openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
45 lines (44 loc) • 1.78 kB
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs";
import { r as defaultRuntime } from "./runtime-B-SLYP-m.mjs";
import { r as terminalText } from "./safe-text-C80HAQ2e.mjs";
import { t as ADMIN_SCOPE } from "./operator-scopes-CULmYfyY.mjs";
import "./method-scopes-Dpyb0Ck-.mjs";
import { r as callGatewayFromCliWithTransport } from "./gateway-rpc-CxUN2f1a.mjs";
//#region src/cli/devices-cli-join.ts
async function runDevicesJoinCodeCommand(e) {
const t = await callGatewayFromCliWithTransport("device.pair.setupCode", e, {
bootstrapProfile: "node",
includeQr: false,
joinUrl: true
}, {
label: "Devices device.pair.setupCode",
defaultTimeoutMs: 1e4,
scopes: [ADMIN_SCOPE],
sharedStateMode: "read-only"
});
const n = normalizeOptionalString(t.joinUrl);
if (!n) throw new Error("Gateway did not return a device join URL.");
const r = normalizeOptionalString(t.command);
const i = normalizeOptionalString(t.serviceCommand);
const a = normalizeOptionalString(t.installedCommand);
const o = normalizeOptionalString(t.versionNote);
if (!r || !i || !a) throw new Error("Gateway did not return device join commands. Update the Gateway and try again.");
if (e.json) {
defaultRuntime.writeJson({
joinUrl: n,
command: r,
serviceCommand: i,
installedCommand: a,
...o ? { versionNote: o } : {}
});
return;
}
defaultRuntime.log(terminalText`${n}`);
defaultRuntime.log(terminalText`${r}`);
defaultRuntime.log("Installs a background node service that can run agent sessions.");
defaultRuntime.log(terminalText`Command-only node: ${i}`);
defaultRuntime.log(terminalText`Already have OpenClaw installed? Run: ${a}`);
if (o) defaultRuntime.log(terminalText`${o}`);
}
//#endregion
export { runDevicesJoinCodeCommand };