-
Notifications
You must be signed in to change notification settings - Fork 37.3k
implement chat terminal streaming #285985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements real-time streaming of terminal command output in chat interactions. The implementation monitors terminal events (cursor movement, line feeds, data writes) and incrementally updates the displayed output in the chat interface, rather than waiting for the command to complete before showing results.
Key Changes
- Made terminal markers optional in
getRangeAsVT()to support streaming scenarios where start/end positions may not be immediately available - Refactored
DetachedTerminalCommandMirrorto add streaming capabilities via event listeners and incremental VT sequence appending - Enhanced command resolution to support commands that are currently executing (not just finished commands)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts | Made startMarker parameter optional and added validation to handle disposed markers (line === -1) |
| src/vs/workbench/contrib/terminal/browser/terminal.ts | Updated getRangeAsVT interface signature and documentation to reflect optional start marker |
| src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts | Major refactoring: removed base class, added streaming infrastructure with cursor tracking, dirty range management, and incremental VT updates |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts | Added support for resolving executing commands and listening to command execution events for real-time updates |
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
...rib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
49474d9 to
ed10bcf
Compare
Tyriar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great!
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
Maybe calls for a setting, perhaps let's wait to see some real world cases to see if we can avoid a setting or do something more clever. |
264432c to
ed10bcf
Compare
|
@Tyriar fixed the height issue When terminal output was streaming in, the height of the output element was sometimes incorrect (too small) for the initial lines.
Now, line count is calculated by:
This ensures the height is never too small. If the terminal buffer hasn't fully updated its cursor position yet, the text-based count provides a floor value. demo.mov |
fixes #271390
onCommandExecutedonDatawe track cursor movement and dirty ranges so we can append new VT sequences instead of rewriting the full buffer.