Skip to content

Add isPty and fold TerminalComplete into ToolResultTerminalContent#352

Merged
anthonykim1 merged 13 commits into
mainfrom
anthonykim1/shellOutputStreaming
Jul 23, 2026
Merged

Add isPty and fold TerminalComplete into ToolResultTerminalContent#352
anthonykim1 merged 13 commits into
mainfrom
anthonykim1/shellOutputStreaming

Conversation

@anthonykim1

@anthonykim1 anthonykim1 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Resolves: #322, #323
Part of: microsoft/vscode#324825

  • Add optional isPty to ToolResultTerminalContent so a client knows whether a terminal is PTY-backed before subscribing or initializing an emulator.
  • Add matching isPty to TerminalState so the channel is self-describing regardless of how a client discovered it; isPty: false means plain-text output and clients do not need to parse VT sequences.
  • Fill exitCode, preview, and truncated in on the terminal block in the completed result, so clients that did not subscribe to the terminal still get the command outcome. This records the command's exit, not the terminal's — the terminal may keep running afterwards.
  • Remove ToolResultTerminalCompleteContent (breaking, riding the 0.7.0 window): its completion data now lives directly on the terminal block it previously correlated with, so clients no longer pair two content blocks per command.
  • Leave cwd off the completion data deliberately — it can be added back additively if a client needs to display it at the top-level terminal part.
  • Keep resource and title required. Per review discussion, non-pty shell runs will be exposed as resource-backed terminals (isPty: false) whose output streams over the terminal channel, so clients receive output only when they subscribe.
  • Add round-trip fixtures 030-terminal-content-ispty and 031-terminal-content-completed, stage added/removed change fragments, and regenerate the JSON schemas and Go/Rust/Kotlin/Swift/TypeScript clients.

Inspirations from:

  • The completion fields are relocated semantically from the removed ToolResultTerminalCompleteContent — same exitCode/preview/truncated shapes and doc intent, moved onto the terminal block.
  • The isPty capability-flag placement on TerminalState follows the existing supportsCommandDetection pattern.
  • The streaming path non-pty terminals will use already exists: terminal/data appends into TerminalState.content, so late subscribers reconstruct output from channel state.
  • The gap this feeds into is VS Code's tool-name sniffing to decide whether partial results are terminal output: isShellTool — the protocol now labels terminal resources instead.

@anthonykim1
anthonykim1 marked this pull request as ready for review July 21, 2026 22:23
@anthonykim1
anthonykim1 marked this pull request as draft July 22, 2026 16:52
Comment thread types/channels-chat/state.ts Outdated
Comment thread types/channels-chat/state.ts Outdated
Comment thread types/channels-chat/state.ts Outdated
@anthonykim1
anthonykim1 marked this pull request as ready for review July 22, 2026 18:11
@anthonykim1
anthonykim1 requested a review from connor4312 July 22, 2026 18:11
@anthonykim1
anthonykim1 marked this pull request as draft July 22, 2026 20:08
@anthonykim1 anthonykim1 changed the title ToolResultTerminalOutputContent for terminal output streaming Add isPty to ToolResultTerminalContent and TerminalState Jul 22, 2026
@anthonykim1 anthonykim1 changed the title Add isPty to ToolResultTerminalContent and TerminalState Add isPty so clients can identify non-PTY terminal resources Jul 22, 2026
@anthonykim1 anthonykim1 changed the title Add isPty so clients can identify non-PTY terminal resources Add isPty and command completion data to ToolResultTerminalContent Jul 22, 2026
@anthonykim1
anthonykim1 marked this pull request as ready for review July 22, 2026 20:59
@anthonykim1 anthonykim1 changed the title Add isPty and command completion data to ToolResultTerminalContent Add isPty and fold TerminalComplete into ToolResultTerminalContent Jul 22, 2026
Comment thread types/channels-chat/state.ts
@anthonykim1
anthonykim1 marked this pull request as draft July 22, 2026 21:07
@anthonykim1
anthonykim1 marked this pull request as ready for review July 23, 2026 07:05
@anthonykim1
anthonykim1 merged commit 1ed58e3 into main Jul 23, 2026
9 checks passed
@anthonykim1
anthonykim1 deleted the anthonykim1/shellOutputStreaming branch July 23, 2026 07:17
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Agent Host Protocol Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Track terminal execution capabilities for PTY and non-PTY command output

2 participants