Skip to content

agentHost: integrate terminals with tool call#308866

Merged
connor4312 merged 4 commits intomainfrom
connor4312/ah-terminals-2
Apr 9, 2026
Merged

agentHost: integrate terminals with tool call#308866
connor4312 merged 4 commits intomainfrom
connor4312/ah-terminals-2

Conversation

@connor4312
Copy link
Copy Markdown
Member

We need proper command detection to make this work flawlessly, but this does the initial hookup replacing the copilot SDK's terminal tools with our tools which are backed by real PTY's.

We need proper command detection to make this work flawlessly, but this
does the initial hookup replacing the copilot SDK's terminal tools with
our tools which are backed by real PTY's.
@connor4312 connor4312 self-assigned this Apr 9, 2026
Copilot AI review requested due to automatic review settings April 9, 2026 20:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Screenshot Changes

Base: 763d8945 Current: 2cfdda7d

Changed (83)

chat/aiCustomizations/aiCustomizationManagementEditor/WelcomePage/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/LocalHarness/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/CliHarness/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/Sessions/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/SessionsSkillsTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpServersTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/AgentsTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/SkillsTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/InstructionsTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/WelcomePage/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/LocalHarness/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/CliHarness/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/Sessions/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/SessionsSkillsTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpServersTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/AgentsTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/SkillsTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/InstructionsTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/HooksTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/HooksTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/PromptsTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/PluginsTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/PromptsTabScrolled/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpServersTabScrolled/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/PluginsTabScrolled/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpServersTabNarrow/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/AgentsTabNarrow/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/PromptsTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/PluginsTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/PromptsTabScrolled/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpServersTabScrolled/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/PluginsTabScrolled/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpServersTabNarrow/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/AgentsTabNarrow/Light
Before After
before after
editor/inlineChatAffordance/InlineChatAffordance/Light
Before After
before after
editor/inlineChatAffordance/InlineChatOverlay/Light
Before After
before after
editor/inlineCompletions/other/HintsToolbar/Light
Before After
before after
editor/inlineCompletions/other/HintsToolbarHovered/Light
Before After
before after
editor/inlineCompletions/other/JumpToHint/Light
Before After
before after
editor/inlineCompletions/other/NextFileEditSuggestion/Light
Before After
before after
editor/inlineCompletions/views/SideBySideViewSmall/Light
Before After
before after
editor/inlineCompletions/views/SideBySideViewWide/Light
Before After
before after
editor/inlineCompletions/views/WordReplacementView/Light
Before After
before after
editor/inlineChatAffordance/InlineChatAffordance/Dark
Before After
before after
editor/inlineChatAffordance/InlineChatOverlay/Dark
Before After
before after
editor/inlineCompletions/other/HintsToolbar/Dark
Before After
before after
editor/inlineCompletions/other/HintsToolbarHovered/Dark
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after
editor/inlineCompletions/other/NextFileEditSuggestion/Dark
Before After
before after
editor/inlineCompletions/views/SideBySideViewSmall/Dark
Before After
before after
editor/inlineCompletions/views/SideBySideViewWide/Dark
Before After
before after
editor/inlineCompletions/views/WordReplacementView/Dark
Before After
before after
editor/inlineCompletions/views/DeletionView/Dark
Before After
before after
editor/inlineCompletions/views/LineReplacementView/Dark
Before After
before after
editor/multiDiffEditor/MultiDiffEditor/Dark
Before After
before after
editor/suggestWidget/MethodCompletions/Dark
Before After
before after
editor/suggestWidget/MixedKinds/Dark
Before After
before after
peekReference/PeekReferences/Dark
Before After
before after
agentSessionsViewer/NeedsInput/Dark
Before After
before after
editor/inlineCompletions/views/DeletionView/Light
Before After
before after
editor/inlineCompletions/views/LineReplacementView/Light
Before After
before after
editor/multiDiffEditor/MultiDiffEditor/Light
Before After
before after
editor/suggestWidget/MethodCompletions/Light
Before After
before after
editor/suggestWidget/MixedKinds/Light
Before After
before after
peekReference/PeekReferences/Light
Before After
before after
agentSessionsViewer/ApprovalRowJson/Light
Before After
before after
agentSessionsViewer/ApprovalRowBash/Light
Before After
before after
agentSessionsViewer/ApprovalRowPowerShell/Light
Before After
before after
agentSessionsViewer/ApprovalRowLongLabel/Light
Before After
before after
agentSessionsViewer/ApprovalRow1Line/Light
Before After
before after
agentSessionsViewer/ApprovalRow2Lines/Light
Before After
before after
agentSessionsViewer/ApprovalRow3Lines/Light
Before After
before after
agentSessionsViewer/ApprovalRow4Lines/Light
Before After
before after
agentSessionsViewer/ApprovalRow3LongLines/Light
Before After
before after
agentSessionsViewer/ApprovalRowJson/Dark
Before After
before after
agentSessionsViewer/ApprovalRowBash/Dark
Before After
before after
agentSessionsViewer/ApprovalRowPowerShell/Dark
Before After
before after
agentSessionsViewer/ApprovalRowLongLabel/Dark
Before After
before after
agentSessionsViewer/ApprovalRow1Line/Dark
Before After
before after
agentSessionsViewer/ApprovalRow2Lines/Dark
Before After
before after
agentSessionsViewer/ApprovalRow3Lines/Dark
Before After
before after
agentSessionsViewer/ApprovalRow4Lines/Dark
Before After
before after
agentSessionsViewer/ApprovalRow3LongLines/Dark
Before After
before after

