跳转至

openclaw tui

打开连接到 Gateway 的终端 UI,或者以本地嵌入式模式运行它。

openclaw tui [target]

target 可以是 Control UI 会话 URL、紧凑的 host/agent/ref、裸短引用(如 movies-a1166b81)或字面量 agent:... 会话密钥。URL 或 host 目标会权威地选择该 Gateway;裸引用使用已配置或默认的 Gateway。你也可以直接将 Control UI URL 粘贴为 openclaw <url>,并将 TUI 选项放在其前后,例如 openclaw <url> --token <token> --deliver。

裸 URL 形式接受 --token、--password、--tls-fingerprint、--deliver、--thinking、--message、--timeout-ms 和 --history-limit。带 URL 值的消息可在任一位置使用,包括 openclaw --message https://example.com/article <url>。当你还需要其他 TUI 选项时,使用 openclaw tui <url>;--local、--url 和 --session 与会话 URL 冲突。

相关指南:TUI

选项

Flag Default Description
--local false 针对本地嵌入式 agent 运行时运行,而非 Gateway。
--url <url> 来自配置的 gateway.remote.url Gateway WebSocket URL。
--token <token> (无) 如果需要,提供 Gateway token。
--password <pass> (无) 如果需要,提供 Gateway 密码。
--tls-fingerprint <sha256> gateway.remote.tlsFingerprint 用于固定 wss:// Gateway 的预期 TLS 证书指纹。
--session <key> main(scope 为 global 时为 global) 会话密钥。在 agent 工作区内,除非带有前缀,否则会自动选择该 agent。
--deliver false 通过已配置的渠道投递助手回复。
--thinking <level> (模型默认) 思考级别覆盖。
--message <text> (无) 连接后发送一条初始消息。
--timeout-ms <ms> agents.defaults.timeoutSeconds Agent 超时。无效值会记录警告并被忽略。
--history-limit <n> 200 附加时要加载的历史记录条目数。

别名:openclaw chat 和 openclaw terminal 以隐含的 --local 调用此命令。

备注

  • --local 不能与 --url、--token、--password 或 --tls-fingerprint 组合使用。
  • 只能传入一个 Gateway 目标。URL 目标不能与 --url 组合,任何位置参数目标不能与 --session 或本地模式组合。
  • URL 或 host 目标永远不会复用已配置的凭据或 OPENCLAW_GATEWAY_TOKEN / OPENCLAW_GATEWAY_PASSWORD。它使用该确切 Gateway origin 的已存储设备 token,或使用显式 --token/--password 凭据。首次接触时,请先传入其中一种凭据一次,在该 Gateway 的 Control UI 中批准配对请求,然后重试;参见 Devices。
  • 会话 URL 必须保持无凭据。userinfo 以及诸如 token 和 password 之类的敏感查询或 fragment 参数会被拒绝。
  • 短引用通过 Gateway 解析。如果短引用有歧义,CLI 会打印候选名称和更长的 ID 前缀,而不会附加到任一会话。
  • 在没有 URL/host 目标或显式 --url 时,tui 会尽可能解析已配置 Gateway 的认证 SecretRefs,以用于 token/password 认证(env/file/exec/store providers)。
  • 当已配置的远程 Gateway 位于感知身份的代理之后时,tui 会解析 gateway.remote.edgeAuth SecretInputs,并仅向该已配置的 Gateway scope 发送这些 header。其他 origin 的 URL 或 host 目标不会继承它们。
  • 在没有显式 URL 或端口时,tui 会跟随正在运行的 Gateway 记录的活动本地 Gateway 端口。显式 --url、OPENCLAW_GATEWAY_URL、OPENCLAW_GATEWAY_PORT 以及远程 Gateway 配置保持优先。
  • 从已配置的 agent 工作区目录内启动时,TUI 会自动为该会话密钥默认值选择该 agent(除非 --session 显式为 agent:<id>:...)。
  • 本地模式直接使用嵌入式 agent 运行时。大多数本地工具可用,但仅限 Gateway 的功能不可用。
  • 本地模式需要对已配置的状态目录拥有独占所有权。如果 Gateway 或其他嵌入式写入者拥有该状态,它会拒绝启动;要不使用 --local 来使用活动 Gateway,要不先用 openclaw gateway stop 停止它。
  • 本地模式会在 TUI 命令表面添加 /auth [provider]。
  • 插件审批门控在本地模式仍然适用:需要审批的工具会在终端中提示决策,不会被静默自动批准。
  • ask_user 问题 在两种模式下都会显示为交互式提示。按 Esc 会在不回答的情况下收起提示;/question 会重新打开它。
  • Gateway 模式接受 secrets 请求,使用带只读允许主机列表的掩码输入。本地模式无法满足存储绑定的请求;请使用 openclaw secrets store 或在有运行 Gateway 的情况下使用 Control UI。
  • 会话 goals 会显示在页脚中,并可通过 /goal 管理。

会话目标错误

失败 恢复
Gateway 早于短链接解析功能 从该 Gateway 的 Control UI 复制完整会话密钥。
会话缺失或短引用不明确 对于已配置/本地 Gateway,运行 openclaw sessions list;对于 URL/主机目标,请在该 Gateway 的 Control UI 中选择更长或完整的密钥。
Gateway 不可达 错误信息会指出所选的源。对于 *.ts.net 主机,请连接 Tailscale,并确认该 Gateway 在 tailnet 上可达。
身份感知代理拒绝了升级请求 为已配置的远程 Gateway 配置 gateway.remote.edgeAuth;错误信息中包含相关的远程访问文档链接。
存储的设备令牌被吊销或轮换 使用 openclaw devices rotate --device <deviceId> --role operator 轮换它,然后重新连接。
TLS 证书固定值不匹配 原始 TLS 指纹错误会原样传递;重试前,请验证配置的或显式指定的固定值。

示例

openclaw chat
openclaw tui --local
openclaw tui
openclaw tui https://gateway.example/dashboard/main/movies-a1166b81
openclaw https://gateway.example/dashboard/main/movies-a1166b81 --token <token>
openclaw tui movies-a1166b81
openclaw tui --url ws://127.0.0.1:18789 --token <token>
openclaw tui --session main --deliver
openclaw chat --message "Compare my config to the docs and tell me what to fix"
# when run inside an agent workspace, infers that agent automatically
openclaw tui --session bugfix

配置修复循环

使用本地模式,让嵌入式 Agent 检查当前配置,将其与文档进行比较,并在同一终端中帮助修复。

如果 openclaw config validate 已经失败,请先运行 openclaw configure 或 openclaw doctor --fix;openclaw chat 不会绕过无效配置保护。

openclaw chat

然后在 TUI 中:

!openclaw config file
!openclaw docs gateway auth token secretref
!openclaw config validate
!openclaw doctor

使用 openclaw config set 或 openclaw configure 应用针对性修复,然后重新运行 openclaw config validate。参见 TUI 和 配置。

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 cl/openclaw