The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
A message typed while Claude Code worked is in the conversation's history (#855)
Deeb48a24788586
diff --git a/cli/src/lib/normalize.test.ts b/cli/src/lib/normalize.test.tsindex 7d9b378eb..c5a1a42fe 100644--- a/cli/src/lib/normalize.test.ts+++ b/cli/src/lib/normalize.test.ts@@ -299,3 +299,34 @@ describe('slash-command prompts', () => {})})})++describe('a message typed while Claude Code worked', () => {+ const queued = (prompt: unknown, kind: string, commandMode = 'prompt') => line({+ type: 'attachment', uuid: `q-${kind}`, attachment: { type: 'queued_command', prompt, commandMode, origin: { kind } },+ })+ const prompt = line({ type: 'user', uuid: 'u1', message: { role: 'user', content: 'run sleep 8, then say three' } })+ const answer = line({ type: 'assistant', uuid: 'a1', message: { role: 'assistant', content: [{ type: 'text', text: 'three\nfour' }], stop_reason: 'end_turn' } })++ it('is in the history where it was delivered, but only the person\'s own words', () => {+ const events = messagesToEvents([+ prompt,+ queued('and then say four', 'human'),+ queued([{ type: 'text', text: 'blocks too' }], 'human'),+ queued('Goal set: ship it', 'auto-continuation'),+ queued('a sub-agent hands back', 'task-notification'),+ queued('/model opus', 'human', 'bash'),+ queued(' ', 'human'),+ answer,+ ])+ expect(events.filter((e) => e.type === 'user_message').map((e) => (e.payload as { content: string }).content))+ .toEqual(['run sleep 8, then say three', 'and then say four', 'blocks too'])+ })++ it('still opens no live turn', () => {+ const state = newTurnState()+ lineToEvents(prompt, state)+ expect(lineToEvents(queued('and then say four', 'human'), state)).toEqual([])+ expect(state.turnOpen).toBe(true)+ })+})+diff --git a/cli/src/lib/normalize.ts b/cli/src/lib/normalize.tsindex 75c6b1ba9..44f7dbb3d 100644--- a/cli/src/lib/normalize.ts+++ b/cli/src/lib/normalize.ts@@ -656,6 +656,24 @@ export function compactEventFromRaw(raw: Record<string, unknown>): SessionEvent[// ── Full replay (session_get) ─────────────────────────────────────────────────────────────────────/** Convert a whole session's raw JSONL lines to replay events (same render path as streaming). */+/**+ * A message the person typed while Claude Code was working. Claude Code delivers it into the running+ * turn as a `queued_command` attachment, not a prompt record. The live view leaves it out on purpose+ * (it opens no turn there), but the history must show it: without it a reopened conversation answered a+ * question it never showed (found by daemon QA with Claude Code 2.1.290). Sub-agent hand-backs and+ * Claude's own continuations arrive the same way, and they are not the person's words.+ */+function queuedHumanPrompt(raw: Record<string, unknown>): string | null {+ if (raw.type !== 'attachment') return null+ const attachment = raw.attachment as { type?: unknown; commandMode?: unknown; prompt?: unknown; origin?: { kind?: unknown } } | undefined+ if (attachment?.type !== 'queued_command' || attachment.commandMode !== 'prompt' || attachment.origin?.kind !== 'human') return null+ const prompt = attachment.prompt+ const text = typeof prompt === 'string' ? prompt+ : Array.isArray(prompt) ? prompt.map((block) => (block as { type?: unknown; text?: unknown })?.type === 'text' ? String((block as { text?: unknown }).text ?? '') : '').join('\n')+ : ''+ return text.trim() ? text : null+}+export function messagesToEvents(rawLines: string[]): SessionEvent[] {const events: SessionEvent[] = []const toolIdToName = new Map<string, string>()@@ -668,6 +686,8 @@ export function messagesToEvents(rawLines: string[]): SessionEvent[] {try { raw = JSON.parse(line) as Record<string, unknown> } catch { continue }const compact = compactEventFromRaw(raw)if (compact) { events.push(...compact); continue } // compact boundary → indicator; summary/meta → suppressed+ const queued = queuedHumanPrompt(raw)+ if (queued) { events.push({ type: 'user_message', payload: { content: queued } }); continue }const msg = transformLine(raw)if (!msg?.message) continue