import "./paths-C9FmTW1x.js";
import { U as theme } from "./agent-paths-BySKyq9I.js";
import "./agent-scope-CLn_Ws3B.js";
import "./commands-registry-DfzoWf4b.js";
import "./reply-DQfPM5ia.js";
import { d as defaultRuntime } from "./errors-Dx3S3Nrp.js";
import "./send-DI5jsj-s.js";
import "./send-Dg2_aoK-.js";
import "./github-copilot-token-BA45-q56.js";
import "./chat-envelope-D_wSv26N.js";
import "./pi-model-discovery-BftA1L--.js";
import "./dangerous-tools-C88-uuUI.js";
import "./chrome-BFIqTpDi.js";
import "./pairing-token-BFGorDQo.js";
import "./ip-D_T5zbZS.js";
import "./ws-cvQhrVP3.js";
import "./onboarding.wallet-B12p7GUZ.js";
import "./wallet-runtime-config-BlRWvEER.js";
import "./wallet-provider-registry-ax0NJo0F.js";
import "./wallet-BPiknFdt.js";
import "./wallet-approval-auth-DT-vofLs.js";
import "./reply-prefix-BRvLVE6I.js";
import "./media-ZuS0crH3.js";
import "./path-alias-guards-DivKBvV8.js";
import "./fs-safe-Cp0MI7Oo.js";
import "./runtime-bsvPuEXH.js";
import "./device-identity-DzUZ06fL.js";
import "./solana-bond-signing-CgswTuFe.js";
import "./diagnostic-Cl18V9Cy.js";
import "./federation-BrNm7xtG.js";
import "./call-s6DNIELo.js";
import "./chunk-tBRG1JLR.js";
import "./markdown-tables-DvKl7MfL.js";
import "./send-aHqtlYYi.js";
import "./fetch-guard-hWUtz61M.js";
import "./ssrf-Blf4NrHS.js";
import "./outbound-attachment-BHTb_aF7.js";
import "./fetch-BJWQWfdf.js";
import "./delivery-queue-9lp1uujZ.js";
import "./deps-CBapZnsi.js";
import "./memory-e9aOXNx1.js";
import "./memory-search-B8y2GTeB.js";
import "./manager-DI2w66Ae.js";
import "./query-expansion-BdzehFyx.js";
import "./memory-cli-mMVfDz8Z.js";
import "./target-errors-_IirSOQ1.js";
import "./render-C2MRWrC0.js";
import "./diagnostic-session-state-89enG0Yp.js";
import "./send-B3O8oJLA.js";
import "./model-CfutahU0.js";
import "./exec-approvals-allowlist-C5bxRc7H.js";
import "./dangerous-name-matching-B2YH8EDF.js";
import "./skills-D1Qdj69-.js";
import "./node-match-BNTZ8TY5.js";
import "./system-run-command-BvFkDQae.js";
import "./channel-selection-EDP8q9uz.js";
import "./task-planner-BW6kdamv.js";
import "./trash-BiHtb5y8.js";
import "./paths-BA7z-HF9.js";
import "./send-CKgt65ud.js";
import "./resolve-route-CbII9dNc.js";
import "./pairing-store-CUPrh2Qy.js";
import "./session-cost-usage-DQSpjhkP.js";
import "./skills-clawhub-kuGAFKgL.js";
import "./config-eval-CuVkTCse.js";
import "./channel-activity-BkfQ8RFW.js";
import "./tables-apsvCDwc.js";
import "./proxy-DU7W9XSc.js";
import "./config-BKhx4paQ.js";
import { t as formatDocsLink } from "./links-BeUKckiL.js";
import { n as runCommandWithRuntime } from "./cli-utils-DJ7Nfw8J.js";
import "./help-format-H4GNCFCs.js";
import "./progress-CDqdg8f8.js";
import "./replies-Xddrs-mt.js";
import "./skills-remote-DkdYN-8J.js";
import "./skill-commands-CxJHp3z6.js";
import "./prompt-style-Db5iJoaI.js";
import "./pairing-labels-sAC1Ty3_.js";
import "./channel-web-qHKfuCHE.js";
import "./outbound-DvIMfvtY.js";
import "./session-DZkPK2HB.js";
import "./login-T8Rtml0H.js";
import "./skills-status-Bgumcv_3.js";
import "./resolve-outbound-target-CNBGL_Eh.js";
import "./managed-up-BykEd-7K.js";
import "./daemon-install-helpers-CG_Lmgua.js";
import "./systemd-ZvgpcrfV.js";
import "./service-DbZp-Ejz.js";
import "./service-audit-B5uApPZ5.js";
import "./widearea-dns-DY1Jr9HZ.js";
import "./ipv4-P47TSJIK.js";
import "./health-DTTfLYjl.js";
import "./heartbeat-runner-DXh84Wuy.js";
import "./auth-choice-DbEAsUsi.js";
import { n as formatAuthChoiceChoicesForCli, r as resolveOnboardProviderAuthFlags } from "./auth-choice-prompt-DMlwK9kF.js";
import "./provider-env-vars-BVYZxJzb.js";
import "./enable-DYrDatZX.js";
import "./logging-C8GVa7dS.js";
import "./installs-BS-BIvab.js";
import "./status-CTveTSuF.js";
import "./update-fKz5UGr6.js";
import "./lifecycle-Bgh3V8Jt.js";
import "./onboard-channels-CPh2EJOi.js";
import "./onboarding-BC-5Pv9o.js";
import "./workspace-Z9acuKnl.js";
import "./hooks-status-CrTowaUt.js";
import "./tui-lmdDZi6Y.js";
import "./note-BVXI9hXT.js";
import "./clack-prompter-Bpbu54xa.js";
import "./systemd-linger-S605QEIC.js";
import "./health-format-BDteAZU6.js";
import { t as onboardCommand } from "./onboard-BD0MOrv7.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 };