1import * as Effect from "effect/Effect";
2import { Argument, Command } from "effect/cli";
3
4import { runAcpMcpCliFastPath } from "../mcp/AcpMcpStdioBridge.ts";
5
6/**
7 * `t3 acp-mcp-bridge` — internal stdio MCP server that ACP agents spawn.
8 *
9 * The T3 server injects this command (with per-session endpoint and
10 * credential environment variables) into `session/new` so every ACP agent
11 * reaches the t3-code toolkit through ACP's required stdio MCP transport.
12 * The credential stays in the environment, never on the command line.
13 *
14 * Real invocations dispatch through the bin.ts fast path before the CLI
15 * graph loads; these definitions keep the commands wired for help and for
16 * anything that drives the full CLI programmatically.
17 */
18export const acpMcpBridgeCommand = Command.make("acp-mcp-bridge").pipe(
19 Command.withDescription("Bridge T3 Code's MCP endpoint to stdio for ACP agents."),
20 Command.unlisted,
21 Command.withHandler(() => Effect.promise(() => runAcpMcpCliFastPath("acp-mcp-bridge", []))),
22);
23
24/** Terminal fallback for ACP agents that do not expose injected MCP servers. */
25export const acpMcpCallCommand = Command.make("acp-mcp-call", {
26 tool: Argument.String("tool"),
27 argumentsJson: Argument.String("arguments-json"),
28}).pipe(
29 Command.withDescription("Call one T3 Code MCP tool from an ACP agent terminal."),
30 Command.unlisted,
31 Command.withHandler(({ tool, argumentsJson }) =>
32 Effect.promise(() => runAcpMcpCliFastPath("acp-mcp-call", [tool, argumentsJson])),
33 ),
34);