chore: sync upstream main (29 commits)#538
Closed
yazelin wants to merge 28 commits intogithub:mainfrom
Closed
Conversation
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
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).
Gemini only sends agent_message_chunk (message_delta), never the complete agent_message. Accumulate delta content per session and emit a synthesized assistant.message event before session.idle. This fixes sendAndWait() returning undefined in ACP mode.
- Implement applySessionConfig in ACP adapter to auto-call session/set_model after session/new when model is specified in createSession() - Add AcpSetModelParams/Result and AcpSetModeParams/Result types - Add upstream-sync GitHub Action for daily sync with ACP file protection - Fix mockProcess missing removeAllListeners in adapter tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge ACP protocol support to main
Fork repos have restricted GITHUB_TOKEN permissions that prevent creating pull requests. Use a Personal Access Token (PAT) stored in repo secrets instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use PAT for upstream-sync workflow
Upstream: github/copilot-sdk@06ff2ae ACP auto-resolved: false
GitHub needs time to index a newly pushed branch before gh pr create can reference it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chore: sync upstream (1 commit)
Add sleep after push for branch indexing
…ssion/set_model session/set_model was a Gemini-specific method not part of the ACP spec. The standard method is session/set_config_option with configId + value params. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use standard ACP session/set_config_option
Upstream: github/copilot-sdk@05e3c46 ACP auto-resolved: false
chore: sync upstream (9 commits)
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
github/copilot-sdkmain branch (29 new commits)client.ts,types.ts,client.test.ts) merged cleanlyNotable upstream changes
Breaking Change
requestPermissionis now alwaystruein Copilot protocol. No impact on ACP: our ACP adapter already had deny-by-default behavior viaoutcome: "cancelled"inhandleAcpPermissionRequest()New Features
clientNamesupport across all SDKs (feat: add clientName to SessionConfig across all SDKs #510)Fixes
envValueModedirect (Fix MCP env vars: send envValueMode direct across all SDKs #484)nodefrom pathDocs
Test plan
git merge-treeconfirms no conflictstsc --noEmitpassesclientNametests)🤖 Generated with Claude Code