import "./reply-B_OGAHxU.js";
import "./paths-B4BZAPZh.js";
import "./utils-h12D6i3s.js";
import { r as theme } from "./theme-CvDUwCeH.js";
import "./thinking-B3X4Pu2T.js";
import "./registry-CEok6CBD.js";
import { f as defaultRuntime } from "./subsystem-CptcaHdG.js";
import "./exec-KZG5pigM.js";
import "./agent-scope-DuRxDIxP.js";
import "./model-selection-Ci1X7yz4.js";
import "./github-copilot-token-BZDGcFI5.js";
import "./boolean-BsqeuxE6.js";
import "./env-Du80aeH-.js";
import "./config-DpEIy1Iq.js";
import "./manifest-registry-DP5prNZc.js";
import "./runner-B8-WBmYS.js";
import "./image-B5SB0tN4.js";
import "./models-config-BvUgiLNT.js";
import "./pi-model-discovery-BXtQTdf5.js";
import "./pi-embedded-helpers-Dt-sU2cn.js";
import "./sandbox-DaCbovTo.js";
import "./chrome-C2U0x_vA.js";
import "./tailscale-CRbgJwcF.js";
import "./auth-lS4wOBFo.js";
import "./server-context-B-YCUG7A.js";
import "./frontmatter-DrdSsH4-.js";
import "./skills-AD616ijL.js";
import "./routes-Cv9WOuy_.js";
import "./redact-CjJyQlVU.js";
import "./errors-CdJjJ1Jq.js";
import "./paths-WCTMjONe.js";
import "./ssrf-BT0IElaU.js";
import "./image-ops-BP1giyhy.js";
import "./store-q26Wtsy_.js";
import "./ports-CTzsGOMF.js";
import "./trash-BeFHeovG.js";
import "./sessions-C_NwV0mt.js";
import "./dock-kPWc7D0x.js";
import "./message-channel-CP2gEtPf.js";
import "./normalize-DqxNnJHS.js";
import "./accounts-DOhECffI.js";
import "./accounts-C1lp0M2X.js";
import "./accounts-BEp1f-Fs.js";
import "./bindings-OUZ-uS5k.js";
import "./logging-D3KTM1pH.js";
import "./send-D2KedNDe.js";
import "./plugins-DXhAnLR9.js";
import "./send-DgJ5msQW.js";
import "./paths-gjLMn4eA.js";
import "./tool-images-DJNWvX-X.js";
import "./tool-display-u8k8a1Tt.js";
import "./fetch-guard-ZRDg55CN.js";
import "./api-key-rotation-uNbQP6UQ.js";
import "./fetch-Dzzhxfkw.js";
import "./sqlite-DE_PUv3w.js";
import "./model-catalog-CvWJHJCg.js";
import "./tokens-DzxZZSkc.js";
import "./with-timeout-GP6SU5gJ.js";
import "./deliver-C4CaFOo6.js";
import "./diagnostic-BzB3fr3H.js";
import "./diagnostic-session-state-8W4S9gt1.js";
import "./send-CT8WXASB.js";
import "./model-Cvdxo1yi.js";
import "./reply-prefix-D96oVZA4.js";
import "./memory-cli-DWhshmym.js";
import "./manager--2hbjmvx.js";
import "./retry-C790w9um.js";
import "./common-DRqN8wrX.js";
import "./chunk-DLXgG-Hp.js";
import "./markdown-tables-PlwJ_Osa.js";
import "./ir-j6-6N0Xv.js";
import "./render-CXDO_kgw.js";
import "./commands-registry-HG-E3pjW.js";
import "./client-CyLl-iJJ.js";
import "./call-Bs5EoNE4.js";
import "./channel-activity-BWmlj9sY.js";
import "./fetch-Cm3dYu7v.js";
import "./tables-nYGLZHh5.js";
import "./send-Cqajy2MP.js";
import "./pairing-store-DLcIgt6E.js";
import "./proxy-6yunx6Zq.js";
import { t as formatDocsLink } from "./links-Dmyh_lxI.js";
import { n as runCommandWithRuntime } from "./cli-utils-BqMwAlgf.js";
import "./help-format-DEcAb7Hf.js";
import "./progress-CHPCu7oZ.js";
import "./resolve-route-D8T9lzde.js";
import "./replies-B-JUCnE1.js";
import "./skill-commands-BSfygubG.js";
import "./workspace-dirs-mwzNI7GY.js";
import "./pi-tools.policy-1nY10FTU.js";
import "./send-BgUrMvy5.js";
import "./onboard-helpers-C0RIySS1.js";
import "./prompt-style-7y8Wox11.js";
import "./outbound-attachment-CGcEC42p.js";
import "./pairing-labels-D713magM.js";
import "./session-cost-usage-CPpYqnqX.js";
import "./nodes-screen-DswDJioD.js";
import "./project-context-D8tjNLtw.js";
import "./control-service-2kAiX_qJ.js";
import "./stagger-Qhb6HicQ.js";
import "./channel-selection-DENvhXo1.js";
import "./delivery-queue-DnX3NB1u.js";
import "./runtime-guard-3Y9--7bU.js";
import "./note-Ds2RlF8N.js";
import "./clack-prompter-DylfOgBh.js";
import "./daemon-runtime-Br8OF35a.js";
import "./systemd-DRdU5sOU.js";
import "./service-BjqyRLSC.js";
import "./health-prGIcSiI.js";
import "./onboarding-Cu5fvJKG.js";
import "./shared-yu_zfA6m.js";
import "./auth-token-CvBWcsws.js";
import "./logging-T3s_DwcU.js";
import { n as formatAuthChoiceChoicesForCli } from "./auth-choice-options-B4GnEmY_.js";
import "./openai-model-default-CW68uJLe.js";
import "./vllm-setup-D2VL1tXo.js";
import "./systemd-linger-BwHZYtAo.js";
import "./model-picker-Cc5JQ_is.js";
import "./onboard-custom-BBTlEZq2.js";
import { n as ONBOARD_PROVIDER_AUTH_FLAGS, t as onboardCommand } from "./onboard-a81LstwG.js";

