六、高级功能(节点与媒体)
6.1 节点(Nodes)概览
节点是一个配套设备(macOS/iOS/Android/无头),它通过 role: "node" 连接到 Gateway 网关 WebSocket,并暴露命令接口。
节点能做什么
| 能力 | 说明 |
|---|---|
| Canvas | 展示网页、求值 JS、截图快照 |
| Camera | 拍照、录制视频片段 |
| Screen | 屏幕录制 |
| Location | 获取位置信息 |
| SMS | 发送短信(Android) |
| System | 运行系统命令 |
| Notifications | 发送系统通知 |
重要说明
- 节点是外围设备,不是网关
- 节点不运行网关服务
- Telegram/WhatsApp 等消息会到达 gateway,不会到达节点
6.2 节点配对
配对流程
- 节点启动时提供设备身份
- Gateway 为
role: node创建设备配对请求 - 通过 CLI 或 UI 批准
CLI 命令
# 查看待配对设备
openclaw devices list
# 批准配对
openclaw devices approve <requestId>
# 拒绝配对
openclaw devices reject <requestId>
# 查看节点状态
openclaw nodes status
# 描述节点
openclaw nodes describe --node <idOrNameOrIp>命名节点
# 启动时指定名称
openclaw node run --host <gateway-host> --port 18789 --display-name "Build Node"
# 重命名
openclaw nodes rename --node <id|name|ip> --name "Build Node"6.3 启动节点主机
前台运行
在节点机器上:
openclaw node run --host <gateway-host> --port 18789 --display-name "Build Node"作为服务运行
openclaw node install --host <gateway-host> --port 18789 --display-name "Build Node"
openclaw node restart通过 SSH 隧道连接
如果 Gateway 绑定到 loopback:
# 终端 A(保持运行)
ssh -N -L 18790:127.0.0.1:18789 user@gateway-host
# 终端 B
export OPENCLAW_GATEWAY_TOKEN="<gateway-token>"
openclaw node run --host 127.0.0.1 --port 18790 --display-name "Build Node"6.4 节点命令
Canvas(画布)
# 展示网页
openclaw nodes canvas present --node <id> --target https://example.com
# 隐藏画布
openclaw nodes canvas hide --node <id>
# 导航
openclaw nodes canvas navigate https://example.com --node <id>
# 执行 JS
openclaw nodes canvas eval --node <id> --js "document.title"
# 截图
openclaw nodes canvas snapshot --node <id> --format png
openclaw nodes canvas snapshot --node <id> --format jpg --max-width 1200 --quality 0.9A2UI(画布)
# 推送 A2UI 内容
openclaw nodes canvas a2ui push --node <id> --text "Hello"
openclaw nodes canvas a2ui push --node <id> --jsonl ./payload.jsonl
# 重置
openclaw nodes canvas a2ui reset --node <id>摄像头
# 列出摄像头
openclaw nodes camera list --node <id>
# 拍照
openclaw nodes camera snap --node <id>
openclaw nodes camera snap --node <id> --facing front
# 录制视频
openclaw nodes camera clip --node <id> --duration 10s
openclaw nodes camera clip --node <id> --duration 3000 --no-audio屏幕录制
openclaw nodes screen record --node <id> --duration 10s --fps 10
openclaw nodes screen record --node <id> --duration 10s --fps 10 --no-audio位置
openclaw nodes location get --node <id>
openclaw nodes location get --node <id> --accuracy precise --max-age 15000系统命令
# 发送通知
openclaw nodes notify --node <id> --title "Ping" --body "Gateway ready"
# 查找命令路径
openclaw nodes invoke --node <id> --command system.which --params '{"name":"git"}'6.5 Exec 节点绑定
当有多个节点可用时,将 exec 绑定到特定节点:
# 全局默认
openclaw config set tools.exec.node "node-id-or-name"
# 按智能体覆盖
openclaw config set agents.list[0].tools.exec.node "node-id-or-name"
# 取消设置
openclaw config unset tools.exec.node6.6 Exec 批准
添加允许列表
openclaw approvals allowlist add --node <id|name|ip> "/usr/bin/uname"
openclaw approvals allowlist add --node <id|name|ip> "/usr/bin/sw_vers"批准信息保存在节点主机上的 ~/.openclaw/exec-approvals.json。
将 exec 指向节点
# 配置默认值
openclaw config set tools.exec.host node
openclaw config set tools.exec.security allowlist
openclaw config set tools.exec.node "<id-or-name>"
# 按会话设置
/exec host=node security=allowlist node=<id-or-name>6.7 媒体理解
图片与媒体支持
- 图片、音频、视频和文档的输入与输出
- 使用
image工具进行分析 - 使用
image_generate进行生成或编辑
音频和语音消息
- 语音消息转录
- 支持多个提供商的文本转语音
摄像头捕获
- 节点摄像头拍照和录像
- 节点必须处于前台才能使用 canvas 和 camera
Talk 模式
- 语音唤醒
- 实时语音交互
6.8 文本转语音 (TTS)
使用 tts 工具进行一次性文本转语音转换。
配置
在配置中设置 TTS 提供商和语音:
{
"tts": {
"provider": "openai",
"voice": "alloy"
}
}6.9 无头节点主机
OpenClaw 可以运行一个无头节点主机(无 UI),连接到 Gateway 并暴露 system.run / system.which。
openclaw node run --host <gateway-host> --port 18789适用于 Linux/Windows,或在服务器旁运行一个最小节点。
6.10 Mac 节点模式
macOS 菜单栏应用会作为节点连接到 Gateway WS 服务器。
在远程模式下,应用会为 Gateway 端口打开 SSH 隧道,并连接到 localhost。