Add Zed agent support via ACP proxy#851
Add Zed agent support via ACP proxy#851Krishnachaitanyakc wants to merge 6 commits intogit-ai-project:mainfrom
Conversation
|
Thank you for addressing that issue! I don't know much about how git-ai works, but I'm surprised this approach is needed. I mean, if I use an external agent in Zed like Claude Code, shouldn't Claude Code hooks like pre-edit fire regardless of whether it is being driven by Zed or not? And most external agents Zed could use probably have git-ai support already. Also I have a question. This proxy won't track edits of the first-party Zed Agent right? (the Zed Agent is the default agent interface when you open the agent panel, to use external agents you need to select them when creating a new thread). If this doesn't track edits from the first-party Zed Agent, I think this shouldn't close #675. |
|
Good points! You're right that Claude Code's hooks fire independently — running it through the ACP proxy would double-track edits. I'm adding a fix: the proxy sets The proxy is still useful for agents that don't have native git-ai integration. Re: first-party Zed Agent — correct, ACP |
bd77336 to
556a714
Compare
Implements automatic checkpoint tracking for Zed by acting as a transparent ACP (Agent Client Protocol) proxy between Zed and the real agent. The proxy intercepts tool_call/tool_call_update notifications to create checkpoints without requiring model cooperation. - Add acp_proxy command with Content-Length framed I/O, two-thread forwarding (Zed→Agent, Agent→Zed), and background checkpoint spawning - Add zed_preset for parsing hook input from the ACP proxy - Add ZedInstaller that detects Zed and prints agent_servers setup instructions - Wire up "acp-proxy" command and "zed" checkpoint preset in handlers
Collapse nested if-let statements into a single if-let chain as suggested by clippy::collapsible_if.
The ACP proxy now sets GIT_AI_ACP_PROXY=1 on the child process, and the Claude preset skips checkpointing when that env var is present. This prevents duplicate checkpoints when Claude Code's own hooks fire alongside the proxy's tool-call interception. Same pattern as the existing VS Code Copilot and Cursor filters.
The daemon's trace ingest worker processed side effects inline, blocking the entire trace event pipeline. Under concurrent test load, events backed up and tests timed out waiting for completion log entries. - Spawn side effects via tokio::spawn for both Applied and QueuedFamily paths so the ingest worker returns immediately - Split replace_pending_root_entry: fast BTreeMap update stays inline, drain moves to a new drain_family_sequencer method spawned async - Fix pre-existing bug where completion log was skipped on side effect errors in the fast path (if/else if -> two separate if blocks) - Increase daemon test sync timeouts (60s->120s total, 20s->30s idle) to provide margin under CI load
Reverts commits 4b0aab0 and a391bf0 which moved daemon side effects into fire-and-forget tokio::spawn tasks. The spawned tasks wrote completion logs asynchronously, causing the test sync mechanism to timeout waiting for entries that were never written (or written too late). This broke all amend and subdirs tests in daemon and wrapper-daemon CI modes. Restores synchronous side effect execution in ingest_trace_payload_fast and inline drain in replace_pending_root_entry.
4166f78 to
3b8c8f8
Compare
Summary
Closes #675
tool_call/tool_call_updatenotifications to create checkpoints automatically — no model cooperation neededZed (ACP Client) ←stdio→ git-ai acp-proxy ←stdio→ Real AgentNew files
src/commands/acp_proxy.rs— Core ACP proxy with Content-Length framed I/O, two-thread forwarding, and background checkpoint spawningsrc/commands/checkpoint_agent/zed_preset.rs— Preset for parsing hook input JSON from the proxysrc/mdm/agents/zed.rs—ZedInstallerthat detects Zed and printsagent_serverssetup instructionsModified files
src/commands/git_ai_handlers.rs— Wire upacp-proxycommand andzedcheckpoint presetmod.rsfilesTest plan
cargo fmt -- --checkpassescargo buildcompiles with no warningsacp_proxy.rs(message framing, file path extraction, tool call tracking, arg parsing)zed_preset.rs(pre/post tool use, error cases)zed.rs(name, id, config hooks flag, install instructions)echo '{"hook_event_name":"PostToolUse","session_id":"s1","cwd":"/tmp","file_paths":["a.rs"]}' | git-ai checkpoint zed --hook-input stdingit-ai acp-proxy -- echo "test"(verifies arg parsing and child spawn)