niceeval 0.13.2 → 0.13.3

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 (494) hide show
  1. package/dist/agents/bub.cjs +4 -4
  2. package/dist/agents/bub.cjs.map +1 -1
  3. package/dist/agents/bub.d.cts +2 -2
  4. package/dist/agents/bub.d.mts +2 -2
  5. package/dist/agents/bub.d.ts +2 -2
  6. package/dist/agents/claude-code-native.cjs +213 -0
  7. package/dist/agents/claude-code-native.cjs.map +1 -0
  8. package/dist/agents/claude-code-native.d.cts +5 -0
  9. package/dist/agents/claude-code-native.d.mts +5 -0
  10. package/dist/agents/claude-code-native.d.ts +5 -0
  11. package/dist/agents/claude-code-native.js +6 -0
  12. package/dist/agents/claude-code-native.js.map +1 -0
  13. package/dist/agents/claude-code.cjs +26 -80
  14. package/dist/agents/claude-code.cjs.map +1 -1
  15. package/dist/agents/codex-app-server.cjs +314 -0
  16. package/dist/agents/codex-app-server.cjs.map +1 -0
  17. package/dist/agents/codex-app-server.d.cts +9 -0
  18. package/dist/agents/codex-app-server.d.mts +9 -0
  19. package/dist/agents/codex-app-server.d.ts +9 -0
  20. package/dist/agents/codex-app-server.js +6 -0
  21. package/dist/agents/codex-app-server.js.map +1 -0
  22. package/dist/agents/codex.cjs +19 -68
  23. package/dist/agents/codex.cjs.map +1 -1
  24. package/dist/agents/codex.d.cts +3 -3
  25. package/dist/agents/codex.d.mts +3 -3
  26. package/dist/agents/codex.d.ts +3 -3
  27. package/dist/agents/index.cjs +3 -1
  28. package/dist/agents/index.cjs.map +1 -1
  29. package/dist/agents/index.d.cts +1 -0
  30. package/dist/agents/index.d.mts +1 -0
  31. package/dist/agents/index.d.ts +1 -0
  32. package/dist/agents/index.js +84 -82
  33. package/dist/agents/index.mjs +84 -82
  34. package/dist/agents/managed-jsonl.cjs +207 -0
  35. package/dist/agents/managed-jsonl.cjs.map +1 -0
  36. package/dist/agents/managed-jsonl.d.cts +39 -0
  37. package/dist/agents/managed-jsonl.d.mts +39 -0
  38. package/dist/agents/managed-jsonl.d.ts +39 -0
  39. package/dist/agents/managed-jsonl.js +6 -0
  40. package/dist/agents/managed-jsonl.js.map +1 -0
  41. package/dist/agents/managed-process.cjs +31 -0
  42. package/dist/agents/managed-process.cjs.map +1 -0
  43. package/dist/agents/managed-process.d.cts +3 -0
  44. package/dist/agents/managed-process.d.mts +3 -0
  45. package/dist/agents/managed-process.d.ts +3 -0
  46. package/dist/agents/managed-process.js +6 -0
  47. package/dist/agents/managed-process.js.map +1 -0
  48. package/dist/agents/omp.cjs +18 -1
  49. package/dist/agents/omp.cjs.map +1 -1
  50. package/dist/agents/sdk-streams.cjs +11 -4
  51. package/dist/agents/sdk-streams.cjs.map +1 -1
  52. package/dist/agents/types.cjs.map +1 -1
  53. package/dist/agents/types.d.cts +8 -0
  54. package/dist/agents/types.d.mts +8 -0
  55. package/dist/agents/types.d.ts +8 -0
  56. package/dist/analysis/bindings.cjs +74 -19
  57. package/dist/analysis/bindings.cjs.map +1 -1
  58. package/dist/analysis/bindings.d.cts +534 -156
  59. package/dist/analysis/bindings.d.mts +534 -156
  60. package/dist/analysis/bindings.d.ts +534 -156
  61. package/dist/analysis/domain-view.cjs.map +1 -1
  62. package/dist/analysis/domain-view.d.cts +137 -8
  63. package/dist/analysis/domain-view.d.mts +137 -8
  64. package/dist/analysis/domain-view.d.ts +137 -8
  65. package/dist/analysis/index.cjs.map +1 -1
  66. package/dist/analysis/index.d.cts +1 -1
  67. package/dist/analysis/index.d.mts +1 -1
  68. package/dist/analysis/index.d.ts +1 -1
  69. package/dist/assertions/api.cjs.map +1 -1
  70. package/dist/assertions/api.d.cts +62 -0
  71. package/dist/assertions/api.d.mts +62 -0
  72. package/dist/assertions/api.d.ts +62 -0
  73. package/dist/assertions/judge.cjs +56 -5
  74. package/dist/assertions/judge.cjs.map +1 -1
  75. package/dist/assertions/match.cjs +66 -42
  76. package/dist/assertions/match.cjs.map +1 -1
  77. package/dist/assertions/match.d.cts +13 -0
  78. package/dist/assertions/match.d.mts +13 -0
  79. package/dist/assertions/match.d.ts +13 -0
  80. package/dist/assertions/record/attachment.cjs +104 -33
  81. package/dist/assertions/record/attachment.cjs.map +1 -1
  82. package/dist/assertions/record/attachment.d.cts +294 -57
  83. package/dist/assertions/record/attachment.d.mts +294 -57
  84. package/dist/assertions/record/attachment.d.ts +294 -57
  85. package/dist/assertions/record/codec.cjs +91 -17
  86. package/dist/assertions/record/codec.cjs.map +1 -1
  87. package/dist/assertions/record/codec.d.cts +280 -52
  88. package/dist/assertions/record/codec.d.mts +280 -52
  89. package/dist/assertions/record/codec.d.ts +280 -52
  90. package/dist/assertions/record/index.js +2 -0
  91. package/dist/assertions/record/model.cjs +16 -0
  92. package/dist/assertions/record/model.cjs.map +1 -1
  93. package/dist/assertions/record/model.d.cts +120 -13
  94. package/dist/assertions/record/model.d.mts +120 -13
  95. package/dist/assertions/record/model.d.ts +120 -13
  96. package/dist/assertions/record/model.js +2 -0
  97. package/dist/assertions/record/producer.cjs +70 -50
  98. package/dist/assertions/record/producer.cjs.map +1 -1
  99. package/dist/assertions/record/producer.d.cts +8 -7
  100. package/dist/assertions/record/producer.d.mts +8 -7
  101. package/dist/assertions/record/producer.d.ts +8 -7
  102. package/dist/assertions/runtime.cjs +49 -7
  103. package/dist/assertions/runtime.cjs.map +1 -1
  104. package/dist/cli/application.cjs +40 -0
  105. package/dist/cli/application.cjs.map +1 -0
  106. package/dist/cli/application.d.cts +129 -0
  107. package/dist/cli/application.d.mts +129 -0
  108. package/dist/cli/application.d.ts +129 -0
  109. package/dist/cli/application.js +24 -0
  110. package/dist/cli/application.js.map +1 -0
  111. package/dist/cli/bootstrap.cjs +10 -4
  112. package/dist/cli/bootstrap.cjs.map +1 -1
  113. package/dist/cli/node-application.cjs +123 -0
  114. package/dist/cli/node-application.cjs.map +1 -0
  115. package/dist/cli/node-application.d.cts +14 -0
  116. package/dist/cli/node-application.d.mts +14 -0
  117. package/dist/cli/node-application.d.ts +14 -0
  118. package/dist/cli/node-application.js +26 -0
  119. package/dist/cli/node-application.js.map +1 -0
  120. package/dist/cli/program.cjs +2807 -0
  121. package/dist/cli/program.cjs.map +1 -0
  122. package/dist/cli/program.d.cts +352 -0
  123. package/dist/cli/program.d.mts +352 -0
  124. package/dist/cli/program.d.ts +352 -0
  125. package/dist/cli/program.js +36 -0
  126. package/dist/cli/program.js.map +1 -0
  127. package/dist/cli/project-configuration.cjs +134 -0
  128. package/dist/cli/project-configuration.cjs.map +1 -0
  129. package/dist/cli/project-configuration.d.cts +64 -0
  130. package/dist/cli/project-configuration.d.mts +64 -0
  131. package/dist/cli/project-configuration.d.ts +64 -0
  132. package/dist/cli/project-configuration.js +22 -0
  133. package/dist/cli/project-configuration.js.map +1 -0
  134. package/dist/cli/record.cjs +20 -4
  135. package/dist/cli/record.cjs.map +1 -1
  136. package/dist/cli/record.d.cts +3 -3
  137. package/dist/cli/record.d.mts +3 -3
  138. package/dist/cli/record.d.ts +3 -3
  139. package/dist/cli.cjs +19 -3130
  140. package/dist/cli.cjs.map +1 -1
  141. package/dist/cli.d.cts +2 -148
  142. package/dist/cli.d.mts +2 -148
  143. package/dist/cli.d.ts +2 -148
  144. package/dist/cli.js +22 -30
  145. package/dist/context/assert-first.cjs +21 -15
  146. package/dist/context/assert-first.cjs.map +1 -1
  147. package/dist/context/assert-first.d.cts +1 -0
  148. package/dist/context/assert-first.d.mts +1 -0
  149. package/dist/context/assert-first.d.ts +1 -0
  150. package/dist/context/attempt-resources.cjs +13 -0
  151. package/dist/context/attempt-resources.cjs.map +1 -0
  152. package/dist/context/attempt-resources.d.cts +3 -0
  153. package/dist/context/attempt-resources.d.mts +3 -0
  154. package/dist/context/attempt-resources.d.ts +3 -0
  155. package/dist/context/attempt-resources.js +8 -0
  156. package/dist/context/attempt-resources.js.map +1 -0
  157. package/dist/context/session.cjs +4 -3
  158. package/dist/context/session.cjs.map +1 -1
  159. package/dist/context/session.d.cts +1 -0
  160. package/dist/context/session.d.mts +1 -0
  161. package/dist/context/session.d.ts +1 -0
  162. package/dist/eval/record/verdict.cjs +3 -2
  163. package/dist/eval/record/verdict.cjs.map +1 -1
  164. package/dist/experiment/host/index.cjs +1 -6
  165. package/dist/experiment/host/index.cjs.map +1 -1
  166. package/dist/experiment/host/index.d.cts +1 -0
  167. package/dist/experiment/host/index.d.mts +1 -0
  168. package/dist/experiment/host/index.d.ts +1 -0
  169. package/dist/load-config.cjs +13 -4
  170. package/dist/load-config.cjs.map +1 -1
  171. package/dist/load-config.d.cts +4 -3
  172. package/dist/load-config.d.mts +4 -3
  173. package/dist/load-config.d.ts +4 -3
  174. package/dist/load-config.js +4 -2
  175. package/dist/o11y/parsers/codex.cjs +29 -7
  176. package/dist/o11y/parsers/codex.cjs.map +1 -1
  177. package/dist/record/codec/core.d.cts +0 -2
  178. package/dist/record/codec/core.d.mts +0 -2
  179. package/dist/record/codec/core.d.ts +0 -2
  180. package/dist/record/codec/identifiers.cjs +2 -3
  181. package/dist/record/codec/identifiers.cjs.map +1 -1
  182. package/dist/record/codec/identifiers.d.cts +1 -2
  183. package/dist/record/codec/identifiers.d.mts +1 -2
  184. package/dist/record/codec/identifiers.d.ts +1 -2
  185. package/dist/record/codec/identifiers.js +10 -12
  186. package/dist/record/codec/index.js +42 -44
  187. package/dist/record/definition/attachment.cjs +1 -0
  188. package/dist/record/definition/attachment.cjs.map +1 -1
  189. package/dist/record/definition/attachment.d.cts +14 -0
  190. package/dist/record/definition/attachment.d.mts +14 -0
  191. package/dist/record/definition/attachment.d.ts +14 -0
  192. package/dist/record/family/assertions-v1.cjs +104 -0
  193. package/dist/record/family/assertions-v1.cjs.map +1 -0
  194. package/dist/record/family/assertions-v1.d.cts +2 -0
  195. package/dist/record/family/assertions-v1.d.mts +2 -0
  196. package/dist/record/family/assertions-v1.d.ts +2 -0
  197. package/dist/record/family/assertions-v1.js +6 -0
  198. package/dist/record/family/assertions-v1.js.map +1 -0
  199. package/dist/record/family/assertions.cjs +16 -5
  200. package/dist/record/family/assertions.cjs.map +1 -1
  201. package/dist/record/family/assertions.d.cts +510 -56
  202. package/dist/record/family/assertions.d.mts +510 -56
  203. package/dist/record/family/assertions.d.ts +510 -56
  204. package/dist/record/family/assertions.js +14 -10
  205. package/dist/record/family/catalog.cjs +17 -1
  206. package/dist/record/family/catalog.cjs.map +1 -1
  207. package/dist/record/family/catalog.d.cts +1292 -104
  208. package/dist/record/family/catalog.d.mts +1292 -104
  209. package/dist/record/family/catalog.d.ts +1292 -104
  210. package/dist/record/family/catalog.js +22 -20
  211. package/dist/record/family/index.js +144 -138
  212. package/dist/record/family/observability-v1.cjs +5 -0
  213. package/dist/record/family/observability-v1.cjs.map +1 -1
  214. package/dist/record/family/observability.cjs +1 -1
  215. package/dist/record/family/observability.cjs.map +1 -1
  216. package/dist/record/host/runtime.cjs +323 -173
  217. package/dist/record/host/runtime.cjs.map +1 -1
  218. package/dist/record/host/types.cjs.map +1 -1
  219. package/dist/record/host/types.d.cts +9 -7
  220. package/dist/record/host/types.d.mts +9 -7
  221. package/dist/record/host/types.d.ts +9 -7
  222. package/dist/record/model/core.cjs.map +1 -1
  223. package/dist/record/model/core.d.cts +1 -2
  224. package/dist/record/model/core.d.mts +1 -2
  225. package/dist/record/model/core.d.ts +1 -2
  226. package/dist/record/model/definition.cjs +1 -2
  227. package/dist/record/model/definition.cjs.map +1 -1
  228. package/dist/record/model/definition.d.cts +1 -7
  229. package/dist/record/model/definition.d.mts +1 -7
  230. package/dist/record/model/definition.d.ts +1 -7
  231. package/dist/record/model/identifiers.cjs +2 -3
  232. package/dist/record/model/identifiers.cjs.map +1 -1
  233. package/dist/record/model/identifiers.d.cts +1 -3
  234. package/dist/record/model/identifiers.d.mts +1 -3
  235. package/dist/record/model/identifiers.d.ts +1 -3
  236. package/dist/record/model/identifiers.js +36 -38
  237. package/dist/record/model/index.js +60 -62
  238. package/dist/record/platform/node.cjs +17 -7
  239. package/dist/record/platform/node.cjs.map +1 -1
  240. package/dist/record/platform/services.cjs.map +1 -1
  241. package/dist/record/platform/services.d.cts +8 -3
  242. package/dist/record/platform/services.d.mts +8 -3
  243. package/dist/record/platform/services.d.ts +8 -3
  244. package/dist/record/reader/format.cjs +16 -65
  245. package/dist/record/reader/format.cjs.map +1 -1
  246. package/dist/record/reader/format.d.cts +5 -9
  247. package/dist/record/reader/format.d.mts +5 -9
  248. package/dist/record/reader/format.d.ts +5 -9
  249. package/dist/record/reader/index.js +10 -8
  250. package/dist/record/reader/runtime.cjs +63 -32
  251. package/dist/record/reader/runtime.cjs.map +1 -1
  252. package/dist/record/reader/runtime.d.cts +40 -4
  253. package/dist/record/reader/runtime.d.mts +40 -4
  254. package/dist/record/reader/runtime.d.ts +40 -4
  255. package/dist/record/reader/runtime.js +6 -4
  256. package/dist/report/assets/enhance.js +5 -5
  257. package/dist/report/assets/styles.css +190 -24
  258. package/dist/report/built-in/result-components.cjs +8 -5
  259. package/dist/report/built-in/result-components.cjs.map +1 -1
  260. package/dist/report/built-in/standard.cjs +3 -0
  261. package/dist/report/built-in/standard.cjs.map +1 -1
  262. package/dist/report/built-in/standard.d.cts +2 -0
  263. package/dist/report/built-in/standard.d.mts +2 -0
  264. package/dist/report/built-in/standard.d.ts +2 -0
  265. package/dist/report/client-dist/app.js +53 -0
  266. package/dist/report/components/attempt-detail/compute.cjs +108 -231
  267. package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
  268. package/dist/report/components/attempt-detail/compute.d.cts +11 -45
  269. package/dist/report/components/attempt-detail/compute.d.mts +11 -45
  270. package/dist/report/components/attempt-detail/compute.d.ts +11 -45
  271. package/dist/report/components/attempt-detail/compute.js +2 -4
  272. package/dist/report/components/attempt-detail/content.cjs +4 -4
  273. package/dist/report/components/attempt-detail/content.cjs.map +1 -1
  274. package/dist/report/components/attempt-detail/validate.cjs +47 -4
  275. package/dist/report/components/attempt-detail/validate.cjs.map +1 -1
  276. package/dist/report/components/entity-lists/compute.cjs +9 -15
  277. package/dist/report/components/entity-lists/compute.cjs.map +1 -1
  278. package/dist/report/components/entity-lists/content.cjs +53 -40
  279. package/dist/report/components/entity-lists/content.cjs.map +1 -1
  280. package/dist/report/components/entity-lists/index.cjs +1 -3
  281. package/dist/report/components/entity-lists/index.cjs.map +1 -1
  282. package/dist/report/components/experiment-detail/compute.cjs +4 -6
  283. package/dist/report/components/experiment-detail/compute.cjs.map +1 -1
  284. package/dist/report/components/summaries/index.cjs +5 -1
  285. package/dist/report/components/summaries/index.cjs.map +1 -1
  286. package/dist/report/definition/cell.cjs +14 -7
  287. package/dist/report/definition/cell.cjs.map +1 -1
  288. package/dist/report/definition/cell.d.cts +4 -0
  289. package/dist/report/definition/cell.d.mts +4 -0
  290. package/dist/report/definition/cell.d.ts +4 -0
  291. package/dist/report/definition/primitives/assertion-evidence.cjs +96 -0
  292. package/dist/report/definition/primitives/assertion-evidence.cjs.map +1 -0
  293. package/dist/report/definition/primitives/assertion-evidence.d.cts +11 -0
  294. package/dist/report/definition/primitives/assertion-evidence.d.mts +11 -0
  295. package/dist/report/definition/primitives/assertion-evidence.d.ts +11 -0
  296. package/dist/report/definition/primitives/assertion-evidence.js +6 -0
  297. package/dist/report/definition/primitives/assertion-evidence.js.map +1 -0
  298. package/dist/report/definition/primitives/conversation.cjs +7 -0
  299. package/dist/report/definition/primitives/conversation.cjs.map +1 -1
  300. package/dist/report/definition/primitives/conversation.d.cts +2 -0
  301. package/dist/report/definition/primitives/conversation.d.mts +2 -0
  302. package/dist/report/definition/primitives/conversation.d.ts +2 -0
  303. package/dist/report/definition/primitives/turn-trace.cjs +53 -3
  304. package/dist/report/definition/primitives/turn-trace.cjs.map +1 -1
  305. package/dist/report/definition/primitives.cjs +14 -1
  306. package/dist/report/definition/primitives.cjs.map +1 -1
  307. package/dist/report/definition/report.cjs +16 -8
  308. package/dist/report/definition/report.cjs.map +1 -1
  309. package/dist/report/definition/report.d.cts +6 -0
  310. package/dist/report/definition/report.d.mts +6 -0
  311. package/dist/report/definition/report.d.ts +6 -0
  312. package/dist/report/definition/table-text.cjs +12 -3
  313. package/dist/report/definition/table-text.cjs.map +1 -1
  314. package/dist/report/definition/table-text.d.cts +6 -1
  315. package/dist/report/definition/table-text.d.mts +6 -1
  316. package/dist/report/definition/table-text.d.ts +6 -1
  317. package/dist/report/execution/model.cjs +6 -14
  318. package/dist/report/execution/model.cjs.map +1 -1
  319. package/dist/report/execution/model.d.cts +5 -10
  320. package/dist/report/execution/model.d.mts +5 -10
  321. package/dist/report/execution/model.d.ts +5 -10
  322. package/dist/report/execution/model.js +6 -6
  323. package/dist/report/execution/paths.cjs +0 -11
  324. package/dist/report/execution/paths.cjs.map +1 -1
  325. package/dist/report/execution/paths.d.cts +0 -1
  326. package/dist/report/execution/paths.d.mts +0 -1
  327. package/dist/report/execution/paths.d.ts +0 -1
  328. package/dist/report/execution/paths.js +6 -8
  329. package/dist/report/host/execute.cjs +13 -22
  330. package/dist/report/host/execute.cjs.map +1 -1
  331. package/dist/report/host/execute.d.cts +1 -4
  332. package/dist/report/host/execute.d.mts +1 -4
  333. package/dist/report/host/execute.d.ts +1 -4
  334. package/dist/report/host/from-record.cjs +3 -0
  335. package/dist/report/host/from-record.cjs.map +1 -1
  336. package/dist/report/host/from-record.d.cts +4 -1
  337. package/dist/report/host/from-record.d.mts +4 -1
  338. package/dist/report/host/from-record.d.ts +4 -1
  339. package/dist/report/host/site-assets.cjs +1 -2
  340. package/dist/report/host/site-assets.cjs.map +1 -1
  341. package/dist/report/host/site-assets.d.cts +0 -1
  342. package/dist/report/host/site-assets.d.mts +0 -1
  343. package/dist/report/host/site-assets.d.ts +0 -1
  344. package/dist/report/host/site-assets.js +2 -4
  345. package/dist/report/host/static.cjs +71 -346
  346. package/dist/report/host/static.cjs.map +1 -1
  347. package/dist/report/host/static.d.cts +1 -3
  348. package/dist/report/host/static.d.mts +1 -3
  349. package/dist/report/host/static.d.ts +1 -3
  350. package/dist/report/host/static.js +2 -2
  351. package/dist/report/host/view-session.cjs.map +1 -1
  352. package/dist/report/host/view-session.d.cts +1 -1
  353. package/dist/report/host/view-session.d.mts +1 -1
  354. package/dist/report/host/view-session.d.ts +1 -1
  355. package/dist/report/model/locale.cjs +1 -1
  356. package/dist/report/model/locale.cjs.map +1 -1
  357. package/dist/report/model/locale.d.cts +1 -1
  358. package/dist/report/model/locale.d.mts +1 -1
  359. package/dist/report/model/locale.d.ts +1 -1
  360. package/dist/report/model/pricing.cjs +2 -2
  361. package/dist/report/model/pricing.cjs.map +1 -1
  362. package/dist/report/react/enhance.js +5 -5
  363. package/dist/report/react/styles.css +190 -24
  364. package/dist/runner/adoption.cjs +4 -7
  365. package/dist/runner/adoption.cjs.map +1 -1
  366. package/dist/runner/attempt-resources.cjs +60 -0
  367. package/dist/runner/attempt-resources.cjs.map +1 -0
  368. package/dist/runner/attempt-resources.d.cts +13 -0
  369. package/dist/runner/attempt-resources.d.mts +13 -0
  370. package/dist/runner/attempt-resources.d.ts +13 -0
  371. package/dist/runner/attempt-resources.js +6 -0
  372. package/dist/runner/attempt-resources.js.map +1 -0
  373. package/dist/runner/attempt.cjs +37 -3
  374. package/dist/runner/attempt.cjs.map +1 -1
  375. package/dist/runner/feedback/failure.cjs +77 -2
  376. package/dist/runner/feedback/failure.cjs.map +1 -1
  377. package/dist/runner/feedback/failure.d.cts +2 -1
  378. package/dist/runner/feedback/failure.d.mts +2 -1
  379. package/dist/runner/feedback/failure.d.ts +2 -1
  380. package/dist/runner/project-current.cjs +2 -13
  381. package/dist/runner/project-current.cjs.map +1 -1
  382. package/dist/runner/project-current.d.cts +4 -2
  383. package/dist/runner/project-current.d.mts +4 -2
  384. package/dist/runner/project-current.d.ts +4 -2
  385. package/dist/runner/reporters/braintrust.cjs +7 -7
  386. package/dist/runner/reporters/braintrust.cjs.map +1 -1
  387. package/dist/runner/reuse-readback.cjs +3 -4
  388. package/dist/runner/reuse-readback.cjs.map +1 -1
  389. package/dist/runner/run.cjs +5 -2
  390. package/dist/runner/run.cjs.map +1 -1
  391. package/dist/sandbox/backend.cjs +32 -2
  392. package/dist/sandbox/backend.cjs.map +1 -1
  393. package/dist/sandbox/backend.d.cts +12 -1
  394. package/dist/sandbox/backend.d.mts +12 -1
  395. package/dist/sandbox/backend.d.ts +12 -1
  396. package/dist/sandbox/backend.js +28 -22
  397. package/dist/sandbox/docker.cjs +140 -0
  398. package/dist/sandbox/docker.cjs.map +1 -1
  399. package/dist/sandbox/docker.d.cts +3 -1
  400. package/dist/sandbox/docker.d.mts +3 -1
  401. package/dist/sandbox/docker.d.ts +3 -1
  402. package/dist/sandbox/e2b.cjs +42 -0
  403. package/dist/sandbox/e2b.cjs.map +1 -1
  404. package/dist/sandbox/e2b.d.cts +2 -0
  405. package/dist/sandbox/e2b.d.mts +2 -0
  406. package/dist/sandbox/e2b.d.ts +2 -0
  407. package/dist/sandbox/local.cjs +64 -0
  408. package/dist/sandbox/local.cjs.map +1 -1
  409. package/dist/sandbox/local.d.cts +3 -1
  410. package/dist/sandbox/local.d.mts +3 -1
  411. package/dist/sandbox/local.d.ts +3 -1
  412. package/dist/sandbox/managed-process.cjs +49 -0
  413. package/dist/sandbox/managed-process.cjs.map +1 -0
  414. package/dist/sandbox/managed-process.d.cts +11 -0
  415. package/dist/sandbox/managed-process.d.mts +11 -0
  416. package/dist/sandbox/managed-process.d.ts +11 -0
  417. package/dist/sandbox/managed-process.js +6 -0
  418. package/dist/sandbox/managed-process.js.map +1 -0
  419. package/dist/sandbox/types.cjs.map +1 -1
  420. package/dist/sandbox/types.d.cts +24 -0
  421. package/dist/sandbox/types.d.mts +24 -0
  422. package/dist/sandbox/types.d.ts +24 -0
  423. package/dist/sandbox/vercel.cjs +1 -0
  424. package/dist/sandbox/vercel.cjs.map +1 -1
  425. package/dist/sandbox/vercel.d.cts +1 -0
  426. package/dist/sandbox/vercel.d.mts +1 -0
  427. package/dist/sandbox/vercel.d.ts +1 -0
  428. package/dist/view/server.cjs +2 -37
  429. package/dist/view/server.cjs.map +1 -1
  430. package/dist/view/server.d.cts +0 -3
  431. package/dist/view/server.d.mts +0 -3
  432. package/dist/view/server.d.ts +0 -3
  433. package/docs-site/zh/reference/builtin-agents.mdx +7 -7
  434. package/docs-site/zh/reference/official-adapters.mdx +4 -4
  435. package/docs-site/zh/reference/report-components.mdx +2 -2
  436. package/docs-site/zh/tutorials/configuration.mdx +2 -2
  437. package/docs-site/zh/tutorials/deploy-report-site.mdx +24 -2
  438. package/docs-site/zh/tutorials/publish-report.mdx +4 -4
  439. package/docs-site/zh/tutorials/sandbox-agent.mdx +5 -5
  440. package/docs-site/zh/tutorials/theming.mdx +2 -2
  441. package/package.json +4 -6
  442. package/dist/record/migration/index.cjs +0 -5
  443. package/dist/record/migration/index.cjs.map +0 -1
  444. package/dist/record/migration/index.d.cts +0 -11
  445. package/dist/record/migration/index.d.mts +0 -11
  446. package/dist/record/migration/index.d.ts +0 -11
  447. package/dist/record/migration/index.js +0 -6
  448. package/dist/record/migration/index.js.map +0 -1
  449. package/dist/report/host/site-runtime.cjs +0 -92
  450. package/dist/report/host/site-runtime.cjs.map +0 -1
  451. package/dist/report/host/site-runtime.d.cts +0 -9
  452. package/dist/report/host/site-runtime.d.mts +0 -9
  453. package/dist/report/host/site-runtime.d.ts +0 -9
  454. package/dist/report/host/site-runtime.js +0 -10
  455. package/dist/report/host/site-runtime.js.map +0 -1
  456. package/dist/view/client-dist/app.css +0 -2
  457. package/dist/view/client-dist/app.js +0 -49
  458. package/dist/view/data.cjs +0 -3
  459. package/dist/view/data.cjs.map +0 -1
  460. package/dist/view/data.d.cts +0 -9
  461. package/dist/view/data.d.mts +0 -9
  462. package/dist/view/data.d.ts +0 -9
  463. package/dist/view/data.js +0 -4
  464. package/dist/view/data.js.map +0 -1
  465. package/dist/view/index.cjs +0 -24
  466. package/dist/view/index.cjs.map +0 -1
  467. package/dist/view/index.d.cts +0 -9
  468. package/dist/view/index.d.mts +0 -9
  469. package/dist/view/index.d.ts +0 -9
  470. package/dist/view/index.js +0 -28
  471. package/dist/view/index.js.map +0 -1
  472. package/dist/view/report-view-cache.cjs +0 -200
  473. package/dist/view/report-view-cache.cjs.map +0 -1
  474. package/dist/view/report-view-cache.d.cts +0 -67
  475. package/dist/view/report-view-cache.d.mts +0 -67
  476. package/dist/view/report-view-cache.d.ts +0 -67
  477. package/dist/view/report-view-cache.js +0 -8
  478. package/dist/view/report-view-cache.js.map +0 -1
  479. package/dist/view/shared/types.cjs +0 -3
  480. package/dist/view/shared/types.cjs.map +0 -1
  481. package/dist/view/shared/types.d.cts +0 -51
  482. package/dist/view/shared/types.d.mts +0 -51
  483. package/dist/view/shared/types.d.ts +0 -51
  484. package/dist/view/shared/types.js +0 -4
  485. package/dist/view/shared/types.js.map +0 -1
  486. package/dist/view/site.cjs +0 -32
  487. package/dist/view/site.cjs.map +0 -1
  488. package/dist/view/site.d.cts +0 -24
  489. package/dist/view/site.d.mts +0 -24
  490. package/dist/view/site.d.ts +0 -24
  491. package/dist/view/site.js +0 -8
  492. package/dist/view/site.js.map +0 -1
  493. package/dist/view/styles.css +0 -170
  494. package/dist/view/template.html +0 -17
