@tangle-network/agent-eval 0.123.8 → 0.125.0

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +29 -4
  2. package/dist/analyst/index.d.ts +5 -0
  3. package/dist/analyst/index.js +4 -4
  4. package/dist/benchmarks/index.js +4 -4
  5. package/dist/campaign/index.d.ts +20 -1
  6. package/dist/campaign/index.js +4 -4
  7. package/dist/{chunk-ZU3QWGZE.js → chunk-A62YMFWA.js} +89 -8
  8. package/dist/chunk-A62YMFWA.js.map +1 -0
  9. package/dist/{chunk-BUR5R4R4.js → chunk-A6GT67HT.js} +3 -3
  10. package/dist/{chunk-EEHHBAWH.js → chunk-DT7OXY3C.js} +2 -2
  11. package/dist/{chunk-PDHIOKRE.js → chunk-EQUK3RFS.js} +8 -4
  12. package/dist/chunk-EQUK3RFS.js.map +1 -0
  13. package/dist/{chunk-V7HQGZBT.js → chunk-GID26AN4.js} +2 -2
  14. package/dist/{chunk-27UXRPIQ.js → chunk-HM6V7F3M.js} +2 -2
  15. package/dist/chunk-IPYXE555.js +594 -0
  16. package/dist/chunk-IPYXE555.js.map +1 -0
  17. package/dist/chunk-LKKT3IVV.js +1644 -0
  18. package/dist/chunk-LKKT3IVV.js.map +1 -0
  19. package/dist/chunk-M7AH34KV.js +155 -0
  20. package/dist/chunk-M7AH34KV.js.map +1 -0
  21. package/dist/chunk-MAX3TN3C.js +249 -0
  22. package/dist/chunk-MAX3TN3C.js.map +1 -0
  23. package/dist/{chunk-QVGVJQMR.js → chunk-PMITBABE.js} +7 -5
  24. package/dist/{chunk-QVGVJQMR.js.map → chunk-PMITBABE.js.map} +1 -1
  25. package/dist/{chunk-J3LHTAAB.js → chunk-QOTFXW5L.js} +1 -47
  26. package/dist/chunk-QOTFXW5L.js.map +1 -0
  27. package/dist/chunk-RZTMDUO7.js +49 -0
  28. package/dist/chunk-RZTMDUO7.js.map +1 -0
  29. package/dist/chunk-VBQ3CRKH.js +291 -0
  30. package/dist/chunk-VBQ3CRKH.js.map +1 -0
  31. package/dist/{chunk-RQ5TP2TV.js → chunk-W5B3ZGP3.js} +3 -3
  32. package/dist/cli.js +13 -2
  33. package/dist/cli.js.map +1 -1
  34. package/dist/contract/index.d.ts +7 -0
  35. package/dist/contract/index.js +4 -4
  36. package/dist/index.d.ts +833 -82
  37. package/dist/index.js +61 -121
  38. package/dist/index.js.map +1 -1
  39. package/dist/openapi.json +1 -1
  40. package/dist/pipelines/index.js +4 -2
  41. package/dist/pipelines/index.js.map +1 -1
  42. package/dist/rl.d.ts +3 -0
  43. package/dist/rl.js +2 -2
  44. package/dist/rollout/index.d.ts +1061 -0
  45. package/dist/rollout/index.js +109 -0
  46. package/dist/rollout/index.js.map +1 -0
  47. package/dist/supervisor-run/index.d.ts +857 -0
  48. package/dist/supervisor-run/index.js +64 -0
  49. package/dist/supervisor-run/index.js.map +1 -0
  50. package/dist/wire/index.d.ts +3 -0
  51. package/dist/wire/index.js +2 -2
  52. package/docs/rollout.md +48 -0
  53. package/package.json +11 -1
  54. package/dist/chunk-J3LHTAAB.js.map +0 -1
  55. package/dist/chunk-PDHIOKRE.js.map +0 -1
  56. package/dist/chunk-ZU3QWGZE.js.map +0 -1
  57. /package/dist/{chunk-BUR5R4R4.js.map → chunk-A6GT67HT.js.map} +0 -0
  58. /package/dist/{chunk-EEHHBAWH.js.map → chunk-DT7OXY3C.js.map} +0 -0
  59. /package/dist/{chunk-V7HQGZBT.js.map → chunk-GID26AN4.js.map} +0 -0
  60. /package/dist/{chunk-27UXRPIQ.js.map → chunk-HM6V7F3M.js.map} +0 -0
  61. /package/dist/{chunk-RQ5TP2TV.js.map → chunk-W5B3ZGP3.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -6,7 +6,7 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ### Added
9
+ ### Changed
10
10
 
11
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
12
  - `llmPolicyEditProposer()` and `projectPolicyEditHistory()` accept `scenarioOrder: 'input'` when controlled comparisons must preserve first-occurrence caller order; ranked evidence selection remains the default.
@@ -14,9 +14,6 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
14
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.
15
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.
16
16
  - `traceAnalystProposer()` accepts an opt-in `resolvePriorFindings` callback that forwards canonical prior findings into the existing analyst registry.
17
-
18
- ### Changed
19
-
20
17
  - Trace-analysis actors are instructed to emit one executable JavaScript program per turn, report named turn-limit exhaustion, and preserve per-analyst failure details when a proposer produces no findings.
21
18
  - Keep one live tip per lineage track when another track branches or merges from it, and compare those track tips when building the frontier.
22
19
  - Pass track identity, operation, vision, ancestry, and proposer choice to candidate generation so independent tracks can pursue distinct strategies.
@@ -53,6 +50,34 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
53
50
  - `runSkillOpt({ holdoutScenarios })` fails closed because those rows are adaptively reused.
54
51
  Pass `selectionScenarios`; selection result fields now use `Selection` instead of `Holdout`, and `lift` is now `selectionLift`.
55
52
 
53
+ ## [0.125.0] — 2026-07-24 — Claude Code supervision reader and path-bound policy edits
54
+
55
+ ### Added
56
+
57
+ - `claudeCodeSupervisorRunReader()` reads Claude Code root and subagent transcripts into the existing supervision-tree report and rollout formats, while declaring source limits instead of fabricating unavailable spend, verdict, or deliverable data.
58
+ - `llmPolicyEditProposer({ valueSchemaByJsonPath })` binds each allowed edit path to an exact JSON Schema in both the provider response contract and local admission.
59
+
60
+ ### Fixed
61
+
62
+ - Deduplicate repeated Claude Code worker cancellation events and preserve available worker cache-token counts.
63
+ - Reject policy-edit values that do not match their target path before a candidate can enter a campaign.
64
+
65
+ ## [0.124.0] — 2026-07-24 — rollout and supervisor-run subpaths
66
+
67
+ ### Added
68
+
69
+ - `callLlm()` and `callLlmJson()` accept request-level or client-default `thinking: 'enabled' | 'disabled'`; GEPA, SkillOpt, and policy-edit authors expose the same per-proposer override, and the exact mode is preserved in cost bounds, raw request capture, and provider traffic.
70
+ - `@tangle-network/agent-eval/rollout` subpath: the single owner of the `tangle.rollout.v1` serialization — canonical schema + fail-loud validation, ledger file API (`writeRolloutLedger`/`appendRolloutLines`/`readRolloutLedger`), harness-store intake readers (opencode sqlite, Claude Code project jsonl), exporters (SFT, reward rows, Prime Intellect verifiers `RolloutOutput`, OpenAI RFT), deterministic 9-rule scrubber, HuggingFace dataset-card generation, and the `agent-eval rollout-release` CLI (build + optional `--push`). Ported from the agent-runtime bench rollout-ledger and reconciled with the PR #410 row shape; see `docs/rollout.md` for the decision table.
71
+ - `@tangle-network/agent-eval/supervisor-run` subpath: supervision-tree analysis alongside single-rollout trace analysis. `analyzeSupervisorRun(runDir | reader | sources)` returns a `SupervisorRunReport` — steer count with per-worker breakdown, spawn waves + sizes, max concurrency, respawns/repeated labels/delegation depth, supervisor wall + idle wall + worker utilization, accepted vs rejected vs empty-pass, evidence→respawn vs blind respawn, tokens/USD by role, judge verdict + patch stats — and `rollupSupervisorRuns` aggregates across runs. Every metric is `Measured<T> = T | {unavailable: reason}`, so a missing artifact never reads as a measured zero. The input contract is a `SupervisorRunReader` over already-read bytes; `loopsSupervisorRunReader` is one implementation (the loops `.loops/supervisor/*` on-disk layout). `supervisorRunRolloutLines` emits the tree as `tangle.rollout.v1` rows keyed by `parent_rollout_id`, so a supervision tree lands in the same ledger as solo rollouts. Ported from the agent-runtime bench run-report; byte-identical on both committed backfill fixtures.
72
+
73
+ ### Changed
74
+
75
+ - `mintRolloutRows` now emits canonical `tangle.rollout.v1` lines (snake_case wire shape) instead of the interim `RolloutRow`; records without trace spans become labeled gap lines AND are listed in `missingTraces` instead of being skipped. `toSftRows`/`toRewardRows` operate on the new lines; `toSftRows` additionally enforces the trainable-split filter (holdout/dev/canary never export). The realness gate still forces reward 0 and SFT exclusion.
76
+
77
+ ### Fixed
78
+
79
+ - `openOpencodeDb` composes the `node:sqlite` specifier at runtime so neither esbuild nor Vite rewrites it, keeping the opencode rollout reader working in the bundled package.
80
+
56
81
  ## [0.123.8] — 2026-07-23 — reasoning-token accounting
57
82
 
58
83
  ### Fixed
@@ -1020,6 +1020,7 @@ interface LlmMessage {
1020
1020
  };
1021
1021
  }>;
