@warmdrift/kgauto-compiler 2.0.0-alpha.74 → 2.0.0-alpha.76
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-EB2YR7HL.mjs → chunk-WZZCW6NA.mjs} +1 -1
- package/dist/index.d.mts +310 -8
- package/dist/index.d.ts +310 -8
- package/dist/index.js +463 -25
- package/dist/index.mjs +449 -24
- package/dist/key-health.js +1 -1
- package/dist/key-health.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -927,10 +927,39 @@ declare function parseJudgeVerdict(raw: string): {
|
|
|
927
927
|
* noise reads as a tie, never as a win).
|
|
928
928
|
*/
|
|
929
929
|
declare function combineOrderSwappedVerdicts(run1: 'candidate-better' | 'current-better' | 'tied', run2: 'candidate-better' | 'current-better' | 'tied'): 'candidate-better' | 'current-better' | 'tied';
|
|
930
|
+
/**
|
|
931
|
+
* Release B — the eval's comparison primitive is arm-agnostic: a MODEL
|
|
932
|
+
* comparison varies `model` and holds `ir`; a STRATEGY comparison varies
|
|
933
|
+
* `ir` and holds `model`. Same replay, same judge, same order-swap, same
|
|
934
|
+
* floors.
|
|
935
|
+
*/
|
|
936
|
+
type GoldenEvalAxis = 'model' | 'strategy';
|
|
937
|
+
/** Strategies the eval can measure. Closed set — a strategy is only
|
|
938
|
+
* measurable against its exact frozen bytes. The `-alt` wording is
|
|
939
|
+
* EVAL-ONLY: it exists to attribute a v1 loss to wording vs mechanism
|
|
940
|
+
* (§6) and never ships in a production compile. */
|
|
941
|
+
type GoldenEvalStrategyId = 'discipline-gates-v1' | 'discipline-gates-v1-alt';
|
|
930
942
|
interface GoldenEvalOptions {
|
|
931
943
|
appId: string;
|
|
932
944
|
archetype: string;
|
|
933
|
-
|
|
945
|
+
/**
|
|
946
|
+
* Release B — comparison axis. Default 'model' (alpha.62 behavior,
|
|
947
|
+
* unchanged). On 'strategy': arm A = the golden IR as stored (gates-off),
|
|
948
|
+
* arm B = the same IR with a `discipline_contract` section appended
|
|
949
|
+
* (gates-on), both replayed on ONE model (`strategyModel` or the resolved
|
|
950
|
+
* incumbent). `candidateModel` is ignored on the strategy axis;
|
|
951
|
+
* `strategy` is required.
|
|
952
|
+
*/
|
|
953
|
+
axis?: GoldenEvalAxis;
|
|
954
|
+
/** Required when axis==='strategy': the strategy under measurement. */
|
|
955
|
+
strategy?: GoldenEvalStrategyId;
|
|
956
|
+
/**
|
|
957
|
+
* axis==='strategy' only: the model both arms run on. Default: the
|
|
958
|
+
* resolved incumbent (most-captured model in the golden set).
|
|
959
|
+
*/
|
|
960
|
+
strategyModel?: string;
|
|
961
|
+
/** Required when axis is 'model' (the default). */
|
|
962
|
+
candidateModel?: string;
|
|
934
963
|
/**
|
|
935
964
|
* Incumbent to compare against. Default: the most frequent incumbent_model
|
|
936
965
|
* across the loaded golden set (the surface's de-facto leader).
|
|
@@ -961,6 +990,18 @@ interface GoldenEvalOptions {
|
|
|
961
990
|
interface GoldenEvalCase {
|
|
962
991
|
goldenIrId: number;
|
|
963
992
|
verdict: 'candidate-better' | 'tied' | 'current-better' | 'inconclusive';
|
|
993
|
+
/**
|
|
994
|
+
* Release B — the RAW order-swapped pair, in incumbent/candidate terms,
|
|
995
|
+
* BEFORE `combineOrderSwappedVerdicts` folds disagreement into 'tied'.
|
|
996
|
+
* The fold is public API and unchanged; this records what it discards,
|
|
997
|
+
* because positional DISAGREEMENT RATE is an objective reliability metric
|
|
998
|
+
* needing no ground truth (§4.0 — the strategy experiment's primary
|
|
999
|
+
* metric is positional consistency, not judge quality).
|
|
1000
|
+
*/
|
|
1001
|
+
orderVerdicts?: {
|
|
1002
|
+
run1: 'candidate-better' | 'current-better' | 'tied';
|
|
1003
|
+
run2: 'candidate-better' | 'current-better' | 'tied';
|
|
1004
|
+
};
|
|
964
1005
|
judgeRationale?: string;
|
|
965
1006
|
/** Hard-floor violations on the candidate side for this case. */
|
|
966
1007
|
floorViolations: Array<'empty' | 'schema' | 'candidate_error'>;
|
|
@@ -983,6 +1024,15 @@ interface GoldenEvalCase {
|
|
|
983
1024
|
interface GoldenEvalRunResult {
|
|
984
1025
|
verdict: 'promote-ready' | 'not-inferior' | 'inconclusive';
|
|
985
1026
|
runId?: number;
|
|
1027
|
+
/**
|
|
1028
|
+
* Release B — which axis produced this verdict. Load-bearing, not
|
|
1029
|
+
* cosmetic: a results table that can't tell you which axis produced a
|
|
1030
|
+
* verdict is a false-attribution engine. On 'strategy',
|
|
1031
|
+
* incumbentModel === candidateModel (the model held constant) and
|
|
1032
|
+
* `strategy` names the arm-B mutation.
|
|
1033
|
+
*/
|
|
1034
|
+
axis: GoldenEvalAxis;
|
|
1035
|
+
strategy?: GoldenEvalStrategyId;
|
|
986
1036
|
appId: string;
|
|
987
1037
|
archetype: string;
|
|
988
1038
|
incumbentModel: string;
|
|
@@ -1002,7 +1052,59 @@ interface GoldenEvalRunResult {
|
|
|
1002
1052
|
cases: GoldenEvalCase[];
|
|
1003
1053
|
notes: string[];
|
|
1004
1054
|
}
|
|
1055
|
+
declare function withDisciplineContract(ir: PromptIR): PromptIR;
|
|
1056
|
+
declare const DISCIPLINE_GATES_V1_ALT_HEADER = "Before stating any conclusion, run this check:";
|
|
1057
|
+
declare function altGatesBlockFor(args: {
|
|
1058
|
+
outputMode: 'text' | 'json' | 'tool_call';
|
|
1059
|
+
hasTools: boolean;
|
|
1060
|
+
}): string;
|
|
1061
|
+
/**
|
|
1062
|
+
* The alt arm injects its block DIRECTLY as an untagged section — it must
|
|
1063
|
+
* not carry `kind: 'discipline_contract'`, or the translator would prepend
|
|
1064
|
+
* the v1 bytes on top and the arm would measure both wordings at once. The
|
|
1065
|
+
* variant choice mirrors matchRule()'s exactly (same outputMode + hasTools
|
|
1066
|
+
* inputs), so the alt arm no-ops nowhere v1 fires and fires nowhere v1
|
|
1067
|
+
* no-ops — the attribution is about WORDING, and everything else is held.
|
|
1068
|
+
*/
|
|
1069
|
+
declare function withAltDisciplineContract(ir: PromptIR): PromptIR;
|
|
1005
1070
|
declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunResult>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Aggregate outcome of one strategy run, in gates-on terms. 'loses' is the
|
|
1073
|
+
* only branch that costs a third replay — and the only one where wording
|
|
1074
|
+
* attribution matters.
|
|
1075
|
+
*/
|
|
1076
|
+
type StrategyOutcome = 'wins' | 'ties' | 'loses' | 'inconclusive';
|
|
1077
|
+
declare function classifyStrategyOutcome(r: GoldenEvalRunResult): StrategyOutcome;
|
|
1078
|
+
/**
|
|
1079
|
+
* The §6 attribution matrix. The load-bearing distinction: a WORDING failure
|
|
1080
|
+
* recorded as a mechanism failure would let Factor B permanently disable a
|
|
1081
|
+
* real capability on evidence about one author's prose.
|
|
1082
|
+
*
|
|
1083
|
+
* v1 vs off | alt vs off | attribution
|
|
1084
|
+
* ----------+------------+----------------------------------------------
|
|
1085
|
+
* wins | (not run) | mechanism-works — ship
|
|
1086
|
+
* ties | (not run) | no-lift — inconclusive at this n, re-eval later
|
|
1087
|
+
* loses | wins | wording-failure — do NOT disable the mechanism
|
|
1088
|
+
* loses | loses | mechanism-failure — well-evidenced; Factor B may disable
|
|
1089
|
+
* loses | ties/inc. | wording-inconclusive — no disable on ambiguity
|
|
1090
|
+
*/
|
|
1091
|
+
type StrategyAttribution = 'mechanism-works' | 'no-lift' | 'wording-failure' | 'mechanism-failure' | 'wording-inconclusive' | 'inconclusive';
|
|
1092
|
+
interface StrategyAttributionResult {
|
|
1093
|
+
attribution: StrategyAttribution;
|
|
1094
|
+
primary: GoldenEvalRunResult;
|
|
1095
|
+
/** Present ONLY when the primary lost (the loss-triggered third arm). */
|
|
1096
|
+
alt?: GoldenEvalRunResult;
|
|
1097
|
+
/** The authorship limitation, restated on every result so no downstream
|
|
1098
|
+
* reader can cite an attribution without it. */
|
|
1099
|
+
limitation: string;
|
|
1100
|
+
}
|
|
1101
|
+
declare const STRATEGY_AUTHORSHIP_LIMITATION: string;
|
|
1102
|
+
/**
|
|
1103
|
+
* Run the strategy eval with loss-triggered wording attribution: v1 first;
|
|
1104
|
+
* the alt arm replays ONLY on a v1 loss (mirrors the engine's retry
|
|
1105
|
+
* posture — don't pay for extra evidence until a result demands it).
|
|
1106
|
+
*/
|
|
1107
|
+
declare function runStrategyEvalWithAttribution(opts: Omit<GoldenEvalOptions, 'axis' | 'strategy' | 'candidateModel'>): Promise<StrategyAttributionResult>;
|
|
1006
1108
|
|
|
1007
1109
|
/**
|
|
1008
1110
|
* alpha.60 — the library's own version, baked as a constant so Edge/Worker
|
|
@@ -1017,7 +1119,7 @@ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunRe
|
|
|
1017
1119
|
* guard in `tests/version.test.ts` fails the suite (and therefore
|
|
1018
1120
|
* `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
|
|
1019
1121
|
*/
|
|
1020
|
-
declare const LIBRARY_VERSION = "2.0.0-alpha.
|
|
1122
|
+
declare const LIBRARY_VERSION = "2.0.0-alpha.76";
|
|
1021
1123
|
|
|
1022
1124
|
/**
|
|
1023
1125
|
* Oracle contract — how an app tells the brain whether a response was good.
|
|
@@ -1351,6 +1453,32 @@ declare const TRANSLATOR_FLOOR = 6;
|
|
|
1351
1453
|
* fingerprint — both stay byte-stable across releases.
|
|
1352
1454
|
*/
|
|
1353
1455
|
declare const RULE_SEQUENTIAL_TOOL_CLIFF = "sequential-tool-cliff-below-floor";
|
|
1456
|
+
/**
|
|
1457
|
+
* alpha.68 / Release A — stable identifier of the discipline-gates rule.
|
|
1458
|
+
* Fires on `discipline_contract` sections that pass the two-factor eligibility
|
|
1459
|
+
* screen (Factor A archetype + Factor C output-shape). Surfaces on
|
|
1460
|
+
* `SectionRewrite.rule` and in brain aggregates.
|
|
1461
|
+
*
|
|
1462
|
+
* Versioned (`v1`) deliberately: Factor B evidence (Release B) is only valid
|
|
1463
|
+
* against the EXACT bytes that produced it, so a silent gate edit would
|
|
1464
|
+
* invalidate every standing verdict. A real gate change bumps this to `v2` and
|
|
1465
|
+
* resets Factor B to unmeasured for every tuple.
|
|
1466
|
+
*/
|
|
1467
|
+
declare const RULE_DISCIPLINE_GATES_V1 = "discipline-gates-v1";
|
|
1468
|
+
/**
|
|
1469
|
+
* Release B — stable identifier of the STRUCTURED-SAFE discipline-gates
|
|
1470
|
+
* variant (design contract §5.D second clause, discharged via §4.0's merge:
|
|
1471
|
+
* "the judge must run gates 1–4 only — which IS Path 1's structured-safe
|
|
1472
|
+
* variant, arrived at as a subset-drop of frozen bytes rather than new
|
|
1473
|
+
* prose"). Fires where the full block is Factor-C-forbidden: `json` and
|
|
1474
|
+
* `tool_call` surfaces, where gates 5+6 are shape-altering and would
|
|
1475
|
+
* manufacture the structured-output violations alpha.66 retries.
|
|
1476
|
+
*
|
|
1477
|
+
* Versioned with the SAME v1 stamp as its parent: its bytes are a strict
|
|
1478
|
+
* subset of `discipline-gates-v1`'s, so a v1 wording change is a variant
|
|
1479
|
+
* wording change by construction, and both bump together.
|
|
1480
|
+
*/
|
|
1481
|
+
declare const RULE_DISCIPLINE_GATES_V1_STRUCTURED = "discipline-gates-v1-structured";
|
|
1354
1482
|
interface ApplySectionRewritesArgs {
|
|
1355
1483
|
ir: PromptIR;
|
|
1356
1484
|
profile: ModelProfile;
|
|
@@ -2807,11 +2935,40 @@ declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions):
|
|
|
2807
2935
|
* One active surface promotion, camelCase-mapped at the boundary from the
|
|
2808
2936
|
* snake_case endpoint row (typed-boundary-transformer convention).
|
|
2809
2937
|
*/
|
|
2938
|
+
/**
|
|
2939
|
+
* Release B (alpha.75): `kgauto_promotions` carries two logical channels
|
|
2940
|
+
* sharing one table and one lifecycle (migration 047). `mode` is the
|
|
2941
|
+
* discriminator, and each mode has exactly ONE consumption site:
|
|
2942
|
+
*
|
|
2943
|
+
* mode reader effect
|
|
2944
|
+
* ---------- ---------------------------------- -------------------
|
|
2945
|
+
* downswap passScoreTargets (compile pass 5) which MODEL runs
|
|
2946
|
+
* strategy applySectionRewrites (pass 6.5) which IR runs
|
|
2947
|
+
*
|
|
2948
|
+
* The resolver is mode-filtered and no unfiltered accessor exists — an
|
|
2949
|
+
* unfiltered `.find()` was the §7 read-path bug: a strategy row has
|
|
2950
|
+
* promoted_model === incumbent_model, so one reaching the model-boost code
|
|
2951
|
+
* would boost the incumbent and could suppress the alpha.49 quality gate on
|
|
2952
|
+
* evidence that was never about quality-gating.
|
|
2953
|
+
*/
|
|
2954
|
+
type PromotionMode = 'downswap' | 'strategy';
|
|
2810
2955
|
interface PromotionRow {
|
|
2811
2956
|
/** Brain row id — cited in the `promotion-applied` mutation for Glass-Box. */
|
|
2812
2957
|
id: number;
|
|
2813
2958
|
/** Intent archetype the promotion applies to. */
|
|
2814
2959
|
archetype: string;
|
|
2960
|
+
/**
|
|
2961
|
+
* Channel discriminator (migration 047). Rows from a pre-047 endpoint
|
|
2962
|
+
* carry no `mode` on the wire and map to 'downswap' — every pre-047 row
|
|
2963
|
+
* IS a downswap, and strategy rows can only be written by post-047 code
|
|
2964
|
+
* whose endpoint serves the column.
|
|
2965
|
+
*/
|
|
2966
|
+
mode: PromotionMode;
|
|
2967
|
+
/**
|
|
2968
|
+
* The strategy id for mode='strategy' rows (e.g. 'discipline-gates-v1');
|
|
2969
|
+
* null on downswaps. DB CHECK: (mode='strategy') = (strategy IS NOT NULL).
|
|
2970
|
+
*/
|
|
2971
|
+
strategy: string | null;
|
|
2815
2972
|
/** The model this surface now routes to. */
|
|
2816
2973
|
promotedModel: string;
|
|
2817
2974
|
/** The model it replaced (the eval's incumbent). */
|
|
@@ -2821,7 +2978,8 @@ interface PromotionRow {
|
|
|
2821
2978
|
/**
|
|
2822
2979
|
* Evidence-supersedes-judgment: skip the alpha.49 schema-weak
|
|
2823
2980
|
* quality-gate penalty for the promoted model on this surface (the eval
|
|
2824
|
-
* measured the schema floor holding on real workload).
|
|
2981
|
+
* measured the schema floor holding on real workload). Always false on
|
|
2982
|
+
* strategy rows (DB CHECK kgauto_promotions_strategy_no_suppress).
|
|
2825
2983
|
*/
|
|
2826
2984
|
suppressQualityGate: boolean;
|
|
2827
2985
|
/** ISO timestamp the promotion went active. */
|
|
@@ -2861,13 +3019,21 @@ interface GetApplicablePromotionOpts {
|
|
|
2861
3019
|
appId: string;
|
|
2862
3020
|
/** Archetype of the compile in flight. Required. */
|
|
2863
3021
|
archetype: IntentArchetypeName | string;
|
|
3022
|
+
/**
|
|
3023
|
+
* Channel to read (migration 047). Required — there is deliberately no
|
|
3024
|
+
* unfiltered accessor: with one active row per (surface, mode) legal, an
|
|
3025
|
+
* unfiltered first-match-wins `.find()` returns an arbitrary channel's
|
|
3026
|
+
* row, and a strategy row reaching the model-boost reader is the §7
|
|
3027
|
+
* read-path bug.
|
|
3028
|
+
*/
|
|
3029
|
+
mode: PromotionMode;
|
|
2864
3030
|
}
|
|
2865
3031
|
/**
|
|
2866
|
-
* Sync reader. Returns the active promotion for `(appId, archetype)`
|
|
2867
|
-
* undefined. First call returns undefined and triggers async refresh;
|
|
3032
|
+
* Sync reader. Returns the active promotion for `(appId, archetype, mode)`
|
|
3033
|
+
* or undefined. First call returns undefined and triggers async refresh;
|
|
2868
3034
|
* subsequent calls within TTL return brain data. The brain enforces one
|
|
2869
|
-
* active promotion per surface (partial unique index), so at most
|
|
2870
|
-
* matches.
|
|
3035
|
+
* active promotion per (surface, mode) (partial unique index), so at most
|
|
3036
|
+
* one row matches.
|
|
2871
3037
|
*
|
|
2872
3038
|
* NEVER throws. Not configured / brain down / cold → undefined.
|
|
2873
3039
|
*/
|
|
@@ -3056,6 +3222,142 @@ declare function getMeasuredFailureVerdict(opts: GetMeasuredFailureOpts): Measur
|
|
|
3056
3222
|
declare function _testResetMeasuredFailure(): void;
|
|
3057
3223
|
declare function _testWaitForMeasuredFailureRefresh(): Promise<void>;
|
|
3058
3224
|
|
|
3225
|
+
/**
|
|
3226
|
+
* Release C (Rung 1) — the decomposition coach's planning engine.
|
|
3227
|
+
*
|
|
3228
|
+
* Design contract §5.1: evidence-backed advisories on the existing surface —
|
|
3229
|
+
* "you're paying frontier prices for grunt work; here's the measured split."
|
|
3230
|
+
* No contract change; nothing here executes a fan-out. This module is PURE:
|
|
3231
|
+
* templates + arithmetic. The operator script feeds it measured surface
|
|
3232
|
+
* stats and evidence-picked executors; Release D's `delegate` primitive will
|
|
3233
|
+
* consume the SAME templates, so they live in the library, versioned.
|
|
3234
|
+
*
|
|
3235
|
+
* Honesty posture (the roster-with-receipts rule, applied to ourselves):
|
|
3236
|
+
*
|
|
3237
|
+
* - The per-step token SHARES are JUDGMENT v1 numbers — labelled as such
|
|
3238
|
+
* in every plan (`assumptions[]`), versioned so a future measured
|
|
3239
|
+
* replacement invalidates nothing silently. No consumer has fan-out
|
|
3240
|
+
* traffic yet (R0 shipped alpha.68, zero adopters), so there is nothing
|
|
3241
|
+
* to measure them from; the moment branch traffic exists, these
|
|
3242
|
+
* graduate per surface.
|
|
3243
|
+
* - Executor grounding is carried per step: 'measured' when the portfolio
|
|
3244
|
+
* corpus has real outcomes for (model, sub-archetype), 'judgment' when
|
|
3245
|
+
* the roster's archetypePerf is all we have.
|
|
3246
|
+
* - The coach's most credible output at low volume is "KEEP THE MONOLITH"
|
|
3247
|
+
* with the break-even volume stated — the never-worse floor in coach
|
|
3248
|
+
* form. The advisory only files when the split is MATERIAL (same $5/mo
|
|
3249
|
+
* felt-utility floor as promotions); the demo report renders every
|
|
3250
|
+
* analysis either way.
|
|
3251
|
+
*/
|
|
3252
|
+
|
|
3253
|
+
declare const DECOMPOSITION_TEMPLATES_VERSION = "decomposition-templates-v1";
|
|
3254
|
+
interface DecompositionStep {
|
|
3255
|
+
/** Human-readable step name (stable — appears in advisories/recipes). */
|
|
3256
|
+
role: string;
|
|
3257
|
+
/** The sub-archetype this step runs as (its own learning_key downstream). */
|
|
3258
|
+
archetype: IntentArchetypeName;
|
|
3259
|
+
/**
|
|
3260
|
+
* Which tier runs the step. 'delegate' steps are the grunt work the coach
|
|
3261
|
+
* proposes moving to a cheap executor; 'anchor' steps stay on the
|
|
3262
|
+
* incumbent (composition is where fan-outs die — §7a — so the composer
|
|
3263
|
+
* anchors on the strong model by design).
|
|
3264
|
+
*/
|
|
3265
|
+
tier: 'delegate' | 'anchor';
|
|
3266
|
+
/** Share of the monolith's INPUT tokens this step reads. JUDGMENT v1. */
|
|
3267
|
+
inputShare: number;
|
|
3268
|
+
/**
|
|
3269
|
+
* Tokens this step EMITS, as a share of the monolith's input (for
|
|
3270
|
+
* intermediate artifacts like extraction notes) — the next anchor step
|
|
3271
|
+
* reads these instead of the raw input. JUDGMENT v1.
|
|
3272
|
+
*/
|
|
3273
|
+
emitsShareOfInput: number;
|
|
3274
|
+
/** Share of the monolith's OUTPUT tokens this step produces (0 for
|
|
3275
|
+
* intermediate steps; the anchor composer typically carries 1). */
|
|
3276
|
+
outputShare: number;
|
|
3277
|
+
}
|
|
3278
|
+
interface DecompositionTemplate {
|
|
3279
|
+
archetype: IntentArchetypeName;
|
|
3280
|
+
steps: DecompositionStep[];
|
|
3281
|
+
rationale: string;
|
|
3282
|
+
version: typeof DECOMPOSITION_TEMPLATES_VERSION;
|
|
3283
|
+
}
|
|
3284
|
+
/**
|
|
3285
|
+
* v1 covers the three judgment-heavy archetypes with a clear split shape.
|
|
3286
|
+
* Every share number below is a judgment estimate, stated in the plan's
|
|
3287
|
+
* assumptions — they exist to make the ARITHMETIC honest, not to claim
|
|
3288
|
+
* precision the corpus doesn't have yet.
|
|
3289
|
+
*/
|
|
3290
|
+
declare const DECOMPOSITION_TEMPLATES: Partial<Record<IntentArchetypeName, DecompositionTemplate>>;
|
|
3291
|
+
interface SurfaceStats {
|
|
3292
|
+
appId: string;
|
|
3293
|
+
archetype: IntentArchetypeName | string;
|
|
3294
|
+
/** The model serving the monolith today (most-served in the window). */
|
|
3295
|
+
incumbentModel: string;
|
|
3296
|
+
nCalls: number;
|
|
3297
|
+
windowDays: number;
|
|
3298
|
+
avgTokensIn: number;
|
|
3299
|
+
avgTokensOut: number;
|
|
3300
|
+
}
|
|
3301
|
+
interface ExecutorCandidate {
|
|
3302
|
+
modelId: string;
|
|
3303
|
+
/** archetypePerf score on the STEP's archetype. */
|
|
3304
|
+
perfScore: number;
|
|
3305
|
+
grounding: 'measured' | 'judgment';
|
|
3306
|
+
costInputPer1m: number;
|
|
3307
|
+
costOutputPer1m: number;
|
|
3308
|
+
}
|
|
3309
|
+
interface ModelPricing {
|
|
3310
|
+
costInputPer1m: number;
|
|
3311
|
+
costOutputPer1m: number;
|
|
3312
|
+
}
|
|
3313
|
+
interface PlannedStep extends DecompositionStep {
|
|
3314
|
+
/** The picked executor ('delegate' steps) or the incumbent ('anchor'). */
|
|
3315
|
+
executorModel: string;
|
|
3316
|
+
executorGrounding: 'measured' | 'judgment';
|
|
3317
|
+
executorPerfScore: number | null;
|
|
3318
|
+
projectedCostPerCallUsd: number;
|
|
3319
|
+
}
|
|
3320
|
+
interface DecompositionPlan {
|
|
3321
|
+
appId: string;
|
|
3322
|
+
archetype: string;
|
|
3323
|
+
incumbentModel: string;
|
|
3324
|
+
template: DecompositionTemplate;
|
|
3325
|
+
steps: PlannedStep[];
|
|
3326
|
+
monolithCostPerCallUsd: number;
|
|
3327
|
+
splitCostPerCallUsd: number;
|
|
3328
|
+
savingPerCallUsd: number;
|
|
3329
|
+
monthlyCalls: number;
|
|
3330
|
+
projectedMonthlySavingUsd: number;
|
|
3331
|
+
/** Monthly calls at which the split clears the materiality floor. null
|
|
3332
|
+
* when the split doesn't save per-call at all (then no volume helps). */
|
|
3333
|
+
breakEvenMonthlyCalls: number | null;
|
|
3334
|
+
verdict: 'split-pays' | 'keep-monolith';
|
|
3335
|
+
verdictReason: string;
|
|
3336
|
+
/** Judgment inputs, stated. Every number that is not measured is here. */
|
|
3337
|
+
assumptions: string[];
|
|
3338
|
+
}
|
|
3339
|
+
declare const COACH_CFG: {
|
|
3340
|
+
/** Same felt-utility floor as promotions (alpha.67 family). */
|
|
3341
|
+
minMonthlySavingUsd: number;
|
|
3342
|
+
/** Executor must clear this archetypePerf on the step's archetype —
|
|
3343
|
+
* same floor as the translator/advisor (ARCHETYPE_FLOOR_DEFAULT). */
|
|
3344
|
+
executorPerfFloor: number;
|
|
3345
|
+
daysPerMonth: number;
|
|
3346
|
+
};
|
|
3347
|
+
interface PlanDecompositionArgs {
|
|
3348
|
+
stats: SurfaceStats;
|
|
3349
|
+
incumbentPricing: ModelPricing;
|
|
3350
|
+
/**
|
|
3351
|
+
* Evidence-picked executor per step archetype. Return undefined when no
|
|
3352
|
+
* candidate clears the perf floor — the plan then keeps that step on the
|
|
3353
|
+
* incumbent and says so (a coach must not route grunt work to a model
|
|
3354
|
+
* that can't do it just because it is cheap).
|
|
3355
|
+
*/
|
|
3356
|
+
pickExecutor: (archetype: IntentArchetypeName) => ExecutorCandidate | undefined;
|
|
3357
|
+
cfg?: Partial<typeof COACH_CFG>;
|
|
3358
|
+
}
|
|
3359
|
+
declare function planDecomposition(args: PlanDecompositionArgs): DecompositionPlan | undefined;
|
|
3360
|
+
|
|
3059
3361
|
/**
|
|
3060
3362
|
* @warmdrift/kgauto v2 — prompt compiler + central learning brain.
|
|
3061
3363
|
*
|
|
@@ -3102,4 +3404,4 @@ declare function _testWaitForMeasuredFailureRefresh(): Promise<void>;
|
|
|
3102
3404
|
*/
|
|
3103
3405
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
3104
3406
|
|
|
3105
|
-
export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FAMILY_FITS, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, 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, BestPracticeAdvisory, type BrainConfig, type BrainDeadLetterEntry, type BrainHealthSnapshot, type BrainQueryConfig, type BrainReadEnv, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, DEFAULT_FINDINGS_ENDPOINT, DEFAULT_MEASURED_FAILURE_ENDPOINT, DEFAULT_PROMOTIONS_ENDPOINT, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, FamilyResolutionError, type GetActionableAdvisoriesOptions, type GetApplicablePromotionOpts, type GetDefaultFallbackChainOpts, type GetMeasuredFailureOpts, type GetPerAxisMetricsOpts, type GetRecommendedPrimaryOptions, type GoldenEvalCase, type GoldenEvalOptions, type GoldenEvalRunResult, 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 PricingRow, type ProbeShadowOptions, type ProbeShadowServed, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, type PromotionRow, type PromotionsRuntime, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type ShadowProbeRecordInput, type SupportedProvider, type SurfaceFailureRow, SystemModelMessage, TRANSLATOR_FLOOR, _testResetMeasuredFailure, _testResetPromotions, _testWaitForMeasuredFailureRefresh, _testWaitForPromotionsRefresh, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, awaitMeasuredFailureReady, brainHealth, buildGoldenIrRow, buildLLMJudge, buildPairwiseJudgePrompt, buildShadowProbeRow, call, clearBrain, combineOrderSwappedVerdicts, compile, compileForAISDKv6, configureBrain, configureMeasuredFailureBrain, configurePromotionsBrain, countTokens, deriveFamilyFromModelId, deriveOwnership, execute, findBetterFit, flushBrainDeadLetter, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getApplicablePromotion, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getMeasuredFailureVerdict, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isAutoPromoteEnabledFromEnv, isBrainQueryActiveFor, isBrainSync, isExclusionFindingsBrainActive, isMeasuredFailureBrainActive, isMeasuredFailureGateEnabledFromEnv, isModelReachable, isPromotionsBrainActive, isProviderReachable, judgeMeasuredFailure, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, parseJudgeVerdict, peekBrainDeadLetter, prefetchMeasuredFailure, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rubricFor, runAdvisor, runGoldenEval, setTokenizer, wilsonLowerBound };
|
|
3407
|
+
export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FAMILY_FITS, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, 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, BestPracticeAdvisory, type BrainConfig, type BrainDeadLetterEntry, type BrainHealthSnapshot, type BrainQueryConfig, type BrainReadEnv, COACH_CFG, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, DECOMPOSITION_TEMPLATES, DECOMPOSITION_TEMPLATES_VERSION, DEFAULT_FINDINGS_ENDPOINT, DEFAULT_MEASURED_FAILURE_ENDPOINT, DEFAULT_PROMOTIONS_ENDPOINT, DISCIPLINE_GATES_V1_ALT_HEADER, type DecompositionPlan, type DecompositionStep, type DecompositionTemplate, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type ExecutorCandidate, type FallbackPosture, 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, RULE_DISCIPLINE_GATES_V1, RULE_DISCIPLINE_GATES_V1_STRUCTURED, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, STRATEGY_AUTHORSHIP_LIMITATION, SectionRewrite, type ShadowProbeRecordInput, type StrategyAttribution, type StrategyAttributionResult, type StrategyOutcome, type SupportedProvider, type SurfaceFailureRow, type SurfaceStats, SystemModelMessage, TRANSLATOR_FLOOR, _testResetMeasuredFailure, _testResetPromotions, _testWaitForMeasuredFailureRefresh, _testWaitForPromotionsRefresh, altGatesBlockFor, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, awaitMeasuredFailureReady, brainHealth, buildGoldenIrRow, buildLLMJudge, buildPairwiseJudgePrompt, buildShadowProbeRow, call, classifyStrategyOutcome, clearBrain, combineOrderSwappedVerdicts, compile, compileForAISDKv6, configureBrain, configureMeasuredFailureBrain, configurePromotionsBrain, countTokens, deriveFamilyFromModelId, deriveOwnership, execute, findBetterFit, flushBrainDeadLetter, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getApplicablePromotion, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getMeasuredFailureVerdict, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isAutoPromoteEnabledFromEnv, isBrainQueryActiveFor, isBrainSync, isExclusionFindingsBrainActive, isMeasuredFailureBrainActive, isMeasuredFailureGateEnabledFromEnv, isModelReachable, isPromotionsBrainActive, isProviderReachable, judgeMeasuredFailure, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, parseJudgeVerdict, peekBrainDeadLetter, planDecomposition, prefetchMeasuredFailure, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rubricFor, runAdvisor, runGoldenEval, runStrategyEvalWithAttribution, setTokenizer, wilsonLowerBound, withAltDisciplineContract, withDisciplineContract };
|