@@ -4,6 +4,7 @@ export { shared } from "./shared.js";
4
4
  export type { Shared } from "./shared.js";
5
5
  export { createNpmCliInstaller, agentBin } from "./npm-staged.js";
6
6
  export type { NpmCliInstallerOptions } from "./npm-staged.js";
7
+ export { acquireManagedProcess } from "./managed-process.js";
7
8
  export { completeEvidenceCoverage } from "../assertions/coverage.js";
8
9
  export type { EvidenceCoverageStatus, EvidenceCoverageEntry, EvidenceCoverage, TurnEvidenceCoverage, } from "../types.js";
9
10
  export { LOGICAL_COMMAND_NORMALIZER, commandProjection, normalizeLogicalCommand, notCommandProjection, opaqueCommandProjection, } from "../o11y/command-projection.js";
@@ -5,86 +5,88 @@ const __niceevalExport0 = __niceevalCanonical["BUILTIN_AGENTS"];
5
5
  export { __niceevalExport0 as BUILTIN_AGENTS };
6
6
  const __niceevalExport1 = __niceevalCanonical["LOGICAL_COMMAND_NORMALIZER"];
7
7
  export { __niceevalExport1 as LOGICAL_COMMAND_NORMALIZER };
8
- const __niceevalExport2 = __niceevalCanonical["agentBin"];
9
- export { __niceevalExport2 as agentBin };
10
- const __niceevalExport3 = __niceevalCanonical["aiSdkAgent"];
11
- export { __niceevalExport3 as aiSdkAgent };
12
- const __niceevalExport4 = __niceevalCanonical["bubAgent"];
13
- export { __niceevalExport4 as bubAgent };
14
- const __niceevalExport5 = __niceevalCanonical["chatCompletionEvidenceCoverage"];
15
- export { __niceevalExport5 as chatCompletionEvidenceCoverage };
16
- const __niceevalExport6 = __niceevalCanonical["claudeCodeAgent"];
17
- export { __niceevalExport6 as claudeCodeAgent };
18
- const __niceevalExport7 = __niceevalCanonical["codexAgent"];
19
- export { __niceevalExport7 as codexAgent };
20
- const __niceevalExport8 = __niceevalCanonical["commandProjection"];
21
- export { __niceevalExport8 as commandProjection };
22
- const __niceevalExport9 = __niceevalCanonical["completeEvidenceCoverage"];
23
- export { __niceevalExport9 as completeEvidenceCoverage };
24
- const __niceevalExport10 = __niceevalCanonical["createClaudeSdkEventStream"];
25
- export { __niceevalExport10 as createClaudeSdkEventStream };
26
- const __niceevalExport11 = __niceevalCanonical["createCodexThreadEventStream"];
27
- export { __niceevalExport11 as createCodexThreadEventStream };
28
- const __niceevalExport12 = __niceevalCanonical["createLangGraphEventStream"];
29
- export { __niceevalExport12 as createLangGraphEventStream };
30
- const __niceevalExport13 = __niceevalCanonical["createNpmCliInstaller"];
31
- export { __niceevalExport13 as createNpmCliInstaller };
32
- const __niceevalExport14 = __niceevalCanonical["createPiAgentEventStream"];
33
- export { __niceevalExport14 as createPiAgentEventStream };
34
- const __niceevalExport15 = __niceevalCanonical["createSessionSlot"];
35
- export { __niceevalExport15 as createSessionSlot };
36
- const __niceevalExport16 = __niceevalCanonical["deepSeekHarnessAgent"];
37
- export { __niceevalExport16 as deepSeekHarnessAgent };
38
- const __niceevalExport17 = __niceevalCanonical["defineAgent"];
39
- export { __niceevalExport17 as defineAgent };
40
- const __niceevalExport18 = __niceevalCanonical["defineSandboxAgent"];
41
- export { __niceevalExport18 as defineSandboxAgent };
42
- const __niceevalExport19 = __niceevalCanonical["deltaStream"];
43
- export { __niceevalExport19 as deltaStream };
44
- const __niceevalExport20 = __niceevalCanonical["driveFrameStream"];
45
- export { __niceevalExport20 as driveFrameStream };
46
- const __niceevalExport21 = __niceevalCanonical["externalCauseMessageChain"];
47
- export { __niceevalExport21 as externalCauseMessageChain };
48
- const __niceevalExport22 = __niceevalCanonical["externalCauseText"];
49
- export { __niceevalExport22 as externalCauseText };
50
- const __niceevalExport23 = __niceevalCanonical["hermesAgent"];
51
- export { __niceevalExport23 as hermesAgent };
52
- const __niceevalExport24 = __niceevalCanonical["heuristicTag"];
53
- export { __niceevalExport24 as heuristicTag };
54
- const __niceevalExport25 = __niceevalCanonical["makeSendFailure"];
55
- export { __niceevalExport25 as makeSendFailure };
56
- const __niceevalExport26 = __niceevalCanonical["mapCodexSpans"];
57
- export { __niceevalExport26 as mapCodexSpans };
58
- const __niceevalExport27 = __niceevalCanonical["normalizeExternalCause"];
59
- export { __niceevalExport27 as normalizeExternalCause };
60
- const __niceevalExport28 = __niceevalCanonical["normalizeLogicalCommand"];
61
- export { __niceevalExport28 as normalizeLogicalCommand };
62
- const __niceevalExport29 = __niceevalCanonical["notCommandProjection"];
63
- export { __niceevalExport29 as notCommandProjection };
64
- const __niceevalExport30 = __niceevalCanonical["ompAgent"];
65
- export { __niceevalExport30 as ompAgent };
66
- const __niceevalExport31 = __niceevalCanonical["opaqueCommandProjection"];
67
- export { __niceevalExport31 as opaqueCommandProjection };
68
- const __niceevalExport32 = __niceevalCanonical["openClawAgent"];
69
- export { __niceevalExport32 as openClawAgent };
70
- const __niceevalExport33 = __niceevalCanonical["openCodeAgent"];
71
- export { __niceevalExport33 as openCodeAgent };
72
- const __niceevalExport34 = __niceevalCanonical["responsesEvidenceCoverage"];
73
- export { __niceevalExport34 as responsesEvidenceCoverage };
74
- const __niceevalExport35 = __niceevalCanonical["sendFailureText"];
75
- export { __niceevalExport35 as sendFailureText };
76
- const __niceevalExport36 = __niceevalCanonical["shared"];
77
- export { __niceevalExport36 as shared };
78
- const __niceevalExport37 = __niceevalCanonical["sseJsonFrames"];
79
- export { __niceevalExport37 as sseJsonFrames };
80
- const __niceevalExport38 = __niceevalCanonical["tagSpan"];
81
- export { __niceevalExport38 as tagSpan };
82
- const __niceevalExport39 = __niceevalCanonical["turnFromAiSdk"];
83
- export { __niceevalExport39 as turnFromAiSdk };
84
- const __niceevalExport40 = __niceevalCanonical["turnFromChatCompletion"];
85
- export { __niceevalExport40 as turnFromChatCompletion };
86
- const __niceevalExport41 = __niceevalCanonical["turnFromResponses"];
87
- export { __niceevalExport41 as turnFromResponses };
88
- const __niceevalExport42 = __niceevalCanonical["uiMessageStreamAgent"];
89
- export { __niceevalExport42 as uiMessageStreamAgent };
8
+ const __niceevalExport2 = __niceevalCanonical["acquireManagedProcess"];
9
+ export { __niceevalExport2 as acquireManagedProcess };
10
+ const __niceevalExport3 = __niceevalCanonical["agentBin"];
11
+ export { __niceevalExport3 as agentBin };
12
+ const __niceevalExport4 = __niceevalCanonical["aiSdkAgent"];
13
+ export { __niceevalExport4 as aiSdkAgent };
14
+ const __niceevalExport5 = __niceevalCanonical["bubAgent"];
15
+ export { __niceevalExport5 as bubAgent };
16
+ const __niceevalExport6 = __niceevalCanonical["chatCompletionEvidenceCoverage"];
17
+ export { __niceevalExport6 as chatCompletionEvidenceCoverage };
18
+ const __niceevalExport7 = __niceevalCanonical["claudeCodeAgent"];
19
+ export { __niceevalExport7 as claudeCodeAgent };
20
+ const __niceevalExport8 = __niceevalCanonical["codexAgent"];
21
+ export { __niceevalExport8 as codexAgent };
22
+ const __niceevalExport9 = __niceevalCanonical["commandProjection"];
23
+ export { __niceevalExport9 as commandProjection };
24
+ const __niceevalExport10 = __niceevalCanonical["completeEvidenceCoverage"];
25
+ export { __niceevalExport10 as completeEvidenceCoverage };
26
+ const __niceevalExport11 = __niceevalCanonical["createClaudeSdkEventStream"];
27
+ export { __niceevalExport11 as createClaudeSdkEventStream };
28
+ const __niceevalExport12 = __niceevalCanonical["createCodexThreadEventStream"];
29
+ export { __niceevalExport12 as createCodexThreadEventStream };
30
+ const __niceevalExport13 = __niceevalCanonical["createLangGraphEventStream"];
31
+ export { __niceevalExport13 as createLangGraphEventStream };
32
+ const __niceevalExport14 = __niceevalCanonical["createNpmCliInstaller"];
33
+ export { __niceevalExport14 as createNpmCliInstaller };
34
+ const __niceevalExport15 = __niceevalCanonical["createPiAgentEventStream"];
35
+ export { __niceevalExport15 as createPiAgentEventStream };
36
+ const __niceevalExport16 = __niceevalCanonical["createSessionSlot"];
37
+ export { __niceevalExport16 as createSessionSlot };
38
+ const __niceevalExport17 = __niceevalCanonical["deepSeekHarnessAgent"];
39
+ export { __niceevalExport17 as deepSeekHarnessAgent };
40
+ const __niceevalExport18 = __niceevalCanonical["defineAgent"];
41
+ export { __niceevalExport18 as defineAgent };
42
+ const __niceevalExport19 = __niceevalCanonical["defineSandboxAgent"];
43
+ export { __niceevalExport19 as defineSandboxAgent };
44
+ const __niceevalExport20 = __niceevalCanonical["deltaStream"];
45
+ export { __niceevalExport20 as deltaStream };
46
+ const __niceevalExport21 = __niceevalCanonical["driveFrameStream"];
47
+ export { __niceevalExport21 as driveFrameStream };
48
+ const __niceevalExport22 = __niceevalCanonical["externalCauseMessageChain"];
49
+ export { __niceevalExport22 as externalCauseMessageChain };
50
+ const __niceevalExport23 = __niceevalCanonical["externalCauseText"];
51
+ export { __niceevalExport23 as externalCauseText };
52
+ const __niceevalExport24 = __niceevalCanonical["hermesAgent"];
53
+ export { __niceevalExport24 as hermesAgent };
54
+ const __niceevalExport25 = __niceevalCanonical["heuristicTag"];
55
+ export { __niceevalExport25 as heuristicTag };
56
+ const __niceevalExport26 = __niceevalCanonical["makeSendFailure"];
57
+ export { __niceevalExport26 as makeSendFailure };
58
+ const __niceevalExport27 = __niceevalCanonical["mapCodexSpans"];
59
+ export { __niceevalExport27 as mapCodexSpans };
60
+ const __niceevalExport28 = __niceevalCanonical["normalizeExternalCause"];
61
+ export { __niceevalExport28 as normalizeExternalCause };
62
+ const __niceevalExport29 = __niceevalCanonical["normalizeLogicalCommand"];
63
+ export { __niceevalExport29 as normalizeLogicalCommand };
64
+ const __niceevalExport30 = __niceevalCanonical["notCommandProjection"];
65
+ export { __niceevalExport30 as notCommandProjection };
66
+ const __niceevalExport31 = __niceevalCanonical["ompAgent"];
67
+ export { __niceevalExport31 as ompAgent };
68
+ const __niceevalExport32 = __niceevalCanonical["opaqueCommandProjection"];
69
+ export { __niceevalExport32 as opaqueCommandProjection };
70
+ const __niceevalExport33 = __niceevalCanonical["openClawAgent"];
71
+ export { __niceevalExport33 as openClawAgent };
72
+ const __niceevalExport34 = __niceevalCanonical["openCodeAgent"];
73
+ export { __niceevalExport34 as openCodeAgent };
74
+ const __niceevalExport35 = __niceevalCanonical["responsesEvidenceCoverage"];
75
+ export { __niceevalExport35 as responsesEvidenceCoverage };
76
+ const __niceevalExport36 = __niceevalCanonical["sendFailureText"];
77
+ export { __niceevalExport36 as sendFailureText };
78
+ const __niceevalExport37 = __niceevalCanonical["shared"];
79
+ export { __niceevalExport37 as shared };
80
+ const __niceevalExport38 = __niceevalCanonical["sseJsonFrames"];
81
+ export { __niceevalExport38 as sseJsonFrames };
82
+ const __niceevalExport39 = __niceevalCanonical["tagSpan"];
83
+ export { __niceevalExport39 as tagSpan };
84
+ const __niceevalExport40 = __niceevalCanonical["turnFromAiSdk"];
85
+ export { __niceevalExport40 as turnFromAiSdk };
86
+ const __niceevalExport41 = __niceevalCanonical["turnFromChatCompletion"];
87
+ export { __niceevalExport41 as turnFromChatCompletion };
88
+ const __niceevalExport42 = __niceevalCanonical["turnFromResponses"];
89
+ export { __niceevalExport42 as turnFromResponses };
90
+ const __niceevalExport43 = __niceevalCanonical["uiMessageStreamAgent"];
91
+ export { __niceevalExport43 as uiMessageStreamAgent };
90
92
  //# sourceMappingURL=index.js.map
