@tangle-network/agent-eval 0.112.0 → 0.114.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 (60) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/belief-state/index.js +1 -1
  3. package/dist/benchmarks/index.d.ts +2 -2
  4. package/dist/benchmarks/index.js +6 -6
  5. package/dist/builder-eval/index.js +1 -1
  6. package/dist/campaign/index.d.ts +55 -22
  7. package/dist/campaign/index.js +13 -7
  8. package/dist/{chunk-VLNGPUJJ.js → chunk-3LXTCTWL.js} +2 -2
  9. package/dist/{chunk-7QPK6W7R.js → chunk-ARU2PZFM.js} +2 -2
  10. package/dist/{chunk-EMKORATZ.js → chunk-DPZAEKA6.js} +2 -2
  11. package/dist/{chunk-XNCF3JU3.js → chunk-FAOEFFRT.js} +2 -2
  12. package/dist/{chunk-WZOIFFG2.js → chunk-LOBMT6SB.js} +2 -2
  13. package/dist/{chunk-RT2AFUXM.js → chunk-MOXWMGPC.js} +2 -2
  14. package/dist/{chunk-RCXMWGRY.js → chunk-N6MTC3GK.js} +69 -25
  15. package/dist/chunk-N6MTC3GK.js.map +1 -0
  16. package/dist/{chunk-YWGKQARF.js → chunk-NYFUT3B3.js} +2 -2
  17. package/dist/{chunk-VC43KQCK.js → chunk-PJQFMIOX.js} +62 -9
  18. package/dist/chunk-PJQFMIOX.js.map +1 -0
  19. package/dist/{chunk-QQVYMBCZ.js → chunk-VHPD6AXX.js} +512 -21
  20. package/dist/{chunk-QQVYMBCZ.js.map → chunk-VHPD6AXX.js.map} +1 -1
  21. package/dist/{chunk-BOLYPSAE.js → chunk-WBOGKYM4.js} +4 -4
  22. package/dist/{chunk-3LDPUYAC.js → chunk-X4UCIOTZ.js} +2 -2
  23. package/dist/contract/index.d.ts +7 -7
  24. package/dist/contract/index.js +9 -8
  25. package/dist/contract/index.js.map +1 -1
  26. package/dist/{gepa-T8T215nw.d.ts → gepa-DolL_Fko.d.ts} +2 -6
  27. package/dist/hosted/index.d.ts +1 -1
  28. package/dist/{index-Dc3VLGhp.d.ts → index-CWr5SIG-.d.ts} +1 -1
  29. package/dist/index.d.ts +8 -8
  30. package/dist/index.js +13 -11
  31. package/dist/index.js.map +1 -1
  32. package/dist/meta-eval/index.d.ts +1 -1
  33. package/dist/meta-eval/index.js +2 -2
  34. package/dist/multishot/index.d.ts +1 -1
  35. package/dist/openapi.json +1 -1
  36. package/dist/pipelines/index.js +2 -2
  37. package/dist/{pre-registration-BepVVa6P.d.ts → pre-registration-CTQbZbpX.d.ts} +1 -1
  38. package/dist/{provenance-KhY8ESVM.d.ts → provenance-BZmpWmn4.d.ts} +5 -11
  39. package/dist/reporting.d.ts +1 -1
  40. package/dist/reporting.js +4 -4
  41. package/dist/rl.d.ts +1 -1
  42. package/dist/rl.js +5 -5
  43. package/dist/{run-campaign-HJQEDCJQ.js → run-campaign-UADIM77S.js} +3 -3
  44. package/dist/{statistics-CDfpwIdX.d.ts → statistics-oUbOJe-S.d.ts} +34 -1
  45. package/dist/{types-v--ctu-b.d.ts → types-CgSlO6wT.d.ts} +26 -11
  46. package/docs/design/loop-taxonomy.md +7 -1
  47. package/docs/improvement-glossary.md +1 -1
  48. package/package.json +1 -1
  49. package/dist/chunk-RCXMWGRY.js.map +0 -1
  50. package/dist/chunk-VC43KQCK.js.map +0 -1
  51. /package/dist/{chunk-VLNGPUJJ.js.map → chunk-3LXTCTWL.js.map} +0 -0
  52. /package/dist/{chunk-7QPK6W7R.js.map → chunk-ARU2PZFM.js.map} +0 -0
  53. /package/dist/{chunk-EMKORATZ.js.map → chunk-DPZAEKA6.js.map} +0 -0
  54. /package/dist/{chunk-XNCF3JU3.js.map → chunk-FAOEFFRT.js.map} +0 -0
  55. /package/dist/{chunk-WZOIFFG2.js.map → chunk-LOBMT6SB.js.map} +0 -0
  56. /package/dist/{chunk-RT2AFUXM.js.map → chunk-MOXWMGPC.js.map} +0 -0
  57. /package/dist/{chunk-YWGKQARF.js.map → chunk-NYFUT3B3.js.map} +0 -0
  58. /package/dist/{chunk-BOLYPSAE.js.map → chunk-WBOGKYM4.js.map} +0 -0
  59. /package/dist/{chunk-3LDPUYAC.js.map → chunk-X4UCIOTZ.js.map} +0 -0
  60. /package/dist/{run-campaign-HJQEDCJQ.js.map → run-campaign-UADIM77S.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,40 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
4
4
 
5
5
  ---
6
6
 
7
+ ## [0.114.0] — 2026-07-11 — exact directional paired inference
8
+
9
+ ### Added
10
+
11
+ - `pairedSignTest(differences, alternative)` computes an exact one-sided sign test for paired numeric differences, excludes zero ties, requires a predeclared `greater` or `less` direction, and reports every denominator.
12
+
13
+ ### Changed
14
+
15
+ - McNemar's exact two-sided calculation now reuses the same log-space binomial-tail implementation without changing its public result contract.
16
+
17
+ This release is additive.
18
+ Existing consumers do not need to update unless they want the new statistic.
19
+
20
+ ## [0.113.0] — 2026-07-10 — immutable code candidates
21
+
22
+ ### Changed
23
+
24
+ - `CodeSurface` is now a finalized, content-addressed code candidate.
25
+ `gitWorktreeAdapter.finalize()` records exact base/candidate commits, the final tree, and the SHA-256 + byte length of the raw binary Git patch; `surfaceHash` and `surfaceContentHash` no longer use filesystem paths.
26
+ Binary-patch generation runs against an isolated bare repository with fixed diff options, config, attributes, compression, and locale, so ambient repository, global, system, or environment settings cannot change the digest for identical trees.
27
+ - `LoopProvenanceRecord.schema` is now `tangle.loop-provenance.v2`, distinguishing records that use content-addressed code-surface hashes from v1 records whose code hashes included mutable paths.
28
+ - `resolveWorktreePath()` now verifies the candidate before returning its checkout.
29
+ Dirty or ignored files, moved refs, missing objects, wrong trees, raw byte or executable-mode mismatches, external symlinks, submodules, and patch-byte mismatches fail instead of being evaluated under stale identity.
30
+ Raw file hashing bypasses Git clean/smudge filters so repository configuration cannot hide different executable bytes.
31
+ Use `verifyCodeSurface()` when a verification receipt is needed directly.
32
+
33
+ ### Breaking
34
+
35
+ - `resolveWorktreePath()` no longer returns a best-effort, unchecked locator: it verifies the finalized candidate and throws on any identity mismatch.
36
+ There is intentionally no lenient fallback on the evaluation path.
37
+ - Path-only `CodeSurface` objects are invalid.
38
+ Every field in the finalized identity is required.
39
+ Downstream callers must migrate to adapter-finalized candidates when adopting 0.113.0.
40
+
7
41
  ## [0.112.0] — 2026-07-10 — complete agent-surface findings
8
42
 
9
43
  ### Added
@@ -17,7 +17,7 @@ import {
17
17
  } from "../chunk-DTJ6QUQB.js";
18
18
  import {
19
19
  confidenceInterval
20
- } from "../chunk-VC43KQCK.js";
20
+ } from "../chunk-PJQFMIOX.js";
21
21
  import {
22
22
  ValidationError
23
23
  } from "../chunk-ONWEPEDO.js";
@@ -1,5 +1,5 @@
1
- export { B as BENCHMARK_SPLIT_SEED, a as BenchmarkAdapter, b as BenchmarkDatasetItem, k as BenchmarkDistribution, c as BenchmarkEvaluation, d as BenchmarkFamily, l as BenchmarkMetricCalibrationOptions, m as BenchmarkMetricCalibrationResult, n as BenchmarkReport, e as BenchmarkResponder, o as BenchmarkRunOptions, p as BenchmarkRunResult, f as BenchmarkScenario, q as BenchmarkSliceSummary, g as BenchmarkSource, h as BenchmarkTaskKind, r as BuildStandardRetrievalItemsOptions, R as RetrievalIdAdapterOptions, S as StandardRetrievalArtifact, s as StandardRetrievalDocument, t as StandardRetrievalEvaluationOptions, u as StandardRetrievalPayload, v as StandardRetrievalQrel, w as StandardRetrievalQuery, x as StandardRetrievalResult, y as buildStandardRetrievalItems, z as calibrateBenchmarkMetric, A as createRetrievalIdBenchmarkAdapter, i as deterministicSplit, C as evaluateStandardRetrieval, D as normalizeRetrievedDocumentIds, E as parseBeirCorpusJsonl, F as parseBeirQueriesJsonl, G as parseJsonlRows, H as parseQrels, I as parseTsvRows, J as renderBenchmarkReportMarkdown, K as retrievalMetricsAtCutoff, L as routing, M as runBenchmarkAdapter, N as summarizeBenchmarkCampaign } from '../index-Dc3VLGhp.js';
2
- import '../types-v--ctu-b.js';
1
+ export { B as BENCHMARK_SPLIT_SEED, a as BenchmarkAdapter, b as BenchmarkDatasetItem, k as BenchmarkDistribution, c as BenchmarkEvaluation, d as BenchmarkFamily, l as BenchmarkMetricCalibrationOptions, m as BenchmarkMetricCalibrationResult, n as BenchmarkReport, e as BenchmarkResponder, o as BenchmarkRunOptions, p as BenchmarkRunResult, f as BenchmarkScenario, q as BenchmarkSliceSummary, g as BenchmarkSource, h as BenchmarkTaskKind, r as BuildStandardRetrievalItemsOptions, R as RetrievalIdAdapterOptions, S as StandardRetrievalArtifact, s as StandardRetrievalDocument, t as StandardRetrievalEvaluationOptions, u as StandardRetrievalPayload, v as StandardRetrievalQrel, w as StandardRetrievalQuery, x as StandardRetrievalResult, y as buildStandardRetrievalItems, z as calibrateBenchmarkMetric, A as createRetrievalIdBenchmarkAdapter, i as deterministicSplit, C as evaluateStandardRetrieval, D as normalizeRetrievedDocumentIds, E as parseBeirCorpusJsonl, F as parseBeirQueriesJsonl, G as parseJsonlRows, H as parseQrels, I as parseTsvRows, J as renderBenchmarkReportMarkdown, K as retrievalMetricsAtCutoff, L as routing, M as runBenchmarkAdapter, N as summarizeBenchmarkCampaign } from '../index-CWr5SIG-.js';
2
+ import '../types-CgSlO6wT.js';
3
3
  import '../run-record-DksGsfgv.js';
4
4
  import '@tangle-network/agent-interface';
5
5
  import '../errors-oeQrLqXC.js';
@@ -16,15 +16,15 @@ import {
16
16
  routing_exports,
17
17
  runBenchmarkAdapter,
18
18
  summarizeBenchmarkCampaign
19
- } from "../chunk-VLNGPUJJ.js";
20
- import "../chunk-QQVYMBCZ.js";
21
- import "../chunk-RCXMWGRY.js";
19
+ } from "../chunk-3LXTCTWL.js";
20
+ import "../chunk-VHPD6AXX.js";
21
+ import "../chunk-N6MTC3GK.js";
22
22
  import "../chunk-VI2UW6B6.js";
23
- import "../chunk-XNCF3JU3.js";
23
+ import "../chunk-FAOEFFRT.js";
24
24
  import "../chunk-HJWNHCD5.js";
25
25
  import "../chunk-DWLIGZBX.js";
26
- import "../chunk-7QPK6W7R.js";
27
- import "../chunk-VC43KQCK.js";
26
+ import "../chunk-ARU2PZFM.js";
27
+ import "../chunk-PJQFMIOX.js";
28
28
  import "../chunk-RPDDVKI7.js";
29
29
  import "../chunk-GGE4NNQT.js";
30
30
  import "../chunk-LNQEP766.js";
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  pearsonR,
7
7
  spearmanR
8
- } from "../chunk-VC43KQCK.js";
8
+ } from "../chunk-PJQFMIOX.js";
9
9
  import {
10
10
  judgeSpans
11
11
  } from "../chunk-MHNQWM4I.js";
@@ -1,14 +1,14 @@
1
- import { S as SignedManifest, B as BackendIntegrityReport, C as CompletionRequirement, R as RuntimeEventLike, a as CompletionVerdict, P as ProducedState, b as CorrectnessChecker } from '../pre-registration-BepVVa6P.js';
2
- export { L as LlmJudgeDimension, c as LlmJudgeOptions, l as llmJudge } from '../pre-registration-BepVVa6P.js';
1
+ import { S as SignedManifest, B as BackendIntegrityReport, C as CompletionRequirement, R as RuntimeEventLike, a as CompletionVerdict, P as ProducedState, b as CorrectnessChecker } from '../pre-registration-CTQbZbpX.js';
2
+ export { L as LlmJudgeDimension, c as LlmJudgeOptions, l as llmJudge } from '../pre-registration-CTQbZbpX.js';
3
3
  import { A as AnalyzeTracesOptions, a as AnalyzeTracesInput, b as AnalyzeTracesResult } from '../analyst-C8HHvfJp.js';
4
- import { S as Scenario, M as MutableSurface, D as DispatchContext, b as JudgeConfig, g as Gate, e as GenerationRecord, J as JudgeScore, L as LabeledScenarioStore, s as LabeledScenarioWrite, t as LabeledScenarioSampleArgs, u as LabeledScenarioRecord, v as LabelTrust, f as SurfaceProposer, w as ProposedCandidate, x as ProposeContext, y as LabeledScenarioSource, C as CampaignResult, m as CodeSurface } from '../types-v--ctu-b.js';
5
- export { i as CampaignAggregates, j as CampaignArtifactWriter, k as CampaignCellResult, l as CampaignCostMeter, z as CampaignTokenUsage, d as CampaignTraceWriter, c as DispatchFn, n as GateContext, h as GateDecision, G as GateResult, o as GenerationCandidate, A as JudgeAggregate, a as JudgeDimension, p as Mutator, O as OptimizationProposer, q as OptimizerConfig, P as ParetoParent, R as RedactionStatus, B as ScenarioAggregate, r as SessionScript, T as TraceSpan, E as isProposedCandidate, F as labelTrustRank } from '../types-v--ctu-b.js';
6
- import { C as CampaignRunPlan, P as PlanCampaignRunOptions, b as RunCampaignOptions, c as RunImprovementLoopOptions } from '../gepa-T8T215nw.js';
7
- export { f as CampaignRunPlanCell, h as GepaProposerConstraints, G as GepaProposerOptions, O as OpenAutoPrOptions, i as OpenAutoPrResult, a as RunImprovementLoopResult, R as RunOptimizationOptions, j as RunOptimizationResult, k as countSentenceEdits, l as defaultRenderDiff, m as extractH2Sections, g as gepaProposer, o as openAutoPr, p as planCampaignRun, r as runCampaign, d as runImprovementLoop, n as runOptimization, s as surfaceHash } from '../gepa-T8T215nw.js';
4
+ import { S as Scenario, M as MutableSurface, D as DispatchContext, b as JudgeConfig, g as Gate, e as GenerationRecord, J as JudgeScore, L as LabeledScenarioStore, s as LabeledScenarioWrite, t as LabeledScenarioSampleArgs, u as LabeledScenarioRecord, v as LabelTrust, f as SurfaceProposer, w as ProposedCandidate, x as ProposeContext, m as CodeSurface, y as LabeledScenarioSource, C as CampaignResult } from '../types-CgSlO6wT.js';
5
+ export { i as CampaignAggregates, j as CampaignArtifactWriter, k as CampaignCellResult, l as CampaignCostMeter, z as CampaignTokenUsage, d as CampaignTraceWriter, c as DispatchFn, n as GateContext, h as GateDecision, G as GateResult, o as GenerationCandidate, A as JudgeAggregate, a as JudgeDimension, p as Mutator, O as OptimizationProposer, q as OptimizerConfig, P as ParetoParent, R as RedactionStatus, B as ScenarioAggregate, r as SessionScript, T as TraceSpan, E as isProposedCandidate, F as labelTrustRank } from '../types-CgSlO6wT.js';
6
+ import { C as CampaignRunPlan, P as PlanCampaignRunOptions, b as RunCampaignOptions, c as RunImprovementLoopOptions } from '../gepa-DolL_Fko.js';
7
+ export { f as CampaignRunPlanCell, h as GepaProposerConstraints, G as GepaProposerOptions, O as OpenAutoPrOptions, i as OpenAutoPrResult, a as RunImprovementLoopResult, R as RunOptimizationOptions, j as RunOptimizationResult, k as countSentenceEdits, l as defaultRenderDiff, m as extractH2Sections, g as gepaProposer, o as openAutoPr, p as planCampaignRun, r as runCampaign, d as runImprovementLoop, n as runOptimization } from '../gepa-DolL_Fko.js';
8
8
  import { C as CampaignStorage } from '../storage-Dw_f7WMt.js';
9
9
  export { f as fsCampaignStorage, i as inMemoryCampaignStorage } from '../storage-Dw_f7WMt.js';
10
- export { A as AxisEvidence, a as AxisVerdict, B as BuildEvidenceVectorOptions, l as BuildLoopProvenanceArgs, D as DefaultProductionGateOptions, m as EmitLoopProvenanceArgs, n as EmitLoopProvenanceResult, E as EvidenceVector, b as EvolutionaryProposerOptions, H as HeldOutGateOptions, o as LoopProvenanceBackend, q as LoopProvenanceCandidate, L as LoopProvenanceRecord, O as ObjectiveSource, c as ParetoSignificanceGateOptions, P as PowerPreflight, s as PowerPreflightOptions, d as PromotionObjective, e as PromotionPolicy, R as RunEvalOptions, f as buildEvidenceVector, t as buildLoopProvenanceRecord, g as composeGate, h as defaultProductionGate, u as emitLoopProvenance, i as evolutionaryProposer, j as heldOutGate, v as loopProvenanceSpans, p as paretoPolicy, k as paretoSignificanceGate, w as powerPreflight, x as provenanceRecordPath, y as provenanceSpansPath, r as runEval, z as surfaceContentHash } from '../provenance-KhY8ESVM.js';
11
- import { E as EProcessState, a as PairedBootstrapResult } from '../statistics-CDfpwIdX.js';
10
+ export { A as AxisEvidence, a as AxisVerdict, B as BuildEvidenceVectorOptions, l as BuildLoopProvenanceArgs, D as DefaultProductionGateOptions, m as EmitLoopProvenanceArgs, n as EmitLoopProvenanceResult, E as EvidenceVector, b as EvolutionaryProposerOptions, H as HeldOutGateOptions, o as LoopProvenanceBackend, q as LoopProvenanceCandidate, L as LoopProvenanceRecord, O as ObjectiveSource, c as ParetoSignificanceGateOptions, P as PowerPreflight, s as PowerPreflightOptions, d as PromotionObjective, e as PromotionPolicy, R as RunEvalOptions, f as buildEvidenceVector, t as buildLoopProvenanceRecord, g as composeGate, h as defaultProductionGate, u as emitLoopProvenance, i as evolutionaryProposer, j as heldOutGate, v as loopProvenanceSpans, p as paretoPolicy, k as paretoSignificanceGate, w as powerPreflight, x as provenanceRecordPath, y as provenanceSpansPath, r as runEval } from '../provenance-BZmpWmn4.js';
11
+ import { E as EProcessState, a as PairedBootstrapResult } from '../statistics-oUbOJe-S.js';
12
12
  import { L as LlmClientOptions } from '../llm-client-DyqEH4jH.js';
