@tangle-network/agent-eval 0.123.3 → 0.123.5

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 CHANGED
@@ -8,6 +8,8 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
8
8
 
9
9
  ### Added
10
10
 
11
+ - `selfImprove({ budget: { candidateConcurrency } })` exposes the existing `runOptimization()` control for scoring candidate campaigns in parallel; it remains opt-in and defaults to one candidate campaign at a time.
12
+ - `llmPolicyEditProposer()` and `projectPolicyEditHistory()` accept `scenarioOrder: 'input'` when controlled comparisons must preserve first-occurrence caller order; ranked evidence selection remains the default.
11
13
  - `callLlmJson()` accepts `jsonPayloadMode: 'exact'` when callers must reject fenced, prose-wrapped, or multi-root responses instead of extracting a JSON value.
12
14
  - `llmPolicyEditProposer({ redactCurrentSurfaceForModel })` can remove credentials and unrelated fields from the current surface sent to the model while applying validated edits to the complete original surface.
13
15
  - `CostLedger.listPending()` exposes immutable pending paid calls and distinguishes calls that are active, late after cancellation, or interrupted by a prior process so durable workflows can reconcile exact reservations before resuming.
@@ -17,7 +17,7 @@ import {
17
17
  runBenchmarkAdapter,
18
18
  summarizeBenchmarkCampaign
19
19
  } from "../chunk-JKDNAOF5.js";
20
- import "../chunk-22VO7T2I.js";
20
+ import "../chunk-LT4J7ULK.js";
21
21
  import "../chunk-SUN7QLPB.js";
22
22
  import "../chunk-D5JZ7UDZ.js";
23
23
  import "../chunk-MHPEGJHC.js";
