import "./env-Dlz8aQHP.js";
import { H as theme } from "./agent-paths-DUHGyU1s.js";
import "./send-Ditv1VfR.js";
import "./send-CWM2yWF6.js";
import "./model-catalog-B2mRe6cZ.js";
import "./github-copilot-token-A9DiaCB0.js";
import { A as defaultRuntime } from "./entry.js";
import "./reply-prefix-CCp0C8w4.js";
import "./memory-BpNgGSAl.js";
import "./memory-search-Bm46LIUQ.js";
import "./manager-DTf-5dRo.js";
import "./fetch-guard-DkRm4Ip1.js";
import "./ip-CLwwPh25.js";
import "./ssrf-CqV2hisj.js";
import "./query-expansion-CfOgA1KD.js";
import "./memory-cli-B7kMyaVL.js";
import "./ir-r4mczNAR.js";
import "./target-errors-CWVZTpXS.js";
import "./chunk-D9NQZPPD.js";
import "./markdown-tables-ylpJUTGZ.js";
import "./path-alias-guards-BerTsE5c.js";
import "./fs-safe-BrR3_fH1.js";
import "./render-BDQg502o.js";
import "./commands-registry-DQLLJg_T.js";
import "./diagnostic-BGFH8MIa.js";
import "./diagnostic-session-state-HO94DMou.js";
import "./send-C4oPrvgH.js";
import "./model-bpjlPTsB.js";
import "./pi-model-discovery-Do4Oa02J.js";
import "./dangerous-tools-CusV9bcr.js";
import "./chrome-CUkBgrOC.js";
import "./pairing-token-C2iKEhFc.js";
import "./ws-DiFJ3zRB.js";
import "./onboarding.wallet-CcoV0W6U.js";
import "./wallet-runtime-config-TjiNNY9x.js";
import "./wallet-provider-registry-CFNtQ2ZR.js";
import "./wallet-W8qsxi6H.js";
import "./wallet-approval-auth-BaVTLG5r.js";
import "./runtime-DXHXAPJA.js";
import "./device-identity-ZHUQ6a8N.js";
import "./solana-bond-signing-D9-GtRIf.js";
import "./federation-8sW60I4p.js";
import "./call-CjHZhgQk.js";
import "./send-Dlj2DghK.js";
import "./outbound-attachment-D2ImFzcm.js";
import "./fetch-BqA-KBI4.js";
import "./delivery-queue-CMGPhIoF.js";
import "./deps-4rCQ5SBd.js";
import "./frontmatter-DTw-J9er.js";
import "./skills-CzDvK09q.js";
import "./skills-remote-CM9uNuu4.js";
import "./dangerous-name-matching-ob0tR02Y.js";
import "./channel-selection-BSwWHrf5.js";
import "./session-cost-usage-Dzc2RiRn.js";
import "./trash--uInT2PE.js";
import "./paths-rsh1tVGc.js";
import "./exec-approvals-aJApzFwx.js";
import "./node-shell-CpYc0oKF.js";
import "./task-planner-CkWt6WhX.js";
import "./send-CekwB5g1.js";
import "./resolve-route-y4Ol4Qmc.js";
import "./pairing-store-qjH5R_BQ.js";
import "./skills-clawhub-CBB2AUv6.js";
import "./exec-approvals-allowlist-BZoClZ91.js";
import "./skill-commands-Cx0nCzUv.js";
import "./channel-activity-DrrSLe52.js";
import "./tables-8heM_uJo.js";
import "./proxy-mdETjik4.js";
import "./config-DfviqDy5.js";
import { t as formatDocsLink } from "./links-CPltkiov.js";
import { n as runCommandWithRuntime } from "./cli-utils-XevKf-tr.js";
import "./help-format-D7mxVfC9.js";
import "./progress-BhMUiH4f.js";
import "./replies-BFsEK9FQ.js";
import "./prompt-style-CWdNyu_Q.js";
import "./pairing-labels-DBt_OA8C.js";
import "./skills-status-Br9ZUEnO.js";
import "./outbound-yJ-5efL1.js";
import "./session-D7HJxZ98.js";
import "./resolve-outbound-target-DIliFuuM.js";
import "./channel-web-CMZFjZzU.js";
import "./login-tqTj2mT5.js";
import "./managed-up-DhYefvn4.js";
import "./daemon-install-helpers-CzpeF_Bc.js";
import "./systemd-7bMkfZjg.js";
import "./service-CnO5S7Pz.js";
import "./service-audit-B92T2Wk3.js";
import "./widearea-dns-Cv-nSB-W.js";
import "./ipv4-Citn8Cno.js";
import "./health-C_g99tp_.js";
import "./heartbeat-runner-D04n14H-.js";
import "./auth-choice-DlcbJgp_.js";
import { n as formatAuthChoiceChoicesForCli, r as resolveOnboardProviderAuthFlags } from "./auth-choice-prompt-CcOEzXoi.js";
import "./provider-env-vars-bf07GMv5.js";
import "./enable-C7xTf-9S.js";
import "./logging-B1pB3RkW.js";
import "./installs-PYgg3AvN.js";
import "./status-jb8w0SwX.js";
import "./update-C_BnpDpE.js";
import "./lifecycle-B4RibYD4.js";
import "./onboard-channels-DUa2qkms.js";
import "./onboarding-DgTB_zq7.js";
import "./workspace-r16eQphT.js";
import "./hooks-status-BZnz9Iag.js";
import "./tui-Dinku0o-.js";
import "./note-_SCwut0b.js";
import "./clack-prompter-CZlDqO1z.js";
import "./systemd-linger-CAPmfIid.js";
import "./health-format-CFeARHgA.js";
import { t as onboardCommand } from "./onboard-Dz8z4vBi.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);
}
function resolveOptionalBooleanFlag(command, optionName, value) {
	if (!command || typeof command !== "object") return;
	const getOptionValueSource = "getOptionValueSource" in command ? command.getOptionValueSource : void 0;
	if (typeof getOptionValueSource !== "function") return;
	if (getOptionValueSource.call(command, optionName) === "cli") return Boolean(value);
}
function resolveOptionalBooleanPairFlag(command, trueOption, falseOption, values) {
	if (resolveOptionalBooleanFlag(command, falseOption, values.whenFalse) !== void 0) return false;
	if (resolveOptionalBooleanFlag(command, trueOption, values.whenTrue) !== void 0) return true;
}
function resolveProviderAuthFlagValues(opts) {
	const values = {};
	for (const providerFlag of resolveOnboardProviderAuthFlags()) values[providerFlag.optionKey] = opts[providerFlag.optionKey];
	return values;
}
const AUTH_CHOICE_HELP = formatAuthChoiceChoicesForCli({
	includeLegacyAliases: true,
	includeSkip: true
});
function registerOnboardCommand(program) {
	const providerAuthFlags = resolveOnboardProviderAuthFlags();
	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.fased.ai/cli/onboard")}\n`).option("--workspace <dir>", "Agent workspace directory (default: ~/.fased/workspace)").option("--reset", "Repair auth/session state before running wizard").option("--reset-scope <scope>", "Repair scope: sessions|auth|auth+sessions").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("--host-profile <profile>", "Host security profile: local|hosting").option("--host-security-capable", "Internal: host security was prepared by a root-started installer session").option("--host-maintenance-session", "Internal: post-bootstrap hosted rerun from the app user over Tailscale").option("--ts-authkey <key>", "Tailscale auth key for hosting setup").option("--allow-insecure", "Allow continuing when hosting security setup fails").option("--swap-gb <n>", "Override automatic swap size in GB for hosting setup").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 providerAuthFlags) 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("--allow-private-network", "Allow a custom local/private model provider endpoint in non-interactive onboarding").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("--wallet-enabled", "Enable wallet integration").option("--wallet-disabled", "Disable wallet integration").option("--wallet-mode <mode>", "Wallet mode: managed|external").option("--wallet-runtime <runtime>", "Wallet runtime: external-docker|external-custom").option("--wallet-providers <ids>", "Enabled wallet providers CSV (embedded-keystore,local-socket-signer,alchemy,turnkey,privy)").option("--wallet-default-provider <id>", "Default wallet provider id (embedded-keystore|local-socket-signer|alchemy|turnkey|privy)").option("--wallet-chains <chains>", "Wallet chains CSV (solana)").option("--wallet-host <host>", "External self-hosted signer host (advanced/deprecated)").option("--wallet-port <port>", "External self-hosted signer port (advanced/deprecated)").option("--wallet-install-enabled", "Enable wallet runtime auto-install").option("--wallet-install-disabled", "Disable wallet runtime auto-install").option("--wallet-install-version <version>", "Legacy self-host signer runtime version").option("--wallet-direct-signing", "Enable automated wallet execution for approved Agent tools").option("--wallet-no-direct-signing", "Disable automated wallet execution for approved Agent tools").option("--wallet-solana-allow-programs <programs>", "CSV allowlist of Solana programs").option("--wallet-solana-max-per-tx <amount>", "Solana per-transaction cap (lamports)").option("--wallet-solana-max-daily <amount>", "Solana daily cap (lamports)").option("--wallet-tool-access-mode <mode>", "Wallet tool access: owner-only|allowlist|all").option("--wallet-tool-access-allow-agents <agents>", "CSV allowlist agent IDs for wallet tool").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("--fast-health", "Use fast health mode (skip long probe waits and non-critical startup gating)", true).option("--no-fast-health", "Disable fast health mode").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 walletEnabled = resolveOptionalBooleanPairFlag(commandRuntime, "walletEnabled", "walletDisabled", {
				whenTrue: Boolean(opts.walletEnabled),
				whenFalse: Boolean(opts.walletDisabled)
			});
			const walletInstallEnabled = resolveOptionalBooleanPairFlag(commandRuntime, "walletInstallEnabled", "walletInstallDisabled", {
				whenTrue: Boolean(opts.walletInstallEnabled),
				whenFalse: Boolean(opts.walletInstallDisabled)
			});
			const walletDirectSigning = resolveOptionalBooleanPairFlag(commandRuntime, "walletDirectSigning", "walletNoDirectSigning", {
				whenTrue: Boolean(opts.walletDirectSigning),
				whenFalse: Boolean(opts.walletNoDirectSigning)
			});
			const gatewayPort = typeof opts.gatewayPort === "string" ? Number.parseInt(opts.gatewayPort, 10) : void 0;
			const walletPort = typeof opts.walletPort === "string" ? Number.parseInt(opts.walletPort, 10) : void 0;
			const swapGbRaw = typeof opts.swapGb === "string" ? Number.parseInt(opts.swapGb, 10) : void 0;
			await onboardCommand({
				hostProfile: opts.hostProfile,
				hostSecurityCapable: Boolean(opts.hostSecurityCapable),
				hostMaintenanceSession: Boolean(opts.hostMaintenanceSession),
				tsAuthkey: opts.tsAuthkey,
				allowInsecure: Boolean(opts.allowInsecure),
				swapGb: typeof swapGbRaw === "number" && Number.isFinite(swapGbRaw) ? swapGbRaw : void 0,
				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,
				resetScope: opts.resetScope,
				...resolveProviderAuthFlagValues(opts),
				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,
				allowPrivateNetwork: opts.allowPrivateNetwork === true,
				gatewayPort: typeof gatewayPort === "number" && Number.isFinite(gatewayPort) ? gatewayPort : void 0,
				gatewayBind: opts.gatewayBind,
				gatewayAuth: opts.gatewayAuth,
				gatewayToken: opts.gatewayToken,
				gatewayPassword: opts.gatewayPassword,
				walletEnabled,
				walletMode: opts.walletMode,
				walletRuntime: opts.walletRuntime,
				walletProviders: opts.walletProviders,
				walletDefaultProvider: opts.walletDefaultProvider,
				walletChains: opts.walletChains,
				walletHost: opts.walletHost,
				walletPort: typeof walletPort === "number" && Number.isFinite(walletPort) ? walletPort : void 0,
				walletInstallEnabled,
				walletInstallVersion: opts.walletInstallVersion,
				walletDirectSigning,
				walletSolanaAllowPrograms: opts.walletSolanaAllowPrograms,
				walletSolanaMaxPerTx: opts.walletSolanaMaxPerTx,
				walletSolanaMaxDaily: opts.walletSolanaMaxDaily,
				walletToolAccessMode: opts.walletToolAccessMode,
				walletToolAccessAllowAgents: opts.walletToolAccessAllowAgents,
				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),
				fastHealth: opts.fastHealth,
				skipUi: Boolean(opts.skipUi),
				nodeManager: opts.nodeManager,
				json: Boolean(opts.json)
			}, defaultRuntime);
		});
	});
}

//#endregion
export { registerOnboardCommand };