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

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-54IXD5BT.mjs +858 -0
  7. package/dist/chunk-65ZMX5OT.mjs +169 -0
  8. package/dist/chunk-AUZTO6Q5.mjs +219 -0
  9. package/dist/{chunk-5TI6PNSK.mjs → chunk-BVEXV5KC.mjs} +11 -0
  10. package/dist/chunk-NBO4R5PC.mjs +313 -0
  11. package/dist/chunk-P3TOAEG4.mjs +56 -0
  12. package/dist/chunk-RO22VFIF.mjs +29 -0
  13. package/dist/chunk-T53ISC2F.mjs +2008 -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 +3326 -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 +10970 -2043
  37. package/dist/index.mjs +6279 -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 +1412 -52
  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,9 +553,19 @@ 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-27",
342
557
  provider: "google",
343
- status: "current",
558
+ // alpha.91 — AVAILABILITY demotion, same class as gemini-2.5-pro below.
559
+ // Google refuses the model for newer account cohorts: "This model is no
560
+ // longer available to new users. Please update your code to use
561
+ // models/gemini-3.5-flash-lite" (tt-intel TT-49 runtime evidence,
562
+ // 2026-08-26, interfaces/kgauto.md ## Requested). It ranked FIRST in
563
+ // getFallbackChain('gemini-2.5-pro') — a dead-for-new-accounts model as
564
+ // the cheapest fallback pick. `legacy` removes it from chains and new
565
+ // selection; explicit-id consumers still resolve it. Successor is the
566
+ // one Google's own error names: gemini-3.5-flash-lite (onboarded this
567
+ // release, same price point).
568
+ status: "legacy",
344
569
  maxContextTokens: 1048576,
345
570
  maxOutputTokens: 65536,
346
571
  maxTools: 128,
@@ -433,9 +658,21 @@ var PROFILES_RAW = [
433
658
  },
434
659
  {
435
660
  id: "gemini-2.5-pro",
436
- verifiedAgainstDocs: "2026-05-08",
661
+ verifiedAgainstDocs: "2026-08-08",
437
662
  provider: "google",
438
- status: "current",
663
+ // alpha.86 — AVAILABILITY demotion, not a provider-lifecycle mirror.
664
+ // Google's docs still list 2.5-pro as Stable, but the serving layer
665
+ // disagrees per account cohort: tt-intel measured 4/4 refusals
666
+ // ("no longer available to new users", 2026-08-02, their bench), and
667
+ // kgauto's own key 429s on a FreeTier per-day quota (probed
668
+ // 2026-08-08). A chain anchor that hard-fails for whole account
669
+ // cohorts is not an anchor; `legacy` removes it from cost-ordered
670
+ // chains and new selection while keeping the profile resolvable for
671
+ // consumers who pass it explicitly. Re-promotion is one status flip
672
+ // if Google restores availability. The registry cannot yet express
673
+ // account-cohort availability as data — see interfaces/kgauto.md
674
+ // ## Requested 2026-08-02.
675
+ status: "legacy",
439
676
  maxContextTokens: 1048576,
440
677
  maxOutputTokens: 65535,
441
678
  maxTools: 128,
@@ -465,7 +702,7 @@ var PROFILES_RAW = [
465
702
  }
466
703
  ],
467
704
  strengths: ["reasoning", "1m_context", "structured_output", "tool_use"],
468
- weaknesses: ["pricing_above_200k"],
705
+ weaknesses: ["pricing_above_200k", "availability_restricted_by_account_cohort"],
469
706
  // Master plan §3.3 anchor: tier-2 cross-provider in almost every chain.
470
707
  // Sits on the frontier at perf-9 — close to Sonnet but cheaper input.
