Commit Graph

489 Commits

Author SHA1 Message Date
Rob Lourens
98f15b55ea Implement agentHost process (#296627)
* agent host init

* Agent host: Copilot SDK integration with chat UI

* Agent host: direct MessagePort, logging, SDK wrapper, env fix

* Refactoring and cleanup

* Copilot-authored message: Agent-host tool rendering, protocol, and session fixes

Tool invocation rendering:
- Emit tool_start/tool_complete as ChatToolInvocation (not progressMessage)
- Shell tools (bash/powershell) render as terminal command blocks with
  IChatTerminalToolInvocationData, output, and exit codes
- Non-shell tools render via invocationMessage/pastTenseMessage (markdown)
- Filter out report_intent (hidden internal tool)

Agent-agnostic protocol:
- IPC events carry display-ready fields (displayName, invocationMessage,
  pastTenseMessage, toolInput, toolOutput, toolKind, language)
- All Copilot CLI-specific logic in copilotToolDisplay.ts with typed
  interfaces for known tools (CopilotToolName enum, parameter types)
- Renderer never references specific SDK tool names

Session fixes:
- Resumed sessions show tool invocations in history (getSessionMessages
  now returns tool events alongside messages)
- Fixed 'already has a pending request' on resumed sessions by
  conditionally providing interruptActiveResponseCallback
- Fixed event filtering for resumed sessions (sessionId override in
  _trackSession)

Documentation:
- Split parity.md into design.md (decisions) and backlog.md (tasks)
- Updated architecture.md, sessions.md with cross-references
- Added maintenance notes to all docs

* Copilot-authored message: Model picker, session class, DI and test cleanup

* Cleanups

* stuff

* add diagram

* Add claude agent

* Clean up

* Copy some build script changes from #295817

* Simplify

* Update docs

* Register agent-host via chatSessions contribution API, reduce peripheral diff

* Cleanup

* Don't ship stuff in stable

* Dynamic agent discovery via listAgents() IPC

Replace hardcoded per-provider contributions with a single
AgentHostContribution that discovers available agents from the
agent host process at startup. Each IAgent backend now exposes
an IAgentDescriptor with display metadata and auth requirements.

- Add IAgentDescriptor interface and listAgents() to IPC contract
- CopilotAgent/ClaudeAgent return descriptors via getDescriptor()
- Single AgentHostContribution discovers + registers dynamically
- Remove agentHostConstants.ts (no more hardcoded session types)
- AgentHostSessionListController/LMProvider take params instead
- Rename AgentSessionProviders.AgentHost -> AgentHostCopilot
- Update architecture.md, sessions.md, backlog.md

(Written by Copilot)

* Fix review findings: proxy, disposal, filtering, tests

- Add listAgents() forwarding to AgentHostServiceClient
- Guard async discovery against disposal race
- Add provider field to IAgentModelInfo for per-provider filtering
- Filter models and sessions by provider in LM provider and list
  controller
- Update tests for new dynamic API and agent-host-copilot scheme

(Written by Copilot)

* Use DI for AgentHostLanguageModelProvider

(Written by Copilot)

* Strip @img/sharp native binaries from builds

sharp is a transitive dependency of the Claude Agent SDK used for
image processing. Its native .node binaries cause dpkg-shlibdeps
errors during Debian packaging due to $ORIGIN RPATH references.
Strip all @img/sharp-* platform packages since the agent host
doesn't need image processing at runtime.

(Written by Copilot)

* Strip Claude SDK vendored ripgrep binaries

The Claude Agent SDK bundles ripgrep binaries for all platforms
under vendor/ripgrep/. Wrong-architecture binaries cause macOS
Mach-O verification to fail. Strip them entirely via .moduleignore
(VS Code has its own ripgrep) and add to verify-macho skip list.

(Written by Copilot)

* Add tests for AgentSession, AgentService dispatcher, and workbench agent host components

(Written by Copilot)

* Add trace logging, IPC output channel, tool permissions, and attachment context

- Add Agent Host IPC output channel (only registered at trace log level) that
  logs all IPC method calls, results, and progress events with full JSON payloads
- Add trace-level logging in AgentService dispatcher for all method calls
- Add trace-level logging in session handler for all progress events and session
  resolution
- Wire up onPermissionRequest handler on CopilotClient.createSession and
  resumeSession to auto-approve tool permission requests
- Add IAgentAttachment type to IPC contract and thread attachments from chat
  variables (file, directory, selection) through sendMessage to the Copilot SDK

(Written by Copilot)

* Add tests for attachment context conversion and threading

(Written by Copilot)

* Add gap analysis docs for Copilot and Claude SDK implementations

(Written by Copilot)

* Sanitize env vars for Copilot CLI subprocess

Strip VSCODE_*, ELECTRON_* (except ELECTRON_RUN_AS_NODE), NODE_OPTIONS, and
other debug-related env vars that can interfere with the Node.js process the
SDK spawns. Matches the env sanitization from the extension implementation.
Also set useStdio and autoStart for proper CLI communication.

(Written by Copilot)

* Add error, usage, and title_changed event types to IPC contract

Add IAgentErrorEvent, IAgentUsageEvent, and IAgentTitleChangedEvent to the
progress event union. Wire up session.error and assistant.usage events from
the Copilot SDK to fire as IPC events instead of only logging. Handle error
events in the renderer session handler by rendering the error message. Usage
and title_changed events are logged at trace level.

(Written by Copilot)

* Add abortSession IPC method for proper cancellation

Add abortSession(session) to the IPC contract, implemented across AgentService,
CopilotAgent (calls session.abort()), ClaudeAgent (no-op, uses AbortController),
and the renderer proxy. Wire up cancellation in the session handler to call
abortSession before finishing, so the SDK actually stops processing.

(Written by Copilot)

* Address reviewer feedback: error finishes request, Claude abort, tests

- Error events now call finish() so the request doesn't hang if the SDK
  doesn't send idle after an error
- ClaudeAgent.abortSession calls ClaudeSession.abort() which signals the
  AbortController and creates a new one for future turns
- Add test: cancellation calls abortSession on the agent host service
- Add test: error event renders message and finishes the request
- Remove stale TODO in interruptActiveResponseCallback
- Use timeout() helper instead of raw setTimeout in test
- Update gap docs to reflect completed work

(Written by Copilot)

* Add permission request IPC round-trip (Written by Copilot)

* Remove Claude agent from agent-host process

Strip the Claude Agent SDK integration from the agent-host utility process
to focus on the Copilot SDK path.

- Delete src/vs/platform/agent/node/claude/ (claudeAgent, claudeSession, claudeToolDisplay)
- Remove @anthropic-ai/claude-agent-sdk from package.json
- Remove AgentHostClaude enum member and all switch cases
- Remove Claude command registration in electron-browser chat.contribution
- Clean up build scripts (.moduleignore, verify-macho, gulpfile.vscode)
- Narrow AgentProvider type to just 'copilot'
- Update tests and documentation

(Written by Copilot)

* Wire up permission confirmation UI with ChatToolInvocation (Written by Copilot)

* Fix reviewer feedback: safe permission serialization, deny on abort/dispose (Written by Copilot)

* Forward reasoning events as thinking blocks (Written by Copilot)

* Pass workspace folder as workingDirectory to Copilot SDK (Written by Copilot)

* Store and pass workingDirectory on session resume, update gap docs (Written by Copilot)

* Fix permission rendering, session-scoped permissions, and test gaps (Written by Copilot)

* Auto-approve read permissions inside workspace folder (Written by Copilot)

* Move read auto-approve into CopilotAgent where permission policy belongs (Written by Copilot)

* Update gap docs (Written by Copilot)

* Use log language for IPC output channel, add trace prefix (Written by Copilot)

* Add tool rendering gaps to docs (Written by Copilot)

* Stringify URIs in IPC output channel for readability (Written by Copilot)

* Fix IPC output channel: use log languageId with non-log channel for proper append + syntax highlighting (Written by Copilot)

* Fix build errors: add URI import, fix test mock types (Written by Copilot)

* Don't localize agent host provider strings (Written by Copilot)

* Remove claude-agent-sdk from eslint allowed imports (Written by Copilot)

* fix test

* initial thoughts

* Rename folder to agentHost

* Fix paths

* Fixes

* Fixes for copilot

* Fix moduleignore

* first working protocol version

align more closely with protocol

json rpc and some gaps

* cleanup

* Fix copilot pty.node packaging

* Fix test

* prebuild packaging

* Agenthost server fixes

* Update monaco.d.ts

* Update docs

* Fixes

* Build fix

* Fix build issues

* reduce duplication in side effecting code

* fix model switching not working

* reduce mock duplication

* Build fixes

* Copy vscode's node.pty

* And ripgrep

* And thsi

* Ripgrep goes to non-SDK

* Skip copy for stable build

* Remove outdated script

* Build fixes for asar

* fix

* Add some logging

* Fix for windows

* Fix

* Logs

* build: add glob diagnostic for copyCopilotNativeDeps

* build: check both node_modules/ and .asar.unpacked/ for source binaries

* Fix

* Remove excalidraw

---------

Co-authored-by: Connor Peet <connor@peet.io>
Co-authored-by: Connor Peet <copeet@microsoft.com>
2026-03-16 15:33:31 -07:00
Osvaldo Ortega
f22a90205c Updates 2026-03-10 15:48:52 -07:00
Osvaldo Ortega
6012003733 Move TS test files to src/vs/sessions/test/
The test/e2e/ directory was too deep for TypeScript to resolve imports
back to src/vs/. Move to test/ (one level up) where imports work.

E2E runner scripts (.cjs) and scenarios stay in test/e2e/.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 14:03:51 -08:00
Osvaldo Ortega
02d5d0ed10 Move test files to src/vs/sessions/test/e2e/
Keeps all E2E test code (mocks, runners, scenarios, extensions) in one
place, separate from production Sessions code. Updates import paths,
server path, and ESLint config.

Note: ESLint import-patterns warnings remain because the relative
imports from test/e2e/ depth don't match the restriction glob syntax.
This is cosmetic — the imports are valid TypeScript.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 13:58:54 -08:00
Osvaldo Ortega
4d61c82ede Add Approach 2: Service overrides for E2E mock testing
New files:
- web.test.ts: TestSessionsBrowserMain with MockChatEntitlementService
- web.test.factory.ts: Factory using TestSessionsBrowserMain
- sessions.web.test.internal.ts: Test entry point

Server uses test entry point when --mock, which injects a mock
IChatEntitlementService returning ChatEntitlement.Free with
installed=true, so Sessions thinks the user is signed in.

Also adds ESLint import patterns for sessions web entry points.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 11:57:48 -08:00
Osvaldo Ortega
7fc071c83b Use mock-fs:// scheme instead of github-remote-file://
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 11:46:28 -08:00
Osvaldo Ortega
4b72d7e678 Open mock workspace folder when --mock is used
Pre-sets the workspace to github-remote-file://mock-repo/ so the
Sessions UI starts with a folder already open, backed by the mock
file system provider from the E2E extension.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 11:44:57 -08:00
Osvaldo Ortega
fafc62f5ac Add mock web extension for E2E testing
New extension at extensions/sessions-e2e-mock/ provides:
- Mock GitHub auth provider (fake token, skips sign-in)
- Mock chat participant (canned responses based on input keywords)
- Mock file system for github-remote-file:// (in-memory files)

Server loads the extension when --mock flag is passed. The generate
and test runners both use --mock automatically.

New npm scripts:
- serve:mock — opens Sessions in browser with mocks loaded

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 11:34:34 -08:00
Osvaldo Ortega
c677691c87 Add --skip-welcome flag to web server and serve script
The serve script now opens with ?skip-sessions-welcome to bypass
the sign-in overlay during manual testing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 11:16:31 -08:00
Osvaldo Ortega
55fe7db35d Add multiple Playwright YAML configuration files for session management UI
- Created new YAML files to define the structure and components of the session management interface.
- Included various toolbars, buttons, and alerts to enhance user interaction.
- Implemented features such as session actions, agent sessions, and folder picker options.
- Ensured accessibility with appropriate cursor pointers and disabled states for buttons.
2026-03-03 18:31:32 -08:00
Osvaldo Ortega
692fb00057 Refactor: update isSessionsWindow getter to use payload for dynamic value 2026-03-02 22:21:51 -08:00
Osvaldo Ortega
4ee10a3e48 Refactor: update getSessionsHTML to improve CSS module handling and file root definition 2026-03-02 21:26:06 -08:00
Osvaldo Ortega
63073c972b Refactor: update CSS module collection to use tinyglobby and add fallback for recursive file search 2026-03-02 20:14:34 -08:00
Osvaldo Ortega
4b93e8fe0e Fix: update open function call to use default export for URL opening 2026-03-02 18:54:51 -08:00
Osvaldo Ortega
71eca7dfec Add Sessions web entry point and supporting scripts for session management 2026-03-02 18:48:46 -08:00
Robo
d112b3987e chore: update application name logic for win32 scripts (#295777) 2026-02-17 15:13:55 +00:00
Robo
b3669c244f ci: fix electron download from test steps (#292811)
* ci: fix electron download from test steps

* build: always repackage electron from oss entry scripts
2026-02-04 16:37:20 +01:00
Robo
d0e516655a fix: rename product executable on macOS (#291948)
* fix: rename product executable name on macOS

* chore: update test/automation/src/electron.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: update test/automation/src/electron.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: rename in additional places

* chore: rename in code-perf.js

* chore: create symlink for backwards compatibility

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-03 14:50:21 -08:00
Henning Dieterichs
4f9b1f6593 Deletes unused playground-server. (#286718)
The monaco dev playground now uses vite.
2026-01-09 11:43:06 +00:00
Benjamin Pasero
fe665a91f6 watcher - update to latest version (#286484) 2026-01-09 07:07:37 +01:00
Dmitriy Vasyura
c8fdd1650c Update TextMate grammars from upstream sources (#286560)
* Update TextMate grammars from upstream sources
* Fix integration test on Windows to run TypeScript file directly
* Baseline update
2026-01-08 16:24:04 +00:00
Daniel Imms
30d2a293f8 Merge pull request #285312 from microsoft/tyriar/xterm_20251229
xterm@6.1.0-beta.56
2025-12-29 05:22:20 -08:00
Benjamin Pasero
43b3987e74 debt - adopt @vscode/watcher with some newer fixes (#285247) 2025-12-29 03:57:05 -08:00
Daniel Imms
ad3a9ff488 xterm@6.1.0-beta.56
Fixes #285138
Part of #285180
Fixes #252449
Fixes #230120
2025-12-29 03:39:30 -08:00
Matt Bierner
65a40cb420 Convert for more reference to .ts 2025-11-21 11:27:29 -08:00
Matt Bierner
f0e7fe3775 Convert a few more build scripts to TypeScript
For #277526
2025-11-21 09:26:54 -08:00
Matt Bierner
2648263d3e Run our build scripts directly as typescript (#277567)
* Run our build scripts directly as typescript #277567

Follow up on #276864
For #277526

* Remove a few more ts-node references

* Fix linux and script reference

* Remove `_build-script` ref

* Fix script missing closing quote

* use type only import

* Fix export

* Make sure to run copy-policy-dto

* Make sure we run the copy-policy-dto script

* Enable `verbatimModuleSyntax`

* Pipelines fixes

* Try adding explicit ext to path

* Fix bad edit

* Revert extra `--`

---------

Co-authored-by: João Moreno <joaomoreno@users.noreply.github.com>
2025-11-21 14:56:00 +01:00
Ben Villalobos
b5903ae54c Support folding in git COMMIT_MSG files (#272356) 2025-10-21 09:26:47 -07:00
Matt Bierner
360c9fd134 Add lint rule for as any and bulk ignore all existing breaks
For #269213

This adds a new eslint rule for `as any` and `<any>({... })`. We'd like to remove almost all of these, however right now the first goal is to prevent them in new code. That's why with this first PR I simply add `eslint-disable` comments for all breaks

Trying to get this change in soon after branching off for release to hopefully minimize disruption during debt week work
2025-10-02 23:38:33 -07:00
Benjamin Pasero
e2423d6644 Allow to hide Copilot via user setting and policy (fix #249615) (#261798) 2025-08-15 16:36:46 +02:00
Benjamin Pasero
367fc5f243 exp - introduce and use flag to disable experiments (#254057)
* exp - introduce and use flag to disable experiments

* fix
2025-07-04 09:17:56 +00:00
Benjamin Pasero
1a41ff6c36 🆙 open@^10.1.2 (#250980) 2025-06-08 22:50:40 -07:00
Benjamin Pasero
3edf73df8a tests - drop more flags (#245357) 2025-04-02 11:33:09 -07:00
Benjamin Pasero
2368e6dc36 Revert "tests - enable API tests with test runner" (#242688)
Revert "tests - enable API tests with test runner (#241149)"

This reverts commit 8f2e1b22ed.
2025-03-05 15:39:39 +01:00
Benjamin Pasero
8f2e1b22ed tests - enable API tests with test runner (#241149)
* Revert "Revert "tests - enable API tests with test runner" (#241146)"

This reverts commit 105d4af21c.

* update

* try to fix

* fix: set extension development path for API tests

---------

Co-authored-by: Connor Peet <connor@peet.io>
2025-03-03 15:43:29 -08:00
Benjamin Pasero
105d4af21c Revert "tests - enable API tests with test runner" (#241146)
Revert "tests - enable API tests with test runner (#240876)"

This reverts commit 0c4d85850f.
2025-02-19 07:15:40 +01:00
Benjamin Pasero
0c4d85850f tests - enable API tests with test runner (#240876)
* tests - enable API tests with test runner

* windows

* use correct specific tests per api workspace type

---------

Co-authored-by: Connor Peet <connor@peet.io>
2025-02-18 22:15:32 +01:00
Henning Dieterichs
28448cedcf Removes debugger scripts, as they don't work with ESM anymore. (#239445) 2025-02-03 03:17:36 +01:00
Daniel Imms
23e6be7d99 Handle terminal progress
Fixes #237564
2025-01-09 06:04:51 -08:00
Daniel Imms
9e688d92ba Add terminal suggest tests to run on Windows
Part of #234777
2024-11-27 11:32:49 -08:00
Megan Rogge
8eb7fac565 add tests for terminal suggest widget, fix some bugs (#234445) 2024-11-24 10:38:19 -05:00
Daniel Imms
a845c87459 Add ligatures working under Electron
Part of #34103
2024-11-01 07:42:40 -07:00
Benjamin Pasero
c025c19d14 eng - reduce some unused deps (#231221) 2024-10-13 12:38:11 +02:00
Benjamin Pasero
a1ec838aac esm - remove hardcoded --esm for code-web (#230538)
* esm - remove hardcoded `--esm` for `code-web`

* update depds
2024-10-04 21:53:45 +02:00
Martin Aeschlimann
f8e51fe82d integration tests: colorization test are run 6 times (#230380)
* integration tests: colorization test are run 6 times

* adding missing --
2024-10-03 12:34:14 +02:00
Benjamin Pasero
2b30a40013 esm - restore --esm for web test runner (#230379) 2024-10-03 03:07:04 -07:00
Benjamin Pasero
c5b6ef14e6 esm - more cleanup (#230285) 2024-10-02 11:55:17 +02:00
Benjamin Pasero
f09184ceb7 esm - set type: module top level (#230210) 2024-10-01 20:48:56 +02:00
Benjamin Pasero
3b68a06818 esm - removal of CSS loader (#230206) 2024-10-01 19:24:18 +02:00
Benjamin Pasero
332b89f198 esm - remove AMD build scripts, tests and variables 2024-09-27 08:04:01 +02:00