You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(acp): Add Claude ACP support via @zed-industries/claude-code-acp (#58)
## Summary
Generated with [Nori](https://www.npmjs.com/package/nori-ai)
- Add Claude as an ACP provider alongside Gemini via
`@zed-industries/claude-code-acp` package
- Add Claude ModelPreset for UI model selection in `/model` command
- Add unit tests for Claude ACP registry config and model family
- Add live E2E tests for ACP models (opt-in with `--ignored` flag,
requires ANTHROPIC_API_KEY/GEMINI_API_KEY)
- Update documentation in docs.md files
- Fix clippy warnings for uninlined format args (pre-existing)
- Update snapshot tests for UI changes (pre-existing /review command
addition)
## Test Plan
- [x] Unit tests pass: `cargo test -p codex-acp` and `cargo test -p
codex-core client_acp_tests --lib`
- [x] E2E snapshot tests pass: `cargo insta test`
- [x] Live ACP test with ANTHROPIC_API_KEY: `cargo test -p tui-pty-e2e
-- --ignored test_claude_acp_live_response`
- [x] CI passes
Share Nori with your team: https://www.npmjs.com/package/nori-ai
Copy file name to clipboardExpand all lines: codex-rs/acp/docs.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,16 +18,18 @@ Path: @/codex-rs/acp
18
18
### Model Registry
19
19
20
20
The ACP registry in `@/codex-rs/acp/src/registry.rs` is **model-centric** rather than provider-centric:
21
-
-`get_agent_config()` accepts model names (e.g., "mock-model", "gemini-2.5-flash") instead of provider names
21
+
-`get_agent_config()` accepts model names (e.g., "mock-model", "gemini-2.5-flash", "claude-acp") instead of provider names
22
22
- Called from `@/codex-rs/core/src/client.rs` at the start of `stream()` to check if model is an ACP agent
23
23
- Returns `AcpAgentConfig` containing:
24
-
-`provider_slug`: Identifies which agent subprocess to spawn (e.g., "mock-acp", "gemini-acp")
24
+
-`provider_slug`: Identifies which agent subprocess to spawn (e.g., "mock-acp", "gemini-acp", "claude-acp")
25
25
-`command`: Executable path or command name
26
26
-`args`: Arguments to pass to the subprocess
27
27
-`provider_info`: Embedded `AcpProviderInfo` with provider configuration (name, retry settings, timeouts)
28
28
- Model names are normalized to lowercase for case-insensitive matching (e.g., "Gemini-2.5-Flash" → "gemini-2.5-flash")
29
29
- Uses exact matching only (no prefix matching) - each model must be explicitly registered
30
30
- The `provider_slug` field enables future optimization to determine when existing subprocess can be reused vs when new one must be spawned when switching models
31
+
- Claude ACP is registered for both "claude" and "claude-acp" model names, using `npx @zed-industries/claude-code-acp` command with no arguments
32
+
- Unit test `test_get_claude_model_config()` verifies Claude ACP registry configuration
`model_presets` defines available models by provider with capabilities:
54
-
- Default reasoning effort levels
53
+
`model_presets`in `@/codex-rs/common/src/model_presets.rs`defines available models by provider with capabilities:
54
+
- Default reasoning effort levels (set to Medium for all models)
55
55
- Summary generation support
56
56
- Tool capabilities
57
+
- Claude ACP preset added with display_name "Claude" and description "Anthropic's Claude via Agent Context Protocol" to make Claude model visible in TUI model selection
Response streaming uses `ResponseStream` of `ResponseEvent` items.
90
90
91
-
For ACP providers (`wire_api: WireApi::Acp`), the client looks up subprocess configuration via `codex_acp::get_agent_config(self.config.model)` from `@/codex-rs/acp/src/registry.rs`. The registry is **model-centric**: it maps model names (e.g., "mock-model", "gemini-2.5-flash") to `AcpAgentConfig` structs containing provider identifier, command, and args. This differs from the provider-based approach used for HTTP APIs. ACP providers should not define `env_key` or `env_key_instructions` in their `ModelProviderInfo` entries, as they communicate via subprocess rather than HTTP APIs.
91
+
For ACP providers (`wire_api: WireApi::Acp`), the client looks up subprocess configuration via `codex_acp::get_agent_config(self.config.model)` from `@/codex-rs/acp/src/registry.rs`. The registry is **model-centric**: it maps model names (e.g., "mock-model", "gemini-2.5-flash", "claude-acp") to `AcpAgentConfig` structs containing provider identifier, command, and args. This differs from the provider-based approach used for HTTP APIs. ACP providers should not define `env_key` or `env_key_instructions` in their `ModelProviderInfo` entries, as they communicate via subprocess rather than HTTP APIs. Unit test `test_claude_acp_model_has_family()` in `@/codex-rs/core/src/client_acp_tests.rs` verifies that Claude ACP models resolve to a valid model family.
0 commit comments