Skip to content

feat(bridge): add a cc-peer bridge for cross-machine Claude Code relay - #148

Merged
Mearman merged 1 commit into
mainfrom
feat/cc-peer-bridge
Sep 16, 2026
Merged

Mearman merged 1 commit into
mainfrom
feat/cc-peer-bridge

Conversation

@Mearman

@Mearman Mearman commented Sep 16, 2026

Copy link
Copy Markdown
Member

Closes #87.

cc-peer speaks Claude Code's own local cross-session peer protocol directly -- a per-session Unix socket with no cross-machine leg of its own. This bridge relays exactly one local Claude Code peer into the agent-comms mesh, matching the "one bridge process is one agent is one device" model every other bridge here follows, so that session becomes reachable from any other agent-comms bridge, including one on a different machine, riding on the mesh's own transport.

Note: #87's own body describes this "riding on the existing federation link today, and on wire-mesh's own relay/capability-token model once that lands (#51)" -- both federation.ts and #51 no longer exist as of this session (federation was fully retired in favour of connectToRemote, #144). Cross-machine reach now comes from connectToRemote/mesh_listen/wire-mesh's own gossip-advertised listener addresses (#147) directly, with no federation fallback. This bridge itself has no dependency on that either way -- it only needs the local MeshStore this repo already provides, same as every other bridge.

Design

  • wireCcPeerBridge (bridge.ts) is the pure, dependency-injected relay wiring: an inbound cc-peer "message" event is posted into this bridge's own project room via buildAction/CommsTool.handle; a mesh delivery for this bridge's own agent is relayed back to the configured target via CcPeer.send().
  • run.ts does the real construction (CcPeer.create, createBridgeMesh, CLI target parsing) and hands both to the wiring function -- kept separate so the relay logic is unit-testable without a real local Claude Code session (none exists in CI or this environment).
  • One bridge process relays for exactly one target local Claude Code peer (by name or pid), not a many-to-one fan-out -- the simplest, most defensible reading given CcPeer's own "do not split listening and sending across processes" constraint and every other bridge's own 1:1 model.

Run via:

npx agent-comms bridge cc-peer <target-name>
npx agent-comms bridge cc-peer --pid=<pid>

Smoke-tested directly: the real CLI path (node dist/cli.js bridge cc-peer <target>) constructs a real CcPeer instance, registers with the local mesh, and starts listening with no crash; --pid=/missing-target argument handling verified against the real CLI. cc-peer was added to this account's min-release-age-exclude list (it's an ExaDev-owned package, published 2 days ago, missing from that list -- a gap, now fixed) per the standing convention for first-party dependencies.

Test plan

  • pnpm typecheck
  • pnpm lint
  • pnpm test (778/778, including 4 new tests for the relay wiring)
  • pnpm build
  • Manual smoke test of the real CLI entry point (no crash, clean shutdown, no stray session-registry entries left behind)

cc-peer speaks Claude Code's own local cross-session peer protocol
directly -- a per-session Unix socket with no cross-machine leg of its
own. This bridge relays exactly one local Claude Code peer into the
agent-comms mesh, the same "one bridge process is one agent is one
device" model every other bridge here already follows, so that session
becomes reachable from any other agent-comms bridge including one on a
different machine, riding on the mesh's own transport.

wireCcPeerBridge (bridge.ts) is the pure, dependency-injected relay
wiring: an inbound cc-peer "message" event is posted into this bridge's
own project room via buildAction/CommsTool.handle; a mesh delivery for
this bridge's own agent is relayed back to the configured target via
CcPeer.send(). run.ts does the real construction (CcPeer.create,
createBridgeMesh, CLI target parsing) and hands both to the wiring
function, kept separate so the relay logic itself is testable without a
real local Claude Code session.

Run via: npx agent-comms bridge cc-peer <target-name>
      or npx agent-comms bridge cc-peer --pid=<pid>
@Mearman
Mearman marked this pull request as ready for review September 16, 2026 06:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-16T06:55:49.748294Z fc48e51 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit 80ce989 into main Sep 16, 2026
6 checks passed
@Mearman
Mearman deleted the feat/cc-peer-bridge branch September 16, 2026 06:56
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a cc-peer bridge for cross-machine Claude Code peer relay

1 participant