Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(context): persist context-window store so the meter survives app restart
enescf76a1af59bb
diff --git a/src/renderer/state/contextWindow.ts b/src/renderer/state/contextWindow.tsindex ebafc1ade..585bd716a 100644--- a/src/renderer/state/contextWindow.ts+++ b/src/renderer/state/contextWindow.ts@@ -1,14 +1,46 @@import { create } from 'zustand'import type { ContextWindowUsage } from '@shared/types'-// Transient (not persisted): per-session context-window fill, fed by context.onUpdate.+// Per-session context-window fill, fed by context.onUpdate.+//+// Persisted to localStorage (like agentStatus' sessionId). Why: after an app restart the+// node's sessionId is restored, but its tmux Claude session is now idle and emits no new+// hook event — so the main-process tailer is never re-fed the transcript path and can't+// re-push until the next prompt. Without persistence the meter would vanish on every restart+// even though the session (and its fill) is unchanged. We restore the last-known value so the+// meter survives the restart; the live tailer overwrites it on the next prompt.+const KEY = 'nodeterm.contextWindow'++function load(): Record<string, ContextWindowUsage> {+ try {+ const raw = localStorage.getItem(KEY)+ if (!raw) return {}+ const data = JSON.parse(raw) as Record<string, ContextWindowUsage>+ return data && typeof data === 'object' ? data : {}+ } catch {+ return {}+ }+}++function save(bySessionId: Record<string, ContextWindowUsage>): void {+ try {+ localStorage.setItem(KEY, JSON.stringify(bySessionId))+ } catch {+ // ignore quota / serialization errors+ }+}+interface ContextWindowState {bySessionId: Record<string, ContextWindowUsage>set(usage: ContextWindowUsage): void}export const useContextWindow = create<ContextWindowState>((set) => ({- bySessionId: {},+ bySessionId: load(),set: (usage) =>- set((s) => ({ bySessionId: { ...s.bySessionId, [usage.sessionId]: usage } }))+ set((s) => {+ const bySessionId = { ...s.bySessionId, [usage.sessionId]: usage }+ save(bySessionId)+ return { bySessionId }+ })}))