@warmdrift/kgauto-compiler 2.0.0-alpha.9 → 2.0.0-alpha.90

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 (55) hide show
  1. package/README.md +176 -46
  2. package/dist/brain-proxy.d.mts +113 -0
  3. package/dist/brain-proxy.d.ts +113 -0
  4. package/dist/brain-proxy.js +193 -0
  5. package/dist/brain-proxy.mjs +6 -0
  6. package/dist/chunk-4LYNDEHJ.mjs +219 -0
  7. package/dist/chunk-65ZMX5OT.mjs +169 -0
  8. package/dist/{chunk-5TI6PNSK.mjs → chunk-BVEXV5KC.mjs} +11 -0
  9. package/dist/chunk-ENELVMJI.mjs +858 -0
  10. package/dist/chunk-NBO4R5PC.mjs +313 -0
  11. package/dist/chunk-OK2TMFRR.mjs +1879 -0
  12. package/dist/chunk-P3TOAEG4.mjs +56 -0
  13. package/dist/chunk-RO22VFIF.mjs +29 -0
  14. package/dist/dialect.d.mts +41 -3
  15. package/dist/dialect.d.ts +41 -3
  16. package/dist/dialect.js +14 -2
  17. package/dist/dialect.mjs +5 -3
  18. package/dist/glassbox/index.d.mts +59 -0
  19. package/dist/glassbox/index.d.ts +59 -0
  20. package/dist/glassbox/index.js +312 -0
  21. package/dist/glassbox/index.mjs +12 -0
  22. package/dist/glassbox-routes/format.d.mts +24 -0
  23. package/dist/glassbox-routes/format.d.ts +24 -0
  24. package/dist/glassbox-routes/format.js +86 -0
  25. package/dist/glassbox-routes/format.mjs +18 -0
  26. package/dist/glassbox-routes/index.d.mts +191 -0
  27. package/dist/glassbox-routes/index.d.ts +191 -0
  28. package/dist/glassbox-routes/index.js +3197 -0
  29. package/dist/glassbox-routes/index.mjs +668 -0
  30. package/dist/glassbox-routes/react/index.d.mts +74 -0
  31. package/dist/glassbox-routes/react/index.d.ts +74 -0
  32. package/dist/glassbox-routes/react/index.js +819 -0
  33. package/dist/glassbox-routes/react/index.mjs +754 -0
  34. package/dist/index.d.mts +3782 -99
  35. package/dist/index.d.ts +3782 -99
  36. package/dist/index.js +10835 -2046
  37. package/dist/index.mjs +6270 -276
  38. package/dist/ir-CTx026t0.d.ts +1887 -0
  39. package/dist/ir-DeYMLWge.d.mts +1887 -0
  40. package/dist/key-health.d.mts +166 -0
  41. package/dist/key-health.d.ts +166 -0
  42. package/dist/key-health.js +247 -0
  43. package/dist/key-health.mjs +12 -0
  44. package/dist/profiles.d.mts +352 -2
  45. package/dist/profiles.d.ts +352 -2
  46. package/dist/profiles.js +1282 -51
  47. package/dist/profiles.mjs +19 -1
  48. package/dist/types-BKbRtmUb.d.ts +131 -0
  49. package/dist/types-Cp9ot1HV.d.ts +142 -0
  50. package/dist/types-DD36cCbZ.d.mts +142 -0
  51. package/dist/types-cBzinzUR.d.mts +131 -0
  52. package/package.json +62 -9
  53. package/dist/chunk-3KVKELZN.mjs +0 -657
  54. package/dist/profiles-BYVOc1eW.d.ts +0 -700
  55. package/dist/profiles-NUZOIzGr.d.mts +0 -700
package/dist/profiles.js CHANGED
@@ -21,12 +21,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var profiles_exports = {};
22
22
  __export(profiles_exports, {
23
23
  ALIASES: () => ALIASES,
24
+ LATENCY_TIER_MS: () => LATENCY_TIER_MS,
25
+ _setProfileBrainHook: () => _setProfileBrainHook,
26
+ _testClearConsumerProfiles: () => _testClearConsumerProfiles,
24
27
  allProfiles: () => allProfiles,
28
+ allProfilesRaw: () => allProfilesRaw,
29
+ bestEffortProfile: () => bestEffortProfile,
25
30
  getProfile: () => getProfile,
31
+ inferProviderFromId: () => inferProviderFromId,
32
+ latencyTierOf: () => latencyTierOf,
26
33
  profilesByProvider: () => profilesByProvider,
34
+ registerProfiles: () => registerProfiles,
35
+ resolveModelAlias: () => resolveModelAlias,
27
36
  tryGetProfile: () => tryGetProfile
28
37
  });
29
38
  module.exports = __toCommonJS(profiles_exports);
