@warmdrift/kgauto-compiler 2.0.0-alpha.64 → 2.0.0-alpha.66
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/{chunk-QKXTMVCT.mjs → chunk-4UO4CCSP.mjs} +150 -0
- package/dist/{chunk-DGPYLFDG.mjs → chunk-CMB6PZWS.mjs} +14 -1
- package/dist/{chunk-YZRPNSSQ.mjs → chunk-SBFSYCQG.mjs} +18 -3
- package/dist/glassbox/index.d.mts +3 -3
- package/dist/glassbox/index.d.ts +3 -3
- package/dist/glassbox-routes/format.d.mts +2 -2
- package/dist/glassbox-routes/format.d.ts +2 -2
- package/dist/glassbox-routes/index.d.mts +4 -4
- package/dist/glassbox-routes/index.d.ts +4 -4
- package/dist/glassbox-routes/index.js +162 -2
- package/dist/glassbox-routes/index.mjs +2 -2
- package/dist/glassbox-routes/react/index.d.mts +2 -2
- package/dist/glassbox-routes/react/index.d.ts +2 -2
- package/dist/index.d.mts +23 -4
- package/dist/index.d.ts +23 -4
- package/dist/index.js +366 -14
- package/dist/index.mjs +190 -14
- package/dist/{ir-B2dRyJXO.d.mts → ir-BTvyl8-w.d.mts} +75 -1
- package/dist/{ir-ClU56aBc.d.ts → ir-Qnw6L265.d.ts} +75 -1
- package/dist/key-health.d.mts +1 -1
- package/dist/key-health.d.ts +1 -1
- package/dist/key-health.js +14 -1
- package/dist/key-health.mjs +1 -1
- package/dist/profiles.d.mts +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +150 -0
- package/dist/profiles.mjs +1 -1
- package/dist/{types-axAX1Bg0.d.mts → types-8pWRDbUg.d.mts} +1 -1
- package/dist/{types-C-Wp7HpI.d.ts → types-BdYlJz0Z.d.ts} +1 -1
- package/dist/{types-CSDweZsl.d.mts → types-Cya0jPAF.d.mts} +1 -1
- package/dist/{types-ByN3r0_7.d.ts → types-DxYXuFxj.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1413,6 +1413,156 @@ var PROFILES_RAW = [
|
|
|
1413
1413
|
classify: 8
|
|
1414
1414
|
// overkill
|
|
1415
1415
|
}
|
|
1416
|
+
},
|
|
1417
|
+
// ── Z.ai (GLM) ──
|
|
1418
|
+
// alpha.65 (2026-07-18): first Z.ai profile, provider `zai` added same
|
|
1419
|
+
// release. Step-zero sources (L-049/L-081, all fetched 2026-07-18):
|
|
1420
|
+
// docs.z.ai/guides/llm/glm-5.2 (capabilities), docs.z.ai api-reference
|
|
1421
|
+
// chat-completion (wire params: thinking.type enabled|disabled default
|
|
1422
|
+
// enabled, reasoning_effort max..none, tool_stream, max output 131072),
|
|
1423
|
+
// docs.z.ai/guides/overview/pricing ($1.4 in / $4.4 out, cached input
|
|
1424
|
+
// $0.26, cache storage limited-time free), vLLM recipe (native ctx
|
|
1425
|
+
// 1,048,576). NO AI-trained numbers.
|
|
1426
|
+
{
|
|
1427
|
+
id: "glm-5.2",
|
|
1428
|
+
verifiedAgainstDocs: "2026-07-18",
|
|
1429
|
+
provider: "zai",
|
|
1430
|
+
status: "preview",
|
|
1431
|
+
maxContextTokens: 1048576,
|
|
1432
|
+
maxOutputTokens: 131072,
|
|
1433
|
+
// No documented tool-count cap — conservative default pending measured
|
|
1434
|
+
// evidence; matches the deepseek posture, not a doc number.
|
|
1435
|
+
maxTools: 16,
|
|
1436
|
+
// Hosted-API docs document tools + tool_choice + tool_stream but say
|
|
1437
|
+
// NOTHING about multiple tool_calls per response. Conservative false so
|
|
1438
|
+
// hunt-shaped ranking doesn't over-promise; flip on doc or probe
|
|
1439
|
+
// evidence (L-081: undocumented ≠ true).
|
|
1440
|
+
parallelToolCalls: false,
|
|
1441
|
+
structuredOutput: "native",
|
|
1442
|
+
systemPromptMode: "inline",
|
|
1443
|
+
streaming: true,
|
|
1444
|
+
cliffs: [],
|
|
1445
|
+
costInputPer1m: 1.4,
|
|
1446
|
+
costOutputPer1m: 4.4,
|
|
1447
|
+
lowering: {
|
|
1448
|
+
system: { mode: "inline" },
|
|
1449
|
+
// Automatic prefix caching ("intelligent caching mechanism") — no wire
|
|
1450
|
+
// marker to emit, DeepSeek-style. Cache-hit input $0.26/M (~0.19× of
|
|
1451
|
+
// miss) tracked in notes; storage limited-time free as of 2026-07-18.
|
|
1452
|
+
cache: { strategy: "unsupported" },
|
|
1453
|
+
tools: { format: "openai" },
|
|
1454
|
+
// thinking.type: 'enabled' (server default) | 'disabled'. lowerZai
|
|
1455
|
+
// emits an explicit disable only on forceThinkingZero cliffs.
|
|
1456
|
+
thinking: { field: "thinking.type", default: "auto" }
|
|
1457
|
+
},
|
|
1458
|
+
recovery: [
|
|
1459
|
+
{ signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
|
|
1460
|
+
{ signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
|
|
1461
|
+
],
|
|
1462
|
+
strengths: ["cost", "1m_context", "code", "tool_use", "json_output", "reasoning"],
|
|
1463
|
+
weaknesses: ["parallel_tools"],
|
|
1464
|
+
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.",
|
|
1465
|
+
// Starter hypotheses — verify with telemetry/probes; NO brain evidence
|
|
1466
|
+
// yet. Anchored on the vendor's agentic-coding positioning at a
|
|
1467
|
+
// mid-cost tier, discounted for the unproven parallel-tool story.
|
|
1468
|
+
archetypePerf: {
|
|
1469
|
+
generate: 7,
|
|
1470
|
+
// agentic-coding positioning — starter hypothesis
|
|
1471
|
+
transform: 7,
|
|
1472
|
+
// starter hypothesis
|
|
1473
|
+
plan: 7,
|
|
1474
|
+
// starter hypothesis
|
|
1475
|
+
summarize: 7,
|
|
1476
|
+
// tolerant archetype — starter hypothesis
|
|
1477
|
+
ask: 6,
|
|
1478
|
+
extract: 6,
|
|
1479
|
+
critique: 6,
|
|
1480
|
+
classify: 6,
|
|
1481
|
+
hunt: 5
|
|
1482
|
+
// tools work; parallel unproven → discounted
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
// ── Moonshot (Kimi) ──
|
|
1486
|
+
// alpha.65 (2026-07-18): first Moonshot profile, provider `moonshot` added
|
|
1487
|
+
// same release. Step-zero sources (all fetched 2026-07-18):
|
|
1488
|
+
// platform.kimi.ai/docs/pricing/chat-k3 ($3.00 cache-miss in / $0.30
|
|
1489
|
+
// cache-hit in / $15.00 out; 1,048,576 ctx; ToolCalls + JSON Mode +
|
|
1490
|
+
// Partial Mode), kimi-k3-quickstart (max_completion_tokens default
|
|
1491
|
+
// 131072, up to 1,048,576; base https://api.moonshot.ai/v1; vision via
|
|
1492
|
+
// base64 or ms://file-id, NO public image URLs), models-overview
|
|
1493
|
+
// (temperature FIXED 1.0, top_p FIXED 0.95, n FIXED 1, always reasons,
|
|
1494
|
+
// reasoning_effort 'max' only), tool-calls guide ("can choose to call
|
|
1495
|
+
// multiple tools at once … will tend to call them in parallel").
|
|
1496
|
+
{
|
|
1497
|
+
id: "kimi-k3",
|
|
1498
|
+
verifiedAgainstDocs: "2026-07-18",
|
|
1499
|
+
provider: "moonshot",
|
|
1500
|
+
status: "preview",
|
|
1501
|
+
maxContextTokens: 1048576,
|
|
1502
|
+
// Documented ceiling; default is 131,072 when unset.
|
|
1503
|
+
maxOutputTokens: 1048576,
|
|
1504
|
+
// No hard doc cap; docs recommend dynamic tool loading at "dozens or
|
|
1505
|
+
// hundreds" — 64 matches the frontier-agentic posture (sonnet-5 tier).
|
|
1506
|
+
maxTools: 64,
|
|
1507
|
+
parallelToolCalls: true,
|
|
1508
|
+
structuredOutput: "native",
|
|
1509
|
+
systemPromptMode: "inline",
|
|
1510
|
+
streaming: true,
|
|
1511
|
+
cliffs: [],
|
|
1512
|
+
costInputPer1m: 3,
|
|
1513
|
+
costOutputPer1m: 15,
|
|
1514
|
+
lowering: {
|
|
1515
|
+
system: { mode: "inline" },
|
|
1516
|
+
// Automatic context caching — no wire marker. Cache-hit input $0.30/M
|
|
1517
|
+
// (0.1× of miss) tracked in notes.
|
|
1518
|
+
cache: { strategy: "unsupported" },
|
|
1519
|
+
tools: { format: "openai" }
|
|
1520
|
+
// No thinking knob: reasoning is always-on and reasoning_effort
|
|
1521
|
+
// accepts only 'max' (= the server default). Nothing to lower.
|
|
1522
|
+
},
|
|
1523
|
+
recovery: [
|
|
1524
|
+
{ signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
|
|
1525
|
+
{ signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
|
|
1526
|
+
],
|
|
1527
|
+
strengths: ["quality", "reasoning", "1m_context", "parallel_tools", "tool_use", "code", "vision"],
|
|
1528
|
+
// 'latency' → latencyTierOf derives 'slow': always-on max-effort
|
|
1529
|
+
// reasoner with no off switch; no measured p50 yet, the tag is the
|
|
1530
|
+
// honest prior (reasoner family precedent: deepseek-v4-pro ~48s).
|
|
1531
|
+
weaknesses: ["cost", "latency"],
|
|
1532
|
+
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.",
|
|
1533
|
+
// Starter hypotheses — verify with telemetry/probes; NO brain evidence
|
|
1534
|
+
// yet. Anchored on documented long-horizon-agentic + parallel-tool
|
|
1535
|
+
// strengths; discounted on terse archetypes where always-on reasoning
|
|
1536
|
+
// bills $15/M output for thinking the archetype doesn't need.
|
|
1537
|
+
archetypePerf: {
|
|
1538
|
+
hunt: 8,
|
|
1539
|
+
// parallel tools + long-horizon agentic — starter hypothesis
|
|
1540
|
+
plan: 8,
|
|
1541
|
+
// starter hypothesis
|
|
1542
|
+
generate: 8,
|
|
1543
|
+
// starter hypothesis
|
|
1544
|
+
critique: 7,
|
|
1545
|
+
ask: 7,
|
|
1546
|
+
extract: 7,
|
|
1547
|
+
transform: 7,
|
|
1548
|
+
summarize: 6,
|
|
1549
|
+
// works, but $15/M output reasoning tax on a tolerant archetype
|
|
1550
|
+
classify: 5
|
|
1551
|
+
// always-on reasoning cost + reasoner hedge risk
|
|
1552
|
+
},
|
|
1553
|
+
// Diagnostics-only (no prompt rewrite): reasoner-family hedge risk on
|
|
1554
|
+
// decisive archetypes, carried as a warning until K3-specific probe
|
|
1555
|
+
// evidence exists. The deepseek-reasoner family showed 8/10 judge
|
|
1556
|
+
// rationales citing hedging on classify (exclusion-finding ID 20,
|
|
1557
|
+
// 2026-05-28); K3 is an always-on reasoner and inherits the risk class,
|
|
1558
|
+
// not the conviction.
|
|
1559
|
+
archetypeConventions: [
|
|
1560
|
+
{
|
|
1561
|
+
archetype: "classify",
|
|
1562
|
+
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.",
|
|
1563
|
+
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."
|
|
1564
|
+
}
|
|
1565
|
+
]
|
|
1416
1566
|
}
|
|
1417
1567
|
];
|
|
1418
1568
|
var ALIASES = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var LIBRARY_VERSION = "2.0.0-alpha.
|
|
2
|
+
var LIBRARY_VERSION = "2.0.0-alpha.66";
|
|
3
3
|
|
|
4
4
|
// src/key-health.ts
|
|
5
5
|
var JSON_HEADERS = { "Content-Type": "application/json" };
|
|
@@ -48,6 +48,14 @@ var PROBE_SPECS = [
|
|
|
48
48
|
return Number.isFinite(n) ? n : void 0;
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
+
{
|
|
52
|
+
provider: "moonshot",
|
|
53
|
+
canonicalEnvName: "MOONSHOT_API_KEY",
|
|
54
|
+
buildRequest: (key) => ({
|
|
55
|
+
url: "https://api.moonshot.ai/v1/models",
|
|
56
|
+
headers: { Authorization: `Bearer ${key}` }
|
|
57
|
+
})
|
|
58
|
+
},
|
|
51
59
|
{
|
|
52
60
|
provider: "google",
|
|
53
61
|
canonicalEnvName: "GEMINI_API_KEY",
|
|
@@ -79,6 +87,11 @@ function createKeyHealthRoute(config) {
|
|
|
79
87
|
const aiSdk = envKey(env, "GOOGLE_GENERATIVE_AI_API_KEY");
|
|
80
88
|
key = gemini ?? google ?? aiSdk;
|
|
81
89
|
envName = gemini ? "GEMINI_API_KEY" : google ? "GOOGLE_API_KEY" : aiSdk ? "GOOGLE_GENERATIVE_AI_API_KEY" : "GEMINI_API_KEY";
|
|
90
|
+
} else if (spec.provider === "moonshot") {
|
|
91
|
+
const moonshot = envKey(env, "MOONSHOT_API_KEY");
|
|
92
|
+
const kimi = envKey(env, "KIMI_API_KEY");
|
|
93
|
+
key = moonshot ?? kimi;
|
|
94
|
+
envName = moonshot ? "MOONSHOT_API_KEY" : kimi ? "KIMI_API_KEY" : "MOONSHOT_API_KEY";
|
|
82
95
|
} else {
|
|
83
96
|
key = envKey(env, spec.canonicalEnvName);
|
|
84
97
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
tryGetProfile
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4UO4CCSP.mjs";
|
|
4
4
|
|
|
5
5
|
// src/brain-query.ts
|
|
6
6
|
var FRESH_SNAPSHOT = {
|
|
@@ -258,7 +258,9 @@ var SUPPORTED_PROVIDERS = Object.freeze([
|
|
|
258
258
|
"anthropic",
|
|
259
259
|
"google",
|
|
260
260
|
"openai",
|
|
261
|
-
"deepseek"
|
|
261
|
+
"deepseek",
|
|
262
|
+
"zai",
|
|
263
|
+
"moonshot"
|
|
262
264
|
]);
|
|
263
265
|
function isSupportedProvider(p) {
|
|
264
266
|
return SUPPORTED_PROVIDERS.includes(p);
|
|
@@ -271,7 +273,15 @@ var PROVIDER_ENV_KEYS = Object.freeze({
|
|
|
271
273
|
"GOOGLE_GENERATIVE_AI_API_KEY"
|
|
272
274
|
]),
|
|
273
275
|
openai: Object.freeze(["OPENAI_API_KEY"]),
|
|
274
|
-
deepseek: Object.freeze(["DEEPSEEK_API_KEY"])
|
|
276
|
+
deepseek: Object.freeze(["DEEPSEEK_API_KEY"]),
|
|
277
|
+
// alpha.65 — Z.ai (GLM family). ZAI_API_KEY is the canonical name; the
|
|
278
|
+
// Z_AI_API_KEY variant covers the underscore convention some tooling uses
|
|
279
|
+
// for the brand's "Z.ai" spelling.
|
|
280
|
+
zai: Object.freeze(["ZAI_API_KEY", "Z_AI_API_KEY"]),
|
|
281
|
+
// alpha.65 — Moonshot AI (Kimi family). MOONSHOT_API_KEY is canonical
|
|
282
|
+
// (api.moonshot.ai); KIMI_API_KEY covers the platform.kimi.ai rebrand
|
|
283
|
+
// surface so consumers keyed under either name resolve.
|
|
284
|
+
moonshot: Object.freeze(["MOONSHOT_API_KEY", "KIMI_API_KEY"])
|
|
275
285
|
});
|
|
276
286
|
function defaultEnv() {
|
|
277
287
|
return typeof process !== "undefined" && process.env ? process.env : {};
|
|
@@ -323,6 +333,10 @@ function readBrainReadEnv(envSource = defaultEnv()) {
|
|
|
323
333
|
if (!anonKey) missingEnv.push("KGAUTO_V2_BRAIN_ANON_KEY");
|
|
324
334
|
return { endpoint, jwt, anonKey, missingEnv };
|
|
325
335
|
}
|
|
336
|
+
function isSameModelRetryEnabledFromEnv(envSource = defaultEnv()) {
|
|
337
|
+
const raw = (envSource.KGAUTO_SAME_MODEL_RETRY ?? "").trim().toLowerCase();
|
|
338
|
+
return raw === "1" || raw === "true";
|
|
339
|
+
}
|
|
326
340
|
|
|
327
341
|
// src/fallback.ts
|
|
328
342
|
var STARTER_CHAINS_GROUNDED = {
|
|
@@ -691,6 +705,7 @@ export {
|
|
|
691
705
|
isModelReachable,
|
|
692
706
|
getReachabilityDiagnostic,
|
|
693
707
|
readBrainReadEnv,
|
|
708
|
+
isSameModelRetryEnabledFromEnv,
|
|
694
709
|
loadChainsFromBrain,
|
|
695
710
|
getDefaultFallbackChain,
|
|
696
711
|
getStarterChain,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as GlassboxEvent } from '../types-
|
|
2
|
-
export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-
|
|
3
|
-
import '../ir-
|
|
1
|
+
import { G as GlassboxEvent } from '../types-8pWRDbUg.mjs';
|
|
2
|
+
export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-8pWRDbUg.mjs';
|
|
3
|
+
import '../ir-BTvyl8-w.mjs';
|
|
4
4
|
import '../dialect.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/glassbox/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as GlassboxEvent } from '../types-
|
|
2
|
-
export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-
|
|
3
|
-
import '../ir-
|
|
1
|
+
import { G as GlassboxEvent } from '../types-BdYlJz0Z.js';
|
|
2
|
+
export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-BdYlJz0Z.js';
|
|
3
|
+
import '../ir-Qnw6L265.js';
|
|
4
4
|
import '../dialect.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as GlassboxEvent } from '../types-
|
|
2
|
-
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-
|
|
3
|
-
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-
|
|
4
|
-
import '../ir-
|
|
1
|
+
import { G as GlassboxEvent } from '../types-8pWRDbUg.mjs';
|
|
2
|
+
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-Cya0jPAF.mjs';
|
|
3
|
+
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-Cya0jPAF.mjs';
|
|
4
|
+
import '../ir-BTvyl8-w.mjs';
|
|
5
5
|
import '../dialect.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as GlassboxEvent } from '../types-
|
|
2
|
-
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-
|
|
3
|
-
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-
|
|
4
|
-
import '../ir-
|
|
1
|
+
import { G as GlassboxEvent } from '../types-BdYlJz0Z.js';
|
|
2
|
+
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-DxYXuFxj.js';
|
|
3
|
+
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-DxYXuFxj.js';
|
|
4
|
+
import '../ir-Qnw6L265.js';
|
|
5
5
|
import '../dialect.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1467,6 +1467,156 @@ var PROFILES_RAW = [
|
|
|
1467
1467
|
classify: 8
|
|
1468
1468
|
// overkill
|
|
1469
1469
|
}
|
|
1470
|
+
},
|
|
1471
|
+
// ── Z.ai (GLM) ──
|
|
1472
|
+
// alpha.65 (2026-07-18): first Z.ai profile, provider `zai` added same
|
|
1473
|
+
// release. Step-zero sources (L-049/L-081, all fetched 2026-07-18):
|
|
1474
|
+
// docs.z.ai/guides/llm/glm-5.2 (capabilities), docs.z.ai api-reference
|
|
1475
|
+
// chat-completion (wire params: thinking.type enabled|disabled default
|
|
1476
|
+
// enabled, reasoning_effort max..none, tool_stream, max output 131072),
|
|
1477
|
+
// docs.z.ai/guides/overview/pricing ($1.4 in / $4.4 out, cached input
|
|
1478
|
+
// $0.26, cache storage limited-time free), vLLM recipe (native ctx
|
|
1479
|
+
// 1,048,576). NO AI-trained numbers.
|
|
1480
|
+
{
|
|
1481
|
+
id: "glm-5.2",
|
|
1482
|
+
verifiedAgainstDocs: "2026-07-18",
|
|
1483
|
+
provider: "zai",
|
|
1484
|
+
status: "preview",
|
|
1485
|
+
maxContextTokens: 1048576,
|
|
1486
|
+
maxOutputTokens: 131072,
|
|
1487
|
+
// No documented tool-count cap — conservative default pending measured
|
|
1488
|
+
// evidence; matches the deepseek posture, not a doc number.
|
|
1489
|
+
maxTools: 16,
|
|
1490
|
+
// Hosted-API docs document tools + tool_choice + tool_stream but say
|
|
1491
|
+
// NOTHING about multiple tool_calls per response. Conservative false so
|
|
1492
|
+
// hunt-shaped ranking doesn't over-promise; flip on doc or probe
|
|
1493
|
+
// evidence (L-081: undocumented ≠ true).
|
|
1494
|
+
parallelToolCalls: false,
|
|
1495
|
+
structuredOutput: "native",
|
|
1496
|
+
systemPromptMode: "inline",
|
|
1497
|
+
streaming: true,
|
|
1498
|
+
cliffs: [],
|
|
1499
|
+
costInputPer1m: 1.4,
|
|
1500
|
+
costOutputPer1m: 4.4,
|
|
1501
|
+
lowering: {
|
|
1502
|
+
system: { mode: "inline" },
|
|
1503
|
+
// Automatic prefix caching ("intelligent caching mechanism") — no wire
|
|
1504
|
+
// marker to emit, DeepSeek-style. Cache-hit input $0.26/M (~0.19× of
|
|
1505
|
+
// miss) tracked in notes; storage limited-time free as of 2026-07-18.
|
|
1506
|
+
cache: { strategy: "unsupported" },
|
|
1507
|
+
tools: { format: "openai" },
|
|
1508
|
+
// thinking.type: 'enabled' (server default) | 'disabled'. lowerZai
|
|
1509
|
+
// emits an explicit disable only on forceThinkingZero cliffs.
|
|
1510
|
+
thinking: { field: "thinking.type", default: "auto" }
|
|
1511
|
+
},
|
|
1512
|
+
recovery: [
|
|
1513
|
+
{ signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
|
|
1514
|
+
{ signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
|
|
1515
|
+
],
|
|
1516
|
+
strengths: ["cost", "1m_context", "code", "tool_use", "json_output", "reasoning"],
|
|
1517
|
+
weaknesses: ["parallel_tools"],
|
|
1518
|
+
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.",
|
|
1519
|
+
// Starter hypotheses — verify with telemetry/probes; NO brain evidence
|
|
1520
|
+
// yet. Anchored on the vendor's agentic-coding positioning at a
|
|
1521
|
+
// mid-cost tier, discounted for the unproven parallel-tool story.
|
|
1522
|
+
archetypePerf: {
|
|
1523
|
+
generate: 7,
|
|
1524
|
+
// agentic-coding positioning — starter hypothesis
|
|
1525
|
+
transform: 7,
|
|
1526
|
+
// starter hypothesis
|
|
1527
|
+
plan: 7,
|
|
1528
|
+
// starter hypothesis
|
|
1529
|
+
summarize: 7,
|
|
1530
|
+
// tolerant archetype — starter hypothesis
|
|
1531
|
+
ask: 6,
|
|
1532
|
+
extract: 6,
|
|
1533
|
+
critique: 6,
|
|
1534
|
+
classify: 6,
|
|
1535
|
+
hunt: 5
|
|
1536
|
+
// tools work; parallel unproven → discounted
|
|
1537
|
+
}
|
|
1538
|
+
},
|
|
1539
|
+
// ── Moonshot (Kimi) ──
|
|
1540
|
+
// alpha.65 (2026-07-18): first Moonshot profile, provider `moonshot` added
|
|
1541
|
+
// same release. Step-zero sources (all fetched 2026-07-18):
|
|
1542
|
+
// platform.kimi.ai/docs/pricing/chat-k3 ($3.00 cache-miss in / $0.30
|
|
1543
|
+
// cache-hit in / $15.00 out; 1,048,576 ctx; ToolCalls + JSON Mode +
|
|
1544
|
+
// Partial Mode), kimi-k3-quickstart (max_completion_tokens default
|
|
1545
|
+
// 131072, up to 1,048,576; base https://api.moonshot.ai/v1; vision via
|
|
1546
|
+
// base64 or ms://file-id, NO public image URLs), models-overview
|
|
1547
|
+
// (temperature FIXED 1.0, top_p FIXED 0.95, n FIXED 1, always reasons,
|
|
1548
|
+
// reasoning_effort 'max' only), tool-calls guide ("can choose to call
|
|
1549
|
+
// multiple tools at once … will tend to call them in parallel").
|
|
1550
|
+
{
|
|
1551
|
+
id: "kimi-k3",
|
|
1552
|
+
verifiedAgainstDocs: "2026-07-18",
|
|
1553
|
+
provider: "moonshot",
|
|
1554
|
+
status: "preview",
|
|
1555
|
+
maxContextTokens: 1048576,
|
|
1556
|
+
// Documented ceiling; default is 131,072 when unset.
|
|
1557
|
+
maxOutputTokens: 1048576,
|
|
1558
|
+
// No hard doc cap; docs recommend dynamic tool loading at "dozens or
|
|
1559
|
+
// hundreds" — 64 matches the frontier-agentic posture (sonnet-5 tier).
|
|
1560
|
+
maxTools: 64,
|
|
1561
|
+
parallelToolCalls: true,
|
|
1562
|
+
structuredOutput: "native",
|
|
1563
|
+
systemPromptMode: "inline",
|
|
1564
|
+
streaming: true,
|
|
1565
|
+
cliffs: [],
|
|
1566
|
+
costInputPer1m: 3,
|
|
1567
|
+
costOutputPer1m: 15,
|
|
1568
|
+
lowering: {
|
|
1569
|
+
system: { mode: "inline" },
|
|
1570
|
+
// Automatic context caching — no wire marker. Cache-hit input $0.30/M
|
|
1571
|
+
// (0.1× of miss) tracked in notes.
|
|
1572
|
+
cache: { strategy: "unsupported" },
|
|
1573
|
+
tools: { format: "openai" }
|
|
1574
|
+
// No thinking knob: reasoning is always-on and reasoning_effort
|
|
1575
|
+
// accepts only 'max' (= the server default). Nothing to lower.
|
|
1576
|
+
},
|
|
1577
|
+
recovery: [
|
|
1578
|
+
{ signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
|
|
1579
|
+
{ signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
|
|
1580
|
+
],
|
|
1581
|
+
strengths: ["quality", "reasoning", "1m_context", "parallel_tools", "tool_use", "code", "vision"],
|
|
1582
|
+
// 'latency' → latencyTierOf derives 'slow': always-on max-effort
|
|
1583
|
+
// reasoner with no off switch; no measured p50 yet, the tag is the
|
|
1584
|
+
// honest prior (reasoner family precedent: deepseek-v4-pro ~48s).
|
|
1585
|
+
weaknesses: ["cost", "latency"],
|
|
1586
|
+
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.",
|
|
1587
|
+
// Starter hypotheses — verify with telemetry/probes; NO brain evidence
|
|
1588
|
+
// yet. Anchored on documented long-horizon-agentic + parallel-tool
|
|
1589
|
+
// strengths; discounted on terse archetypes where always-on reasoning
|
|
1590
|
+
// bills $15/M output for thinking the archetype doesn't need.
|
|
1591
|
+
archetypePerf: {
|
|
1592
|
+
hunt: 8,
|
|
1593
|
+
// parallel tools + long-horizon agentic — starter hypothesis
|
|
1594
|
+
plan: 8,
|
|
1595
|
+
// starter hypothesis
|
|
1596
|
+
generate: 8,
|
|
1597
|
+
// starter hypothesis
|
|
1598
|
+
critique: 7,
|
|
1599
|
+
ask: 7,
|
|
1600
|
+
extract: 7,
|
|
1601
|
+
transform: 7,
|
|
1602
|
+
summarize: 6,
|
|
1603
|
+
// works, but $15/M output reasoning tax on a tolerant archetype
|
|
1604
|
+
classify: 5
|
|
1605
|
+
// always-on reasoning cost + reasoner hedge risk
|
|
1606
|
+
},
|
|
1607
|
+
// Diagnostics-only (no prompt rewrite): reasoner-family hedge risk on
|
|
1608
|
+
// decisive archetypes, carried as a warning until K3-specific probe
|
|
1609
|
+
// evidence exists. The deepseek-reasoner family showed 8/10 judge
|
|
1610
|
+
// rationales citing hedging on classify (exclusion-finding ID 20,
|
|
1611
|
+
// 2026-05-28); K3 is an always-on reasoner and inherits the risk class,
|
|
1612
|
+
// not the conviction.
|
|
1613
|
+
archetypeConventions: [
|
|
1614
|
+
{
|
|
1615
|
+
archetype: "classify",
|
|
1616
|
+
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.",
|
|
1617
|
+
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."
|
|
1618
|
+
}
|
|
1619
|
+
]
|
|
1470
1620
|
}
|
|
1471
1621
|
];
|
|
1472
1622
|
var ALIASES = {
|
|
@@ -1493,7 +1643,9 @@ var SUPPORTED_PROVIDERS = Object.freeze([
|
|
|
1493
1643
|
"anthropic",
|
|
1494
1644
|
"google",
|
|
1495
1645
|
"openai",
|
|
1496
|
-
"deepseek"
|
|
1646
|
+
"deepseek",
|
|
1647
|
+
"zai",
|
|
1648
|
+
"moonshot"
|
|
1497
1649
|
]);
|
|
1498
1650
|
function isSupportedProvider(p) {
|
|
1499
1651
|
return SUPPORTED_PROVIDERS.includes(p);
|
|
@@ -1506,7 +1658,15 @@ var PROVIDER_ENV_KEYS = Object.freeze({
|
|
|
1506
1658
|
"GOOGLE_GENERATIVE_AI_API_KEY"
|
|
1507
1659
|
]),
|
|
1508
1660
|
openai: Object.freeze(["OPENAI_API_KEY"]),
|
|
1509
|
-
deepseek: Object.freeze(["DEEPSEEK_API_KEY"])
|
|
1661
|
+
deepseek: Object.freeze(["DEEPSEEK_API_KEY"]),
|
|
1662
|
+
// alpha.65 — Z.ai (GLM family). ZAI_API_KEY is the canonical name; the
|
|
1663
|
+
// Z_AI_API_KEY variant covers the underscore convention some tooling uses
|
|
1664
|
+
// for the brand's "Z.ai" spelling.
|
|
1665
|
+
zai: Object.freeze(["ZAI_API_KEY", "Z_AI_API_KEY"]),
|
|
1666
|
+
// alpha.65 — Moonshot AI (Kimi family). MOONSHOT_API_KEY is canonical
|
|
1667
|
+
// (api.moonshot.ai); KIMI_API_KEY covers the platform.kimi.ai rebrand
|
|
1668
|
+
// surface so consumers keyed under either name resolve.
|
|
1669
|
+
moonshot: Object.freeze(["MOONSHOT_API_KEY", "KIMI_API_KEY"])
|
|
1510
1670
|
});
|
|
1511
1671
|
function defaultEnv() {
|
|
1512
1672
|
return typeof process !== "undefined" && process.env ? process.env : {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARCHETYPE_FLOOR_DEFAULT,
|
|
3
3
|
getDefaultFallbackChain
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-SBFSYCQG.mjs";
|
|
5
5
|
import {
|
|
6
6
|
tryGetProfile
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-4UO4CCSP.mjs";
|
|
8
8
|
import {
|
|
9
9
|
subscribe,
|
|
10
10
|
subscribeApp
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as TraceDetail } from '../../types-
|
|
3
|
-
import '../../ir-
|
|
2
|
+
import { a as TraceDetail } from '../../types-Cya0jPAF.mjs';
|
|
3
|
+
import '../../ir-BTvyl8-w.mjs';
|
|
4
4
|
import '../../dialect.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as TraceDetail } from '../../types-
|
|
3
|
-
import '../../ir-
|
|
2
|
+
import { a as TraceDetail } from '../../types-DxYXuFxj.js';
|
|
3
|
+
import '../../ir-Qnw6L265.js';
|
|
4
4
|
import '../../dialect.js';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-
|
|
2
|
-
export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-
|
|
1
|
+
import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-BTvyl8-w.mjs';
|
|
2
|
+
export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-BTvyl8-w.mjs';
|
|
3
3
|
import { ModelProfile, ArchetypeConvention } from './profiles.mjs';
|
|
4
4
|
export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, latencyTierOf, profilesByProvider, tryGetProfile } from './profiles.mjs';
|
|
5
5
|
export { BrainForwardConfig, BrainForwardRoutes, createBrainForwardRoutes } from './brain-proxy.mjs';
|
|
@@ -78,6 +78,19 @@ interface ExecuteErr {
|
|
|
78
78
|
errorCode: string;
|
|
79
79
|
message: string;
|
|
80
80
|
raw: unknown;
|
|
81
|
+
/**
|
|
82
|
+
* alpha.66 — real token usage when the failure is a SYNTHESIZED
|
|
83
|
+
* structured-output contract violation (the provider returned 200 with
|
|
84
|
+
* usage; the response just violated the contract). Absent on transport-
|
|
85
|
+
* level failures (4xx/5xx/network) where no usage exists. Lets the
|
|
86
|
+
* brain's failure rows carry true `tokens_in` for the cliff class —
|
|
87
|
+
* PB's 2026-05-18 `chain-walk-on-structured-output-parse-failed` ask 4
|
|
88
|
+
* (tokens_in=0 on a 72s parse-fail made diagnosis ambiguous).
|
|
89
|
+
*/
|
|
90
|
+
tokens?: {
|
|
91
|
+
input: number;
|
|
92
|
+
output: number;
|
|
93
|
+
};
|
|
81
94
|
}
|
|
82
95
|
type ExecuteResult = ExecuteOk | ExecuteErr;
|
|
83
96
|
declare function execute(request: CompiledRequest, opts?: ExecuteOptions): Promise<ExecuteResult>;
|
|
@@ -597,6 +610,12 @@ interface OutcomePayload {
|
|
|
597
610
|
system_prompt_chars?: number;
|
|
598
611
|
fell_over_from?: string;
|
|
599
612
|
fallback_reason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
|
|
613
|
+
/**
|
|
614
|
+
* True when the same-model retry (CallOptions.sameModelRetry) fired
|
|
615
|
+
* during this call. Key OMITTED (not false) when no retry fired — safe
|
|
616
|
+
* against brains that haven't applied migration 039 yet.
|
|
617
|
+
*/
|
|
618
|
+
retried_same_model?: boolean;
|
|
600
619
|
/**
|
|
601
620
|
* Per-call SectionRewrite[] captured at compile time. Omitted (sent as
|
|
602
621
|
* undefined → stored NULL) when no rewrites fired. Powers cross-app
|
|
@@ -923,7 +942,7 @@ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunRe
|
|
|
923
942
|
* guard in `tests/version.test.ts` fails the suite (and therefore
|
|
924
943
|
* `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
|
|
925
944
|
*/
|
|
926
|
-
declare const LIBRARY_VERSION = "2.0.0-alpha.
|
|
945
|
+
declare const LIBRARY_VERSION = "2.0.0-alpha.66";
|
|
927
946
|
|
|
928
947
|
/**
|
|
929
948
|
* Oracle contract — how an app tells the brain whether a response was good.
|
|
@@ -1808,7 +1827,7 @@ declare function getPerAxisMetrics(opts: GetPerAxisMetricsOpts): Promise<PerAxis
|
|
|
1808
1827
|
* no execute() handler, no env-var convention). Narrowing here keeps the
|
|
1809
1828
|
* reachability check structurally honest.
|
|
1810
1829
|
*/
|
|
1811
|
-
type SupportedProvider = 'anthropic' | 'google' | 'openai' | 'deepseek';
|
|
1830
|
+
type SupportedProvider = 'anthropic' | 'google' | 'openai' | 'deepseek' | 'zai' | 'moonshot';
|
|
1812
1831
|
/**
|
|
1813
1832
|
* Per-provider env var names kgauto recognizes. Order doesn't matter —
|
|
1814
1833
|
* first-present wins. Multiple names per provider supported because Google
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-
|
|
2
|
-
export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-
|
|
1
|
+
import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-Qnw6L265.js';
|
|
2
|
+
export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-Qnw6L265.js';
|
|
3
3
|
import { ModelProfile, ArchetypeConvention } from './profiles.js';
|
|
4
4
|
export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, latencyTierOf, profilesByProvider, tryGetProfile } from './profiles.js';
|
|
5
5
|
export { BrainForwardConfig, BrainForwardRoutes, createBrainForwardRoutes } from './brain-proxy.js';
|
|
@@ -78,6 +78,19 @@ interface ExecuteErr {
|
|
|
78
78
|
errorCode: string;
|
|
79
79
|
message: string;
|
|
80
80
|
raw: unknown;
|
|
81
|
+
/**
|
|
82
|
+
* alpha.66 — real token usage when the failure is a SYNTHESIZED
|
|
83
|
+
* structured-output contract violation (the provider returned 200 with
|
|
84
|
+
* usage; the response just violated the contract). Absent on transport-
|
|
85
|
+
* level failures (4xx/5xx/network) where no usage exists. Lets the
|
|
86
|
+
* brain's failure rows carry true `tokens_in` for the cliff class —
|
|
87
|
+
* PB's 2026-05-18 `chain-walk-on-structured-output-parse-failed` ask 4
|
|
88
|
+
* (tokens_in=0 on a 72s parse-fail made diagnosis ambiguous).
|
|
89
|
+
*/
|
|
90
|
+
tokens?: {
|
|
91
|
+
input: number;
|
|
92
|
+
output: number;
|
|
93
|
+
};
|
|
81
94
|
}
|
|
82
95
|
type ExecuteResult = ExecuteOk | ExecuteErr;
|
|
83
96
|
declare function execute(request: CompiledRequest, opts?: ExecuteOptions): Promise<ExecuteResult>;
|
|
@@ -597,6 +610,12 @@ interface OutcomePayload {
|
|
|
597
610
|
system_prompt_chars?: number;
|
|
598
611
|
fell_over_from?: string;
|
|
599
612
|
fallback_reason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
|
|
613
|
+
/**
|
|
614
|
+
* True when the same-model retry (CallOptions.sameModelRetry) fired
|
|
615
|
+
* during this call. Key OMITTED (not false) when no retry fired — safe
|
|
616
|
+
* against brains that haven't applied migration 039 yet.
|
|
617
|
+
*/
|
|
618
|
+
retried_same_model?: boolean;
|
|
600
619
|
/**
|
|
601
620
|
* Per-call SectionRewrite[] captured at compile time. Omitted (sent as
|
|
602
621
|
* undefined → stored NULL) when no rewrites fired. Powers cross-app
|
|
@@ -923,7 +942,7 @@ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunRe
|
|
|
923
942
|
* guard in `tests/version.test.ts` fails the suite (and therefore
|
|
924
943
|
* `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
|
|
925
944
|
*/
|
|
926
|
-
declare const LIBRARY_VERSION = "2.0.0-alpha.
|
|
945
|
+
declare const LIBRARY_VERSION = "2.0.0-alpha.66";
|
|
927
946
|
|
|
928
947
|
/**
|
|
929
948
|
* Oracle contract — how an app tells the brain whether a response was good.
|
|
@@ -1808,7 +1827,7 @@ declare function getPerAxisMetrics(opts: GetPerAxisMetricsOpts): Promise<PerAxis
|
|
|
1808
1827
|
* no execute() handler, no env-var convention). Narrowing here keeps the
|
|
1809
1828
|
* reachability check structurally honest.
|
|
1810
1829
|
*/
|
|
1811
|
-
type SupportedProvider = 'anthropic' | 'google' | 'openai' | 'deepseek';
|
|
1830
|
+
type SupportedProvider = 'anthropic' | 'google' | 'openai' | 'deepseek' | 'zai' | 'moonshot';
|
|
1812
1831
|
/**
|
|
1813
1832
|
* Per-provider env var names kgauto recognizes. Order doesn't matter —
|
|
1814
1833
|
* first-present wins. Multiple names per provider supported because Google
|