feat: add agent-device acp, a deterministic stdio ACP agent - #1132
feat: add agent-device acp, a deterministic stdio ACP agent#1132XeonBloomfield wants to merge 5 commits into
Conversation
|
Review finding: |
| ``` | ||
| open com.example.app --platform ios | ||
| snapshot -i | ||
| /snapshot -i |
There was a problem hiding this comment.
I think this line within the guide can be reverted as the previous behavior still works!
|
Ready for human review. I rechecked #1132 at head Checks: 15 successful; only expected skipped |
Add an Agent Client Protocol (ACP) v1 agent mode so ACP clients such as Zed can drive devices from the agent panel. agent-device has no LLM, so the agent is deterministic: each prompt line is one agent-device command in CLI syntax, executed through the same AgentDeviceClient path as MCP tools. - Hand-rolled protocol layer in src/acp/ mirroring src/mcp/ (zero new runtime dependencies), reusing the MCP newline-delimited JSON-RPC stdio transport, payload queue, and error formatting. - Prompt lines are tokenized with the replay-script tokenizer and parsed with the real CLI parser; target flags (--platform, --device, --udid, --session, --state-dir) are sticky within an ACP session. - Command executions stream as tool_call/tool_call_update notifications with daemon progress forwarding; screenshots attach as inline images; errors keep the code/hint/supportedOn contract. - session/cancel is intercepted ahead of the serialized queue so it takes effect between command lines of a running prompt; the command already in flight runs to completion (documented v1 limitation). - Natural-language prompts are refused with guidance instead of guessed at; available commands are advertised per session after session/new. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Rechecked the later |
|
Branch blocker at head Please rebase or merge current Residual risk: no separately authorized cross-vendor review was performed. |
|
Sentinel review of exact head The architecture is also obsolete: current ADR 0008 derives command surfaces from the descriptor registry, while this branch adds a second parser/executor/client-progress/error/output stack around old CLI and MCP seams. That duplicates the current supported CLI, MCP, Node, and AI SDK surfaces. The 1,841-line addition is not justified without a confirmed ACP client need. If real client demand appears, start a fresh discovery issue and rebuild against current descriptor-backed metadata/client seams with a typed ACP protocol boundary and real Zed plus mutated-device validation. |
|
Not ready; this needs a fresh architecture pass rather than conflict resolution. The branch is 624 current-main commits stale and DIRTY, with only July 7 CI. ACP files import interfaces removed from main ( At +1,841/-52 across 30 files with no current size evidence, the materially smaller/deeper direction is a fresh implementation: derive exposure from current command descriptors/CLI grammar and reuse one structured client-context/command-dispatch seam. The ACP adapter should own only ACP wire/session semantics, not a parallel flags/client/progress/error stack. Old inventory evidence did not exercise Zed and is not current evidence for a resolved tree. Do not modify the branch. |
|
This branch is no longer reviewable against current main. Exact head 6dbd05e is conflicting and roughly 646 commits stale, and it depends on CLI, daemon progress, replay, and option seams that have since been removed. Resolving Git conflicts would not restore the current descriptor-derived CLI/MCP ownership or client-context/remote-lock behavior required by ADR-0003/0008; the July checks and device evidence cannot validate the resulting tree. Given the parallel ~1.8k-line flags/client/progress stack, I recommend closing this PR rather than rebasing it. If ACP demand remains, start a fresh, smaller adapter on the current command descriptors and client-context seams. |
|
This head is no longer reviewable against current main and should be closed rather than routinely rebased. It is CONFLICTING/DIRTY and 653 commits behind, depends on removed CLI/progress/client/replay ownership seams, and adds a parallel ~1.8k-line flags/protocol/client stack with only stale July CI and narrow inventory evidence. If ACP demand remains, start a fresh smaller adapter over current command descriptors and client-context/structured-dispatch seams, with current checks and practical ACP-client/device evidence. |
|
This exact head is closable rather than rebaseable. It is 668 main commits behind its merge base, CONFLICTING, and imports removed CLI/replay/request-progress seams; July 7 checks validate the obsolete tree and Zed was never exercised. There is no linked issue, replacement PR, or current ACP demand signal, and repeated prior closure reviews produced no new author head. A rebase would be a rewrite across current descriptor/client-context/remote ownership. Close this PR; if concrete ACP-client demand returns, start fresh as a small adapter over current command descriptors/structured dispatch with real ACP-client plus device evidence. |
Summary
Adds
agent-device acp: an Agent Client Protocol v1 agent over stdio, so ACP clients such as Zed can drive devices from their agent panel. Before: ACP editors could only reach agent-device indirectly, through whatever LLM agent they run and its MCP config. After:agent-device acpis a first-class agent surface — each prompt line is one agent-device command in CLI syntax, executed through the sameAgentDeviceClientpath as MCP tools, streamed back as ACP tool calls with daemon progress updates and inline screenshot images.Design choices:
src/acp/, reusing the MCP server's newline-delimited JSON-RPC transport, payload queue, and error formatting (the shared pieces are now exported fromsrc/mcp/instead of duplicated).--platform,--device,--udid,--session,--state-dir) are sticky within an ACP session.session/cancelis intercepted ahead of the serialized inbound queue so it takes effect between command lines of a running prompt. The command already in flight runs to completion — there is no abort seam in the daemon client; documented as a v1 limitation.session/newadvertises all MCP-exposed commands viaavailable_commands_update(response-before-notification ordering is pinned by test).Docs: new ACP section in
agent-setup.mdwith the Zedagent_serversconfig, README pointer, CHANGELOG entry, CONTEXT.md command-surface vocabulary update.23 files touched (13 new:
src/acp/+ tests). Scope stayed within the planned command-surface addition; the only changes outside it areexports of previously-private MCP transport/formatting helpers and the replay tokenizer.Validation
Full unit bundle green (3296 tests / 366 files, including 27 new ACP tests covering the router contract, prompt parsing, sticky flags, cancellation, refusal, screenshot image attachment, and out-of-band cancel interception).
check:quick,check:layering, fallow audit (0 dead code / 0 duplication after deduplicating againstsrc/mcp/), andtest:smokeall pass — including a newsmoke-acp.test.tsthat spawns the real stdio process and drives initialize → session/new → prompt refusal → clean shutdown. Live device evidence: through the packaged build (dist/src/internal/bin.js acp), an ACP session randevicesagainst a real daemon with an isolated state dir and streamed back actual inventory (iPhone 17 Pro simulator + host macOS target) as a completedtool_call_update; the daemon and state dir were cleaned up afterwards. Zed itself was not exercised — the wire contract was verified against the official ACP v1 JSON schema; a follow-up interactive Zed session is the remaining real-client check.🤖 Generated with Claude Code