Open
Conversation
Author
Update: Tool Calls & Permission Request Support AddedThis PR now includes complete ACP support with: New Features
Test Results (All Passing)
E2E Tool Call Test OutputReady for review! 🚀 |
added 4 commits
February 5, 2026 13:46
Enable direct connection to ACP-compatible agents (e.g., Gemini CLI)
without requiring a protocol translation proxy.
- Add protocol adapter abstraction layer
- Implement NDJSON transport for ACP wire format
- Translate Copilot SDK methods to ACP: ping→initialize,
session.create→session/new, session.send→session/prompt
- Map ACP session/update notifications to SessionEvent format
- Add 'protocol' option to CopilotClientOptions ("copilot" | "acp")
- Include comprehensive unit tests and e2e tests
Usage:
```typescript
const client = new CopilotClient({
cliPath: "gemini",
cliArgs: ["--experimental-acp"],
protocol: "acp"
});
```
Gemini returns stopReason in the session/prompt response instead of sending a separate end_turn notification. Emit session.idle event when stopReason is "end_turn" to properly signal turn completion. Changes: - Add stopReason to AcpSessionPromptResult type definition - Emit session.idle via queueMicrotask when stopReason is "end_turn" - Add unit test for stopReason handling
Implement support for ACP tool calls and permission requests: - Add types for tool_call, tool_call_update, and permission requests - Map ACP tool_call to tool.execution_start event - Map ACP tool_call_update to tool.execution_progress/complete events - Handle session/request_permission requests from ACP server - Add sendResponse and onRequest to AcpTransport for server requests - Remove tool.call and permission.request from unsupported methods Tests: 53 passing (21 mapper + 17 transport + 15 adapter)
- Add test for receiving tool events when agent uses tools - Add test for tool.execution_start and tool.execution_complete events - Tests prompt Gemini to read files/list directory to trigger tool usage - Tests are skipped when ACP_CLI_PATH is not set
cddfeed to
9a225bf
Compare
added 4 commits
February 5, 2026 15:28
The Node.js process would hang after calling client.stop() because the child process streams (stdin, stdout, stderr) were not properly cleaned up. Changes: - Store bound event handlers for proper removal on cleanup - Remove all event listeners from streams before closing - Call destroy() on stdin/stdout/stderr to properly close pipes - Clean up both in stop() and forceStop() methods This ensures the Node.js event loop can exit normally without requiring process.exit() in user code.
JSON-RPC errors may include a 'data' field with additional details.
Now the error message includes this data, e.g.:
Before: 'Internal error'
After: 'Internal error: {"details":"Requested entity was not found."}'
Registers handlers for exit, SIGINT, and SIGTERM to ensure the gemini child process is killed when Node.js exits unexpectedly.
Gemini expects env as array of "KEY=value" strings, not object. Also ensure args and env are always present (empty array if not set).
d3ed889 to
76d68a2
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.
Summary
Adds native ACP (Agent Client Protocol) support to allow the Copilot SDK to connect directly to ACP-compatible agents (e.g., Gemini CLI with
--experimental-acp) without requiring a protocol translation proxy.Closes #377
Changes
protocoloption toCopilotClientOptions("copilot"|"acp")ping→initializesession.create→session/newsession.send→session/promptsession/updatenotifications toSessionEventformatstopReasonresponse forsession.idleeventUsage
Test Plan
Files Changed