Added (8)

chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePageClassic/Dark

current

chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePagePromptLaunchers/Dark

current

chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePageSelectorClassic/Dark

current

chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePageSelectorPromptLaunchers/Dark

current

chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePageClassic/Light

current

chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePagePromptLaunchers/Light

current

chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePageSelectorClassic/Light

current

chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePageSelectorPromptLaunchers/Light

current

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 wires agent-host tool calls to real, PTY-backed terminals by introducing a shared terminal service on the renderer side and overriding Copilot SDK shell tools on the agent-host side to use the agent host terminal manager.

Changes:

  • Add IAgentHostTerminalService to create/revive agent-host terminals and update AgentHostPty to support “attach-only” mode for tool-owned terminals.
  • Extend chat tool invocation rendering by introducing an observable toolSpecificDataKind, and refactor agent-host session handling to revive/register terminals for tool calls and support “Continue in Background”.
  • Add PTY-backed shell tool overrides (bash/powershell + companion tools) using a per-session ShellManager, and expose the agent-host terminal manager via DI.
Show a summary per file
File Description
src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts Registers IAgentHostTerminalService singleton.
src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.ts New service to create/revive terminals backed by AgentHostPty.
src/vs/workbench/contrib/terminal/browser/agentHostTerminalContribution.ts Switches profile creation to use IAgentHostTerminalService.
src/vs/workbench/contrib/terminal/browser/agentHostPty.ts Adds attachOnly option to avoid creating/disposing tool-owned terminals.
src/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatToolInvocation.ts Tracks toolSpecificData.kind via observable to trigger re-render.
src/vs/workbench/contrib/chat/common/chatService/chatService.ts Adds toolSpecificDataKind to IChatToolInvocation.
src/vs/workbench/contrib/chat/browser/widget/.../chatToolInvocationPart.ts Re-renders tool invocation part when data kind changes.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts Exposes terminal URI detection + adds terminal tool session id into terminal tool data.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts Revives/registers agent-host terminals for tool calls; “continue in background” claim narrowing; refactors turn processing.
src/vs/platform/agentHost/node/agentHostTerminalManager.ts Exposes terminal events/content APIs; supports specifying shell executable.
src/vs/platform/agentHost/node/agentService.ts Exposes terminal manager instance for agent providers.
src/vs/platform/agentHost/node/agentHost{Main,ServerMain}.ts Registers IAgentHostTerminalManager in DI.
src/vs/platform/agentHost/node/copilot/copilotShellTools.ts New PTY-backed shell tool overrides + ShellManager.
src/vs/platform/agentHost/node/copilot/copilotToolDisplay.ts Adds isShellTool and unwraps custom-tool shell args for display/input.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Creates ShellManager per session and injects shell tools into SDK session config.
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Disposes ShellManager; normalizes permission kinds; includes terminal content refs for shell tools on completion.
src/vs/platform/agentHost/common/state/sessionReducers.ts Removes VS Code-specific tool metadata helpers.
src/vs/workbench/contrib/chat/test/... Updates mocks to satisfy new toolSpecificDataKind requirement.
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts Adjusts session construction for new ctor parameter.
.vscode/launch.json Improves agent-host attach debugging and adds compound config.

Copilot's findings

  • Files reviewed: 24/24 changed files
  • Comments generated: 3

@connor4312 connor4312 marked this pull request as ready for review April 9, 2026 20:57
@connor4312 connor4312 enabled auto-merge April 9, 2026 20:59
roblourens
roblourens previously approved these changes Apr 9, 2026
mjbvz
mjbvz previously approved these changes Apr 9, 2026
@connor4312 connor4312 dismissed stale reviews from mjbvz and roblourens via 93a9f97 April 9, 2026 22:20
@connor4312 connor4312 merged commit baa9c85 into main Apr 9, 2026
26 checks passed
@connor4312 connor4312 deleted the connor4312/ah-terminals-2 branch April 9, 2026 22:55
@vs-code-engineering vs-code-engineering bot added this to the 1.116.0 milestone Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants