niceeval 0.16.2 → 0.17.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 (258) hide show
  1. package/dist/cli/bootstrap.cjs +7 -1
  2. package/dist/cli/bootstrap.cjs.map +1 -1
  3. package/dist/cli/project-configuration.cjs +8 -11
  4. package/dist/cli/project-configuration.cjs.map +1 -1
  5. package/dist/expect/index.cjs.map +1 -1
  6. package/dist/expect/index.d.cts +1 -0
  7. package/dist/expect/index.d.mts +1 -0
  8. package/dist/expect/index.d.ts +1 -0
  9. package/dist/experiment/host/cli/contribution.cjs +6 -11
  10. package/dist/experiment/host/cli/contribution.cjs.map +1 -1
  11. package/dist/experiment/host/cli/contribution.d.cts +0 -16
  12. package/dist/experiment/host/cli/contribution.d.mts +0 -16
  13. package/dist/experiment/host/cli/contribution.d.ts +0 -16
  14. package/dist/experiment/host/operations.cjs +3 -3
  15. package/dist/experiment/host/operations.cjs.map +1 -1
  16. package/dist/experiment/host/types.cjs.map +1 -1
  17. package/dist/experiment/host/types.d.cts +0 -4
  18. package/dist/experiment/host/types.d.mts +0 -4
  19. package/dist/experiment/host/types.d.ts +0 -4
  20. package/dist/fresh-import.cjs +2 -2
  21. package/dist/fresh-import.cjs.map +1 -1
  22. package/dist/fresh-import.d.cts +3 -3
  23. package/dist/fresh-import.d.mts +3 -3
  24. package/dist/fresh-import.d.ts +3 -3
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +1 -0
  27. package/dist/index.d.mts +1 -0
  28. package/dist/index.d.ts +1 -0
  29. package/dist/inspection/codec.cjs.map +1 -1
  30. package/dist/inspection/codec.d.cts +1 -1
  31. package/dist/inspection/codec.d.mts +1 -1
  32. package/dist/inspection/codec.d.ts +1 -1
  33. package/dist/inspection/facts.cjs +66 -9
  34. package/dist/inspection/facts.cjs.map +1 -1
  35. package/dist/inspection/facts.d.cts +4 -0
  36. package/dist/inspection/facts.d.mts +4 -0
  37. package/dist/inspection/facts.d.ts +4 -0
  38. package/dist/inspection/facts.js +4 -2
  39. package/dist/inspection/index.cjs +1 -3
  40. package/dist/inspection/index.cjs.map +1 -1
  41. package/dist/inspection/index.d.cts +1 -1
  42. package/dist/inspection/index.d.mts +1 -1
  43. package/dist/inspection/index.d.ts +1 -1
  44. package/dist/inspection/index.js +44 -48
  45. package/dist/inspection/limits.cjs +3 -1
  46. package/dist/inspection/limits.cjs.map +1 -1
  47. package/dist/inspection/limits.d.cts +2 -0
  48. package/dist/inspection/limits.d.mts +2 -0
  49. package/dist/inspection/limits.d.ts +2 -0
  50. package/dist/inspection/limits.js +6 -4
  51. package/dist/inspection/project-source.cjs +4 -1
  52. package/dist/inspection/project-source.cjs.map +1 -1
  53. package/dist/inspection/protocol.cjs +10 -18
  54. package/dist/inspection/protocol.cjs.map +1 -1
  55. package/dist/inspection/protocol.d.cts +111 -173
  56. package/dist/inspection/protocol.d.mts +111 -173
  57. package/dist/inspection/protocol.d.ts +111 -173
  58. package/dist/inspection/public.mjs +73 -109
  59. package/dist/inspection/results.cjs +12 -48
  60. package/dist/inspection/results.cjs.map +1 -1
  61. package/dist/inspection/results.d.cts +124 -122
  62. package/dist/inspection/results.d.mts +124 -122
  63. package/dist/inspection/results.d.ts +124 -122
  64. package/dist/inspection/results.js +16 -20
  65. package/dist/inspection/select.cjs +80 -117
  66. package/dist/inspection/select.cjs.map +1 -1
  67. package/dist/inspection/source.cjs +14 -15
  68. package/dist/inspection/source.cjs.map +1 -1
  69. package/dist/inspection/source.d.cts +6 -3
  70. package/dist/inspection/source.d.mts +6 -3
  71. package/dist/inspection/source.d.ts +6 -3
  72. package/dist/inspection/trace.cjs +1 -1
  73. package/dist/inspection/trace.cjs.map +1 -1
  74. package/dist/load-config.cjs +17 -11
  75. package/dist/load-config.cjs.map +1 -1
  76. package/dist/load-config.d.cts +3 -2
  77. package/dist/load-config.d.mts +3 -2
  78. package/dist/load-config.d.ts +3 -2
  79. package/dist/o11y/adapter-usage-projection.cjs +5 -1
  80. package/dist/o11y/adapter-usage-projection.cjs.map +1 -1
  81. package/dist/o11y/adapter-usage-projection.d.cts +109 -1
  82. package/dist/o11y/adapter-usage-projection.d.mts +109 -1
  83. package/dist/o11y/adapter-usage-projection.d.ts +109 -1
  84. package/dist/o11y/cache-read.cjs +113 -0
  85. package/dist/o11y/cache-read.cjs.map +1 -0
  86. package/dist/o11y/cache-read.d.cts +80 -0
  87. package/dist/o11y/cache-read.d.mts +80 -0
  88. package/dist/o11y/cache-read.d.ts +80 -0
  89. package/dist/o11y/cache-read.js +8 -0
  90. package/dist/o11y/cache-read.js.map +1 -0
  91. package/dist/o11y/eval-usage.cjs +4 -1
  92. package/dist/o11y/eval-usage.cjs.map +1 -1
  93. package/dist/o11y/eval-usage.d.cts +4 -1
  94. package/dist/o11y/eval-usage.d.mts +4 -1
  95. package/dist/o11y/eval-usage.d.ts +4 -1
  96. package/dist/record/host/sqlite-host.cjs +188 -53
  97. package/dist/record/host/sqlite-host.cjs.map +1 -1
  98. package/dist/record/host/sqlite-host.d.cts +37 -1
  99. package/dist/record/host/sqlite-host.d.mts +37 -1
  100. package/dist/record/host/sqlite-host.d.ts +37 -1
  101. package/dist/record/host/sqlite-host.js +16 -8
  102. package/dist/record/maintenance/runtime.cjs +3 -3
  103. package/dist/record/maintenance/runtime.cjs.map +1 -1
  104. package/dist/record/sqlite/admission-repository.cjs +18 -18
  105. package/dist/record/sqlite/admission-repository.cjs.map +1 -1
  106. package/dist/record/sqlite/case-repository.cjs +6 -6
  107. package/dist/record/sqlite/case-repository.cjs.map +1 -1
  108. package/dist/record/sqlite/coordination-repository.cjs +25 -25
  109. package/dist/record/sqlite/coordination-repository.cjs.map +1 -1
  110. package/dist/record/sqlite/current-schema.cjs +115 -111
  111. package/dist/record/sqlite/current-schema.cjs.map +1 -1
  112. package/dist/record/sqlite/current-schema.d.cts +3 -3
  113. package/dist/record/sqlite/current-schema.d.mts +3 -3
  114. package/dist/record/sqlite/current-schema.d.ts +3 -3
  115. package/dist/record/sqlite/database.cjs +56 -53
  116. package/dist/record/sqlite/database.cjs.map +1 -1
  117. package/dist/record/sqlite/index.cjs +3 -1
  118. package/dist/record/sqlite/index.cjs.map +1 -1
  119. package/dist/record/sqlite/index.d.cts +5 -2
  120. package/dist/record/sqlite/index.d.mts +5 -2
  121. package/dist/record/sqlite/index.d.ts +5 -2
  122. package/dist/record/sqlite/legacy-schema-018.cjs +443 -0
  123. package/dist/record/sqlite/legacy-schema-018.cjs.map +1 -0
  124. package/dist/record/sqlite/legacy-schema-018.d.cts +6 -0
  125. package/dist/record/sqlite/legacy-schema-018.d.mts +6 -0
  126. package/dist/record/sqlite/legacy-schema-018.d.ts +6 -0
  127. package/dist/record/sqlite/legacy-schema-018.js +6 -0
  128. package/dist/record/sqlite/legacy-schema-018.js.map +1 -0
  129. package/dist/record/sqlite/migration.cjs +105 -46
  130. package/dist/record/sqlite/migration.cjs.map +1 -1
  131. package/dist/record/sqlite/migration.d.cts +2 -1
  132. package/dist/record/sqlite/migration.d.mts +2 -1
  133. package/dist/record/sqlite/migration.d.ts +2 -1
  134. package/dist/record/sqlite/portable-capture.cjs +13 -13
  135. package/dist/record/sqlite/portable-capture.cjs.map +1 -1
  136. package/dist/record/sqlite/registry-repository.cjs +22 -22
  137. package/dist/record/sqlite/registry-repository.cjs.map +1 -1
  138. package/dist/record/sqlite/schema.cjs +10 -2
  139. package/dist/record/sqlite/schema.cjs.map +1 -1
  140. package/dist/record/sqlite/schema.d.cts +4 -1
  141. package/dist/record/sqlite/schema.d.mts +4 -1
  142. package/dist/record/sqlite/schema.d.ts +4 -1
  143. package/dist/record/sqlite/schema.js +20 -14
  144. package/dist/record/sqlite/storage-worker.cjs +1 -1
  145. package/dist/record/sqlite/storage-worker.cjs.map +1 -1
  146. package/dist/record/sqlite/storage.cjs +316 -232
  147. package/dist/record/sqlite/storage.cjs.map +1 -1
  148. package/dist/record/sqlite/storage.d.cts +10 -2
  149. package/dist/record/sqlite/storage.d.mts +10 -2
  150. package/dist/record/sqlite/storage.d.ts +10 -2
  151. package/dist/record/sqlite/storage.js +54 -50
  152. package/dist/record/sqlite/types.cjs +1 -1
  153. package/dist/record/sqlite/types.cjs.map +1 -1
  154. package/dist/record/sqlite/types.d.cts +13 -1
  155. package/dist/record/sqlite/types.d.mts +13 -1
  156. package/dist/record/sqlite/types.d.ts +13 -1
  157. package/dist/run/cli/contribution.cjs +17 -12
  158. package/dist/run/cli/contribution.cjs.map +1 -1
  159. package/dist/run/host/lifecycle-adapter.cjs +1 -1
  160. package/dist/run/host/lifecycle-adapter.cjs.map +1 -1
  161. package/dist/run/storage/owner-identity.cjs +78 -16
  162. package/dist/run/storage/owner-identity.cjs.map +1 -1
  163. package/dist/run/storage/owner-identity.d.cts +2 -1
  164. package/dist/run/storage/owner-identity.d.mts +2 -1
  165. package/dist/run/storage/owner-identity.d.ts +2 -1
  166. package/dist/run/storage/sqlite.cjs +55 -55
  167. package/dist/run/storage/sqlite.cjs.map +1 -1
  168. package/dist/runner/accept.cjs +12 -42
  169. package/dist/runner/accept.cjs.map +1 -1
  170. package/dist/runner/accept.d.cts +2 -3
  171. package/dist/runner/accept.d.mts +2 -3
  172. package/dist/runner/accept.d.ts +2 -3
  173. package/dist/runner/adapter-usage.cjs +2 -2
  174. package/dist/runner/adapter-usage.cjs.map +1 -1
  175. package/dist/runner/adoption.cjs +14 -26
  176. package/dist/runner/adoption.cjs.map +1 -1
  177. package/dist/runner/adoption.d.cts +5 -13
  178. package/dist/runner/adoption.d.mts +5 -13
  179. package/dist/runner/adoption.d.ts +5 -13
  180. package/dist/runner/adoption.js +2 -4
  181. package/dist/runner/record.cjs +24 -18
  182. package/dist/runner/record.cjs.map +1 -1
  183. package/dist/runner/rename-experiment.cjs +5 -7
  184. package/dist/runner/rename-experiment.cjs.map +1 -1
  185. package/dist/runner/reuse-plan.cjs +37 -18
  186. package/dist/runner/reuse-plan.cjs.map +1 -1
  187. package/dist/runner/reuse-plan.d.cts +4 -1
  188. package/dist/runner/reuse-plan.d.mts +4 -1
  189. package/dist/runner/reuse-plan.d.ts +4 -1
  190. package/dist/runner/setup-prefix-plan.cjs +17 -12
  191. package/dist/runner/setup-prefix-plan.cjs.map +1 -1
  192. package/dist/runner/setup-prefix-plan.d.cts +0 -2
  193. package/dist/runner/setup-prefix-plan.d.mts +0 -2
  194. package/dist/runner/setup-prefix-plan.d.ts +0 -2
  195. package/dist/runner/setup-prefix-plan.js +8 -12
  196. package/dist/sandbox/backend.cjs +10 -1
  197. package/dist/sandbox/backend.cjs.map +1 -1
  198. package/dist/sandbox/backend.d.cts +16 -8
  199. package/dist/sandbox/backend.d.mts +16 -8
  200. package/dist/sandbox/backend.d.ts +16 -8
  201. package/dist/sandbox/backend.js +28 -26
  202. package/dist/sandbox/docker.cjs +7 -1
  203. package/dist/sandbox/docker.cjs.map +1 -1
  204. package/dist/sandbox/e2b-cache-repository.cjs +13 -3
  205. package/dist/sandbox/e2b-cache-repository.cjs.map +1 -1
  206. package/dist/sandbox/e2b-cache-repository.d.cts +3 -0
  207. package/dist/sandbox/e2b-cache-repository.d.mts +3 -0
  208. package/dist/sandbox/e2b-cache-repository.d.ts +3 -0
  209. package/dist/sandbox/e2b-cache-repository.js +16 -12
  210. package/dist/sandbox/e2b.cjs +2 -2
  211. package/dist/sandbox/e2b.cjs.map +1 -1
  212. package/dist/sandbox/incus/materialize.cjs +1 -1
  213. package/dist/sandbox/incus/materialize.cjs.map +1 -1
  214. package/dist/show/contribution.cjs +3 -3
  215. package/dist/show/contribution.cjs.map +1 -1
  216. package/dist/show/model.cjs +14 -13
  217. package/dist/show/model.cjs.map +1 -1
  218. package/dist/show/model.d.cts +7 -7
  219. package/dist/show/model.d.mts +7 -7
  220. package/dist/show/model.d.ts +7 -7
  221. package/dist/show/render.cjs +14 -0
  222. package/dist/show/render.cjs.map +1 -1
  223. package/dist/user-database/storage-worker.cjs +13 -3
  224. package/dist/user-database/storage-worker.cjs.map +1 -1
  225. package/dist/view/app-dist/.vite/manifest.json +2 -2
  226. package/dist/view/app-dist/assets/{index-CmVoXbwG.js → index-B3ijZRph.js} +17 -17
  227. package/dist/view/app-dist/assets/{quality-cost-scatter-BuLISaH4.js → quality-cost-scatter-B--DfJ9s.js} +1 -1
  228. package/dist/view/app-dist/index.html +1 -1
  229. package/dist/view/application-runtime.cjs +8 -0
  230. package/dist/view/application-runtime.cjs.map +1 -0
  231. package/dist/view/application-runtime.d.cts +9 -0
  232. package/dist/view/application-runtime.d.mts +9 -0
  233. package/dist/view/application-runtime.d.ts +9 -0
  234. package/dist/view/application-runtime.js +6 -0
  235. package/dist/view/application-runtime.js.map +1 -0
  236. package/dist/view/cli/contribution.cjs +5 -2
  237. package/dist/view/cli/contribution.cjs.map +1 -1
  238. package/dist/view/cli/contribution.d.cts +2 -1
  239. package/dist/view/cli/contribution.d.mts +2 -1
  240. package/dist/view/cli/contribution.d.ts +2 -1
  241. package/dist/view/function-runtime.mjs +1019 -456
  242. package/dist/view/http-protocol.d.cts +1 -9
  243. package/dist/view/http-protocol.d.mts +1 -9
  244. package/dist/view/http-protocol.d.ts +1 -9
  245. package/dist/view/inspection-host.cjs +39 -30
  246. package/dist/view/inspection-host.cjs.map +1 -1
  247. package/dist/view/inspection-host.d.cts +7545 -2
  248. package/dist/view/inspection-host.d.mts +7545 -2
  249. package/dist/view/inspection-host.d.ts +7545 -2
  250. package/dist/view/server.cjs +8 -5
  251. package/dist/view/server.cjs.map +1 -1
  252. package/dist/view/server.d.cts +4 -2
  253. package/dist/view/server.d.mts +4 -2
  254. package/dist/view/server.d.ts +4 -2
  255. package/docs-site/zh/reference/cli.mdx +1 -2
  256. package/docs-site/zh/tutorials/control-run-cost.mdx +22 -0
  257. package/docs-site/zh/tutorials/niceeval-taste-application.mdx +21 -0
  258. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"reuse-plan.js","sourceRoot":"","sources":["reuse-plan.ts"],"names":[],"mappings":";;;AAwJA,gEAiBC;AA2DD,wDAKC;A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GhB,CAAC;IACF,OAAO,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;WACnC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC;WACxC,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ;WAClC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AACD,SAAS,wBAAwB,CAAC,KAAc;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAC3C,OAAO,KAAK,CAAC;IACjB,MAAM,QAAQ,GAAG,KAGhB,CAAC;IACF,OAAO,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;WACnC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC;WACxC,OAAO,QAAQ,CAAC,YAAY,KAAK,QAAQ;WACzC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;WACtC,QAAQ,CAAC,YAAY,IAAI,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// @concord-file ne-runner-reuse-plan\n// @concord-implements docs/feature/experiments/cache.md\n// @concord-implements docs/feature/experiments/use-case/cache-explicit-rerun.md\n// @concord-implements docs/feature/experiments/use-case/rerun-all.md\nimport { Effect, Result, Schema } from \"effect\";\nimport { RecordIntegrityFailure } from \"../record/reader/errors.ts\";\nimport { RunIdSchema, ExperimentIdSchema, UtcMillisSchema } from \"../record/codec/identifiers.ts\";\nimport { RecordSlotIdentitySchema } from \"../record/codec/core.ts\";\nimport type { ReadableRunResource } from \"../run/storage/types.ts\";\nimport { foldRecordedAttemptScore } from \"../eval/record/score.ts\";\nimport { executionDigestForExperiment, hasProvenNoExperimentHooks } from \"./rename-identity.ts\";\nimport type { RecordIssue } from \"../record/errors/record-errors.ts\";\nimport type { AssertionsAttachment, } from \"../record/family/assertions/definition.ts\";\nimport { NiceEvalRecordAttachments } from \"../record/family/catalog.ts\";\nimport { readAttemptExecutionDuration, type DurationLimit, type AttemptExecutionTimingFacts, } from \"../eval/record/eligibility.ts\";\nimport { COMPARISON_SOURCE_STATES, type ComparisonAttachment, type ComparisonResult, type RecordedAttemptClaim, } from \"../eval/record/membership-provenance.ts\";\nimport { foldRecordedAttemptVerdict, type VerdictState, } from \"../eval/record/verdict.ts\";\nimport type { RecordReadSession, ReadableAttempt, ReadableRun, SelectedAttemptRef, SelectedRunRef, } from \"../record/host/types.ts\";\nimport type { RecordCoreRead, RecordAttachmentRead } from \"../record/model/read-state.ts\";\nimport { compareCanonicalIdentity, isPortableSegment, isSha256Digest, isUtcMillis, type ExecutionIdentityDigest, type RunId, type SlotId, type UtcMillis, } from \"../record/model/identifiers.ts\";\nimport type { AttemptOutcome, AttemptDocument, MemberDocument, RunDocument, RecordSlotIdentity } from \"../record/model/core.ts\";\nimport type { RecordReaderReadError } from \"../record/reader/errors.ts\";\nimport type { EvaluationKind } from \"./types.ts\";\nexport const PROJECT_TARGET_POLICY_NAME = \"project-target\" as const;\nexport const PROJECT_TARGET_POLICY_VERSION = 2 as const;\nexport const PROJECT_TARGET_INVOCATION_ID_MAXIMUM_LENGTH = 255 as const;\nexport const PROJECT_TARGET_RECORD_IDENTITY_MAXIMUM_LENGTH = 4096 as const;\nexport interface ExecutionPolicyIdentity {\n readonly name: typeof PROJECT_TARGET_POLICY_NAME;\n readonly version: typeof PROJECT_TARGET_POLICY_VERSION;\n}\nexport const projectTargetPolicyIdentity: ExecutionPolicyIdentity = Object.freeze({\n name: PROJECT_TARGET_POLICY_NAME,\n version: PROJECT_TARGET_POLICY_VERSION,\n});\n/** Current planner input, kept in memory rather than persisted as an Attachment. */\nexport interface ExecutionIdentity {\n readonly domain: string;\n readonly value: string;\n}\nexport interface ExecutionDurationLimit {\n readonly domain: string;\n readonly milliseconds: number;\n}\n/**\n * Reuse compares current execution identity with the immutable Core Slot,\n * folds Core outcome with Assertions, and reads duration from Runner Activity\n * receipts. None of these facts is a separate eligibility/verdict family.\n */\nexport const EXECUTION_COMPARISON_PROJECTION_STATE = Object.freeze({\n migrationRequired: \"migration-required\" as const,\n});\nexport const EXECUTION_COMPARISON_SOURCE_STATES = [\n ...COMPARISON_SOURCE_STATES,\n EXECUTION_COMPARISON_PROJECTION_STATE.migrationRequired,\n] as const;\nexport type ExecutionComparisonAttachment = ComparisonAttachment;\nexport type ExecutionComparisonSourceState = (typeof EXECUTION_COMPARISON_SOURCE_STATES)[number];\nexport type ExecutionComparisonResult = ComparisonResult;\nexport type ExecutionRecordedClaim = RecordedAttemptClaim;\nexport interface ExecutionComparison {\n readonly attachment: ExecutionComparisonAttachment;\n readonly recordedClaim: ExecutionRecordedClaim;\n readonly sourceState: ExecutionComparisonSourceState;\n readonly result: ExecutionComparisonResult;\n readonly reason: string;\n}\nexport type ExecutionGapReason = \"no-source-run\" | \"source-slot-missing\" | \"source-member-missing\" | \"source-core-invalid\" | \"source-publication-unavailable\" | \"source-attachment-unavailable\" | \"source-attachment-migration-required\" | \"source-attachment-unsupported\" | \"source-attachment-invalid\" | \"reuse-contract-domain-mismatch\" | \"reuse-contract-mismatch\" | \"identity-mismatch\" | \"identity-domain-mismatch\" | \"duration-domain-mismatch\" | \"timeout-exceeded\" | \"attempt-outcome-ineligible\" | \"adoption-unproven\" | \"verdict-ineligible\" | \"score-incomplete\" | \"adapter-behavior-revision-required\" | \"rerun-requested\" | \"sandbox-retention-requested\";\nexport type ExecutionGapScope = \"slot\" | \"experiment\" | \"target\";\n/** Origin identity is read from the immutable Attempt, never reconstructed. */\nexport interface ExecutionSourceOrigin {\n readonly runId: RunId;\n readonly slotId: SlotId;\n}\n/** The selected Run boundary may itself be a reference Run. */\nexport interface ExecutionSourceBarrier {\n readonly runId: RunId;\n readonly startedAt: UtcMillis;\n}\nexport interface ExecutionReuseEffectiveOptions {\n readonly rerun: \"none\" | \"failed\" | \"all\";\n readonly keepSandbox: boolean;\n readonly reuseContract: ExecutionIdentity;\n}\nexport interface ExecutionTarget {\n readonly invocationId: string;\n readonly runs: readonly TargetRun[];\n}\nexport interface TargetRun {\n readonly runId: RunId;\n readonly experimentId: string;\n readonly startedAt: UtcMillis;\n readonly slots: readonly TargetSlot[];\n}\n/**\n * `slotId` and `executionIdentityDigest` are deterministic current planning\n * facts. A carried Member can therefore point at the exact immutable origin\n * Attempt without an out-of-band provenance Attachment.\n */\nexport interface TargetSlot {\n readonly renameFingerprint?: (experimentId: string) => string | undefined;\n readonly runId: RunId;\n readonly slotId: SlotId;\n readonly experimentId: string;\n readonly evalId: string;\n readonly attempt: number;\n readonly evaluationKind: EvaluationKind;\n readonly executionIdentityDigest: ExecutionIdentityDigest;\n readonly inputIdentity: ExecutionIdentity;\n readonly configIdentity: ExecutionIdentity;\n readonly timeout?: ExecutionDurationLimit;\n /** Current-only eligibility fact; omitted means behavior identity is reusable. */\n readonly reuseEligibility?: \"adapter-behavior-revision-required\";\n}\n/** Logical current input; evaluating it never allocates durable identities. */\nexport type CurrentTargetSlot = Omit<TargetSlot, \"runId\" | \"slotId\">;\nexport interface CurrentAssessmentRun<Ref> {\n readonly createdRevision?: number;\n readonly lifecycle?: Pick<ReadableRunResource, \"state\" | \"slots\">;\n readonly document: Pick<RunDocument, \"runId\" | \"experimentId\" | \"startedAt\" | \"expectedSlots\"> & {\n readonly context?: RunDocument[\"context\"];\n };\n readonly members: readonly {\n readonly document: MemberDocument;\n readonly bindingRevision?: number;\n readonly attempt: Ref | null;\n }[];\n}\nexport interface CurrentAssessmentSource {\n readonly attemptId: AttemptDocument[\"attemptId\"];\n readonly origin: ExecutionSourceOrigin;\n readonly sourceBarrier: ExecutionSourceBarrier;\n}\nexport type CurrentSlotAssessment<Target extends CurrentTargetSlot, Source extends CurrentAssessmentSource> = Target & ({\n readonly state: \"reuse\";\n readonly adoption: \"carried\";\n readonly source: Source;\n readonly comparisons: readonly ExecutionComparison[];\n} | {\n readonly state: \"gap\";\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: Source;\n readonly comparisons: readonly ExecutionComparison[];\n});\nexport interface CurrentAssessmentAttempt {\n readonly document: AttemptDocument;\n readonly publicationAvailable: boolean;\n}\n/** Both consumers retain every expected lifecycle position at one cutoff. */\nexport function mergeCurrentAssessmentRuns<Ref>(runs: readonly CurrentAssessmentRun<Ref>[], resources: readonly ReadableRunResource[]): Effect.Effect<readonly CurrentAssessmentRun<Ref>[], RecordIntegrityFailure> {\n return Effect.map(Effect.forEach(resources, (resource) => {\n const published = runs.find((run) => run.document.runId === resource.runId);\n const lifecycle = Object.freeze({ state: resource.state, slots: resource.slots });\n if (published !== undefined)\n return Effect.succeed(Object.freeze({ ...published, createdRevision: resource.createdRevision, lifecycle }));\n return Schema.decodeUnknownEffect(Schema.Struct({\n runId: RunIdSchema, experimentId: ExperimentIdSchema, startedAt: UtcMillisSchema,\n expectedSlots: Schema.Array(RecordSlotIdentitySchema),\n }))({\n runId: resource.runId, experimentId: resource.experimentId, startedAt: Date.parse(resource.startedAt),\n expectedSlots: resource.slots.map(({ publication: _publication, ...slot }) => slot),\n }).pipe(Effect.map((document): CurrentAssessmentRun<Ref> => Object.freeze({ createdRevision: resource.createdRevision, lifecycle, document, members: Object.freeze([]) })), Effect.mapError(() => new RecordIntegrityFailure({ code: \"record-integrity-failure\", runId: resource.runId, reason: \"core-invalid\" })));\n }, { concurrency: 1 }), (lifecycle) => Object.freeze([\n ...lifecycle,\n ...runs.filter((run) => !resources.some((resource) => resource.runId === run.document.runId)),\n ]));\n}\nexport type AssertionsVerdict = VerdictState;\n/** The exact selection-issued references remain live only while its reader Scope is live. */\nexport interface ExecutionReusePlanSource {\n readonly attemptId: SelectedAttemptRef[\"attemptId\"];\n readonly attempt: SelectedAttemptRef & {\n readonly publicationIdentity: NonNullable<SelectedAttemptRef[\"publicationIdentity\"]>;\n };\n readonly origin: ExecutionSourceOrigin;\n readonly originRun: SelectedRunRef;\n readonly sourceBarrier: ExecutionSourceBarrier;\n readonly evaluationKind: EvaluationKind;\n}\nexport interface ProjectTargetPolicy {\n readonly identity: ExecutionPolicyIdentity;\n readonly reuseContract: ExecutionIdentity;\n readonly rerun: \"none\" | \"failed\" | \"all\";\n readonly keepSandbox: boolean;\n}\nexport interface ExecutionReusePlanSlotBase extends TargetSlot {\n readonly comparisons: readonly ExecutionComparison[];\n}\nexport interface ReusePlanSlot extends ExecutionReusePlanSlotBase {\n readonly state: \"reuse\";\n readonly adoption: \"carried\";\n readonly source: ExecutionReusePlanSource;\n}\nexport interface ExecutionGapSlot extends ExecutionReusePlanSlotBase {\n readonly state: \"gap\";\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: ExecutionReusePlanSource;\n}\nexport type ExecutionReusePlanSlot = ReusePlanSlot | ExecutionGapSlot;\nexport interface ExecutionReusePlan {\n readonly target: ExecutionTarget;\n readonly policy: ExecutionPolicyIdentity;\n readonly effectiveOptions: ExecutionReuseEffectiveOptions;\n readonly slots: readonly ExecutionReusePlanSlot[];\n readonly reuse: readonly ReusePlanSlot[];\n readonly gaps: readonly ExecutionGapSlot[];\n}\nexport interface ProjectTargetReusePlanInput {\n readonly reader: RecordReadSession;\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}\nexport type ProjectTargetReusePlanInvalidReason = \"invocation-id-invalid\" | \"target-run-invalid\" | \"target-run-duplicate\" | \"target-slot-invalid\" | \"target-slot-duplicate\" | \"target-slot-run-mismatch\" | \"target-slot-experiment-mismatch\" | \"target-slot-ordinal-duplicate\" | \"policy-unsupported\" | \"policy-input-invalid\";\nexport interface ProjectTargetReusePlanInvalid {\n readonly code: \"project-target-reuse-plan-invalid\";\n readonly reason: ProjectTargetReusePlanInvalidReason;\n}\n/**\n * Fold the terminal Verdict from the source Attempt's immutable Core outcome\n * and its fixed Assertions facts. This is a projection, not a second durable\n * Verdict family.\n */\nexport function recordedAttemptVerdict(input: {\n readonly outcome: AttemptOutcome;\n readonly assertions: AssertionsAttachment;\n}): AssertionsVerdict {\n return foldRecordedAttemptVerdict(input);\n}\n/** Input validation is pure; it never invents a target Slot or repairs an identity. */\nexport function validateProjectTargetReusePlanInput(input: {\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}): ProjectTargetReusePlanInvalid | undefined {\n const unknownInput: unknown = input;\n if (typeof unknownInput !== \"object\" || unknownInput === null) {\n return invalidPlan(\"target-run-invalid\");\n }\n const envelope = unknownInput as {\n readonly target?: unknown;\n readonly policy?: unknown;\n };\n if (typeof envelope.target !== \"object\" || envelope.target === null) {\n return invalidPlan(\"target-run-invalid\");\n }\n const target = envelope.target as {\n readonly invocationId?: unknown;\n readonly runs?: unknown;\n };\n if (typeof target.invocationId !== \"string\"\n || !isBoundedNonEmptyText(target.invocationId, PROJECT_TARGET_INVOCATION_ID_MAXIMUM_LENGTH)\n || !Array.isArray(target.runs)) {\n return invalidPlan(\"invocation-id-invalid\");\n }\n if (typeof envelope.policy !== \"object\" || envelope.policy === null) {\n return invalidPlan(\"policy-input-invalid\");\n }\n const policy = envelope.policy as {\n readonly identity?: unknown;\n readonly reuseContract?: unknown;\n readonly rerun?: unknown;\n readonly keepSandbox?: unknown;\n };\n if (typeof policy.identity !== \"object\"\n || policy.identity === null\n || (policy.identity as {\n readonly name?: unknown;\n }).name !== PROJECT_TARGET_POLICY_NAME\n || (policy.identity as {\n readonly version?: unknown;\n }).version !== PROJECT_TARGET_POLICY_VERSION) {\n return invalidPlan(\"policy-unsupported\");\n }\n if (!isExecutionIdentity(policy.reuseContract)\n || !isRerunOption(policy.rerun)\n || typeof policy.keepSandbox !== \"boolean\") {\n return invalidPlan(\"policy-input-invalid\");\n }\n const runIds = new Set<string>();\n const slotIds = new Set<string>();\n const ordinals = new Set<string>();\n for (const run of target.runs) {\n if (!isTargetRun(run))\n return invalidPlan(\"target-run-invalid\");\n if (runIds.has(run.runId))\n return invalidPlan(\"target-run-duplicate\");\n runIds.add(run.runId);\n for (const slot of run.slots) {\n if (!isTargetSlot(slot))\n return invalidPlan(\"target-slot-invalid\");\n if (slot.runId !== run.runId)\n return invalidPlan(\"target-slot-run-mismatch\");\n if (slot.experimentId !== run.experimentId) {\n return invalidPlan(\"target-slot-experiment-mismatch\");\n }\n if (slotIds.has(slot.slotId))\n return invalidPlan(\"target-slot-duplicate\");\n slotIds.add(slot.slotId);\n const ordinal = sourceKey(slot.experimentId, slot.evalId, String(slot.attempt));\n if (ordinals.has(ordinal))\n return invalidPlan(\"target-slot-ordinal-duplicate\");\n ordinals.add(ordinal);\n }\n }\n return undefined;\n}\n/**\n * Plans only from Record Host selection references. It neither reconstructs\n * attempt handles from strings nor reads private Record paths.\n */\n// @concord-code ne-runner-plan-reuse\n// @concord-implements docs/feature/experiments/cache.md\nexport function planProjectTargetReuse(input: ProjectTargetReusePlanInput): Effect.Effect<ExecutionReusePlan, ProjectTargetReusePlanInvalid | RecordReaderReadError> {\n return Effect.suspend<ExecutionReusePlan, ProjectTargetReusePlanInvalid | RecordReaderReadError, never>(() => {\n const invalid = validateProjectTargetReusePlanInput(input);\n if (invalid !== undefined)\n return Effect.fail(invalid);\n return Effect.gen(function* () {\n const selection = yield* input.reader.selectRuns({ includePublishedActive: true });\n const readable = yield* Effect.forEach(selection.runRefs, (ref) => input.reader.readRun(ref), { concurrency: 1 });\n const publishedRuns: ReadableRun[] = [];\n const coreIssues: RecordIssue[] = [];\n for (const read of readable) {\n if (read.state === \"available\")\n publishedRuns.push(read.value);\n else if (read.state === \"core-invalid\")\n coreIssues.push(...read.issues);\n }\n const resources: ReadableRunResource[] = [];\n let afterRunId = \"\";\n for (;;) {\n const page = yield* input.reader.listRunResources({ afterRunId, pageSize: 100 });\n resources.push(...page.runs);\n if (page.nextAfterRunId === null)\n break;\n afterRunId = page.nextAfterRunId;\n }\n const runs = yield* mergeCurrentAssessmentRuns(publishedRuns, resources);\n const byRunId = new Map(publishedRuns.map((run) => [run.document.runId, run] as const));\n const slots: ExecutionReusePlanSlot[] = [];\n for (const target of flattenTargetSlots(input.target)) {\n slots.push(yield* planTargetSlot({\n reader: input.reader,\n target,\n policy: input.policy,\n runs,\n byRunId,\n selectionHasProblem: selection.problems.length > 0 || coreIssues.length > 0,\n coreIssues,\n }));\n }\n const reuse = slots.filter((slot): slot is ReusePlanSlot => slot.state === \"reuse\");\n const gaps = slots.filter((slot): slot is ExecutionGapSlot => slot.state === \"gap\");\n return Object.freeze({\n target: input.target,\n policy: projectTargetPolicyIdentity,\n effectiveOptions: effectiveOptions(input.policy),\n slots: Object.freeze(slots),\n reuse: Object.freeze(reuse),\n gaps: Object.freeze(gaps),\n });\n });\n });\n}\n/** Empty or not-yet-created Record roots produce no source capability. */\nexport function planProjectTargetReuseWithoutSources(input: {\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}): Effect.Effect<ExecutionReusePlan, ProjectTargetReusePlanInvalid> {\n return Effect.suspend(() => {\n const invalid = validateProjectTargetReusePlanInput(input);\n if (invalid !== undefined)\n return Effect.fail(invalid);\n const gaps = Object.freeze(flattenTargetSlots(input.target).map((target) => gapSlot(target, {\n reason: target.reuseEligibility ?? \"no-source-run\",\n scope: \"slot\",\n issues: [],\n comparisons: [],\n })));\n return Effect.succeed(Object.freeze({\n target: input.target,\n policy: projectTargetPolicyIdentity,\n effectiveOptions: effectiveOptions(input.policy),\n slots: gaps,\n reuse: Object.freeze([]),\n gaps,\n }));\n });\n}\nexport const ProjectTargetReusePlanner = Object.freeze({ plan: planProjectTargetReuse });\nfunction planTargetSlot(input: {\n readonly reader: RecordReadSession;\n readonly target: TargetSlot;\n readonly policy: ProjectTargetPolicy;\n readonly runs: readonly CurrentAssessmentRun<SelectedAttemptRef>[];\n readonly byRunId: ReadonlyMap<RunId, ReadableRun>;\n readonly selectionHasProblem: boolean;\n readonly coreIssues: readonly RecordIssue[];\n}): Effect.Effect<ExecutionReusePlanSlot, RecordReaderReadError> {\n return assessCurrentTargetSlot({\n ...input,\n readAttempt: (ref) => input.reader.readAttempt(ref).pipe(Effect.map((read) => read.state !== \"available\" ? read : {\n state: \"available\" as const,\n value: { ...read.value, publicationAvailable: read.value.ref.publicationIdentity !== undefined },\n })),\n readAssertions: (attempt) => input.reader.read(attempt.owner, NiceEvalRecordAttachments.assertions),\n readActivities: (attempt) => input.reader.read(attempt.owner, NiceEvalRecordAttachments.runnerActivities.attempt),\n sourceFor: (attempt, sourceBarrier) => {\n if (!hasPublicationIdentity(attempt))\n throw new Error(\"Expected a published Attempt\");\n return candidateFor({ target: input.target, sourceBarrier, attempt, byRunId: input.byRunId })!.source;\n },\n });\n}\n/** Both read-only current results and execution planning use this assessment. */\nexport interface CurrentAssessmentInput<Ref, Attempt extends CurrentAssessmentAttempt, Source extends CurrentAssessmentSource, Target extends CurrentTargetSlot, Error> {\n readonly target: Target;\n readonly policy: ProjectTargetPolicy;\n readonly runs: readonly CurrentAssessmentRun<Ref>[];\n readonly byRunId: ReadonlyMap<RunId, CurrentAssessmentRun<Ref>>;\n readonly selectionHasProblem: boolean;\n readonly coreIssues: readonly RecordIssue[];\n readonly readAttempt: (ref: Ref) => Effect.Effect<RecordCoreRead<Attempt>, Error>;\n readonly readAssertions: (attempt: Attempt) => Effect.Effect<RecordAttachmentRead<AssertionsAttachment>, Error>;\n readonly readActivities: (attempt: Attempt) => Effect.Effect<RecordAttachmentRead<AttemptExecutionTimingFacts>, Error>;\n readonly sourceFor: (attempt: Attempt, barrier: ExecutionSourceBarrier) => Source;\n}\nexport function assessCurrentTargetSlot<Ref, Attempt extends CurrentAssessmentAttempt, Source extends CurrentAssessmentSource, Target extends CurrentTargetSlot, Error>(input: CurrentAssessmentInput<Ref, Attempt, Source, Target, Error>): Effect.Effect<CurrentSlotAssessment<Target, Source>, Error> {\n return Effect.gen(function* () {\n if (input.target.reuseEligibility !== undefined) {\n return gapSlot(input.target, {\n reason: input.target.reuseEligibility,\n scope: \"slot\",\n issues: [],\n comparisons: [],\n });\n }\n if (input.selectionHasProblem) {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"target\",\n issues: input.coreIssues,\n comparisons: [],\n });\n }\n const sourceRun = latestSourceRun(input.runs, input.target);\n if (sourceRun === undefined) {\n return gapSlot(input.target, {\n reason: \"no-source-run\",\n scope: \"slot\",\n issues: [],\n comparisons: [],\n });\n }\n const sourceBarrier = Object.freeze({\n runId: sourceRun.document.runId,\n startedAt: sourceRun.document.startedAt,\n });\n const expected = sourceRun.document.expectedSlots.find((slot) => slot.evalId === input.target.evalId\n && slot.attemptOrdinal === input.target.attempt);\n if (expected === undefined) {\n return gapSlot(input.target, {\n reason: \"source-slot-missing\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const member = sourceRun.members.find((candidate) => candidate.document.slotId === expected.slotId);\n if (member === undefined || member.attempt === null) {\n const publication = sourceRun.lifecycle?.slots.find((slot) => slot.slotId === expected.slotId)?.publication;\n return gapSlot(input.target, {\n reason: \"source-member-missing\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: publication?.state === \"pending\" || publication?.state === \"absent\"\n ? [comparison(\"core\", \"attempt-outcome\", \"unavailable\", \"not-comparable\", publication.state === \"pending\" ? \"pending\" : publication.reason)]\n : [],\n });\n }\n const readAttempt = yield* input.readAttempt(member.attempt);\n if (readAttempt.state !== \"available\") {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"slot\",\n issues: issuesOf(readAttempt),\n sourceBarrier,\n comparisons: [],\n });\n }\n if (!readAttempt.value.publicationAvailable) {\n return gapSlot(input.target, {\n reason: \"source-publication-unavailable\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const document = readAttempt.value.document;\n const originRun = input.byRunId.get(document.originRunId);\n const originExpected = originRun?.document.expectedSlots.find((slot) => slot.slotId === document.slotId);\n if (originExpected === undefined || document.evalId !== originExpected.evalId || document.executionIdentityDigest !== originExpected.executionIdentityDigest) {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const candidate = input.sourceFor(readAttempt.value, sourceBarrier);\n const ordinaryIdentity = reusableSlotIdentityMatches({ target: input.target, sourceExpected: expected, originExpected });\n if (!ordinaryIdentity) {\n const originRun = input.byRunId.get(candidate.origin.runId)!;\n const pureRename = targetMatchesLogicalIdentity(input.target, expected) &&\n originExpected.evalId === input.target.evalId &&\n originExpected.attemptOrdinal === input.target.attempt &&\n executionDigestForExperiment(input.target, originRun.document.experimentId) === originExpected.executionIdentityDigest;\n if (!pureRename)\n return gapSlot(input.target, {\n reason: \"identity-mismatch\", scope: \"slot\", issues: [], sourceBarrier, candidate,\n comparisons: [identityMismatchComparison()],\n });\n if (sourceRun.document.context === undefined || originRun.document.context === undefined ||\n !hasProvenNoExperimentHooks(sourceRun.document.context) ||\n !hasProvenNoExperimentHooks(originRun.document.context))\n return gapSlot(input.target, {\n reason: \"adoption-unproven\", scope: \"slot\", issues: [], sourceBarrier, candidate, comparisons: [],\n });\n const witness = member.bindingRevision === undefined ? undefined : input.runs.find((run) => {\n if (run.document.experimentId !== input.target.experimentId)\n return false;\n const slot = run.document.expectedSlots.find((entry) => targetMatchesLogicalIdentity(input.target, entry));\n if (slot === undefined)\n return false;\n return run.members.some((entry) => entry.document.slotId === slot.slotId && entry.document.action === \"accepted\" &&\n entry.document.attempt !== null && entry.document.attempt.originRunId === candidate.origin.runId &&\n entry.document.attempt.attemptId === candidate.attemptId && entry.bindingRevision !== undefined &&\n entry.bindingRevision <= member.bindingRevision!);\n });\n if (witness === undefined)\n return gapSlot(input.target, {\n reason: \"adoption-unproven\", scope: \"slot\", issues: [], sourceBarrier, candidate, comparisons: [],\n });\n }\n const assertions = yield* input.readAssertions(readAttempt.value);\n if (assertions.state !== \"available\") {\n const problem = attachmentProblem(assertions);\n return gapSlot(input.target, {\n reason: problem.reason,\n scope: \"slot\",\n issues: problem.issues,\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.assertions\", \"assertion-verdict\", problem.state, \"not-comparable\", problem.reason)],\n });\n }\n const verdict = recordedAttemptVerdict({\n outcome: readAttempt.value.document.outcome,\n assertions: assertions.value,\n });\n if (readAttempt.value.document.outcome !== \"completed\") {\n return gapSlot(input.target, {\n reason: \"attempt-outcome-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [\n comparison(\"core\", \"attempt-outcome\", \"available\", \"ineligible\", `attempt-${readAttempt.value.document.outcome}`),\n verdictComparison(verdict, \"ineligible\"),\n ],\n });\n }\n if (input.target.evaluationKind === \"score\") {\n const score = foldRecordedAttemptScore({ outcome: readAttempt.value.document.outcome, assertions: assertions.value });\n if (Result.isFailure(score) || score.success.state !== \"complete\")\n return gapSlot(input.target, {\n reason: \"score-incomplete\", scope: \"slot\", issues: [], sourceBarrier, candidate,\n comparisons: [comparison(\"niceeval.assertions\", \"assertion-verdict\", \"available\", \"ineligible\", \"score-incomplete\")],\n });\n }\n if (verdict !== \"passed\" && verdict !== \"failed\") {\n return gapSlot(input.target, {\n reason: \"verdict-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"ineligible\")],\n });\n }\n const activities = yield* input.readActivities(readAttempt.value);\n if (activities.state !== \"available\") {\n const problem = attachmentProblem(activities);\n return gapSlot(input.target, {\n reason: problem.reason,\n scope: \"slot\",\n issues: problem.issues,\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.runner-activities\", \"execution-duration\", problem.state, \"not-comparable\", problem.reason)],\n });\n }\n const durationRead = readAttemptExecutionDuration(activities.value);\n if (durationRead.state !== \"available\") {\n return gapSlot(input.target, {\n reason: \"source-attachment-unavailable\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.runner-activities\", \"execution-duration\", \"unavailable\", \"not-comparable\", durationRead.reason)],\n });\n }\n const duration = durationComparison({\n source: durationRead.duration,\n target: input.target.timeout,\n });\n if (duration.failure !== undefined) {\n return gapSlot(input.target, {\n reason: duration.failure,\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [duration.comparison],\n });\n }\n if (input.policy.rerun === \"all\"\n || (input.policy.rerun === \"failed\" && verdict === \"failed\")) {\n return gapSlot(input.target, {\n reason: \"rerun-requested\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"match\"), duration.comparison],\n });\n }\n if (input.policy.keepSandbox) {\n return gapSlot(input.target, {\n reason: \"sandbox-retention-requested\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"match\"), duration.comparison],\n });\n }\n return Object.freeze({\n ...input.target,\n state: \"reuse\" as const,\n adoption: \"carried\" as const,\n source: candidate,\n comparisons: Object.freeze([\n comparison(\"core\", \"execution-identity\", \"available\", \"match\", \"execution-identity-match\"),\n comparison(\"core\", \"attempt-outcome\", \"available\", \"match\", \"attempt-completed\"),\n verdictComparison(verdict, \"match\"),\n duration.comparison,\n ]),\n });\n });\n}\nfunction latestSourceRun<Ref>(runs: readonly CurrentAssessmentRun<Ref>[], target: CurrentTargetSlot): CurrentAssessmentRun<Ref> | undefined {\n const candidates = runs.filter((run) => run.document.experimentId === target.experimentId\n // Execution refreshes may see their own already-created pending Run.\n // Logical current targets have no Run identity and keep every barrier.\n && (!(\"runId\" in target) || run.document.runId !== target.runId)\n && run.document.expectedSlots.some((slot) => slot.evalId === target.evalId && slot.attemptOrdinal === target.attempt));\n return candidates.sort((left, right) => {\n const a = left.createdRevision ?? 0, b = right.createdRevision ?? 0;\n return a - b || compareCanonicalIdentity(left.document.runId, right.document.runId);\n }).at(-1);\n}\ninterface CandidateResolution {\n readonly source: ExecutionReusePlanSource;\n readonly originExpected: RecordSlotIdentity;\n}\nfunction hasPublicationIdentity(attempt: ReadableAttempt): attempt is ReadableAttempt & {\n readonly ref: ExecutionReusePlanSource[\"attempt\"];\n} {\n return attempt.ref.publicationIdentity !== undefined;\n}\nfunction candidateFor(input: {\n readonly target: TargetSlot;\n readonly sourceBarrier: ExecutionSourceBarrier;\n readonly attempt: ReadableAttempt & {\n readonly ref: ExecutionReusePlanSource[\"attempt\"];\n };\n readonly byRunId: ReadonlyMap<RunId, ReadableRun>;\n}): CandidateResolution | undefined {\n const document = input.attempt.document;\n const originRun = input.byRunId.get(document.originRunId);\n if (originRun === undefined)\n return undefined;\n const originExpected = originRun.document.expectedSlots.find((slot) => slot.slotId === document.slotId);\n if (originExpected === undefined\n || document.evalId !== originExpected.evalId\n || document.executionIdentityDigest !== originExpected.executionIdentityDigest) {\n return undefined;\n }\n return Object.freeze({\n source: Object.freeze({\n attemptId: input.attempt.ref.attemptId,\n attempt: input.attempt.ref,\n origin: Object.freeze({ runId: document.originRunId, slotId: document.slotId }),\n originRun: originRun.ref,\n sourceBarrier: input.sourceBarrier,\n evaluationKind: input.target.evaluationKind,\n }),\n originExpected,\n });\n}\nfunction sameSlotIdentity(left: RecordSlotIdentity, right: RecordSlotIdentity): boolean {\n return left.slotId === right.slotId\n && left.evalId === right.evalId\n && left.attemptOrdinal === right.attemptOrdinal\n && left.executionIdentityDigest === right.executionIdentityDigest;\n}\n/** Slot IDs are exact references within a Run, not cross-Run equivalence keys. */\nfunction targetMatchesLogicalIdentity(target: CurrentTargetSlot, slot: RecordSlotIdentity): boolean {\n return target.evalId === slot.evalId\n && target.attempt === slot.attemptOrdinal\n && target.executionIdentityDigest === slot.executionIdentityDigest;\n}\nfunction targetMatchesSlotIdentity(target: CurrentTargetSlot, slot: RecordSlotIdentity): boolean {\n return (!(\"slotId\" in target) || target.slotId === slot.slotId)\n && target.evalId === slot.evalId\n && target.attempt === slot.attemptOrdinal\n && target.executionIdentityDigest === slot.executionIdentityDigest;\n}\nfunction reusableSlotIdentityMatches(input: {\n readonly target: CurrentTargetSlot;\n readonly sourceExpected: RecordSlotIdentity;\n readonly originExpected: RecordSlotIdentity;\n}): boolean {\n return sameSlotIdentity(input.sourceExpected, input.originExpected)\n && targetMatchesSlotIdentity(input.target, input.sourceExpected)\n && targetMatchesSlotIdentity(input.target, input.originExpected);\n}\nfunction issuesOf(read: RecordCoreRead<unknown>): readonly RecordIssue[] {\n return read.state === \"core-invalid\" ? read.issues : Object.freeze([]);\n}\nfunction attachmentProblem(input: {\n readonly state: \"not-recorded\" | \"migration-required\" | \"unsupported\" | \"invalid\";\n readonly family?: string;\n readonly schemaVersion?: number;\n readonly issues?: readonly RecordIssue[];\n}): {\n readonly reason: Extract<ExecutionGapReason, \"source-attachment-unavailable\" | \"source-attachment-migration-required\" | \"source-attachment-unsupported\" | \"source-attachment-invalid\">;\n readonly state: Exclude<ExecutionComparisonSourceState, \"available\">;\n readonly issues: readonly RecordIssue[];\n} {\n switch (input.state) {\n case \"not-recorded\":\n return Object.freeze({\n reason: \"source-attachment-unavailable\" as const,\n state: \"unavailable\" as const,\n issues: Object.freeze([]),\n });\n case \"migration-required\":\n return Object.freeze({\n reason: \"source-attachment-migration-required\" as const,\n state: EXECUTION_COMPARISON_PROJECTION_STATE.migrationRequired,\n issues: Object.freeze([]),\n });\n case \"unsupported\":\n return Object.freeze({\n reason: \"source-attachment-unsupported\" as const,\n state: \"unsupported\" as const,\n issues: Object.freeze([]),\n });\n case \"invalid\":\n return Object.freeze({\n reason: \"source-attachment-invalid\" as const,\n state: \"invalid\" as const,\n issues: input.issues ?? Object.freeze([]),\n });\n }\n}\nfunction identityMismatchComparison(): ExecutionComparison {\n return comparison(\"core\", \"execution-identity\", \"available\", \"mismatch\", \"identity-mismatch\");\n}\nfunction verdictComparison(verdict: AssertionsVerdict, result: Extract<ExecutionComparisonResult, \"match\" | \"ineligible\">): ExecutionComparison {\n return comparison(\"niceeval.assertions\", \"assertion-verdict\", \"available\", result, verdict === \"errored\" ? \"verdict-ineligible\" : `verdict-${verdict}`);\n}\nfunction durationComparison(input: {\n readonly source: DurationLimit;\n readonly target: ExecutionDurationLimit | undefined;\n}): {\n readonly comparison: ExecutionComparison;\n readonly failure?: \"duration-domain-mismatch\" | \"timeout-exceeded\";\n} {\n if (input.target === undefined) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"match\", \"timeout-unbounded\"),\n };\n }\n if (input.source.domain !== input.target.domain) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"mismatch\", \"duration-domain-mismatch\"),\n failure: \"duration-domain-mismatch\",\n };\n }\n if (input.source.milliseconds > input.target.milliseconds) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"mismatch\", \"timeout-exceeded\"),\n failure: \"timeout-exceeded\",\n };\n }\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"match\", \"duration-within-timeout\"),\n };\n}\nfunction comparison(attachment: ExecutionComparisonAttachment, recordedClaim: ExecutionRecordedClaim, sourceState: ExecutionComparisonSourceState, result: ExecutionComparisonResult, reason: string): ExecutionComparison {\n return Object.freeze({ attachment, recordedClaim, sourceState, result, reason });\n}\nfunction gapSlot<Target extends CurrentTargetSlot, Source extends CurrentAssessmentSource = ExecutionReusePlanSource>(target: Target, input: {\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly comparisons: readonly ExecutionComparison[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: Source;\n}): Extract<CurrentSlotAssessment<Target, Source>, {\n readonly state: \"gap\";\n}> {\n return Object.freeze({\n ...target,\n state: \"gap\" as const,\n reason: input.reason,\n scope: input.scope,\n issues: Object.freeze([...input.issues]),\n ...(input.sourceBarrier === undefined ? {} : { sourceBarrier: input.sourceBarrier }),\n ...(input.candidate === undefined ? {} : { candidate: input.candidate }),\n comparisons: Object.freeze([...input.comparisons]),\n });\n}\nfunction effectiveOptions(policy: ProjectTargetPolicy): ExecutionReuseEffectiveOptions {\n return Object.freeze({\n rerun: policy.rerun,\n keepSandbox: policy.keepSandbox,\n reuseContract: Object.freeze({\n domain: policy.reuseContract.domain,\n value: policy.reuseContract.value,\n }),\n });\n}\nfunction flattenTargetSlots(target: ExecutionTarget): readonly TargetSlot[] {\n return Object.freeze(target.runs.flatMap((run) => run.slots));\n}\nfunction sourceKey(experimentId: string, evalId: string, ordinal?: string): string {\n return ordinal === undefined\n ? `${experimentId}\\u0000${evalId}`\n : `${experimentId}\\u0000${evalId}\\u0000${ordinal}`;\n}\nfunction invalidPlan(reason: ProjectTargetReusePlanInvalidReason): ProjectTargetReusePlanInvalid {\n return Object.freeze({ code: \"project-target-reuse-plan-invalid\", reason });\n}\nfunction isTargetRun(value: unknown): value is TargetRun {\n if (typeof value !== \"object\" || value === null)\n return false;\n const run = value as Partial<TargetRun>;\n return (typeof run.runId === \"string\"\n && isPortableSegment(run.runId)\n && typeof run.experimentId === \"string\"\n && isBoundedRecordIdentity(run.experimentId)\n && typeof run.startedAt === \"number\"\n && isUtcMillis(run.startedAt)\n && Array.isArray(run.slots));\n}\nfunction isTargetSlot(value: unknown): value is TargetSlot {\n if (typeof value !== \"object\" || value === null)\n return false;\n const slot = value as Partial<TargetSlot>;\n return (typeof slot.runId === \"string\"\n && isPortableSegment(slot.runId)\n && typeof slot.slotId === \"string\"\n && isPortableSegment(slot.slotId)\n && typeof slot.experimentId === \"string\"\n && isBoundedRecordIdentity(slot.experimentId)\n && typeof slot.evalId === \"string\"\n && isBoundedRecordIdentity(slot.evalId)\n && typeof slot.attempt === \"number\"\n && Number.isSafeInteger(slot.attempt)\n && slot.attempt >= 0\n && (slot.evaluationKind === \"pass\" || slot.evaluationKind === \"score\")\n && (slot.reuseEligibility === undefined\n || slot.reuseEligibility === \"adapter-behavior-revision-required\")\n && typeof slot.executionIdentityDigest === \"string\"\n && isSha256Digest(slot.executionIdentityDigest)\n && isExecutionIdentity(slot.inputIdentity)\n && isExecutionIdentity(slot.configIdentity)\n && (slot.timeout === undefined || isExecutionDurationLimit(slot.timeout)));\n}\nfunction isBoundedNonEmptyText(value: string, maximumLength: number): boolean {\n return value.length > 0 && value.length <= maximumLength;\n}\nfunction isBoundedRecordIdentity(value: string): boolean {\n return isBoundedNonEmptyText(value, PROJECT_TARGET_RECORD_IDENTITY_MAXIMUM_LENGTH)\n && !value.includes(\"\\u0000\");\n}\nfunction isRerunOption(value: unknown): value is ProjectTargetPolicy[\"rerun\"] {\n return value === \"none\" || value === \"failed\" || value === \"all\";\n}\nfunction isExecutionIdentity(value: unknown): value is ExecutionIdentity {\n if (typeof value !== \"object\" || value === null)\n return false;\n const identity = value as {\n readonly domain?: unknown;\n readonly value?: unknown;\n };\n return typeof identity.domain === \"string\"\n && isBoundedRecordIdentity(identity.domain)\n && typeof identity.value === \"string\"\n && isBoundedRecordIdentity(identity.value);\n}\nfunction isExecutionDurationLimit(value: unknown): value is ExecutionDurationLimit {\n if (typeof value !== \"object\" || value === null)\n return false;\n const duration = value as {\n readonly domain?: unknown;\n readonly milliseconds?: unknown;\n };\n return typeof duration.domain === \"string\"\n && isBoundedRecordIdentity(duration.domain)\n && typeof duration.milliseconds === \"number\"\n && Number.isFinite(duration.milliseconds)\n && duration.milliseconds >= 0;\n}\n"]}
