@warmdrift/kgauto-compiler 2.0.0-alpha.81 → 2.0.0-alpha.83
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-OZNAGO4U.mjs → chunk-QEFIAAE7.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/react/index.d.mts +2 -2
- package/dist/glassbox-routes/react/index.d.ts +2 -2
- package/dist/index.d.mts +183 -14
- package/dist/index.d.ts +183 -14
- package/dist/index.js +176 -32
- package/dist/index.mjs +164 -32
- package/dist/{ir-DZKS1tI7.d.ts → ir-Cx9hJj0B.d.ts} +1 -1
- package/dist/{ir-BFwWhj2s.d.mts → ir-D4S9R816.d.mts} +1 -1
- package/dist/key-health.js +1 -1
- package/dist/key-health.mjs +1 -1
- package/dist/profiles.d.mts +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{types-B4kz3Vs0.d.ts → types-CAs9-0S4.d.ts} +1 -1
- package/dist/{types-DpcAMmk-.d.mts → types-CRXaR7nJ.d.mts} +1 -1
- package/dist/{types-D_fLt_Xv.d.ts → types-Cvd6kRNv.d.ts} +1 -1
- package/dist/{types-hjzSWxtv.d.mts → types-DHi4FcUu.d.mts} +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -23,9 +23,12 @@ __export(index_exports, {
|
|
|
23
23
|
ABSOLUTE_FLOOR: () => ABSOLUTE_FLOOR,
|
|
24
24
|
ALIASES: () => ALIASES,
|
|
25
25
|
ALL_ARCHETYPES: () => ALL_ARCHETYPES,
|
|
26
|
+
ALT_BLIND_TOKEN_BUDGET_BREACH: () => ALT_BLIND_TOKEN_BUDGET_BREACH,
|
|
27
|
+
ALT_STRATEGY_IDS: () => ALT_STRATEGY_IDS,
|
|
26
28
|
ARCHETYPE_FAMILY_FITS: () => ARCHETYPE_FAMILY_FITS,
|
|
27
29
|
ARCHETYPE_FLOOR_DEFAULT: () => ARCHETYPE_FLOOR_DEFAULT,
|
|
28
30
|
BRAIN_READ_ENV_NAMES: () => BRAIN_READ_ENV_NAMES,
|
|
31
|
+
BURST_SPAN_MS: () => BURST_SPAN_MS,
|
|
29
32
|
COACH_CFG: () => COACH_CFG,
|
|
30
33
|
COST_RANKING_REFERENCE_SHAPE: () => COST_RANKING_REFERENCE_SHAPE,
|
|
31
34
|
CallError: () => CallError,
|
|
@@ -36,6 +39,7 @@ __export(index_exports, {
|
|
|
36
39
|
DEFAULT_PROMOTIONS_ENDPOINT: () => DEFAULT_PROMOTIONS_ENDPOINT,
|
|
37
40
|
DELEGATE_TOOL_DEFINITION: () => DELEGATE_TOOL_DEFINITION,
|
|
38
41
|
DIALECT_VERSION: () => DIALECT_VERSION,
|
|
42
|
+
DISCIPLINE_GATES_V1_ALT_BLIND_HEADER: () => DISCIPLINE_GATES_V1_ALT_BLIND_HEADER,
|
|
39
43
|
DISCIPLINE_GATES_V1_ALT_HEADER: () => DISCIPLINE_GATES_V1_ALT_HEADER,
|
|
40
44
|
FamilyResolutionError: () => FamilyResolutionError,
|
|
41
45
|
INTENT_ARCHETYPES: () => INTENT_ARCHETYPES,
|
|
@@ -52,6 +56,7 @@ __export(index_exports, {
|
|
|
52
56
|
RULE_DISCIPLINE_GATES_V1: () => RULE_DISCIPLINE_GATES_V1,
|
|
53
57
|
RULE_DISCIPLINE_GATES_V1_STRUCTURED: () => RULE_DISCIPLINE_GATES_V1_STRUCTURED,
|
|
54
58
|
RULE_SEQUENTIAL_TOOL_CLIFF: () => RULE_SEQUENTIAL_TOOL_CLIFF,
|
|
59
|
+
STRATEGY_AUTHORSHIP_INDEPENDENT: () => STRATEGY_AUTHORSHIP_INDEPENDENT,
|
|
55
60
|
STRATEGY_AUTHORSHIP_LIMITATION: () => STRATEGY_AUTHORSHIP_LIMITATION,
|
|
56
61
|
TRANSLATOR_FLOOR: () => TRANSLATOR_FLOOR,
|
|
57
62
|
_testResetMeasuredFailure: () => _testResetMeasuredFailure,
|
|
@@ -59,6 +64,7 @@ __export(index_exports, {
|
|
|
59
64
|
_testWaitForMeasuredFailureRefresh: () => _testWaitForMeasuredFailureRefresh,
|
|
60
65
|
_testWaitForPromotionsRefresh: () => _testWaitForPromotionsRefresh,
|
|
61
66
|
allProfiles: () => allProfiles,
|
|
67
|
+
altBlindGatesBlockFor: () => altBlindGatesBlockFor,
|
|
62
68
|
altGatesBlockFor: () => altGatesBlockFor,
|
|
63
69
|
applyArchetypeConvention: () => applyArchetypeConvention,
|
|
64
70
|
applySectionRewrites: () => applySectionRewrites,
|
|
@@ -72,9 +78,11 @@ __export(index_exports, {
|
|
|
72
78
|
buildLLMJudge: () => buildLLMJudge,
|
|
73
79
|
buildPairwiseJudgePrompt: () => buildPairwiseJudgePrompt,
|
|
74
80
|
buildShadowProbeRow: () => buildShadowProbeRow,
|
|
81
|
+
burstCaveat: () => burstCaveat,
|
|
75
82
|
call: () => call,
|
|
76
83
|
captureGoldenIr: () => captureGoldenIr,
|
|
77
84
|
chainProviderSpread: () => chainProviderSpread,
|
|
85
|
+
classifyEvidenceWindow: () => classifyEvidenceWindow,
|
|
78
86
|
classifyStrategyOutcome: () => classifyStrategyOutcome,
|
|
79
87
|
clearBrain: () => clearBrain,
|
|
80
88
|
combineOrderSwappedVerdicts: () => combineOrderSwappedVerdicts,
|
|
@@ -94,6 +102,7 @@ __export(index_exports, {
|
|
|
94
102
|
execute: () => execute,
|
|
95
103
|
findBetterFit: () => findBetterFit,
|
|
96
104
|
flushBrainDeadLetter: () => flushBrainDeadLetter,
|
|
105
|
+
formatEvidenceSpan: () => formatEvidenceSpan,
|
|
97
106
|
getActionableAdvisories: () => getActionableAdvisories,
|
|
98
107
|
getAllStarterChains: () => getAllStarterChains,
|
|
99
108
|
getAllStarterChainsWithGrounding: () => getAllStarterChainsWithGrounding,
|
|
@@ -115,6 +124,7 @@ __export(index_exports, {
|
|
|
115
124
|
getStarterChainWithGrounding: () => getStarterChainWithGrounding,
|
|
116
125
|
hasMutation: () => hasMutation,
|
|
117
126
|
hashShape: () => hashShape,
|
|
127
|
+
isAltStrategy: () => isAltStrategy,
|
|
118
128
|
isArchetype: () => isArchetype,
|
|
119
129
|
isAutoPromoteEnabledFromEnv: () => isAutoPromoteEnabledFromEnv,
|
|
120
130
|
isBrainQueryActiveFor: () => isBrainQueryActiveFor,
|
|
@@ -160,6 +170,7 @@ __export(index_exports, {
|
|
|
160
170
|
resolveGoldenCaptureRate: () => resolveGoldenCaptureRate,
|
|
161
171
|
resolvePricingAt: () => resolvePricingAt,
|
|
162
172
|
resolveProviderKey: () => resolveProviderKey,
|
|
173
|
+
rowToAdvisory: () => rowToAdvisory,
|
|
163
174
|
rubricFor: () => rubricFor,
|
|
164
175
|
runAdvisor: () => runAdvisor,
|
|
165
176
|
runGoldenEval: () => runGoldenEval,
|
|
@@ -168,6 +179,7 @@ __export(index_exports, {
|
|
|
168
179
|
shouldCaptureGolden: () => shouldCaptureGolden,
|
|
169
180
|
tryGetProfile: () => tryGetProfile,
|
|
170
181
|
wilsonLowerBound: () => wilsonLowerBound,
|
|
182
|
+
withAltBlindDisciplineContract: () => withAltBlindDisciplineContract,
|
|
171
183
|
withAltDisciplineContract: () => withAltDisciplineContract,
|
|
172
184
|
withDisciplineContract: () => withDisciplineContract
|
|
173
185
|
});
|
|
@@ -5186,6 +5198,20 @@ function detectSingleModelArray(ir, policy) {
|
|
|
5186
5198
|
}
|
|
5187
5199
|
];
|
|
5188
5200
|
}
|
|
5201
|
+
function suppressedRecommendationReason(ir, archetype, altProfile) {
|
|
5202
|
+
if (getMeasuredFailureVerdict({ appId: ir.appId, archetype, model: altProfile.id })?.gated === true) {
|
|
5203
|
+
return "measured-failure-gate";
|
|
5204
|
+
}
|
|
5205
|
+
if (ir.constraints?.structuredOutput && effectiveConventions(altProfile).some(
|
|
5206
|
+
(c) => c.archetype === archetype && c.structuredOutputHint === "avoid"
|
|
5207
|
+
)) {
|
|
5208
|
+
return "schema-weakness-convention";
|
|
5209
|
+
}
|
|
5210
|
+
if (getRecentRollback({ appId: ir.appId, archetype, model: altProfile.id }) !== void 0) {
|
|
5211
|
+
return "recent-rollback";
|
|
5212
|
+
}
|
|
5213
|
+
return void 0;
|
|
5214
|
+
}
|
|
5189
5215
|
function openPostureRemedyClause(archetype, recommended, resolveProfile) {
|
|
5190
5216
|
const openChain = getDefaultFallbackChain({ archetype, posture: "open" });
|
|
5191
5217
|
const openPrimaryId = openChain[0];
|
|
@@ -5223,25 +5249,7 @@ function detectCostMismatchedArchetype(ir, profile, phase2) {
|
|
|
5223
5249
|
if (altScore.score < QUALITY_FLOOR_FOR_RECOMMENDATION) continue;
|
|
5224
5250
|
if (altScore.score < chosenScore.score) continue;
|
|
5225
5251
|
if (altProfile.costInputPer1m >= profile.costInputPer1m) continue;
|
|
5226
|
-
if (
|
|
5227
|
-
appId: ir.appId,
|
|
5228
|
-
archetype,
|
|
5229
|
-
model: altProfile.id
|
|
5230
|
-
})?.gated === true) {
|
|
5231
|
-
continue;
|
|
5232
|
-
}
|
|
5233
|
-
if (ir.constraints?.structuredOutput && effectiveConventions(altProfile).some(
|
|
5234
|
-
(c) => c.archetype === archetype && c.structuredOutputHint === "avoid"
|
|
5235
|
-
)) {
|
|
5236
|
-
continue;
|
|
5237
|
-
}
|
|
5238
|
-
if (getRecentRollback({
|
|
5239
|
-
appId: ir.appId,
|
|
5240
|
-
archetype,
|
|
5241
|
-
model: altProfile.id
|
|
5242
|
-
}) !== void 0) {
|
|
5243
|
-
continue;
|
|
5244
|
-
}
|
|
5252
|
+
if (suppressedRecommendationReason(ir, archetype, altProfile)) continue;
|
|
5245
5253
|
if (!bestAlt || altScore.score > bestAlt.score.score || altScore.score === bestAlt.score.score && altProfile.costInputPer1m < bestAlt.profile.costInputPer1m) {
|
|
5246
5254
|
bestAlt = { id: altId, profile: altProfile, score: altScore };
|
|
5247
5255
|
}
|
|
@@ -5299,6 +5307,7 @@ function detectTierDown(ir, profile, phase2) {
|
|
|
5299
5307
|
if (altScore.score < QUALITY_FLOOR_FOR_RECOMMENDATION) continue;
|
|
5300
5308
|
if (altScore.score < chosenScore.score) continue;
|
|
5301
5309
|
if (altProfile.costInputPer1m > chosenCost * TIER_DOWN_COST_RATIO) continue;
|
|
5310
|
+
if (suppressedRecommendationReason(ir, archetype, altProfile)) continue;
|
|
5302
5311
|
if (!bestAlt || altProfile.costInputPer1m < bestAlt.profile.costInputPer1m || altProfile.costInputPer1m === bestAlt.profile.costInputPer1m && altScore.score > bestAlt.score.score) {
|
|
5303
5312
|
bestAlt = { id: altId, profile: altProfile, score: altScore };
|
|
5304
5313
|
}
|
|
@@ -5345,7 +5354,18 @@ function detectArchetypePerfFloorBreach(ir, profile) {
|
|
|
5345
5354
|
// library pick" endorsement could land on a materially pricier
|
|
5346
5355
|
// primary. The floor recommendation stands; the axis is now named,
|
|
5347
5356
|
// and the cost-ordered variant is offered alongside it.
|
|
5348
|
-
|
|
5357
|
+
//
|
|
5358
|
+
// alpha.82 (cc-Cairn 2026-07-29, follow-on 1): the suggestion read as
|
|
5359
|
+
// advice about the ARCHETYPE when it is a fact about ONE CALL. Model
|
|
5360
|
+
// selection is input-size dependent, so a rule that fires on the
|
|
5361
|
+
// small-payload tail of a path whose typical case clears the floor
|
|
5362
|
+
// reads as "your primary is wrong" when the accurate statement is
|
|
5363
|
+
// "this call landed here." Ground truth for the wording: tt-intel's
|
|
5364
|
+
// open critical is `gemini-2.5-flash-lite` (ask, 5/10) selected at
|
|
5365
|
+
// ~2.1K tokens_in, while `claude-opus-5` served the same archetype at
|
|
5366
|
+
// ~22K the same day — cc read the evidence set as self-contradictory
|
|
5367
|
+
// precisely because the text did not say which call it described.
|
|
5368
|
+
suggestion: `This fired for \`${profile.id}\`, the model selected for THIS call \u2014 selection is input-size dependent, so other calls on \`${ir.intent.archetype}\` may pick a different model that clears the floor. Swap to a model whose archetypePerf for ${ir.intent.archetype} clears the floor. Use \`getModelCompatibility(candidateId, { archetype: '${ir.intent.archetype}' })\` to vet candidates, or \`getDefaultFallbackChain({ archetype: '${ir.intent.archetype}', posture: 'open' })\` for a library-picked chain that respects the floor by construction \u2014 note that chain is ordered by archetype performance, NOT cost, so it may select a pricier primary than you run today. Add \`optimizeFor: 'cost'\` for a chain that clears the same floor cheapest-first. To stop this model being selected at all, pass \`policy.blockedModels: ['${profile.id}']\`.`,
|
|
5349
5369
|
recommendationType: "model-swap",
|
|
5350
5370
|
docsUrl: "https://github.com/stue/command-center/blob/main/interfaces/kgauto.md#best-practice-advisories"
|
|
5351
5371
|
}
|
|
@@ -5845,7 +5865,7 @@ function validateFinalFit(ir, profile, tokens) {
|
|
|
5845
5865
|
}
|
|
5846
5866
|
|
|
5847
5867
|
// src/version.ts
|
|
5848
|
-
var LIBRARY_VERSION = "2.0.0-alpha.
|
|
5868
|
+
var LIBRARY_VERSION = "2.0.0-alpha.83";
|
|
5849
5869
|
|
|
5850
5870
|
// src/pricing-brain.ts
|
|
5851
5871
|
function isPricingRow(x) {
|
|
@@ -6642,13 +6662,16 @@ var FAILED = /* @__PURE__ */ Symbol("parse-failed");
|
|
|
6642
6662
|
|
|
6643
6663
|
// src/ir.ts
|
|
6644
6664
|
function mutationId(m) {
|
|
6645
|
-
|
|
6665
|
+
if (m == null) return void 0;
|
|
6666
|
+
if (typeof m === "string") return m;
|
|
6667
|
+
return typeof m.id === "string" ? m.id : void 0;
|
|
6646
6668
|
}
|
|
6647
6669
|
function hasMutation(list, idOrPrefix) {
|
|
6648
6670
|
if (!Array.isArray(list)) return false;
|
|
6649
6671
|
const prefix = idOrPrefix.endsWith("*") ? idOrPrefix.slice(0, -1) : void 0;
|
|
6650
6672
|
return list.some((m) => {
|
|
6651
6673
|
const id = mutationId(m);
|
|
6674
|
+
if (id === void 0) return false;
|
|
6652
6675
|
return prefix !== void 0 ? id.startsWith(prefix) : id === idOrPrefix;
|
|
6653
6676
|
});
|
|
6654
6677
|
}
|
|
@@ -8625,6 +8648,13 @@ function combineOrderSwappedVerdicts(run1, run2) {
|
|
|
8625
8648
|
if (run1 === run2) return run1;
|
|
8626
8649
|
return "tied";
|
|
8627
8650
|
}
|
|
8651
|
+
var ALT_STRATEGY_IDS = [
|
|
8652
|
+
"discipline-gates-v1-alt",
|
|
8653
|
+
"discipline-gates-v1-alt-blind"
|
|
8654
|
+
];
|
|
8655
|
+
function isAltStrategy(id) {
|
|
8656
|
+
return id !== void 0 && ALT_STRATEGY_IDS.includes(id);
|
|
8657
|
+
}
|
|
8628
8658
|
function replayRetryDelayMs(errorCode) {
|
|
8629
8659
|
return errorCode === "rate_limit" ? 65e3 : 2e3;
|
|
8630
8660
|
}
|
|
@@ -8678,7 +8708,34 @@ function altGatesBlockFor(args) {
|
|
|
8678
8708
|
...shapeAltering
|
|
8679
8709
|
]);
|
|
8680
8710
|
}
|
|
8711
|
+
var ALT_BLIND_TOKEN_BUDGET_BREACH = {
|
|
8712
|
+
ceilingTokens: 264,
|
|
8713
|
+
measuredTokensTextWithTools: 285,
|
|
8714
|
+
note: "Blind arm exceeds the stated 264-token ceiling on text+tools (285) and costs ~2.4x the v1-alt arm. Not corrected: compressing it would require editing prose the arm depends on NOT having been edited by this seat. Read a blind-arm LOSS as confounded by token tax; a WIN is unaffected."
|
|
8715
|
+
};
|
|
8716
|
+
var DISCIPLINE_GATES_V1_ALT_BLIND_HEADER = "Before stating any conclusion, run this check:";
|
|
8717
|
+
var ALT_BLIND_BULLETS = {
|
|
8718
|
+
falsify: "- Before committing to an approach, state in one line what evidence would prove it wrong and how you would notice it. If nothing could falsify the approach, you hold a preference, not a plan \u2014 rework it until something could.",
|
|
8719
|
+
deviation: "- When you choose not to follow an applicable instruction, say so explicitly: name the instruction, why you are deviating, and what you are doing instead. Silent deviation is forbidden \u2014 an override is only legitimate when it is visible.",
|
|
8720
|
+
toolPredict: "- When using tools: before each call, state the result you expect. On mismatch, treat the gap as evidence your model of the system is wrong \u2014 revise the model before acting again; never silently retry.",
|
|
8721
|
+
verifyDelegated: "- Verify every delegated or sub-agent result before composing it into an answer: spot-check it against the source or an independent probe. An unverified sub-result is a claim you are repeating, not a fact you know.",
|
|
8722
|
+
markAssumed: '- In the final answer, keep verified claims and assumptions visibly distinct: mark anything unchecked as "assumed" or "unverified". Never let an assumption borrow the confidence of the verified claims beside it.'
|
|
8723
|
+
};
|
|
8724
|
+
function altBlindGatesBlockFor(args) {
|
|
8725
|
+
const parts = [
|
|
8726
|
+
"falsify",
|
|
8727
|
+
"deviation",
|
|
8728
|
+
...args.hasTools ? ["toolPredict"] : [],
|
|
8729
|
+
"verifyDelegated",
|
|
8730
|
+
...args.outputMode === "text" ? ["markAssumed"] : []
|
|
8731
|
+
];
|
|
8732
|
+
return [
|
|
8733
|
+
DISCIPLINE_GATES_V1_ALT_BLIND_HEADER,
|
|
8734
|
+
...parts.map((p) => ALT_BLIND_BULLETS[p])
|
|
8735
|
+
].join("\n");
|
|
8736
|
+
}
|
|
8681
8737
|
var STRATEGY_ALT_SECTION_ID = "__kgauto_strategy_eval_gates_alt__";
|
|
8738
|
+
var STRATEGY_ALT_BLIND_SECTION_ID = "__kgauto_strategy_eval_gates_alt_blind__";
|
|
8682
8739
|
function withAltDisciplineContract(ir) {
|
|
8683
8740
|
const outputMode = resolveOutputMode({
|
|
8684
8741
|
declared: ir.constraints?.outputMode,
|
|
@@ -8697,6 +8754,28 @@ function withAltDisciplineContract(ir) {
|
|
|
8697
8754
|
]
|
|
8698
8755
|
};
|
|
8699
8756
|
}
|
|
8757
|
+
function withAltBlindDisciplineContract(ir) {
|
|
8758
|
+
const outputMode = resolveOutputMode({
|
|
8759
|
+
declared: ir.constraints?.outputMode,
|
|
8760
|
+
structuredOutput: ir.constraints?.structuredOutput,
|
|
8761
|
+
toolCount: ir.tools?.length ?? 0
|
|
8762
|
+
});
|
|
8763
|
+
const hasTools = (ir.tools?.length ?? 0) > 0;
|
|
8764
|
+
return {
|
|
8765
|
+
...ir,
|
|
8766
|
+
sections: [
|
|
8767
|
+
...ir.sections ?? [],
|
|
8768
|
+
{
|
|
8769
|
+
id: STRATEGY_ALT_BLIND_SECTION_ID,
|
|
8770
|
+
text: altBlindGatesBlockFor({ outputMode, hasTools })
|
|
8771
|
+
}
|
|
8772
|
+
]
|
|
8773
|
+
};
|
|
8774
|
+
}
|
|
8775
|
+
var ALT_SECTION_ID_BY_STRATEGY = {
|
|
8776
|
+
"discipline-gates-v1-alt": STRATEGY_ALT_SECTION_ID,
|
|
8777
|
+
"discipline-gates-v1-alt-blind": STRATEGY_ALT_BLIND_SECTION_ID
|
|
8778
|
+
};
|
|
8700
8779
|
async function runGoldenEval(opts) {
|
|
8701
8780
|
const fetchFn = opts.fetchImpl ?? fetch;
|
|
8702
8781
|
const progress = opts.onProgress ?? (() => {
|
|
@@ -8764,7 +8843,9 @@ async function runGoldenEval(opts) {
|
|
|
8764
8843
|
}
|
|
8765
8844
|
const armBIr = (ir) => {
|
|
8766
8845
|
if (axis !== "strategy") return ir;
|
|
8767
|
-
|
|
8846
|
+
if (strategyId === "discipline-gates-v1-alt") return withAltDisciplineContract(ir);
|
|
8847
|
+
if (strategyId === "discipline-gates-v1-alt-blind") return withAltBlindDisciplineContract(ir);
|
|
8848
|
+
return withDisciplineContract(ir);
|
|
8768
8849
|
};
|
|
8769
8850
|
const replay = async (ir, model, captureGates = false) => {
|
|
8770
8851
|
let gates;
|
|
@@ -8776,13 +8857,14 @@ async function runGoldenEval(opts) {
|
|
|
8776
8857
|
};
|
|
8777
8858
|
const compiled = compile(evalIr);
|
|
8778
8859
|
if (captureGates) {
|
|
8779
|
-
if (strategyId
|
|
8860
|
+
if (isAltStrategy(strategyId)) {
|
|
8861
|
+
const altSectionId = ALT_SECTION_ID_BY_STRATEGY[strategyId];
|
|
8780
8862
|
const altSection = (evalIr.sections ?? []).find(
|
|
8781
|
-
(s) => s.id ===
|
|
8863
|
+
(s) => s.id === altSectionId
|
|
8782
8864
|
);
|
|
8783
8865
|
gates = {
|
|
8784
8866
|
fired: altSection !== void 0 && altSection.text.length > 0,
|
|
8785
|
-
rule:
|
|
8867
|
+
rule: strategyId,
|
|
8786
8868
|
gateTokens: altSection ? countTokens(`${altSection.text}
|
|
8787
8869
|
|
|
8788
8870
|
`) : 0
|
|
@@ -9213,7 +9295,8 @@ function classifyStrategyOutcome(r) {
|
|
|
9213
9295
|
if (r.losses > r.wins) return "loses";
|
|
9214
9296
|
return "ties";
|
|
9215
9297
|
}
|
|
9216
|
-
var STRATEGY_AUTHORSHIP_LIMITATION = "
|
|
9298
|
+
var STRATEGY_AUTHORSHIP_LIMITATION = "Only the v1 wording was measured on this run; no re-wording arm was triggered, so this result says nothing about whether the wording or the mechanism produced it.";
|
|
9299
|
+
var STRATEGY_AUTHORSHIP_INDEPENDENT = "Three arms: v1 and one re-wording by this seat, plus an independently authored arm (context-free subagent, no repo access, no knowledge of the experiment). A both-lose verdict therefore spans independent authorship and is not explained by one author's blind spot. Residual limitation: all three arms encode a similar set of underlying principles, so a wrong CHOICE of principles remains harder to see than a wrong wording of them.";
|
|
9217
9300
|
async function runStrategyEvalWithAttribution(opts) {
|
|
9218
9301
|
const primary = await runGoldenEval({
|
|
9219
9302
|
...opts,
|
|
@@ -9230,9 +9313,20 @@ async function runStrategyEvalWithAttribution(opts) {
|
|
|
9230
9313
|
axis: "strategy",
|
|
9231
9314
|
strategy: "discipline-gates-v1-alt"
|
|
9232
9315
|
});
|
|
9233
|
-
const
|
|
9234
|
-
|
|
9235
|
-
|
|
9316
|
+
const altBlind = await runGoldenEval({
|
|
9317
|
+
...opts,
|
|
9318
|
+
axis: "strategy",
|
|
9319
|
+
strategy: "discipline-gates-v1-alt-blind"
|
|
9320
|
+
});
|
|
9321
|
+
const outcomes = [classifyStrategyOutcome(alt), classifyStrategyOutcome(altBlind)];
|
|
9322
|
+
const attribution = outcomes.includes("wins") ? "wording-failure" : outcomes.every((o) => o === "loses") ? "mechanism-failure" : "wording-inconclusive";
|
|
9323
|
+
return {
|
|
9324
|
+
attribution,
|
|
9325
|
+
primary,
|
|
9326
|
+
alt,
|
|
9327
|
+
altBlind,
|
|
9328
|
+
limitation: STRATEGY_AUTHORSHIP_INDEPENDENT
|
|
9329
|
+
};
|
|
9236
9330
|
}
|
|
9237
9331
|
|
|
9238
9332
|
// src/brain-proxy.ts
|
|
@@ -9864,6 +9958,30 @@ function createDelegate(opts) {
|
|
|
9864
9958
|
}
|
|
9865
9959
|
|
|
9866
9960
|
// src/advisories-api.ts
|
|
9961
|
+
var BURST_SPAN_MS = 5 * 60 * 1e3;
|
|
9962
|
+
function classifyEvidenceWindow(row) {
|
|
9963
|
+
const { evidence_first_at: first, evidence_last_at: last, evidence_n: n } = row;
|
|
9964
|
+
if (typeof first !== "string" || typeof last !== "string") return null;
|
|
9965
|
+
if (typeof n !== "number" || !Number.isFinite(n) || n <= 0) return null;
|
|
9966
|
+
const t0 = Date.parse(first);
|
|
9967
|
+
const t1 = Date.parse(last);
|
|
9968
|
+
if (Number.isNaN(t0) || Number.isNaN(t1)) return null;
|
|
9969
|
+
const spanMs = Math.max(0, t1 - t0);
|
|
9970
|
+
return { firstAt: first, lastAt: last, n, spanMs, isBurst: spanMs < BURST_SPAN_MS };
|
|
9971
|
+
}
|
|
9972
|
+
function formatEvidenceSpan(spanMs) {
|
|
9973
|
+
if (spanMs < 1e3) return `${spanMs}ms`;
|
|
9974
|
+
const s = Math.round(spanMs / 1e3);
|
|
9975
|
+
if (s < 90) return `${s}s`;
|
|
9976
|
+
const m = Math.round(s / 60);
|
|
9977
|
+
if (m < 90) return `${m}m`;
|
|
9978
|
+
const h = Math.round(m / 60);
|
|
9979
|
+
if (h < 48) return `${h}h`;
|
|
9980
|
+
return `${Math.round(h / 24)}d`;
|
|
9981
|
+
}
|
|
9982
|
+
function burstCaveat(w) {
|
|
9983
|
+
return `Evidence is ${w.n} observation${w.n === 1 ? "" : "s"} spanning ${formatEvidenceSpan(w.spanMs)} (${w.firstAt} \u2192 ${w.lastAt}) \u2014 that is a single burst, not a standing rate. Check it against your own deploy log before acting: a cluster this tight is usually one incident, and may already be fixed.`;
|
|
9984
|
+
}
|
|
9867
9985
|
var SEVERITY_SET = /* @__PURE__ */ new Set(["info", "warn", "critical"]);
|
|
9868
9986
|
var STATUS_SET = /* @__PURE__ */ new Set(["open", "snoozed", "resolved"]);
|
|
9869
9987
|
var RESOLUTION_SOURCE_SET = /* @__PURE__ */ new Set([
|
|
@@ -9903,10 +10021,18 @@ function rowToAdvisory(row) {
|
|
|
9903
10021
|
if (docsLink) suggestedFix.docsLink = docsLink;
|
|
9904
10022
|
if (suggestion) suggestedFix.before = suggestion;
|
|
9905
10023
|
}
|
|
10024
|
+
const evidenceWindow = classifyEvidenceWindow(
|
|
10025
|
+
row
|
|
10026
|
+
);
|
|
10027
|
+
const declaredSeverity = asSeverity(row.severity);
|
|
10028
|
+
const downgraded = evidenceWindow?.isBurst === true && declaredSeverity === "critical";
|
|
10029
|
+
const effectiveSeverity = downgraded ? "warn" : declaredSeverity;
|
|
9906
10030
|
const out = {
|
|
9907
10031
|
id: typeof row.id === "string" ? row.id : "",
|
|
9908
10032
|
rule: typeof row.rule === "string" ? row.rule : "",
|
|
9909
|
-
severity:
|
|
10033
|
+
severity: effectiveSeverity,
|
|
10034
|
+
evidenceWindow,
|
|
10035
|
+
...downgraded ? { severityBeforeBurstDowngrade: declaredSeverity } : {},
|
|
9910
10036
|
openedAt: typeof row.opened_at === "string" ? row.opened_at : "",
|
|
9911
10037
|
lastObservedAt: typeof row.last_observed_at === "string" ? row.last_observed_at : "",
|
|
9912
10038
|
observationCount: typeof row.observation_count === "number" ? row.observation_count : 0,
|
|
@@ -9914,7 +10040,13 @@ function rowToAdvisory(row) {
|
|
|
9914
10040
|
...archetype ? { archetype } : {},
|
|
9915
10041
|
...model ? { model } : {}
|
|
9916
10042
|
},
|
|
9917
|
-
|
|
10043
|
+
// The caveat goes INLINE in the message, not only in `evidenceWindow`.
|
|
10044
|
+
// A structured field a consumer must think to read is the same defect
|
|
10045
|
+
// one layer along: the substrate knowing and not telling. The whole
|
|
10046
|
+
// point is that the check costs a glance rather than a query.
|
|
10047
|
+
message: (typeof row.message === "string" ? row.message : "") + (evidenceWindow?.isBurst ? `
|
|
10048
|
+
|
|
10049
|
+
${burstCaveat(evidenceWindow)}` : ""),
|
|
9918
10050
|
suggestedFix,
|
|
9919
10051
|
autoApplicable: false,
|
|
9920
10052
|
// reserved — alpha.30+
|
|
@@ -10452,9 +10584,12 @@ function compile2(ir, opts) {
|
|
|
10452
10584
|
ABSOLUTE_FLOOR,
|
|
10453
10585
|
ALIASES,
|
|
10454
10586
|
ALL_ARCHETYPES,
|
|
10587
|
+
ALT_BLIND_TOKEN_BUDGET_BREACH,
|
|
10588
|
+
ALT_STRATEGY_IDS,
|
|
10455
10589
|
ARCHETYPE_FAMILY_FITS,
|
|
10456
10590
|
ARCHETYPE_FLOOR_DEFAULT,
|
|
10457
10591
|
BRAIN_READ_ENV_NAMES,
|
|
10592
|
+
BURST_SPAN_MS,
|
|
10458
10593
|
COACH_CFG,
|
|
10459
10594
|
COST_RANKING_REFERENCE_SHAPE,
|
|
10460
10595
|
CallError,
|
|
@@ -10465,6 +10600,7 @@ function compile2(ir, opts) {
|
|
|
10465
10600
|
DEFAULT_PROMOTIONS_ENDPOINT,
|
|
10466
10601
|
DELEGATE_TOOL_DEFINITION,
|
|
10467
10602
|
DIALECT_VERSION,
|
|
10603
|
+
DISCIPLINE_GATES_V1_ALT_BLIND_HEADER,
|
|
10468
10604
|
DISCIPLINE_GATES_V1_ALT_HEADER,
|
|
10469
10605
|
FamilyResolutionError,
|
|
10470
10606
|
INTENT_ARCHETYPES,
|
|
@@ -10481,6 +10617,7 @@ function compile2(ir, opts) {
|
|
|
10481
10617
|
RULE_DISCIPLINE_GATES_V1,
|
|
10482
10618
|
RULE_DISCIPLINE_GATES_V1_STRUCTURED,
|
|
10483
10619
|
RULE_SEQUENTIAL_TOOL_CLIFF,
|
|
10620
|
+
STRATEGY_AUTHORSHIP_INDEPENDENT,
|
|
10484
10621
|
STRATEGY_AUTHORSHIP_LIMITATION,
|
|
10485
10622
|
TRANSLATOR_FLOOR,
|
|
10486
10623
|
_testResetMeasuredFailure,
|
|
@@ -10488,6 +10625,7 @@ function compile2(ir, opts) {
|
|
|
10488
10625
|
_testWaitForMeasuredFailureRefresh,
|
|
10489
10626
|
_testWaitForPromotionsRefresh,
|
|
10490
10627
|
allProfiles,
|
|
10628
|
+
altBlindGatesBlockFor,
|
|
10491
10629
|
altGatesBlockFor,
|
|
10492
10630
|
applyArchetypeConvention,
|
|
10493
10631
|
applySectionRewrites,
|
|
@@ -10501,9 +10639,11 @@ function compile2(ir, opts) {
|
|
|
10501
10639
|
buildLLMJudge,
|
|
10502
10640
|
buildPairwiseJudgePrompt,
|
|
10503
10641
|
buildShadowProbeRow,
|
|
10642
|
+
burstCaveat,
|
|
10504
10643
|
call,
|
|
10505
10644
|
captureGoldenIr,
|
|
10506
10645
|
chainProviderSpread,
|
|
10646
|
+
classifyEvidenceWindow,
|
|
10507
10647
|
classifyStrategyOutcome,
|
|
10508
10648
|
clearBrain,
|
|
10509
10649
|
combineOrderSwappedVerdicts,
|
|
@@ -10523,6 +10663,7 @@ function compile2(ir, opts) {
|
|
|
10523
10663
|
execute,
|
|
10524
10664
|
findBetterFit,
|
|
10525
10665
|
flushBrainDeadLetter,
|
|
10666
|
+
formatEvidenceSpan,
|
|
10526
10667
|
getActionableAdvisories,
|
|
10527
10668
|
getAllStarterChains,
|
|
10528
10669
|
getAllStarterChainsWithGrounding,
|
|
@@ -10544,6 +10685,7 @@ function compile2(ir, opts) {
|
|
|
10544
10685
|
getStarterChainWithGrounding,
|
|
10545
10686
|
hasMutation,
|
|
10546
10687
|
hashShape,
|
|
10688
|
+
isAltStrategy,
|
|
10547
10689
|
isArchetype,
|
|
10548
10690
|
isAutoPromoteEnabledFromEnv,
|
|
10549
10691
|
isBrainQueryActiveFor,
|
|
@@ -10589,6 +10731,7 @@ function compile2(ir, opts) {
|
|
|
10589
10731
|
resolveGoldenCaptureRate,
|
|
10590
10732
|
resolvePricingAt,
|
|
10591
10733
|
resolveProviderKey,
|
|
10734
|
+
rowToAdvisory,
|
|
10592
10735
|
rubricFor,
|
|
10593
10736
|
runAdvisor,
|
|
10594
10737
|
runGoldenEval,
|
|
@@ -10597,6 +10740,7 @@ function compile2(ir, opts) {
|
|
|
10597
10740
|
shouldCaptureGolden,
|
|
10598
10741
|
tryGetProfile,
|
|
10599
10742
|
wilsonLowerBound,
|
|
10743
|
+
withAltBlindDisciplineContract,
|
|
10600
10744
|
withAltDisciplineContract,
|
|
10601
10745
|
withDisciplineContract
|
|
10602
10746
|
});
|