@heyditto/cli 3.10.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -664,7 +664,7 @@ Options shared by both commands:
664
664
  | `--session <id>` | reuse a Ditto session id so traces land in an existing thread |
665
665
  | `--resume [id]` / `-c, --continue` | resume a local session (`heyditto sessions`) / the agent's most recent conversation. Claude also takes a Claude session id or title here, including sessions started in Claude Desktop or plain `claude`, and runs in the directory that session ran in; with no value, a terminal gets a searchable picker. Claude's own `-r` / `--resume` / `-c` after `--` do the same. |
666
666
  | `--yolo` / `--yellow` / `--plan` | bypass permissions / auto-accept edits / plan mode (Claude only) |
667
- | `--mcp` / `--no-mcp` | attach the endpoint's tools to Claude Code as its own MCP servers, or keep them on the router (default: the endpoint's `claude_tool_surface`, else MCP) |
667
+ | `--mcp` / `--no-mcp` | attach the endpoint's tools to Claude Code or Codex as its own MCP servers, or keep them on the router (default: the endpoint's `claude_tool_surface` / `codex_tool_surface`, else MCP) |
668
668
  | `--no-hooks` | leave out the Claude Code hooks the repository's `.ditto` profile declares (`claude_hooks`); Claude only |
669
669
  | `-p, --prompt <text>` | headless run: `claude -p` or `codex exec` |
