niceeval 0.17.1 → 0.19.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 (692) hide show
  1. package/INDEX.md +5 -2
  2. package/dist/adapter-usage.cjs.map +1 -1
  3. package/dist/adapter-usage.d.cts +1 -1
  4. package/dist/adapter-usage.d.mts +1 -1
  5. package/dist/adapter-usage.d.ts +1 -1
  6. package/dist/adapter.cjs +8 -3
  7. package/dist/adapter.cjs.map +1 -1
  8. package/dist/adapter.d.cts +26 -15
  9. package/dist/adapter.d.mts +26 -15
  10. package/dist/adapter.d.ts +26 -15
  11. package/dist/agents/{effect-runtime.cjs → agent-effects.cjs} +12 -18
  12. package/dist/agents/agent-effects.cjs.map +1 -0
  13. package/dist/agents/agent-effects.d.cts +23 -0
  14. package/dist/agents/agent-effects.d.mts +23 -0
  15. package/dist/agents/agent-effects.d.ts +23 -0
  16. package/dist/agents/agent-effects.js +16 -0
  17. package/dist/agents/agent-effects.js.map +1 -0
  18. package/dist/agents/ai-sdk.cjs +1 -1
  19. package/dist/agents/ai-sdk.cjs.map +1 -1
  20. package/dist/agents/bub.cjs +31 -18
  21. package/dist/agents/bub.cjs.map +1 -1
  22. package/dist/agents/bub.d.cts +9 -12
  23. package/dist/agents/bub.d.mts +9 -12
  24. package/dist/agents/bub.d.ts +9 -12
  25. package/dist/agents/claude-code-native.cjs +2 -2
  26. package/dist/agents/claude-code-native.cjs.map +1 -1
  27. package/dist/agents/claude-code.cjs +17 -11
  28. package/dist/agents/claude-code.cjs.map +1 -1
  29. package/dist/agents/claude-code.d.cts +11 -11
  30. package/dist/agents/claude-code.d.mts +11 -11
  31. package/dist/agents/claude-code.d.ts +11 -11
  32. package/dist/agents/codex-app-server.cjs +2 -2
  33. package/dist/agents/codex-app-server.cjs.map +1 -1
  34. package/dist/agents/codex.cjs +18 -12
  35. package/dist/agents/codex.cjs.map +1 -1
  36. package/dist/agents/codex.d.cts +12 -12
  37. package/dist/agents/codex.d.mts +12 -12
  38. package/dist/agents/codex.d.ts +12 -12
  39. package/dist/agents/deepseek-harness.cjs +2 -2
  40. package/dist/agents/deepseek-harness.cjs.map +1 -1
  41. package/dist/agents/hermes.cjs +3 -3
  42. package/dist/agents/hermes.cjs.map +1 -1
  43. package/dist/agents/index.cjs +3 -3
  44. package/dist/agents/index.cjs.map +1 -1
  45. package/dist/agents/index.d.cts +3 -3
  46. package/dist/agents/index.d.mts +3 -3
  47. package/dist/agents/index.d.ts +3 -3
  48. package/dist/agents/index.js +2 -2
  49. package/dist/agents/index.mjs +2 -2
  50. package/dist/agents/mcp.cjs.map +1 -1
  51. package/dist/agents/mcp.d.cts +2 -2
  52. package/dist/agents/mcp.d.mts +2 -2
  53. package/dist/agents/mcp.d.ts +2 -2
  54. package/dist/agents/omp.cjs +2 -2
  55. package/dist/agents/omp.cjs.map +1 -1
  56. package/dist/agents/openai-compat.cjs +2 -2
  57. package/dist/agents/openai-compat.cjs.map +1 -1
  58. package/dist/agents/openclaw.cjs +3 -3
  59. package/dist/agents/openclaw.cjs.map +1 -1
  60. package/dist/agents/opencode.cjs +16 -4
  61. package/dist/agents/opencode.cjs.map +1 -1
  62. package/dist/agents/plugin-extensions.cjs +71 -0
  63. package/dist/agents/plugin-extensions.cjs.map +1 -0
  64. package/dist/agents/plugin-extensions.d.cts +26 -0
  65. package/dist/agents/plugin-extensions.d.mts +26 -0
  66. package/dist/agents/plugin-extensions.d.ts +26 -0
  67. package/dist/agents/plugin-extensions.js +8 -0
  68. package/dist/agents/plugin-extensions.js.map +1 -0
  69. package/dist/agents/post-setup.cjs +14 -3
  70. package/dist/agents/post-setup.cjs.map +1 -1
  71. package/dist/agents/post-setup.d.cts +4 -2
  72. package/dist/agents/post-setup.d.mts +4 -2
  73. package/dist/agents/post-setup.d.ts +4 -2
  74. package/dist/agents/post-setup.js +8 -6
  75. package/dist/agents/sdk-streams.cjs +3 -3
  76. package/dist/agents/sdk-streams.cjs.map +1 -1
  77. package/dist/agents/{session-slot.cjs → session-key.cjs} +4 -4
  78. package/dist/agents/session-key.cjs.map +1 -0
  79. package/dist/agents/session-key.d.cts +12 -0
  80. package/dist/agents/session-key.d.mts +12 -0
  81. package/dist/agents/session-key.d.ts +12 -0
  82. package/dist/agents/session-key.js +6 -0
  83. package/dist/agents/session-key.js.map +1 -0
  84. package/dist/agents/shared.cjs +2 -2
  85. package/dist/agents/shared.cjs.map +1 -1
  86. package/dist/agents/shared.d.cts +4 -4
  87. package/dist/agents/shared.d.mts +4 -4
  88. package/dist/agents/shared.d.ts +4 -4
  89. package/dist/agents/skills.cjs.map +1 -1
  90. package/dist/agents/skills.d.cts +3 -3
  91. package/dist/agents/skills.d.mts +3 -3
  92. package/dist/agents/skills.d.ts +3 -3
  93. package/dist/agents/types.cjs.map +1 -1
  94. package/dist/agents/types.d.cts +55 -54
  95. package/dist/agents/types.d.mts +55 -54
  96. package/dist/agents/types.d.ts +55 -54
  97. package/dist/agents/ui-message-stream.cjs +4 -4
  98. package/dist/agents/ui-message-stream.cjs.map +1 -1
  99. package/dist/agents/unrecognized-events.cjs +32 -0
  100. package/dist/agents/unrecognized-events.cjs.map +1 -0
  101. package/dist/agents/unrecognized-events.d.cts +8 -0
  102. package/dist/agents/unrecognized-events.d.mts +8 -0
  103. package/dist/agents/unrecognized-events.d.ts +8 -0
  104. package/dist/agents/unrecognized-events.js +6 -0
  105. package/dist/agents/unrecognized-events.js.map +1 -0
  106. package/dist/assertions/api.cjs.map +1 -1
  107. package/dist/assertions/api.d.cts +3 -0
  108. package/dist/assertions/api.d.mts +3 -0
  109. package/dist/assertions/api.d.ts +3 -0
  110. package/dist/assertions/collection.cjs +1 -1
  111. package/dist/assertions/collection.cjs.map +1 -1
  112. package/dist/assertions/judge.cjs +1 -1
  113. package/dist/assertions/judge.cjs.map +1 -1
  114. package/dist/assertions/match.cjs +52 -21
  115. package/dist/assertions/match.cjs.map +1 -1
  116. package/dist/assertions/match.d.cts +16 -5
  117. package/dist/assertions/match.d.mts +16 -5
  118. package/dist/assertions/match.d.ts +16 -5
  119. package/dist/assertions/match.js +96 -94
  120. package/dist/assertions/measurements.cjs +61 -0
  121. package/dist/assertions/measurements.cjs.map +1 -0
  122. package/dist/assertions/measurements.d.cts +24 -0
  123. package/dist/assertions/measurements.d.mts +24 -0
  124. package/dist/assertions/measurements.d.ts +24 -0
  125. package/dist/assertions/measurements.js +8 -0
  126. package/dist/assertions/measurements.js.map +1 -0
  127. package/dist/assertions/numeric.cjs +2 -0
  128. package/dist/assertions/numeric.cjs.map +1 -1
  129. package/dist/assertions/numeric.d.cts +1 -1
  130. package/dist/assertions/numeric.d.mts +1 -1
  131. package/dist/assertions/numeric.d.ts +1 -1
  132. package/dist/assertions/quantity.cjs +42 -0
  133. package/dist/assertions/quantity.cjs.map +1 -0
  134. package/dist/assertions/quantity.d.cts +18 -0
  135. package/dist/assertions/quantity.d.mts +18 -0
  136. package/dist/assertions/quantity.d.ts +18 -0
  137. package/dist/assertions/quantity.js +22 -0
  138. package/dist/assertions/quantity.js.map +1 -0
  139. package/dist/assertions/record/attachment.cjs +2 -0
  140. package/dist/assertions/record/attachment.cjs.map +1 -1
  141. package/dist/assertions/record/codec.cjs +5 -1
  142. package/dist/assertions/record/codec.cjs.map +1 -1
  143. package/dist/assertions/record/model.cjs.map +1 -1
  144. package/dist/assertions/record/model.d.cts +3 -1
  145. package/dist/assertions/record/model.d.mts +3 -1
  146. package/dist/assertions/record/model.d.ts +3 -1
  147. package/dist/assertions/runtime.cjs +11 -6
  148. package/dist/assertions/runtime.cjs.map +1 -1
  149. package/dist/cli/program.cjs +3 -0
  150. package/dist/cli/program.cjs.map +1 -1
  151. package/dist/context/assert-first.cjs +6 -4
  152. package/dist/context/assert-first.cjs.map +1 -1
  153. package/dist/context/assert-first.d.cts +9 -3
  154. package/dist/context/assert-first.d.mts +9 -3
  155. package/dist/context/assert-first.d.ts +9 -3
  156. package/dist/context/notes.cjs +47 -0
  157. package/dist/context/notes.cjs.map +1 -0
  158. package/dist/context/notes.d.cts +10 -0
  159. package/dist/context/notes.d.mts +10 -0
  160. package/dist/context/notes.d.ts +10 -0
  161. package/dist/context/notes.js +6 -0
  162. package/dist/context/notes.js.map +1 -0
  163. package/dist/context/send-failures.cjs +1 -7
  164. package/dist/context/send-failures.cjs.map +1 -1
  165. package/dist/context/send-failures.d.cts +2 -3
  166. package/dist/context/send-failures.d.mts +2 -3
  167. package/dist/context/send-failures.d.ts +2 -3
  168. package/dist/context/send-retry.cjs +0 -1
  169. package/dist/context/send-retry.cjs.map +1 -1
  170. package/dist/context/send-retry.d.cts +1 -2
  171. package/dist/context/send-retry.d.mts +1 -2
  172. package/dist/context/send-retry.d.ts +1 -2
  173. package/dist/context/session.cjs +10 -17
  174. package/dist/context/session.cjs.map +1 -1
  175. package/dist/context/session.d.cts +4 -10
  176. package/dist/context/session.d.mts +4 -10
  177. package/dist/context/session.d.ts +4 -10
  178. package/dist/define.cjs +89 -64
  179. package/dist/define.cjs.map +1 -1
  180. package/dist/define.d.cts +3 -3
  181. package/dist/define.d.mts +3 -3
  182. package/dist/define.d.ts +3 -3
  183. package/dist/eval/cli/contribution.cjs +1 -1
  184. package/dist/eval/cli/contribution.cjs.map +1 -1
  185. package/dist/eval/host/index.cjs +1 -1
  186. package/dist/eval/host/index.cjs.map +1 -1
  187. package/dist/eval/record/evaluation.cjs +1 -1
  188. package/dist/eval/record/evaluation.cjs.map +1 -1
  189. package/dist/eval/record/membership-provenance.d.cts +3 -3
  190. package/dist/eval/record/membership-provenance.d.mts +3 -3
  191. package/dist/eval/record/membership-provenance.d.ts +3 -3
  192. package/dist/eval/record/score.cjs +2 -2
  193. package/dist/eval/record/score.cjs.map +1 -1
  194. package/dist/eval/record/sealed-assertion.cjs +1 -1
  195. package/dist/eval/record/sealed-assertion.cjs.map +1 -1
  196. package/dist/eval/record/verdict.cjs +2 -2
  197. package/dist/eval/record/verdict.cjs.map +1 -1
  198. package/dist/expect/index.cjs +13 -1
  199. package/dist/expect/index.cjs.map +1 -1
  200. package/dist/expect/index.d.cts +5 -1
  201. package/dist/expect/index.d.mts +5 -1
  202. package/dist/expect/index.d.ts +5 -1
  203. package/dist/expect/index.js +92 -72
  204. package/dist/expect/index.mjs +92 -72
  205. package/dist/experiment/host/cli/contribution.cjs +52 -39
  206. package/dist/experiment/host/cli/contribution.cjs.map +1 -1
  207. package/dist/experiment/host/cli/contribution.d.cts +18 -4
  208. package/dist/experiment/host/cli/contribution.d.mts +18 -4
  209. package/dist/experiment/host/cli/contribution.d.ts +18 -4
  210. package/dist/experiment/host/cli/contribution.js +2 -2
  211. package/dist/experiment/host/cli/debug-protocol.cjs +2 -2
  212. package/dist/experiment/host/cli/debug-protocol.cjs.map +1 -1
  213. package/dist/experiment/host/cli/debug-protocol.d.cts +2 -2
  214. package/dist/experiment/host/cli/debug-protocol.d.mts +2 -2
  215. package/dist/experiment/host/cli/debug-protocol.d.ts +2 -2
  216. package/dist/experiment/host/cli/output-protocol.cjs +1 -1
  217. package/dist/experiment/host/cli/output-protocol.cjs.map +1 -1
  218. package/dist/experiment/host/cli/output-protocol.d.cts +2 -2
  219. package/dist/experiment/host/cli/output-protocol.d.mts +2 -2
  220. package/dist/experiment/host/cli/output-protocol.d.ts +2 -2
  221. package/dist/experiment/host/current.cjs +2 -2
  222. package/dist/experiment/host/current.cjs.map +1 -1
  223. package/dist/experiment/host/index.cjs +1 -1
  224. package/dist/experiment/host/index.cjs.map +1 -1
  225. package/dist/experiment/host/operations.cjs +24 -23
  226. package/dist/experiment/host/operations.cjs.map +1 -1
  227. package/dist/experiment/host/runtime.cjs +11 -10
  228. package/dist/experiment/host/runtime.cjs.map +1 -1
  229. package/dist/experiment/host/runtime.d.cts +3 -3
  230. package/dist/experiment/host/runtime.d.mts +3 -3
  231. package/dist/experiment/host/runtime.d.ts +3 -3
  232. package/dist/experiment/host/teardown.cjs +4 -3
  233. package/dist/experiment/host/teardown.cjs.map +1 -1
  234. package/dist/experiment/host/teardown.d.cts +3 -3
  235. package/dist/experiment/host/teardown.d.mts +3 -3
  236. package/dist/experiment/host/teardown.d.ts +3 -3
  237. package/dist/experiment/host/types.cjs.map +1 -1
  238. package/dist/experiment/host/types.d.cts +19 -19
  239. package/dist/experiment/host/types.d.mts +19 -19
  240. package/dist/experiment/host/types.d.ts +19 -19
  241. package/dist/index.cjs +3 -19
  242. package/dist/index.cjs.map +1 -1
  243. package/dist/index.d.cts +4 -8
  244. package/dist/index.d.mts +4 -8
  245. package/dist/index.d.ts +4 -8
  246. package/dist/index.js +12 -34
  247. package/dist/index.mjs +12 -34
  248. package/dist/inspection/assertions.cjs +1 -1
  249. package/dist/inspection/assertions.cjs.map +1 -1
  250. package/dist/inspection/cli/contribution.cjs +8 -7
  251. package/dist/inspection/cli/contribution.cjs.map +1 -1
  252. package/dist/inspection/facts.cjs +4 -4
  253. package/dist/inspection/facts.cjs.map +1 -1
  254. package/dist/inspection/index.cjs +1 -5
  255. package/dist/inspection/index.cjs.map +1 -1
  256. package/dist/inspection/index.d.cts +1 -2
  257. package/dist/inspection/index.d.mts +1 -2
  258. package/dist/inspection/index.d.ts +1 -2
  259. package/dist/inspection/index.js +20 -26
  260. package/dist/inspection/lifecycle.cjs +7 -0
  261. package/dist/inspection/lifecycle.cjs.map +1 -0
  262. package/dist/inspection/lifecycle.d.cts +4 -0
  263. package/dist/inspection/lifecycle.d.mts +4 -0
  264. package/dist/inspection/lifecycle.d.ts +4 -0
  265. package/dist/inspection/lifecycle.js +6 -0
  266. package/dist/inspection/lifecycle.js.map +1 -0
  267. package/dist/inspection/notes.cjs +40 -0
  268. package/dist/inspection/notes.cjs.map +1 -0
  269. package/dist/inspection/notes.d.cts +12 -0
  270. package/dist/inspection/notes.d.mts +12 -0
  271. package/dist/inspection/notes.d.ts +12 -0
  272. package/dist/inspection/notes.js +8 -0
  273. package/dist/inspection/notes.js.map +1 -0
  274. package/dist/inspection/overview.cjs +12 -15
  275. package/dist/inspection/overview.cjs.map +1 -1
  276. package/dist/inspection/overview.d.cts +8 -6
  277. package/dist/inspection/overview.d.mts +8 -6
  278. package/dist/inspection/overview.d.ts +8 -6
  279. package/dist/inspection/planned-attempt.cjs +45 -0
  280. package/dist/inspection/planned-attempt.cjs.map +1 -0
  281. package/dist/inspection/planned-attempt.d.cts +109 -0
  282. package/dist/inspection/planned-attempt.d.mts +109 -0
  283. package/dist/inspection/planned-attempt.d.ts +109 -0
  284. package/dist/inspection/planned-attempt.js +24 -0
  285. package/dist/inspection/planned-attempt.js.map +1 -0
  286. package/dist/inspection/project-result.cjs +5 -5
  287. package/dist/inspection/project-result.cjs.map +1 -1
  288. package/dist/inspection/project-result.d.cts +58 -57
  289. package/dist/inspection/project-result.d.mts +58 -57
  290. package/dist/inspection/project-result.d.ts +58 -57
  291. package/dist/inspection/project-result.js +4 -4
  292. package/dist/inspection/project.cjs +3 -3
  293. package/dist/inspection/project.cjs.map +1 -1
  294. package/dist/inspection/protocol-values.cjs +1 -1
  295. package/dist/inspection/protocol-values.cjs.map +1 -1
  296. package/dist/inspection/protocol-values.d.cts +1 -1
  297. package/dist/inspection/protocol-values.d.mts +1 -1
  298. package/dist/inspection/protocol-values.d.ts +1 -1
  299. package/dist/inspection/protocol.cjs +8 -8
  300. package/dist/inspection/protocol.cjs.map +1 -1
  301. package/dist/inspection/protocol.d.cts +237 -219
  302. package/dist/inspection/protocol.d.mts +237 -219
  303. package/dist/inspection/protocol.d.ts +237 -219
  304. package/dist/inspection/public.cjs +1 -5
  305. package/dist/inspection/public.cjs.map +1 -1
  306. package/dist/inspection/public.d.cts +1 -2
  307. package/dist/inspection/public.d.mts +1 -2
  308. package/dist/inspection/public.d.ts +1 -2
  309. package/dist/inspection/public.js +14 -20
  310. package/dist/inspection/public.mjs +166 -129
  311. package/dist/inspection/query.cjs +1 -1
  312. package/dist/inspection/query.cjs.map +1 -1
  313. package/dist/inspection/results.cjs +61 -52
  314. package/dist/inspection/results.cjs.map +1 -1
  315. package/dist/inspection/results.d.cts +157 -140
  316. package/dist/inspection/results.d.mts +157 -140
  317. package/dist/inspection/results.d.ts +157 -140
  318. package/dist/inspection/select.cjs +33 -28
  319. package/dist/inspection/select.cjs.map +1 -1
  320. package/dist/inspection/source.cjs +1 -1
  321. package/dist/inspection/source.cjs.map +1 -1
  322. package/dist/inspection/sources.cjs +2 -2
  323. package/dist/inspection/sources.cjs.map +1 -1
  324. package/dist/inspection/trace.cjs +9 -8
  325. package/dist/inspection/trace.cjs.map +1 -1
  326. package/dist/inspection/trace.d.cts +4 -4
  327. package/dist/inspection/trace.d.mts +4 -4
  328. package/dist/inspection/trace.d.ts +4 -4
  329. package/dist/loaders/index.cjs +7 -279
  330. package/dist/loaders/index.cjs.map +1 -1
  331. package/dist/loaders/index.d.cts +2 -95
  332. package/dist/loaders/index.d.mts +2 -95
  333. package/dist/loaders/index.d.ts +2 -95
  334. package/dist/loaders/index.js +10 -12
  335. package/dist/loaders/index.mjs +10 -12
  336. package/dist/loaders/runtime.cjs +283 -0
  337. package/dist/loaders/runtime.cjs.map +1 -0
  338. package/dist/loaders/runtime.d.cts +95 -0
  339. package/dist/loaders/runtime.d.mts +95 -0
  340. package/dist/loaders/runtime.d.ts +95 -0
  341. package/dist/loaders/runtime.js +16 -0
  342. package/dist/loaders/runtime.js.map +1 -0
  343. package/dist/migrations/judge-provider.md +6 -6
  344. package/dist/{model-slots.cjs → model-roles.cjs} +26 -7
  345. package/dist/model-roles.cjs.map +1 -0
  346. package/dist/model-roles.d.cts +26 -0
  347. package/dist/model-roles.d.mts +26 -0
  348. package/dist/model-roles.d.ts +26 -0
  349. package/dist/model-roles.js +14 -0
  350. package/dist/model-roles.js.map +1 -0
  351. package/dist/o11y/adapter-usage-projection.cjs +9 -8
  352. package/dist/o11y/adapter-usage-projection.cjs.map +1 -1
  353. package/dist/o11y/adapter-usage-projection.d.cts +23 -15
  354. package/dist/o11y/adapter-usage-projection.d.mts +23 -15
  355. package/dist/o11y/adapter-usage-projection.d.ts +23 -15
  356. package/dist/o11y/cache-read.cjs +14 -14
  357. package/dist/o11y/cache-read.cjs.map +1 -1
  358. package/dist/o11y/cache-read.d.cts +5 -5
  359. package/dist/o11y/cache-read.d.mts +5 -5
  360. package/dist/o11y/cache-read.d.ts +5 -5
  361. package/dist/o11y/derive.cjs.map +1 -1
  362. package/dist/o11y/derive.d.cts +2 -2
  363. package/dist/o11y/derive.d.mts +2 -2
  364. package/dist/o11y/derive.d.ts +2 -2
  365. package/dist/o11y/eval-usage.cjs +9 -9
  366. package/dist/o11y/eval-usage.cjs.map +1 -1
  367. package/dist/o11y/eval-usage.d.cts +7 -7
  368. package/dist/o11y/eval-usage.d.mts +7 -7
  369. package/dist/o11y/eval-usage.d.ts +7 -7
  370. package/dist/o11y/parsers/bub.cjs +57 -81
  371. package/dist/o11y/parsers/bub.cjs.map +1 -1
  372. package/dist/o11y/parsers/index.cjs.map +1 -1
  373. package/dist/o11y/parsers/index.d.cts +2 -0
  374. package/dist/o11y/parsers/index.d.mts +2 -0
  375. package/dist/o11y/parsers/index.d.ts +2 -0
  376. package/dist/o11y/parsers/opencode.cjs +129 -217
  377. package/dist/o11y/parsers/opencode.cjs.map +1 -1
  378. package/dist/o11y/parsers/opencode.d.cts +2 -5
  379. package/dist/o11y/parsers/opencode.d.mts +2 -5
  380. package/dist/o11y/parsers/opencode.d.ts +2 -5
  381. package/dist/o11y/types.cjs.map +1 -1
  382. package/dist/o11y/types.d.cts +1 -1
  383. package/dist/o11y/types.d.mts +1 -1
  384. package/dist/o11y/types.d.ts +1 -1
  385. package/dist/plugin/contracts.cjs +170 -120
  386. package/dist/plugin/contracts.cjs.map +1 -1
  387. package/dist/plugin/contracts.d.cts +102 -90
  388. package/dist/plugin/contracts.d.mts +102 -90
  389. package/dist/plugin/contracts.d.ts +102 -90
  390. package/dist/plugin/contracts.js +16 -12
  391. package/dist/plugin/index.cjs.map +1 -1
  392. package/dist/plugin/index.d.cts +1 -1
  393. package/dist/plugin/index.d.mts +1 -1
  394. package/dist/plugin/index.d.ts +1 -1
  395. package/dist/plugin/link.cjs +69 -64
  396. package/dist/plugin/link.cjs.map +1 -1
  397. package/dist/plugin/link.d.cts +5 -3
  398. package/dist/plugin/link.d.mts +5 -3
  399. package/dist/plugin/link.d.ts +5 -3
  400. package/dist/plugin/link.js +12 -8
  401. package/dist/record/codec/seal-manifest.d.cts +3 -3
  402. package/dist/record/codec/seal-manifest.d.mts +3 -3
  403. package/dist/record/codec/seal-manifest.d.ts +3 -3
  404. package/dist/record/family/attempt-note/definition.cjs +12 -0
  405. package/dist/record/family/attempt-note/definition.cjs.map +1 -0
  406. package/dist/record/family/attempt-note/definition.d.cts +6 -0
  407. package/dist/record/family/attempt-note/definition.d.mts +6 -0
  408. package/dist/record/family/attempt-note/definition.d.ts +6 -0
  409. package/dist/record/family/attempt-note/definition.js +6 -0
  410. package/dist/record/family/attempt-note/definition.js.map +1 -0
  411. package/dist/record/family/attempt-note/persistence.cjs +10 -0
  412. package/dist/record/family/attempt-note/persistence.cjs.map +1 -0
  413. package/dist/record/family/attempt-note/persistence.d.cts +6 -0
  414. package/dist/record/family/attempt-note/persistence.d.mts +6 -0
  415. package/dist/record/family/attempt-note/persistence.d.ts +6 -0
  416. package/dist/record/family/attempt-note/persistence.js +6 -0
  417. package/dist/record/family/attempt-note/persistence.js.map +1 -0
  418. package/dist/record/family/attempt-note/schema.cjs +20 -0
  419. package/dist/record/family/attempt-note/schema.cjs.map +1 -0
  420. package/dist/record/family/attempt-note/schema.d.cts +21 -0
  421. package/dist/record/family/attempt-note/schema.d.mts +21 -0
  422. package/dist/record/family/attempt-note/schema.d.ts +21 -0
  423. package/dist/record/family/attempt-note/schema.js +10 -0
  424. package/dist/record/family/attempt-note/schema.js.map +1 -0
  425. package/dist/record/family/catalog.cjs +32 -29
  426. package/dist/record/family/catalog.cjs.map +1 -1
  427. package/dist/record/family/catalog.d.cts +7 -2
  428. package/dist/record/family/catalog.d.mts +7 -2
  429. package/dist/record/family/catalog.d.ts +7 -2
  430. package/dist/record/family/current.cjs +48 -45
  431. package/dist/record/family/current.cjs.map +1 -1
  432. package/dist/record/family/current.d.cts +15 -0
  433. package/dist/record/family/current.d.mts +15 -0
  434. package/dist/record/family/current.d.ts +15 -0
  435. package/dist/record/model/index.js +66 -64
  436. package/dist/record/model/run-context.cjs +9 -3
  437. package/dist/record/model/run-context.cjs.map +1 -1
  438. package/dist/record/model/run-context.d.cts +9 -2
  439. package/dist/record/model/run-context.d.mts +9 -2
  440. package/dist/record/model/run-context.d.ts +9 -2
  441. package/dist/record/model/run-context.js +8 -6
  442. package/dist/record/model/seal-manifest.d.cts +1 -1
  443. package/dist/record/model/seal-manifest.d.mts +1 -1
  444. package/dist/record/model/seal-manifest.d.ts +1 -1
  445. package/dist/run/cli/contribution.cjs +6 -32
  446. package/dist/run/cli/contribution.cjs.map +1 -1
  447. package/dist/run/host/runtime.cjs +1 -1
  448. package/dist/run/host/runtime.cjs.map +1 -1
  449. package/dist/run/storage/sqlite.cjs +7 -7
  450. package/dist/run/storage/sqlite.cjs.map +1 -1
  451. package/dist/runner/adapter-usage.cjs +5 -3
  452. package/dist/runner/adapter-usage.cjs.map +1 -1
  453. package/dist/runner/adapter-usage.d.cts +2 -2
  454. package/dist/runner/adapter-usage.d.mts +2 -2
  455. package/dist/runner/adapter-usage.d.ts +2 -2
  456. package/dist/runner/adoption.cjs +10 -12
  457. package/dist/runner/adoption.cjs.map +1 -1
  458. package/dist/runner/attempt-notes.cjs +8 -0
  459. package/dist/runner/attempt-notes.cjs.map +1 -0
  460. package/dist/runner/attempt-notes.d.cts +4 -0
  461. package/dist/runner/attempt-notes.d.mts +4 -0
  462. package/dist/runner/attempt-notes.d.ts +4 -0
  463. package/dist/runner/attempt-notes.js +8 -0
  464. package/dist/runner/attempt-notes.js.map +1 -0
  465. package/dist/runner/attempt.cjs +61 -73
  466. package/dist/runner/attempt.cjs.map +1 -1
  467. package/dist/runner/attempt.d.cts +3 -3
  468. package/dist/runner/attempt.d.mts +3 -3
  469. package/dist/runner/attempt.d.ts +3 -3
  470. package/dist/runner/command-plan.cjs +21 -26
  471. package/dist/runner/command-plan.cjs.map +1 -1
  472. package/dist/runner/command-plan.d.cts +4 -4
  473. package/dist/runner/command-plan.d.mts +4 -4
  474. package/dist/runner/command-plan.d.ts +4 -4
  475. package/dist/runner/command-plan.js +4 -4
  476. package/dist/runner/config-identity.cjs.map +1 -1
  477. package/dist/runner/config-identity.d.cts +2 -2
  478. package/dist/runner/config-identity.d.mts +2 -2
  479. package/dist/runner/config-identity.d.ts +2 -2
  480. package/dist/runner/discover.cjs +6 -6
  481. package/dist/runner/discover.cjs.map +1 -1
  482. package/dist/runner/eval-selection.cjs +15 -1
  483. package/dist/runner/eval-selection.cjs.map +1 -1
  484. package/dist/runner/eval-selection.d.cts +4 -0
  485. package/dist/runner/eval-selection.d.mts +4 -0
  486. package/dist/runner/eval-selection.d.ts +4 -0
  487. package/dist/runner/feedback/human.cjs +1 -1
  488. package/dist/runner/feedback/human.cjs.map +1 -1
  489. package/dist/runner/feedback/json.cjs +4 -2
  490. package/dist/runner/feedback/json.cjs.map +1 -1
  491. package/dist/runner/feedback/json.d.cts +1 -1
  492. package/dist/runner/feedback/json.d.mts +1 -1
  493. package/dist/runner/feedback/json.d.ts +1 -1
  494. package/dist/runner/feedback/sink.cjs +1 -1
  495. package/dist/runner/feedback/sink.cjs.map +1 -1
  496. package/dist/runner/feedback/sink.d.cts +1 -1
  497. package/dist/runner/feedback/sink.d.mts +1 -1
  498. package/dist/runner/feedback/sink.d.ts +1 -1
  499. package/dist/runner/fingerprint.cjs +1 -1
  500. package/dist/runner/fingerprint.cjs.map +1 -1
  501. package/dist/runner/lock.cjs +1 -3
  502. package/dist/runner/lock.cjs.map +1 -1
  503. package/dist/runner/lock.d.cts +0 -2
  504. package/dist/runner/lock.d.mts +0 -2
  505. package/dist/runner/lock.d.ts +0 -2
  506. package/dist/runner/lock.js +14 -16
  507. package/dist/runner/project-target.cjs.map +1 -1
  508. package/dist/runner/project-target.d.cts +2 -2
  509. package/dist/runner/project-target.d.mts +2 -2
  510. package/dist/runner/project-target.d.ts +2 -2
  511. package/dist/runner/record/attachments.cjs +2 -2
  512. package/dist/runner/record/attachments.cjs.map +1 -1
  513. package/dist/runner/record/planning.cjs +8 -2
  514. package/dist/runner/record/planning.cjs.map +1 -1
  515. package/dist/runner/record.cjs +2 -0
  516. package/dist/runner/record.cjs.map +1 -1
  517. package/dist/runner/report.cjs +3 -3
  518. package/dist/runner/report.cjs.map +1 -1
  519. package/dist/runner/report.d.cts +1 -1
  520. package/dist/runner/report.d.mts +1 -1
  521. package/dist/runner/report.d.ts +1 -1
  522. package/dist/runner/reuse-plan.cjs +2 -2
  523. package/dist/runner/reuse-plan.cjs.map +1 -1
  524. package/dist/runner/run.cjs +10 -45
  525. package/dist/runner/run.cjs.map +1 -1
  526. package/dist/runner/sandbox-pool.cjs +1 -2
  527. package/dist/runner/sandbox-pool.cjs.map +1 -1
  528. package/dist/runner/setup-prefix-preparation.cjs +1 -1
  529. package/dist/runner/setup-prefix-preparation.cjs.map +1 -1
  530. package/dist/runner/teardown-registry.cjs +2 -2
  531. package/dist/runner/teardown-registry.cjs.map +1 -1
  532. package/dist/runner/teardown-registry.d.cts +1 -1
  533. package/dist/runner/teardown-registry.d.mts +1 -1
  534. package/dist/runner/teardown-registry.d.ts +1 -1
  535. package/dist/runner/types.cjs +4 -4
  536. package/dist/runner/types.cjs.map +1 -1
  537. package/dist/runner/types.d.cts +64 -92
  538. package/dist/runner/types.d.mts +64 -92
  539. package/dist/runner/types.d.ts +64 -92
  540. package/dist/runner/types.js +2 -2
  541. package/dist/sandbox/action.cjs +1 -1
  542. package/dist/sandbox/action.cjs.map +1 -1
  543. package/dist/sandbox/cli/contribution.cjs +17 -14
  544. package/dist/sandbox/cli/contribution.cjs.map +1 -1
  545. package/dist/sandbox/cli/contribution.d.cts +1 -1
  546. package/dist/sandbox/cli/contribution.d.mts +1 -1
  547. package/dist/sandbox/cli/contribution.d.ts +1 -1
  548. package/dist/sandbox/commands.cjs +1 -1
  549. package/dist/sandbox/commands.cjs.map +1 -1
  550. package/dist/sandbox/commands.d.cts +1 -1
  551. package/dist/sandbox/commands.d.mts +1 -1
  552. package/dist/sandbox/commands.d.ts +1 -1
  553. package/dist/sandbox/compose.cjs +2 -2
  554. package/dist/sandbox/compose.cjs.map +1 -1
  555. package/dist/sandbox/docker-profile/registry.cjs +5 -10
  556. package/dist/sandbox/docker-profile/registry.cjs.map +1 -1
  557. package/dist/sandbox/docker-profile/registry.d.cts +0 -4
  558. package/dist/sandbox/docker-profile/registry.d.mts +0 -4
  559. package/dist/sandbox/docker-profile/registry.d.ts +0 -4
  560. package/dist/sandbox/docker-profile/registry.js +6 -14
  561. package/dist/sandbox/docker-profile/runtime.cjs +1 -1
  562. package/dist/sandbox/docker-profile/runtime.cjs.map +1 -1
  563. package/dist/sandbox/docker-profile/schema.cjs +12 -16
  564. package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
  565. package/dist/sandbox/docker-profile/schema.d.cts +2 -6
  566. package/dist/sandbox/docker-profile/schema.d.mts +2 -6
  567. package/dist/sandbox/docker-profile/schema.d.ts +2 -6
  568. package/dist/sandbox/docker-profile/schema.js +24 -32
  569. package/dist/sandbox/incus.cjs +2 -2
  570. package/dist/sandbox/incus.cjs.map +1 -1
  571. package/dist/sandbox/index.cjs +4 -36
  572. package/dist/sandbox/index.cjs.map +1 -1
  573. package/dist/sandbox/index.d.cts +4 -8
  574. package/dist/sandbox/index.d.mts +4 -8
  575. package/dist/sandbox/index.d.ts +4 -8
  576. package/dist/sandbox/index.js +116 -174
  577. package/dist/sandbox/index.mjs +116 -174
  578. package/dist/sandbox/layer.cjs +3 -3
  579. package/dist/sandbox/layer.cjs.map +1 -1
  580. package/dist/sandbox/link.cjs +5 -0
  581. package/dist/sandbox/link.cjs.map +1 -1
  582. package/dist/sandbox/link.d.cts +3 -0
  583. package/dist/sandbox/link.d.mts +3 -0
  584. package/dist/sandbox/link.d.ts +3 -0
  585. package/dist/sandbox/runtime.cjs +9 -4
  586. package/dist/sandbox/runtime.cjs.map +1 -1
  587. package/dist/shared/failure-class.cjs +5 -5
  588. package/dist/shared/failure-class.cjs.map +1 -1
  589. package/dist/shared/failure-class.d.cts +4 -10
  590. package/dist/shared/failure-class.d.mts +4 -10
  591. package/dist/shared/failure-class.d.ts +4 -10
  592. package/dist/shared/types.cjs.map +1 -1
  593. package/dist/shared/types.d.cts +1 -1
  594. package/dist/shared/types.d.mts +1 -1
  595. package/dist/shared/types.d.ts +1 -1
  596. package/dist/show/contribution.cjs +17 -2
  597. package/dist/show/contribution.cjs.map +1 -1
  598. package/dist/show/contribution.d.cts +14 -0
  599. package/dist/show/contribution.d.mts +14 -0
  600. package/dist/show/contribution.d.ts +14 -0
  601. package/dist/show/model.cjs +8 -5
  602. package/dist/show/model.cjs.map +1 -1
  603. package/dist/show/model.d.cts +11 -8
  604. package/dist/show/model.d.mts +11 -8
  605. package/dist/show/model.d.ts +11 -8
  606. package/dist/show/render.cjs +34 -22
  607. package/dist/show/render.cjs.map +1 -1
  608. package/dist/sources/projector.cjs +1 -1
  609. package/dist/sources/projector.cjs.map +1 -1
  610. package/dist/types.cjs +1 -1
  611. package/dist/types.cjs.map +1 -1
  612. package/dist/types.d.cts +1 -1
  613. package/dist/types.d.mts +1 -1
  614. package/dist/types.d.ts +1 -1
  615. package/dist/types.js +2 -2
  616. package/dist/view/app-dist/.vite/manifest.json +2 -2
  617. package/dist/view/app-dist/assets/{index-B3ijZRph.js → index-CxrOUvHC.js} +17 -17
  618. package/dist/view/app-dist/assets/{quality-cost-scatter-B--DfJ9s.js → quality-cost-scatter-B6Aiss7x.js} +1 -1
  619. package/dist/view/app-dist/index.html +1 -1
  620. package/dist/view/cli/contribution.cjs +1 -1
  621. package/dist/view/cli/contribution.cjs.map +1 -1
  622. package/dist/view/function-runtime.mjs +318 -121
  623. package/dist/view/http-protocol.d.cts +1 -1
  624. package/dist/view/http-protocol.d.mts +1 -1
  625. package/dist/view/http-protocol.d.ts +1 -1
  626. package/dist/view/inspection-host.cjs +2 -2
  627. package/dist/view/inspection-host.cjs.map +1 -1
  628. package/dist/view/inspection-host.d.cts +349 -331
  629. package/dist/view/inspection-host.d.mts +349 -331
  630. package/dist/view/inspection-host.d.ts +349 -331
  631. package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +9 -9
  632. package/docs-site/zh/examples/integrations/claude-sdk.mdx +8 -8
  633. package/docs-site/zh/examples/integrations/codex-sdk.mdx +4 -4
  634. package/docs-site/zh/examples/integrations/langgraph.mdx +6 -6
  635. package/docs-site/zh/examples/integrations/pi-sdk.mdx +8 -8
  636. package/docs-site/zh/explanation/adapter.mdx +6 -6
  637. package/docs-site/zh/explanation/assert.mdx +7 -7
  638. package/docs-site/zh/explanation/drive.mdx +4 -4
  639. package/docs-site/zh/explanation/hitl.mdx +2 -2
  640. package/docs-site/zh/explanation/judge.mdx +3 -3
  641. package/docs-site/zh/index.mdx +18 -0
  642. package/docs-site/zh/introduction.mdx +4 -3
  643. package/docs-site/zh/reference/builtin-agents.mdx +46 -49
  644. package/docs-site/zh/reference/cli.mdx +16 -14
  645. package/docs-site/zh/reference/define-agent.mdx +19 -19
  646. package/docs-site/zh/reference/define-config.mdx +7 -15
  647. package/docs-site/zh/reference/define-eval.mdx +20 -14
  648. package/docs-site/zh/reference/define-experiment.mdx +18 -39
  649. package/docs-site/zh/reference/events.mdx +1 -1
  650. package/docs-site/zh/reference/expect.mdx +21 -0
  651. package/docs-site/zh/reference/official-adapters.mdx +12 -5
  652. package/docs-site/zh/troubleshooting/debugging.mdx +2 -2
  653. package/docs-site/zh/troubleshooting/recover-after-kill.mdx +1 -1
  654. package/docs-site/zh/tutorials/agent-onboarding.mdx +2 -2
  655. package/docs-site/zh/tutorials/authoring.mdx +4 -3
  656. package/docs-site/zh/tutorials/compare-runs.mdx +1 -1
  657. package/docs-site/zh/tutorials/concurrency.mdx +8 -8
  658. package/docs-site/zh/tutorials/configuration.mdx +5 -5
  659. package/docs-site/zh/tutorials/control-run-cost.mdx +49 -9
  660. package/docs-site/zh/tutorials/eval-groups.mdx +1 -1
  661. package/docs-site/zh/tutorials/evaluation-kinds.mdx +5 -5
  662. package/docs-site/zh/tutorials/experiment-services.mdx +32 -32
  663. package/docs-site/zh/tutorials/handle-execution-failures.mdx +2 -28
  664. package/docs-site/zh/tutorials/plugins.mdx +49 -143
  665. package/docs-site/zh/tutorials/sandbox-agent.mdx +1 -1
  666. package/docs-site/zh/tutorials/sandbox-reuse.mdx +7 -7
  667. package/docs-site/zh/tutorials/upgrade-0-18.mdx +64 -0
  668. package/docs-site/zh/tutorials/upgrade-0-19.mdx +121 -0
  669. package/docs-site/zh/tutorials/upgrade-0-20.mdx +12 -0
  670. package/docs-site/zh/tutorials/verify-judge.mdx +4 -3
  671. package/docs-site/zh/tutorials/viewing-results.mdx +2 -2
  672. package/docs-site/zh/tutorials/write-experiment.mdx +1 -1
  673. package/docs-site/zh/tutorials/write-send.mdx +13 -13
  674. package/package.json +1 -1
  675. package/dist/agents/effect-runtime.cjs.map +0 -1
  676. package/dist/agents/effect-runtime.d.cts +0 -29
  677. package/dist/agents/effect-runtime.d.mts +0 -29
  678. package/dist/agents/effect-runtime.d.ts +0 -29
  679. package/dist/agents/effect-runtime.js +0 -16
  680. package/dist/agents/effect-runtime.js.map +0 -1
  681. package/dist/agents/session-slot.cjs.map +0 -1
  682. package/dist/agents/session-slot.d.cts +0 -12
  683. package/dist/agents/session-slot.d.mts +0 -12
  684. package/dist/agents/session-slot.d.ts +0 -12
  685. package/dist/agents/session-slot.js +0 -6
  686. package/dist/agents/session-slot.js.map +0 -1
  687. package/dist/model-slots.cjs.map +0 -1
  688. package/dist/model-slots.d.cts +0 -19
  689. package/dist/model-slots.d.mts +0 -19
  690. package/dist/model-slots.d.ts +0 -19
  691. package/dist/model-slots.js +0 -8
  692. package/dist/model-slots.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"report.js","sourceRoot":"","sources":["report.ts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,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO;QACH,IAAI;QACJ,SAAS;QACT,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,UAAU;QACV,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE;QACnD,+DAA+D;QAC/D,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QACrD,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC;QAClD,OAAO;QACP,aAAa;KAChB,CAAC;AACN,CAAC","sourcesContent":["// reporter 编排与运行级汇总。reporter 是「结果消费方」:单个 reporter 抛错只记\n// diagnostic,不能让整次调度崩。\nimport { Effect } from \"effect\";\nimport type { EvalResult, InvocationShape, InvocationSummary, LocalizedText, Reporter, ReporterEvent, ReporterRegistration, } from \"../types.ts\";\nimport { firstLine, formatThrown } from \"../util.ts\";\nimport { reportReporterError } from \"./feedback/sink.ts\";\n/**\n * reporter 调用的统一兜错。返回 void,永不 reject(供 Promise.all 安全聚合,单个 reporter\n * 抛错不终止其它 reporter 的收尾,也不中断在飞的 attempt)。`reg.name`/`reg.required` 决定\n * `reportReporterError()` 收到的诊断身份与判定权重(见 `ReporterRegistration` 的字段注释:\n * 同一个 reporter 反复失败按 `name` 去重折叠,`required` 决定它是否让 completion/CI 退出码\n * 判红)。`stage` 只是这次失败发生在哪个回调阶段的次要上下文,拼进 message,不参与去重身份——\n * 同一 reporter 在 onEvalComplete 与 onInvocationComplete 两个阶段各失败一次,仍然折成同一条诊断、\n * count 累加到 2,而不是拆成两条互不相关的诊断。message 只取 `formatThrown()` 的第一行(与\n * run.ts 的 `describeFailureReason` 同一原则)——reporter 抛出的 Error 完整 `.stack` 含本地\n * 绝对文件路径和调用帧,不适合塞进 agent/ci 那种单行、稳定、机器消费的 envelope;这里没有\n * `EvalResult.error` 那样的落盘字段能保留完整栈,所以「一层可行动摘要」就是这条诊断的全部内容,\n * 不是从更详细的记录里摘出来的简化版——排查真正需要栈时,重跑该 reporter 单独复现更可靠。\n */\nexport function runReporter(reg: ReporterRegistration, stage: string, fn: () => unknown): Effect.Effect<void> {\n return Effect.tryPromise({\n // Public Reporter callbacks are the one Promise boundary for this module.\n try: () => Promise.resolve().then(fn),\n catch: (cause) => cause,\n }).pipe(Effect.catch((cause) => Effect.sync(() => {\n reportReporterError({\n reporter: reg.name,\n required: reg.required,\n message: `${stage}: ${firstLine(formatThrown(cause))}`,\n });\n })));\n}\nexport function emitReporterEvent(registrations: readonly ReporterRegistration[], event: ReporterEvent): Effect.Effect<void> {\n // Existing Promise.all starts every reporter immediately and waits for each one;\n // retain that concurrent, best-effort observable behavior under Effect.\n return Effect.forEach(registrations, (reg) => runReporter(reg, `event:${event.type}`, () => reg.reporter.onEvent?.(event)), { concurrency: \"unbounded\", discard: true });\n}\n/** 按 eval id 过滤 InvocationSummary 并重新计数 —— eval 级 reporter 只看它观测的那部分。 */\nexport function filterSummary(summary: InvocationSummary, ids: ReadonlySet<string>): InvocationSummary {\n const results = summary.results.filter((r) => ids.has(r.id));\n const reusedAttempts = summary.reusedAttempts.filter((attempt) => ids.has(attempt.target.evalId));\n const sub = summarize(results, reusedAttempts, summary.startedAt, summary.durationMs, summary.name, summary.setupPrefixes);\n // completedAt 用原值(summarize 会重新取 now);name 等其余字段原样保留。\n return { ...summary, ...sub, completedAt: summary.completedAt };\n}\n/**\n * eval 级 reporter 的作用域包装:实例只观测「引用它的那些 eval」。\n * 结果类回调按 eval id 过滤,汇总类回调收到重新计数的子集汇总;\n * shape 由调用方按作用域预先算好(包装器自己看不到 attempts)。\n */\nexport function scopeReporter(r: Reporter, ids: ReadonlySet<string>, shape?: InvocationShape): Reporter {\n const scoped: Reporter = {};\n if (r.onInvocationStart) {\n scoped.onInvocationStart = (evals, fullShape) => r.onInvocationStart!(evals.filter((e) => ids.has(e.id)), shape ?? fullShape);\n }\n if (r.onEvalComplete) {\n scoped.onEvalComplete = (result) => (ids.has(result.id) ? r.onEvalComplete!(result) : undefined);\n }\n if (r.onInvocationComplete) {\n scoped.onInvocationComplete = (summary) => r.onInvocationComplete!(filterSummary(summary, ids));\n }\n if (r.onEvent) {\n scoped.onEvent = (event) => {\n switch (event.type) {\n case \"invocation:start\":\n return r.onEvent!({\n ...event,\n evals: event.evals.filter((e) => ids.has(e.id)),\n shape: shape ?? event.shape,\n });\n case \"eval:start\":\n return ids.has(event.eval.id) ? r.onEvent!(event) : undefined;\n case \"eval:complete\":\n return ids.has(event.result.id) ? r.onEvent!(event) : undefined;\n case \"invocation:earlyExit\":\n return ids.has(event.evalId) ? r.onEvent!(event) : undefined;\n case \"invocation:summary\":\n case \"invocation:saved\":\n return r.onEvent!({ ...event, summary: filterSummary(event.summary, ids) });\n default:\n return r.onEvent!(event);\n }\n };\n }\n return scoped;\n}\n/** 全局汇总:verdict 计数 + token / cost 折叠。按 attempt 计(eval 级折叠见 shared/verdict.ts)。不接收 agent/model —— 一次 Invocation 可能横跨多个配置,身份从逐条 `EvalResult` 读取。 */\nexport function summarize(results: EvalResult[], reusedAttempts: readonly import(\"./reuse-readback.ts\").CurrentReusedAttemptReadback[], startedAt: string, durationMs: number, name?: LocalizedText, setupPrefixes: InvocationSummary[\"setupPrefixes\"] = Object.freeze({ total: 0, hit: 0, prepared: 0, failed: 0 })): InvocationSummary {\n const counts = { passed: 0, failed: 0, skipped: 0, errored: 0 };\n let inTok = 0;\n let outTok = 0;\n let cost = 0;\n let hasEstimatedCost = false;\n for (const r of results) {\n counts[r.verdict] += 1;\n inTok += r.usage?.inputTokens ?? 0;\n outTok += r.usage?.outputTokens ?? 0;\n if (r.estimatedCostUSD !== undefined) {\n cost += r.estimatedCostUSD;\n hasEstimatedCost = true;\n }\n }\n for (const attempt of reusedAttempts) {\n counts[attempt.verdict] += 1;\n }\n return {\n name,\n startedAt,\n completedAt: new Date().toISOString(),\n passed: counts.passed,\n failed: counts.failed,\n skipped: counts.skipped,\n errored: counts.errored,\n durationMs,\n usage: { inputTokens: inTok, outputTokens: outTok },\n // 0 是合法估算值:至少一条 fresh 结果带 estimatedCostUSD 就输出累计值(可为 0),全缺才省略。\n estimatedCostUSD: hasEstimatedCost ? cost : undefined,\n reusedAttempts: Object.freeze([...reusedAttempts]),\n results,\n setupPrefixes,\n };\n}\n"]}
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["report.ts"],"names":[],"mappings":";;AAmBA,kCAYC;AACD,8CAIC;AAED,sCAMC;AAMD,sCAmCC;AAED,8BAkCC;AAzHD,uDAAuD;AACvD,uBAAuB;AACvB,mCAAgC;AAEhC,wCAAqD;AACrD,gDAAyD;AACzD;;;;;;;;;;;;GAYG;AACH,SAAgB,WAAW,CAAC,GAAyB,EAAE,KAAa,EAAE,EAAiB;IACnF,OAAO,eAAM,CAAC,UAAU,CAAC;QACrB,0EAA0E;QAC1E,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;KAC1B,CAAC,CAAC,IAAI,CAAC,eAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QAC7C,IAAA,6BAAmB,EAAC;YAChB,QAAQ,EAAE,GAAG,CAAC,IAAI;YAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,OAAO,EAAE,GAAG,KAAK,KAAK,IAAA,mBAAS,EAAC,IAAA,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ACd,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACtB,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,WAAW,IAAI,CAAC,CAAC;QACnC,MAAM,IAAI,CAAC,CAAC,KAAK,EAAE,YAAY,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,IAAI,CAAC,CAAC,gBAAgB,CAAC;YAC3B,gBAAgB,GAAG,IAAI,CAAC;QAC5B,CAAC;IACL,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO;QACH,IAAI;QACJ,SAAS;QACT,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,UAAU;QACV,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE;QACnD,+DAA+D;QAC/D,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QACrD,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC;QAClD,OAAO;QACP,YAAY;KACf,CAAC;AACN,CAAC","sourcesContent":["// reporter 编排与运行级汇总。reporter 是「结果消费方」:单个 reporter 抛错只记\n// diagnostic,不能让整次调度崩。\nimport { Effect } from \"effect\";\nimport type { EvalResult, InvocationShape, InvocationSummary, LocalizedText, Reporter, ReporterEvent, ReporterRegistration, } from \"../types.ts\";\nimport { firstLine, formatThrown } from \"../util.ts\";\nimport { reportReporterError } from \"./feedback/sink.ts\";\n/**\n * reporter 调用的统一兜错。返回 void,永不 reject(供 Promise.all 安全聚合,单个 reporter\n * 抛错不终止其它 reporter 的收尾,也不中断在飞的 attempt)。`reg.name`/`reg.required` 决定\n * `reportReporterError()` 收到的诊断身份与判定权重(见 `ReporterRegistration` 的字段注释:\n * 同一个 reporter 反复失败按 `name` 去重折叠,`required` 决定它是否让 completion/CI 退出码\n * 判红)。`stage` 只是这次失败发生在哪个回调阶段的次要上下文,拼进 message,不参与去重身份——\n * 同一 reporter 在 onEvalComplete 与 onInvocationComplete 两个阶段各失败一次,仍然折成同一条诊断、\n * count 累加到 2,而不是拆成两条互不相关的诊断。message 只取 `formatThrown()` 的第一行(与\n * run.ts 的 `describeFailureReason` 同一原则)——reporter 抛出的 Error 完整 `.stack` 含本地\n * 绝对文件路径和调用帧,不适合塞进 agent/ci 那种单行、稳定、机器消费的 envelope;这里没有\n * `EvalResult.error` 那样的落盘字段能保留完整栈,所以「一层可行动摘要」就是这条诊断的全部内容,\n * 不是从更详细的记录里摘出来的简化版——排查真正需要栈时,重跑该 reporter 单独复现更可靠。\n */\nexport function runReporter(reg: ReporterRegistration, stage: string, fn: () => unknown): Effect.Effect<void> {\n return Effect.tryPromise({\n // Public Reporter callbacks are the one Promise boundary for this module.\n try: () => Promise.resolve().then(fn),\n catch: (cause) => cause,\n }).pipe(Effect.catch((cause) => Effect.sync(() => {\n reportReporterError({\n reporter: reg.name,\n required: reg.required,\n message: `${stage}: ${firstLine(formatThrown(cause))}`,\n });\n })));\n}\nexport function emitReporterEvent(registrations: readonly ReporterRegistration[], event: ReporterEvent): Effect.Effect<void> {\n // Existing Promise.all starts every reporter immediately and waits for each one;\n // retain that concurrent, best-effort observable behavior under Effect.\n return Effect.forEach(registrations, (reg) => runReporter(reg, `event:${event.type}`, () => reg.reporter.onEvent?.(event)), { concurrency: \"unbounded\", discard: true });\n}\n/** 按 eval id 过滤 InvocationSummary 并重新计数 —— eval 级 reporter 只看它观测的那部分。 */\nexport function filterSummary(summary: InvocationSummary, ids: ReadonlySet<string>): InvocationSummary {\n const results = summary.results.filter((r) => ids.has(r.id));\n const reusedAttempts = summary.reusedAttempts.filter((attempt) => ids.has(attempt.target.evalId));\n const sub = summarize(results, reusedAttempts, summary.startedAt, summary.durationMs, summary.name, summary.beforeCaches);\n // completedAt 用原值(summarize 会重新取 now);name 等其余字段原样保留。\n return { ...summary, ...sub, completedAt: summary.completedAt };\n}\n/**\n * eval 级 reporter 的作用域包装:实例只观测「引用它的那些 eval」。\n * 结果类回调按 eval id 过滤,汇总类回调收到重新计数的子集汇总;\n * shape 由调用方按作用域预先算好(包装器自己看不到 attempts)。\n */\nexport function scopeReporter(r: Reporter, ids: ReadonlySet<string>, shape?: InvocationShape): Reporter {\n const scoped: Reporter = {};\n if (r.onInvocationStart) {\n scoped.onInvocationStart = (evals, fullShape) => r.onInvocationStart!(evals.filter((e) => ids.has(e.id)), shape ?? fullShape);\n }\n if (r.onEvalComplete) {\n scoped.onEvalComplete = (result) => (ids.has(result.id) ? r.onEvalComplete!(result) : undefined);\n }\n if (r.onInvocationComplete) {\n scoped.onInvocationComplete = (summary) => r.onInvocationComplete!(filterSummary(summary, ids));\n }\n if (r.onEvent) {\n scoped.onEvent = (event) => {\n switch (event.type) {\n case \"invocation:start\":\n return r.onEvent!({\n ...event,\n evals: event.evals.filter((e) => ids.has(e.id)),\n shape: shape ?? event.shape,\n });\n case \"eval:start\":\n return ids.has(event.eval.id) ? r.onEvent!(event) : undefined;\n case \"eval:complete\":\n return ids.has(event.result.id) ? r.onEvent!(event) : undefined;\n case \"invocation:earlyExit\":\n return ids.has(event.evalId) ? r.onEvent!(event) : undefined;\n case \"invocation:summary\":\n case \"invocation:saved\":\n return r.onEvent!({ ...event, summary: filterSummary(event.summary, ids) });\n default:\n return r.onEvent!(event);\n }\n };\n }\n return scoped;\n}\n/** 全局汇总:verdict 计数 + token / cost 折叠。按 attempt 计(eval 级折叠见 shared/verdict.ts)。不接收 agent/model —— 一次 Invocation 可能横跨多个配置,身份从逐条 `EvalResult` 读取。 */\nexport function summarize(results: EvalResult[], reusedAttempts: readonly import(\"./reuse-readback.ts\").CurrentReusedAttemptReadback[], startedAt: string, durationMs: number, name?: LocalizedText, beforeCaches: InvocationSummary[\"beforeCaches\"] = Object.freeze({ total: 0, hit: 0, prepared: 0, failed: 0 })): InvocationSummary {\n const counts = { passed: 0, failed: 0, skipped: 0, errored: 0 };\n let inTok = 0;\n let outTok = 0;\n let cost = 0;\n let hasEstimatedCost = false;\n for (const r of results) {\n counts[r.verdict] += 1;\n inTok += r.usage?.inputTokens ?? 0;\n outTok += r.usage?.outputTokens ?? 0;\n if (r.estimatedCostUSD !== undefined) {\n cost += r.estimatedCostUSD;\n hasEstimatedCost = true;\n }\n }\n for (const attempt of reusedAttempts) {\n counts[attempt.verdict] += 1;\n }\n return {\n name,\n startedAt,\n completedAt: new Date().toISOString(),\n passed: counts.passed,\n failed: counts.failed,\n skipped: counts.skipped,\n errored: counts.errored,\n durationMs,\n usage: { inputTokens: inTok, outputTokens: outTok },\n // 0 是合法估算值:至少一条 fresh 结果带 estimatedCostUSD 就输出累计值(可为 0),全缺才省略。\n estimatedCostUSD: hasEstimatedCost ? cost : undefined,\n reusedAttempts: Object.freeze([...reusedAttempts]),\n results,\n beforeCaches,\n };\n}\n"]}
@@ -24,4 +24,4 @@ export declare function filterSummary(summary: InvocationSummary, ids: ReadonlyS
24
24
  */
25
25
  export declare function scopeReporter(r: Reporter, ids: ReadonlySet<string>, shape?: InvocationShape): Reporter;
26
26
  /** 全局汇总:verdict 计数 + token / cost 折叠。按 attempt 计(eval 级折叠见 shared/verdict.ts)。不接收 agent/model —— 一次 Invocation 可能横跨多个配置,身份从逐条 `EvalResult` 读取。 */
27
- export declare function summarize(results: EvalResult[], reusedAttempts: readonly import("./reuse-readback.cjs").CurrentReusedAttemptReadback[], startedAt: string, durationMs: number, name?: LocalizedText, setupPrefixes?: InvocationSummary["setupPrefixes"]): InvocationSummary;
27
+ export declare function summarize(results: EvalResult[], reusedAttempts: readonly import("./reuse-readback.cjs").CurrentReusedAttemptReadback[], startedAt: string, durationMs: number, name?: LocalizedText, beforeCaches?: InvocationSummary["beforeCaches"]): InvocationSummary;
@@ -24,4 +24,4 @@ export declare function filterSummary(summary: InvocationSummary, ids: ReadonlyS
24
24
  */
25
25
  export declare function scopeReporter(r: Reporter, ids: ReadonlySet<string>, shape?: InvocationShape): Reporter;
26
26
  /** 全局汇总:verdict 计数 + token / cost 折叠。按 attempt 计(eval 级折叠见 shared/verdict.ts)。不接收 agent/model —— 一次 Invocation 可能横跨多个配置,身份从逐条 `EvalResult` 读取。 */
27
- export declare function summarize(results: EvalResult[], reusedAttempts: readonly import("./reuse-readback.mjs").CurrentReusedAttemptReadback[], startedAt: string, durationMs: number, name?: LocalizedText, setupPrefixes?: InvocationSummary["setupPrefixes"]): InvocationSummary;
27
+ export declare function summarize(results: EvalResult[], reusedAttempts: readonly import("./reuse-readback.mjs").CurrentReusedAttemptReadback[], startedAt: string, durationMs: number, name?: LocalizedText, beforeCaches?: InvocationSummary["beforeCaches"]): InvocationSummary;
@@ -24,4 +24,4 @@ export declare function filterSummary(summary: InvocationSummary, ids: ReadonlyS
24
24
  */
25
25
  export declare function scopeReporter(r: Reporter, ids: ReadonlySet<string>, shape?: InvocationShape): Reporter;
26
26
  /** 全局汇总:verdict 计数 + token / cost 折叠。按 attempt 计(eval 级折叠见 shared/verdict.ts)。不接收 agent/model —— 一次 Invocation 可能横跨多个配置,身份从逐条 `EvalResult` 读取。 */
27
- export declare function summarize(results: EvalResult[], reusedAttempts: readonly import("./reuse-readback.js").CurrentReusedAttemptReadback[], startedAt: string, durationMs: number, name?: LocalizedText, setupPrefixes?: InvocationSummary["setupPrefixes"]): InvocationSummary;
27
+ export declare function summarize(results: EvalResult[], reusedAttempts: readonly import("./reuse-readback.js").CurrentReusedAttemptReadback[], startedAt: string, durationMs: number, name?: LocalizedText, beforeCaches?: InvocationSummary["beforeCaches"]): InvocationSummary;
@@ -7,7 +7,7 @@ exports.validateProjectTargetReusePlanInput = validateProjectTargetReusePlanInpu
7
7
  exports.planProjectTargetReuse = planProjectTargetReuse;
8
8
  exports.planProjectTargetReuseWithoutSources = planProjectTargetReuseWithoutSources;
9
9
  exports.assessCurrentTargetSlot = assessCurrentTargetSlot;
10
- // @concord-file ne-runner-reuse-plan
10
+ // @concord-file
11
11
  // @concord-implements docs/feature/experiments/cache.md
12
12
  // @concord-implements docs/feature/experiments/use-case/cache-explicit-rerun.md
13
13
  // @concord-implements docs/feature/experiments/use-case/rerun-all.md
@@ -135,7 +135,7 @@ function validateProjectTargetReusePlanInput(input) {
135
135
  * Plans only from Record Host selection references. It neither reconstructs
136
136
  * attempt handles from strings nor reads private Record paths.
137
137
  */
138
- // @concord-code ne-runner-plan-reuse
138
+ // @concord-code
139
139
  // @concord-implements docs/feature/experiments/cache.md
140
140
  function planProjectTargetReuse(input) {
141
141
  return effect_1.Effect.suspend(() => {
@@ -1 +1 @@
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,gBAAyB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,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
+ {"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,gBAAgB;AAChB,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,gBAAyB,CAAC;AACvD,QAAA,6BAA6B,GAAG,CAAU,CAAC;AAC3C,QAAA,2CAA2C,GAAG,GAAY,CAAC;AAC3D,QAAA,6CAA6C,GAAG,IAAa,CAAC;AAK9D,QAAA,2BAA2B,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC9E,IAAI,EAAE,kCAA0B;IAChC,OAAO,EAAE,qCAA6B;CACzC,CAAC,CAAC;AAUH;;;;GAIG;AACU,QAAA,qCAAqC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/D,iBAAiB,EAAE,oBAA6B;CACnD,CAAC,CAAC;AACU,QAAA,kCAAkC,G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K,CAAC,MAAM,IAAI,aAAa,CAAC;AAC7D,CAAC;AACD,SAAS,uBAAuB,CAAC,KAAa;IAC1C,OAAO,qBAAqB,CAAC,KAAK,EAAE,qDAA6C,CAAC;WAC3E,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC;AACD,SAAS,aAAa,CAAC,KAAc;IACjC,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,KAAK,CAAC;AACrE,CAAC;AACD,SAAS,mBAAmB,CAAC,KAAc;IACvC,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,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\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\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"]}