Add agent host xterm/headless #315407
Draft
anthonykim1 wants to merge 1 commit intomainfrom
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a headless xterm.js-backed terminal mirror inside the Agent Host so the PTY can receive terminal-state query responses (eg cursor position reports) even when no UI terminal is attached.
Changes:
- Introduces
AgentHostHeadlessTerminal, a small wrapper around@xterm/headlessthat mirrors PTY output and forwards only cursor-position responses. - Wires the headless terminal into
AgentHostTerminalManagerto feed PTY output into the mirror and write approved responses back to the PTY. - Adds unit tests covering DSR/DEC DSR responses, filtering, resize/clear behavior, and resilience to write failures.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/test/node/agentHostHeadlessTerminal.test.ts | New unit tests for the headless terminal mirror’s response forwarding and state updates. |
| src/vs/platform/agentHost/node/agentHostTerminalManager.ts | Instantiates and integrates the headless terminal mirror per managed PTY, including resize/clear propagation. |
| src/vs/platform/agentHost/node/agentHostHeadlessTerminal.ts | New headless xterm-based mirror that emits filtered response data for terminal-state queries. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 1
Comment on lines
293
to
+327
| @@ -304,9 +313,18 @@ export class AgentHostTerminalManager extends Disposable implements IAgentHostTe | |||
| contentSize: 0, | |||
| claim, | |||
| commandTracker, | |||
| headlessTerminal, | |||
| }; | |||
|
|
|||
| this._terminals.set(uri, managed); | |||
| store.add(headlessTerminal.onResponseData(data => { | |||
| this._logService.debug(`[TerminalManager] Writing headless terminal response for ${uri}: ${JSON.stringify(data)}`); | |||
| try { | |||
| ptyProcess.write(data); | |||
| } catch (err) { | |||
| this._logService.debug(`[TerminalManager] Failed to write headless terminal response for ${uri}: ${err instanceof Error ? err.message : String(err)}`); | |||
| } | |||
| })); | |||
Contributor
Author
There was a problem hiding this comment.
Yes we should cover test.
Contributor
blocks-ci screenshots changedReplace the contents of Updated blocks-ci-screenshots.md<!-- auto-generated by CI — do not edit manually -->
#### editor/codeEditor/CodeEditor/Dark

#### editor/codeEditor/CodeEditor/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
 |
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.
No description provided.