670
670
  | `-m, --model <id>` | model to request (default: the agent's own model id passes through and the endpoint routes it) |
@@ -717,6 +717,16 @@ How the wiring works:
717
717
  - **Codex** speaks the Responses API only, so the endpoint is injected as a
718
718
  `ditto` model provider via `-c` overrides (nothing is written to
719
719
  `~/.codex/config.toml`) with the key in `DITTO_INFERENCE_API_KEY`.
720
+ - **Codex** gets the same MCP servers as Claude Code by default, the way cmux
721
+ attaches its computer-use server: one `-c mcp_servers.<name>={…}` override
722
+ per server, read from the same catalog, with `bearer_token_env_var =
723
+ "DITTO_ROUTER_MCP_KEY"` so the key stays out of argv and disk. Each override
724
+ sets `enabled = true`, because Codex merges it into a server of the same
725
+ name in your own config. Approvals map onto Codex's: tools Ditto holds
726
+ itself run as `approve`, and under `client_approvals` the gated ones are
727
+ `prompt` (`--yolo` runs them unasked). Claude's `permissions.deny` rules are
728
+ not applied to Codex. `--no-mcp` or `codex_tool_surface = "router"` keeps
729
+ the tools on the router.
720
730
 
721
731
  ### `codex-app`
722
732
 
@@ -1296,7 +1306,9 @@ A `.ditto/endpoints/<name>.toml` is a Router profile checked into the repository
1296
1306
  model, routing, tools, and the Claude Code or Codex system prompt, which is read
1297
1307
  from a file next to it. `repository.default_endpoint` in `.ditto/config.toml`
1298
1308
  names the profile that `heyditto claude` / `codex` use when no `--endpoint` is
1299
- given, from anywhere inside the repository. `--endpoint` always wins.
1309
+ given, from anywhere inside the repository. `--endpoint` always wins;
1310
+ `--fallback-endpoint` (what the default T3 provider passes) applies only
1311
+ outside such a repository; profile T3 providers pin their endpoint.
1300
1312
 
1301
1313
  ```toml
1302
1314
  # .ditto/endpoints/dev.toml
@@ -67,19 +67,41 @@ export interface McpCatalog {
67
67
  * it mid-task.
68
68
  */
69
69
  export declare function mcpUnavailableLines(catalog: Pick<McpCatalog, "unavailable">): string[];
70
- /** What a Claude launch needs to attach the catalog. */
70
+ /**
71
+ * One attached server in harness-neutral form, for harnesses that take MCP
72
+ * configuration in their own shape (codex-mcp.ts). The key is never here:
73
+ * each harness reads it from MCP_KEY_ENV.
74
+ */
75
+ export interface McpAttachedServer {
76
+ /** The harness-side server name (claudeServerName). */
77
+ name: string;
78
+ url: string;
79
+ /** Session and deny headers; not Authorization. */
80
+ headers: Record<string, string>;
81
+ /** Tools that run without the agent asking. */
82
+ allowTools: string[];
83
+ /** Tools the agent asks a person about first. */
84
+ askTools: string[];
85
+ }
86
+ /** What a launch needs to attach the catalog. */
71
87
  export interface ClaudeMcpAttachment {
72
88
  /** The `--mcp-config` JSON. */
73
89
  config: string;
74
90
  /** permissions.allow / permissions.ask for `--settings`. */
75
91
  allow: string[];
76
92
  ask: string[];
93
+ /** The same servers and policy, for every other harness. */
94
+ attached: McpAttachedServer[];
95
+ /** Catalog servers left out because their name is unsafe in an agent's config. */
96
+ skipped: string[];
77
97
  servers: number;
78
98
  tools: number;
79
99
  /** Tools Ditto's policy would hold for a person. */
80
100
  gated: number;
81
101
  clientApprovals: boolean;
82
102
  }
103
+ /** The catalog attached to a launch, whichever harness renders it. */
104
+ export type McpAttachment = ClaudeMcpAttachment;
83
105
  /** Claude Code server name for a catalog server: the built-ins keep "ditto", the rest are "ditto-<source>". */
84
106
  export declare function claudeServerName(server: string): string;
85
107
  /** Reads the endpoint's MCP catalog with the session's own key. */
@@ -94,7 +116,7 @@ export declare function claudeMcpAttachment(catalog: McpCatalog, sessionId: stri
94
116
  toolDeny?: string[];
95
117
  }): ClaudeMcpAttachment;
96
118
  /** Who stops a gated call, for the launch banner: only what is actually true. */
97
- export declare function mcpApprovalNote(mcp: ClaudeMcpAttachment): string;
119
+ export declare function mcpApprovalNote(mcp: ClaudeMcpAttachment, agent?: string): string;
98
120
  type Json = Record<string, unknown>;
99
121
  /** Objects merge key by key, arrays concatenate without duplicates, anything else: b wins. */
100
122
  export declare function mergeSettings(a: Json, b: Json): Json;
@@ -48,6 +48,13 @@ export function mcpUnavailableLines(catalog) {
48
48
  return `${name} is disconnected (${why}); its tools are missing — ${fix}`;
49
49
  });
50
50
  }
51
+ /**
52
+ * A server name every agent's config can carry as a bare key: Codex splits
53
+ * `-c` paths on dots, and tool rules join the name with "__". The backend only
54
+ * serves names like this (mcpServerName); anything else is left out, the same
55
+ * way for every harness, rather than spliced into a config path.
56
+ */
57
+ const SAFE_SERVER_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$/;
51
58
  /** Claude Code server name for a catalog server: the built-ins keep "ditto", the rest are "ditto-<source>". */
52
59
  export function claudeServerName(server) {
53
60
  return server === "ditto" ? "ditto" : `ditto-${server}`;
@@ -84,23 +91,40 @@ export async function fetchMcpCatalog(baseUrl, apiKey, sessionId, fetchImpl = fe
84
91
  */
85
92
  export function claudeMcpAttachment(catalog, sessionId, opts = {}) {
86
93
  const mcpServers = {};
94
+ const attached = [];
87
95
  const allow = [];
88
96
  const ask = [];
97
+ const skipped = [];
89
98
  let tools = 0;
90
99
  let gated = 0;
91
100
  for (const server of catalog.servers) {
92
101
  if (server.tools.length === 0)
93
102
  continue;
103
+ if (!SAFE_SERVER_NAME.test(server.name)) {
104
+ skipped.push(server.name);
105
+ continue;
106
+ }
94
107
  const name = claudeServerName(server.name);
108
+ const headers = { "X-Ditto-Session-Id": sessionId, ...(opts.toolDeny?.length ? { [TOOL_DENY_HEADER]: opts.toolDeny.join(",") } : {}) };
95
109
  mcpServers[name] = {
96
110
  type: "http",
97
111
  url: server.url,
98
- headers: { Authorization: `Bearer \${${MCP_KEY_ENV}}`, "X-Ditto-Session-Id": sessionId, ...(opts.toolDeny?.length ? { [TOOL_DENY_HEADER]: opts.toolDeny.join(",") } : {}) },
112
+ headers: { Authorization: `Bearer \${${MCP_KEY_ENV}}`, ...headers },
99
113
  };
100
114
  tools += server.tools.length;
101
115
  gated += server.tools.filter((t) => t.approval).length;
116
+ // Ditto's gate is the authority without client approvals; an agent prompt
117
+ // on top would ask twice. With them, the agent asks about exactly the
118
+ // calls Ditto would have held, unless bypass said not to ask.
119
+ const asks = (t) => catalog.clientApprovals && t.approval && !opts.yolo;
120
+ attached.push({
121
+ name,
122
+ url: server.url,
123
+ headers,
124
+ allowTools: server.tools.filter((t) => !asks(t)).map((t) => t.name),
125
+ askTools: server.tools.filter(asks).map((t) => t.name),
126
+ });
102
127
  if (!catalog.clientApprovals) {
103
- // Ditto's gate is the authority here; a Claude prompt on top would ask twice.
104
128
  allow.push(`mcp__${name}`);
105
129
  continue;
106
130
  }
@@ -117,6 +141,8 @@ export function claudeMcpAttachment(catalog, sessionId, opts = {}) {
117
141
  config: JSON.stringify({ mcpServers }),
118
142
  allow,
119
143
  ask,
144
+ attached,
145
+ skipped,
120
146
  servers: Object.keys(mcpServers).length,
121
147
  tools,
122
148
  gated,
@@ -124,12 +150,12 @@ export function claudeMcpAttachment(catalog, sessionId, opts = {}) {
124
150
  };
125
151
  }
126
152
  /** Who stops a gated call, for the launch banner: only what is actually true. */
127
- export function mcpApprovalNote(mcp) {
153
+ export function mcpApprovalNote(mcp, agent = "Claude Code") {
128
154
  if (mcp.gated === 0)
129
155
  return "no gated tools";
130
156
  if (!mcp.clientApprovals)
131
157
  return `Ditto holds ${mcp.gated} gated`;
132
- return mcp.ask.length ? `Claude Code asks before ${mcp.ask.length} gated` : `${mcp.gated} gated run unasked (--yolo)`;
158
+ return mcp.ask.length ? `${agent} asks before ${mcp.ask.length} gated` : `${mcp.gated} gated run unasked (--yolo)`;
133
159
  }
134
160
  function isObject(v) {
135
161
  return typeof v === "object" && v !== null && !Array.isArray(v);
@@ -1 +1 @@
1
- {"version":3,"file":"claude-mcp.js","sourceRoot":"","sources":["../../src/agents/claude-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC;AA0ClD,MAAM,mBAAmB,GAA2B;IAClD,mBAAmB,EAAE,4BAA4B;IACjD,WAAW,EAAE,gCAAgC;CAC9C,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAwC;IAC1E,MAAM,OAAO,GAAG,KAAK,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,MAAM,CAAC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,kBAAkB,CAAC,GAAwB;IACzD,MAAM,WAAW,GAAS,EAAE,CAAC;IAC7B,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM;QAAE,WAAW,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACpD,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM;QAAE,WAAW,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;IAC9C,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAChE,CAAC"}
@@ -1,8 +1,22 @@
1
+ import { type McpAttachment } from "./claude-mcp.js";
1
2
  import { type HarnessPlan, type PlanInput } from "./types.js";
2
3
  /** Quotes a string as a TOML basic string for `codex -c key=value`. */
3
4
  export declare function tomlString(value: string): string;
4
5
  /** A TOML inline table of string pairs: `{"A"="1","B"="2"}`. */
5
6
  export declare function tomlInlineTable(entries: Array<[string, string]>): string;
7
+ /**
8
+ * Native MCP for Codex: each attached server as one `-c mcp_servers.<name>=…`
9
+ * override, the way cmux attaches its computer-use server, so nothing is
10
+ * written to ~/.codex/config.toml. Codex merges an override into a server of
11
+ * the same name in the user's config (a disabled "ditto" entry is common), so
12
+ * every override turns its server on. The key stays out of argv: Codex reads
13
+ * it from MCP_KEY_ENV (bearer_token_env_var).
14
+ *
15
+ * Approvals follow the attachment: tools Ditto holds itself, or that bypass
16
+ * runs unasked, are "approve"; the rest are "prompt", so Codex asks about
17
+ * exactly the calls Ditto would have held.
18
+ */
19
+ export declare function codexMcpArgs(mcp: McpAttachment): string[];
6
20
  /**
7
21
  * Builds the `codex` invocation.
8
22
  *
@@ -1,3 +1,4 @@
1
+ import { MCP_KEY_ENV, TOOL_SURFACE_HEADER, TOOL_SURFACE_MCP } from "./claude-mcp.js";
1
2
  import { harnessHeaders } from "./harness-headers.js";
2
3
  import { CODEX_KEY_ENV, SESSION_HEADER } from "./types.js";
3
4
  /** Quotes a string as a TOML basic string for `codex -c key=value`. */
@@ -8,6 +9,38 @@ export function tomlString(value) {
8
9
  export function tomlInlineTable(entries) {
9
10
  return `{${entries.map(([k, v]) => `${tomlString(k)}=${tomlString(v)}`).join(",")}}`;
10
11
  }
12
+ /**
13
+ * Native MCP for Codex: each attached server as one `-c mcp_servers.<name>=…`
14
+ * override, the way cmux attaches its computer-use server, so nothing is
15
+ * written to ~/.codex/config.toml. Codex merges an override into a server of
16
+ * the same name in the user's config (a disabled "ditto" entry is common), so
17
+ * every override turns its server on. The key stays out of argv: Codex reads
18
+ * it from MCP_KEY_ENV (bearer_token_env_var).
19
+ *
20
+ * Approvals follow the attachment: tools Ditto holds itself, or that bypass
21
+ * runs unasked, are "approve"; the rest are "prompt", so Codex asks about
22
+ * exactly the calls Ditto would have held.
23
+ */
24
+ export function codexMcpArgs(mcp) {
25
+ const args = [];
26
+ // Names are bare keys (claudeMcpAttachment drops any other), so they can
27
+ // sit in the dotted -c path as they are.
28
+ for (const server of mcp.attached) {
29
+ const fields = [
30
+ ["enabled", "true"],
31
+ ["url", tomlString(server.url)],
32
+ ["bearer_token_env_var", tomlString(MCP_KEY_ENV)],
33
+ ["http_headers", tomlInlineTable(Object.entries(server.headers))],
34
+ ["default_tools_approval_mode", tomlString("approve")],
35
+ ];
36
+ if (server.askTools.length) {
37
+ const prompt = `{${tomlString("approval_mode")}=${tomlString("prompt")}}`;
38
+ fields.push(["tools", `{${server.askTools.map((t) => `${tomlString(t)}=${prompt}`).join(",")}}`]);
39
+ }
40
+ args.push("-c", `mcp_servers.${server.name}={${fields.map(([k, v]) => `${k}=${v}`).join(",")}}`);
41
+ }
42
+ return args;
43
+ }
11
44
  /**
12
45
  * Builds the `codex` invocation.
13
46
  *
@@ -33,7 +66,14 @@ export function planCodex(input) {
33
66
  else if (resuming) {
34
67
  args.push("resume");
35
68
  }
36
- args.push("-c", `model_provider=${tomlString("ditto")}`, "-c", `model_providers.ditto.name=${tomlString(input.localInference ? "CLIProxy" : "Ditto")}`, "-c", `model_providers.ditto.base_url=${tomlString(input.baseUrl)}`, "-c", `model_providers.ditto.env_key=${tomlString(CODEX_KEY_ENV)}`, "-c", `model_providers.ditto.wire_api=${tomlString("responses")}`, "-c", `model_providers.ditto.http_headers=${tomlInlineTable(input.localInference ? [] : [[SESSION_HEADER, input.sessionId], ...harnessHeaders("codex", input.harnessVersion)])}`);
69
+ args.push("-c", `model_provider=${tomlString("ditto")}`, "-c", `model_providers.ditto.name=${tomlString(input.localInference ? "CLIProxy" : "Ditto")}`, "-c", `model_providers.ditto.base_url=${tomlString(input.baseUrl)}`, "-c", `model_providers.ditto.env_key=${tomlString(CODEX_KEY_ENV)}`, "-c", `model_providers.ditto.wire_api=${tomlString("responses")}`, "-c", `model_providers.ditto.http_headers=${tomlInlineTable(input.localInference ? [] : [
70
+ [SESSION_HEADER, input.sessionId],
71
+ ...harnessHeaders("codex", input.harnessVersion),
72
+ // The tools are attached below; the router must not inject them again.
73
+ ...(input.mcp ? [[TOOL_SURFACE_HEADER, TOOL_SURFACE_MCP]] : []),
74
+ ])}`);
75
+ if (input.mcp)
76
+ args.push(...codexMcpArgs(input.mcp));
37
77
  if (input.model)
38
78
  args.push("-m", input.model);
39
79
  if (input.yolo)
@@ -62,7 +102,7 @@ export function planCodex(input) {
62
102
  return {
63
103
  command: "codex",
64
104
  args,
65
- envSet: { [CODEX_KEY_ENV]: input.apiKey },
105
+ envSet: { [CODEX_KEY_ENV]: input.apiKey, ...(input.mcp ? { [MCP_KEY_ENV]: input.mcpApiKey ?? input.apiKey } : {}) },
66
106
  envUnset: [],
67
107
  installHint: "install Codex: npm i -g @openai/codex (or brew install cod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,CAAC;IAClC,CAAC;IAED,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,IAAI;QACJ,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;QACnH,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,+DAA+D;KAC7E,CAAC;AACJ,CAAC"}
@@ -2,6 +2,12 @@ import { type InferenceEndpoint } from "../api.js";
2
2
  import { type Harness } from "./types.js";
3
3
  export interface LaunchOptions {
4
4
  endpoint?: string;
5
+ /**
6
+ * The endpoint to use only when nothing else names one: no --endpoint,
7
+ * --profile, resumed session or repository `.ditto/` default. T3 providers
8
+ * pass theirs here so a checkout's own profile still picks its endpoint.
9
+ */
10
+ fallbackEndpoint?: string;
5
11
  budget?: string;
6
12
  expires?: string;
7
13
  keepKey?: boolean;
@@ -34,9 +40,9 @@ export interface LaunchOptions {
34
40
  */
35
41
  headless?: boolean;
36
42
  /**
37
- * Claude only: attach the endpoint's tools as Claude Code MCP servers
38
- * (`--mcp`) or keep them on the router (`--no-mcp`). Unset follows the
39
- * endpoint's `claude_tool_surface` option, else native MCP.
43
+ * Claude and Codex: attach the endpoint's tools as the agent's own MCP
44
+ * servers (`--mcp`) or keep them on the router (`--no-mcp`). Unset follows
45
+ * the endpoint's `<harness>_tool_surface` option, else native MCP.
40
46
  */
41
47
  mcp?: boolean;
42
48
  mcpOnly?: boolean;
@@ -50,14 +56,26 @@ export interface LaunchOptions {
50
56
  cliproxy?: string | boolean;
51
57
  remoteTransport?: "cli" | "channels";
52
58
  }
59
+ /**
60
+ * The default T3 provider's launcher from before --fallback-endpoint (no
61
+ * DITTO_T3_ENDPOINT_MODE) passes its DITTO_T3_ENDPOINT as --endpoint. That is
62
+ * the provider's default, so it is demoted to the fallback and a checkout's
63
+ * `.ditto/` default applies without rerunning setup. Old launchers of any
64
+ * other instance (profile providers) were a deliberate choice and stay
65
+ * pinned. The launcher's variables are then dropped, so a `heyditto` run
66
+ * inside the chat keeps its own --endpoint.
67
+ */
68
+ export declare function t3FallbackEndpoint(options: LaunchOptions, env?: NodeJS.ProcessEnv): LaunchOptions;
53
69
  /** Explicit flags (or resumed choices) win over repo/cloud launch defaults. */
54
70
  export declare function resolveClaudeLaunchDefaults(options: LaunchOptions, defaults?: Record<string, unknown>): LaunchOptions;
71
+ /** Harnesses that can attach an endpoint's tools as their own MCP servers. */
72
+ export declare const MCP_HARNESSES: readonly Harness[];
55
73
  /**
56
- * `--mcp` / `--no-mcp`, else the endpoint's `claude_tool_surface`, else native
57
- * MCP: Claude Code gets an endpoint's tools as its own servers unless the
74
+ * `--mcp` / `--no-mcp`, else the endpoint's `<harness>_tool_surface`, else
75
+ * native MCP: the agent gets an endpoint's tools as its own servers unless the
58
76
  * endpoint keeps them on the router (`claude_tool_surface = "router"`).
59
77
  */
60
- export declare function wantsMcp(options: Pick<LaunchOptions, "mcp">, endpoint: Pick<InferenceEndpoint, "providerOptions">): boolean;
78
+ export declare function wantsMcp(options: Pick<LaunchOptions, "mcp">, endpoint: Pick<InferenceEndpoint, "providerOptions">, harness?: Harness): boolean;
61
79
  /** Interactive numbered picker; also accepts a slug or id. Exported for `heyditto endpoints pick`. */
62
80
  export declare function pickEndpoint(endpoints: InferenceEndpoint[], defaultSlug?: string): Promise<InferenceEndpoint>;
63
81
  /** Refuses to launch against an endpoint the backend marked inactive (e.g. awaiting the user's plan). */
@@ -29,12 +29,33 @@ import { latestSession, readSession, sessionForHarnessId, writeSession } from ".
29
29
  import { canonicalCwd } from "../teleport/harness.js";
30
30
  import { DEFAULT_LAUNCH_EXPIRY, KEY_EXPIRIES, childEnv, maskKey, stripSeparator, } from "./types.js";
31
31
  import { defaultWorktreeName, ensureWorktree } from "./worktree.js";
32
+ import { DEFAULT_T3_INSTANCE } from "../t3/instance.js";
32
33
  import { RemoteSession } from "../remote/controller.js";
33
34
  import { startHeadlessTurn } from "../remote/headless.js";
34
35
  import { claudeHookSettings, codexNotifyOverride, hookScriptPath, startHookServer, withHookArgs } from "../remote/hooks.js";
35
36
  import { loadPty, spawnInPty } from "../remote/pty.js";
36
37
  import { remoteSessionURL, UNLINKABLE_SESSION_NOTICE } from "../remote/session-link.js";
37
38
  import { checkpointPush } from "../teleport/commands.js";
39
+ /**
40
+ * The default T3 provider's launcher from before --fallback-endpoint (no
41
+ * DITTO_T3_ENDPOINT_MODE) passes its DITTO_T3_ENDPOINT as --endpoint. That is
42
+ * the provider's default, so it is demoted to the fallback and a checkout's
43
+ * `.ditto/` default applies without rerunning setup. Old launchers of any
44
+ * other instance (profile providers) were a deliberate choice and stay
45
+ * pinned. The launcher's variables are then dropped, so a `heyditto` run
46
+ * inside the chat keeps its own --endpoint.
47
+ */
48
+ export function t3FallbackEndpoint(options, env = process.env) {
49
+ const fromLauncher = env.DITTO_T3_ENDPOINT?.trim();
50
+ const legacyDefault = env.DITTO_T3_ENDPOINT_MODE === undefined
51
+ && path.basename(path.dirname(path.resolve(env.CLAUDE_CONFIG_DIR ?? "/"))) === DEFAULT_T3_INSTANCE;
52
+ for (const k of T3_LAUNCHER_ENV)
53
+ delete env[k];
54
+ if (!fromLauncher || !legacyDefault || options.fallbackEndpoint !== undefined || options.endpoint?.trim() !== fromLauncher)
55
+ return options;
56
+ return { ...options, endpoint: undefined, fallbackEndpoint: fromLauncher };
57
+ }
58
+ const T3_LAUNCHER_ENV = ["DITTO_T3_ENDPOINT", "DITTO_T3_ENDPOINT_MODE", "DITTO_T3_INFERENCE", "DITTO_T3_HEYDITTO_BIN", "DITTO_T3_CLAUDE_BIN"];
38
59
  /** Explicit flags (or resumed choices) win over repo/cloud launch defaults. */
39
60
  export function resolveClaudeLaunchDefaults(options, defaults = {}) {
40
61
  const mcpOnly = options.cliproxy ? false : options.mcpOnly ?? (defaults.claude_inference === "native");
@@ -43,15 +64,19 @@ export function resolveClaudeLaunchDefaults(options, defaults = {}) {
43
64
  return { ...options, mcpOnly, remoteTransport };
44
65
  }
45
66
  const DRY_RUN_KEY = "ditto_inf_<minted-at-launch>";
67
+ /** Harnesses that can attach an endpoint's tools as their own MCP servers. */
68
+ export const MCP_HARNESSES = ["claude", "codex"];
46
69
  /**
47
- * `--mcp` / `--no-mcp`, else the endpoint's `claude_tool_surface`, else native
48
- * MCP: Claude Code gets an endpoint's tools as its own servers unless the
70
+ * `--mcp` / `--no-mcp`, else the endpoint's `<harness>_tool_surface`, else
71
+ * native MCP: the agent gets an endpoint's tools as its own servers unless the
49
72
  * endpoint keeps them on the router (`claude_tool_surface = "router"`).
50
73
  */
51
- export function wantsMcp(options, endpoint) {
74
+ export function wantsMcp(options, endpoint, harness = "claude") {
75
+ if (!MCP_HARNESSES.includes(harness))
76
+ return false;
52
77
  if (options.mcp !== undefined)
53
78
  return options.mcp;
54
- return endpoint.providerOptions?.claude_tool_surface !== "router";
79
+ return endpoint.providerOptions?.[`${harness}_tool_surface`] !== "router";
55
80
  }
56
81
  /**
57
82
  * Ditto's hooks for this launch, from the repository profile that names this
@@ -95,8 +120,8 @@ async function repoHooks(endpoint, profile, cwd, requested, enabled) {
95
120
  return { attachment, banner: `${attachment.summary.join(", ")} ${c("dim", `(${source})`)}` };
96
121
  }
97
122
  /** Someone chose native MCP for this launch, rather than getting it by default. */
98
- function mcpChosen(options, endpoint) {
99
- return options.mcp === true || endpoint.providerOptions?.claude_tool_surface === "mcp";
123
+ function mcpChosen(options, endpoint, harness) {
124
+ return options.mcp === true || endpoint.providerOptions?.[`${harness}_tool_surface`] === "mcp";
100
125
  }
101
126
  /**
102
127
  * The banner's tools field. A fallback to the router is yellow only when MCP
@@ -107,8 +132,9 @@ function mcpBanner(mcp, opts) {
107
132
  return c("dim", "none (the endpoint has no tools)");
108
133
  if (!mcp)
109
134
  return opts.dryRun ? "mcp (catalog read at launch)" : c(opts.chosen ? "yellow" : "dim", "router (MCP not attached)");
110
- return `mcp ${c("dim", `(${mcp.servers} servers, ${mcp.tools} tools; ${mcpApprovalNote(mcp)})`)}`;
135
+ return `mcp ${c("dim", `(${mcp.servers} servers, ${mcp.tools} tools; ${mcpApprovalNote(mcp, opts.agent)})`)}`;
111
136
  }
137
+ const AGENT_LABELS = { claude: "Claude Code", codex: "Codex", grok: "Grok" };
112
138
  function log(line, options) {
113
139
  writeNote(`${c("dim", "ditto:")} ${line}\n`, options);
114
140
  }
@@ -482,12 +508,14 @@ export async function launchHarness(harness, rawArgs, options) {
482
508
  // its endpoint, so it also beats a repository's .ditto default. Only the
483
509
  // flag moves a resumed session off the endpoint it was recorded on; a
484
510
  // shell-wide DITTO_PROFILE does not.
511
+ options = t3FallbackEndpoint(options);
485
512
  const named = options.endpoint?.trim() ? undefined : await explicitProfileEndpoint();
486
513
  const fromFlag = named?.source === "flag" ? named.endpoint : undefined;
487
514
  const requestedEndpoint = options.endpoint ?? (fromFlag ?? record?.endpointSlug ?? named?.endpoint);
488
515
  if (named)
489
516
  log(`using profile ${named.name} → ${named.endpoint}`);
490
- const { selected, catalog } = await signInAndListEndpoints(harness, requestedEndpoint, Boolean(options.dryRun));
517
+ const fallbackEndpoint = options.fallbackEndpoint?.trim() || undefined;
518
+ const { selected, catalog } = await signInAndListEndpoints(harness, requestedEndpoint ?? fallbackEndpoint, Boolean(options.dryRun));
491
519
  // Sent as X-Ditto-Harness-Version so the router serves this release's own
492
520
  // prompts. Started only now that sign-in has succeeded (a failed login
493
521
  // never runs the harness) and awaited where the plan is built, so the
@@ -551,12 +579,15 @@ export async function launchHarness(harness, rawArgs, options) {
551
579
  log(`using ${profile.owner.kind === "org" ? `@${profile.owner.org}/` : ""}${endpoint.slug} from ${path.join(profile.repoDir, ".ditto")}`);
552
580
  }
553
581
  }
554
- endpoint ??= await resolveEndpoint(requestedEndpoint, catalog.endpoints, selected);
582
+ if (!endpoint && !requestedEndpoint?.trim() && fallbackEndpoint)
583
+ log(`using ${fallbackEndpoint} (no repository .ditto default here)`);
584
+ endpoint ??= await resolveEndpoint(requestedEndpoint?.trim() ? requestedEndpoint : fallbackEndpoint, catalog.endpoints, selected);
555
585
  const hooks = harness === "claude" ? await repoHooks(endpoint, repoProfile, cwd, Boolean(requestedEndpoint?.trim()), options.hooks !== false) : undefined;
556
- if (harness === "claude") {
557
- endpoint = { ...endpoint, providerOptions: { ...endpoint.providerOptions, ...repoLaunchDefaults } };
586
+ // The repository's launch defaults (its <agent>_tool_surface among them)
587
+ // beat the endpoint's saved options for this launch.
588
+ endpoint = { ...endpoint, providerOptions: { ...endpoint.providerOptions, ...repoLaunchDefaults } };
589
+ if (harness === "claude")
558
590
  options = resolveClaudeLaunchDefaults(options, endpoint.providerOptions);
559
- }
560
591
  if (!options.mcpOnly && !proxy)
561
592
  await assertEndpointActive(endpoint);
562
593
  if (options.mcpOnly && (harness !== "claude" || options.mcp === false))
@@ -617,20 +648,22 @@ export async function launchHarness(harness, rawArgs, options) {
617
648
  // than launching an agent with none. Native MCP is the default, so the
618
649
  // fallback is only flagged when someone asked for MCP; an endpoint the
619
650
  // surface refuses (an app's) would otherwise warn on every launch.
620
- const wantMcp = harness === "claude" && (options.mcpOnly || wantsMcp(options, endpoint));
621
- const chosen = mcpChosen(options, endpoint);
651
+ const wantMcp = options.mcpOnly || wantsMcp(options, endpoint, harness);
652
+ const chosen = mcpChosen(options, endpoint, harness);
622
653
  let mcp;
623
654
  let noTools = false;
624
655
  if (wantMcp && key?.key) {
625
656
  try {
626
657
  const mcpCatalog = await fetchMcpCatalog(catalog.baseUrl, key.key, sessionId);
627
- const attachment = claudeMcpAttachment(mcpCatalog, sessionId, { yolo: options.yolo, toolDeny: claudeDittoDenyRules(cwd, process.env) });
658
+ const attachment = claudeMcpAttachment(mcpCatalog, sessionId, { yolo: options.yolo, toolDeny: harness === "claude" ? claudeDittoDenyRules(cwd, process.env) : undefined });
628
659
  if (attachment.tools > 0)
629
660
  mcp = attachment;
630
661
  else
631
662
  noTools = true;
632
663
  for (const line of mcpUnavailableLines(mcpCatalog))
633
664
  log(c("yellow", line));
665
+ for (const name of attachment.skipped)
666
+ log(c("yellow", `MCP server ${JSON.stringify(name)} left out: its name cannot be used in an agent's config`));
634
667
  }
635
668
  catch (err) {
636
669
  if (options.mcpOnly || proxy) {
@@ -682,7 +715,7 @@ export async function launchHarness(harness, rawArgs, options) {
682
715
  field("expires", `${expiresIn}${options.keepKey ? "" : c("dim", " (revoked on exit)")}`),
683
716
  budget !== undefined ? field("budget", `${budget.toLocaleString()} tokens`) : undefined,
684
717
  field("session", c("bold", sessionId)),
685
- wantMcp ? field("tools", mcpBanner(mcp, { dryRun: options.dryRun, noTools, chosen })) : undefined,
718
+ wantMcp ? field("tools", mcpBanner(mcp, { dryRun: options.dryRun, noTools, chosen, agent: AGENT_LABELS[harness] })) : undefined,
686
719
  hooks?.banner ? field("hooks", hooks.banner) : undefined,
687
720
  ]
688
721
  .filter(Boolean)