anomalyco / anomalyco/opencode

[FEATURE]: Custom tools: Support incremental output streaming during execution

Open
#38,373 0 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Jul 22, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Feature hasn't been suggested before.
  • I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request

Problem

Custom tools can only return a complete result from execute() — there's no mechanism to stream incremental output to the TUI while the tool is running. Built-in tools like bash stream stdout/stderr progressively, but custom tools show nothing until they finish.

Current behavior

  1. tool-call event → tool enters running state
  2. (silence)
  3. tool-result event → full output appears at once

Expected behavior

Custom tools should be able to emit incremental output during execution, rendered progressively in the TUI.

Use case

Any custom tool that dispatches long-running commands (test suites, builds, deployments, remote execution) produces output over minutes. The user needs to see progress to know the tool is working and to catch issues early.

Possible approaches

  1. Streaming HTTP response — the tool reads a chunked/SSE response and the framework renders chunks as they arrive
  2. Plugin API extension — add a stream callback to ToolContext that the tool can call incrementally (similar to how ctx.metadata() works for metadata)
  3. Polling — the tool periodically updates output via a new ctx.output() method

Context

The bash tool achieves streaming through special processor handling that captures child process stdout/stderr incrementally. Custom tools have no equivalent path — execute() returns Promise<ToolResult>, a single value. The ctx.metadata() method (added in #7590) streams metadata but not the actual output content.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.