feat: surface the run_code program in the ACP tool-call card

The generated program rode only rawInput — the detail/expanded slot
many ACP clients never open — so the code a run executed was invisible
in the UI stream. presentCall now also carries it as a fenced ts block
in the card's content, which the bridge already forwards as tool_call
content. The two code-mode snapshot goldens are re-recorded live and
replay green; the presentation unit test pins the fenced block.
This commit is contained in:
Tianyi Cui
2026-07-09 20:56:44 +08:00
parent a4553cc10d
commit 2c03b2bc29
6 changed files with 359 additions and 352 deletions

View File

@@ -289,7 +289,17 @@ export function createRunCodeTool(registry: ToolRegistry, requireRuntime: () =>
exec.signal?.removeEventListener('abort', onOuterAbort)
}
},
presentCall: args => ({ card: 'generic', title: 'Run code', kind: 'execute', rawInput: args.code }),
// The program IS the call: surface it as an always-visible fenced block in
// the card body (rawInput alone lands in detail/expanded views many
// clients never open). Fence collisions are impossible to break rendering
// — a backtick run inside the program at worst ends the block early.
presentCall: args => ({
card: 'generic',
title: 'Run code',
kind: 'execute',
rawInput: args.code,
content: [{ type: 'text', text: `\`\`\`ts\n${args.code}\n\`\`\`` }],
}),
presentResult: (_args, result) => {
const meta = asRunCodeMeta(result.meta)
if (!meta) return undefined