import "./tool-display-B7qTeoCS.js";
import "./paths-D4_LjrY7.js";
import "./utils-BnlaT0eO.js";
import { r as theme } from "./theme-CG-K7m8u.js";
import "./thinking-CKGMvVgd.js";
import "./reply-DbpXq1MH.js";
import "./subsystem-ocBR131w.js";
import { n as defaultRuntime } from "./runtime-CRvfzclG.js";
import "./exec-CZr_EJHt.js";
import "./agent-scope-CVnlY0oG.js";
import "./model-selection-p6J3l4qF.js";
import "./github-copilot-token-CjSKohyA.js";
import "./emitter-oHo8y9ow.js";
import "./sqlite-wYNyDR1B.js";
import "./reliability-Dl7hbRzF.js";
import "./boolean-DGGu1sGA.js";
import "./env-CvUd308i.js";
import "./validation-p1IK70TM.js";
import "./config-DJ3A5x_1.js";
import "./manifest-registry-U2EDFVP4.js";
import "./runner-BZrNCxMY.js";
import "./image-tool.helpers-tqRivaKA.js";
import "./models-config-DLUtus3b.js";
import "./pi-model-discovery-4-XyjjxG.js";
import "./pi-embedded-utils-BraP32ED.js";
import "./redact-DcYCKU6u.js";
import "./pi-embedded-helpers-CLkeTWAT.js";
import "./sandbox-C5rKvtrA.js";
import "./chrome-BQkAVfz8.js";
import "./tailscale-CcUMoDkd.js";
import "./auth-BxKMeEw-.js";
import "./server-context-s_zNpSdX.js";
import "./frontmatter-VFr0KMAQ.js";
import "./skills-CHYyY1lO.js";
import "./routes-CT0DmotX.js";
import "./errors-DbYSuCgv.js";
import "./paths-Ct4sqLyX.js";
import "./ssrf-tneKFjA6.js";
import "./image-ops-C0D77XHD.js";
import "./store-Cdm3Z5cQ.js";
import "./ports-DvLDsgl0.js";
import "./trash-BRBQoy9m.js";
import "./sessions-Ct2d_bGl.js";
import "./message-channel-DSU96OKy.js";
import "./dock-DY0TWaYa.js";
import "./normalize-DgwtBdm-.js";
import "./accounts-BZv5WxME.js";
import "./accounts-DFaskvEN.js";
import "./accounts-T7o73ZSN.js";
import "./bindings-BbaWTQJM.js";
import "./logging-wfRfbMvt.js";
import "./client-36a9DTBg.js";
import "./plugins-DYgcd4QJ.js";
import "./targets-qjNLO5UC.js";
import "./paths-DRyRQF9o.js";
import "./tool-images-CRPqucMe.js";
import "./image-Dx_UDO2W.js";
import "./fetch-guard-C12KgXTM.js";
import "./api-key-rotation-Bl9Larnz.js";
import "./fetch-Dy3Y7lWo.js";
import "./session-files-DroWN-X3.js";
import "./model-catalog-DyP7lvDH.js";
import "./tokens-DuLZdp8u.js";
import "./heartbeat-BJ0mtjXV.js";
import "./helpers-DAXsRcXO.js";
import "./targets-D3Hd_LiZ.js";
import "./with-timeout-BeRjsuGt.js";
import "./diagnostic-Ct9JySKv.js";
import "./diagnostic-session-state-CjvcsE8F.js";
import "./lanes-s-MZ35vD.js";
import "./reply-payloads-Idpqh_HL.js";
import "./route-reply-C3GnJgPP.js";
import "./tts-pLGM3rbp.js";
import "./audio-Cf4_M2_g.js";
import "./model-p-v6-khS.js";
import "./chat-trace-DE0u11RV.js";
import "./response-prefix-template-ZNVQwQzJ.js";
import "./tool-tracking-BeyzFfAx.js";
import "./memory-cli-D_iCajsu.js";
import "./manager-Be4wtySp.js";
import "./retry-BR_e19Qc.js";
import "./hybrid-oFciuzzr.js";
import "./common-oaZdjdal.js";
import "./send-BFMLircB.js";
import "./chunk-CF0Wb8FK.js";
import "./markdown-tables-BkkSACKz.js";
import "./media-Ce9mjBUa.js";
import "./ir-DDJn3mJR.js";
import "./render-Cz3PVxTW.js";
import "./commands-registry-CvAV0O7w.js";
import "./client-DNPnFy4E.js";
import "./call-C206Z-zx.js";
import "./sessions-helpers-DYJnJN3U.js";
import "./external-content-CNcZgk3W.js";
import "./send-BQth8hb0.js";
import "./channel-activity-C8K3u-iy.js";
import "./fetch-CdBeMr8t.js";
import "./tables-GfMspQYU.js";
import "./server-startup-users-Bb0MWaNU.js";
import "./resolve-route-D-YVS8mL.js";
import "./pairing-store-Z_SXyT9W.js";
import "./replies-AgkcH9tU.js";
import "./reply-prefix-DB7HiPpn.js";
import "./workspace-dirs-C1v5ssUA.js";
import "./skill-commands-vM7RDRiG.js";
import "./pi-tools.policy-C7_kjOAN.js";
import "./send-BKH82oGz.js";
import "./onboard-helpers-B0CkVZ2U.js";
import "./prompt-style-D4OL61iD.js";
import "./onboard-helpers-BvqKOAqv.js";
import "./outbound-attachment-DzzKBoks.js";
import "./targets-B17-mYQK.js";
import "./pairing-labels-BoIZlK5l.js";
import "./send-C5tjqyuP.js";
import "./session-cost-usage-UDBgjJvw.js";
import "./send-XU_khFvN.js";
import "./proxy-CjhP7CG1.js";
import { t as formatDocsLink } from "./links-G4gKCCcI.js";
import { n as runCommandWithRuntime } from "./cli-utils-Cps3tWFt.js";
import "./help-format-DukcHIxz.js";
import "./progress-WmzCxxhb.js";
import "./active-listener-CEwpUvTV.js";
import "./exec-approvals-C7AUcy3J.js";
import "./gateway-DKSm1BrZ.js";
import "./nodes-utils-yMGpHJYN.js";
import "./model-fallback-BPqOLk8z.js";
import "./typed-schema-4lv655ii.js";
import "./knowledge-graph-D4-b38d_.js";
import "./runtime-guard-ChZ6T0fk.js";
import "./env-file-jMSm0wPK.js";
import "./deliver-DhB9l23e.js";
import "./delivery-queue-CKcfhYo3.js";
import "./note-U4_LTORH.js";
import "./clack-prompter-C53smn2y.js";
import { n as formatAuthChoiceChoicesForCli } from "./auth-choice-options-C7eFoApC.js";
import "./onboard-auth-B_PG9Lfr.js";
import "./openai-model-default-C9zElP81.js";
import "./shared-BwkO5M-b.js";
import "./logging-CgrC2xWs.js";
import "./vllm-setup-BE_da5Bx.js";
import "./systemd-CdTDtFWy.js";
import "./service-tzRBQba1.js";
import "./daemon-runtime-CamLzRLO.js";
import "./daemon-install-helpers-OEyMcFNy.js";
import "./systemd-linger-D4DzdniD.js";
import "./model-picker-NSZcd-8b.js";
import "./onboard-custom-B3TKu9Vn.js";
import "./health-u_Dm-5Ek.js";
import "./onboarding--M0Y1eGc.js";
import "./auth-token-DVpOm5kp.js";
import { n as ONBOARD_PROVIDER_AUTH_FLAGS, t as onboardCommand } from "./onboard-NCAWX59J.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.minion.ai/cli/onboard")}\n`).option("--workspace <dir>", "Agent workspace directory (default: ~/.minion/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 };