Stream built-in shell output over AHP terminal channel#327090
Closed
anthonykim1 wants to merge 18 commits into
Closed
Stream built-in shell output over AHP terminal channel#327090anthonykim1 wants to merge 18 commits into
anthonykim1 wants to merge 18 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5083fb1f-34d7-44bf-82a1-c4582e57683b
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5083fb1f-34d7-44bf-82a1-c4582e57683b
…t over the terminal channel - Re-vendor agent-host-protocol: terminalComplete removed, exitCode/preview/truncated fold into terminal.result (TerminalCommandResult), isPty added to ToolResultTerminalContent and TerminalState - shell_exit now lands on the tool call's terminal block; history replay synthesizes a non-pty block keyed by toolCallId - Stream tool.execution_partial_result into an output-only agenthost-terminal channel (isPty false) instead of replacing Text content - Normalize LF to CRLF in AgentHostPty when the channel is plain text - Re-apply local CompletionItem.label extension clobbered by the protocol sync (still needs upstreaming)
The runtime emits cumulative plain-text snapshots (ANSI-stripped, throttled) that are capped to the leading ~10KB with a growing truncation marker, so a length-based delta goes stale once output exceeds the cap. Track the last emitted snapshot and prefix-check it: extend in place while the snapshot grows, reset the channel and rewrite when it was rewritten.
Pty-backed channels already carry CRLF because the pty converts output line endings; do the same for output-only channels at the point data enters the channel, so terminal frontends render both identically and AgentHostPty needs no isPty-specific handling. Reverts the client-side normalization.
Contributor
There was a problem hiding this comment.
Pull request overview
Streams cumulative shell output from Copilot SDK bash and powershell calls into running Agent Host tool invocations.
Changes:
- Emits content-change actions for tracked shell partial results.
- Preserves non-text tool content and ignores irrelevant events.
- Adds focused unit coverage.
Show a summary per file
| File | Description |
|---|---|
copilotAgentSession.ts |
Forwards tracked shell output snapshots. |
copilotAgentSession.test.ts |
Tests cumulative, untracked, and non-shell events. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Medium
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.
Related: microsoft/agent-host-protocol#352
Resolves: #324825
Part of: #323399
Adopts the terminal completion model from microsoft/agent-host-protocol#352 and supersedes the cumulative-Text approach from #326291.
terminalComplete, moveexitCode/preview/truncatedonto the terminal block asresult, and addisPtyto terminal tool results and terminal state.tool.execution_partial_resultevents into output-only AHP terminal channels for runtime-executed shell tools, while leaving client-hosted PTY terminals on their existing path.shell_completedsupplies the real exit code.ITerminalInstance, adding a root terminal entry, opening a bottom-panel terminal, or exposing terminal Focus/Show actions.terminalCompleteblocks.CompletionItem.labelextension from Config-action slash commands for Copilot agent-host chat inputs #326807 after protocol generation. The generated snapshot still needs a final.ahp-versionsync after Add isPty and fold TerminalComplete into ToolResultTerminalContent agent-host-protocol#352 lands.Inspirations from:
isPtyandresult: TerminalCommandResultshapes come from the protocol change itself:ToolResultTerminalContent/TerminalCommandResultandTerminalState.isPty.copilotAgentSession.AgentHostTerminalManager._handlePtyData.copilotShellTools.ChatTerminalToolProgressPart._attachAhpCommandSource.