471
708
  archetypePerf: {
@@ -483,7 +720,7 @@ var PROFILES_RAW = [
483
720
  },
484
721
  {
485
722
  id: "gemini-3.1-pro-preview",
486
- verifiedAgainstDocs: "2026-05-08",
723
+ verifiedAgainstDocs: "2026-08-14",
487
724
  provider: "google",
488
725
  status: "preview",
489
726
  maxContextTokens: 1048576,
@@ -543,7 +780,7 @@ var PROFILES_RAW = [
543
780
  // deepseek-reasoner registered as aliases (see ALIASES below).
544
781
  {
545
782
  id: "deepseek-v4-flash",
546
- verifiedAgainstDocs: "2026-05-08",
783
+ verifiedAgainstDocs: "2026-08-24",
547
784
  provider: "deepseek",
548
785
  status: "current",
549
786
  maxContextTokens: 1e6,
@@ -561,8 +798,8 @@ var PROFILES_RAW = [
561
798
  reason: "Sequential tool calls only \u2014 L-040"
562
799
  }
563
800
  ],
564
- costInputPer1m: 0.14,
565
- costOutputPer1m: 0.28,
801
+ costInputPer1m: 0.44,
802
+ costOutputPer1m: 1.32,
566
803
  lowering: {
567
804
  system: { mode: "inline" },
568
805
  cache: { strategy: "unsupported" },
@@ -573,7 +810,15 @@ var PROFILES_RAW = [
573
810
  ],
574
811
  strengths: ["cost", "1m_context", "json_output", "code", "reasoning"],
575
812
  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.",
813
+ // alpha.47 explicit slow override. Tag derivation would say 'medium'
814
+ // (no 'latency' weakness, no 'speed' strength), but the alpha.46 shadow
815
+ // probe MEASURED deepseek-v4-flash at 20485ms served (2026-06-03) — ~2.3×
816
+ // gemini-2.5-flash on PB's synchronous /api/analyze path. The 'flash' name
817
+ // is DeepSeek's, not a speed promise. This is the row that, scoring 0.85
818
+ // baseQuality (it carries 'reasoning') with no latency counterweight,
819
+ // leapfrogged gemini-2.5-flash as PB's summarize leader once reachable.
820
+ latencyTier: "slow",
821
+ 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
822
  // Master plan §6.2 anchor. Brain-validated tier 1 cross-provider for
578
823
  // classify (169 rows, 0% empty). Tier 0 for summarize-with-no-tools.
579
824
  // Falls off on hunt (sequential tools — L-040) and reasoning depth.
@@ -590,11 +835,25 @@ var PROFILES_RAW = [
590
835
  critique: 4,
591
836
  hunt: 4
592
837
  // sequential tool calls only — L-040
593
- }
838
+ },
839
+ // alpha.43 — family-level conventions for the `deepseek-chat` family
840
+ // (V4-Flash + future non-thinking-mode members). V4-Flash struggles
841
+ // with summarize-archetype + structured-output: 3 of 4 schema-attempted
842
+ // PB calls (2026-05-18 + 2026-05-22) hit `structured_output_parse_failed`.
843
+ // Surface the friction at compile time so consumers either drop the
844
+ // schema or route to a more schema-reliable family.
845
+ archetypeConventions: [
846
+ {
847
+ archetype: "summarize",
848
+ structuredOutputHint: "avoid",
849
+ 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.",
850
+ reason: "Brain evidence: PB compile_outcomes 2026-05-18 + 2026-05-22, error_type=structured_output_parse_failed on deepseek-v4-flash + summarize archetype."
851
+ }
852
+ ]
594
853
  },
595
854
  {
596
855
  id: "deepseek-v4-pro",
597
- verifiedAgainstDocs: "2026-05-08",
856
+ verifiedAgainstDocs: "2026-08-24",
598
857
  provider: "deepseek",
599
858
  status: "current",
600
859
  maxContextTokens: 1e6,
@@ -612,10 +871,14 @@ var PROFILES_RAW = [
612
871
  reason: "Sequential tool calls only \u2014 L-040"
613
872
  }
614
873
  ],
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,
874
+ // Verified against the live DeepSeek pricing page 2026-06-22: the 75%-off
875
+ // launch "promo" ($0.435/$0.87) did NOT revert on 2026-05-31 it became the
876
+ // standing price (docs show $0.435 in / $0.87 out cache-miss, $0.003625
877
+ // cache-hit in; no promo caveat). The old $1.74/$3.48 "regular post-promo"
878
+ // was a projected revert that never happened (L-073/L-081) — it 4×-overstated
879
+ // cost and suppressed V4-Pro in cost-aware ranking.
880
+ costInputPer1m: 1.32,
881
+ costOutputPer1m: 3.96,
619
882
  lowering: {
620
883
  system: { mode: "inline" },
621
884
  cache: { strategy: "unsupported" },
@@ -626,7 +889,12 @@ var PROFILES_RAW = [
626
889
  ],
627
890
  strengths: ["quality", "reasoning", "1m_context", "json_output", "code", "extended_thinking"],
628
891
  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.",
892
+ // alpha.47 explicit slow override. Measured 47722ms on the alpha.46
893
+ // shadow probe (2026-06-03) — it's an extended-thinking reasoner, slowest
894
+ // of the served set. Tag derivation would say 'medium'; the measurement says
895
+ // otherwise.
896
+ latencyTier: "slow",
897
+ 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
898
  // Master plan §3.3: tier 3 cross-provider for plan chain. Reasoning
631
899
  // bumped one notch over V4-Flash; same parallel-tool ceiling.
632
900
  archetypePerf: {
@@ -641,35 +909,1118 @@ var PROFILES_RAW = [
641
909
  transform: 6,
642
910
  hunt: 4
643
911
  // sequential tools — same as V4-Flash
912
+ },
913
+ // alpha.43 — family-level conventions for the `deepseek-reasoner` family
914
+ // (V4-Pro is the family rep; future thinking-mode members inherit).
915
+ //
916
+ // The decisive-archetype suffix is the load-bearing piece: 2026-05-28
917
+ // first real V4-Pro probe on tt-intel/classify (exclusion-finding ID 20)
918
+ // showed 8/10 judge rationales citing "candidate hedges and fails to
919
+ // commit to a single classification" or "candidate refuses to pick
920
+ // among the labels." Without the forcing-function suffix, every
921
+ // reasoner probe on classify/extract/ask verdicts stay-excluded for
922
+ // model-behavior reasons (epistemic humility is reasoner-shaped),
923
+ // NOT quality reasons. The suffix re-shapes the contract so the model
924
+ // is asked for what it's actually being measured on.
925
+ //
926
+ // The hunt-archetype cliffWarning is the L-040 architectural reading
927
+ // surfaced at compile time. Reasoners produce sequential reasoning
928
+ // chains by design; hunt archetypes with 3+ parallel tools lose
929
+ // substantial throughput (L-040 + L-041). The L-040 cliff in the
930
+ // `cliffs` array already trims to top-relevant tools; this warning
931
+ // tells the consumer the family is wrong for the shape so they can
932
+ // route to gemini-flash (parallel-strong) instead of accepting trimmed
933
+ // throughput silently.
934
+ archetypeConventions: [
935
+ {
936
+ archetype: "classify",
937
+ 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.",
938
+ 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."
939
+ },
940
+ {
941
+ archetype: "extract",
942
+ 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.",
943
+ 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."
944
+ },
945
+ {
946
+ archetype: "ask",
947
+ 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.",
948
+ 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."
949
+ },
950
+ {
951
+ archetype: "hunt",
952
+ whenToolCountAtLeast: 3,
953
+ 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.",
954
+ 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."
955
+ }
956
+ ]
957
+ },
958
+ // ── OpenAI ──
959
+ // alpha.16 (2026-05-17): close the half-supported provider gap. env.ts
960
+ // already registered OPENAI_API_KEY + executeOpenAI + normalizeOpenAILike
961
+ // + lowerOpenAI all existed; profile entries were missing, so the
962
+ // alpha.10 auto-filter would mark openai-keyed models reachable but
963
+ // there were no profiles to filter IN. Half-supported is now fully
964
+ // supported. PB request `openai-provider-profiles` (2026-05-16).
965
+ //
966
+ // Profile data verified against developers.openai.com/api/docs/pricing
967
+ // + per-model pages 2026-05-17. L-049/L-081 step-zero: no AI-trained
968
+ // numbers — fetched live from OpenAI's docs. As of 2026-05, OpenAI's
969
+ // current flagship is gpt-5.5 (2025-12 cutoff); gpt-5.4-{base,mini,nano}
970
+ // are the workhorse family. gpt-4.1 + gpt-4o are legacy.
971
+ //
972
+ // Both 5.5 and 5.4 carry a 272K input-token pricing cliff (2x input,
973
+ // 1.5x output beyond that). Modeled as a `downgrade_quality_warning`
974
+ // cliff because it ranks the model down at large-context shapes — the
975
+ // semantics of "this model is now 2x more expensive" map onto the
976
+ // existing penalty mechanism. Cost-watcher will catch high-context
977
+ // spikes empirically; the cliff prevents naive routing into the doubled
978
+ // pricing zone.
979
+ {
980
+ id: "gpt-5.5",
981
+ verifiedAgainstDocs: "2026-05-17",
982
+ provider: "openai",
983
+ status: "current",
984
+ maxContextTokens: 105e4,
985
+ maxOutputTokens: 128e3,
986
+ maxTools: 64,
987
+ parallelToolCalls: true,
988
+ structuredOutput: "native",
989
+ systemPromptMode: "inline",
990
+ streaming: true,
991
+ cliffs: [
992
+ {
993
+ metric: "input_tokens",
994
+ threshold: 272e3,
995
+ action: "downgrade_quality_warning",
996
+ reason: "OpenAI pricing tier shift: >272K input tokens billed at 2x input + 1.5x output rates"
997
+ }
998
+ ],
999
+ costInputPer1m: 5,
1000
+ costOutputPer1m: 30,
1001
+ lowering: {
1002
+ system: { mode: "inline" },
1003
+ // OpenAI caching is implicit (auto-applied to repeated prefixes
1004
+ // ≥1024 tokens for prompt_tokens_details.cached_tokens). No
1005
+ // wire-format marker. Discount: 10x for cached input ($0.50/$5.00).
1006
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
1007
+ tools: { format: "openai" }
1008
+ },
1009
+ recovery: [
1010
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1011
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1012
+ ],
1013
+ strengths: ["reasoning", "agentic_coding", "long_context", "structured_output", "reliable_tool_use", "reasoning_effort_knob"],
1014
+ weaknesses: ["cost", "pricing_cliff_at_272k"],
1015
+ 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.",
1016
+ // Frontier-tier perf hypothesis. Anchored to Opus 4.7 row (similar
1017
+ // price/positioning). Brain evidence will refine; no telemetry yet.
1018
+ archetypePerf: {
1019
+ critique: 9,
1020
+ plan: 9,
1021
+ generate: 9,
1022
+ ask: 9,
1023
+ extract: 9,
1024
+ transform: 9,
1025
+ hunt: 8,
1026
+ // parallel tool support good but cliff at 272K hurts deep multi-step
1027
+ summarize: 7,
1028
+ // overkill for tolerant archetype
1029
+ classify: 7
1030
+ // overkill; cheaper models cover this
644
1031
  }
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() {
1032
+ },
1033
+ {
1034
+ id: "gpt-5.4",
1035
+ verifiedAgainstDocs: "2026-05-17",
1036
+ provider: "openai",
1037
+ status: "current",
1038
+ maxContextTokens: 105e4,
1039
+ maxOutputTokens: 128e3,
1040
+ maxTools: 64,
1041
+ parallelToolCalls: true,
1042
+ structuredOutput: "native",
1043
+ systemPromptMode: "inline",
1044
+ streaming: true,
1045
+ cliffs: [
1046
+ {
1047
+ metric: "input_tokens",
1048
+ threshold: 272e3,
1049
+ action: "downgrade_quality_warning",
1050
+ reason: "OpenAI pricing tier shift: >272K input tokens billed at 2x input + 1.5x output rates"
1051
+ }
1052
+ ],
1053
+ costInputPer1m: 2.5,
1054
+ costOutputPer1m: 15,
1055
+ lowering: {
1056
+ system: { mode: "inline" },
1057
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
1058
+ tools: { format: "openai" }
1059
+ },
1060
+ recovery: [
1061
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1062
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1063
+ ],
1064
+ strengths: ["reasoning", "long_context", "structured_output", "reliable_tool_use"],
1065
+ weaknesses: ["pricing_cliff_at_272k"],
1066
+ 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).",
1067
+ // Anchored to Sonnet 4.6 row (similar price/positioning). Slight
1068
+ // anthropic-side edge on agentic coding per master plan vibe.
1069
+ archetypePerf: {
1070
+ critique: 8,
1071
+ plan: 8,
1072
+ generate: 8,
1073
+ ask: 8,
1074
+ extract: 8,
1075
+ transform: 8,
1076
+ hunt: 7,
1077
+ summarize: 7,
1078
+ classify: 7
1079
+ }
1080
+ },
1081
+ {
1082
+ id: "gpt-5.4-mini",
1083
+ verifiedAgainstDocs: "2026-05-17",
1084
+ provider: "openai",
1085
+ status: "current",
1086
+ maxContextTokens: 4e5,
1087
+ maxOutputTokens: 128e3,
1088
+ maxTools: 64,
1089
+ parallelToolCalls: true,
1090
+ structuredOutput: "native",
1091
+ systemPromptMode: "inline",
1092
+ streaming: true,
1093
+ cliffs: [],
1094
+ costInputPer1m: 0.75,
1095
+ costOutputPer1m: 4.5,
1096
+ lowering: {
1097
+ system: { mode: "inline" },
1098
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
1099
+ tools: { format: "openai" }
1100
+ },
1101
+ recovery: [
1102
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1103
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1104
+ ],
1105
+ strengths: ["cost", "speed", "agentic_coding", "structured_output", "reliable_tool_use"],
1106
+ weaknesses: ["reasoning_depth"],
1107
+ 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).",
1108
+ // Mini-tier hypothesis. Anchored to Haiku 4.5 + Flash row pricing.
1109
+ // Cost is slightly higher than Haiku ($0.75 vs $0.50 input) but
1110
+ // OpenAI claims strong coding/subagent perf.
1111
+ archetypePerf: {
1112
+ ask: 7,
1113
+ generate: 7,
1114
+ extract: 7,
1115
+ transform: 7,
1116
+ classify: 7,
1117
+ summarize: 7,
1118
+ hunt: 7,
1119
+ plan: 6,
1120
+ critique: 5
1121
+ // reasoning depth gap — frontier models handle this
1122
+ }
1123
+ },
1124
+ {
1125
+ id: "gpt-5.4-nano",
1126
+ verifiedAgainstDocs: "2026-05-17",
1127
+ provider: "openai",
1128
+ status: "current",
1129
+ maxContextTokens: 4e5,
1130
+ maxOutputTokens: 128e3,
1131
+ maxTools: 64,
1132
+ parallelToolCalls: true,
1133
+ structuredOutput: "native",
1134
+ systemPromptMode: "inline",
1135
+ streaming: true,
1136
+ cliffs: [],
1137
+ costInputPer1m: 0.2,
1138
+ costOutputPer1m: 1.25,
1139
+ lowering: {
1140
+ system: { mode: "inline" },
1141
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
1142
+ tools: { format: "openai" }
1143
+ },
1144
+ recovery: [
1145
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1146
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1147
+ ],
1148
+ strengths: ["cost", "speed", "volume", "structured_output"],
1149
+ weaknesses: ["reasoning_depth", "no_computer_use"],
1150
+ 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.",
1151
+ // Nano-tier. Anchored to Flash-Lite row ($0.10/$0.40 vs nano's
1152
+ // $0.20/$1.25). Slightly more expensive than Flash-Lite but with
1153
+ // OpenAI brand reliability. Good fit for classify/summarize floor.
1154
+ archetypePerf: {
1155
+ classify: 7,
1156
+ summarize: 6,
1157
+ ask: 6,
1158
+ transform: 6,
1159
+ extract: 6,
1160
+ generate: 5,
1161
+ hunt: 5,
1162
+ plan: 4,
1163
+ critique: 3
1164
+ // not for reasoning archetypes
1165
+ }
1166
+ },
1167
+ // ── Auto-onboarded (UNVERIFIED) ──
1168
+ // Cloned by scripts/auto-onboard-models.mjs from a same-family template.
1169
+ // Each entry's pricing/context/cliffs/lowering reflects the template, NOT
1170
+ // provider docs. Verify before promoting status to 'current' (L-049/L-081).
1171
+ {
1172
+ // s37 (2026-05-21): UNVERIFIED-AUTO-ONBOARD → verified against
1173
+ // ai.google.dev/gemini-api/docs/models/gemini-3-flash-preview +
1174
+ // ai.google.dev/gemini-api/docs/pricing. L-081 catches:
1175
+ // maxOutputTokens 65_535 → 65_536 (off-by-one)
1176
+ // costInputPer1m 0.30 → 0.50 (template-cloned from 2.5-flash; actual is 1.67× more expensive)
1177
+ // costOutputPer1m 2.50 → 3.00 (template-cloned; actual 1.2× more expensive)
1178
+ // cache discount default 0.25 → 0.10 (10× discount, $0.05/$0.50 per docs)
1179
+ // Cliffs inherited from 2.5-flash conservatively. The 8K-context-quality
1180
+ // cliff was a 2.5-Flash observation — Google positions Gemini 3 as
1181
+ // sustained-frontier-on-long-context; brain evidence will validate/relax.
1182
+ // Kept as guard for now.
1183
+ id: "gemini-3-flash-preview",
1184
+ verifiedAgainstDocs: "2026-05-21",
1185
+ provider: "google",
1186
+ status: "preview",
1187
+ maxContextTokens: 1048576,
1188
+ maxOutputTokens: 65536,
1189
+ maxTools: 128,
1190
+ parallelToolCalls: true,
1191
+ structuredOutput: "native",
1192
+ systemPromptMode: "separate",
1193
+ streaming: true,
1194
+ cliffs: [
1195
+ {
1196
+ metric: "input_tokens",
1197
+ threshold: 8e3,
1198
+ action: "downgrade_quality_warning",
1199
+ reason: "Inherited from 2.5-flash guard; brain evidence on Gemini 3 long-context quality will validate/relax"
1200
+ },
1201
+ {
1202
+ metric: "tool_count",
1203
+ threshold: 20,
1204
+ action: "drop_to_top_relevant",
1205
+ reason: "Tool reliability drops above ~20 tools (despite 128 hard limit) \u2014 inherited from Flash family"
1206
+ },
1207
+ {
1208
+ metric: "thinking_with_short_output",
1209
+ threshold: 1,
1210
+ action: "force_thinking_budget_zero",
1211
+ reason: "Thinking tokens consume maxOutputTokens \u2014 empty response if drained"
1212
+ },
1213
+ {
1214
+ // Inherited from gemini-2.5-flash s11 trust artifact. Family-likely
1215
+ // failure mode for Flash architecture. Keep preemptively until brain
1216
+ // evidence on Gemini 3 specifically.
1217
+ metric: "tool_count",
1218
+ threshold: 1,
1219
+ whenIntent: "summarize",
1220
+ action: "strip_tools",
1221
+ reason: "Inherited from 2.5-flash s11 cliff: summarize+tools \u2192 empty response. Preemptive guard until brain evidence on 3-flash-preview specifically."
1222
+ }
1223
+ ],
1224
+ costInputPer1m: 0.5,
1225
+ costOutputPer1m: 3,
1226
+ lowering: {
1227
+ ...GOOGLE_LOWERING_BASE,
1228
+ // 10× cache discount per Google pricing: $0.05/M cached vs $0.50/M input.
1229
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1230
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1231
+ },
1232
+ recovery: [
1233
+ {
1234
+ signal: "empty_response_after_tool",
1235
+ action: "retry_with_params",
1236
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1237
+ maxRetries: 1,
1238
+ reason: "Known: empty after tool result \u2014 retry with thinking off"
1239
+ },
1240
+ {
1241
+ signal: "empty_response",
1242
+ action: "retry_with_params",
1243
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1244
+ maxRetries: 1,
1245
+ reason: "Empty response \u2014 try with thinking off"
1246
+ },
1247
+ {
1248
+ signal: "malformed_function_call",
1249
+ action: "escalate",
1250
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
1251
+ }
1252
+ ],
1253
+ strengths: ["speed", "volume", "classification", "1m_context", "cost"],
1254
+ weaknesses: ["complex_schemas", "large_tool_sets", "high_context_quality"],
1255
+ 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.",
1256
+ // Anchored to 2.5-flash archetypePerf as starter, with judgment adjustments
1257
+ // for Google's "step-change on agentic" positioning. Brain evidence (zero
1258
+ // rows today) will replace these starter values.
1259
+ archetypePerf: {
1260
+ hunt: 9,
1261
+ // Inherits 2.5-flash L-040 parallel-tool tier; Google positions 3 as agentic-loop upgrade
1262
+ classify: 7,
1263
+ // Inherits 2.5-flash brain-validated tier (218 rows on 2.5)
1264
+ summarize: 7,
1265
+ // Inherits 2.5-flash; cliff strips tools when present
1266
+ transform: 7,
1267
+ ask: 8,
1268
+ // +1 vs 2.5-flash — sustained-frontier positioning
1269
+ generate: 7,
1270
+ // +1 vs 2.5-flash — agentic coding upgrade per Google
1271
+ plan: 6,
1272
+ // +1 vs 2.5-flash — complex iterations per positioning
1273
+ extract: 6,
1274
+ critique: 5
1275
+ // +1 vs 2.5-flash — but still below Sonnet/Opus reasoning floor
1276
+ }
1277
+ },
1278
+ {
1279
+ // ── Gemini 3.1 Flash-Lite ──
1280
+ // Onboarded 2026-05-16 by auto-onboarder; s37 (2026-05-21) verified
1281
+ // against ai.google.dev/gemini-api/docs/pricing.
1282
+ //
1283
+ // L-081 CATCHES (template clone from 2.5-flash-lite was 2.5-3.75× too cheap):
1284
+ // costInputPer1m 0.10 → 0.25 (template clone undervalued by 2.5×)
1285
+ // costOutputPer1m 0.40 → 1.50 (template clone undervalued by 3.75×)
1286
+ //
1287
+ // Real 3.1-flash-lite is NOT a cost-equivalent successor to 2.5-flash-lite —
1288
+ // it sits between 2.5-flash-lite ($0.10/$0.40) and 2.5-flash ($0.30/$2.50).
1289
+ // Cache discount 10× verified ($0.025/M cached vs $0.25/M input).
1290
+ //
1291
+ // Cliffs are HYPOTHESIZED from 2.5-flash family; brain evidence pending.
1292
+ id: "gemini-3.1-flash-lite",
1293
+ verifiedAgainstDocs: "2026-08-27",
1294
+ provider: "google",
1295
+ // alpha.91 — docs page now labels it "Stable" and the brain row has been
1296
+ // `current` since catalog-sync moved it; the bundle lagged (the L-073
1297
+ // layer-parity shape, caught during the TT-49 delisting release).
1298
+ status: "current",
1299
+ maxContextTokens: 1048576,
1300
+ maxOutputTokens: 65536,
1301
+ maxTools: 128,
1302
+ parallelToolCalls: true,
1303
+ structuredOutput: "native",
1304
+ systemPromptMode: "separate",
1305
+ streaming: true,
1306
+ cliffs: [
1307
+ {
1308
+ metric: "input_tokens",
1309
+ threshold: 8e3,
1310
+ action: "downgrade_quality_warning",
1311
+ reason: "Inherited from Flash: quality degrades above ~8K. Smaller model \u2014 likely degrades faster. Re-tune from brain after n\u226520."
1312
+ },
1313
+ {
1314
+ metric: "tool_count",
1315
+ threshold: 10,
1316
+ action: "drop_to_top_relevant",
1317
+ reason: "Conservative: Flash drops at 20, Flash-Lite is smaller \u2014 assume tighter ceiling until brain proves otherwise."
1318
+ },
1319
+ {
1320
+ metric: "thinking_with_short_output",
1321
+ threshold: 1,
1322
+ action: "force_thinking_budget_zero",
1323
+ reason: "Thinking enabled per Google API (thinking: true). Same drain risk as Flash \u2014 thinking tokens consume maxOutputTokens."
1324
+ },
1325
+ {
1326
+ // Strong prior: Flash hit 5/5 empty rate on summarize+tools (s11
1327
+ // trust artifact, kgauto commit 3872832). Flash-Lite shares the
1328
+ // same architectural family — almost certainly inherits this cliff.
1329
+ // Ship the guard preemptively; brain telemetry confirms or relaxes.
1330
+ metric: "tool_count",
1331
+ threshold: 1,
1332
+ whenIntent: "summarize",
1333
+ action: "strip_tools",
1334
+ reason: "Inherited from Flash s11 cliff: summarize+tools \u2192 empty response. Preemptive guard until brain evidence on Flash-Lite specifically."
1335
+ }
1336
+ ],
1337
+ costInputPer1m: 0.25,
1338
+ costOutputPer1m: 1.5,
1339
+ lowering: {
1340
+ ...GOOGLE_LOWERING_BASE,
1341
+ // Cache discount 10× (vs Flash 4×) — Google docs s37: $0.025/M cached vs
1342
+ // $0.25/M input. Material for repeat-prompt workloads (classify shape).
1343
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1344
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1345
+ },
1346
+ recovery: [
1347
+ {
1348
+ signal: "empty_response_after_tool",
1349
+ action: "retry_with_params",
1350
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1351
+ maxRetries: 1,
1352
+ reason: "Known on Flash family: empty after tool result \u2014 retry with thinking off."
1353
+ },
1354
+ {
1355
+ signal: "empty_response",
1356
+ action: "retry_with_params",
1357
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1358
+ maxRetries: 1,
1359
+ reason: "Empty response \u2014 try with thinking off."
1360
+ },
1361
+ {
1362
+ signal: "malformed_function_call",
1363
+ action: "escalate",
1364
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target."
1365
+ }
1366
+ ],
1367
+ strengths: ["low_cost", "speed", "volume", "classification", "summarize", "1m_context", "cache_friendly"],
1368
+ weaknesses: ["complex_reasoning", "large_tool_sets", "complex_schemas", "structured_output_unproven", "long_context_quality"],
1369
+ 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.",
1370
+ // Tier 2-3 floor for summarize/classify chains at the new (verified) price
1371
+ // point. ZERO brain rows — values are starter hypotheses anchored to
1372
+ // "smaller sibling of Flash at higher cost than 2.5-flash-lite." The first
1373
+ // 50 brain rows per archetype will validate or relax these.
1374
+ archetypePerf: {
1375
+ classify: 6,
1376
+ // starter hypothesis — verify (Flash is 7, lite likely ≤)
1377
+ summarize: 6,
1378
+ // starter hypothesis — verify; cliff strips tools
1379
+ transform: 6,
1380
+ // starter hypothesis — verify
1381
+ ask: 5,
1382
+ hunt: 5,
1383
+ generate: 4,
1384
+ extract: 4,
1385
+ plan: 3,
1386
+ critique: 3
1387
+ }
1388
+ },
1389
+ // ─────────────────────────────────────────────────────────────────────────
1390
+ // Gemini 3.5 Flash-Lite — onboarded s91 (2026-08-27)
1391
+ //
1392
+ // The successor Google's own delisting error names: "This model
1393
+ // [gemini-2.5-flash-lite] is no longer available to new users. Please
1394
+ // update your code to use models/gemini-3.5-flash-lite" (tt-intel TT-49,
1395
+ // 2026-08-26). Same price point as the 2.5 Lite rung it replaces in the
1396
+ // summarize/classify starter chains ($0.30/$2.50 vs the old $0.10/$0.40
1397
+ // era pricing), same 1M/65K limits, same 10× cache discount ($0.03 vs
1398
+ // $0.30 input). Positioning: "fastest, most cost-effective 3.5 model for
1399
+ // high-throughput execution … high-volume agentic tasks, translation, and
1400
+ // simple data processing."
1401
+ //
1402
+ // Cliffs + archetypePerf inherited from the Flash-Lite family as starter
1403
+ // hypotheses — ZERO brain rows on this id yet; first 50 rows per archetype
1404
+ // validate or relax.
1405
+ //
1406
+ // Specs verified 2026-08-27 against:
1407
+ // ai.google.dev/gemini-api/docs/models/gemini-3.5-flash-lite
1408
+ // (Stable; input limit 1,048,576; output limit 65,536; function
1409
+ // calling / structured outputs / thinking / caching all Supported)
1410
+ // ai.google.dev/gemini-api/docs/pricing ($0.30 in / $2.50 out incl.
1411
+ // thinking tokens; context caching $0.03)
1412
+ // ─────────────────────────────────────────────────────────────────────────
1413
+ {
1414
+ id: "gemini-3.5-flash-lite",
1415
+ verifiedAgainstDocs: "2026-08-27",
1416
+ provider: "google",
1417
+ status: "current",
1418
+ maxContextTokens: 1048576,
1419
+ maxOutputTokens: 65536,
1420
+ maxTools: 128,
1421
+ parallelToolCalls: true,
1422
+ structuredOutput: "native",
1423
+ systemPromptMode: "separate",
1424
+ streaming: true,
1425
+ cliffs: [
1426
+ {
1427
+ metric: "input_tokens",
1428
+ threshold: 8e3,
1429
+ action: "downgrade_quality_warning",
1430
+ reason: "Inherited from Flash family: quality degrades above ~8K. Lite tier \u2014 assume it degrades at least as fast. Re-tune from brain after n\u226520."
1431
+ },
1432
+ {
1433
+ metric: "tool_count",
1434
+ threshold: 10,
1435
+ action: "drop_to_top_relevant",
1436
+ reason: "Conservative: Flash drops at 20, Lite tier is smaller \u2014 assume tighter ceiling until brain proves otherwise."
1437
+ },
1438
+ {
1439
+ metric: "thinking_with_short_output",
1440
+ threshold: 1,
1441
+ action: "force_thinking_budget_zero",
1442
+ reason: "Thinking Supported per model page \u2014 same drain risk as Flash; thinking tokens consume maxOutputTokens."
1443
+ },
1444
+ {
1445
+ // Strong prior: Flash hit 5/5 empty rate on summarize+tools (s11
1446
+ // trust artifact). Flash-Lite siblings carry the guard preemptively;
1447
+ // brain telemetry confirms or relaxes per id.
1448
+ metric: "tool_count",
1449
+ threshold: 1,
1450
+ whenIntent: "summarize",
1451
+ action: "strip_tools",
1452
+ reason: "Inherited from Flash s11 cliff: summarize+tools \u2192 empty response. Preemptive guard until brain evidence on 3.5 Flash-Lite specifically."
1453
+ }
1454
+ ],
1455
+ costInputPer1m: 0.3,
1456
+ costOutputPer1m: 2.5,
1457
+ lowering: {
1458
+ ...GOOGLE_LOWERING_BASE,
1459
+ // Cache discount 10× — pricing page: $0.03/M cached vs $0.30/M input.
1460
+ // Material for repeat-prompt workloads (classify shape).
1461
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1462
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1463
+ },
1464
+ recovery: [
1465
+ {
1466
+ signal: "empty_response_after_tool",
1467
+ action: "retry_with_params",
1468
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1469
+ maxRetries: 1,
1470
+ reason: "Known on Flash family: empty after tool result \u2014 retry with thinking off."
1471
+ },
1472
+ {
1473
+ signal: "empty_response",
1474
+ action: "retry_with_params",
1475
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1476
+ maxRetries: 1,
1477
+ reason: "Empty response \u2014 try with thinking off."
1478
+ },
1479
+ {
1480
+ signal: "malformed_function_call",
1481
+ action: "escalate",
1482
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target."
1483
+ }
1484
+ ],
1485
+ strengths: ["low_cost", "speed", "volume", "classification", "summarize", "1m_context", "cache_friendly"],
1486
+ weaknesses: ["complex_reasoning", "large_tool_sets", "complex_schemas", "structured_output_unproven", "long_context_quality"],
1487
+ notes: 'Onboarded s91 (2026-08-27) as the Google-named successor to availability-restricted gemini-2.5-flash-lite. $0.30/$2.50 per 1M, 1M context, 65K max output, cache $0.03/M (10\xD7 discount). "Fastest, most cost-effective 3.5 model for high-throughput execution." Cliffs hypothesized from the Flash family \u2014 brain evidence pending.',
1488
+ // Lite-tier floor for summarize/classify chains. ZERO brain rows — all
1489
+ // values are starter hypotheses anchored to the Flash-Lite family shape.
1490
+ archetypePerf: {
1491
+ classify: 6,
1492
+ // starter hypothesis — verify (Flash is 7, lite likely ≤)
1493
+ summarize: 6,
1494
+ // starter hypothesis — verify; cliff strips tools
1495
+ transform: 6,
1496
+ // starter hypothesis — verify
1497
+ ask: 5,
1498
+ hunt: 5,
1499
+ generate: 4,
1500
+ extract: 4,
1501
+ plan: 3,
1502
+ critique: 3
1503
+ }
1504
+ },
1505
+ // ─────────────────────────────────────────────────────────────────────────
1506
+ // Gemini 3.5 Flash — hand-onboarded s37 (2026-05-21)
1507
+ //
1508
+ // Google positioning ("Most intelligent for sustained frontier performance
1509
+ // on agentic and coding tasks" / "particularly effective for rapid agentic
1510
+ // loops involving complex coding cycles and iterations") suggests this is
1511
+ // the Flash-family upgrade specifically aimed at hunt-shape workloads.
1512
+ // Pricing 5× input / 3.6× output vs 2.5-flash — material cost premium.
1513
+ // archetypePerf adjusted +1 vs 2.5-flash on ask/generate/plan/critique
1514
+ // (sustained-frontier positioning); hunt held at 9 inherited from L-040
1515
+ // family parallel-tool tier; brain evidence will validate within 50 rows.
1516
+ //
1517
+ // Cliffs inherited conservatively from 2.5-flash. Google's "sustained
1518
+ // frontier on long-context" positioning suggests the 8K cliff may not
1519
+ // apply to 3.5 — keep as guard until brain evidence shows otherwise.
1520
+ //
1521
+ // Specs verified against:
1522
+ // ai.google.dev/gemini-api/docs/models/gemini-3.5-flash
1523
+ // ai.google.dev/gemini-api/docs/pricing (Standard tier)
1524
+ // ─────────────────────────────────────────────────────────────────────────
1525
+ {
1526
+ id: "gemini-3.5-flash",
1527
+ verifiedAgainstDocs: "2026-05-21",
1528
+ provider: "google",
1529
+ status: "current",
1530
+ maxContextTokens: 1048576,
1531
+ maxOutputTokens: 65536,
1532
+ maxTools: 128,
1533
+ parallelToolCalls: true,
1534
+ structuredOutput: "native",
1535
+ systemPromptMode: "separate",
1536
+ streaming: true,
1537
+ cliffs: [
1538
+ {
1539
+ metric: "input_tokens",
1540
+ threshold: 8e3,
1541
+ action: "downgrade_quality_warning",
1542
+ reason: "Inherited from 2.5-flash guard; Google positions 3.5 as sustained-frontier-on-long-context but brain evidence pending"
1543
+ },
1544
+ {
1545
+ metric: "tool_count",
1546
+ threshold: 20,
1547
+ action: "drop_to_top_relevant",
1548
+ reason: "Inherited from Flash family: tool reliability drops above ~20 (despite 128 hard limit). Validate per (archetype, model) after n\u226520."
1549
+ },
1550
+ {
1551
+ metric: "thinking_with_short_output",
1552
+ threshold: 1,
1553
+ action: "force_thinking_budget_zero",
1554
+ reason: "Thinking mode supported per Google docs; same drain risk as 2.5-flash \u2014 thinking tokens consume maxOutputTokens"
1555
+ },
1556
+ {
1557
+ // Inherited from 2.5-flash s11 trust artifact (5/5 empty rate on
1558
+ // tt-intelligence/summarize/gemini-2.5-flash with tools offered).
1559
+ // Family-likely failure mode for Flash architecture across versions.
1560
+ // Keep preemptively until brain evidence on 3.5-flash specifically.
1561
+ metric: "tool_count",
1562
+ threshold: 1,
1563
+ whenIntent: "summarize",
1564
+ action: "strip_tools",
1565
+ 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."
1566
+ }
1567
+ ],
1568
+ costInputPer1m: 1.5,
1569
+ costOutputPer1m: 9,
1570
+ lowering: {
1571
+ ...GOOGLE_LOWERING_BASE,
1572
+ // 10× cache discount per Google pricing: $0.15/M cached vs $1.50/M input.
1573
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1574
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1575
+ },
1576
+ recovery: [
1577
+ {
1578
+ signal: "empty_response_after_tool",
1579
+ action: "retry_with_params",
1580
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1581
+ maxRetries: 1,
1582
+ reason: "Inherited Flash-family pattern: empty after tool result \u2014 retry with thinking off"
1583
+ },
1584
+ {
1585
+ signal: "empty_response",
1586
+ action: "retry_with_params",
1587
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1588
+ maxRetries: 1,
1589
+ reason: "Empty response \u2014 try with thinking off"
1590
+ },
1591
+ {
1592
+ signal: "malformed_function_call",
1593
+ action: "escalate",
1594
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
1595
+ }
1596
+ ],
1597
+ strengths: ["agentic_loops", "coding", "1m_context", "parallel_tools", "thinking_mode", "sustained_frontier"],
1598
+ weaknesses: ["cost_vs_2_5_flash", "no_brain_evidence_yet"],
1599
+ 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.",
1600
+ // Starter hypothesis: anchored to 2.5-flash archetypePerf with +1
1601
+ // adjustments where Google's positioning explicitly supports
1602
+ // (agentic/coding/sustained). Hunt held at 9 inherited from L-040 family
1603
+ // parallel-tool tier. Brain evidence will replace.
1604
+ archetypePerf: {
1605
+ hunt: 9,
1606
+ // Inherited from 2.5-flash L-040 parallel-tool tier; Google positions 3.5 as agentic-loop champion
1607
+ classify: 7,
1608
+ // Inherited from 2.5-flash brain-validated tier (218 rows on 2.5)
1609
+ summarize: 7,
1610
+ // Inherited from 2.5-flash; cliff strips tools when present
1611
+ transform: 7,
1612
+ ask: 8,
1613
+ // +1 vs 2.5-flash — sustained-frontier positioning
1614
+ generate: 8,
1615
+ // +1 vs 2.5-flash (6→8) — Google: "complex coding cycles and iterations"
1616
+ plan: 7,
1617
+ // +1 vs 2.5-flash (5→7) — "complex iterations" positioning
1618
+ extract: 7,
1619
+ // +1 vs 2.5-flash — sustained-frontier on structured tasks
1620
+ critique: 5
1621
+ // +1 vs 2.5-flash — but still below Sonnet/Opus reasoning floor
1622
+ }
1623
+ },
1624
+ // ─────────────────────────────────────────────────────────────────────────
1625
+ // gemini-3.6-flash — hand-onboarded s86 (2026-08-14), step-zero against
1626
+ // Google docs (models/gemini-3.6-flash page + pricing via catalog-sync's
1627
+ // two-agreeing-extraction the same day). Docs list it as Stable and call
1628
+ // it "previous-generation Flash" (3.5-flash is now "legacy" in Google's
1629
+ // wording) — but kgauto status is 'preview' per the standing entry rule:
1630
+ // a new model enters on capability data verified only at the docs level,
1631
+ // preview is unreachable by starter chains, and promotion to routing
1632
+ // happens through brain evidence, not through Google's marketing tier.
1633
+ // This also means NO family-primary retarget rides this release.
1634
+ // ─────────────────────────────────────────────────────────────────────────
1635
+ {
1636
+ id: "gemini-3.6-flash",
1637
+ verifiedAgainstDocs: "2026-08-24",
1638
+ versionAdded: "2.0.0-alpha.87",
1639
+ provider: "google",
1640
+ status: "preview",
1641
+ maxContextTokens: 1048576,
1642
+ maxOutputTokens: 65536,
1643
+ maxTools: 128,
1644
+ parallelToolCalls: true,
1645
+ structuredOutput: "native",
1646
+ systemPromptMode: "separate",
1647
+ streaming: true,
1648
+ cliffs: [
1649
+ {
1650
+ metric: "input_tokens",
1651
+ threshold: 8e3,
1652
+ action: "downgrade_quality_warning",
1653
+ reason: "Inherited Flash-family guard (2.5\u21923.5 lineage); no 3.6 brain evidence yet"
1654
+ },
1655
+ {
1656
+ metric: "tool_count",
1657
+ threshold: 20,
1658
+ action: "drop_to_top_relevant",
1659
+ reason: "Inherited from Flash family: tool reliability drops above ~20 (despite 128 hard limit). Validate per (archetype, model) after n\u226520."
1660
+ },
1661
+ {
1662
+ metric: "thinking_with_short_output",
1663
+ threshold: 1,
1664
+ action: "force_thinking_budget_zero",
1665
+ reason: "Thinking supported per Google docs; same drain risk as 2.5/3.5-flash \u2014 thinking tokens consume maxOutputTokens"
1666
+ },
1667
+ {
1668
+ metric: "tool_count",
1669
+ threshold: 1,
1670
+ whenIntent: "summarize",
1671
+ action: "strip_tools",
1672
+ reason: "Inherited from 2.5-flash s11 cliff: summarize+tools \u2192 empty response. Preemptive family guard until brain evidence on 3.6-flash specifically."
1673
+ }
1674
+ ],
1675
+ costInputPer1m: 0.75,
1676
+ // promo through 2026-12-31; $1.50 from 2027-01-01 (TIME_BOUNDED_PRICING_ROWS carries the transition)
1677
+ costOutputPer1m: 3.75,
1678
+ // promo through 2026-12-31; $7.50 from 2027-01-01
1679
+ lowering: {
1680
+ ...GOOGLE_LOWERING_BASE,
1681
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1682
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1683
+ },
1684
+ recovery: [
1685
+ {
1686
+ signal: "empty_response_after_tool",
1687
+ action: "retry_with_params",
1688
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1689
+ maxRetries: 1,
1690
+ reason: "Inherited Flash-family pattern: empty after tool result \u2014 retry with thinking off"
1691
+ },
1692
+ {
1693
+ signal: "empty_response",
1694
+ action: "retry_with_params",
1695
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1696
+ maxRetries: 1,
1697
+ reason: "Empty response \u2014 try with thinking off"
1698
+ },
1699
+ {
1700
+ signal: "malformed_function_call",
1701
+ action: "escalate",
1702
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
1703
+ }
1704
+ ],
1705
+ strengths: ["agentic_loops", "coding", "1m_context", "parallel_tools", "thinking_mode"],
1706
+ weaknesses: ["no_brain_evidence_yet"],
1707
+ 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).",
1708
+ archetypePerf: {
1709
+ hunt: 9,
1710
+ // Flash-family parallel-tool tier (L-040); inherited from 3.5-flash
1711
+ classify: 7,
1712
+ summarize: 7,
1713
+ transform: 7,
1714
+ ask: 8,
1715
+ generate: 8,
1716
+ plan: 7,
1717
+ extract: 7,
1718
+ critique: 5
1719
+ }
1720
+ },
1721
+ {
1722
+ // Auto-onboarded 2026-07-01 from `claude-sonnet-4-6`; VERIFIED 2026-07-02
1723
+ // against the claude-api reference (cc-portfolio ratification pass). The
1724
+ // clone got context right (1M). PRICING RE-BASED 2026-08-14 (s86): the
1725
+ // introductory $2/$10 was made PERMANENT — Anthropic's pricing page now
1726
+ // states the scheduled Sept-1 increase to $3/$15 "will not occur", so
1727
+ // $2/$10 IS the sticker. (The $3/$15 encoded 07-02 was correct under the
1728
+ // time-bounded-pricing convention at the time; the bound was cancelled.) The clone got max output WRONG:
1729
+ // Sonnet 5 is 128k, not 4-6's 64k — corrected. New tokenizer (~30% more
1730
+ // tokens for the same text vs 4-6): byte-budget consumers should re-baseline.
1731
+ // API quirks (claude-api ref): (a) NON-DEFAULT temperature/top_p/top_k
1732
+ // return 400 — moot for kgauto's own call() path (ANTHROPIC_LOWERING_BASE
1733
+ // emits no sampling params) but a REAL hazard for compileForAISDKv6
1734
+ // consumers that pass temperature themselves (tt-intel scoring uses temp:0
1735
+ // for determinism — that 400s on this model; noted to consumers via the
1736
+ // contract). (b) Omitting `thinking` runs ADAPTIVE by default (4-6 ran
1737
+ // thinking-off) — output spend shifts. (c) Supports effort xhigh. status:
1738
+ // 'preview' per the Fable precedent — no brain evidence yet; promotion to
1739
+ // 'current' is an explicit call. (L-049/L-081.)
1740
+ id: "claude-sonnet-5",
1741
+ verifiedAgainstDocs: "2026-08-14",
1742
+ provider: "anthropic",
1743
+ status: "current",
1744
+ // s76 2026-07-25: GA per docs; was preview.
1745
+ maxContextTokens: 1e6,
1746
+ maxOutputTokens: 128e3,
1747
+ maxTools: 64,
1748
+ parallelToolCalls: true,
1749
+ structuredOutput: "grammar",
1750
+ systemPromptMode: "inline",
1751
+ streaming: true,
1752
+ cliffs: [],
1753
+ costInputPer1m: 2,
1754
+ // 2026-08-24: intro price made PERMANENT (docs: "the previously scheduled increase to $3/$15 on September 1, 2026 will not occur")
1755
+ costOutputPer1m: 10,
1756
+ lowering: ANTHROPIC_LOWERING_BASE,
1757
+ recovery: [
1758
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
1759
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
1760
+ ],
1761
+ strengths: ["quality", "tool_use", "long_context", "cache_friendly", "extended_thinking"],
1762
+ weaknesses: [],
1763
+ 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.",
1764
+ // Master plan §6.2 anchor. Tier 0 for plan/generate/ask/extract/transform
1765
+ // in starter chains; tier 1 cross-provider for hunt/summarize/classify.
1766
+ archetypePerf: {
1767
+ ask: 9,
1768
+ generate: 9,
1769
+ plan: 9,
1770
+ critique: 9,
1771
+ extract: 9,
1772
+ transform: 9,
1773
+ hunt: 7,
1774
+ // strong but Flash beats on parallel tool throughput
1775
+ summarize: 8,
1776
+ // overkill for tolerant archetype
1777
+ classify: 8
1778
+ // overkill
1779
+ }
1780
+ },
1781
+ // ── Z.ai (GLM) ──
1782
+ // alpha.65 (2026-07-18): first Z.ai profile, provider `zai` added same
1783
+ // release. Step-zero sources (L-049/L-081, all fetched 2026-07-18):
1784
+ // docs.z.ai/guides/llm/glm-5.2 (capabilities), docs.z.ai api-reference
1785
+ // chat-completion (wire params: thinking.type enabled|disabled default
1786
+ // enabled, reasoning_effort max..none, tool_stream, max output 131072),
1787
+ // docs.z.ai/guides/overview/pricing ($1.4 in / $4.4 out, cached input
1788
+ // $0.26, cache storage limited-time free), vLLM recipe (native ctx
1789
+ // 1,048,576). NO AI-trained numbers.
1790
+ {
1791
+ id: "glm-5.2",
1792
+ verifiedAgainstDocs: "2026-07-18",
1793
+ provider: "zai",
1794
+ status: "preview",
1795
+ maxContextTokens: 1048576,
1796
+ maxOutputTokens: 131072,
1797
+ // No documented tool-count cap — conservative default pending measured
1798
+ // evidence; matches the deepseek posture, not a doc number.
1799
+ maxTools: 16,
1800
+ // Hosted-API docs document tools + tool_choice + tool_stream but say
1801
+ // NOTHING about multiple tool_calls per response. Conservative false so
1802
+ // hunt-shaped ranking doesn't over-promise; flip on doc or probe
1803
+ // evidence (L-081: undocumented ≠ true).
1804
+ parallelToolCalls: false,
1805
+ structuredOutput: "native",
1806
+ systemPromptMode: "inline",
1807
+ streaming: true,
1808
+ cliffs: [],
1809
+ costInputPer1m: 1.4,
1810
+ costOutputPer1m: 4.4,
1811
+ lowering: {
1812
+ system: { mode: "inline" },
1813
+ // Automatic prefix caching ("intelligent caching mechanism") — no wire
1814
+ // marker to emit, DeepSeek-style. Cache-hit input $0.26/M (~0.19× of
1815
+ // miss) tracked in notes; storage limited-time free as of 2026-07-18.
1816
+ cache: { strategy: "unsupported" },
1817
+ tools: { format: "openai" },
1818
+ // thinking.type: 'enabled' (server default) | 'disabled'. lowerZai
1819
+ // emits an explicit disable only on forceThinkingZero cliffs.
1820
+ thinking: { field: "thinking.type", default: "auto" }
1821
+ },
1822
+ recovery: [
1823
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
1824
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
1825
+ ],
1826
+ strengths: ["cost", "1m_context", "code", "tool_use", "json_output", "reasoning"],
1827
+ weaknesses: ["parallel_tools"],
1828
+ 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.",
1829
+ // Starter hypotheses — verify with telemetry/probes; NO brain evidence
1830
+ // yet. Anchored on the vendor's agentic-coding positioning at a
1831
+ // mid-cost tier, discounted for the unproven parallel-tool story.
1832
+ archetypePerf: {
1833
+ generate: 7,
1834
+ // agentic-coding positioning — starter hypothesis
1835
+ transform: 7,
1836
+ // starter hypothesis
1837
+ plan: 7,
1838
+ // starter hypothesis
1839
+ summarize: 7,
1840
+ // tolerant archetype — starter hypothesis
1841
+ ask: 6,
1842
+ extract: 6,
1843
+ critique: 6,
1844
+ classify: 6,
1845
+ hunt: 5
1846
+ // tools work; parallel unproven → discounted
1847
+ }
1848
+ },
1849
+ // ── Moonshot (Kimi) ──
1850
+ // alpha.65 (2026-07-18): first Moonshot profile, provider `moonshot` added
1851
+ // same release. Step-zero sources (all fetched 2026-07-18):
1852
+ // platform.kimi.ai/docs/pricing/chat-k3 ($3.00 cache-miss in / $0.30
1853
+ // cache-hit in / $15.00 out; 1,048,576 ctx; ToolCalls + JSON Mode +
1854
+ // Partial Mode), kimi-k3-quickstart (max_completion_tokens default
1855
+ // 131072, up to 1,048,576; base https://api.moonshot.ai/v1; vision via
1856
+ // base64 or ms://file-id, NO public image URLs), models-overview
1857
+ // (temperature FIXED 1.0, top_p FIXED 0.95, n FIXED 1, always reasons,
1858
+ // reasoning_effort 'max' only), tool-calls guide ("can choose to call
1859
+ // multiple tools at once … will tend to call them in parallel").
1860
+ {
1861
+ id: "kimi-k3",
1862
+ verifiedAgainstDocs: "2026-07-18",
1863
+ provider: "moonshot",
1864
+ status: "preview",
1865
+ maxContextTokens: 1048576,
1866
+ // Documented ceiling; default is 131,072 when unset.
1867
+ maxOutputTokens: 1048576,
1868
+ // No hard doc cap; docs recommend dynamic tool loading at "dozens or
1869
+ // hundreds" — 64 matches the frontier-agentic posture (sonnet-5 tier).
1870
+ maxTools: 64,
1871
+ parallelToolCalls: true,
1872
+ structuredOutput: "native",
1873
+ systemPromptMode: "inline",
1874
+ streaming: true,
1875
+ cliffs: [],
1876
+ costInputPer1m: 3,
1877
+ costOutputPer1m: 15,
1878
+ lowering: {
1879
+ system: { mode: "inline" },
1880
+ // Automatic context caching — no wire marker. Cache-hit input $0.30/M
1881
+ // (0.1× of miss) tracked in notes.
1882
+ cache: { strategy: "unsupported" },
1883
+ tools: { format: "openai" }
1884
+ // No thinking knob: reasoning is always-on and reasoning_effort
1885
+ // accepts only 'max' (= the server default). Nothing to lower.
1886
+ },
1887
+ recovery: [
1888
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
1889
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
1890
+ ],
1891
+ strengths: ["quality", "reasoning", "1m_context", "parallel_tools", "tool_use", "code", "vision"],
1892
+ // 'latency' → latencyTierOf derives 'slow': always-on max-effort
1893
+ // reasoner with no off switch; no measured p50 yet, the tag is the
1894
+ // honest prior (reasoner family precedent: deepseek-v4-pro ~48s).
1895
+ weaknesses: ["cost", "latency"],
1896
+ 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.",
1897
+ // Starter hypotheses — verify with telemetry/probes; NO brain evidence
1898
+ // yet. Anchored on documented long-horizon-agentic + parallel-tool
1899
+ // strengths; discounted on terse archetypes where always-on reasoning
1900
+ // bills $15/M output for thinking the archetype doesn't need.
1901
+ archetypePerf: {
1902
+ hunt: 8,
1903
+ // parallel tools + long-horizon agentic — starter hypothesis
1904
+ plan: 8,
1905
+ // starter hypothesis
1906
+ generate: 8,
1907
+ // starter hypothesis
1908
+ critique: 7,
1909
+ ask: 7,
1910
+ extract: 7,
1911
+ transform: 7,
1912
+ summarize: 6,
1913
+ // works, but $15/M output reasoning tax on a tolerant archetype
1914
+ classify: 5
1915
+ // always-on reasoning cost + reasoner hedge risk
1916
+ },
1917
+ // Diagnostics-only (no prompt rewrite): reasoner-family hedge risk on
1918
+ // decisive archetypes, carried as a warning until K3-specific probe
1919
+ // evidence exists. The deepseek-reasoner family showed 8/10 judge
1920
+ // rationales citing hedging on classify (exclusion-finding ID 20,
1921
+ // 2026-05-28); K3 is an always-on reasoner and inherits the risk class,
1922
+ // not the conviction.
1923
+ archetypeConventions: [
1924
+ {
1925
+ archetype: "classify",
1926
+ 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.",
1927
+ 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."
1928
+ }
1929
+ ]
1930
+ }
1931
+ ];
1932
+ var ALIASES = {
1933
+ // DeepSeek's own model routing — both names served by V4-Flash.
1934
+ "deepseek-chat": "deepseek-v4-flash",
1935
+ "deepseek-reasoner": "deepseek-v4-flash",
1936
+ // Legacy kgauto typo — actual API alias is dash-form (alpha.1 had dot).
1937
+ "claude-haiku-4.5": "claude-haiku-4-5"
1938
+ };
1939
+ var brainHook = {};
1940
+ function _setProfileBrainHook(hook) {
1941
+ brainHook = hook;
1942
+ }
1943
+ function canonicalId(id) {
1944
+ return brainHook.resolveAlias?.(id) ?? ALIASES[id] ?? id;
1945
+ }
1946
+ var CONSUMER_INDEX = /* @__PURE__ */ new Map();
1947
+ function registerProfiles(profiles) {
1948
+ for (const p of profiles) CONSUMER_INDEX.set(p.id, p);
1949
+ }
1950
+ function _testClearConsumerProfiles() {
1951
+ CONSUMER_INDEX.clear();
1952
+ }
1953
+ function inferProviderFromId(id) {
1954
+ const lower = id.toLowerCase();
1955
+ if (lower.startsWith("claude")) return "anthropic";
1956
+ if (lower.startsWith("gemini") || lower.startsWith("palm")) return "google";
1957
+ if (lower.startsWith("gpt") || /^o[0-9]/.test(lower) || lower.startsWith("chatgpt")) return "openai";
1958
+ if (lower.startsWith("deepseek")) return "deepseek";
1959
+ if (lower.startsWith("glm")) return "zai";
1960
+ if (lower.startsWith("kimi") || lower.startsWith("moonshot")) return "moonshot";
1961
+ return void 0;
1962
+ }
1963
+ function bestEffortProfile(id) {
1964
+ const canonical = canonicalId(id);
1965
+ const existing = tryGetProfile(canonical);
1966
+ if (existing) return existing;
1967
+ const provider = inferProviderFromId(canonical);
1968
+ if (!provider) return void 0;
1969
+ const donor = PROFILES_RAW.find((p) => p.provider === provider && p.status === "current") ?? PROFILES_RAW.find((p) => p.provider === provider);
1970
+ if (!donor) return void 0;
1971
+ const synth = {
1972
+ id: canonical,
1973
+ provider,
1974
+ bestEffort: true,
1975
+ status: "preview",
1976
+ maxContextTokens: 128e3,
1977
+ maxOutputTokens: 4096,
1978
+ maxTools: donor.maxTools,
1979
+ parallelToolCalls: false,
1980
+ structuredOutput: "none",
1981
+ systemPromptMode: donor.systemPromptMode,
1982
+ streaming: donor.streaming,
1983
+ cliffs: [],
1984
+ costInputPer1m: 0,
1985
+ costOutputPer1m: 0,
1986
+ lowering: donor.lowering,
1987
+ recovery: [],
1988
+ strengths: [],
1989
+ weaknesses: ["best-effort synthesized profile \u2014 no verified capability data"],
1990
+ 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.`
1991
+ };
1992
+ CONSUMER_INDEX.set(canonical, synth);
1993
+ return synth;
1994
+ }
1995
+ function resolveModelAlias(id) {
1996
+ return canonicalId(id);
1997
+ }
1998
+ var PROFILE_INDEX = new Map(
1999
+ PROFILES_RAW.map((p) => [p.id, p])
2000
+ );
2001
+ function getProfile(id) {
2002
+ const canonical = canonicalId(id);
2003
+ const fromConsumer = CONSUMER_INDEX.get(canonical);
2004
+ if (fromConsumer) return fromConsumer;
2005
+ const fromBrain = brainHook.getProfile?.(canonical);
2006
+ if (fromBrain) return fromBrain;
2007
+ const p = PROFILE_INDEX.get(canonical);
2008
+ if (!p) {
2009
+ const known = [...PROFILE_INDEX.keys(), ...Object.keys(ALIASES)].join(", ");
2010
+ throw new Error(
2011
+ `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).`
2012
+ );
2013
+ }
2014
+ return p;
2015
+ }
2016
+ function tryGetProfile(id) {
2017
+ const canonical = canonicalId(id);
2018
+ return CONSUMER_INDEX.get(canonical) ?? brainHook.getProfile?.(canonical) ?? PROFILE_INDEX.get(canonical);
2019
+ }
2020
+ function allProfiles() {
2021
+ return PROFILES_RAW;
2022
+ }
2023
+ function allProfilesRaw() {
673
2024
  return PROFILES_RAW;
674
2025
  }
675
2026
  function profilesByProvider(provider) {
@@ -678,8 +2029,17 @@ function profilesByProvider(provider) {
678
2029
  // Annotate the CommonJS export names for ESM import in node:
679
2030
  0 && (module.exports = {
680
2031
  ALIASES,
2032
+ LATENCY_TIER_MS,
2033
+ _setProfileBrainHook,
2034
+ _testClearConsumerProfiles,
681
2035
  allProfiles,
2036
+ allProfilesRaw,
2037
+ bestEffortProfile,
682
2038
  getProfile,
2039
+ inferProviderFromId,
2040
+ latencyTierOf,
683
2041
  profilesByProvider,
2042
+ registerProfiles,
2043
+ resolveModelAlias,
684
2044
  tryGetProfile
685
2045
  });