Skip to content

fix: surface Bash tool image output instead of dropping it#617

Merged
benbrandt merged 4 commits into
agentclientprotocol:mainfrom
davethedev3:fix/bash-image-output
Jun 19, 2026
Merged

fix: surface Bash tool image output instead of dropping it#617
benbrandt merged 4 commits into
agentclientprotocol:mainfrom
davethedev3:fix/bash-image-output

Conversation

@davethedev3

Copy link
Copy Markdown
Contributor

What's broken

The Bash branch of toolUpdateFromToolResult (src/tools.ts) guards the array-content path on "text" in result[0]. When the local Bash tool produces image content — [{ type: "image", source: { type: "base64", ... } }], e.g. when a command pipes a base64 data URI — the guard rejects the array and output stays empty. The image is silently dropped from the ACP tool_call_update and the client renders nothing.

Fix

Distinguish text-only arrays (existing terminal-stream behavior) from arrays containing non-text blocks. For the latter, bypass the terminal _meta channel (binary payloads can't be streamed through it) and delegate to toAcpContentUpdate so images surface as ACP content blocks.

The change is contained to the Bash case in toolUpdateFromToolResult; no other tool dispatch is affected.

Tests

Three regression tests added in src/tests/tools.test.ts under a new describe("with image array tool_result …"):

  • pure image, supportsTerminalOutput: false — image surfaces as ACP content
  • pure image, supportsTerminalOutput: true_meta is correctly bypassed and image still surfaces
  • mixed text + image — both blocks surface in order

All existing tests pass. Total: 240 → 243.

Validation

  • npm run check
  • npm run build
  • npm run test:run ✅ (243 passed, 13 integration skipped)

dave and others added 4 commits April 30, 2026 05:03
The Bash branch of toolUpdateFromToolResult guarded the array-content
case on `"text" in result[0]`, so when the local Bash tool produced
image content (`[{ type: "image", source: {...} }]`, e.g. piping a
base64 data URI) the array failed the guard and `output` stayed
empty, silently dropping the image.

Distinguish text-only arrays (existing terminal-stream behavior) from
arrays containing non-text blocks. For the latter, bypass the terminal
_meta channel \u2014 binary payloads can't be streamed through it \u2014 and
delegate to toAcpContentUpdate so images surface as ACP content blocks.

Adds three regression tests: pure image (terminal off), pure image
(terminal on, _meta still bypassed), and a mixed text+image case.

@benbrandt benbrandt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@benbrandt benbrandt enabled auto-merge (squash) June 19, 2026 10:27
@benbrandt benbrandt merged commit a759e64 into agentclientprotocol:main Jun 19, 2026
1 check passed
benbrandt pushed a commit that referenced this pull request Jun 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.48.0](v0.47.0...v0.48.0)
(2026-06-19)


### Features

* Agent selection dropdown in config options
([#794](#794))
([5729c47](5729c47))
* **deps:** bump the minor group with 11 updates
([#787](#787))
([ad3b5fe](ad3b5fe))
* Update to claude-agent-sdk 0.3.183
([#791](#791))
([744b2d4](744b2d4))
* Update to new ACP SDK patterns
([#790](#790))
([2554c7b](2554c7b))


### Bug Fixes

* duplicate assistant text when turn activates mid-message
([#789](#789))
([1c80bf8](1c80bf8))
* Skip empty thinking chunks
([#793](#793))
([15fdf26](15fdf26))
* surface Bash tool image output instead of dropping it
([#617](#617))
([a759e64](a759e64))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants