@warmdrift/kgauto-compiler 2.0.0-alpha.86 → 2.0.0-alpha.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/profiles.js CHANGED
@@ -23,11 +23,15 @@ __export(profiles_exports, {
23
23
  ALIASES: () => ALIASES,
24
24
  LATENCY_TIER_MS: () => LATENCY_TIER_MS,
25
25
  _setProfileBrainHook: () => _setProfileBrainHook,
26
+ _testClearConsumerProfiles: () => _testClearConsumerProfiles,
26
27
  allProfiles: () => allProfiles,
27
28
  allProfilesRaw: () => allProfilesRaw,
29
+ bestEffortProfile: () => bestEffortProfile,
28
30
  getProfile: () => getProfile,
31
+ inferProviderFromId: () => inferProviderFromId,
29
32
  latencyTierOf: () => latencyTierOf,
30
33
  profilesByProvider: () => profilesByProvider,
34
+ registerProfiles: () => registerProfiles,
31
35
  resolveModelAlias: () => resolveModelAlias,
32
36
  tryGetProfile: () => tryGetProfile
33
37
  });
@@ -244,7 +248,7 @@ var PROFILES_RAW = [
244
248
  },
245
249
  {
246
250
  id: "claude-opus-4-7",
247
- verifiedAgainstDocs: "2026-05-08",
251
+ verifiedAgainstDocs: "2026-08-14",
248
252
  provider: "anthropic",
249
253
  status: "legacy",
250
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.
@@ -294,7 +298,7 @@ var PROFILES_RAW = [
294
298
  },
295
299
  {
296
300
  id: "claude-opus-4-6",
297
- verifiedAgainstDocs: "2026-05-08",
301
+ verifiedAgainstDocs: "2026-08-14",
298
302
  provider: "anthropic",
299
303
  status: "legacy",
300
304
  maxContextTokens: 1e6,
@@ -339,7 +343,7 @@ var PROFILES_RAW = [
339
343
  },
340
344
  {
341
345
  id: "claude-sonnet-4-6",
342
- verifiedAgainstDocs: "2026-05-08",
346
+ verifiedAgainstDocs: "2026-08-14",
343
347
  provider: "anthropic",
344
348
  status: "legacy",
345
349
  // s76 2026-07-25: docs list as LEGACY (Sonnet 5 is current).
@@ -380,7 +384,7 @@ var PROFILES_RAW = [
380
384
  },
381
385
  {
382
386
  id: "claude-haiku-4-5",
383
- verifiedAgainstDocs: "2026-05-08",
387
+ verifiedAgainstDocs: "2026-08-14",
384
388
  provider: "anthropic",
385
389
  status: "current",
386
390
  maxContextTokens: 2e5,
@@ -443,7 +447,7 @@ var PROFILES_RAW = [
443
447
  // ── Google ──
444
448
  {
445
449
  id: "gemini-2.5-flash",
446
- verifiedAgainstDocs: "2026-05-08",
450
+ verifiedAgainstDocs: "2026-08-14",
447
451
  provider: "google",
448
452
  status: "current",
449
453
  maxContextTokens: 1048576,
@@ -549,7 +553,7 @@ var PROFILES_RAW = [
549
553
  // thresholds. The brain will validate/relax these as evidence accumulates
550
554
  // per (archetype, model) tuple. Currently ZERO brain rows for this model.
551
555
  id: "gemini-2.5-flash-lite",
552
- verifiedAgainstDocs: "2026-05-13",
556
+ verifiedAgainstDocs: "2026-08-14",
553
557
  provider: "google",
554
558
  status: "current",
555
559
  maxContextTokens: 1048576,
@@ -706,7 +710,7 @@ var PROFILES_RAW = [
706
710
  },
707
711
  {
708
712
  id: "gemini-3.1-pro-preview",
709
- verifiedAgainstDocs: "2026-05-08",
713
+ verifiedAgainstDocs: "2026-08-14",
710
714
  provider: "google",
711
715
  status: "preview",
712
716
  maxContextTokens: 1048576,
@@ -766,7 +770,7 @@ var PROFILES_RAW = [
766
770
  // deepseek-reasoner registered as aliases (see ALIASES below).
767
771
  {
768
772
  id: "deepseek-v4-flash",
769
- verifiedAgainstDocs: "2026-05-08",
773
+ verifiedAgainstDocs: "2026-08-14",
770
774
  provider: "deepseek",
771
775
  status: "current",
772
776
  maxContextTokens: 1e6,
@@ -804,7 +808,7 @@ var PROFILES_RAW = [
804
808
  // baseQuality (it carries 'reasoning') with no latency counterweight,
805
809
  // leapfrogged gemini-2.5-flash as PB's summarize leader once reachable.
806
810
  latencyTier: "slow",
807
- 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.",
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. PRICING MODEL CHANGE effective 2026-08-16: DeepSeek moves to peak/off-peak billing, off-peak at HALF the peak rate (docs, fetched 2026-08-14). Encoded prices are peak; cost math for off-peak traffic will overstate by up to 2x until time-of-day pricing is modeled.",
808
812
  // Master plan §6.2 anchor. Brain-validated tier 1 cross-provider for
809
813
  // classify (169 rows, 0% empty). Tier 0 for summarize-with-no-tools.
810
814
  // Falls off on hunt (sequential tools — L-040) and reasoning depth.
@@ -839,7 +843,7 @@ var PROFILES_RAW = [
839
843
  },
840
844
  {
841
845
  id: "deepseek-v4-pro",
842
- verifiedAgainstDocs: "2026-06-22",
846
+ verifiedAgainstDocs: "2026-08-14",
843
847
  provider: "deepseek",
844
848
  status: "current",
845
849
  maxContextTokens: 1e6,
@@ -880,7 +884,7 @@ var PROFILES_RAW = [
880
884
  // of the served set. Tag derivation would say 'medium'; the measurement says
881
885
  // otherwise.
882
886
  latencyTier: "slow",
883
- 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.",
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. PRICING MODEL CHANGE effective 2026-08-16: DeepSeek moves to peak/off-peak billing, off-peak at HALF the peak rate (docs, fetched 2026-08-14). Encoded prices are peak; cost math for off-peak traffic will overstate by up to 2x until time-of-day pricing is modeled.",
884
888
  // Master plan §3.3: tier 3 cross-provider for plan chain. Reasoning
885
889
  // bumped one notch over V4-Flash; same parallel-tool ceiling.
886
890
  archetypePerf: {
@@ -1488,13 +1492,109 @@ var PROFILES_RAW = [
1488
1492
  // +1 vs 2.5-flash — but still below Sonnet/Opus reasoning floor
1489
1493
  }
1490
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-14",
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: 1.5,
1547
+ costOutputPer1m: 7.5,
1548
+ lowering: {
1549
+ ...GOOGLE_LOWERING_BASE,
1550
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1551
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1552
+ },
1553
+ recovery: [
1554
+ {
1555
+ signal: "empty_response_after_tool",
1556
+ action: "retry_with_params",
1557
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1558
+ maxRetries: 1,
1559
+ reason: "Inherited Flash-family pattern: empty after tool result \u2014 retry with thinking off"
1560
+ },
1561
+ {
1562
+ signal: "empty_response",
1563
+ action: "retry_with_params",
1564
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1565
+ maxRetries: 1,
1566
+ reason: "Empty response \u2014 try with thinking off"
1567
+ },
1568
+ {
1569
+ signal: "malformed_function_call",
1570
+ action: "escalate",
1571
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
1572
+ }
1573
+ ],
1574
+ strengths: ["agentic_loops", "coding", "1m_context", "parallel_tools", "thinking_mode"],
1575
+ weaknesses: ["no_brain_evidence_yet"],
1576
+ notes: "Hand-onboarded s86 (2026-08-14), step-zero verified: 1,048,576 ctx / 65,536 out (Google model page), $1.50/$7.50 per 1M (catalog-sync two-agreeing-extraction same day \u2014 CHEAPER output than 3.5-flash at $9.00). 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; sat in the onboarding queue 18 days \u2014 drained by the s86 catalog-sync run.",
1577
+ archetypePerf: {
1578
+ hunt: 9,
1579
+ // Flash-family parallel-tool tier (L-040); inherited from 3.5-flash
1580
+ classify: 7,
1581
+ summarize: 7,
1582
+ transform: 7,
1583
+ ask: 8,
1584
+ generate: 8,
1585
+ plan: 7,
1586
+ extract: 7,
1587
+ critique: 5
1588
+ }
1589
+ },
1491
1590
  {
1492
1591
  // Auto-onboarded 2026-07-01 from `claude-sonnet-4-6`; VERIFIED 2026-07-02
1493
1592
  // against the claude-api reference (cc-portfolio ratification pass). The
1494
- // clone got context right (1M) and pricing right at sticker ($3/$15
1495
- // NOTE an introductory $2/$10 per MTok runs through 2026-08-31; sticker
1496
- // encoded here per the time-bounded-pricing convention, intro belongs in
1497
- // brain kgauto_pricing if worth capturing). The clone got max output WRONG:
1593
+ // clone got context right (1M). PRICING RE-BASED 2026-08-14 (s86): the
1594
+ // introductory $2/$10 was made PERMANENT Anthropic's pricing page now
1595
+ // states the scheduled Sept-1 increase to $3/$15 "will not occur", so
1596
+ // $2/$10 IS the sticker. (The $3/$15 encoded 07-02 was correct under the
1597
+ // time-bounded-pricing convention at the time; the bound was cancelled.) The clone got max output WRONG:
1498
1598
  // Sonnet 5 is 128k, not 4-6's 64k — corrected. New tokenizer (~30% more
1499
1599
  // tokens for the same text vs 4-6): byte-budget consumers should re-baseline.
1500
1600
  // API quirks (claude-api ref): (a) NON-DEFAULT temperature/top_p/top_k
@@ -1507,7 +1607,7 @@ var PROFILES_RAW = [
1507
1607
  // 'preview' per the Fable precedent — no brain evidence yet; promotion to
1508
1608
  // 'current' is an explicit call. (L-049/L-081.)
1509
1609
  id: "claude-sonnet-5",
1510
- verifiedAgainstDocs: "2026-07-02",
1610
+ verifiedAgainstDocs: "2026-08-14",
1511
1611
  provider: "anthropic",
1512
1612
  status: "current",
1513
1613
  // s76 2026-07-25: GA per docs; was preview.
@@ -1519,8 +1619,9 @@ var PROFILES_RAW = [
1519
1619
  systemPromptMode: "inline",
1520
1620
  streaming: true,
1521
1621
  cliffs: [],
1522
- costInputPer1m: 3,
1523
- costOutputPer1m: 15,
1622
+ costInputPer1m: 2,
1623
+ // 2026-08-14: intro price made PERMANENT (docs: "the previously scheduled increase to $3/$15 on September 1, 2026 will not occur")
1624
+ costOutputPer1m: 10,
1524
1625
  lowering: ANTHROPIC_LOWERING_BASE,
1525
1626
  recovery: [
1526
1627
  { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
@@ -1711,6 +1812,55 @@ function _setProfileBrainHook(hook) {
1711
1812
  function canonicalId(id) {
1712
1813
  return brainHook.resolveAlias?.(id) ?? ALIASES[id] ?? id;
1713
1814
  }
1815
+ var CONSUMER_INDEX = /* @__PURE__ */ new Map();
1816
+ function registerProfiles(profiles) {
1817
+ for (const p of profiles) CONSUMER_INDEX.set(p.id, p);
1818
+ }
1819
+ function _testClearConsumerProfiles() {
1820
+ CONSUMER_INDEX.clear();
1821
+ }
1822
+ function inferProviderFromId(id) {
1823
+ const lower = id.toLowerCase();
1824
+ if (lower.startsWith("claude")) return "anthropic";
1825
+ if (lower.startsWith("gemini") || lower.startsWith("palm")) return "google";
1826
+ if (lower.startsWith("gpt") || /^o[0-9]/.test(lower) || lower.startsWith("chatgpt")) return "openai";
1827
+ if (lower.startsWith("deepseek")) return "deepseek";
1828
+ if (lower.startsWith("glm")) return "zai";
1829
+ if (lower.startsWith("kimi") || lower.startsWith("moonshot")) return "moonshot";
1830
+ return void 0;
1831
+ }
1832
+ function bestEffortProfile(id) {
1833
+ const canonical = canonicalId(id);
1834
+ const existing = tryGetProfile(canonical);
1835
+ if (existing) return existing;
1836
+ const provider = inferProviderFromId(canonical);
1837
+ if (!provider) return void 0;
1838
+ const donor = PROFILES_RAW.find((p) => p.provider === provider && p.status === "current") ?? PROFILES_RAW.find((p) => p.provider === provider);
1839
+ if (!donor) return void 0;
1840
+ const synth = {
1841
+ id: canonical,
1842
+ provider,
1843
+ bestEffort: true,
1844
+ status: "preview",
1845
+ maxContextTokens: 128e3,
1846
+ maxOutputTokens: 4096,
1847
+ maxTools: donor.maxTools,
1848
+ parallelToolCalls: false,
1849
+ structuredOutput: "none",
1850
+ systemPromptMode: donor.systemPromptMode,
1851
+ streaming: donor.streaming,
1852
+ cliffs: [],
1853
+ costInputPer1m: 0,
1854
+ costOutputPer1m: 0,
1855
+ lowering: donor.lowering,
1856
+ recovery: [],
1857
+ strengths: [],
1858
+ weaknesses: ["best-effort synthesized profile \u2014 no verified capability data"],
1859
+ 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.`
1860
+ };
1861
+ CONSUMER_INDEX.set(canonical, synth);
1862
+ return synth;
1863
+ }
1714
1864
  function resolveModelAlias(id) {
1715
1865
  return canonicalId(id);
1716
1866
  }
@@ -1719,18 +1869,22 @@ var PROFILE_INDEX = new Map(
1719
1869
  );
1720
1870
  function getProfile(id) {
1721
1871
  const canonical = canonicalId(id);
1872
+ const fromConsumer = CONSUMER_INDEX.get(canonical);
1873
+ if (fromConsumer) return fromConsumer;
1722
1874
  const fromBrain = brainHook.getProfile?.(canonical);
1723
1875
  if (fromBrain) return fromBrain;
1724
1876
  const p = PROFILE_INDEX.get(canonical);
1725
1877
  if (!p) {
1726
1878
  const known = [...PROFILE_INDEX.keys(), ...Object.keys(ALIASES)].join(", ");
1727
- throw new Error(`Unknown model id: "${id}". Known: ${known}`);
1879
+ throw new Error(
1880
+ `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).`
1881
+ );
1728
1882
  }
1729
1883
  return p;
1730
1884
  }
1731
1885
  function tryGetProfile(id) {
1732
1886
  const canonical = canonicalId(id);
1733
- return brainHook.getProfile?.(canonical) ?? PROFILE_INDEX.get(canonical);
1887
+ return CONSUMER_INDEX.get(canonical) ?? brainHook.getProfile?.(canonical) ?? PROFILE_INDEX.get(canonical);
1734
1888
  }
1735
1889
  function allProfiles() {
1736
1890
  return PROFILES_RAW;
@@ -1746,11 +1900,15 @@ function profilesByProvider(provider) {
1746
1900
  ALIASES,
1747
1901
  LATENCY_TIER_MS,
1748
1902
  _setProfileBrainHook,
1903
+ _testClearConsumerProfiles,
1749
1904
  allProfiles,
1750
1905
  allProfilesRaw,
1906
+ bestEffortProfile,
1751
1907
  getProfile,
1908
+ inferProviderFromId,
1752
1909
  latencyTierOf,
1753
1910
  profilesByProvider,
1911
+ registerProfiles,
1754
1912
  resolveModelAlias,
1755
1913
  tryGetProfile
1756
1914
  });
package/dist/profiles.mjs CHANGED
@@ -2,23 +2,31 @@ import {
2
2
  ALIASES,
3
3
  LATENCY_TIER_MS,
4
4
  _setProfileBrainHook,
5
+ _testClearConsumerProfiles,
5
6
  allProfiles,
6
7
  allProfilesRaw,
8
+ bestEffortProfile,
7
9
  getProfile,
10
+ inferProviderFromId,
8
11
  latencyTierOf,
9
12
  profilesByProvider,
13
+ registerProfiles,
10
14
  resolveModelAlias,
11
15
  tryGetProfile
12
- } from "./chunk-2MQIVVEU.mjs";
16
+ } from "./chunk-YVKTTTTB.mjs";
13
17
  export {
14
18
  ALIASES,
15
19
  LATENCY_TIER_MS,
16
20
  _setProfileBrainHook,
21
+ _testClearConsumerProfiles,
17
22
  allProfiles,
18
23
  allProfilesRaw,
24
+ bestEffortProfile,
19
25
  getProfile,
26
+ inferProviderFromId,
20
27
  latencyTierOf,
21
28
  profilesByProvider,
29
+ registerProfiles,
22
30
  resolveModelAlias,
23
31
  tryGetProfile
24
32
  };
@@ -1,4 +1,4 @@
1
- import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-5TJLAYKR.mjs';
1
+ import { t as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, n as CallAttempt } from './ir-P3NEU8z4.mjs';
2
2
 
3
3
  /**
4
4
  * Glass-Box observability types (alpha.17).
@@ -1,4 +1,4 @@
1
- import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-C1zmvAh6.js';
1
+ import { t as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, n as CallAttempt } from './ir-ZgN2KkuF.js';
2
2
 
3
3
  /**
4
4
  * Glass-Box observability types (alpha.17).
@@ -1,4 +1,4 @@
1
- import { i as Adapter, F as FallbackReason, x as SectionKind } from './ir-C1zmvAh6.js';
1
+ import { j as Adapter, F as FallbackReason, y as SectionKind } from './ir-ZgN2KkuF.js';
2
2
 
3
3
  /**
4
4
  * Wire contract for the Glass-Box Chrome extension's brain-poll endpoint.
@@ -1,4 +1,4 @@
1
- import { i as Adapter, F as FallbackReason, x as SectionKind } from './ir-5TJLAYKR.mjs';
1
+ import { j as Adapter, F as FallbackReason, y as SectionKind } from './ir-P3NEU8z4.mjs';
2
2
 
3
3
  /**
4
4
  * Wire contract for the Glass-Box Chrome extension's brain-poll endpoint.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmdrift/kgauto-compiler",
3
- "version": "2.0.0-alpha.86",
3
+ "version": "2.0.0-alpha.87",
4
4
  "description": "Prompt compiler with executable provider knowledge for multi-model AI apps: normalized multi-provider transport with fallback chains, compile-time cliff guards, a curated model registry, and a telemetry flight recorder. Swap models without rewriting prompts.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -77,6 +77,12 @@
77
77
  "model-fallback"
78
78
  ],
79
79
  "license": "MIT",
80
+ "repository": {
81
+ "type": "git",
82
+ "url": "git+https://github.com/stue/kgauto.git",
83
+ "directory": "v2"
84
+ },
85
+ "homepage": "https://github.com/stue/kgauto/tree/main/v2#readme",
80
86
  "peerDependencies": {
81
87
  "js-tiktoken": ">=1.0.0",
82
88
  "react": ">=18.0.0",
@@ -103,4 +109,4 @@
103
109
  "typescript": "^5.7.0",
104
110
  "vitest": "^3.1.0"
105
111
  }
106
- }
112
+ }