@deepthonk/providers 0.1.3 → 0.1.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.
package/README.md CHANGED
@@ -31,7 +31,7 @@ deepthonk plan --profile paper
31
31
 
32
32
  The paper profile plans 285 model calls and 8 sequential rounds. Confirm budget and provider pricing before pointing it at paid models. The short alias `dt` is installed alongside `deepthonk`. Develop from source: see [Development](#development).
33
33
 
34
- > v0.1 scope: an independent TypeScript reimplementation of the OpenDeepThink algorithm as a CLI + MCP server. The published algorithm is the load-bearing part; this release is a practical integration layer with explicit limits documented below. Cost guarantees rely on provider pricing being present in config; resume only inspects trace state, it does not replay; the MCP HTTP transport is loopback-only. The included acceptance smoke uses the deterministic fake provider and a toy task — it is not a CF-73 / HLE reproduction; see `docs/` and [Acknowledgments](#acknowledgments) for the canonical paper and Python reference.
34
+ > v0.1 scope: an independent TypeScript reimplementation of the OpenDeepThink algorithm as a CLI + MCP server. The published algorithm is the load-bearing part; this release is a practical integration layer with explicit limits documented below. Cost guarantees rely on provider pricing being present in config; resume inspects trace state by default and can replay from validated phase boundaries with `--continue` / MCP `continue: true`; the MCP HTTP transport is loopback-only. The included acceptance smoke uses the deterministic fake provider and a toy task — it is not a CF-73 / HLE reproduction; see `docs/` and [Acknowledgments](#acknowledgments) for the canonical paper and Python reference.
35
35
 
36
36
  ## Setup
37
37
 
@@ -70,7 +70,7 @@ deepthonk plan --config ~/.config/deepthonk/config.yaml
70
70
  deepthonk run --task task.md --config ~/.config/deepthonk/config.yaml --profile quick --dry-run
71
71
  ```
72
72
 
73
- Start with `--profile quick` and consider `--max-concurrency`, `--max-input-tokens`, `--max-output-tokens`, `--max-usd`, and `--request-timeout-ms` before larger paid profiles. Runtime token/USD budgets are enforced after completed provider calls and can overshoot by at most the active concurrency window. Every completed run summary includes call/token usage, and includes `usage.usd` when matching model pricing is available.
73
+ Start with `--profile quick` and consider `--max-concurrency`, `--max-calls`, `--max-input-tokens`, `--max-output-tokens`, `--max-usd`, and `--request-timeout-ms` before larger paid profiles. `max_calls` is reserved before dispatch and counts logical model invocations, including failed calls and invalid-JSON retries; provider-internal HTTP retries are reported separately. Token/USD totals are known only after responses and can overshoot by at most the active concurrency window. Plans keep nominal `calls` separate from finalizer and retry headroom in `worst_case_calls`.
74
74
 
75
75
  ## OpenAI-Compatible Providers
76
76
 
@@ -111,7 +111,7 @@ The MCP server exposes the same engine the CLI runs. Once wired into an MCP host
111
111
 
112
112
  Provider API keys come from the host process's environment, not from DeepThonk's config alone. Each host handles env passthrough slightly differently — see the concrete patterns below.
113
113
 
114
- MCP Sampling is supported as `provider: "sampling"` when the connected host advertises the MCP sampling capability. Sampling is not available from standalone CLI runs; use `deepseek`, `openrouter`, or `openai-compatible` there.
114
+ MCP Sampling is supported over stdio as `provider: "sampling"` when the connected host advertises the MCP sampling capability. The v0.1 patch line rejects Sampling over Streamable HTTP and all mixed Sampling/direct role routes; use a direct provider there. Sampling is not available from standalone CLI runs.
115
115
 
116
116
  ### Claude Code
117
117
 
@@ -177,22 +177,28 @@ For local web hosts, or when stdio isn't available:
177
177
  deepthonk serve-mcp --transport http --port 3333
178
178
  ```
179
179
 
180
- The server binds `127.0.0.1:3333` only (loopback) and the endpoint is `POST http://127.0.0.1:3333/mcp`. DNS rebinding protection is on (CVE-2025-66414): requests with `Host` headers outside `127.0.0.1:3333` / `localhost:3333` are rejected. Do not expose this port through a reverse proxy without re-evaluating that trust boundary.
180
+ The server binds `127.0.0.1:3333` only and exposes stateful `POST`, `GET`, and `DELETE` at `http://127.0.0.1:3333/mcp`. Sessions use cryptographic IDs, expire after 30 idle minutes when no request is active, and are capped at 64. DNS rebinding protection is on (CVE-2025-66414): requests with `Host` headers outside `127.0.0.1:3333` / `localhost:3333` are rejected. The wrapper also rejects non-JSON POSTs, non-loopback `Origin` headers, and `Sec-Fetch-Site: cross-site` before reading the body. It has no bearer auth. Do not expose this port through a reverse proxy without re-evaluating that trust boundary.
181
181
 
182
182
  ### Tools
183
183
 
184
184
  | Tool | Purpose |
185
185
  |---|---|
186
186
  | `deepthonk.plan` | Estimate calls and sequential rounds for a profile (no model calls). Use before paid runs. |
187
- | `deepthonk.start` | Start a run in the background; returns `run_dir` + `job_id`. |
187
+ | `deepthonk.start` | Start a run in the background; returns `run_dir`, `job_id`, and job-scoped artifact resources. |
188
188
  | `deepthonk.status` | Poll job status from a `run_dir`. |
189
189
  | `deepthonk.result` | Return final summary + winner once a job is complete. |
190
190
  | `deepthonk.cancel` | Request cancellation by writing `cancel.json` into the run directory. |
191
+ | `deepthonk.lock_inspect` / `deepthonk.lock_reclaim` | Inspect lock ownership and explicitly reclaim only an exact fingerprint. |
192
+ | `deepthonk.repair_budget` | Replace legacy `[redacted]` numeric budget fields with explicit original values. |
191
193
  | `deepthonk.run` | Blocking convenience: start + await completion in one call. Prefer `start` + polling for long-running jobs. |
192
194
  | `deepthonk.rank` | Rank a user-supplied candidate set with pairwise judging + Bradley-Terry (skip generation). |
193
195
  | `deepthonk.mutate` | Mutate one supplied candidate with critique (one-shot). |
194
- | `deepthonk.resume` | Detect whether a run can be resumed. Reports state only; does not replay yet. |
196
+ | `deepthonk.resume` | Detect whether a run can be resumed; with `continue: true`, replay from the last validated phase boundary. |
195
197
  | `deepthonk.export` | Export run summary or full trace in JSON or markdown. |
198
+ | `deepthonk.profile_list` | List saved named profile bundles. |
199
+ | `deepthonk.profile_show` | Show one saved profile; manually edited secret-shaped values are rejected on load. |
200
+ | `deepthonk.profile_save` | Save a reusable named profile bundle. |
201
+ | `deepthonk.profile_delete` | Delete a saved named profile bundle. |
196
202
 
197
203
  All tools accept inline provider/model fields, or `config_path` pointing at a DeepThonk YAML config.
198
204
 
@@ -205,7 +211,9 @@ All tools accept inline provider/model fields, or `config_path` pointing at a De
205
211
  - `deepthonk://runs/{run_id}/population/{generation}` — population snapshot for a generation (JSON).
206
212
  - `deepthonk://runs/{run_id}/{winner|final}` — text artifacts.
207
213
  - `deepthonk://runs/{run_id}/status` — run state (JSON).
208
- - `deepthonk://jobs/{job_id}/{status|result}?run_dir=...` — job-scoped lookup; the `run_dir` query param is required.
214
+ - `deepthonk://jobs/{job_id}/{status|result|config|candidates|comparisons|scores|usage|trace|final|winner}?run_dir=...` — job-scoped lookup; the `run_dir` query param is required.
215
+ - `deepthonk://jobs/{job_id}/population/{generation}?run_dir=...` — job-scoped population snapshots before or after completion.
216
+ - `deepthonk://runs/{run_id}/{resource}/page/{cursor}` and job equivalents — opaque bounded pages. Whole reads are limited to 1 MiB; pages contain at most 1,000 records and 1 MiB.
209
217
 
210
218
  ### Prompts
211
219
 
@@ -213,7 +221,7 @@ Four templates mirror the core loop: `deepthonk/generate`, `deepthonk/compare`,
213
221
 
214
222
  ### Limits
215
223
 
216
- `deepthonk.resume` reports trace state and safe phase boundaries but does not replay interrupted runs. The HTTP transport is loopback-only by design. MCP Sampling depends on the host's sampling implementation; model hints are preferences, token usage may be unavailable, and sampling concurrency is capped at 4.
224
+ `deepthonk.resume` reports trace state by default. With `continue: true`, it validates phase order, artifacts, run/provider/model identity, scores, usage, and deterministic pair schedules before replaying a complete phase boundary. MCP Sampling model hints are preferences, token usage may be unavailable, and stdio Sampling concurrency is capped at 4. Streamable HTTP in v0.1 supports direct providers only.
217
225
 
218
226
  ## Customization
219
227
 
@@ -259,6 +267,8 @@ runs/{run_id}/
259
267
  comparisons.jsonl
260
268
  scores.jsonl
261
269
  usage.jsonl
270
+ population-0.json
271
+ population-{generation}.json
262
272
  summary.json
263
273
  artifacts/winner.txt
264
274
  artifacts/final.txt
@@ -283,10 +293,12 @@ pnpm run lint
283
293
 
284
294
  This repository is source-only. Generated run traces, paper notes, build output, coverage, logs, and `node_modules` are intentionally ignored.
285
295
 
296
+ Release publishing is tag-triggered through npm Trusted Publishing. See [docs/release.md](https://github.com/linxule/deepthonk/blob/main/docs/release.md) before bumping versions or pushing a `v*` tag.
297
+
286
298
  Known limits for this release:
287
299
 
288
- - Conservative resume reports trace state and safe phase boundaries, but does not replay interrupted runs yet.
289
- - MCP Sampling is MCP-host-only. Standalone CLI runs need a direct provider.
300
+ - Conservative v1 resume replays an interrupted phase wholesale, preserves its usage accounting, and only reuses validated completed phase boundaries.
301
+ - MCP Sampling is stdio-host-only in v0.1. Standalone CLI and Streamable HTTP runs need a direct provider.
290
302
  - `maxUsd` requires known model pricing; add explicit prices in YAML for custom providers and model IDs. Optional fields `longContextThresholdTokens`, `inputUsdPerMillionLong`, and `outputUsdPerMillionLong` enable tiered pricing for models with a long-context surcharge (e.g., Gemini at 200K input tokens). Cache hit/miss rates remain flat.
291
303
 
292
304
  ## Acknowledgments
@@ -9,6 +9,7 @@ export interface ProviderModelOverrides {
9
9
  }
10
10
  export interface ProviderConfigOptions {
11
11
  provider: string;
12
+ routeFingerprint?: string;
12
13
  baseUrl?: string;
13
14
  apiKeyEnv?: string;
14
15
  apiKey?: string;
@@ -16,6 +17,14 @@ export interface ProviderConfigOptions {
16
17
  retry?: ProviderConfig["retry"];
17
18
  supportsJsonMode?: boolean;
18
19
  samplingTransport?: SamplingTransport;
20
+ modelHints?: string[];
21
+ costPriority?: number;
22
+ speedPriority?: number;
23
+ intelligencePriority?: number;
24
+ includeRawOutputs?: boolean;
25
+ requestTimeoutMs?: number;
26
+ /** Disable implicit endpoint and credential defaults for an explicitly replaced route. */
27
+ inheritProviderDefaults?: boolean;
19
28
  roleProviders?: Partial<Record<ProviderRole, Partial<Omit<RoleProviderConfig, "model">> & {
20
29
  model?: string;
21
30
  }>>;
package/dist/defaults.js CHANGED
@@ -8,16 +8,24 @@ export function resolveProviderModels(provider, overrides = {}) {
8
8
  }
9
9
  export function resolveProviderConfig(options) {
10
10
  const models = resolveProviderModels(options.provider, options.models);
11
+ const inheritProviderDefaults = options.inheritProviderDefaults ?? true;
11
12
  return {
12
13
  provider: options.provider,
13
- baseUrl: options.baseUrl ?? defaultBaseUrl(options.provider),
14
- apiKeyEnv: options.apiKeyEnv ?? defaultApiKeyEnv(options.provider),
14
+ routeFingerprint: options.routeFingerprint,
15
+ baseUrl: options.baseUrl ?? (inheritProviderDefaults ? defaultBaseUrl(options.provider) : undefined),
16
+ apiKeyEnv: options.apiKeyEnv ?? (inheritProviderDefaults ? defaultApiKeyEnv(options.provider) : undefined),
15
17
  apiKey: options.apiKey,
16
18
  models,
17
19
  retry: options.retry,
18
20
  supportsJsonMode: options.supportsJsonMode,
19
21
  samplingTransport: options.samplingTransport,
20
- roleProviders: resolveRoleProviders(options.provider, models, options.roleProviders, options.retry)
22
+ modelHints: options.modelHints,
23
+ costPriority: options.costPriority,
24
+ speedPriority: options.speedPriority,
25
+ intelligencePriority: options.intelligencePriority,
26
+ includeRawOutputs: options.includeRawOutputs,
27
+ requestTimeoutMs: options.requestTimeoutMs,
28
+ roleProviders: resolveRoleProviders(options.provider, models, options.roleProviders, options.retry, options.supportsJsonMode)
21
29
  };
22
30
  }
23
31
  export function defaultModel(provider, role) {
@@ -49,7 +57,7 @@ export function defaultApiKeyEnv(provider) {
49
57
  return "DEEPTHONK_API_KEY";
50
58
  return undefined;
51
59
  }
52
- function resolveRoleProviders(baseProvider, models, roleProviders, baseRetry) {
60
+ function resolveRoleProviders(baseProvider, models, roleProviders, baseRetry, baseSupportsJsonMode) {
53
61
  if (!roleProviders)
54
62
  return undefined;
55
63
  const resolved = {};
@@ -58,15 +66,16 @@ function resolveRoleProviders(baseProvider, models, roleProviders, baseRetry) {
58
66
  if (!input)
59
67
  continue;
60
68
  const provider = input.provider ?? baseProvider;
61
- const model = input.model ?? models[role] ?? defaultModel(provider, role);
69
+ const isolatedRoute = input.baseUrl !== undefined || (input.provider !== undefined && input.provider !== baseProvider);
70
+ const model = input.model ?? (isolatedRoute ? defaultModel(provider, role) : models[role]) ?? defaultModel(provider, role);
62
71
  resolved[role] = {
63
72
  provider,
64
73
  baseUrl: input.baseUrl ?? defaultBaseUrl(provider),
65
- apiKeyEnv: input.apiKeyEnv ?? defaultApiKeyEnv(provider),
74
+ apiKeyEnv: input.apiKeyEnv ?? (input.baseUrl === undefined ? defaultApiKeyEnv(provider) : undefined),
66
75
  apiKey: input.apiKey,
67
76
  model,
68
77
  retry: input.retry ?? baseRetry,
69
- supportsJsonMode: input.supportsJsonMode
78
+ supportsJsonMode: input.supportsJsonMode ?? (isolatedRoute ? undefined : baseSupportsJsonMode)
70
79
  };
71
80
  }
72
81
  return Object.keys(resolved).length ? resolved : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,qBAAqB,CAAC,QAAgB,EAAE,YAAoC,EAAE;IAC5F,OAAO;QACL,SAAS,EAAE,SAAS,CAAC,SAAS,IAAI,YAAY,CAAC,QAAQ,EAAE,WAAW,CAAC;QACrE,OAAO,EAAE,SAAS,CAAC,OAAO,IAAI,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC;QAC/D,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;QACzD,SAAS,EAAE,SAAS,CAAC,SAAS;KAC/B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAA8B;IAClE,MAAM,MAAM,GAAG,qBAAqB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC5D,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC;QAClE,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM;QACN,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,aAAa,EAAE,oBAAoB,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Role } from "./types.js";
3
+ export interface ExternalConfigFile {
4
+ runId?: string;
5
+ profile?: BuiltInProfileName;
6
+ provider?: string;
7
+ base_url?: string;
8
+ api_key_env?: string;
9
+ supports_json_mode?: boolean;
10
+ models?: {
11
+ generator?: string;
12
+ mutator?: string;
13
+ judge?: string;
14
+ finalizer?: string;
15
+ };
16
+ providers?: Partial<Record<ProviderRole, ExternalRoleProviderConfig>>;
17
+ concurrency?: Partial<RunConfig["concurrency"]>;
18
+ retry?: Partial<RunConfig["retry"]>;
19
+ budget?: RunConfig["budget"];
20
+ output?: Partial<RunConfig["output"]>;
21
+ prompt_style?: RunConfig["promptStyle"];
22
+ algorithm?: ExternalAlgorithmOverrides;
23
+ prompts?: ExternalPromptOverrides;
24
+ metadata?: Record<string, unknown>;
25
+ }
26
+ export interface ExternalAlgorithmOverrides {
27
+ n?: number;
28
+ k?: number;
29
+ t?: number;
30
+ m?: number;
31
+ lambda?: number;
32
+ sample_temperature?: number;
33
+ mutate_temperature?: number;
34
+ judge_temperature?: number;
35
+ }
36
+ export interface ExternalPromptOverrides {
37
+ generate?: {
38
+ system?: string;
39
+ user?: string;
40
+ };
41
+ compare?: {
42
+ system?: string;
43
+ user?: string;
44
+ };
45
+ mutate?: {
46
+ system?: string;
47
+ user?: string;
48
+ };
49
+ finalize?: {
50
+ system?: string;
51
+ user?: string;
52
+ };
53
+ }
54
+ interface ExternalRoleProviderConfig {
55
+ provider?: string;
56
+ base_url?: string;
57
+ api_key_env?: string;
58
+ model?: string;
59
+ supports_json_mode?: boolean;
60
+ }
61
+ /** Normalize the public YAML contract to the camelCase core/provider shape. */
62
+ export declare function normalizeExternalConfig(value: unknown, source?: string): ExternalConfigFile;
63
+ export {};
@@ -0,0 +1,266 @@
1
+ import { ConfigError } from "@deepthonk/core";
2
+ import { z } from "zod";
3
+ const nonEmptyString = z.string().trim().min(1);
4
+ const promptBlockSchema = z.object({ system: z.string().optional(), user: z.string().optional() }).strict();
5
+ const priceSchema = z
6
+ .object({
7
+ provider: nonEmptyString,
8
+ model: nonEmptyString,
9
+ inputUsdPerMillion: z.number().min(0).optional(),
10
+ inputCacheHitUsdPerMillion: z.number().min(0).optional(),
11
+ inputCacheMissUsdPerMillion: z.number().min(0).optional(),
12
+ outputUsdPerMillion: z.number().min(0).optional(),
13
+ longContextThresholdTokens: z.number().int().min(1).optional(),
14
+ inputUsdPerMillionLong: z.number().min(0).optional(),
15
+ outputUsdPerMillionLong: z.number().min(0).optional()
16
+ })
17
+ .strict()
18
+ .superRefine((price, context) => {
19
+ const longFields = [price.longContextThresholdTokens, price.inputUsdPerMillionLong, price.outputUsdPerMillionLong];
20
+ if (longFields.every((entry) => entry === undefined))
21
+ return;
22
+ if (price.longContextThresholdTokens === undefined ||
23
+ price.inputUsdPerMillion === undefined ||
24
+ price.outputUsdPerMillion === undefined ||
25
+ price.inputUsdPerMillionLong === undefined ||
26
+ price.outputUsdPerMillionLong === undefined) {
27
+ context.addIssue({
28
+ code: z.ZodIssueCode.custom,
29
+ message: "Long-context pricing requires threshold and complete flat/long input/output rates."
30
+ });
31
+ }
32
+ });
33
+ const externalConfigSchema = z
34
+ .object({
35
+ runId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/).optional(),
36
+ profile: z.enum(["quick", "balanced", "paper"]).optional(),
37
+ provider: nonEmptyString.optional(),
38
+ base_url: z.string().url().optional(),
39
+ api_key_env: z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).optional(),
40
+ supports_json_mode: z.boolean().optional(),
41
+ models: z.object({ generator: nonEmptyString.optional(), mutator: nonEmptyString.optional(), judge: nonEmptyString.optional(), finalizer: nonEmptyString.optional() }).strict().optional(),
42
+ providers: z.record(z.enum(["generator", "mutator", "judge", "finalizer"]), z.object({
43
+ provider: nonEmptyString.optional(),
44
+ base_url: z.string().url().optional(),
45
+ api_key_env: z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).optional(),
46
+ model: nonEmptyString.optional(),
47
+ supports_json_mode: z.boolean().optional()
48
+ }).strict()).optional(),
49
+ concurrency: z.object({ generate: z.number().int().min(1).optional(), judge: z.number().int().min(1).optional(), mutate: z.number().int().min(1).optional() }).strict().optional(),
50
+ retry: z.object({ httpRetries: z.number().int().min(0).optional(), invalidJsonRetries: z.number().int().min(0).optional(), requestTimeoutMs: z.number().int().min(1).optional() }).strict().optional(),
51
+ budget: z.object({
52
+ maxCalls: z.number().int().min(1).optional(),
53
+ maxInputTokens: z.number().int().min(1).optional(),
54
+ maxOutputTokens: z.number().int().min(1).optional(),
55
+ maxUsd: z.number().min(0).optional(),
56
+ prices: z.array(priceSchema).optional()
57
+ }).strict().optional(),
58
+ output: z.object({ includeRawModelOutputs: z.boolean().optional(), includePrompts: z.boolean().optional() }).strict().optional(),
59
+ prompt_style: z.enum(["general", "paper-programming"]).optional(),
60
+ algorithm: z.object({
61
+ n: z.number().int().min(2).optional(),
62
+ k: z.number().int().min(1).optional(),
63
+ t: z.number().int().min(0).optional(),
64
+ m: z.number().int().min(1).optional(),
65
+ lambda: z.number().min(0).optional(),
66
+ sample_temperature: z.number().min(0).optional(),
67
+ mutate_temperature: z.number().min(0).optional(),
68
+ judge_temperature: z.number().min(0).optional()
69
+ }).strict().optional(),
70
+ prompts: z.object({ generate: promptBlockSchema.optional(), compare: promptBlockSchema.optional(), mutate: promptBlockSchema.optional(), finalize: promptBlockSchema.optional() }).strict().optional(),
71
+ metadata: z.record(z.unknown()).optional()
72
+ })
73
+ .strict();
74
+ /** Normalize the public YAML contract to the camelCase core/provider shape. */
75
+ export function normalizeExternalConfig(value, source = "config") {
76
+ const root = configRecord(value, source);
77
+ assertKnownKeys(root, [
78
+ "profile", "run_id", "runId", "provider", "base_url", "baseUrl", "api_key_env", "apiKeyEnv",
79
+ "supports_json_mode", "supportsJsonMode", "models", "providers", "concurrency", "retry", "budget",
80
+ "output", "prompt_style", "promptStyle", "algorithm", "prompts", "metadata"
81
+ ], source);
82
+ const normalized = {
83
+ runId: aliased(root, "run_id", "runId", source),
84
+ profile: root.profile,
85
+ provider: root.provider,
86
+ base_url: aliased(root, "base_url", "baseUrl", source),
87
+ api_key_env: aliased(root, "api_key_env", "apiKeyEnv", source),
88
+ supports_json_mode: aliased(root, "supports_json_mode", "supportsJsonMode", source),
89
+ models: normalizeModels(root.models, `${source}.models`),
90
+ providers: normalizeProviders(root.providers, `${source}.providers`),
91
+ concurrency: normalizeConcurrency(root.concurrency, `${source}.concurrency`),
92
+ retry: normalizeRetry(root.retry, `${source}.retry`),
93
+ budget: normalizeBudget(root.budget, `${source}.budget`),
94
+ output: normalizeOutput(root.output, `${source}.output`),
95
+ prompt_style: aliased(root, "prompt_style", "promptStyle", source),
96
+ algorithm: normalizeAlgorithm(root.algorithm, `${source}.algorithm`),
97
+ prompts: normalizePrompts(root.prompts, `${source}.prompts`),
98
+ metadata: root.metadata === undefined ? undefined : configRecord(root.metadata, `${source}.metadata`)
99
+ };
100
+ const compact = compactConfig(normalized);
101
+ const parsed = externalConfigSchema.safeParse(compact);
102
+ if (!parsed.success) {
103
+ throw new ConfigError(`Invalid config value at ${source}: ${parsed.error.issues.map((issue) => `${issue.path.join(".") || "root"}: ${issue.message}`).join("; ")}.`, {
104
+ code: "config.invalid_value",
105
+ retryable: false,
106
+ fix: "Use the documented strings, booleans, enums, and numeric ranges. YAML numeric values must not be quoted."
107
+ });
108
+ }
109
+ return parsed.data;
110
+ }
111
+ function normalizeModels(value, path) {
112
+ if (value === undefined)
113
+ return undefined;
114
+ const record = configRecord(value, path);
115
+ assertKnownKeys(record, ["generator", "mutator", "judge", "finalizer"], path);
116
+ return compactConfig({ generator: record.generator, mutator: record.mutator, judge: record.judge, finalizer: record.finalizer });
117
+ }
118
+ function normalizeProviders(value, path) {
119
+ if (value === undefined)
120
+ return undefined;
121
+ const record = configRecord(value, path);
122
+ assertKnownKeys(record, ["generator", "mutator", "judge", "finalizer"], path);
123
+ const providers = {};
124
+ for (const role of ["generator", "mutator", "judge", "finalizer"]) {
125
+ if (record[role] === undefined)
126
+ continue;
127
+ const rolePath = `${path}.${role}`;
128
+ const input = configRecord(record[role], rolePath);
129
+ assertKnownKeys(input, ["provider", "base_url", "baseUrl", "api_key_env", "apiKeyEnv", "model", "supports_json_mode", "supportsJsonMode"], rolePath);
130
+ providers[role] = compactConfig({
131
+ provider: input.provider,
132
+ base_url: aliased(input, "base_url", "baseUrl", rolePath),
133
+ api_key_env: aliased(input, "api_key_env", "apiKeyEnv", rolePath),
134
+ model: input.model,
135
+ supports_json_mode: aliased(input, "supports_json_mode", "supportsJsonMode", rolePath)
136
+ });
137
+ }
138
+ return providers;
139
+ }
140
+ function normalizeConcurrency(value, path) {
141
+ if (value === undefined)
142
+ return undefined;
143
+ const record = configRecord(value, path);
144
+ assertKnownKeys(record, ["generate", "judge", "mutate"], path);
145
+ return compactConfig({ generate: record.generate, judge: record.judge, mutate: record.mutate });
146
+ }
147
+ function normalizeRetry(value, path) {
148
+ if (value === undefined)
149
+ return undefined;
150
+ const record = configRecord(value, path);
151
+ assertKnownKeys(record, ["http_retries", "httpRetries", "invalid_json_retries", "invalidJsonRetries", "request_timeout_ms", "requestTimeoutMs"], path);
152
+ return compactConfig({
153
+ httpRetries: aliased(record, "http_retries", "httpRetries", path),
154
+ invalidJsonRetries: aliased(record, "invalid_json_retries", "invalidJsonRetries", path),
155
+ requestTimeoutMs: aliased(record, "request_timeout_ms", "requestTimeoutMs", path)
156
+ });
157
+ }
158
+ function normalizeBudget(value, path) {
159
+ if (value === undefined)
160
+ return undefined;
161
+ const record = configRecord(value, path);
162
+ assertKnownKeys(record, ["max_calls", "maxCalls", "max_input_tokens", "maxInputTokens", "max_output_tokens", "maxOutputTokens", "max_usd", "maxUsd", "prices"], path);
163
+ return compactConfig({
164
+ maxCalls: aliased(record, "max_calls", "maxCalls", path),
165
+ maxInputTokens: aliased(record, "max_input_tokens", "maxInputTokens", path),
166
+ maxOutputTokens: aliased(record, "max_output_tokens", "maxOutputTokens", path),
167
+ maxUsd: aliased(record, "max_usd", "maxUsd", path),
168
+ prices: record.prices === undefined ? undefined : normalizePrices(record.prices, `${path}.prices`)
169
+ });
170
+ }
171
+ function normalizePrices(value, path) {
172
+ if (!Array.isArray(value))
173
+ throw invalidConfigShape(path, "an array");
174
+ return value.map((entry, index) => {
175
+ const entryPath = `${path}[${index}]`;
176
+ const record = configRecord(entry, entryPath);
177
+ const aliases = [
178
+ ["input_usd_per_million", "inputUsdPerMillion"], ["input_cache_hit_usd_per_million", "inputCacheHitUsdPerMillion"],
179
+ ["input_cache_miss_usd_per_million", "inputCacheMissUsdPerMillion"], ["output_usd_per_million", "outputUsdPerMillion"],
180
+ ["long_context_threshold_tokens", "longContextThresholdTokens"], ["input_usd_per_million_long", "inputUsdPerMillionLong"],
181
+ ["output_usd_per_million_long", "outputUsdPerMillionLong"]
182
+ ];
183
+ assertKnownKeys(record, ["provider", "model", ...aliases.flat()], entryPath);
184
+ return compactConfig({
185
+ provider: record.provider, model: record.model,
186
+ inputUsdPerMillion: aliased(record, ...aliases[0], entryPath),
187
+ inputCacheHitUsdPerMillion: aliased(record, ...aliases[1], entryPath),
188
+ inputCacheMissUsdPerMillion: aliased(record, ...aliases[2], entryPath),
189
+ outputUsdPerMillion: aliased(record, ...aliases[3], entryPath),
190
+ longContextThresholdTokens: aliased(record, ...aliases[4], entryPath),
191
+ inputUsdPerMillionLong: aliased(record, ...aliases[5], entryPath),
192
+ outputUsdPerMillionLong: aliased(record, ...aliases[6], entryPath)
193
+ });
194
+ });
195
+ }
196
+ function normalizeOutput(value, path) {
197
+ if (value === undefined)
198
+ return undefined;
199
+ const record = configRecord(value, path);
200
+ assertKnownKeys(record, ["include_raw_model_outputs", "includeRawModelOutputs", "include_prompts", "includePrompts"], path);
201
+ return compactConfig({
202
+ includeRawModelOutputs: aliased(record, "include_raw_model_outputs", "includeRawModelOutputs", path),
203
+ includePrompts: aliased(record, "include_prompts", "includePrompts", path)
204
+ });
205
+ }
206
+ function normalizeAlgorithm(value, path) {
207
+ if (value === undefined)
208
+ return undefined;
209
+ const record = configRecord(value, path);
210
+ assertKnownKeys(record, ["n", "k", "t", "m", "lambda", "sample_temperature", "sampleTemperature", "mutate_temperature", "mutateTemperature", "judge_temperature", "judgeTemperature"], path);
211
+ return compactConfig({
212
+ n: record.n, k: record.k, t: record.t, m: record.m, lambda: record.lambda,
213
+ sample_temperature: aliased(record, "sample_temperature", "sampleTemperature", path),
214
+ mutate_temperature: aliased(record, "mutate_temperature", "mutateTemperature", path),
215
+ judge_temperature: aliased(record, "judge_temperature", "judgeTemperature", path)
216
+ });
217
+ }
218
+ function normalizePrompts(value, path) {
219
+ if (value === undefined)
220
+ return undefined;
221
+ const record = configRecord(value, path);
222
+ assertKnownKeys(record, ["generate", "compare", "mutate", "finalize"], path);
223
+ const prompts = {};
224
+ for (const phase of ["generate", "compare", "mutate", "finalize"]) {
225
+ if (record[phase] === undefined)
226
+ continue;
227
+ const phasePath = `${path}.${phase}`;
228
+ const prompt = configRecord(record[phase], phasePath);
229
+ assertKnownKeys(prompt, ["system", "user"], phasePath);
230
+ prompts[phase] = compactConfig({ system: prompt.system, user: prompt.user });
231
+ }
232
+ return prompts;
233
+ }
234
+ function configRecord(value, path) {
235
+ if (!value || typeof value !== "object" || Array.isArray(value))
236
+ throw invalidConfigShape(path, "a mapping");
237
+ return value;
238
+ }
239
+ function assertKnownKeys(record, allowed, path) {
240
+ const allowedSet = new Set(allowed);
241
+ const unknown = Object.keys(record).filter((key) => !allowedSet.has(key));
242
+ if (!unknown.length)
243
+ return;
244
+ throw new ConfigError(`Unknown config key${unknown.length === 1 ? "" : "s"} at ${path}: ${unknown.join(", ")}.`, {
245
+ code: "config.unknown_key", retryable: false,
246
+ fix: "Remove misspelled or unsupported operational keys. Arbitrary application data is allowed only below metadata."
247
+ });
248
+ }
249
+ function aliased(record, canonical, camel, path) {
250
+ const hasCanonical = Object.prototype.hasOwnProperty.call(record, canonical);
251
+ const hasCamel = Object.prototype.hasOwnProperty.call(record, camel);
252
+ if (hasCanonical && hasCamel && JSON.stringify(record[canonical]) !== JSON.stringify(record[camel])) {
253
+ throw new ConfigError(`Conflicting config aliases at ${path}: '${canonical}' and '${camel}' have different values.`, {
254
+ code: "config.alias_conflict", retryable: false,
255
+ fix: `Keep the canonical snake_case '${canonical}' key, or make both aliases identical during migration.`
256
+ });
257
+ }
258
+ return hasCanonical ? record[canonical] : record[camel];
259
+ }
260
+ function compactConfig(value) {
261
+ return Object.fromEntries(Object.entries(value).filter(([, entryValue]) => entryValue !== undefined));
262
+ }
263
+ function invalidConfigShape(path, expected) {
264
+ return new ConfigError(`${path} must be ${expected}.`, { code: "config.invalid_shape", retryable: false, fix: "Use the documented YAML mapping and array structure." });
265
+ }
266
+ //# sourceMappingURL=externalConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalConfig.js","sourceRoot":"","sources":["../src/externalConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2C,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgDxB,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChD,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAC5G,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,QAAQ,EAAE,cAAc;IACxB,KAAK,EAAE,cAAc;IACrB,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAChD,0BAA0B,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,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AE,CAAC,UAAU,KAAK,SAAS,CAAC,CAAM,CAAC;AAC7G,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY,EAAE,QAAgB;IACxD,OAAO,IAAI,WAAW,CAAC,GAAG,IAAI,YAAY,QAAQ,GAAG,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,sDAAsD,EAAE,CAAC,CAAC;AAC1K,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  export * from "./fake.js";
2
2
  export * from "./defaults.js";
3
3
  export * from "./env.js";
4
+ export * from "./externalConfig.js";
4
5
  export * from "./jsonExtract.js";
5
6
  export * from "./profileRegistry.js";
6
7
  export * from "./openaiCompatible.js";
7
8
  export * from "./pricing.js";
9
+ export * from "./providerReplay.js";
8
10
  export * from "./registry.js";
9
11
  export * from "./sampling.js";
10
12
  export * from "./types.js";
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  export * from "./fake.js";
2
2
  export * from "./defaults.js";
3
3
  export * from "./env.js";
4
+ export * from "./externalConfig.js";
4
5
  export * from "./jsonExtract.js";
5
6
  export * from "./profileRegistry.js";
6
7
  export * from "./openaiCompatible.js";
7
8
  export * from "./pricing.js";
9
+ export * from "./providerReplay.js";
8
10
  export * from "./registry.js";
9
11
  export * from "./sampling.js";
10
12
  export * from "./types.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
@@ -7,7 +7,11 @@ export declare class OpenAiCompatibleDriver implements ModelDriver {
7
7
  readonly apiKey?: string;
8
8
  readonly httpRetries: number;
9
9
  readonly requestTimeoutMs?: number;
10
+ readonly responseBodyLimitBytes: number;
11
+ readonly maxRetryDelayMs: number;
10
12
  readonly supportsJsonMode: boolean;
13
+ private jsonModeState;
14
+ private jsonModeProbe?;
11
15
  constructor(config: ProviderConfig);
12
16
  generate(input: GenerateInput): Promise<ModelTextResult>;
13
17
  compare(input: CompareInput): Promise<ModelTextResult>;