llm-cli-gateway 1.17.4 → 1.17.5

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/dist/approval-manager.js +0 -8
  4. package/dist/async-job-manager.d.ts +0 -113
  5. package/dist/async-job-manager.js +6 -124
  6. package/dist/cache-stats.d.ts +0 -89
  7. package/dist/cache-stats.js +0 -62
  8. package/dist/claude-mcp-config.js +0 -1
  9. package/dist/cli-updater.d.ts +0 -8
  10. package/dist/cli-updater.js +0 -12
  11. package/dist/codex-json-parser.d.ts +0 -20
  12. package/dist/codex-json-parser.js +0 -21
  13. package/dist/config.d.ts +0 -31
  14. package/dist/config.js +2 -72
  15. package/dist/db.d.ts +0 -18
  16. package/dist/db.js +0 -22
  17. package/dist/doctor.d.ts +0 -49
  18. package/dist/doctor.js +0 -47
  19. package/dist/endpoint-exposure.js +0 -1
  20. package/dist/executor.d.ts +0 -19
  21. package/dist/executor.js +3 -38
  22. package/dist/flight-recorder.d.ts +0 -26
  23. package/dist/flight-recorder.js +1 -70
  24. package/dist/gemini-json-parser.d.ts +0 -25
  25. package/dist/gemini-json-parser.js +0 -28
  26. package/dist/health.d.ts +0 -3
  27. package/dist/health.js +0 -3
  28. package/dist/index.d.ts +1 -221
  29. package/dist/index.js +14 -563
  30. package/dist/job-store.d.ts +0 -74
  31. package/dist/job-store.js +1 -73
  32. package/dist/logger.d.ts +0 -7
  33. package/dist/logger.js +0 -6
  34. package/dist/migrate-sessions.d.ts +0 -3
  35. package/dist/migrate-sessions.js +0 -16
  36. package/dist/migrate.js +1 -18
  37. package/dist/mistral-meta-json-parser.js +0 -67
  38. package/dist/model-registry.js +0 -13
  39. package/dist/pricing.d.ts +0 -46
  40. package/dist/pricing.js +0 -47
  41. package/dist/process-monitor.d.ts +0 -15
  42. package/dist/process-monitor.js +2 -31
  43. package/dist/prompt-parts.d.ts +0 -25
  44. package/dist/prompt-parts.js +0 -11
  45. package/dist/provider-status.d.ts +0 -8
  46. package/dist/provider-status.js +0 -11
  47. package/dist/request-helpers.d.ts +0 -334
  48. package/dist/request-helpers.js +1 -229
  49. package/dist/resources.d.ts +0 -20
  50. package/dist/resources.js +1 -34
  51. package/dist/retry.d.ts +0 -45
  52. package/dist/retry.js +3 -40
  53. package/dist/session-manager-pg.d.ts +0 -32
  54. package/dist/session-manager-pg.js +0 -32
  55. package/dist/session-manager.d.ts +0 -21
  56. package/dist/session-manager.js +1 -15
  57. package/dist/stream-json-parser.d.ts +0 -18
  58. package/dist/stream-json-parser.js +0 -22
  59. package/dist/upstream-contracts.d.ts +0 -55
  60. package/dist/upstream-contracts.js +0 -77
  61. package/dist/validation-orchestrator.js +0 -3
  62. package/dist/worktree-manager.d.ts +0 -9
  63. package/dist/worktree-manager.js +0 -21
  64. package/package.json +1 -1
@@ -1,55 +1,20 @@
1
1
  import { z } from "zod/v3";
2
- /** Prefix for gateway-generated session IDs. Enforces provenance structurally. */
3
2
  export declare const GATEWAY_SESSION_PREFIX = "gw-";
4
3
  export interface SessionResumeResult {
5
4
  resumeArgs: string[];
6
5
  effectiveSessionId: string | undefined;
7
6
  userProvidedSession: boolean;
8
7
  }