1
+ {"version":3,"file":"reuse-plan.js","sourceRoot":"","sources":["reuse-plan.ts"],"names":[],"mappings":";;;AA2JA,gEAiBC;AA4DD,wDAKC;AAED,kFA2EC;AAOD,wDAmDC;AAED,oFAuBC;AAqDD,0DA+OC;AAjrBD,qCAAqC;AACrC,wDAAwD;AACxD,gFAAgF;AAChF,qEAAqE;AACrE,mCAAgD;AAChD,0DAAoE;AACpE,0DAA+D;AAC/D,kEAA4H;AAC5H,mEAAkG;AAClG,qDAAmE;AAEnE,sDAAmE;AACnE,6DAAgG;AAEhG,wEAAsF;AAEtF,4DAAwE;AACxE,kEAAoI;AACpI,sFAAiK;AACjK,0DAA2F;AAG3F,mEAAkM;AAIrL,QAAA,0BAA0B,GAAG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AAC;IACF,OAAO,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;WACnC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC;WACxC,OAAO,QAAQ,CAAC,YAAY,KAAK,QAAQ;WACzC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;WACtC,QAAQ,CAAC,YAAY,IAAI,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// @concord-file ne-runner-reuse-plan\n// @concord-implements docs/feature/experiments/cache.md\n// @concord-implements docs/feature/experiments/use-case/cache-explicit-rerun.md\n// @concord-implements docs/feature/experiments/use-case/rerun-all.md\nimport { Effect, Result, Schema } from \"effect\";\nimport { RecordIntegrityFailure } from \"../record/reader/errors.ts\";\nimport { SqliteRecordError } from \"../record/sqlite/errors.ts\";\nimport { detachPlanningReference, selectPlanningSources, type PlanningExactReference } from \"../record/host/sqlite-host.ts\";\nimport { RunIdSchema, ExperimentIdSchema, UtcMillisSchema } from \"../record/codec/identifiers.ts\";\nimport { RecordSlotIdentitySchema } from \"../record/codec/core.ts\";\nimport type { ReadableRunResource } from \"../run/storage/types.ts\";\nimport { foldRecordedAttemptScore } from \"../eval/record/score.ts\";\nimport { executionDigestForExperiment, hasProvenNoExperimentHooks } from \"./rename-identity.ts\";\nimport type { RecordIssue } from \"../record/errors/record-errors.ts\";\nimport { nonEmptyRecordIssues, recordIssue } from \"../record/errors/record-errors.ts\";\nimport type { AssertionsAttachment, } from \"../record/family/assertions/definition.ts\";\nimport { NiceEvalRecordAttachments } from \"../record/family/catalog.ts\";\nimport { readAttemptExecutionDuration, type DurationLimit, type AttemptExecutionTimingFacts, } from \"../eval/record/eligibility.ts\";\nimport { COMPARISON_SOURCE_STATES, type ComparisonAttachment, type ComparisonResult, type RecordedAttemptClaim, } from \"../eval/record/membership-provenance.ts\";\nimport { foldRecordedAttemptVerdict, type VerdictState, } from \"../eval/record/verdict.ts\";\nimport type { RecordReadSession, ReadableAttempt, ReadableRun, SelectedAttemptRef, SelectedRunRef, } from \"../record/host/types.ts\";\nimport type { RecordCoreRead, RecordAttachmentRead } from \"../record/model/read-state.ts\";\nimport { compareCanonicalIdentity, isPortableSegment, isSha256Digest, isUtcMillis, type ExecutionIdentityDigest, type RunId, type SlotId, type UtcMillis, } from \"../record/model/identifiers.ts\";\nimport type { AttemptOutcome, AttemptDocument, MemberDocument, RunDocument, RecordSlotIdentity } from \"../record/model/core.ts\";\nimport type { RecordReaderReadError } from \"../record/reader/errors.ts\";\nimport type { EvaluationKind } from \"./types.ts\";\nexport const PROJECT_TARGET_POLICY_NAME = \"project-target\" as const;\nexport const PROJECT_TARGET_POLICY_VERSION = 2 as const;\nexport const PROJECT_TARGET_INVOCATION_ID_MAXIMUM_LENGTH = 255 as const;\nexport const PROJECT_TARGET_RECORD_IDENTITY_MAXIMUM_LENGTH = 4096 as const;\nexport interface ExecutionPolicyIdentity {\n readonly name: typeof PROJECT_TARGET_POLICY_NAME;\n readonly version: typeof PROJECT_TARGET_POLICY_VERSION;\n}\nexport const projectTargetPolicyIdentity: ExecutionPolicyIdentity = Object.freeze({\n name: PROJECT_TARGET_POLICY_NAME,\n version: PROJECT_TARGET_POLICY_VERSION,\n});\n/** Current planner input, kept in memory rather than persisted as an Attachment. */\nexport interface ExecutionIdentity {\n readonly domain: string;\n readonly value: string;\n}\nexport interface ExecutionDurationLimit {\n readonly domain: string;\n readonly milliseconds: number;\n}\n/**\n * Reuse compares current execution identity with the immutable Core Slot,\n * folds Core outcome with Assertions, and reads duration from Runner Activity\n * receipts. None of these facts is a separate eligibility/verdict family.\n */\nexport const EXECUTION_COMPARISON_PROJECTION_STATE = Object.freeze({\n migrationRequired: \"migration-required\" as const,\n});\nexport const EXECUTION_COMPARISON_SOURCE_STATES = [\n ...COMPARISON_SOURCE_STATES,\n EXECUTION_COMPARISON_PROJECTION_STATE.migrationRequired,\n] as const;\nexport type ExecutionComparisonAttachment = ComparisonAttachment;\nexport type ExecutionComparisonSourceState = (typeof EXECUTION_COMPARISON_SOURCE_STATES)[number];\nexport type ExecutionComparisonResult = ComparisonResult;\nexport type ExecutionRecordedClaim = RecordedAttemptClaim;\nexport interface ExecutionComparison {\n readonly attachment: ExecutionComparisonAttachment;\n readonly recordedClaim: ExecutionRecordedClaim;\n readonly sourceState: ExecutionComparisonSourceState;\n readonly result: ExecutionComparisonResult;\n readonly reason: string;\n}\nexport type ExecutionGapReason = \"no-source-run\" | \"source-slot-missing\" | \"source-member-missing\" | \"source-core-invalid\" | \"source-publication-unavailable\" | \"source-attachment-unavailable\" | \"source-attachment-migration-required\" | \"source-attachment-unsupported\" | \"source-attachment-invalid\" | \"reuse-contract-domain-mismatch\" | \"reuse-contract-mismatch\" | \"identity-mismatch\" | \"identity-domain-mismatch\" | \"duration-domain-mismatch\" | \"timeout-exceeded\" | \"attempt-outcome-ineligible\" | \"adoption-unproven\" | \"verdict-ineligible\" | \"score-incomplete\" | \"adapter-behavior-revision-required\" | \"rerun-requested\" | \"sandbox-retention-requested\";\nexport type ExecutionGapScope = \"slot\" | \"experiment\" | \"target\";\n/** Origin identity is read from the immutable Attempt, never reconstructed. */\nexport interface ExecutionSourceOrigin {\n readonly runId: RunId;\n readonly slotId: SlotId;\n}\n/** The selected Run boundary may itself be a reference Run. */\nexport interface ExecutionSourceBarrier {\n readonly runId: RunId;\n readonly startedAt: UtcMillis;\n}\nexport interface ExecutionReuseEffectiveOptions {\n readonly rerun: \"none\" | \"failed\" | \"all\";\n readonly keepSandbox: boolean;\n readonly reuseContract: ExecutionIdentity;\n}\nexport interface ExecutionTarget {\n readonly invocationId: string;\n readonly runs: readonly TargetRun[];\n}\nexport interface TargetRun {\n readonly runId: RunId;\n readonly experimentId: string;\n readonly startedAt: UtcMillis;\n readonly slots: readonly TargetSlot[];\n}\n/**\n * `slotId` and `executionIdentityDigest` are deterministic current planning\n * facts. A carried Member can therefore point at the exact immutable origin\n * Attempt without an out-of-band provenance Attachment.\n */\nexport interface TargetSlot {\n readonly renameFingerprint?: (experimentId: string) => string | undefined;\n readonly runId: RunId;\n readonly slotId: SlotId;\n readonly experimentId: string;\n readonly evalId: string;\n readonly attempt: number;\n readonly evaluationKind: EvaluationKind;\n readonly executionIdentityDigest: ExecutionIdentityDigest;\n readonly inputIdentity: ExecutionIdentity;\n readonly configIdentity: ExecutionIdentity;\n readonly timeout?: ExecutionDurationLimit;\n /** Current-only eligibility fact; omitted means behavior identity is reusable. */\n readonly reuseEligibility?: \"adapter-behavior-revision-required\";\n}\n/** Logical current input; evaluating it never allocates durable identities. */\nexport type CurrentTargetSlot = Omit<TargetSlot, \"runId\" | \"slotId\">;\nexport interface CurrentAssessmentRun<Ref> {\n readonly createdRevision?: number;\n readonly lifecycle?: Pick<ReadableRunResource, \"state\" | \"slots\">;\n readonly document: Pick<RunDocument, \"runId\" | \"experimentId\" | \"startedAt\" | \"expectedSlots\"> & {\n readonly context?: RunDocument[\"context\"];\n };\n readonly members: readonly {\n readonly document: MemberDocument;\n readonly bindingRevision?: number;\n readonly attempt: Ref | null;\n }[];\n}\nexport interface CurrentAssessmentSource {\n readonly attemptId: AttemptDocument[\"attemptId\"];\n readonly origin: ExecutionSourceOrigin;\n readonly sourceBarrier: ExecutionSourceBarrier;\n}\nexport type CurrentSlotAssessment<Target extends CurrentTargetSlot, Source extends CurrentAssessmentSource> = Target & ({\n readonly state: \"reuse\";\n readonly adoption: \"carried\";\n readonly source: Source;\n readonly comparisons: readonly ExecutionComparison[];\n} | {\n readonly state: \"gap\";\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: Source;\n readonly comparisons: readonly ExecutionComparison[];\n});\nexport interface CurrentAssessmentAttempt {\n readonly document: AttemptDocument;\n readonly publicationAvailable: boolean;\n}\n/** Both consumers retain every expected lifecycle position at one cutoff. */\nexport function mergeCurrentAssessmentRuns<Ref>(runs: readonly CurrentAssessmentRun<Ref>[], resources: readonly ReadableRunResource[]): Effect.Effect<readonly CurrentAssessmentRun<Ref>[], RecordIntegrityFailure> {\n return Effect.map(Effect.forEach(resources, (resource) => {\n const published = runs.find((run) => run.document.runId === resource.runId);\n const lifecycle = Object.freeze({ state: resource.state, slots: resource.slots });\n if (published !== undefined)\n return Effect.succeed(Object.freeze({ ...published, createdRevision: resource.createdRevision, lifecycle }));\n return Schema.decodeUnknownEffect(Schema.Struct({\n runId: RunIdSchema, experimentId: ExperimentIdSchema, startedAt: UtcMillisSchema,\n expectedSlots: Schema.Array(RecordSlotIdentitySchema),\n }))({\n runId: resource.runId, experimentId: resource.experimentId, startedAt: Date.parse(resource.startedAt),\n expectedSlots: resource.slots.map(({ publication: _publication, ...slot }) => slot),\n }).pipe(Effect.map((document): CurrentAssessmentRun<Ref> => Object.freeze({ createdRevision: resource.createdRevision, lifecycle, document, members: Object.freeze([]) })), Effect.mapError(() => new RecordIntegrityFailure({ code: \"record-integrity-failure\", runId: resource.runId, reason: \"core-invalid\" })));\n }, { concurrency: 1 }), (lifecycle) => Object.freeze([\n ...lifecycle,\n ...runs.filter((run) => !resources.some((resource) => resource.runId === run.document.runId)),\n ]));\n}\nexport type AssertionsVerdict = VerdictState;\n/** Read references are consumed during planning; binding uses the detached proof. */\nexport interface ExecutionReusePlanSource {\n readonly reference: PlanningExactReference;\n readonly attemptId: SelectedAttemptRef[\"attemptId\"];\n readonly attempt: SelectedAttemptRef & {\n readonly publicationIdentity: NonNullable<SelectedAttemptRef[\"publicationIdentity\"]>;\n };\n readonly origin: ExecutionSourceOrigin;\n readonly originRun: SelectedRunRef;\n readonly sourceBarrier: ExecutionSourceBarrier;\n readonly evaluationKind: EvaluationKind;\n}\nexport interface ProjectTargetPolicy {\n readonly identity: ExecutionPolicyIdentity;\n readonly reuseContract: ExecutionIdentity;\n readonly rerun: \"none\" | \"failed\" | \"all\";\n readonly keepSandbox: boolean;\n}\nexport interface ExecutionReusePlanSlotBase extends TargetSlot {\n readonly comparisons: readonly ExecutionComparison[];\n}\nexport interface ReusePlanSlot extends ExecutionReusePlanSlotBase {\n readonly state: \"reuse\";\n readonly adoption: \"carried\";\n readonly source: ExecutionReusePlanSource;\n}\nexport interface ExecutionGapSlot extends ExecutionReusePlanSlotBase {\n readonly state: \"gap\";\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: ExecutionReusePlanSource;\n}\nexport type ExecutionReusePlanSlot = ReusePlanSlot | ExecutionGapSlot;\nexport interface ExecutionReusePlan {\n readonly target: ExecutionTarget;\n readonly policy: ExecutionPolicyIdentity;\n readonly effectiveOptions: ExecutionReuseEffectiveOptions;\n readonly slots: readonly ExecutionReusePlanSlot[];\n readonly reuse: readonly ReusePlanSlot[];\n readonly gaps: readonly ExecutionGapSlot[];\n}\nexport interface ProjectTargetReusePlanInput {\n readonly reader: RecordReadSession;\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}\nexport type ProjectTargetReusePlanInvalidReason = \"invocation-id-invalid\" | \"target-run-invalid\" | \"target-run-duplicate\" | \"target-slot-invalid\" | \"target-slot-duplicate\" | \"target-slot-run-mismatch\" | \"target-slot-experiment-mismatch\" | \"target-slot-ordinal-duplicate\" | \"policy-unsupported\" | \"policy-input-invalid\";\nexport interface ProjectTargetReusePlanInvalid {\n readonly code: \"project-target-reuse-plan-invalid\";\n readonly reason: ProjectTargetReusePlanInvalidReason;\n}\n/**\n * Fold the terminal Verdict from the source Attempt's immutable Core outcome\n * and its fixed Assertions facts. This is a projection, not a second durable\n * Verdict family.\n */\nexport function recordedAttemptVerdict(input: {\n readonly outcome: AttemptOutcome;\n readonly assertions: AssertionsAttachment;\n}): AssertionsVerdict {\n return foldRecordedAttemptVerdict(input);\n}\n/** Input validation is pure; it never invents a target Slot or repairs an identity. */\nexport function validateProjectTargetReusePlanInput(input: {\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}): ProjectTargetReusePlanInvalid | undefined {\n const unknownInput: unknown = input;\n if (typeof unknownInput !== \"object\" || unknownInput === null) {\n return invalidPlan(\"target-run-invalid\");\n }\n const envelope = unknownInput as {\n readonly target?: unknown;\n readonly policy?: unknown;\n };\n if (typeof envelope.target !== \"object\" || envelope.target === null) {\n return invalidPlan(\"target-run-invalid\");\n }\n const target = envelope.target as {\n readonly invocationId?: unknown;\n readonly runs?: unknown;\n };\n if (typeof target.invocationId !== \"string\"\n || !isBoundedNonEmptyText(target.invocationId, PROJECT_TARGET_INVOCATION_ID_MAXIMUM_LENGTH)\n || !Array.isArray(target.runs)) {\n return invalidPlan(\"invocation-id-invalid\");\n }\n if (typeof envelope.policy !== \"object\" || envelope.policy === null) {\n return invalidPlan(\"policy-input-invalid\");\n }\n const policy = envelope.policy as {\n readonly identity?: unknown;\n readonly reuseContract?: unknown;\n readonly rerun?: unknown;\n readonly keepSandbox?: unknown;\n };\n if (typeof policy.identity !== \"object\"\n || policy.identity === null\n || (policy.identity as {\n readonly name?: unknown;\n }).name !== PROJECT_TARGET_POLICY_NAME\n || (policy.identity as {\n readonly version?: unknown;\n }).version !== PROJECT_TARGET_POLICY_VERSION) {\n return invalidPlan(\"policy-unsupported\");\n }\n if (!isExecutionIdentity(policy.reuseContract)\n || !isRerunOption(policy.rerun)\n || typeof policy.keepSandbox !== \"boolean\") {\n return invalidPlan(\"policy-input-invalid\");\n }\n const runIds = new Set<string>();\n const slotIds = new Set<string>();\n const ordinals = new Set<string>();\n for (const run of target.runs) {\n if (!isTargetRun(run))\n return invalidPlan(\"target-run-invalid\");\n if (runIds.has(run.runId))\n return invalidPlan(\"target-run-duplicate\");\n runIds.add(run.runId);\n for (const slot of run.slots) {\n if (!isTargetSlot(slot))\n return invalidPlan(\"target-slot-invalid\");\n if (slot.runId !== run.runId)\n return invalidPlan(\"target-slot-run-mismatch\");\n if (slot.experimentId !== run.experimentId) {\n return invalidPlan(\"target-slot-experiment-mismatch\");\n }\n if (slotIds.has(slot.slotId))\n return invalidPlan(\"target-slot-duplicate\");\n slotIds.add(slot.slotId);\n const ordinal = sourceKey(slot.experimentId, slot.evalId, String(slot.attempt));\n if (ordinals.has(ordinal))\n return invalidPlan(\"target-slot-ordinal-duplicate\");\n ordinals.add(ordinal);\n }\n }\n return undefined;\n}\n/**\n * Plans only from Record Host selection references. It neither reconstructs\n * attempt handles from strings nor reads private Record paths.\n */\n// @concord-code ne-runner-plan-reuse\n// @concord-implements docs/feature/experiments/cache.md\nexport function planProjectTargetReuse(input: ProjectTargetReusePlanInput): Effect.Effect<ExecutionReusePlan, ProjectTargetReusePlanInvalid | RecordReaderReadError> {\n return Effect.suspend<ExecutionReusePlan, ProjectTargetReusePlanInvalid | RecordReaderReadError, never>(() => {\n const invalid = validateProjectTargetReusePlanInput(input);\n if (invalid !== undefined)\n return Effect.fail(invalid);\n return Effect.gen(function* () {\n const selected = yield* selectPlanningSources(input.reader, flattenTargetSlots(input.target).map((slot) => ({\n experimentId: slot.experimentId, evalId: slot.evalId, attemptOrdinal: slot.attempt, excludeRunId: slot.runId,\n })));\n const { selection } = selected;\n const readable = yield* Effect.forEach(selection.runRefs, (ref) => input.reader.readRun(ref), { concurrency: 1 });\n const publishedRuns: ReadableRun[] = [];\n const coreIssues: RecordIssue[] = [];\n for (const read of readable) {\n if (read.state === \"available\")\n publishedRuns.push(read.value);\n else if (read.state === \"core-invalid\")\n coreIssues.push(...read.issues);\n }\n const merged = yield* mergeCurrentAssessmentRuns(publishedRuns, selected.resources);\n const runs = merged.map((run) => selected.members.has(run.document.runId)\n ? Object.freeze({ ...run, members: selected.members.get(run.document.runId)! }) : run);\n const byRunId = new Map(publishedRuns.map((run) => [run.document.runId, run] as const));\n const slots: ExecutionReusePlanSlot[] = [];\n for (const target of flattenTargetSlots(input.target)) {\n const sourceProblems = selection.problems.filter((problem) => selected.experimentByRun.get(problem.runId) === target.experimentId);\n const scopedIssues = [...(selected.issuesByExperiment.get(target.experimentId) ?? []),\n ...sourceProblems.map((problem) => recordIssue(\"record-schema-invalid\", [\"run\", problem.runId, problem.code]))];\n slots.push(yield* planTargetSlot({\n reader: input.reader,\n target,\n policy: input.policy,\n runs,\n byRunId,\n selectionHasProblem: scopedIssues.length > 0 || coreIssues.length > 0,\n selectionProblemScope: coreIssues.length > 0 ? \"target\" : \"experiment\",\n coreIssues: [...coreIssues, ...scopedIssues],\n }));\n }\n const reuse = slots.filter((slot): slot is ReusePlanSlot => slot.state === \"reuse\");\n const gaps = slots.filter((slot): slot is ExecutionGapSlot => slot.state === \"gap\");\n return Object.freeze({\n target: input.target,\n policy: projectTargetPolicyIdentity,\n effectiveOptions: effectiveOptions(input.policy),\n slots: Object.freeze(slots),\n reuse: Object.freeze(reuse),\n gaps: Object.freeze(gaps),\n });\n });\n });\n}\n/** Empty or not-yet-created Record roots produce no source capability. */\nexport function planProjectTargetReuseWithoutSources(input: {\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}): Effect.Effect<ExecutionReusePlan, ProjectTargetReusePlanInvalid> {\n return Effect.suspend(() => {\n const invalid = validateProjectTargetReusePlanInput(input);\n if (invalid !== undefined)\n return Effect.fail(invalid);\n const gaps = Object.freeze(flattenTargetSlots(input.target).map((target) => gapSlot(target, {\n reason: target.reuseEligibility ?? \"no-source-run\",\n scope: \"slot\",\n issues: [],\n comparisons: [],\n })));\n return Effect.succeed(Object.freeze({\n target: input.target,\n policy: projectTargetPolicyIdentity,\n effectiveOptions: effectiveOptions(input.policy),\n slots: gaps,\n reuse: Object.freeze([]),\n gaps,\n }));\n });\n}\nexport const ProjectTargetReusePlanner = Object.freeze({ plan: planProjectTargetReuse });\nfunction planTargetSlot(input: {\n readonly reader: RecordReadSession;\n readonly target: TargetSlot;\n readonly policy: ProjectTargetPolicy;\n readonly runs: readonly CurrentAssessmentRun<SelectedAttemptRef>[];\n readonly byRunId: ReadonlyMap<RunId, ReadableRun>;\n readonly selectionHasProblem: boolean;\n readonly selectionProblemScope?: ExecutionGapScope;\n readonly coreIssues: readonly RecordIssue[];\n}): Effect.Effect<ExecutionReusePlanSlot, RecordReaderReadError> {\n return assessCurrentTargetSlot({\n ...input,\n readAttempt: (ref) => input.reader.readAttempt(ref).pipe(Effect.catch((error) => error instanceof RecordIntegrityFailure || error instanceof SqliteRecordError &&\n [\"record-database-invalid\", \"record-content-invalid\", \"record-seal-incomplete\"].includes(error.code)\n ? Effect.succeed({ state: \"core-invalid\" as const,\n issues: nonEmptyRecordIssues([recordIssue(\"record-schema-invalid\", [\"attempt\", String(ref.attemptId), error.code,\n ...(error instanceof RecordIntegrityFailure ? [error.reason] : [])])])! })\n : Effect.fail(error)), Effect.map((read) => read.state !== \"available\" ? read : {\n state: \"available\" as const,\n value: { ...read.value, publicationAvailable: read.value.ref.publicationIdentity !== undefined },\n })),\n readAssertions: (attempt) => planningAttachment(input.reader.read(attempt.owner, NiceEvalRecordAttachments.assertions), \"assertions\"),\n readActivities: (attempt) => planningAttachment(input.reader.read(attempt.owner, NiceEvalRecordAttachments.runnerActivities.attempt), \"runner-activities\"),\n sourceFor: (attempt, sourceBarrier) => {\n if (!hasPublicationIdentity(attempt))\n throw new Error(\"Expected a published Attempt\");\n return candidateFor({ reader: input.reader, target: input.target, sourceBarrier, attempt, byRunId: input.byRunId })!.source;\n },\n });\n}\nfunction planningAttachment<Value>(read: Effect.Effect<RecordAttachmentRead<Value>, RecordReaderReadError>, family: string): Effect.Effect<RecordAttachmentRead<Value>, RecordReaderReadError> {\n return read.pipe(Effect.catch((error) => error instanceof SqliteRecordError &&\n [\"record-database-invalid\", \"record-content-invalid\", \"record-seal-incomplete\"].includes(error.code)\n ? Effect.succeed({ state: \"invalid\" as const,\n issues: nonEmptyRecordIssues([recordIssue(\"record-schema-invalid\", [family, error.code])])! })\n : Effect.fail(error)));\n}\n/** Both read-only current results and execution planning use this assessment. */\nexport interface CurrentAssessmentInput<Ref, Attempt extends CurrentAssessmentAttempt, Source extends CurrentAssessmentSource, Target extends CurrentTargetSlot, Error> {\n readonly target: Target;\n readonly policy: ProjectTargetPolicy;\n readonly runs: readonly CurrentAssessmentRun<Ref>[];\n readonly byRunId: ReadonlyMap<RunId, CurrentAssessmentRun<Ref>>;\n readonly selectionHasProblem: boolean;\n readonly selectionProblemScope?: ExecutionGapScope;\n readonly coreIssues: readonly RecordIssue[];\n readonly readAttempt: (ref: Ref) => Effect.Effect<RecordCoreRead<Attempt>, Error>;\n readonly readAssertions: (attempt: Attempt) => Effect.Effect<RecordAttachmentRead<AssertionsAttachment>, Error>;\n readonly readActivities: (attempt: Attempt) => Effect.Effect<RecordAttachmentRead<AttemptExecutionTimingFacts>, Error>;\n readonly sourceFor: (attempt: Attempt, barrier: ExecutionSourceBarrier) => Source;\n}\nexport function assessCurrentTargetSlot<Ref, Attempt extends CurrentAssessmentAttempt, Source extends CurrentAssessmentSource, Target extends CurrentTargetSlot, Error>(input: CurrentAssessmentInput<Ref, Attempt, Source, Target, Error>): Effect.Effect<CurrentSlotAssessment<Target, Source>, Error> {\n return Effect.gen(function* () {\n if (input.target.reuseEligibility !== undefined) {\n return gapSlot(input.target, {\n reason: input.target.reuseEligibility,\n scope: \"slot\",\n issues: [],\n comparisons: [],\n });\n }\n if (input.selectionHasProblem) {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: input.selectionProblemScope ?? \"target\",\n issues: input.coreIssues,\n comparisons: [],\n });\n }\n const sourceRun = latestSourceRun(input.runs, input.target);\n if (sourceRun === undefined) {\n return gapSlot(input.target, {\n reason: \"no-source-run\",\n scope: \"slot\",\n issues: [],\n comparisons: [],\n });\n }\n const sourceBarrier = Object.freeze({\n runId: sourceRun.document.runId,\n startedAt: sourceRun.document.startedAt,\n });\n const expected = sourceRun.document.expectedSlots.find((slot) => slot.evalId === input.target.evalId\n && slot.attemptOrdinal === input.target.attempt);\n if (expected === undefined) {\n return gapSlot(input.target, {\n reason: \"source-slot-missing\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const member = sourceRun.members.find((candidate) => candidate.document.slotId === expected.slotId);\n if (member === undefined || member.attempt === null) {\n const publication = sourceRun.lifecycle?.slots.find((slot) => slot.slotId === expected.slotId)?.publication;\n return gapSlot(input.target, {\n reason: \"source-member-missing\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: publication?.state === \"pending\" || publication?.state === \"absent\"\n ? [comparison(\"core\", \"attempt-outcome\", \"unavailable\", \"not-comparable\", publication.state === \"pending\" ? \"pending\" : publication.reason)]\n : [],\n });\n }\n const readAttempt = yield* input.readAttempt(member.attempt);\n if (readAttempt.state !== \"available\") {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"slot\",\n issues: issuesOf(readAttempt),\n sourceBarrier,\n comparisons: [],\n });\n }\n if (!readAttempt.value.publicationAvailable) {\n return gapSlot(input.target, {\n reason: \"source-publication-unavailable\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const document = readAttempt.value.document;\n const originRun = input.byRunId.get(document.originRunId);\n const originExpected = originRun?.document.expectedSlots.find((slot) => slot.slotId === document.slotId);\n if (originExpected === undefined || document.evalId !== originExpected.evalId || document.executionIdentityDigest !== originExpected.executionIdentityDigest) {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const candidate = input.sourceFor(readAttempt.value, sourceBarrier);\n const ordinaryIdentity = reusableSlotIdentityMatches({ target: input.target, sourceExpected: expected, originExpected });\n if (!ordinaryIdentity) {\n const originRun = input.byRunId.get(candidate.origin.runId)!;\n const pureRename = targetMatchesLogicalIdentity(input.target, expected) &&\n originExpected.evalId === input.target.evalId &&\n originExpected.attemptOrdinal === input.target.attempt &&\n executionDigestForExperiment(input.target, originRun.document.experimentId) === originExpected.executionIdentityDigest;\n if (!pureRename)\n return gapSlot(input.target, {\n reason: \"identity-mismatch\", scope: \"slot\", issues: [], sourceBarrier, candidate,\n comparisons: [identityMismatchComparison()],\n });\n if (sourceRun.document.context === undefined || originRun.document.context === undefined ||\n !hasProvenNoExperimentHooks(sourceRun.document.context) ||\n !hasProvenNoExperimentHooks(originRun.document.context))\n return gapSlot(input.target, {\n reason: \"adoption-unproven\", scope: \"slot\", issues: [], sourceBarrier, candidate, comparisons: [],\n });\n const witness = member.bindingRevision === undefined ? undefined : input.runs.find((run) => {\n if (run.document.experimentId !== input.target.experimentId)\n return false;\n const slot = run.document.expectedSlots.find((entry) => targetMatchesLogicalIdentity(input.target, entry));\n if (slot === undefined)\n return false;\n return run.members.some((entry) => entry.document.slotId === slot.slotId && entry.document.action === \"accepted\" &&\n entry.document.attempt !== null && entry.document.attempt.originRunId === candidate.origin.runId &&\n entry.document.attempt.attemptId === candidate.attemptId && entry.bindingRevision !== undefined &&\n entry.bindingRevision <= member.bindingRevision!);\n });\n if (witness === undefined)\n return gapSlot(input.target, {\n reason: \"adoption-unproven\", scope: \"slot\", issues: [], sourceBarrier, candidate, comparisons: [],\n });\n }\n const assertions = yield* input.readAssertions(readAttempt.value);\n if (assertions.state !== \"available\") {\n const problem = attachmentProblem(assertions);\n return gapSlot(input.target, {\n reason: problem.reason,\n scope: \"slot\",\n issues: problem.issues,\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.assertions\", \"assertion-verdict\", problem.state, \"not-comparable\", problem.reason)],\n });\n }\n const verdict = recordedAttemptVerdict({\n outcome: readAttempt.value.document.outcome,\n assertions: assertions.value,\n });\n if (readAttempt.value.document.outcome !== \"completed\") {\n return gapSlot(input.target, {\n reason: \"attempt-outcome-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [\n comparison(\"core\", \"attempt-outcome\", \"available\", \"ineligible\", `attempt-${readAttempt.value.document.outcome}`),\n verdictComparison(verdict, \"ineligible\"),\n ],\n });\n }\n if (input.target.evaluationKind === \"score\") {\n const score = foldRecordedAttemptScore({ outcome: readAttempt.value.document.outcome, assertions: assertions.value });\n if (Result.isFailure(score) || score.success.state !== \"complete\")\n return gapSlot(input.target, {\n reason: \"score-incomplete\", scope: \"slot\", issues: [], sourceBarrier, candidate,\n comparisons: [comparison(\"niceeval.assertions\", \"assertion-verdict\", \"available\", \"ineligible\", \"score-incomplete\")],\n });\n }\n if (verdict !== \"passed\" && verdict !== \"failed\") {\n return gapSlot(input.target, {\n reason: \"verdict-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"ineligible\")],\n });\n }\n const activities = yield* input.readActivities(readAttempt.value);\n if (activities.state !== \"available\") {\n const problem = attachmentProblem(activities);\n return gapSlot(input.target, {\n reason: problem.reason,\n scope: \"slot\",\n issues: problem.issues,\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.runner-activities\", \"execution-duration\", problem.state, \"not-comparable\", problem.reason)],\n });\n }\n const durationRead = readAttemptExecutionDuration(activities.value);\n if (durationRead.state !== \"available\") {\n return gapSlot(input.target, {\n reason: \"source-attachment-unavailable\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.runner-activities\", \"execution-duration\", \"unavailable\", \"not-comparable\", durationRead.reason)],\n });\n }\n const duration = durationComparison({\n source: durationRead.duration,\n target: input.target.timeout,\n });\n if (duration.failure !== undefined) {\n return gapSlot(input.target, {\n reason: duration.failure,\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [duration.comparison],\n });\n }\n if (input.policy.rerun === \"all\"\n || (input.policy.rerun === \"failed\" && verdict === \"failed\")) {\n return gapSlot(input.target, {\n reason: \"rerun-requested\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"match\"), duration.comparison],\n });\n }\n if (input.policy.keepSandbox) {\n return gapSlot(input.target, {\n reason: \"sandbox-retention-requested\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"match\"), duration.comparison],\n });\n }\n return Object.freeze({\n ...input.target,\n state: \"reuse\" as const,\n adoption: \"carried\" as const,\n source: candidate,\n comparisons: Object.freeze([\n comparison(\"core\", \"execution-identity\", \"available\", \"match\", \"execution-identity-match\"),\n comparison(\"core\", \"attempt-outcome\", \"available\", \"match\", \"attempt-completed\"),\n verdictComparison(verdict, \"match\"),\n duration.comparison,\n ]),\n });\n });\n}\nfunction latestSourceRun<Ref>(runs: readonly CurrentAssessmentRun<Ref>[], target: CurrentTargetSlot): CurrentAssessmentRun<Ref> | undefined {\n const candidates = runs.filter((run) => run.document.experimentId === target.experimentId\n // Execution refreshes may see their own already-created pending Run.\n // Logical current targets have no Run identity and keep every barrier.\n && (!(\"runId\" in target) || run.document.runId !== target.runId)\n && run.document.expectedSlots.some((slot) => slot.evalId === target.evalId && slot.attemptOrdinal === target.attempt));\n return candidates.sort((left, right) => {\n const a = left.createdRevision ?? 0, b = right.createdRevision ?? 0;\n return a - b || compareCanonicalIdentity(left.document.runId, right.document.runId);\n }).at(-1);\n}\ninterface CandidateResolution {\n readonly source: ExecutionReusePlanSource;\n readonly originExpected: RecordSlotIdentity;\n}\nfunction hasPublicationIdentity(attempt: ReadableAttempt): attempt is ReadableAttempt & {\n readonly ref: ExecutionReusePlanSource[\"attempt\"];\n} {\n return attempt.ref.publicationIdentity !== undefined;\n}\nfunction candidateFor(input: {\n readonly reader: RecordReadSession;\n readonly target: TargetSlot;\n readonly sourceBarrier: ExecutionSourceBarrier;\n readonly attempt: ReadableAttempt & {\n readonly ref: ExecutionReusePlanSource[\"attempt\"];\n };\n readonly byRunId: ReadonlyMap<RunId, ReadableRun>;\n}): CandidateResolution | undefined {\n const document = input.attempt.document;\n const originRun = input.byRunId.get(document.originRunId);\n if (originRun === undefined)\n return undefined;\n const originExpected = originRun.document.expectedSlots.find((slot) => slot.slotId === document.slotId);\n if (originExpected === undefined\n || document.evalId !== originExpected.evalId\n || document.executionIdentityDigest !== originExpected.executionIdentityDigest) {\n return undefined;\n }\n const reference = detachPlanningReference(input.reader, input.attempt.ref);\n if (reference === undefined)\n return undefined;\n return Object.freeze({\n source: Object.freeze({\n reference,\n attemptId: input.attempt.ref.attemptId,\n attempt: input.attempt.ref,\n origin: Object.freeze({ runId: document.originRunId, slotId: document.slotId }),\n originRun: originRun.ref,\n sourceBarrier: input.sourceBarrier,\n evaluationKind: input.target.evaluationKind,\n }),\n originExpected,\n });\n}\nfunction sameSlotIdentity(left: RecordSlotIdentity, right: RecordSlotIdentity): boolean {\n return left.slotId === right.slotId\n && left.evalId === right.evalId\n && left.attemptOrdinal === right.attemptOrdinal\n && left.executionIdentityDigest === right.executionIdentityDigest;\n}\n/** Slot IDs are exact references within a Run, not cross-Run equivalence keys. */\nfunction targetMatchesLogicalIdentity(target: CurrentTargetSlot, slot: RecordSlotIdentity): boolean {\n return target.evalId === slot.evalId\n && target.attempt === slot.attemptOrdinal\n && target.executionIdentityDigest === slot.executionIdentityDigest;\n}\nfunction targetMatchesSlotIdentity(target: CurrentTargetSlot, slot: RecordSlotIdentity): boolean {\n return (!(\"slotId\" in target) || target.slotId === slot.slotId)\n && target.evalId === slot.evalId\n && target.attempt === slot.attemptOrdinal\n && target.executionIdentityDigest === slot.executionIdentityDigest;\n}\nfunction reusableSlotIdentityMatches(input: {\n readonly target: CurrentTargetSlot;\n readonly sourceExpected: RecordSlotIdentity;\n readonly originExpected: RecordSlotIdentity;\n}): boolean {\n return sameSlotIdentity(input.sourceExpected, input.originExpected)\n && targetMatchesSlotIdentity(input.target, input.sourceExpected)\n && targetMatchesSlotIdentity(input.target, input.originExpected);\n}\nfunction issuesOf(read: RecordCoreRead<unknown>): readonly RecordIssue[] {\n return read.state === \"core-invalid\" ? read.issues : Object.freeze([]);\n}\nfunction attachmentProblem(input: {\n readonly state: \"not-recorded\" | \"migration-required\" | \"unsupported\" | \"invalid\";\n readonly family?: string;\n readonly schemaVersion?: number;\n readonly issues?: readonly RecordIssue[];\n}): {\n readonly reason: Extract<ExecutionGapReason, \"source-attachment-unavailable\" | \"source-attachment-migration-required\" | \"source-attachment-unsupported\" | \"source-attachment-invalid\">;\n readonly state: Exclude<ExecutionComparisonSourceState, \"available\">;\n readonly issues: readonly RecordIssue[];\n} {\n switch (input.state) {\n case \"not-recorded\":\n return Object.freeze({\n reason: \"source-attachment-unavailable\" as const,\n state: \"unavailable\" as const,\n issues: Object.freeze([]),\n });\n case \"migration-required\":\n return Object.freeze({\n reason: \"source-attachment-migration-required\" as const,\n state: EXECUTION_COMPARISON_PROJECTION_STATE.migrationRequired,\n issues: Object.freeze([]),\n });\n case \"unsupported\":\n return Object.freeze({\n reason: \"source-attachment-unsupported\" as const,\n state: \"unsupported\" as const,\n issues: Object.freeze([]),\n });\n case \"invalid\":\n return Object.freeze({\n reason: \"source-attachment-invalid\" as const,\n state: \"invalid\" as const,\n issues: input.issues ?? Object.freeze([]),\n });\n }\n}\nfunction identityMismatchComparison(): ExecutionComparison {\n return comparison(\"core\", \"execution-identity\", \"available\", \"mismatch\", \"identity-mismatch\");\n}\nfunction verdictComparison(verdict: AssertionsVerdict, result: Extract<ExecutionComparisonResult, \"match\" | \"ineligible\">): ExecutionComparison {\n return comparison(\"niceeval.assertions\", \"assertion-verdict\", \"available\", result, verdict === \"errored\" ? \"verdict-ineligible\" : `verdict-${verdict}`);\n}\nfunction durationComparison(input: {\n readonly source: DurationLimit;\n readonly target: ExecutionDurationLimit | undefined;\n}): {\n readonly comparison: ExecutionComparison;\n readonly failure?: \"duration-domain-mismatch\" | \"timeout-exceeded\";\n} {\n if (input.target === undefined) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"match\", \"timeout-unbounded\"),\n };\n }\n if (input.source.domain !== input.target.domain) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"mismatch\", \"duration-domain-mismatch\"),\n failure: \"duration-domain-mismatch\",\n };\n }\n if (input.source.milliseconds > input.target.milliseconds) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"mismatch\", \"timeout-exceeded\"),\n failure: \"timeout-exceeded\",\n };\n }\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"match\", \"duration-within-timeout\"),\n };\n}\nfunction comparison(attachment: ExecutionComparisonAttachment, recordedClaim: ExecutionRecordedClaim, sourceState: ExecutionComparisonSourceState, result: ExecutionComparisonResult, reason: string): ExecutionComparison {\n return Object.freeze({ attachment, recordedClaim, sourceState, result, reason });\n}\nfunction gapSlot<Target extends CurrentTargetSlot, Source extends CurrentAssessmentSource = ExecutionReusePlanSource>(target: Target, input: {\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly comparisons: readonly ExecutionComparison[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: Source;\n}): Extract<CurrentSlotAssessment<Target, Source>, {\n readonly state: \"gap\";\n}> {\n return Object.freeze({\n ...target,\n state: \"gap\" as const,\n reason: input.reason,\n scope: input.scope,\n issues: Object.freeze([...input.issues]),\n ...(input.sourceBarrier === undefined ? {} : { sourceBarrier: input.sourceBarrier }),\n ...(input.candidate === undefined ? {} : { candidate: input.candidate }),\n comparisons: Object.freeze([...input.comparisons]),\n });\n}\nfunction effectiveOptions(policy: ProjectTargetPolicy): ExecutionReuseEffectiveOptions {\n return Object.freeze({\n rerun: policy.rerun,\n keepSandbox: policy.keepSandbox,\n reuseContract: Object.freeze({\n domain: policy.reuseContract.domain,\n value: policy.reuseContract.value,\n }),\n });\n}\nfunction flattenTargetSlots(target: ExecutionTarget): readonly TargetSlot[] {\n return Object.freeze(target.runs.flatMap((run) => run.slots));\n}\nfunction sourceKey(experimentId: string, evalId: string, ordinal?: string): string {\n return ordinal === undefined\n ? `${experimentId}\\u0000${evalId}`\n : `${experimentId}\\u0000${evalId}\\u0000${ordinal}`;\n}\nfunction invalidPlan(reason: ProjectTargetReusePlanInvalidReason): ProjectTargetReusePlanInvalid {\n return Object.freeze({ code: \"project-target-reuse-plan-invalid\", reason });\n}\nfunction isTargetRun(value: unknown): value is TargetRun {\n if (typeof value !== \"object\" || value === null)\n return false;\n const run = value as Partial<TargetRun>;\n return (typeof run.runId === \"string\"\n && isPortableSegment(run.runId)\n && typeof run.experimentId === \"string\"\n && isBoundedRecordIdentity(run.experimentId)\n && typeof run.startedAt === \"number\"\n && isUtcMillis(run.startedAt)\n && Array.isArray(run.slots));\n}\nfunction isTargetSlot(value: unknown): value is TargetSlot {\n if (typeof value !== \"object\" || value === null)\n return false;\n const slot = value as Partial<TargetSlot>;\n return (typeof slot.runId === \"string\"\n && isPortableSegment(slot.runId)\n && typeof slot.slotId === \"string\"\n && isPortableSegment(slot.slotId)\n && typeof slot.experimentId === \"string\"\n && isBoundedRecordIdentity(slot.experimentId)\n && typeof slot.evalId === \"string\"\n && isBoundedRecordIdentity(slot.evalId)\n && typeof slot.attempt === \"number\"\n && Number.isSafeInteger(slot.attempt)\n && slot.attempt >= 0\n && (slot.evaluationKind === \"pass\" || slot.evaluationKind === \"score\")\n && (slot.reuseEligibility === undefined\n || slot.reuseEligibility === \"adapter-behavior-revision-required\")\n && typeof slot.executionIdentityDigest === \"string\"\n && isSha256Digest(slot.executionIdentityDigest)\n && isExecutionIdentity(slot.inputIdentity)\n && isExecutionIdentity(slot.configIdentity)\n && (slot.timeout === undefined || isExecutionDurationLimit(slot.timeout)));\n}\nfunction isBoundedNonEmptyText(value: string, maximumLength: number): boolean {\n return value.length > 0 && value.length <= maximumLength;\n}\nfunction isBoundedRecordIdentity(value: string): boolean {\n return isBoundedNonEmptyText(value, PROJECT_TARGET_RECORD_IDENTITY_MAXIMUM_LENGTH)\n && !value.includes(\"\\u0000\");\n}\nfunction isRerunOption(value: unknown): value is ProjectTargetPolicy[\"rerun\"] {\n return value === \"none\" || value === \"failed\" || value === \"all\";\n}\nfunction isExecutionIdentity(value: unknown): value is ExecutionIdentity {\n if (typeof value !== \"object\" || value === null)\n return false;\n const identity = value as {\n readonly domain?: unknown;\n readonly value?: unknown;\n };\n return typeof identity.domain === \"string\"\n && isBoundedRecordIdentity(identity.domain)\n && typeof identity.value === \"string\"\n && isBoundedRecordIdentity(identity.value);\n}\nfunction isExecutionDurationLimit(value: unknown): value is ExecutionDurationLimit {\n if (typeof value !== \"object\" || value === null)\n return false;\n const duration = value as {\n readonly domain?: unknown;\n readonly milliseconds?: unknown;\n };\n return typeof duration.domain === \"string\"\n && isBoundedRecordIdentity(duration.domain)\n && typeof duration.milliseconds === \"number\"\n && Number.isFinite(duration.milliseconds)\n && duration.milliseconds >= 0;\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import { RecordIntegrityFailure } from "../record/reader/errors.cjs";
3
+ import { type PlanningExactReference } from "../record/host/sqlite-host.cjs";
3
4
  import type { ReadableRunResource } from "../run/storage/types.cjs";
4
5
  import type { RecordIssue } from "../record/errors/record-errors.cjs";
5
6
  import type { AssertionsAttachment } from "../record/family/assertions/definition.cjs";
@@ -137,8 +138,9 @@ export interface CurrentAssessmentAttempt {
137
138
  /** Both consumers retain every expected lifecycle position at one cutoff. */
138
139
  export declare function mergeCurrentAssessmentRuns<Ref>(runs: readonly CurrentAssessmentRun<Ref>[], resources: readonly ReadableRunResource[]): Effect.Effect<readonly CurrentAssessmentRun<Ref>[], RecordIntegrityFailure>;
139
140
  export type AssertionsVerdict = VerdictState;
140
- /** The exact selection-issued references remain live only while its reader Scope is live. */
141
+ /** Read references are consumed during planning; binding uses the detached proof. */
141
142
  export interface ExecutionReusePlanSource {
143
+ readonly reference: PlanningExactReference;
142
144
  readonly attemptId: SelectedAttemptRef["attemptId"];
143
145
  readonly attempt: SelectedAttemptRef & {
144
146
  readonly publicationIdentity: NonNullable<SelectedAttemptRef["publicationIdentity"]>;
@@ -223,6 +225,7 @@ export interface CurrentAssessmentInput<Ref, Attempt extends CurrentAssessmentAt
223
225
  readonly runs: readonly CurrentAssessmentRun<Ref>[];
224
226
  readonly byRunId: ReadonlyMap<RunId, CurrentAssessmentRun<Ref>>;
225
227
  readonly selectionHasProblem: boolean;
228
+ readonly selectionProblemScope?: ExecutionGapScope;
226
229
  readonly coreIssues: readonly RecordIssue[];
227
230
  readonly readAttempt: (ref: Ref) => Effect.Effect<RecordCoreRead<Attempt>, Error>;
228
231
  readonly readAssertions: (attempt: Attempt) => Effect.Effect<RecordAttachmentRead<AssertionsAttachment>, Error>;
@@ -1,5 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import { RecordIntegrityFailure } from "../record/reader/errors.mjs";
3
+ import { type PlanningExactReference } from "../record/host/sqlite-host.mjs";
3
4
  import type { ReadableRunResource } from "../run/storage/types.mjs";
4
5
  import type { RecordIssue } from "../record/errors/record-errors.mjs";
5
6
  import type { AssertionsAttachment } from "../record/family/assertions/definition.mjs";
@@ -137,8 +138,9 @@ export interface CurrentAssessmentAttempt {
137
138
  /** Both consumers retain every expected lifecycle position at one cutoff. */
138
139
  export declare function mergeCurrentAssessmentRuns<Ref>(runs: readonly CurrentAssessmentRun<Ref>[], resources: readonly ReadableRunResource[]): Effect.Effect<readonly CurrentAssessmentRun<Ref>[], RecordIntegrityFailure>;
139
140
  export type AssertionsVerdict = VerdictState;
140
- /** The exact selection-issued references remain live only while its reader Scope is live. */
141
+ /** Read references are consumed during planning; binding uses the detached proof. */
141
142
  export interface ExecutionReusePlanSource {
143
+ readonly reference: PlanningExactReference;
142
144
  readonly attemptId: SelectedAttemptRef["attemptId"];
143
145
  readonly attempt: SelectedAttemptRef & {
144
146
  readonly publicationIdentity: NonNullable<SelectedAttemptRef["publicationIdentity"]>;
@@ -223,6 +225,7 @@ export interface CurrentAssessmentInput<Ref, Attempt extends CurrentAssessmentAt
223
225
  readonly runs: readonly CurrentAssessmentRun<Ref>[];
224
226
  readonly byRunId: ReadonlyMap<RunId, CurrentAssessmentRun<Ref>>;
225
227
  readonly selectionHasProblem: boolean;
228
+ readonly selectionProblemScope?: ExecutionGapScope;
226
229
  readonly coreIssues: readonly RecordIssue[];
227
230
  readonly readAttempt: (ref: Ref) => Effect.Effect<RecordCoreRead<Attempt>, Error>;
228
231
  readonly readAssertions: (attempt: Attempt) => Effect.Effect<RecordAttachmentRead<AssertionsAttachment>, Error>;
@@ -1,5 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import { RecordIntegrityFailure } from "../record/reader/errors.js";
3
+ import { type PlanningExactReference } from "../record/host/sqlite-host.js";
3
4
  import type { ReadableRunResource } from "../run/storage/types.js";
4
5
  import type { RecordIssue } from "../record/errors/record-errors.js";
5
6
  import type { AssertionsAttachment } from "../record/family/assertions/definition.js";
@@ -137,8 +138,9 @@ export interface CurrentAssessmentAttempt {
137
138
  /** Both consumers retain every expected lifecycle position at one cutoff. */
138
139
  export declare function mergeCurrentAssessmentRuns<Ref>(runs: readonly CurrentAssessmentRun<Ref>[], resources: readonly ReadableRunResource[]): Effect.Effect<readonly CurrentAssessmentRun<Ref>[], RecordIntegrityFailure>;
139
140
  export type AssertionsVerdict = VerdictState;
140
- /** The exact selection-issued references remain live only while its reader Scope is live. */
141
+ /** Read references are consumed during planning; binding uses the detached proof. */
141
142
  export interface ExecutionReusePlanSource {
143
+ readonly reference: PlanningExactReference;
142
144
  readonly attemptId: SelectedAttemptRef["attemptId"];
143
145
  readonly attempt: SelectedAttemptRef & {
144
146
  readonly publicationIdentity: NonNullable<SelectedAttemptRef["publicationIdentity"]>;
@@ -223,6 +225,7 @@ export interface CurrentAssessmentInput<Ref, Attempt extends CurrentAssessmentAt
223
225
  readonly runs: readonly CurrentAssessmentRun<Ref>[];
224
226
  readonly byRunId: ReadonlyMap<RunId, CurrentAssessmentRun<Ref>>;
225
227
  readonly selectionHasProblem: boolean;
228
+ readonly selectionProblemScope?: ExecutionGapScope;
226
229
  readonly coreIssues: readonly RecordIssue[];
227
230
  readonly readAttempt: (ref: Ref) => Effect.Effect<RecordCoreRead<Attempt>, Error>;
228
231
  readonly readAssertions: (attempt: Attempt) => Effect.Effect<RecordAttachmentRead<AssertionsAttachment>, Error>;
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SETUP_PREFIX_CAPTURE_REVISION = exports.SETUP_PREFIX_QUIESCE_REVISION = exports.SETUP_PREFIX_INTERPRETER_REVISION = exports.SETUP_PREFIX_STORAGE_REVISION = void 0;
3
+ exports.SETUP_PREFIX_QUIESCE_REVISION = exports.SETUP_PREFIX_INTERPRETER_REVISION = void 0;
4
4
  exports.plannedSetupPrefixActions = plannedSetupPrefixActions;
5
5
  exports.setupPrefixOperation = setupPrefixOperation;
6
6
  const node_crypto_1 = require("node:crypto");
7
7
  const action_ts_1 = require("../sandbox/action.cjs");
8
8
  const identity_ts_1 = require("../sandbox/identity.cjs");
9
- exports.SETUP_PREFIX_STORAGE_REVISION = "niceeval.setup-prefix-storage/v2";
10
9
  exports.SETUP_PREFIX_INTERPRETER_REVISION = "niceeval.sandbox-step-interpreter/v1";
11
10
  exports.SETUP_PREFIX_QUIESCE_REVISION = "niceeval.setup-prefix-quiesce/v1";
12
- exports.SETUP_PREFIX_CAPTURE_REVISION = "niceeval.setup-prefix-capture/v1";
13
11
  /**
14
12
  * The one provider-neutral SetupPrefix key planner. CaseKey, BuildKey and an
15
13
  * occurrence cohort deliberately stay out of this identity: the exact Base,
@@ -17,13 +15,8 @@ exports.SETUP_PREFIX_CAPTURE_REVISION = "niceeval.setup-prefix-capture/v1";
17
15
  */
18
16
  function plannedSetupPrefixActions(plan, entries, eligibility) {
19
17
  const baseImageId = eligibility.baseImageId;
20
- const keyScope = eligibility.keyScope ?? Object.freeze({
21
- protocol: "niceeval-docker-rootfs-setup-prefix/v1",
22
- storageSchemaRevision: exports.SETUP_PREFIX_STORAGE_REVISION,
23
- artifactFormatRevision: exports.SETUP_PREFIX_CAPTURE_REVISION,
24
- semanticIdentity: Object.freeze({ capture: "outer-writable-rootfs" }),
25
- });
26
- const keyScopeIdentity = keyScope;
18
+ const keyScope = eligibility.keyScope;
19
+ const keyScopeIdentity = { ...keyScope };
27
20
  const provider = plan.providerPlan;
28
21
  const targetIdentity = {
29
22
  source: provider.target.source,
@@ -76,8 +69,20 @@ function plannedSetupPrefixActions(plan, entries, eligibility) {
76
69
  declaredState: entry.data.plan.state,
77
70
  cumulativeState,
78
71
  input: entry.data.plan.input,
79
- fingerprint: entry.data.plan.fingerprint,
80
- steps: entry.data.plan.steps,
72
+ fingerprint: { ...entry.data.plan.fingerprint },
73
+ steps: entry.data.plan.steps.map((step) => {
74
+ if (step.kind === "exec") {
75
+ const { args, envKeys, ...fields } = step;
76
+ return { ...fields, args: [...args], ...(envKeys === undefined ? {} : { envKeys: [...envKeys] }) };
77
+ }
78
+ if (step.kind === "checkoutGit") {
79
+ const { sparse, ...fields } = step;
80
+ return { ...fields, ...(sparse === undefined ? {} : {
81
+ sparse: { include: [...sparse.include], exclude: [...sparse.exclude] },
82
+ }) };
83
+ }
84
+ return { ...step };
85
+ }),
81
86
  },
82
87
  }));
83
88
  const declarationMetadata = Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"setup-prefix-plan.js","sourceRoot":"","sources":["setup-prefix-plan.ts"],"names":[],"mappings":";;;AAuBA,8DAiHC;AACD,oDAQC;AAjJD,6CAAyC;AAGzC,oDAAwF;AACxF,wDAAkD;AAGrC,QAAA,6BAA6B,GAAG,kCAAkC,CAAC;AACnE,QAAA,iCAAiC,GAAG,sCAAsC,CAAC;AAC3E,QAAA,6BAA6B,GAAG,kCAAkC,CAAC;AACnE,QAAA,6BAA6B,GAAG,kCAAkC,CAAC;AAQhF;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,IAExC,EAAE,OAEA,EAAE,WAEJ;IACE,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;IAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC;QACnD,QAAQ,EAAE,wCAAwC;QAClD,qBAAqB,EA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SAAS,GAAG,GAAG,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AACD,SAAgB,oBAAoB,CAAC,OAAiC,EAAE,oBAAwC;IAC5G,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,gBAAgB,IAAA,wBAAU,GAAE,EAAE;QAC3C,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,GAAG,CAAC,oBAAoB,KAAK,SAAS,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC;YACvE,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,EAAE,CAAC;KAC5E,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { JsonValue } from \"../shared/types.ts\";\nimport { type SandboxSetupPrefixCacheEligibility, type SandboxSetupPrefixCacheManifest, type SandboxSetupPrefixCacheOperation, } from \"../sandbox/backend.ts\";\nimport { mergeSandboxActionState, type SandboxActionState } from \"../sandbox/action.ts\";\nimport { digestOf } from \"../sandbox/identity.ts\";\nimport type { ScheduledSandboxBefore } from \"../sandbox/link.ts\";\nimport type { LinkedRunPlan } from \"../sandbox/plan.ts\";\nexport const SETUP_PREFIX_STORAGE_REVISION = \"niceeval.setup-prefix-storage/v2\";\nexport const SETUP_PREFIX_INTERPRETER_REVISION = \"niceeval.sandbox-step-interpreter/v1\";\nexport const SETUP_PREFIX_QUIESCE_REVISION = \"niceeval.setup-prefix-quiesce/v1\";\nexport const SETUP_PREFIX_CAPTURE_REVISION = \"niceeval.setup-prefix-capture/v1\";\nexport interface PlannedSetupPrefixAction {\n readonly entry: Extract<ScheduledSandboxBefore, {\n readonly kind: \"action\";\n }>;\n readonly key: string;\n readonly manifest: SandboxSetupPrefixCacheManifest;\n}\n/**\n * The one provider-neutral SetupPrefix key planner. CaseKey, BuildKey and an\n * occurrence cohort deliberately stay out of this identity: the exact Base,\n * provider preparation identity and ordered action declarations are sufficient.\n */\nexport function plannedSetupPrefixActions(plan: Extract<LinkedRunPlan, {\n readonly _tag: \"Sandbox\";\n}>, entries: readonly Extract<ScheduledSandboxBefore, {\n readonly kind: \"action\";\n}>[], eligibility: Extract<SandboxSetupPrefixCacheEligibility, {\n readonly _tag: \"Eligible\";\n}>): readonly PlannedSetupPrefixAction[] {\n const baseImageId = eligibility.baseImageId;\n const keyScope = eligibility.keyScope ?? Object.freeze({\n protocol: \"niceeval-docker-rootfs-setup-prefix/v1\",\n storageSchemaRevision: SETUP_PREFIX_STORAGE_REVISION,\n artifactFormatRevision: SETUP_PREFIX_CAPTURE_REVISION,\n semanticIdentity: Object.freeze({ capture: \"outer-writable-rootfs\" }),\n });\n const keyScopeIdentity = keyScope as unknown as JsonValue;\n const provider = plan.providerPlan;\n const targetIdentity = {\n source: provider.target.source,\n platform: { ...provider.target.platform },\n } as unknown as JsonValue;\n const revisions = Object.freeze({\n storage: keyScope.storageSchemaRevision,\n interpreter: SETUP_PREFIX_INTERPRETER_REVISION,\n quiesce: SETUP_PREFIX_QUIESCE_REVISION,\n capture: keyScope.artifactFormatRevision,\n });\n let parentKey = `base:${digestOf({\n protocol: \"niceeval.setup-prefix-key/v2\",\n baseImageId,\n provider: {\n id: provider.provider,\n plannerRevision: provider.plannerRevision,\n },\n target: targetIdentity,\n revisions,\n preparationIdentity: keyScopeIdentity,\n })}`;\n const planned: PlannedSetupPrefixAction[] = [];\n const actionManifest: JsonValue[] = [];\n let cumulativeState: SandboxActionState | undefined;\n for (const entry of entries) {\n cumulativeState = mergeSandboxActionState(cumulativeState, entry.data.plan.state);\n actionManifest.push(Object.freeze({\n owner: {\n kind: entry.owner.kind,\n id: entry.owner.id,\n ordinal: entry.ordinal,\n },\n order: entry.executionOrder.topologicalOrdinal,\n changeFrequency: {\n value: entry.metadata.changeFrequency.value,\n source: entry.metadata.changeFrequency.source,\n ...(entry.metadata.changeFrequency.preset === undefined\n ? {}\n : { preset: entry.metadata.changeFrequency.preset }),\n },\n dependencyEdges: entry.dependencies.map((dependency) => ({ ...dependency })),\n capabilities: {\n requires: [...entry.metadata.requires],\n provides: [...entry.metadata.provides],\n },\n action: {\n id: entry.data.plan.id,\n family: entry.data.plan.family,\n declaredState: entry.data.plan.state,\n cumulativeState,\n input: entry.data.plan.input,\n fingerprint: entry.data.plan.fingerprint,\n steps: entry.data.plan.steps,\n },\n }) as unknown as JsonValue);\n const declarationMetadata = Object.freeze({\n protocol: \"niceeval.setup-prefix-manifest/v2\",\n parentKey,\n baseImageId,\n provider: {\n id: provider.provider,\n plannerRevision: provider.plannerRevision,\n },\n actionManifest: [...actionManifest],\n // Replacement collapses only physical generations of the exact declared\n // content. Different canonical inputs remain independently addressable.\n replacementScope: Object.freeze({\n protocol: \"niceeval.setup-prefix-replacement/v2\",\n baseImageId,\n provider: {\n id: provider.provider,\n plannerRevision: provider.plannerRevision,\n },\n target: targetIdentity,\n preparationIdentity: keyScopeIdentity,\n actionManifest: [...actionManifest],\n }),\n requiredState: cumulativeState,\n target: targetIdentity,\n revisions,\n preparationIdentity: keyScopeIdentity,\n }) as unknown as JsonValue;\n const key = `prefix:${digestOf(declarationMetadata)}`;\n const manifest: SandboxSetupPrefixCacheManifest = Object.freeze({\n baseImageId,\n setupPrefixKey: key,\n setupManifestDigest: `sha256:${digestOf(declarationMetadata)}`,\n requiredState: cumulativeState,\n storageSchemaRevision: keyScope.storageSchemaRevision,\n artifactFormatRevision: keyScope.artifactFormatRevision,\n changeFrequency: entry.metadata.changeFrequency.value,\n declarationMetadata,\n });\n planned.push(Object.freeze({ entry, key, manifest }));\n parentKey = key;\n }\n return Object.freeze(planned);\n}\nexport function setupPrefixOperation(planned: PlannedSetupPrefixAction, knownSensitiveValues?: readonly string[]): SandboxSetupPrefixCacheOperation {\n return Object.freeze({\n operationId: `setup-prefix-${randomUUID()}`,\n manifest: planned.manifest,\n ...(knownSensitiveValues === undefined || knownSensitiveValues.length === 0\n ? {}\n : { knownSensitiveValues: Object.freeze([...knownSensitiveValues]) }),\n });\n}\n"]}
1
+ {"version":3,"file":"setup-prefix-plan.js","sourceRoot":"","sources":["setup-prefix-plan.ts"],"names":[],"mappings":";;;AAqBA,8DAwHC;AACD,oDAQC;AAtJD,6CAAyC;AAGzC,oDAAwF;AACxF,wDAAkD;AAGrC,QAAA,iCAAiC,GAAG,sCAAsC,CAAC;AAC3E,QAAA,6BAA6B,GAAG,kCAAkC,CAAC;AAQhF;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,IAExC,EAAE,OAEA,EAAE,WAEJ;IACE,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;IAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;IACtC,MAAM,gBAAgB,GAAc,EAAE,GAAG,QAAQ,EAAE,CAAC;IACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;IACnC,MAAM,cAAc,GAAc;QAC9B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM;QAC9B,QAAQ,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;KAC5C,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,OAAO,EAAE,QAAQ,CAAC,qBAAqB;QACvC,WAAW,EAAE,yCAAiC;QAC9C,OAAO,EAAE,qCAA6B;QACtC,OAAO,EAAE,QAAQ,CAAC,sBAAsB;KAC3C,CAAC,CAAC;IACH,IAAI,SAAS,GAAG,QAAQ,IAAA,sBAAQ,EAAC;QAC7B,QAAQ,EAAE,8BAA8B;QACxC,WAAW;QACX,QAAQ,EAAE;YACN,EAAE,EAAE,QAAQ,CAAC,QAAQ;YACrB,eAAe,EAAE,QAAQ,CAAC,eAAe;SAC5C;QACD,MAAM,EAAE,cAAc;QACtB,SAAS;QACT,mBAAmB,EAAE,gBAAgB;KACx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QAAQ,EAAE,CAAC,CAAC,CAAC;QACtD,SAAS,GAAG,GAAG,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AACD,SAAgB,oBAAoB,CAAC,OAAiC,EAAE,oBAAwC;IAC5G,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,gBAAgB,IAAA,wBAAU,GAAE,EAAE;QAC3C,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,GAAG,CAAC,oBAAoB,KAAK,SAAS,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC;YACvE,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,EAAE,CAAC;KAC5E,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { JsonValue } from \"../shared/types.ts\";\nimport { type SandboxSetupPrefixCacheEligibility, type SandboxSetupPrefixCacheManifest, type SandboxSetupPrefixCacheOperation, } from \"../sandbox/backend.ts\";\nimport { mergeSandboxActionState, type SandboxActionState } from \"../sandbox/action.ts\";\nimport { digestOf } from \"../sandbox/identity.ts\";\nimport type { ScheduledSandboxBefore } from \"../sandbox/link.ts\";\nimport type { LinkedRunPlan } from \"../sandbox/plan.ts\";\nexport const SETUP_PREFIX_INTERPRETER_REVISION = \"niceeval.sandbox-step-interpreter/v1\";\nexport const SETUP_PREFIX_QUIESCE_REVISION = \"niceeval.setup-prefix-quiesce/v1\";\nexport interface PlannedSetupPrefixAction {\n readonly entry: Extract<ScheduledSandboxBefore, {\n readonly kind: \"action\";\n }>;\n readonly key: string;\n readonly manifest: SandboxSetupPrefixCacheManifest;\n}\n/**\n * The one provider-neutral SetupPrefix key planner. CaseKey, BuildKey and an\n * occurrence cohort deliberately stay out of this identity: the exact Base,\n * provider preparation identity and ordered action declarations are sufficient.\n */\nexport function plannedSetupPrefixActions(plan: Extract<LinkedRunPlan, {\n readonly _tag: \"Sandbox\";\n}>, entries: readonly Extract<ScheduledSandboxBefore, {\n readonly kind: \"action\";\n}>[], eligibility: Extract<SandboxSetupPrefixCacheEligibility, {\n readonly _tag: \"Eligible\";\n}>): readonly PlannedSetupPrefixAction[] {\n const baseImageId = eligibility.baseImageId;\n const keyScope = eligibility.keyScope;\n const keyScopeIdentity: JsonValue = { ...keyScope };\n const provider = plan.providerPlan;\n const targetIdentity: JsonValue = {\n source: provider.target.source,\n platform: { ...provider.target.platform },\n };\n const revisions = Object.freeze({\n storage: keyScope.storageSchemaRevision,\n interpreter: SETUP_PREFIX_INTERPRETER_REVISION,\n quiesce: SETUP_PREFIX_QUIESCE_REVISION,\n capture: keyScope.artifactFormatRevision,\n });\n let parentKey = `base:${digestOf({\n protocol: \"niceeval.setup-prefix-key/v2\",\n baseImageId,\n provider: {\n id: provider.provider,\n plannerRevision: provider.plannerRevision,\n },\n target: targetIdentity,\n revisions,\n preparationIdentity: keyScopeIdentity,\n })}`;\n const planned: PlannedSetupPrefixAction[] = [];\n const actionManifest: JsonValue[] = [];\n let cumulativeState: SandboxActionState | undefined;\n for (const entry of entries) {\n cumulativeState = mergeSandboxActionState(cumulativeState, entry.data.plan.state);\n actionManifest.push(Object.freeze({\n owner: {\n kind: entry.owner.kind,\n id: entry.owner.id,\n ordinal: entry.ordinal,\n },\n order: entry.executionOrder.topologicalOrdinal,\n changeFrequency: {\n value: entry.metadata.changeFrequency.value,\n source: entry.metadata.changeFrequency.source,\n ...(entry.metadata.changeFrequency.preset === undefined\n ? {}\n : { preset: entry.metadata.changeFrequency.preset }),\n },\n dependencyEdges: entry.dependencies.map((dependency) => ({ ...dependency })),\n capabilities: {\n requires: [...entry.metadata.requires],\n provides: [...entry.metadata.provides],\n },\n action: {\n id: entry.data.plan.id,\n family: entry.data.plan.family,\n declaredState: entry.data.plan.state,\n cumulativeState,\n input: entry.data.plan.input,\n fingerprint: { ...entry.data.plan.fingerprint },\n steps: entry.data.plan.steps.map((step) => {\n if (step.kind === \"exec\") {\n const { args, envKeys, ...fields } = step;\n return { ...fields, args: [...args], ...(envKeys === undefined ? {} : { envKeys: [...envKeys] }) };\n }\n if (step.kind === \"checkoutGit\") {\n const { sparse, ...fields } = step;\n return { ...fields, ...(sparse === undefined ? {} : {\n sparse: { include: [...sparse.include], exclude: [...sparse.exclude] },\n }) };\n }\n return { ...step };\n }),\n },\n }));\n const declarationMetadata: JsonValue = Object.freeze({\n protocol: \"niceeval.setup-prefix-manifest/v2\",\n parentKey,\n baseImageId,\n provider: {\n id: provider.provider,\n plannerRevision: provider.plannerRevision,\n },\n actionManifest: [...actionManifest],\n // Replacement collapses only physical generations of the exact declared\n // content. Different canonical inputs remain independently addressable.\n replacementScope: Object.freeze({\n protocol: \"niceeval.setup-prefix-replacement/v2\",\n baseImageId,\n provider: {\n id: provider.provider,\n plannerRevision: provider.plannerRevision,\n },\n target: targetIdentity,\n preparationIdentity: keyScopeIdentity,\n actionManifest: [...actionManifest],\n }),\n requiredState: cumulativeState,\n target: targetIdentity,\n revisions,\n preparationIdentity: keyScopeIdentity,\n });\n const key = `prefix:${digestOf(declarationMetadata)}`;\n const manifest: SandboxSetupPrefixCacheManifest = Object.freeze({\n baseImageId,\n setupPrefixKey: key,\n setupManifestDigest: `sha256:${digestOf(declarationMetadata)}`,\n requiredState: cumulativeState,\n storageSchemaRevision: keyScope.storageSchemaRevision,\n artifactFormatRevision: keyScope.artifactFormatRevision,\n changeFrequency: entry.metadata.changeFrequency.value,\n declarationMetadata,\n });\n planned.push(Object.freeze({ entry, key, manifest }));\n parentKey = key;\n }\n return Object.freeze(planned);\n}\nexport function setupPrefixOperation(planned: PlannedSetupPrefixAction, knownSensitiveValues?: readonly string[]): SandboxSetupPrefixCacheOperation {\n return Object.freeze({\n operationId: `setup-prefix-${randomUUID()}`,\n manifest: planned.manifest,\n ...(knownSensitiveValues === undefined || knownSensitiveValues.length === 0\n ? {}\n : { knownSensitiveValues: Object.freeze([...knownSensitiveValues]) }),\n });\n}\n"]}
@@ -1,10 +1,8 @@
1
1
  import { type SandboxSetupPrefixCacheEligibility, type SandboxSetupPrefixCacheManifest, type SandboxSetupPrefixCacheOperation } from "../sandbox/backend.cjs";
2
2
  import type { ScheduledSandboxBefore } from "../sandbox/link.cjs";
3
3
  import type { LinkedRunPlan } from "../sandbox/plan.cjs";
4
- export declare const SETUP_PREFIX_STORAGE_REVISION = "niceeval.setup-prefix-storage/v2";
5
4
  export declare const SETUP_PREFIX_INTERPRETER_REVISION = "niceeval.sandbox-step-interpreter/v1";
6
5
  export declare const SETUP_PREFIX_QUIESCE_REVISION = "niceeval.setup-prefix-quiesce/v1";
7
- export declare const SETUP_PREFIX_CAPTURE_REVISION = "niceeval.setup-prefix-capture/v1";
8
6
  export interface PlannedSetupPrefixAction {
9
7
  readonly entry: Extract<ScheduledSandboxBefore, {
10
8
  readonly kind: "action";
@@ -1,10 +1,8 @@
1
1
  import { type SandboxSetupPrefixCacheEligibility, type SandboxSetupPrefixCacheManifest, type SandboxSetupPrefixCacheOperation } from "../sandbox/backend.mjs";
2
2
  import type { ScheduledSandboxBefore } from "../sandbox/link.mjs";
3
3
  import type { LinkedRunPlan } from "../sandbox/plan.mjs";
4
- export declare const SETUP_PREFIX_STORAGE_REVISION = "niceeval.setup-prefix-storage/v2";
5
4
  export declare const SETUP_PREFIX_INTERPRETER_REVISION = "niceeval.sandbox-step-interpreter/v1";
6
5
  export declare const SETUP_PREFIX_QUIESCE_REVISION = "niceeval.setup-prefix-quiesce/v1";
7
- export declare const SETUP_PREFIX_CAPTURE_REVISION = "niceeval.setup-prefix-capture/v1";
8
6
  export interface PlannedSetupPrefixAction {
9
7
  readonly entry: Extract<ScheduledSandboxBefore, {
10
8
  readonly kind: "action";