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

@@ -447,7 +447,15 @@ describe('the run_code dispatch bridge', () => {
it('presents the pending call as a generic execute card carrying the program, and the result with the captured output', async () => {
const { ctx } = await setup({ mode: 'code' })
const tool = ctx.tools.get(RUN_CODE_NAME)!
expect(tool.presentCall?.({ code: 'return 1' })).toEqual({ card: 'generic', title: 'Run code', kind: 'execute', rawInput: 'return 1' })
expect(tool.presentCall?.({ code: 'return 1' })).toEqual({
card: 'generic',
title: 'Run code',
kind: 'execute',
rawInput: 'return 1',
// The program rides the card BODY as a fenced block — visible in ACP
// clients that never open the rawInput detail view.
content: [{ type: 'text', text: '```ts\nreturn 1\n```' }],
})
const view = tool.presentResult?.({ code: 'return 1' }, {
content: [{ type: 'text', text: 'model-facing' }],
isError: false,