1022
1022
  }
1023
+ type LlmThinkingMode = 'enabled' | 'disabled';
1023
1024
  interface LlmCallRequest {
1024
1025
  model: string;
1025
1026
  messages: LlmMessage[];
@@ -1032,6 +1033,8 @@ interface LlmCallRequest {
1032
1033
  };
1033
1034
  temperature?: number;
1034
1035
  maxTokens?: number;
1036
+ /** OpenAI-compatible reasoning mode. Omitted when the provider default should apply. */
1037
+ thinking?: LlmThinkingMode;
1035
1038
  /** Per-call timeout, default 300s. */
1036
1039
  timeoutMs?: number;
1037
1040
  }
@@ -1125,6 +1128,8 @@ interface LlmClientOptions {
1125
1128
  * Default: `extract`.
1126
1129
  */
1127
1130
  jsonPayloadMode?: 'extract' | 'exact';
1131
+ /** Default provider reasoning mode. A per-call request value takes precedence. */
1132
+ thinking?: LlmThinkingMode;
1128
1133
  /** Fetch implementation — defaults to global `fetch`. Override for custom transport (e.g. tests). */
1129
1134
  fetch?: typeof fetch;
1130
1135
  /**
@@ -9,13 +9,13 @@ import {
9
9
  diffFindings,
10
10
  emitSkillUsageFindings,
11
11
  runSemanticConceptJudge
12
- } from "../chunk-RQ5TP2TV.js";
12
+ } from "../chunk-W5B3ZGP3.js";
13
13
  import {
14
14
  behavioralAnalyst,
15
15
  buildDefaultAnalystRegistry,
16
16
  createChatClient,
17
17
  deriveEfficiencyFindings
18
- } from "../chunk-BUR5R4R4.js";
18
+ } from "../chunk-A6GT67HT.js";
19
19
  import "../chunk-HHWE3POT.js";
20
20
  import {
21
21
  ANALYST_SEVERITIES,
@@ -71,8 +71,8 @@ import {
71
71
  validatePolicyEdit,
72
72
  validatePolicyEditCandidateRecord,
73
73
  validateUsageSettlementTimeout
74
- } from "../chunk-EEHHBAWH.js";
75
- import "../chunk-PDHIOKRE.js";
74
+ } from "../chunk-DT7OXY3C.js";
75
+ import "../chunk-EQUK3RFS.js";
76
76
  import {
77
77
  CostLedger
78
78
  } from "../chunk-GRCDRKII.js";
@@ -17,12 +17,12 @@ import {
17
17
  runBenchmarkAdapter,
18
18
  summarizeBenchmarkCampaign
19
19
  } from "../chunk-JKDNAOF5.js";
20
- import "../chunk-ZU3QWGZE.js";
21
- import "../chunk-QVGVJQMR.js";
20
+ import "../chunk-A62YMFWA.js";
21
+ import "../chunk-PMITBABE.js";
22
22
  import "../chunk-D5JZ7UDZ.js";
23
- import "../chunk-EEHHBAWH.js";
23
+ import "../chunk-DT7OXY3C.js";
24
24
  import "../chunk-ARU2PZFM.js";
25
- import "../chunk-PDHIOKRE.js";
25
+ import "../chunk-EQUK3RFS.js";
26
26
  import "../chunk-PJQFMIOX.js";
27
27
  import "../chunk-GRCDRKII.js";
28
28
  import "../chunk-VI2UW6B6.js";
@@ -1113,6 +1113,7 @@ interface LlmMessage {
1113
1113
  };
1114
1114
  }>;
1115
1115
  }
1116
+ type LlmThinkingMode = 'enabled' | 'disabled';
1116
1117
  interface LlmCallRequest {
1117
1118
  model: string;
1118
1119
  messages: LlmMessage[];
@@ -1125,6 +1126,8 @@ interface LlmCallRequest {
1125
1126
  };
1126
1127
  temperature?: number;
1127
1128
  maxTokens?: number;
1129
+ /** OpenAI-compatible reasoning mode. Omitted when the provider default should apply. */
1130
+ thinking?: LlmThinkingMode;
1128
1131
  /** Per-call timeout, default 300s. */
1129
1132
  timeoutMs?: number;
1130
1133
  }
@@ -1219,6 +1222,8 @@ interface LlmClientOptions {
1219
1222
  * Default: `extract`.
1220
1223
  */
1221
1224
  jsonPayloadMode?: 'extract' | 'exact';
1225
+ /** Default provider reasoning mode. A per-call request value takes precedence. */
1226
+ thinking?: LlmThinkingMode;
1222
1227
  /** Fetch implementation — defaults to global `fetch`. Override for custom transport (e.g. tests). */
1223
1228
  fetch?: typeof fetch;
1224
1229
  /**
@@ -5455,6 +5460,8 @@ interface SkillOptProposerOptions {
5455
5460
  editBudget?: number;
5456
5461
  temperature?: number;
5457
5462
  maxTokens?: number;
5463
+ /** Provider reasoning mode for each patch-authoring call. Omitted to preserve the provider default. */
5464
+ thinking?: LlmCallRequest['thinking'];
5458
5465
  /** Top-K weak scenarios/dimensions surfaced as evidence. Default 3. */
5459
5466
  evidenceK?: number;
5460
5467
  }
@@ -5706,6 +5713,8 @@ interface GepaProposerOptions {
5706
5713
  temperature?: number;
5707
5714
  /** Reflection max tokens. Default 6000. */
5708
5715
  maxTokens?: number;
5716
+ /** Provider reasoning mode for each reflection call. Omitted to preserve the provider default. */
5717
+ thinking?: LlmCallRequest['thinking'];
5709
5718
  /** Structured-doc constraints. Candidates violating any are rejected
5710
5719
  * post-parse and dropped from the returned population. */
5711
5720
  constraints?: GepaProposerConstraints;
@@ -5832,6 +5841,8 @@ type PolicyEditFindingSource = {
5832
5841
  kind: 'global';
5833
5842
  label: string;
5834
5843
  };
5844
+ /** Exact JSON Schema applied to authored `change.value` for one allowed path. */
5845
+ type PolicyEditJsonValueSchema = Readonly<Record<string, unknown>>;
5835
5846
  /** Trace-derived findings must name the measured profile that produced them.
5836
5847
  * Cross-run doctrine can be explicitly global; an unwrapped finding is rejected. */
5837
5848
  interface PolicyEditFindingInput {
@@ -5927,6 +5938,12 @@ interface LlmPolicyEditProposerOptions {
5927
5938
  targetSurface: JsonPolicyEditTargetSurface;
5928
5939
  /** Exact JSON paths the author may change. Prefix or fuzzy matches are not accepted. */
5929
5940
  allowedJsonPaths: readonly string[];
5941
+ /**
5942
+ * Optional exact JSON Schema for `change.value` at every allowed path.
5943
+ * When present, keys must exactly match `allowedJsonPaths`; both the provider
5944
+ * response schema and local validation bind each path to its own value shape.
5945
+ */
5946
+ valueSchemaByJsonPath?: Readonly<Record<string, PolicyEditJsonValueSchema>>;
5930
5947
  /** Caller-owned search objective bound into every authored forecast. */
5931
5948
  objectives: readonly PolicyEditObjective[];
5932
5949
  /** Default: evidence-only, so uncertain edits are measured rather than
@@ -5937,6 +5954,8 @@ interface LlmPolicyEditProposerOptions {
5937
5954
  maxCandidates?: number;
5938
5955
  temperature?: number;
5939
5956
  maxTokens?: number;
5957
+ /** Provider reasoning mode for each policy-authoring call. Omitted to preserve the provider default. */
5958
+ thinking?: LlmCallRequest['thinking'];
5940
5959
  timeoutMs?: number;
5941
5960
  /** Number of most recent scored generations sent to the author. Default: 4. */
5942
5961
  maxHistoryGenerations?: number;
@@ -7754,4 +7773,4 @@ declare function verifyCodeSurface(surface: CodeSurface, worktreeDir?: string):
7754
7773
  * identity against the checkout at `worktreeRef`. */
7755
7774
  declare function resolveWorktreePath(surface: CodeSurface, worktreeDir?: string): string;
7756
7775
 
7757
- 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 GepaEngineRun, type GepaOptimizationMethodConfig, type GepaOptimizationRecipe, type GepaProposerConstraints, type GepaProposerOptions, type GepaRunnerCommand, 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, gepaOptimizationMethod, 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 };
7776
+ 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 GepaEngineRun, type GepaOptimizationMethodConfig, type GepaOptimizationRecipe, type GepaProposerConstraints, type GepaProposerOptions, type GepaRunnerCommand, 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 PolicyEditJsonValueSchema, 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, gepaOptimizationMethod, 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 };
@@ -71,7 +71,7 @@ import {
71
71
  userStoryScoreboard,
72
72
  validateSearchLedgerEvent,
73
73
  verifyCodeSurface
74
- } from "../chunk-ZU3QWGZE.js";
74
+ } from "../chunk-A62YMFWA.js";
75
75
  import {
76
76
  assertCodeSurfaceIdentity,
77
77
  buildEvidenceVector,
@@ -112,7 +112,7 @@ import {
112
112
  surfaceContentHash,
113
113
  surfaceHash,
114
114
  verifyLoopProvenanceRecord
115
- } from "../chunk-QVGVJQMR.js";
115
+ } from "../chunk-PMITBABE.js";
116
116
  import {
117
117
  SearchLedgerConflictError,
118
118
  SearchLedgerError,
@@ -133,9 +133,9 @@ import {
133
133
  import {
134
134
  POLICY_EDIT_CANDIDATE_RECORD_SCHEMA,
135
135
  validatePolicyEditCandidateRecord
136
- } from "../chunk-EEHHBAWH.js";
136
+ } from "../chunk-DT7OXY3C.js";
137
137
  import "../chunk-ARU2PZFM.js";
138
- import "../chunk-PDHIOKRE.js";
138
+ import "../chunk-EQUK3RFS.js";
139
139
  import "../chunk-PJQFMIOX.js";
140
140
  import "../chunk-GRCDRKII.js";
141
141
  import "../chunk-VI2UW6B6.js";
@@ -15,7 +15,7 @@ import {
15
15
  runImprovementLoop,
16
16
  surfaceContentHash,
17
17
  surfaceHash
18
- } from "./chunk-QVGVJQMR.js";
18
+ } from "./chunk-PMITBABE.js";
19
19
  import {
20
20
  SearchLedgerConflictError,
21
21
  SearchLedgerError,
@@ -51,14 +51,14 @@ import {
51
51
  mapConcurrent,
52
52
  policyEditsFromFindings,
53
53
  validatePolicyEditCandidateRecord
54
- } from "./chunk-EEHHBAWH.js";
54
+ } from "./chunk-DT7OXY3C.js";
55
55
  import {
56
56
  callLlm,
57
57
  callLlmJson,
58
58
  costReceiptFromLlm,
59
59
  costReceiptFromLlmError,
60
60
  maximumChargeForLlmRequest
61
- } from "./chunk-PDHIOKRE.js";
61
+ } from "./chunk-EQUK3RFS.js";
62
62
  import {
63
63
  eProcess,
64
64
  mcnemar,
@@ -4106,7 +4106,8 @@ function skillOptProposer(opts) {
4106
4106
  ],
4107
4107
  jsonMode: true,
4108
4108
  temperature: opts.temperature ?? 0.6,
4109
- maxTokens: opts.maxTokens ?? 4e3
4109
+ maxTokens: opts.maxTokens ?? 4e3,
4110
+ thinking: opts.thinking
4110
4111
  };