//#region src/cli/program/register.onboard.ts
function resolveInstallDaemonFlag(command, opts) {
	if (!command || typeof command !== "object") return;
	const getOptionValueSource = "getOptionValueSource" in command ? command.getOptionValueSource : void 0;
	if (typeof getOptionValueSource !== "function") return;
	if (getOptionValueSource.call(command, "skipDaemon") === "cli") return false;
	if (getOptionValueSource.call(command, "installDaemon") === "cli") return Boolean(opts.installDaemon);
}
const AUTH_CHOICE_HELP = formatAuthChoiceChoicesForCli({
	includeLegacyAliases: true,
	includeSkip: true
});
function registerOnboardCommand(program) {
	const command = program.command("onboard").description("Interactive wizard to set up the gateway, workspace, and skills").addHelpText("after", () => `\n${theme.muted("Docs:")} ${formatDocsLink("/cli/onboard", "docs.openclaw.ai/cli/onboard")}\n`).option("--workspace <dir>", "Agent workspace directory (default: ~/.openclaw/workspace)").option("--reset", "Reset config + credentials + sessions + workspace before running wizard").option("--non-interactive", "Run without prompts", false).option("--accept-risk", "Acknowledge that agents are powerful and full system access is risky (required for --non-interactive)", false).option("--flow <flow>", "Wizard flow: quickstart|advanced|manual").option("--mode <mode>", "Wizard mode: local|remote").option("--auth-choice <choice>", `Auth: ${AUTH_CHOICE_HELP}`).option("--token-provider <id>", "Token provider id (non-interactive; used with --auth-choice token)").option("--token <token>", "Token value (non-interactive; used with --auth-choice token)").option("--token-profile-id <id>", "Auth profile id (non-interactive; default: <provider>:manual)").option("--token-expires-in <duration>", "Optional token expiry duration (e.g. 365d, 12h)").option("--cloudflare-ai-gateway-account-id <id>", "Cloudflare Account ID").option("--cloudflare-ai-gateway-gateway-id <id>", "Cloudflare AI Gateway ID");
	for (const providerFlag of ONBOARD_PROVIDER_AUTH_FLAGS) command.option(providerFlag.cliOption, providerFlag.description);
	command.option("--custom-base-url <url>", "Custom provider base URL").option("--custom-api-key <key>", "Custom provider API key (optional)").option("--custom-model-id <id>", "Custom provider model ID").option("--custom-provider-id <id>", "Custom provider ID (optional; auto-derived by default)").option("--custom-compatibility <mode>", "Custom provider API compatibility: openai|anthropic (default: openai)").option("--gateway-port <port>", "Gateway port").option("--gateway-bind <mode>", "Gateway bind: loopback|tailnet|lan|auto|custom").option("--gateway-auth <mode>", "Gateway auth: token|password").option("--gateway-token <token>", "Gateway token (token auth)").option("--gateway-password <password>", "Gateway password (password auth)").option("--remote-url <url>", "Remote Gateway WebSocket URL").option("--remote-token <token>", "Remote Gateway token (optional)").option("--tailscale <mode>", "Tailscale: off|serve|funnel").option("--tailscale-reset-on-exit", "Reset tailscale serve/funnel on exit").option("--install-daemon", "Install gateway service").option("--no-install-daemon", "Skip gateway service install").option("--skip-daemon", "Skip gateway service install").option("--daemon-runtime <runtime>", "Daemon runtime: node|bun").option("--skip-channels", "Skip channel setup").option("--skip-skills", "Skip skills setup").option("--skip-health", "Skip health check").option("--skip-ui", "Skip Control UI/TUI prompts").option("--node-manager <name>", "Node manager for skills: npm|pnpm|bun").option("--json", "Output JSON summary", false);
	command.action(async (opts, commandRuntime) => {
		await runCommandWithRuntime(defaultRuntime, async () => {
			const installDaemon = resolveInstallDaemonFlag(commandRuntime, { installDaemon: Boolean(opts.installDaemon) });
			const gatewayPort = typeof opts.gatewayPort === "string" ? Number.parseInt(opts.gatewayPort, 10) : void 0;
			await onboardCommand({
				workspace: opts.workspace,
				nonInteractive: Boolean(opts.nonInteractive),
				acceptRisk: Boolean(opts.acceptRisk),
				flow: opts.flow,
				mode: opts.mode,
				authChoice: opts.authChoice,
				tokenProvider: opts.tokenProvider,
				token: opts.token,
				tokenProfileId: opts.tokenProfileId,
				tokenExpiresIn: opts.tokenExpiresIn,
				anthropicApiKey: opts.anthropicApiKey,
				openaiApiKey: opts.openaiApiKey,
				openrouterApiKey: opts.openrouterApiKey,
				aiGatewayApiKey: opts.aiGatewayApiKey,
				cloudflareAiGatewayAccountId: opts.cloudflareAiGatewayAccountId,
				cloudflareAiGatewayGatewayId: opts.cloudflareAiGatewayGatewayId,
				cloudflareAiGatewayApiKey: opts.cloudflareAiGatewayApiKey,
				moonshotApiKey: opts.moonshotApiKey,
				kimiCodeApiKey: opts.kimiCodeApiKey,
				geminiApiKey: opts.geminiApiKey,
				zaiApiKey: opts.zaiApiKey,
				xiaomiApiKey: opts.xiaomiApiKey,
				qianfanApiKey: opts.qianfanApiKey,
				minimaxApiKey: opts.minimaxApiKey,
				syntheticApiKey: opts.syntheticApiKey,
				veniceApiKey: opts.veniceApiKey,
				togetherApiKey: opts.togetherApiKey,
				huggingfaceApiKey: opts.huggingfaceApiKey,
				opencodeZenApiKey: opts.opencodeZenApiKey,
				xaiApiKey: opts.xaiApiKey,
				litellmApiKey: opts.litellmApiKey,
				customBaseUrl: opts.customBaseUrl,
				customApiKey: opts.customApiKey,
				customModelId: opts.customModelId,
				customProviderId: opts.customProviderId,
				customCompatibility: opts.customCompatibility,
				gatewayPort: typeof gatewayPort === "number" && Number.isFinite(gatewayPort) ? gatewayPort : void 0,
				gatewayBind: opts.gatewayBind,
				gatewayAuth: opts.gatewayAuth,
				gatewayToken: opts.gatewayToken,
				gatewayPassword: opts.gatewayPassword,
				remoteUrl: opts.remoteUrl,
				remoteToken: opts.remoteToken,
				tailscale: opts.tailscale,
				tailscaleResetOnExit: Boolean(opts.tailscaleResetOnExit),
				reset: Boolean(opts.reset),
				installDaemon,
				daemonRuntime: opts.daemonRuntime,
				skipChannels: Boolean(opts.skipChannels),
				skipSkills: Boolean(opts.skipSkills),
				skipHealth: Boolean(opts.skipHealth),
				skipUi: Boolean(opts.skipUi),
				nodeManager: opts.nodeManager,
				json: Boolean(opts.json)
			}, defaultRuntime);
		});
	});
}

//#endregion
export { registerOnboardCommand };