39
+ var LATENCY_TIER_MS = {
40
+ fast: 4e3,
41
+ medium: 11e3,
42
+ slow: 24e3
43
+ };
44
+ function latencyTierOf(profile) {
45
+ if (profile.latencyTier) return profile.latencyTier;
46
+ if (profile.weaknesses.includes("latency")) return "slow";
47
+ if (profile.strengths.includes("speed")) return "fast";
48
+ return "medium";
49
+ }
30
50
  var ANTHROPIC_LOWERING_BASE = {
31
51
  system: { mode: "inline" },
32
52
  cache: {
@@ -50,8 +70,139 @@ var GOOGLE_LOWERING_BASE = {
50
70
  var PROFILES_RAW = [
51
71
  // ── Anthropic ──
52
72
  {
53
- id: "claude-opus-4-7",
54
- verifiedAgainstDocs: "2026-05-08",
73
+ // VERIFIED 2026-06-21 against the claude-api reference. Claude Fable 5 is
74
+ // Anthropic's most capable model — a NEW tier ABOVE the opus/sonnet/haiku
75
+ // line (the id has no MAJOR-MINOR version, just `-5`) at 2× Opus pricing
76
+ // ($10/$50 vs $5/$25). Hand-authored, not cloned: the onboarder regex can't
77
+ // match this shape (new family + single-segment version), AND a clone would
78
+ // carry the wrong (opus) pricing. status:'preview' — no brain evidence yet;
79
+ // it earns per-archetype placement through the machinery like any model, and
80
+ // at 2× Opus the quality-floor + cost gates do real work before it leads.
81
+ // API quirk (claude-api ref): an explicit `thinking:{type:"disabled"}` 400s
82
+ // on Fable 5 (omit instead) — MOOT here: ANTHROPIC_LOWERING_BASE carries no
83
+ // `thinking` field, so kgauto never sends the param. (L-049/L-081.)
84
+ id: "claude-fable-5",
85
+ verifiedAgainstDocs: "2026-06-21",
86
+ provider: "anthropic",
87
+ status: "current",
88
+ // s76 2026-07-25: GA since 2026-06-09 per docs; was preview.
89
+ maxContextTokens: 1e6,
90
+ maxOutputTokens: 128e3,
91
+ maxTools: 64,
92
+ parallelToolCalls: true,
93
+ structuredOutput: "grammar",
94
+ systemPromptMode: "inline",
95
+ streaming: true,
96
+ cliffs: [],
97
+ costInputPer1m: 10,
98
+ costOutputPer1m: 50,
99
+ lowering: ANTHROPIC_LOWERING_BASE,
100
+ recovery: [
101
+ {
102
+ signal: "rate_limit",
103
+ action: "escalate",
104
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
105
+ },
106
+ {
107
+ signal: "model_not_found",
108
+ action: "escalate",
109
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
110
+ }
111
+ ],
112
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
113
+ weaknesses: ["cost", "latency"],
114
+ notes: "Most capable Anthropic model (2026-06); a new tier ABOVE Opus at 2\xD7 pricing ($10/$50). 1M ctx, 128k out. Verified 2026-06-21 against the claude-api reference. status:preview \u2014 no brain evidence yet; earns placement via the machinery (cost + quality-floor gates govern). latencyTier derives `slow` (weaknesses includes latency \u2014 minutes-long turns on hard tasks). The thinking-disabled-400 API quirk is moot for kgauto (Anthropic lowering emits no thinking param).",
115
+ // archetypePerf cloned from claude-opus-4-8 as a conservative estimate
116
+ // (Fable >= Opus in capability, but unmeasured — no fabricated superiority).
117
+ // Re-rank once brain rows exist.
118
+ archetypePerf: {
119
+ critique: 10,
120
+ plan: 10,
121
+ generate: 9,
122
+ ask: 9,
123
+ extract: 9,
124
+ transform: 9,
125
+ hunt: 8,
126
+ summarize: 8,
127
+ classify: 8
128
+ }
129
+ },
130
+ {
131
+ // Auto-onboarded 2026-06-04 from `claude-opus-4-7`; VERIFIED 2026-06-21
132
+ // against the claude-api reference. Opus 4.8 shares 4.7's surface exactly —
133
+ // 1M ctx, 128k out, $5/$25, no new breaking changes — so the clone's
134
+ // capability data was accurate (confirmed field-by-field). archetypePerf is
135
+ // still cloned from 4.7 (a sound estimate: 4.8 >= 4.7) — re-rank once brain
136
+ // rows exist. Promoted to status:'current' 2026-06-21 (Sacha: "include Claude
137
+ // Opus 4.8") — now live-selectable. Ties with the still-current claude-opus-4-7
138
+ // (identical $5/$25 + cloned perf) resolve to 4-8 by array order. (L-049/L-081.)
139
+ id: "claude-opus-4-8",
140
+ verifiedAgainstDocs: "2026-06-21",
141
+ provider: "anthropic",
142
+ status: "legacy",
143
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 generation is current).
144
+ maxContextTokens: 1e6,
145
+ maxOutputTokens: 128e3,
146
+ maxTools: 64,
147
+ parallelToolCalls: true,
148
+ structuredOutput: "grammar",
149
+ systemPromptMode: "inline",
150
+ streaming: true,
151
+ cliffs: [],
152
+ costInputPer1m: 5,
153
+ costOutputPer1m: 25,
154
+ lowering: ANTHROPIC_LOWERING_BASE,
155
+ recovery: [
156
+ {
157
+ signal: "rate_limit",
158
+ action: "escalate",
159
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
160
+ },
161
+ {
162
+ signal: "model_not_found",
163
+ action: "escalate",
164
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
165
+ }
166
+ ],
167
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
168
+ weaknesses: ["cost", "latency"],
169
+ notes: "Frontier Opus (2026-06), the current recommended Opus-tier default. Verified 2026-06-21 against the claude-api reference: 1M ctx, 128k out, $5/$25 \u2014 identical surface to 4.7, no new breaking changes. Promoted to status:current 2026-06-21 (live-selectable); coexists with claude-opus-4-7 (still current).",
170
+ // Cloned archetypePerf from claude-opus-4-7 — re-evaluate once brain rows exist.
171
+ archetypePerf: {
172
+ critique: 10,
173
+ plan: 10,
174
+ generate: 9,
175
+ ask: 9,
176
+ extract: 9,
177
+ transform: 9,
178
+ hunt: 8,
179
+ summarize: 8,
180
+ classify: 8
181
+ }
182
+ },
183
+ {
184
+ // ── Claude Opus 5 — added s76 (2026-07-25, alpha.72) ──────────────────
185
+ // The model every seat in the portfolio actually runs, absent from the
186
+ // roster until now. Found by a catalog QA, not by the release watcher:
187
+ // the watcher detects unknown IDs on a provider's /models endpoint, but
188
+ // detection was never wired to ingestion, so the gap sat open. (That is
189
+ // what `scripts/catalog-sync.mjs` exists to close.)
190
+ //
191
+ // PROVENANCE — doc-verified 2026-07-25 against
192
+ // platform.claude.com/docs/en/docs/about-claude/models/overview:
193
+ // 1M context · 128k max output · $5/$25 per MTok · adaptive thinking YES
194
+ // · extended thinking NO · `effort` defaults to 'high' on the Claude API
195
+ // · reliable knowledge cutoff May 2026.
196
+ //
197
+ // FAMILY-INHERITED (not doc-read): maxTools, parallelToolCalls,
198
+ // structuredOutput, systemPromptMode, streaming. These are identical
199
+ // across opus-4-6 / 4-7 / 4-8 / sonnet-5 / fable-5 — five consecutive
200
+ // models — so they are a structural provider constant rather than a
201
+ // per-model value. Deliberately distinguished from the gemini-3.1-flash-lite
202
+ // failure, where a template-clone of PRICE (the field that actually varies,
203
+ // there by 2.5-3.75x) went unverified for 65 days.
204
+ id: "claude-opus-5",
205
+ verifiedAgainstDocs: "2026-07-25",
55
206
  provider: "anthropic",
56
207
  status: "current",
57
208
  maxContextTokens: 1e6,
@@ -79,6 +230,53 @@ var PROFILES_RAW = [
79
230
  ],
80
231
  strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
81
232
  weaknesses: ["cost", "latency"],
233
+ notes: "Anthropic frontier for complex agentic coding + enterprise work; the Opus-tier current default as of 2026-07-25, superseding 4.8/4.7/4.6 (all now legacy). Doc-verified 2026-07-25: 1M ctx, 128k out, $5/$25, adaptive thinking (extended thinking NOT supported \u2014 that is Haiku 4.5 only in this generation), `effort` defaults to high on the Claude API. Price is unchanged from 4.5 through 5 \u2014 the tier moved without a cost change.",
234
+ // COLD-START PRIOR cloned from claude-opus-4-8. Self-labelling: below
235
+ // MEASURED_GROUNDING_MIN_N (10) brain rows these resolve as
236
+ // grounding:'judgment', so nothing reads them as measured until they are.
237
+ archetypePerf: {
238
+ critique: 10,
239
+ plan: 10,
240
+ generate: 9,
241
+ ask: 9,
242
+ extract: 9,
243
+ transform: 9,
244
+ hunt: 8,
245
+ summarize: 8,
246
+ classify: 8
247
+ }
248
+ },
249
+ {
250
+ id: "claude-opus-4-7",
251
+ verifiedAgainstDocs: "2026-08-14",
252
+ provider: "anthropic",
253
+ status: "legacy",
254
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 is current). Bundle said current while the brain already said legacy — the two disagreed.
255
+ maxContextTokens: 1e6,
256
+ maxOutputTokens: 128e3,
257
+ maxTools: 64,
258
+ parallelToolCalls: true,
259
+ structuredOutput: "grammar",
260
+ systemPromptMode: "inline",
261
+ streaming: true,
262
+ cliffs: [],
263
+ costInputPer1m: 5,
264
+ costOutputPer1m: 25,
265
+ lowering: ANTHROPIC_LOWERING_BASE,
266
+ recovery: [
267
+ {
268
+ signal: "rate_limit",
269
+ action: "escalate",
270
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
271
+ },
272
+ {
273
+ signal: "model_not_found",
274
+ action: "escalate",
275
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
276
+ }
277
+ ],
278
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
279
+ weaknesses: ["cost", "latency"],
82
280
  notes: "Frontier (2026-05). Step-change improvement over 4.6 in agentic coding. Adaptive thinking only \u2014 no extended-thinking toggle. 1M context, 128k max output.",
83
281
  // Frontier perf. Drops on archetypes where parallel-tool throughput
84
282
  // (hunt) or low-budget cost-sensitivity (classify/summarize) matters
@@ -100,7 +298,7 @@ var PROFILES_RAW = [
100
298
  },
101
299
  {
102
300
  id: "claude-opus-4-6",
103
- verifiedAgainstDocs: "2026-05-08",
301
+ verifiedAgainstDocs: "2026-08-14",
104
302
  provider: "anthropic",
105
303
  status: "legacy",
106
304
  maxContextTokens: 1e6,
@@ -145,9 +343,10 @@ var PROFILES_RAW = [
145
343
  },
146
344
  {
147
345
  id: "claude-sonnet-4-6",
148
- verifiedAgainstDocs: "2026-05-08",
346
+ verifiedAgainstDocs: "2026-08-14",
149
347
  provider: "anthropic",
150
- status: "current",
348
+ status: "legacy",
349
+ // s76 2026-07-25: docs list as LEGACY (Sonnet 5 is current).
151
350
  maxContextTokens: 1e6,
152
351
  maxOutputTokens: 64e3,
153
352
  maxTools: 64,
@@ -185,7 +384,7 @@ var PROFILES_RAW = [
185
384
  },
186
385
  {
187
386
  id: "claude-haiku-4-5",
188
- verifiedAgainstDocs: "2026-05-08",
387
+ verifiedAgainstDocs: "2026-08-14",
189
388
  provider: "anthropic",
190
389
  status: "current",
191
390
  maxContextTokens: 2e5,
@@ -201,6 +400,22 @@ var PROFILES_RAW = [
201
400
  threshold: 16,
202
401
  action: "drop_to_top_relevant",
203
402
  reason: "Haiku reliability degrades above ~16 tools"
403
+ },
404
+ {
405
+ // alpha.78 — the declared `structuredOutput: 'grammar'` does NOT
406
+ // hold on long-input summarize. MEASURED (brain, playbacksam):
407
+ // 21 disambiguated `structured_output_parse_failed` fallover rows
408
+ // 2026-07-22..27, tokens_in 12,280–31,450; PB's gate counted 20/20
409
+ // in-window failures. Clean traffic p50 sits at ~9K tokens_in, so
410
+ // 12K gates the failing band without touching the working one.
411
+ // Short-input summarize carries no failure evidence and stays
412
+ // ungated — this is why it's a cliff, not an archetype-wide
413
+ // `structuredOutputHint: 'avoid'`.
414
+ metric: "input_tokens",
415
+ threshold: 12e3,
416
+ action: "quality_gate_structured",
417
+ whenIntent: "summarize",
418
+ reason: "Structured-output parse failures at 100% in-window on long-input summarize (measured on playbacksam, 2026-07-25..27; haiku only led when input size made price dominate, then failed every time)."
204
419
  }
205
420
  ],
206
421
  costInputPer1m: 1,
@@ -232,7 +447,7 @@ var PROFILES_RAW = [
232
447
  // ── Google ──
233
448
  {
234
449
  id: "gemini-2.5-flash",
235
- verifiedAgainstDocs: "2026-05-08",
450
+ verifiedAgainstDocs: "2026-08-14",
236
451
  provider: "google",
237
452
  status: "current",
238
453
  maxContextTokens: 1048576,
@@ -338,7 +553,7 @@ var PROFILES_RAW = [
338
553
  // thresholds. The brain will validate/relax these as evidence accumulates
339
554
  // per (archetype, model) tuple. Currently ZERO brain rows for this model.
340
555
  id: "gemini-2.5-flash-lite",
341
- verifiedAgainstDocs: "2026-05-13",
556
+ verifiedAgainstDocs: "2026-08-14",
342
557
  provider: "google",
343
558
  status: "current",
344
559
  maxContextTokens: 1048576,
@@ -433,9 +648,21 @@ var PROFILES_RAW = [
433
648
  },
434
649
  {
435
650
  id: "gemini-2.5-pro",
436
- verifiedAgainstDocs: "2026-05-08",
651
+ verifiedAgainstDocs: "2026-08-08",
437
652
  provider: "google",
438
- status: "current",
653
+ // alpha.86 — AVAILABILITY demotion, not a provider-lifecycle mirror.
654
+ // Google's docs still list 2.5-pro as Stable, but the serving layer
655
+ // disagrees per account cohort: tt-intel measured 4/4 refusals
656
+ // ("no longer available to new users", 2026-08-02, their bench), and
657
+ // kgauto's own key 429s on a FreeTier per-day quota (probed
658
+ // 2026-08-08). A chain anchor that hard-fails for whole account
659
+ // cohorts is not an anchor; `legacy` removes it from cost-ordered
660
+ // chains and new selection while keeping the profile resolvable for
661
+ // consumers who pass it explicitly. Re-promotion is one status flip
662
+ // if Google restores availability. The registry cannot yet express
663
+ // account-cohort availability as data — see interfaces/kgauto.md
664
+ // ## Requested 2026-08-02.
665
+ status: "legacy",
439
666
  maxContextTokens: 1048576,
440
667
  maxOutputTokens: 65535,
441
668
  maxTools: 128,
@@ -465,7 +692,7 @@ var PROFILES_RAW = [
465
692
  }
466
693
  ],
467
694
  strengths: ["reasoning", "1m_context", "structured_output", "tool_use"],
468
- weaknesses: ["pricing_above_200k"],
695
+ weaknesses: ["pricing_above_200k", "availability_restricted_by_account_cohort"],
469
696
  // Master plan §3.3 anchor: tier-2 cross-provider in almost every chain.
470
697
  // Sits on the frontier at perf-9 — close to Sonnet but cheaper input.
471
698
  archetypePerf: {
@@ -483,7 +710,7 @@ var PROFILES_RAW = [
483
710
  },
484
711
  {
485
712
  id: "gemini-3.1-pro-preview",
486
- verifiedAgainstDocs: "2026-05-08",
713
+ verifiedAgainstDocs: "2026-08-14",
487
714
  provider: "google",
488
715
  status: "preview",
489
716
  maxContextTokens: 1048576,
@@ -543,7 +770,7 @@ var PROFILES_RAW = [
543
770
  // deepseek-reasoner registered as aliases (see ALIASES below).
544
771
  {
545
772
  id: "deepseek-v4-flash",
546
- verifiedAgainstDocs: "2026-05-08",
773
+ verifiedAgainstDocs: "2026-08-24",
547
774
  provider: "deepseek",
548
775
  status: "current",
549
776
  maxContextTokens: 1e6,
@@ -561,8 +788,8 @@ var PROFILES_RAW = [
561
788
  reason: "Sequential tool calls only \u2014 L-040"
562
789
  }
563
790
  ],
564
- costInputPer1m: 0.14,
565
- costOutputPer1m: 0.28,
791
+ costInputPer1m: 0.44,
792
+ costOutputPer1m: 1.32,
566
793
  lowering: {
567
794
  system: { mode: "inline" },
568
795
  cache: { strategy: "unsupported" },
@@ -573,7 +800,15 @@ var PROFILES_RAW = [
573
800
  ],
574
801
  strengths: ["cost", "1m_context", "json_output", "code", "reasoning"],
575
802
  weaknesses: ["parallel_tools", "large_tool_sets"],
576
- notes: "Cheap workhorse. 1M context, 384k max output. Cache-hit input $0.0028/M (1/50\xD7 of miss). Aliased as `deepseek-chat` (non-thinking) and `deepseek-reasoner` (thinking) \u2014 see ALIASES.",
803
+ // alpha.47 explicit slow override. Tag derivation would say 'medium'
804
+ // (no 'latency' weakness, no 'speed' strength), but the alpha.46 shadow
805
+ // probe MEASURED deepseek-v4-flash at 20485ms served (2026-06-03) — ~2.3×
806
+ // gemini-2.5-flash on PB's synchronous /api/analyze path. The 'flash' name
807
+ // is DeepSeek's, not a speed promise. This is the row that, scoring 0.85
808
+ // baseQuality (it carries 'reasoning') with no latency counterweight,
809
+ // leapfrogged gemini-2.5-flash as PB's summarize leader once reachable.
810
+ latencyTier: "slow",
811
+ notes: "Cheap workhorse. 1M context, 384k max output. Cache-hit input $0.0028/M (1/50\xD7 of miss). Aliased as `deepseek-chat` (non-thinking) and `deepseek-reasoner` (thinking) \u2014 see ALIASES. PEAK/OFF-PEAK since 2026-08-16 (page fetched 2026-08-24): peak = weekdays 01:00-04:00 + 06:00-10:00 UTC, off-peak = all other hours at HALF peak. Encoded prices ARE the peak rate (conservative: never understate cost); off-peak traffic costs half what the estimate says. alpha.87 was built + verified 2026-08-14 (prices then live), held at the publish gate 10 days, and published 2026-08-24 \u2014 by which time the 08-16 transition had killed them ($0.14/$0.28 flash, $0.435/$0.87 pro); corrected here (alpha.88). Build-then-hold is the mechanism: re-verify prices at publish when publish is not same-session as build. A single price field cannot represent a two-rate schedule; catalog-sync extractions oscillate between the rates day-to-day (peak read 08-21, off-peak read 08-22) \u2014 time-of-day pricing remains unmodeled, roadmap.",
577
812
  // Master plan §6.2 anchor. Brain-validated tier 1 cross-provider for
578
813
  // classify (169 rows, 0% empty). Tier 0 for summarize-with-no-tools.
579
814
  // Falls off on hunt (sequential tools — L-040) and reasoning depth.
@@ -590,11 +825,25 @@ var PROFILES_RAW = [
590
825
  critique: 4,
591
826
  hunt: 4
592
827
  // sequential tool calls only — L-040
593
- }
828
+ },
829
+ // alpha.43 — family-level conventions for the `deepseek-chat` family
830
+ // (V4-Flash + future non-thinking-mode members). V4-Flash struggles
831
+ // with summarize-archetype + structured-output: 3 of 4 schema-attempted
832
+ // PB calls (2026-05-18 + 2026-05-22) hit `structured_output_parse_failed`.
833
+ // Surface the friction at compile time so consumers either drop the
834
+ // schema or route to a more schema-reliable family.
835
+ archetypeConventions: [
836
+ {
837
+ archetype: "summarize",
838
+ structuredOutputHint: "avoid",
839
+ cliffWarning: "deepseek-chat family schema compliance on summarize is weak (3 of 4 schema-attempted PB calls hit structured_output_parse_failed). Consider routing summarize+structured-output to a different family (claude-sonnet, gemini-pro, openai-gpt-5.4) or dropping the schema for free-text summaries.",
840
+ reason: "Brain evidence: PB compile_outcomes 2026-05-18 + 2026-05-22, error_type=structured_output_parse_failed on deepseek-v4-flash + summarize archetype."
841
+ }
842
+ ]
594
843
  },
595
844
  {
596
845
  id: "deepseek-v4-pro",
597
- verifiedAgainstDocs: "2026-05-08",
846
+ verifiedAgainstDocs: "2026-08-24",
598
847
  provider: "deepseek",
599
848
  status: "current",
600
849
  maxContextTokens: 1e6,
@@ -612,10 +861,14 @@ var PROFILES_RAW = [
612
861
  reason: "Sequential tool calls only \u2014 L-040"
613
862
  }
614
863
  ],
615
- // Profile carries REGULAR pricing, not the 75%-off promo (ends 2026-05-31).
616
- // Under-estimating cost is worse than over-estimating for budget caps.
617
- costInputPer1m: 1.74,
618
- costOutputPer1m: 3.48,
864
+ // Verified against the live DeepSeek pricing page 2026-06-22: the 75%-off
865
+ // launch "promo" ($0.435/$0.87) did NOT revert on 2026-05-31 it became the
866
+ // standing price (docs show $0.435 in / $0.87 out cache-miss, $0.003625
867
+ // cache-hit in; no promo caveat). The old $1.74/$3.48 "regular post-promo"
868
+ // was a projected revert that never happened (L-073/L-081) — it 4×-overstated
869
+ // cost and suppressed V4-Pro in cost-aware ranking.
870
+ costInputPer1m: 1.32,
871
+ costOutputPer1m: 3.96,
619
872
  lowering: {
620
873
  system: { mode: "inline" },
621
874
  cache: { strategy: "unsupported" },
@@ -626,7 +879,12 @@ var PROFILES_RAW = [
626
879
  ],
627
880
  strengths: ["quality", "reasoning", "1m_context", "json_output", "code", "extended_thinking"],
628
881
  weaknesses: ["parallel_tools", "large_tool_sets"],
629
- notes: "Pro tier. 1M context, 384k max output. Regular pricing $1.74/$3.48; 75% promo through 2026-05-31 ($0.435/$0.87). Default mode = thinking.",
882
+ // alpha.47 explicit slow override. Measured 47722ms on the alpha.46
883
+ // shadow probe (2026-06-03) — it's an extended-thinking reasoner, slowest
884
+ // of the served set. Tag derivation would say 'medium'; the measurement says
885
+ // otherwise.
886
+ latencyTier: "slow",
887
+ notes: "Pro tier. 1M context, 384k max output. $0.435/$0.87 per 1M (cache-hit in $0.003625) \u2014 verified live 2026-06-22; the launch promo became the standing price (no revert). Default mode = thinking. PEAK/OFF-PEAK since 2026-08-16 (page fetched 2026-08-24): peak = weekdays 01:00-04:00 + 06:00-10:00 UTC, off-peak = all other hours at HALF peak. Encoded prices ARE the peak rate (conservative: never understate cost); off-peak traffic costs half what the estimate says. alpha.87 was built + verified 2026-08-14 (prices then live), held at the publish gate 10 days, and published 2026-08-24 \u2014 by which time the 08-16 transition had killed them ($0.14/$0.28 flash, $0.435/$0.87 pro); corrected here (alpha.88). Build-then-hold is the mechanism: re-verify prices at publish when publish is not same-session as build. A single price field cannot represent a two-rate schedule; catalog-sync extractions oscillate between the rates day-to-day (peak read 08-21, off-peak read 08-22) \u2014 time-of-day pricing remains unmodeled, roadmap.",
630
888
  // Master plan §3.3: tier 3 cross-provider for plan chain. Reasoning
631
889
  // bumped one notch over V4-Flash; same parallel-tool ceiling.
632
890
  archetypePerf: {
@@ -641,35 +899,999 @@ var PROFILES_RAW = [
641
899
  transform: 6,
642
900
  hunt: 4
643
901
  // sequential tools — same as V4-Flash
902
+ },
903
+ // alpha.43 — family-level conventions for the `deepseek-reasoner` family
904
+ // (V4-Pro is the family rep; future thinking-mode members inherit).
905
+ //
906
+ // The decisive-archetype suffix is the load-bearing piece: 2026-05-28
907
+ // first real V4-Pro probe on tt-intel/classify (exclusion-finding ID 20)
908
+ // showed 8/10 judge rationales citing "candidate hedges and fails to
909
+ // commit to a single classification" or "candidate refuses to pick
910
+ // among the labels." Without the forcing-function suffix, every
911
+ // reasoner probe on classify/extract/ask verdicts stay-excluded for
912
+ // model-behavior reasons (epistemic humility is reasoner-shaped),
913
+ // NOT quality reasons. The suffix re-shapes the contract so the model
914
+ // is asked for what it's actually being measured on.
915
+ //
916
+ // The hunt-archetype cliffWarning is the L-040 architectural reading
917
+ // surfaced at compile time. Reasoners produce sequential reasoning
918
+ // chains by design; hunt archetypes with 3+ parallel tools lose
919
+ // substantial throughput (L-040 + L-041). The L-040 cliff in the
920
+ // `cliffs` array already trims to top-relevant tools; this warning
921
+ // tells the consumer the family is wrong for the shape so they can
922
+ // route to gemini-flash (parallel-strong) instead of accepting trimmed
923
+ // throughput silently.
924
+ archetypeConventions: [
925
+ {
926
+ archetype: "classify",
927
+ promptSuffix: "\n\nOutput exactly one classification label. Do not hedge, do not add preamble, do not explain your reasoning. If uncertain, pick the most likely label and commit to it.",
928
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: 2026-05-28 V4-Pro probe on tt-intel/classify (exclusion-finding ID 20, brain probe_outcomes); 8 of 10 judge rationales cited hedging or refusal-to-commit. Forcing-function suffix converts reasoner output to decisive labels."
929
+ },
930
+ {
931
+ archetype: "extract",
932
+ promptSuffix: "\n\nOutput exactly the requested structured fields. Do not hedge, do not add preamble, do not explain your reasoning. If a field is unknown, emit the field with a null/empty value and commit to that \u2014 do not refuse to extract.",
933
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: same family failure shape as classify (exclusion-finding ID 20, 2026-05-28). Forcing-function suffix asks for commitment instead of epistemic-humility hedging."
934
+ },
935
+ {
936
+ archetype: "ask",
937
+ promptSuffix: "\n\nAnswer the question directly. Do not hedge, do not add preamble, do not explain your reasoning unless explicitly asked. If uncertain, give your best answer and commit to it.",
938
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: same family failure shape as classify (exclusion-finding ID 20, 2026-05-28). Forcing-function suffix asks for commitment instead of epistemic-humility hedging."
939
+ },
940
+ {
941
+ archetype: "hunt",
942
+ whenToolCountAtLeast: 3,
943
+ cliffWarning: "Reasoners (deepseek-reasoner family) produce sequential reasoning chains by design; hunt archetypes with 3+ parallel tools lose substantial throughput. Consider gemini-flash family (parallel-strong) instead \u2014 see L-040 / L-041.",
944
+ reason: "L-040 + L-041 architectural reading; 2026-05-28 V4-Pro probe evidence (exclusion-finding ID 20) confirms reasoner-family hunt fit is structurally weak."
945
+ }
946
+ ]
947
+ },
948
+ // ── OpenAI ──
949
+ // alpha.16 (2026-05-17): close the half-supported provider gap. env.ts
950
+ // already registered OPENAI_API_KEY + executeOpenAI + normalizeOpenAILike
951
+ // + lowerOpenAI all existed; profile entries were missing, so the
952
+ // alpha.10 auto-filter would mark openai-keyed models reachable but
953
+ // there were no profiles to filter IN. Half-supported is now fully
954
+ // supported. PB request `openai-provider-profiles` (2026-05-16).
955
+ //
956
+ // Profile data verified against developers.openai.com/api/docs/pricing
957
+ // + per-model pages 2026-05-17. L-049/L-081 step-zero: no AI-trained
958
+ // numbers — fetched live from OpenAI's docs. As of 2026-05, OpenAI's
959
+ // current flagship is gpt-5.5 (2025-12 cutoff); gpt-5.4-{base,mini,nano}
960
+ // are the workhorse family. gpt-4.1 + gpt-4o are legacy.
961
+ //
962
+ // Both 5.5 and 5.4 carry a 272K input-token pricing cliff (2x input,
963
+ // 1.5x output beyond that). Modeled as a `downgrade_quality_warning`
964
+ // cliff because it ranks the model down at large-context shapes — the
965
+ // semantics of "this model is now 2x more expensive" map onto the
966
+ // existing penalty mechanism. Cost-watcher will catch high-context
967
+ // spikes empirically; the cliff prevents naive routing into the doubled
968
+ // pricing zone.
969
+ {
970
+ id: "gpt-5.5",
971
+ verifiedAgainstDocs: "2026-05-17",
972
+ provider: "openai",
973
+ status: "current",
974
+ maxContextTokens: 105e4,
975
+ maxOutputTokens: 128e3,
976
+ maxTools: 64,
977
+ parallelToolCalls: true,
978
+ structuredOutput: "native",
979
+ systemPromptMode: "inline",
980
+ streaming: true,
981
+ cliffs: [
982
+ {
983
+ metric: "input_tokens",
984
+ threshold: 272e3,
985
+ action: "downgrade_quality_warning",
986
+ reason: "OpenAI pricing tier shift: >272K input tokens billed at 2x input + 1.5x output rates"
987
+ }
988
+ ],
989
+ costInputPer1m: 5,
990
+ costOutputPer1m: 30,
991
+ lowering: {
992
+ system: { mode: "inline" },
993
+ // OpenAI caching is implicit (auto-applied to repeated prefixes
994
+ // ≥1024 tokens for prompt_tokens_details.cached_tokens). No
995
+ // wire-format marker. Discount: 10x for cached input ($0.50/$5.00).
996
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
997
+ tools: { format: "openai" }
998
+ },
999
+ recovery: [
1000
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1001
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1002
+ ],
1003
+ strengths: ["reasoning", "agentic_coding", "long_context", "structured_output", "reliable_tool_use", "reasoning_effort_knob"],
1004
+ weaknesses: ["cost", "pricing_cliff_at_272k"],
1005
+ notes: "OpenAI frontier (2026-05). 1M context (1.05M total), 128K max output, 2025-12 cutoff. Reasoning effort knob (none/low/medium/high/xhigh). Pricing cliff at 272K input.",
1006
+ // Frontier-tier perf hypothesis. Anchored to Opus 4.7 row (similar
1007
+ // price/positioning). Brain evidence will refine; no telemetry yet.
1008
+ archetypePerf: {
1009
+ critique: 9,
1010
+ plan: 9,
1011
+ generate: 9,
1012
+ ask: 9,
1013
+ extract: 9,
1014
+ transform: 9,
1015
+ hunt: 8,
1016
+ // parallel tool support good but cliff at 272K hurts deep multi-step
1017
+ summarize: 7,
1018
+ // overkill for tolerant archetype
1019
+ classify: 7
1020
+ // overkill; cheaper models cover this
644
1021
  }
645
- }
646
- ];
647
- var ALIASES = {
648
- // DeepSeek's own model routing — both names served by V4-Flash.
649
- "deepseek-chat": "deepseek-v4-flash",
650
- "deepseek-reasoner": "deepseek-v4-flash",
651
- // Legacy kgauto typo — actual API alias is dash-form (alpha.1 had dot).
652
- "claude-haiku-4.5": "claude-haiku-4-5"
653
- };
654
- function canonicalId(id) {
655
- return ALIASES[id] ?? id;
656
- }
657
- var PROFILE_INDEX = new Map(
658
- PROFILES_RAW.map((p) => [p.id, p])
659
- );
660
- function getProfile(id) {
661
- const canonical = canonicalId(id);
662
- const p = PROFILE_INDEX.get(canonical);
663
- if (!p) {
664
- const known = [...PROFILE_INDEX.keys(), ...Object.keys(ALIASES)].join(", ");
665
- throw new Error(`Unknown model id: "${id}". Known: ${known}`);
666
- }
667
- return p;
668
- }
669
- function tryGetProfile(id) {
670
- return PROFILE_INDEX.get(canonicalId(id));
671
- }
672
- function allProfiles() {
1022
+ },
1023
+ {
1024
+ id: "gpt-5.4",
1025
+ verifiedAgainstDocs: "2026-05-17",
1026
+ provider: "openai",
1027
+ status: "current",
1028
+ maxContextTokens: 105e4,
1029
+ maxOutputTokens: 128e3,
1030
+ maxTools: 64,
1031
+ parallelToolCalls: true,
1032
+ structuredOutput: "native",
1033
+ systemPromptMode: "inline",
1034
+ streaming: true,
1035
+ cliffs: [
1036
+ {
1037
+ metric: "input_tokens",
1038
+ threshold: 272e3,
1039
+ action: "downgrade_quality_warning",
1040
+ reason: "OpenAI pricing tier shift: >272K input tokens billed at 2x input + 1.5x output rates"
1041
+ }
1042
+ ],
1043
+ costInputPer1m: 2.5,
1044
+ costOutputPer1m: 15,
1045
+ lowering: {
1046
+ system: { mode: "inline" },
1047
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
1048
+ tools: { format: "openai" }
1049
+ },
1050
+ recovery: [
1051
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1052
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1053
+ ],
1054
+ strengths: ["reasoning", "long_context", "structured_output", "reliable_tool_use"],
1055
+ weaknesses: ["pricing_cliff_at_272k"],
1056
+ notes: "OpenAI workhorse (2026-05). 1M context (1.05M total), 128K max output, 2025-08 cutoff. Pricing cliff at 272K input. Pairs cleanly with Sonnet 4.6 on cost ($2.50/$15.00 vs $3.00/$15.00).",
1057
+ // Anchored to Sonnet 4.6 row (similar price/positioning). Slight
1058
+ // anthropic-side edge on agentic coding per master plan vibe.
1059
+ archetypePerf: {
1060
+ critique: 8,
1061
+ plan: 8,
1062
+ generate: 8,
1063
+ ask: 8,
1064
+ extract: 8,
1065
+ transform: 8,
1066
+ hunt: 7,
1067
+ summarize: 7,
1068
+ classify: 7
1069
+ }
1070
+ },
1071
+ {
1072
+ id: "gpt-5.4-mini",
1073
+ verifiedAgainstDocs: "2026-05-17",
1074
+ provider: "openai",
1075
+ status: "current",
1076
+ maxContextTokens: 4e5,
1077
+ maxOutputTokens: 128e3,
1078
+ maxTools: 64,
1079
+ parallelToolCalls: true,
1080
+ structuredOutput: "native",
1081
+ systemPromptMode: "inline",
1082
+ streaming: true,
1083
+ cliffs: [],
1084
+ costInputPer1m: 0.75,
1085
+ costOutputPer1m: 4.5,
1086
+ lowering: {
1087
+ system: { mode: "inline" },
1088
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
1089
+ tools: { format: "openai" }
1090
+ },
1091
+ recovery: [
1092
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1093
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1094
+ ],
1095
+ strengths: ["cost", "speed", "agentic_coding", "structured_output", "reliable_tool_use"],
1096
+ weaknesses: ["reasoning_depth"],
1097
+ notes: "OpenAI mini-tier (2026-05). 400K context, 128K max output, 2025-08 cutoff. OpenAI describes as 'strongest mini model for coding, computer use, subagents.' Cache discount 10x ($0.075 input).",
1098
+ // Mini-tier hypothesis. Anchored to Haiku 4.5 + Flash row pricing.
1099
+ // Cost is slightly higher than Haiku ($0.75 vs $0.50 input) but
1100
+ // OpenAI claims strong coding/subagent perf.
1101
+ archetypePerf: {
1102
+ ask: 7,
1103
+ generate: 7,
1104
+ extract: 7,
1105
+ transform: 7,
1106
+ classify: 7,
1107
+ summarize: 7,
1108
+ hunt: 7,
1109
+ plan: 6,
1110
+ critique: 5
1111
+ // reasoning depth gap — frontier models handle this
1112
+ }
1113
+ },
1114
+ {
1115
+ id: "gpt-5.4-nano",
1116
+ verifiedAgainstDocs: "2026-05-17",
1117
+ provider: "openai",
1118
+ status: "current",
1119
+ maxContextTokens: 4e5,
1120
+ maxOutputTokens: 128e3,
1121
+ maxTools: 64,
1122
+ parallelToolCalls: true,
1123
+ structuredOutput: "native",
1124
+ systemPromptMode: "inline",
1125
+ streaming: true,
1126
+ cliffs: [],
1127
+ costInputPer1m: 0.2,
1128
+ costOutputPer1m: 1.25,
1129
+ lowering: {
1130
+ system: { mode: "inline" },
1131
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
1132
+ tools: { format: "openai" }
1133
+ },
1134
+ recovery: [
1135
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1136
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1137
+ ],
1138
+ strengths: ["cost", "speed", "volume", "structured_output"],
1139
+ weaknesses: ["reasoning_depth", "no_computer_use"],
1140
+ notes: "OpenAI nano-tier (2026-05). 400K context, 128K max output, 2025-08 cutoff. 'Cheapest GPT-5.4-class for simple high-volume tasks.' No fine-tuning, no computer-use tools. Cache discount 10x.",
1141
+ // Nano-tier. Anchored to Flash-Lite row ($0.10/$0.40 vs nano's
1142
+ // $0.20/$1.25). Slightly more expensive than Flash-Lite but with
1143
+ // OpenAI brand reliability. Good fit for classify/summarize floor.
1144
+ archetypePerf: {
1145
+ classify: 7,
1146
+ summarize: 6,
1147
+ ask: 6,
1148
+ transform: 6,
1149
+ extract: 6,
1150
+ generate: 5,
1151
+ hunt: 5,
1152
+ plan: 4,
1153
+ critique: 3
1154
+ // not for reasoning archetypes
1155
+ }
1156
+ },
1157
+ // ── Auto-onboarded (UNVERIFIED) ──
1158
+ // Cloned by scripts/auto-onboard-models.mjs from a same-family template.
1159
+ // Each entry's pricing/context/cliffs/lowering reflects the template, NOT
1160
+ // provider docs. Verify before promoting status to 'current' (L-049/L-081).
1161
+ {
1162
+ // s37 (2026-05-21): UNVERIFIED-AUTO-ONBOARD → verified against
1163
+ // ai.google.dev/gemini-api/docs/models/gemini-3-flash-preview +
1164
+ // ai.google.dev/gemini-api/docs/pricing. L-081 catches:
1165
+ // maxOutputTokens 65_535 → 65_536 (off-by-one)
1166
+ // costInputPer1m 0.30 → 0.50 (template-cloned from 2.5-flash; actual is 1.67× more expensive)
1167
+ // costOutputPer1m 2.50 → 3.00 (template-cloned; actual 1.2× more expensive)
1168
+ // cache discount default 0.25 → 0.10 (10× discount, $0.05/$0.50 per docs)
1169
+ // Cliffs inherited from 2.5-flash conservatively. The 8K-context-quality
1170
+ // cliff was a 2.5-Flash observation — Google positions Gemini 3 as
1171
+ // sustained-frontier-on-long-context; brain evidence will validate/relax.
1172
+ // Kept as guard for now.
1173
+ id: "gemini-3-flash-preview",
1174
+ verifiedAgainstDocs: "2026-05-21",
1175
+ provider: "google",
1176
+ status: "preview",
1177
+ maxContextTokens: 1048576,
1178
+ maxOutputTokens: 65536,
1179
+ maxTools: 128,
1180
+ parallelToolCalls: true,
1181
+ structuredOutput: "native",
1182
+ systemPromptMode: "separate",
1183
+ streaming: true,
1184
+ cliffs: [
1185
+ {
1186
+ metric: "input_tokens",
1187
+ threshold: 8e3,
1188
+ action: "downgrade_quality_warning",
1189
+ reason: "Inherited from 2.5-flash guard; brain evidence on Gemini 3 long-context quality will validate/relax"
1190
+ },
1191
+ {
1192
+ metric: "tool_count",
1193
+ threshold: 20,
1194
+ action: "drop_to_top_relevant",
1195
+ reason: "Tool reliability drops above ~20 tools (despite 128 hard limit) \u2014 inherited from Flash family"
1196
+ },
1197
+ {
1198
+ metric: "thinking_with_short_output",
1199
+ threshold: 1,
1200
+ action: "force_thinking_budget_zero",
1201
+ reason: "Thinking tokens consume maxOutputTokens \u2014 empty response if drained"
1202
+ },
1203
+ {
1204
+ // Inherited from gemini-2.5-flash s11 trust artifact. Family-likely
1205
+ // failure mode for Flash architecture. Keep preemptively until brain
1206
+ // evidence on Gemini 3 specifically.
1207
+ metric: "tool_count",
1208
+ threshold: 1,
1209
+ whenIntent: "summarize",
1210
+ action: "strip_tools",
1211
+ reason: "Inherited from 2.5-flash s11 cliff: summarize+tools \u2192 empty response. Preemptive guard until brain evidence on 3-flash-preview specifically."
1212
+ }
1213
+ ],
1214
+ costInputPer1m: 0.5,
1215
+ costOutputPer1m: 3,
1216
+ lowering: {
1217
+ ...GOOGLE_LOWERING_BASE,
1218
+ // 10× cache discount per Google pricing: $0.05/M cached vs $0.50/M input.
1219
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1220
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1221
+ },
1222
+ recovery: [
1223
+ {
1224
+ signal: "empty_response_after_tool",
1225
+ action: "retry_with_params",
1226
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1227
+ maxRetries: 1,
1228
+ reason: "Known: empty after tool result \u2014 retry with thinking off"
1229
+ },
1230
+ {
1231
+ signal: "empty_response",
1232
+ action: "retry_with_params",
1233
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1234
+ maxRetries: 1,
1235
+ reason: "Empty response \u2014 try with thinking off"
1236
+ },
1237
+ {
1238
+ signal: "malformed_function_call",
1239
+ action: "escalate",
1240
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
1241
+ }
1242
+ ],
1243
+ strengths: ["speed", "volume", "classification", "1m_context", "cost"],
1244
+ weaknesses: ["complex_schemas", "large_tool_sets", "high_context_quality"],
1245
+ notes: "Verified s37 (2026-05-21) against Google docs. Step-change positioning vs 2.5-flash on agentic loops per Google's release notes (Dec 2025). Pricing 1.67\xD7/1.2\xD7 higher than 2.5-flash; cache discount 10\xD7 (vs 4\xD7 for 2.5). Status=preview until brain evidence accumulates.",
1246
+ // Anchored to 2.5-flash archetypePerf as starter, with judgment adjustments
1247
+ // for Google's "step-change on agentic" positioning. Brain evidence (zero
1248
+ // rows today) will replace these starter values.
1249
+ archetypePerf: {
1250
+ hunt: 9,
1251
+ // Inherits 2.5-flash L-040 parallel-tool tier; Google positions 3 as agentic-loop upgrade
1252
+ classify: 7,
1253
+ // Inherits 2.5-flash brain-validated tier (218 rows on 2.5)
1254
+ summarize: 7,
1255
+ // Inherits 2.5-flash; cliff strips tools when present
1256
+ transform: 7,
1257
+ ask: 8,
1258
+ // +1 vs 2.5-flash — sustained-frontier positioning
1259
+ generate: 7,
1260
+ // +1 vs 2.5-flash — agentic coding upgrade per Google
1261
+ plan: 6,
1262
+ // +1 vs 2.5-flash — complex iterations per positioning
1263
+ extract: 6,
1264
+ critique: 5
1265
+ // +1 vs 2.5-flash — but still below Sonnet/Opus reasoning floor
1266
+ }
1267
+ },
1268
+ {
1269
+ // ── Gemini 3.1 Flash-Lite ──
1270
+ // Onboarded 2026-05-16 by auto-onboarder; s37 (2026-05-21) verified
1271
+ // against ai.google.dev/gemini-api/docs/pricing.
1272
+ //
1273
+ // L-081 CATCHES (template clone from 2.5-flash-lite was 2.5-3.75× too cheap):
1274
+ // costInputPer1m 0.10 → 0.25 (template clone undervalued by 2.5×)
1275
+ // costOutputPer1m 0.40 → 1.50 (template clone undervalued by 3.75×)
1276
+ //
1277
+ // Real 3.1-flash-lite is NOT a cost-equivalent successor to 2.5-flash-lite —
1278
+ // it sits between 2.5-flash-lite ($0.10/$0.40) and 2.5-flash ($0.30/$2.50).
1279
+ // Cache discount 10× verified ($0.025/M cached vs $0.25/M input).
1280
+ //
1281
+ // Cliffs are HYPOTHESIZED from 2.5-flash family; brain evidence pending.
1282
+ id: "gemini-3.1-flash-lite",
1283
+ verifiedAgainstDocs: "2026-05-21",
1284
+ provider: "google",
1285
+ status: "preview",
1286
+ maxContextTokens: 1048576,
1287
+ maxOutputTokens: 65536,
1288
+ maxTools: 128,
1289
+ parallelToolCalls: true,
1290
+ structuredOutput: "native",
1291
+ systemPromptMode: "separate",
1292
+ streaming: true,
1293
+ cliffs: [
1294
+ {
1295
+ metric: "input_tokens",
1296
+ threshold: 8e3,
1297
+ action: "downgrade_quality_warning",
1298
+ reason: "Inherited from Flash: quality degrades above ~8K. Smaller model \u2014 likely degrades faster. Re-tune from brain after n\u226520."
1299
+ },
1300
+ {
1301
+ metric: "tool_count",
1302
+ threshold: 10,
1303
+ action: "drop_to_top_relevant",
1304
+ reason: "Conservative: Flash drops at 20, Flash-Lite is smaller \u2014 assume tighter ceiling until brain proves otherwise."
1305
+ },
1306
+ {
1307
+ metric: "thinking_with_short_output",
1308
+ threshold: 1,
1309
+ action: "force_thinking_budget_zero",
1310
+ reason: "Thinking enabled per Google API (thinking: true). Same drain risk as Flash \u2014 thinking tokens consume maxOutputTokens."
1311
+ },
1312
+ {
1313
+ // Strong prior: Flash hit 5/5 empty rate on summarize+tools (s11
1314
+ // trust artifact, kgauto commit 3872832). Flash-Lite shares the
1315
+ // same architectural family — almost certainly inherits this cliff.
1316
+ // Ship the guard preemptively; brain telemetry confirms or relaxes.
1317
+ metric: "tool_count",
1318
+ threshold: 1,
1319
+ whenIntent: "summarize",
1320
+ action: "strip_tools",
1321
+ reason: "Inherited from Flash s11 cliff: summarize+tools \u2192 empty response. Preemptive guard until brain evidence on Flash-Lite specifically."
1322
+ }
1323
+ ],
1324
+ costInputPer1m: 0.25,
1325
+ costOutputPer1m: 1.5,
1326
+ lowering: {
1327
+ ...GOOGLE_LOWERING_BASE,
1328
+ // Cache discount 10× (vs Flash 4×) — Google docs s37: $0.025/M cached vs
1329
+ // $0.25/M input. Material for repeat-prompt workloads (classify shape).
1330
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1331
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1332
+ },
1333
+ recovery: [
1334
+ {
1335
+ signal: "empty_response_after_tool",
1336
+ action: "retry_with_params",
1337
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1338
+ maxRetries: 1,
1339
+ reason: "Known on Flash family: empty after tool result \u2014 retry with thinking off."
1340
+ },
1341
+ {
1342
+ signal: "empty_response",
1343
+ action: "retry_with_params",
1344
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1345
+ maxRetries: 1,
1346
+ reason: "Empty response \u2014 try with thinking off."
1347
+ },
1348
+ {
1349
+ signal: "malformed_function_call",
1350
+ action: "escalate",
1351
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target."
1352
+ }
1353
+ ],
1354
+ strengths: ["low_cost", "speed", "volume", "classification", "summarize", "1m_context", "cache_friendly"],
1355
+ weaknesses: ["complex_reasoning", "large_tool_sets", "complex_schemas", "structured_output_unproven", "long_context_quality"],
1356
+ notes: "Verified s37 (2026-05-21) against Google docs. Sits between 2.5-flash-lite (cheaper) and 2.5-flash (more expensive) on cost frontier; 2.5\xD7 more expensive than initial template-clone. Cliffs hypothesized from Flash family \u2014 brain evidence pending.",
1357
+ // Tier 2-3 floor for summarize/classify chains at the new (verified) price
1358
+ // point. ZERO brain rows — values are starter hypotheses anchored to
1359
+ // "smaller sibling of Flash at higher cost than 2.5-flash-lite." The first
1360
+ // 50 brain rows per archetype will validate or relax these.
1361
+ archetypePerf: {
1362
+ classify: 6,
1363
+ // starter hypothesis — verify (Flash is 7, lite likely ≤)
1364
+ summarize: 6,
1365
+ // starter hypothesis — verify; cliff strips tools
1366
+ transform: 6,
1367
+ // starter hypothesis — verify
1368
+ ask: 5,
1369
+ hunt: 5,
1370
+ generate: 4,
1371
+ extract: 4,
1372
+ plan: 3,
1373
+ critique: 3
1374
+ }
1375
+ },
1376
+ // ─────────────────────────────────────────────────────────────────────────
1377
+ // Gemini 3.5 Flash — hand-onboarded s37 (2026-05-21)
1378
+ //
1379
+ // Google positioning ("Most intelligent for sustained frontier performance
1380
+ // on agentic and coding tasks" / "particularly effective for rapid agentic
1381
+ // loops involving complex coding cycles and iterations") suggests this is
1382
+ // the Flash-family upgrade specifically aimed at hunt-shape workloads.
1383
+ // Pricing 5× input / 3.6× output vs 2.5-flash — material cost premium.
1384
+ // archetypePerf adjusted +1 vs 2.5-flash on ask/generate/plan/critique
1385
+ // (sustained-frontier positioning); hunt held at 9 inherited from L-040
1386
+ // family parallel-tool tier; brain evidence will validate within 50 rows.
1387
+ //
1388
+ // Cliffs inherited conservatively from 2.5-flash. Google's "sustained
1389
+ // frontier on long-context" positioning suggests the 8K cliff may not
1390
+ // apply to 3.5 — keep as guard until brain evidence shows otherwise.
1391
+ //
1392
+ // Specs verified against:
1393
+ // ai.google.dev/gemini-api/docs/models/gemini-3.5-flash
1394
+ // ai.google.dev/gemini-api/docs/pricing (Standard tier)
1395
+ // ─────────────────────────────────────────────────────────────────────────
1396
+ {
1397
+ id: "gemini-3.5-flash",
1398
+ verifiedAgainstDocs: "2026-05-21",
1399
+ provider: "google",
1400
+ status: "current",
1401
+ maxContextTokens: 1048576,
1402
+ maxOutputTokens: 65536,
1403
+ maxTools: 128,
1404
+ parallelToolCalls: true,
1405
+ structuredOutput: "native",
1406
+ systemPromptMode: "separate",
1407
+ streaming: true,
1408
+ cliffs: [
1409
+ {
1410
+ metric: "input_tokens",
1411
+ threshold: 8e3,
1412
+ action: "downgrade_quality_warning",
1413
+ reason: "Inherited from 2.5-flash guard; Google positions 3.5 as sustained-frontier-on-long-context but brain evidence pending"
1414
+ },
1415
+ {
1416
+ metric: "tool_count",
1417
+ threshold: 20,
1418
+ action: "drop_to_top_relevant",
1419
+ reason: "Inherited from Flash family: tool reliability drops above ~20 (despite 128 hard limit). Validate per (archetype, model) after n\u226520."
1420
+ },
1421
+ {
1422
+ metric: "thinking_with_short_output",
1423
+ threshold: 1,
1424
+ action: "force_thinking_budget_zero",
1425
+ reason: "Thinking mode supported per Google docs; same drain risk as 2.5-flash \u2014 thinking tokens consume maxOutputTokens"
1426
+ },
1427
+ {
1428
+ // Inherited from 2.5-flash s11 trust artifact (5/5 empty rate on
1429
+ // tt-intelligence/summarize/gemini-2.5-flash with tools offered).
1430
+ // Family-likely failure mode for Flash architecture across versions.
1431
+ // Keep preemptively until brain evidence on 3.5-flash specifically.
1432
+ metric: "tool_count",
1433
+ threshold: 1,
1434
+ whenIntent: "summarize",
1435
+ action: "strip_tools",
1436
+ reason: "Inherited from 2.5-flash s11 cliff (kgauto commit 3872832): summarize+tools \u2192 empty response. Preemptive guard until brain evidence on 3.5-flash specifically."
1437
+ }
1438
+ ],
1439
+ costInputPer1m: 1.5,
1440
+ costOutputPer1m: 9,
1441
+ lowering: {
1442
+ ...GOOGLE_LOWERING_BASE,
1443
+ // 10× cache discount per Google pricing: $0.15/M cached vs $1.50/M input.
1444
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1445
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1446
+ },
1447
+ recovery: [
1448
+ {
1449
+ signal: "empty_response_after_tool",
1450
+ action: "retry_with_params",
1451
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1452
+ maxRetries: 1,
1453
+ reason: "Inherited Flash-family pattern: empty after tool result \u2014 retry with thinking off"
1454
+ },
1455
+ {
1456
+ signal: "empty_response",
1457
+ action: "retry_with_params",
1458
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1459
+ maxRetries: 1,
1460
+ reason: "Empty response \u2014 try with thinking off"
1461
+ },
1462
+ {
1463
+ signal: "malformed_function_call",
1464
+ action: "escalate",
1465
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
1466
+ }
1467
+ ],
1468
+ strengths: ["agentic_loops", "coding", "1m_context", "parallel_tools", "thinking_mode", "sustained_frontier"],
1469
+ weaknesses: ["cost_vs_2_5_flash", "no_brain_evidence_yet"],
1470
+ notes: "Hand-onboarded s37 (2026-05-21) verified against Google docs. Stable status; positioned as Flash-family upgrade for agentic loops and coding. 5\xD7/3.6\xD7 more expensive than 2.5-flash but Google claims step-change on sustained frontier work. archetypePerf adjustments are judgment-grounded starter hypotheses \u2014 brain evidence will validate within ~50 rows per archetype.",
1471
+ // Starter hypothesis: anchored to 2.5-flash archetypePerf with +1
1472
+ // adjustments where Google's positioning explicitly supports
1473
+ // (agentic/coding/sustained). Hunt held at 9 inherited from L-040 family
1474
+ // parallel-tool tier. Brain evidence will replace.
1475
+ archetypePerf: {
1476
+ hunt: 9,
1477
+ // Inherited from 2.5-flash L-040 parallel-tool tier; Google positions 3.5 as agentic-loop champion
1478
+ classify: 7,
1479
+ // Inherited from 2.5-flash brain-validated tier (218 rows on 2.5)
1480
+ summarize: 7,
1481
+ // Inherited from 2.5-flash; cliff strips tools when present
1482
+ transform: 7,
1483
+ ask: 8,
1484
+ // +1 vs 2.5-flash — sustained-frontier positioning
1485
+ generate: 8,
1486
+ // +1 vs 2.5-flash (6→8) — Google: "complex coding cycles and iterations"
1487
+ plan: 7,
1488
+ // +1 vs 2.5-flash (5→7) — "complex iterations" positioning
1489
+ extract: 7,
1490
+ // +1 vs 2.5-flash — sustained-frontier on structured tasks
1491
+ critique: 5
1492
+ // +1 vs 2.5-flash — but still below Sonnet/Opus reasoning floor
1493
+ }
1494
+ },
1495
+ // ─────────────────────────────────────────────────────────────────────────
1496
+ // gemini-3.6-flash — hand-onboarded s86 (2026-08-14), step-zero against
1497
+ // Google docs (models/gemini-3.6-flash page + pricing via catalog-sync's
1498
+ // two-agreeing-extraction the same day). Docs list it as Stable and call
1499
+ // it "previous-generation Flash" (3.5-flash is now "legacy" in Google's
1500
+ // wording) — but kgauto status is 'preview' per the standing entry rule:
1501
+ // a new model enters on capability data verified only at the docs level,
1502
+ // preview is unreachable by starter chains, and promotion to routing
1503
+ // happens through brain evidence, not through Google's marketing tier.
1504
+ // This also means NO family-primary retarget rides this release.
1505
+ // ─────────────────────────────────────────────────────────────────────────
1506
+ {
1507
+ id: "gemini-3.6-flash",
1508
+ verifiedAgainstDocs: "2026-08-24",
1509
+ versionAdded: "2.0.0-alpha.87",
1510
+ provider: "google",
1511
+ status: "preview",
1512
+ maxContextTokens: 1048576,
1513
+ maxOutputTokens: 65536,
1514
+ maxTools: 128,
1515
+ parallelToolCalls: true,
1516
+ structuredOutput: "native",
1517
+ systemPromptMode: "separate",
1518
+ streaming: true,
1519
+ cliffs: [
1520
+ {
1521
+ metric: "input_tokens",
1522
+ threshold: 8e3,
1523
+ action: "downgrade_quality_warning",
1524
+ reason: "Inherited Flash-family guard (2.5\u21923.5 lineage); no 3.6 brain evidence yet"
1525
+ },
1526
+ {
1527
+ metric: "tool_count",
1528
+ threshold: 20,
1529
+ action: "drop_to_top_relevant",
1530
+ reason: "Inherited from Flash family: tool reliability drops above ~20 (despite 128 hard limit). Validate per (archetype, model) after n\u226520."
1531
+ },
1532
+ {
1533
+ metric: "thinking_with_short_output",
1534
+ threshold: 1,
1535
+ action: "force_thinking_budget_zero",
1536
+ reason: "Thinking supported per Google docs; same drain risk as 2.5/3.5-flash \u2014 thinking tokens consume maxOutputTokens"
1537
+ },
1538
+ {
1539
+ metric: "tool_count",
1540
+ threshold: 1,
1541
+ whenIntent: "summarize",
1542
+ action: "strip_tools",
1543
+ reason: "Inherited from 2.5-flash s11 cliff: summarize+tools \u2192 empty response. Preemptive family guard until brain evidence on 3.6-flash specifically."
1544
+ }
1545
+ ],
1546
+ costInputPer1m: 0.75,
1547
+ // promo through 2026-12-31; $1.50 from 2027-01-01 (TIME_BOUNDED_PRICING_ROWS carries the transition)
1548
+ costOutputPer1m: 3.75,
1549
+ // promo through 2026-12-31; $7.50 from 2027-01-01
1550
+ lowering: {
1551
+ ...GOOGLE_LOWERING_BASE,
1552
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1553
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1554
+ },
1555
+ recovery: [
1556
+ {
1557
+ signal: "empty_response_after_tool",
1558
+ action: "retry_with_params",
1559
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1560
+ maxRetries: 1,
1561
+ reason: "Inherited Flash-family pattern: empty after tool result \u2014 retry with thinking off"
1562
+ },
1563
+ {
1564
+ signal: "empty_response",
1565
+ action: "retry_with_params",
1566
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1567
+ maxRetries: 1,
1568
+ reason: "Empty response \u2014 try with thinking off"
1569
+ },
1570
+ {
1571
+ signal: "malformed_function_call",
1572
+ action: "escalate",
1573
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
1574
+ }
1575
+ ],
1576
+ strengths: ["agentic_loops", "coding", "1m_context", "parallel_tools", "thinking_mode"],
1577
+ weaknesses: ["no_brain_evidence_yet"],
1578
+ notes: "Hand-onboarded s86 (2026-08-14), step-zero verified: 1,048,576 ctx / 65,536 out (Google model page). PRICING re-verified 2026-08-24 at publish: $0.75/$3.75 promo through 2026-12-31, $1.50/$7.50 from 2027-01-01 \u2014 the alpha.87 profile carried the post-promo rate as if current; corrected alpha.88. Docs status Stable; enters kgauto as preview per standing rule (availability != lifecycle, promotion via brain evidence). Function calling + structured outputs + thinking per docs; parallel tools assumed per Flash family (docs silent). First flagged by the release watcher s73 (2026-07-24); ~21 days in the onboarding queue (onboarded 2026-08-14).",
1579
+ archetypePerf: {
1580
+ hunt: 9,
1581
+ // Flash-family parallel-tool tier (L-040); inherited from 3.5-flash
1582
+ classify: 7,
1583
+ summarize: 7,
1584
+ transform: 7,
1585
+ ask: 8,
1586
+ generate: 8,
1587
+ plan: 7,
1588
+ extract: 7,
1589
+ critique: 5
1590
+ }
1591
+ },
1592
+ {
1593
+ // Auto-onboarded 2026-07-01 from `claude-sonnet-4-6`; VERIFIED 2026-07-02
1594
+ // against the claude-api reference (cc-portfolio ratification pass). The
1595
+ // clone got context right (1M). PRICING RE-BASED 2026-08-14 (s86): the
1596
+ // introductory $2/$10 was made PERMANENT — Anthropic's pricing page now
1597
+ // states the scheduled Sept-1 increase to $3/$15 "will not occur", so
1598
+ // $2/$10 IS the sticker. (The $3/$15 encoded 07-02 was correct under the
1599
+ // time-bounded-pricing convention at the time; the bound was cancelled.) The clone got max output WRONG:
1600
+ // Sonnet 5 is 128k, not 4-6's 64k — corrected. New tokenizer (~30% more
1601
+ // tokens for the same text vs 4-6): byte-budget consumers should re-baseline.
1602
+ // API quirks (claude-api ref): (a) NON-DEFAULT temperature/top_p/top_k
1603
+ // return 400 — moot for kgauto's own call() path (ANTHROPIC_LOWERING_BASE
1604
+ // emits no sampling params) but a REAL hazard for compileForAISDKv6
1605
+ // consumers that pass temperature themselves (tt-intel scoring uses temp:0
1606
+ // for determinism — that 400s on this model; noted to consumers via the
1607
+ // contract). (b) Omitting `thinking` runs ADAPTIVE by default (4-6 ran
1608
+ // thinking-off) — output spend shifts. (c) Supports effort xhigh. status:
1609
+ // 'preview' per the Fable precedent — no brain evidence yet; promotion to
1610
+ // 'current' is an explicit call. (L-049/L-081.)
1611
+ id: "claude-sonnet-5",
1612
+ verifiedAgainstDocs: "2026-08-14",
1613
+ provider: "anthropic",
1614
+ status: "current",
1615
+ // s76 2026-07-25: GA per docs; was preview.
1616
+ maxContextTokens: 1e6,
1617
+ maxOutputTokens: 128e3,
1618
+ maxTools: 64,
1619
+ parallelToolCalls: true,
1620
+ structuredOutput: "grammar",
1621
+ systemPromptMode: "inline",
1622
+ streaming: true,
1623
+ cliffs: [],
1624
+ costInputPer1m: 2,
1625
+ // 2026-08-24: intro price made PERMANENT (docs: "the previously scheduled increase to $3/$15 on September 1, 2026 will not occur")
1626
+ costOutputPer1m: 10,
1627
+ lowering: ANTHROPIC_LOWERING_BASE,
1628
+ recovery: [
1629
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
1630
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
1631
+ ],
1632
+ strengths: ["quality", "tool_use", "long_context", "cache_friendly", "extended_thinking"],
1633
+ weaknesses: [],
1634
+ notes: "Sonnet 5 (2026-06): near-Opus quality on coding/agentic work at Sonnet cost. Verified 2026-07-02 against the claude-api reference: 1M ctx, 128k out (clone's 64k corrected), $3/$15 sticker (intro $2/$10 through 2026-08-31). New tokenizer ~30% more tokens vs sonnet-4-6. Consumer hazards: non-default temperature/top_p/top_k 400 (temp:0 rejected \u2014 deterministic-scoring consumers must omit); thinking defaults to adaptive when omitted. status:preview \u2014 no brain evidence yet; earns placement via the machinery.",
1635
+ // Master plan §6.2 anchor. Tier 0 for plan/generate/ask/extract/transform
1636
+ // in starter chains; tier 1 cross-provider for hunt/summarize/classify.
1637
+ archetypePerf: {
1638
+ ask: 9,
1639
+ generate: 9,
1640
+ plan: 9,
1641
+ critique: 9,
1642
+ extract: 9,
1643
+ transform: 9,
1644
+ hunt: 7,
1645
+ // strong but Flash beats on parallel tool throughput
1646
+ summarize: 8,
1647
+ // overkill for tolerant archetype
1648
+ classify: 8
1649
+ // overkill
1650
+ }
1651
+ },
1652
+ // ── Z.ai (GLM) ──
1653
+ // alpha.65 (2026-07-18): first Z.ai profile, provider `zai` added same
1654
+ // release. Step-zero sources (L-049/L-081, all fetched 2026-07-18):
1655
+ // docs.z.ai/guides/llm/glm-5.2 (capabilities), docs.z.ai api-reference
1656
+ // chat-completion (wire params: thinking.type enabled|disabled default
1657
+ // enabled, reasoning_effort max..none, tool_stream, max output 131072),
1658
+ // docs.z.ai/guides/overview/pricing ($1.4 in / $4.4 out, cached input
1659
+ // $0.26, cache storage limited-time free), vLLM recipe (native ctx
1660
+ // 1,048,576). NO AI-trained numbers.
1661
+ {
1662
+ id: "glm-5.2",
1663
+ verifiedAgainstDocs: "2026-07-18",
1664
+ provider: "zai",
1665
+ status: "preview",
1666
+ maxContextTokens: 1048576,
1667
+ maxOutputTokens: 131072,
1668
+ // No documented tool-count cap — conservative default pending measured
1669
+ // evidence; matches the deepseek posture, not a doc number.
1670
+ maxTools: 16,
1671
+ // Hosted-API docs document tools + tool_choice + tool_stream but say
1672
+ // NOTHING about multiple tool_calls per response. Conservative false so
1673
+ // hunt-shaped ranking doesn't over-promise; flip on doc or probe
1674
+ // evidence (L-081: undocumented ≠ true).
1675
+ parallelToolCalls: false,
1676
+ structuredOutput: "native",
1677
+ systemPromptMode: "inline",
1678
+ streaming: true,
1679
+ cliffs: [],
1680
+ costInputPer1m: 1.4,
1681
+ costOutputPer1m: 4.4,
1682
+ lowering: {
1683
+ system: { mode: "inline" },
1684
+ // Automatic prefix caching ("intelligent caching mechanism") — no wire
1685
+ // marker to emit, DeepSeek-style. Cache-hit input $0.26/M (~0.19× of
1686
+ // miss) tracked in notes; storage limited-time free as of 2026-07-18.
1687
+ cache: { strategy: "unsupported" },
1688
+ tools: { format: "openai" },
1689
+ // thinking.type: 'enabled' (server default) | 'disabled'. lowerZai
1690
+ // emits an explicit disable only on forceThinkingZero cliffs.
1691
+ thinking: { field: "thinking.type", default: "auto" }
1692
+ },
1693
+ recovery: [
1694
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
1695
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
1696
+ ],
1697
+ strengths: ["cost", "1m_context", "code", "tool_use", "json_output", "reasoning"],
1698
+ weaknesses: ["parallel_tools"],
1699
+ notes: "GLM-5.2 (Z.ai, 2026-06): agentic-coding flagship. 1,048,576 ctx / 131,072 max out. $1.40/$4.40 per 1M; cached input $0.26/M (automatic caching, no marker; storage limited-time free as of 2026-07-18). Thinking on by default (`thinking.type`), `reasoning_effort` max..none. Parallel tool calls UNDOCUMENTED on the hosted API \u2014 profile says false until doc or probe evidence. status:preview \u2014 no brain evidence yet; earns placement via the machinery.",
1700
+ // Starter hypotheses — verify with telemetry/probes; NO brain evidence
1701
+ // yet. Anchored on the vendor's agentic-coding positioning at a
1702
+ // mid-cost tier, discounted for the unproven parallel-tool story.
1703
+ archetypePerf: {
1704
+ generate: 7,
1705
+ // agentic-coding positioning — starter hypothesis
1706
+ transform: 7,
1707
+ // starter hypothesis
1708
+ plan: 7,
1709
+ // starter hypothesis
1710
+ summarize: 7,
1711
+ // tolerant archetype — starter hypothesis
1712
+ ask: 6,
1713
+ extract: 6,
1714
+ critique: 6,
1715
+ classify: 6,
1716
+ hunt: 5
1717
+ // tools work; parallel unproven → discounted
1718
+ }
1719
+ },
1720
+ // ── Moonshot (Kimi) ──
1721
+ // alpha.65 (2026-07-18): first Moonshot profile, provider `moonshot` added
1722
+ // same release. Step-zero sources (all fetched 2026-07-18):
1723
+ // platform.kimi.ai/docs/pricing/chat-k3 ($3.00 cache-miss in / $0.30
1724
+ // cache-hit in / $15.00 out; 1,048,576 ctx; ToolCalls + JSON Mode +
1725
+ // Partial Mode), kimi-k3-quickstart (max_completion_tokens default
1726
+ // 131072, up to 1,048,576; base https://api.moonshot.ai/v1; vision via
1727
+ // base64 or ms://file-id, NO public image URLs), models-overview
1728
+ // (temperature FIXED 1.0, top_p FIXED 0.95, n FIXED 1, always reasons,
1729
+ // reasoning_effort 'max' only), tool-calls guide ("can choose to call
1730
+ // multiple tools at once … will tend to call them in parallel").
1731
+ {
1732
+ id: "kimi-k3",
1733
+ verifiedAgainstDocs: "2026-07-18",
1734
+ provider: "moonshot",
1735
+ status: "preview",
1736
+ maxContextTokens: 1048576,
1737
+ // Documented ceiling; default is 131,072 when unset.
1738
+ maxOutputTokens: 1048576,
1739
+ // No hard doc cap; docs recommend dynamic tool loading at "dozens or
1740
+ // hundreds" — 64 matches the frontier-agentic posture (sonnet-5 tier).
1741
+ maxTools: 64,
1742
+ parallelToolCalls: true,
1743
+ structuredOutput: "native",
1744
+ systemPromptMode: "inline",
1745
+ streaming: true,
1746
+ cliffs: [],
1747
+ costInputPer1m: 3,
1748
+ costOutputPer1m: 15,
1749
+ lowering: {
1750
+ system: { mode: "inline" },
1751
+ // Automatic context caching — no wire marker. Cache-hit input $0.30/M
1752
+ // (0.1× of miss) tracked in notes.
1753
+ cache: { strategy: "unsupported" },
1754
+ tools: { format: "openai" }
1755
+ // No thinking knob: reasoning is always-on and reasoning_effort
1756
+ // accepts only 'max' (= the server default). Nothing to lower.
1757
+ },
1758
+ recovery: [
1759
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
1760
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
1761
+ ],
1762
+ strengths: ["quality", "reasoning", "1m_context", "parallel_tools", "tool_use", "code", "vision"],
1763
+ // 'latency' → latencyTierOf derives 'slow': always-on max-effort
1764
+ // reasoner with no off switch; no measured p50 yet, the tag is the
1765
+ // honest prior (reasoner family precedent: deepseek-v4-pro ~48s).
1766
+ weaknesses: ["cost", "latency"],
1767
+ notes: "Kimi K3 (Moonshot, API live 2026-07-16): 2.8T-param open-weight flagship, native vision. 1,048,576 ctx; max_completion_tokens default 131,072, ceiling 1,048,576. $3.00/$15.00 per 1M, cache-hit input $0.30/M (automatic caching). Reasoning ALWAYS ON (reasoning_effort max only, cannot disable; responses may carry reasoning_content). Wire quirks: temperature fixed 1.0 / top_p 0.95 / n 1 (kgauto never emits those); vision input must be base64 or ms://file-id \u2014 public image URLs rejected. status:preview \u2014 earns placement via the machinery.",
1768
+ // Starter hypotheses — verify with telemetry/probes; NO brain evidence
1769
+ // yet. Anchored on documented long-horizon-agentic + parallel-tool
1770
+ // strengths; discounted on terse archetypes where always-on reasoning
1771
+ // bills $15/M output for thinking the archetype doesn't need.
1772
+ archetypePerf: {
1773
+ hunt: 8,
1774
+ // parallel tools + long-horizon agentic — starter hypothesis
1775
+ plan: 8,
1776
+ // starter hypothesis
1777
+ generate: 8,
1778
+ // starter hypothesis
1779
+ critique: 7,
1780
+ ask: 7,
1781
+ extract: 7,
1782
+ transform: 7,
1783
+ summarize: 6,
1784
+ // works, but $15/M output reasoning tax on a tolerant archetype
1785
+ classify: 5
1786
+ // always-on reasoning cost + reasoner hedge risk
1787
+ },
1788
+ // Diagnostics-only (no prompt rewrite): reasoner-family hedge risk on
1789
+ // decisive archetypes, carried as a warning until K3-specific probe
1790
+ // evidence exists. The deepseek-reasoner family showed 8/10 judge
1791
+ // rationales citing hedging on classify (exclusion-finding ID 20,
1792
+ // 2026-05-28); K3 is an always-on reasoner and inherits the risk class,
1793
+ // not the conviction.
1794
+ archetypeConventions: [
1795
+ {
1796
+ archetype: "classify",
1797
+ cliffWarning: "kimi-k3 is an always-on reasoner: decisive archetypes (classify) may hedge, and reasoning tokens bill at $15/M output. Family-prior risk (deepseek-reasoner precedent), not K3-measured \u2014 probe before relying on it for classify.",
1798
+ reason: "Reasoner-family prior (exclusion-finding ID 20, 2026-05-28, deepseek-v4-pro on tt-intel/classify). No K3-specific evidence yet \u2014 warning only, no prompt rewrite."
1799
+ }
1800
+ ]
1801
+ }
1802
+ ];
1803
+ var ALIASES = {
1804
+ // DeepSeek's own model routing — both names served by V4-Flash.
1805
+ "deepseek-chat": "deepseek-v4-flash",
1806
+ "deepseek-reasoner": "deepseek-v4-flash",
1807
+ // Legacy kgauto typo — actual API alias is dash-form (alpha.1 had dot).
1808
+ "claude-haiku-4.5": "claude-haiku-4-5"
1809
+ };
1810
+ var brainHook = {};
1811
+ function _setProfileBrainHook(hook) {
1812
+ brainHook = hook;
1813
+ }
1814
+ function canonicalId(id) {
1815
+ return brainHook.resolveAlias?.(id) ?? ALIASES[id] ?? id;
1816
+ }
1817
+ var CONSUMER_INDEX = /* @__PURE__ */ new Map();
1818
+ function registerProfiles(profiles) {
1819
+ for (const p of profiles) CONSUMER_INDEX.set(p.id, p);
1820
+ }
1821
+ function _testClearConsumerProfiles() {
1822
+ CONSUMER_INDEX.clear();
1823
+ }
1824
+ function inferProviderFromId(id) {
1825
+ const lower = id.toLowerCase();
1826
+ if (lower.startsWith("claude")) return "anthropic";
1827
+ if (lower.startsWith("gemini") || lower.startsWith("palm")) return "google";
1828
+ if (lower.startsWith("gpt") || /^o[0-9]/.test(lower) || lower.startsWith("chatgpt")) return "openai";
1829
+ if (lower.startsWith("deepseek")) return "deepseek";
1830
+ if (lower.startsWith("glm")) return "zai";
1831
+ if (lower.startsWith("kimi") || lower.startsWith("moonshot")) return "moonshot";
1832
+ return void 0;
1833
+ }
1834
+ function bestEffortProfile(id) {
1835
+ const canonical = canonicalId(id);
1836
+ const existing = tryGetProfile(canonical);
1837
+ if (existing) return existing;
1838
+ const provider = inferProviderFromId(canonical);
1839
+ if (!provider) return void 0;
1840
+ const donor = PROFILES_RAW.find((p) => p.provider === provider && p.status === "current") ?? PROFILES_RAW.find((p) => p.provider === provider);
1841
+ if (!donor) return void 0;
1842
+ const synth = {
1843
+ id: canonical,
1844
+ provider,
1845
+ bestEffort: true,
1846
+ status: "preview",
1847
+ maxContextTokens: 128e3,
1848
+ maxOutputTokens: 4096,
1849
+ maxTools: donor.maxTools,
1850
+ parallelToolCalls: false,
1851
+ structuredOutput: "none",
1852
+ systemPromptMode: donor.systemPromptMode,
1853
+ streaming: donor.streaming,
1854
+ cliffs: [],
1855
+ costInputPer1m: 0,
1856
+ costOutputPer1m: 0,
1857
+ lowering: donor.lowering,
1858
+ recovery: [],
1859
+ strengths: [],
1860
+ weaknesses: ["best-effort synthesized profile \u2014 no verified capability data"],
1861
+ notes: `Synthesized by onUnprofiledModel:'best-effort' (provider ${provider} inferred from id; wire mechanics borrowed from ${donor.id}). No cliffs, no measured knowledge, cost UNKNOWN (recorded as 0). Replace via registerProfiles() for real guards.`
1862
+ };
1863
+ CONSUMER_INDEX.set(canonical, synth);
1864
+ return synth;
1865
+ }
1866
+ function resolveModelAlias(id) {
1867
+ return canonicalId(id);
1868
+ }
1869
+ var PROFILE_INDEX = new Map(
1870
+ PROFILES_RAW.map((p) => [p.id, p])
1871
+ );
1872
+ function getProfile(id) {
1873
+ const canonical = canonicalId(id);
1874
+ const fromConsumer = CONSUMER_INDEX.get(canonical);
1875
+ if (fromConsumer) return fromConsumer;
1876
+ const fromBrain = brainHook.getProfile?.(canonical);
1877
+ if (fromBrain) return fromBrain;
1878
+ const p = PROFILE_INDEX.get(canonical);
1879
+ if (!p) {
1880
+ const known = [...PROFILE_INDEX.keys(), ...Object.keys(ALIASES)].join(", ");
1881
+ throw new Error(
1882
+ `Unknown model id: "${id}". Known: ${known}. For a model kgauto has not onboarded: registerProfiles([...]) supplies a full profile, or policy.onUnprofiledModel:'best-effort' compiles with guards skipped (alpha.87).`
1883
+ );
1884
+ }
1885
+ return p;
1886
+ }
1887
+ function tryGetProfile(id) {
1888
+ const canonical = canonicalId(id);
1889
+ return CONSUMER_INDEX.get(canonical) ?? brainHook.getProfile?.(canonical) ?? PROFILE_INDEX.get(canonical);
1890
+ }
1891
+ function allProfiles() {
1892
+ return PROFILES_RAW;
1893
+ }
1894
+ function allProfilesRaw() {
673
1895
  return PROFILES_RAW;
674
1896
  }
675
1897
  function profilesByProvider(provider) {
@@ -678,8 +1900,17 @@ function profilesByProvider(provider) {
678
1900
  // Annotate the CommonJS export names for ESM import in node:
679
1901
  0 && (module.exports = {
680
1902
  ALIASES,
1903
+ LATENCY_TIER_MS,
1904
+ _setProfileBrainHook,
1905
+ _testClearConsumerProfiles,
681
1906
  allProfiles,
1907
+ allProfilesRaw,
1908
+ bestEffortProfile,
682
1909
  getProfile,
1910
+ inferProviderFromId,
1911
+ latencyTierOf,
683
1912
  profilesByProvider,
1913
+ registerProfiles,
1914
+ resolveModelAlias,
684
1915
  tryGetProfile
685
1916
  });