@warmdrift/kgauto-compiler 2.0.0-alpha.75 → 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-WP22F3CX.mjs → chunk-WZZCW6NA.mjs} +1 -1
- package/dist/index.d.mts +138 -2
- package/dist/index.d.ts +138 -2
- package/dist/index.js +214 -1
- package/dist/index.mjs +210 -1
- 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
|
@@ -1119,7 +1119,7 @@ declare function runStrategyEvalWithAttribution(opts: Omit<GoldenEvalOptions, 'a
|
|
|
1119
1119
|
* guard in `tests/version.test.ts` fails the suite (and therefore
|
|
1120
1120
|
* `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
|
|
1121
1121
|
*/
|
|
1122
|
-
declare const LIBRARY_VERSION = "2.0.0-alpha.
|
|
1122
|
+
declare const LIBRARY_VERSION = "2.0.0-alpha.76";
|
|
1123
1123
|
|
|
1124
1124
|
/**
|
|
1125
1125
|
* Oracle contract — how an app tells the brain whether a response was good.
|
|
@@ -3222,6 +3222,142 @@ declare function getMeasuredFailureVerdict(opts: GetMeasuredFailureOpts): Measur
|
|
|
3222
3222
|
declare function _testResetMeasuredFailure(): void;
|
|
3223
3223
|
declare function _testWaitForMeasuredFailureRefresh(): Promise<void>;
|
|
3224
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
|
+
|
|
3225
3361
|
/**
|
|
3226
3362
|
* @warmdrift/kgauto v2 — prompt compiler + central learning brain.
|
|
3227
3363
|
*
|
|
@@ -3268,4 +3404,4 @@ declare function _testWaitForMeasuredFailureRefresh(): Promise<void>;
|
|
|
3268
3404
|
*/
|
|
3269
3405
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
3270
3406
|
|
|
3271
|
-
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, DISCIPLINE_GATES_V1_ALT_HEADER, 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 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 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, 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, prefetchMeasuredFailure, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rubricFor, runAdvisor, runGoldenEval, runStrategyEvalWithAttribution, setTokenizer, wilsonLowerBound, withAltDisciplineContract, withDisciplineContract };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1119,7 +1119,7 @@ declare function runStrategyEvalWithAttribution(opts: Omit<GoldenEvalOptions, 'a
|
|
|
1119
1119
|
* guard in `tests/version.test.ts` fails the suite (and therefore
|
|
1120
1120
|
* `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
|
|
1121
1121
|
*/
|
|
1122
|
-
declare const LIBRARY_VERSION = "2.0.0-alpha.
|
|
1122
|
+
declare const LIBRARY_VERSION = "2.0.0-alpha.76";
|
|
1123
1123
|
|
|
1124
1124
|
/**
|
|
1125
1125
|
* Oracle contract — how an app tells the brain whether a response was good.
|
|
@@ -3222,6 +3222,142 @@ declare function getMeasuredFailureVerdict(opts: GetMeasuredFailureOpts): Measur
|
|
|
3222
3222
|
declare function _testResetMeasuredFailure(): void;
|
|
3223
3223
|
declare function _testWaitForMeasuredFailureRefresh(): Promise<void>;
|
|
3224
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
|
+
|
|
3225
3361
|
/**
|
|
3226
3362
|
* @warmdrift/kgauto v2 — prompt compiler + central learning brain.
|
|
3227
3363
|
*
|
|
@@ -3268,4 +3404,4 @@ declare function _testWaitForMeasuredFailureRefresh(): Promise<void>;
|
|
|
3268
3404
|
*/
|
|
3269
3405
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
3270
3406
|
|
|
3271
|
-
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, DISCIPLINE_GATES_V1_ALT_HEADER, 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 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 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, 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, prefetchMeasuredFailure, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rubricFor, runAdvisor, runGoldenEval, runStrategyEvalWithAttribution, setTokenizer, wilsonLowerBound, withAltDisciplineContract, withDisciplineContract };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,10 @@ __export(index_exports, {
|
|
|
25
25
|
ALL_ARCHETYPES: () => ALL_ARCHETYPES,
|
|
26
26
|
ARCHETYPE_FAMILY_FITS: () => ARCHETYPE_FAMILY_FITS,
|
|
27
27
|
ARCHETYPE_FLOOR_DEFAULT: () => ARCHETYPE_FLOOR_DEFAULT,
|
|
28
|
+
COACH_CFG: () => COACH_CFG,
|
|
28
29
|
CallError: () => CallError,
|
|
30
|
+
DECOMPOSITION_TEMPLATES: () => DECOMPOSITION_TEMPLATES,
|
|
31
|
+
DECOMPOSITION_TEMPLATES_VERSION: () => DECOMPOSITION_TEMPLATES_VERSION,
|
|
29
32
|
DEFAULT_FINDINGS_ENDPOINT: () => DEFAULT_FINDINGS_ENDPOINT,
|
|
30
33
|
DEFAULT_MEASURED_FAILURE_ENDPOINT: () => DEFAULT_MEASURED_FAILURE_ENDPOINT,
|
|
31
34
|
DEFAULT_PROMOTIONS_ENDPOINT: () => DEFAULT_PROMOTIONS_ENDPOINT,
|
|
@@ -125,6 +128,7 @@ __export(index_exports, {
|
|
|
125
128
|
parseGoldenCaptureRate: () => parseGoldenCaptureRate,
|
|
126
129
|
parseJudgeVerdict: () => parseJudgeVerdict,
|
|
127
130
|
peekBrainDeadLetter: () => peekBrainDeadLetter,
|
|
131
|
+
planDecomposition: () => planDecomposition,
|
|
128
132
|
prefetchMeasuredFailure: () => prefetchMeasuredFailure,
|
|
129
133
|
probeShadow: () => probeShadow,
|
|
130
134
|
profileToRow: () => profileToRow,
|
|
@@ -9039,7 +9043,7 @@ function createBrainForwardRoutes(config) {
|
|
|
9039
9043
|
}
|
|
9040
9044
|
|
|
9041
9045
|
// src/version.ts
|
|
9042
|
-
var LIBRARY_VERSION = "2.0.0-alpha.
|
|
9046
|
+
var LIBRARY_VERSION = "2.0.0-alpha.76";
|
|
9043
9047
|
|
|
9044
9048
|
// src/key-health.ts
|
|
9045
9049
|
var JSON_HEADERS2 = { "Content-Type": "application/json" };
|
|
@@ -9657,6 +9661,211 @@ async function markExclusionFindingHandled(opts) {
|
|
|
9657
9661
|
return { ok: true };
|
|
9658
9662
|
}
|
|
9659
9663
|
|
|
9664
|
+
// src/decomposition.ts
|
|
9665
|
+
var DECOMPOSITION_TEMPLATES_VERSION = "decomposition-templates-v1";
|
|
9666
|
+
var DECOMPOSITION_TEMPLATES = {
|
|
9667
|
+
summarize: {
|
|
9668
|
+
archetype: "summarize",
|
|
9669
|
+
version: DECOMPOSITION_TEMPLATES_VERSION,
|
|
9670
|
+
rationale: "A long-input summarize is mostly reading. A cheap extractor reads the full payload and emits compressed notes; the incumbent composes the summary from the notes \u2014 frontier tokens are spent only on the part that needs frontier judgment.",
|
|
9671
|
+
steps: [
|
|
9672
|
+
{
|
|
9673
|
+
role: "chunk-extract",
|
|
9674
|
+
archetype: "extract",
|
|
9675
|
+
tier: "delegate",
|
|
9676
|
+
inputShare: 1,
|
|
9677
|
+
emitsShareOfInput: 0.15,
|
|
9678
|
+
outputShare: 0
|
|
9679
|
+
},
|
|
9680
|
+
{
|
|
9681
|
+
role: "compose",
|
|
9682
|
+
archetype: "summarize",
|
|
9683
|
+
tier: "anchor",
|
|
9684
|
+
inputShare: 0.15,
|
|
9685
|
+
// reads the notes, not the raw payload
|
|
9686
|
+
emitsShareOfInput: 0,
|
|
9687
|
+
outputShare: 1
|
|
9688
|
+
}
|
|
9689
|
+
]
|
|
9690
|
+
},
|
|
9691
|
+
hunt: {
|
|
9692
|
+
archetype: "hunt",
|
|
9693
|
+
version: DECOMPOSITION_TEMPLATES_VERSION,
|
|
9694
|
+
rationale: "Hunt decomposes into breadth (search sweeps), mechanical harvesting (extraction), and judgment (dedupe + compose). The sweeps and the harvest are grunt work; the composition anchors on the incumbent.",
|
|
9695
|
+
steps: [
|
|
9696
|
+
{
|
|
9697
|
+
role: "search-sweep",
|
|
9698
|
+
archetype: "hunt",
|
|
9699
|
+
tier: "delegate",
|
|
9700
|
+
inputShare: 0.5,
|
|
9701
|
+
emitsShareOfInput: 0.2,
|
|
9702
|
+
outputShare: 0
|
|
9703
|
+
},
|
|
9704
|
+
{
|
|
9705
|
+
role: "harvest",
|
|
9706
|
+
archetype: "extract",
|
|
9707
|
+
tier: "delegate",
|
|
9708
|
+
inputShare: 0.35,
|
|
9709
|
+
emitsShareOfInput: 0.1,
|
|
9710
|
+
outputShare: 0
|
|
9711
|
+
},
|
|
9712
|
+
{
|
|
9713
|
+
role: "dedupe-compose",
|
|
9714
|
+
archetype: "judge",
|
|
9715
|
+
tier: "anchor",
|
|
9716
|
+
inputShare: 0.3,
|
|
9717
|
+
// sweep notes + harvest notes
|
|
9718
|
+
emitsShareOfInput: 0,
|
|
9719
|
+
outputShare: 1
|
|
9720
|
+
}
|
|
9721
|
+
]
|
|
9722
|
+
},
|
|
9723
|
+
plan: {
|
|
9724
|
+
archetype: "plan",
|
|
9725
|
+
version: DECOMPOSITION_TEMPLATES_VERSION,
|
|
9726
|
+
rationale: "Planning splits into context-gathering (mechanical reading) and the plan itself (judgment). The gatherer reads the corpus and briefs; the incumbent plans from the brief.",
|
|
9727
|
+
steps: [
|
|
9728
|
+
{
|
|
9729
|
+
role: "gather-brief",
|
|
9730
|
+
archetype: "extract",
|
|
9731
|
+
tier: "delegate",
|
|
9732
|
+
inputShare: 1,
|
|
9733
|
+
emitsShareOfInput: 0.2,
|
|
9734
|
+
outputShare: 0
|
|
9735
|
+
},
|
|
9736
|
+
{
|
|
9737
|
+
role: "draft-plan",
|
|
9738
|
+
archetype: "plan",
|
|
9739
|
+
tier: "anchor",
|
|
9740
|
+
inputShare: 0.2,
|
|
9741
|
+
emitsShareOfInput: 0,
|
|
9742
|
+
outputShare: 1
|
|
9743
|
+
}
|
|
9744
|
+
]
|
|
9745
|
+
}
|
|
9746
|
+
};
|
|
9747
|
+
var COACH_CFG = {
|
|
9748
|
+
/** Same felt-utility floor as promotions (alpha.67 family). */
|
|
9749
|
+
minMonthlySavingUsd: 5,
|
|
9750
|
+
/** Executor must clear this archetypePerf on the step's archetype —
|
|
9751
|
+
* same floor as the translator/advisor (ARCHETYPE_FLOOR_DEFAULT). */
|
|
9752
|
+
executorPerfFloor: 6,
|
|
9753
|
+
daysPerMonth: 30
|
|
9754
|
+
};
|
|
9755
|
+
function planDecomposition(args) {
|
|
9756
|
+
const { stats, incumbentPricing, pickExecutor } = args;
|
|
9757
|
+
const cfg = { ...COACH_CFG, ...args.cfg ?? {} };
|
|
9758
|
+
const template = DECOMPOSITION_TEMPLATES[stats.archetype];
|
|
9759
|
+
if (!template) return void 0;
|
|
9760
|
+
const perCall = (pricing, tokensIn, tokensOut) => tokensIn / 1e6 * pricing.costInputPer1m + tokensOut / 1e6 * pricing.costOutputPer1m;
|
|
9761
|
+
const monolithCostPerCallUsd = perCall(
|
|
9762
|
+
incumbentPricing,
|
|
9763
|
+
stats.avgTokensIn,
|
|
9764
|
+
stats.avgTokensOut
|
|
9765
|
+
);
|
|
9766
|
+
const assumptions = [
|
|
9767
|
+
`per-step token shares are ${template.version} JUDGMENT numbers \u2014 no fan-out traffic exists to measure them from yet; they graduate per surface when branch traffic lands`
|
|
9768
|
+
];
|
|
9769
|
+
const steps = [];
|
|
9770
|
+
let splitCostPerCallUsd = 0;
|
|
9771
|
+
for (const step of template.steps) {
|
|
9772
|
+
const stepTokensIn = stats.avgTokensIn * step.inputShare;
|
|
9773
|
+
const stepTokensOut = stats.avgTokensIn * step.emitsShareOfInput + stats.avgTokensOut * step.outputShare;
|
|
9774
|
+
if (step.tier === "anchor") {
|
|
9775
|
+
const cost2 = perCall(incumbentPricing, stepTokensIn, stepTokensOut);
|
|
9776
|
+
splitCostPerCallUsd += cost2;
|
|
9777
|
+
steps.push({
|
|
9778
|
+
...step,
|
|
9779
|
+
executorModel: stats.incumbentModel,
|
|
9780
|
+
executorGrounding: "measured",
|
|
9781
|
+
// the incumbent IS the measured baseline
|
|
9782
|
+
executorPerfScore: null,
|
|
9783
|
+
projectedCostPerCallUsd: cost2
|
|
9784
|
+
});
|
|
9785
|
+
continue;
|
|
9786
|
+
}
|
|
9787
|
+
const candidate = pickExecutor(step.archetype);
|
|
9788
|
+
if (candidate && candidate.modelId === stats.incumbentModel) {
|
|
9789
|
+
const cost2 = perCall(incumbentPricing, stepTokensIn, stepTokensOut);
|
|
9790
|
+
splitCostPerCallUsd += cost2;
|
|
9791
|
+
steps.push({
|
|
9792
|
+
...step,
|
|
9793
|
+
tier: "anchor",
|
|
9794
|
+
executorModel: stats.incumbentModel,
|
|
9795
|
+
executorGrounding: candidate.grounding,
|
|
9796
|
+
executorPerfScore: candidate.perfScore,
|
|
9797
|
+
projectedCostPerCallUsd: cost2
|
|
9798
|
+
});
|
|
9799
|
+
assumptions.push(
|
|
9800
|
+
`step '${step.role}': the cheapest qualified executor IS the incumbent \u2014 nothing to delegate to`
|
|
9801
|
+
);
|
|
9802
|
+
continue;
|
|
9803
|
+
}
|
|
9804
|
+
if (!candidate || candidate.perfScore < cfg.executorPerfFloor) {
|
|
9805
|
+
const cost2 = perCall(incumbentPricing, stepTokensIn, stepTokensOut);
|
|
9806
|
+
splitCostPerCallUsd += cost2;
|
|
9807
|
+
steps.push({
|
|
9808
|
+
...step,
|
|
9809
|
+
tier: "anchor",
|
|
9810
|
+
executorModel: stats.incumbentModel,
|
|
9811
|
+
executorGrounding: "measured",
|
|
9812
|
+
executorPerfScore: candidate?.perfScore ?? null,
|
|
9813
|
+
projectedCostPerCallUsd: cost2
|
|
9814
|
+
});
|
|
9815
|
+
assumptions.push(
|
|
9816
|
+
`step '${step.role}' (${step.archetype}): no executor clears the perf floor ${cfg.executorPerfFloor} \u2014 kept on the incumbent`
|
|
9817
|
+
);
|
|
9818
|
+
continue;
|
|
9819
|
+
}
|
|
9820
|
+
const cost = perCall(candidate, stepTokensIn, stepTokensOut);
|
|
9821
|
+
splitCostPerCallUsd += cost;
|
|
9822
|
+
steps.push({
|
|
9823
|
+
...step,
|
|
9824
|
+
executorModel: candidate.modelId,
|
|
9825
|
+
executorGrounding: candidate.grounding,
|
|
9826
|
+
executorPerfScore: candidate.perfScore,
|
|
9827
|
+
projectedCostPerCallUsd: cost
|
|
9828
|
+
});
|
|
9829
|
+
if (candidate.grounding === "judgment") {
|
|
9830
|
+
assumptions.push(
|
|
9831
|
+
`step '${step.role}': ${candidate.modelId} perf ${candidate.perfScore}/10 on ${step.archetype} is JUDGMENT-grounded (no measured portfolio outcomes for the tuple yet)`
|
|
9832
|
+
);
|
|
9833
|
+
}
|
|
9834
|
+
}
|
|
9835
|
+
const savingPerCallUsd = monolithCostPerCallUsd - splitCostPerCallUsd;
|
|
9836
|
+
const monthlyCalls = stats.nCalls / stats.windowDays * cfg.daysPerMonth;
|
|
9837
|
+
const projectedMonthlySavingUsd = savingPerCallUsd * monthlyCalls;
|
|
9838
|
+
const breakEvenMonthlyCalls = savingPerCallUsd > 0 ? cfg.minMonthlySavingUsd / savingPerCallUsd : null;
|
|
9839
|
+
let verdict;
|
|
9840
|
+
let verdictReason;
|
|
9841
|
+
if (savingPerCallUsd <= 0) {
|
|
9842
|
+
verdict = "keep-monolith";
|
|
9843
|
+
verdictReason = "the split costs MORE per call than the monolith at current pricing \u2014 no volume makes it pay";
|
|
9844
|
+
} else if (projectedMonthlySavingUsd < cfg.minMonthlySavingUsd) {
|
|
9845
|
+
verdict = "keep-monolith";
|
|
9846
|
+
verdictReason = `the split pays $${projectedMonthlySavingUsd.toFixed(2)}/mo at your ~${Math.round(monthlyCalls)} calls/mo \u2014 below the $${cfg.minMonthlySavingUsd} felt-utility floor. Break-even is ~${Math.ceil(breakEvenMonthlyCalls ?? 0)} calls/mo; revisit when volume gets there. Decomposition adds moving parts, and a saving you can't feel doesn't buy them`;
|
|
9847
|
+
} else {
|
|
9848
|
+
verdict = "split-pays";
|
|
9849
|
+
verdictReason = `projected $${projectedMonthlySavingUsd.toFixed(2)}/mo saving at ~${Math.round(monthlyCalls)} calls/mo (monolith $${monolithCostPerCallUsd.toFixed(4)}/call \u2192 split $${splitCostPerCallUsd.toFixed(4)}/call)`;
|
|
9850
|
+
}
|
|
9851
|
+
return {
|
|
9852
|
+
appId: stats.appId,
|
|
9853
|
+
archetype: String(stats.archetype),
|
|
9854
|
+
incumbentModel: stats.incumbentModel,
|
|
9855
|
+
template,
|
|
9856
|
+
steps,
|
|
9857
|
+
monolithCostPerCallUsd,
|
|
9858
|
+
splitCostPerCallUsd,
|
|
9859
|
+
savingPerCallUsd,
|
|
9860
|
+
monthlyCalls,
|
|
9861
|
+
projectedMonthlySavingUsd,
|
|
9862
|
+
breakEvenMonthlyCalls,
|
|
9863
|
+
verdict,
|
|
9864
|
+
verdictReason,
|
|
9865
|
+
assumptions
|
|
9866
|
+
};
|
|
9867
|
+
}
|
|
9868
|
+
|
|
9660
9869
|
// src/index.ts
|
|
9661
9870
|
function compile2(ir, opts) {
|
|
9662
9871
|
const result = compile(ir, opts);
|
|
@@ -9670,7 +9879,10 @@ function compile2(ir, opts) {
|
|
|
9670
9879
|
ALL_ARCHETYPES,
|
|
9671
9880
|
ARCHETYPE_FAMILY_FITS,
|
|
9672
9881
|
ARCHETYPE_FLOOR_DEFAULT,
|
|
9882
|
+
COACH_CFG,
|
|
9673
9883
|
CallError,
|
|
9884
|
+
DECOMPOSITION_TEMPLATES,
|
|
9885
|
+
DECOMPOSITION_TEMPLATES_VERSION,
|
|
9674
9886
|
DEFAULT_FINDINGS_ENDPOINT,
|
|
9675
9887
|
DEFAULT_MEASURED_FAILURE_ENDPOINT,
|
|
9676
9888
|
DEFAULT_PROMOTIONS_ENDPOINT,
|
|
@@ -9770,6 +9982,7 @@ function compile2(ir, opts) {
|
|
|
9770
9982
|
parseGoldenCaptureRate,
|
|
9771
9983
|
parseJudgeVerdict,
|
|
9772
9984
|
peekBrainDeadLetter,
|
|
9985
|
+
planDecomposition,
|
|
9773
9986
|
prefetchMeasuredFailure,
|
|
9774
9987
|
probeShadow,
|
|
9775
9988
|
profileToRow,
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
LIBRARY_VERSION,
|
|
18
18
|
createKeyHealthRoute
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-WZZCW6NA.mjs";
|
|
20
20
|
import {
|
|
21
21
|
ABSOLUTE_FLOOR,
|
|
22
22
|
ARCHETYPE_FLOOR_DEFAULT,
|
|
@@ -6438,6 +6438,211 @@ async function markExclusionFindingHandled(opts) {
|
|
|
6438
6438
|
return { ok: true };
|
|
6439
6439
|
}
|
|
6440
6440
|
|
|
6441
|
+
// src/decomposition.ts
|
|
6442
|
+
var DECOMPOSITION_TEMPLATES_VERSION = "decomposition-templates-v1";
|
|
6443
|
+
var DECOMPOSITION_TEMPLATES = {
|
|
6444
|
+
summarize: {
|
|
6445
|
+
archetype: "summarize",
|
|
6446
|
+
version: DECOMPOSITION_TEMPLATES_VERSION,
|
|
6447
|
+
rationale: "A long-input summarize is mostly reading. A cheap extractor reads the full payload and emits compressed notes; the incumbent composes the summary from the notes \u2014 frontier tokens are spent only on the part that needs frontier judgment.",
|
|
6448
|
+
steps: [
|
|
6449
|
+
{
|
|
6450
|
+
role: "chunk-extract",
|
|
6451
|
+
archetype: "extract",
|
|
6452
|
+
tier: "delegate",
|
|
6453
|
+
inputShare: 1,
|
|
6454
|
+
emitsShareOfInput: 0.15,
|
|
6455
|
+
outputShare: 0
|
|
6456
|
+
},
|
|
6457
|
+
{
|
|
6458
|
+
role: "compose",
|
|
6459
|
+
archetype: "summarize",
|
|
6460
|
+
tier: "anchor",
|
|
6461
|
+
inputShare: 0.15,
|
|
6462
|
+
// reads the notes, not the raw payload
|
|
6463
|
+
emitsShareOfInput: 0,
|
|
6464
|
+
outputShare: 1
|
|
6465
|
+
}
|
|
6466
|
+
]
|
|
6467
|
+
},
|
|
6468
|
+
hunt: {
|
|
6469
|
+
archetype: "hunt",
|
|
6470
|
+
version: DECOMPOSITION_TEMPLATES_VERSION,
|
|
6471
|
+
rationale: "Hunt decomposes into breadth (search sweeps), mechanical harvesting (extraction), and judgment (dedupe + compose). The sweeps and the harvest are grunt work; the composition anchors on the incumbent.",
|
|
6472
|
+
steps: [
|
|
6473
|
+
{
|
|
6474
|
+
role: "search-sweep",
|
|
6475
|
+
archetype: "hunt",
|
|
6476
|
+
tier: "delegate",
|
|
6477
|
+
inputShare: 0.5,
|
|
6478
|
+
emitsShareOfInput: 0.2,
|
|
6479
|
+
outputShare: 0
|
|
6480
|
+
},
|
|
6481
|
+
{
|
|
6482
|
+
role: "harvest",
|
|
6483
|
+
archetype: "extract",
|
|
6484
|
+
tier: "delegate",
|
|
6485
|
+
inputShare: 0.35,
|
|
6486
|
+
emitsShareOfInput: 0.1,
|
|
6487
|
+
outputShare: 0
|
|
6488
|
+
},
|
|
6489
|
+
{
|
|
6490
|
+
role: "dedupe-compose",
|
|
6491
|
+
archetype: "judge",
|
|
6492
|
+
tier: "anchor",
|
|
6493
|
+
inputShare: 0.3,
|
|
6494
|
+
// sweep notes + harvest notes
|
|
6495
|
+
emitsShareOfInput: 0,
|
|
6496
|
+
outputShare: 1
|
|
6497
|
+
}
|
|
6498
|
+
]
|
|
6499
|
+
},
|
|
6500
|
+
plan: {
|
|
6501
|
+
archetype: "plan",
|
|
6502
|
+
version: DECOMPOSITION_TEMPLATES_VERSION,
|
|
6503
|
+
rationale: "Planning splits into context-gathering (mechanical reading) and the plan itself (judgment). The gatherer reads the corpus and briefs; the incumbent plans from the brief.",
|
|
6504
|
+
steps: [
|
|
6505
|
+
{
|
|
6506
|
+
role: "gather-brief",
|
|
6507
|
+
archetype: "extract",
|
|
6508
|
+
tier: "delegate",
|
|
6509
|
+
inputShare: 1,
|
|
6510
|
+
emitsShareOfInput: 0.2,
|
|
6511
|
+
outputShare: 0
|
|
6512
|
+
},
|
|
6513
|
+
{
|
|
6514
|
+
role: "draft-plan",
|
|
6515
|
+
archetype: "plan",
|
|
6516
|
+
tier: "anchor",
|
|
6517
|
+
inputShare: 0.2,
|
|
6518
|
+
emitsShareOfInput: 0,
|
|
6519
|
+
outputShare: 1
|
|
6520
|
+
}
|
|
6521
|
+
]
|
|
6522
|
+
}
|
|
6523
|
+
};
|
|
6524
|
+
var COACH_CFG = {
|
|
6525
|
+
/** Same felt-utility floor as promotions (alpha.67 family). */
|
|
6526
|
+
minMonthlySavingUsd: 5,
|
|
6527
|
+
/** Executor must clear this archetypePerf on the step's archetype —
|
|
6528
|
+
* same floor as the translator/advisor (ARCHETYPE_FLOOR_DEFAULT). */
|
|
6529
|
+
executorPerfFloor: 6,
|
|
6530
|
+
daysPerMonth: 30
|
|
6531
|
+
};
|
|
6532
|
+
function planDecomposition(args) {
|
|
6533
|
+
const { stats, incumbentPricing, pickExecutor } = args;
|
|
6534
|
+
const cfg = { ...COACH_CFG, ...args.cfg ?? {} };
|
|
6535
|
+
const template = DECOMPOSITION_TEMPLATES[stats.archetype];
|
|
6536
|
+
if (!template) return void 0;
|
|
6537
|
+
const perCall = (pricing, tokensIn, tokensOut) => tokensIn / 1e6 * pricing.costInputPer1m + tokensOut / 1e6 * pricing.costOutputPer1m;
|
|
6538
|
+
const monolithCostPerCallUsd = perCall(
|
|
6539
|
+
incumbentPricing,
|
|
6540
|
+
stats.avgTokensIn,
|
|
6541
|
+
stats.avgTokensOut
|
|
6542
|
+
);
|
|
6543
|
+
const assumptions = [
|
|
6544
|
+
`per-step token shares are ${template.version} JUDGMENT numbers \u2014 no fan-out traffic exists to measure them from yet; they graduate per surface when branch traffic lands`
|
|
6545
|
+
];
|
|
6546
|
+
const steps = [];
|
|
6547
|
+
let splitCostPerCallUsd = 0;
|
|
6548
|
+
for (const step of template.steps) {
|
|
6549
|
+
const stepTokensIn = stats.avgTokensIn * step.inputShare;
|
|
6550
|
+
const stepTokensOut = stats.avgTokensIn * step.emitsShareOfInput + stats.avgTokensOut * step.outputShare;
|
|
6551
|
+
if (step.tier === "anchor") {
|
|
6552
|
+
const cost2 = perCall(incumbentPricing, stepTokensIn, stepTokensOut);
|
|
6553
|
+
splitCostPerCallUsd += cost2;
|
|
6554
|
+
steps.push({
|
|
6555
|
+
...step,
|
|
6556
|
+
executorModel: stats.incumbentModel,
|
|
6557
|
+
executorGrounding: "measured",
|
|
6558
|
+
// the incumbent IS the measured baseline
|
|
6559
|
+
executorPerfScore: null,
|
|
6560
|
+
projectedCostPerCallUsd: cost2
|
|
6561
|
+
});
|
|
6562
|
+
continue;
|
|
6563
|
+
}
|
|
6564
|
+
const candidate = pickExecutor(step.archetype);
|
|
6565
|
+
if (candidate && candidate.modelId === stats.incumbentModel) {
|
|
6566
|
+
const cost2 = perCall(incumbentPricing, stepTokensIn, stepTokensOut);
|
|
6567
|
+
splitCostPerCallUsd += cost2;
|
|
6568
|
+
steps.push({
|
|
6569
|
+
...step,
|
|
6570
|
+
tier: "anchor",
|
|
6571
|
+
executorModel: stats.incumbentModel,
|
|
6572
|
+
executorGrounding: candidate.grounding,
|
|
6573
|
+
executorPerfScore: candidate.perfScore,
|
|
6574
|
+
projectedCostPerCallUsd: cost2
|
|
6575
|
+
});
|
|
6576
|
+
assumptions.push(
|
|
6577
|
+
`step '${step.role}': the cheapest qualified executor IS the incumbent \u2014 nothing to delegate to`
|
|
6578
|
+
);
|
|
6579
|
+
continue;
|
|
6580
|
+
}
|
|
6581
|
+
if (!candidate || candidate.perfScore < cfg.executorPerfFloor) {
|
|
6582
|
+
const cost2 = perCall(incumbentPricing, stepTokensIn, stepTokensOut);
|
|
6583
|
+
splitCostPerCallUsd += cost2;
|
|
6584
|
+
steps.push({
|
|
6585
|
+
...step,
|
|
6586
|
+
tier: "anchor",
|
|
6587
|
+
executorModel: stats.incumbentModel,
|
|
6588
|
+
executorGrounding: "measured",
|
|
6589
|
+
executorPerfScore: candidate?.perfScore ?? null,
|
|
6590
|
+
projectedCostPerCallUsd: cost2
|
|
6591
|
+
});
|
|
6592
|
+
assumptions.push(
|
|
6593
|
+
`step '${step.role}' (${step.archetype}): no executor clears the perf floor ${cfg.executorPerfFloor} \u2014 kept on the incumbent`
|
|
6594
|
+
);
|
|
6595
|
+
continue;
|
|
6596
|
+
}
|
|
6597
|
+
const cost = perCall(candidate, stepTokensIn, stepTokensOut);
|
|
6598
|
+
splitCostPerCallUsd += cost;
|
|
6599
|
+
steps.push({
|
|
6600
|
+
...step,
|
|
6601
|
+
executorModel: candidate.modelId,
|
|
6602
|
+
executorGrounding: candidate.grounding,
|
|
6603
|
+
executorPerfScore: candidate.perfScore,
|
|
6604
|
+
projectedCostPerCallUsd: cost
|
|
6605
|
+
});
|
|
6606
|
+
if (candidate.grounding === "judgment") {
|
|
6607
|
+
assumptions.push(
|
|
6608
|
+
`step '${step.role}': ${candidate.modelId} perf ${candidate.perfScore}/10 on ${step.archetype} is JUDGMENT-grounded (no measured portfolio outcomes for the tuple yet)`
|
|
6609
|
+
);
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
const savingPerCallUsd = monolithCostPerCallUsd - splitCostPerCallUsd;
|
|
6613
|
+
const monthlyCalls = stats.nCalls / stats.windowDays * cfg.daysPerMonth;
|
|
6614
|
+
const projectedMonthlySavingUsd = savingPerCallUsd * monthlyCalls;
|
|
6615
|
+
const breakEvenMonthlyCalls = savingPerCallUsd > 0 ? cfg.minMonthlySavingUsd / savingPerCallUsd : null;
|
|
6616
|
+
let verdict;
|
|
6617
|
+
let verdictReason;
|
|
6618
|
+
if (savingPerCallUsd <= 0) {
|
|
6619
|
+
verdict = "keep-monolith";
|
|
6620
|
+
verdictReason = "the split costs MORE per call than the monolith at current pricing \u2014 no volume makes it pay";
|
|
6621
|
+
} else if (projectedMonthlySavingUsd < cfg.minMonthlySavingUsd) {
|
|
6622
|
+
verdict = "keep-monolith";
|
|
6623
|
+
verdictReason = `the split pays $${projectedMonthlySavingUsd.toFixed(2)}/mo at your ~${Math.round(monthlyCalls)} calls/mo \u2014 below the $${cfg.minMonthlySavingUsd} felt-utility floor. Break-even is ~${Math.ceil(breakEvenMonthlyCalls ?? 0)} calls/mo; revisit when volume gets there. Decomposition adds moving parts, and a saving you can't feel doesn't buy them`;
|
|
6624
|
+
} else {
|
|
6625
|
+
verdict = "split-pays";
|
|
6626
|
+
verdictReason = `projected $${projectedMonthlySavingUsd.toFixed(2)}/mo saving at ~${Math.round(monthlyCalls)} calls/mo (monolith $${monolithCostPerCallUsd.toFixed(4)}/call \u2192 split $${splitCostPerCallUsd.toFixed(4)}/call)`;
|
|
6627
|
+
}
|
|
6628
|
+
return {
|
|
6629
|
+
appId: stats.appId,
|
|
6630
|
+
archetype: String(stats.archetype),
|
|
6631
|
+
incumbentModel: stats.incumbentModel,
|
|
6632
|
+
template,
|
|
6633
|
+
steps,
|
|
6634
|
+
monolithCostPerCallUsd,
|
|
6635
|
+
splitCostPerCallUsd,
|
|
6636
|
+
savingPerCallUsd,
|
|
6637
|
+
monthlyCalls,
|
|
6638
|
+
projectedMonthlySavingUsd,
|
|
6639
|
+
breakEvenMonthlyCalls,
|
|
6640
|
+
verdict,
|
|
6641
|
+
verdictReason,
|
|
6642
|
+
assumptions
|
|
6643
|
+
};
|
|
6644
|
+
}
|
|
6645
|
+
|
|
6441
6646
|
// src/index.ts
|
|
6442
6647
|
function compile2(ir, opts) {
|
|
6443
6648
|
const result = compile(ir, opts);
|
|
@@ -6450,7 +6655,10 @@ export {
|
|
|
6450
6655
|
ALL_ARCHETYPES,
|
|
6451
6656
|
ARCHETYPE_FAMILY_FITS,
|
|
6452
6657
|
ARCHETYPE_FLOOR_DEFAULT,
|
|
6658
|
+
COACH_CFG,
|
|
6453
6659
|
CallError,
|
|
6660
|
+
DECOMPOSITION_TEMPLATES,
|
|
6661
|
+
DECOMPOSITION_TEMPLATES_VERSION,
|
|
6454
6662
|
DEFAULT_FINDINGS_ENDPOINT,
|
|
6455
6663
|
DEFAULT_MEASURED_FAILURE_ENDPOINT,
|
|
6456
6664
|
DEFAULT_PROMOTIONS_ENDPOINT,
|
|
@@ -6550,6 +6758,7 @@ export {
|
|
|
6550
6758
|
parseGoldenCaptureRate,
|
|
6551
6759
|
parseJudgeVerdict,
|
|
6552
6760
|
peekBrainDeadLetter,
|
|
6761
|
+
planDecomposition,
|
|
6553
6762
|
prefetchMeasuredFailure,
|
|
6554
6763
|
probeShadow,
|
|
6555
6764
|
profileToRow,
|
package/dist/key-health.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(key_health_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(key_health_exports);
|
|
26
26
|
|
|
27
27
|
// src/version.ts
|
|
28
|
-
var LIBRARY_VERSION = "2.0.0-alpha.
|
|
28
|
+
var LIBRARY_VERSION = "2.0.0-alpha.76";
|
|
29
29
|
|
|
30
30
|
// src/key-health.ts
|
|
31
31
|
var JSON_HEADERS = { "Content-Type": "application/json" };
|
package/dist/key-health.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warmdrift/kgauto-compiler",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.76",
|
|
4
4
|
"description": "Prompt compiler with executable provider knowledge for multi-model AI apps: normalized multi-provider transport with fallback chains, compile-time cliff guards, a curated model registry, and a telemetry flight recorder. Swap models without rewriting prompts.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|