13
13
  import { AgentProfile } from '@tangle-network/agent-interface';
14
14
  import { A as AgentEvalError } from '../errors-oeQrLqXC.js';
@@ -1013,6 +1013,17 @@ interface ParameterSweepProposerOptions {
1013
1013
  /** Config/parameter-level proposer for FAPO's middle escalation level. */
1014
1014
  declare function parameterSweepProposer(opts: ParameterSweepProposerOptions): SurfaceProposer;
1015
1015
 
1016
+ /** Fail when a code surface does not carry a complete immutable identity. */
1017
+ declare function assertCodeSurfaceIdentity(surface: unknown): asserts surface is CodeSurface;
1018
+ /** Canonical, location-independent identity of a finalized code candidate.
1019
+ * Commit metadata is excluded: two commits with the same base, final tree,
1020
+ * and patch bytes are the same executable candidate. */
1021
+ declare function codeSurfaceIdentityMaterial(surface: CodeSurface): string;
1022
+ /** Full SHA-256 content identity for a prompt or finalized code surface. */
1023
+ declare function surfaceContentHash(surface: MutableSurface): `sha256:${string}`;
1024
+ /** Short loop key derived from the same content identity as provenance. */
1025
+ declare function surfaceHash(surface: MutableSurface): string;
1026
+
1016
1027
  /**
1017
1028
  * `compareProposers` — a head-to-head lift benchmark across surface proposers
1018
1029
  * on ONE corpus. This is the forcing function: optimizer quality (GEPA
@@ -2208,21 +2219,28 @@ declare function isTransientTransportFailure(message: string | null | undefined,
2208
2219
  * VCS-pluggable worktree adapter. One improvement = one worktree, PR-like
2209
2220
  * (multiple commits allowed). A code-tier proposer's `propose()` creates a
2210
2221
  * worktree, an agent commits the change into it, and `finalize()` returns a
2211
- * `CodeSurface{ worktreeRef }` the measurement checks out to run the worker
2212
- * against the changed code. On promotion the worktree becomes the PR branch.
2222
+ * content-addressed `CodeSurface` the measurement verifies before running.
2223
+ * On promotion the worktree becomes the PR branch.
2213
2224
  *
2214
2225
  * The interface is VCS-agnostic so a future `jj` ([jj-vcs](https://github.com/jj-vcs/jj))
2215
2226
  * adapter can slot in without touching proposer code. Only the git adapter
2216
2227
  * ships today. See `docs/design/loop-taxonomy.md`.
2217
2228
  */
2218
2229
 
2230
+ type GitOutput = string | Uint8Array;
2231
+ type GitEnvironment = Readonly<Record<string, string>>;
2232
+ type GitRunner = (args: string[], cwd: string, env?: GitEnvironment) => GitOutput;
2219
2233
  interface Worktree {
2220
2234
  /** Absolute path to the checked-out worktree directory. */
2221
- path: string;
2235
+ readonly path: string;
2222
2236
  /** The branch the worktree is on (becomes the PR branch on promotion). */
2223
- branch: string;
2237
+ readonly branch: string;
2224
2238
  /** The ref the worktree was forked from. */
2225
- baseRef: string;
2239
+ readonly baseRef: string;
2240
+ /** Exact commit `baseRef` resolved to before the worktree was created. */
2241
+ readonly baseCommit: string;
2242
+ /** Exact tree object for `baseCommit`. */
2243
+ readonly baseTree: string;
2226
2244
  }
2227
2245
  interface WorktreeAdapter {
2228
2246
  /** Create an isolated worktree on a fresh branch off `baseRef`. */
@@ -2230,9 +2248,8 @@ interface WorktreeAdapter {
2230
2248
  baseRef: string;
2231
2249
  label: string;
2232
2250
  }): Promise<Worktree>;
2233
- /** Commit any pending changes in the worktree, then return a CodeSurface
2234
- * pointing at it. The agent has already written its change into
2235
- * `worktree.path` by the time this is called. */
2251
+ /** Commit pending changes, freeze the exact Git objects + binary patch, and
2252
+ * verify the worktree still matches that identity. */
2236
2253
  finalize(worktree: Worktree, summary: string): Promise<CodeSurface>;
2237
2254
  /** Remove the worktree (and its branch) — called for losing candidates. */
2238
2255
  discard(worktree: Worktree): Promise<void>;
@@ -2249,16 +2266,32 @@ interface GitWorktreeAdapterOptions {
2249
2266
  worktreeDir?: string;
2250
2267
  /** Branch-name prefix. Default: `improve`. */
2251
2268
  branchPrefix?: string;
2252
- /** Test seam — defaults to a real `git` runner. */
2253
- git?: (args: string[], cwd: string) => string;
2269
+ /** Test seam — defaults to a real `git` runner. The return value must contain
2270
+ * stdout verbatim, and runners that execute Git must forward the optional
2271
+ * environment overrides used to isolate patch generation. */
2272
+ git?: GitRunner;
2273
+ }
2274
+ interface CodeSurfaceVerification {
2275
+ /** Verified worktree path. */
2276
+ path: string;
2277
+ /** Git's canonical root for the verified checkout. */
2278
+ repoRoot: string;
2279
+ /** Recomputed full content identity. */
2280
+ contentHash: `sha256:${string}`;
2281
+ /** Exact verified binary-patch bytes. Candidate-bundle builders encode this
2282
+ * directly instead of reproducing Git diff options. */
2283
+ patchBytes: Uint8Array;
2254
2284
  }
2255
2285
  /**
2256
2286
  * Git-backed `WorktreeAdapter`: creates isolated worktrees on fresh branches, commits agent changes, and discards losers.
2257
2287
  */
2258
2288
  declare function gitWorktreeAdapter(opts: GitWorktreeAdapterOptions): WorktreeAdapter;
2259
- /** Resolve a `CodeSurface`'s worktreeRef to a directory the measurement can
2260
- * run the worker in. A path ref is returned as-is; anything else is treated
2261
- * as a ref under the adapter's worktree dir. */
2289
+ /** Verify a finalized code surface against its current checkout. This rejects
2290
+ * dirty/ignored files, moved refs, missing Git objects, raw byte/mode
2291
+ * mismatches, external symlinks, and submodules. */
2292
+ declare function verifyCodeSurface(surface: CodeSurface, worktreeDir?: string): CodeSurfaceVerification;
2293
+ /** Resolve a code candidate for evaluation only after verifying its immutable
2294
+ * identity against the checkout at `worktreeRef`. */
2262
2295
  declare function resolveWorktreePath(surface: CodeSurface, worktreeDir?: string): string;
2263
2296
 
2264
- export { type AcceptedEdit, type AceProposerOptions, type AnalystArtifact, type AnalystScenario, type ApplySkillPatchResult, type BuildAnalystSurfaceDispatchOptions, type CampaignBreakdown, CampaignResult, CampaignRunPlan, CampaignStorage, CodeSurface, type CompareProposersOptions, type CompositeProposerOptions, type DimensionRegression, type DiscriminationScore, DispatchContext, type EvalFixture, type EvalFixtureFile, type EvalFixtureLoadOptions, type EvalFixtureRunPlan, type EvalFixtureScenario, type EvalFixtureValidationMode, type FailureModeRecallJudgeOptions, type FapoAttributionSignals, type FapoEntryConfig, type FapoFailureCluster, type FapoOptimizationLevel, type FapoProposerOptions, type FapoReviewInput, type FapoReviewIssue, type FapoReviewResult, type FapoScopeContract, FsLabeledScenarioStore, type FsLabeledScenarioStoreOptions, Gate, GenerationRecord, type GitWorktreeAdapterOptions, type Governor, type GovernorContext, type GovernorOp, type HaloProposerOptions, type HeldoutSignificance, type HeldoutSignificanceOptions, type HeuristicGovernorOptions, type JsonPrimitive, type JsonValue, JudgeConfig, JudgeScore, LabelTrust, LabeledScenarioRecord, LabeledScenarioSampleArgs, LabeledScenarioSource, LabeledScenarioStore, LabeledScenarioStoreError, LabeledScenarioWrite, Lineage, type LineageEdge, type LineageGraph, type LineageNode, type LineageNodeInput, type LineageStore, type LoadEvalFixtureScenariosOptions, type MemoryCurationProposerOptions, MutableSurface, type NeutralizationGateOptions, type OptimizerEntryConfig, type PairedHoldout, type ParameterCandidate, type ParameterChange, type ParameterSweepProposerOptions, PlanCampaignRunOptions, type PlanEvalFixtureRunOptions, type PlaybackContext, type PlaybackDriver, type PlaybackStep, type PolicyEditProposerOptions, type ProfileDispatchFn, ProfileMatrixError, type ProfileSummary, ProposeContext, type ProposePatchesArgs, ProposedCandidate, type ProposerComparison, type ProposerEntry, type ProposerPairwise, type ProposerScore, type RejectedEdit, type RolloutArgumentDiff, type RolloutArgumentDiffOptions, type RolloutCall, RunCampaignOptions, RunImprovementLoopOptions, type RunLineageLoopOptions, type RunLineageLoopResult, type RunLineageLoopSeed, type RunLineageOptions, type RunLineageResult, type RunLineageSeed, type RunLineageStepResult, type RunProfileMatrixOptions, type RunProfileMatrixResult, type RunSkillOptOptions, type RunSkillOptResult, Scenario, type ScenarioRollup, type ScenarioSignal, type ScoreboardRenderOptions, type ScoreboardRow, type ScoreboardSummary, type ScoredRollout, type SequentialDecideFn, type SequentialDecideOptions, type SequentialDecision, type SequentialObservation, type SequentialPairedGate, type SequentialPairedGateOptions, type SingleRunLock, type SingleRunLockOptions, type SkillOptEpochRecord, type SkillOptEvidence, type SkillOptProposer, type SkillOptProposerOptions, type SkillPatch, type SkillPatchOp, SkillPatchParseError, type SkillPatchRejection, SurfaceProposer, type SurfaceScore, type TraceAnalystProposerOptions, type TransientFailureOptions, type UngroundedLiteralReport, type UserStory, type UserStoryVerdict, type Worktree, type WorktreeAdapter, WorktreeAdapterError, aceProposer, acquireSingleRunLock, applySkillPatch, buildAnalystSurfaceDispatch, callbackGovernor, campaignBreakdown, campaignMeanComposite, classifyUngroundedLiterals, compareProposers, compositeProposer, detectScale, dimensionRegressions, discoverEvalFixtures, extractFapoAttributionSignals, failureModeRecallJudge, fapoEscalationEntry, fapoProposer, fsLineageStore, gepaParetoEntry, gepaReflectionEntry, gitWorktreeAdapter, haloProposer, heldoutSignificance, heuristicGovernor, isTransientTransportFailure, lineageNodeId, loadEvalFixture, loadEvalFixtureScenarios, makePlaybackDispatch, memLineageStore, memoryCurationProposer, neutralizationGate, neutralizeText, pairHoldout, parameterSweepProposer, parseSkillPatchResponse, patchEditCount, planEvalFixtureRun, policyEditProposer, renderScoreboardMarkdown, resolveRunDir, resolveWorktreePath, rolloutArgumentDiff, runLineage, runLineageLoop, runProfileMatrix, runSkillOpt, scoreDiscrimination, scoreUserStory, scoreboardSummary, selectDiscriminative, sequentialDecide, sequentialPairedGate, skillOptEntry, skillOptProposer, tangleTracesRoot, traceAnalystProposer, userStoryScoreboard };
2297
+ export { type AcceptedEdit, type AceProposerOptions, type AnalystArtifact, type AnalystScenario, type ApplySkillPatchResult, type BuildAnalystSurfaceDispatchOptions, type CampaignBreakdown, CampaignResult, CampaignRunPlan, CampaignStorage, CodeSurface, type CodeSurfaceVerification, type CompareProposersOptions, type CompositeProposerOptions, type DimensionRegression, type DiscriminationScore, DispatchContext, type EvalFixture, type EvalFixtureFile, type EvalFixtureLoadOptions, type EvalFixtureRunPlan, type EvalFixtureScenario, type EvalFixtureValidationMode, type FailureModeRecallJudgeOptions, type FapoAttributionSignals, type FapoEntryConfig, type FapoFailureCluster, type FapoOptimizationLevel, type FapoProposerOptions, type FapoReviewInput, type FapoReviewIssue, type FapoReviewResult, type FapoScopeContract, FsLabeledScenarioStore, type FsLabeledScenarioStoreOptions, Gate, GenerationRecord, type GitWorktreeAdapterOptions, type Governor, type GovernorContext, type GovernorOp, type HaloProposerOptions, type HeldoutSignificance, type HeldoutSignificanceOptions, type HeuristicGovernorOptions, type JsonPrimitive, type JsonValue, JudgeConfig, JudgeScore, LabelTrust, LabeledScenarioRecord, LabeledScenarioSampleArgs, LabeledScenarioSource, LabeledScenarioStore, LabeledScenarioStoreError, LabeledScenarioWrite, Lineage, type LineageEdge, type LineageGraph, type LineageNode, type LineageNodeInput, type LineageStore, type LoadEvalFixtureScenariosOptions, type MemoryCurationProposerOptions, MutableSurface, type NeutralizationGateOptions, type OptimizerEntryConfig, type PairedHoldout, type ParameterCandidate, type ParameterChange, type ParameterSweepProposerOptions, PlanCampaignRunOptions, type PlanEvalFixtureRunOptions, type PlaybackContext, type PlaybackDriver, type PlaybackStep, type PolicyEditProposerOptions, type ProfileDispatchFn, ProfileMatrixError, type ProfileSummary, ProposeContext, type ProposePatchesArgs, ProposedCandidate, type ProposerComparison, type ProposerEntry, type ProposerPairwise, type ProposerScore, type RejectedEdit, type RolloutArgumentDiff, type RolloutArgumentDiffOptions, type RolloutCall, RunCampaignOptions, RunImprovementLoopOptions, type RunLineageLoopOptions, type RunLineageLoopResult, type RunLineageLoopSeed, type RunLineageOptions, type RunLineageResult, type RunLineageSeed, type RunLineageStepResult, type RunProfileMatrixOptions, type RunProfileMatrixResult, type RunSkillOptOptions, type RunSkillOptResult, Scenario, type ScenarioRollup, type ScenarioSignal, type ScoreboardRenderOptions, type ScoreboardRow, type ScoreboardSummary, type ScoredRollout, type SequentialDecideFn, type SequentialDecideOptions, type SequentialDecision, type SequentialObservation, type SequentialPairedGate, type SequentialPairedGateOptions, type SingleRunLock, type SingleRunLockOptions, type SkillOptEpochRecord, type SkillOptEvidence, type SkillOptProposer, type SkillOptProposerOptions, type SkillPatch, type SkillPatchOp, SkillPatchParseError, type SkillPatchRejection, SurfaceProposer, type SurfaceScore, type TraceAnalystProposerOptions, type TransientFailureOptions, type UngroundedLiteralReport, type UserStory, type UserStoryVerdict, type Worktree, type WorktreeAdapter, WorktreeAdapterError, aceProposer, acquireSingleRunLock, applySkillPatch, assertCodeSurfaceIdentity, buildAnalystSurfaceDispatch, callbackGovernor, campaignBreakdown, campaignMeanComposite, classifyUngroundedLiterals, codeSurfaceIdentityMaterial, compareProposers, compositeProposer, detectScale, dimensionRegressions, discoverEvalFixtures, extractFapoAttributionSignals, failureModeRecallJudge, fapoEscalationEntry, fapoProposer, fsLineageStore, gepaParetoEntry, gepaReflectionEntry, gitWorktreeAdapter, haloProposer, heldoutSignificance, heuristicGovernor, isTransientTransportFailure, lineageNodeId, loadEvalFixture, loadEvalFixtureScenarios, makePlaybackDispatch, memLineageStore, memoryCurationProposer, neutralizationGate, neutralizeText, pairHoldout, parameterSweepProposer, parseSkillPatchResponse, patchEditCount, planEvalFixtureRun, policyEditProposer, renderScoreboardMarkdown, resolveRunDir, resolveWorktreePath, rolloutArgumentDiff, runLineage, runLineageLoop, runProfileMatrix, runSkillOpt, scoreDiscrimination, scoreUserStory, scoreboardSummary, selectDiscriminative, sequentialDecide, sequentialPairedGate, skillOptEntry, skillOptProposer, surfaceContentHash, surfaceHash, tangleTracesRoot, traceAnalystProposer, userStoryScoreboard, verifyCodeSurface };
@@ -55,13 +55,16 @@ import {
55
55
  skillOptEntry,
56
56
  skillOptProposer,
57
57
  traceAnalystProposer,
58
- userStoryScoreboard
59
- } from "../chunk-QQVYMBCZ.js";
58
+ userStoryScoreboard,
59
+ verifyCodeSurface
60
+ } from "../chunk-VHPD6AXX.js";
60
61
  import {
62
+ assertCodeSurfaceIdentity,
61
63
  buildEvidenceVector,
62
64
  buildLoopProvenanceRecord,
63
65
  campaignBreakdown,
64
66
  campaignMeanComposite,
67
+ codeSurfaceIdentityMaterial,
65
68
  composeGate,
66
69
  countSentenceEdits,
67
70
  defaultProductionGate,
@@ -89,7 +92,7 @@ import {
89
92
  runOptimization,
90
93
  surfaceContentHash,
91
94
  surfaceHash
92
- } from "../chunk-RCXMWGRY.js";
95
+ } from "../chunk-N6MTC3GK.js";
93
96
  import "../chunk-VI2UW6B6.js";
