Open History to see the last commit
1/**
2 * Every ACP agent spawns `t3 acp-mcp-bridge` while opening its session, and terminal-fallback
3 * agents run `t3 acp-mcp-call` per tool call, so their startup sits on first-message latency.
4 * They and Codex's managed-token helper dispatch before the full CLI module graph (seconds
5 * of evaluation) loads; everything else defers to the real CLI in ./binCli.ts.
6 */
7import { isEntrypoint } from "./entrypoint.ts";
8
9if (
10 isEntrypoint({
11 moduleUrl: import.meta.url,
12 entryPath: process.argv[1],
13 runtimeMain: import.meta.main,
14 })
15) {
16 const command = process.argv[2];
17 // Guard sockets before either dispatch path can load outbound-capable modules.
18 const { ignoreMacosTypeOfServiceEinval } = await import("./outboundHttp.ts");
19 ignoreMacosTypeOfServiceEinval();
20 if (command === "__managed-chatgpt-token") {
21 const { runManagedChatGptTokenCli } = await import("./cli/managedChatGptToken.ts");
22 await runManagedChatGptTokenCli(process.argv.slice(3));
23 } else if (command === "acp-mcp-bridge" || command === "acp-mcp-call") {
24 const { runAcpMcpCliFastPath } = await import("./mcp/AcpMcpStdioBridge.ts");
25 await runAcpMcpCliFastPath(command, process.argv.slice(3));
26 } else {
27 // Before anything reads stdin: the desktop app's Windows launcher starts
28 // the CLI without one. Never for the fast paths, whose stdin is a pipe.
29 const { attachConsoleStdin } = await import("./cli/consoleStdin.ts");
30 attachConsoleStdin();
31 const { runCli } = await import("./binCli.ts");
32 runCli();
33 }
34}