openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
70 lines (69 loc) • 2.23 kB
JavaScript
import { t as restoreTerminalState } from "./restore-DNQI6tve.mjs";
import { n as WizardCancelledError } from "./prompts-CCXo2K24.mjs";
import { r as t } from "./i18n-AiHKCZaZ.mjs";
import path from "node:path";
//#region src/commands/onboard-interactive-runner.ts
async function runInteractiveOnboarding(e, n) {
let r = null;
try {
await e();
} catch (e) {
if (e instanceof WizardCancelledError) {
r = 1;
return;
}
throw e;
} finally {
restoreTerminalState("setup finish", { resumeStdinIfPaused: false });
if (r !== null) n.exit(r);
}
}
async function launchHatchTui(e, n, r) {
const [{ launchTuiCli: i }, { DEFAULT_BOOTSTRAP_FILENAME: a }, o, { readActiveGatewayLockIdentity: s }] = await Promise.all([
import("./tui-launch-Du5NfFrb.mjs"),
import("./workspace-bfkABDJi.mjs"),
import("node:fs"),
import("./gateway-lock-C8DzJkpV.mjs")
]);
const c = o.existsSync(path.join(e, a));
const l = n && !await s();
restoreTerminalState("guided hatch tui", { resumeStdinIfPaused: false });
try {
await i({
...l ? { local: true } : {},
deliver: false,
...r ? { session: `agent:${r}:main` } : {},
...c ? { message: t("wizard.finalize.bootstrapHatchMessage") } : {}
});
} finally {
restoreTerminalState("post guided hatch tui", { resumeStdinIfPaused: false });
}
}
async function runGuidedOnboardingHandoff(e, n, r, i) {
if (!e) return;
if (e.next === "foreground-gateway") {
const { runQuickstartForegroundGateway: i } = await import("./onboard-quickstart-host-DFaYZlnA.mjs");
await i({
runtime: r,
...e.agentId ? { agentId: e.agentId } : {},
...n.suppressGatewayTokenOutput ? { suppressTokenOutput: true } : {}
});
return;
}
if (e.next === "hatch") {
await launchHatchTui(e.workspace, e.local, e.agentId);
return;
}
if (e.next === "browser") return;
if (i.runSystemAgentChat) await i.runSystemAgentChat(e.workspace, r, true, e.agentName);
else {
const { runConversationalOnboarding: n } = await import("./onboard-interactive-CJ3psnaV.mjs");
await n({
workspace: e.workspace,
...e.agentName ? { agentName: e.agentName } : {},
acceptRisk: true
}, r);
}
}
//#endregion
export { runInteractiveOnboarding as n, runGuidedOnboardingHandoff as t };