Files
openclaw/docs/reference/rpc.md
Jesse Merhi 4a2a600809 feat(channels): add channel-owned setup contracts (#112176)
* feat(channels): add channel-owned setup contracts

* test(channels): align legacy setup fixtures

* chore(channels): regenerate config and SDK baselines after rebase

* fix(update): run fresh doctor after current-process core changes

* fix(channels): align add pre-scan with execution precedence

* style(cli): format channels-cli test additions

* fix(channels): restore option-before-positional channel resolution via metadata arity scan

* fix(channels): keep help flags out of metadata arity escalation

* test(update): mock fresh post-update doctor in current-process suites

* style: format review fixes and correct entrypoint mock type

* fix(channels): register only modern contract options for dual-publishing plugins

* test(update): align downgrade suites with fresh-doctor child invocation

* docs(channels): record empty-contract and input-forwarding invariants

* fix(line): keep the shipped --token switch as a channel access token alias

* fix(signal): stop treating exact cross-family loopback endpoints as bind-aligned

* chore(config): regenerate docs config baselines after second rebase

* style: format rebased channels add tests

* fix(channels): enforce field-key and flag-name agreement in setup contracts

* fix(signal): detect container endpoints for bare --http-url setup

* fix(signal): ignore unconfigured accounts in transport collision checks

* fix(channels): validate negated setup flags in contract and normalizer

* fix(signal): preserve existing transport kind when setup detection is unreachable

* style(signal): use direct boolean check in collision guard

* style(signal): type test config literals

* docs(update): record two-read design of fresh-doctor validation gate

* fix(channels): satisfy post-rebase architecture gates

* docs: refresh channel setup map

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-22 19:57:42 -04:00

1.3 KiB

summary, read_when, title
summary read_when title
RPC adapters for external CLIs (signal-cli, imsg) and gateway patterns
Adding or changing external CLI integrations
Debugging RPC adapters (signal-cli, imsg)
RPC adapters

OpenClaw integrates external CLIs via JSON-RPC. Two patterns are used today.

Pattern A: HTTP daemon (signal-cli)

  • signal-cli runs as a daemon with JSON-RPC over HTTP.
  • Event stream is SSE (/api/v1/events).
  • Health probe: /api/v1/check.
  • OpenClaw owns lifecycle when channels.signal.transport.kind="managed-native" (the default).

See Signal for setup and endpoints.

Pattern B: stdio child process (imsg)

  • OpenClaw spawns imsg rpc as a child process for iMessage.
  • JSON-RPC is line-delimited over stdin/stdout (one JSON object per line).
  • No TCP port, no daemon required.

Core methods used:

  • watch.subscribe → notifications (method: "message")
  • watch.unsubscribe
  • send
  • chats.list (probe/diagnostics)

See iMessage for setup and addressing (chat_id preferred over display strings).

Adapter guidelines

  • Gateway owns the process (start/stop tied to provider lifecycle).
  • Keep RPC clients resilient: timeouts, restart on exit.
  • Prefer stable IDs (e.g., chat_id) over display strings.