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,5 +1,5 @@
1
1
  import { Effect } from "effect";
2
- import { type CommandPlan, type SetupPrefixPlan } from "../../runner/command-plan.mjs";
2
+ import { type CommandPlan, type BeforeCachePlan } from "../../runner/command-plan.mjs";
3
3
  import type { Config } from "../../runner/types.mjs";
4
4
  import { accept, applyRunAccept, applyRename, catalog, check, listInvocationStatus, planInvocation, planRename, planRunAccept, runInvocation, showInvocationStatus } from "./operations.mjs";
5
5
  import { inspectTeardown, runTeardown } from "./teardown.mjs";
@@ -18,7 +18,7 @@ export interface ExperimentHostDebugPlan {
18
18
  readonly evalId?: string;
19
19
  readonly evalIds: readonly string[];
20
20
  readonly commandPlan: CommandPlan;
21
- readonly setupPrefixPlan: SetupPrefixPlan;
21
+ readonly beforeCachePlan: BeforeCachePlan;
22
22
  }
23
23
  /**
24
24
  * Selector outcomes are data, rather than CLI-owned selection logic or a
@@ -65,7 +65,7 @@ export declare const rawExperimentHost: Readonly<{
65
65
  plan: typeof planRename;
66
66
  apply: typeof applyRename;
67
67
  }>;
68
- teardown: Readonly<{
68
+ after: Readonly<{
69
69
  inspect: typeof inspectTeardown;
70
70
  run: typeof runTeardown;
71
71
  }>;
@@ -1,5 +1,5 @@
1
1
  import { Effect } from "effect";
2
- import { type CommandPlan, type SetupPrefixPlan } from "../../runner/command-plan.js";
2
+ import { type CommandPlan, type BeforeCachePlan } from "../../runner/command-plan.js";
3
3
  import type { Config } from "../../runner/types.js";
4
4
  import { accept, applyRunAccept, applyRename, catalog, check, listInvocationStatus, planInvocation, planRename, planRunAccept, runInvocation, showInvocationStatus } from "./operations.js";
5
5
  import { inspectTeardown, runTeardown } from "./teardown.js";
@@ -18,7 +18,7 @@ export interface ExperimentHostDebugPlan {
18
18
  readonly evalId?: string;
19
19
  readonly evalIds: readonly string[];
20
20
  readonly commandPlan: CommandPlan;
21
- readonly setupPrefixPlan: SetupPrefixPlan;
21
+ readonly beforeCachePlan: BeforeCachePlan;
22
22
  }
23
23
  /**
24
24
  * Selector outcomes are data, rather than CLI-owned selection logic or a
@@ -65,7 +65,7 @@ export declare const rawExperimentHost: Readonly<{
65
65
  plan: typeof planRename;
66
66
  apply: typeof applyRename;
67
67
  }>;
68
- teardown: Readonly<{
68
+ after: Readonly<{
69
69
  inspect: typeof inspectTeardown;
70
70
  run: typeof runTeardown;
71
71
  }>;
@@ -49,6 +49,7 @@ function selectTeardowns(input) {
49
49
  selected: freezeArray(matched.map((experiment) => {
50
50
  const selection = (0, eval_selection_ts_1.resolveExperimentEvals)({
51
51
  experimentId: experiment.id,
52
+ validateModelRequirements: false,
52
53
  selector: experiment.evals,
53
54
  cliPatterns: [],
54
55
  evals,
@@ -62,7 +63,7 @@ function selectTeardowns(input) {
62
63
  });
63
64
  }
64
65
  function teardownOf(experiment) {
65
- return typeof experiment.teardown === "function" ? experiment.teardown : undefined;
66
+ return typeof experiment.after === "function" ? experiment.after : undefined;
66
67
  }
67
68
  function evidenceOf(record) {
68
69
  return Object.freeze({
@@ -208,7 +209,7 @@ function inspectTeardown(input) {
208
209
  }
209
210
  if (teardownOf(target.experiment) === undefined) {
210
211
  return Object.freeze({
211
- status: "teardown-required",
212
+ status: "after-required",
212
213
  experimentId: target.experiment.id,
213
214
  evidence,
214
215
  });
@@ -252,7 +253,7 @@ function runExplicitRecovery(input, selection, record) {
252
253
  }
253
254
  if (teardownOf(target.experiment) === undefined) {
254
255
  return Object.freeze({
255
- status: "teardown-required",
256
+ status: "after-required",
256
257
  experimentId: target.experiment.id,
257
258
  evidence,
258
259
  });
@@ -1 +1 @@
1
- {"version":3,"file":"teardown.js","sourceRoot":"","sources":["teardown.ts"],"names":[],"mappings":";;AAiNA,0CAqDC;AAqGD,kCA+DC;AA1aD,yCAAoC;AACpC,mCAA+C;AAE/C,wEAAkE;AAClE,0DAA8E;AAC9E,sEAAwE;AACxE,8EAA+M;AAC/M,4EAAwQ;AAExQ,4DAAoE;AACpE,yCAAiD;AAEjD,SAAS,cAAc,CAAC,SAAkC,EAAE,KAAc;IACtE,IAAI,KAAK,YAAY,8BAAmB;QACpC,OAAO,KAAK,CAAC;IACjB,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EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,WAAoB,CAAC,CAAC,CAAC,QAAiB;gBACzE,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;aACvD,CAAC,CAAC,CAAC;QACR,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC;YACjB,MAAM,EAAE,WAAoB;YAC5B,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC;SACpC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import { resolve } from \"node:path\";\nimport { Clock, Effect, Result } from \"effect\";\nimport type { ProjectStateDatabase } from \"../../record/sqlite/project-state-database.ts\";\nimport { cleanupCallback } from \"../../runner/cleanup-timeout.ts\";\nimport { discoverEvals, discoverExperiments } from \"../../runner/discover.ts\";\nimport { resolveExperimentEvals } from \"../../runner/eval-selection.ts\";\nimport { beginExplicitSharedStateRecoveryEffect, completeExplicitSharedStateRecoveryEffect, readSharedStateLeaseRecoveryTargetEffect, type SharedStateLeaseRecord, } from \"../../runner/shared-state-lease.ts\";\nimport { isExactTeardownRegistrationOwnerTerminatedEffect, isOrphanedTeardownRegistration, readExactTeardownRegistrationEffect, readTeardownRegistrationsEffect, removeTeardownRegistrationIfPresentEffect, teardownEntryId, } from \"../../runner/teardown-registry.ts\";\nimport type { DiscoveredExperiment, ExperimentHook, ExperimentHookContext, } from \"../../runner/types.ts\";\nimport { matchExperimentSelector } from \"../../shared/aggregate.ts\";\nimport { ExperimentHostError } from \"./types.ts\";\nimport type { ExperimentHostTeardownEvent, ExperimentHostTeardownObserver, ExperimentHostOperation, ExperimentHostSharedStateEvidence, ExperimentHostTeardownInspection, ExperimentHostTeardownInspectRequest, ExperimentHostTeardownRequest, ExperimentHostTeardownResult, } from \"./types.ts\";\nfunction operationError(operation: ExperimentHostOperation, cause: unknown): ExperimentHostError {\n if (cause instanceof ExperimentHostError)\n return cause;\n const code = typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"code\") === \"string\"\n ? String(Reflect.get(cause, \"code\"))\n : \"experiment-host-operation-failed\";\n return new ExperimentHostError({\n operation,\n code,\n message: cause instanceof Error ? cause.message : String(cause),\n });\n}\nfunction closeOperation<A, E, R>(operation: ExperimentHostOperation, effect: Effect.Effect<A, E, R>): Effect.Effect<A, ExperimentHostError, R> {\n return effect.pipe(Effect.mapError((cause) => operationError(operation, cause)));\n}\nfunction recoveryOperationError(code: string, cause: unknown): ExperimentHostError {\n return new ExperimentHostError({\n operation: \"teardown-run\",\n code,\n message: cause instanceof Error ? cause.message : String(cause),\n });\n}\ninterface TeardownSelection {\n readonly experimentIds: readonly string[];\n readonly selected: readonly {\n readonly experiment: DiscoveredExperiment;\n readonly selectedEvalIds: readonly string[];\n }[];\n}\nfunction freezeArray<A>(values: Iterable<A>): readonly A[] {\n return Object.freeze([...values]);\n}\nfunction selectTeardowns(input: {\n readonly cwd: string;\n readonly experimentSelector?: string;\n}): Effect.Effect<TeardownSelection, unknown> {\n return Effect.gen(function* () {\n const evals = yield* discoverEvals(input.cwd);\n const experiments = yield* discoverExperiments(input.cwd);\n const experimentIds = freezeArray(experiments.map((experiment) => experiment.id));\n const matched = input.experimentSelector === undefined\n ? experiments\n : experiments.filter((experiment) => matchExperimentSelector(experimentIds, input.experimentSelector!).includes(experiment.id));\n return Object.freeze({\n experimentIds,\n selected: freezeArray(matched.map((experiment) => {\n const selection = resolveExperimentEvals({\n experimentId: experiment.id,\n selector: experiment.evals,\n cliPatterns: [],\n evals,\n });\n return Object.freeze({\n experiment,\n selectedEvalIds: freezeArray(selection.selectedEvalIds),\n });\n })),\n });\n });\n}\nfunction teardownOf(experiment: DiscoveredExperiment): ExperimentHook | undefined {\n return typeof experiment.teardown === \"function\" ? experiment.teardown : undefined;\n}\nfunction evidenceOf(record: SharedStateLeaseRecord): ExperimentHostSharedStateEvidence {\n return Object.freeze({\n key: record.key,\n experimentId: record.experimentId,\n ownerToken: record.ownerToken,\n host: record.host,\n pid: record.pid,\n processIdentity: record.processIdentity,\n heartbeatAt: record.heartbeatAt,\n });\n}\nfunction noExperimentMatch(selector: string, selection: TeardownSelection): ExperimentHostTeardownInspection {\n return Object.freeze({\n status: \"experiment-no-match\" as const,\n selector,\n candidates: freezeArray([...selection.experimentIds].sort()),\n });\n}\nfunction inspectExactRegistration(input: {\n readonly coordinationRoot: string;\n readonly record: SharedStateLeaseRecord;\n readonly currentHost: string;\n}): Effect.Effect<boolean, unknown, ProjectStateDatabase> {\n const id = teardownEntryId(input.record.experimentId, input.record.pid);\n return Effect.gen(function* () {\n const registration = yield* readExactTeardownRegistrationEffect(input.coordinationRoot, input.record.experimentId, input.record.pid);\n if (registration === undefined)\n return false;\n if (registration.host !== input.record.host) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} belongs to host ${JSON.stringify(registration.host)}, ` +\n `not immutable sharedState owner host ${JSON.stringify(input.record.host)}`));\n }\n const terminated = yield* isExactTeardownRegistrationOwnerTerminatedEffect({\n registration,\n owner: input.record,\n currentHost: input.currentHost,\n });\n if (!terminated) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} still belongs to a live exact sharedState owner`));\n }\n return true;\n });\n}\nfunction clearExactRegistration(input: {\n readonly coordinationRoot: string;\n readonly record: SharedStateLeaseRecord;\n readonly currentHost: string;\n readonly expectedRegistration: boolean;\n}): Effect.Effect<void, unknown, ProjectStateDatabase> {\n const id = teardownEntryId(input.record.experimentId, input.record.pid);\n return Effect.gen(function* () {\n const present = yield* inspectExactRegistration(input);\n if (!present) {\n if (input.expectedRegistration) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} disappeared before recovery could clear it`));\n }\n return;\n }\n if (!input.expectedRegistration) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} appeared after recovery was claimed`));\n }\n if (!(yield* removeTeardownRegistrationIfPresentEffect(input.coordinationRoot, id))) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} changed before recovery could clear it`));\n }\n });\n}\nfunction emit(observer: ExperimentHostTeardownObserver | undefined, event: ExperimentHostTeardownEvent): void {\n try {\n observer?.observe(Object.freeze(event));\n }\n catch {\n // Feedback is transient and must never hold recovery authority closed.\n }\n}\nfunction hookContext(input: {\n readonly experimentId: string;\n readonly selectedEvalIds: readonly string[];\n readonly observer?: ExperimentHostTeardownObserver;\n readonly signal?: AbortSignal;\n}): ExperimentHookContext {\n return {\n experimentId: input.experimentId,\n selectedEvalIds: input.selectedEvalIds,\n signal: input.signal ?? new AbortController().signal,\n progress: (progress) => emit(input.observer, {\n type: \"experiment-progress\",\n experimentId: input.experimentId,\n detail: progress.message,\n }),\n diagnostic: (diagnostic) => emit(input.observer, {\n type: \"diagnostic\",\n code: diagnostic.code,\n level: diagnostic.level,\n message: diagnostic.message,\n ...(diagnostic.data === undefined ? {} : { data: Object.freeze({ ...diagnostic.data }) }),\n }),\n };\n}\nfunction runAuthorTeardown(input: {\n readonly experiment: DiscoveredExperiment;\n readonly selectedEvalIds: readonly string[];\n readonly observer?: ExperimentHostTeardownObserver;\n readonly signal?: AbortSignal;\n readonly recovery: boolean;\n}) {\n const teardown = teardownOf(input.experiment);\n if (teardown === undefined)\n return Effect.succeed(false as const);\n return Effect.gen(function* () {\n const startedAt = yield* Clock.currentTimeMillis;\n emit(input.observer, {\n type: \"experiment-hook\",\n experimentId: input.experiment.id,\n hook: \"teardown\",\n status: \"started\",\n ...(input.recovery ? { recovery: true } : {}),\n });\n const outcome = yield* Effect.result(cleanupCallback(() => teardown(hookContext({\n experimentId: input.experiment.id,\n selectedEvalIds: input.selectedEvalIds,\n ...(input.observer === undefined ? {} : { observer: input.observer }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n }))));\n const completedAt = yield* Clock.currentTimeMillis;\n emit(input.observer, {\n type: \"experiment-hook\",\n experimentId: input.experiment.id,\n hook: \"teardown\",\n status: Result.isSuccess(outcome) ? \"done\" : \"failed\",\n durationMs: Math.max(0, completedAt - startedAt),\n });\n return outcome;\n });\n}\nexport function inspectTeardown(input: ExperimentHostTeardownInspectRequest): Effect.Effect<ExperimentHostTeardownInspection, ExperimentHostError, ProjectStateDatabase> {\n return closeOperation(\"teardown-inspect\", Effect.gen(function* () {\n const selection = yield* selectTeardowns(input);\n if (input.experimentSelector !== undefined && selection.selected.length === 0) {\n return noExperimentMatch(input.experimentSelector, selection);\n }\n const coordinationRoot = resolve(input.cwd, input.coordinationRoot ?? \".niceeval\");\n if (input.recoveryKey !== undefined) {\n const record = yield* readSharedStateLeaseRecoveryTargetEffect(coordinationRoot, input.recoveryKey);\n if (record === undefined) {\n return Object.freeze({ status: \"no-evidence\" as const, key: input.recoveryKey });\n }\n const evidence = evidenceOf(record);\n if (selection.selected.length !== 1) {\n return Object.freeze({\n status: \"selection-not-unique\" as const,\n experimentIds: freezeArray(selection.selected.map(({ experiment }) => experiment.id)),\n evidence,\n });\n }\n const target = selection.selected[0]!;\n if (target.experiment.id !== record.experimentId) {\n return Object.freeze({\n status: \"experiment-mismatch\" as const,\n selectedExperimentId: target.experiment.id,\n evidence,\n });\n }\n if (teardownOf(target.experiment) === undefined) {\n return Object.freeze({\n status: \"teardown-required\" as const,\n experimentId: target.experiment.id,\n evidence,\n });\n }\n const registrations = yield* readTeardownRegistrationsEffect(coordinationRoot);\n return Object.freeze({\n status: \"ready\" as const,\n experimentIds: Object.freeze([target.experiment.id]),\n orphanedRegistrations: registrations.filter(({ entry }) => entry.experimentId === target.experiment.id &&\n isOrphanedTeardownRegistration(entry, input.currentHost)).length,\n evidence,\n });\n }\n const registrations = yield* readTeardownRegistrationsEffect(coordinationRoot);\n const selectedIds = new Set(selection.selected.map(({ experiment }) => experiment.id));\n return Object.freeze({\n status: \"ready\" as const,\n experimentIds: freezeArray(selectedIds),\n orphanedRegistrations: registrations.filter(({ entry }) => selectedIds.has(entry.experimentId) &&\n isOrphanedTeardownRegistration(entry, input.currentHost)).length,\n });\n }));\n}\nfunction runExplicitRecovery(input: ExperimentHostTeardownRequest, selection: TeardownSelection, record: SharedStateLeaseRecord): Effect.Effect<ExperimentHostTeardownResult, unknown, ProjectStateDatabase> {\n return Effect.gen(function* () {\n const evidence = evidenceOf(record);\n if (selection.selected.length !== 1) {\n return Object.freeze({\n status: \"selection-not-unique\" as const,\n experimentIds: freezeArray(selection.selected.map(({ experiment }) => experiment.id)),\n evidence,\n });\n }\n const target = selection.selected[0]!;\n if (target.experiment.id !== record.experimentId) {\n return Object.freeze({\n status: \"experiment-mismatch\" as const,\n selectedExperimentId: target.experiment.id,\n evidence,\n });\n }\n if (teardownOf(target.experiment) === undefined) {\n return Object.freeze({\n status: \"teardown-required\" as const,\n experimentId: target.experiment.id,\n evidence,\n });\n }\n if (input.ownerToken === undefined ||\n input.confirmOwnerTerminated !== true ||\n input.confirmRemoteQuiesced !== true) {\n return Object.freeze({ status: \"recovery-confirmation-required\" as const, evidence });\n }\n const coordinationRoot = resolve(input.cwd, input.coordinationRoot ?? \".niceeval\");\n const begun = yield* beginExplicitSharedStateRecoveryEffect({\n niceevalRoot: coordinationRoot,\n key: record.key,\n ownerToken: input.ownerToken,\n localHost: input.currentHost,\n confirmOwnerTerminated: true,\n confirmRemoteQuiesced: true,\n });\n const claimedEvidence = evidenceOf(begun.record);\n const registrationFailureCode = begun._tag === \"AlreadyReleased\"\n ? \"shared-state-recovery-already-released-registration-failed\"\n : \"shared-state-recovery-registration-failed\";\n const registrationWasPresent = yield* inspectExactRegistration({\n coordinationRoot,\n record: begun.record,\n currentHost: input.currentHost,\n }).pipe(Effect.mapError((cause) => recoveryOperationError(registrationFailureCode, cause)));\n if (begun._tag === \"AlreadyReleased\") {\n yield* clearExactRegistration({\n coordinationRoot,\n record: begun.record,\n currentHost: input.currentHost,\n expectedRegistration: registrationWasPresent,\n }).pipe(Effect.mapError((cause) => recoveryOperationError(registrationFailureCode, cause)));\n return Object.freeze({\n status: \"already-released\" as const,\n key: begun.record.key,\n experimentId: begun.record.experimentId,\n ownerToken: begun.record.ownerToken,\n });\n }\n const outcome = yield* runAuthorTeardown({\n experiment: target.experiment,\n selectedEvalIds: target.selectedEvalIds,\n ...(input.observer === undefined ? {} : { observer: input.observer }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n recovery: true,\n });\n if (outcome === false) {\n return yield* Effect.fail(new Error(\"Recovery target lost its required teardown callback.\"));\n }\n if (Result.isFailure(outcome)) {\n return Object.freeze({\n status: \"recovery-teardown-failed\" as const,\n evidence: claimedEvidence,\n error: outcome.failure instanceof Error ? outcome.failure.message : String(outcome.failure),\n });\n }\n yield* clearExactRegistration({\n coordinationRoot,\n record: begun.record,\n currentHost: input.currentHost,\n expectedRegistration: registrationWasPresent,\n }).pipe(Effect.mapError((cause) => recoveryOperationError(registrationFailureCode, cause)));\n yield* completeExplicitSharedStateRecoveryEffect({\n niceevalRoot: coordinationRoot,\n key: begun.record.key,\n ownerToken: begun.record.ownerToken,\n recoveryId: begun.recoveryId,\n localHost: input.currentHost,\n }).pipe(Effect.mapError((cause) => recoveryOperationError(\"shared-state-recovery-completion-failed\", cause)));\n return Object.freeze({\n status: \"recovered\" as const,\n key: begun.record.key,\n experimentId: begun.record.experimentId,\n ownerToken: begun.record.ownerToken,\n });\n });\n}\nexport function runTeardown(input: ExperimentHostTeardownRequest): Effect.Effect<ExperimentHostTeardownResult, ExperimentHostError, ProjectStateDatabase> {\n return closeOperation(\"teardown-run\", Effect.gen(function* () {\n const inspection = yield* inspectTeardown(input);\n if (inspection.status !== \"ready\")\n return inspection;\n const selection = yield* selectTeardowns(input);\n if (input.recoveryKey !== undefined) {\n if (inspection.evidence === undefined || selection.selected.length !== 1)\n return inspection;\n const record = yield* readSharedStateLeaseRecoveryTargetEffect(resolve(input.cwd, input.coordinationRoot ?? \".niceeval\"), input.recoveryKey);\n if (record === undefined) {\n return Object.freeze({ status: \"no-evidence\" as const, key: input.recoveryKey });\n }\n return yield* runExplicitRecovery(input, selection, record);\n }\n const coordinationRoot = resolve(input.cwd, input.coordinationRoot ?? \".niceeval\");\n const registrations = yield* readTeardownRegistrationsEffect(coordinationRoot);\n const results: Array<{\n readonly experimentId: string;\n readonly executions: number;\n readonly outcome: \"succeeded\" | \"failed\" | \"not-configured\";\n readonly error?: string;\n }> = [];\n for (const target of selection.selected) {\n if (teardownOf(target.experiment) === undefined) {\n results.push(Object.freeze({\n experimentId: target.experiment.id,\n executions: 0,\n outcome: \"not-configured\" as const,\n }));\n continue;\n }\n const matching = registrations.filter(({ entry }) => entry.experimentId === target.experiment.id);\n const orphaned = matching.filter(({ entry }) => isOrphanedTeardownRegistration(entry, input.currentHost));\n const claimed = yield* Effect.all(orphaned.map(({ id }) => removeTeardownRegistrationIfPresentEffect(coordinationRoot, id)), {\n concurrency: \"unbounded\",\n });\n const executions = matching.length === 0 ? 1 : claimed.filter(Boolean).length;\n let failure: string | undefined;\n for (let index = 0; index < executions; index += 1) {\n const outcome = yield* runAuthorTeardown({\n experiment: target.experiment,\n selectedEvalIds: target.selectedEvalIds,\n ...(input.observer === undefined ? {} : { observer: input.observer }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n recovery: true,\n });\n if (outcome !== false && Result.isFailure(outcome)) {\n failure = outcome.failure instanceof Error ? outcome.failure.message : String(outcome.failure);\n }\n }\n results.push(Object.freeze({\n experimentId: target.experiment.id,\n executions,\n outcome: failure === undefined ? \"succeeded\" as const : \"failed\" as const,\n ...(failure === undefined ? {} : { error: failure }),\n }));\n }\n return Object.freeze({\n status: \"completed\" as const,\n experiments: freezeArray(results),\n });\n }));\n}\n"]}
1
+ {"version":3,"file":"teardown.js","sourceRoot":"","sources":["teardown.ts"],"names":[],"mappings":";;AAkNA,0CAqDC;AAqGD,kCA+DC;AA3aD,yCAAoC;AACpC,mCAA+C;AAE/C,wEAAkE;AAClE,0DAA8E;AAC9E,sEAAwE;AACxE,8EAA+M;AAC/M,4EAAwQ;AAExQ,4DAAoE;AAC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AAC;YACL,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;gBACvB,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE;gBAClC,UAAU;gBACV,OAAO,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,WAAoB,CAAC,CAAC,CAAC,QAAiB;gBACzE,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;aACvD,CAAC,CAAC,CAAC;QACR,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC;YACjB,MAAM,EAAE,WAAoB;YAC5B,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC;SACpC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import { resolve } from \"node:path\";\nimport { Clock, Effect, Result } from \"effect\";\nimport type { ProjectStateDatabase } from \"../../record/sqlite/project-state-database.ts\";\nimport { cleanupCallback } from \"../../runner/cleanup-timeout.ts\";\nimport { discoverEvals, discoverExperiments } from \"../../runner/discover.ts\";\nimport { resolveExperimentEvals } from \"../../runner/eval-selection.ts\";\nimport { beginExplicitSharedStateRecoveryEffect, completeExplicitSharedStateRecoveryEffect, readSharedStateLeaseRecoveryTargetEffect, type SharedStateLeaseRecord, } from \"../../runner/shared-state-lease.ts\";\nimport { isExactTeardownRegistrationOwnerTerminatedEffect, isOrphanedTeardownRegistration, readExactTeardownRegistrationEffect, readTeardownRegistrationsEffect, removeTeardownRegistrationIfPresentEffect, teardownEntryId, } from \"../../runner/teardown-registry.ts\";\nimport type { DiscoveredExperiment, ExperimentHook, ExperimentHookContext, } from \"../../runner/types.ts\";\nimport { matchExperimentSelector } from \"../../shared/aggregate.ts\";\nimport { ExperimentHostError } from \"./types.ts\";\nimport type { ExperimentHostAfterEvent, ExperimentHostAfterObserver, ExperimentHostOperation, ExperimentHostSharedStateEvidence, ExperimentHostAfterInspection, ExperimentHostAfterInspectRequest, ExperimentHostAfterRequest, ExperimentHostAfterResult, } from \"./types.ts\";\nfunction operationError(operation: ExperimentHostOperation, cause: unknown): ExperimentHostError {\n if (cause instanceof ExperimentHostError)\n return cause;\n const code = typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"code\") === \"string\"\n ? String(Reflect.get(cause, \"code\"))\n : \"experiment-host-operation-failed\";\n return new ExperimentHostError({\n operation,\n code,\n message: cause instanceof Error ? cause.message : String(cause),\n });\n}\nfunction closeOperation<A, E, R>(operation: ExperimentHostOperation, effect: Effect.Effect<A, E, R>): Effect.Effect<A, ExperimentHostError, R> {\n return effect.pipe(Effect.mapError((cause) => operationError(operation, cause)));\n}\nfunction recoveryOperationError(code: string, cause: unknown): ExperimentHostError {\n return new ExperimentHostError({\n operation: \"teardown-run\",\n code,\n message: cause instanceof Error ? cause.message : String(cause),\n });\n}\ninterface TeardownSelection {\n readonly experimentIds: readonly string[];\n readonly selected: readonly {\n readonly experiment: DiscoveredExperiment;\n readonly selectedEvalIds: readonly string[];\n }[];\n}\nfunction freezeArray<A>(values: Iterable<A>): readonly A[] {\n return Object.freeze([...values]);\n}\nfunction selectTeardowns(input: {\n readonly cwd: string;\n readonly experimentSelector?: string;\n}): Effect.Effect<TeardownSelection, unknown> {\n return Effect.gen(function* () {\n const evals = yield* discoverEvals(input.cwd);\n const experiments = yield* discoverExperiments(input.cwd);\n const experimentIds = freezeArray(experiments.map((experiment) => experiment.id));\n const matched = input.experimentSelector === undefined\n ? experiments\n : experiments.filter((experiment) => matchExperimentSelector(experimentIds, input.experimentSelector!).includes(experiment.id));\n return Object.freeze({\n experimentIds,\n selected: freezeArray(matched.map((experiment) => {\n const selection = resolveExperimentEvals({\n experimentId: experiment.id,\n validateModelRequirements: false,\n selector: experiment.evals,\n cliPatterns: [],\n evals,\n });\n return Object.freeze({\n experiment,\n selectedEvalIds: freezeArray(selection.selectedEvalIds),\n });\n })),\n });\n });\n}\nfunction teardownOf(experiment: DiscoveredExperiment): ExperimentHook | undefined {\n return typeof experiment.after === \"function\" ? experiment.after : undefined;\n}\nfunction evidenceOf(record: SharedStateLeaseRecord): ExperimentHostSharedStateEvidence {\n return Object.freeze({\n key: record.key,\n experimentId: record.experimentId,\n ownerToken: record.ownerToken,\n host: record.host,\n pid: record.pid,\n processIdentity: record.processIdentity,\n heartbeatAt: record.heartbeatAt,\n });\n}\nfunction noExperimentMatch(selector: string, selection: TeardownSelection): ExperimentHostAfterInspection {\n return Object.freeze({\n status: \"experiment-no-match\" as const,\n selector,\n candidates: freezeArray([...selection.experimentIds].sort()),\n });\n}\nfunction inspectExactRegistration(input: {\n readonly coordinationRoot: string;\n readonly record: SharedStateLeaseRecord;\n readonly currentHost: string;\n}): Effect.Effect<boolean, unknown, ProjectStateDatabase> {\n const id = teardownEntryId(input.record.experimentId, input.record.pid);\n return Effect.gen(function* () {\n const registration = yield* readExactTeardownRegistrationEffect(input.coordinationRoot, input.record.experimentId, input.record.pid);\n if (registration === undefined)\n return false;\n if (registration.host !== input.record.host) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} belongs to host ${JSON.stringify(registration.host)}, ` +\n `not immutable sharedState owner host ${JSON.stringify(input.record.host)}`));\n }\n const terminated = yield* isExactTeardownRegistrationOwnerTerminatedEffect({\n registration,\n owner: input.record,\n currentHost: input.currentHost,\n });\n if (!terminated) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} still belongs to a live exact sharedState owner`));\n }\n return true;\n });\n}\nfunction clearExactRegistration(input: {\n readonly coordinationRoot: string;\n readonly record: SharedStateLeaseRecord;\n readonly currentHost: string;\n readonly expectedRegistration: boolean;\n}): Effect.Effect<void, unknown, ProjectStateDatabase> {\n const id = teardownEntryId(input.record.experimentId, input.record.pid);\n return Effect.gen(function* () {\n const present = yield* inspectExactRegistration(input);\n if (!present) {\n if (input.expectedRegistration) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} disappeared before recovery could clear it`));\n }\n return;\n }\n if (!input.expectedRegistration) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} appeared after recovery was claimed`));\n }\n if (!(yield* removeTeardownRegistrationIfPresentEffect(input.coordinationRoot, id))) {\n return yield* Effect.fail(new Error(`teardown registration ${JSON.stringify(id)} changed before recovery could clear it`));\n }\n });\n}\nfunction emit(observer: ExperimentHostAfterObserver | undefined, event: ExperimentHostAfterEvent): void {\n try {\n observer?.observe(Object.freeze(event));\n }\n catch {\n // Feedback is transient and must never hold recovery authority closed.\n }\n}\nfunction hookContext(input: {\n readonly experimentId: string;\n readonly selectedEvalIds: readonly string[];\n readonly observer?: ExperimentHostAfterObserver;\n readonly signal?: AbortSignal;\n}): ExperimentHookContext {\n return {\n experimentId: input.experimentId,\n selectedEvalIds: input.selectedEvalIds,\n signal: input.signal ?? new AbortController().signal,\n progress: (progress) => emit(input.observer, {\n type: \"experiment-progress\",\n experimentId: input.experimentId,\n detail: progress.message,\n }),\n diagnostic: (diagnostic) => emit(input.observer, {\n type: \"diagnostic\",\n code: diagnostic.code,\n level: diagnostic.level,\n message: diagnostic.message,\n ...(diagnostic.data === undefined ? {} : { data: Object.freeze({ ...diagnostic.data }) }),\n }),\n };\n}\nfunction runAuthorTeardown(input: {\n readonly experiment: DiscoveredExperiment;\n readonly selectedEvalIds: readonly string[];\n readonly observer?: ExperimentHostAfterObserver;\n readonly signal?: AbortSignal;\n readonly recovery: boolean;\n}) {\n const teardown = teardownOf(input.experiment);\n if (teardown === undefined)\n return Effect.succeed(false as const);\n return Effect.gen(function* () {\n const startedAt = yield* Clock.currentTimeMillis;\n emit(input.observer, {\n type: \"experiment-hook\",\n experimentId: input.experiment.id,\n hook: \"teardown\",\n status: \"started\",\n ...(input.recovery ? { recovery: true } : {}),\n });\n const outcome = yield* Effect.result(cleanupCallback(() => teardown(hookContext({\n experimentId: input.experiment.id,\n selectedEvalIds: input.selectedEvalIds,\n ...(input.observer === undefined ? {} : { observer: input.observer }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n }))));\n const completedAt = yield* Clock.currentTimeMillis;\n emit(input.observer, {\n type: \"experiment-hook\",\n experimentId: input.experiment.id,\n hook: \"teardown\",\n status: Result.isSuccess(outcome) ? \"done\" : \"failed\",\n durationMs: Math.max(0, completedAt - startedAt),\n });\n return outcome;\n });\n}\nexport function inspectTeardown(input: ExperimentHostAfterInspectRequest): Effect.Effect<ExperimentHostAfterInspection, ExperimentHostError, ProjectStateDatabase> {\n return closeOperation(\"teardown-inspect\", Effect.gen(function* () {\n const selection = yield* selectTeardowns(input);\n if (input.experimentSelector !== undefined && selection.selected.length === 0) {\n return noExperimentMatch(input.experimentSelector, selection);\n }\n const coordinationRoot = resolve(input.cwd, input.coordinationRoot ?? \".niceeval\");\n if (input.recoveryKey !== undefined) {\n const record = yield* readSharedStateLeaseRecoveryTargetEffect(coordinationRoot, input.recoveryKey);\n if (record === undefined) {\n return Object.freeze({ status: \"no-evidence\" as const, key: input.recoveryKey });\n }\n const evidence = evidenceOf(record);\n if (selection.selected.length !== 1) {\n return Object.freeze({\n status: \"selection-not-unique\" as const,\n experimentIds: freezeArray(selection.selected.map(({ experiment }) => experiment.id)),\n evidence,\n });\n }\n const target = selection.selected[0]!;\n if (target.experiment.id !== record.experimentId) {\n return Object.freeze({\n status: \"experiment-mismatch\" as const,\n selectedExperimentId: target.experiment.id,\n evidence,\n });\n }\n if (teardownOf(target.experiment) === undefined) {\n return Object.freeze({\n status: \"after-required\" as const,\n experimentId: target.experiment.id,\n evidence,\n });\n }\n const registrations = yield* readTeardownRegistrationsEffect(coordinationRoot);\n return Object.freeze({\n status: \"ready\" as const,\n experimentIds: Object.freeze([target.experiment.id]),\n orphanedRegistrations: registrations.filter(({ entry }) => entry.experimentId === target.experiment.id &&\n isOrphanedTeardownRegistration(entry, input.currentHost)).length,\n evidence,\n });\n }\n const registrations = yield* readTeardownRegistrationsEffect(coordinationRoot);\n const selectedIds = new Set(selection.selected.map(({ experiment }) => experiment.id));\n return Object.freeze({\n status: \"ready\" as const,\n experimentIds: freezeArray(selectedIds),\n orphanedRegistrations: registrations.filter(({ entry }) => selectedIds.has(entry.experimentId) &&\n isOrphanedTeardownRegistration(entry, input.currentHost)).length,\n });\n }));\n}\nfunction runExplicitRecovery(input: ExperimentHostAfterRequest, selection: TeardownSelection, record: SharedStateLeaseRecord): Effect.Effect<ExperimentHostAfterResult, unknown, ProjectStateDatabase> {\n return Effect.gen(function* () {\n const evidence = evidenceOf(record);\n if (selection.selected.length !== 1) {\n return Object.freeze({\n status: \"selection-not-unique\" as const,\n experimentIds: freezeArray(selection.selected.map(({ experiment }) => experiment.id)),\n evidence,\n });\n }\n const target = selection.selected[0]!;\n if (target.experiment.id !== record.experimentId) {\n return Object.freeze({\n status: \"experiment-mismatch\" as const,\n selectedExperimentId: target.experiment.id,\n evidence,\n });\n }\n if (teardownOf(target.experiment) === undefined) {\n return Object.freeze({\n status: \"after-required\" as const,\n experimentId: target.experiment.id,\n evidence,\n });\n }\n if (input.ownerToken === undefined ||\n input.confirmOwnerTerminated !== true ||\n input.confirmRemoteQuiesced !== true) {\n return Object.freeze({ status: \"recovery-confirmation-required\" as const, evidence });\n }\n const coordinationRoot = resolve(input.cwd, input.coordinationRoot ?? \".niceeval\");\n const begun = yield* beginExplicitSharedStateRecoveryEffect({\n niceevalRoot: coordinationRoot,\n key: record.key,\n ownerToken: input.ownerToken,\n localHost: input.currentHost,\n confirmOwnerTerminated: true,\n confirmRemoteQuiesced: true,\n });\n const claimedEvidence = evidenceOf(begun.record);\n const registrationFailureCode = begun._tag === \"AlreadyReleased\"\n ? \"shared-state-recovery-already-released-registration-failed\"\n : \"shared-state-recovery-registration-failed\";\n const registrationWasPresent = yield* inspectExactRegistration({\n coordinationRoot,\n record: begun.record,\n currentHost: input.currentHost,\n }).pipe(Effect.mapError((cause) => recoveryOperationError(registrationFailureCode, cause)));\n if (begun._tag === \"AlreadyReleased\") {\n yield* clearExactRegistration({\n coordinationRoot,\n record: begun.record,\n currentHost: input.currentHost,\n expectedRegistration: registrationWasPresent,\n }).pipe(Effect.mapError((cause) => recoveryOperationError(registrationFailureCode, cause)));\n return Object.freeze({\n status: \"already-released\" as const,\n key: begun.record.key,\n experimentId: begun.record.experimentId,\n ownerToken: begun.record.ownerToken,\n });\n }\n const outcome = yield* runAuthorTeardown({\n experiment: target.experiment,\n selectedEvalIds: target.selectedEvalIds,\n ...(input.observer === undefined ? {} : { observer: input.observer }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n recovery: true,\n });\n if (outcome === false) {\n return yield* Effect.fail(new Error(\"Recovery target lost its required teardown callback.\"));\n }\n if (Result.isFailure(outcome)) {\n return Object.freeze({\n status: \"recovery-teardown-failed\" as const,\n evidence: claimedEvidence,\n error: outcome.failure instanceof Error ? outcome.failure.message : String(outcome.failure),\n });\n }\n yield* clearExactRegistration({\n coordinationRoot,\n record: begun.record,\n currentHost: input.currentHost,\n expectedRegistration: registrationWasPresent,\n }).pipe(Effect.mapError((cause) => recoveryOperationError(registrationFailureCode, cause)));\n yield* completeExplicitSharedStateRecoveryEffect({\n niceevalRoot: coordinationRoot,\n key: begun.record.key,\n ownerToken: begun.record.ownerToken,\n recoveryId: begun.recoveryId,\n localHost: input.currentHost,\n }).pipe(Effect.mapError((cause) => recoveryOperationError(\"shared-state-recovery-completion-failed\", cause)));\n return Object.freeze({\n status: \"recovered\" as const,\n key: begun.record.key,\n experimentId: begun.record.experimentId,\n ownerToken: begun.record.ownerToken,\n });\n });\n}\nexport function runTeardown(input: ExperimentHostAfterRequest): Effect.Effect<ExperimentHostAfterResult, ExperimentHostError, ProjectStateDatabase> {\n return closeOperation(\"teardown-run\", Effect.gen(function* () {\n const inspection = yield* inspectTeardown(input);\n if (inspection.status !== \"ready\")\n return inspection;\n const selection = yield* selectTeardowns(input);\n if (input.recoveryKey !== undefined) {\n if (inspection.evidence === undefined || selection.selected.length !== 1)\n return inspection;\n const record = yield* readSharedStateLeaseRecoveryTargetEffect(resolve(input.cwd, input.coordinationRoot ?? \".niceeval\"), input.recoveryKey);\n if (record === undefined) {\n return Object.freeze({ status: \"no-evidence\" as const, key: input.recoveryKey });\n }\n return yield* runExplicitRecovery(input, selection, record);\n }\n const coordinationRoot = resolve(input.cwd, input.coordinationRoot ?? \".niceeval\");\n const registrations = yield* readTeardownRegistrationsEffect(coordinationRoot);\n const results: Array<{\n readonly experimentId: string;\n readonly executions: number;\n readonly outcome: \"succeeded\" | \"failed\" | \"not-configured\";\n readonly error?: string;\n }> = [];\n for (const target of selection.selected) {\n if (teardownOf(target.experiment) === undefined) {\n results.push(Object.freeze({\n experimentId: target.experiment.id,\n executions: 0,\n outcome: \"not-configured\" as const,\n }));\n continue;\n }\n const matching = registrations.filter(({ entry }) => entry.experimentId === target.experiment.id);\n const orphaned = matching.filter(({ entry }) => isOrphanedTeardownRegistration(entry, input.currentHost));\n const claimed = yield* Effect.all(orphaned.map(({ id }) => removeTeardownRegistrationIfPresentEffect(coordinationRoot, id)), {\n concurrency: \"unbounded\",\n });\n const executions = matching.length === 0 ? 1 : claimed.filter(Boolean).length;\n let failure: string | undefined;\n for (let index = 0; index < executions; index += 1) {\n const outcome = yield* runAuthorTeardown({\n experiment: target.experiment,\n selectedEvalIds: target.selectedEvalIds,\n ...(input.observer === undefined ? {} : { observer: input.observer }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n recovery: true,\n });\n if (outcome !== false && Result.isFailure(outcome)) {\n failure = outcome.failure instanceof Error ? outcome.failure.message : String(outcome.failure);\n }\n }\n results.push(Object.freeze({\n experimentId: target.experiment.id,\n executions,\n outcome: failure === undefined ? \"succeeded\" as const : \"failed\" as const,\n ...(failure === undefined ? {} : { error: failure }),\n }));\n }\n return Object.freeze({\n status: \"completed\" as const,\n experiments: freezeArray(results),\n });\n }));\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import type { ProjectStateDatabase } from "../../record/sqlite/project-state-database.cjs";
3
3
  import { ExperimentHostError } from "./types.cjs";
4
- import type { ExperimentHostTeardownInspection, ExperimentHostTeardownInspectRequest, ExperimentHostTeardownRequest, ExperimentHostTeardownResult } from "./types.cjs";
5
- export declare function inspectTeardown(input: ExperimentHostTeardownInspectRequest): Effect.Effect<ExperimentHostTeardownInspection, ExperimentHostError, ProjectStateDatabase>;
6
- export declare function runTeardown(input: ExperimentHostTeardownRequest): Effect.Effect<ExperimentHostTeardownResult, ExperimentHostError, ProjectStateDatabase>;
4
+ import type { ExperimentHostAfterInspection, ExperimentHostAfterInspectRequest, ExperimentHostAfterRequest, ExperimentHostAfterResult } from "./types.cjs";
5
+ export declare function inspectTeardown(input: ExperimentHostAfterInspectRequest): Effect.Effect<ExperimentHostAfterInspection, ExperimentHostError, ProjectStateDatabase>;
6
+ export declare function runTeardown(input: ExperimentHostAfterRequest): Effect.Effect<ExperimentHostAfterResult, ExperimentHostError, ProjectStateDatabase>;
@@ -1,6 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import type { ProjectStateDatabase } from "../../record/sqlite/project-state-database.mjs";
3
3
  import { ExperimentHostError } from "./types.mjs";
4
- import type { ExperimentHostTeardownInspection, ExperimentHostTeardownInspectRequest, ExperimentHostTeardownRequest, ExperimentHostTeardownResult } from "./types.mjs";
5
- export declare function inspectTeardown(input: ExperimentHostTeardownInspectRequest): Effect.Effect<ExperimentHostTeardownInspection, ExperimentHostError, ProjectStateDatabase>;
6
- export declare function runTeardown(input: ExperimentHostTeardownRequest): Effect.Effect<ExperimentHostTeardownResult, ExperimentHostError, ProjectStateDatabase>;
4
+ import type { ExperimentHostAfterInspection, ExperimentHostAfterInspectRequest, ExperimentHostAfterRequest, ExperimentHostAfterResult } from "./types.mjs";
5
+ export declare function inspectTeardown(input: ExperimentHostAfterInspectRequest): Effect.Effect<ExperimentHostAfterInspection, ExperimentHostError, ProjectStateDatabase>;
6
+ export declare function runTeardown(input: ExperimentHostAfterRequest): Effect.Effect<ExperimentHostAfterResult, ExperimentHostError, ProjectStateDatabase>;
@@ -1,6 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import type { ProjectStateDatabase } from "../../record/sqlite/project-state-database.js";
3
3
  import { ExperimentHostError } from "./types.js";
4
- import type { ExperimentHostTeardownInspection, ExperimentHostTeardownInspectRequest, ExperimentHostTeardownRequest, ExperimentHostTeardownResult } from "./types.js";
5
- export declare function inspectTeardown(input: ExperimentHostTeardownInspectRequest): Effect.Effect<ExperimentHostTeardownInspection, ExperimentHostError, ProjectStateDatabase>;
6
- export declare function runTeardown(input: ExperimentHostTeardownRequest): Effect.Effect<ExperimentHostTeardownResult, ExperimentHostError, ProjectStateDatabase>;
4
+ import type { ExperimentHostAfterInspection, ExperimentHostAfterInspectRequest, ExperimentHostAfterRequest, ExperimentHostAfterResult } from "./types.js";
5
+ export declare function inspectTeardown(input: ExperimentHostAfterInspectRequest): Effect.Effect<ExperimentHostAfterInspection, ExperimentHostError, ProjectStateDatabase>;
6
+ export declare function runTeardown(input: ExperimentHostAfterRequest): Effect.Effect<ExperimentHostAfterResult, ExperimentHostError, ProjectStateDatabase>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AACA,mCAA2C;AAW3C,+EAA+E;AAC/E,MAAa,mBAAoB,SAAQ,aAAI,CAAC,WAAW,CAAC,qBAAqB,CAM7E;CACD;AAPD,kDAOC","sourcesContent":["import type { ResolvedModelSlots } from \"../../model-slots.ts\";\nimport { Data, type Effect } from \"effect\";\nimport type { Config } from \"../../types.ts\";\nimport type { FeedbackCoordinator } from \"../../runner/feedback/coordinator.ts\";\nimport type { InvocationCompletion } from \"../../runner/types.ts\";\nimport type { SessionListDocument, SessionShowDocument } from \"../../runner/session.ts\";\nimport type { CurrentReuseReadbackSnapshot } from \"../../runner/reuse-readback.ts\";\nimport type { SetupPrefixPreparationSummary } from \"../../runner/setup-prefix-preparation.ts\";\nexport type ExperimentHostJsonValue = null | boolean | number | string | readonly ExperimentHostJsonValue[] | {\n readonly [key: string]: ExperimentHostJsonValue;\n};\nexport type ExperimentHostOperation = \"catalog\" | \"check\" | \"debug\" | \"invocation-plan\" | \"invocation-run\" | \"rename-plan\" | \"rename-apply\" | \"accept\" | \"invocation-status-list\" | \"invocation-status-show\" | \"teardown-inspect\" | \"teardown-run\";\n/** Stable typed failure boundary; defects and interruption remain separate. */\nexport class ExperimentHostError extends Data.TaggedError(\"ExperimentHostError\")<{\n readonly operation: ExperimentHostOperation;\n readonly code: string;\n readonly message: string;\n /** Structured typed failure retained for application/CLI attribution. */\n readonly cause?: unknown;\n}> {\n}\n/** Inputs shared by discovery, link checking, and invocation planning. */\nexport interface ExperimentHostSelectionInput {\n readonly cwd: string;\n readonly experimentSelector?: string;\n /** Non-empty exact Experiment ID set; mutually exclusive with experimentSelector. */\n readonly experimentIds?: readonly string[];\n readonly evalSelectors?: readonly string[];\n readonly tag?: string;\n}\nexport interface ExperimentHostEvalSummary {\n readonly id: string;\n readonly description?: string;\n readonly tags: readonly string[];\n readonly evaluationKind: \"pass\" | \"score\";\n}\nexport interface ExperimentHostExperimentSummary {\n readonly models?: ResolvedModelSlots;\n readonly id: string;\n readonly description?: string;\n readonly adapter: string;\n readonly model?: string;\n readonly attempts: number;\n readonly evalIds: readonly string[];\n readonly labels: Readonly<Record<string, string | number>>;\n readonly hasSetup: boolean;\n readonly hasTeardown: boolean;\n readonly sharedStateKey?: string;\n}\nexport interface ExperimentHostCatalog {\n readonly status: \"listed\";\n readonly evals: readonly ExperimentHostEvalSummary[];\n readonly experimentIds: readonly string[];\n readonly experiments: readonly ExperimentHostExperimentSummary[];\n}\nexport type ExperimentHostSelectionProblem = {\n readonly status: \"experiment-no-match\";\n readonly selector: string;\n readonly candidates: readonly string[];\n} | {\n readonly status: \"eval-no-match\";\n readonly selector: string;\n readonly experimentIds: readonly string[];\n readonly candidates: readonly string[];\n} | {\n readonly status: \"empty-selection\";\n readonly experimentIds: readonly string[];\n readonly candidates: readonly string[];\n};\nexport interface ExperimentHostRunOverrides {\n readonly attempts?: number;\n readonly earlyExit?: boolean;\n readonly timeoutMs?: number;\n readonly budget?: number;\n readonly rerun?: \"failed\" | \"all\";\n readonly keepSandbox?: \"failed\" | \"all\";\n readonly maxConcurrency?: number;\n readonly maxBuildConcurrency?: number;\n readonly maxSetupPrefixConcurrency?: number;\n}\nexport interface ExperimentHostCheckRequest extends ExperimentHostSelectionInput {\n readonly config: Config;\n readonly overrides?: ExperimentHostRunOverrides;\n}\nexport type ExperimentHostCheckResult = ExperimentHostSelectionProblem | {\n readonly status: \"linked\";\n readonly experimentIds: readonly string[];\n readonly evalIds: readonly string[];\n readonly pairCount: number;\n};\ndeclare const invocationPlanBrand: unique symbol;\n/**\n * Opaque in-memory authority issued by `experimentHost.invocation.plan`.\n * Its Runner graph is held in Host-private storage and cannot be forged or\n * reconstructed by a CLI.\n */\nexport interface ExperimentHostInvocationPlan {\n readonly [invocationPlanBrand]: typeof invocationPlanBrand;\n}\nexport interface ExperimentHostInvocationShape {\n readonly experiments: number;\n readonly evals: number;\n readonly configurations: number;\n readonly totalAttempts: number;\n readonly attempts: number;\n readonly maxConcurrency: number;\n readonly maxBuildConcurrency: number;\n readonly maxSetupPrefixConcurrency: number;\n readonly experimentConcurrency: Readonly<Record<string, number>>;\n}\nexport interface ExperimentHostDrySlotTarget {\n readonly runId: string;\n readonly slotId: string;\n readonly experimentId: string;\n readonly evalId: string;\n readonly executionIdentityDigest: string;\n readonly evalGroupId?: string;\n readonly evalGroupIndex?: number;\n readonly attempt: number;\n}\nexport interface ExperimentHostDryComparison {\n readonly attachment: string;\n readonly recordedClaim: string;\n readonly sourceState: string;\n readonly result: string;\n readonly reason: string;\n}\nexport type ExperimentHostDrySlot = {\n readonly state: \"reuse\";\n readonly target: ExperimentHostDrySlotTarget;\n readonly source: {\n readonly attemptId: string;\n readonly originRunId: string;\n readonly originSlotId: string;\n readonly sourceRunId: string;\n };\n readonly comparisons: readonly ExperimentHostDryComparison[];\n} | {\n readonly state: \"gap\";\n readonly target: ExperimentHostDrySlotTarget;\n readonly reason: string;\n readonly scope: \"slot\" | \"experiment\" | \"target\";\n readonly issues: readonly ExperimentHostJsonValue[];\n readonly comparisons: readonly ExperimentHostDryComparison[];\n};\nexport interface ExperimentHostDryPlan {\n readonly policy: {\n readonly name: \"project-target\";\n readonly version: 1;\n };\n readonly slots: readonly ExperimentHostDrySlot[];\n readonly readbacks: readonly CurrentReuseReadbackSnapshot[];\n readonly lockedPairs: readonly string[];\n}\nexport type ExperimentHostInvocationPlanResult = ExperimentHostSelectionProblem | {\n readonly status: \"ready\";\n readonly plan: ExperimentHostInvocationPlan;\n readonly shape: ExperimentHostInvocationShape;\n readonly experimentIds: readonly string[];\n readonly evalIds: readonly string[];\n readonly pluginAudit: {\n readonly occurrences: readonly ExperimentHostJsonValue[];\n };\n readonly dry?: ExperimentHostDryPlan;\n};\nexport interface ExperimentHostInvocationPlanRequest extends ExperimentHostSelectionInput {\n readonly config: Config;\n /** Host path to process coordination state; defaults to cwd/.niceeval. */\n readonly coordinationRoot?: string;\n readonly overrides?: ExperimentHostRunOverrides;\n readonly preview?: boolean;\n}\n/** Lossless Experiment presentation owned by the calling Host surface. */\nexport interface ExperimentHostInvocationFeedback {\n readonly coordinator: FeedbackCoordinator;\n}\nexport interface ExperimentHostInvocationRunRequest {\n readonly plan: ExperimentHostInvocationPlan;\n readonly signal?: AbortSignal;\n readonly feedback?: ExperimentHostInvocationFeedback;\n /** Optional required JUnit reporter target, owned and invoked inside Host. */\n readonly junitPath?: string;\n}\n/**\n * Invocation status is project-local and ephemeral. It is an observation of\n * the coordination directory, not recoverable Record fact data.\n */\nexport interface ExperimentHostInvocationStatusListRequest {\n readonly cwd: string;\n readonly all?: boolean;\n readonly experimentSelector?: string;\n}\nexport interface ExperimentHostInvocationStatusShowRequest {\n readonly cwd: string;\n readonly invocationSelector: string;\n}\nexport type ExperimentHostInvocationStatusList = SessionListDocument;\nexport type ExperimentHostInvocationStatusShow = SessionShowDocument;\nexport interface ExperimentHostInvocationReceipt {\n readonly invocationId: string;\n readonly createdRunIds: readonly string[];\n readonly publicationCutoff: string;\n readonly startedAt: string;\n readonly completedAt?: string;\n readonly completion: \"completed\" | \"interrupted\" | \"failed\";\n}\nexport interface ExperimentHostInvocationSummary {\n readonly total: number;\n readonly passed: number;\n readonly failed: number;\n readonly skipped: number;\n readonly errored: number;\n readonly durationMs: number;\n readonly inputTokens?: number;\n readonly outputTokens?: number;\n readonly estimatedCostUSD?: number;\n readonly setupPrefixes: SetupPrefixPreparationSummary;\n}\nexport interface ExperimentHostInvocationResult {\n readonly status: \"finished\";\n readonly receipt: ExperimentHostInvocationReceipt;\n readonly summary: ExperimentHostInvocationSummary;\n /** Present when the caller supplied the one feedback reducer/presentation. */\n readonly completion?: InvocationCompletion;\n /** Exact CLI exit fold for the supplied presentation. */\n readonly exitCode?: number;\n}\n/** Adopt one exact historical Run into one current Experiment. */\nexport interface ExperimentHostRenameRequest {\n readonly cwd: string;\n readonly sourceRunId: string;\n readonly newId: string;\n readonly config?: Config;\n readonly operatorReason?: string;\n}\nexport type ExperimentHostRenameReason = import(\"../../runner/adoption.ts\").ExplicitAdoptionFailureCode;\nexport interface ExperimentHostRenamePlan {\n readonly status: \"plan\";\n readonly sourceRunId: string;\n readonly oldId: string | null;\n readonly newId: string;\n readonly migrations: readonly {\n readonly evalId: string;\n readonly attempt: number;\n readonly sourceLocator: string;\n readonly targetExperimentId: string;\n readonly fingerprint: string;\n }[];\n readonly blocked?: {\n readonly reason: ExperimentHostRenameReason;\n readonly detail: string;\n };\n}\nexport type ExperimentHostRenameResult = {\n readonly status: \"rejected\";\n readonly sourceRunId: string;\n readonly oldId: string | null;\n readonly newId: string;\n readonly reason: ExperimentHostRenameReason;\n readonly detail: string;\n} | {\n readonly status: \"done\";\n readonly invocationId: string;\n readonly runId: string;\n readonly sourceRunId: string;\n readonly oldId: string;\n readonly newId: string;\n readonly migrated: readonly {\n readonly evalId: string;\n readonly attempt: number;\n readonly sourceLocator: string;\n readonly locator: string;\n readonly fingerprint: string;\n readonly verdict: \"passed\" | \"failed\";\n }[];\n};\nexport interface ExperimentHostAcceptRequest {\n readonly cwd: string;\n readonly locators: readonly string[];\n readonly config?: Config;\n readonly operatorReason?: string;\n}\nexport interface ExperimentHostAcceptedAttempt {\n readonly invocationId: string;\n readonly runId: string;\n readonly slotId: string;\n readonly locator: string;\n readonly sourceLocator: string;\n readonly fingerprint: string;\n}\nexport interface ExperimentHostAcceptRunRequest extends Omit<ExperimentHostAcceptRequest, \"locators\"> {\n readonly runId: string;\n}\nexport interface ExperimentHostAcceptRunPlan {\n readonly sourceRunId: string;\n readonly members: readonly {\n readonly locator: string;\n readonly experimentId: string;\n readonly evalId: string;\n readonly attempt: number;\n readonly fingerprint: string;\n }[];\n}\nexport interface ExperimentHostSharedStateEvidence {\n readonly key: string;\n readonly experimentId: string;\n readonly ownerToken: string;\n readonly host: string;\n readonly pid: number;\n readonly processIdentity: string;\n readonly heartbeatAt: string;\n}\nexport interface ExperimentHostTeardownInspectRequest {\n readonly cwd: string;\n readonly experimentSelector?: string;\n readonly coordinationRoot?: string;\n readonly currentHost: string;\n readonly recoveryKey?: string;\n}\nexport type ExperimentHostTeardownInspection = {\n readonly status: \"no-evidence\";\n readonly key: string;\n} | ExperimentHostSelectionProblem | {\n readonly status: \"selection-not-unique\";\n readonly experimentIds: readonly string[];\n readonly evidence: ExperimentHostSharedStateEvidence;\n} | {\n readonly status: \"experiment-mismatch\";\n readonly selectedExperimentId: string;\n readonly evidence: ExperimentHostSharedStateEvidence;\n} | {\n readonly status: \"teardown-required\";\n readonly experimentId: string;\n readonly evidence: ExperimentHostSharedStateEvidence;\n} | {\n readonly status: \"ready\";\n readonly experimentIds: readonly string[];\n readonly orphanedRegistrations: number;\n readonly evidence?: ExperimentHostSharedStateEvidence;\n};\nexport interface ExperimentHostTeardownRequest extends ExperimentHostTeardownInspectRequest {\n readonly observer?: ExperimentHostTeardownObserver;\n readonly signal?: AbortSignal;\n readonly ownerToken?: string;\n readonly confirmOwnerTerminated?: boolean;\n readonly confirmRemoteQuiesced?: boolean;\n}\nexport type ExperimentHostTeardownEvent = {\n readonly type: \"experiment-progress\";\n readonly experimentId: string;\n readonly detail: string;\n} | {\n readonly type: \"diagnostic\";\n readonly code: string;\n readonly level: \"info\" | \"warning\" | \"error\";\n readonly message: string;\n readonly data?: Readonly<Record<string, ExperimentHostJsonValue>>;\n} | {\n readonly type: \"experiment-hook\";\n readonly experimentId: string;\n readonly hook: \"teardown\";\n readonly status: \"started\" | \"done\" | \"failed\";\n readonly durationMs?: number;\n readonly recovery?: true;\n};\nexport interface ExperimentHostTeardownObserver {\n readonly observe: (event: ExperimentHostTeardownEvent) => void;\n}\nexport type ExperimentHostTeardownResult = ExperimentHostTeardownInspection | {\n readonly status: \"completed\";\n readonly experiments: readonly {\n readonly experimentId: string;\n readonly executions: number;\n readonly outcome: \"succeeded\" | \"failed\" | \"not-configured\";\n readonly error?: string;\n }[];\n} | {\n readonly status: \"recovered\" | \"already-released\";\n readonly key: string;\n readonly experimentId: string;\n readonly ownerToken: string;\n} | {\n readonly status: \"recovery-confirmation-required\";\n readonly evidence: ExperimentHostSharedStateEvidence;\n} | {\n readonly status: \"recovery-teardown-failed\";\n readonly evidence: ExperimentHostSharedStateEvidence;\n readonly error: string;\n};\nexport interface ExperimentHostHighLevelSDK {\n readonly catalog: (input: ExperimentHostSelectionInput) => Effect.Effect<ExperimentHostCatalog, ExperimentHostError>;\n readonly check: (input: ExperimentHostCheckRequest) => Effect.Effect<ExperimentHostCheckResult, ExperimentHostError>;\n readonly invocation: {\n readonly plan: (input: ExperimentHostInvocationPlanRequest) => Effect.Effect<ExperimentHostInvocationPlanResult, ExperimentHostError>;\n readonly run: (input: ExperimentHostInvocationRunRequest) => Effect.Effect<ExperimentHostInvocationResult, ExperimentHostError>;\n };\n readonly invocationStatus: {\n readonly list: (input: ExperimentHostInvocationStatusListRequest) => Effect.Effect<ExperimentHostInvocationStatusList, ExperimentHostError>;\n readonly show: (input: ExperimentHostInvocationStatusShowRequest) => Effect.Effect<ExperimentHostInvocationStatusShow, ExperimentHostError>;\n };\n readonly rename: {\n readonly plan: (input: ExperimentHostRenameRequest) => Effect.Effect<ExperimentHostRenamePlan, ExperimentHostError>;\n readonly apply: (input: ExperimentHostRenameRequest) => Effect.Effect<ExperimentHostRenameResult, ExperimentHostError>;\n };\n readonly teardown: {\n readonly inspect: (input: ExperimentHostTeardownInspectRequest) => Effect.Effect<ExperimentHostTeardownInspection, ExperimentHostError>;\n readonly run: (input: ExperimentHostTeardownRequest) => Effect.Effect<ExperimentHostTeardownResult, ExperimentHostError>;\n };\n readonly accept: (input: ExperimentHostAcceptRequest) => Effect.Effect<readonly ExperimentHostAcceptedAttempt[], ExperimentHostError>;\n readonly acceptRun: {\n readonly plan: (input: ExperimentHostAcceptRunRequest) => Effect.Effect<ExperimentHostAcceptRunPlan, ExperimentHostError>;\n readonly apply: (input: ExperimentHostAcceptRunRequest) => Effect.Effect<readonly ExperimentHostAcceptedAttempt[], ExperimentHostError>;\n };\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AACA,mCAA2C;AAW3C,+EAA+E;AAC/E,MAAa,mBAAoB,SAAQ,aAAI,CAAC,WAAW,CAAC,qBAAqB,CAM7E;CACD;AAPD,kDAOC","sourcesContent":["import type { ResolvedModelRoles } from \"../../model-roles.ts\";\nimport { Data, type Effect } from \"effect\";\nimport type { Config } from \"../../types.ts\";\nimport type { FeedbackCoordinator } from \"../../runner/feedback/coordinator.ts\";\nimport type { InvocationCompletion } from \"../../runner/types.ts\";\nimport type { SessionListDocument, SessionShowDocument } from \"../../runner/session.ts\";\nimport type { CurrentReuseReadbackSnapshot } from \"../../runner/reuse-readback.ts\";\nimport type { SetupPrefixPreparationSummary } from \"../../runner/setup-prefix-preparation.ts\";\nexport type ExperimentHostJsonValue = null | boolean | number | string | readonly ExperimentHostJsonValue[] | {\n readonly [key: string]: ExperimentHostJsonValue;\n};\nexport type ExperimentHostOperation = \"catalog\" | \"check\" | \"debug\" | \"invocation-plan\" | \"invocation-run\" | \"rename-plan\" | \"rename-apply\" | \"accept\" | \"invocation-status-list\" | \"invocation-status-show\" | \"teardown-inspect\" | \"teardown-run\";\n/** Stable typed failure boundary; defects and interruption remain separate. */\nexport class ExperimentHostError extends Data.TaggedError(\"ExperimentHostError\")<{\n readonly operation: ExperimentHostOperation;\n readonly code: string;\n readonly message: string;\n /** Structured typed failure retained for application/CLI attribution. */\n readonly cause?: unknown;\n}> {\n}\n/** Inputs shared by discovery, link checking, and invocation planning. */\nexport interface ExperimentHostSelectionInput {\n readonly cwd: string;\n readonly experimentSelector?: string;\n /** Non-empty exact Experiment ID set; mutually exclusive with experimentSelector. */\n readonly experimentIds?: readonly string[];\n readonly evalSelectors?: readonly string[];\n readonly tag?: string;\n}\nexport interface ExperimentHostEvalSummary {\n readonly id: string;\n readonly description?: string;\n readonly tags: readonly string[];\n readonly evaluationKind: \"pass\" | \"score\";\n}\nexport interface ExperimentHostExperimentSummary {\n readonly models?: ResolvedModelRoles;\n readonly id: string;\n readonly description?: string;\n readonly adapter: string;\n readonly model?: string;\n readonly attempts: number;\n readonly evalIds: readonly string[];\n readonly labels: Readonly<Record<string, string | number>>;\n readonly hasBefore: boolean;\n readonly hasAfter: boolean;\n readonly sharedStateKey?: string;\n}\nexport interface ExperimentHostCatalog {\n readonly status: \"listed\";\n readonly evals: readonly ExperimentHostEvalSummary[];\n readonly experimentIds: readonly string[];\n readonly experiments: readonly ExperimentHostExperimentSummary[];\n}\nexport type ExperimentHostSelectionProblem = {\n readonly status: \"experiment-no-match\";\n readonly selector: string;\n readonly candidates: readonly string[];\n} | {\n readonly status: \"eval-no-match\";\n readonly selector: string;\n readonly experimentIds: readonly string[];\n readonly candidates: readonly string[];\n} | {\n readonly status: \"empty-selection\";\n readonly experimentIds: readonly string[];\n readonly candidates: readonly string[];\n};\nexport interface ExperimentHostRunOverrides {\n readonly attempts?: number;\n readonly earlyExit?: boolean;\n readonly timeoutMs?: number;\n readonly budget?: number;\n readonly rerun?: \"failed\" | \"all\";\n readonly keepSandbox?: \"failed\" | \"all\";\n readonly maxConcurrency?: number;\n readonly maxBuildConcurrency?: number;\n readonly maxBeforeCacheConcurrency?: number;\n}\nexport interface ExperimentHostCheckRequest extends ExperimentHostSelectionInput {\n readonly config: Config;\n readonly overrides?: ExperimentHostRunOverrides;\n}\nexport type ExperimentHostCheckResult = ExperimentHostSelectionProblem | {\n readonly status: \"linked\";\n readonly experimentIds: readonly string[];\n readonly evalIds: readonly string[];\n readonly pairCount: number;\n};\ndeclare const invocationPlanBrand: unique symbol;\n/**\n * Opaque in-memory authority issued by `experimentHost.invocation.plan`.\n * Its Runner graph is held in Host-private storage and cannot be forged or\n * reconstructed by a CLI.\n */\nexport interface ExperimentHostInvocationPlan {\n readonly [invocationPlanBrand]: typeof invocationPlanBrand;\n}\nexport interface ExperimentHostInvocationShape {\n readonly experiments: number;\n readonly evals: number;\n readonly configurations: number;\n readonly totalAttempts: number;\n readonly attempts: number;\n readonly maxConcurrency: number;\n readonly maxBuildConcurrency: number;\n readonly maxBeforeCacheConcurrency: number;\n readonly experimentConcurrency: Readonly<Record<string, number>>;\n}\nexport interface ExperimentHostDrySlotTarget {\n readonly runId: string;\n readonly slotId: string;\n readonly experimentId: string;\n readonly evalId: string;\n readonly executionIdentityDigest: string;\n readonly evalGroupId?: string;\n readonly evalGroupIndex?: number;\n readonly attempt: number;\n}\nexport interface ExperimentHostDryComparison {\n readonly attachment: string;\n readonly recordedClaim: string;\n readonly sourceState: string;\n readonly result: string;\n readonly reason: string;\n}\nexport type ExperimentHostDrySlot = {\n readonly state: \"reuse\";\n readonly target: ExperimentHostDrySlotTarget;\n readonly source: {\n readonly attemptId: string;\n readonly originRunId: string;\n readonly originSlotId: string;\n readonly sourceRunId: string;\n };\n readonly comparisons: readonly ExperimentHostDryComparison[];\n} | {\n readonly state: \"gap\";\n readonly target: ExperimentHostDrySlotTarget;\n readonly reason: string;\n readonly scope: \"slot\" | \"experiment\" | \"target\";\n readonly issues: readonly ExperimentHostJsonValue[];\n readonly comparisons: readonly ExperimentHostDryComparison[];\n};\nexport interface ExperimentHostDryPlan {\n readonly policy: {\n readonly name: \"project-target\";\n readonly version: 1;\n };\n readonly slots: readonly ExperimentHostDrySlot[];\n readonly readbacks: readonly CurrentReuseReadbackSnapshot[];\n readonly lockedPairs: readonly string[];\n}\nexport type ExperimentHostInvocationPlanResult = ExperimentHostSelectionProblem | {\n readonly status: \"ready\";\n readonly plan: ExperimentHostInvocationPlan;\n readonly shape: ExperimentHostInvocationShape;\n readonly experimentIds: readonly string[];\n readonly evalIds: readonly string[];\n readonly pluginAudit: {\n readonly occurrences: readonly ExperimentHostJsonValue[];\n };\n readonly dry?: ExperimentHostDryPlan;\n};\nexport interface ExperimentHostInvocationPlanRequest extends ExperimentHostSelectionInput {\n readonly config: Config;\n /** Host path to process coordination state; defaults to cwd/.niceeval. */\n readonly coordinationRoot?: string;\n readonly overrides?: ExperimentHostRunOverrides;\n readonly preview?: boolean;\n}\n/** Lossless Experiment presentation owned by the calling Host surface. */\nexport interface ExperimentHostInvocationFeedback {\n readonly coordinator: FeedbackCoordinator;\n}\nexport interface ExperimentHostInvocationRunRequest {\n readonly plan: ExperimentHostInvocationPlan;\n readonly signal?: AbortSignal;\n readonly feedback?: ExperimentHostInvocationFeedback;\n /** Optional required JUnit reporter target, owned and invoked inside Host. */\n readonly junitPath?: string;\n}\n/**\n * Invocation status is project-local and ephemeral. It is an observation of\n * the coordination directory, not recoverable Record fact data.\n */\nexport interface ExperimentHostInvocationStatusListRequest {\n readonly cwd: string;\n readonly all?: boolean;\n readonly experimentSelector?: string;\n}\nexport interface ExperimentHostInvocationStatusShowRequest {\n readonly cwd: string;\n readonly invocationSelector: string;\n}\nexport type ExperimentHostInvocationStatusList = SessionListDocument;\nexport type ExperimentHostInvocationStatusShow = SessionShowDocument;\nexport interface ExperimentHostInvocationReceipt {\n readonly invocationId: string;\n readonly createdRunIds: readonly string[];\n readonly publicationCutoff: string;\n readonly startedAt: string;\n readonly completedAt?: string;\n readonly completion: \"completed\" | \"interrupted\" | \"failed\";\n}\nexport interface ExperimentHostInvocationSummary {\n readonly total: number;\n readonly passed: number;\n readonly failed: number;\n readonly skipped: number;\n readonly errored: number;\n readonly durationMs: number;\n readonly inputTokens?: number;\n readonly outputTokens?: number;\n readonly estimatedCostUSD?: number;\n readonly beforeCaches: SetupPrefixPreparationSummary;\n}\nexport interface ExperimentHostInvocationResult {\n readonly status: \"finished\";\n readonly receipt: ExperimentHostInvocationReceipt;\n readonly summary: ExperimentHostInvocationSummary;\n /** Present when the caller supplied the one feedback reducer/presentation. */\n readonly completion?: InvocationCompletion;\n /** Exact CLI exit fold for the supplied presentation. */\n readonly exitCode?: number;\n}\n/** Adopt one exact historical Run into one current Experiment. */\nexport interface ExperimentHostRenameRequest {\n readonly cwd: string;\n readonly sourceRunId: string;\n readonly newId: string;\n readonly config?: Config;\n readonly operatorReason?: string;\n}\nexport type ExperimentHostRenameReason = import(\"../../runner/adoption.ts\").ExplicitAdoptionFailureCode;\nexport interface ExperimentHostRenamePlan {\n readonly status: \"plan\";\n readonly sourceRunId: string;\n readonly oldId: string | null;\n readonly newId: string;\n readonly migrations: readonly {\n readonly evalId: string;\n readonly attempt: number;\n readonly sourceLocator: string;\n readonly targetExperimentId: string;\n readonly fingerprint: string;\n }[];\n readonly blocked?: {\n readonly reason: ExperimentHostRenameReason;\n readonly detail: string;\n };\n}\nexport type ExperimentHostRenameResult = {\n readonly status: \"rejected\";\n readonly sourceRunId: string;\n readonly oldId: string | null;\n readonly newId: string;\n readonly reason: ExperimentHostRenameReason;\n readonly detail: string;\n} | {\n readonly status: \"done\";\n readonly invocationId: string;\n readonly runId: string;\n readonly sourceRunId: string;\n readonly oldId: string;\n readonly newId: string;\n readonly migrated: readonly {\n readonly evalId: string;\n readonly attempt: number;\n readonly sourceLocator: string;\n readonly locator: string;\n readonly fingerprint: string;\n readonly verdict: \"passed\" | \"failed\";\n }[];\n};\nexport interface ExperimentHostAcceptRequest {\n readonly cwd: string;\n readonly locators: readonly string[];\n readonly config?: Config;\n readonly operatorReason?: string;\n}\nexport interface ExperimentHostAcceptedAttempt {\n readonly invocationId: string;\n readonly runId: string;\n readonly slotId: string;\n readonly locator: string;\n readonly sourceLocator: string;\n readonly fingerprint: string;\n}\nexport interface ExperimentHostAcceptRunRequest extends Omit<ExperimentHostAcceptRequest, \"locators\"> {\n readonly runId: string;\n}\nexport interface ExperimentHostAcceptRunPlan {\n readonly sourceRunId: string;\n readonly members: readonly {\n readonly locator: string;\n readonly experimentId: string;\n readonly evalId: string;\n readonly attempt: number;\n readonly fingerprint: string;\n }[];\n}\nexport interface ExperimentHostSharedStateEvidence {\n readonly key: string;\n readonly experimentId: string;\n readonly ownerToken: string;\n readonly host: string;\n readonly pid: number;\n readonly processIdentity: string;\n readonly heartbeatAt: string;\n}\nexport interface ExperimentHostAfterInspectRequest {\n readonly cwd: string;\n readonly experimentSelector?: string;\n readonly coordinationRoot?: string;\n readonly currentHost: string;\n readonly recoveryKey?: string;\n}\nexport type ExperimentHostAfterInspection = {\n readonly status: \"no-evidence\";\n readonly key: string;\n} | ExperimentHostSelectionProblem | {\n readonly status: \"selection-not-unique\";\n readonly experimentIds: readonly string[];\n readonly evidence: ExperimentHostSharedStateEvidence;\n} | {\n readonly status: \"experiment-mismatch\";\n readonly selectedExperimentId: string;\n readonly evidence: ExperimentHostSharedStateEvidence;\n} | {\n readonly status: \"after-required\";\n readonly experimentId: string;\n readonly evidence: ExperimentHostSharedStateEvidence;\n} | {\n readonly status: \"ready\";\n readonly experimentIds: readonly string[];\n readonly orphanedRegistrations: number;\n readonly evidence?: ExperimentHostSharedStateEvidence;\n};\nexport interface ExperimentHostAfterRequest extends ExperimentHostAfterInspectRequest {\n readonly observer?: ExperimentHostAfterObserver;\n readonly signal?: AbortSignal;\n readonly ownerToken?: string;\n readonly confirmOwnerTerminated?: boolean;\n readonly confirmRemoteQuiesced?: boolean;\n}\nexport type ExperimentHostAfterEvent = {\n readonly type: \"experiment-progress\";\n readonly experimentId: string;\n readonly detail: string;\n} | {\n readonly type: \"diagnostic\";\n readonly code: string;\n readonly level: \"info\" | \"warning\" | \"error\";\n readonly message: string;\n readonly data?: Readonly<Record<string, ExperimentHostJsonValue>>;\n} | {\n readonly type: \"experiment-hook\";\n readonly experimentId: string;\n readonly hook: \"teardown\";\n readonly status: \"started\" | \"done\" | \"failed\";\n readonly durationMs?: number;\n readonly recovery?: true;\n};\nexport interface ExperimentHostAfterObserver {\n readonly observe: (event: ExperimentHostAfterEvent) => void;\n}\nexport type ExperimentHostAfterResult = ExperimentHostAfterInspection | {\n readonly status: \"completed\";\n readonly experiments: readonly {\n readonly experimentId: string;\n readonly executions: number;\n readonly outcome: \"succeeded\" | \"failed\" | \"not-configured\";\n readonly error?: string;\n }[];\n} | {\n readonly status: \"recovered\" | \"already-released\";\n readonly key: string;\n readonly experimentId: string;\n readonly ownerToken: string;\n} | {\n readonly status: \"recovery-confirmation-required\";\n readonly evidence: ExperimentHostSharedStateEvidence;\n} | {\n readonly status: \"recovery-teardown-failed\";\n readonly evidence: ExperimentHostSharedStateEvidence;\n readonly error: string;\n};\nexport interface ExperimentHostHighLevelSDK {\n readonly catalog: (input: ExperimentHostSelectionInput) => Effect.Effect<ExperimentHostCatalog, ExperimentHostError>;\n readonly check: (input: ExperimentHostCheckRequest) => Effect.Effect<ExperimentHostCheckResult, ExperimentHostError>;\n readonly invocation: {\n readonly plan: (input: ExperimentHostInvocationPlanRequest) => Effect.Effect<ExperimentHostInvocationPlanResult, ExperimentHostError>;\n readonly run: (input: ExperimentHostInvocationRunRequest) => Effect.Effect<ExperimentHostInvocationResult, ExperimentHostError>;\n };\n readonly invocationStatus: {\n readonly list: (input: ExperimentHostInvocationStatusListRequest) => Effect.Effect<ExperimentHostInvocationStatusList, ExperimentHostError>;\n readonly show: (input: ExperimentHostInvocationStatusShowRequest) => Effect.Effect<ExperimentHostInvocationStatusShow, ExperimentHostError>;\n };\n readonly rename: {\n readonly plan: (input: ExperimentHostRenameRequest) => Effect.Effect<ExperimentHostRenamePlan, ExperimentHostError>;\n readonly apply: (input: ExperimentHostRenameRequest) => Effect.Effect<ExperimentHostRenameResult, ExperimentHostError>;\n };\n readonly after: {\n readonly inspect: (input: ExperimentHostAfterInspectRequest) => Effect.Effect<ExperimentHostAfterInspection, ExperimentHostError>;\n readonly run: (input: ExperimentHostAfterRequest) => Effect.Effect<ExperimentHostAfterResult, ExperimentHostError>;\n };\n readonly accept: (input: ExperimentHostAcceptRequest) => Effect.Effect<readonly ExperimentHostAcceptedAttempt[], ExperimentHostError>;\n readonly acceptRun: {\n readonly plan: (input: ExperimentHostAcceptRunRequest) => Effect.Effect<ExperimentHostAcceptRunPlan, ExperimentHostError>;\n readonly apply: (input: ExperimentHostAcceptRunRequest) => Effect.Effect<readonly ExperimentHostAcceptedAttempt[], ExperimentHostError>;\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { ResolvedModelSlots } from "../../model-slots.cjs";
1
+ import type { ResolvedModelRoles } from "../../model-roles.cjs";
2
2
  import { type Effect } from "effect";
3
3
  import type { Config } from "../../types.cjs";
4
4
  import type { FeedbackCoordinator } from "../../runner/feedback/coordinator.cjs";
@@ -38,7 +38,7 @@ export interface ExperimentHostEvalSummary {
38
38
  readonly evaluationKind: "pass" | "score";
39
39
  }
40
40
  export interface ExperimentHostExperimentSummary {
41
- readonly models?: ResolvedModelSlots;
41
+ readonly models?: ResolvedModelRoles;
42
42
  readonly id: string;
43
43
  readonly description?: string;
44
44
  readonly adapter: string;
@@ -46,8 +46,8 @@ export interface ExperimentHostExperimentSummary {
46
46
  readonly attempts: number;
47
47
  readonly evalIds: readonly string[];
48
48
  readonly labels: Readonly<Record<string, string | number>>;
49
- readonly hasSetup: boolean;
50
- readonly hasTeardown: boolean;
49
+ readonly hasBefore: boolean;
50
+ readonly hasAfter: boolean;
51
51
  readonly sharedStateKey?: string;
52
52
  }
53
53
  export interface ExperimentHostCatalog {
@@ -79,7 +79,7 @@ export interface ExperimentHostRunOverrides {
79
79
  readonly keepSandbox?: "failed" | "all";
80
80
  readonly maxConcurrency?: number;
81
81
  readonly maxBuildConcurrency?: number;
82
- readonly maxSetupPrefixConcurrency?: number;
82
+ readonly maxBeforeCacheConcurrency?: number;
83
83
  }
84
84
  export interface ExperimentHostCheckRequest extends ExperimentHostSelectionInput {
85
85
  readonly config: Config;
@@ -108,7 +108,7 @@ export interface ExperimentHostInvocationShape {
108
108
  readonly attempts: number;
109
109
  readonly maxConcurrency: number;
110
110
  readonly maxBuildConcurrency: number;
111
- readonly maxSetupPrefixConcurrency: number;
111
+ readonly maxBeforeCacheConcurrency: number;
112
112
  readonly experimentConcurrency: Readonly<Record<string, number>>;
113
113
  }
114
114
  export interface ExperimentHostDrySlotTarget {
@@ -217,7 +217,7 @@ export interface ExperimentHostInvocationSummary {
217
217
  readonly inputTokens?: number;
218
218
  readonly outputTokens?: number;
219
219
  readonly estimatedCostUSD?: number;
220
- readonly setupPrefixes: SetupPrefixPreparationSummary;
220
+ readonly beforeCaches: SetupPrefixPreparationSummary;
221
221
  }
222
222
  export interface ExperimentHostInvocationResult {
223
223
  readonly status: "finished";
@@ -313,14 +313,14 @@ export interface ExperimentHostSharedStateEvidence {
313
313
  readonly processIdentity: string;
314
314
  readonly heartbeatAt: string;
315
315
  }
316
- export interface ExperimentHostTeardownInspectRequest {
316
+ export interface ExperimentHostAfterInspectRequest {
317
317
  readonly cwd: string;
318
318
  readonly experimentSelector?: string;
319
319
  readonly coordinationRoot?: string;
320
320
  readonly currentHost: string;
321
321
  readonly recoveryKey?: string;
322
322
  }
323
- export type ExperimentHostTeardownInspection = {
323
+ export type ExperimentHostAfterInspection = {
324
324
  readonly status: "no-evidence";
325
325
  readonly key: string;
326
326
  } | ExperimentHostSelectionProblem | {
@@ -332,7 +332,7 @@ export type ExperimentHostTeardownInspection = {
332
332
  readonly selectedExperimentId: string;
333
333
  readonly evidence: ExperimentHostSharedStateEvidence;
334
334
  } | {
335
- readonly status: "teardown-required";
335
+ readonly status: "after-required";
336
336
  readonly experimentId: string;
337
337
  readonly evidence: ExperimentHostSharedStateEvidence;
338
338
  } | {
@@ -341,14 +341,14 @@ export type ExperimentHostTeardownInspection = {
341
341
  readonly orphanedRegistrations: number;
342
342
  readonly evidence?: ExperimentHostSharedStateEvidence;
343
343
  };
344
- export interface ExperimentHostTeardownRequest extends ExperimentHostTeardownInspectRequest {
345
- readonly observer?: ExperimentHostTeardownObserver;
344
+ export interface ExperimentHostAfterRequest extends ExperimentHostAfterInspectRequest {
345
+ readonly observer?: ExperimentHostAfterObserver;
346
346
  readonly signal?: AbortSignal;
347
347
  readonly ownerToken?: string;
348
348
  readonly confirmOwnerTerminated?: boolean;
349
349
  readonly confirmRemoteQuiesced?: boolean;
350
350
  }
351
- export type ExperimentHostTeardownEvent = {
351
+ export type ExperimentHostAfterEvent = {
352
352
  readonly type: "experiment-progress";
353
353
  readonly experimentId: string;
354
354
  readonly detail: string;
@@ -366,10 +366,10 @@ export type ExperimentHostTeardownEvent = {
366
366
  readonly durationMs?: number;
367
367
  readonly recovery?: true;
368
368
  };
369
- export interface ExperimentHostTeardownObserver {
370
- readonly observe: (event: ExperimentHostTeardownEvent) => void;
369
+ export interface ExperimentHostAfterObserver {
370
+ readonly observe: (event: ExperimentHostAfterEvent) => void;
371
371
  }
372
- export type ExperimentHostTeardownResult = ExperimentHostTeardownInspection | {
372
+ export type ExperimentHostAfterResult = ExperimentHostAfterInspection | {
373
373
  readonly status: "completed";
374
374
  readonly experiments: readonly {
375
375
  readonly experimentId: string;
@@ -405,9 +405,9 @@ export interface ExperimentHostHighLevelSDK {
405
405
  readonly plan: (input: ExperimentHostRenameRequest) => Effect.Effect<ExperimentHostRenamePlan, ExperimentHostError>;
406
406
  readonly apply: (input: ExperimentHostRenameRequest) => Effect.Effect<ExperimentHostRenameResult, ExperimentHostError>;
407
407
  };
408
- readonly teardown: {
409
- readonly inspect: (input: ExperimentHostTeardownInspectRequest) => Effect.Effect<ExperimentHostTeardownInspection, ExperimentHostError>;
410
- readonly run: (input: ExperimentHostTeardownRequest) => Effect.Effect<ExperimentHostTeardownResult, ExperimentHostError>;
408
+ readonly after: {
409
+ readonly inspect: (input: ExperimentHostAfterInspectRequest) => Effect.Effect<ExperimentHostAfterInspection, ExperimentHostError>;
410
+ readonly run: (input: ExperimentHostAfterRequest) => Effect.Effect<ExperimentHostAfterResult, ExperimentHostError>;
411
411
  };
412
412
  readonly accept: (input: ExperimentHostAcceptRequest) => Effect.Effect<readonly ExperimentHostAcceptedAttempt[], ExperimentHostError>;
413
413
  readonly acceptRun: {