@warmdrift/kgauto-compiler 2.0.0-alpha.91 → 2.0.0-alpha.93
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-BTP5WK3B.mjs +3448 -0
- package/dist/{chunk-BVEXV5KC.mjs → chunk-FEMPY6EC.mjs} +5 -1
- package/dist/{chunk-54IXD5BT.mjs → chunk-S4PA2BDB.mjs} +8 -3
- package/dist/{chunk-AUZTO6Q5.mjs → chunk-WFLDRRY7.mjs} +1 -1
- package/dist/{chunk-T53ISC2F.mjs → chunk-YO2ZLPSD.mjs} +10 -0
- package/dist/compile-BlMXv6QT.d.ts +53 -0
- package/dist/compile-C2IfAGV1.d.mts +53 -0
- package/dist/dialect.d.mts +11 -1
- package/dist/dialect.d.ts +11 -1
- package/dist/dialect.js +7 -2
- package/dist/dialect.mjs +5 -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 +7 -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 +13 -49
- package/dist/index.d.ts +13 -49
- package/dist/index.js +95 -11
- package/dist/index.mjs +197 -3425
- package/dist/{ir-CTx026t0.d.ts → ir-DbvOFKF-.d.ts} +96 -2
- package/dist/{ir-DeYMLWge.d.mts → ir-DyMJ84je.d.mts} +96 -2
- package/dist/key-health.js +1 -1
- package/dist/key-health.mjs +1 -1
- package/dist/probe.d.mts +46 -0
- package/dist/probe.d.ts +46 -0
- package/dist/probe.js +5767 -0
- package/dist/probe.mjs +45 -0
- package/dist/profiles.d.mts +30 -2
- package/dist/profiles.d.ts +30 -2
- package/dist/profiles.js +11 -0
- package/dist/profiles.mjs +3 -1
- package/dist/{types-Cp9ot1HV.d.ts → types-5TqjBeZD.d.ts} +1 -1
- package/dist/{types-BKbRtmUb.d.ts → types-BlrbNQfj.d.ts} +1 -1
- package/dist/{types-DD36cCbZ.d.mts → types-D441T-KC.d.mts} +1 -1
- package/dist/{types-cBzinzUR.d.mts → types-_myk4bxn.d.mts} +1 -1
- package/package.json +7 -2
|
@@ -91,6 +91,9 @@ function hashShape(s) {
|
|
|
91
91
|
function learningKey(archetype, model, shape) {
|
|
92
92
|
return `${DIALECT_VERSION}::${archetype}::${model}::${hashShape(shape)}`;
|
|
93
93
|
}
|
|
94
|
+
function routeScopedModel(model, route) {
|
|
95
|
+
return route === "openrouter" ? `${model}@openrouter` : model;
|
|
96
|
+
}
|
|
94
97
|
|
|
95
98
|
export {
|
|
96
99
|
DIALECT_VERSION,
|
|
@@ -102,5 +105,6 @@ export {
|
|
|
102
105
|
bucketToolCount,
|
|
103
106
|
bucketHistory,
|
|
104
107
|
hashShape,
|
|
105
|
-
learningKey
|
|
108
|
+
learningKey,
|
|
109
|
+
routeScopedModel
|
|
106
110
|
};
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
allProfiles,
|
|
3
3
|
resolveModelAlias,
|
|
4
4
|
tryGetProfile
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YO2ZLPSD.mjs";
|
|
6
6
|
|
|
7
7
|
// src/brain-query.ts
|
|
8
8
|
var FRESH_SNAPSHOT = {
|
|
@@ -322,7 +322,8 @@ var SUPPORTED_PROVIDERS = Object.freeze([
|
|
|
322
322
|
"openai",
|
|
323
323
|
"deepseek",
|
|
324
324
|
"zai",
|
|
325
|
-
"moonshot"
|
|
325
|
+
"moonshot",
|
|
326
|
+
"openrouter"
|
|
326
327
|
]);
|
|
327
328
|
function isSupportedProvider(p) {
|
|
328
329
|
return SUPPORTED_PROVIDERS.includes(p);
|
|
@@ -343,7 +344,11 @@ var PROVIDER_ENV_KEYS = Object.freeze({
|
|
|
343
344
|
// alpha.65 — Moonshot AI (Kimi family). MOONSHOT_API_KEY is canonical
|
|
344
345
|
// (api.moonshot.ai); KIMI_API_KEY covers the platform.kimi.ai rebrand
|
|
345
346
|
// surface so consumers keyed under either name resolve.
|
|
346
|
-
moonshot: Object.freeze(["MOONSHOT_API_KEY", "KIMI_API_KEY"])
|
|
347
|
+
moonshot: Object.freeze(["MOONSHOT_API_KEY", "KIMI_API_KEY"]),
|
|
348
|
+
// alpha.92 — the OpenRouter gateway route (execute-leg contract). This is
|
|
349
|
+
// a ROUTE key, not a vendor key: it never makes a vendor "reachable" for
|
|
350
|
+
// chain composition — only explicit `route: 'openrouter'` calls use it.
|
|
351
|
+
openrouter: Object.freeze(["OPENROUTER_API_KEY"])
|
|
347
352
|
});
|
|
348
353
|
function defaultEnv() {
|
|
349
354
|
return typeof process !== "undefined" && process.env ? process.env : {};
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
// src/profiles.ts
|
|
2
|
+
function deriveCliffEvidenceClass(rule) {
|
|
3
|
+
if (rule.evidence?.class) return rule.evidence.class;
|
|
4
|
+
const r = rule.reason.toLowerCase();
|
|
5
|
+
if (/inherited|conservative|assume|likely degrades|preemptive|starter hypothesis|same drain risk/.test(r)) {
|
|
6
|
+
return "assumed";
|
|
7
|
+
}
|
|
8
|
+
if (/observed|measured|\d+\/\d+ empty|replayed into/.test(r)) return "observed";
|
|
9
|
+
return "asserted";
|
|
10
|
+
}
|
|
2
11
|
var LATENCY_TIER_MS = {
|
|
3
12
|
fast: 4e3,
|
|
4
13
|
medium: 11e3,
|
|
@@ -1991,6 +2000,7 @@ function profilesByProvider(provider) {
|
|
|
1991
2000
|
}
|
|
1992
2001
|
|
|
1993
2002
|
export {
|
|
2003
|
+
deriveCliffEvidenceClass,
|
|
1994
2004
|
LATENCY_TIER_MS,
|
|
1995
2005
|
latencyTierOf,
|
|
1996
2006
|
ALIASES,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { a as CompilePolicy } from './ir-DbvOFKF-.js';
|
|
2
|
+
import { ModelProfile } from './profiles.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* compile() — the main orchestrator.
|
|
6
|
+
*
|
|
7
|
+
* Runs all passes in order, picks a target, lowers to wire format, returns
|
|
8
|
+
* a CompileResult the caller uses to make the actual provider call.
|
|
9
|
+
*
|
|
10
|
+
* Pure function in v2.0.0-alpha.1: no network, no I/O, no mutation cache yet.
|
|
11
|
+
* Mutation cache will be added in v2.1 when the brain has data to push.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface CompileOptions {
|
|
15
|
+
/** Custom profile resolver — for tests or custom profile sets. */
|
|
16
|
+
profileResolver?: (id: string) => ModelProfile;
|
|
17
|
+
/** Tool relevance threshold (default 0.2). */
|
|
18
|
+
toolRelevanceThreshold?: number;
|
|
19
|
+
/** History compression — turns count threshold (default 8). */
|
|
20
|
+
compressHistoryAfter?: number;
|
|
21
|
+
/**
|
|
22
|
+
* History compression — token threshold (alpha.7). When total history
|
|
23
|
+
* tokens exceed this AND there are more recent turns to keep, compress
|
|
24
|
+
* even when count threshold is below `compressHistoryAfter`. Catches
|
|
25
|
+
* fat-message bloat (tool-using agents pack many tool-call/result pairs
|
|
26
|
+
* into single assistant messages — count stays low, tokens explode).
|
|
27
|
+
* Default undefined (disabled — backward-compatible).
|
|
28
|
+
*/
|
|
29
|
+
compressHistoryAboveTokens?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Consumer-declared policy. Filters blocked models, enforces cost
|
|
32
|
+
* ceiling, boosts preferred. See CompilePolicy in ir.ts.
|
|
33
|
+
*/
|
|
34
|
+
policy?: CompilePolicy;
|
|
35
|
+
/**
|
|
36
|
+
* alpha.68 / Release A (delegation-fanout-accelerator §5.0, R0 linkage) —
|
|
37
|
+
* transport for the fan-out parent handle. Threaded from
|
|
38
|
+
* `CallOptions.parentHandle` on the call() path (and settable directly on the
|
|
39
|
+
* public compile() path). Release A does NOT route on it — it only labels the
|
|
40
|
+
* outcome row (fanout_role / trace_id / parent_handle) at record-registration
|
|
41
|
+
* time. `registerCompile` reads it to derive the linkage. Absent ⇒ root call.
|
|
42
|
+
*/
|
|
43
|
+
parentHandle?: string;
|
|
44
|
+
/**
|
|
45
|
+
* alpha.92 — lower for a gateway route (execute-leg contract). Threaded
|
|
46
|
+
* from `CallOptions.route`. The canonical profile drives every pass
|
|
47
|
+
* (cliffs, scoring, budgets) unchanged; only the wire destination and the
|
|
48
|
+
* learning-key encoding change. Absent ⇒ direct vendor wire.
|
|
49
|
+
*/
|
|
50
|
+
route?: 'direct' | 'openrouter';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type { CompileOptions as C };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { a as CompilePolicy } from './ir-DyMJ84je.mjs';
|
|
2
|
+
import { ModelProfile } from './profiles.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* compile() — the main orchestrator.
|
|
6
|
+
*
|
|
7
|
+
* Runs all passes in order, picks a target, lowers to wire format, returns
|
|
8
|
+
* a CompileResult the caller uses to make the actual provider call.
|
|
9
|
+
*
|
|
10
|
+
* Pure function in v2.0.0-alpha.1: no network, no I/O, no mutation cache yet.
|
|
11
|
+
* Mutation cache will be added in v2.1 when the brain has data to push.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface CompileOptions {
|
|
15
|
+
/** Custom profile resolver — for tests or custom profile sets. */
|
|
16
|
+
profileResolver?: (id: string) => ModelProfile;
|
|
17
|
+
/** Tool relevance threshold (default 0.2). */
|
|
18
|
+
toolRelevanceThreshold?: number;
|
|
19
|
+
/** History compression — turns count threshold (default 8). */
|
|
20
|
+
compressHistoryAfter?: number;
|
|
21
|
+
/**
|
|
22
|
+
* History compression — token threshold (alpha.7). When total history
|
|
23
|
+
* tokens exceed this AND there are more recent turns to keep, compress
|
|
24
|
+
* even when count threshold is below `compressHistoryAfter`. Catches
|
|
25
|
+
* fat-message bloat (tool-using agents pack many tool-call/result pairs
|
|
26
|
+
* into single assistant messages — count stays low, tokens explode).
|
|
27
|
+
* Default undefined (disabled — backward-compatible).
|
|
28
|
+
*/
|
|
29
|
+
compressHistoryAboveTokens?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Consumer-declared policy. Filters blocked models, enforces cost
|
|
32
|
+
* ceiling, boosts preferred. See CompilePolicy in ir.ts.
|
|
33
|
+
*/
|
|
34
|
+
policy?: CompilePolicy;
|
|
35
|
+
/**
|
|
36
|
+
* alpha.68 / Release A (delegation-fanout-accelerator §5.0, R0 linkage) —
|
|
37
|
+
* transport for the fan-out parent handle. Threaded from
|
|
38
|
+
* `CallOptions.parentHandle` on the call() path (and settable directly on the
|
|
39
|
+
* public compile() path). Release A does NOT route on it — it only labels the
|
|
40
|
+
* outcome row (fanout_role / trace_id / parent_handle) at record-registration
|
|
41
|
+
* time. `registerCompile` reads it to derive the linkage. Absent ⇒ root call.
|
|
42
|
+
*/
|
|
43
|
+
parentHandle?: string;
|
|
44
|
+
/**
|
|
45
|
+
* alpha.92 — lower for a gateway route (execute-leg contract). Threaded
|
|
46
|
+
* from `CallOptions.route`. The canonical profile drives every pass
|
|
47
|
+
* (cliffs, scoring, budgets) unchanged; only the wire destination and the
|
|
48
|
+
* learning-key encoding change. Absent ⇒ direct vendor wire.
|
|
49
|
+
*/
|
|
50
|
+
route?: 'direct' | 'openrouter';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type { CompileOptions as C };
|
package/dist/dialect.d.mts
CHANGED
|
@@ -133,5 +133,15 @@ declare function hashShape(s: ShapeSignature): string;
|
|
|
133
133
|
* any app can produce and any app can benefit from.
|
|
134
134
|
*/
|
|
135
135
|
declare function learningKey(archetype: IntentArchetypeName, model: string, shape: ShapeSignature): string;
|
|
136
|
+
/**
|
|
137
|
+
* alpha.92 — the model segment of a learning key, route-scoped. A route is
|
|
138
|
+
* part of a measurement's identity (execute-leg contract): the same model id
|
|
139
|
+
* through a gateway is a different serving stack per host, so non-direct
|
|
140
|
+
* evidence carries the route dimension (`model@openrouter`) and can never
|
|
141
|
+
* pollute direct-vendor evidence. ONE derivation, used by compile() and
|
|
142
|
+
* registerCompile() both — two inline encodings of one concept is the s75
|
|
143
|
+
* drift shape.
|
|
144
|
+
*/
|
|
145
|
+
declare function routeScopedModel(model: string, route?: 'direct' | 'openrouter'): string;
|
|
136
146
|
|
|
137
|
-
export { ALL_ARCHETYPES, type ContextBucket, DIALECT_VERSION, type HistoryDepth, INTENT_ARCHETYPES, type IntentArchetypeName, type OutputMode, type ShapeSignature, type ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey, resolveOutputMode };
|
|
147
|
+
export { ALL_ARCHETYPES, type ContextBucket, DIALECT_VERSION, type HistoryDepth, INTENT_ARCHETYPES, type IntentArchetypeName, type OutputMode, type ShapeSignature, type ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey, resolveOutputMode, routeScopedModel };
|
package/dist/dialect.d.ts
CHANGED
|
@@ -133,5 +133,15 @@ declare function hashShape(s: ShapeSignature): string;
|
|
|
133
133
|
* any app can produce and any app can benefit from.
|
|
134
134
|
*/
|
|
135
135
|
declare function learningKey(archetype: IntentArchetypeName, model: string, shape: ShapeSignature): string;
|
|
136
|
+
/**
|
|
137
|
+
* alpha.92 — the model segment of a learning key, route-scoped. A route is
|
|
138
|
+
* part of a measurement's identity (execute-leg contract): the same model id
|
|
139
|
+
* through a gateway is a different serving stack per host, so non-direct
|
|
140
|
+
* evidence carries the route dimension (`model@openrouter`) and can never
|
|
141
|
+
* pollute direct-vendor evidence. ONE derivation, used by compile() and
|
|
142
|
+
* registerCompile() both — two inline encodings of one concept is the s75
|
|
143
|
+
* drift shape.
|
|
144
|
+
*/
|
|
145
|
+
declare function routeScopedModel(model: string, route?: 'direct' | 'openrouter'): string;
|
|
136
146
|
|
|
137
|
-
export { ALL_ARCHETYPES, type ContextBucket, DIALECT_VERSION, type HistoryDepth, INTENT_ARCHETYPES, type IntentArchetypeName, type OutputMode, type ShapeSignature, type ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey, resolveOutputMode };
|
|
147
|
+
export { ALL_ARCHETYPES, type ContextBucket, DIALECT_VERSION, type HistoryDepth, INTENT_ARCHETYPES, type IntentArchetypeName, type OutputMode, type ShapeSignature, type ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey, resolveOutputMode, routeScopedModel };
|
package/dist/dialect.js
CHANGED
|
@@ -29,7 +29,8 @@ __export(dialect_exports, {
|
|
|
29
29
|
hashShape: () => hashShape,
|
|
30
30
|
isArchetype: () => isArchetype,
|
|
31
31
|
learningKey: () => learningKey,
|
|
32
|
-
resolveOutputMode: () => resolveOutputMode
|
|
32
|
+
resolveOutputMode: () => resolveOutputMode,
|
|
33
|
+
routeScopedModel: () => routeScopedModel
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(dialect_exports);
|
|
35
36
|
var DIALECT_VERSION = "v1";
|
|
@@ -124,6 +125,9 @@ function hashShape(s) {
|
|
|
124
125
|
function learningKey(archetype, model, shape) {
|
|
125
126
|
return `${DIALECT_VERSION}::${archetype}::${model}::${hashShape(shape)}`;
|
|
126
127
|
}
|
|
128
|
+
function routeScopedModel(model, route) {
|
|
129
|
+
return route === "openrouter" ? `${model}@openrouter` : model;
|
|
130
|
+
}
|
|
127
131
|
// Annotate the CommonJS export names for ESM import in node:
|
|
128
132
|
0 && (module.exports = {
|
|
129
133
|
ALL_ARCHETYPES,
|
|
@@ -135,5 +139,6 @@ function learningKey(archetype, model, shape) {
|
|
|
135
139
|
hashShape,
|
|
136
140
|
isArchetype,
|
|
137
141
|
learningKey,
|
|
138
|
-
resolveOutputMode
|
|
142
|
+
resolveOutputMode,
|
|
143
|
+
routeScopedModel
|
|
139
144
|
});
|
package/dist/dialect.mjs
CHANGED
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
hashShape,
|
|
9
9
|
isArchetype,
|
|
10
10
|
learningKey,
|
|
11
|
-
resolveOutputMode
|
|
12
|
-
|
|
11
|
+
resolveOutputMode,
|
|
12
|
+
routeScopedModel
|
|
13
|
+
} from "./chunk-FEMPY6EC.mjs";
|
|
13
14
|
export {
|
|
14
15
|
ALL_ARCHETYPES,
|
|
15
16
|
DIALECT_VERSION,
|
|
@@ -20,5 +21,6 @@ export {
|
|
|
20
21
|
hashShape,
|
|
21
22
|
isArchetype,
|
|
22
23
|
learningKey,
|
|
23
|
-
resolveOutputMode
|
|
24
|
+
resolveOutputMode,
|
|
25
|
+
routeScopedModel
|
|
24
26
|
};
|
|
@@ -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-_myk4bxn.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-_myk4bxn.mjs';
|
|
3
|
+
import '../ir-DyMJ84je.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-BlrbNQfj.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-BlrbNQfj.js';
|
|
3
|
+
import '../ir-DbvOFKF-.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-_myk4bxn.mjs';
|
|
2
|
+
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-D441T-KC.mjs';
|
|
3
|
+
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-D441T-KC.mjs';
|
|
4
|
+
import '../ir-DyMJ84je.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-BlrbNQfj.js';
|
|
2
|
+
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-5TqjBeZD.js';
|
|
3
|
+
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-5TqjBeZD.js';
|
|
4
|
+
import '../ir-DbvOFKF-.js';
|
|
5
5
|
import '../dialect.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1979,7 +1979,8 @@ var SUPPORTED_PROVIDERS = Object.freeze([
|
|
|
1979
1979
|
"openai",
|
|
1980
1980
|
"deepseek",
|
|
1981
1981
|
"zai",
|
|
1982
|
-
"moonshot"
|
|
1982
|
+
"moonshot",
|
|
1983
|
+
"openrouter"
|
|
1983
1984
|
]);
|
|
1984
1985
|
function isSupportedProvider(p) {
|
|
1985
1986
|
return SUPPORTED_PROVIDERS.includes(p);
|
|
@@ -2000,7 +2001,11 @@ var PROVIDER_ENV_KEYS = Object.freeze({
|
|
|
2000
2001
|
// alpha.65 — Moonshot AI (Kimi family). MOONSHOT_API_KEY is canonical
|
|
2001
2002
|
// (api.moonshot.ai); KIMI_API_KEY covers the platform.kimi.ai rebrand
|
|
2002
2003
|
// surface so consumers keyed under either name resolve.
|
|
2003
|
-
moonshot: Object.freeze(["MOONSHOT_API_KEY", "KIMI_API_KEY"])
|
|
2004
|
+
moonshot: Object.freeze(["MOONSHOT_API_KEY", "KIMI_API_KEY"]),
|
|
2005
|
+
// alpha.92 — the OpenRouter gateway route (execute-leg contract). This is
|
|
2006
|
+
// a ROUTE key, not a vendor key: it never makes a vendor "reachable" for
|
|
2007
|
+
// chain composition — only explicit `route: 'openrouter'` calls use it.
|
|
2008
|
+
openrouter: Object.freeze(["OPENROUTER_API_KEY"])
|
|
2004
2009
|
});
|
|
2005
2010
|
function defaultEnv() {
|
|
2006
2011
|
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-S4PA2BDB.mjs";
|
|
5
5
|
import {
|
|
6
6
|
tryGetProfile
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-YO2ZLPSD.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-D441T-KC.mjs';
|
|
3
|
+
import '../../ir-DyMJ84je.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-5TqjBeZD.js';
|
|
3
|
+
import '../../ir-DbvOFKF-.js';
|
|
4
4
|
import '../../dialect.js';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,54 +1,13 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, _testClearConsumerProfiles, allProfiles, bestEffortProfile, getProfile, inferProviderFromId, latencyTierOf, profilesByProvider, registerProfiles, resolveModelAlias, tryGetProfile } from './profiles.mjs';
|
|
1
|
+
import { C as CompileOptions } from './compile-C2IfAGV1.mjs';
|
|
2
|
+
import { N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, C as CompiledRequest, a as CompilePolicy, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, F as FallbackReason, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OutcomeSource, i as OracleScore, j as Adapter, k as PerAxisMetrics, l as Provider, m as ChainEntry, G as Grounding } from './ir-DyMJ84je.mjs';
|
|
3
|
+
export { n as CallAttempt, o as CallError, p as ChainModelEntry, q as ChainWithGrounding, r as Constraints, E as EffortLevel, s as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, t as MutationApplied, u as NormalizedTokens, v as OutcomeKind, w as PerAxisMetricsByModel, x as PromptSection, y as SectionKind, z as ShadowProbeConfig, T as ToolCall, D as ToolDefinition, J as captureGoldenIr, K as hasMutation, L as mutationId, Q as parseGoldenCaptureRate, U as resolveGoldenCaptureRate, V as shouldCaptureGolden } from './ir-DyMJ84je.mjs';
|
|
5
4
|
export { BrainForwardConfig, BrainForwardRoutes, createBrainForwardRoutes } from './brain-proxy.mjs';
|
|
6
5
|
export { KEY_FINGERPRINT_DOMAIN, KEY_FINGERPRINT_LENGTH, KeyHealthConfig, KeyHealthProvider, KeyHealthResponseBody, KeyHealthResult, KeyHealthRoute, createKeyHealthRoute, keyFingerprint } from './key-health.mjs';
|
|
6
|
+
import { ModelProfile, ArchetypeConvention } from './profiles.mjs';
|
|
7
|
+
export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, _testClearConsumerProfiles, allProfiles, bestEffortProfile, getProfile, inferProviderFromId, latencyTierOf, profilesByProvider, registerProfiles, resolveModelAlias, tryGetProfile } from './profiles.mjs';
|
|
7
8
|
import { IntentArchetypeName, OutputMode } from './dialect.mjs';
|
|
8
9
|
export { ALL_ARCHETYPES, ContextBucket, DIALECT_VERSION, HistoryDepth, INTENT_ARCHETYPES, ShapeSignature, ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey } from './dialect.mjs';
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
* compile() — the main orchestrator.
|
|
12
|
-
*
|
|
13
|
-
* Runs all passes in order, picks a target, lowers to wire format, returns
|
|
14
|
-
* a CompileResult the caller uses to make the actual provider call.
|
|
15
|
-
*
|
|
16
|
-
* Pure function in v2.0.0-alpha.1: no network, no I/O, no mutation cache yet.
|
|
17
|
-
* Mutation cache will be added in v2.1 when the brain has data to push.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
interface CompileOptions {
|
|
21
|
-
/** Custom profile resolver — for tests or custom profile sets. */
|
|
22
|
-
profileResolver?: (id: string) => ModelProfile;
|
|
23
|
-
/** Tool relevance threshold (default 0.2). */
|
|
24
|
-
toolRelevanceThreshold?: number;
|
|
25
|
-
/** History compression — turns count threshold (default 8). */
|
|
26
|
-
compressHistoryAfter?: number;
|
|
27
|
-
/**
|
|
28
|
-
* History compression — token threshold (alpha.7). When total history
|
|
29
|
-
* tokens exceed this AND there are more recent turns to keep, compress
|
|
30
|
-
* even when count threshold is below `compressHistoryAfter`. Catches
|
|
31
|
-
* fat-message bloat (tool-using agents pack many tool-call/result pairs
|
|
32
|
-
* into single assistant messages — count stays low, tokens explode).
|
|
33
|
-
* Default undefined (disabled — backward-compatible).
|
|
34
|
-
*/
|
|
35
|
-
compressHistoryAboveTokens?: number;
|
|
36
|
-
/**
|
|
37
|
-
* Consumer-declared policy. Filters blocked models, enforces cost
|
|
38
|
-
* ceiling, boosts preferred. See CompilePolicy in ir.ts.
|
|
39
|
-
*/
|
|
40
|
-
policy?: CompilePolicy;
|
|
41
|
-
/**
|
|
42
|
-
* alpha.68 / Release A (delegation-fanout-accelerator §5.0, R0 linkage) —
|
|
43
|
-
* transport for the fan-out parent handle. Threaded from
|
|
44
|
-
* `CallOptions.parentHandle` on the call() path (and settable directly on the
|
|
45
|
-
* public compile() path). Release A does NOT route on it — it only labels the
|
|
46
|
-
* outcome row (fanout_role / trace_id / parent_handle) at record-registration
|
|
47
|
-
* time. `registerCompile` reads it to derive the linkage. Absent ⇒ root call.
|
|
48
|
-
*/
|
|
49
|
-
parentHandle?: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
11
|
/**
|
|
53
12
|
* execute() — fire a CompiledRequest at the right provider, normalize the
|
|
54
13
|
* response shape across providers.
|
|
@@ -666,6 +625,10 @@ interface OutcomePayload {
|
|
|
666
625
|
provider?: string;
|
|
667
626
|
shape_key?: string;
|
|
668
627
|
learning_key?: string;
|
|
628
|
+
/** alpha.92 (migration 067) — route identity: 'direct' | 'openrouter'. */
|
|
629
|
+
route?: string;
|
|
630
|
+
/** alpha.92 — gateway-reported serving host (OpenRouter `provider` field). */
|
|
631
|
+
route_host?: string;
|
|
669
632
|
mutations_applied: string[];
|
|
670
633
|
tokens_in: number;
|
|
671
634
|
tokens_out: number;
|
|
@@ -862,6 +825,7 @@ declare function buildShadowProbeRow(input: ShadowProbeRecordInput): {
|
|
|
862
825
|
latency_candidate_ms: number | null;
|
|
863
826
|
prompt_fidelity: number;
|
|
864
827
|
replay_source: 'inline-full-ir';
|
|
828
|
+
evidence_basis: 'controlled';
|
|
865
829
|
outcome: 'completed' | 'aborted_latency_budget' | 'skipped_slow_tier_sync' | 'candidate_error';
|
|
866
830
|
error_class: string | null;
|
|
867
831
|
};
|
|
@@ -1270,7 +1234,7 @@ declare function runStrategyEvalWithAttribution(opts: Omit<GoldenEvalOptions, 'a
|
|
|
1270
1234
|
* guard in `tests/version.test.ts` fails the suite (and therefore
|
|
1271
1235
|
* `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
|
|
1272
1236
|
*/
|
|
1273
|
-
declare const LIBRARY_VERSION = "2.0.0-alpha.
|
|
1237
|
+
declare const LIBRARY_VERSION = "2.0.0-alpha.93";
|
|
1274
1238
|
|
|
1275
1239
|
/**
|
|
1276
1240
|
* Oracle contract — how an app tells the brain whether a response was good.
|
|
@@ -2668,7 +2632,7 @@ declare function getPerAxisMetrics(opts: GetPerAxisMetricsOpts): Promise<PerAxis
|
|
|
2668
2632
|
* no execute() handler, no env-var convention). Narrowing here keeps the
|
|
2669
2633
|
* reachability check structurally honest.
|
|
2670
2634
|
*/
|
|
2671
|
-
type SupportedProvider = 'anthropic' | 'google' | 'openai' | 'deepseek' | 'zai' | 'moonshot';
|
|
2635
|
+
type SupportedProvider = 'anthropic' | 'google' | 'openai' | 'deepseek' | 'zai' | 'moonshot' | 'openrouter';
|
|
2672
2636
|
/**
|
|
2673
2637
|
* Per-provider env var names kgauto recognizes. Order doesn't matter —
|
|
2674
2638
|
* first-present wins. Multiple names per provider supported because Google
|
|
@@ -4091,4 +4055,4 @@ declare function planDecomposition(args: PlanDecompositionArgs): DecompositionPl
|
|
|
4091
4055
|
*/
|
|
4092
4056
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
4093
4057
|
|
|
4094
|
-
export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ALT_BLIND_TOKEN_BUDGET_BREACH, ALT_STRATEGY_IDS, ARCHETYPE_FAMILY_FITS, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryEvidenceWindow, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, ArchetypeConvention, type ArchetypeFamilyFit, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BLOCKED_MODEL_FAMILY_SIBLING_SERVED_CODE, BLOCKED_MODEL_NOT_IN_ROSTER_CODE, BRAIN_READ_ENV_NAMES, BURST_SPAN_MS, BestPracticeAdvisory, type BrainConfig, type BrainDeadLetterEntry, type BrainHealthSnapshot, type BrainQueryConfig, type BrainReadEnv, COACH_CFG, COST_RANKING_REFERENCE_SHAPE, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result,
|
|
4058
|
+
export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ALT_BLIND_TOKEN_BUDGET_BREACH, ALT_STRATEGY_IDS, ARCHETYPE_FAMILY_FITS, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryEvidenceWindow, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, ArchetypeConvention, type ArchetypeFamilyFit, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BLOCKED_MODEL_FAMILY_SIBLING_SERVED_CODE, BLOCKED_MODEL_NOT_IN_ROSTER_CODE, BRAIN_READ_ENV_NAMES, BURST_SPAN_MS, BestPracticeAdvisory, type BrainConfig, type BrainDeadLetterEntry, type BrainHealthSnapshot, type BrainQueryConfig, type BrainReadEnv, COACH_CFG, COST_RANKING_REFERENCE_SHAPE, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, CompileOptions, CompilePolicy, CompileResult, CompiledRequest, type CreateDelegateOpts, DECOMPOSITION_TEMPLATES, DECOMPOSITION_TEMPLATES_VERSION, DEFAULT_FINDINGS_ENDPOINT, DEFAULT_JUDGE_MODEL, DEFAULT_MEASURED_FAILURE_ENDPOINT, DEFAULT_PROMOTIONS_ENDPOINT, DELEGATE_TOOL_DEFINITION, DISCIPLINE_GATES_V1_ALT_BLIND_HEADER, DISCIPLINE_GATES_V1_ALT_HEADER, type DecompositionPlan, type DecompositionStep, type DecompositionTemplate, type DelegateHandle, type DelegateRefusalReason, type DelegateResult, type DelegateToolArgs, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type ExecutorCandidate, type FallbackPosture, FallbackReason, FamilyResolutionError, type GetActionableAdvisoriesOptions, type GetApplicablePromotionOpts, type GetDefaultFallbackChainOpts, type GetMeasuredFailureOpts, type GetPerAxisMetricsOpts, type GetRecommendedPrimaryOptions, type GoldenEvalAxis, type GoldenEvalCase, type GoldenEvalOptions, type GoldenEvalRunResult, type GoldenEvalStrategyId, type GoldenIrRecordInput, Grounding, IntentArchetypeName, JUDGE_RUBRICS, LIBRARY_VERSION, type LLMJudgeOptions, MEASURED_FAILURE_CFG, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type MarkPromoteReadyHandledOptions, type MeasuredFailureRuntime, type MeasuredFailureVerdict, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, OutputMode, PRODUCER_OWNED_RULE_CODES, PROVIDER_ENV_KEYS, PerAxisMetrics, type PlannedStep, type PricingRow, type ProbeShadowOptions, type ProbeShadowServed, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, type PromotionRow, type PromotionsRuntime, PromptIR, Provider, ProviderOverrides, type ProviderReachability, ROLLBACK_SUPPRESSION_WINDOW_DAYS, RULE_DISCIPLINE_GATES_V1, RULE_DISCIPLINE_GATES_V1_STRUCTURED, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, STRATEGY_AUTHORSHIP_INDEPENDENT, STRATEGY_AUTHORSHIP_LIMITATION, SectionRewrite, type ShadowProbeRecordInput, type StrategyAttribution, type StrategyAttributionResult, type StrategyOutcome, type SupportedProvider, type SurfaceFailureRow, type SurfaceStats, SystemModelMessage, TRANSLATOR_FLOOR, _testResetMeasuredFailure, _testResetOutcomeSourceWarning, _testResetPromotions, _testWaitForMeasuredFailureRefresh, _testWaitForPromotionsRefresh, altBlindGatesBlockFor, altGatesBlockFor, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, awaitMeasuredFailureReady, awaitPromotionsReady, brainHealth, buildGoldenIrRow, buildLLMJudge, buildPairwiseJudgePrompt, buildShadowProbeRow, burstCaveat, call, chainProviderSpread, classifyEvidenceWindow, classifyStrategyOutcome, clearBrain, combineOrderSwappedVerdicts, compile, compileForAISDKv6, configureBrain, configureMeasuredFailureBrain, configurePromotionsBrain, countTokens, createDelegate, deriveFamilyFromModelId, deriveOwnership, estimateChainCostUsd, estimateModelCostUsd, execute, findBetterFit, flushBrainDeadLetter, formatEvidenceSpan, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getApplicablePromotion, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getMeasuredFailureVerdict, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecentRollback, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isAltStrategy, isAutoPromoteEnabledFromEnv, isBrainQueryActiveFor, isBrainSync, isDelegateEnabledFromEnv, isExclusionFindingsBrainActive, isMeasuredFailureBrainActive, isMeasuredFailureGateEnabledFromEnv, isModelReachable, isPromotionsBrainActive, isProviderReachable, judgeMeasuredFailure, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, mapMeasuredFailureRows, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, parseJudgeVerdict, peekBrainDeadLetter, planDecomposition, prefetchMeasuredFailure, prefetchPromotions, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolveOutcomeSource, resolvePricingAt, resolveProviderKey, rowToAdvisory, rubricFor, runAdvisor, runGoldenEval, runStrategyEvalWithAttribution, setTokenizer, wilsonLowerBound, withAltBlindDisciplineContract, withAltDisciplineContract, withDisciplineContract };
|