Files
openclaw/docs/reference/rpc.md

42 lines
1.2 KiB
Markdown
Raw Normal View History

2026-01-02 01:19:22 +01:00
---
summary: "RPC adapters for external CLIs (signal-cli, imsg) and gateway patterns"
read_when:
- Adding or changing external CLI integrations
- Debugging RPC adapters (signal-cli, imsg)
title: "RPC Adapters"
2026-01-02 01:19:22 +01:00
---
2026-01-31 21:13:13 +09:00
2026-01-02 01:19:22 +01:00
# RPC adapters
2026-01-30 03:15:10 +01:00
OpenClaw integrates external CLIs via JSON-RPC. Two patterns are used today.
2026-01-02 01:19:22 +01:00
## Pattern A: HTTP daemon (signal-cli)
2026-01-31 21:13:13 +09:00
2026-01-02 01:19:22 +01:00
- `signal-cli` runs as a daemon with JSON-RPC over HTTP.
- Event stream is SSE (`/api/v1/events`).
- Health probe: `/api/v1/check`.
2026-01-30 03:15:10 +01:00
- OpenClaw owns lifecycle when `channels.signal.autoStart=true`.
2026-01-02 01:19:22 +01:00
See [Signal](/channels/signal) for setup and endpoints.
2026-01-02 01:19:22 +01:00
## Pattern B: stdio child process (imsg)
2026-01-31 21:13:13 +09:00
2026-01-30 03:15:10 +01:00
- OpenClaw spawns `imsg rpc` as a child process.
2026-01-02 01:19:22 +01:00
- JSON-RPC is line-delimited over stdin/stdout (one JSON object per line).
- No TCP port, no daemon required.
Core methods used:
2026-01-31 21:13:13 +09:00
2026-01-02 01:19:22 +01:00
- `watch.subscribe` → notifications (`method: "message"`)
- `watch.unsubscribe`
- `send`
- `chats.list` (probe/diagnostics)
See [iMessage](/channels/imessage) for setup and addressing (`chat_id` preferred).
2026-01-02 01:19:22 +01:00
## Adapter guidelines
2026-01-31 21:13:13 +09:00
2026-01-02 01:19:22 +01:00
- 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.