import "./paths-mmi2xb99.js";
import { L as theme, c as defaultRuntime } from "./subsystem-D4e4nOE7.js";
import "./utils-DLd4fFd2.js";
import "./boolean-Djq1Hgv8.js";
import "./env-Bdq5Y-tD.js";
import "./chrome-CpAaM-7H.js";
import "./logging-BdXz5wtj.js";
import "./config-C9wUwpYY.js";
import "./agent-scope-BcV171ci.js";
import "./exec-B_ziy0Fn.js";
import "./edwinpai-root-BaNzp4sP.js";
import "./model-selection-ChysOie6.js";
import "./github-copilot-token-D-EydSr2.js";
import "./command-format-XQlUKdf6.js";
import "./manifest-registry-DThGPzHr.js";
import "./client-FZxVEb3g.js";
import "./message-channel-eeeqF-J8.js";
import "./ws-ld1ms-Ht.js";
import "./sandbox-B_7wnPz0.js";
import "./plugins-D_f06tiR.js";
import "./accounts-Blm-CSIN.js";
import "./routes-CHh8zZx-.js";
import "./pi-embedded-helpers-Hus0BP0L.js";
import "./skills-B9WXNmn5.js";
import "./server-context-CdZ_-Xj5.js";
import "./ports-SUg8rnQx.js";
import "./paths-1OcM9YBo.js";
import "./redact-DbMu650y.js";
import "./tool-display-D8xZqYsu.js";
import { t as parseTimeoutMs } from "./parse-timeout-B6C7D7bk.js";
import "./channel-summary-xp5M-jlo.js";
import { t as formatDocsLink } from "./links-DlcX3SnL.js";
import { t as runTui } from "./tui-BeUMXiYC.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.edwinpai.com/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 };