From 0065bb4afcc3cdfb618fcc7b7b15db35ba6f60e3 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Mon, 19 Jan 2026 13:46:51 -0800 Subject: [PATCH] fix: reconnect bug, don't greet on reconnects (#43) ### Explanation _No response_ ### Issue _No response_ ### Attestations - [ ] I have read and agree to the [Code of Conduct](https://docs.nhcarrigan.com/community/coc/) - [ ] I have read and agree to the [Community Guidelines](https://docs.nhcarrigan.com/community/guide/). - [ ] My contribution complies with the [Contributor Covenant](https://docs.nhcarrigan.com/dev/covenant/). ### Dependencies - [ ] I have pinned the dependencies to a specific patch version. ### Style - [ ] I have run the linter and resolved any errors. - [ ] My pull request uses an appropriate title, matching the conventional commit standards. - [ ] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request. ### Tests - [ ] My contribution adds new code, and I have added tests to cover it. - [ ] My contribution modifies existing code, and I have updated the tests to reflect these changes. - [ ] All new and existing tests pass locally with my changes. - [ ] Code coverage remains at or above the configured threshold. ### Documentation _No response_ ### Versioning _No response_ Reviewed-on: https://git.nhcarrigan.com/nhcarrigan/hikari-desktop/pulls/43 Co-authored-by: Naomi Carrigan Co-committed-by: Naomi Carrigan --- src/lib/components/PermissionModal.svelte | 6 ++++-- src/lib/tauri.ts | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/components/PermissionModal.svelte b/src/lib/components/PermissionModal.svelte index 12a41e3..63df096 100644 --- a/src/lib/components/PermissionModal.svelte +++ b/src/lib/components/PermissionModal.svelte @@ -51,8 +51,10 @@ await new Promise((resolve) => setTimeout(resolve, 500)); await invoke("start_claude", { - workingDir: workingDirectory || "/home/naomi", - allowedTools: newGrantedTools, + options: { + working_dir: workingDirectory || "/home/naomi", + allowed_tools: newGrantedTools, + }, }); // Wait for connection to establish diff --git a/src/lib/tauri.ts b/src/lib/tauri.ts index a747089..69f5461 100644 --- a/src/lib/tauri.ts +++ b/src/lib/tauri.ts @@ -11,6 +11,8 @@ interface StateChangePayload { tool_name: string | null; } +let hasConnectedThisSession = false; + function getTimeOfDay(): string { const hour = new Date().getHours(); @@ -65,12 +67,16 @@ export async function initializeTauriListeners() { if (status === "connected") { claudeStore.addLine("system", "Connected to Claude Code"); characterState.setState("idle"); - // Send greeting when connection is established - await sendGreeting(); + if (!hasConnectedThisSession) { + hasConnectedThisSession = true; + await sendGreeting(); + } } else if (status === "disconnected") { + hasConnectedThisSession = false; claudeStore.addLine("system", "Disconnected from Claude Code"); characterState.setState("idle"); } else if (status === "error") { + hasConnectedThisSession = false; claudeStore.addLine("error", "Connection error"); characterState.setTemporaryState("error", 3000); }