4111
4112
  const paid = await (args.costLedger ?? directCostLedger).runPaidCall({
4112
4113
  channel: "driver",
@@ -6328,7 +6329,7 @@ var POLICY_EDIT_AUTHOR_JSON_SCHEMA = {
6328
6329
  }
6329
6330
  }
6330
6331
  };
6331
- function policyEditAuthorJsonSchema(maxItems, allowedJsonPaths) {
6332
+ function policyEditAuthorJsonSchema(maxItems, allowedJsonPaths, valueSchemaByJsonPath) {
6332
6333
  const schema = JSON.parse(JSON.stringify(POLICY_EDIT_AUTHOR_JSON_SCHEMA));
6333
6334
  const properties = schema.properties;
6334
6335
  const edits = properties.edits;
@@ -6338,8 +6339,32 @@ function policyEditAuthorJsonSchema(maxItems, allowedJsonPaths) {
6338
6339
  const target = itemProperties.target;
6339
6340
  const targetProperties = target.properties;
6340
6341
  targetProperties.path = { type: "string", enum: [...allowedJsonPaths] };
6342
+ if (valueSchemaByJsonPath) {
6343
+ edits.items = {
6344
+ anyOf: allowedJsonPaths.map(
6345
+ (path) => policyEditAuthorItemJsonSchema(item, path, valueSchemaByJsonPath.get(path))
6346
+ )
6347
+ };
6348
+ }
6341
6349
  return schema;
6342
6350
  }
6351
+ function policyEditAuthorItemJsonSchema(item, path, valueSchema) {
6352
+ const branch = structuredClone(item);
6353
+ const properties = branch.properties;
6354
+ const target = properties.target;
6355
+ const targetProperties = target.properties;
6356
+ targetProperties.path = { const: path };
6357
+ const change = properties.change;
6358
+ const changeBranches = change.anyOf;
6359
+ for (const changeBranch of changeBranches) {
6360
+ const changeProperties = changeBranch.properties;
6361
+ const mode = changeProperties.mode;
6362
+ if (mode.const !== "remove") {
6363
+ changeProperties.value = structuredClone(valueSchema);
6364
+ }
6365
+ }
6366
+ return branch;
6367
+ }
6343
6368
  var DEFAULT_POLICY_EDIT_HISTORY_LIMITS = Object.freeze({
6344
6369
  generations: 4,
6345
6370
  candidatesPerGeneration: 16,
@@ -6369,6 +6394,7 @@ function policyEditAuthorSystem(responseSchema) {
6369
6394
  function llmPolicyEditProposer(opts) {
6370
6395
  const allowedJsonPaths = validateAllowedJsonPaths(opts.allowedJsonPaths);
6371
6396
  const allowedPathSet = new Set(allowedJsonPaths);
6397
+ const pathValueSchemas = validatePathValueSchemas(opts.valueSchemaByJsonPath, allowedJsonPaths);
6372
6398
  const objectives = validateObjectives(opts.objectives);
6373
6399
  const objectiveByKey = new Map(objectives.map((objective) => [objective.key, objective]));
6374
6400
  requireNonEmpty(opts.model, "model");
@@ -6463,7 +6489,11 @@ function llmPolicyEditProposer(opts) {
6463
6489
  objectiveByKey
6464
6490
  )
6465
6491
  };
6466
- const responseSchema = policyEditAuthorJsonSchema(limit, allowedJsonPaths);
6492
+ const responseSchema = policyEditAuthorJsonSchema(
6493
+ limit,
6494
+ allowedJsonPaths,
6495
+ pathValueSchemas?.schemas
6496
+ );
6467
6497
  const system = policyEditAuthorSystem(responseSchema);
6468
6498
  assertPolicyEditAuthorContextBudget(
6469
6499
  { system, authorContext, responseSchema },
@@ -6482,6 +6512,7 @@ function llmPolicyEditProposer(opts) {
6482
6512
  },
6483
6513
  temperature: opts.temperature ?? 0.2,
6484
6514
  maxTokens: opts.maxTokens ?? 6e3,
6515
+ thinking: opts.thinking,
6485
6516
  timeoutMs: opts.timeoutMs
6486
6517
  };
6487
6518
  const paid = await (ctx.costLedger ?? directCostLedger).runPaidCall({
@@ -6515,6 +6546,7 @@ function llmPolicyEditProposer(opts) {
6515
6546
  findingByKey,
6516
6547
  opts.targetSurface,
6517
6548
  allowedPathSet,
6549
+ pathValueSchemas?.validators,
6518
6550
  objectives[0],
6519
6551
  ctx.incumbentOutcome?.composite ?? ctx.baselineOutcome?.composite
6520
6552
  )
@@ -6961,12 +6993,23 @@ function parseAuthorResponse(value) {
6961
6993
  const issues = parsed.error.issues.map((issue) => `${issue.path.join(".") || "<root>"}: ${issue.message}`).join("; ");
6962
6994
  throw new Error(`llmPolicyEditProposer: invalid PolicyEdit response: ${issues}`);
6963
6995
  }
6964
- function bindAuthoredEdit(draft, findingByKey, targetSurface, allowedPaths, objective, currentComposite) {
6996
+ function bindAuthoredEdit(draft, findingByKey, targetSurface, allowedPaths, valueValidatorByJsonPath, objective, currentComposite) {
6965
6997
  if (!allowedPaths.has(draft.target.path)) {
6966
6998
  throw new Error(
6967
6999
  `llmPolicyEditProposer: JSON path '${draft.target.path}' is outside allowedJsonPaths`
6968
7000
  );
6969
7001
  }
7002
+ if (draft.change.mode !== "remove") {
7003
+ const valueValidator = valueValidatorByJsonPath?.get(draft.target.path);
7004
+ if (valueValidator) {
7005
+ const parsedValue = valueValidator.safeParse(draft.change.value);
7006
+ if (!parsedValue.success) {
7007
+ throw new Error(
7008
+ `llmPolicyEditProposer: change.value for JSON path '${draft.target.path}' does not match valueSchemaByJsonPath (${formatJsonValidationError(parsedValue.error)})`
7009
+ );
7010
+ }
7011
+ }
7012
+ }
6970
7013
  const cited = draft.source.findingKeys.map((findingKey) => {
6971
7014
  const finding = findingByKey.get(findingKey);
6972
7015
  if (!finding) {
@@ -7219,6 +7262,44 @@ function validateAllowedJsonPaths(paths) {
7219
7262
  }
7220
7263
  return [...paths];
7221
7264
  }
7265
+ function validatePathValueSchemas(input, allowedJsonPaths) {
7266
+ if (input === void 0) return void 0;
7267
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
7268
+ throw new Error("llmPolicyEditProposer: valueSchemaByJsonPath must be a JSON object");
7269
+ }
7270
+ const allowed = new Set(allowedJsonPaths);
7271
+ const suppliedPaths = Object.keys(input);
7272
+ const missing = allowedJsonPaths.filter((path) => !Object.hasOwn(input, path));
7273
+ const unexpected = suppliedPaths.filter((path) => !allowed.has(path));
7274
+ if (missing.length > 0 || unexpected.length > 0) {
7275
+ throw new Error(
7276
+ `llmPolicyEditProposer: valueSchemaByJsonPath keys must exactly match allowedJsonPaths (missing: ${missing.join(", ") || "none"}; unexpected: ${unexpected.join(", ") || "none"})`
7277
+ );
7278
+ }
7279
+ const schemas = /* @__PURE__ */ new Map();
7280
+ const validators = /* @__PURE__ */ new Map();
7281
+ for (const path of allowedJsonPaths) {
7282
+ const parsed = JsonValueSchema.safeParse(input[path]);
7283
+ if (!parsed.success || !parsed.data || typeof parsed.data !== "object" || Array.isArray(parsed.data)) {
7284
+ const detail = parsed.success ? "expected a JSON object" : formatJsonValidationError(parsed.error);
7285
+ throw new Error(
7286
+ `llmPolicyEditProposer: valueSchemaByJsonPath['${path}'] must be a valid JSON Schema object (${detail})`
7287
+ );
7288
+ }
7289
+ const schema = parsed.data;
7290
+ let validator;
7291
+ try {
7292
+ validator = z.fromJSONSchema(schema);
7293
+ } catch (error) {
7294
+ throw new Error(
7295
+ `llmPolicyEditProposer: valueSchemaByJsonPath['${path}'] is unsupported (${error instanceof Error ? error.message : String(error)})`
7296
+ );
7297
+ }
7298
+ schemas.set(path, schema);
7299
+ validators.set(path, validator);
7300
+ }
7301
+ return { schemas, validators };
7302
+ }
7222
7303
  function requireNonEmpty(value, field) {
7223
7304
  if (!value || value.trim() !== value) {
7224
7305
  throw new Error(`llmPolicyEditProposer: ${field} must be a trimmed non-empty string`);
@@ -9185,4 +9266,4 @@ export {
9185
9266
  verifyCodeSurface,
9186
9267
  resolveWorktreePath
9187
9268
  };
9188
- //# sourceMappingURL=chunk-ZU3QWGZE.js.map
9269
+ //# sourceMappingURL=chunk-A62YMFWA.js.map