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 fix/chat-plan-body
review34064ea1dad1
diff --cc src/core/transcript-reader.test.tsindex 4c25194f8,dbf7c3841..5a6371cd4--- a/src/core/transcript-reader.test.ts+++ b/src/core/transcript-reader.test.ts@@@ -313,56 -313,45 +313,99 @@@ describe('readChatWindow — byte windo})})+// ─────────────────────────────────────────────────────────────────────────────────────────────+// Tool bodies: a plan (ExitPlanMode) or a question (AskUserQuestion) is the content the user needs+// to read, not a chip. Must ride BOTH the legacy and the paged parse, keys/carried results unchanged.+// ─────────────────────────────────────────────────────────────────────────────────────────────+const PLAN = '# Plan\n\n1. Read the plan\n2. Render it'+const planUse = (id: string): string =>+ jl({+ type: 'assistant',+ message: { content: [{ type: 'tool_use', id, name: 'ExitPlanMode', input: { plan: PLAN } }] }+ })++describe('tool bodies in the chat parse', () => {+ it('the legacy parser attaches the plan as the tool body (and nothing else changes)', () => {+ const msgs = parseChatMessages((planUse('p1') + toolResult('p1', 'User approved')).split('\n'))+ expect(msgs).toEqual([+ { role: 'assistant', parts: [{ kind: 'tool', name: 'ExitPlanMode', arg: '', body: PLAN, result: 'User approved' }] }+ ])+ })++ it('the paged parser attaches the same body, keeps the id and the key', () => {+ const r = parseChatWindow(Buffer.from(planUse('p1') + toolResult('p1', 'User approved')), 0)+ expect(r.messages).toEqual([+ {+ role: 'assistant',+ key: 0,+ parts: [{ kind: 'tool', name: 'ExitPlanMode', arg: '', body: PLAN, id: 'p1', result: 'User approved' }]+ }+ ])+ })++ it('a plan whose answer lands in a newer page still carries its result by id', () => {+ const older = planUse('p2')+ const file = Buffer.from(older + toolResult('p2', 'User rejected'))+ const split = Buffer.byteLength(older)+ const newest = parseChatWindow(file.subarray(split - 1), split - 1)+ expect(newest.unmatchedResults).toEqual([{ id: 'p2', result: 'User rejected' }])+ const olderPage = parseChatWindow(file.subarray(0, split), 0)+ expect(olderPage.messages[0].parts[0]).toMatchObject({ kind: 'tool', id: 'p2', body: PLAN })+ })++ it('a tool with no body keeps today\'s shape exactly (no body key)', () => {+ const msgs = parseChatMessages(toolUse('t1', 'ls').split('\n'))+ expect(msgs[0].parts[0]).toEqual({ kind: 'tool', name: 'Bash', arg: 'ls' })+ })++ it('the search index includes the plan text so the find bar can find it', () => {+ const lines = parseTranscriptLines(planUse('p1'))+ expect(lines).toEqual([+ { role: 'tool', text: '$ ExitPlanMode' },+ { role: 'tool', text: PLAN }+ ])+ })+})+++ // The title poll runs every 4–15 s per agent node, and each poll used to read + parse a 128 KB+ // tail. The name can only change when the transcript does, so an unchanged (size, mtime) must+ // answer from the cache without touching the file's bytes — while a /rename (the file grows)+ // must still be picked up on the next poll.+ describe('readSessionName — unchanged transcripts are not re-read', () => {+ const sid = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'+ const custom = (t: string) => JSON.stringify({ type: 'custom-title', customTitle: t, sessionId: sid })+ let home: string+ let file: string++ beforeEach(() => {+ home = fs.mkdtempSync(path.join(os.tmpdir(), 'nt-title-cache-'))+ vi.spyOn(os, 'homedir').mockReturnValue(home)+ const dir = path.join(home, '.claude', 'projects', '-proj')+ fs.mkdirSync(dir, { recursive: true })+ file = path.join(dir, `${sid}.jsonl`)+ fs.writeFileSync(file, custom('First') + '\n')+ })++ afterEach(() => {+ vi.restoreAllMocks()+ fs.rmSync(home, { recursive: true, force: true })+ })++ // readSmallTail reads a small file with readFile and a large one with open+read — spy on both,+ // so "no tail read" holds whichever branch the fixture size lands on.+ it('does not re-read an unchanged transcript', async () => {+ const readFile = vi.spyOn(fs.promises, 'readFile')+ const open = vi.spyOn(fs.promises, 'open')+ expect(await readSessionName(sid)).toBe('First')+ const reads = readFile.mock.calls.length + open.mock.calls.length+ expect(reads).toBeGreaterThan(0)+ expect(await readSessionName(sid)).toBe('First')+ expect(readFile.mock.calls.length + open.mock.calls.length).toBe(reads)+ })++ it('re-reads after the transcript changes (e.g. /rename)', async () => {+ expect(await readSessionName(sid)).toBe('First')+ fs.appendFileSync(file, custom('Second') + '\n')+ expect(await readSessionName(sid)).toBe('Second')+ })+ })