[PR #13589] feat(acp): stream bash tool output during execution #14727

Open
opened 2026-02-16 18:19:29 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13589

State: open
Merged: No


Summary

Streams partial bash output through ACP during tool execution, enabling real-time feedback for ACP clients.

Fixes #5024

Changes

In packages/opencode/src/acp/agent.ts, added rawOutput to the "running" status update (8 lines total, 4 per case):

case "running":
  await this.connection.sessionUpdate({
    sessionId,
    update: {
      // ... existing fields ...
      rawInput: part.state.input,
      // NEW: Stream partial output during execution
      rawOutput: part.state.metadata?.output
        ? { output: part.state.metadata.output }
        : undefined,
    },
  })

Background

The bash tool already updates ctx.metadata() with stdout on each chunk (line 179 in bash.ts), but this metadata was not being forwarded through ACP during the "running" state. Only "completed" and "error" states included rawOutput.

Use Case

Any ACP client that wants to show users what is happening during long-running bash commands:

  • Chat interfaces (Slack, Discord, Matrix bots)
  • Web UIs with live terminal output
  • IDE integrations showing command progress

Without this change, users see nothing until the command finishes. With this change, they see output line-by-line as it is produced.

Testing

Tested with opencode-chat-bridge, an ACP client that bridges OpenCode to Matrix chat rooms.

use bash to: echo "Starting..."; sleep 2; echo "Still working..."; sleep 2; echo "Done!"

Before: All output appears after 4 seconds.
After: Each line appears at 0s, 2s, and 4s respectively.

image
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13589 **State:** open **Merged:** No --- ## Summary Streams partial bash output through ACP during tool execution, enabling real-time feedback for ACP clients. Fixes #5024 ## Changes In `packages/opencode/src/acp/agent.ts`, added `rawOutput` to the "running" status update (8 lines total, 4 per case): ```typescript case "running": await this.connection.sessionUpdate({ sessionId, update: { // ... existing fields ... rawInput: part.state.input, // NEW: Stream partial output during execution rawOutput: part.state.metadata?.output ? { output: part.state.metadata.output } : undefined, }, }) ``` ## Background The bash tool already updates `ctx.metadata()` with stdout on each chunk (line 179 in `bash.ts`), but this metadata was not being forwarded through ACP during the "running" state. Only "completed" and "error" states included `rawOutput`. ## Use Case Any ACP client that wants to show users what is happening during long-running bash commands: - Chat interfaces (Slack, Discord, Matrix bots) - Web UIs with live terminal output - IDE integrations showing command progress Without this change, users see nothing until the command finishes. With this change, they see output line-by-line as it is produced. ## Testing Tested with [opencode-chat-bridge](https://github.com/ominiverdi/opencode-chat-bridge), an ACP client that bridges OpenCode to Matrix chat rooms. ``` use bash to: echo "Starting..."; sleep 2; echo "Still working..."; sleep 2; echo "Done!" ``` Before: All output appears after 4 seconds. After: Each line appears at 0s, 2s, and 4s respectively. <img width="587" height="338" alt="image" src="https://github.com/user-attachments/assets/d4cba7ca-eb40-415d-9709-b98269d73c8f" />
yindo added the pull-request label 2026-02-16 18:19:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14727