Repository navigation
Releases: yazelin/claude-code-acp-py
Release list
v0.5.1
v0.5.0
What's New
on_tool_input_transform callback
New ClaudeClient callback for framework-level tool input transformation. Called after permission is granted, before tool execution.
Use case: Inject parameters (e.g., user identity) into MCP tool calls at the framework level, independent of LLM behavior.
client = ClaudeClient(cwd=".")
@client.on_tool_input_transform
async def inject_user(tool_name: str, tool_input: dict) -> dict | None:
if tool_name.startswith("mcp__my-server__"):
return {**tool_input, "user_id": current_user_id}
return None # keep originalKey properties:
- Leverages
claude_agent_sdk's nativePermissionResultAllow(updated_input=...)support - Framework-controlled: LLM cannot manipulate injected values
- Backward compatible: no changes to existing
on_permissioncallback - Does not affect
AcpClientor external ACP client connections
Full Changelog: v0.4.4...v0.5.0
v0.4.4 - Proper session lifecycle management
What's Changed
Fix: Unclosed client sessions
Added proper lifecycle management to ClaudeAcpAgent and ClaudeClient to prevent unclosed subprocess connections (and associated aiohttp session warnings).
New methods:
ClaudeAcpAgent.close()/close_session(session_id)— properly disconnectsClaudeSDKClientinstancesClaudeClient.close()— delegates to agent cleanup- Both now support
async withcontext manager for automatic cleanup
Usage:
# Recommended: async context manager
async with ClaudeClient(cwd=".") as client:
response = await client.query("Hello")
# Or manual cleanup
client = ClaudeClient(cwd=".")
try:
response = await client.query("Hello")
finally:
await client.close()Also:
run()entry point now ensuresagent.close()on shutdown viatry/finally- Updated README examples to use
async withpattern - Added unit tests for lifecycle methods
v0.4.3
v0.4.2
v0.4.1 - Subprocess Cleanup Fix
v0.4.1
Fix
- Close subprocess stdin/stdout/stderr pipes in
AcpClient.disconnect()to preventRuntimeError: Event loop is closedduring garbage collection
This error occurred when the ACP agent process (e.g. Gemini) was slow to terminate and had to be force-killed. The orphaned subprocess transport would then trigger the error during GC after the event loop had already closed.
v0.4.0 - AvailableCommands & Models Support
What's New
Features
- AvailableCommandsUpdate: Now sends available slash commands to ACP clients after session creation
- SessionModelState: Returns available models (default/Opus, Sonnet, Haiku) in NewSessionResponse
Technical Details
- Uses
get_server_info()from Claude SDK to fetch commands and models - Filters unsupported commands (cost, login, logout, etc.)
- Handles MCP commands with proper naming convention
This brings feature parity with the TypeScript implementation for model and command discovery.
v0.3.9 - Test Framework & MCP Fix
What's New
Test Framework
- Add pytest test framework with 72 tests (55 unit + 17 integration)
- Add pytest-asyncio, pytest-cov, pytest-timeout dependencies
- Add Makefile for convenient test commands
Bug Fixes
- Fix MCP server dynamic loading with
--strict-mcp-configflag
Usage
# Run all tests
make test
# Run only unit tests (fast)
make test-unit
# Run integration tests
make test-integrationv0.3.8 - All Backends Model Support Verified
Model Parameter Support - All Backends Verified ✅
| Backend | Method | Status |
|---|---|---|
| claude-code-acp | ACP set_session_model |
✅ opus, sonnet |
| Gemini | CLI --model |
✅ gemini-2.0-flash, gemini-2.5-flash, etc. |
| Copilot | CLI --model + ACP |
✅ See supported models below |
Copilot Supported Models
claude-sonnet-4.5, claude-haiku-4.5, claude-opus-4.5, claude-sonnet-4
gemini-3-pro-preview
gpt-5.2-codex, gpt-5.2, gpt-5.1-codex-max, gpt-5.1-codex, gpt-5.1, gpt-5
gpt-5.1-codex-mini, gpt-5-mini, gpt-4.1
Install
pip install git+https://github.com/yazelin/claude-code-acp-py.git@v0.3.8v0.3.7 - Model Parameter Support
Features
- Model parameter now works for all backends:
- claude-code-acp: via ACP
set_session_modelmethod (opus/sonnet) - Gemini: via CLI
--modelargument (gemini-2.0-flash,gemini-2.5-flash, etc.) - Copilot: via CLI
--modelargument (gpt-4,gpt-4o, etc.)
- claude-code-acp: via ACP
Fixes
- Enable
use_unstable_protocol=Trueto supportset_session_modelACP method - Add
_pending_modelmechanism in AcpClient to apply model after session creation - Pass model as CLI argument for backends that don't support ACP method
Debug
- Add
ACP_PROXY_LOG_FILEenvironment variable for proxy debugging
Install
pip install git+https://github.com/yazelin/claude-code-acp-py.git@v0.3.7