94
97
  import {
95
98
  fsCampaignStorage,
@@ -98,11 +101,11 @@ import {
98
101
  resolveRunDir,
99
102
  runCampaign,
100
103
  tangleTracesRoot
101
- } from "../chunk-XNCF3JU3.js";
104
+ } from "../chunk-FAOEFFRT.js";
102
105
  import "../chunk-HJWNHCD5.js";
103
106
  import "../chunk-DWLIGZBX.js";
104
- import "../chunk-7QPK6W7R.js";
105
- import "../chunk-VC43KQCK.js";
107
+ import "../chunk-ARU2PZFM.js";
108
+ import "../chunk-PJQFMIOX.js";
106
109
  import "../chunk-RPDDVKI7.js";
107
110
  import "../chunk-GGE4NNQT.js";
108
111
  import "../chunk-LNQEP766.js";
@@ -123,6 +126,7 @@ export {
123
126
  aceProposer,
124
127
  acquireSingleRunLock,
125
128
  applySkillPatch,
129
+ assertCodeSurfaceIdentity,
126
130
  buildAnalystSurfaceDispatch,
127
131
  buildEvidenceVector,
128
132
  buildLoopProvenanceRecord,
@@ -130,6 +134,7 @@ export {
130
134
  campaignBreakdown,
131
135
  campaignMeanComposite,
132
136
  classifyUngroundedLiterals,
137
+ codeSurfaceIdentityMaterial,
133
138
  compareProposers,
134
139
  composeGate,
135
140
  compositeProposer,
@@ -207,6 +212,7 @@ export {
207
212
  surfaceHash,
208
213
  tangleTracesRoot,
209
214
  traceAnalystProposer,
210
- userStoryScoreboard
215
+ userStoryScoreboard,
216
+ verifyCodeSurface
211
217
  };
212
218
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fsCampaignStorage,
3
3
  runCampaign
4
- } from "./chunk-XNCF3JU3.js";
4
+ } from "./chunk-FAOEFFRT.js";
5
5
  import {
6
6
  __export
7
7
  } from "./chunk-PZ5AY32C.js";
