diff --git a/extensions/ask-user-choice.ts b/extensions/ask-user-choice.ts index 4f078eb4e..f436ebb09 100644 --- a/extensions/ask-user-choice.ts +++ b/extensions/ask-user-choice.ts @@ -322,7 +322,9 @@ export default function askUserChoice(pi: ExtensionAPI): void { if (details?.selection) { return new Text(theme.fg("success", `✓ ${details.selection.index}. ${details.selection.label}`), 0, 0); } - if (details?.customResponse !== undefined) return new Text(theme.fg("success", "✓ Custom response"), 0, 0); + if (details?.customResponse !== undefined) { + return new Text(theme.fg("success", `✓ Custom response — ${details.customResponse}`), 0, 0); + } return new Text(theme.fg("warning", "Cancelled"), 0, 0); }, }); diff --git a/tests/ask-user-choice.test.ts b/tests/ask-user-choice.test.ts index ae93cd1a1..f509e5af5 100644 --- a/tests/ask-user-choice.test.ts +++ b/tests/ask-user-choice.test.ts @@ -711,3 +711,17 @@ test("ask_user_choice is offered on an interactive rpc host and withdrawn once t for (const hook of registration.hooks) await hook({}, { mode: "rpc" }); assert.deepEqual(registration.activeTools(), ["read"]); }); + +test("ask_user_choice transcript shows the custom response text the user typed", () => { + const { tool } = registerChoiceTool(); + const renderResult = (tool as unknown as { + renderResult: (result: unknown, options: unknown, theme: ChoiceTheme) => { render(width: number): string[] }; + }).renderResult; + const theme: ChoiceTheme = { fg: (_color, text) => text, bg: (_color, text) => text, bold: (text) => text }; + const rendered = renderResult( + { content: [], details: { question: "Explain?", options, customResponse: "use the staging bucket" } }, + {}, + theme, + ).render(100).join("\n"); + assert.equal(stripTerminalSequences(rendered).trimEnd(), "✓ Custom response — use the staging bucket"); +});