9
- /**
10
- * Validate that a user-provided sessionId doesn't use the reserved gateway prefix.
11
- * Throws if the ID starts with "gw-" — this namespace is reserved for gateway-generated IDs.
12
- */
13
8
  export declare function validateSessionId(sessionId: string): void;
14
- /**
15
- * Pure function: determine --resume args and session provenance from request flags.
16
- * Does NOT perform any session I/O — callers handle create/update separately.
17
- */
18
- /**
19
- * Reject CLI arg values that start with "-" to prevent argument injection.
20
- * spawn() doesn't invoke a shell so there's no shell injection, but a value
21
- * like "--dangerously-skip-permissions" passed as a tool name would be
22
- * interpreted as a flag by the child CLI.
23
- */
24
9
  export declare function sanitizeCliArgValues(values: string[], fieldName: string): string[];
25
10
  export declare function resolveSessionResumeArgs(opts: {
26
11
  sessionId?: string;
27
12
  resumeLatest?: boolean;
28
13
  createNewSession?: boolean;
29
14
  }): SessionResumeResult;
30
- /**
31
- * Codex-specific resume planning.
32
- *
33
- * Codex CLI ≥ 0.30 exposes session resume as a subcommand (`codex exec resume`),
34
- * not a flag pair like Claude/Gemini/Grok. So we can't return a simple list of
35
- * args — we describe the *mode* and let the caller branch when building argv:
36
- *
37
- * - "new" → `codex exec [...flags] PROMPT`
38
- * - "resume-by-id" → `codex exec resume [...resume-safe flags] <SESSION_ID> PROMPT`
39
- * - "resume-latest" → `codex exec resume --last [...resume-safe flags] PROMPT`
40
- *
41
- * `codex exec resume` rejects sandbox/working-directory policy flags; the original session's approval
42
- * policy is inherited. Callers MUST filter those flags out of the flag set
43
- * when mode is one of the resume forms (see `prepareCodexRequest`).
44
- *
45
- * `sessionId` MUST be a real Codex session UUID (as recorded under
46
- * `~/.codex/sessions/`). Gateway-generated `gw-*` IDs are rejected, since
47
- * they are bookkeeping handles and would 404 against `codex resume`.
48
- */
49
15
  export type CodexSessionMode = "new" | "resume-by-id" | "resume-latest";
50
16
  export interface CodexSessionPlan {
51
17
  mode: CodexSessionMode;
52
- /** Real Codex session UUID. Present only when mode === "resume-by-id". */
53
18
  sessionId?: string;
54
19
  }
55
20
  export declare function resolveCodexSessionArgs(opts: {
@@ -57,39 +22,16 @@ export declare function resolveCodexSessionArgs(opts: {
57
22
  resumeLatest?: boolean;
58
23
  createNewSession?: boolean;
59
24
  }): CodexSessionPlan;
60
- /**
61
- * Grok-specific resume args. Grok accepts `--resume <id>` to resume a named session,
62
- * and `--continue` to resume the most recent session for the current working directory.
63
- * Unlike `resolveSessionResumeArgs`, "resume latest" maps to `--continue` (not `--resume latest`)
64
- * because Grok would interpret a literal "latest" as a session ID.
65
- */
66
25
  export declare function resolveGrokSessionArgs(opts: {
67
26
  sessionId?: string;
68
27
  resumeLatest?: boolean;
69
28
  createNewSession?: boolean;
70
29
  }): SessionResumeResult;
71
- /**
72
- * Mistral Vibe-specific resume args.
73
- *
74
- * Current Vibe defaults session logging on; older configs can explicitly set
75
- * `[session_logging] enabled = false`. The doctor checks that toggle before
76
- * callers rely on session continuity; this pure helper just emits the args.
77
- *
78
- * The args shape mirrors Grok (`--continue` for latest, `--resume <id>` for a
79
- * specific session) because Vibe exposes the same surface for its session log.
80
- */
81
30
  export declare function resolveMistralSessionArgs(opts: {
82
31
  sessionId?: string;
83
32
  resumeLatest?: boolean;
84
33
  createNewSession?: boolean;
85
34
  }): SessionResumeResult;
86
- /**
87
- * Vibe-specific permission mode mapping. Vibe replaces Grok's `--always-approve`
88
- * with an `--agent <mode>` enum. When the caller does not set a permissionMode,
89
- * the gateway emits `--agent auto-approve` explicitly: omitting the flag would
90
- * let Vibe pick its own default which may not be auto-approve, surprising
91
- * programmatic callers.
92
- */
93
35
  export declare const MISTRAL_AGENT_MODES: readonly ["default", "plan", "accept-edits", "auto-approve", "chat", "explore", "lean"];
94
36
  export type MistralAgentMode = (typeof MISTRAL_AGENT_MODES)[number];
95
37
  export declare const MISTRAL_DEFAULT_AGENT_MODE: MistralAgentMode;
@@ -99,45 +41,12 @@ export interface PrepareMistralRequestInput {
99
41
  outputFormat?: string;
100
42
  permissionMode?: MistralAgentMode;
101
43
  allowedTools?: string[];
102
- /**
103
- * Vibe has no flag to deny tools; this is accepted in the schema for caller
104
- * parity with Grok/Claude but produces no CLI flag. The caller is expected to
105
- * emit a `logger.warn` when this is non-empty.
106
- */
107
44
  disallowedTools?: string[];
108
- /**
109
- * Phase 4 slice γ: emit `--trust` so non-interactive runs in fresh
110
- * workspaces skip Vibe's interactive trust prompt for this invocation
111
- * only (not persisted to `trusted_folders.toml`). Default undefined →
112
- * Vibe's prompt behaviour is preserved for existing callers.
113
- */
114
45
  trust?: boolean;
115
- /**
116
- * Phase 4 slice δ: emit `--max-turns N` to cap the agent-loop iteration
117
- * count (only applies in programmatic mode with `-p`).
118
- */
119
46
  maxTurns?: number;
120
- /**
121
- * Phase 4 slice δ: emit `--max-price DOLLARS` so the session is
122
- * interrupted when cumulative cost crosses the cap (programmatic mode
123
- * only).
124
- */
125
47
  maxPrice?: number;
126
- /**
127
- * Vibe 2.x supports `--max-tokens N` in programmatic mode, wired through to
128
- * `run_programmatic(max_session_tokens=...)`.
129
- */
130
48
  maxTokens?: number;
131
- /**
132
- * Phase 4 slice ζ: emit `--workdir <DIR>` so Vibe changes into the named
133
- * directory before running. Single value (Vibe accepts one --workdir).
134
- */
135
49
  workingDir?: string;
136
- /**
137
- * Phase 4 slice ζ: emit `--add-dir <DIR>` per directory. Vibe's `--help`
138
- * states the flag "Can be specified multiple times" — each entry is its
139
- * own argv pair.
140
- */
141
50
  addDir?: string[];
142
51
  }
143
52
  export interface PrepareMistralRequestResult {
@@ -145,127 +54,39 @@ export interface PrepareMistralRequestResult {
145
54
  env: Record<string, string>;
146
55
  ignoredDisallowedTools: boolean;
147
56
  }
148
- /**
149
- * Pure helper that builds Vibe's argv and env.
150
- *
151
- * - Model is selected via `VIBE_ACTIVE_MODEL` env var (NOT a `--model` flag).
152
- * - Permission mode emits `--agent <mode>` (defaults to `auto-approve` when unset).
153
- * - Allowed tools emit `--enabled-tools <tool>` once per tool (allowlist only).
154
- * - Output format emits `--output <text|json|streaming>` (legacy gateway
155
- * aliases `plain` and `stream-json` are normalized before spawn).
156
- * - Disallowed tools are accepted but ignored at the CLI boundary.
157
- */
158
57
  export declare function prepareMistralRequest(input: PrepareMistralRequestInput): PrepareMistralRequestResult;
159
- /**
160
- * Claude `--permission-mode` values. `default` is a no-op (no flag emitted) —
161
- * matches the CLI's behavior when the flag is absent, and avoids hard-coding an
162
- * undocumented literal.
163
- */
164
58
  export declare const CLAUDE_PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "dontAsk", "bypassPermissions"];
165
59
  export type ClaudePermissionMode = (typeof CLAUDE_PERMISSION_MODES)[number];
166
60
  export interface ClaudePermissionFlagsInput {
167
61
  permissionMode?: ClaudePermissionMode;
168
- /** Legacy parameter retained for one minor release. Maps to bypassPermissions. */
169
62
  dangerouslySkipPermissions?: boolean;
170
63
  }
171
64
  export interface ClaudePermissionFlagsResult {
172
65
  args: string[];
173
- /** Set when both legacy + new flag are passed; caller should logger.warn. */
174
66
  warning?: string;
175
67
  }
176
- /**
177
- * Resolve Claude's `--permission-mode` args.
178
- *
179
- * Precedence:
180
- * 1. If `permissionMode` is set, it wins. A warning is returned when
181
- * `dangerouslySkipPermissions: true` is also set (legacy + new conflict).
182
- * 2. Else if `dangerouslySkipPermissions: true`, emit `--permission-mode
183
- * bypassPermissions`.
184
- * 3. Else (or `permissionMode === "default"`) emit nothing.
185
- */
186
68
  export declare function resolveClaudePermissionFlags(input: ClaudePermissionFlagsInput): ClaudePermissionFlagsResult;
187
- /**
188
- * Gemini `--approval-mode` values. Preserves existing values (`default`,
189
- * `auto_edit`, `yolo`) and adds `plan` for parity with Claude's plan mode.
190
- */
191
69
  export declare const GEMINI_APPROVAL_MODES: readonly ["default", "auto_edit", "yolo", "plan"];
192
70
  export type GeminiApprovalMode = (typeof GEMINI_APPROVAL_MODES)[number];
193
- /**
194
- * Codex sandbox modes (for `--sandbox <mode>`).
195
- */
196
71
  export declare const CODEX_SANDBOX_MODES: readonly ["read-only", "workspace-write", "danger-full-access"];
197
72
  export type CodexSandboxMode = (typeof CODEX_SANDBOX_MODES)[number];
198
- /**
199
- * Deprecated Codex approval modes. Current Codex no longer exposes an
200
- * `--ask-for-approval` flag; the MCP input is temporarily retained so older
201
- * callers do not fail schema validation, but it emits no CLI argv.
202
- */
203
73
  export declare const CODEX_ASK_FOR_APPROVAL_MODES: readonly ["untrusted", "on-request", "never"];
204
74
  export type CodexAskForApproval = (typeof CODEX_ASK_FOR_APPROVAL_MODES)[number];
205
75
  export interface CodexSandboxFlagsInput {
206
- /** Modern: explicit sandbox mode. */
207
76
  sandboxMode?: CodexSandboxMode;
208
- /** Deprecated compatibility input; current Codex exposes no approval-policy flag. */
209
77
  askForApproval?: CodexAskForApproval;
210
- /** Legacy: shorthand for sandbox=workspace-write. */
211
78
  fullAuto?: boolean;
212
- /**
213
- * Deprecated compatibility input. Current Codex rejects `--full-auto`, so
214
- * this no longer changes argv emission.
215
- */
216
79
  useLegacyFullAutoFlag?: boolean;
217
80
  }
218
81
  export interface CodexSandboxFlagsResult {
219
82
  args: string[];
220
- /** Set when deprecated/no-op compatibility inputs are supplied. */
221
83
  warning?: string;
222
84
  }
223
- /**
224
- * Resolve current Codex sandbox args from the modern params + legacy
225
- * `fullAuto` shorthand. Current Codex exposes `--sandbox`, but no longer
226
- * exposes `--ask-for-approval` or `--full-auto`.
227
- *
228
- * Precedence:
229
- * 1. Explicit `sandboxMode` emits `--sandbox <mode>`.
230
- * 2. Else if `fullAuto: true`, expand to `--sandbox workspace-write`.
231
- * 3. Deprecated `askForApproval` and `useLegacyFullAutoFlag` emit no argv
232
- * and return warnings for callers to surface/log.
233
- * 4. Else emit nothing.
234
- */
235
85
  export declare function resolveCodexSandboxFlags(input: CodexSandboxFlagsInput): CodexSandboxFlagsResult;
236
- /**
237
- * Flags that `codex exec resume` rejects (the original session's policy is
238
- * inherited). Callers must drop these when building resume argv.
239
- *
240
- * Verified against `codex exec resume --help` (codex-cli 0.135.0):
241
- * `--sandbox`, `--add-dir`, `-C`, `--cd`, `--profile`, and `--search` are rejected.
242
- * Deprecated `--full-auto` / `--ask-for-approval` are kept here defensively so
243
- * legacy pre-filtered segments are stripped instead of reaching spawn.
244
- * `--output-schema` and `-c key=value` ARE accepted on resume and therefore are
245
- * NOT in this filter (Phase 4 slice α restored the previously-silent drop of those two).
246
- */
247
86
  export declare const CODEX_RESUME_FILTERED_FLAGS: ReadonlySet<string>;
248
- /**
249
- * Strip resume-incompatible flag/value pairs from a Codex argv segment.
250
- *
251
- * Bare flags (`--full-auto`, `--search`) drop without consuming a value.
252
- * Value-taking flags (`--sandbox`, `--ask-for-approval`, `--add-dir`, `-C`, `--cd`,
253
- * `--profile`) drop together with their immediately-following value.
254
- */
255
87
  export declare function filterCodexResumeFlags(args: string[]): string[];
256
- /**
257
- * Claude `--effort` enum values. Mirrors the model-side effort axis.
258
- */
259
88
  export declare const CLAUDE_EFFORT_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
260
89
  export type ClaudeEffortLevel = (typeof CLAUDE_EFFORT_LEVELS)[number];
261
- /**
262
- * Standalone Zod object for U25's high-impact param subset. Enforces the
263
- * `systemPrompt` / `appendSystemPrompt` mutual-exclusion via `.refine(...)`.
264
- *
265
- * The MCP SDK's `server.tool` takes a raw shape (no top-level refine), so the
266
- * tool callback re-checks the constraint and returns an error response. This
267
- * exported schema is what tests use to verify Zod-level enforcement.
268
- */
269
90
  export declare const CLAUDE_HIGH_IMPACT_PARAMS_SCHEMA: z.ZodEffects<z.ZodObject<{
270
91
  agent: z.ZodOptional<z.ZodString>;
271
92
  agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -317,12 +138,6 @@ export declare const CLAUDE_HIGH_IMPACT_PARAMS_SCHEMA: z.ZodEffects<z.ZodObject<
317
138
  effort?: "low" | "medium" | "high" | "xhigh" | "max" | undefined;
318
139
  excludeDynamicSystemPromptSections?: boolean | undefined;
319
140
  }>;
320
- /**
321
- * Minimal Anthropic agent-definition schema. Mirrors the shape expected by
322
- * Claude CLI's `--agents` inline JSON argument. We validate the *required*
323
- * keys (`description`, `prompt`) up-front so a malformed payload fails fast
324
- * with an actionable error instead of producing an opaque CLI exit.
325
- */
326
141
  export declare const CLAUDE_AGENT_DEFINITION_SCHEMA: z.ZodObject<{
327
142
  description: z.ZodString;
328
143
  prompt: z.ZodString;
@@ -340,13 +155,6 @@ export declare const CLAUDE_AGENT_DEFINITION_SCHEMA: z.ZodObject<{
340
155
  model: z.ZodOptional<z.ZodString>;
341
156
  }, z.ZodTypeAny, "passthrough">>;
342
157
  export type ClaudeAgentDefinition = z.infer<typeof CLAUDE_AGENT_DEFINITION_SCHEMA>;
343
- /**
344
- * Validate an `agents` map against {@link CLAUDE_AGENT_DEFINITION_SCHEMA}.
345
- *
346
- * Returns `{ ok: true, value }` on success and `{ ok: false, agentKey, message }`
347
- * on the first failing entry. The caller is responsible for turning the failure
348
- * into a tool-level error response (e.g. via `createErrorResponse`).
349
- */
350
158
  export declare function validateClaudeAgentsMap(agents: Record<string, unknown>): {
351
159
  ok: true;
352
160
  value: Record<string, ClaudeAgentDefinition>;
@@ -357,7 +165,6 @@ export declare function validateClaudeAgentsMap(agents: Record<string, unknown>)
357
165
  };
358
166
  export interface ClaudeHighImpactFlagsInput {
359
167
  agent?: string;
360
- /** Pre-validated agents map (call {@link validateClaudeAgentsMap} first). */
361
168
  agents?: Record<string, ClaudeAgentDefinition>;
362
169
  forkSession?: boolean;
363
170
  systemPrompt?: string;
@@ -366,110 +173,24 @@ export interface ClaudeHighImpactFlagsInput {
366
173
  maxTurns?: number;
367
174
  effort?: ClaudeEffortLevel;
368
175
  excludeDynamicSystemPromptSections?: boolean;
369
- /**
370
- * Phase 4 slice η — Claude `--fallback-model <model>`. Routes overloaded-model
371
- * requests to the named fallback. Only effective with `--print` (we always pass
372
- * `-p`, so no extra gating required here).
373
- */
374
176
  fallbackModel?: string;
375
- /**
376
- * Phase 4 slice η — Claude `--json-schema <schema>`. Per `claude --help`, the
377
- * argument is the JSON Schema *literal*, not a path. Object values are
378
- * `JSON.stringify`-d; string values are passed verbatim (caller already wrote
379
- * a JSON literal). No temp file lifecycle needed (contrast with Codex
380
- * `--output-schema`, which takes a path).
381
- */
382
177
  jsonSchema?: string | Record<string, unknown>;
383
- /**
384
- * Phase 4 slice ζ — Claude `--add-dir <dirs...>`. Additional directories the
385
- * Claude CLI is allowed to read/write beyond the process cwd. The CLI accepts
386
- * a single variadic flag (space-separated values) per `claude --help`; we
387
- * emit one `--add-dir` instance per directory so each path is its own argv
388
- * token (survives any future tightening of the variadic parser without
389
- * changing the call site).
390
- */
391
178
  addDir?: string[];
392
- /**
393
- * Claude `--no-session-persistence`: do not write this session to disk
394
- * (one-shot / ephemeral runs; mirrors Codex `--ephemeral`).
395
- */
396
179
  noSessionPersistence?: boolean;
397
- /**
398
- * Claude `--setting-sources <user,project,local>`: comma-separated list of
399
- * setting sources to load, for reproducible / isolated headless runs.
400
- * Passed through verbatim.
401
- */
402
180
  settingSources?: string;
403
- /**
404
- * Claude `--settings <file-or-json>`: load additional settings from a JSON
405
- * file path or a JSON literal. Powerful: settings can define hooks,
406
- * permissions, and model; the value is passed through verbatim.
407
- */
408
181
  settings?: string;
409
- /**
410
- * Claude `--tools <tools...>`: restrict the available built-in tool set
411
- * (distinct from `--allowed-tools` permission gating). Emitted as a single
412
- * variadic flag mirroring `--allowed-tools`; pass `[""]` to disable all
413
- * tools per `claude --help`. An empty array emits nothing.
414
- */
415
182
  tools?: string[];
416
183
  }
417
- /**
418
- * Emit Claude high-impact feature flags (U25) as a flat argv segment.
419
- *
420
- * Mutual-exclusion of `systemPrompt`/`appendSystemPrompt` is enforced upstream
421
- * at the Zod schema (`.refine(...)`); this helper does *not* re-check it, so
422
- * tests can exercise either flag in isolation.
423
- */
424
184
  export declare function prepareClaudeHighImpactFlags(input: ClaudeHighImpactFlagsInput): string[];
425
- /**
426
- * Zod schema for Codex `configOverrides` map.
427
- *
428
- * Hard requirements (argv-injection prevention):
429
- * - Keys MUST match /^[a-zA-Z0-9._]+$/ (no whitespace, no equals, no flag-like prefixes).
430
- * - Values MUST NOT contain CR or LF — newlines could be re-interpreted by the
431
- * CLI's TOML parser as new keys.
432
- *
433
- * The CLI consumes overrides as `-c key=value`. We rely on `spawn(..., args)`
434
- * passing argv directly without a shell, so we forbid shape-breaking
435
- * characters rather than shell-escaping values.
436
- */
437
185
  export declare const CODEX_CONFIG_OVERRIDES_SCHEMA: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
438
186
  export type CodexConfigOverrides = z.infer<typeof CODEX_CONFIG_OVERRIDES_SCHEMA>;
439
- /**
440
- * Emit `-c key=value` pairs for each override. Caller MUST have validated the
441
- * map with {@link CODEX_CONFIG_OVERRIDES_SCHEMA} first.
442
- */
443
187
  export declare function emitCodexConfigOverrideArgs(overrides: Record<string, string> | undefined): string[];
444
- /**
445
- * Materialize `outputSchema` into a CLI path.
446
- *
447
- * If `outputSchema` is a string, treat it as a pre-existing path and pass it
448
- * through verbatim (no temp file, no cleanup needed).
449
- *
450
- * If it is an object, JSON-serialize it into a 0o600-mode temp file under
451
- * `os.tmpdir()` and return both the path and a cleanup function. The caller
452
- * MUST invoke `cleanup()` in a `finally` block (no matter the exit path) so
453
- * the temp file does not leak.
454
- *
455
- * Returns `null` when `outputSchema` is undefined.
456
- */
457
188
  export interface CodexOutputSchemaResult {
458
189
  path: string;
459
- /** No-op when schema came in as a string. Idempotent. */
460
190
  cleanup: () => void;
461
191
  }
462
192
  export declare function prepareCodexOutputSchema(outputSchema: string | Record<string, unknown> | undefined): CodexOutputSchemaResult | null;
463
- /**
464
- * Validate that every image path exists on disk. Returns the first missing
465
- * path on failure; `null` on success.
466
- */
467
193
  export declare function findMissingImagePath(images: string[] | undefined): string | null;
468
- /**
469
- * Zod schema for the U26 Codex high-impact feature subset. Used by the
470
- * `codex_request` / `codex_request_async` tool schemas to validate the new
471
- * params before they reach `prepareCodexRequest`.
472
- */
473
194
  export declare const CODEX_HIGH_IMPACT_PARAMS_SCHEMA: z.ZodObject<{
474
195
  outputSchema: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
475
196
  search: z.ZodOptional<z.ZodBoolean>;
@@ -510,30 +231,11 @@ export interface CodexHighImpactFlagsInput {
510
231
  }
511
232
  export interface CodexHighImpactFlagsResult {
512
233
  args: string[];
513
- /** Cleanup hook for the `outputSchema` temp file. Caller MUST invoke in `finally`. */
514
234
  cleanup: () => void;
515
- /** First missing image path, if any. When set, the caller should bail before spawning. */
516
235
  missingImagePath: string | null;
517
- /** Set when deprecated/no-op compatibility inputs are supplied. */
518
236
  warning?: string;
519
237
  }
520
- /**
521
- * Build the U26 argv segment AND any required side-effect handles.
522
- *
523
- * IMPORTANT: When this function writes a temp file for `outputSchema`, the
524
- * returned `cleanup` function MUST be invoked by the caller (typically in a
525
- * `finally` block around the spawn). Failing to do so leaks `0o600` temp
526
- * files into `os.tmpdir()`.
527
- */
528
238
  export declare function prepareCodexHighImpactFlags(input: CodexHighImpactFlagsInput): CodexHighImpactFlagsResult;
529
- /**
530
- * Pure helper for `codex_fork_session`. Builds `codex fork ...` argv from a
531
- * mutually-exclusive (sessionId | forkLast) selector and a prompt.
532
- *
533
- * Mutual exclusion is also enforced at the Zod schema in `index.ts`; this
534
- * helper re-checks defensively so callers exercising it in isolation get the
535
- * same guarantees.
536
- */
537
239
  export interface CodexForkRequestInput {
538
240
  prompt: string;
539
241
  sessionId?: string;
@@ -542,22 +244,7 @@ export interface CodexForkRequestInput {
542
244
  export declare function prepareCodexForkRequest(input: CodexForkRequestInput): {
543
245
  args: string[];
544
246
  };
545
- /**
546
- * Prepend `@<abs-path>` tokens to a Gemini prompt so the CLI's attachment
547
- * resolver picks them up. Each path MUST be absolute and exist on disk.
548
- *
549
- * Returns the mutated prompt. Throws on validation failure so the caller can
550
- * convert to a `createErrorResponse`.
551
- */
552
247
  export declare function prependGeminiAttachments(prompt: string, attachments: string[]): string;
553
- /**
554
- * Zod schema for the U27 Gemini high-impact feature subset. Used by the
555
- * `gemini_request` / `gemini_request_async` tool schemas to validate the new
556
- * params before they reach `prepareGeminiRequest`.
557
- *
558
- * `attachments` paths are validated to be absolute at the Zod layer; existence
559
- * is enforced at execution time via `prependGeminiAttachments`.
560
- */
561
248
  export declare const GEMINI_HIGH_IMPACT_PARAMS_SCHEMA: z.ZodObject<{
562
249
  sandbox: z.ZodOptional<z.ZodBoolean>;
563
250
  policyFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -581,35 +268,14 @@ export interface GeminiHighImpactFlagsInput {
581
268
  }
582
269
  export interface GeminiHighImpactFlagsResult {
583
270
  args: string[];
584
- /** First missing policy path, if any. When set, the caller should bail. */
585
271
  missingPolicyPath: string | null;
586
- /** Which field the missing path came from (for actionable error messages). */
587
272
  missingPolicyField: "policyFiles" | "adminPolicyFiles" | null;
588
273
  }
589
- /**
590
- * Emit Gemini U27 high-impact flags. Policy paths are existence-checked here
591
- * so a missing file fails fast with an actionable error rather than producing
592
- * an opaque CLI exit.
593
- *
594
- * Does NOT handle `attachments` — those are mutated into the prompt string
595
- * via {@link prependGeminiAttachments} BEFORE the `-p <prompt>` pair is
596
- * emitted, preserving the U21 `-p` ordering invariant.
597
- */
598
274
  export declare function prepareGeminiHighImpactFlags(input: GeminiHighImpactFlagsInput): GeminiHighImpactFlagsResult;
599
- /**
600
- * Result of resolving Gemini's session strategy.
601
- */
602
275
  export interface GeminiSessionPlan {
603
- /** Flag pair to inject into argv (one of `["--resume", id]`, `["--resume", "latest"]`, or `[]`). */
604
276
  args: string[];
605
- /** True iff `--resume <id>` was emitted with a user-supplied id. */
606
277
  resumed: boolean;
607
278
  }
608
- /**
609
- * Resolve Gemini session args. Gemini CLI 0.43 exposes `--resume` but not a
610
- * supported `--session-id` flag for fresh sessions, so new-session requests
611
- * intentionally emit no session flag and let the CLI create its own session.
612
- */
613
279
  export declare function resolveGeminiSessionPlan(opts: {
614
280
  sessionId?: string;
615
281
  resumeLatest?: boolean;