niceeval 0.18.0 → 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 (679) hide show
  1. package/INDEX.md +4 -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 -7
  7. package/dist/adapter.cjs.map +1 -1
  8. package/dist/adapter.d.cts +21 -21
  9. package/dist/adapter.d.mts +21 -21
  10. package/dist/adapter.d.ts +21 -21
  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 +22 -6
  121. package/dist/assertions/measurements.cjs.map +1 -1
  122. package/dist/assertions/measurements.d.cts +8 -1
  123. package/dist/assertions/measurements.d.mts +8 -1
  124. package/dist/assertions/measurements.d.ts +8 -1
  125. package/dist/assertions/numeric.cjs +2 -0
  126. package/dist/assertions/numeric.cjs.map +1 -1
  127. package/dist/assertions/numeric.d.cts +1 -1
  128. package/dist/assertions/numeric.d.mts +1 -1
  129. package/dist/assertions/numeric.d.ts +1 -1
  130. package/dist/assertions/quantity.cjs +42 -0
  131. package/dist/assertions/quantity.cjs.map +1 -0
  132. package/dist/assertions/quantity.d.cts +18 -0
  133. package/dist/assertions/quantity.d.mts +18 -0
  134. package/dist/assertions/quantity.d.ts +18 -0
  135. package/dist/assertions/quantity.js +22 -0
  136. package/dist/assertions/quantity.js.map +1 -0
  137. package/dist/assertions/record/attachment.cjs +2 -0
  138. package/dist/assertions/record/attachment.cjs.map +1 -1
  139. package/dist/assertions/record/codec.cjs +5 -1
  140. package/dist/assertions/record/codec.cjs.map +1 -1
  141. package/dist/assertions/record/model.cjs.map +1 -1
  142. package/dist/assertions/record/model.d.cts +3 -1
  143. package/dist/assertions/record/model.d.mts +3 -1
  144. package/dist/assertions/record/model.d.ts +3 -1
  145. package/dist/assertions/runtime.cjs +11 -6
  146. package/dist/assertions/runtime.cjs.map +1 -1
  147. package/dist/cli/program.cjs +3 -0
  148. package/dist/cli/program.cjs.map +1 -1
  149. package/dist/context/assert-first.cjs +6 -4
  150. package/dist/context/assert-first.cjs.map +1 -1
  151. package/dist/context/assert-first.d.cts +9 -3
  152. package/dist/context/assert-first.d.mts +9 -3
  153. package/dist/context/assert-first.d.ts +9 -3
  154. package/dist/context/notes.cjs +47 -0
  155. package/dist/context/notes.cjs.map +1 -0
  156. package/dist/context/notes.d.cts +10 -0
  157. package/dist/context/notes.d.mts +10 -0
  158. package/dist/context/notes.d.ts +10 -0
  159. package/dist/context/notes.js +6 -0
  160. package/dist/context/notes.js.map +1 -0
  161. package/dist/context/send-failures.cjs +1 -7
  162. package/dist/context/send-failures.cjs.map +1 -1
  163. package/dist/context/send-failures.d.cts +2 -3
  164. package/dist/context/send-failures.d.mts +2 -3
  165. package/dist/context/send-failures.d.ts +2 -3
  166. package/dist/context/send-retry.cjs +0 -1
  167. package/dist/context/send-retry.cjs.map +1 -1
  168. package/dist/context/send-retry.d.cts +1 -2
  169. package/dist/context/send-retry.d.mts +1 -2
  170. package/dist/context/send-retry.d.ts +1 -2
  171. package/dist/context/session.cjs +10 -17
  172. package/dist/context/session.cjs.map +1 -1
  173. package/dist/context/session.d.cts +4 -10
  174. package/dist/context/session.d.mts +4 -10
  175. package/dist/context/session.d.ts +4 -10
  176. package/dist/define.cjs +88 -65
  177. package/dist/define.cjs.map +1 -1
  178. package/dist/define.d.cts +3 -3
  179. package/dist/define.d.mts +3 -3
  180. package/dist/define.d.ts +3 -3
  181. package/dist/eval/cli/contribution.cjs +1 -1
  182. package/dist/eval/cli/contribution.cjs.map +1 -1
  183. package/dist/eval/host/index.cjs +1 -1
  184. package/dist/eval/host/index.cjs.map +1 -1
  185. package/dist/eval/record/evaluation.cjs +1 -1
  186. package/dist/eval/record/evaluation.cjs.map +1 -1
  187. package/dist/eval/record/membership-provenance.d.cts +3 -3
  188. package/dist/eval/record/membership-provenance.d.mts +3 -3
  189. package/dist/eval/record/membership-provenance.d.ts +3 -3
  190. package/dist/eval/record/score.cjs +2 -2
  191. package/dist/eval/record/score.cjs.map +1 -1
  192. package/dist/eval/record/sealed-assertion.cjs +1 -1
  193. package/dist/eval/record/sealed-assertion.cjs.map +1 -1
  194. package/dist/eval/record/verdict.cjs +2 -2
  195. package/dist/eval/record/verdict.cjs.map +1 -1
  196. package/dist/expect/index.cjs +10 -1
  197. package/dist/expect/index.cjs.map +1 -1
  198. package/dist/expect/index.d.cts +3 -1
  199. package/dist/expect/index.d.mts +3 -1
  200. package/dist/expect/index.d.ts +3 -1
  201. package/dist/expect/index.js +92 -76
  202. package/dist/expect/index.mjs +92 -76
  203. package/dist/experiment/host/cli/contribution.cjs +52 -39
  204. package/dist/experiment/host/cli/contribution.cjs.map +1 -1
  205. package/dist/experiment/host/cli/contribution.d.cts +18 -4
  206. package/dist/experiment/host/cli/contribution.d.mts +18 -4
  207. package/dist/experiment/host/cli/contribution.d.ts +18 -4
  208. package/dist/experiment/host/cli/contribution.js +2 -2
  209. package/dist/experiment/host/cli/debug-protocol.cjs +2 -2
  210. package/dist/experiment/host/cli/debug-protocol.cjs.map +1 -1
  211. package/dist/experiment/host/cli/debug-protocol.d.cts +2 -2
  212. package/dist/experiment/host/cli/debug-protocol.d.mts +2 -2
  213. package/dist/experiment/host/cli/debug-protocol.d.ts +2 -2
  214. package/dist/experiment/host/cli/output-protocol.cjs +1 -1
  215. package/dist/experiment/host/cli/output-protocol.cjs.map +1 -1
  216. package/dist/experiment/host/cli/output-protocol.d.cts +2 -2
  217. package/dist/experiment/host/cli/output-protocol.d.mts +2 -2
  218. package/dist/experiment/host/cli/output-protocol.d.ts +2 -2
  219. package/dist/experiment/host/current.cjs +2 -2
  220. package/dist/experiment/host/current.cjs.map +1 -1
  221. package/dist/experiment/host/index.cjs +1 -1
  222. package/dist/experiment/host/index.cjs.map +1 -1
  223. package/dist/experiment/host/operations.cjs +21 -22
  224. package/dist/experiment/host/operations.cjs.map +1 -1
  225. package/dist/experiment/host/runtime.cjs +8 -9
  226. package/dist/experiment/host/runtime.cjs.map +1 -1
  227. package/dist/experiment/host/runtime.d.cts +3 -3
  228. package/dist/experiment/host/runtime.d.mts +3 -3
  229. package/dist/experiment/host/runtime.d.ts +3 -3
  230. package/dist/experiment/host/teardown.cjs +3 -3
  231. package/dist/experiment/host/teardown.cjs.map +1 -1
  232. package/dist/experiment/host/teardown.d.cts +3 -3
  233. package/dist/experiment/host/teardown.d.mts +3 -3
  234. package/dist/experiment/host/teardown.d.ts +3 -3
  235. package/dist/experiment/host/types.cjs.map +1 -1
  236. package/dist/experiment/host/types.d.cts +19 -19
  237. package/dist/experiment/host/types.d.mts +19 -19
  238. package/dist/experiment/host/types.d.ts +19 -19
  239. package/dist/index.cjs +3 -3
  240. package/dist/index.cjs.map +1 -1
  241. package/dist/index.d.cts +3 -3
  242. package/dist/index.d.mts +3 -3
  243. package/dist/index.d.ts +3 -3
  244. package/dist/index.js +2 -2
  245. package/dist/index.mjs +2 -2
  246. package/dist/inspection/assertions.cjs +1 -1
  247. package/dist/inspection/assertions.cjs.map +1 -1
  248. package/dist/inspection/cli/contribution.cjs +8 -7
  249. package/dist/inspection/cli/contribution.cjs.map +1 -1
  250. package/dist/inspection/facts.cjs +4 -4
  251. package/dist/inspection/facts.cjs.map +1 -1
  252. package/dist/inspection/index.cjs +1 -5
  253. package/dist/inspection/index.cjs.map +1 -1
  254. package/dist/inspection/index.d.cts +1 -2
  255. package/dist/inspection/index.d.mts +1 -2
  256. package/dist/inspection/index.d.ts +1 -2
  257. package/dist/inspection/index.js +20 -26
  258. package/dist/inspection/lifecycle.cjs +7 -0
  259. package/dist/inspection/lifecycle.cjs.map +1 -0
  260. package/dist/inspection/lifecycle.d.cts +4 -0
  261. package/dist/inspection/lifecycle.d.mts +4 -0
  262. package/dist/inspection/lifecycle.d.ts +4 -0
  263. package/dist/inspection/lifecycle.js +6 -0
  264. package/dist/inspection/lifecycle.js.map +1 -0
  265. package/dist/inspection/notes.cjs +40 -0
  266. package/dist/inspection/notes.cjs.map +1 -0
  267. package/dist/inspection/notes.d.cts +12 -0
  268. package/dist/inspection/notes.d.mts +12 -0
  269. package/dist/inspection/notes.d.ts +12 -0
  270. package/dist/inspection/notes.js +8 -0
  271. package/dist/inspection/notes.js.map +1 -0
  272. package/dist/inspection/overview.cjs +12 -15
  273. package/dist/inspection/overview.cjs.map +1 -1
  274. package/dist/inspection/overview.d.cts +8 -6
  275. package/dist/inspection/overview.d.mts +8 -6
  276. package/dist/inspection/overview.d.ts +8 -6
  277. package/dist/inspection/planned-attempt.cjs +45 -0
  278. package/dist/inspection/planned-attempt.cjs.map +1 -0
  279. package/dist/inspection/planned-attempt.d.cts +109 -0
  280. package/dist/inspection/planned-attempt.d.mts +109 -0
  281. package/dist/inspection/planned-attempt.d.ts +109 -0
  282. package/dist/inspection/planned-attempt.js +24 -0
  283. package/dist/inspection/planned-attempt.js.map +1 -0
  284. package/dist/inspection/project-result.cjs +5 -5
  285. package/dist/inspection/project-result.cjs.map +1 -1
  286. package/dist/inspection/project-result.d.cts +58 -57
  287. package/dist/inspection/project-result.d.mts +58 -57
  288. package/dist/inspection/project-result.d.ts +58 -57
  289. package/dist/inspection/project-result.js +4 -4
  290. package/dist/inspection/project.cjs +3 -3
  291. package/dist/inspection/project.cjs.map +1 -1
  292. package/dist/inspection/protocol-values.cjs +1 -1
  293. package/dist/inspection/protocol-values.cjs.map +1 -1
  294. package/dist/inspection/protocol-values.d.cts +1 -1
  295. package/dist/inspection/protocol-values.d.mts +1 -1
  296. package/dist/inspection/protocol-values.d.ts +1 -1
  297. package/dist/inspection/protocol.cjs +8 -8
  298. package/dist/inspection/protocol.cjs.map +1 -1
  299. package/dist/inspection/protocol.d.cts +237 -219
  300. package/dist/inspection/protocol.d.mts +237 -219
  301. package/dist/inspection/protocol.d.ts +237 -219
  302. package/dist/inspection/public.cjs +1 -5
  303. package/dist/inspection/public.cjs.map +1 -1
  304. package/dist/inspection/public.d.cts +1 -2
  305. package/dist/inspection/public.d.mts +1 -2
  306. package/dist/inspection/public.d.ts +1 -2
  307. package/dist/inspection/public.js +14 -20
  308. package/dist/inspection/public.mjs +166 -129
  309. package/dist/inspection/query.cjs +1 -1
  310. package/dist/inspection/query.cjs.map +1 -1
  311. package/dist/inspection/results.cjs +61 -52
  312. package/dist/inspection/results.cjs.map +1 -1
  313. package/dist/inspection/results.d.cts +157 -140
  314. package/dist/inspection/results.d.mts +157 -140
  315. package/dist/inspection/results.d.ts +157 -140
  316. package/dist/inspection/select.cjs +33 -28
  317. package/dist/inspection/select.cjs.map +1 -1
  318. package/dist/inspection/source.cjs +1 -1
  319. package/dist/inspection/source.cjs.map +1 -1
  320. package/dist/inspection/sources.cjs +2 -2
  321. package/dist/inspection/sources.cjs.map +1 -1
  322. package/dist/inspection/trace.cjs +9 -8
  323. package/dist/inspection/trace.cjs.map +1 -1
  324. package/dist/inspection/trace.d.cts +4 -4
  325. package/dist/inspection/trace.d.mts +4 -4
  326. package/dist/inspection/trace.d.ts +4 -4
  327. package/dist/loaders/index.cjs +7 -279
  328. package/dist/loaders/index.cjs.map +1 -1
  329. package/dist/loaders/index.d.cts +2 -95
  330. package/dist/loaders/index.d.mts +2 -95
  331. package/dist/loaders/index.d.ts +2 -95
  332. package/dist/loaders/index.js +10 -12
  333. package/dist/loaders/index.mjs +10 -12
  334. package/dist/loaders/runtime.cjs +283 -0
  335. package/dist/loaders/runtime.cjs.map +1 -0
  336. package/dist/loaders/runtime.d.cts +95 -0
  337. package/dist/loaders/runtime.d.mts +95 -0
  338. package/dist/loaders/runtime.d.ts +95 -0
  339. package/dist/loaders/runtime.js +16 -0
  340. package/dist/loaders/runtime.js.map +1 -0
  341. package/dist/migrations/judge-provider.md +6 -6
  342. package/dist/{model-slots.cjs → model-roles.cjs} +12 -12
  343. package/dist/{model-slots.cjs.map → model-roles.cjs.map} +1 -1
  344. package/dist/{model-slots.d.cts → model-roles.d.cts} +10 -10
  345. package/dist/{model-slots.d.mts → model-roles.d.mts} +10 -10
  346. package/dist/{model-slots.d.ts → model-roles.d.ts} +10 -10
  347. package/dist/model-roles.js +14 -0
  348. package/dist/model-roles.js.map +1 -0
  349. package/dist/o11y/adapter-usage-projection.cjs +9 -8
  350. package/dist/o11y/adapter-usage-projection.cjs.map +1 -1
  351. package/dist/o11y/adapter-usage-projection.d.cts +23 -15
  352. package/dist/o11y/adapter-usage-projection.d.mts +23 -15
  353. package/dist/o11y/adapter-usage-projection.d.ts +23 -15
  354. package/dist/o11y/cache-read.cjs +14 -14
  355. package/dist/o11y/cache-read.cjs.map +1 -1
  356. package/dist/o11y/cache-read.d.cts +5 -5
  357. package/dist/o11y/cache-read.d.mts +5 -5
  358. package/dist/o11y/cache-read.d.ts +5 -5
  359. package/dist/o11y/derive.cjs.map +1 -1
  360. package/dist/o11y/derive.d.cts +2 -2
  361. package/dist/o11y/derive.d.mts +2 -2
  362. package/dist/o11y/derive.d.ts +2 -2
  363. package/dist/o11y/eval-usage.cjs +9 -9
  364. package/dist/o11y/eval-usage.cjs.map +1 -1
  365. package/dist/o11y/eval-usage.d.cts +7 -7
  366. package/dist/o11y/eval-usage.d.mts +7 -7
  367. package/dist/o11y/eval-usage.d.ts +7 -7
  368. package/dist/o11y/parsers/bub.cjs +57 -81
  369. package/dist/o11y/parsers/bub.cjs.map +1 -1
  370. package/dist/o11y/parsers/index.cjs.map +1 -1
  371. package/dist/o11y/parsers/index.d.cts +2 -0
  372. package/dist/o11y/parsers/index.d.mts +2 -0
  373. package/dist/o11y/parsers/index.d.ts +2 -0
  374. package/dist/o11y/parsers/opencode.cjs +129 -217
  375. package/dist/o11y/parsers/opencode.cjs.map +1 -1
  376. package/dist/o11y/parsers/opencode.d.cts +2 -5
  377. package/dist/o11y/parsers/opencode.d.mts +2 -5
  378. package/dist/o11y/parsers/opencode.d.ts +2 -5
  379. package/dist/o11y/types.cjs.map +1 -1
  380. package/dist/o11y/types.d.cts +1 -1
  381. package/dist/o11y/types.d.mts +1 -1
  382. package/dist/o11y/types.d.ts +1 -1
  383. package/dist/plugin/contracts.cjs +170 -120
  384. package/dist/plugin/contracts.cjs.map +1 -1
  385. package/dist/plugin/contracts.d.cts +102 -90
  386. package/dist/plugin/contracts.d.mts +102 -90
  387. package/dist/plugin/contracts.d.ts +102 -90
  388. package/dist/plugin/contracts.js +16 -12
  389. package/dist/plugin/index.cjs.map +1 -1
  390. package/dist/plugin/index.d.cts +1 -1
  391. package/dist/plugin/index.d.mts +1 -1
  392. package/dist/plugin/index.d.ts +1 -1
  393. package/dist/plugin/link.cjs +69 -64
  394. package/dist/plugin/link.cjs.map +1 -1
  395. package/dist/plugin/link.d.cts +5 -3
  396. package/dist/plugin/link.d.mts +5 -3
  397. package/dist/plugin/link.d.ts +5 -3
  398. package/dist/plugin/link.js +12 -8
  399. package/dist/record/codec/seal-manifest.d.cts +3 -3
  400. package/dist/record/codec/seal-manifest.d.mts +3 -3
  401. package/dist/record/codec/seal-manifest.d.ts +3 -3
  402. package/dist/record/family/attempt-note/definition.cjs +12 -0
  403. package/dist/record/family/attempt-note/definition.cjs.map +1 -0
  404. package/dist/record/family/attempt-note/definition.d.cts +6 -0
  405. package/dist/record/family/attempt-note/definition.d.mts +6 -0
  406. package/dist/record/family/attempt-note/definition.d.ts +6 -0
  407. package/dist/record/family/attempt-note/definition.js +6 -0
  408. package/dist/record/family/attempt-note/definition.js.map +1 -0
  409. package/dist/record/family/attempt-note/persistence.cjs +10 -0
  410. package/dist/record/family/attempt-note/persistence.cjs.map +1 -0
  411. package/dist/record/family/attempt-note/persistence.d.cts +6 -0
  412. package/dist/record/family/attempt-note/persistence.d.mts +6 -0
  413. package/dist/record/family/attempt-note/persistence.d.ts +6 -0
  414. package/dist/record/family/attempt-note/persistence.js +6 -0
  415. package/dist/record/family/attempt-note/persistence.js.map +1 -0
  416. package/dist/record/family/attempt-note/schema.cjs +20 -0
  417. package/dist/record/family/attempt-note/schema.cjs.map +1 -0
  418. package/dist/record/family/attempt-note/schema.d.cts +21 -0
  419. package/dist/record/family/attempt-note/schema.d.mts +21 -0
  420. package/dist/record/family/attempt-note/schema.d.ts +21 -0
  421. package/dist/record/family/attempt-note/schema.js +10 -0
  422. package/dist/record/family/attempt-note/schema.js.map +1 -0
  423. package/dist/record/family/catalog.cjs +32 -29
  424. package/dist/record/family/catalog.cjs.map +1 -1
  425. package/dist/record/family/catalog.d.cts +7 -2
  426. package/dist/record/family/catalog.d.mts +7 -2
  427. package/dist/record/family/catalog.d.ts +7 -2
  428. package/dist/record/family/current.cjs +48 -45
  429. package/dist/record/family/current.cjs.map +1 -1
  430. package/dist/record/family/current.d.cts +15 -0
  431. package/dist/record/family/current.d.mts +15 -0
  432. package/dist/record/family/current.d.ts +15 -0
  433. package/dist/record/model/index.js +66 -64
  434. package/dist/record/model/run-context.cjs +9 -3
  435. package/dist/record/model/run-context.cjs.map +1 -1
  436. package/dist/record/model/run-context.d.cts +9 -2
  437. package/dist/record/model/run-context.d.mts +9 -2
  438. package/dist/record/model/run-context.d.ts +9 -2
  439. package/dist/record/model/run-context.js +8 -6
  440. package/dist/record/model/seal-manifest.d.cts +1 -1
  441. package/dist/record/model/seal-manifest.d.mts +1 -1
  442. package/dist/record/model/seal-manifest.d.ts +1 -1
  443. package/dist/run/cli/contribution.cjs +6 -32
  444. package/dist/run/cli/contribution.cjs.map +1 -1
  445. package/dist/run/host/runtime.cjs +1 -1
  446. package/dist/run/host/runtime.cjs.map +1 -1
  447. package/dist/run/storage/sqlite.cjs +7 -7
  448. package/dist/run/storage/sqlite.cjs.map +1 -1
  449. package/dist/runner/adapter-usage.cjs +5 -3
  450. package/dist/runner/adapter-usage.cjs.map +1 -1
  451. package/dist/runner/adapter-usage.d.cts +2 -2
  452. package/dist/runner/adapter-usage.d.mts +2 -2
  453. package/dist/runner/adapter-usage.d.ts +2 -2
  454. package/dist/runner/adoption.cjs +9 -12
  455. package/dist/runner/adoption.cjs.map +1 -1
  456. package/dist/runner/attempt-notes.cjs +8 -0
  457. package/dist/runner/attempt-notes.cjs.map +1 -0
  458. package/dist/runner/attempt-notes.d.cts +4 -0
  459. package/dist/runner/attempt-notes.d.mts +4 -0
  460. package/dist/runner/attempt-notes.d.ts +4 -0
  461. package/dist/runner/attempt-notes.js +8 -0
  462. package/dist/runner/attempt-notes.js.map +1 -0
  463. package/dist/runner/attempt.cjs +61 -73
  464. package/dist/runner/attempt.cjs.map +1 -1
  465. package/dist/runner/attempt.d.cts +3 -3
  466. package/dist/runner/attempt.d.mts +3 -3
  467. package/dist/runner/attempt.d.ts +3 -3
  468. package/dist/runner/command-plan.cjs +21 -26
  469. package/dist/runner/command-plan.cjs.map +1 -1
  470. package/dist/runner/command-plan.d.cts +4 -4
  471. package/dist/runner/command-plan.d.mts +4 -4
  472. package/dist/runner/command-plan.d.ts +4 -4
  473. package/dist/runner/command-plan.js +4 -4
  474. package/dist/runner/config-identity.cjs.map +1 -1
  475. package/dist/runner/config-identity.d.cts +2 -2
  476. package/dist/runner/config-identity.d.mts +2 -2
  477. package/dist/runner/config-identity.d.ts +2 -2
  478. package/dist/runner/discover.cjs +6 -6
  479. package/dist/runner/discover.cjs.map +1 -1
  480. package/dist/runner/eval-selection.cjs +2 -2
  481. package/dist/runner/eval-selection.cjs.map +1 -1
  482. package/dist/runner/eval-selection.d.cts +2 -2
  483. package/dist/runner/eval-selection.d.mts +2 -2
  484. package/dist/runner/eval-selection.d.ts +2 -2
  485. package/dist/runner/feedback/human.cjs +1 -1
  486. package/dist/runner/feedback/human.cjs.map +1 -1
  487. package/dist/runner/feedback/json.cjs +4 -2
  488. package/dist/runner/feedback/json.cjs.map +1 -1
  489. package/dist/runner/feedback/json.d.cts +1 -1
  490. package/dist/runner/feedback/json.d.mts +1 -1
  491. package/dist/runner/feedback/json.d.ts +1 -1
  492. package/dist/runner/feedback/sink.cjs +1 -1
  493. package/dist/runner/feedback/sink.cjs.map +1 -1
  494. package/dist/runner/feedback/sink.d.cts +1 -1
  495. package/dist/runner/feedback/sink.d.mts +1 -1
  496. package/dist/runner/feedback/sink.d.ts +1 -1
  497. package/dist/runner/fingerprint.cjs +1 -1
  498. package/dist/runner/fingerprint.cjs.map +1 -1
  499. package/dist/runner/project-target.cjs.map +1 -1
  500. package/dist/runner/project-target.d.cts +2 -2
  501. package/dist/runner/project-target.d.mts +2 -2
  502. package/dist/runner/project-target.d.ts +2 -2
  503. package/dist/runner/record/attachments.cjs +2 -2
  504. package/dist/runner/record/attachments.cjs.map +1 -1
  505. package/dist/runner/record/planning.cjs +8 -2
  506. package/dist/runner/record/planning.cjs.map +1 -1
  507. package/dist/runner/record.cjs +2 -0
  508. package/dist/runner/record.cjs.map +1 -1
  509. package/dist/runner/report.cjs +3 -3
  510. package/dist/runner/report.cjs.map +1 -1
  511. package/dist/runner/report.d.cts +1 -1
  512. package/dist/runner/report.d.mts +1 -1
  513. package/dist/runner/report.d.ts +1 -1
  514. package/dist/runner/reuse-plan.cjs +2 -2
  515. package/dist/runner/reuse-plan.cjs.map +1 -1
  516. package/dist/runner/run.cjs +10 -45
  517. package/dist/runner/run.cjs.map +1 -1
  518. package/dist/runner/sandbox-pool.cjs +1 -2
  519. package/dist/runner/sandbox-pool.cjs.map +1 -1
  520. package/dist/runner/setup-prefix-preparation.cjs +1 -1
  521. package/dist/runner/setup-prefix-preparation.cjs.map +1 -1
  522. package/dist/runner/teardown-registry.cjs +2 -2
  523. package/dist/runner/teardown-registry.cjs.map +1 -1
  524. package/dist/runner/teardown-registry.d.cts +1 -1
  525. package/dist/runner/teardown-registry.d.mts +1 -1
  526. package/dist/runner/teardown-registry.d.ts +1 -1
  527. package/dist/runner/types.cjs +4 -4
  528. package/dist/runner/types.cjs.map +1 -1
  529. package/dist/runner/types.d.cts +64 -93
  530. package/dist/runner/types.d.mts +64 -93
  531. package/dist/runner/types.d.ts +64 -93
  532. package/dist/runner/types.js +2 -2
  533. package/dist/sandbox/action.cjs +1 -1
  534. package/dist/sandbox/action.cjs.map +1 -1
  535. package/dist/sandbox/cli/contribution.cjs +17 -14
  536. package/dist/sandbox/cli/contribution.cjs.map +1 -1
  537. package/dist/sandbox/cli/contribution.d.cts +1 -1
  538. package/dist/sandbox/cli/contribution.d.mts +1 -1
  539. package/dist/sandbox/cli/contribution.d.ts +1 -1
  540. package/dist/sandbox/commands.cjs +1 -1
  541. package/dist/sandbox/commands.cjs.map +1 -1
  542. package/dist/sandbox/commands.d.cts +1 -1
  543. package/dist/sandbox/commands.d.mts +1 -1
  544. package/dist/sandbox/commands.d.ts +1 -1
  545. package/dist/sandbox/compose.cjs +2 -2
  546. package/dist/sandbox/compose.cjs.map +1 -1
  547. package/dist/sandbox/docker-profile/registry.cjs +5 -9
  548. package/dist/sandbox/docker-profile/registry.cjs.map +1 -1
  549. package/dist/sandbox/docker-profile/registry.d.cts +0 -3
  550. package/dist/sandbox/docker-profile/registry.d.mts +0 -3
  551. package/dist/sandbox/docker-profile/registry.d.ts +0 -3
  552. package/dist/sandbox/docker-profile/registry.js +6 -12
  553. package/dist/sandbox/docker-profile/runtime.cjs +1 -1
  554. package/dist/sandbox/docker-profile/runtime.cjs.map +1 -1
  555. package/dist/sandbox/docker-profile/schema.cjs +12 -16
  556. package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
  557. package/dist/sandbox/docker-profile/schema.d.cts +2 -6
  558. package/dist/sandbox/docker-profile/schema.d.mts +2 -6
  559. package/dist/sandbox/docker-profile/schema.d.ts +2 -6
  560. package/dist/sandbox/docker-profile/schema.js +24 -32
  561. package/dist/sandbox/incus.cjs +2 -2
  562. package/dist/sandbox/incus.cjs.map +1 -1
  563. package/dist/sandbox/index.cjs +4 -35
  564. package/dist/sandbox/index.cjs.map +1 -1
  565. package/dist/sandbox/index.d.cts +4 -8
  566. package/dist/sandbox/index.d.mts +4 -8
  567. package/dist/sandbox/index.d.ts +4 -8
  568. package/dist/sandbox/index.js +116 -172
  569. package/dist/sandbox/index.mjs +116 -172
  570. package/dist/sandbox/layer.cjs +3 -3
  571. package/dist/sandbox/layer.cjs.map +1 -1
  572. package/dist/sandbox/link.cjs +5 -0
  573. package/dist/sandbox/link.cjs.map +1 -1
  574. package/dist/sandbox/link.d.cts +3 -0
  575. package/dist/sandbox/link.d.mts +3 -0
  576. package/dist/sandbox/link.d.ts +3 -0
  577. package/dist/sandbox/runtime.cjs +9 -4
  578. package/dist/sandbox/runtime.cjs.map +1 -1
  579. package/dist/shared/failure-class.cjs +5 -5
  580. package/dist/shared/failure-class.cjs.map +1 -1
  581. package/dist/shared/failure-class.d.cts +4 -10
  582. package/dist/shared/failure-class.d.mts +4 -10
  583. package/dist/shared/failure-class.d.ts +4 -10
  584. package/dist/shared/types.cjs.map +1 -1
  585. package/dist/shared/types.d.cts +1 -1
  586. package/dist/shared/types.d.mts +1 -1
  587. package/dist/shared/types.d.ts +1 -1
  588. package/dist/show/contribution.cjs +17 -2
  589. package/dist/show/contribution.cjs.map +1 -1
  590. package/dist/show/contribution.d.cts +14 -0
  591. package/dist/show/contribution.d.mts +14 -0
  592. package/dist/show/contribution.d.ts +14 -0
  593. package/dist/show/model.cjs +8 -5
  594. package/dist/show/model.cjs.map +1 -1
  595. package/dist/show/model.d.cts +11 -8
  596. package/dist/show/model.d.mts +11 -8
  597. package/dist/show/model.d.ts +11 -8
  598. package/dist/show/render.cjs +34 -22
  599. package/dist/show/render.cjs.map +1 -1
  600. package/dist/sources/projector.cjs +1 -1
  601. package/dist/sources/projector.cjs.map +1 -1
  602. package/dist/types.cjs +1 -1
  603. package/dist/types.cjs.map +1 -1
  604. package/dist/types.d.cts +1 -1
  605. package/dist/types.d.mts +1 -1
  606. package/dist/types.d.ts +1 -1
  607. package/dist/types.js +2 -2
  608. package/dist/view/app-dist/.vite/manifest.json +2 -2
  609. package/dist/view/app-dist/assets/{index-B3ijZRph.js → index-CxrOUvHC.js} +17 -17
  610. package/dist/view/app-dist/assets/{quality-cost-scatter-B--DfJ9s.js → quality-cost-scatter-B6Aiss7x.js} +1 -1
  611. package/dist/view/app-dist/index.html +1 -1
  612. package/dist/view/cli/contribution.cjs +1 -1
  613. package/dist/view/cli/contribution.cjs.map +1 -1
  614. package/dist/view/function-runtime.mjs +318 -121
  615. package/dist/view/http-protocol.d.cts +1 -1
  616. package/dist/view/http-protocol.d.mts +1 -1
  617. package/dist/view/http-protocol.d.ts +1 -1
  618. package/dist/view/inspection-host.cjs +2 -2
  619. package/dist/view/inspection-host.cjs.map +1 -1
  620. package/dist/view/inspection-host.d.cts +349 -331
  621. package/dist/view/inspection-host.d.mts +349 -331
  622. package/dist/view/inspection-host.d.ts +349 -331
  623. package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +6 -6
  624. package/docs-site/zh/examples/integrations/claude-sdk.mdx +5 -5
  625. package/docs-site/zh/examples/integrations/codex-sdk.mdx +4 -4
  626. package/docs-site/zh/examples/integrations/langgraph.mdx +4 -4
  627. package/docs-site/zh/examples/integrations/pi-sdk.mdx +5 -5
  628. package/docs-site/zh/explanation/adapter.mdx +6 -6
  629. package/docs-site/zh/explanation/assert.mdx +7 -7
  630. package/docs-site/zh/explanation/drive.mdx +4 -4
  631. package/docs-site/zh/explanation/hitl.mdx +2 -2
  632. package/docs-site/zh/explanation/judge.mdx +2 -2
  633. package/docs-site/zh/introduction.mdx +2 -2
  634. package/docs-site/zh/reference/builtin-agents.mdx +46 -49
  635. package/docs-site/zh/reference/cli.mdx +16 -14
  636. package/docs-site/zh/reference/define-agent.mdx +19 -19
  637. package/docs-site/zh/reference/define-config.mdx +7 -15
  638. package/docs-site/zh/reference/define-eval.mdx +20 -14
  639. package/docs-site/zh/reference/define-experiment.mdx +18 -39
  640. package/docs-site/zh/reference/events.mdx +1 -1
  641. package/docs-site/zh/reference/expect.mdx +21 -0
  642. package/docs-site/zh/reference/official-adapters.mdx +12 -5
  643. package/docs-site/zh/troubleshooting/debugging.mdx +2 -2
  644. package/docs-site/zh/troubleshooting/recover-after-kill.mdx +1 -1
  645. package/docs-site/zh/tutorials/agent-onboarding.mdx +2 -2
  646. package/docs-site/zh/tutorials/authoring.mdx +2 -2
  647. package/docs-site/zh/tutorials/compare-runs.mdx +1 -1
  648. package/docs-site/zh/tutorials/concurrency.mdx +8 -8
  649. package/docs-site/zh/tutorials/configuration.mdx +5 -5
  650. package/docs-site/zh/tutorials/control-run-cost.mdx +19 -19
  651. package/docs-site/zh/tutorials/eval-groups.mdx +1 -1
  652. package/docs-site/zh/tutorials/evaluation-kinds.mdx +5 -5
  653. package/docs-site/zh/tutorials/experiment-services.mdx +32 -32
  654. package/docs-site/zh/tutorials/handle-execution-failures.mdx +2 -28
  655. package/docs-site/zh/tutorials/plugins.mdx +49 -143
  656. package/docs-site/zh/tutorials/sandbox-agent.mdx +1 -1
  657. package/docs-site/zh/tutorials/sandbox-reuse.mdx +7 -7
  658. package/docs-site/zh/tutorials/upgrade-0-18.mdx +1 -1
  659. package/docs-site/zh/tutorials/upgrade-0-19.mdx +121 -0
  660. package/docs-site/zh/tutorials/upgrade-0-20.mdx +12 -0
  661. package/docs-site/zh/tutorials/verify-judge.mdx +2 -2
  662. package/docs-site/zh/tutorials/viewing-results.mdx +2 -2
  663. package/docs-site/zh/tutorials/write-experiment.mdx +1 -1
  664. package/docs-site/zh/tutorials/write-send.mdx +13 -13
  665. package/package.json +1 -1
  666. package/dist/agents/effect-runtime.cjs.map +0 -1
  667. package/dist/agents/effect-runtime.d.cts +0 -29
  668. package/dist/agents/effect-runtime.d.mts +0 -29
  669. package/dist/agents/effect-runtime.d.ts +0 -29
  670. package/dist/agents/effect-runtime.js +0 -16
  671. package/dist/agents/effect-runtime.js.map +0 -1
  672. package/dist/agents/session-slot.cjs.map +0 -1
  673. package/dist/agents/session-slot.d.cts +0 -12
  674. package/dist/agents/session-slot.d.mts +0 -12
  675. package/dist/agents/session-slot.d.ts +0 -12
  676. package/dist/agents/session-slot.js +0 -6
  677. package/dist/agents/session-slot.js.map +0 -1
  678. package/dist/model-slots.js +0 -14
  679. package/dist/model-slots.js.map +0 -1
