fix: reconnect bug, don't greet on reconnects #43

Merged
naomi merged 2 commits from fix/reconnect into main 2026-01-19 13:46:52 -08:00
Showing only changes of commit bcbda1baa4 - Show all commits
+8 -2
View File
@@ -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);
}