openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
37 lines (36 loc) • 1.39 kB
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-1VuiLaaR.mjs";
import { r as defaultRuntime } from "./runtime-BRg2NubB.mjs";
import { t as quoteCliArg } from "./quote-cli-arg-BEt71TUh.mjs";
import { t as ADMIN_SCOPE } from "./operator-scopes-BO7_XQCg.mjs";
import { r as callGatewayFromCliWithTransport } from "./gateway-rpc-9mVMq9dg.mjs";
import "./method-scopes-CRSVCw9J.mjs";
//#region src/cli/devices-cli-join.ts
async function runDevicesJoinCodeCommand(opts) {
const result = await callGatewayFromCliWithTransport("device.pair.setupCode", opts, {
bootstrapProfile: "node",
includeQr: false,
joinUrl: true
}, {
label: "Devices device.pair.setupCode",
defaultTimeoutMs: 1e4,
scopes: [ADMIN_SCOPE],
sharedStateMode: "read-only"
});
const joinUrl = normalizeOptionalString(result.joinUrl);
if (!joinUrl) throw new Error("Gateway did not return a device join URL.");
const serviceCommand = `npx -y openclaw connect ${quoteCliArg(joinUrl)} --service`;
const command = `${serviceCommand} --session-host`;
if (opts.json) {
defaultRuntime.writeJson({
joinUrl,
command
});
return;
}
defaultRuntime.log(joinUrl);
defaultRuntime.log(command);
defaultRuntime.log("Installs a background node service that can run agent sessions.");
defaultRuntime.log(`Command-only node: ${serviceCommand}`);
}
//#endregion
export { runDevicesJoinCodeCommand };