CLI commands
QR
openclaw qr
從目前的 Gateway 設定產生行動裝置配對 QR 與設定碼。
用法
openclaw qr
openclaw qr --setup-code-only
openclaw qr --json
openclaw qr --remote
openclaw qr --url wss://gateway.example/ws
選項
--remote:優先使用gateway.remote.url;若未設定,gateway.tailscale.mode=serve|funnel仍可提供遠端公開 URL--url <url>:覆寫承載資料中使用的 Gateway URL--public-url <url>:覆寫承載資料中使用的公開 URL--token <token>:覆寫啟動流程用來驗證的 Gateway 權杖--password <password>:覆寫啟動流程用來驗證的 Gateway 密碼--setup-code-only:只列印設定碼--no-ascii:略過 ASCII QR 算繪--json:輸出 JSON(setupCode、gatewayUrl、auth、urlSource)
注意事項
--token和--password互斥。- 設定碼本身現在攜帶不透明且短效的
bootstrapToken,而不是共用的 Gateway 權杖/密碼。 - 在內建的 Node/操作者啟動流程中,主要 Node 權杖仍會以
scopes: []落地。 - 如果啟動交接也簽發操作者權杖,該權杖會維持限制在啟動允許清單中:
operator.approvals、operator.read、operator.talk.secrets、operator.write。 - 啟動範圍檢查具有角色前綴。該操作者允許清單只滿足操作者請求;非操作者角色仍需要其自身角色前綴下的範圍。
- 行動裝置配對會對 Tailscale/公開
ws://Gateway URL 採取失敗關閉。私人 LAN 位址和.localBonjour 主機仍支援透過ws://使用,但 Tailscale/公開行動路由應使用 Tailscale Serve/Funnel 或wss://Gateway URL。 - 使用
--remote時,OpenClaw 需要gateway.remote.url或gateway.tailscale.mode=serve|funnel。 - 使用
--remote時,如果實際作用中的遠端憑證設定為 SecretRefs,且你沒有傳入--token或--password,此命令會從作用中的 Gateway 快照解析它們。如果 Gateway 無法使用,此命令會快速失敗。 - 不使用
--remote時,若未傳入 CLI 驗證覆寫,會解析本機 Gateway 驗證 SecretRefs:- 當權杖驗證可勝出時,會解析
gateway.auth.token(明確的gateway.auth.mode="token",或在沒有密碼來源勝出的情況下推斷出的模式)。 - 當密碼驗證可勝出時,會解析
gateway.auth.password(明確的gateway.auth.mode="password",或在沒有來自驗證/環境的權杖勝出的情況下推斷出的模式)。
- 當權杖驗證可勝出時,會解析
- 如果同時設定了
gateway.auth.token和gateway.auth.password(包含 SecretRefs),且未設定gateway.auth.mode,設定碼解析會失敗,直到明確設定模式為止。 - Gateway 版本偏差注意事項:此命令路徑需要支援
secrets.resolve的 Gateway;較舊的 Gateway 會傳回未知方法錯誤。 - 掃描後,使用以下命令核准裝置配對:
openclaw devices listopenclaw devices approve <requestId>