@@ -5,86 +5,88 @@ const __niceevalExport0 = __niceevalCanonical["BUILTIN_AGENTS"];
5
5
  export { __niceevalExport0 as BUILTIN_AGENTS };
6
6
  const __niceevalExport1 = __niceevalCanonical["LOGICAL_COMMAND_NORMALIZER"];
7
7
  export { __niceevalExport1 as LOGICAL_COMMAND_NORMALIZER };
8
- const __niceevalExport2 = __niceevalCanonical["agentBin"];
9
- export { __niceevalExport2 as agentBin };
10
- const __niceevalExport3 = __niceevalCanonical["aiSdkAgent"];
11
- export { __niceevalExport3 as aiSdkAgent };
12
- const __niceevalExport4 = __niceevalCanonical["bubAgent"];
13
- export { __niceevalExport4 as bubAgent };
14
- const __niceevalExport5 = __niceevalCanonical["chatCompletionEvidenceCoverage"];
15
- export { __niceevalExport5 as chatCompletionEvidenceCoverage };
16
- const __niceevalExport6 = __niceevalCanonical["claudeCodeAgent"];
17
- export { __niceevalExport6 as claudeCodeAgent };
18
- const __niceevalExport7 = __niceevalCanonical["codexAgent"];
19
- export { __niceevalExport7 as codexAgent };
20
- const __niceevalExport8 = __niceevalCanonical["commandProjection"];
21
- export { __niceevalExport8 as commandProjection };
22
- const __niceevalExport9 = __niceevalCanonical["completeEvidenceCoverage"];
23
- export { __niceevalExport9 as completeEvidenceCoverage };
24
- const __niceevalExport10 = __niceevalCanonical["createClaudeSdkEventStream"];
25
- export { __niceevalExport10 as createClaudeSdkEventStream };
26
- const __niceevalExport11 = __niceevalCanonical["createCodexThreadEventStream"];
27
- export { __niceevalExport11 as createCodexThreadEventStream };
28
- const __niceevalExport12 = __niceevalCanonical["createLangGraphEventStream"];
29
- export { __niceevalExport12 as createLangGraphEventStream };
30
- const __niceevalExport13 = __niceevalCanonical["createNpmCliInstaller"];
31
- export { __niceevalExport13 as createNpmCliInstaller };
32
- const __niceevalExport14 = __niceevalCanonical["createPiAgentEventStream"];
33
- export { __niceevalExport14 as createPiAgentEventStream };
34
- const __niceevalExport15 = __niceevalCanonical["createSessionSlot"];
35
- export { __niceevalExport15 as createSessionSlot };
36
- const __niceevalExport16 = __niceevalCanonical["deepSeekHarnessAgent"];
37
- export { __niceevalExport16 as deepSeekHarnessAgent };
38
- const __niceevalExport17 = __niceevalCanonical["defineAgent"];
39
- export { __niceevalExport17 as defineAgent };
40
- const __niceevalExport18 = __niceevalCanonical["defineSandboxAgent"];
41
- export { __niceevalExport18 as defineSandboxAgent };
42
- const __niceevalExport19 = __niceevalCanonical["deltaStream"];
43
- export { __niceevalExport19 as deltaStream };
44
- const __niceevalExport20 = __niceevalCanonical["driveFrameStream"];
45
- export { __niceevalExport20 as driveFrameStream };
46
- const __niceevalExport21 = __niceevalCanonical["externalCauseMessageChain"];
47
- export { __niceevalExport21 as externalCauseMessageChain };
48
- const __niceevalExport22 = __niceevalCanonical["externalCauseText"];
49
- export { __niceevalExport22 as externalCauseText };
50
- const __niceevalExport23 = __niceevalCanonical["hermesAgent"];
51
- export { __niceevalExport23 as hermesAgent };
52
- const __niceevalExport24 = __niceevalCanonical["heuristicTag"];
53
- export { __niceevalExport24 as heuristicTag };
54
- const __niceevalExport25 = __niceevalCanonical["makeSendFailure"];
55
- export { __niceevalExport25 as makeSendFailure };
56
- const __niceevalExport26 = __niceevalCanonical["mapCodexSpans"];
57
- export { __niceevalExport26 as mapCodexSpans };
58
- const __niceevalExport27 = __niceevalCanonical["normalizeExternalCause"];
59
- export { __niceevalExport27 as normalizeExternalCause };
60
- const __niceevalExport28 = __niceevalCanonical["normalizeLogicalCommand"];
61
- export { __niceevalExport28 as normalizeLogicalCommand };
62
- const __niceevalExport29 = __niceevalCanonical["notCommandProjection"];
63
- export { __niceevalExport29 as notCommandProjection };
64
- const __niceevalExport30 = __niceevalCanonical["ompAgent"];
65
- export { __niceevalExport30 as ompAgent };
66
- const __niceevalExport31 = __niceevalCanonical["opaqueCommandProjection"];
67
- export { __niceevalExport31 as opaqueCommandProjection };
68
- const __niceevalExport32 = __niceevalCanonical["openClawAgent"];
69
- export { __niceevalExport32 as openClawAgent };
70
- const __niceevalExport33 = __niceevalCanonical["openCodeAgent"];
71
- export { __niceevalExport33 as openCodeAgent };
72
- const __niceevalExport34 = __niceevalCanonical["responsesEvidenceCoverage"];
73
- export { __niceevalExport34 as responsesEvidenceCoverage };
74
- const __niceevalExport35 = __niceevalCanonical["sendFailureText"];
75
- export { __niceevalExport35 as sendFailureText };
76
- const __niceevalExport36 = __niceevalCanonical["shared"];
77
- export { __niceevalExport36 as shared };
78
- const __niceevalExport37 = __niceevalCanonical["sseJsonFrames"];
79
- export { __niceevalExport37 as sseJsonFrames };
80
- const __niceevalExport38 = __niceevalCanonical["tagSpan"];
81
- export { __niceevalExport38 as tagSpan };
82
- const __niceevalExport39 = __niceevalCanonical["turnFromAiSdk"];
83
- export { __niceevalExport39 as turnFromAiSdk };
84
- const __niceevalExport40 = __niceevalCanonical["turnFromChatCompletion"];
85
- export { __niceevalExport40 as turnFromChatCompletion };
86
- const __niceevalExport41 = __niceevalCanonical["turnFromResponses"];
87
- export { __niceevalExport41 as turnFromResponses };
88
- const __niceevalExport42 = __niceevalCanonical["uiMessageStreamAgent"];
89
- export { __niceevalExport42 as uiMessageStreamAgent };
8
+ const __niceevalExport2 = __niceevalCanonical["acquireManagedProcess"];
9
+ export { __niceevalExport2 as acquireManagedProcess };
10
+ const __niceevalExport3 = __niceevalCanonical["agentBin"];
11
+ export { __niceevalExport3 as agentBin };
12
+ const __niceevalExport4 = __niceevalCanonical["aiSdkAgent"];
13
+ export { __niceevalExport4 as aiSdkAgent };
14
+ const __niceevalExport5 = __niceevalCanonical["bubAgent"];
15
+ export { __niceevalExport5 as bubAgent };
16
+ const __niceevalExport6 = __niceevalCanonical["chatCompletionEvidenceCoverage"];
17
+ export { __niceevalExport6 as chatCompletionEvidenceCoverage };
18
+ const __niceevalExport7 = __niceevalCanonical["claudeCodeAgent"];
19
+ export { __niceevalExport7 as claudeCodeAgent };
20
+ const __niceevalExport8 = __niceevalCanonical["codexAgent"];
21
+ export { __niceevalExport8 as codexAgent };
22
+ const __niceevalExport9 = __niceevalCanonical["commandProjection"];
23
+ export { __niceevalExport9 as commandProjection };
24
+ const __niceevalExport10 = __niceevalCanonical["completeEvidenceCoverage"];
25
+ export { __niceevalExport10 as completeEvidenceCoverage };
26
+ const __niceevalExport11 = __niceevalCanonical["createClaudeSdkEventStream"];
27
+ export { __niceevalExport11 as createClaudeSdkEventStream };
28
+ const __niceevalExport12 = __niceevalCanonical["createCodexThreadEventStream"];
29
+ export { __niceevalExport12 as createCodexThreadEventStream };
30
+ const __niceevalExport13 = __niceevalCanonical["createLangGraphEventStream"];
31
+ export { __niceevalExport13 as createLangGraphEventStream };
32
+ const __niceevalExport14 = __niceevalCanonical["createNpmCliInstaller"];
33
+ export { __niceevalExport14 as createNpmCliInstaller };
34
+ const __niceevalExport15 = __niceevalCanonical["createPiAgentEventStream"];
35
+ export { __niceevalExport15 as createPiAgentEventStream };
36
+ const __niceevalExport16 = __niceevalCanonical["createSessionSlot"];
37
+ export { __niceevalExport16 as createSessionSlot };
38
+ const __niceevalExport17 = __niceevalCanonical["deepSeekHarnessAgent"];
39
+ export { __niceevalExport17 as deepSeekHarnessAgent };
40
+ const __niceevalExport18 = __niceevalCanonical["defineAgent"];
41
+ export { __niceevalExport18 as defineAgent };
42
+ const __niceevalExport19 = __niceevalCanonical["defineSandboxAgent"];
43
+ export { __niceevalExport19 as defineSandboxAgent };
44
+ const __niceevalExport20 = __niceevalCanonical["deltaStream"];
45
+ export { __niceevalExport20 as deltaStream };
46
+ const __niceevalExport21 = __niceevalCanonical["driveFrameStream"];
47
+ export { __niceevalExport21 as driveFrameStream };
48
+ const __niceevalExport22 = __niceevalCanonical["externalCauseMessageChain"];
49
+ export { __niceevalExport22 as externalCauseMessageChain };
50
+ const __niceevalExport23 = __niceevalCanonical["externalCauseText"];
51
+ export { __niceevalExport23 as externalCauseText };
52
+ const __niceevalExport24 = __niceevalCanonical["hermesAgent"];
53
+ export { __niceevalExport24 as hermesAgent };
54
+ const __niceevalExport25 = __niceevalCanonical["heuristicTag"];
55
+ export { __niceevalExport25 as heuristicTag };
56
+ const __niceevalExport26 = __niceevalCanonical["makeSendFailure"];
57
+ export { __niceevalExport26 as makeSendFailure };
58
+ const __niceevalExport27 = __niceevalCanonical["mapCodexSpans"];
59
+ export { __niceevalExport27 as mapCodexSpans };
60
+ const __niceevalExport28 = __niceevalCanonical["normalizeExternalCause"];
61
+ export { __niceevalExport28 as normalizeExternalCause };
62
+ const __niceevalExport29 = __niceevalCanonical["normalizeLogicalCommand"];
63
+ export { __niceevalExport29 as normalizeLogicalCommand };
64
+ const __niceevalExport30 = __niceevalCanonical["notCommandProjection"];
65
+ export { __niceevalExport30 as notCommandProjection };
66
+ const __niceevalExport31 = __niceevalCanonical["ompAgent"];
67
+ export { __niceevalExport31 as ompAgent };
68
+ const __niceevalExport32 = __niceevalCanonical["opaqueCommandProjection"];
69
+ export { __niceevalExport32 as opaqueCommandProjection };
70
+ const __niceevalExport33 = __niceevalCanonical["openClawAgent"];
71
+ export { __niceevalExport33 as openClawAgent };
72
+ const __niceevalExport34 = __niceevalCanonical["openCodeAgent"];
73
+ export { __niceevalExport34 as openCodeAgent };
74
+ const __niceevalExport35 = __niceevalCanonical["responsesEvidenceCoverage"];
75
+ export { __niceevalExport35 as responsesEvidenceCoverage };
76
+ const __niceevalExport36 = __niceevalCanonical["sendFailureText"];
77
+ export { __niceevalExport36 as sendFailureText };
78
+ const __niceevalExport37 = __niceevalCanonical["shared"];
79
+ export { __niceevalExport37 as shared };
80
+ const __niceevalExport38 = __niceevalCanonical["sseJsonFrames"];
81
+ export { __niceevalExport38 as sseJsonFrames };
82
+ const __niceevalExport39 = __niceevalCanonical["tagSpan"];
83
+ export { __niceevalExport39 as tagSpan };
84
+ const __niceevalExport40 = __niceevalCanonical["turnFromAiSdk"];
85
+ export { __niceevalExport40 as turnFromAiSdk };
86
+ const __niceevalExport41 = __niceevalCanonical["turnFromChatCompletion"];
87
+ export { __niceevalExport41 as turnFromChatCompletion };
88
+ const __niceevalExport42 = __niceevalCanonical["turnFromResponses"];
89
+ export { __niceevalExport42 as turnFromResponses };
90
+ const __niceevalExport43 = __niceevalCanonical["uiMessageStreamAgent"];
91
+ export { __niceevalExport43 as uiMessageStreamAgent };
90
92
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ManagedJsonlDriver = void 0;
4
+ const backend_ts_1 = require("../sandbox/backend.cjs");
5
+ const encoder = new TextEncoder();
6
+ function timeout(promise, milliseconds) {
7
+ return new Promise((resolve, reject) => {
8
+ const timer = setTimeout(() => reject(new Error(`managed process did not exit within ${milliseconds}ms`)), milliseconds);
9
+ promise.then((value) => { clearTimeout(timer); resolve(value); }, (error) => { clearTimeout(timer); reject(error); });
10
+ });
11
+ }
12
+ class ManagedJsonlDriver {
13
+ process;
14
+ shutdownFrame;
15
+ onFrame;
16
+ frames = [];
17
+ waiters = new Set();
18
+ stderrText = "";
19
+ outputFailure;
20
+ state = "open";
21
+ revision = 0;
22
+ shutdownReceipt;
23
+ releaseReceipt;
24
+ writes = Promise.resolve();
25
+ exit;
26
+ observedExit;
27
+ constructor(process, shutdownFrame, onFrame) {
28
+ this.process = process;
29
+ this.shutdownFrame = shutdownFrame;
30
+ this.onFrame = onFrame;
31
+ this.exit = process.wait().then((receipt) => {
32
+ this.observedExit = receipt;
33
+ this.state = "closed";
34
+ return receipt;
35
+ });
36
+ void this.consume();
37
+ }
38
+ static async start(sandbox, agent, resources, input, shutdownFrame, onFrame) {
39
+ const startProcess = (0, backend_ts_1.requireManagedProcessCapability)(sandbox, agent);
40
+ return resources.acquire(async () => {
41
+ const process = await startProcess(input);
42
+ try {
43
+ return new ManagedJsonlDriver(process, shutdownFrame, onFrame);
44
+ }
45
+ catch (cause) {
46
+ // The process exists but the registry has not received a Driver yet.
47
+ // Close this constructor gap locally with the same bounded cleanup.
48
+ await process.closeStdin().catch(() => undefined);
49
+ await process.terminate().catch(() => undefined);
50
+ await timeout(process.wait(), 2000).catch(() => undefined);
51
+ throw cause;
52
+ }
53
+ }, {
54
+ shutdown: (driver) => driver.shutdown(),
55
+ release: (driver) => driver.release(),
56
+ });
57
+ }
58
+ cursor() { return this.frames.length; }
59
+ stderr() { return this.stderrText; }
60
+ processReceipt() {
61
+ return {
62
+ ...(this.observedExit?.exitCode == null ? {} : { exitCode: this.observedExit.exitCode }),
63
+ ...(this.observedExit?.signal === undefined ? {} : { signal: this.observedExit.signal }),
64
+ stderr: this.stderrText,
65
+ };
66
+ }
67
+ async write(value) {
68
+ if (this.state !== "open")
69
+ throw new Error("managed process stdin is closing or closed");
70
+ const receipt = this.writes.then(() => this.writeRaw(value));
71
+ this.writes = receipt.catch(() => undefined);
72
+ await receipt;
73
+ }
74
+ async waitFor(cursor, accept, signal) {
75
+ let next = cursor;
76
+ for (;;) {
77
+ while (next < this.frames.length) {
78
+ const frame = this.frames[next++];
79
+ if (accept(frame))
80
+ return { frame, cursor: next };
81
+ }
82
+ if (this.outputFailure !== undefined)
83
+ throw this.outputFailure;
84
+ const observedRevision = this.revision;
85
+ const outcome = await Promise.race([
86
+ this.waitForChange(observedRevision, signal).then(() => ({ exited: false })),
87
+ this.exit.then((receipt) => ({ exited: true, receipt })),
88
+ ]);
89
+ if (outcome.exited && next >= this.frames.length) {
90
+ throw new Error(`managed process exited before the expected protocol frame (exitCode=${outcome.receipt.exitCode ?? "null"}, signal=${outcome.receipt.signal ?? "none"})${this.stderrText ? `: ${this.stderrText.slice(-1000)}` : ""}`);
91
+ }
92
+ }
93
+ }
94
+ framesSince(cursor) { return this.frames.slice(cursor); }
95
+ frameKinds() {
96
+ return this.frames.slice(-12).map((value) => {
97
+ if (value === null || typeof value !== "object" || Array.isArray(value))
98
+ return typeof value;
99
+ const frame = value;
100
+ return String(frame.type ?? frame.method ?? (frame.id === undefined ? "object" : `response:${String(frame.id)}`));
101
+ }).join(",");
102
+ }
103
+ shutdown() {
104
+ return this.shutdownReceipt ??= (async () => {
105
+ if (this.state !== "open")
106
+ return;
107
+ this.state = "closing";
108
+ await this.writes;
109
+ const frame = this.shutdownFrame?.();
110
+ if (frame !== undefined)
111
+ await this.writeRaw(frame).catch(() => undefined);
112
+ await this.process.closeStdin().catch(() => undefined);
113
+ this.state = "closed";
114
+ })();
115
+ }
116
+ release() {
117
+ return this.releaseReceipt ??= (async () => {
118
+ await this.shutdown();
119
+ try {
120
+ await timeout(this.exit, 2000);
121
+ }
122
+ catch {
123
+ await this.process.terminate();
124
+ await timeout(this.exit, 2000);
125
+ }
126
+ })();
127
+ }
128
+ async consume() {
129
+ const stdoutDecoder = new TextDecoder();
130
+ const stderrDecoder = new TextDecoder();
131
+ let stdout = "";
132
+ try {
133
+ for await (const chunk of this.process.output) {
134
+ if (chunk._tag === "Stderr") {
135
+ this.stderrText += stderrDecoder.decode(chunk.bytes, { stream: true });
136
+ continue;
137
+ }
138
+ stdout += stdoutDecoder.decode(chunk.bytes, { stream: true });
139
+ for (;;) {
140
+ const newline = stdout.indexOf("\n");
141
+ if (newline < 0)
142
+ break;
143
+ const line = stdout.slice(0, newline).trim();
144
+ stdout = stdout.slice(newline + 1);
145
+ if (!line)
146
+ continue;
147
+ const frame = JSON.parse(line);
148
+ this.frames.push(frame);
149
+ this.onFrame?.(frame);
150
+ this.notify();
151
+ }
152
+ }
153
+ const tail = `${stdout}${stdoutDecoder.decode()}`.trim();
154
+ if (tail) {
155
+ const frame = JSON.parse(tail);
156
+ this.frames.push(frame);
157
+ this.onFrame?.(frame);
158
+ this.notify();
159
+ }
160
+ this.stderrText += stderrDecoder.decode();
161
+ }
162
+ catch (error) {
163
+ this.outputFailure = error;
164
+ }
165
+ finally {
166
+ this.notify();
167
+ }
168
+ }
169
+ writeRaw(value) {
170
+ return this.process.writeStdin(encoder.encode(`${JSON.stringify(value)}\n`));
171
+ }
172
+ waitForChange(observedRevision, signal) {
173
+ if (signal.aborted)
174
+ return Promise.reject(signal.reason);
175
+ return new Promise((resolve, reject) => {
176
+ let settled = false;
177
+ const cleanup = () => { signal.removeEventListener("abort", aborted); this.waiters.delete(done); };
178
+ const done = () => {
179
+ if (settled)
180
+ return;
181
+ settled = true;
182
+ cleanup();
183
+ resolve();
184
+ };
185
+ const aborted = () => {
186
+ if (settled)
187
+ return;
188
+ settled = true;
189
+ cleanup();
190
+ reject(signal.reason);
191
+ };
192
+ this.waiters.add(done);
193
+ signal.addEventListener("abort", aborted, { once: true });
194
+ if (signal.aborted)
195
+ aborted();
196
+ else if (this.revision !== observedRevision)
197
+ done();
198
+ });
199
+ }
200
+ notify() {
201
+ this.revision += 1;
202
+ for (const waiter of [...this.waiters])
203
+ waiter();
204
+ }
205
+ }
206
+ exports.ManagedJsonlDriver = ManagedJsonlDriver;
207
+ //# sourceMappingURL=managed-jsonl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"managed-jsonl.js","sourceRoot":"","sources":["managed-jsonl.ts"],"names":[],"mappings":";;;AACA,sDAAwE;AACxE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,SAAS,OAAO,CAAI,OAAmB,EAAE,YAAoB;IACzD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,uCAAuC,YAAY,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QACzH,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1H,CAAC,CAAC,CAAC;AACP,CAAC;AACD,MAAa,kBAAkB;IAYU;IAA0C;IAAyE;IAXv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C,CAAC;QACnB,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;YAClC,MAAM,EAAE,CAAC;IACjB,CAAC;CACJ;AAlMD,gDAkMC","sourcesContent":["import type { AgentContext, ManagedProcess, ManagedProcessStart, Sandbox } from \"../types.ts\";\nimport { requireManagedProcessCapability } from \"../sandbox/backend.ts\";\nconst encoder = new TextEncoder();\nfunction timeout<T>(promise: Promise<T>, milliseconds: number): Promise<T> {\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => reject(new Error(`managed process did not exit within ${milliseconds}ms`)), milliseconds);\n promise.then((value) => { clearTimeout(timer); resolve(value); }, (error) => { clearTimeout(timer); reject(error); });\n });\n}\nexport class ManagedJsonlDriver {\n private readonly frames: unknown[] = [];\n private readonly waiters = new Set<() => void>();\n private stderrText = \"\";\n private outputFailure: unknown;\n private state: \"open\" | \"closing\" | \"closed\" = \"open\";\n private revision = 0;\n private shutdownReceipt?: Promise<void>;\n private releaseReceipt?: Promise<void>;\n private writes: Promise<void> = Promise.resolve();\n private readonly exit: ReturnType<ManagedProcess[\"wait\"]>;\n private observedExit?: Awaited<ReturnType<ManagedProcess[\"wait\"]>>;\n private constructor(private readonly process: ManagedProcess, private readonly shutdownFrame: (() => unknown | undefined) | undefined, private readonly onFrame: ((frame: unknown) => void) | undefined) {\n this.exit = process.wait().then((receipt) => {\n this.observedExit = receipt;\n this.state = \"closed\";\n return receipt;\n });\n void this.consume();\n }\n static async start(sandbox: Sandbox, agent: string, resources: import(\"../types.ts\").AttemptResourceRegistry, input: ManagedProcessStart, shutdownFrame?: () => unknown | undefined, onFrame?: (frame: unknown) => void): Promise<ManagedJsonlDriver> {\n const startProcess = requireManagedProcessCapability(sandbox, agent);\n return resources.acquire(async () => {\n const process = await startProcess(input);\n try {\n return new ManagedJsonlDriver(process, shutdownFrame, onFrame);\n }\n catch (cause) {\n // The process exists but the registry has not received a Driver yet.\n // Close this constructor gap locally with the same bounded cleanup.\n await process.closeStdin().catch(() => undefined);\n await process.terminate().catch(() => undefined);\n await timeout(process.wait(), 2000).catch(() => undefined);\n throw cause;\n }\n }, {\n shutdown: (driver) => driver.shutdown(),\n release: (driver) => driver.release(),\n });\n }\n cursor(): number { return this.frames.length; }\n stderr(): string { return this.stderrText; }\n processReceipt(): {\n readonly exitCode?: number;\n readonly signal?: string;\n readonly stderr: string;\n } {\n return {\n ...(this.observedExit?.exitCode == null ? {} : { exitCode: this.observedExit.exitCode }),\n ...(this.observedExit?.signal === undefined ? {} : { signal: this.observedExit.signal }),\n stderr: this.stderrText,\n };\n }\n async write(value: unknown): Promise<void> {\n if (this.state !== \"open\")\n throw new Error(\"managed process stdin is closing or closed\");\n const receipt = this.writes.then(() => this.writeRaw(value));\n this.writes = receipt.catch(() => undefined);\n await receipt;\n }\n async waitFor(cursor: number, accept: (frame: unknown) => boolean, signal: AbortSignal): Promise<{\n readonly frame: unknown;\n readonly cursor: number;\n }> {\n let next = cursor;\n for (;;) {\n while (next < this.frames.length) {\n const frame = this.frames[next++]!;\n if (accept(frame))\n return { frame, cursor: next };\n }\n if (this.outputFailure !== undefined)\n throw this.outputFailure;\n const observedRevision = this.revision;\n const outcome = await Promise.race([\n this.waitForChange(observedRevision, signal).then(() => ({ exited: false as const })),\n this.exit.then((receipt) => ({ exited: true as const, receipt })),\n ]);\n if (outcome.exited && next >= this.frames.length) {\n throw new Error(`managed process exited before the expected protocol frame (exitCode=${outcome.receipt.exitCode ?? \"null\"}, signal=${outcome.receipt.signal ?? \"none\"})${this.stderrText ? `: ${this.stderrText.slice(-1000)}` : \"\"}`);\n }\n }\n }\n framesSince(cursor: number): readonly unknown[] { return this.frames.slice(cursor); }\n frameKinds(): string {\n return this.frames.slice(-12).map((value) => {\n if (value === null || typeof value !== \"object\" || Array.isArray(value))\n return typeof value;\n const frame = value as Record<string, unknown>;\n return String(frame.type ?? frame.method ?? (frame.id === undefined ? \"object\" : `response:${String(frame.id)}`));\n }).join(\",\");\n }\n shutdown(): Promise<void> {\n return this.shutdownReceipt ??= (async () => {\n if (this.state !== \"open\")\n return;\n this.state = \"closing\";\n await this.writes;\n const frame = this.shutdownFrame?.();\n if (frame !== undefined)\n await this.writeRaw(frame).catch(() => undefined);\n await this.process.closeStdin().catch(() => undefined);\n this.state = \"closed\";\n })();\n }\n release(): Promise<void> {\n return this.releaseReceipt ??= (async () => {\n await this.shutdown();\n try {\n await timeout(this.exit, 2000);\n }\n catch {\n await this.process.terminate();\n await timeout(this.exit, 2000);\n }\n })();\n }\n private async consume(): Promise<void> {\n const stdoutDecoder = new TextDecoder();\n const stderrDecoder = new TextDecoder();\n let stdout = \"\";\n try {\n for await (const chunk of this.process.output) {\n if (chunk._tag === \"Stderr\") {\n this.stderrText += stderrDecoder.decode(chunk.bytes, { stream: true });\n continue;\n }\n stdout += stdoutDecoder.decode(chunk.bytes, { stream: true });\n for (;;) {\n const newline = stdout.indexOf(\"\\n\");\n if (newline < 0)\n break;\n const line = stdout.slice(0, newline).trim();\n stdout = stdout.slice(newline + 1);\n if (!line)\n continue;\n const frame: unknown = JSON.parse(line);\n this.frames.push(frame);\n this.onFrame?.(frame);\n this.notify();\n }\n }\n const tail = `${stdout}${stdoutDecoder.decode()}`.trim();\n if (tail) {\n const frame: unknown = JSON.parse(tail);\n this.frames.push(frame);\n this.onFrame?.(frame);\n this.notify();\n }\n this.stderrText += stderrDecoder.decode();\n }\n catch (error) {\n this.outputFailure = error;\n }\n finally {\n this.notify();\n }\n }\n private writeRaw(value: unknown): Promise<void> {\n return this.process.writeStdin(encoder.encode(`${JSON.stringify(value)}\\n`));\n }\n private waitForChange(observedRevision: number, signal: AbortSignal): Promise<void> {\n if (signal.aborted)\n return Promise.reject(signal.reason);\n return new Promise((resolve, reject) => {\n let settled = false;\n const cleanup = (): void => { signal.removeEventListener(\"abort\", aborted); this.waiters.delete(done); };\n const done = (): void => {\n if (settled)\n return;\n settled = true;\n cleanup();\n resolve();\n };\n const aborted = (): void => {\n if (settled)\n return;\n settled = true;\n cleanup();\n reject(signal.reason);\n };\n this.waiters.add(done);\n signal.addEventListener(\"abort\", aborted, { once: true });\n if (signal.aborted)\n aborted();\n else if (this.revision !== observedRevision)\n done();\n });\n }\n private notify(): void {\n this.revision += 1;\n for (const waiter of [...this.waiters])\n waiter();\n }\n}\n"]}