Skip to content

Tag command stdout/stderr as command_output_message#36

Merged
jackcbrown89 merged 3 commits intomainfrom
jb-stdout-per-command
Apr 26, 2026
Merged

Tag command stdout/stderr as command_output_message#36
jackcbrown89 merged 3 commits intomainfrom
jb-stdout-per-command

Conversation

@jackcbrown89
Copy link
Copy Markdown
Contributor

@jackcbrown89 jackcbrown89 commented Apr 26, 2026

Summary

  • Introduces a command_output_message wire type so command stdout/stderr is no longer conflated with agent assistant_message text. Each chunk carries stream ("stdout"/"stderr"), text, and the originating command.
  • Python client adds on_command_output to QueryOptions and ExecuteCommandsOptions. on_assistant_message continues to carry agent text only.
  • Both runtimeuse and runtimeuse-client bumped 0.13.0 → 0.14.0.

Why

When pre/post commands or execute_commands produce output, callers currently can't tell command stdout/stderr apart from agent reasoning, can't tell stdout from stderr, and can't tie a chunk back to the command that produced it. This blocks per-command logging policies (e.g. routing setup-command output somewhere different from agent text).

Test plan

  • TS: npm test in packages/runtimeuse — 143/143 pass
  • TS: npm run typecheck — clean
  • Python: uv run pytest test/test_client.py -q — 47/47 pass (3 new tests in TestCommandOutputMessage)
  • Imports / instantiation smoke-test of CommandOutputMessageInterface, OnCommandOutputCallback, on_command_output field

Notes

  • assistant_message is unchanged and still used by agent handlers via MessageSender.sendAssistantMessage.
  • Old clients that only listen on on_assistant_message will no longer see command output (they'd previously get it disguised as agent text). That's the intended cleanup; pair any consumer upgrade with wiring on_command_output.
  • silent flag is not added — visibility decisions move to the receiver via on_command_output.

Note

Medium Risk
Medium risk because it changes the wire protocol and client callback surface for streamed command output; older clients listening only to assistant_message will stop seeing pre/post/command-only output unless updated.

Overview
Introduces a new command_output_message wire type so stdout/stderr from pre/post-invocation commands and execute_commands is no longer sent as assistant_message, and now includes stream (stdout/stderr), text, and originating command.

Updates the Python client to handle and expose this via a new on_command_output callback (with a lightweight hot-path dispatch), adds CommandOutputMessageInterface/OnCommandOutputCallback, and adjusts tests/examples/docs accordingly. Bumps both runtimeuse and runtimeuse-client versions to 0.14.0.

Reviewed by Cursor Bugbot for commit 0c28a91. Bugbot is set up for automated code reviews on this repo. Configure here.

Previously, command stdout and stderr were emitted as assistant_message
text_blocks, indistinguishable from agent text on the receiving side.
This commit introduces a dedicated command_output_message wire type that
carries the stream ("stdout" or "stderr"), the chunk of text, and the
originating command string.

The Python client gains an on_command_output callback on QueryOptions
and ExecuteCommandsOptions; on_assistant_message remains for agent text.
Bumps both packages to 0.14.0.
@jackcbrown89 jackcbrown89 force-pushed the jb-stdout-per-command branch from 1f05832 to b2a519a Compare April 26, 2026 18:41
@jackcbrown89 jackcbrown89 merged commit 17b9f61 into main Apr 26, 2026
6 checks passed
@jackcbrown89 jackcbrown89 deleted the jb-stdout-per-command branch April 26, 2026 19:50
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.

1 participant