Bridge protocol (legacy node transport)
橋接通訊協定是一種 舊版 的節點傳輸(TCP JSONL)。新的節點用戶端 應改用統一的 Gateway WebSocket 傳輸協定。 橋接通訊協定是一種 舊版 的節點傳輸(TCP JSONL)。新的節點用戶端 應改用統一的 Gateway WebSocket 傳輸協定。 New node clients should use the unified Gateway WebSocket protocol instead. 如果你正在建置營運工具或節點用戶端,請使用 Gateway protocol。 注意事項: 目前的 OpenClaw 版本已不再隨附 TCP 橋接監聽器;此文件僅保留作為歷史參考。 舊版的bridge.* 設定金鑰已不再屬於設定結構描述的一部分。
Legacy bridge.* config keys are no longer part of the config schema.
Legacy bridge.* config keys are no longer part of the config schema.
Why we have both
- 安全邊界:橋接僅暴露小型的允許清單,而非完整的 Gateway 閘道器 API 介面。
- Pairing + node identity: node admission is owned by the gateway and tied to a per-node token.
- 探索體驗(UX):節點可透過 LAN 上的 Bonjour 探索 Gateway 閘道器,或經由 tailnet 直接連線。
- Loopback WS:完整的 WS 控制平面除非透過 SSH 通道,否則會維持在本機。
Transport
- TCP,每行一個 JSON 物件(JSONL)。
- 可選 TLS(當
bridge.tls.enabled為 true 時)。 - Legacy default listener port was
18790(current builds do not start a TCP bridge).
bridgeTls=1 以及
bridgeTlsSha256,以便節點能夠釘選憑證。 請注意,Bonjour/mDNS TXT 記錄是
未經驗證的;用戶端不得在沒有使用者明確意圖或其他帶外驗證的情況下,將所公告的指紋視為具權威性的 pin。
Handshake + pairing
- Client sends
hellowith node metadata + token (if already paired). - 若尚未配對,Gateway 閘道器回覆
error(NOT_PAIRED/UNAUTHORIZED)。 - 用戶端送出
pair-request。 - Gateway 閘道器等待核准,接著送出
pair-ok與hello-ok。
hello-ok 會回傳 serverName,且可能包含 canvasHostUrl。
框架(Frames)
用戶端 → Gateway 閘道器:req/res:具範圍的 Gateway RPC(聊天、工作階段、設定、健康狀態、voicewake、skills.bins)event:節點訊號(語音逐字稿、代理程式請求、聊天訂閱、exec 生命週期)
invoke/invoke-res:節點指令(canvas.*、camera.*、screen.record、location.get、sms.send)event:已訂閱工作階段的聊天更新ping/pong:保活(keepalive)
src/gateway/server-bridge.ts(已移除)。
Exec 生命週期事件
Nodes can emitexec.finished or exec.denied events to surface system.run activity.
These are mapped to system events in the gateway. (Legacy nodes may still emit exec.started.)
Payload fields (all optional unless noted):
sessionKey(必填):接收系統事件的代理程式工作階段。runId:用於分組的唯一 exec id。command:原始或格式化的指令字串。exitCode、timedOut、success、output:完成詳細資訊(僅在 finished 時)。reason:拒絕原因(僅在 denied 時)。
Tailnet 使用方式
- 將橋接綁定至 tailnet IP:在
~/.openclaw/openclaw.json中設定bridge.bind: "tailnet"。 - 用戶端可透過 MagicDNS 名稱或 tailnet IP 連線。
- Bonjour 不會 跨網路;必要時請使用手動主機/連接埠或廣域 DNS‑SD。