@warmdrift/kgauto-compiler 2.0.0-alpha.82 → 2.0.0-alpha.85
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-VVRDFE6T.mjs → chunk-FD3NFXDC.mjs} +4 -0
- package/dist/{chunk-XPD4I3Q5.mjs → chunk-LO2JXTGG.mjs} +19 -5
- package/dist/{chunk-L246YOV7.mjs → chunk-WXN7FNXP.mjs} +1 -1
- 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 +16 -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 +396 -141
- package/dist/index.d.ts +396 -141
- package/dist/index.js +283 -37
- package/dist/index.mjs +255 -35
- package/dist/{ir-Cx9hJj0B.d.ts → ir-DfrM71pA.d.ts} +49 -0
- package/dist/{ir-D4S9R816.d.mts → ir-JUoybVM-.d.mts} +49 -0
- package/dist/key-health.js +1 -1
- package/dist/key-health.mjs +1 -1
- package/dist/profiles.d.mts +11 -2
- package/dist/profiles.d.ts +11 -2
- package/dist/profiles.js +5 -0
- package/dist/profiles.mjs +3 -1
- package/dist/{types-DHi4FcUu.d.mts → types-BGH_KAHu.d.mts} +1 -1
- package/dist/{types-CAs9-0S4.d.ts → types-BqTKRECa.d.ts} +1 -1
- package/dist/{types-Cvd6kRNv.d.ts → types-DLDJbCha.d.ts} +1 -1
- package/dist/{types-CRXaR7nJ.d.mts → types-y42mwdvM.d.mts} +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 FallbackReason, 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, 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 hasMutation, K as mutationId, L as parseGoldenCaptureRate, Q as resolveGoldenCaptureRate, U 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 FallbackReason, 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-JUoybVM-.mjs';
|
|
2
|
+
export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, 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 hasMutation, K as mutationId, L as parseGoldenCaptureRate, Q as resolveGoldenCaptureRate, U as shouldCaptureGolden } from './ir-JUoybVM-.mjs';
|
|
3
3
|
import { ModelProfile, ArchetypeConvention } from './profiles.mjs';
|
|
4
|
-
export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, latencyTierOf, profilesByProvider, tryGetProfile } from './profiles.mjs';
|
|
4
|
+
export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, latencyTierOf, profilesByProvider, resolveModelAlias, tryGetProfile } from './profiles.mjs';
|
|
5
5
|
export { BrainForwardConfig, BrainForwardRoutes, createBrainForwardRoutes } from './brain-proxy.mjs';
|
|
6
6
|
export { KEY_FINGERPRINT_DOMAIN, KEY_FINGERPRINT_LENGTH, KeyHealthConfig, KeyHealthProvider, KeyHealthResponseBody, KeyHealthResult, KeyHealthRoute, createKeyHealthRoute, keyFingerprint } from './key-health.mjs';
|
|
7
7
|
import { IntentArchetypeName, OutputMode } from './dialect.mjs';
|
|
@@ -965,7 +965,11 @@ type GoldenEvalAxis = 'model' | 'strategy';
|
|
|
965
965
|
* measurable against its exact frozen bytes. The `-alt` wording is
|
|
966
966
|
* EVAL-ONLY: it exists to attribute a v1 loss to wording vs mechanism
|
|
967
967
|
* (§6) and never ships in a production compile. */
|
|
968
|
-
type GoldenEvalStrategyId = 'discipline-gates-v1' | 'discipline-gates-v1-alt';
|
|
968
|
+
type GoldenEvalStrategyId = 'discipline-gates-v1' | 'discipline-gates-v1-alt' | 'discipline-gates-v1-alt-blind';
|
|
969
|
+
/** Both re-wordings of v1. Dispatch keys on this, never on a string prefix,
|
|
970
|
+
* so adding a fourth arm is one edit rather than a grep. */
|
|
971
|
+
declare const ALT_STRATEGY_IDS: readonly GoldenEvalStrategyId[];
|
|
972
|
+
declare function isAltStrategy(id: GoldenEvalStrategyId | undefined): boolean;
|
|
969
973
|
interface GoldenEvalOptions {
|
|
970
974
|
appId: string;
|
|
971
975
|
archetype: string;
|
|
@@ -1085,6 +1089,45 @@ declare function altGatesBlockFor(args: {
|
|
|
1085
1089
|
outputMode: 'text' | 'json' | 'tool_call';
|
|
1086
1090
|
hasTools: boolean;
|
|
1087
1091
|
}): string;
|
|
1092
|
+
declare const ALT_BLIND_TOKEN_BUDGET_BREACH: {
|
|
1093
|
+
readonly ceilingTokens: 264;
|
|
1094
|
+
readonly measuredTokensTextWithTools: 285;
|
|
1095
|
+
readonly note: string;
|
|
1096
|
+
};
|
|
1097
|
+
declare const DISCIPLINE_GATES_V1_ALT_BLIND_HEADER = "Before stating any conclusion, run this check:";
|
|
1098
|
+
/**
|
|
1099
|
+
* The variant matrix — and this is the ONE place this seat's judgment enters
|
|
1100
|
+
* the blind arm, so it is stated rather than buried.
|
|
1101
|
+
*
|
|
1102
|
+
* cc's instruction: adapt MECHANICALLY where the injection format demands it,
|
|
1103
|
+
* note the diff, never edit semantics. Choosing which gates to drop per
|
|
1104
|
+
* surface is a selection, not an edit — the bytes of every retained gate are
|
|
1105
|
+
* untouched — but the selection is still mine, so:
|
|
1106
|
+
*
|
|
1107
|
+
* NO TOOLS drops `toolPredict`. Forced, not chosen: the string opens
|
|
1108
|
+
* "When using tools" and is literally inapplicable without them.
|
|
1109
|
+
* Mirrors v1 dropping its compressed-item bullet.
|
|
1110
|
+
* STRUCTURED drops `markAssumed` ONLY. It is the sole gate whose entire
|
|
1111
|
+
* function is text in the final answer ('mark anything unchecked
|
|
1112
|
+
* as "assumed"'), which a JSON/tool_call schema has no field for
|
|
1113
|
+
* and which would corrupt the parse.
|
|
1114
|
+
*
|
|
1115
|
+
* The judgment call worth flagging: v1 drops TWO bullets on structured
|
|
1116
|
+
* surfaces, and a stricter reading would also drop `falsify` ("state in one
|
|
1117
|
+
* line") and `deviation` ("say so explicitly"), since both demand output
|
|
1118
|
+
* text. I kept them. Their output demand is incidental (and conditional, for
|
|
1119
|
+
* `deviation`) while their primary effect is on reasoning before the answer
|
|
1120
|
+
* exists — whereas v1's dropped pair (`label`, `gap`) are purely
|
|
1121
|
+
* output-shaping. Dropping three of five would leave a two-gate arm that no
|
|
1122
|
+
* longer tests the same mechanism, and an arm crippled by my formatting
|
|
1123
|
+
* choice would read as a wording loss that was actually a scoping loss.
|
|
1124
|
+
* If the structured surface shows anomalous results, this is the first
|
|
1125
|
+
* thing to re-examine.
|
|
1126
|
+
*/
|
|
1127
|
+
declare function altBlindGatesBlockFor(args: {
|
|
1128
|
+
outputMode: 'text' | 'json' | 'tool_call';
|
|
1129
|
+
hasTools: boolean;
|
|
1130
|
+
}): string;
|
|
1088
1131
|
/**
|
|
1089
1132
|
* The alt arm injects its block DIRECTLY as an untagged section — it must
|
|
1090
1133
|
* not carry `kind: 'discipline_contract'`, or the translator would prepend
|
|
@@ -1094,6 +1137,14 @@ declare function altGatesBlockFor(args: {
|
|
|
1094
1137
|
* no-ops — the attribution is about WORDING, and everything else is held.
|
|
1095
1138
|
*/
|
|
1096
1139
|
declare function withAltDisciplineContract(ir: PromptIR): PromptIR;
|
|
1140
|
+
/**
|
|
1141
|
+
* Same injection contract as `withAltDisciplineContract` — untagged section,
|
|
1142
|
+
* so the translator never prepends the v1 bytes on top and the arm measures
|
|
1143
|
+
* exactly one wording. Same variant inputs, so the blind arm no-ops nowhere
|
|
1144
|
+
* v1 fires and fires nowhere v1 no-ops; the comparison is about WORDING and
|
|
1145
|
+
* everything else is held.
|
|
1146
|
+
*/
|
|
1147
|
+
declare function withAltBlindDisciplineContract(ir: PromptIR): PromptIR;
|
|
1097
1148
|
declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunResult>;
|
|
1098
1149
|
/**
|
|
1099
1150
|
* Aggregate outcome of one strategy run, in gates-on terms. 'loses' is the
|
|
@@ -1107,25 +1158,54 @@ declare function classifyStrategyOutcome(r: GoldenEvalRunResult): StrategyOutcom
|
|
|
1107
1158
|
* recorded as a mechanism failure would let Factor B permanently disable a
|
|
1108
1159
|
* real capability on evidence about one author's prose.
|
|
1109
1160
|
*
|
|
1110
|
-
*
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1161
|
+
* THREE arms since 2026-07-29. Both re-wordings run on a v1 loss, and a win
|
|
1162
|
+
* by EITHER is enough to acquit the mechanism — the question "does some
|
|
1163
|
+
* wording of this work?" is answered by one existence proof, so there is no
|
|
1164
|
+
* reason to require agreement between the alts.
|
|
1165
|
+
*
|
|
1166
|
+
* v1 vs off | alt / alt-blind vs off | attribution
|
|
1167
|
+
* ----------+------------------------+------------------------------------
|
|
1168
|
+
* wins | (not run) | mechanism-works — ship
|
|
1169
|
+
* ties | (not run) | no-lift — inconclusive at n, re-eval
|
|
1170
|
+
* loses | either wins | wording-failure — do NOT disable
|
|
1171
|
+
* loses | BOTH lose | mechanism-failure — Factor B may disable
|
|
1172
|
+
* loses | neither wins, not both lose | wording-inconclusive — no disable
|
|
1173
|
+
*
|
|
1174
|
+
* The `mechanism-failure` cell is the one that changed character. It used to
|
|
1175
|
+
* rest on two wordings by one author, so a shared blind spot (the principles
|
|
1176
|
+
* being the wrong principles) was invisible and the verdict was hedged. The
|
|
1177
|
+
* blind arm was authored by a context-free subagent with no knowledge of this
|
|
1178
|
+
* repo, the experiment, or who was asking — so a both-lose verdict now spans
|
|
1179
|
+
* independent authorship and is strong on its own terms. That is exactly the
|
|
1180
|
+
* gap `STRATEGY_AUTHORSHIP_LIMITATION` was written to confess, which is why
|
|
1181
|
+
* the limitation text is now conditional on whether the blind arm ran.
|
|
1117
1182
|
*/
|
|
1118
1183
|
type StrategyAttribution = 'mechanism-works' | 'no-lift' | 'wording-failure' | 'mechanism-failure' | 'wording-inconclusive' | 'inconclusive';
|
|
1119
1184
|
interface StrategyAttributionResult {
|
|
1120
1185
|
attribution: StrategyAttribution;
|
|
1121
1186
|
primary: GoldenEvalRunResult;
|
|
1122
|
-
/** Present ONLY when the primary lost (the loss-triggered
|
|
1187
|
+
/** Present ONLY when the primary lost (the loss-triggered arms). */
|
|
1123
1188
|
alt?: GoldenEvalRunResult;
|
|
1189
|
+
/** The independently-authored arm. Present ONLY when the primary lost. */
|
|
1190
|
+
altBlind?: GoldenEvalRunResult;
|
|
1124
1191
|
/** The authorship limitation, restated on every result so no downstream
|
|
1125
|
-
* reader can cite an attribution without it.
|
|
1192
|
+
* reader can cite an attribution without it. Which string this carries
|
|
1193
|
+
* depends on whether the blind arm actually ran — see below. */
|
|
1126
1194
|
limitation: string;
|
|
1127
1195
|
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Carried when the blind arm did NOT run — i.e. v1 won or tied, so no
|
|
1198
|
+
* re-wording was measured at all and any claim about wording is unevidenced.
|
|
1199
|
+
*/
|
|
1128
1200
|
declare const STRATEGY_AUTHORSHIP_LIMITATION: string;
|
|
1201
|
+
/**
|
|
1202
|
+
* Carried when both re-wording arms ran. The shared-author caveat is GONE by
|
|
1203
|
+
* construction, and saying so is the point: the previous version of this
|
|
1204
|
+
* string confessed a gap that has since been closed, and a stale confession
|
|
1205
|
+
* is its own kind of false statement — a reader would discount a verdict
|
|
1206
|
+
* that no longer deserves discounting.
|
|
1207
|
+
*/
|
|
1208
|
+
declare const STRATEGY_AUTHORSHIP_INDEPENDENT: string;
|
|
1129
1209
|
/**
|
|
1130
1210
|
* Run the strategy eval with loss-triggered wording attribution: v1 first;
|
|
1131
1211
|
* the alt arm replays ONLY on a v1 loss (mirrors the engine's retry
|
|
@@ -1146,7 +1226,7 @@ declare function runStrategyEvalWithAttribution(opts: Omit<GoldenEvalOptions, 'a
|
|
|
1146
1226
|
* guard in `tests/version.test.ts` fails the suite (and therefore
|
|
1147
1227
|
* `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
|
|
1148
1228
|
*/
|
|
1149
|
-
declare const LIBRARY_VERSION = "2.0.0-alpha.
|
|
1229
|
+
declare const LIBRARY_VERSION = "2.0.0-alpha.85";
|
|
1150
1230
|
|
|
1151
1231
|
/**
|
|
1152
1232
|
* Oracle contract — how an app tells the brain whether a response was good.
|
|
@@ -1565,6 +1645,218 @@ declare function deriveOwnership(code: string, selfDeclared?: 'consumer-actionab
|
|
|
1565
1645
|
*/
|
|
1566
1646
|
declare function runAdvisor(ir: PromptIR, result: AdvisorContext, profile: ModelProfile, policy?: CompilePolicy, phase2?: RunAdvisorPhase2Context): BestPracticeAdvisory[];
|
|
1567
1647
|
|
|
1648
|
+
/**
|
|
1649
|
+
* promote-ready-brain — alpha.41 substrate.
|
|
1650
|
+
*
|
|
1651
|
+
* Per-tenant SWR cache for the `promote_ready_findings` table populated by
|
|
1652
|
+
* the autonomous `promotion-probe-watcher` (Mode 2). Mirrors
|
|
1653
|
+
* `exclusion-findings-brain.ts` shape byte-for-byte where applicable; this
|
|
1654
|
+
* is the read-side substrate for the compile-time `promote-ready` advisor
|
|
1655
|
+
* rule.
|
|
1656
|
+
*
|
|
1657
|
+
* Architecture (mirror of exclusion-findings-brain):
|
|
1658
|
+
*
|
|
1659
|
+
* - **Sync API surface.** `getPromoteReadyFindings({ appId, archetype,
|
|
1660
|
+
* family })` returns `PromoteReadyFindingRow[]` immediately. First call
|
|
1661
|
+
* returns the bundled fallback (empty array); async refresh fires in
|
|
1662
|
+
* background; subsequent calls within TTL return brain data.
|
|
1663
|
+
*
|
|
1664
|
+
* - **Per-appId snapshot.** Each appId gets its own cache entry. One fetch
|
|
1665
|
+
* per appId per TTL window. Tests reset between cases via
|
|
1666
|
+
* `_testResetPromoteReadyFindings()`.
|
|
1667
|
+
*
|
|
1668
|
+
* - **Tolerant.** Brain down / endpoint misconfigured / unexpected shape →
|
|
1669
|
+
* silent bundled fallback (empty array). Never throws. Warns once per
|
|
1670
|
+
* process per error to avoid log spam.
|
|
1671
|
+
*
|
|
1672
|
+
* - **Opt-in.** Activation gated on `configurePromoteReadyBrain()` having
|
|
1673
|
+
* been called with a runtime. The public `configureBrain()` in brain.ts
|
|
1674
|
+
* wires this up automatically when
|
|
1675
|
+
* `BrainConfig.brainQuery.findingsPromoteReady !== false`.
|
|
1676
|
+
*
|
|
1677
|
+
* Plus: `markPromoteReadyHandled` — direct PostgREST PATCH against the
|
|
1678
|
+
* brain (no kgauto proxy). Mirrors `markExclusionFindingHandled` shape
|
|
1679
|
+
* byte-for-byte. Idempotent on `resolved_at=is.null` filter.
|
|
1680
|
+
*
|
|
1681
|
+
* Default endpoint:
|
|
1682
|
+
* `https://kgauto-dashboard.vercel.app/api/kgauto-v2/findings/promote-ready`
|
|
1683
|
+
* The route accepts `?app_id=X` and returns a JSON array of findings
|
|
1684
|
+
* for that app filtered to `resolved_at IS NULL`.
|
|
1685
|
+
*/
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Shape of one row from the `promote_ready_findings` cache table. Mirrors
|
|
1689
|
+
* the snake_case JSONB returned by the brain endpoint, mapped to camelCase
|
|
1690
|
+
* at the boundary (rowToFinding) so the in-memory shape stays consistent
|
|
1691
|
+
* with the rest of the library.
|
|
1692
|
+
*/
|
|
1693
|
+
interface PromoteReadyFindingRow {
|
|
1694
|
+
/** Intent archetype the finding applies to. */
|
|
1695
|
+
archetype: string;
|
|
1696
|
+
/** Model family (e.g. 'claude-opus', 'gemini-flash'). */
|
|
1697
|
+
family: string;
|
|
1698
|
+
/** The candidate model that the probe validated. */
|
|
1699
|
+
candidateModel: string;
|
|
1700
|
+
/** The current production model the candidate was compared against. */
|
|
1701
|
+
currentModel: string;
|
|
1702
|
+
/** Sample size of the probe run (typically 10). */
|
|
1703
|
+
sampleN: number;
|
|
1704
|
+
/** Fraction of probes where the judge verdict was 'candidate-better' or
|
|
1705
|
+
* 'tied'. 0.000 to 1.000. */
|
|
1706
|
+
judgePassRate: number;
|
|
1707
|
+
/** Mean judge score across the probe sample. 1.00 to 5.00. */
|
|
1708
|
+
judgeAvgScore: number;
|
|
1709
|
+
/** Signed cost delta as a fraction (negative = candidate is cheaper).
|
|
1710
|
+
* Null when pricing data was incomplete at probe time. */
|
|
1711
|
+
costDeltaPct: number | null;
|
|
1712
|
+
/** ISO timestamp of detection (when the probe wrote the row). */
|
|
1713
|
+
detectedAt: string;
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Resolution sources supported by alpha.41 `markPromoteReadyHandled`. The
|
|
1717
|
+
* three values map to the three CHECK-constrained resolution values on
|
|
1718
|
+
* `promote_ready_findings.resolution`:
|
|
1719
|
+
*
|
|
1720
|
+
* - `'promoted'` — consumer migrated to the candidate model. Strong
|
|
1721
|
+
* positive signal; the probe was right.
|
|
1722
|
+
* - `'declined'` — consumer evaluated and chose not to promote.
|
|
1723
|
+
* Strong negative signal; revisit only on new
|
|
1724
|
+
* family entries or material score swings.
|
|
1725
|
+
* - `'still-evaluating'` — consumer acknowledges the finding but defers
|
|
1726
|
+
* the decision. Acknowledges-without-deciding;
|
|
1727
|
+
* finding silences this cycle but next probe may
|
|
1728
|
+
* re-surface.
|
|
1729
|
+
*/
|
|
1730
|
+
type PromoteReadyResolution = 'promoted' | 'declined' | 'still-evaluating';
|
|
1731
|
+
interface MarkPromoteReadyHandledOptions {
|
|
1732
|
+
/** App id the finding belongs to. Required (RLS scopes writes by this). */
|
|
1733
|
+
appId: string;
|
|
1734
|
+
/** Archetype the finding applies to (e.g. 'hunt', 'classify'). */
|
|
1735
|
+
archetype: IntentArchetypeName | string;
|
|
1736
|
+
/** Model family the finding applies to (e.g. 'claude-opus'). */
|
|
1737
|
+
family: string;
|
|
1738
|
+
/** Resolution semantics — see `PromoteReadyResolution`. */
|
|
1739
|
+
resolution: PromoteReadyResolution;
|
|
1740
|
+
/** Optional free-form note explaining the decision. */
|
|
1741
|
+
resolutionNote?: string;
|
|
1742
|
+
/** Brain Supabase URL base (e.g. `https://<project>.supabase.co`). */
|
|
1743
|
+
brainEndpoint: string;
|
|
1744
|
+
/** Consumer-scoped JWT carrying the `app_id` claim. */
|
|
1745
|
+
brainJwt: string;
|
|
1746
|
+
/** Supabase anon key for the `apikey` header. */
|
|
1747
|
+
brainAnonKey: string;
|
|
1748
|
+
/** Injected fetch for tests. Defaults to global fetch. */
|
|
1749
|
+
fetch?: typeof fetch;
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Mark a probe-validated promote-ready finding as handled. Returns an
|
|
1753
|
+
* `ok/reason` envelope matching `markExclusionFindingHandled`.
|
|
1754
|
+
*
|
|
1755
|
+
* Idempotent: if no row matches the (app_id, archetype, family) tuple
|
|
1756
|
+
* (already resolved, never existed, watcher not yet UPSERTed), PostgREST
|
|
1757
|
+
* returns 200/204 with zero affected rows and we return `{ ok: true }`.
|
|
1758
|
+
*
|
|
1759
|
+
* Reasons surfaced on failure:
|
|
1760
|
+
* - `app_id_required` / `archetype_required` / `family_required`
|
|
1761
|
+
* - `resolution_invalid` — not one of the three documented values
|
|
1762
|
+
* - `brain_auth_misconfig` — 401/403
|
|
1763
|
+
* - `brain_unavailable` — 5xx
|
|
1764
|
+
* - `network_error:<message>` — fetch threw
|
|
1765
|
+
* - `patch_failed:<status>` — anything else non-2xx
|
|
1766
|
+
*/
|
|
1767
|
+
declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions): Promise<{
|
|
1768
|
+
ok: true;
|
|
1769
|
+
} | {
|
|
1770
|
+
ok: false;
|
|
1771
|
+
reason: string;
|
|
1772
|
+
}>;
|
|
1773
|
+
|
|
1774
|
+
/**
|
|
1775
|
+
* blocked-model-drift — advisor rule for the two ways a consumer's
|
|
1776
|
+
* `CompilePolicy.blockedModels` can stop meaning what the consumer meant,
|
|
1777
|
+
* without anything anywhere reporting a problem.
|
|
1778
|
+
*
|
|
1779
|
+
* ── The incidents this is grounded in (tt-intel s113 + s119) ─────────────
|
|
1780
|
+
*
|
|
1781
|
+
* (Correction, s83: an earlier draft cited "claude-sonnet-5 served 30% of
|
|
1782
|
+
* tt-intel's ask traffic" as the motivating incident. That number was a
|
|
1783
|
+
* FOSSIL — tt-intel's own L-188 traced all 11 calls to a 29-second burst
|
|
1784
|
+
* from their own prior spend-gate experiment, fixed minutes later, and
|
|
1785
|
+
* their block was in fact working. Do not resurrect it.)
|
|
1786
|
+
*
|
|
1787
|
+
* The real, verified incidents:
|
|
1788
|
+
*
|
|
1789
|
+
* 1. alpha.72 retargeted the curated `claude-sonnet` family primary from
|
|
1790
|
+
* `claude-sonnet-4-6` (now `legacy`) to `claude-sonnet-5` (now
|
|
1791
|
+
* `current`), and tt-intel's literal-id gate STOPPED MATCHING the
|
|
1792
|
+
* family's routed traffic — their s113 response was to build
|
|
1793
|
+
* consumer-side family→concrete-id resolution (`parseBlockedModels`)
|
|
1794
|
+
* before ids reach kgauto. Every consumer without that local machinery
|
|
1795
|
+
* is exposed to the same silent retarget: `blockedModels` is matched by
|
|
1796
|
+
* exact id, so a block written against yesterday's primary says nothing
|
|
1797
|
+
* about today's.
|
|
1798
|
+
*
|
|
1799
|
+
* 2. tt-intel s119 (2026-07-29 filing): a blocked model SERVED when an
|
|
1800
|
+
* unblocked ALIAS of it sat in the candidate set (`deepseek-chat` ≡
|
|
1801
|
+
* `deepseek-v4-flash`). That one was a kgauto correctness bug, fixed in
|
|
1802
|
+
* alpha.85 by canonical matching (`policy-match.ts`) — but it proved
|
|
1803
|
+
* the class: a block-list meaning drifts whenever the roster's id
|
|
1804
|
+
* surface moves under it, and no layer errors.
|
|
1805
|
+
*
|
|
1806
|
+
* ── What this rule is NOT ────────────────────────────────────────────────
|
|
1807
|
+
*
|
|
1808
|
+
* It does not change matching semantics. Exact-ID matching is arguably the
|
|
1809
|
+
* correct contract: family-glob matching would silently widen every
|
|
1810
|
+
* existing consumer's block-list, which is a breaking semantic change and
|
|
1811
|
+
* not kgauto's to make unilaterally. The gap here is silence, not
|
|
1812
|
+
* semantics — so the fix is a signal, not a behavior change. Selection is
|
|
1813
|
+
* untouched; a consumer who blocked one exact id still gets exactly that
|
|
1814
|
+
* id blocked and nothing else.
|
|
1815
|
+
*
|
|
1816
|
+
* ── The two branches ─────────────────────────────────────────────────────
|
|
1817
|
+
*
|
|
1818
|
+
* (a) `blocked-model-not-in-roster` — a `blockedModels` entry resolves to
|
|
1819
|
+
* no model in the current roster (after alias resolution). The block is
|
|
1820
|
+
* inert: it can never match anything. Causes are a typo, a model
|
|
1821
|
+
* retired out of the roster, or a stale env var carried forward. There
|
|
1822
|
+
* is no reading under which an entry matching nothing is what the
|
|
1823
|
+
* consumer wanted, so this is unambiguous.
|
|
1824
|
+
*
|
|
1825
|
+
* (b) `blocked-model-family-sibling-served` — the model selected for THIS
|
|
1826
|
+
* call is in the same family as a blocked entry but is a different
|
|
1827
|
+
* exact id. This is the tt-intel shape. Unlike (a) it IS ambiguous:
|
|
1828
|
+
* "block `claude-sonnet-4-6` specifically, `claude-sonnet-5` is fine"
|
|
1829
|
+
* is a legitimate and common intent. So the message states both
|
|
1830
|
+
* readings and says how to act on either. It escalates its wording —
|
|
1831
|
+
* not its level — when the blocked sibling is `legacy`/`deprecated` and
|
|
1832
|
+
* the served sibling is `current`, because that combination is the
|
|
1833
|
+
* signature of a roster lifecycle move rather than a deliberate
|
|
1834
|
+
* per-generation block.
|
|
1835
|
+
*
|
|
1836
|
+
* Both fire at `warn`, and both fire regardless of `policy.posture`.
|
|
1837
|
+
* `posture: 'locked'` means "do not recommend models to me" — these are not
|
|
1838
|
+
* recommendations, they are reports that the consumer's own declared
|
|
1839
|
+
* constraint is not doing what its author expects. Same reasoning as the
|
|
1840
|
+
* alpha.28 `archetype-perf-floor-breach` cliff advisor, which is also
|
|
1841
|
+
* posture-independent because it reports a structural fact rather than a
|
|
1842
|
+
* preference.
|
|
1843
|
+
*
|
|
1844
|
+
* Companion watcher: `v2/scripts/blocked-model-drift-watch.mjs` rolls the
|
|
1845
|
+
* same two branches up across a consumer's recent traffic from the brain,
|
|
1846
|
+
* so the signal survives a consumer who never reads `result.advisories[]`.
|
|
1847
|
+
*
|
|
1848
|
+
* L-073 family ("no errors = healthy"): as with DeepSeek's `deepseek-chat`
|
|
1849
|
+
* compat alias and the alpha.47/.43 field-drop chain, nothing errored,
|
|
1850
|
+
* nothing 404'd, latency did not move — and the cached intent was wrong for
|
|
1851
|
+
* an unknown duration. The detection loop has to be built deliberately
|
|
1852
|
+
* because the failure emits no natural signal.
|
|
1853
|
+
*/
|
|
1854
|
+
|
|
1855
|
+
/** Stable rule code — branch (a). Written to `compile_outcome_advisories.code`. */
|
|
1856
|
+
declare const BLOCKED_MODEL_NOT_IN_ROSTER_CODE = "blocked-model-not-in-roster";
|
|
1857
|
+
/** Stable rule code — branch (b). Written to `compile_outcome_advisories.code`. */
|
|
1858
|
+
declare const BLOCKED_MODEL_FAMILY_SIBLING_SERVED_CODE = "blocked-model-family-sibling-served";
|
|
1859
|
+
|
|
1568
1860
|
/**
|
|
1569
1861
|
* Translator primitive — alpha.31.
|
|
1570
1862
|
*
|
|
@@ -1795,6 +2087,77 @@ interface AdvisorySuggestedFix {
|
|
|
1795
2087
|
* view's snake_case columns to camelCase. See `feedback_typed_boundary_transformers.md`
|
|
1796
2088
|
* (L-118) for the rationale.
|
|
1797
2089
|
*/
|
|
2090
|
+
/**
|
|
2091
|
+
* The window of evidence a finding was computed from — migration 054.
|
|
2092
|
+
*
|
|
2093
|
+
* READ THE DISTINCTION BEFORE USING THIS. It is NOT `openedAt` /
|
|
2094
|
+
* `lastObservedAt` / `observationCount`, which describe the ADVISORY (how
|
|
2095
|
+
* long it has been firing, how many times the watcher ran and still saw the
|
|
2096
|
+
* condition). This describes what the generator LOOKED AT.
|
|
2097
|
+
*
|
|
2098
|
+
* A daily cron that keeps firing on a single 29-second burst reports
|
|
2099
|
+
* `observationCount: 11` spanning 11 days — the most standing-looking of
|
|
2100
|
+
* standing conditions — while its evidence is one event from 11 days ago.
|
|
2101
|
+
* Separating the two is the entire point.
|
|
2102
|
+
*
|
|
2103
|
+
* `null` when the generator did not state its window. Honest unknown; it
|
|
2104
|
+
* must never be read as "not a burst". Compile-time library rules carry
|
|
2105
|
+
* null legitimately — they fire on ONE call, so their evidence is the call
|
|
2106
|
+
* in hand and there is no window to state.
|
|
2107
|
+
*/
|
|
2108
|
+
interface AdvisoryEvidenceWindow {
|
|
2109
|
+
firstAt: string;
|
|
2110
|
+
lastAt: string;
|
|
2111
|
+
n: number;
|
|
2112
|
+
/** `lastAt - firstAt`, precomputed so no caller re-derives it wrong. */
|
|
2113
|
+
spanMs: number;
|
|
2114
|
+
/**
|
|
2115
|
+
* `true` when the evidence is clustered tightly enough to be ONE EVENT
|
|
2116
|
+
* rather than a standing rate. See `classifyEvidenceWindow`.
|
|
2117
|
+
*/
|
|
2118
|
+
isBurst: boolean;
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Burst-vs-rate, computed rather than judged.
|
|
2122
|
+
*
|
|
2123
|
+
* Origin: tt-intel s118. A cost query showed `claude-sonnet-5` at 30% of
|
|
2124
|
+
* their `ask` traffic and 80% of ask spend. Every number true, every
|
|
2125
|
+
* mechanism check correct, and every correct check made them more certain
|
|
2126
|
+
* the spend gate had regressed. All eleven calls sat in a 29-second window —
|
|
2127
|
+
* their own prior experiment, fixed six minutes after the last one. Their
|
|
2128
|
+
* formulation: **a cluster is an event, not a rate.**
|
|
2129
|
+
*
|
|
2130
|
+
* The rule, deliberately crude because a subtle one would need tuning per
|
|
2131
|
+
* rule and would then be wrong per rule: evidence is a burst when it spans
|
|
2132
|
+
* less than `BURST_SPAN_MS` (5 minutes). Multiple observations inside five
|
|
2133
|
+
* minutes are one incident — a deploy, a retry storm, a test run, a
|
|
2134
|
+
* benchmark — not a pattern of behavior over time.
|
|
2135
|
+
*
|
|
2136
|
+
* Two deliberate non-features:
|
|
2137
|
+
*
|
|
2138
|
+
* - **n is not in the test.** Two rows 4 minutes apart are as much a single
|
|
2139
|
+
* event as eleven are. Requiring a minimum n would let the smallest, least
|
|
2140
|
+
* evidenced findings skip the check.
|
|
2141
|
+
* - **It does not try to detect fossils.** A burst is not necessarily stale;
|
|
2142
|
+
* it is merely not a rate. Only the consumer's own deploy log can turn
|
|
2143
|
+
* "one event" into "an event we already fixed", and this library cannot
|
|
2144
|
+
* see that. Claiming otherwise would be the same over-reach the rule
|
|
2145
|
+
* exists to correct.
|
|
2146
|
+
*/
|
|
2147
|
+
declare const BURST_SPAN_MS: number;
|
|
2148
|
+
declare function classifyEvidenceWindow(row: {
|
|
2149
|
+
evidence_first_at?: string | null;
|
|
2150
|
+
evidence_last_at?: string | null;
|
|
2151
|
+
evidence_n?: number | null;
|
|
2152
|
+
}): AdvisoryEvidenceWindow | null;
|
|
2153
|
+
/** Human-readable span for advisory text. Terse by design — it sits inline. */
|
|
2154
|
+
declare function formatEvidenceSpan(spanMs: number): string;
|
|
2155
|
+
/**
|
|
2156
|
+
* The sentence that travels with a burst-shaped finding. Written to be
|
|
2157
|
+
* usable verbatim in advisory text, and to say what the library CAN claim
|
|
2158
|
+
* (one event) rather than what it cannot (that the event is stale).
|
|
2159
|
+
*/
|
|
2160
|
+
declare function burstCaveat(w: AdvisoryEvidenceWindow): string;
|
|
1798
2161
|
interface ActionableAdvisory {
|
|
1799
2162
|
id: string;
|
|
1800
2163
|
rule: string;
|
|
@@ -1802,6 +2165,18 @@ interface ActionableAdvisory {
|
|
|
1802
2165
|
openedAt: string;
|
|
1803
2166
|
lastObservedAt: string;
|
|
1804
2167
|
observationCount: number;
|
|
2168
|
+
/**
|
|
2169
|
+
* Migration 054. `null` when the generator did not state a window — an
|
|
2170
|
+
* honest unknown, NOT an assertion that the evidence is well-spread.
|
|
2171
|
+
*/
|
|
2172
|
+
evidenceWindow: AdvisoryEvidenceWindow | null;
|
|
2173
|
+
/**
|
|
2174
|
+
* The severity the rule ASKED for, present only when this advisory's
|
|
2175
|
+
* effective `severity` was downgraded because its evidence is burst-shaped.
|
|
2176
|
+
* Kept so a consumer can see the downgrade happened rather than silently
|
|
2177
|
+
* receiving a quieter advisory than the generator wrote.
|
|
2178
|
+
*/
|
|
2179
|
+
severityBeforeBurstDowngrade?: AdvisorySeverity;
|
|
1805
2180
|
appliesTo: {
|
|
1806
2181
|
archetype?: IntentArchetypeName;
|
|
1807
2182
|
model?: string;
|
|
@@ -1853,6 +2228,12 @@ interface MarkAdvisoryResolvedOptions {
|
|
|
1853
2228
|
brainAnonKey?: string;
|
|
1854
2229
|
fetch?: typeof fetch;
|
|
1855
2230
|
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Map a single `actionable_advisories_v` row (snake_case, Postgres
|
|
2233
|
+
* native) to the public `ActionableAdvisory` shape (camelCase). Single
|
|
2234
|
+
* canonical mapping site for this boundary (L-118).
|
|
2235
|
+
*/
|
|
2236
|
+
declare function rowToAdvisory(row: Record<string, unknown>): ActionableAdvisory;
|
|
1856
2237
|
/**
|
|
1857
2238
|
* Query the open advisory set for an app. Pulls from
|
|
1858
2239
|
* `actionable_advisories_v` (per-(app_id, code) rollup with stable ids
|
|
@@ -3072,132 +3453,6 @@ declare function deriveFamilyFromModelId(modelId: string): string | null;
|
|
|
3072
3453
|
*/
|
|
3073
3454
|
declare function getRecommendedPrimary(opts: GetRecommendedPrimaryOptions): string;
|
|
3074
3455
|
|
|
3075
|
-
/**
|
|
3076
|
-
* promote-ready-brain — alpha.41 substrate.
|
|
3077
|
-
*
|
|
3078
|
-
* Per-tenant SWR cache for the `promote_ready_findings` table populated by
|
|
3079
|
-
* the autonomous `promotion-probe-watcher` (Mode 2). Mirrors
|
|
3080
|
-
* `exclusion-findings-brain.ts` shape byte-for-byte where applicable; this
|
|
3081
|
-
* is the read-side substrate for the compile-time `promote-ready` advisor
|
|
3082
|
-
* rule.
|
|
3083
|
-
*
|
|
3084
|
-
* Architecture (mirror of exclusion-findings-brain):
|
|
3085
|
-
*
|
|
3086
|
-
* - **Sync API surface.** `getPromoteReadyFindings({ appId, archetype,
|
|
3087
|
-
* family })` returns `PromoteReadyFindingRow[]` immediately. First call
|
|
3088
|
-
* returns the bundled fallback (empty array); async refresh fires in
|
|
3089
|
-
* background; subsequent calls within TTL return brain data.
|
|
3090
|
-
*
|
|
3091
|
-
* - **Per-appId snapshot.** Each appId gets its own cache entry. One fetch
|
|
3092
|
-
* per appId per TTL window. Tests reset between cases via
|
|
3093
|
-
* `_testResetPromoteReadyFindings()`.
|
|
3094
|
-
*
|
|
3095
|
-
* - **Tolerant.** Brain down / endpoint misconfigured / unexpected shape →
|
|
3096
|
-
* silent bundled fallback (empty array). Never throws. Warns once per
|
|
3097
|
-
* process per error to avoid log spam.
|
|
3098
|
-
*
|
|
3099
|
-
* - **Opt-in.** Activation gated on `configurePromoteReadyBrain()` having
|
|
3100
|
-
* been called with a runtime. The public `configureBrain()` in brain.ts
|
|
3101
|
-
* wires this up automatically when
|
|
3102
|
-
* `BrainConfig.brainQuery.findingsPromoteReady !== false`.
|
|
3103
|
-
*
|
|
3104
|
-
* Plus: `markPromoteReadyHandled` — direct PostgREST PATCH against the
|
|
3105
|
-
* brain (no kgauto proxy). Mirrors `markExclusionFindingHandled` shape
|
|
3106
|
-
* byte-for-byte. Idempotent on `resolved_at=is.null` filter.
|
|
3107
|
-
*
|
|
3108
|
-
* Default endpoint:
|
|
3109
|
-
* `https://kgauto-dashboard.vercel.app/api/kgauto-v2/findings/promote-ready`
|
|
3110
|
-
* The route accepts `?app_id=X` and returns a JSON array of findings
|
|
3111
|
-
* for that app filtered to `resolved_at IS NULL`.
|
|
3112
|
-
*/
|
|
3113
|
-
|
|
3114
|
-
/**
|
|
3115
|
-
* Shape of one row from the `promote_ready_findings` cache table. Mirrors
|
|
3116
|
-
* the snake_case JSONB returned by the brain endpoint, mapped to camelCase
|
|
3117
|
-
* at the boundary (rowToFinding) so the in-memory shape stays consistent
|
|
3118
|
-
* with the rest of the library.
|
|
3119
|
-
*/
|
|
3120
|
-
interface PromoteReadyFindingRow {
|
|
3121
|
-
/** Intent archetype the finding applies to. */
|
|
3122
|
-
archetype: string;
|
|
3123
|
-
/** Model family (e.g. 'claude-opus', 'gemini-flash'). */
|
|
3124
|
-
family: string;
|
|
3125
|
-
/** The candidate model that the probe validated. */
|
|
3126
|
-
candidateModel: string;
|
|
3127
|
-
/** The current production model the candidate was compared against. */
|
|
3128
|
-
currentModel: string;
|
|
3129
|
-
/** Sample size of the probe run (typically 10). */
|
|
3130
|
-
sampleN: number;
|
|
3131
|
-
/** Fraction of probes where the judge verdict was 'candidate-better' or
|
|
3132
|
-
* 'tied'. 0.000 to 1.000. */
|
|
3133
|
-
judgePassRate: number;
|
|
3134
|
-
/** Mean judge score across the probe sample. 1.00 to 5.00. */
|
|
3135
|
-
judgeAvgScore: number;
|
|
3136
|
-
/** Signed cost delta as a fraction (negative = candidate is cheaper).
|
|
3137
|
-
* Null when pricing data was incomplete at probe time. */
|
|
3138
|
-
costDeltaPct: number | null;
|
|
3139
|
-
/** ISO timestamp of detection (when the probe wrote the row). */
|
|
3140
|
-
detectedAt: string;
|
|
3141
|
-
}
|
|
3142
|
-
/**
|
|
3143
|
-
* Resolution sources supported by alpha.41 `markPromoteReadyHandled`. The
|
|
3144
|
-
* three values map to the three CHECK-constrained resolution values on
|
|
3145
|
-
* `promote_ready_findings.resolution`:
|
|
3146
|
-
*
|
|
3147
|
-
* - `'promoted'` — consumer migrated to the candidate model. Strong
|
|
3148
|
-
* positive signal; the probe was right.
|
|
3149
|
-
* - `'declined'` — consumer evaluated and chose not to promote.
|
|
3150
|
-
* Strong negative signal; revisit only on new
|
|
3151
|
-
* family entries or material score swings.
|
|
3152
|
-
* - `'still-evaluating'` — consumer acknowledges the finding but defers
|
|
3153
|
-
* the decision. Acknowledges-without-deciding;
|
|
3154
|
-
* finding silences this cycle but next probe may
|
|
3155
|
-
* re-surface.
|
|
3156
|
-
*/
|
|
3157
|
-
type PromoteReadyResolution = 'promoted' | 'declined' | 'still-evaluating';
|
|
3158
|
-
interface MarkPromoteReadyHandledOptions {
|
|
3159
|
-
/** App id the finding belongs to. Required (RLS scopes writes by this). */
|
|
3160
|
-
appId: string;
|
|
3161
|
-
/** Archetype the finding applies to (e.g. 'hunt', 'classify'). */
|
|
3162
|
-
archetype: IntentArchetypeName | string;
|
|
3163
|
-
/** Model family the finding applies to (e.g. 'claude-opus'). */
|
|
3164
|
-
family: string;
|
|
3165
|
-
/** Resolution semantics — see `PromoteReadyResolution`. */
|
|
3166
|
-
resolution: PromoteReadyResolution;
|
|
3167
|
-
/** Optional free-form note explaining the decision. */
|
|
3168
|
-
resolutionNote?: string;
|
|
3169
|
-
/** Brain Supabase URL base (e.g. `https://<project>.supabase.co`). */
|
|
3170
|
-
brainEndpoint: string;
|
|
3171
|
-
/** Consumer-scoped JWT carrying the `app_id` claim. */
|
|
3172
|
-
brainJwt: string;
|
|
3173
|
-
/** Supabase anon key for the `apikey` header. */
|
|
3174
|
-
brainAnonKey: string;
|
|
3175
|
-
/** Injected fetch for tests. Defaults to global fetch. */
|
|
3176
|
-
fetch?: typeof fetch;
|
|
3177
|
-
}
|
|
3178
|
-
/**
|
|
3179
|
-
* Mark a probe-validated promote-ready finding as handled. Returns an
|
|
3180
|
-
* `ok/reason` envelope matching `markExclusionFindingHandled`.
|
|
3181
|
-
*
|
|
3182
|
-
* Idempotent: if no row matches the (app_id, archetype, family) tuple
|
|
3183
|
-
* (already resolved, never existed, watcher not yet UPSERTed), PostgREST
|
|
3184
|
-
* returns 200/204 with zero affected rows and we return `{ ok: true }`.
|
|
3185
|
-
*
|
|
3186
|
-
* Reasons surfaced on failure:
|
|
3187
|
-
* - `app_id_required` / `archetype_required` / `family_required`
|
|
3188
|
-
* - `resolution_invalid` — not one of the three documented values
|
|
3189
|
-
* - `brain_auth_misconfig` — 401/403
|
|
3190
|
-
* - `brain_unavailable` — 5xx
|
|
3191
|
-
* - `network_error:<message>` — fetch threw
|
|
3192
|
-
* - `patch_failed:<status>` — anything else non-2xx
|
|
3193
|
-
*/
|
|
3194
|
-
declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions): Promise<{
|
|
3195
|
-
ok: true;
|
|
3196
|
-
} | {
|
|
3197
|
-
ok: false;
|
|
3198
|
-
reason: string;
|
|
3199
|
-
}>;
|
|
3200
|
-
|
|
3201
3456
|
/**
|
|
3202
3457
|
* promotions-brain — alpha.64 Stage-2 substrate.
|
|
3203
3458
|
*
|
|
@@ -3760,4 +4015,4 @@ declare function planDecomposition(args: PlanDecompositionArgs): DecompositionPl
|
|
|
3760
4015
|
*/
|
|
3761
4016
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
3762
4017
|
|
|
3763
|
-
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, BRAIN_READ_ENV_NAMES, BestPracticeAdvisory, type BrainConfig, type BrainDeadLetterEntry, type BrainHealthSnapshot, type BrainQueryConfig, type BrainReadEnv, COACH_CFG, COST_RANKING_REFERENCE_SHAPE, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, type CreateDelegateOpts, DECOMPOSITION_TEMPLATES, DECOMPOSITION_TEMPLATES_VERSION, DEFAULT_FINDINGS_ENDPOINT, DEFAULT_MEASURED_FAILURE_ENDPOINT, DEFAULT_PROMOTIONS_ENDPOINT, DELEGATE_TOOL_DEFINITION, 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_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, chainProviderSpread, classifyStrategyOutcome, clearBrain, combineOrderSwappedVerdicts, compile, compileForAISDKv6, configureBrain, configureMeasuredFailureBrain, configurePromotionsBrain, countTokens, createDelegate, deriveFamilyFromModelId, deriveOwnership, estimateChainCostUsd, estimateModelCostUsd, execute, findBetterFit, flushBrainDeadLetter, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getApplicablePromotion, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getMeasuredFailureVerdict, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecentRollback, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, 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, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rubricFor, runAdvisor, runGoldenEval, runStrategyEvalWithAttribution, setTokenizer, wilsonLowerBound, withAltDisciplineContract, withDisciplineContract };
|
|
4018
|
+
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, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, type CreateDelegateOpts, DECOMPOSITION_TEMPLATES, DECOMPOSITION_TEMPLATES_VERSION, DEFAULT_FINDINGS_ENDPOINT, 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, _testResetPromotions, _testWaitForMeasuredFailureRefresh, _testWaitForPromotionsRefresh, altBlindGatesBlockFor, altGatesBlockFor, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, awaitMeasuredFailureReady, 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, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rowToAdvisory, rubricFor, runAdvisor, runGoldenEval, runStrategyEvalWithAttribution, setTokenizer, wilsonLowerBound, withAltBlindDisciplineContract, withAltDisciplineContract, withDisciplineContract };
|