Skip to content

feat(acp): Setup first ACP with mock agent#55

Merged
CSRessel merged 13 commits intofork/acp-with-geminifrom
fork/acp-with-mock
Nov 24, 2025
Merged

feat(acp): Setup first ACP with mock agent#55
CSRessel merged 13 commits intofork/acp-with-geminifrom
fork/acp-with-mock

Conversation

@CSRessel
Copy link
Copy Markdown
Collaborator

No description provided.

CSRessel and others added 2 commits November 21, 2025 02:27
…communication

Adds full support for Agent Client Protocol (ACP) as a wire API option alongside
existing Chat and Responses APIs. ACP enables subprocess-based agent communication
over JSON-RPC 2.0 via stdin/stdout instead of HTTP requests.

Core changes:
- Add ACP agent registry (acp/src/registry.rs) mapping provider names to binary commands
- Implement ModelClient::stream() for WireApi::Acp with event mapping to ResponseEvent
- Add "mock-acp" and "gemini-acp" model families for proper model resolution
- Configure mock-acp and gemini-acp providers with WireApi::Acp
- Add comprehensive unit tests (8/8 passing) covering providers, registry, and model families

Implementation follows existing Chat API patterns with subprocess spawning instead of HTTP.
Event mapping: AcpEvent::TextDelta → ResponseEvent::OutputTextDelta, etc.

Test coverage:
- Unit tests: Provider configuration, model families, registry integration
- Integration test: ModelClient streaming with mock-acp-agent binary
- TUI test: Updated to use "mock-acp" model name (model resolution pending)

Note: TUI integration test still needs model-name-to-provider-ID resolution work,
tracked separately as it's a config loading concern rather than core ACP implementation.
🤖 Generated with [Nori](https://nori.ai)

Co-Authored-By: Nori <noreply@tilework.tech>
@CSRessel
Copy link
Copy Markdown
Collaborator Author

2nd in stack

CSRessel and others added 6 commits November 21, 2025 12:16
Add init_file_tracing() function to enable structured file logging for the ACP package.

- Accepts custom log file path parameter
- Filters at DEBUG level and above (TRACE excluded)
- Uses non-blocking file appender for async-safe writes
- Returns error on re-initialization (global subscriber constraint)
- Includes comprehensive integration test
- Updates package documentation
🤖 Generated with [Nori](https://nori.ai)

Co-Authored-By: Nori <noreply@tilework.tech>
Add automatic initialization of ACP file tracing when the CLI starts.
Logs are written to .codex-acp.log in the current working directory.

- Add codex-acp dependency to cli/Cargo.toml
- Call init_file_tracing() in cli_main() after CLI argument parsing
- Log warning (non-fatal) if tracing initialization fails
- Update acp/docs.md to document automatic CLI initialization

This ensures ACP tracing is always available when using the codex CLI,
without requiring manual initialization by library users.
🤖 Generated with [Nori](https://nori.ai)

Co-Authored-By: Nori <noreply@tilework.tech>
…rary

Replaces custom protocol.rs and transport.rs implementations with the
official agent-client-protocol v0.7 library, eliminating ~250 lines of
duplicative JSON-RPC code.

Key changes:
- Implement Client trait in new client_handler.rs for permission/session callbacks
- Refactor AgentProcess to use ClientSideConnection instead of StdioTransport
- Add tokio-util compat layer for AsyncRead/Write trait compatibility
- Use LocalSet pattern throughout for handling !Send futures from the library
- Replace custom JsonRpcRequest/Response with typed library requests
- Update all tests to wrap in LocalSet contexts
- Fix clippy warnings (unused variables, unwrap usage, error formatting)

Benefits:
- Type-safe protocol communication with compile-time validation
- Spec-compliant implementation maintained by library authors
- Reduced maintenance burden and code complexity
- Better error handling with library-defined error types

Breaking changes:
- AgentProcess API updated with typed new_session() and prompt() methods
- ClientEvent enum introduced for permission requests and session updates
- Public API now exports library types instead of custom types
🤖 Generated with [Nori](https://nori.ai)

Co-Authored-By: Nori <noreply@tilework.tech>
Add comprehensive JSON request/response logging for ACP protocol debugging:
- Log initialize and new_session requests/responses with pretty-printed JSON
- Change protocol version from V1 to V0 for Gemini compatibility
- Fix client capabilities to use camelCase format with meta fields
- Add retry configuration (2 retries) for ACP model providers
- Increase log tail from 50 to 150 lines for better error diagnostics

Switch integration tests to use mock-acp instead of gemini-acp for faster
iteration during development.

Note: Includes temporary debugging code (hardcoded mock-acp provider in
client.rs) that should be reverted before merging.
Base automatically changed from fork/playwright-for-tui to fork/acp-with-gemini November 22, 2025 18:33
🤖 Generated with [Nori](https://nori.ai)\n\nCo-Authored-By: Nori <noreply@tilework.tech>

Change the ACP registry to use model names for lookups instead of provider names. This separates the model identifier (what the user specifies) from the provider identifier (which agent subprocess to use).

The provider field in AcpAgentConfig now uniquely identifies the agent subprocess, enabling future optimization to determine when an existing subprocess can be reused vs when a new one must be spawned when switching models.

Changes:
- Add provider field to AcpAgentConfig struct
- Change get_agent_config() to accept model_name instead of provider_name
- Update registry to map exact model names (e.g., "mock-model", "gemini-flash-2.0") to agent configurations
- Fix client.rs WireApi::Acp to pass self.config.model to registry
- Update all tests to use model names and verify provider field
- Update documentation to reflect model-centric architecture

The registry uses exact matching with case-insensitive normalization. Each model must be explicitly registered.
@CSRessel CSRessel marked this pull request as ready for review November 24, 2025 18:30
@CSRessel CSRessel merged commit 1a5ef77 into fork/acp-with-gemini Nov 24, 2025
5 of 9 checks passed
@CSRessel CSRessel deleted the fork/acp-with-mock branch November 24, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant