llm-cli-gateway 1.17.3 → 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 +45 -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 +12 -208
  29. package/dist/index.js +116 -588
  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 +6 -31
  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 +4 -316
  48. package/dist/request-helpers.js +13 -231
  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 +86 -64
  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;
@@ -98,48 +40,13 @@ export interface PrepareMistralRequestInput {
98
40
  resolvedModel?: string;
99
41
  outputFormat?: string;
100
42
  permissionMode?: MistralAgentMode;
101
- effort?: string;
102
- reasoningEffort?: string;
103
43
  allowedTools?: string[];
104
- /**
105
- * Vibe has no flag to deny tools; this is accepted in the schema for caller
106
- * parity with Grok/Claude but produces no CLI flag. The caller is expected to
107
- * emit a `logger.warn` when this is non-empty.
108
- */
109
44
  disallowedTools?: string[];
110
- /**
111
- * Phase 4 slice γ: emit `--trust` so non-interactive runs in fresh
112
- * workspaces skip Vibe's interactive trust prompt for this invocation
113
- * only (not persisted to `trusted_folders.toml`). Default undefined →
114
- * Vibe's prompt behaviour is preserved for existing callers.
115
- */
116
45
  trust?: boolean;
117
- /**
118
- * Phase 4 slice δ: emit `--max-turns N` to cap the agent-loop iteration
119
- * count (only applies in programmatic mode with `-p`).
120
- */
121
46
  maxTurns?: number;
122
- /**
123
- * Phase 4 slice δ: emit `--max-price DOLLARS` so the session is
124
- * interrupted when cumulative cost crosses the cap (programmatic mode
125
- * only).
126
- */
127
47
  maxPrice?: number;
128
- /**
129
- * Vibe 2.x supports `--max-tokens N` in programmatic mode, wired through to
130
- * `run_programmatic(max_session_tokens=...)`.
131
- */
132
48
  maxTokens?: number;
133
- /**
134
- * Phase 4 slice ζ: emit `--workdir <DIR>` so Vibe changes into the named
135
- * directory before running. Single value (Vibe accepts one --workdir).
136
- */
137
49
  workingDir?: string;
138
- /**
139
- * Phase 4 slice ζ: emit `--add-dir <DIR>` per directory. Vibe's `--help`
140
- * states the flag "Can be specified multiple times" — each entry is its
141
- * own argv pair.
142
- */
143
50
  addDir?: string[];
144
51
  }
145
52
  export interface PrepareMistralRequestResult {
@@ -147,127 +54,39 @@ export interface PrepareMistralRequestResult {
147
54
  env: Record<string, string>;
148
55
  ignoredDisallowedTools: boolean;
149
56
  }
150
- /**
151
- * Pure helper that builds Vibe's argv and env.
152
- *
153
- * - Model is selected via `VIBE_ACTIVE_MODEL` env var (NOT a `--model` flag).
154
- * - Permission mode emits `--agent <mode>` (defaults to `auto-approve` when unset).
155
- * - Allowed tools emit `--enabled-tools <tool>` once per tool (allowlist only).
156
- * - Output format emits `--output <text|json|streaming>` (legacy gateway
157
- * aliases `plain` and `stream-json` are normalized before spawn).
158
- * - Disallowed tools are accepted but ignored at the CLI boundary.
159
- */
160
57
  export declare function prepareMistralRequest(input: PrepareMistralRequestInput): PrepareMistralRequestResult;
161
- /**
162
- * Claude `--permission-mode` values. `default` is a no-op (no flag emitted) —
163
- * matches the CLI's behavior when the flag is absent, and avoids hard-coding an
164
- * undocumented literal.
165
- */
166
58
  export declare const CLAUDE_PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "dontAsk", "bypassPermissions"];
167
59
  export type ClaudePermissionMode = (typeof CLAUDE_PERMISSION_MODES)[number];
168
60
  export interface ClaudePermissionFlagsInput {
169
61
  permissionMode?: ClaudePermissionMode;
170
- /** Legacy parameter retained for one minor release. Maps to bypassPermissions. */
171
62
  dangerouslySkipPermissions?: boolean;
172
63
  }
173
64
  export interface ClaudePermissionFlagsResult {
174
65
  args: string[];
175
- /** Set when both legacy + new flag are passed; caller should logger.warn. */
176
66
  warning?: string;
177
67
  }
178
- /**
179
- * Resolve Claude's `--permission-mode` args.
180
- *
181
- * Precedence:
182
- * 1. If `permissionMode` is set, it wins. A warning is returned when
183
- * `dangerouslySkipPermissions: true` is also set (legacy + new conflict).
184
- * 2. Else if `dangerouslySkipPermissions: true`, emit `--permission-mode
185
- * bypassPermissions`.
186
- * 3. Else (or `permissionMode === "default"`) emit nothing.
187
- */
188
68
  export declare function resolveClaudePermissionFlags(input: ClaudePermissionFlagsInput): ClaudePermissionFlagsResult;
189
- /**
190
- * Gemini `--approval-mode` values. Preserves existing values (`default`,
191
- * `auto_edit`, `yolo`) and adds `plan` for parity with Claude's plan mode.
192
- */
193
69
  export declare const GEMINI_APPROVAL_MODES: readonly ["default", "auto_edit", "yolo", "plan"];
194
70
  export type GeminiApprovalMode = (typeof GEMINI_APPROVAL_MODES)[number];
195
- /**
196
- * Codex sandbox modes (for `--sandbox <mode>`).
197
- */
198
71
  export declare const CODEX_SANDBOX_MODES: readonly ["read-only", "workspace-write", "danger-full-access"];
199
72
  export type CodexSandboxMode = (typeof CODEX_SANDBOX_MODES)[number];
200
- /**
201
- * Deprecated Codex approval modes. Current Codex no longer exposes an
202
- * `--ask-for-approval` flag; the MCP input is temporarily retained so older
203
- * callers do not fail schema validation, but it emits no CLI argv.
204
- */
205
73
  export declare const CODEX_ASK_FOR_APPROVAL_MODES: readonly ["untrusted", "on-request", "never"];
206
74
  export type CodexAskForApproval = (typeof CODEX_ASK_FOR_APPROVAL_MODES)[number];
207
75
  export interface CodexSandboxFlagsInput {
208
- /** Modern: explicit sandbox mode. */
209
76
  sandboxMode?: CodexSandboxMode;
210
- /** Deprecated compatibility input; current Codex exposes no approval-policy flag. */
211
77
  askForApproval?: CodexAskForApproval;
212
- /** Legacy: shorthand for sandbox=workspace-write. */
213
78
  fullAuto?: boolean;
214
- /**
215
- * Deprecated compatibility input. Current Codex rejects `--full-auto`, so
216
- * this no longer changes argv emission.
217
- */
218
79
  useLegacyFullAutoFlag?: boolean;
219
80
  }
220
81
  export interface CodexSandboxFlagsResult {
221
82
  args: string[];
222
- /** Set when deprecated/no-op compatibility inputs are supplied. */
223
83
  warning?: string;
224
84
  }
225
- /**
226
- * Resolve current Codex sandbox args from the modern params + legacy
227
- * `fullAuto` shorthand. Current Codex exposes `--sandbox`, but no longer
228
- * exposes `--ask-for-approval` or `--full-auto`.
229
- *
230
- * Precedence:
231
- * 1. Explicit `sandboxMode` emits `--sandbox <mode>`.
232
- * 2. Else if `fullAuto: true`, expand to `--sandbox workspace-write`.
233
- * 3. Deprecated `askForApproval` and `useLegacyFullAutoFlag` emit no argv
234
- * and return warnings for callers to surface/log.
235
- * 4. Else emit nothing.
236
- */
237
85
  export declare function resolveCodexSandboxFlags(input: CodexSandboxFlagsInput): CodexSandboxFlagsResult;
238
- /**
239
- * Flags that `codex exec resume` rejects (the original session's policy is
240
- * inherited). Callers must drop these when building resume argv.
241
- *
242
- * Verified against `codex exec resume --help` (codex-cli 0.135.0):
243
- * `--sandbox`, `--add-dir`, `-C`, `--cd`, `--profile`, and `--search` are rejected.
244
- * Deprecated `--full-auto` / `--ask-for-approval` are kept here defensively so
245
- * legacy pre-filtered segments are stripped instead of reaching spawn.
246
- * `--output-schema` and `-c key=value` ARE accepted on resume and therefore are
247
- * NOT in this filter (Phase 4 slice α restored the previously-silent drop of those two).
248
- */
249
86
  export declare const CODEX_RESUME_FILTERED_FLAGS: ReadonlySet<string>;
250
- /**
251
- * Strip resume-incompatible flag/value pairs from a Codex argv segment.
252
- *
253
- * Bare flags (`--full-auto`, `--search`) drop without consuming a value.
254
- * Value-taking flags (`--sandbox`, `--ask-for-approval`, `--add-dir`, `-C`, `--cd`,
255
- * `--profile`) drop together with their immediately-following value.
256
- */
257
87
  export declare function filterCodexResumeFlags(args: string[]): string[];
258
- /**
259
- * Claude `--effort` enum values. Mirrors the model-side effort axis.
260
- */
261
88
  export declare const CLAUDE_EFFORT_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
262
89
  export type ClaudeEffortLevel = (typeof CLAUDE_EFFORT_LEVELS)[number];
263
- /**
264
- * Standalone Zod object for U25's high-impact param subset. Enforces the
265
- * `systemPrompt` / `appendSystemPrompt` mutual-exclusion via `.refine(...)`.
266
- *
267
- * The MCP SDK's `server.tool` takes a raw shape (no top-level refine), so the
268
- * tool callback re-checks the constraint and returns an error response. This
269
- * exported schema is what tests use to verify Zod-level enforcement.
270
- */
271
90
  export declare const CLAUDE_HIGH_IMPACT_PARAMS_SCHEMA: z.ZodEffects<z.ZodObject<{
272
91
  agent: z.ZodOptional<z.ZodString>;
273
92
  agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -319,12 +138,6 @@ export declare const CLAUDE_HIGH_IMPACT_PARAMS_SCHEMA: z.ZodEffects<z.ZodObject<
319
138
  effort?: "low" | "medium" | "high" | "xhigh" | "max" | undefined;
320
139
  excludeDynamicSystemPromptSections?: boolean | undefined;
321
140
  }>;
322
- /**
323
- * Minimal Anthropic agent-definition schema. Mirrors the shape expected by
324
- * Claude CLI's `--agents` inline JSON argument. We validate the *required*
325
- * keys (`description`, `prompt`) up-front so a malformed payload fails fast
326
- * with an actionable error instead of producing an opaque CLI exit.
327
- */
328
141
  export declare const CLAUDE_AGENT_DEFINITION_SCHEMA: z.ZodObject<{
329
142
  description: z.ZodString;
330
143
  prompt: z.ZodString;
@@ -342,13 +155,6 @@ export declare const CLAUDE_AGENT_DEFINITION_SCHEMA: z.ZodObject<{
342
155
  model: z.ZodOptional<z.ZodString>;
343
156
  }, z.ZodTypeAny, "passthrough">>;
344
157
  export type ClaudeAgentDefinition = z.infer<typeof CLAUDE_AGENT_DEFINITION_SCHEMA>;
345
- /**
346
- * Validate an `agents` map against {@link CLAUDE_AGENT_DEFINITION_SCHEMA}.
347
- *
348
- * Returns `{ ok: true, value }` on success and `{ ok: false, agentKey, message }`
349
- * on the first failing entry. The caller is responsible for turning the failure
350
- * into a tool-level error response (e.g. via `createErrorResponse`).
351
- */
352
158
  export declare function validateClaudeAgentsMap(agents: Record<string, unknown>): {
353
159
  ok: true;
354
160
  value: Record<string, ClaudeAgentDefinition>;
@@ -359,7 +165,6 @@ export declare function validateClaudeAgentsMap(agents: Record<string, unknown>)
359
165
  };
360
166
  export interface ClaudeHighImpactFlagsInput {
361
167
  agent?: string;
362
- /** Pre-validated agents map (call {@link validateClaudeAgentsMap} first). */
363
168
  agents?: Record<string, ClaudeAgentDefinition>;
364
169
  forkSession?: boolean;
365
170
  systemPrompt?: string;
@@ -368,86 +173,24 @@ export interface ClaudeHighImpactFlagsInput {
368
173
  maxTurns?: number;
369
174
  effort?: ClaudeEffortLevel;
370
175
  excludeDynamicSystemPromptSections?: boolean;
371
- /**
372
- * Phase 4 slice η — Claude `--fallback-model <model>`. Routes overloaded-model
373
- * requests to the named fallback. Only effective with `--print` (we always pass
374
- * `-p`, so no extra gating required here).
375
- */
376
176
  fallbackModel?: string;
377
- /**
378
- * Phase 4 slice η — Claude `--json-schema <schema>`. Per `claude --help`, the
379
- * argument is the JSON Schema *literal*, not a path. Object values are
380
- * `JSON.stringify`-d; string values are passed verbatim (caller already wrote
381
- * a JSON literal). No temp file lifecycle needed (contrast with Codex
382
- * `--output-schema`, which takes a path).
383
- */
384
177
  jsonSchema?: string | Record<string, unknown>;
385
- /**
386
- * Phase 4 slice ζ — Claude `--add-dir <dirs...>`. Additional directories the
387
- * Claude CLI is allowed to read/write beyond the process cwd. The CLI accepts
388
- * a single variadic flag (space-separated values) per `claude --help`; we
389
- * emit one `--add-dir` instance per directory so each path is its own argv
390
- * token (survives any future tightening of the variadic parser without
391
- * changing the call site).
392
- */
393
178
  addDir?: string[];
179
+ noSessionPersistence?: boolean;
180
+ settingSources?: string;
181
+ settings?: string;
182
+ tools?: string[];
394
183
  }
395
- /**
396
- * Emit Claude high-impact feature flags (U25) as a flat argv segment.
397
- *
398
- * Mutual-exclusion of `systemPrompt`/`appendSystemPrompt` is enforced upstream
399
- * at the Zod schema (`.refine(...)`); this helper does *not* re-check it, so
400
- * tests can exercise either flag in isolation.
401
- */
402
184
  export declare function prepareClaudeHighImpactFlags(input: ClaudeHighImpactFlagsInput): string[];
403
- /**
404
- * Zod schema for Codex `configOverrides` map.
405
- *
406
- * Hard requirements (argv-injection prevention):
407
- * - Keys MUST match /^[a-zA-Z0-9._]+$/ (no whitespace, no equals, no flag-like prefixes).
408
- * - Values MUST NOT contain CR or LF — newlines could be re-interpreted by the
409
- * CLI's TOML parser as new keys.
410
- *
411
- * The CLI consumes overrides as `-c key=value`. We rely on `spawn(..., args)`
412
- * passing argv directly without a shell, so we forbid shape-breaking
413
- * characters rather than shell-escaping values.
414
- */
415
185
  export declare const CODEX_CONFIG_OVERRIDES_SCHEMA: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
416
186
  export type CodexConfigOverrides = z.infer<typeof CODEX_CONFIG_OVERRIDES_SCHEMA>;
417
- /**
418
- * Emit `-c key=value` pairs for each override. Caller MUST have validated the
419
- * map with {@link CODEX_CONFIG_OVERRIDES_SCHEMA} first.
420
- */
421
187
  export declare function emitCodexConfigOverrideArgs(overrides: Record<string, string> | undefined): string[];
422
- /**
423
- * Materialize `outputSchema` into a CLI path.
424
- *
425
- * If `outputSchema` is a string, treat it as a pre-existing path and pass it
426
- * through verbatim (no temp file, no cleanup needed).
427
- *
428
- * If it is an object, JSON-serialize it into a 0o600-mode temp file under
429
- * `os.tmpdir()` and return both the path and a cleanup function. The caller
430
- * MUST invoke `cleanup()` in a `finally` block (no matter the exit path) so
431
- * the temp file does not leak.
432
- *
433
- * Returns `null` when `outputSchema` is undefined.
434
- */
435
188
  export interface CodexOutputSchemaResult {
436
189
  path: string;
437
- /** No-op when schema came in as a string. Idempotent. */
438
190
  cleanup: () => void;
439
191
  }
440
192
  export declare function prepareCodexOutputSchema(outputSchema: string | Record<string, unknown> | undefined): CodexOutputSchemaResult | null;
441
- /**
442
- * Validate that every image path exists on disk. Returns the first missing
443
- * path on failure; `null` on success.
444
- */
445
193
  export declare function findMissingImagePath(images: string[] | undefined): string | null;
446
- /**
447
- * Zod schema for the U26 Codex high-impact feature subset. Used by the
448
- * `codex_request` / `codex_request_async` tool schemas to validate the new
449
- * params before they reach `prepareCodexRequest`.
450
- */
451
194
  export declare const CODEX_HIGH_IMPACT_PARAMS_SCHEMA: z.ZodObject<{
452
195
  outputSchema: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
453
196
  search: z.ZodOptional<z.ZodBoolean>;
@@ -488,30 +231,11 @@ export interface CodexHighImpactFlagsInput {
488
231
  }
489
232
  export interface CodexHighImpactFlagsResult {
490
233
  args: string[];
491
- /** Cleanup hook for the `outputSchema` temp file. Caller MUST invoke in `finally`. */
492
234
  cleanup: () => void;
493
- /** First missing image path, if any. When set, the caller should bail before spawning. */
494
235
  missingImagePath: string | null;
495
- /** Set when deprecated/no-op compatibility inputs are supplied. */
496
236
  warning?: string;
497
237
  }
498
- /**
499
- * Build the U26 argv segment AND any required side-effect handles.
500
- *
501
- * IMPORTANT: When this function writes a temp file for `outputSchema`, the
502
- * returned `cleanup` function MUST be invoked by the caller (typically in a
503
- * `finally` block around the spawn). Failing to do so leaks `0o600` temp
504
- * files into `os.tmpdir()`.
505
- */
506
238
  export declare function prepareCodexHighImpactFlags(input: CodexHighImpactFlagsInput): CodexHighImpactFlagsResult;
507
- /**
508
- * Pure helper for `codex_fork_session`. Builds `codex fork ...` argv from a
509
- * mutually-exclusive (sessionId | forkLast) selector and a prompt.
510
- *
511
- * Mutual exclusion is also enforced at the Zod schema in `index.ts`; this
512
- * helper re-checks defensively so callers exercising it in isolation get the
513
- * same guarantees.
514
- */
515
239
  export interface CodexForkRequestInput {
516
240
  prompt: string;
517
241
  sessionId?: string;
@@ -520,22 +244,7 @@ export interface CodexForkRequestInput {
520
244
  export declare function prepareCodexForkRequest(input: CodexForkRequestInput): {
521
245
  args: string[];
522
246
  };
523
- /**
524
- * Prepend `@<abs-path>` tokens to a Gemini prompt so the CLI's attachment
525
- * resolver picks them up. Each path MUST be absolute and exist on disk.
526
- *
527
- * Returns the mutated prompt. Throws on validation failure so the caller can
528
- * convert to a `createErrorResponse`.
529
- */
530
247
  export declare function prependGeminiAttachments(prompt: string, attachments: string[]): string;
531
- /**
532
- * Zod schema for the U27 Gemini high-impact feature subset. Used by the
533
- * `gemini_request` / `gemini_request_async` tool schemas to validate the new
534
- * params before they reach `prepareGeminiRequest`.
535
- *
536
- * `attachments` paths are validated to be absolute at the Zod layer; existence
537
- * is enforced at execution time via `prependGeminiAttachments`.
538
- */
539
248
  export declare const GEMINI_HIGH_IMPACT_PARAMS_SCHEMA: z.ZodObject<{
540
249
  sandbox: z.ZodOptional<z.ZodBoolean>;
541
250
  policyFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -559,35 +268,14 @@ export interface GeminiHighImpactFlagsInput {
559
268
  }
560
269
  export interface GeminiHighImpactFlagsResult {
561
270
  args: string[];
562
- /** First missing policy path, if any. When set, the caller should bail. */
563
271
  missingPolicyPath: string | null;
564
- /** Which field the missing path came from (for actionable error messages). */
565
272
  missingPolicyField: "policyFiles" | "adminPolicyFiles" | null;
566
273
  }
567
- /**
568
- * Emit Gemini U27 high-impact flags. Policy paths are existence-checked here
569
- * so a missing file fails fast with an actionable error rather than producing
570
- * an opaque CLI exit.
571
- *
572
- * Does NOT handle `attachments` — those are mutated into the prompt string
573
- * via {@link prependGeminiAttachments} BEFORE the `-p <prompt>` pair is
574
- * emitted, preserving the U21 `-p` ordering invariant.
575
- */
576
274
  export declare function prepareGeminiHighImpactFlags(input: GeminiHighImpactFlagsInput): GeminiHighImpactFlagsResult;
577
- /**
578
- * Result of resolving Gemini's session strategy.
579
- */
580
275
  export interface GeminiSessionPlan {
581
- /** Flag pair to inject into argv (one of `["--resume", id]`, `["--resume", "latest"]`, or `[]`). */
582
276
  args: string[];
583
- /** True iff `--resume <id>` was emitted with a user-supplied id. */
584
277
  resumed: boolean;
585
278
  }
586
- /**
587
- * Resolve Gemini session args. Gemini CLI 0.43 exposes `--resume` but not a
588
- * supported `--session-id` flag for fresh sessions, so new-session requests
589
- * intentionally emit no session flag and let the CLI create its own session.
590
- */
591
279
  export declare function resolveGeminiSessionPlan(opts: {
592
280
  sessionId?: string;
593
281
  resumeLatest?: boolean;