Skip to content

feat(acp-tunnel): reverse-MCP-over-ACP session lifecycle (Part B slice 3) - #40

Merged
brettchien merged 1 commit into
mainfrom
feat/acp-tunnel-session-lifecycle
Aug 14, 2026
Merged

brettchien merged 1 commit into
mainfrom
feat/acp-tunnel-session-lifecycle

Conversation

@brettchien

Copy link
Copy Markdown
Contributor

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

Slice 3 of the reverse-MCP client ADR (#36). A new aws-free root-workspace crate holding the Studio-side reverse-MCP-over-ACP protocol as pure logic — so it is unit-tested by cargo test --workspace (and locally, unlike the aws-linked crates) and reused by src-tauri's WS transport (and any future headless client) without pulling protocol code into the Tauri build.

Why a separate crate

src-tauri is its own workspace, built only by desktop.yml (macOS tauri build) and not locally compilable here (webkit/gtk). Putting the protocol + state machine in crates/acp-tunnel keeps it in the fast ci.yml gate and fully testable.

Slice 3 — the session lifecycle

  • Bearer sub-protocol builder (openab.bearer.<token>, acp.v1) + protocol limits (frame/timeout/server caps) from the tunnel contract §1/§7.
  • ServerDecl / oab_server — the single type:"acp" oab server Studio declares (D1), in wire form.
  • JSON-RPC 2.0 envelope helpers (request / notification / response / error).
  • Session state machine: New → Initializing → Initialized → SessionActive, producing initialize → session/new (declaring the oab server) → session/resume (re-presenting the whole set with fresh per-connection ids on reconnect, contract §7). Monotonic request ids.

Contract-specified parts (declaration, envelope, methods, limits) are owned here; the standard-ACP initialize params are passed through by the transport against the ACP version in use.

Design note (corrects ADR §4.3 — update incoming on #36)

The desktop reaches oab-mcp only via the stdio sidecar (McpClient), keeping aws out of the Tauri build (desktop-core-sidecar ADR). So slice 4's tunnel dispatch will relay inner MCP to that running sidecar, not link oab-mcp in-process. Slice 2's lib split is still fine (and serves a future headless client); the desktop path is a WS↔sidecar relay.

Verification

cargo test -p acp-tunnel — 7/7 pass locally (no aws, no Tauri). Also runs in ci.yml cargo test --workspace.

Next: slice 4 — inbound mcp/connect/mcp/message/mcp/disconnect/mcp/cancel dispatch (in this crate, with a ToolBackend trait) + the src-tauri WS transport implementing it over the sidecar.

🤖 Generated with Claude Code

…e 3)

New aws-free root-workspace crate holding the Studio-side reverse-MCP-over-ACP
protocol as pure logic — so it is unit-tested in `cargo test --workspace` (and
locally, unlike the aws-linked crates) and reused by src-tauri's WS transport
(and any future headless client) without pulling protocol code into the Tauri
build.

Slice 3 = the session lifecycle:
- The bearer sub-protocol builder (`openab.bearer.<token>, acp.v1`) and the
  protocol `limits` (frame/timeout/server caps) from the tunnel contract.
- `ServerDecl` / `oab_server` — the single `type:"acp"` `oab` server Studio
  declares (D1), in wire form.
- JSON-RPC 2.0 envelope helpers (request/notification/response/error).
- `Session` state machine: New → Initializing → Initialized → SessionActive,
  producing `initialize` → `session/new` (declaring the oab server) →
  `session/resume` (re-presenting the whole set with fresh per-connection ids on
  reconnect, per contract §7). Monotonic request ids.

Contract-specified parts (declaration, envelope, methods, limits) are owned here;
the standard-ACP `initialize` params are passed through by the transport against
the ACP version in use. Inbound tunnel dispatch is slice 4; the src-tauri WS glue
relays tool calls to the running oab-mcp sidecar (no in-process aws link — see the
ADR §4 update).

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@brettchien
brettchien merged commit c4d9ad0 into main Aug 14, 2026
2 checks passed
@brettchien
brettchien deleted the feat/acp-tunnel-session-lifecycle branch August 14, 2026 05:34
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