feat(vscode): Add ACP Chat Participant for VS Code#15501
Closed
rudironsoni wants to merge 45 commits intoanomalyco:devfrom
Closed
feat(vscode): Add ACP Chat Participant for VS Code#15501rudironsoni wants to merge 45 commits intoanomalyco:devfrom
rudironsoni wants to merge 45 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
eca00bd to
af0930d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new VS Code extension feature set to integrate OpenCode as a native VS Code Chat participant backed by an ACP (JSON-RPC over stdio) client/process layer, with accompanying storage/session plumbing and extensive tests.
Changes:
- Introduces ACP protocol/client/connection/process implementations for stdio JSON-RPC communication.
- Adds VS Code-side components for activation, chat participant registration, request handling, and storage/session persistence.
- Adds unit + integration test suites and CI workflow coverage for the VS Code SDK package.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| sdks/vscode/src/vscode/storage.ts | Implements transcript + session index persistence under storageUri, plus workspaceState caching. |
| sdks/vscode/src/vscode/storage.test.ts | Unit tests for storage behaviors (index, transcripts, retention, flush). |
| sdks/vscode/src/vscode/session.ts | Adds a session manager that stores session metadata in workspaceState and uses ACP sessions. |
| sdks/vscode/src/vscode/session.test.ts | Unit tests for session creation/reuse/title update/delete logic. |
| sdks/vscode/src/vscode/participant.ts | Registers the @opencode chat participant and defines its request handler. |
| sdks/vscode/src/vscode/participant.test.ts | Unit tests for participant metadata, commands, mentions, and activation integration. |
| sdks/vscode/src/vscode/handler.ts | Implements a chat request handler that builds ACP prompts from VS Code chat history and streams updates. |
| sdks/vscode/src/vscode/handler.test.ts | Unit tests for prompt building, streaming, cancellation, and error mapping. |
| sdks/vscode/src/vscode/activation.ts | Adds on-demand ACP process startup/stop logic with lifecycle tracking. |
| sdks/vscode/src/vscode/activation.test.ts | Unit tests for activation state transitions, concurrency, and disposal behavior. |
| sdks/vscode/src/integration/chat.test.ts | Adds basic integration test scaffolding for chat API availability. |
| sdks/vscode/src/integration/activation.test.ts | Adds basic integration test scaffolding for activation and progress APIs. |
| sdks/vscode/src/fixtures/mockAcpServer.ts | Introduces a mock ACP server intended for integration testing. |
| sdks/vscode/src/extension.ts | Wires activation controller + chat participant registration into extension activation. |
| sdks/vscode/src/core/types.ts | Re-exports storage-related types via a core types module. |
| sdks/vscode/src/core/session/key.ts | Placeholder for future session key management. |
| sdks/vscode/src/core/prompt/builder.ts | Placeholder for future prompt builder. |
| sdks/vscode/src/acp/protocol.ts | Defines ACP protocol types and error codes. |
| sdks/vscode/src/acp/process.ts | Implements spawning/monitoring of the opencode acp subprocess with restart logic. |
| sdks/vscode/src/acp/process.test.ts | Unit tests for process spawn/stdio/healthcheck/restart/stop logic. |
| sdks/vscode/src/acp/connection.ts | Implements JSON-RPC request/response + notification handling over streams. |
| sdks/vscode/src/acp/connection.test.ts | Unit tests for connection buffering, timeouts, notifications, and disposal. |
| sdks/vscode/src/acp/client.ts | Implements high-level ACP client APIs over the JSON-RPC connection. |
| sdks/vscode/src/acp/client.test.ts | Unit tests for client initialization, session APIs, streaming updates, cancel, and disposal. |
| sdks/vscode/package.json | Contributes the chatParticipants entry for @opencode and retains extension commands/scripts. |
| sdks/vscode/PLAN.md | Documents the intended architecture/phases for ACP-based chat integration. |
| sdks/vscode/.vscode-test.mjs | Updates VS Code test-cli configuration to separate unit vs integration suites. |
| .github/workflows/vscode-test.yml | Adds CI workflow to build + run VS Code extension tests on Linux/Windows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
17e2224 to
7e30675
Compare
This was referenced Mar 1, 2026
Implements a first-class VS Code chat participant using Agent Client Protocol (ACP) that integrates natively with VS Code's chat UI. ## Core Features - ACP process management with JSON-RPC over stdio - Native @OpenCode chat participant integration - Session management with on-demand activation - Microsoft-style storage with JSON file transcripts ## Architecture - : Process spawning, connection handling, protocol types - : Chat participant, request handler, session management - : Unit and integration tests with mock ACP server ## Storage Pattern - JSON files in storageUri/transcripts/ - Workspace state for metadata - Max 50 sessions with auto-cleanup Implements stable Chat Participant API (no proposed APIs).
…mock protocol alignment
- Uses system screenshot tools (scrot, ImageMagick import, gnome-screenshot) - Automatically starts Xvfb on free display if DISPLAY not set - Organizes screenshots by feature (01-extension, 02-chat, 03-failures) - Captures full window screenshots during test execution - Includes helper utilities for test integration
- Fix connection.ts: update ACP connection handling - Fix process.ts/process.test.ts: correct process management and tests - Fix activation.test.ts (integration): improve integration activation tests - Fix chat.test.ts: expand and fix chat integration tests - Fix screenshot.ts: fix screenshot output path and enhance utilities - Fix testHelpers.ts: improve test helper utilities - Fix activation.test.ts (vscode): update vscode activation tests - Fix handler.test.ts: refactor handler tests - Fix session.test.ts/session.ts: fix session management and tests - Fix storage.test.ts/storage.ts: fix storage implementation and tests - Add .vscode-test/ and out/ to .gitignore to exclude large test artifacts
- Fixed all unit/integration tests (181/181 passing) - Added Playwright E2E tests for chat participant UI (4 tests) - playwright.config.ts: Playwright configuration for E2E tests - tsconfig.e2e.json: TypeScript config for E2E tests - src/e2e/fixtures.ts: Electron launch fixture - src/e2e/chat-participant.e2e.ts: E2E test suite with 4 tests - src/e2e/helpers/chat.ts: ChatPanel page object - Enhanced MockAcpServer with session/prompt handler - Added screenshot infrastructure with env var support - Updated package.json with Playwright dependencies - Updated tsconfig.json with E2E exclude patterns
- Remove console.log statements, use output channel - Add comprehensive .gitignore (40+ patterns) - Create Microsoft-compliant test architecture - Add channel detection (stable vs insiders) - Create test utilities (channel, assertions) - Create E2E test suites (chat-core, session-target) - Add documentation (ARCHITECTURE, CONTRIBUTING, TROUBLESHOOTING) - Add CI workflow with 6-job matrix (3 OS × 2 channels) - Fix activation.ts bug (preserve ERROR state) - Configure mochawesome reporter for HTML reports Work in progress - tests compile but need verification
…activation event - Remove Insiders guard from extension registration to enable standard VS Code - Fix participant ID mismatch in chatSession.ts - Add onStartupFinished activation event for better startup handling - Fix E2E tests to work with session targets - Configure E2E tests to use VS Code Insiders - Update .gitignore to exclude .vscode-test/ and out/ directories
Adds test helper and bootstrap to capture artifacts on failure; updates .vscode-test.mjs to require bootstrap and updates CI workflow to capture runner stdout/stderr and upload test-results. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ture\n\nAdd src/test/bootstrap.ts and evidence helper plus a small e2e smoke test to exercise failure artifact capture.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nce generation\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make the smoke e2e test pass to avoid intentional CI failure while preserving evidence capture. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Temporary test to validate evidence capture; will be removed after verification.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…table evidence capture Improve attach retry loop and mirror artifacts into package test-results so screenshots can be captured and discovered during CI.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ctron capture APIs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…vidence capture Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t handling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ad68e71 to
18a7973
Compare
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.
Issue for this PR
Implements a VS Code chat participant using ACP (Agent Client Protocol) for native VS Code Chat integration.
Type of change
What does this PR do?
This PR adds a VS Code extension that integrates OpenCode as a native chat participant using the ACP (Agent Client Protocol).
Key features:
The implementation follows Microsoft's best practices for VS Code extensions and uses stable Chat Participant APIs (no proposed APIs).
How did you verify your code works?
Checklist