feat(acp): wire AcpContext into agent loop, cancellation, spec compliance#814
Merged
feat(acp): wire AcpContext into agent loop, cancellation, spec compliance#814
Conversation
Pass AcpContext (IDE-proxied FS, shell, permissions) through AgentSpawner into the agent tool chain via CompositeExecutor composition. ACP executors take priority over local tools with automatic fallback. Add cancel_signal (Arc<Notify>) to LoopbackHandle for cooperative cancellation between ACP sessions and the agent loop. cancel() now triggers notify_one() to interrupt the active prompt. Closes #779, closes #780
Add ACP Phase 2 entries to CHANGELOG.md (AcpContext wiring, DynExecutor, cancel_signal, permission cache fix). Update mdbook architecture and advanced sections. Create zeph-acp README. Update zeph-core and zeph-tools READMEs with new public API surface.
6 tasks
# Conflicts: # crates/zeph-acp/src/agent.rs
…ol output Two spec compliance fixes: 1. prompt() now detects cancel_signal via tokio::select! during the drain loop and returns StopReason::Cancelled instead of EndTurn. Per ACP spec: agents MUST return cancelled stop reason when the client sends session/cancel. 2. LoopbackEvent::ToolOutput now maps to SessionUpdate::ToolCall with Completed status and proper ToolKind instead of AgentMessageChunk. Per ACP spec: tool invocations must be reported via structured ToolCall notifications, not as generic message chunks.
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
cancel_signal: Arc<Notify>to LoopbackHandle for cooperative cancellation between ACP sessions and agent loopStopReason::Cancelledwhen IDE sendssession/cancel(ACP spec compliance)ToolOutputto structuredSessionUpdate::ToolCallwith properToolKindandCompletedstatus instead of genericAgentMessageChunk(ACP spec compliance)Changes
src/main.rsspawn_acp_agentacceptsOption<AcpContext>, composes ACP executorscrates/zeph-tools/src/executor.rsDynExecutornewtype for object-safe ToolExecutor compositioncrates/zeph-tools/src/lib.rsDynExecutorcrates/zeph-core/src/channel.rscancel_signal: Arc<Notify>onLoopbackHandlecrates/zeph-core/src/agent/builder.rswith_cancel_signal()builder methodcrates/zeph-acp/src/agent.rsStopReason::Cancelled, structuredToolCallnotifications,tool_kind_from_name()crates/zeph-acp/src/permission.rsACP spec compliance fixes
prompt()usestokio::select!to detectcancel_signalduring drain loop, returnsStopReason::Cancelledper spec requirementSessionUpdate::ToolCallwithCompletedstatus andToolKindper tool-calls spec, enabling IDE structured tool UXTest plan
cargo clippy --workspace -- -D warnings: 0 warningscargo +nightly fmt --check: cleanCloses #779, closes #780
Part of Epic #777