@@ -763,4 +763,4 @@ export {
763
763
  retrievalMetricsAtCutoff,
764
764
  benchmarks_exports
765
765
  };
766
- //# sourceMappingURL=chunk-VLNGPUJJ.js.map
766
+ //# sourceMappingURL=chunk-3LXTCTWL.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pearsonR
3
- } from "./chunk-VC43KQCK.js";
3
+ } from "./chunk-PJQFMIOX.js";
4
4
 
5
5
  // src/rl/verifiable-reward.ts
6
6
  var DEFAULT_DETERMINISTIC_LAYERS = /* @__PURE__ */ new Set([
@@ -309,4 +309,4 @@ export {
309
309
  filterDeterministicallyRewarded,
310
310
  detectRewardHacking
311
311
  };
312
- //# sourceMappingURL=chunk-7QPK6W7R.js.map
312
+ //# sourceMappingURL=chunk-ARU2PZFM.js.map
@@ -5,7 +5,7 @@ import {
5
5
  pairedBootstrap,
6
6
  pairedMde,
7
7
  wilcoxonSignedRank
8
- } from "./chunk-VC43KQCK.js";
8
+ } from "./chunk-PJQFMIOX.js";
9
9
  import {
10
10
  canonicalize,
11
11
  hashJson
@@ -877,4 +877,4 @@ export {
877
877
  RESEARCH_REPORT_HARD_PAIR_FLOOR,
878
878
  researchReport
879
879
  };
880
- //# sourceMappingURL=chunk-EMKORATZ.js.map
880
+ //# sourceMappingURL=chunk-DPZAEKA6.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  confidenceInterval
3
- } from "./chunk-VC43KQCK.js";
3
+ } from "./chunk-PJQFMIOX.js";
4
4
  import {
5
5
  AgentEvalError
6
6
  } from "./chunk-ONWEPEDO.js";
