openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 3.27 kB
JavaScript
import{n as createLazyRuntimeMethodBinder}from"./lazy-runtime-Ds6M7vp4.mjs";import{t as isDevicesMachineOutput}from"./devices-output-mode-BzcbnbX5.mjs";import{t as applyParentDefaultHelpAction}from"./parent-default-help-BQhbR5_q.mjs";import{n as setCommandJsonMode}from"./json-mode-COATK2x3.mjs";import{Option}from"commander";
//!src/cli/devices-cli.ts
const DEFAULT_DEVICES_TIMEOUT_MS=1e4;const deviceAction=createLazyRuntimeMethodBinder(()=>import(`./devices-cli.runtime-C5lrAjvi.mjs`));const joinAction=createLazyRuntimeMethodBinder(()=>import(`./devices-cli-join-D_ghFZs-.mjs`));function registerDevicesCli(e){const t=e.command(`devices`).description("Device pairing and auth tokens (for mobile app setup codes, use `openclaw qr` instead)");t.command(`list`).description(`List pending and paired devices`).action(deviceAction(e=>e.runDevicesListCommand));t.command(`join-code`).description("Mint a single-use node onboarding URL (not a mobile app setup code; use `openclaw qr` for that)").action(joinAction(e=>e.runDevicesJoinCodeCommand));t.command(`remove`).description(`Remove a paired device entry`).argument(`<deviceId>`,`Paired device id`).action(deviceAction(e=>e.runDevicesDeleteCommand.bind(null,`remove`)));t.command(`clear`).description(`Clear paired devices from the gateway table`).option(`--pending`,`Also reject all pending pairing requests`,false).option(`--yes`,`Confirm destructive clear`,false).action(deviceAction(e=>e.runDevicesClearCommand));t.command(`approve`).description(`Approve a pending device pairing request`).argument(`[requestId]`,`Pending request id`).option(`--latest`,`Show the most recent pending request to approve explicitly`,false).action(deviceAction(e=>e.runDevicesApproveCommand));t.command(`reject`).description(`Reject a pending device pairing request`).argument(`<requestId>`,`Pending request id`).action(deviceAction(e=>e.runDevicesDeleteCommand.bind(null,`reject`)));t.command(`rename`).description(`Assign an operator label to a paired device`).requiredOption(`--device <id>`,`Device id`).requiredOption(`--name <label>`,`Operator-assigned label (max 64 characters)`).action(deviceAction(e=>e.runDevicesRenameCommand));t.command(`rotate`).description(`Rotate a device token for a role`).requiredOption(`--device <id>`,`Device id`).requiredOption(`--role <role>`,`Role name`).option(`--scope <scope...>`,`Scopes to attach to the token (repeatable)`).addOption(new Option(`--no-scopes`,`Rotate with an empty scope set`).conflicts(`scope`)).action(deviceAction(e=>e.runDevicesTokenCommand.bind(null,`rotate`)));t.command(`revoke`).description(`Revoke a device token for a role`).requiredOption(`--device <id>`,`Device id`).requiredOption(`--role <role>`,`Role name`).action(deviceAction(e=>e.runDevicesTokenCommand.bind(null,`revoke`)));for(const e of t.commands)e.option(`--url <url>`,`Gateway WebSocket URL (defaults to gateway.remote.url when configured)`).option(`--token <token>`,`Gateway token (if required)`).option(`--password <password>`,`Gateway password (password auth)`).option(`--timeout <ms>`,`Timeout in ms`,String(DEFAULT_DEVICES_TIMEOUT_MS)).option(`--json`,`Output JSON`,false);setCommandJsonMode(t,`output`,({argv:e})=>isDevicesMachineOutput(e));applyParentDefaultHelpAction(t)}export{registerDevicesCli};