Skip to content

feat(acp-tunnel): inbound tunnel dispatch — parse frames + build replies (Part B slice 4) - #41

Closed
brettchien wants to merge 1 commit into
feat/acp-tunnel-session-lifecyclefrom
feat/acp-tunnel-dispatch
Closed

brettchien wants to merge 1 commit into
feat/acp-tunnel-session-lifecyclefrom
feat/acp-tunnel-dispatch

Conversation

@brettchien

Copy link
Copy Markdown
Contributor

Drafted by Orca (ecs-claude) — flagging authorship (shared GitHub identity).

Slice 4 of the reverse-MCP client ADR (#36) — the protocol half. ⚠️ Stacked on #40 (slice 3) — base is feat/acp-tunnel-session-lifecycle; merge #40 first (I'll rebase onto main after).

The gateway-initiated tunnel routing, kept pure so the async work (forwarding an inner MCP call to the running oab-mcp sidecar and awaiting it) stays in the transport, and routing is unit-testable without a runtime.

What

  • Inbound classification of an /acp frame: Connect / Message (request vs notification by presence of the outer id) / Disconnect / Cancel / Other (ACP chat + unknown ignored).
  • parse_inbound (never fails; lenient sub-field reads) + reply builders connect_reply / message_reply / message_error / disconnect_reply.
  • Correlation always by the outer ACP frame id; the inner MCP result becomes the ACP response result verbatim; an inner error → an outer JSON-RPC error (contract §4).

Verification

cargo test -p acp-tunnel — 13/13 pass locally (7 lifecycle + 6 dispatch), no aws / no Tauri.

Remaining for path (i) — the src-tauri WS transport (follow-up)

Dial /acp (tokio-tungstenite), drive the Session, and on each Inbound::Message relay to the sidecar McpClient and reply (§4.3). That half:

  • compiles only under desktop.yml (macOS tauri build) — not locally here (webkit/gtk), so it's CI-only-verifiable;
  • runs end-to-end only against a real agent-runtime gateway (§5 — pending the Jelly thread on endpoint + bearer).

I've split it out so the tested protocol lands now; the transport pairs naturally with the endpoint arriving.

🤖 Generated with Claude Code

…ies (Part B slice 4)

The gateway-initiated tunnel routing, kept **pure** so the async work (forwarding
an inner MCP call to the running oab-mcp sidecar and awaiting it) stays in the
src-tauri transport and the routing is unit-testable without a runtime.

- `Inbound` classification of an `/acp` frame: `Connect` / `Message`
  (request vs notification by presence of the outer id) / `Disconnect` / `Cancel`
  / `Other` (ACP chat + unknown are ignored by the tunnel).
- `parse_inbound` (never fails; lenient sub-field reads) and the reply builders
  `connect_reply` / `message_reply` / `message_error` / `disconnect_reply`.
- Correlation is always by the OUTER ACP frame id; the inner MCP result becomes
  the ACP response result verbatim; an inner error becomes an outer JSON-RPC
  error (tunnel contract §4).

Verification: `cargo test -p acp-tunnel` — 13/13 pass locally (7 lifecycle + 6
dispatch), no aws / no Tauri.

Remaining for path (i): the src-tauri WS transport — dial `/acp`
(tokio-tungstenite), drive the `Session`, and on each `Inbound::Message` relay to
the sidecar `McpClient` and reply. That half compiles only under desktop.yml
(macOS) and runs end-to-end only against a real gateway (ADR §5, pending).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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