openclaw devices

管理设备配对请求和设备范围的令牌。

命令

openclaw devices list

列出待处理的配对请求和已配对的设备。

openclaw devices list
openclaw devices list --json

openclaw devices remove <deviceId>

移除一个已配对的设备条目。

openclaw devices remove <deviceId>
openclaw devices remove <deviceId> --json

openclaw devices clear --yes [--pending]

批量清除已配对的设备。

openclaw devices clear --yes
openclaw devices clear --yes --pending
openclaw devices clear --yes --pending --json

openclaw devices approve [requestId] [--latest]

批准待处理的设备配对请求。如果省略 requestId,OpenClaw 会自动批准最新的待处理请求。

openclaw devices approve
openclaw devices approve <requestId>
openclaw devices approve --latest

openclaw devices reject <requestId>

拒绝待处理的设备配对请求。

openclaw devices reject <requestId>

openclaw devices rotate --device <id> --role <role> [--scope <scope...>]

为特定角色轮换设备令牌(可选择更新作用域)。

openclaw devices rotate --device <deviceId> --role operator --scope operator.read --scope operator.write

openclaw devices revoke --device <id> --role <role>

撤销特定角色的设备令牌。

openclaw devices revoke --device <deviceId> --role node

常用选项

  • --url <url>:网关 WebSocket URL(配置时默认为 gateway.remote.url)。
  • --token <token>:网关令牌(如需要)。
  • --password <password>:网关密码(密码认证)。
  • --timeout <ms>:RPC 超时时间。
  • --json:JSON 输出(推荐用于脚本)。

注意:当你设置 --url 时,CLI 不会回退到配置或环境凭证。需要显式传递 --token--password。缺少显式凭证会导致错误。

注意事项

  • 令牌轮换会返回新令牌(敏感信息)。请将其作为密钥处理。
  • 这些命令需要 operator.pairing(或 operator.admin)作用域。
  • devices clear 故意需要 --yes 确认。
  • 如果本地回环上无法使用配对作用域(且未传递显式 --url),列表/批准可以使用本地配对回退方案。