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(chat): content-only task-notification needs a system/unset promptSource (allowlist)
review9460239214e4
diff --git a/src/core/transcript-reader.test.ts b/src/core/transcript-reader.test.tsindex e28eebbe5..b7c944469 100644--- a/src/core/transcript-reader.test.ts+++ b/src/core/transcript-reader.test.ts@@ -879,7 +879,9 @@ describe('system-injected user records', () => {{ origin: { kind: 'human' } },{ promptSource: 'typed' },{ promptSource: 'queued' },- { promptSource: 'suggestion_accepted' }+ { promptSource: 'suggestion_accepted' },+ { promptSource: 'sdk' },+ { promptSource: 'some-future-human-source' }]) {const msgs = parseChatMessages(userStr(el, extra).split('\n'))expect(msgs).toEqual([{ role: 'user', parts: [{ kind: 'text', text: el }] }])@@ -1100,7 +1102,7 @@ describe('system-injected user records', () => {const fill = (unit: string): string => unit.repeat(Math.ceil(SIZE / unit.length))const hex4 = (i: number): string => (i % 65536).toString(16).padStart(4, '0')// Generous on purpose (a loaded CI box), and still an order of magnitude under any quadratic time.- const BOUND_MS = 1500+ const BOUND_MS = 5000const cases: Array<[string, string]> = [['unclosed paste opens, one id', userStr(fill('<pasted_content id="0a1b">\nx'), { origin: { kind: 'human' } })],[diff --git a/src/core/transcript-reader.ts b/src/core/transcript-reader.tsindex 54cd32d69..fa281bf73 100644--- a/src/core/transcript-reader.ts+++ b/src/core/transcript-reader.ts@@ -190,8 +190,11 @@ const originKind = (origin: unknown): string | undefined => {return typeof k === 'string' ? k : undefined}-/** `promptSource` values that mean a human sent the record (measured on CLI 2.1.285). */-const HUMAN_PROMPT_SOURCES: ReadonlySet<string> = new Set(['typed', 'queued', 'suggestion_accepted'])+/** The only `promptSource` values a content-only (origin-less) task-notification may carry: none, or+ * `system`. An ALLOWLIST, not a list of human sources — a human source added later (`sdk` already+ * exists, 132 records measured) must never turn a human's pasted element into a chip. Every real+ * notification measured (1,693, CLI 2.1.209–2.1.286) carries `origin.kind` AND `promptSource:"system"`. */+const systemOrUnsetSource = (source: unknown): boolean => source === undefined || source === 'system'/** The first line of the trimmed text, trimmed, capped like a tool arg. */const firstLine = (text: string): string => capArg(text.trim().split('\n')[0])@@ -296,8 +299,10 @@ export function classifySystemRecord(content: string): SystemRecord | null {const kind = originKind(rec.origin)- const human = typeof rec.promptSource === 'string' && HUMAN_PROMPT_SOURCES.has(rec.promptSource)- if (kind === 'task-notification' || (kind === undefined && !human && isWholeTaskNotification(content))) {+ if (+ kind === 'task-notification' ||+ (kind === undefined && systemOrUnsetSource(rec.promptSource) && isWholeTaskNotification(content))+ ) {return taskNotification(content)}if (kind === 'peer') return peerMessage(content)diff --git a/src/shared/chat-system-records.ts b/src/shared/chat-system-records.tsindex 533d5787d..407b9551a 100644--- a/src/shared/chat-system-records.ts+++ b/src/shared/chat-system-records.ts@@ -56,7 +56,7 @@ export function fencePasted(body: string): string {/*** Every paste span in typed text → `fencePasted(body)`, left to right. A span's body ends at the- * FIRST close marker with the same id at or after the body's start (the CLI's own `indexOf`). Text+ * FIRST close marker with the same id at or after the body's start (close to, but deliberately not exactly, the CLI's `o_t`: an empty body and an unclosed open stay as typed here — the CLI's writer never emits either, so ports must NOT "correct" toward the CLI). Text* outside the spans is kept as typed; an open with no matching close is left alone.*/export function expandPastedContent(text: string): string {