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 "./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 "./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 "./plugins-DYgcd4QJ.js";
import "./paths-DRyRQF9o.js";
import "./tool-images-CRPqucMe.js";
import "./commands-registry-CvAV0O7w.js";
import "./client-DNPnFy4E.js";
import "./call-C206Z-zx.js";
import { t as formatDocsLink } from "./links-G4gKCCcI.js";
import { t as parseTimeoutMs } from "./parse-timeout-BpphuwYl.js";
import { t as runTui } from "./tui-BpehHyx_.js";

//#region src/cli/tui-cli.ts
function registerTuiCli(program) {
	program.command("tui").description("Open a terminal UI connected to the Gateway").option("--url <url>", "Gateway WebSocket URL (defaults to gateway.remote.url when configured)").option("--token <token>", "Gateway token (if required)").option("--password <password>", "Gateway password (if required)").option("--session <key>", "Session key (default: \"main\", or \"global\" when scope is global)").option("--deliver", "Deliver assistant replies", false).option("--thinking <level>", "Thinking level override").option("--message <text>", "Send an initial message after connecting").option("--timeout-ms <ms>", "Agent timeout in ms (defaults to agents.defaults.timeoutSeconds)").option("--history-limit <n>", "History entries to load", "200").addHelpText("after", () => `\n${theme.muted("Docs:")} ${formatDocsLink("/cli/tui", "docs.minion.ai/cli/tui")}\n`).action(async (opts) => {
		try {
			const timeoutMs = parseTimeoutMs(opts.timeoutMs);
			if (opts.timeoutMs !== void 0 && timeoutMs === void 0) defaultRuntime.error(`warning: invalid --timeout-ms "${String(opts.timeoutMs)}"; ignoring`);
			const historyLimit = Number.parseInt(String(opts.historyLimit ?? "200"), 10);
			await runTui({
				url: opts.url,
				token: opts.token,
				password: opts.password,
				session: opts.session,
				deliver: Boolean(opts.deliver),
				thinking: opts.thinking,
				message: opts.message,
				timeoutMs,
				historyLimit: Number.isNaN(historyLimit) ? void 0 : historyLimit
			});
		} catch (err) {
			defaultRuntime.error(String(err));
			defaultRuntime.exit(1);
		}
	});
}

//#endregion
export { registerTuiCli };