Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

bin.ts

31 lines1.3 KB

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 * Both dispatch here before the full CLI module graph (seconds of evaluation) loads; everything
5 * 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 === "acp-mcp-bridge" || command === "acp-mcp-call") {
21 const { runAcpMcpCliFastPath } = await import("./mcp/AcpMcpStdioBridge.ts");
22 await runAcpMcpCliFastPath(command, process.argv.slice(3));
23 } else {
24 // Before anything reads stdin: the desktop app's Windows launcher starts
25 // the CLI without one. Never for the fast paths, whose stdin is a pipe.
26 const { attachConsoleStdin } = await import("./cli/consoleStdin.ts");
27 attachConsoleStdin();
28 const { runCli } = await import("./binCli.ts");
29 runCli();
30 }