fix(dsh-plugin-browserskill): keep the terminal result card for multi-block results

browser_screenshot on an image-capable route returns text + image
blocks; the shared result presenter required exactly one text block and
bailed to the generic card (tool name + raw args). Project the first
text block instead so the terminal card shows in both modes.
This commit is contained in:
BB-fat
2026-08-13 18:06:57 +00:00
parent 54869cabd0
commit 0771292336
2 changed files with 16 additions and 1 deletions
@@ -81,7 +81,9 @@ function cmdline(deps: ToolDeps, args: string[]): string {
/** Shared completed-card presenter: terminal card with the rendered text. */
function presentTerminalResult(_args: never, result: ToolResult) {
const block = result.content.length === 1 ? result.content[0] : undefined;
// Multi-block results (e.g. screenshot text + image) still project their
// text block onto the terminal card.
const block = result.content.find((b) => b.type === "text");
if (block === undefined || block.type !== "text") return undefined;
if (result.isError) return undefined;
return { card: "terminal" as const, output: block.text, exitCode: 0 };