@@ -5702,6 +5702,36 @@ interface HaloProposerOptions {
5702
5702
  /** Wrap the real halo-engine CLI as a SurfaceProposer (prompt-tier). */
5703
5703
  declare function haloProposer(opts: HaloProposerOptions): SurfaceProposer;
5704
5704
 
5705
+ /** One measured scenario row eligible for PolicyEdit author context. */
5706
+ interface PolicyEditAuthorScenarioRow {
5707
+ scenarioId: string;
5708
+ composite: number;
5709
+ }
5710
+ type PolicyEditAuthorScenarioOrder = 'ranked' | 'input';
5711
+ interface SelectPolicyEditAuthorRowsOptions {
5712
+ /** Maximum returned rows. Must be a positive safe integer. */
5713
+ limit: number;
5714
+ /** Optional score to compare against, keyed by scenario ID. */
5715
+ referenceByScenario?: ReadonlyMap<string, number>;
5716
+ /** Ranked evidence selection by default; `input` preserves first-occurrence caller order. */
5717
+ scenarioOrder?: PolicyEditAuthorScenarioOrder;
5718
+ }
5719
+ interface SerializedJsonBudget {
5720
+ json: string;
5721
+ actualChars: number;
5722
+ maxChars: number;
5723
+ }
5724
+ /**
5725
+ * Select a bounded, deterministic evidence slice for a PolicyEdit author.
5726
+ *
5727
+ * Rows are deduplicated by scenario ID, keeping the first measured row. Ranked
5728
+ * selection (the default) interleaves hardest score, largest regression, and
5729
+ * largest improvement. Input selection retains first-occurrence caller order.
5730
+ */
5731
+ declare function selectPolicyEditAuthorRows<T extends PolicyEditAuthorScenarioRow>(rows: readonly T[], options: SelectPolicyEditAuthorRowsOptions): T[];
5732
+ /** Serialize once and fail before dispatch when author context exceeds its budget. */
5733
+ declare function assertPolicyEditAuthorContextBudget(value: unknown, maxChars: number): SerializedJsonBudget;
5734
+
5705
5735
  declare const JSON_POLICY_EDIT_TARGET_SURFACES: readonly ["prompt", "tool-contract", "runtime-config", "memory", "agent-profile"];
5706
5736
  type JsonPolicyEditTargetSurface = (typeof JSON_POLICY_EDIT_TARGET_SURFACES)[number];
5707
5737
  declare const DEFAULT_POLICY_EDIT_HISTORY_LIMITS: Readonly<{
@@ -5744,8 +5774,10 @@ interface PolicyEditHistoryProjectionOptions {
5744
5774
  maxGenerations?: number;
5745
5775
  /** Number of candidates retained per generation. Default: 16. */
5746
5776
  maxCandidatesPerGeneration?: number;
5747
- /** Scored tasks retained per candidate/outcome after deterministic extreme selection. */
5777
+ /** Maximum scored tasks retained per candidate/outcome. */
5748
5778
  maxScenariosPerCandidate?: number;
5779
+ /** Ranked evidence selection by default; `input` preserves first-occurrence caller order. */
5780
+ scenarioOrder?: PolicyEditAuthorScenarioOrder;
5749
5781
  /** Optional pseudonymizer applied before scenario IDs enter author text. */
5750
5782
  scenarioIdTransform?: (scenarioId: string) => string;
5751
5783
  /** Objectives used to compute forecast residuals from measured composite deltas. */
@@ -5841,8 +5873,10 @@ interface LlmPolicyEditProposerOptions {
5841
5873
  maxHistoryGenerations?: number;
5842
5874
  /** Candidates retained per admitted generation. Default: 16. */
5843
5875
  maxHistoryCandidatesPerGeneration?: number;
5844
- /** Scored tasks retained per candidate/outcome after deterministic extreme selection. */
5876
+ /** Maximum scored tasks retained per candidate/outcome. */
5845
5877
  maxScenariosPerCandidate?: number;
5878
+ /** Ranked evidence selection by default; `input` preserves first-occurrence caller order. */
5879
+ scenarioOrder?: PolicyEditAuthorScenarioOrder;
5846
5880
  /** Evidence-bearing findings retained after deterministic severity/confidence ordering. */
5847
5881
  maxFindings?: number;
5848
5882
  /** Hard character limit over system + schema + serialized author context. */
@@ -5948,33 +5982,6 @@ interface PolicyEditProposerOptions {
5948
5982
  */
5949
5983
  declare function policyEditProposer(opts?: PolicyEditProposerOptions): SurfaceProposer;
5950
5984
 
5951
- /** One measured scenario row eligible for PolicyEdit author context. */
5952
- interface PolicyEditAuthorScenarioRow {
5953
- scenarioId: string;
5954
- composite: number;
5955
- }
5956
- interface SelectPolicyEditAuthorRowsOptions {
5957
- /** Maximum returned rows. Must be a positive safe integer. */
5958
- limit: number;
5959
- /** Optional score to compare against, keyed by scenario ID. */
5960
- referenceByScenario?: ReadonlyMap<string, number>;
5961
- }
5962
- interface SerializedJsonBudget {
5963
- json: string;
5964
- actualChars: number;
5965
- maxChars: number;
5966
- }
5967
- /**
5968
- * Select a bounded, deterministic evidence slice for a PolicyEdit author.
5969
- *
5970
- * Rows are deduplicated by scenario ID, keeping the first measured row. The
5971
- * result then interleaves three ranked views: hardest score, largest regression,
5972
- * and largest improvement. A row selected by multiple views appears once.
5973
- */
5974
- declare function selectPolicyEditAuthorRows<T extends PolicyEditAuthorScenarioRow>(rows: readonly T[], options: SelectPolicyEditAuthorRowsOptions): T[];
5975
- /** Serialize once and fail before dispatch when author context exceeds its budget. */
5976
- declare function assertPolicyEditAuthorContextBudget(value: unknown, maxChars: number): SerializedJsonBudget;
5977
-
5978
5985
  /**
5979
5986
  * Typed Ax output for analyst findings.
5980
5987
  *
@@ -7678,4 +7685,4 @@ declare function verifyCodeSurface(surface: CodeSurface, worktreeDir?: string):
7678
7685
  * identity against the checkout at `worktreeRef`. */
7679
7686
  declare function resolveWorktreePath(surface: CodeSurface, worktreeDir?: string): string;
7680
7687
 
7681
- export { type AcceptedEdit, type AceProposerOptions, type AnalystArtifact, type AnalystScenario, type AnalyzeCrossSurfaceInteractionsInput, type AnalyzeOtlpTraceFileOptions, type ApplySkillPatchResult, type AxisEvidence, type AxisVerdict, type BuildAnalystSurfaceDispatchOptions, type BuildEvidenceVectorOptions, type BuildLoopProvenanceArgs, type BuiltinOptimizationMethodConfig, 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 CompositeProposerOptions, 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, DEFAULT_POLICY_EDIT_HISTORY_LIMITS, 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 EvolutionaryProposerOptions, type FailureModeRecallJudgeOptions, type FapoAttributionSignals, type FapoFailureCluster, type FapoOptimizationLevel, type FapoOptimizationMethodConfig, type FapoProposerOptions, type FapoReviewInput, type FapoReviewIssue, type FapoReviewResult, type FapoScopeContract, FileSearchLedger, FsLabeledScenarioStore, type FsLabeledScenarioStoreOptions, type Gate, type GateContext, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaProposerConstraints, type GepaProposerOptions, type GitWorktreeAdapterOptions, type Governor, type GovernorContext, type GovernorOp, type HaloProposerOptions, type HeldOutGateOptions, type HeldoutSignificance, type HeldoutSignificanceOptions, type HeuristicGovernorOptions, type JsonPolicyEditTargetSurface, type JsonPrimitive, type JsonValue, type JudgeAggregate, type JudgeConfig, type JudgeDimension, type JudgeScore, type LabelTrust, type LabeledScenarioRecord, type LabeledScenarioSampleArgs, type LabeledScenarioSource, type LabeledScenarioStore, LabeledScenarioStoreError, type LabeledScenarioWrite, Lineage, type LineageEdge, type LineageGraph, type LineageNode, type LineageNodeInput, type LineageStore, LineageStoreConflictError, type LlmJudgeDimension, type LlmJudgeOptions, type LlmPolicyEditProposerOptions, type LoadEvalFixtureScenariosOptions, type LoopProvenanceArgsFromResult, type LoopProvenanceBackend, type LoopProvenanceCandidate, type LoopProvenanceEvidence, type LoopProvenanceRecord, type MemoryCurationProposerOptions, type MutableSurface, type Mutator, type NeutralizationGateOptions, type ObjectiveSource, type OpenAutoPrOptions, type OpenAutoPrResult, type OpenSearchLedgerOptions, type OptimizationMethod, type OptimizationMethodComparison, type OptimizationMethodInput, type OptimizationMethodPairwise, type OptimizationMethodResult, type OptimizationMethodRunOptions, type OptimizationMethodScore, type OptimizationProposer, type OptimizerConfig, POLICY_EDIT_CANDIDATE_RECORD_SCHEMA, type PairedHoldout, type ParameterCandidate, type ParameterChange, type ParameterSweepProposerOptions, type ParetoParent, type ParetoSignificanceGateOptions, type PendingCostCallView, type PlanCampaignRunOptions, type PlanEvalFixtureRunOptions, type PlaybackContext, type PlaybackDriver, type PlaybackStep, type PolicyEditAuthorScenarioRow, type PolicyEditCandidateRecord, type PolicyEditCandidateSummary, type PolicyEditFindingInput, type PolicyEditFindingSource, type PolicyEditHistoryCandidateContext, type PolicyEditHistoryGenerationContext, type PolicyEditHistoryProjectionOptions, type PolicyEditObjective, type PolicyEditOutcomeContext, type PolicyEditProposerOptions, type PowerPreflight, type PowerPreflightOptions, type PremeasuredOptimizationBaseline, type ProfileDispatchFn, ProfileMatrixError, type ProfileSummary, type PromotionObjective, type PromotionPolicy, type ProposalTrackContext, type ProposeContext, type ProposePatchesArgs, type ProposedCandidate, type RedactionStatus, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceScenario, type RejectedEdit, type RolloutArgumentDiff, type RolloutArgumentDiffOptions, type RolloutCall, type RunCampaignOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunLineageLoopOptions, type RunLineageLoopResult, type RunLineageLoopSeed, type RunLineageOptions, type RunLineageResult, type RunLineageSeed, type RunLineageStepResult, type RunOptimizationOptions, type RunOptimizationResult, type RunProfileMatrixOptions, type RunProfileMatrixResult, type RunSkillOptOptions, type RunSkillOptResult, 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 SelectPolicyEditAuthorRowsOptions, type SequentialDecideFn, type SequentialDecideOptions, type SequentialDecision, type SequentialObservation, type SequentialPairedGate, type SequentialPairedGateOptions, type SerializedJsonBudget, type SessionScript, type SingleRunLock, type SingleRunLockOptions, type SkillOptEpochRecord, type SkillOptEvidence, type SkillOptProposer, type SkillOptProposerOptions, type SkillPatch, type SkillPatchOp, SkillPatchParseError, type SkillPatchRejection, type SurfaceProposer, type SurfaceScore, type TraceAnalystPriorFindings, type TraceAnalystProposerOptions, type TraceSpan, type TransientFailureOptions, type UngroundedLiteralReport, type UserStory, type UserStoryVerdict, type Worktree, type WorktreeAdapter, WorktreeAdapterError, aceProposer, acquireSingleRunLock, analyzeCrossSurfaceInteractions, analyzeOtlpTraceFile, applySkillPatch, assertCampaignDesign, assertCampaignSplitIdentity, assertCodeSurfaceIdentity, assertPolicyEditAuthorContextBudget, buildAnalystSurfaceDispatch, buildEvidenceVector, buildLoopProvenanceRecord, callbackGovernor, campaignBreakdown, campaignLineageStore, campaignMeanComposite, campaignMeasurementDigest, campaignScenarioIdentity, campaignSplitDigest, campaignSplitDigestFromIdentities, canonicalDigest, classifyUngroundedLiterals, codeSurfaceIdentityMaterial, compareOptimizationMethods, composeGate, compositeProposer, costFromLedgerSummary, countSentenceEdits, createReferenceEquivalenceJudge, createRunCostLedger, defaultProductionGate, detectScale, dimensionRegressions, discoverEvalFixtures, emitLoopProvenance, evolutionaryProposer, extractFapoAttributionSignals, extractH2Sections, failureModeRecallJudge, fapoEscalationMethod, fapoProposer, fsCampaignStorage, fsLineageStore, gepaParetoMethod, gepaProposer, gepaReflectionMethod, gitWorktreeAdapter, haloProposer, heldOutGate, heldoutSignificance, heuristicGovernor, inMemoryCampaignStorage, isProposedCandidate, isTransientTransportFailure, labelTrustRank, lineageNodeId, llmJudge, llmPolicyEditProposer, loadEvalFixture, loadEvalFixtureScenarios, loopProvenanceArgsFromResult, loopProvenanceSpans, makePlaybackDispatch, memLineageStore, memoryCurationProposer, neutralizationGate, neutralizeText, openAutoPr, openSearchLedger, pairHoldout, parameterSweepProposer, paretoPolicy, paretoSignificanceGate, parseSkillPatchResponse, patchEditCount, planCampaignRun, planEvalFixtureRun, policyEditProposer, powerPreflight, projectPolicyEditHistory, provenanceRecordPath, provenanceSpansPath, renderScoreboardMarkdown, renderSurfaceDiff, resolveRunDir, resolveWorktreePath, rolloutArgumentDiff, runCampaign, runEval, runImprovementLoop, runLineage, runLineageLoop, runOptimization, runProfileMatrix, runSkillOpt, scoreDiscrimination, scoreUserStory, scoreboardSummary, selectDiscriminative, selectPolicyEditAuthorRows, sequentialDecide, sequentialPairedGate, skillOptMethod, skillOptProposer, surfaceContentHash, surfaceHash, tangleTracesRoot, traceAnalystProposer, userStoryScoreboard, validatePolicyEditCandidateRecord, validateSearchLedgerEvent, verifyCodeSurface, verifyLoopProvenanceRecord };
7688
+ export { type AcceptedEdit, type AceProposerOptions, type AnalystArtifact, type AnalystScenario, type AnalyzeCrossSurfaceInteractionsInput, type AnalyzeOtlpTraceFileOptions, type ApplySkillPatchResult, type AxisEvidence, type AxisVerdict, type BuildAnalystSurfaceDispatchOptions, type BuildEvidenceVectorOptions, type BuildLoopProvenanceArgs, type BuiltinOptimizationMethodConfig, 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 CompositeProposerOptions, 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, DEFAULT_POLICY_EDIT_HISTORY_LIMITS, 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 EvolutionaryProposerOptions, type FailureModeRecallJudgeOptions, type FapoAttributionSignals, type FapoFailureCluster, type FapoOptimizationLevel, type FapoOptimizationMethodConfig, type FapoProposerOptions, type FapoReviewInput, type FapoReviewIssue, type FapoReviewResult, type FapoScopeContract, FileSearchLedger, FsLabeledScenarioStore, type FsLabeledScenarioStoreOptions, type Gate, type GateContext, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaProposerConstraints, type GepaProposerOptions, type GitWorktreeAdapterOptions, type Governor, type GovernorContext, type GovernorOp, type HaloProposerOptions, type HeldOutGateOptions, type HeldoutSignificance, type HeldoutSignificanceOptions, type HeuristicGovernorOptions, type JsonPolicyEditTargetSurface, type JsonPrimitive, type JsonValue, type JudgeAggregate, type JudgeConfig, type JudgeDimension, type JudgeScore, type LabelTrust, type LabeledScenarioRecord, type LabeledScenarioSampleArgs, type LabeledScenarioSource, type LabeledScenarioStore, LabeledScenarioStoreError, type LabeledScenarioWrite, Lineage, type LineageEdge, type LineageGraph, type LineageNode, type LineageNodeInput, type LineageStore, LineageStoreConflictError, type LlmJudgeDimension, type LlmJudgeOptions, type LlmPolicyEditProposerOptions, type LoadEvalFixtureScenariosOptions, type LoopProvenanceArgsFromResult, type LoopProvenanceBackend, type LoopProvenanceCandidate, type LoopProvenanceEvidence, type LoopProvenanceRecord, type MemoryCurationProposerOptions, type MutableSurface, type Mutator, type NeutralizationGateOptions, type ObjectiveSource, type OpenAutoPrOptions, type OpenAutoPrResult, type OpenSearchLedgerOptions, type OptimizationMethod, type OptimizationMethodComparison, type OptimizationMethodInput, type OptimizationMethodPairwise, type OptimizationMethodResult, type OptimizationMethodRunOptions, type OptimizationMethodScore, type OptimizationProposer, type OptimizerConfig, POLICY_EDIT_CANDIDATE_RECORD_SCHEMA, type PairedHoldout, type ParameterCandidate, type ParameterChange, type ParameterSweepProposerOptions, type ParetoParent, type ParetoSignificanceGateOptions, type PendingCostCallView, type PlanCampaignRunOptions, type PlanEvalFixtureRunOptions, type PlaybackContext, type PlaybackDriver, type PlaybackStep, type PolicyEditAuthorScenarioOrder, type PolicyEditAuthorScenarioRow, type PolicyEditCandidateRecord, type PolicyEditCandidateSummary, type PolicyEditFindingInput, type PolicyEditFindingSource, type PolicyEditHistoryCandidateContext, type PolicyEditHistoryGenerationContext, type PolicyEditHistoryProjectionOptions, type PolicyEditObjective, type PolicyEditOutcomeContext, type PolicyEditProposerOptions, type PowerPreflight, type PowerPreflightOptions, type PremeasuredOptimizationBaseline, type ProfileDispatchFn, ProfileMatrixError, type ProfileSummary, type PromotionObjective, type PromotionPolicy, type ProposalTrackContext, type ProposeContext, type ProposePatchesArgs, type ProposedCandidate, type RedactionStatus, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceScenario, type RejectedEdit, type RolloutArgumentDiff, type RolloutArgumentDiffOptions, type RolloutCall, type RunCampaignOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunLineageLoopOptions, type RunLineageLoopResult, type RunLineageLoopSeed, type RunLineageOptions, type RunLineageResult, type RunLineageSeed, type RunLineageStepResult, type RunOptimizationOptions, type RunOptimizationResult, type RunProfileMatrixOptions, type RunProfileMatrixResult, type RunSkillOptOptions, type RunSkillOptResult, 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 SelectPolicyEditAuthorRowsOptions, type SequentialDecideFn, type SequentialDecideOptions, type SequentialDecision, type SequentialObservation, type SequentialPairedGate, type SequentialPairedGateOptions, type SerializedJsonBudget, type SessionScript, type SingleRunLock, type SingleRunLockOptions, type SkillOptEpochRecord, type SkillOptEvidence, type SkillOptProposer, type SkillOptProposerOptions, type SkillPatch, type SkillPatchOp, SkillPatchParseError, type SkillPatchRejection, type SurfaceProposer, type SurfaceScore, type TraceAnalystPriorFindings, type TraceAnalystProposerOptions, type TraceSpan, type TransientFailureOptions, type UngroundedLiteralReport, type UserStory, type UserStoryVerdict, type Worktree, type WorktreeAdapter, WorktreeAdapterError, aceProposer, acquireSingleRunLock, analyzeCrossSurfaceInteractions, analyzeOtlpTraceFile, applySkillPatch, assertCampaignDesign, assertCampaignSplitIdentity, assertCodeSurfaceIdentity, assertPolicyEditAuthorContextBudget, buildAnalystSurfaceDispatch, buildEvidenceVector, buildLoopProvenanceRecord, callbackGovernor, campaignBreakdown, campaignLineageStore, campaignMeanComposite, campaignMeasurementDigest, campaignScenarioIdentity, campaignSplitDigest, campaignSplitDigestFromIdentities, canonicalDigest, classifyUngroundedLiterals, codeSurfaceIdentityMaterial, compareOptimizationMethods, composeGate, compositeProposer, costFromLedgerSummary, countSentenceEdits, createReferenceEquivalenceJudge, createRunCostLedger, defaultProductionGate, detectScale, dimensionRegressions, discoverEvalFixtures, emitLoopProvenance, evolutionaryProposer, extractFapoAttributionSignals, extractH2Sections, failureModeRecallJudge, fapoEscalationMethod, fapoProposer, fsCampaignStorage, fsLineageStore, gepaParetoMethod, gepaProposer, gepaReflectionMethod, gitWorktreeAdapter, haloProposer, heldOutGate, heldoutSignificance, heuristicGovernor, inMemoryCampaignStorage, isProposedCandidate, isTransientTransportFailure, labelTrustRank, lineageNodeId, llmJudge, llmPolicyEditProposer, loadEvalFixture, loadEvalFixtureScenarios, loopProvenanceArgsFromResult, loopProvenanceSpans, makePlaybackDispatch, memLineageStore, memoryCurationProposer, neutralizationGate, neutralizeText, openAutoPr, openSearchLedger, pairHoldout, parameterSweepProposer, paretoPolicy, paretoSignificanceGate, parseSkillPatchResponse, patchEditCount, planCampaignRun, planEvalFixtureRun, policyEditProposer, powerPreflight, projectPolicyEditHistory, provenanceRecordPath, provenanceSpansPath, renderScoreboardMarkdown, renderSurfaceDiff, resolveRunDir, resolveWorktreePath, rolloutArgumentDiff, runCampaign, runEval, runImprovementLoop, runLineage, runLineageLoop, runOptimization, runProfileMatrix, runSkillOpt, scoreDiscrimination, scoreUserStory, scoreboardSummary, selectDiscriminative, selectPolicyEditAuthorRows, sequentialDecide, sequentialPairedGate, skillOptMethod, skillOptProposer, surfaceContentHash, surfaceHash, tangleTracesRoot, traceAnalystProposer, userStoryScoreboard, validatePolicyEditCandidateRecord, validateSearchLedgerEvent, verifyCodeSurface, verifyLoopProvenanceRecord };
@@ -70,7 +70,7 @@ import {
70
70
  userStoryScoreboard,
71
71
  validateSearchLedgerEvent,
72
72
  verifyCodeSurface
73
- } from "../chunk-22VO7T2I.js";
73
+ } from "../chunk-LT4J7ULK.js";
74
74
  import {
75
75
  assertCodeSurfaceIdentity,
76
76
  buildEvidenceVector,
@@ -5637,6 +5637,10 @@ function coerceCandidateSurface(surface) {
5637
5637
  // src/campaign/proposers/policy-edit-author-context.ts
5638
5638
  function selectPolicyEditAuthorRows(rows, options) {
5639
5639
  assertPositiveSafeInteger2(options.limit, "limit");
5640
+ const scenarioOrder = options.scenarioOrder ?? "ranked";
5641
+ if (scenarioOrder !== "ranked" && scenarioOrder !== "input") {
5642
+ throw new Error("selectPolicyEditAuthorRows: scenarioOrder must be 'ranked' or 'input'");
5643
+ }
5640
5644
  const unique2 = /* @__PURE__ */ new Map();
5641
5645
  for (const row of rows) {
5642
5646
  if (!row.scenarioId || row.scenarioId.trim() !== row.scenarioId) {
@@ -5659,6 +5663,9 @@ function selectPolicyEditAuthorRows(rows, options) {
5659
5663
  delta: reference === void 0 ? null : row.composite - reference
5660
5664
  });
5661
5665
  }
5666
+ if (scenarioOrder === "input") {
5667
+ return [...unique2.values()].slice(0, options.limit).map(({ row }) => row);
5668
+ }
5662
5669
  const hardest = [...unique2.values()].sort(
5663
5670
  (a, b) => a.row.composite - b.row.composite || compareScenarioId(a.row, b.row)
5664
5671
  );
@@ -5937,6 +5944,7 @@ function llmPolicyEditProposer(opts) {
5937
5944
  ...opts.maxHistoryGenerations === void 0 ? {} : { maxGenerations: opts.maxHistoryGenerations },
5938
5945
  ...opts.maxHistoryCandidatesPerGeneration === void 0 ? {} : { maxCandidatesPerGeneration: opts.maxHistoryCandidatesPerGeneration },
5939
5946
  ...opts.maxScenariosPerCandidate === void 0 ? {} : { maxScenariosPerCandidate: opts.maxScenariosPerCandidate },
5947
+ ...opts.scenarioOrder === void 0 ? {} : { scenarioOrder: opts.scenarioOrder },
5940
5948
  ...opts.scenarioIdTransform === void 0 ? {} : { scenarioIdTransform: opts.scenarioIdTransform }
5941
5949
  });
5942
5950
  const maxFindings = positiveLimit(
@@ -5990,12 +5998,14 @@ function llmPolicyEditProposer(opts) {
5990
5998
  baselineOutcome: projectOutcome(
5991
5999
  ctx.baselineOutcome,
5992
6000
  scenarioIds,
5993
- historyLimits.maxScenariosPerCandidate
6001
+ historyLimits.maxScenariosPerCandidate,
6002
+ historyLimits.scenarioOrder
5994
6003
  ),
5995
6004
  incumbentOutcome: projectOutcome(
5996
6005
  ctx.incumbentOutcome,
5997
6006
  scenarioIds,
5998
6007
  historyLimits.maxScenariosPerCandidate,
6008
+ historyLimits.scenarioOrder,
5999
6009
  ctx.baselineOutcome
6000
6010
  ),
6001
6011
  history: projectPolicyEditHistoryWithProjector(
@@ -6105,6 +6115,7 @@ function projectPolicyEditHistoryWithProjector(history, limits, scenarioIds, obj
6105
6115
  candidate,
6106
6116
  scenarioIds,
6107
6117
  limits.maxScenariosPerCandidate,
6118
+ limits.scenarioOrder,
6108
6119
  candidate.parentSurfaceHash ? candidateByHash.get(candidate.parentSurfaceHash)?.scenarios : void 0,
6109
6120
  objectiveByKey
6110
6121
  )
@@ -6130,10 +6141,11 @@ function selectHistoryCandidates(record, limit) {
6130
6141
  }
6131
6142
  return selected;
6132
6143
  }
6133
- function projectHistoryCandidate(candidate, scenarioIds, maxScenarios, parentScenarios, objectiveByKey) {
6144
+ function projectHistoryCandidate(candidate, scenarioIds, maxScenarios, scenarioOrder, parentScenarios, objectiveByKey) {
6134
6145
  const referenceByScenario = parentScenarios ? new Map(parentScenarios.map((scenario) => [scenario.scenarioId, scenario.composite])) : void 0;
6135
6146
  const selectedScenarios = selectPolicyEditAuthorRows(candidate.scenarios, {
6136
6147
  limit: maxScenarios,
6148
+ scenarioOrder,
6137
6149
  ...referenceByScenario ? { referenceByScenario } : {}
6138
6150
  });
6139
6151
  const validatedRecord = candidate.candidateRecord ? validatePolicyEditCandidateRecord(candidate.candidateRecord) : void 0;
@@ -6167,11 +6179,12 @@ function projectHistoryCandidate(candidate, scenarioIds, maxScenarios, parentSce
6167
6179
  forecastCalibration: forecastCalibration(candidate, validatedRecord, objectiveByKey)
6168
6180
  };
6169
6181
  }
6170
- function projectOutcome(outcome, scenarioIds, maxScenarios, reference = void 0) {
6182
+ function projectOutcome(outcome, scenarioIds, maxScenarios, scenarioOrder, reference = void 0) {
6171
6183
  if (!outcome) return null;
6172
6184
  const referenceByScenario = reference ? new Map(reference.scenarios.map((scenario) => [scenario.scenarioId, scenario.composite])) : void 0;
6173
6185
  const selectedScenarios = selectPolicyEditAuthorRows(outcome.scenarios, {
6174
6186
  limit: maxScenarios,
6187
+ scenarioOrder,
6175
6188
  ...referenceByScenario ? { referenceByScenario } : {}
6176
6189
  });
6177
6190
  return {
@@ -6424,6 +6437,7 @@ function validateHistoryLimits(options) {
6424
6437
  const maxGenerations = options.maxGenerations ?? DEFAULT_POLICY_EDIT_HISTORY_LIMITS.generations;
6425
6438
  const maxCandidatesPerGeneration = options.maxCandidatesPerGeneration ?? DEFAULT_POLICY_EDIT_HISTORY_LIMITS.candidatesPerGeneration;
6426
6439
  const maxScenariosPerCandidate = options.maxScenariosPerCandidate ?? DEFAULT_POLICY_EDIT_HISTORY_LIMITS.scenariosPerCandidate;
6440
+ const scenarioOrder = options.scenarioOrder ?? "ranked";
6427
6441
  if (!Number.isSafeInteger(maxGenerations) || maxGenerations <= 0) {
6428
6442
  throw new Error("llmPolicyEditProposer: maxHistoryGenerations must be a positive safe integer");
6429
6443
  }
@@ -6437,10 +6451,14 @@ function validateHistoryLimits(options) {
6437
6451
  "llmPolicyEditProposer: maxScenariosPerCandidate must be a positive safe integer"
6438
6452
  );
6439
6453
  }
6454
+ if (scenarioOrder !== "ranked" && scenarioOrder !== "input") {
6455
+ throw new Error("llmPolicyEditProposer: scenarioOrder must be 'ranked' or 'input'");
6456
+ }
6440
6457
  return {
6441
6458
  maxGenerations,
6442
6459
  maxCandidatesPerGeneration,
6443
6460
  maxScenariosPerCandidate,
6461
+ scenarioOrder,
6444
6462
  scenarioIdTransform: options.scenarioIdTransform ?? ((scenarioId) => scenarioId)
6445
6463
  };
6446
6464
  }
@@ -8718,4 +8736,4 @@ export {
8718
8736
  verifyCodeSurface,
8719
8737
  resolveWorktreePath
8720
8738
  };
8721
- //# sourceMappingURL=chunk-22VO7T2I.js.map
8739
+ //# sourceMappingURL=chunk-LT4J7ULK.js.map