@tangle-network/agent-eval 0.126.1 → 0.126.2
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/CHANGELOG.md +12 -0
- package/dist/benchmarks/index.js +2 -2
- package/dist/campaign/index.d.ts +23 -1
- package/dist/campaign/index.js +4 -2
- package/dist/{chunk-VMUENW6F.js → chunk-7AN2E7BU.js} +57 -3
- package/dist/chunk-7AN2E7BU.js.map +1 -0
- package/dist/{chunk-NGUYT5CI.js → chunk-Y5CLI4PY.js} +2 -2
- package/dist/contract/index.d.ts +25 -0
- package/dist/contract/index.js +3 -2
- package/dist/contract/index.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/openapi.json +1 -1
- package/package.json +1 -1
- package/dist/chunk-VMUENW6F.js.map +0 -1
- /package/dist/{chunk-NGUYT5CI.js.map → chunk-Y5CLI4PY.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.126.2] - 2026-07-24 - fail-closed candidate ranking
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `runOptimization()` and `selfImprove()` accept a fixed-length `selectionRankKey` so domain-specific reliability metrics can choose candidates during every generation.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Candidate rank keys must be non-empty, fixed-length, and finite.
|
|
18
|
+
- A candidate must strictly beat the incumbent on the configured rank key before it can become the next parent or final winner.
|
|
19
|
+
- Method-reported spend above `costCeiling` is rejected before final scoring.
|
|
20
|
+
|
|
9
21
|
## [0.126.1] - 2026-07-24 - optimizer lifecycle integrity
|
|
10
22
|
|
|
11
23
|
### Changed
|
package/dist/benchmarks/index.js
CHANGED
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
runBenchmarkAdapter,
|
|
18
18
|
summarizeBenchmarkCampaign
|
|
19
19
|
} from "../chunk-W4L6C2XT.js";
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-Y5CLI4PY.js";
|
|
21
|
+
import "../chunk-7AN2E7BU.js";
|
|
22
22
|
import "../chunk-UCLVDLCH.js";
|
|
23
23
|
import "../chunk-WGXIEX7P.js";
|
|
24
24
|
import "../chunk-ARU2PZFM.js";
|
package/dist/campaign/index.d.ts
CHANGED
|
@@ -4457,6 +4457,24 @@ interface RunOptimizationBaseOptions<TScenario extends Scenario, TArtifact> exte
|
|
|
4457
4457
|
costLedger?: CostLedgerHandle;
|
|
4458
4458
|
costPhase?: string;
|
|
4459
4459
|
}) => Promise<unknown[]>;
|
|
4460
|
+
/**
|
|
4461
|
+
* Optional override for how the WINNER is selected among coverage-complete
|
|
4462
|
+
* candidates (and how the incumbent bar is set). Returns a lexicographic rank
|
|
4463
|
+
* key — each element higher-is-better; candidates are ranked by descending key
|
|
4464
|
+
* (`compareRankKeys`) and the top must STRICTLY beat the incumbent's key to
|
|
4465
|
+
* promote. Defaults to `[campaignMeanComposite(campaign)]`, i.e. the historical
|
|
4466
|
+
* scalar-mean ranking (single-element key ⇒ identical behavior).
|
|
4467
|
+
*
|
|
4468
|
+
* A binary-with-replicates consumer (e.g. swe-arena, whose ship-gate counts an
|
|
4469
|
+
* instance resolved only when EVERY replicate resolved) passes a fail-closed
|
|
4470
|
+
* key built from the SAME reduction its gate uses, so winner-selection and the
|
|
4471
|
+
* ship-gate rank on the identical metric and can never invert — the selector
|
|
4472
|
+
* cannot promote a flaky per-cell-mean candidate the gate would reject over a
|
|
4473
|
+
* fail-closed candidate the gate would accept. Only the winner CHOICE changes;
|
|
4474
|
+
* the descriptive `composite` (mean) on every record and the Pareto objective
|
|
4475
|
+
* vectors are untouched, so proposer diversity and reporting are unaffected.
|
|
4476
|
+
*/
|
|
4477
|
+
selectionRankKey?: (campaign: CampaignResult<TArtifact, TScenario>) => number[];
|
|
4460
4478
|
}
|
|
4461
4479
|
type RunOptimizationOptions<TScenario extends Scenario, TArtifact> = RunOptimizationBaseOptions<TScenario, TArtifact>;
|
|
4462
4480
|
interface RunOptimizationResult<TArtifact, TScenario extends Scenario> {
|
|
@@ -5487,6 +5505,10 @@ declare function selectDiscriminative(signals: ScenarioSignal[], k: number, opts
|
|
|
5487
5505
|
* descriptive aggregate with NaN. Cells with no valid scores are skipped.
|
|
5488
5506
|
* Empty ⇒ 0. */
|
|
5489
5507
|
declare function campaignMeanComposite<TArtifact, TScenario extends Scenario>(campaign: CampaignResult<TArtifact, TScenario>): number;
|
|
5508
|
+
/** Compare fixed-length lexicographic rank keys where each element is higher-is-better.
|
|
5509
|
+
* Returns a positive number when `a` ranks above `b`, negative when below, and
|
|
5510
|
+
* zero when equal. */
|
|
5511
|
+
declare function compareRankKeys(a: readonly number[], b: readonly number[]): number;
|
|
5490
5512
|
interface CampaignBreakdown {
|
|
5491
5513
|
/** Mean score per judge dimension across all cells. */
|
|
5492
5514
|
dimensions: Record<string, number>;
|
|
@@ -6054,4 +6076,4 @@ declare function verifyCodeSurface(surface: CodeSurface, worktreeDir?: string):
|
|
|
6054
6076
|
* identity against the checkout at `worktreeRef`. */
|
|
6055
6077
|
declare function resolveWorktreePath(surface: CodeSurface, worktreeDir?: string): string;
|
|
6056
6078
|
|
|
6057
|
-
export { type AnalystArtifact, type AnalystScenario, type AnalyzeCrossSurfaceInteractionsInput, type AxisEvidence, type AxisVerdict, type BuildAnalystSurfaceDispatchOptions, type BuildEvidenceVectorOptions, type BuildLoopProvenanceArgs, type CampaignAggregates, type CampaignArtifactWriter, type CampaignBreakdown, type CampaignCellResult, type CampaignCostMeter, type CampaignResult, type CampaignRunPlan, type CampaignRunPlanCell, type CampaignScenarioIdentity, type CampaignStorage, type CampaignTokenUsage, type CampaignTraceWriter, type CodeSurface, type CodeSurfaceVerification, type CompareOptimizationMethodsOptions, type ComparisonCost, type ComponentSurface, type CostLedgerHandle, type CrossSurfaceAdditionDecision, type CrossSurfaceAdditionRejectionReason, type CrossSurfaceAttemptCompleteness, type CrossSurfaceBestSingleSelection, type CrossSurfaceBootstrapPolicy, type CrossSurfaceCandidate, type CrossSurfaceCandidateComparison, type CrossSurfaceCandidateEvidence, type CrossSurfaceCandidateOutcome, type CrossSurfaceCandidateSummary, type CrossSurfaceComponent, type CrossSurfaceComponentEvidence, type CrossSurfaceCompositionStep, type CrossSurfaceDistribution, type CrossSurfaceEligibility, type CrossSurfaceEvidenceBreakdown, type CrossSurfaceIneligibilityReason, type CrossSurfaceInteractionAwareSelection, type CrossSurfaceInteractionEffect, type CrossSurfaceInteractionPath, type CrossSurfaceInteractionReport, type CrossSurfaceInteractionTask, type CrossSurfaceNaiveStackSelection, type CrossSurfacePairCompatibility, type CrossSurfacePairEvidence, type CrossSurfacePairIncompatibilityReason, type CrossSurfacePairwiseEntry, type CrossSurfaceRankedSingle, type CrossSurfaceRelativeCost, type CrossSurfaceSelectionPolicy, type CrossSurfaceSelections, type CrossSurfaceTaskRow, type DefaultProductionGateOptions, type DimensionRegression, type DiscriminationScore, type DispatchContext, type DispatchFn, type EmitLoopProvenanceArgs, type EmitLoopProvenanceResult, type EvalFixture, type EvalFixtureFile, type EvalFixtureLoadOptions, type EvalFixtureRunPlan, type EvalFixtureScenario, type EvalFixtureValidationMode, type EvidenceVector, type ExternalOptimizationExample, type ExternalTextEvaluationResponse, type ExternalTextOptimizationMethodConfig, type ExternalTextOptimizerContext, type ExternalTextOptimizerResult, type FailureModeRecallJudgeOptions, FileSearchLedger, FsLabeledScenarioStore, type FsLabeledScenarioStoreOptions, type Gate, type GateContext, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaAdaptiveEngineRun, type GepaEngineOptions, type GepaEngineRun, type GepaOptimizationMethodConfig, type GepaOptimizationRecipe, type GepaRunnerCommand, type GitWorktreeAdapterOptions, type HeldOutGateOptions, type HeldoutSignificance, type HeldoutSignificanceOptions, type JudgeAggregate, type JudgeConfig, type JudgeDimension, type JudgeScore, type LabelTrust, type LabeledScenarioRecord, type LabeledScenarioSampleArgs, type LabeledScenarioSource, type LabeledScenarioStore, LabeledScenarioStoreError, type LabeledScenarioWrite, type LlmJudgeDimension, type LlmJudgeOptions, type LoadEvalFixtureScenariosOptions, type LoopProvenanceArgsFromResult, type LoopProvenanceBackend, type LoopProvenanceCandidate, type LoopProvenanceEvidence, type LoopProvenanceOptimizationMethod, type LoopProvenanceRecord, type MutableSurface, type NeutralizationGateOptions, type ObjectiveSource, type OpenAICompatibleOptimizerModel, type OpenAutoPrOptions, type OpenAutoPrResult, type OpenSearchLedgerOptions, type OptimizationMethod, type OptimizationMethodComparison, type OptimizationMethodInput, type OptimizationMethodPairwise, type OptimizationMethodProvenance, type OptimizationMethodResult, type OptimizationMethodRunOptions, type OptimizationMethodScore, type OptimizationPackageSource, type OptimizationProposer, type OptimizationTokenUsage, type OptimizerConfig, type OptimizerModelBudget, type PairedHoldout, type ParetoParent, type ParetoSignificanceGateOptions, type PendingCostCallView, type PlanCampaignRunOptions, type PlanEvalFixtureRunOptions, type PlaybackContext, type PlaybackDriver, type PlaybackStep, type PowerPreflight, type PowerPreflightOptions, type PremeasuredOptimizationBaseline, type ProfileDispatchFn, ProfileMatrixError, type ProfileSummary, type PromotionObjective, type PromotionPolicy, type ProposalTrackContext, type ProposeContext, type ProposedCandidate, type RedactionStatus, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceScenario, type RolloutArgumentDiff, type RolloutArgumentDiffOptions, type RolloutCall, type RunCampaignOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunOptimizationOptions, type RunOptimizationResult, type RunProfileMatrixOptions, type RunProfileMatrixResult, SEARCH_LEDGER_SCHEMA, type Scenario, type ScenarioAggregate, type ScenarioRollup, type ScenarioSignal, type ScoreboardRenderOptions, type ScoreboardRow, type ScoreboardSummary, type ScoredRollout, type ScoredSurfaceOutcome, type SearchAccountingAudit, type SearchArtifactRef, type SearchAttemptAccounting, type SearchCandidateDecidedEvent, type SearchCandidateLineage, type SearchCandidateRegisteredEvent, type SearchCandidateSlot, type SearchCandidateSlotClosedEvent, type SearchCandidateSurface, type SearchCompletedEvent, type SearchCostAccounting, type SearchFailureReason, type SearchLedger, type SearchLedgerAppendResult, SearchLedgerConflictError, type SearchLedgerEntry, SearchLedgerError, type SearchLedgerEvent, type SearchLedgerHash, SearchLedgerIntegrityError, type SearchLedgerReplay, type SearchModelIdentity, type SearchOperationKind, type SearchOperationRecordedEvent, type SearchPlan, type SearchPlannedEvent, type SearchPlannedOperation, type SearchPlannedTask, type SearchSourceRef, type SearchSurfaceEffect, type SearchSurfaceEvidence, type SearchSurfaceKind, type SearchTaskAttemptedEvent, type SearchTaskOutcome, type SearchTokenAccounting, type SequentialDecideFn, type SequentialDecideOptions, type SequentialDecision, type SequentialObservation, type SequentialPairedGate, type SequentialPairedGateOptions, type SessionScript, type SingleRunLock, type SingleRunLockOptions, type SkillOptOptimizationMethodConfig, type SkillOptRunnerCommand, type SkillOptTrainerConfig, type SurfaceProposer, type TraceSpan, type TransientFailureOptions, type UngroundedLiteralReport, type UserStory, type UserStoryVerdict, type Worktree, type WorktreeAdapter, WorktreeAdapterError, acquireSingleRunLock, analyzeCrossSurfaceInteractions, assertCampaignDesign, assertCampaignSplitIdentity, assertCodeSurfaceIdentity, assertComponentSurface, buildAnalystSurfaceDispatch, buildEvidenceVector, buildLoopProvenanceRecord, campaignBreakdown, campaignMeanComposite, campaignMeasurementDigest, campaignScenarioIdentity, campaignSplitDigest, campaignSplitDigestFromIdentities, canonicalDigest, classifyUngroundedLiterals, codeSurfaceIdentityMaterial, compareOptimizationMethods, componentSurfaceIdentityMaterial, composeGate, costFromLedgerSummary, createReferenceEquivalenceJudge, createRunCostLedger, defaultProductionGate, detectScale, dimensionRegressions, discoverEvalFixtures, emitLoopProvenance, externalTextOptimizationMethod, failureModeRecallJudge, fsCampaignStorage, gepaOptimizationMethod, gitWorktreeAdapter, heldOutGate, heldoutSignificance, inMemoryCampaignStorage, isProposedCandidate, isTransientTransportFailure, labelTrustRank, llmJudge, loadEvalFixture, loadEvalFixtureScenarios, loopProvenanceArgsFromResult, loopProvenanceSpans, makePlaybackDispatch, neutralizationGate, neutralizeText, openAutoPr, openSearchLedger, optimizationTokenUsageFromSummary, pairHoldout, paretoPolicy, paretoSignificanceGate, planCampaignRun, planEvalFixtureRun, powerPreflight, provenanceRecordPath, provenanceSpansPath, renderScoreboardMarkdown, renderSurfaceDiff, resolveRunDir, resolveWorktreePath, rolloutArgumentDiff, runCampaign, runEval, runImprovementLoop, runOptimization, runProfileMatrix, scoreDiscrimination, scoreUserStory, scoreboardSummary, selectDiscriminative, sequentialDecide, sequentialPairedGate, skillOptOptimizationMethod, surfaceContentHash, surfaceHash, tangleTracesRoot, userStoryScoreboard, validateSearchLedgerEvent, verifyCodeSurface, verifyLoopProvenanceRecord };
|
|
6079
|
+
export { type AnalystArtifact, type AnalystScenario, type AnalyzeCrossSurfaceInteractionsInput, type AxisEvidence, type AxisVerdict, type BuildAnalystSurfaceDispatchOptions, type BuildEvidenceVectorOptions, type BuildLoopProvenanceArgs, type CampaignAggregates, type CampaignArtifactWriter, type CampaignBreakdown, type CampaignCellResult, type CampaignCostMeter, type CampaignResult, type CampaignRunPlan, type CampaignRunPlanCell, type CampaignScenarioIdentity, type CampaignStorage, type CampaignTokenUsage, type CampaignTraceWriter, type CodeSurface, type CodeSurfaceVerification, type CompareOptimizationMethodsOptions, type ComparisonCost, type ComponentSurface, type CostLedgerHandle, type CrossSurfaceAdditionDecision, type CrossSurfaceAdditionRejectionReason, type CrossSurfaceAttemptCompleteness, type CrossSurfaceBestSingleSelection, type CrossSurfaceBootstrapPolicy, type CrossSurfaceCandidate, type CrossSurfaceCandidateComparison, type CrossSurfaceCandidateEvidence, type CrossSurfaceCandidateOutcome, type CrossSurfaceCandidateSummary, type CrossSurfaceComponent, type CrossSurfaceComponentEvidence, type CrossSurfaceCompositionStep, type CrossSurfaceDistribution, type CrossSurfaceEligibility, type CrossSurfaceEvidenceBreakdown, type CrossSurfaceIneligibilityReason, type CrossSurfaceInteractionAwareSelection, type CrossSurfaceInteractionEffect, type CrossSurfaceInteractionPath, type CrossSurfaceInteractionReport, type CrossSurfaceInteractionTask, type CrossSurfaceNaiveStackSelection, type CrossSurfacePairCompatibility, type CrossSurfacePairEvidence, type CrossSurfacePairIncompatibilityReason, type CrossSurfacePairwiseEntry, type CrossSurfaceRankedSingle, type CrossSurfaceRelativeCost, type CrossSurfaceSelectionPolicy, type CrossSurfaceSelections, type CrossSurfaceTaskRow, type DefaultProductionGateOptions, type DimensionRegression, type DiscriminationScore, type DispatchContext, type DispatchFn, type EmitLoopProvenanceArgs, type EmitLoopProvenanceResult, type EvalFixture, type EvalFixtureFile, type EvalFixtureLoadOptions, type EvalFixtureRunPlan, type EvalFixtureScenario, type EvalFixtureValidationMode, type EvidenceVector, type ExternalOptimizationExample, type ExternalTextEvaluationResponse, type ExternalTextOptimizationMethodConfig, type ExternalTextOptimizerContext, type ExternalTextOptimizerResult, type FailureModeRecallJudgeOptions, FileSearchLedger, FsLabeledScenarioStore, type FsLabeledScenarioStoreOptions, type Gate, type GateContext, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaAdaptiveEngineRun, type GepaEngineOptions, type GepaEngineRun, type GepaOptimizationMethodConfig, type GepaOptimizationRecipe, type GepaRunnerCommand, type GitWorktreeAdapterOptions, type HeldOutGateOptions, type HeldoutSignificance, type HeldoutSignificanceOptions, type JudgeAggregate, type JudgeConfig, type JudgeDimension, type JudgeScore, type LabelTrust, type LabeledScenarioRecord, type LabeledScenarioSampleArgs, type LabeledScenarioSource, type LabeledScenarioStore, LabeledScenarioStoreError, type LabeledScenarioWrite, type LlmJudgeDimension, type LlmJudgeOptions, type LoadEvalFixtureScenariosOptions, type LoopProvenanceArgsFromResult, type LoopProvenanceBackend, type LoopProvenanceCandidate, type LoopProvenanceEvidence, type LoopProvenanceOptimizationMethod, type LoopProvenanceRecord, type MutableSurface, type NeutralizationGateOptions, type ObjectiveSource, type OpenAICompatibleOptimizerModel, type OpenAutoPrOptions, type OpenAutoPrResult, type OpenSearchLedgerOptions, type OptimizationMethod, type OptimizationMethodComparison, type OptimizationMethodInput, type OptimizationMethodPairwise, type OptimizationMethodProvenance, type OptimizationMethodResult, type OptimizationMethodRunOptions, type OptimizationMethodScore, type OptimizationPackageSource, type OptimizationProposer, type OptimizationTokenUsage, type OptimizerConfig, type OptimizerModelBudget, type PairedHoldout, type ParetoParent, type ParetoSignificanceGateOptions, type PendingCostCallView, type PlanCampaignRunOptions, type PlanEvalFixtureRunOptions, type PlaybackContext, type PlaybackDriver, type PlaybackStep, type PowerPreflight, type PowerPreflightOptions, type PremeasuredOptimizationBaseline, type ProfileDispatchFn, ProfileMatrixError, type ProfileSummary, type PromotionObjective, type PromotionPolicy, type ProposalTrackContext, type ProposeContext, type ProposedCandidate, type RedactionStatus, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceScenario, type RolloutArgumentDiff, type RolloutArgumentDiffOptions, type RolloutCall, type RunCampaignOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunOptimizationOptions, type RunOptimizationResult, type RunProfileMatrixOptions, type RunProfileMatrixResult, SEARCH_LEDGER_SCHEMA, type Scenario, type ScenarioAggregate, type ScenarioRollup, type ScenarioSignal, type ScoreboardRenderOptions, type ScoreboardRow, type ScoreboardSummary, type ScoredRollout, type ScoredSurfaceOutcome, type SearchAccountingAudit, type SearchArtifactRef, type SearchAttemptAccounting, type SearchCandidateDecidedEvent, type SearchCandidateLineage, type SearchCandidateRegisteredEvent, type SearchCandidateSlot, type SearchCandidateSlotClosedEvent, type SearchCandidateSurface, type SearchCompletedEvent, type SearchCostAccounting, type SearchFailureReason, type SearchLedger, type SearchLedgerAppendResult, SearchLedgerConflictError, type SearchLedgerEntry, SearchLedgerError, type SearchLedgerEvent, type SearchLedgerHash, SearchLedgerIntegrityError, type SearchLedgerReplay, type SearchModelIdentity, type SearchOperationKind, type SearchOperationRecordedEvent, type SearchPlan, type SearchPlannedEvent, type SearchPlannedOperation, type SearchPlannedTask, type SearchSourceRef, type SearchSurfaceEffect, type SearchSurfaceEvidence, type SearchSurfaceKind, type SearchTaskAttemptedEvent, type SearchTaskOutcome, type SearchTokenAccounting, type SequentialDecideFn, type SequentialDecideOptions, type SequentialDecision, type SequentialObservation, type SequentialPairedGate, type SequentialPairedGateOptions, type SessionScript, type SingleRunLock, type SingleRunLockOptions, type SkillOptOptimizationMethodConfig, type SkillOptRunnerCommand, type SkillOptTrainerConfig, type SurfaceProposer, type TraceSpan, type TransientFailureOptions, type UngroundedLiteralReport, type UserStory, type UserStoryVerdict, type Worktree, type WorktreeAdapter, WorktreeAdapterError, acquireSingleRunLock, analyzeCrossSurfaceInteractions, assertCampaignDesign, assertCampaignSplitIdentity, assertCodeSurfaceIdentity, assertComponentSurface, buildAnalystSurfaceDispatch, buildEvidenceVector, buildLoopProvenanceRecord, campaignBreakdown, campaignMeanComposite, campaignMeasurementDigest, campaignScenarioIdentity, campaignSplitDigest, campaignSplitDigestFromIdentities, canonicalDigest, classifyUngroundedLiterals, codeSurfaceIdentityMaterial, compareOptimizationMethods, compareRankKeys, componentSurfaceIdentityMaterial, composeGate, costFromLedgerSummary, createReferenceEquivalenceJudge, createRunCostLedger, defaultProductionGate, detectScale, dimensionRegressions, discoverEvalFixtures, emitLoopProvenance, externalTextOptimizationMethod, failureModeRecallJudge, fsCampaignStorage, gepaOptimizationMethod, gitWorktreeAdapter, heldOutGate, heldoutSignificance, inMemoryCampaignStorage, isProposedCandidate, isTransientTransportFailure, labelTrustRank, llmJudge, loadEvalFixture, loadEvalFixtureScenarios, loopProvenanceArgsFromResult, loopProvenanceSpans, makePlaybackDispatch, neutralizationGate, neutralizeText, openAutoPr, openSearchLedger, optimizationTokenUsageFromSummary, pairHoldout, paretoPolicy, paretoSignificanceGate, planCampaignRun, planEvalFixtureRun, powerPreflight, provenanceRecordPath, provenanceSpansPath, renderScoreboardMarkdown, renderSurfaceDiff, resolveRunDir, resolveWorktreePath, rolloutArgumentDiff, runCampaign, runEval, runImprovementLoop, runOptimization, runProfileMatrix, scoreDiscrimination, scoreUserStory, scoreboardSummary, selectDiscriminative, sequentialDecide, sequentialPairedGate, skillOptOptimizationMethod, surfaceContentHash, surfaceHash, tangleTracesRoot, userStoryScoreboard, validateSearchLedgerEvent, verifyCodeSurface, verifyLoopProvenanceRecord };
|
package/dist/campaign/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
userStoryScoreboard,
|
|
33
33
|
validateSearchLedgerEvent,
|
|
34
34
|
verifyCodeSurface
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-Y5CLI4PY.js";
|
|
36
36
|
import {
|
|
37
37
|
acquireSingleRunLock,
|
|
38
38
|
assertCodeSurfaceIdentity,
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
canonicalDigest,
|
|
46
46
|
codeSurfaceIdentityMaterial,
|
|
47
47
|
compareOptimizationMethods,
|
|
48
|
+
compareRankKeys,
|
|
48
49
|
componentSurfaceIdentityMaterial,
|
|
49
50
|
composeGate,
|
|
50
51
|
costFromLedgerSummary,
|
|
@@ -78,7 +79,7 @@ import {
|
|
|
78
79
|
surfaceContentHash,
|
|
79
80
|
surfaceHash,
|
|
80
81
|
verifyLoopProvenanceRecord
|
|
81
|
-
} from "../chunk-
|
|
82
|
+
} from "../chunk-7AN2E7BU.js";
|
|
82
83
|
import {
|
|
83
84
|
SearchLedgerConflictError,
|
|
84
85
|
SearchLedgerError,
|
|
@@ -141,6 +142,7 @@ export {
|
|
|
141
142
|
classifyUngroundedLiterals,
|
|
142
143
|
codeSurfaceIdentityMaterial,
|
|
143
144
|
compareOptimizationMethods,
|
|
145
|
+
compareRankKeys,
|
|
144
146
|
componentSurfaceIdentityMaterial,
|
|
145
147
|
composeGate,
|
|
146
148
|
costFromLedgerSummary,
|
|
@@ -1514,6 +1514,29 @@ function campaignMeanComposite(campaign) {
|
|
|
1514
1514
|
}
|
|
1515
1515
|
return composites.length === 0 ? 0 : composites.reduce((a, b) => a + b, 0) / composites.length;
|
|
1516
1516
|
}
|
|
1517
|
+
function assertFiniteRankKey(key, label, expectedLength) {
|
|
1518
|
+
if (!Array.isArray(key) || key.length === 0) {
|
|
1519
|
+
throw new Error(`${label} must return a non-empty array`);
|
|
1520
|
+
}
|
|
1521
|
+
if (expectedLength !== void 0 && key.length !== expectedLength) {
|
|
1522
|
+
throw new Error(`${label} returned ${key.length} elements; expected ${expectedLength}`);
|
|
1523
|
+
}
|
|
1524
|
+
for (let index = 0; index < key.length; index++) {
|
|
1525
|
+
if (!Number.isFinite(key[index])) {
|
|
1526
|
+
throw new Error(`${label}[${index}] must be finite`);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
function compareRankKeys(a, b) {
|
|
1531
|
+
assertFiniteRankKey(a, "rank key a");
|
|
1532
|
+
assertFiniteRankKey(b, "rank key b", a.length);
|
|
1533
|
+
for (let i = 0; i < a.length; i++) {
|
|
1534
|
+
const av = a[i];
|
|
1535
|
+
const bv = b[i];
|
|
1536
|
+
if (av !== bv) return av - bv;
|
|
1537
|
+
}
|
|
1538
|
+
return 0;
|
|
1539
|
+
}
|
|
1517
1540
|
function campaignBreakdown(campaign) {
|
|
1518
1541
|
const dimSums = {};
|
|
1519
1542
|
const dimCounts = {};
|
|
@@ -1775,6 +1798,16 @@ async function compareOptimizationMethods(opts) {
|
|
|
1775
1798
|
throw error;
|
|
1776
1799
|
}
|
|
1777
1800
|
});
|
|
1801
|
+
assertReportedCostWithinCeiling(
|
|
1802
|
+
combineCosts(
|
|
1803
|
+
optimized.map((result) => ({
|
|
1804
|
+
label: `method '${result.name}'`,
|
|
1805
|
+
cost: result.cost
|
|
1806
|
+
}))
|
|
1807
|
+
).totalCostUsd,
|
|
1808
|
+
opts.costCeiling,
|
|
1809
|
+
"optimization"
|
|
1810
|
+
);
|
|
1778
1811
|
const testCostPhase = finalCostPhase(opts, baselineSurface, optimized, seed);
|
|
1779
1812
|
const baselineArr = align(
|
|
1780
1813
|
await scoreOnTest(baselineSurface, "test/baseline", testCostPhase),
|
|
@@ -1869,6 +1902,7 @@ async function compareOptimizationMethods(opts) {
|
|
|
1869
1902
|
{ label: "optimization", cost: optimizationCost },
|
|
1870
1903
|
{ label: "final test", cost: testCost }
|
|
1871
1904
|
]);
|
|
1905
|
+
assertReportedCostWithinCeiling(totalCost.totalCostUsd, opts.costCeiling, "total");
|
|
1872
1906
|
return {
|
|
1873
1907
|
scores,
|
|
1874
1908
|
best,
|
|
@@ -1885,6 +1919,14 @@ async function compareOptimizationMethods(opts) {
|
|
|
1885
1919
|
reps: opts.reps ?? 1
|
|
1886
1920
|
};
|
|
1887
1921
|
}
|
|
1922
|
+
function assertReportedCostWithinCeiling(totalCostUsd, costCeiling, phase) {
|
|
1923
|
+
const tolerance = Number.EPSILON * Math.max(1, Math.abs(totalCostUsd), Math.abs(costCeiling ?? 0)) * 8;
|
|
1924
|
+
if (costCeiling !== void 0 && totalCostUsd > costCeiling + tolerance) {
|
|
1925
|
+
throw new Error(
|
|
1926
|
+
`compareOptimizationMethods: reported ${phase} cost ${totalCostUsd} exceeds costCeiling ${costCeiling}`
|
|
1927
|
+
);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1888
1930
|
function assertOptimizationMethods(methods) {
|
|
1889
1931
|
if (!Array.isArray(methods) || methods.length === 0) {
|
|
1890
1932
|
throw new Error("compareOptimizationMethods: no methods to compare");
|
|
@@ -5739,9 +5781,12 @@ async function runOptimization(opts) {
|
|
|
5739
5781
|
const generations = [];
|
|
5740
5782
|
const history = [];
|
|
5741
5783
|
let currentFindings = opts.findings ?? [];
|
|
5784
|
+
const selectionRankKey = opts.selectionRankKey ?? ((campaign) => [campaignMeanComposite(campaign)]);
|
|
5742
5785
|
let winnerSurface = opts.baselineSurface;
|
|
5743
5786
|
let winnerSurfaceHash = surfaceHash(opts.baselineSurface);
|
|
5744
5787
|
let winnerComposite = campaignMeanComposite(baselineCampaign);
|
|
5788
|
+
let winnerRankKey = selectionRankKey(baselineCampaign);
|
|
5789
|
+
assertFiniteRankKey(winnerRankKey, "selectionRankKey for baseline");
|
|
5745
5790
|
const baselineOutcome = toScoredSurfaceOutcome(
|
|
5746
5791
|
winnerSurfaceHash,
|
|
5747
5792
|
baselineCampaign,
|
|
@@ -5808,6 +5853,12 @@ async function runOptimization(opts) {
|
|
|
5808
5853
|
runDir: `${opts.runDir}/gen-${gen}/candidate-${i}`
|
|
5809
5854
|
});
|
|
5810
5855
|
const composite = campaignMeanComposite(campaign);
|
|
5856
|
+
const rankKey = selectionRankKey(campaign);
|
|
5857
|
+
assertFiniteRankKey(
|
|
5858
|
+
rankKey,
|
|
5859
|
+
`selectionRankKey for generation ${gen} candidate ${i}`,
|
|
5860
|
+
winnerRankKey.length
|
|
5861
|
+
);
|
|
5811
5862
|
const coverage = campaignCoverage(
|
|
5812
5863
|
campaign.cells,
|
|
5813
5864
|
opts.scenarios,
|
|
@@ -5821,6 +5872,7 @@ async function runOptimization(opts) {
|
|
|
5821
5872
|
rationale,
|
|
5822
5873
|
campaign,
|
|
5823
5874
|
composite,
|
|
5875
|
+
rankKey,
|
|
5824
5876
|
coverage
|
|
5825
5877
|
};
|
|
5826
5878
|
}
|
|
@@ -5835,16 +5887,17 @@ async function runOptimization(opts) {
|
|
|
5835
5887
|
}
|
|
5836
5888
|
surfaceResults.sort((a, b) => {
|
|
5837
5889
|
if (a.coverage.complete !== b.coverage.complete) return a.coverage.complete ? -1 : 1;
|
|
5838
|
-
return b.
|
|
5890
|
+
return compareRankKeys(b.rankKey, a.rankKey);
|
|
5839
5891
|
});
|
|
5840
5892
|
const eligibleResults = surfaceResults.filter((result) => result.coverage.complete);
|
|
5841
5893
|
const top = eligibleResults[0];
|
|
5842
|
-
const promoted = top && top.
|
|
5894
|
+
const promoted = top && compareRankKeys(top.rankKey, winnerRankKey) > 0 ? [top] : [];
|
|
5843
5895
|
if (promoted[0]) {
|
|
5844
5896
|
const top2 = promoted[0];
|
|
5845
5897
|
winnerSurface = top2.surface;
|
|
5846
5898
|
winnerSurfaceHash = top2.surfaceHash;
|
|
5847
5899
|
winnerComposite = top2.composite;
|
|
5900
|
+
winnerRankKey = top2.rankKey;
|
|
5848
5901
|
winnerOutcome = toScoredSurfaceOutcome(top2.surfaceHash, top2.campaign, top2.coverage, gen);
|
|
5849
5902
|
winnerLabel = top2.label || void 0;
|
|
5850
5903
|
winnerRationale = top2.rationale || void 0;
|
|
@@ -7228,6 +7281,7 @@ export {
|
|
|
7228
7281
|
buildReflectionPrompt,
|
|
7229
7282
|
parseReflectionResponse,
|
|
7230
7283
|
campaignMeanComposite,
|
|
7284
|
+
compareRankKeys,
|
|
7231
7285
|
campaignBreakdown,
|
|
7232
7286
|
assertCodeSurfaceIdentity,
|
|
7233
7287
|
assertComponentSurface,
|
|
@@ -7271,4 +7325,4 @@ export {
|
|
|
7271
7325
|
emitLoopProvenance,
|
|
7272
7326
|
skillOptOptimizationMethod
|
|
7273
7327
|
};
|
|
7274
|
-
//# sourceMappingURL=chunk-
|
|
7328
|
+
//# sourceMappingURL=chunk-7AN2E7BU.js.map
|