Tag command stdout/stderr as command_output_message#36
Merged
jackcbrown89 merged 3 commits intomainfrom Apr 26, 2026
Merged
Conversation
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.
1f05832 to
b2a519a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
command_output_messagewire type so command stdout/stderr is no longer conflated with agentassistant_messagetext. Each chunk carriesstream("stdout"/"stderr"),text, and the originatingcommand.on_command_outputtoQueryOptionsandExecuteCommandsOptions.on_assistant_messagecontinues to carry agent text only.runtimeuseandruntimeuse-clientbumped 0.13.0 → 0.14.0.Why
When pre/post commands or
execute_commandsproduce 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
npm testinpackages/runtimeuse— 143/143 passnpm run typecheck— cleanuv run pytest test/test_client.py -q— 47/47 pass (3 new tests inTestCommandOutputMessage)CommandOutputMessageInterface,OnCommandOutputCallback,on_command_outputfieldNotes
assistant_messageis unchanged and still used by agent handlers viaMessageSender.sendAssistantMessage.on_assistant_messagewill no longer see command output (they'd previously get it disguised as agent text). That's the intended cleanup; pair any consumer upgrade with wiringon_command_output.silentflag is not added — visibility decisions move to the receiver viaon_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_messagewill stop seeing pre/post/command-only output unless updated.Overview
Introduces a new
command_output_messagewire type so stdout/stderr from pre/post-invocation commands andexecute_commandsis no longer sent asassistant_message, and now includesstream(stdout/stderr),text, and originatingcommand.Updates the Python client to handle and expose this via a new
on_command_outputcallback (with a lightweight hot-path dispatch), addsCommandOutputMessageInterface/OnCommandOutputCallback, and adjusts tests/examples/docs accordingly. Bumps bothruntimeuseandruntimeuse-clientversions to0.14.0.Reviewed by Cursor Bugbot for commit 0c28a91. Bugbot is set up for automated code reviews on this repo. Configure here.