@@ -787,4 +787,4 @@ export {
787
787
  runCampaign,
788
788
  planCampaignRun
789
789
  };
790
- //# sourceMappingURL=chunk-XNCF3JU3.js.map
790
+ //# sourceMappingURL=chunk-FAOEFFRT.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  researchReport
3
- } from "./chunk-EMKORATZ.js";
3
+ } from "./chunk-DPZAEKA6.js";
4
4
  import {
5
5
  RunIntegrityError,
6
6
  assertRunCaptured
@@ -354,4 +354,4 @@ function defaultRunId(params) {
354
354
  export {
355
355
  runEvalCampaign
356
356
  };
357
- //# sourceMappingURL=chunk-WZOIFFG2.js.map
357
+ //# sourceMappingURL=chunk-LOBMT6SB.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  summaryTable
3
- } from "./chunk-EMKORATZ.js";
3
+ } from "./chunk-DPZAEKA6.js";
4
4
  import {
5
5
  VerificationError
6
6
  } from "./chunk-ONWEPEDO.js";
@@ -574,4 +574,4 @@ export {
574
574
  judgeReplayGate,
575
575
  renderReleaseReport
576
576
  };
577
- //# sourceMappingURL=chunk-RT2AFUXM.js.map
577
+ //# sourceMappingURL=chunk-MOXWMGPC.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  runCampaign,
3
3
  summarizeBackendIntegrity
4
- } from "./chunk-XNCF3JU3.js";
4
+ } from "./chunk-FAOEFFRT.js";
5
5
  import {
6
6
  detectRewardHacking
7
- } from "./chunk-7QPK6W7R.js";
7
+ } from "./chunk-ARU2PZFM.js";
8
8
  import {
9
9
  pairedBootstrap
10
- } from "./chunk-VC43KQCK.js";
10
+ } from "./chunk-PJQFMIOX.js";
11
11
  import {
12
12
  DEFAULT_REDACTION_RULES
13
13
  } from "./chunk-GGE4NNQT.js";
@@ -1928,8 +1928,66 @@ function campaignBreakdown(campaign) {
1928
1928
  return { dimensions, scenarios };
1929
1929
  }
1930
1930
 
1931
- // src/campaign/presets/run-optimization.ts
1931
+ // src/campaign/surface-identity.ts
1932
1932
  import { createHash } from "crypto";
