YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(chat): live sidebar dot pulses while current-chat streams
Louis Beaumont20a0e69e4533
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsxindex c5ced958e..3426fffa8 100644--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx@@ -43,6 +43,7 @@ import { commands } from "@/lib/utils/tauri";import { emit } from "@tauri-apps/api/event";import { useChatConversations } from "@/components/hooks/use-chat-conversations";import { useChatStore } from "@/lib/stores/chat-store";+import { statusForEvent } from "@/lib/stores/pi-event-router";import { getCurrentWindow } from "@tauri-apps/api/window";import { getCurrentWebview } from "@tauri-apps/api/webview";import { usePlatform } from "@/lib/hooks/use-platform";@@ -2682,6 +2683,29 @@ export function StandaloneChat({const handlePiEventData = (data: any) => {+ // Mirror status into the chat-store so the sidebar dot reflects what+ // Pi is actually doing. The bus routes foreground events exclusively+ // to this listener, so the router (default subscriber) never sees+ // them — without this mirror, session.status stays at whatever was+ // set last time the chat was on the background path (usually+ // "idle"), and the sidebar shows a hollow gray ring while the+ // chat is mid-stream. Mirroring covers all of: streaming /+ // thinking / tool / idle / error per `statusForEvent`.+ try {+ const sid = piSessionIdRef.current;+ const next = sid ? statusForEvent(data) : null;+ if (sid && next) {+ const store = useChatStore.getState();+ const cur = store.sessions[sid]?.status;+ if (cur !== next) {+ store.actions.patch(sid, { status: next });+ }+ }+ } catch {+ /* defensive — never let a status-mirror failure break the+ foreground event handler */+ }+if (data.type === "message_update" && data.assistantMessageEvent) {const evt = data.assistantMessageEvent;if (evt.type === "text_delta" && evt.delta) {diff --git a/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts b/apps/screenpipe-app-tauri/lib/stores/pi-event-router.tsindex e9d40c3ec..d2f1a4143 100644--- a/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts+++ b/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts@@ -79,8 +79,17 @@ type PiInnerEvent = AgentInnerEvent;/** Map a raw event type to a SessionStatus. Returns null when the event* doesn't carry a status signal (e.g. `tool_execution_end` is ambiguous —* could go back to streaming or end the turn entirely; we wait for the- * next definitive event). */-function statusForEvent(evt: PiInnerEvent): SessionStatus | null {+ * next definitive event).+ *+ * Exported so the foreground chat panel can mirror status updates into+ * the store on its own — the bus routes foreground events exclusively+ * to the panel listener (see `bus.ts:dispatchEvent`), so the router+ * never sees them and never gets a chance to patch the store. Without+ * this mirror the sidebar dot stays at whatever status was set last+ * time the session was on the background path (usually `idle`),+ * causing the user-visible bug "I'm in the chat and it's gray instead+ * of pulsing while streaming". */+export function statusForEvent(evt: PiInnerEvent): SessionStatus | null {switch (evt.type) {case "agent_start":case "turn_start":