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
Merge origin/main into feat/chat-answers
review1c1a99cdf97d
diff --cc src/renderer/state/agentStatus.test.tsindex 302c0dece,d1269f4a0..c70d25a6e--- a/src/renderer/state/agentStatus.test.ts+++ b/src/renderer/state/agentStatus.test.ts@@@ -351,32 -351,55 +351,85 @@@ describe('the verified evidence for a t})})+describe('held permission request (structured answers)', () => {+ const plan = { pendingId: 'n-1-1', toolName: 'ExitPlanMode' }+ const question = { pendingId: 'n-2-2', toolName: 'AskUserQuestion' }++ it('is kept on blocked AND on waiting (a held picker is broadcast as waiting), cleared on leaving', () => {+ const s = useAgentStatus.getState()+ const id = nid()+ s.setState(id, 'blocked', 'claude', false, 'n-1-1', true, false, plan)+ expect(useAgentStatus.getState().byId[id].held).toEqual(plan)+ const q = nid()+ s.setState(q, 'waiting', 'claude', false, undefined, true, false, question)+ expect(useAgentStatus.getState().byId[q].held).toEqual(question)+ expect(useAgentStatus.getState().byId[q].pendingId).toBeUndefined() // approve/deny stays off+ s.setState(id, 'working', 'claude', false)+ expect(useAgentStatus.getState().byId[id].held).toBeUndefined()+ })++ it('a NEW held request on a same-state re-assert retargets (breaks the in-place fast path)', () => {+ const s = useAgentStatus.getState()+ const id = nid()+ s.setState(id, 'waiting', 'claude', false, undefined, true, false, question)+ const again = { pendingId: 'n-3-3', toolName: 'AskUserQuestion' }+ s.setState(id, 'waiting', 'claude', false, undefined, true, false, again)+ expect(useAgentStatus.getState().byId[id].held).toEqual(again)+ // A re-assert with no held info keeps the current one.+ s.setState(id, 'waiting', 'claude', false)+ expect(useAgentStatus.getState().byId[id].held).toEqual(again)+ })+})+++ describe('onHookEvent — a per-node pulse for EVERY hook event, same-state ones included', () => {+ it('a same-state event notifies no zustand subscriber (the in-place fast path) — which is why the pulse exists', () => {+ const id = nid()+ useAgentStatus.getState().setState(id, 'working', 'claude', true)+ const sub = vi.fn()+ const unsub = useAgentStatus.subscribe(sub)+ useAgentStatus.getState().setState(id, 'working', 'claude')+ expect(sub).not.toHaveBeenCalled()+ unsub()+ })++ it('fires for transitions and same-state events of that node only, and unsubscribes', () => {+ const id = nid()+ const other = nid()+ const cb = vi.fn()+ const unsub = useAgentStatus.getState().onHookEvent(id, cb)+ useAgentStatus.getState().setState(id, 'working', 'claude', true)+ useAgentStatus.getState().setState(id, 'working', 'claude')+ useAgentStatus.getState().setState(other, 'working', 'claude', true)+ expect(cb).toHaveBeenCalledTimes(2)+ unsub()+ useAgentStatus.getState().setState(id, 'done', 'claude')+ expect(cb).toHaveBeenCalledTimes(2)+ })++ it('a throwing listener neither aborts setState nor starves the next listener', () => {+ const id = nid()+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})+ const bad = useAgentStatus.getState().onHookEvent(id, () => {+ throw new Error('boom')+ })+ const good = vi.fn()+ const unsub = useAgentStatus.getState().onHookEvent(id, good)+ expect(() => useAgentStatus.getState().setState(id, 'working', 'claude', true)).not.toThrow()+ expect(good).toHaveBeenCalledOnce()+ expect(useAgentStatus.getState().byId[id]?.state).toBe('working')+ bad()+ unsub()+ warn.mockRestore()+ })++ it('sees the store already updated when it fires', () => {+ const id = nid()+ let seen: string | undefined+ const unsub = useAgentStatus.getState().onHookEvent(id, () => {+ seen = useAgentStatus.getState().byId[id]?.state+ })+ useAgentStatus.getState().setState(id, 'working', 'claude', true)+ expect(seen).toBe('working')+ unsub()+ })+ })diff --cc src/renderer/state/agentStatus.tsindex 00e6f3ab7,91c0d7846..20cc0c5e3--- a/src/renderer/state/agentStatus.ts+++ b/src/renderer/state/agentStatus.ts@@@ -270,9 -258,16 +270,17 @@@ export interface AgentStatusStorenewTurn?: boolean,pendingId?: string,verified?: boolean,- errored?: boolean+ errored?: boolean,+ held?: HeldPermission): void+ /**+ * Subscribe to EVERY hook event `setState` records for node `id` — same-state ones included, and+ * only once the store already reflects it. A zustand selector cannot see those: the same-state+ * fast path refreshes `stateAt` IN PLACE and returns the same state object, so no subscriber is+ * notified (deliberately — a notification per tool event would re-run every header's selector).+ * This side channel is how the ⌘M panel refreshes its tail while a turn runs. Returns unsubscribe.+ */+ onHookEvent(id: string, cb: () => void): () => void/** Clear `working` entries whose last event is older than `staleMs` (lost-Stop safety net). */sweepStaleWorking(staleMs?: number): voidsetSession(id: string, session: string): void@@@ -517,7 -538,7 +551,7 @@@ export function createAgentStatusSessioreturn s.activeId === id ? { activeId: null } : s}),- setState: (id, state, agentId, newTurn, pendingId, verified, errored, held) =>- setState: (id, state, agentId, newTurn, pendingId, verified, errored) => {++ setState: (id, state, agentId, newTurn, pendingId, verified, errored, held) => {set((s) => {const prev = s.byId[id] ?? EMPTYconst now = Date.now()