@@ -5,7 +5,7 @@ exports.operationalInspectionSource = operationalInspectionSource;
5
5
  exports.externalInspectionSource = externalInspectionSource;
6
6
  exports.openInspectionSource = openInspectionSource;
7
7
  exports.openHostOwnedInspectionSource = openHostOwnedInspectionSource;
8
- // @concord-file ne-eval-inspection-source
8
+ // @concord-file
9
9
  // @concord-implements docs/feature/inspection/README.md
10
10
  // @concord-implements docs/feature/inspection/architecture.md
11
11
  // @concord-implements docs/feature/insight/README.md
@@ -1 +1 @@
1
- {"version":3,"file":"source.js","sourceRoot":"","sources":["source.ts"],"names":[],"mappings":";;;AA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Y,EAAE,QAAQ,CAAC;QAC/I,kBAAkB,EAAE,CAAC,YAAoB,EAAE,YAAoB,EAAE,QAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,sBAAsB,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC;KAC7J,CAAC,CAAC;AACP,CAAC;AACD,SAAS,WAAW,CAAC,KAAc;IAC/B,IAAI,KAAK,YAAY,kCAAsB,EAAE,CAAC;QAC1C,OAAO,IAAI,wBAAwB,CAAC;YAChC,IAAI,EAAE,qCAAqC;YAC3C,KAAK,EAAE,KAAK,CAAC,KAAK;SACrB,CAAC,CAAC;IACP,CAAC;IACD,OAAO,IAAI,qBAAqB,CAAC;QAC7B,IAAI,EAAE,2BAA2B;QACjC,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAiC;QAClF,KAAK;KACR,CAAC,CAAC;AACP,CAAC","sourcesContent":["// @concord-file ne-eval-inspection-source\n// @concord-implements docs/feature/inspection/README.md\n// @concord-implements docs/feature/inspection/architecture.md\n// @concord-implements docs/feature/insight/README.md\nimport { existsSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { Data, Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { RecordIntegrityFailure } from \"../record/reader/errors.ts\";\nimport { EMPTY_PUBLICATION_CUTOFF_IDENTITY } from \"../run/protocol.ts\";\nimport { openHostOwnedRecordReadSession, acquireProjectRecordReadSession, RECORD_SQLITE_VALIDATION_DEADLINE_MS, type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type PinnedRecordReadSession, type SealedRunCore, type SealedRunSummaryPage, } from \"../record/sqlite/index.ts\";\nimport { startExternalRecordImport } from \"../record/sqlite/external-record-import.ts\";\nimport { publicationCutoffIdentity } from \"../run/storage/cutoff.ts\";\nimport type { PublicationCutoff, ReadableRunResource, RunResourcePage } from \"../run/storage/types.ts\";\nexport type InspectionSource = {\n readonly kind: \"project-record\";\n readonly databasePath: string;\n} | {\n readonly kind: \"external-record\";\n readonly recordPath: string;\n};\nexport class InspectionSourceError extends Data.TaggedError(\"InspectionSourceError\")<{\n readonly code: \"inspection-source-invalid\";\n readonly reason: string;\n readonly cause?: unknown;\n}> {\n}\n/** Safe Inspection identity for a Record publication that is not closed. */\nexport class InspectionIntegrityError extends Data.TaggedError(\"InspectionIntegrityError\")<{\n readonly code: \"inspection-record-integrity-failure\";\n readonly runId: string;\n}> {\n}\n/** Browser-neutral fixed reader capability backed by one pinned Record generation. */\nexport interface InspectionFactSource {\n readonly kind: InspectionSource[\"kind\"];\n readonly cutoff: () => PublicationCutoff & {\n readonly identity: string;\n };\n readonly findExperimentRunIds: (experimentId: string) => readonly string[];\n readonly readRunResource: (runId: string) => ReadableRunResource | undefined;\n readonly readRunResourcePage: (afterRunId?: string, pageSize?: number) => RunResourcePage;\n readonly readSealedRunSummaryPage: (afterRunId?: string, pageSize?: number, expectedCutoffIdentity?: string) => SealedRunSummaryPage;\n readonly findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => AttemptLocatorCandidates;\n readonly readSealedRunCore: (runId: string) => SealedRunCore | undefined;\n readonly readContentPage: (contentId: string, afterOrdinal: number, pageSize: number) => ContentChunkPage;\n readonly readCollectionPage: (attachmentId: string, afterOrdinal: number, pageSize: number) => CollectionItemPage;\n}\n/** Pure source selection; opening and validation happen only inside a Scope. */\nexport function operationalInspectionSource(cwd: string): InspectionSource {\n return Object.freeze({\n kind: \"project-record\" as const,\n databasePath: resolve(cwd, \".niceeval/record.sqlite\"),\n });\n}\nexport function externalInspectionSource(cwd: string, pathname: string): InspectionSource {\n return Object.freeze({\n kind: \"external-record\" as const,\n recordPath: resolve(cwd, pathname),\n });\n}\n/**\n * Acquires exactly one pinned Record reader. Every fixed operation in the\n * returned source sees the same generation, and Scope closes the session on\n * success, typed failure, defect, or interruption.\n */\nexport function openInspectionSource(source: InspectionSource): Effect.Effect<InspectionFactSource, InspectionSourceError | InspectionIntegrityError, Scope.Scope> {\n return Effect.gen(function* () {\n let session: PinnedRecordReadSession;\n if (source.kind === \"project-record\") {\n if (!existsSync(source.databasePath))\n return emptyOperationalFacts();\n session = yield* acquireProjectRecordReadSession(dirname(source.databasePath)).pipe(Effect.mapError(sourceError));\n }\n else {\n const importDeadline = Date.now() + RECORD_SQLITE_VALIDATION_DEADLINE_MS;\n const importer = yield* Effect.acquireRelease(Effect.try({\n try: () => startExternalRecordImport(source.recordPath, importDeadline),\n catch: (cause) => sourceError(cause),\n }), (handle) => Effect.promise(() => handle.close().catch(() => undefined)));\n const generation = yield* Effect.tryPromise({\n // Declaring the AbortSignal keeps this await interruptible. Scope then\n // terminates the Worker and removes its private generation.\n try: (_signal) => importer.result,\n catch: (cause) => sourceError(cause),\n });\n session = yield* Effect.acquireRelease(Effect.try({\n try: () => openHostOwnedRecordReadSession(generation.path),\n catch: (cause) => sourceError(cause),\n }), (opened) => Effect.sync(() => opened.close()));\n }\n return sessionFacts(session, source.kind);\n });\n}\n/** Opens one already-imported private generation without accepting a public path. */\nexport function openHostOwnedInspectionSource(recordPath: string): Effect.Effect<InspectionFactSource, InspectionSourceError | InspectionIntegrityError, Scope.Scope> {\n return Effect.gen(function* () {\n const session = yield* Effect.acquireRelease(Effect.try({\n try: () => openHostOwnedRecordReadSession(recordPath),\n catch: (cause) => sourceError(cause),\n }), (opened) => Effect.sync(() => opened.close()));\n return sessionFacts(session, \"external-record\");\n });\n}\nconst EMPTY_OPERATIONAL_CUTOFF = Object.freeze({\n identity: EMPTY_PUBLICATION_CUTOFF_IDENTITY,\n storeGeneration: EMPTY_PUBLICATION_CUTOFF_IDENTITY,\n revision: 0,\n});\nfunction emptyOperationalFacts(): InspectionFactSource {\n return Object.freeze({\n kind: \"project-record\" as const,\n cutoff: () => EMPTY_OPERATIONAL_CUTOFF,\n findExperimentRunIds: () => Object.freeze([]),\n readRunResource: () => undefined,\n readRunResourcePage: () => Object.freeze({\n cutoff: Object.freeze({ storeGeneration: EMPTY_PUBLICATION_CUTOFF_IDENTITY, revision: 0 }),\n runs: Object.freeze([]),\n nextAfterRunId: null,\n }),\n readSealedRunSummaryPage: (afterRunId = \"\", _pageSize = 100, expectedCutoffIdentity?: string) => {\n if (expectedCutoffIdentity !== undefined && expectedCutoffIdentity !== EMPTY_OPERATIONAL_CUTOFF.identity) {\n throw new InspectionSourceError({\n code: \"inspection-source-invalid\",\n reason: \"The empty operational publication cutoff changed; restart pagination.\",\n });\n }\n return Object.freeze({\n cutoff: Object.freeze({ identity: EMPTY_OPERATIONAL_CUTOFF.identity, runCount: 0 }),\n afterRunId,\n summaries: Object.freeze([]),\n nextAfterRunId: null,\n });\n },\n findAttemptLocatorCandidates: (locator: string) => Object.freeze({\n locator,\n ambiguous: false,\n candidates: Object.freeze([]),\n }),\n readSealedRunCore: () => undefined,\n readContentPage: (contentId: string, afterOrdinal: number) => Object.freeze({\n contentId,\n afterOrdinal,\n chunks: Object.freeze([]),\n nextOrdinal: null,\n }),\n readCollectionPage: (attachmentId: string, afterOrdinal: number) => Object.freeze({\n attachmentId,\n afterOrdinal,\n items: Object.freeze([]),\n nextOrdinal: null,\n }),\n });\n}\nfunction sessionFacts(session: PinnedRecordReadSession, kind: InspectionSource[\"kind\"]): InspectionFactSource {\n const publication = session.publicationCutoff();\n const cutoff = Object.freeze({ ...publication, identity: publicationCutoffIdentity(publication) });\n const readPage = (afterRunId = \"\", pageSize = 100, expectedCutoffIdentity?: string): SealedRunSummaryPage => session.readSealedRunSummaryPage(afterRunId, pageSize, expectedCutoffIdentity ?? cutoff.identity);\n return Object.freeze({\n kind,\n cutoff: () => cutoff,\n findExperimentRunIds: session.findExperimentRunIds,\n readRunResource: (runId: string) => session.readRunResource(runId),\n readRunResourcePage: (afterRunId = \"\", pageSize = 100) => session.listRunResources({ afterRunId, pageSize }),\n readSealedRunSummaryPage: readPage,\n findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => session.findAttemptLocatorCandidates(locator, maximumCandidateRuns),\n readSealedRunCore: (runId: string) => session.readSealedRunCore(runId, true),\n readContentPage: (contentId: string, afterOrdinal: number, pageSize: number) => session.readContentChunkPage(contentId, afterOrdinal, pageSize),\n readCollectionPage: (attachmentId: string, afterOrdinal: number, pageSize: number) => session.readCollectionItemPage(attachmentId, afterOrdinal, pageSize),\n });\n}\nfunction sourceError(cause: unknown): InspectionSourceError | InspectionIntegrityError {\n if (cause instanceof RecordIntegrityFailure) {\n return new InspectionIntegrityError({\n code: \"inspection-record-integrity-failure\",\n runId: cause.runId,\n });\n }\n return new InspectionSourceError({\n code: \"inspection-source-invalid\",\n reason: cause instanceof Error ? cause.message : \"Record source validation failed\",\n cause,\n });\n}\n"]}
1
+ {"version":3,"file":"source.js","sourceRoot":"","sources":["source.ts"],"names":[],"mappings":";;;AAiDA,kEAKC;AACD,4DAKC;AAMD,oDA2BC;AAED,sEAQC;AAvGD,gBAAgB;AAChB,wDAAwD;AACxD,8DAA8D;AAC9D,qDAAqD;AACrD,qCAAqC;AACrC,yCAA6C;AAC7C,mCAAsC;AAEtC,0DAAoE;AACpE,oDAAuE;AACvE,wDAA+S;AAC/S,0FAAuF;AACvF,wDAAqE;AASrE,MAAa,qBAAsB,SAAQ,aAAI,CAAC,WAAW,CAAC,uBAAuB,CAIjF;CACD;AALD,sDAKC;AACD,4EAA4E;AAC5E,MAAa,wBAAyB,SAAQ,aAAI,CAAC,WAAW,CAAC,0BAA0B,CAGvF;CACD;AAJD,4DAIC;AAgBD,gFAAgF;AAChF,SAAgB,2BAA2B,CAAC,GAAW;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,gBAAyB;QAC/B,YAAY,EAAE,IAAA,mBAAO,EAAC,GAAG,EAAE,yBAAyB,CAAC;KACxD,CAAC,CAAC;AACP,CAAC;AACD,SAAgB,wBAAwB,CAAC,GAAW,EAAE,QAAgB;IAClE,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE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BAAmB,EAAE,CAAC,UAAU,GAAG,EAAE,EAAE,QAAQ,GAAG,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;QAC5G,wBAAwB,EAAE,QAAQ;QAClC,4BAA4B,EAAE,CAAC,OAAe,EAAE,oBAA4B,EAAE,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC,OAAO,EAAE,oBAAoB,CAAC;QACpJ,iBAAiB,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC;QAC5E,eAAe,EAAE,CAAC,SAAiB,EAAE,YAAoB,EAAE,QAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,YAAY,EAAE,QAAQ,CAAC;QAC/I,kBAAkB,EAAE,CAAC,YAAoB,EAAE,YAAoB,EAAE,QAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,sBAAsB,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC;KAC7J,CAAC,CAAC;AACP,CAAC;AACD,SAAS,WAAW,CAAC,KAAc;IAC/B,IAAI,KAAK,YAAY,kCAAsB,EAAE,CAAC;QAC1C,OAAO,IAAI,wBAAwB,CAAC;YAChC,IAAI,EAAE,qCAAqC;YAC3C,KAAK,EAAE,KAAK,CAAC,KAAK;SACrB,CAAC,CAAC;IACP,CAAC;IACD,OAAO,IAAI,qBAAqB,CAAC;QAC7B,IAAI,EAAE,2BAA2B;QACjC,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAiC;QAClF,KAAK;KACR,CAAC,CAAC;AACP,CAAC","sourcesContent":["// @concord-file\n// @concord-implements docs/feature/inspection/README.md\n// @concord-implements docs/feature/inspection/architecture.md\n// @concord-implements docs/feature/insight/README.md\nimport { existsSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { Data, Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { RecordIntegrityFailure } from \"../record/reader/errors.ts\";\nimport { EMPTY_PUBLICATION_CUTOFF_IDENTITY } from \"../run/protocol.ts\";\nimport { openHostOwnedRecordReadSession, acquireProjectRecordReadSession, RECORD_SQLITE_VALIDATION_DEADLINE_MS, type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type PinnedRecordReadSession, type SealedRunCore, type SealedRunSummaryPage, } from \"../record/sqlite/index.ts\";\nimport { startExternalRecordImport } from \"../record/sqlite/external-record-import.ts\";\nimport { publicationCutoffIdentity } from \"../run/storage/cutoff.ts\";\nimport type { PublicationCutoff, ReadableRunResource, RunResourcePage } from \"../run/storage/types.ts\";\nexport type InspectionSource = {\n readonly kind: \"project-record\";\n readonly databasePath: string;\n} | {\n readonly kind: \"external-record\";\n readonly recordPath: string;\n};\nexport class InspectionSourceError extends Data.TaggedError(\"InspectionSourceError\")<{\n readonly code: \"inspection-source-invalid\";\n readonly reason: string;\n readonly cause?: unknown;\n}> {\n}\n/** Safe Inspection identity for a Record publication that is not closed. */\nexport class InspectionIntegrityError extends Data.TaggedError(\"InspectionIntegrityError\")<{\n readonly code: \"inspection-record-integrity-failure\";\n readonly runId: string;\n}> {\n}\n/** Browser-neutral fixed reader capability backed by one pinned Record generation. */\nexport interface InspectionFactSource {\n readonly kind: InspectionSource[\"kind\"];\n readonly cutoff: () => PublicationCutoff & {\n readonly identity: string;\n };\n readonly findExperimentRunIds: (experimentId: string) => readonly string[];\n readonly readRunResource: (runId: string) => ReadableRunResource | undefined;\n readonly readRunResourcePage: (afterRunId?: string, pageSize?: number) => RunResourcePage;\n readonly readSealedRunSummaryPage: (afterRunId?: string, pageSize?: number, expectedCutoffIdentity?: string) => SealedRunSummaryPage;\n readonly findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => AttemptLocatorCandidates;\n readonly readSealedRunCore: (runId: string) => SealedRunCore | undefined;\n readonly readContentPage: (contentId: string, afterOrdinal: number, pageSize: number) => ContentChunkPage;\n readonly readCollectionPage: (attachmentId: string, afterOrdinal: number, pageSize: number) => CollectionItemPage;\n}\n/** Pure source selection; opening and validation happen only inside a Scope. */\nexport function operationalInspectionSource(cwd: string): InspectionSource {\n return Object.freeze({\n kind: \"project-record\" as const,\n databasePath: resolve(cwd, \".niceeval/record.sqlite\"),\n });\n}\nexport function externalInspectionSource(cwd: string, pathname: string): InspectionSource {\n return Object.freeze({\n kind: \"external-record\" as const,\n recordPath: resolve(cwd, pathname),\n });\n}\n/**\n * Acquires exactly one pinned Record reader. Every fixed operation in the\n * returned source sees the same generation, and Scope closes the session on\n * success, typed failure, defect, or interruption.\n */\nexport function openInspectionSource(source: InspectionSource): Effect.Effect<InspectionFactSource, InspectionSourceError | InspectionIntegrityError, Scope.Scope> {\n return Effect.gen(function* () {\n let session: PinnedRecordReadSession;\n if (source.kind === \"project-record\") {\n if (!existsSync(source.databasePath))\n return emptyOperationalFacts();\n session = yield* acquireProjectRecordReadSession(dirname(source.databasePath)).pipe(Effect.mapError(sourceError));\n }\n else {\n const importDeadline = Date.now() + RECORD_SQLITE_VALIDATION_DEADLINE_MS;\n const importer = yield* Effect.acquireRelease(Effect.try({\n try: () => startExternalRecordImport(source.recordPath, importDeadline),\n catch: (cause) => sourceError(cause),\n }), (handle) => Effect.promise(() => handle.close().catch(() => undefined)));\n const generation = yield* Effect.tryPromise({\n // Declaring the AbortSignal keeps this await interruptible. Scope then\n // terminates the Worker and removes its private generation.\n try: (_signal) => importer.result,\n catch: (cause) => sourceError(cause),\n });\n session = yield* Effect.acquireRelease(Effect.try({\n try: () => openHostOwnedRecordReadSession(generation.path),\n catch: (cause) => sourceError(cause),\n }), (opened) => Effect.sync(() => opened.close()));\n }\n return sessionFacts(session, source.kind);\n });\n}\n/** Opens one already-imported private generation without accepting a public path. */\nexport function openHostOwnedInspectionSource(recordPath: string): Effect.Effect<InspectionFactSource, InspectionSourceError | InspectionIntegrityError, Scope.Scope> {\n return Effect.gen(function* () {\n const session = yield* Effect.acquireRelease(Effect.try({\n try: () => openHostOwnedRecordReadSession(recordPath),\n catch: (cause) => sourceError(cause),\n }), (opened) => Effect.sync(() => opened.close()));\n return sessionFacts(session, \"external-record\");\n });\n}\nconst EMPTY_OPERATIONAL_CUTOFF = Object.freeze({\n identity: EMPTY_PUBLICATION_CUTOFF_IDENTITY,\n storeGeneration: EMPTY_PUBLICATION_CUTOFF_IDENTITY,\n revision: 0,\n});\nfunction emptyOperationalFacts(): InspectionFactSource {\n return Object.freeze({\n kind: \"project-record\" as const,\n cutoff: () => EMPTY_OPERATIONAL_CUTOFF,\n findExperimentRunIds: () => Object.freeze([]),\n readRunResource: () => undefined,\n readRunResourcePage: () => Object.freeze({\n cutoff: Object.freeze({ storeGeneration: EMPTY_PUBLICATION_CUTOFF_IDENTITY, revision: 0 }),\n runs: Object.freeze([]),\n nextAfterRunId: null,\n }),\n readSealedRunSummaryPage: (afterRunId = \"\", _pageSize = 100, expectedCutoffIdentity?: string) => {\n if (expectedCutoffIdentity !== undefined && expectedCutoffIdentity !== EMPTY_OPERATIONAL_CUTOFF.identity) {\n throw new InspectionSourceError({\n code: \"inspection-source-invalid\",\n reason: \"The empty operational publication cutoff changed; restart pagination.\",\n });\n }\n return Object.freeze({\n cutoff: Object.freeze({ identity: EMPTY_OPERATIONAL_CUTOFF.identity, runCount: 0 }),\n afterRunId,\n summaries: Object.freeze([]),\n nextAfterRunId: null,\n });\n },\n findAttemptLocatorCandidates: (locator: string) => Object.freeze({\n locator,\n ambiguous: false,\n candidates: Object.freeze([]),\n }),\n readSealedRunCore: () => undefined,\n readContentPage: (contentId: string, afterOrdinal: number) => Object.freeze({\n contentId,\n afterOrdinal,\n chunks: Object.freeze([]),\n nextOrdinal: null,\n }),\n readCollectionPage: (attachmentId: string, afterOrdinal: number) => Object.freeze({\n attachmentId,\n afterOrdinal,\n items: Object.freeze([]),\n nextOrdinal: null,\n }),\n });\n}\nfunction sessionFacts(session: PinnedRecordReadSession, kind: InspectionSource[\"kind\"]): InspectionFactSource {\n const publication = session.publicationCutoff();\n const cutoff = Object.freeze({ ...publication, identity: publicationCutoffIdentity(publication) });\n const readPage = (afterRunId = \"\", pageSize = 100, expectedCutoffIdentity?: string): SealedRunSummaryPage => session.readSealedRunSummaryPage(afterRunId, pageSize, expectedCutoffIdentity ?? cutoff.identity);\n return Object.freeze({\n kind,\n cutoff: () => cutoff,\n findExperimentRunIds: session.findExperimentRunIds,\n readRunResource: (runId: string) => session.readRunResource(runId),\n readRunResourcePage: (afterRunId = \"\", pageSize = 100) => session.listRunResources({ afterRunId, pageSize }),\n readSealedRunSummaryPage: readPage,\n findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => session.findAttemptLocatorCandidates(locator, maximumCandidateRuns),\n readSealedRunCore: (runId: string) => session.readSealedRunCore(runId, true),\n readContentPage: (contentId: string, afterOrdinal: number, pageSize: number) => session.readContentChunkPage(contentId, afterOrdinal, pageSize),\n readCollectionPage: (attachmentId: string, afterOrdinal: number, pageSize: number) => session.readCollectionItemPage(attachmentId, afterOrdinal, pageSize),\n });\n}\nfunction sourceError(cause: unknown): InspectionSourceError | InspectionIntegrityError {\n if (cause instanceof RecordIntegrityFailure) {\n return new InspectionIntegrityError({\n code: \"inspection-record-integrity-failure\",\n runId: cause.runId,\n });\n }\n return new InspectionSourceError({\n code: \"inspection-source-invalid\",\n reason: cause instanceof Error ? cause.message : \"Record source validation failed\",\n cause,\n });\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.projectAttemptSources = projectAttemptSources;
4
- // @concord-file ne-eval-inspection-sources
4
+ // @concord-file
5
5
  // @concord-implements docs/feature/inspection/README.md
6
6
  // @concord-implements docs/feature/inspection/architecture.md
7
7
  const effect_1 = require("effect");
@@ -14,7 +14,7 @@ const limits_ts_1 = require("./limits.cjs");
14
14
  const SOURCE_TEXT_BYTE_LIMIT = 256 * 1024;
15
15
  const SOURCE_RESULT_HEADROOM = 1024;
16
16
  const CONTENT_PAGE_SIZE = 64;
17
- // @concord-code ne-eval-inspection-project-sources
17
+ // @concord-code
18
18
  // @concord-implements docs/feature/inspection/architecture.md
19
19
  function projectAttemptSources(source, attachment, assertions) {
20
20
  const assertionsRead = readAssertionSites(assertions);
@@ -1 +1 @@
1
- {"version":3,"file":"sources.js","sourceRoot":"","sources":["sources.ts"],"names":[],"mappings":";;AAkDA,sDA+EC;AAjID,2CAA2C;AAC3C,wDAAwD;AACxD,8DAA8D;AAC9D,mCAAgC;AAChC,kEAAmF;AACnF,gEAAqG;AACrG,4DAA2G;AAE3G,yCAA8F;AAC9F,yCAA8D;AAE9D,2CAA2D;AAG3D,MAAM,sBAAsB,GAAG,GAAG,GAAG,IAAI,CAAC;AAC1C,MAAM,sBAAsB,GAAG,IAAI,CAAC;AACpC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAgC7B,mDAAmD;AACnD,8DAA8D;AAC9D,SAAgB,qBAAqB,CAAC,MAA4B,EAAE,UAA8C,EAAE,UAAoC;IACpJ,MAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACtD,IAAI,KAAK,GAAwB,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC;IACzF,IAAI,OAAO,GAA+B,EAAE,CAAC;IAC7C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC;YACD,OAAO,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,CAAC;YACH,KAAK,GAAG,SAAS,CAAC;QACtB,CAAC;IACL,CAAC;IACD,MAAM,KAAK,GAA+C,EAAE,CAAC;IAC7D,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,cAAc,CAAC,CAAC;IACpE,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAA+B,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C,OAAO,CAAC,KAAK,CAAC;QACvE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC;AACD,SAAS,SAAS,CAAC,KAAc;IAC7B,MAAM,MAAM,GAAG,IAAA,8BAAmB,EAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,IAAA,iCAAsB,EAAC,MAAM,CAAC;QAC9B,MAAM,MAAM,CAAC;IACjB,OAAO,MAAwB,CAAC;AACpC,CAAC;AACD,SAAS,cAAc,CAAC,KAAc;IAClC,OAAO,IAAA,yBAAc,EAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// @concord-file ne-eval-inspection-sources\n// @concord-implements docs/feature/inspection/README.md\n// @concord-implements docs/feature/inspection/architecture.md\nimport { Result } from \"effect\";\nimport { hydrateRecordAttachmentCurrent, } from \"../record/attachment/protocol.ts\";\nimport { mintRecordContentHandle, type RecordContentHandle, } from \"../record/attachment/content.ts\";\nimport { NiceEvalCurrentRecordAttachments, NiceEvalRecordAttachments, } from \"../record/family/current.ts\";\nimport type { PersistedContentMetadata, SealedAttachmentMetadata, } from \"../record/sqlite/index.ts\";\nimport { closeInspectionJson, isInspectionCodecError, type InspectionJson } from \"./codec.ts\";\nimport { InspectionSha256, utf8ByteLength } from \"./bytes.ts\";\nimport type { InspectionAssertionsRead } from \"./facts.ts\";\nimport { INSPECTION_RESULT_BYTE_LIMIT } from \"./limits.ts\";\nimport type { InspectionFactSource } from \"./source.ts\";\nimport type { InspectionSourcesResult } from \"./results.ts\";\nconst SOURCE_TEXT_BYTE_LIMIT = 256 * 1024;\nconst SOURCE_RESULT_HEADROOM = 1024;\nconst CONTENT_PAGE_SIZE = 64;\nexport interface SourcesAttachmentInput {\n readonly physical: SealedAttachmentMetadata;\n readonly value: InspectionJson;\n}\ninterface HydratedSourceItem {\n readonly sourceItemId: string;\n readonly path: string;\n readonly byteLength: number;\n readonly sha256: string;\n readonly content: RecordContentHandle;\n}\ninterface BoundSourceItem {\n readonly item: HydratedSourceItem;\n readonly content: PersistedContentMetadata;\n}\ntype AttachmentReadState = \"available\" | \"not-recorded\" | \"invalid\";\ninterface AvailableAssertions {\n readonly state: \"available\";\n readonly sourceSites: Extract<InspectionAssertionsRead, {\n readonly state: \"available\";\n }>[\"value\"][\"sourceSites\"];\n}\ninterface UnavailableAssertions {\n readonly state: \"not-recorded\" | \"invalid\";\n}\ntype AssertionsRead = AvailableAssertions | UnavailableAssertions;\ntype HydratedAssertionSourceSite = AvailableAssertions[\"sourceSites\"][number];\ninterface SourcePosition {\n readonly line: number;\n readonly column: number;\n}\n// @concord-code ne-eval-inspection-project-sources\n// @concord-implements docs/feature/inspection/architecture.md\nexport function projectAttemptSources(source: InspectionFactSource, attachment: SourcesAttachmentInput | undefined, assertions: InspectionAssertionsRead): InspectionSourcesResult {\n const assertionsRead = readAssertionSites(assertions);\n let state: AttachmentReadState = attachment === undefined ? \"not-recorded\" : \"available\";\n let decoded: readonly BoundSourceItem[] = [];\n if (attachment !== undefined) {\n try {\n decoded = hydrateSourceItems(attachment);\n }\n catch {\n state = \"invalid\";\n }\n }\n const items: InspectionSourcesResult[\"items\"][number][] = [];\n const requestedPositions = assertionSourcePositions(assertionsRead);\n const verifiedSourcePositions = new Map<string, ReadonlySet<string>>();\n let projectedBytes = jsonByteLength(Object.freeze({\n state,\n items: Object.freeze([]),\n hasMore: decoded.length > 0,\n omittedItemCount: decoded.length,\n }));\n let acceptProjectedItems = true;\n try {\n for (const entry of state === \"available\" ? decoded : []) {\n const omitted = projectedSourceItem(entry, omittedContent(entry.content.byteLength));\n const omittedBytes = jsonByteLength(omitted) + (items.length === 0 ? 0 : 1);\n const includeItem = acceptProjectedItems &&\n projectedBytes + omittedBytes <= INSPECTION_RESULT_BYTE_LIMIT - SOURCE_RESULT_HEADROOM;\n if (!includeItem)\n acceptProjectedItems = false;\n let projected = omitted;\n const positions = requestedPositions.get(entry.item.sourceItemId) ?? Object.freeze([]);\n const verified = positions.length > 0 || includeItem && entry.content.byteLength <= SOURCE_TEXT_BYTE_LIMIT\n ? readVerifiedSource(source, entry.content, positions)\n : undefined;\n if (verified !== undefined) {\n verifiedSourcePositions.set(entry.item.sourceItemId, verified.displayablePositions);\n }\n if (verified?.text !== undefined) {\n const available = projectedSourceItem(entry, Object.freeze({\n state: \"available\" as const,\n text: verified.text,\n }));\n const availableBytes = jsonByteLength(available) + (items.length === 0 ? 0 : 1);\n if (projectedBytes + availableBytes <= INSPECTION_RESULT_BYTE_LIMIT - SOURCE_RESULT_HEADROOM) {\n projected = available;\n }\n }\n if (!includeItem)\n continue;\n const itemBytes = jsonByteLength(projected) + (items.length === 0 ? 0 : 1);\n items.push(projected);\n projectedBytes += itemBytes;\n }\n }\n catch {\n state = \"invalid\";\n decoded = Object.freeze([]);\n items.splice(0, items.length);\n verifiedSourcePositions.clear();\n }\n const sourceItems = new Map(decoded.map((entry) => [entry.item.sourceItemId, entry] as const));\n const sites = assertionsRead.state === \"available\"\n ? assertionsRead.sourceSites.map((site) => projectAssertionSourceSite(site, state, sourceItems, verifiedSourcePositions))\n : [];\n let projectedSiteCount = sites.length;\n let result = sourceResult(state, items, decoded.length, assertionResult(assertionsRead, sites, projectedSiteCount));\n while (jsonByteLength(result) > INSPECTION_RESULT_BYTE_LIMIT && items.length > 0) {\n items.pop();\n result = sourceResult(state, items, decoded.length, assertionResult(assertionsRead, sites, projectedSiteCount));\n }\n while (jsonByteLength(result) > INSPECTION_RESULT_BYTE_LIMIT && projectedSiteCount > 0) {\n projectedSiteCount -= 1;\n result = sourceResult(state, items, decoded.length, assertionResult(assertionsRead, sites, projectedSiteCount));\n }\n if (jsonByteLength(result) > INSPECTION_RESULT_BYTE_LIMIT) {\n throw new Error(\"Sources projection cannot fit its fixed result byte limit\");\n }\n return result;\n}\nfunction assertionSourcePositions(assertions: AssertionsRead): ReadonlyMap<string, readonly SourcePosition[]> {\n const output = new Map<string, SourcePosition[]>();\n if (assertions.state !== \"available\")\n return output;\n for (const site of assertions.sourceSites) {\n const sourceItemId = site.source.value.sourceItemId;\n const positions = output.get(sourceItemId) ?? [];\n positions.push(site.start, site.end);\n output.set(sourceItemId, positions);\n }\n return new Map([...output].map(([sourceItemId, positions]) => [\n sourceItemId,\n Object.freeze(positions),\n ] as const));\n}\nfunction readAssertionSites(input: InspectionAssertionsRead): AssertionsRead {\n if (input.state === \"available\") {\n return Object.freeze({\n state: \"available\" as const,\n sourceSites: input.value.sourceSites,\n });\n }\n return Object.freeze({\n state: input.state === \"not-recorded\" ? \"not-recorded\" as const : \"invalid\" as const,\n });\n}\nfunction projectAssertionSourceSite(site: HydratedAssertionSourceSite, sourceState: AttachmentReadState, sourceItems: ReadonlyMap<string, BoundSourceItem>, verifiedSourcePositions: ReadonlyMap<string, ReadonlySet<string>>): Extract<InspectionSourcesResult[\"assertions\"], {\n readonly state: \"available\";\n}>[\"sourceSites\"][number] {\n const anchor = site.source.value;\n const item = sourceState === \"available\" ? sourceItems.get(anchor.sourceItemId) : undefined;\n const source = item === undefined || item.item.sha256 !== anchor.sha256\n ? unmappedSource(\"source-snapshot-not-recorded\")\n : !positionsAreDisplayable(verifiedSourcePositions.get(anchor.sourceItemId), site.start, site.end)\n ? unmappedSource(\"position-unrepresentable\")\n : Object.freeze({\n state: \"mapped\" as const,\n sourceItemId: anchor.sourceItemId,\n sha256: anchor.sha256,\n });\n return Object.freeze({\n entryId: site.entryId,\n sourceOrder: site.sourceOrder,\n role: site.role,\n start: Object.freeze({ line: site.start.line, column: site.start.column }),\n end: Object.freeze({ line: site.end.line, column: site.end.column }),\n source,\n });\n}\nfunction assertionResult(assertions: AssertionsRead, sites: readonly Extract<InspectionSourcesResult[\"assertions\"], {\n readonly state: \"available\";\n}>[\"sourceSites\"][number][], projectedSiteCount: number): InspectionSourcesResult[\"assertions\"] {\n if (assertions.state !== \"available\") {\n return Object.freeze({\n state: assertions.state,\n sourceSites: Object.freeze([] as const),\n hasMoreSourceSites: false as const,\n omittedSourceSiteCount: 0 as const,\n });\n }\n return Object.freeze({\n state: \"available\" as const,\n sourceSites: Object.freeze(sites.slice(0, projectedSiteCount)),\n hasMoreSourceSites: projectedSiteCount < sites.length,\n omittedSourceSiteCount: sites.length - projectedSiteCount,\n });\n}\nfunction unmappedSource(reason: \"source-snapshot-not-recorded\" | \"position-unrepresentable\"): Extract<Extract<InspectionSourcesResult[\"assertions\"], {\n readonly state: \"available\";\n}>[\"sourceSites\"][number][\"source\"], {\n readonly state: \"unmapped\";\n}> {\n return Object.freeze({ state: \"unmapped\" as const, reason });\n}\nfunction positionsAreDisplayable(positions: ReadonlySet<string> | undefined, start: SourcePosition, end: SourcePosition): boolean {\n return positions?.has(positionKey(start)) === true && positions.has(positionKey(end));\n}\nfunction positionKey(position: SourcePosition): string {\n return `${position.line}:${position.column}`;\n}\nfunction hydrateSourceItems(attachment: SourcesAttachmentInput): readonly BoundSourceItem[] {\n if (attachment.physical.ownerKind !== \"run\" ||\n attachment.physical.family !== NiceEvalRecordAttachments.sources.family ||\n attachment.physical.familyRevision !== NiceEvalCurrentRecordAttachments.sources.revision) {\n throw new Error(\"Sources Attachment requires migration before Inspection\");\n }\n const byLogicalHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content] as const));\n const byHydratedHandle = new WeakMap<object, PersistedContentMetadata>();\n const usedLogicalHandles = new Set<string>();\n const hydrated = hydrateRecordAttachmentCurrent(NiceEvalRecordAttachments.sources, attachment.value, {\n content: (token, declaration) => {\n const logicalHandle = exactMarker(token, \"$niceeval.record.content\");\n if (logicalHandle === undefined && !hasOwnMarker(token, \"$niceeval.record.content\")) {\n return Result.succeed(undefined);\n }\n const metadata = typeof logicalHandle === \"string\"\n ? byLogicalHandle.get(logicalHandle)\n : undefined;\n if (metadata === undefined || declaration.kind !== \"text\" ||\n declaration.maximumBytes !== undefined && metadata.byteLength > declaration.maximumBytes ||\n usedLogicalHandles.has(logicalHandle as string)) {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n const handle = mintRecordContentHandle(\"text\");\n byHydratedHandle.set(handle, metadata);\n usedLogicalHandles.add(logicalHandle as string);\n return Result.succeed(handle);\n },\n reference: () => Result.succeed(undefined),\n });\n if (Result.isFailure(hydrated) || usedLogicalHandles.size !== attachment.physical.contents.length) {\n throw new Error(\"Sources Attachment content closure is invalid\");\n }\n const output: BoundSourceItem[] = [];\n for (const item of hydrated.success.items as readonly HydratedSourceItem[]) {\n const metadata = byHydratedHandle.get(item.content);\n if (metadata === undefined || metadata.byteLength !== item.byteLength || metadata.digest !== item.sha256) {\n throw new Error(\"Sources Attachment item does not match its sealed Content metadata\");\n }\n output.push(Object.freeze({ item, content: metadata }));\n }\n return Object.freeze(output);\n}\nfunction readVerifiedSource(source: InspectionFactSource, metadata: PersistedContentMetadata, positions: readonly SourcePosition[]): {\n readonly text?: string;\n readonly displayablePositions: ReadonlySet<string>;\n} {\n const digest = new InspectionSha256();\n const decoder = new TextDecoder(\"utf-8\", { fatal: true });\n const retainText = metadata.byteLength <= SOURCE_TEXT_BYTE_LIMIT;\n const text: string[] = [];\n const positionsByLine = new Map<number, Set<number>>();\n for (const position of positions) {\n const columns = positionsByLine.get(position.line) ?? new Set<number>();\n columns.add(position.column - 1);\n positionsByLine.set(position.line, columns);\n }\n const displayablePositions = new Set<string>();\n let offset = 0;\n let afterOrdinal = -1;\n let expectedOrdinal = 0;\n let observedChunks = 0;\n let line = 1;\n let column = 0;\n const markPosition = (byte: number | undefined): void => {\n const columns = positionsByLine.get(line);\n if (columns?.has(column) !== true)\n return;\n if (byte === undefined || byte === 0x0a || (byte & 192) !== 128) {\n displayablePositions.add(`${line}:${column + 1}`);\n }\n };\n while (true) {\n const page = source.readContentPage(metadata.contentId, afterOrdinal, CONTENT_PAGE_SIZE);\n if (page.contentId !== metadata.contentId || page.afterOrdinal !== afterOrdinal ||\n page.chunks.length === 0 && page.nextOrdinal !== null) {\n throw new Error(\"Sources Content page is invalid\");\n }\n for (const chunk of page.chunks) {\n if (chunk.ordinal !== expectedOrdinal || offset + chunk.bytes.byteLength > metadata.byteLength) {\n throw new Error(\"Sources Content chunk sequence is invalid\");\n }\n digest.update(chunk.bytes);\n const decoded = decoder.decode(chunk.bytes, { stream: true });\n if (retainText)\n text.push(decoded);\n for (const byte of chunk.bytes) {\n markPosition(byte);\n if (byte === 0x0a) {\n line += 1;\n column = 0;\n }\n else {\n column += 1;\n }\n }\n offset += chunk.bytes.byteLength;\n expectedOrdinal += 1;\n observedChunks += 1;\n }\n if (page.nextOrdinal === null)\n break;\n if (page.nextOrdinal !== expectedOrdinal - 1 || observedChunks > metadata.chunkCount) {\n throw new Error(\"Sources Content continuation is invalid\");\n }\n afterOrdinal = page.nextOrdinal;\n }\n const finalText = decoder.decode();\n if (retainText)\n text.push(finalText);\n markPosition(undefined);\n if (offset !== metadata.byteLength || observedChunks !== metadata.chunkCount ||\n digest.digestHex() !== metadata.digest) {\n throw new Error(\"Sources Content does not match its sealed metadata\");\n }\n return Object.freeze({\n ...(retainText ? { text: text.join(\"\") } : {}),\n displayablePositions,\n });\n}\nfunction projectedSourceItem(entry: BoundSourceItem, content: InspectionSourcesResult[\"items\"][number][\"content\"]): InspectionSourcesResult[\"items\"][number] {\n return Object.freeze({\n sourceItemId: entry.item.sourceItemId,\n path: entry.item.path,\n byteLength: entry.item.byteLength,\n sha256: entry.item.sha256,\n content,\n });\n}\nfunction omittedContent(byteLength: number): InspectionSourcesResult[\"items\"][number][\"content\"] {\n return Object.freeze({\n state: \"omitted\" as const,\n reason: \"inspection-result-byte-limit\" as const,\n byteLength,\n byteLimit: SOURCE_TEXT_BYTE_LIMIT,\n });\n}\nfunction sourceResult(state: AttachmentReadState, items: readonly InspectionSourcesResult[\"items\"][number][], total: number, assertions: InspectionSourcesResult[\"assertions\"]): InspectionSourcesResult {\n return Object.freeze({\n state,\n items: Object.freeze([...items]),\n hasMore: items.length < total,\n omittedItemCount: total - items.length,\n assertions,\n });\n}\nfunction exactMarker(value: unknown, key: string): unknown | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value))\n return undefined;\n const keys = Reflect.ownKeys(value);\n if (keys.length !== 1 || keys[0] !== key)\n return undefined;\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n return descriptor !== undefined && descriptor.enumerable && \"value\" in descriptor\n ? descriptor.value\n : undefined;\n}\nfunction hasOwnMarker(value: unknown, key: string): boolean {\n return typeof value === \"object\" && value !== null && !Array.isArray(value) &&\n Object.prototype.hasOwnProperty.call(value, key);\n}\nfunction closeJson(value: unknown): InspectionJson {\n const closed = closeInspectionJson(value);\n if (isInspectionCodecError(closed))\n throw closed;\n return closed as InspectionJson;\n}\nfunction jsonByteLength(value: unknown): number {\n return utf8ByteLength(JSON.stringify(value));\n}\n"]}
1
+ {"version":3,"file":"sources.js","sourceRoot":"","sources":["sources.ts"],"names":[],"mappings":";;AAkDA,sDA+EC;AAjID,gBAAgB;AAChB,wDAAwD;AACxD,8DAA8D;AAC9D,mCAAgC;AAChC,kEAAmF;AACnF,gEAAqG;AACrG,4DAA2G;AAE3G,yCAA8F;AAC9F,yCAA8D;AAE9D,2CAA2D;AAG3D,MAAM,sBAAsB,GAAG,GAAG,GAAG,IAAI,CAAC;AAC1C,MAAM,sBAAsB,GAAG,IAAI,CAAC;AACpC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAgC7B,gBAAgB;AAChB,8DAA8D;AAC9D,SAAgB,qBAAqB,CAAC,MAA4B,EAAE,UAA8C,EAAE,UAAoC;IACpJ,MAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACtD,IAAI,KAAK,GAAwB,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC;IACzF,IAAI,OAAO,GAA+B,EAAE,CAAC;IAC7C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC;YACD,OAAO,GAAG,kBAAkB,CAA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AU,CAAC,UAAU,IAAI,OAAO,IAAI,UAAU;QAC7E,CAAC,CAAC,UAAU,CAAC,KAAK;QAClB,CAAC,CAAC,SAAS,CAAC;AACpB,CAAC;AACD,SAAS,YAAY,CAAC,KAAc,EAAE,GAAW;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACvE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC;AACD,SAAS,SAAS,CAAC,KAAc;IAC7B,MAAM,MAAM,GAAG,IAAA,8BAAmB,EAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,IAAA,iCAAsB,EAAC,MAAM,CAAC;QAC9B,MAAM,MAAM,CAAC;IACjB,OAAO,MAAwB,CAAC;AACpC,CAAC;AACD,SAAS,cAAc,CAAC,KAAc;IAClC,OAAO,IAAA,yBAAc,EAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// @concord-file\n// @concord-implements docs/feature/inspection/README.md\n// @concord-implements docs/feature/inspection/architecture.md\nimport { Result } from \"effect\";\nimport { hydrateRecordAttachmentCurrent, } from \"../record/attachment/protocol.ts\";\nimport { mintRecordContentHandle, type RecordContentHandle, } from \"../record/attachment/content.ts\";\nimport { NiceEvalCurrentRecordAttachments, NiceEvalRecordAttachments, } from \"../record/family/current.ts\";\nimport type { PersistedContentMetadata, SealedAttachmentMetadata, } from \"../record/sqlite/index.ts\";\nimport { closeInspectionJson, isInspectionCodecError, type InspectionJson } from \"./codec.ts\";\nimport { InspectionSha256, utf8ByteLength } from \"./bytes.ts\";\nimport type { InspectionAssertionsRead } from \"./facts.ts\";\nimport { INSPECTION_RESULT_BYTE_LIMIT } from \"./limits.ts\";\nimport type { InspectionFactSource } from \"./source.ts\";\nimport type { InspectionSourcesResult } from \"./results.ts\";\nconst SOURCE_TEXT_BYTE_LIMIT = 256 * 1024;\nconst SOURCE_RESULT_HEADROOM = 1024;\nconst CONTENT_PAGE_SIZE = 64;\nexport interface SourcesAttachmentInput {\n readonly physical: SealedAttachmentMetadata;\n readonly value: InspectionJson;\n}\ninterface HydratedSourceItem {\n readonly sourceItemId: string;\n readonly path: string;\n readonly byteLength: number;\n readonly sha256: string;\n readonly content: RecordContentHandle;\n}\ninterface BoundSourceItem {\n readonly item: HydratedSourceItem;\n readonly content: PersistedContentMetadata;\n}\ntype AttachmentReadState = \"available\" | \"not-recorded\" | \"invalid\";\ninterface AvailableAssertions {\n readonly state: \"available\";\n readonly sourceSites: Extract<InspectionAssertionsRead, {\n readonly state: \"available\";\n }>[\"value\"][\"sourceSites\"];\n}\ninterface UnavailableAssertions {\n readonly state: \"not-recorded\" | \"invalid\";\n}\ntype AssertionsRead = AvailableAssertions | UnavailableAssertions;\ntype HydratedAssertionSourceSite = AvailableAssertions[\"sourceSites\"][number];\ninterface SourcePosition {\n readonly line: number;\n readonly column: number;\n}\n// @concord-code\n// @concord-implements docs/feature/inspection/architecture.md\nexport function projectAttemptSources(source: InspectionFactSource, attachment: SourcesAttachmentInput | undefined, assertions: InspectionAssertionsRead): InspectionSourcesResult {\n const assertionsRead = readAssertionSites(assertions);\n let state: AttachmentReadState = attachment === undefined ? \"not-recorded\" : \"available\";\n let decoded: readonly BoundSourceItem[] = [];\n if (attachment !== undefined) {\n try {\n decoded = hydrateSourceItems(attachment);\n }\n catch {\n state = \"invalid\";\n }\n }\n const items: InspectionSourcesResult[\"items\"][number][] = [];\n const requestedPositions = assertionSourcePositions(assertionsRead);\n const verifiedSourcePositions = new Map<string, ReadonlySet<string>>();\n let projectedBytes = jsonByteLength(Object.freeze({\n state,\n items: Object.freeze([]),\n hasMore: decoded.length > 0,\n omittedItemCount: decoded.length,\n }));\n let acceptProjectedItems = true;\n try {\n for (const entry of state === \"available\" ? decoded : []) {\n const omitted = projectedSourceItem(entry, omittedContent(entry.content.byteLength));\n const omittedBytes = jsonByteLength(omitted) + (items.length === 0 ? 0 : 1);\n const includeItem = acceptProjectedItems &&\n projectedBytes + omittedBytes <= INSPECTION_RESULT_BYTE_LIMIT - SOURCE_RESULT_HEADROOM;\n if (!includeItem)\n acceptProjectedItems = false;\n let projected = omitted;\n const positions = requestedPositions.get(entry.item.sourceItemId) ?? Object.freeze([]);\n const verified = positions.length > 0 || includeItem && entry.content.byteLength <= SOURCE_TEXT_BYTE_LIMIT\n ? readVerifiedSource(source, entry.content, positions)\n : undefined;\n if (verified !== undefined) {\n verifiedSourcePositions.set(entry.item.sourceItemId, verified.displayablePositions);\n }\n if (verified?.text !== undefined) {\n const available = projectedSourceItem(entry, Object.freeze({\n state: \"available\" as const,\n text: verified.text,\n }));\n const availableBytes = jsonByteLength(available) + (items.length === 0 ? 0 : 1);\n if (projectedBytes + availableBytes <= INSPECTION_RESULT_BYTE_LIMIT - SOURCE_RESULT_HEADROOM) {\n projected = available;\n }\n }\n if (!includeItem)\n continue;\n const itemBytes = jsonByteLength(projected) + (items.length === 0 ? 0 : 1);\n items.push(projected);\n projectedBytes += itemBytes;\n }\n }\n catch {\n state = \"invalid\";\n decoded = Object.freeze([]);\n items.splice(0, items.length);\n verifiedSourcePositions.clear();\n }\n const sourceItems = new Map(decoded.map((entry) => [entry.item.sourceItemId, entry] as const));\n const sites = assertionsRead.state === \"available\"\n ? assertionsRead.sourceSites.map((site) => projectAssertionSourceSite(site, state, sourceItems, verifiedSourcePositions))\n : [];\n let projectedSiteCount = sites.length;\n let result = sourceResult(state, items, decoded.length, assertionResult(assertionsRead, sites, projectedSiteCount));\n while (jsonByteLength(result) > INSPECTION_RESULT_BYTE_LIMIT && items.length > 0) {\n items.pop();\n result = sourceResult(state, items, decoded.length, assertionResult(assertionsRead, sites, projectedSiteCount));\n }\n while (jsonByteLength(result) > INSPECTION_RESULT_BYTE_LIMIT && projectedSiteCount > 0) {\n projectedSiteCount -= 1;\n result = sourceResult(state, items, decoded.length, assertionResult(assertionsRead, sites, projectedSiteCount));\n }\n if (jsonByteLength(result) > INSPECTION_RESULT_BYTE_LIMIT) {\n throw new Error(\"Sources projection cannot fit its fixed result byte limit\");\n }\n return result;\n}\nfunction assertionSourcePositions(assertions: AssertionsRead): ReadonlyMap<string, readonly SourcePosition[]> {\n const output = new Map<string, SourcePosition[]>();\n if (assertions.state !== \"available\")\n return output;\n for (const site of assertions.sourceSites) {\n const sourceItemId = site.source.value.sourceItemId;\n const positions = output.get(sourceItemId) ?? [];\n positions.push(site.start, site.end);\n output.set(sourceItemId, positions);\n }\n return new Map([...output].map(([sourceItemId, positions]) => [\n sourceItemId,\n Object.freeze(positions),\n ] as const));\n}\nfunction readAssertionSites(input: InspectionAssertionsRead): AssertionsRead {\n if (input.state === \"available\") {\n return Object.freeze({\n state: \"available\" as const,\n sourceSites: input.value.sourceSites,\n });\n }\n return Object.freeze({\n state: input.state === \"not-recorded\" ? \"not-recorded\" as const : \"invalid\" as const,\n });\n}\nfunction projectAssertionSourceSite(site: HydratedAssertionSourceSite, sourceState: AttachmentReadState, sourceItems: ReadonlyMap<string, BoundSourceItem>, verifiedSourcePositions: ReadonlyMap<string, ReadonlySet<string>>): Extract<InspectionSourcesResult[\"assertions\"], {\n readonly state: \"available\";\n}>[\"sourceSites\"][number] {\n const anchor = site.source.value;\n const item = sourceState === \"available\" ? sourceItems.get(anchor.sourceItemId) : undefined;\n const source = item === undefined || item.item.sha256 !== anchor.sha256\n ? unmappedSource(\"source-snapshot-not-recorded\")\n : !positionsAreDisplayable(verifiedSourcePositions.get(anchor.sourceItemId), site.start, site.end)\n ? unmappedSource(\"position-unrepresentable\")\n : Object.freeze({\n state: \"mapped\" as const,\n sourceItemId: anchor.sourceItemId,\n sha256: anchor.sha256,\n });\n return Object.freeze({\n entryId: site.entryId,\n sourceOrder: site.sourceOrder,\n role: site.role,\n start: Object.freeze({ line: site.start.line, column: site.start.column }),\n end: Object.freeze({ line: site.end.line, column: site.end.column }),\n source,\n });\n}\nfunction assertionResult(assertions: AssertionsRead, sites: readonly Extract<InspectionSourcesResult[\"assertions\"], {\n readonly state: \"available\";\n}>[\"sourceSites\"][number][], projectedSiteCount: number): InspectionSourcesResult[\"assertions\"] {\n if (assertions.state !== \"available\") {\n return Object.freeze({\n state: assertions.state,\n sourceSites: Object.freeze([] as const),\n hasMoreSourceSites: false as const,\n omittedSourceSiteCount: 0 as const,\n });\n }\n return Object.freeze({\n state: \"available\" as const,\n sourceSites: Object.freeze(sites.slice(0, projectedSiteCount)),\n hasMoreSourceSites: projectedSiteCount < sites.length,\n omittedSourceSiteCount: sites.length - projectedSiteCount,\n });\n}\nfunction unmappedSource(reason: \"source-snapshot-not-recorded\" | \"position-unrepresentable\"): Extract<Extract<InspectionSourcesResult[\"assertions\"], {\n readonly state: \"available\";\n}>[\"sourceSites\"][number][\"source\"], {\n readonly state: \"unmapped\";\n}> {\n return Object.freeze({ state: \"unmapped\" as const, reason });\n}\nfunction positionsAreDisplayable(positions: ReadonlySet<string> | undefined, start: SourcePosition, end: SourcePosition): boolean {\n return positions?.has(positionKey(start)) === true && positions.has(positionKey(end));\n}\nfunction positionKey(position: SourcePosition): string {\n return `${position.line}:${position.column}`;\n}\nfunction hydrateSourceItems(attachment: SourcesAttachmentInput): readonly BoundSourceItem[] {\n if (attachment.physical.ownerKind !== \"run\" ||\n attachment.physical.family !== NiceEvalRecordAttachments.sources.family ||\n attachment.physical.familyRevision !== NiceEvalCurrentRecordAttachments.sources.revision) {\n throw new Error(\"Sources Attachment requires migration before Inspection\");\n }\n const byLogicalHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content] as const));\n const byHydratedHandle = new WeakMap<object, PersistedContentMetadata>();\n const usedLogicalHandles = new Set<string>();\n const hydrated = hydrateRecordAttachmentCurrent(NiceEvalRecordAttachments.sources, attachment.value, {\n content: (token, declaration) => {\n const logicalHandle = exactMarker(token, \"$niceeval.record.content\");\n if (logicalHandle === undefined && !hasOwnMarker(token, \"$niceeval.record.content\")) {\n return Result.succeed(undefined);\n }\n const metadata = typeof logicalHandle === \"string\"\n ? byLogicalHandle.get(logicalHandle)\n : undefined;\n if (metadata === undefined || declaration.kind !== \"text\" ||\n declaration.maximumBytes !== undefined && metadata.byteLength > declaration.maximumBytes ||\n usedLogicalHandles.has(logicalHandle as string)) {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n const handle = mintRecordContentHandle(\"text\");\n byHydratedHandle.set(handle, metadata);\n usedLogicalHandles.add(logicalHandle as string);\n return Result.succeed(handle);\n },\n reference: () => Result.succeed(undefined),\n });\n if (Result.isFailure(hydrated) || usedLogicalHandles.size !== attachment.physical.contents.length) {\n throw new Error(\"Sources Attachment content closure is invalid\");\n }\n const output: BoundSourceItem[] = [];\n for (const item of hydrated.success.items as readonly HydratedSourceItem[]) {\n const metadata = byHydratedHandle.get(item.content);\n if (metadata === undefined || metadata.byteLength !== item.byteLength || metadata.digest !== item.sha256) {\n throw new Error(\"Sources Attachment item does not match its sealed Content metadata\");\n }\n output.push(Object.freeze({ item, content: metadata }));\n }\n return Object.freeze(output);\n}\nfunction readVerifiedSource(source: InspectionFactSource, metadata: PersistedContentMetadata, positions: readonly SourcePosition[]): {\n readonly text?: string;\n readonly displayablePositions: ReadonlySet<string>;\n} {\n const digest = new InspectionSha256();\n const decoder = new TextDecoder(\"utf-8\", { fatal: true });\n const retainText = metadata.byteLength <= SOURCE_TEXT_BYTE_LIMIT;\n const text: string[] = [];\n const positionsByLine = new Map<number, Set<number>>();\n for (const position of positions) {\n const columns = positionsByLine.get(position.line) ?? new Set<number>();\n columns.add(position.column - 1);\n positionsByLine.set(position.line, columns);\n }\n const displayablePositions = new Set<string>();\n let offset = 0;\n let afterOrdinal = -1;\n let expectedOrdinal = 0;\n let observedChunks = 0;\n let line = 1;\n let column = 0;\n const markPosition = (byte: number | undefined): void => {\n const columns = positionsByLine.get(line);\n if (columns?.has(column) !== true)\n return;\n if (byte === undefined || byte === 0x0a || (byte & 192) !== 128) {\n displayablePositions.add(`${line}:${column + 1}`);\n }\n };\n while (true) {\n const page = source.readContentPage(metadata.contentId, afterOrdinal, CONTENT_PAGE_SIZE);\n if (page.contentId !== metadata.contentId || page.afterOrdinal !== afterOrdinal ||\n page.chunks.length === 0 && page.nextOrdinal !== null) {\n throw new Error(\"Sources Content page is invalid\");\n }\n for (const chunk of page.chunks) {\n if (chunk.ordinal !== expectedOrdinal || offset + chunk.bytes.byteLength > metadata.byteLength) {\n throw new Error(\"Sources Content chunk sequence is invalid\");\n }\n digest.update(chunk.bytes);\n const decoded = decoder.decode(chunk.bytes, { stream: true });\n if (retainText)\n text.push(decoded);\n for (const byte of chunk.bytes) {\n markPosition(byte);\n if (byte === 0x0a) {\n line += 1;\n column = 0;\n }\n else {\n column += 1;\n }\n }\n offset += chunk.bytes.byteLength;\n expectedOrdinal += 1;\n observedChunks += 1;\n }\n if (page.nextOrdinal === null)\n break;\n if (page.nextOrdinal !== expectedOrdinal - 1 || observedChunks > metadata.chunkCount) {\n throw new Error(\"Sources Content continuation is invalid\");\n }\n afterOrdinal = page.nextOrdinal;\n }\n const finalText = decoder.decode();\n if (retainText)\n text.push(finalText);\n markPosition(undefined);\n if (offset !== metadata.byteLength || observedChunks !== metadata.chunkCount ||\n digest.digestHex() !== metadata.digest) {\n throw new Error(\"Sources Content does not match its sealed metadata\");\n }\n return Object.freeze({\n ...(retainText ? { text: text.join(\"\") } : {}),\n displayablePositions,\n });\n}\nfunction projectedSourceItem(entry: BoundSourceItem, content: InspectionSourcesResult[\"items\"][number][\"content\"]): InspectionSourcesResult[\"items\"][number] {\n return Object.freeze({\n sourceItemId: entry.item.sourceItemId,\n path: entry.item.path,\n byteLength: entry.item.byteLength,\n sha256: entry.item.sha256,\n content,\n });\n}\nfunction omittedContent(byteLength: number): InspectionSourcesResult[\"items\"][number][\"content\"] {\n return Object.freeze({\n state: \"omitted\" as const,\n reason: \"inspection-result-byte-limit\" as const,\n byteLength,\n byteLimit: SOURCE_TEXT_BYTE_LIMIT,\n });\n}\nfunction sourceResult(state: AttachmentReadState, items: readonly InspectionSourcesResult[\"items\"][number][], total: number, assertions: InspectionSourcesResult[\"assertions\"]): InspectionSourcesResult {\n return Object.freeze({\n state,\n items: Object.freeze([...items]),\n hasMore: items.length < total,\n omittedItemCount: total - items.length,\n assertions,\n });\n}\nfunction exactMarker(value: unknown, key: string): unknown | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value))\n return undefined;\n const keys = Reflect.ownKeys(value);\n if (keys.length !== 1 || keys[0] !== key)\n return undefined;\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n return descriptor !== undefined && descriptor.enumerable && \"value\" in descriptor\n ? descriptor.value\n : undefined;\n}\nfunction hasOwnMarker(value: unknown, key: string): boolean {\n return typeof value === \"object\" && value !== null && !Array.isArray(value) &&\n Object.prototype.hasOwnProperty.call(value, key);\n}\nfunction closeJson(value: unknown): InspectionJson {\n const closed = closeInspectionJson(value);\n if (isInspectionCodecError(closed))\n throw closed;\n return closed as InspectionJson;\n}\nfunction jsonByteLength(value: unknown): number {\n return utf8ByteLength(JSON.stringify(value));\n}\n"]}
@@ -8,9 +8,10 @@ exports.projectAdapterUsageTokens = projectAdapterUsageTokens;
8
8
  exports.unavailableInspectionUsageTotals = unavailableInspectionUsageTotals;
9
9
  exports.combineInspectionUsageTotals = combineInspectionUsageTotals;
10
10
  exports.projectAttemptTiming = projectAttemptTiming;
11
- // @concord-file ne-eval-inspection-trace
11
+ // @concord-file
12
12
  // @concord-implements docs/feature/inspection/README.md
13
13
  // @concord-implements docs/feature/insight/README.md
14
+ const lifecycle_ts_1 = require("./lifecycle.cjs");
14
15
  const adapter_usage_projection_ts_1 = require("../o11y/adapter-usage-projection.cjs");
15
16
  const judge_usage_projection_ts_1 = require("../o11y/judge-usage-projection.cjs");
16
17
  const effect_1 = require("effect");
@@ -41,7 +42,7 @@ const MAX_COMMAND_ARGUMENT_BYTES = 128;
41
42
  const MAX_COMMAND_STREAM_TEXT_BYTES = 1024;
42
43
  const MAX_DIAGNOSTIC_SUMMARY_BYTES = 256;
43
44
  const MAX_DIAGNOSTIC_CAUSE_BYTES = 128;
44
- // @concord-code ne-eval-inspection-project-trace
45
+ // @concord-code
45
46
  // @concord-implements docs/feature/inspection/README.md
46
47
  // @concord-implements docs/feature/insight/README.md
47
48
  function projectAttemptTrace(source, attachments, execution, executionFilters = {}) {
@@ -90,7 +91,7 @@ function projectAttemptTrace(source, attachments, execution, executionFilters =
90
91
  const commandItems = sandboxCommands.state === "available"
91
92
  ? sandboxCommands.value.segments.slice(0, MAX_COMMANDS).map((command) => Object.freeze({
92
93
  commandId: command.commandId,
93
- phase: command.phase,
94
+ phase: (0, lifecycle_ts_1.projectLifecyclePhase)(command.phase),
94
95
  outcome: command.outcome,
95
96
  }))
96
97
  : [];
@@ -597,7 +598,7 @@ function projectTraceCommandDetail(source, commands, commandId) {
597
598
  workingDirectory: command.workingDirectory,
598
599
  outcome: command.outcome,
599
600
  turnId: command.turnId,
600
- phase: command.phase,
601
+ phase: (0, lifecycle_ts_1.projectLifecyclePhase)(command.phase),
601
602
  sequence: command.sequence,
602
603
  stdout: stream(command.stdout),
603
604
  stderr: stream(command.stderr),
@@ -1431,7 +1432,7 @@ function projectCommands(source, commands) {
1431
1432
  commandId: command.commandId,
1432
1433
  sequence: command.sequence,
1433
1434
  turnId: command.turnId,
1434
- phase: command.phase,
1435
+ phase: (0, lifecycle_ts_1.projectLifecyclePhase)(command.phase),
1435
1436
  invocation: projectInvocation(command.invocation),
1436
1437
  workingDirectory: command.workingDirectory,
1437
1438
  outcome: command.outcome,
@@ -1527,8 +1528,8 @@ function projectTiming(activities) {
1527
1528
  sequence: activity.sequence,
1528
1529
  parentActivityId: activity.parentActivityId,
1529
1530
  turnId: activity.turnId,
1530
- phase: activity.phase,
1531
- label: activity.label,
1531
+ phase: (0, lifecycle_ts_1.projectLifecyclePhase)(activity.phase),
1532
+ label: (0, lifecycle_ts_1.projectLifecyclePhase)(activity.label),
1532
1533
  startOffsetMs: activity.startOffsetMs,
1533
1534
  durationMs: activity.durationMs,
1534
1535
  outcome: activity.outcome,
@@ -1575,7 +1576,7 @@ function projectDiagnostics(diagnostics) {
1575
1576
  diagnosticId: diagnostic.diagnosticId,
1576
1577
  sequence: diagnostic.sequence,
1577
1578
  turnId: diagnostic.turnId,
1578
- phase: diagnostic.phase,
1579
+ phase: (0, lifecycle_ts_1.projectLifecyclePhase)(diagnostic.phase),
1579
1580
  kind: diagnostic.kind,
1580
1581
  code: diagnostic.code,
1581
1582
  summary: summary.value,