Spaces:
Paused
Paused
|
Download docs/reference/rpc.md from amos-fernandes/melbot: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/amos-fernandes/melbot/resolve/main/docs/reference/rpc.md
- Command line
-
hf download hf://spaces/amos-fernandes/melbot/docs/reference/rpc.md
-
curl -L -o rpc.md https://huggingface.co/spaces/amos-fernandes/melbot/resolve/main/docs/reference/rpc.md
1.22 kB
metadata
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)
RPC adapters
Moltbot integrates external CLIs via JSON-RPC. Two patterns are used today.
Pattern A: HTTP daemon (signal-cli)
signal-cliruns as a daemon with JSON-RPC over HTTP.- Event stream is SSE (
/api/v1/events). - Health probe:
/api/v1/check. - Moltbot owns lifecycle when
channels.signal.autoStart=true.
See Signal for setup and endpoints.
Pattern B: stdio child process (imsg)
- Moltbot spawns
imsg rpcas a child process. - 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.unsubscribesendchats.list(probe/diagnostics)
See iMessage for setup and addressing (chat_id preferred).
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.