1933
+ var GIT_OBJECT_ID = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
1934
+ var SHA256 = /^sha256:[a-f0-9]{64}$/;
1935
+ function assertCodeSurfaceIdentity(surface) {
1936
+ if (!surface || typeof surface !== "object") {
1937
+ throw new TypeError("CodeSurface must be an object");
1938
+ }
1939
+ const candidate = surface;
1940
+ if (candidate.kind !== "code") throw new TypeError('CodeSurface.kind must be "code"');
1941
+ if (typeof candidate.worktreeRef !== "string" || candidate.worktreeRef.trim().length === 0) {
1942
+ throw new TypeError("CodeSurface.worktreeRef must be a non-empty locator");
1943
+ }
1944
+ if (typeof candidate.baseRef !== "string" || candidate.baseRef.trim().length === 0) {
1945
+ throw new TypeError("CodeSurface.baseRef must be a non-empty ref label");
1946
+ }
1947
+ for (const [field, value] of [
1948
+ ["baseCommit", candidate.baseCommit],
1949
+ ["baseTree", candidate.baseTree],
1950
+ ["candidateCommit", candidate.candidateCommit],
1951
+ ["candidateTree", candidate.candidateTree]
1952
+ ]) {
1953
+ if (typeof value !== "string" || !GIT_OBJECT_ID.test(value)) {
1954
+ throw new TypeError(`CodeSurface.${field} must be a full Git object id`);
1955
+ }
1956
+ }
1957
+ const patch = candidate.patch;
1958
+ if (!patch || typeof patch !== "object" || patch.format !== "git-diff-binary") {
1959
+ throw new TypeError('CodeSurface.patch.format must be "git-diff-binary"');
1960
+ }
1961
+ if (typeof patch.sha256 !== "string" || !SHA256.test(patch.sha256)) {
1962
+ throw new TypeError("CodeSurface.patch.sha256 must be a sha256 digest");
1963
+ }
1964
+ if (!Number.isSafeInteger(patch.byteLength) || patch.byteLength < 0) {
1965
+ throw new TypeError("CodeSurface.patch.byteLength must be a non-negative safe integer");
1966
+ }
1967
+ }
1968
+ function codeSurfaceIdentityMaterial(surface) {
1969
+ assertCodeSurfaceIdentity(surface);
1970
+ return JSON.stringify({
1971
+ schema: "tangle.code-surface.v1",
1972
+ baseCommit: surface.baseCommit,
1973
+ baseTree: surface.baseTree,
1974
+ candidateTree: surface.candidateTree,
1975
+ patch: {
1976
+ format: surface.patch.format,
1977
+ sha256: surface.patch.sha256,
1978
+ byteLength: surface.patch.byteLength
1979
+ }
1980
+ });
1981
+ }
1982
+ function surfaceContentHash(surface) {
1983
+ const material = typeof surface === "string" ? surface : codeSurfaceIdentityMaterial(surface);
1984
+ return `sha256:${createHash("sha256").update(material).digest("hex")}`;
1985
+ }
1986
+ function surfaceHash(surface) {
1987
+ return surfaceContentHash(surface).slice("sha256:".length, "sha256:".length + 16);
1988
+ }
1989
+
1990
+ // src/campaign/presets/run-optimization.ts
1933
1991
  async function runOptimization(opts) {
1934
1992
  const { proposer } = opts;
1935
1993
  const promoteTopK = opts.promoteTopK ?? 2;
@@ -2098,14 +2156,6 @@ function computeParetoFrontier(scored) {
2098
2156
  }));
2099
2157
  return paretoFrontier(scored, objectives).frontier;
2100
2158
  }
2101
- function surfaceHash(surface) {
2102
- const material = typeof surface === "string" ? surface : JSON.stringify({
2103
- kind: surface.kind,
2104
- worktreeRef: surface.worktreeRef,
2105
- baseRef: surface.baseRef ?? null
2106
- });
2107
- return createHash("sha256").update(material).digest("hex").slice(0, 16);
2108
- }
2109
2159
 
2110
2160
  // src/campaign/presets/run-improvement-loop.ts
2111
2161
  var DEFAULT_DISPATCH_TIMEOUT_MS = 6e5;
@@ -2135,7 +2185,7 @@ async function runImprovementLoop(opts) {
2135
2185
  const dispatchTimeoutMs = opts.dispatchTimeoutMs ?? DEFAULT_DISPATCH_TIMEOUT_MS;
2136
2186
  const optimization = await runOptimization({ ...opts, dispatchTimeoutMs });
2137
2187
  const winnerIsBaseline = optimization.winnerSurfaceHash === surfaceHash(opts.baselineSurface);
2138
- const { runCampaign: runCampaign2 } = await import("./run-campaign-HJQEDCJQ.js");
2188
+ const { runCampaign: runCampaign2 } = await import("./run-campaign-UADIM77S.js");
2139
2189
  const baselineOnHoldout = await runCampaign2({
2140
2190
  ...opts,
2141
2191
  dispatchTimeoutMs,
@@ -2273,14 +2323,6 @@ function evolutionaryProposer(opts) {
2273
2323
  // src/campaign/provenance.ts
2274
2324
  import { createHash as createHash2 } from "crypto";
2275
2325
  import { join as join2 } from "path";
2276
- function surfaceContentHash(surface) {
2277
- const material = typeof surface === "string" ? surface : JSON.stringify({
2278
- kind: surface.kind,
2279
- worktreeRef: surface.worktreeRef,
2280
- baseRef: surface.baseRef ?? null
2281
- });
2282
- return `sha256:${createHash2("sha256").update(material).digest("hex")}`;
2283
- }
2284
2326
  function meanHoldoutComposite(campaign) {
2285
2327
  const xs = [];
2286
2328
  for (const cell of campaign.cells) {
@@ -2314,7 +2356,7 @@ function buildLoopProvenanceRecord(args) {
2314
2356
  const baselineHoldoutComposite = meanHoldoutComposite(args.baselineOnHoldout);
2315
2357
  const winnerHoldoutComposite = meanHoldoutComposite(args.winnerOnHoldout);
2316
2358
  const record = {
2317
- schema: "tangle.loop-provenance.v1",
2359
+ schema: "tangle.loop-provenance.v2",
2318
2360
  runId: args.runId,
2319
2361
  runDir: args.runDir,
2320
2362
  timestamp: args.timestamp,
@@ -2576,17 +2618,19 @@ export {
2576
2618
  countSentenceEdits,
2577
2619
  campaignMeanComposite,
2578
2620
  campaignBreakdown,
2579
- runOptimization,
2621
+ assertCodeSurfaceIdentity,
2622
+ codeSurfaceIdentityMaterial,
2623
+ surfaceContentHash,
2580
2624
  surfaceHash,
2625
+ runOptimization,
2581
2626
  runImprovementLoop,
2582
2627
  defaultRenderDiff,
2583
2628
  runEval,
2584
2629
  evolutionaryProposer,
2585
- surfaceContentHash,
2586
2630
  buildLoopProvenanceRecord,
2587
2631
  loopProvenanceSpans,
2588
2632
  provenanceRecordPath,
2589
2633
  provenanceSpansPath,
2590
2634
  emitLoopProvenance
2591
2635
  };
2592
- //# sourceMappingURL=chunk-RCXMWGRY.js.map
2636
+ //# sourceMappingURL=chunk-N6MTC3GK.js.map