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(relay): the card modal's transcript search follows relayStatusGates
reviewd72a36ca9519
diff --git a/CLAUDE.md b/CLAUDE.mdindex 9a943b3b7..94c7c07ae 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -10389,11 +10389,11 @@ invariants:lifetime and feeds `applyAgentEvent` into that session's keyless store(`getSessionStores(id).agentStatus`). Routing is by api, never by a project lookup: two relaysessions may serve one project id. **A reader of a team tab's node must not ask the default- store** (the ones that still do are the doc's follow-ups): after Share with team the handed-off- SSH project (local session, default store) and its team tab (relay session) hold the SAME node- ids, so a reader that asked the default store, or the active project's, shows one project's status- on the other's node, and a restart that read it would quit a host session the badge shows as- RUNNING. Readers resolve per project+ store** (the known ones that still do are the doc's follow-ups): after Share with team the+ handed-off SSH project (local session, default store) and its team tab (relay session) hold the+ SAME node ids, so a reader that asked the default store, or the active project's, shows one+ project's status on the other's node, and a restart that read it would quit a host session the+ badge shows as RUNNING. Readers resolve per project(`agentStatusForProject`; `useAgentStatusLookup` / `useAgentStatusSig` re-subscribe inside thesession-registry listener, so a reconnect that leaves the signature unchanged still moves them tothe new store) or per node (`useSessionStores()`, render-safe for a session disposed a moment@@ -10410,8 +10410,9 @@ invariants:ONLY `stateAt = now - ageMs`, never `lastEventAt` / `lastSeen`: the joiner saw no transition, anda fabricated one would claim it did. The teardown empties the store, so a dropped tab readsUnknown. The status-driven readers that act on THIS machine are off for a relay node- (`relayStatusGates`: Approve/Deny, title sync, transcript search, the ⌘M chat view); only- `'local'` runs them, and `'relay'`, `'server'` and an unknown source fail closed. A desktop Team+ (`relayStatusGates`: Approve/Deny, title sync, transcript search, the ⌘M chat view; the card+ modal's `ModalTerminal` gates its transcript search the same way); only `'local'` runs them, and+ `'relay'`, `'server'` and an unknown source fail closed. A desktop TeamAccess host's agent emits go through `corePlatform.broadcast` (its window plus every non-quietpeer); `agent:unread-clear` stays main-window only. Mobile: N/A (the phone speaks the legacydialect and reads the mirror file). Follow-ups, including the Canvas-level readers still on thediff --git a/docs/hosted-team-relay.md b/docs/hosted-team-relay.mdindex 3556a18b0..843756b5b 100644--- a/docs/hosted-team-relay.md+++ b/docs/hosted-team-relay.md@@ -659,7 +659,9 @@ holds for a hosted team's tabs and for a Team Access relay tab alike: both openApprove/Deny (they answer this machine's permission server, which holds no ticket for the host'ssession), the session-title sync (it would rewrite the host's canvas from every tab that shows thenode), the find bar's transcript search and the ⌘M chat view (both read this machine's- transcripts). ⌘M keeps the Markdown output view.+ transcripts). ⌘M keeps the Markdown output view. The kanban card modal gates its find bar's+ transcript search the same way (`ModalTerminal`); its ⌘M chat view reads through the tab's relay+ api, which refuses transcript reads (`E_UNSUPPORTED`), and the view says so.- **A dropped or closed tab reads Unknown.** The teardown ends the subscription and empties thestore; a frame that arrives afterwards writes nothing.- **Mobile:** N/A. The phone speaks the legacy relay dialect and reads the host's agent-status@@ -685,6 +687,11 @@ holds for a hosted team's tabs and for a Team Access relay tab alike: both openswitch eligibility (`lib/nodeActionItems.tsx`), bulk pause, the Eco plan, `stationNoticeWiring`,`loopCard`, the app badge count (Dock / taskbar), the sidebar row's account-chip "multipleidentities" check, and the focused-node skip of "next needing you".+- The project tab's pause badge ("⏸ N", `usePauseCounts` in `state/pauseCounts.ts`) counts from+ this desktop's store by bare node id: a team tab shows the handed-off SSH project's paused nodes as+ its own, and a shallow pause made on the team tab never shows there.+- The node menu's Transfer submenu takes the session id from this desktop's store+ (`lib/nodeActionItems.tsx`), not the team tab's.- The status-grouped sidebar lists a node id once (`buildStatusList` dedups by bare id), so ashared id shows one row when both the handed-off SSH project and the team tab are open.- A shallow pause made on a team tab lives in the tab's in-memory store and does not survive adiff --git a/src/renderer/components/kanban/ModalTerminal.tsx b/src/renderer/components/kanban/ModalTerminal.tsxindex 2cedcf6b9..5b6bd31f6 100644--- a/src/renderer/components/kanban/ModalTerminal.tsx+++ b/src/renderer/components/kanban/ModalTerminal.tsx@@ -21,6 +21,7 @@ import { focusXtermUnlessCovered, useMdModeFocus } from '../../terminal/useMdModimport { FindBar } from '../FindBar'import { useProjects } from '../../state/projects'import { isRemoteProjectId, useSession, useSessionStores } from '../../session/session'+import { relayStatusGates } from '../../terminal/relay-status-gates'import { REMOTE_PROJECT_SPAWN_REFUSAL, spawnBelongsElsewhere, useOwningProjectId } from '../../session/owning-project'import { isHostedReadOnly } from '../../state/hostedTeams'import { useSettings } from '../../state/settings'@@ -159,6 +160,9 @@ export function ModalTerminal({}: ModalTerminalProps) {const session = useSession()const { api } = session+ // MIRROR TerminalNode: which status-driven readers this viewer may run (relay-status-gates.ts) —+ // all of them on the local session, none on a relay / team tab, whose status is its host's.+ const gates = relayStatusGates(session.source)// The agent status of the session this card's project runs under (mounted through// `ProjectSessionScope`), never the default store: a team tab's node shares its id with the// handed-off SSH project, whose entry is the default store's.@@ -265,8 +269,10 @@ export function ModalTerminal({accountId: effectiveAccountId(spawn.accountId, observedAccount, claudeAccounts),// MIRROR TerminalNode: the transcript index reads claude's JSONL through claude's resolver, so// it is gated on the claude-transcript fact, NOT on the context meter's `hasUsage` (which now- // spans codex and gemini too) — see lib/transcriptGates.ts.- searchTranscript: readsClaudeTranscript(spawn.agentId),+ // spans codex and gemini too) — see lib/transcriptGates.ts. And on `gates.transcriptSearch`: it+ // reads THIS machine's transcripts (`window.nodeTerminal.claude`), never a relay host's, and a+ // team tab's card holds the HOST's session id.+ searchTranscript: gates.transcriptSearch && readsClaudeTranscript(spawn.agentId),open: searchOpen,readBuffer})diff --git a/src/renderer/components/kanban/modal-terminal-gates.source.test.ts b/src/renderer/components/kanban/modal-terminal-gates.source.test.tsnew file mode 100644index 000000000..19741841f--- /dev/null+++ b/src/renderer/components/kanban/modal-terminal-gates.source.test.ts@@ -0,0 +1,35 @@+import { describe, expect, it } from 'vitest'+import { readFileSync } from 'node:fs'+import { resolve } from 'node:path'+import { relayStatusGates } from '../../terminal/relay-status-gates'++/**+ * The card modal's terminal viewer runs the same status-gated reader the canvas node does (bug D).+ * Since it reads the card's session store, a team tab's card holds the HOST's agent session id, and+ * its find bar's transcript leg reads `window.nodeTerminal.claude.readTranscript` — THIS machine's+ * transcripts. So it is gated by `relayStatusGates(session.source).transcriptSearch`, exactly like+ * TerminalNode's (pinned in nodes/terminal-agent-status.source.test.ts). Source pins: ModalTerminal+ * has no render harness (every CardModal test mocks it).+ */+const src = readFileSync(resolve(__dirname, 'ModalTerminal.tsx'), 'utf8').replace(/\r\n/g, '\n')++describe("the card modal's transcript search is gated like the node's", () => {+ it('derives the gates from the session the modal renders under', () => {+ expect(src).toContain("import { relayStatusGates } from '../../terminal/relay-status-gates'")+ expect(src).toMatch(/const session = useSession\(\)\n\s*const \{ api \} = session/)+ expect(src).toMatch(/const gates = relayStatusGates\(session\.source\)/)+ })++ it('ANDs gates.transcriptSearch into the one searchTranscript site', () => {+ const sites = src.split('\n').filter((l) => l.includes('searchTranscript:'))+ expect(sites).toHaveLength(1)+ expect(sites[0].trim()).toBe('searchTranscript: gates.transcriptSearch && readsClaudeTranscript(spawn.agentId),')+ })++ it('a relay-scoped modal searches no transcript; a local one still does', () => {+ // The value the site above computes, for a claude card (readsClaudeTranscript = true).+ expect(relayStatusGates('relay').transcriptSearch && true).toBe(false)+ expect(relayStatusGates('server').transcriptSearch && true).toBe(false)+ expect(relayStatusGates('local').transcriptSearch && true).toBe(true)+ })+})