openpond 0.2.55 → 0.2.56

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 (399) hide show
  1. package/dist/app-server.d.ts +10545 -10254
  2. package/dist/app-server.js +1 -1
  3. package/dist/chunks/actions-command-QU4H53OG.js +2 -0
  4. package/dist/chunks/{app-layer-Y2UERCPY.js → app-layer-NSTE5HIT.js} +1 -1
  5. package/dist/chunks/app-server-connected-apps-JHGWLBXT.js +2 -0
  6. package/dist/chunks/app-server-evaluations-GJPFWIDA.js +2 -0
  7. package/dist/chunks/app-server-harness-services-IH4G6POY.js +2 -0
  8. package/dist/chunks/app-server-runtime-DVKOZ5B6.js +2 -0
  9. package/dist/chunks/apps-BKTOR4F7.js +2 -0
  10. package/dist/chunks/chunk-25MBPJVY.js +2 -0
  11. package/dist/chunks/chunk-2D4Y3HNW.js +2 -0
  12. package/dist/chunks/chunk-2IHO4GDJ.js +2 -0
  13. package/dist/chunks/chunk-2QUCCP6Z.js +2 -0
  14. package/dist/chunks/chunk-3K4VVB7S.js +6 -0
  15. package/dist/chunks/chunk-3QIB5FXI.js +10 -0
  16. package/dist/chunks/chunk-3RCRSMWZ.js +17 -0
  17. package/dist/chunks/chunk-3VUATFZD.js +2 -0
  18. package/dist/chunks/chunk-3Z47M3YY.js +2 -0
  19. package/dist/chunks/{chunk-UA5DA5I2.js → chunk-4D7HWVWD.js} +1 -1
  20. package/dist/chunks/chunk-4EPSHPZL.js +2 -0
  21. package/dist/chunks/chunk-4NESNOK5.js +2 -0
  22. package/dist/chunks/chunk-523TE4BI.js +2 -0
  23. package/dist/chunks/{chunk-B7QDZPNX.js → chunk-5MCNZCVQ.js} +1 -1
  24. package/dist/chunks/{chunk-DLVPSCTB.js → chunk-6QSSIT62.js} +1 -1
  25. package/dist/chunks/chunk-6ZFPQYHG.js +2 -0
  26. package/dist/chunks/chunk-74IIXVAE.js +2 -0
  27. package/dist/chunks/chunk-74ZXXBGN.js +6 -0
  28. package/dist/chunks/chunk-773TH7FN.js +2 -0
  29. package/dist/chunks/chunk-7E6T7GP5.js +2 -0
  30. package/dist/chunks/chunk-7ED24PP6.js +2 -0
  31. package/dist/chunks/chunk-7HPDGZOR.js +86 -0
  32. package/dist/chunks/chunk-7KWD2I6W.js +2 -0
  33. package/dist/chunks/chunk-7PXZ4X4P.js +2 -0
  34. package/dist/chunks/chunk-A6USMRWK.js +2 -0
  35. package/dist/chunks/chunk-ABD5M2D2.js +2 -0
  36. package/dist/chunks/chunk-ACYFMLWG.js +10 -0
  37. package/dist/chunks/chunk-AN525SPP.js +6 -0
  38. package/dist/chunks/chunk-APB2STJK.js +2 -0
  39. package/dist/chunks/chunk-AY64VY4E.js +2 -0
  40. package/dist/chunks/{chunk-G6JMQGX7.js → chunk-B7RFL4N2.js} +1 -1
  41. package/dist/chunks/chunk-BLXEAZCQ.js +12 -0
  42. package/dist/chunks/chunk-D74JEERO.js +5 -0
  43. package/dist/chunks/{chunk-U2YMBCX7.js → chunk-DARVPBZ4.js} +1 -1
  44. package/dist/chunks/chunk-DBK66CJP.js +8 -0
  45. package/dist/chunks/chunk-DDMZSZFL.js +1 -0
  46. package/dist/chunks/chunk-DIO5CB6U.js +2 -0
  47. package/dist/chunks/chunk-DMFUEUAZ.js +5 -0
  48. package/dist/chunks/chunk-DMVD2RFZ.js +2 -0
  49. package/dist/chunks/chunk-DUURYZOI.js +2 -0
  50. package/dist/chunks/chunk-DZUAT3TP.js +1 -0
  51. package/dist/chunks/chunk-EIEZHFIW.js +6 -0
  52. package/dist/chunks/chunk-EIRYMSEG.js +19 -0
  53. package/dist/chunks/{chunk-R27YGT77.js → chunk-EKM2D7JU.js} +1 -1
  54. package/dist/chunks/chunk-EQFGBL3O.js +2 -0
  55. package/dist/chunks/chunk-EYPCBBMS.js +2 -0
  56. package/dist/chunks/chunk-F4KOGISR.js +10 -0
  57. package/dist/chunks/chunk-F74GBN6K.js +2 -0
  58. package/dist/chunks/chunk-FEAKTSRS.js +2 -0
  59. package/dist/chunks/chunk-FFRFSDBM.js +2 -0
  60. package/dist/chunks/chunk-FTEOCCPB.js +23 -0
  61. package/dist/chunks/chunk-FUOEIDMA.js +8 -0
  62. package/dist/chunks/{chunk-BQAF5P7K.js → chunk-FV2R5RUN.js} +2 -2
  63. package/dist/chunks/chunk-FWIPHEVA.js +12 -0
  64. package/dist/chunks/chunk-FY5KHLMW.js +2 -0
  65. package/dist/chunks/chunk-G3RXYI2L.js +6 -0
  66. package/dist/chunks/chunk-GJ2ZJFDD.js +2 -0
  67. package/dist/chunks/chunk-GLDYJM7O.js +1 -0
  68. package/dist/chunks/chunk-GPVCOEUH.js +2 -0
  69. package/dist/chunks/chunk-GW766ZSO.js +5 -0
  70. package/dist/chunks/chunk-GWCHDF2C.js +4 -0
  71. package/dist/chunks/chunk-GZ7M5XBP.js +2 -0
  72. package/dist/chunks/chunk-H6IW2R22.js +140 -0
  73. package/dist/chunks/chunk-HCYX6RHP.js +2 -0
  74. package/dist/chunks/chunk-HDL5YSAA.js +2 -0
  75. package/dist/chunks/chunk-HIOKCIL7.js +2 -0
  76. package/dist/chunks/{chunk-IODUCRBA.js → chunk-HY3GOBFJ.js} +1 -1
  77. package/dist/chunks/chunk-HZEIRHEB.js +2 -0
  78. package/dist/chunks/chunk-I2NXNMRZ.js +2 -0
  79. package/dist/chunks/chunk-I7AQMAQI.js +33 -0
  80. package/dist/chunks/chunk-IZ6DLEVY.js +2 -0
  81. package/dist/chunks/chunk-J2TWKFML.js +1871 -0
  82. package/dist/chunks/chunk-JDEEWOD7.js +2 -0
  83. package/dist/chunks/chunk-JFXWI3EN.js +6 -0
  84. package/dist/chunks/chunk-JYKRR7E5.js +5 -0
  85. package/dist/chunks/chunk-KCJVFLBB.js +2 -0
  86. package/dist/chunks/{chunk-5CMKGD43.js → chunk-KG325WTN.js} +1 -1
  87. package/dist/chunks/chunk-KUERKVEU.js +3 -0
  88. package/dist/chunks/chunk-KVTBX2UP.js +2 -0
  89. package/dist/chunks/chunk-L3KS6MOV.js +2 -0
  90. package/dist/chunks/chunk-L6K7ERG5.js +2 -0
  91. package/dist/chunks/{chunk-MH3LHSGX.js → chunk-LQQNBVEB.js} +1 -1
  92. package/dist/chunks/{chunk-BTI4N7YO.js → chunk-M4JWQSV7.js} +1 -1
  93. package/dist/chunks/chunk-MQULU465.js +2 -0
  94. package/dist/chunks/chunk-N4FFQPLR.js +2 -0
  95. package/dist/chunks/chunk-N73MU2C3.js +2 -0
  96. package/dist/chunks/chunk-NHQ36THU.js +3 -0
  97. package/dist/chunks/chunk-O6ULLQJ6.js +2 -0
  98. package/dist/chunks/chunk-O72BSKSO.js +2 -0
  99. package/dist/chunks/chunk-OGDADQGH.js +143 -0
  100. package/dist/chunks/chunk-OIUTWU6K.js +2 -0
  101. package/dist/chunks/chunk-OLLLZVHF.js +2 -0
  102. package/dist/chunks/chunk-OPNRWESL.js +3 -0
  103. package/dist/chunks/chunk-OQKJGTTO.js +4 -0
  104. package/dist/chunks/chunk-OQPJ7FJF.js +9 -0
  105. package/dist/chunks/{chunk-TERVLCRG.js → chunk-OS3LO5J3.js} +1 -1
  106. package/dist/chunks/chunk-OUVIWDL2.js +2 -0
  107. package/dist/chunks/chunk-PCSIOUHF.js +7 -0
  108. package/dist/chunks/chunk-PF5R6CMP.js +21 -0
  109. package/dist/chunks/chunk-PPAPVGJP.js +3 -0
  110. package/dist/chunks/chunk-PRGBLQVH.js +2 -0
  111. package/dist/chunks/chunk-PSGGOZFM.js +2 -0
  112. package/dist/chunks/chunk-PUZQU66L.js +2 -0
  113. package/dist/chunks/{chunk-NOTXPD2T.js → chunk-Q2QL6UWN.js} +1 -1
  114. package/dist/chunks/chunk-Q4TBTRIG.js +2 -0
  115. package/dist/chunks/chunk-Q5LEXXJG.js +16 -0
  116. package/dist/chunks/chunk-QDC4OW3S.js +2 -0
  117. package/dist/chunks/chunk-QEFHOJFE.js +7 -0
  118. package/dist/chunks/chunk-QHWGQ3A4.js +5 -0
  119. package/dist/chunks/chunk-QIKWJ2AA.js +11 -0
  120. package/dist/chunks/chunk-QNG27G3T.js +6 -0
  121. package/dist/chunks/chunk-QOGJAQDO.js +3 -0
  122. package/dist/chunks/chunk-QOTVNQDI.js +4 -0
  123. package/dist/chunks/{chunk-NNIRIUSY.js → chunk-RAXOSUSW.js} +1 -1
  124. package/dist/chunks/chunk-RNIAFXMB.js +50 -0
  125. package/dist/chunks/{chunk-SHQOIROR.js → chunk-S5ESN275.js} +3 -3
  126. package/dist/chunks/chunk-SDAUS5PY.js +2 -0
  127. package/dist/chunks/chunk-SDXFLO7J.js +5 -0
  128. package/dist/chunks/chunk-SH5CBAFC.js +2 -0
  129. package/dist/chunks/chunk-SWUEFLOH.js +2 -0
  130. package/dist/chunks/chunk-SYUKES6H.js +3 -0
  131. package/dist/chunks/chunk-T5AACNJI.js +2 -0
  132. package/dist/chunks/chunk-TRQQNFMO.js +4 -0
  133. package/dist/chunks/chunk-TVQAPBLZ.js +2 -0
  134. package/dist/chunks/chunk-UCPGRPWY.js +2 -0
  135. package/dist/chunks/chunk-UGL7WF3W.js +2 -0
  136. package/dist/chunks/chunk-UHFZHBGW.js +2 -0
  137. package/dist/chunks/{chunk-C6D4WAYN.js → chunk-UKMA4R6X.js} +2 -2
  138. package/dist/chunks/{chunk-4WEUCGJ3.js → chunk-VRIEKBBH.js} +1 -1
  139. package/dist/chunks/chunk-VYLGI3IH.js +13 -0
  140. package/dist/chunks/chunk-W45RKGM6.js +1 -0
  141. package/dist/chunks/chunk-WJ43MJ3F.js +2 -0
  142. package/dist/chunks/chunk-WMKYHXVM.js +3 -0
  143. package/dist/chunks/chunk-WN3V6KDN.js +3 -0
  144. package/dist/chunks/chunk-X4OSOOSU.js +3 -0
  145. package/dist/chunks/chunk-XDQMGUWL.js +2 -0
  146. package/dist/chunks/chunk-XTFPDQMH.js +3 -0
  147. package/dist/chunks/chunk-XVDFJ3ZF.js +2 -0
  148. package/dist/chunks/chunk-XW6HGSIT.js +8 -0
  149. package/dist/chunks/chunk-XXYGGNVM.js +2 -0
  150. package/dist/chunks/chunk-Y4OWBBDD.js +184 -0
  151. package/dist/chunks/chunk-YBT2NB32.js +2 -0
  152. package/dist/chunks/chunk-YCJO3YVD.js +10 -0
  153. package/dist/chunks/{chunk-QRAKXZOC.js → chunk-YOBN7KTF.js} +6 -6
  154. package/dist/chunks/chunk-YOQRYNLP.js +2 -0
  155. package/dist/chunks/chunk-YY7LEQGP.js +2 -0
  156. package/dist/chunks/chunk-Z4Z5UOZM.js +22 -0
  157. package/dist/chunks/chunk-Z54O534A.js +3 -0
  158. package/dist/chunks/chunk-ZCHXGRRU.js +2 -0
  159. package/dist/chunks/chunk-ZFSHBFG5.js +40 -0
  160. package/dist/chunks/chunk-ZGTOK7ZK.js +12 -0
  161. package/dist/chunks/{chunk-Q7AXHFZV.js → chunk-ZRDGQDZL.js} +1 -1
  162. package/dist/chunks/chunk-ZUJ3XUCP.js +2 -0
  163. package/dist/chunks/chunk-ZZWAQBA2.js +2 -0
  164. package/dist/chunks/cli-X25RSO2X.js +2 -0
  165. package/dist/chunks/configuration-command-6C5UO7GE.js +2 -0
  166. package/dist/chunks/connected-app-executor-IVLGQP65.js +2 -0
  167. package/dist/chunks/connected-evidence-GH2ATNEX.js +2 -0
  168. package/dist/chunks/connection-HTF6CC7M.js +2 -0
  169. package/dist/chunks/{continual-TTGJ6YTR.js → continual-6CQAMTTR.js} +3 -3
  170. package/dist/chunks/core-commands-A2DGGIPS.js +2 -0
  171. package/dist/chunks/datasets-7BNMVJOY.js +2 -0
  172. package/dist/chunks/desktop-test-3CUHVLXV.js +3 -0
  173. package/dist/chunks/dist-OMGUJYPD.js +2 -0
  174. package/dist/chunks/dist-VYC5VMQB.js +2 -0
  175. package/dist/chunks/{dist-FAJX2UBW.js → dist-ZVJPJLXR.js} +1 -1
  176. package/dist/chunks/enclave-QS4BUNDU.js +2 -0
  177. package/dist/chunks/evaluation-coordination-XEF5L7KZ.js +2 -0
  178. package/dist/chunks/experiment-improvements-KRX2DP27.js +2 -0
  179. package/dist/chunks/experiments-DFGQYA4O.js +2 -0
  180. package/dist/chunks/experiments-VFQGE4HC.js +2 -0
  181. package/dist/chunks/{extension-DWMY6D2R.js → extension-XKXXOP5N.js} +1 -1
  182. package/dist/chunks/{help-A72QDRNG.js → help-S7THC6IE.js} +1 -1
  183. package/dist/chunks/host-profile-evaluation-tools-JJQWJUBT.js +2 -0
  184. package/dist/chunks/host-profile-external-dataset-K3ICDHIP.js +2 -0
  185. package/dist/chunks/hosted-app-server-composition-BCOO5ANF.js +2 -0
  186. package/dist/chunks/hosted-experiment-improvement-NFSVS5TU.js +3 -0
  187. package/dist/chunks/hosted-harness-runtime-723S5ZSH.js +2 -0
  188. package/dist/chunks/hosted-profile-candidate-2S5LFUWD.js +3 -0
  189. package/dist/chunks/hosted-profile-compiler-2DQIFSXW.js +2 -0
  190. package/dist/chunks/hosted-profile-evaluation-control-76BTRTYD.js +2 -0
  191. package/dist/chunks/hosted-profile-evaluation-inspection-V6Z3A5XJ.js +3 -0
  192. package/dist/chunks/hosted-profile-evaluation-preparation-IDJYREW3.js +3 -0
  193. package/dist/chunks/hosted-tasksets-ANAE2PIW.js +2 -0
  194. package/dist/chunks/human-review-WR777ODH.js +2 -0
  195. package/dist/chunks/import-MLZUHITH.js +4 -0
  196. package/dist/chunks/learning-ACEVFL5M.js +2 -0
  197. package/dist/chunks/local-harness-improvement-runtime-JIQ6ZVDW.js +2 -0
  198. package/dist/chunks/local-harness-taskset-review-XVYTGAGK.js +2 -0
  199. package/dist/chunks/local-scope-HVF2GZ5W.js +2 -0
  200. package/dist/chunks/model-projects-QPO22JPA.js +2 -0
  201. package/dist/chunks/opchat-T4QTNEIY.js +3 -0
  202. package/dist/chunks/organizations-75L5DZDV.js +2 -0
  203. package/dist/chunks/{profile-NOZ6TVXL.js → profile-TFZMUEDR.js} +1 -1
  204. package/dist/chunks/profile-training-source-6GOT7AHM.js +2 -0
  205. package/dist/chunks/project-action-payload-7VGL7OER.js +2 -0
  206. package/dist/chunks/project-agent-6RRO233B.js +2 -0
  207. package/dist/chunks/published-experiment-source-DZFENAQA.js +2 -0
  208. package/dist/chunks/refiner-profile-service-UUIWFJVT.js +2 -0
  209. package/dist/chunks/runtime-A7OZXM43.js +6 -0
  210. package/dist/chunks/sandbox-command-IU5XFTJP.js +2 -0
  211. package/dist/chunks/{sandbox-template-LKGBDVJ4.js → sandbox-template-C4V6T36U.js} +1 -1
  212. package/dist/chunks/saved-work-6BMBFP43.js +2 -0
  213. package/dist/chunks/send-turn-XTAIS2JN.js +2 -0
  214. package/dist/chunks/src-CJM6HY5Y.js +326 -0
  215. package/dist/chunks/{src-ZWJ5IO7A.js → src-LMC3K6LH.js} +1 -1
  216. package/dist/chunks/standalone-experiment-turn-owner-JCY5LL5R.js +2 -0
  217. package/dist/chunks/store-chat-workflows-S72HZXQR.js +18 -0
  218. package/dist/chunks/store-continual-support-reviews-HHA6NX7K.js +7 -0
  219. package/dist/chunks/store-conversation-serving-KPC62UEY.js +2 -0
  220. package/dist/chunks/store-create-improve-QV54XIZW.js +40 -0
  221. package/dist/chunks/store-datasets-RXJ33SUN.js +86 -0
  222. package/dist/chunks/store-evaluation-results-3F3P527G.js +7 -0
  223. package/dist/chunks/store-harness-evaluation-review-settings-I2R3HPO3.js +29 -0
  224. package/dist/chunks/store-harness-memory-VINCZ4GK.js +17 -0
  225. package/dist/chunks/store-harness-refinement-candidates-EA5KFQPH.js +21 -0
  226. package/dist/chunks/store-harness-workspaces-XUM4Z66X.js +2 -0
  227. package/dist/chunks/store-human-review-RAH7WMIP.js +7 -0
  228. package/dist/chunks/store-learned-preference-migration-validation-4CI2IRUF.js +2 -0
  229. package/dist/chunks/store-learning-WLG6KFIO.js +2 -0
  230. package/dist/chunks/store-learning-credentials-WZQJ4HPJ.js +2 -0
  231. package/dist/chunks/store-local-experiments-5LUJR7GI.js +97 -0
  232. package/dist/chunks/store-model-batch-review-YEGX327M.js +2 -0
  233. package/dist/chunks/store-model-configuration-5ZURQATB.js +3 -0
  234. package/dist/chunks/store-preference-comparison-LV32MHVL.js +6 -0
  235. package/dist/chunks/store-schedules-VGTEQVKH.js +53 -0
  236. package/dist/chunks/store-sidebar-file-bookmarks-VB5GTLFY.js +18 -0
  237. package/dist/chunks/store-sidebar-preferences-GWIOG2NH.js +16 -0
  238. package/dist/chunks/store-subagents-T7R2Z6TB.js +67 -0
  239. package/dist/chunks/store-task-inbox-JJTBW76C.js +33 -0
  240. package/dist/chunks/store-task-inventory-OB3F2APC.js +10 -0
  241. package/dist/chunks/store-taskset-drafts-EKQWWFYQ.js +9 -0
  242. package/dist/chunks/store-training-G6YLFSIR.js +70 -0
  243. package/dist/chunks/store-training-jobs-RC46YBF6.js +19 -0
  244. package/dist/chunks/store-training-models-6BA43IPP.js +49 -0
  245. package/dist/chunks/store-usage-IE2U2FD3.js +63 -0
  246. package/dist/chunks/store-work-evidence-QQDKM5AQ.js +8 -0
  247. package/dist/chunks/taskset-EQRFQBYM.js +2 -0
  248. package/dist/chunks/taskset-packages-XC6HEE3K.js +2 -0
  249. package/dist/chunks/{teams-bot-H7XT23XB.js → teams-bot-EAPGPTHZ.js} +1 -1
  250. package/dist/chunks/training-UF6RPI4T.js +2 -0
  251. package/dist/chunks/web-search-CZ3NCLPY.js +2 -0
  252. package/dist/chunks/workspaces-EKKE5NAC.js +2 -0
  253. package/dist/cli.js +1 -1
  254. package/dist/index.js +1 -1
  255. package/dist/web/assets/{App-CTlAPuCY.css → App-CaRMZoxo.css} +1 -1
  256. package/dist/web/assets/App-s-CJswyt.js +154 -0
  257. package/dist/web/assets/{AppDialog-CPHTPqrx.js → AppDialog-t2Fx5tK3.js} +1 -1
  258. package/dist/web/assets/{AppTerminalPanel-BVj5Tj93.js → AppTerminalPanel-Dj1Y32oI.js} +2 -2
  259. package/dist/web/assets/{AppsView-O69zEBY3.js → AppsView-BYE5EBDJ.js} +1 -1
  260. package/dist/web/assets/{BrowserSidebar-Pr_Kpe8p.js → BrowserSidebar-jhWi4rVm.js} +1 -1
  261. package/dist/web/assets/{CartesianChart-JPqo6YOf.js → CartesianChart-C1DIx0Ia.js} +1 -1
  262. package/dist/web/assets/{CollaborationTabs-CAJcQFn2.js → CollaborationTabs-Bdr-HmOL.js} +1 -1
  263. package/dist/web/assets/{CommandMenu-B-w53n9A.js → CommandMenu-Ux2yOHAc.js} +1 -1
  264. package/dist/web/assets/{CommunityView-DbZKK8_P.js → CommunityView-DPEeVKFn.js} +1 -1
  265. package/dist/web/assets/{ComposerCreateImproveStrip-3_083PF4.js → ComposerCreateImproveStrip-CEgh4OtN.js} +1 -1
  266. package/dist/web/assets/{GetStartedView-D7JGm_6c.js → GetStartedView-CFHP0AaI.js} +1 -1
  267. package/dist/web/assets/{HostedModelLearningReview-DwgMfZ7_.js → HostedModelLearningReview-D8BGTPVN.js} +1 -1
  268. package/dist/web/assets/{HostedModelLearningSettings-JRfQadRl.js → HostedModelLearningSettings-JS1S7vNO.js} +1 -1
  269. package/dist/web/assets/{LabModelVersionDetailPage-BUYflJY_.js → LabModelVersionDetailPage-Dx5Q3xV2.js} +1 -1
  270. package/dist/web/assets/{LabSkillSidebar-BBiqk7Rf.js → LabSkillSidebar-BxffN-pN.js} +1 -1
  271. package/dist/web/assets/{LabsRoute-Ci6vUnSd.js → LabsRoute-CyYF8-dw.js} +4 -4
  272. package/dist/web/assets/{MainChatThread-BQK3oI2N.js → MainChatThread-DZpcFRFl.js} +2 -2
  273. package/dist/web/assets/MainPane-5DTtwVCk.js +65 -0
  274. package/dist/web/assets/MainPane-BIM_UJ3q.css +1 -0
  275. package/dist/web/assets/{MarkdownText-DOdOVFXL.js → MarkdownText-BR4V6lNO.js} +21 -21
  276. package/dist/web/assets/{NativeSkillSidebar-CRI_ri8z.js → NativeSkillSidebar-DU9IEgIO.js} +1 -1
  277. package/dist/web/assets/{NewExperienceSwitcher-DhYtfE68.js → NewExperienceSwitcher-mIy6FzCj.js} +1 -1
  278. package/dist/web/assets/{NewProjectDialog-D8sy1gOz.js → NewProjectDialog-RfTZTHxl.js} +1 -1
  279. package/dist/web/assets/{OutputsPage-CbWgrhXA.js → OutputsPage-Cr1Spf7S.js} +1 -1
  280. package/dist/web/assets/{ProjectsPage-DLB67lyA.js → ProjectsPage-CE6QUB-b.js} +1 -1
  281. package/dist/web/assets/{RightChatPanelStack-ozSKnDyX.js → RightChatPanelStack-T6VRWuHo.js} +1 -1
  282. package/dist/web/assets/RightSidebarHomePanel-CK0rP3WT.js +1 -0
  283. package/dist/web/assets/{ScheduledWorkPage-Cafv_QnR.js → ScheduledWorkPage-vOrYv8pp.js} +1 -1
  284. package/dist/web/assets/SettingsView-DCKVrfjj.js +5 -0
  285. package/dist/web/assets/SettingsView-Dulr_xlq.css +1 -0
  286. package/dist/web/assets/{TeamChatView-vIrmXOY_.js → TeamChatView-Bwrjr-vk.js} +2 -2
  287. package/dist/web/assets/{TerminalOverlay-CAmF__Dq.js → TerminalOverlay-DhPoKZAq.js} +1 -1
  288. package/dist/web/assets/TrainingCreationPanel-BXHfohNm.js +1 -0
  289. package/dist/web/assets/{TrainingDraftPanel-D7XZePAk.js → TrainingDraftPanel-C9cRX5qf.js} +1 -1
  290. package/dist/web/assets/{UsageSettingsSection-CYTmp7PG.js → UsageSettingsSection-CrdcSGeW.js} +1 -1
  291. package/dist/web/assets/WorkSidebarPanel-DSSikNFQ.js +1 -0
  292. package/dist/web/assets/{WorkspaceDiffPanel-DQGoIjH9.js → WorkspaceDiffPanel-BAFo0CPN.js} +6 -6
  293. package/dist/web/assets/{WorkspaceEnvironmentMenu-c1pHDskn.js → WorkspaceEnvironmentMenu-BVHAhwnJ.js} +1 -1
  294. package/dist/web/assets/WorkspaceGitDialogs-CwVoiDQ2.js +1 -0
  295. package/dist/web/assets/{WorkspaceMonacoEditor-BCKzvSj2.js → WorkspaceMonacoEditor-TxLyhzNp.js} +3 -3
  296. package/dist/web/assets/{arrow-up-right-CP4hZdrJ.js → arrow-up-right-C9aE8Mfz.js} +1 -1
  297. package/dist/web/assets/{chunk-NOJECMB7-Bhcms-w5.js → chunk-P3BRSSRD-DUGfuKA8.js} +1 -1
  298. package/dist/web/assets/{clipboard-BgrXorn-.js → clipboard-Dk158Qp4.js} +1 -1
  299. package/dist/web/assets/{cloud-upload-B_zYztb6.js → cloud-upload-k9eqBsHr.js} +1 -1
  300. package/dist/web/assets/{cssMode-DanjGgA8.js → cssMode-CO35ARZp.js} +1 -1
  301. package/dist/web/assets/{folder-open-CdVKbtGq.js → folder-open-sYgceW_f.js} +1 -1
  302. package/dist/web/assets/{folder-plus-Cc5KElB6.js → folder-plus-CS0R49m9.js} +1 -1
  303. package/dist/web/assets/{git-commit-horizontal-CjGIIgRi.js → git-commit-horizontal-DrGxH2h4.js} +1 -1
  304. package/dist/web/assets/{htmlMode-DRGDF_UL.js → htmlMode-REMmzdfq.js} +1 -1
  305. package/dist/web/assets/index-3iPNbbER.css +1 -0
  306. package/dist/web/assets/{index-BE-wXZ5R.js → index-C8aCGagb.js} +2 -2
  307. package/dist/web/assets/{info-BLj0RvhA.js → info-DLdbiUrh.js} +1 -1
  308. package/dist/web/assets/{jsonMode-CCu0j2GD.js → jsonMode-KEdMfkIf.js} +1 -1
  309. package/dist/web/assets/{lspLanguageFeatures-s_Lhm7P6.js → lspLanguageFeatures-5KZwEoxW.js} +1 -1
  310. package/dist/web/assets/{minimize-2-Cyg_zD9z.js → minimize-2-CqcI4zcM.js} +1 -1
  311. package/dist/web/assets/{monaco.contribution-CY7mRgOB.js → monaco.contribution-BJGj65F9.js} +2 -2
  312. package/dist/web/assets/{monaco.contribution-CAzXvYkn.js → monaco.contribution-Cly9Wt7L.js} +2 -2
  313. package/dist/web/assets/{monaco.contribution-mUPNK9ra.js → monaco.contribution-DO10L0zW.js} +2 -2
  314. package/dist/web/assets/{monaco.contribution-aUeLcBEg.js → monaco.contribution-omszXBEj.js} +2 -2
  315. package/dist/web/assets/{monitor-DZvOs_wC.js → monitor-BFVCcbxp.js} +1 -1
  316. package/dist/web/assets/{play-BJPzemuY.js → play-C469pVZq.js} +1 -1
  317. package/dist/web/assets/{python-B_qnnVaG.js → python-Dw0YcVy9.js} +1 -1
  318. package/dist/web/assets/{save-BDy9tA3E.js → save-CtSjPydi.js} +1 -1
  319. package/dist/web/assets/{square-Cb2c5td4.js → square-BuImvLhT.js} +1 -1
  320. package/dist/web/assets/{toggleHighContrast-MhO1JLyR.js → toggleHighContrast-DjCO9lIP.js} +1 -1
  321. package/dist/web/assets/{tsMode-DfBXJb9V.js → tsMode-BAOnxKd6.js} +1 -1
  322. package/dist/web/assets/{upload-D56kThRh.js → upload-2JkFZo3h.js} +1 -1
  323. package/dist/web/assets/{useLocalAgentSchedules-DMnGfswi.js → useLocalAgentSchedules-BNqAisfS.js} +1 -1
  324. package/dist/web/assets/useProviderSettings-C4L4wDoh.js +5 -0
  325. package/dist/web/assets/{useProviderSettings-Bw-csWbH.css → useProviderSettings-CmL_BaxP.css} +1 -1
  326. package/dist/web/assets/{useSessionTurnCache-ClAY8gze.js → useSessionTurnCache-BHU2-Jmz.js} +1 -1
  327. package/dist/web/assets/{wifi-off-C9lWJmVm.js → wifi-off-CpOAH62M.js} +1 -1
  328. package/dist/web/assets/{workers-BYzrH8by.js → workers-0QvlA2T5.js} +1 -1
  329. package/dist/web/assets/{yaml-D3T8UkT3.js → yaml-BK3qxo7D.js} +1 -1
  330. package/dist/web/index.html +2 -2
  331. package/package.json +1 -1
  332. package/dist/chunks/actions-command-WTFZA7LF.js +0 -2
  333. package/dist/chunks/app-server-runtime-2RM3N4I6.js +0 -2
  334. package/dist/chunks/apps-KDNWYO3G.js +0 -2
  335. package/dist/chunks/chunk-2DFR7PJ4.js +0 -2460
  336. package/dist/chunks/chunk-4CRM2ADK.js +0 -2
  337. package/dist/chunks/chunk-55G6B54U.js +0 -6
  338. package/dist/chunks/chunk-73G5UYBB.js +0 -12
  339. package/dist/chunks/chunk-ARQEJOEK.js +0 -33
  340. package/dist/chunks/chunk-CGBI2VYJ.js +0 -2
  341. package/dist/chunks/chunk-GGIG3XU7.js +0 -3
  342. package/dist/chunks/chunk-JIMU3KDA.js +0 -24
  343. package/dist/chunks/chunk-JUJSA7KI.js +0 -22
  344. package/dist/chunks/chunk-K5SBVO3B.js +0 -195
  345. package/dist/chunks/chunk-KD3QVRIJ.js +0 -21
  346. package/dist/chunks/chunk-L4235TRQ.js +0 -140
  347. package/dist/chunks/chunk-MVF3F5QS.js +0 -2
  348. package/dist/chunks/chunk-OULAKUIN.js +0 -2
  349. package/dist/chunks/chunk-OWNLDB2O.js +0 -2
  350. package/dist/chunks/chunk-QDHMP5FS.js +0 -2
  351. package/dist/chunks/chunk-QKD5OMDI.js +0 -2
  352. package/dist/chunks/chunk-R2BSIRYL.js +0 -3
  353. package/dist/chunks/chunk-STDMBJOQ.js +0 -9
  354. package/dist/chunks/chunk-T4QGDQHP.js +0 -4
  355. package/dist/chunks/chunk-USMZT5FZ.js +0 -18
  356. package/dist/chunks/chunk-VJEZPDBS.js +0 -5
  357. package/dist/chunks/chunk-WDFLCNRC.js +0 -8
  358. package/dist/chunks/chunk-WZYRAR7X.js +0 -16
  359. package/dist/chunks/chunk-YDT7L3VZ.js +0 -24
  360. package/dist/chunks/chunk-YUPBAWBJ.js +0 -554
  361. package/dist/chunks/cli-465VC2WP.js +0 -2
  362. package/dist/chunks/configuration-command-LAAP2EXT.js +0 -2
  363. package/dist/chunks/connected-evidence-XM626247.js +0 -2
  364. package/dist/chunks/core-commands-W7EK552V.js +0 -2
  365. package/dist/chunks/datasets-QJWYTTQL.js +0 -2
  366. package/dist/chunks/desktop-test-3B2D34NF.js +0 -3
  367. package/dist/chunks/dist-HUAE2KFZ.js +0 -2
  368. package/dist/chunks/evaluation-coordination-2MONR4AX.js +0 -2
  369. package/dist/chunks/experiment-improvements-WVQ5FK46.js +0 -2
  370. package/dist/chunks/experiments-S5UQ32QB.js +0 -2
  371. package/dist/chunks/hosted-experiment-improvement-2OWOQLHC.js +0 -3
  372. package/dist/chunks/hosted-harness-runtime-TGFMAV7W.js +0 -2
  373. package/dist/chunks/hosted-profile-candidate-WQSI6HZO.js +0 -3
  374. package/dist/chunks/hosted-profile-compiler-Z2A4TEA6.js +0 -2
  375. package/dist/chunks/hosted-profile-evaluation-control-FKGARUEE.js +0 -2
  376. package/dist/chunks/hosted-profile-evaluation-inspection-QOY2JKV4.js +0 -3
  377. package/dist/chunks/hosted-profile-evaluation-preparation-WVP6CALP.js +0 -3
  378. package/dist/chunks/human-review-TGHQKXFZ.js +0 -2
  379. package/dist/chunks/import-4UE5XNSG.js +0 -4
  380. package/dist/chunks/learning-R2XBMMEM.js +0 -2
  381. package/dist/chunks/opchat-WULL6CUP.js +0 -3
  382. package/dist/chunks/organizations-I37HISVX.js +0 -2
  383. package/dist/chunks/project-agent-T6XKC54C.js +0 -2
  384. package/dist/chunks/sandbox-command-STB47FRY.js +0 -2
  385. package/dist/chunks/src-T3KWWCAH.js +0 -322
  386. package/dist/chunks/taskset-RNYDR4GS.js +0 -2
  387. package/dist/chunks/training-M6FAPRSJ.js +0 -2
  388. package/dist/chunks/workspaces-MFZ3OO6O.js +0 -2
  389. package/dist/web/assets/App-CLFfy_Av.js +0 -154
  390. package/dist/web/assets/MainPane-D3ojiN-p.js +0 -18
  391. package/dist/web/assets/MainPane-DOWsSew1.css +0 -1
  392. package/dist/web/assets/RightSidebarHomePanel-CKs3OwhD.js +0 -1
  393. package/dist/web/assets/SettingsView-BnANbPLS.css +0 -1
  394. package/dist/web/assets/SettingsView-T1vYDPjh.js +0 -5
  395. package/dist/web/assets/TrainingCreationPanel-D75K0yk5.js +0 -1
  396. package/dist/web/assets/WorkSidebarPanel-CODMjVHY.js +0 -1
  397. package/dist/web/assets/WorkspaceGitDialogs-DrVtapQQ.js +0 -1
  398. package/dist/web/assets/index-B5re-RJy.css +0 -1
  399. package/dist/web/assets/useProviderSettings-Bv5B9eNk.js +0 -5
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{Ab as _,Bb as z,Cb as K,Db as G,l as P,mb as ie,nb as oe,o as d,qb as ce,rb as me,tb as q,wa as ne,wb as T,zb as M}from"./chunk-YDT7L3VZ.js";import{I as R}from"./chunk-55G6B54U.js";import{I as X,J as Q,La as Y,Oa as Z,Pa as ee,Qa as te,Ra as re,Va as se,hb as C,ib as ae,xa as W}from"./chunk-KD3QVRIJ.js";import{b as w,c as f,d as y,f as S,m as u,n as U}from"./chunk-KGNCKIFP.js";import{b as t}from"./chunk-ES2ISFJC.js";import{a as l}from"./chunk-FTQLQJQV.js";var de=t.object({schemaVersion:t.literal("openpond.profileEvaluationComparison.v1"),id:w,tasksetRelease:S,populationHash:f,environmentHash:f,metricPolicyHash:f,limitsHash:f,members:t.array(t.object({runManifest:S,metricResultHash:f,source:re,policy:R.shape.policy,score:t.number().min(0).max(1).nullable()}).strict()).min(2).max(100),createdAt:y}).strict(),L=de.extend({contentHash:f}).strict();function Ve(r){if(r.members.length<2)throw new Error("A comparison requires at least two runs.");let e=r.members.map(({manifest:o,result:p})=>{if(R.parse(o),U(o,"Taskset run manifest"),Q(p),!o.profileEvaluation||o.execution.kind!=="harness")throw new Error("Profile comparison requires released Profile evaluation runs.");if(p.runManifest.id!==o.id||p.runManifest.contentHash!==o.contentHash||p.tasksetRelease.id!==o.tasksetRelease.id||p.tasksetRelease.contentHash!==o.tasksetRelease.contentHash||p.policyHash!==u(o.metricPolicy))throw new Error("Profile comparison metric differs from its run manifest.");return{manifest:o,result:p,source:o.profileEvaluation}}),s=e[0],a=u(s.manifest.population.map(({taskId:o,seed:p,fixtureId:g})=>({taskId:o,seed:p,fixtureId:g}))),n=u(s.manifest.metricPolicy),c=u(s.manifest.limits),i=new Set;for(let o of e){if(i.has(o.manifest.id))throw new Error("Profile comparison repeats a run.");if(i.add(o.manifest.id),o.manifest.tasksetRelease.id!==s.manifest.tasksetRelease.id||o.manifest.tasksetRelease.contentHash!==s.manifest.tasksetRelease.contentHash||u(o.manifest.population.map(({taskId:p,seed:g,fixtureId:v})=>({taskId:p,seed:g,fixtureId:v})))!==a||o.source.environmentHash!==s.source.environmentHash||u(o.manifest.metricPolicy)!==n||u(o.manifest.limits)!==c||o.manifest.runtimeTarget.adapterId!==s.manifest.runtimeTarget.adapterId||o.manifest.runtimeTarget.placement!==s.manifest.runtimeTarget.placement||o.manifest.runtimeTarget.runtimeVersion!==s.manifest.runtimeTarget.runtimeVersion)throw new Error("Profile comparison runs differ in frozen tasks, environment, grading, limits, or runtime.")}let m=de.parse({schemaVersion:"openpond.profileEvaluationComparison.v1",id:r.id,tasksetRelease:s.manifest.tasksetRelease,populationHash:a,environmentHash:s.source.environmentHash,metricPolicyHash:n,limitsHash:c,members:e.map(({manifest:o,result:p,source:g})=>({runManifest:{id:o.id,contentHash:o.contentHash},metricResultHash:p.contentHash,source:g,policy:o.policy,score:p.value})),createdAt:r.createdAt});return L.parse({...m,contentHash:u(m)})}l(Ve,"createProfileEvaluationComparison");var le=t.object({schemaVersion:t.literal("openpond.profileEvaluationSuiteRun.v1"),id:w,suiteId:w,suiteHash:f,catalogHash:f,profileId:w,sourceRevision:t.string().trim().min(1).max(240),harnessRelease:S,members:t.array(t.object({definitionId:w,runManifest:S,runHash:f,passed:t.boolean(),score:t.number().min(0).max(1).nullable()}).strict()).min(1).max(1e3),passed:t.boolean(),createdAt:y,completedAt:y}).strict(),V=le.extend({contentHash:f}).strict();function We(r){let e=te.parse(r.catalog),s=e.suites.find(m=>m.id===r.suiteId);if(!s)throw new Error(`Profile evaluation suite ${r.suiteId} is absent from its catalog.`);if(r.members.length!==s.definitionIds.length)throw new Error("Profile evaluation suite has an incomplete run population.");let a=r.members.map((m,o)=>{let p=s.definitionIds[o],g=e.definitions.find(b=>b.id===p);if(!g||m.definitionId!==p)throw new Error("Profile evaluation suite members differ from declared definition order.");let v=R.parse(m.manifest);U(v,"Profile evaluation suite member manifest");let x=v.profileEvaluation;if(!x||v.execution.kind!=="harness"||x.definitionId!==p||x.definitionHash!==u(g)||u(x.target)!==u(g.target)||x.catalogHash!==u(e)||v.tasksetRelease.id!==g.tasksetRelease.id||v.tasksetRelease.contentHash!==g.tasksetRelease.contentHash)throw new Error("Profile evaluation suite member differs from its released definition.");return{...m,manifest:v,source:x}}),n=a[0].source,c=a[0].manifest.policy;if(c.kind!=="model")throw new Error("Profile evaluation suite requires model runs.");for(let m of a){if(m.source.profileId!==n.profileId||m.source.sourceRevision!==n.sourceRevision||m.source.harnessRelease.id!==n.harnessRelease.id||m.source.harnessRelease.contentHash!==n.harnessRelease.contentHash)throw new Error("Profile evaluation suite members use different Profile releases.");let o=m.manifest.policy;if(o.kind!=="model"||u(o)!==u(c))throw new Error("Profile evaluation suite members use different model configurations.")}let i=le.parse({schemaVersion:"openpond.profileEvaluationSuiteRun.v1",id:r.id,suiteId:s.id,suiteHash:u(s),catalogHash:u(e),profileId:n.profileId,sourceRevision:n.sourceRevision,harnessRelease:n.harnessRelease,members:a.map(m=>({definitionId:m.definitionId,runManifest:{id:m.manifest.id,contentHash:m.manifest.contentHash},runHash:m.runHash,passed:m.passed,score:m.score})),passed:a.every(m=>m.passed),createdAt:r.createdAt,completedAt:r.completedAt});return V.parse({...i,contentHash:u(i)})}l(We,"createProfileEvaluationSuiteRun");var qe=t.object({profileId:w,sourceRevision:t.string().trim().min(1).max(240),harnessRelease:S}).strict(),Te=t.object({kind:t.enum(["run","suite","comparison"]),id:w,contentHash:f}).strict(),pe=t.object({schemaVersion:t.literal("openpond.profileEvaluationReport.v1"),id:w,createdAt:y,testedSources:t.array(qe).min(1).max(100),tasksetReleases:t.array(S).min(1).max(100),metricPolicyHashes:t.array(f).min(1).max(100),modelConfigurationHashes:t.array(f).min(1).max(100),evidence:t.array(Te).min(1).max(100),summary:t.object({totalChecks:t.number().int().nonnegative(),passedChecks:t.number().int().nonnegative(),failedChecks:t.number().int().nonnegative(),unscoredChecks:t.number().int().nonnegative(),meanScore:t.number().min(0).max(1).nullable()}).strict()}).strict().superRefine((r,e)=>{let{summary:s}=r;s.passedChecks+s.failedChecks+s.unscoredChecks!==s.totalChecks&&e.addIssue({code:"custom",path:["summary"],message:"Report check counts must add up."}),new Set(r.evidence.map(({kind:a,id:n})=>`${a}:${n}`)).size!==r.evidence.length&&e.addIssue({code:"custom",path:["evidence"],message:"Report evidence must be unique."})}),D=pe.safeExtend({contentHash:f});function rt(r){let e=pe.parse(r);return D.parse({...e,contentHash:u(e)})}l(rt,"createProfileEvaluationReport");function st(r){let e=D.parse(r),{contentHash:s,...a}=e;if(u(a)!==s)throw new Error("Profile evaluation report content hash differs from its source bytes.");return e}l(st,"assertProfileEvaluationReport");var j=t.string().trim().min(1).max(200),A=t.object({operationId:j,execution:P,executionKind:t.literal("recorded_evidence").optional(),graders:t.array(W).min(1).max(100),maximumCostUsd:t.number().finite().min(1e-6).max(1e4),mappings:t.array(t.object({graderId:j,fields:q}).strict()).max(100).optional()}).strict().superRefine((r,e)=>{new Set(r.graders.map(s=>s.id)).size!==r.graders.length&&e.addIssue({code:"custom",path:["graders"],message:"Select each grader once."}),r.mappings&&(new Set(r.mappings.map(s=>s.graderId)).size!==r.mappings.length||r.mappings.some(s=>!r.graders.some(a=>a.id===s.graderId)))&&e.addIssue({code:"custom",path:["mappings"],message:"Map each selected grader at most once."})}),je=t.object({schemaVersion:t.literal("openpond.experimentScoringPass.v1"),id:j,teamId:j,revision:t.number().int().positive(),request:A,graders:t.array(T).min(1).max(100),status:t.enum(["queued","running","cancelling","completed","failed","cancelled"]),totalCount:t.number().int().min(1).max(1e4),counts:t.object({pending:t.number().int().nonnegative(),running:t.number().int().nonnegative(),scored:t.number().int().nonnegative(),unavailable:t.number().int().nonnegative(),failed:t.number().int().nonnegative(),cancelled:t.number().int().nonnegative()}).strict(),resultAvailable:t.boolean(),createdAt:t.iso.datetime(),startedAt:t.iso.datetime().nullable(),completedAt:t.iso.datetime().nullable(),error:t.object({code:j,message:t.string().max(2e3)}).strict().nullable()}).strict(),ue=je.extend({contentHash:t.string().regex(/^[a-f0-9]{64}$/)});function $(r){let e=ue.parse(r),{contentHash:s,...a}=e;if(d(a)!==s||Object.values(e.counts).reduce((c,i)=>c+i,0)!==e.totalCount)throw new Error("Scoring pass integrity or population accounting failed.");let n=["completed","failed","cancelled"].includes(e.status);if(n&&(!e.completedAt||e.counts.pending||e.counts.running)||!n&&(e.completedAt!==null||e.resultAvailable)||e.status==="completed"&&!e.resultAvailable)throw new Error("Scoring pass lifecycle differs from its retained result.");if(e.graders.length!==e.request.graders.length||new Set(e.graders.map(c=>c.feedbackKey)).size!==e.graders.length||e.graders.some((c,i)=>d(c.release)!==d(e.request.graders[i])||d(c.mappings??[])!==d(e.request.mappings?.find(m=>m.graderId===c.release?.id)?.fields??[])))throw new Error("Scoring pass graders differ from their exact admission.");return e}l($,"verifyExperimentScoringPass");var fe=8388608;async function he(r,e,s,a){let n=new AbortController,c=s.signal,i=l(()=>n.abort(c?.reason),"forward");c?.aborted?i():c?.addEventListener("abort",i,{once:!0});let m=setTimeout(()=>n.abort(new Error("Connected evidence request timed out.")),6e4),o,p=l(()=>{o&&o.cancel(n.signal.reason).catch(()=>{})},"abortReader");n.signal.addEventListener("abort",p,{once:!0});let g=new Promise((v,x)=>{let b=l(()=>x(n.signal.reason??new DOMException("Request aborted","AbortError")),"abort");n.signal.aborted?b():n.signal.addEventListener("abort",b,{once:!0})});try{let v=r(e,{...s,signal:n.signal}).then(E=>{if(n.signal.aborted)throw E.body?.cancel(n.signal.reason).catch(()=>{}),n.signal.reason;return E}),x=await Promise.race([v,g]),b=x.headers.get("content-length");if(o=x.body?.getReader(),n.signal.aborted)throw await o?.cancel(n.signal.reason),n.signal.reason;if(b&&Number(b)>fe)throw await o?.cancel(),a(502,"connected_response_too_large","Connected evidence response exceeds 8 MiB.");let J=[],O=0;if(o)for(;;){let E=await Promise.race([o.read(),g]);if(E.done)break;if(O+=E.value.byteLength,O>fe)throw await o.cancel(),a(502,"connected_response_too_large","Connected evidence response exceeds 8 MiB.");J.push(E.value)}let N=new Uint8Array(O),B=0;for(let E of J)N.set(E,B),B+=E.byteLength;let F;try{F=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(N))}catch{throw a(502,"connected_response_invalid","Connected evidence response is not valid JSON.")}return{response:x,value:F}}finally{clearTimeout(m),c?.removeEventListener("abort",i),n.signal.removeEventListener("abort",p),o?.releaseLock()}}l(he,"fetchConnectedJson");var ge=t.string().regex(/^[a-f0-9]{64}$/),xe=t.object({request:ie,maximumCostUsd:t.number().finite().positive().max(1e4),graders:t.array(T).min(1).max(100),admissionRequestHash:ge.optional(),sourceExperimentId:t.string().trim().min(1).max(200).optional()}).strict(),ve=xe.extend({configurationHash:ge}).strict(),we=oe.extend({configuration:ve}).strict();function k(r){return r.policy.kind==="hosted_harness"?{...r,population:r.population.map(({receiptId:e,...s})=>s)}:r}l(k,"experimentConfigurationRequest");function Ee(r){let e=xe.parse(r);return d({...e,request:k(e.request)})}l(Ee,"experimentRunConfigurationHash");async function Se(r){let e=we.parse(r),{configuration:s,...a}=e,n=await me(a),{configurationHash:c,...i}=s;if(c!==Ee(i)||d(k(s.request))!==d(k(n.request))||s.maximumCostUsd!==n.manifest.limits.maximumSpendUsd)throw new Error("Experiment configuration differs from its retained run.");if(n.manifest.metadata.experimentDefinition===null){let m=_.parse({definition:null,configurationHash:s.configurationHash,maximumCostUsd:s.maximumCostUsd,graders:s.graders,...s.admissionRequestHash?{admissionRequestHash:s.admissionRequestHash}:{},...s.sourceExperimentId?{sourceExperimentId:s.sourceExperimentId}:{}});if(n.manifest.metadata.experimentConfigurationHash!==d(m))throw new Error("Experiment configuration differs from its admitted manifest.")}return{...n,configuration:s}}l(Se,"verifyExperimentRunDetails");var Ie=t.object({teamId:t.string().trim().min(1).max(240),items:t.array(t.object({name:t.string().trim().min(1).max(500),source:se,ready:t.boolean(),reason:t.string().min(1).max(2e3).nullable()}).strict()).max(8),nextCursor:t.string().min(1).max(8192).nullable()}).strict(),h=t.string().trim().min(1).max(200),be=class extends Error{static{l(this,"OpenPondExperimentError")}constructor(r,e,s){super(s),this.status=r,this.code=e,this.name="OpenPondExperimentError"}status;code},Ue=class{static{l(this,"OpenPondExperimentsClient")}constructor(r){this.options=r;let e=new URL(r.baseUrl);if(!["http:","https:"].includes(e.protocol)||e.username||e.password||e.search||e.hash||!r.apiKey.trim()||!r.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=e.toString().replace(/\/+$/,"")}options;baseUrl;async harnessSources(r={}){let e=r.cursor===void 0?void 0:t.string().min(1).max(8192).parse(r.cursor),s=new URLSearchParams(e?{cursor:e}:{}),a=Ie.parse(await this.request(`/harness-sources?${s}`,"GET",void 0,r.signal));if(a.teamId!==this.options.teamId||new Set(a.items.map(n=>d(n.source))).size!==a.items.length||a.nextCursor!==null&&a.nextCursor===e||a.items.some(n=>n.ready!==(n.reason===null)))throw new Error("Harness catalog differs from its workspace, readiness or continuation.");return a}async prepareHarness(r,e){let s=z.parse(r),a=K.parse(await this.request("/harness-setup","POST",s,e));ce(a.request,a.manifest);let n=a.request.policy;if(a.request.teamId!==this.options.teamId||a.request.operationId!==s.operationId||n.kind!=="hosted_harness"||n.profileRepositoryId!==s.profileRepositoryId||n.source.definitionId!==s.definitionId||n.modelId!==s.modelId||n.reasoningEffort!==s.reasoningEffort||a.maximumCostUsd!==s.maximumCostUsd||a.manifest.limits.maximumSpendUsd!==s.maximumCostUsd)throw new Error("Harness preparation differs from its requested scope or configuration.");return a}async run(r,e){let s=G.parse(r);if(s.request.teamId!==this.options.teamId)throw new Error("Experiment workspace mismatch.");let a=await this.details(await this.request("","POST",s,e));if(d(k(a.request))!==d(k(s.request))||a.configuration.maximumCostUsd!==s.maximumCostUsd||a.configuration.sourceExperimentId!==s.sourceExperimentId||a.configuration.admissionRequestHash!==d(s))throw new Error("Experiment admission differs from its submitted configuration.");if(s.graders&&d(s.graders)!==d(a.configuration.graders.map(n=>({id:n.id,version:n.version,contentHash:n.contentHash,mappings:n.mappings??[]}))))throw new Error("Experiment admission differs from its selected graders or mappings.");return a}async get(r,e={}){return this.details(await this.request(`/${encodeURIComponent(h.parse(r))}`,"GET",void 0,e.signal),r)}async list(r={},e){let s=M.parse(r),a=new URLSearchParams(Object.entries(s).filter(([,i])=>i!==void 0).map(([i,m])=>[i,String(m)])),n=t.object({items:t.array(t.unknown()).max(100),nextCursor:h.nullable()}).strict().parse(await this.request(`?${a}`,"GET",void 0,e)),c=await Promise.all(n.items.map(i=>this.details(i)));if(c.length>s.limit||new Set(c.map(i=>i.summary.id)).size!==c.length||n.nextCursor!==null&&n.nextCursor!==c.at(-1)?.summary.id||c.some(i=>s.projectId&&i.request.project?.id!==s.projectId||s.datasetHash&&i.request.taskset.contentHash!==s.datasetHash||s.status&&i.summary.status!==s.status))throw new Error("Experiment page differs from its selected scope.");return{items:c,nextCursor:n.nextCursor}}async result(r,e){let s=t.object({executionId:h,passId:h.nullable(),manifest:t.unknown(),result:t.unknown()}).strict().parse(await this.request(`/${encodeURIComponent(h.parse(r))}/result`,"GET",void 0,e)),a=C(s);if(s.executionId!==r||a.manifest.teamId!==this.options.teamId||a.manifest.lineage?.execution.id!==r||a.manifest.lineage.scoringPassId!==s.passId)throw new Error("Experiment result identity mismatch.");return{...a,executionId:r,passId:s.passId}}async cancel(r,e){return this.details(await this.request(`/${encodeURIComponent(h.parse(r))}/cancel`,"POST",{},e),r)}async duplicate(r,e,s){let a=await this.details(await this.request(`/${encodeURIComponent(h.parse(r))}/duplicate`,"POST",{operationId:h.parse(e)},s));if(a.request.operationId!==e||a.configuration.sourceExperimentId!==r||a.summary.id===r)throw new Error("Duplicate Experiment admission differs from its source or operation.");return a}async score(r,e){let s=A.parse(r),a=this.pass(await this.request(`/${encodeURIComponent(s.execution.id)}/scoring-passes`,"POST",s,e));if(d(a.request)!==d(s))throw new Error("Scoring admission differs from its submitted inputs.");return a}async scoringPass(r,e){return this.pass(await this.request(`/scoring-passes/${encodeURIComponent(h.parse(r))}`,"GET",void 0,e),r)}async scoringPasses(r,e={}){let s=new URLSearchParams(e.afterId?{afterId:h.parse(e.afterId)}:{});e.executionKind&&s.set("executionKind",t.literal("recorded_evidence").parse(e.executionKind));let a=t.object({items:t.array(t.unknown()).max(30),nextCursor:h.nullable()}).strict().parse(await this.request(`/${encodeURIComponent(h.parse(r))}/scoring-passes?${s}`,"GET",void 0,e.signal)),n=a.items.map(c=>this.pass(c));if(n.some(c=>c.request.execution.id!==r||c.request.executionKind!==e.executionKind)||new Set(n.map(c=>c.id)).size!==n.length)throw new Error("Scoring pass page differs from its execution ownership.");return{items:n,nextCursor:a.nextCursor}}async cancelScoringPass(r,e){return this.pass(await this.request(`/scoring-passes/${encodeURIComponent(h.parse(r))}/cancel`,"POST",{},e),r)}async scoringResult(r,e){let s=t.object({executionId:h,passId:h,manifest:t.unknown(),result:t.unknown()}).strict().parse(await this.request(`/scoring-passes/${encodeURIComponent(h.parse(r))}/result`,"GET",void 0,e)),a=C(s);if(s.passId!==r||a.manifest.teamId!==this.options.teamId||a.manifest.id!==r||a.manifest.lineage?.execution.id!==s.executionId||a.manifest.lineage.scoringPassId!==r)throw new Error("Scoring result identity mismatch.");return{...a,executionId:s.executionId,passId:r}}async compare(r,e,s){let a=l(i=>i.startsWith("score_")?this.scoringResult(i,s):this.result(i,s),"read"),[n,c]=await Promise.all([a(r),a(e)]);return{baseline:n,candidate:c,comparison:ae(n,c)}}async details(r,e){let s=await Se(r);if(s.summary.teamId!==this.options.teamId||e&&s.summary.id!==e)throw new Error("Experiment identity mismatch.");return s}pass(r,e){let s=$(r);if(s.teamId!==this.options.teamId||e&&s.id!==e)throw new Error("Scoring pass identity mismatch.");return s}async request(r,e,s,a){let n=await(this.options.fetch??fetch)(`${this.baseUrl}/v1/experiments${r}`,{method:e,signal:a,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,"Content-Type":"application/json",Accept:"application/json"},...s===void 0?{}:{body:JSON.stringify(s)}}),c=await n.json();if(!n.ok){let i=t.object({code:t.string(),message:t.string()}).safeParse(c);throw new be(n.status,i.success?i.data.code:"experiment_request_failed",i.success?i.data.message:"Experiment request failed.")}return c}},I=t.string().trim().min(1).max(500),ye=t.string().regex(/^[a-f0-9]{64}$/),De=t.object({schemaVersion:t.literal("openpond.experimentCaseInspection.v1"),teamId:I,executionId:I,manifestHash:ye,receiptId:I,taskId:I,seed:t.string().min(1),input:t.record(t.string(),t.unknown()).nullable(),output:t.unknown().nullable(),error:t.string().nullable(),events:t.array(t.record(t.string(),t.unknown())).max(25),nextEventCursor:I.nullable(),eventCount:t.number().int().nonnegative()}).strict(),Re=De.extend({contentHash:ye}).strict(),Ae=class{static{l(this,"OpenPondExperimentInspectionClient")}constructor(r){this.options=r;let e=new URL(r.baseUrl);if(!["http:","https:"].includes(e.protocol)||e.username||e.password||e.search||e.hash||!r.apiKey.trim()||!r.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=e.toString().replace(/\/+$/,"")}options;baseUrl;async case(r,e,s={}){let a=new URLSearchParams(s.afterId?{afterId:I.parse(s.afterId)}:{}),n=await(this.options.fetch??fetch)(`${this.baseUrl}/v1/experiments/${encodeURIComponent(I.parse(r))}/cases/${encodeURIComponent(I.parse(e))}?${a}`,{signal:s.signal,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,Accept:"application/json"}}),c=await n.json();if(!n.ok)throw new Error(t.object({message:t.string()}).parse(c).message);let i=Re.parse(c),{contentHash:m,...o}=i;if(d(o)!==m||i.teamId!==this.options.teamId||i.executionId!==r||i.receiptId!==e||s.manifestHash&&i.manifestHash!==s.manifestHash||i.events.length>i.eventCount)throw new Error("Case inspection differs from its requested workspace, execution or retained content.");return i}};function He(r){return JSON.stringify(r.release?["reward",r.release.id,r.release.revision,r.release.contentHash,r.feedbackKey]:["dataset",r.id,r.version,r.contentHash,r.feedbackKey])}l(He,"datasetGraderIdentity");function Pe(r){let e=new Map;for(let s of r){let a=He(s),n=e.get(a);n?n.aliases.push(s):e.set(a,{key:a,grader:s,aliases:[s]})}return[...e.values()]}l(Pe,"groupDatasetGraders");function $e(r){let e=Pe(r),s=new Map;for(let a of e){let n=s.get(a.grader.feedbackKey);if(n&&n!==a.key)throw new Error(`Different selected grader releases use feedback key "${a.grader.feedbackKey}". Select one, or publish graders with distinct feedback keys.`);s.set(a.grader.feedbackKey,a.key);let c=JSON.stringify(a.grader.mappings??[]);if(a.aliases.some(i=>JSON.stringify(i.mappings??[])!==c))throw new Error(`Aliases of grader "${a.grader.feedbackKey}" have different field mappings. Select one alias and review its mappings.`)}return e.map(a=>a.grader)}l($e,"canonicalDatasetGraderSelection");function Oe(r){let e=Y(r.binding),s=ne(r.packageValue),a=s.taskset;if(a.id!==e.dataset.id||a.revision!==e.dataset.revision||a.contentHash!==e.dataset.contentHash||s.contentHash!==e.packageHash||d(a.environment)!==e.environmentHash||d(s.files.filter(n=>n.asset.visibility!=="policy").map(n=>n.asset))!==e.privateDatasetClosureHash)throw new Error("The selected Dataset package, environment or protected closure changed.");if(e.population.length>500)throw new Error("Select at most 500 exact Dataset cases before starting this bounded Profile evaluation.");for(let n of e.population){let c=a.tasks.find(i=>i.id===n.taskId);if(!c||c.split!==e.split)throw new Error("The selected ordered population is outside its exact Dataset split.");if(n.fixtureId!==null)throw new Error("This recorded cutoff needs an admitted replay fixture before executing the Profile target.")}if(e.gradingSource){if(!r.actualGrading)throw new Error("The actual selected scoring owner is required for this recipe.");let n=$(r.actualGrading.pass),c=C(t.object({manifest:t.unknown(),result:t.unknown()}).strict().parse(r.actualGrading.evidence));if(n.status!=="completed"||n.id!==e.gradingSource.pass.id||n.contentHash!==e.gradingSource.pass.contentHash||c.manifest.id!==e.gradingSource.evidence.id||c.result.contentHash!==e.gradingSource.evidence.contentHash||c.manifest.lineage?.scoringPassId!==n.id||d(c.manifest.dataset)!==d(e.dataset)||d(c.manifest.evaluators)!==d(e.evaluators)||d(e.fieldMappings)!==d(n.graders.map(o=>({graderId:o.id,fields:o.mappings??[]}))))throw new Error("The selected scoring owner changed its exact Dataset, measurements or mappings.");let i=c.manifest.population,m=e.recordedOrigin?e.recordedOrigin.members.map(o=>({caseId:o.caseId,seed:o.seed,fixtureId:o.fixtureId})):e.population.map(o=>({caseId:o.taskId,seed:o.seed,fixtureId:o.fixtureId}));if(i.length!==m.length||i.some((o,p)=>d(o)!==d(m[p])))throw new Error("The selected scoring population differs from the exact ordered original cases and cutoffs.")}else{if(e.fieldMappings.some(i=>!a.graders.some(m=>m.id===i.graderId)))throw new Error("The field mappings name a grader outside the selected release.");for(let i of e.fieldMappings)q.parse(i.fields);let n=e.evaluators.map(i=>{let m=r.graders.find(o=>o.feedbackKey===i.feedbackKey&&d(o.release??{id:o.id,revision:o.version,contentHash:o.contentHash})===d(i.release));if(!m)throw new Error("Select an exact released Dataset grader for this external recipe.");return m});if(e.fieldMappings.some(i=>!n.some(m=>m.id===i.graderId)))throw new Error("Field mappings refer to an unselected grader.");let c=n.map(i=>({release:i.release??{id:i.id,revision:i.version,contentHash:i.contentHash},feedbackKey:i.feedbackKey,configurationHash:d({graderHash:i.contentHash,mappings:e.fieldMappings.find(m=>m.graderId===i.id)?.fields??[]}),output:"score",categories:[]}));if(d(c)!==d(e.evaluators))throw new Error("The external recipe's graders or mappings differ from the current exact released grading settings.");for(let i of r.graders)if(!a.graders.some(m=>m.id===i.id&&m.version===i.version&&d(m)===i.contentHash))throw new Error("External grader pins differ from the actual Dataset implementation.")}for(let n of r.graders)if(!a.graders.some(c=>c.id===n.id&&c.version===n.version&&d(c)===n.contentHash))throw new Error("Dataset-native grader pins differ from their actual implementation.");return s}l(Oe,"verifyExternalDatasetPackage");var H=t.string().trim().min(1).max(240),ke=t.object({profileRef:t.object({source:t.enum(["local","github","openpond_git"]),repositoryId:H,profileId:H}).strict(),sourceRevision:t.string().min(1).max(500),harnessRelease:P,catalogHash:t.string().regex(/^[a-f0-9]{64}$/).nullable(),definitions:t.array(Z).max(1e3),suites:t.array(ee).max(100),runs:t.array(t.object({profileRef:t.object({source:t.enum(["local","github","openpond_git"]),repositoryId:H,profileId:H}).strict(),manifest:R,metric:X,gradeRefs:t.array(P),receiptRefs:t.array(P),passRate:t.number().min(0).max(1),passed:t.boolean(),completedAt:t.iso.datetime(),contentHash:t.string().regex(/^[a-f0-9]{64}$/)}).strict()).max(1e3),comparisons:t.array(L).max(1e3),suiteRuns:t.array(V).max(1e3),reports:t.array(D).max(1e3)}).strict(),Ce=t.object({teamId:H,profileRepositoryId:H,trainingProjectId:H.optional()}).strict(),Me=class{static{l(this,"OpenPondProfileEvaluationDiscoveryClient")}constructor(r){this.options=r;let e=new URL(r.baseUrl);if(!["http:","https:"].includes(e.protocol)||e.username||e.password||e.search||e.hash||!r.apiKey.trim()||!r.teamId.trim())throw new Error("Profile discovery requires a scoped HTTP endpoint and owner credential.")}options;async read(r,e){let s=Ce.parse({...r,teamId:this.options.teamId}),{response:a,value:n}=await he(this.options.fetch??fetch,`${this.options.baseUrl.replace(/\/$/,"")}/v1/profile-evaluation-discovery`,{method:"POST",redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,"Content-Type":"application/json"},body:JSON.stringify(s),signal:e},(i,m,o)=>new Error(o));if(!a.ok)throw new Error("The released Profile evaluation owner is unavailable to this account and workspace.");let c=ke.parse(n);if(c.profileRef.repositoryId!==s.profileRepositoryId)throw new Error("Profile discovery returned another source owner.");return c}};export{L as a,Ve as b,rt as c,st as d,V as e,We as f,A as g,he as h,be as i,Ue as j,Ae as k,$e as l,Oe as m,Me as n};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{Ed as H,Fd as y,Gd as C,Id as E,Kd as S,Ld as P,Md as j}from"./chunk-JIMU3KDA.js";import{h as I}from"./chunk-QDHMP5FS.js";import{Pb as w,Rb as b,l as h,n as v,o as l}from"./chunk-YDT7L3VZ.js";import{b as e}from"./chunk-ES2ISFJC.js";import{a as f}from"./chunk-FTQLQJQV.js";var a=e.string().min(1).max(240),d=e.string().regex(/^[a-f0-9]{64}$/),g=e.string().regex(/^[a-f0-9]{40}$/),x=e.object({schemaVersion:e.literal("openpond.hostedProfileCandidateExport.v1"),actorId:a,teamId:a,candidateId:a,candidateRevision:e.number().int().positive(),projectId:a.nullable(),profileRef:e.object({source:e.literal("openpond_git"),repositoryId:a,profileId:a}).strict(),expectedCommit:g,component:y.shape.component,baseRelease:h,frozenHash:d,executableSourceHash:d,protectedClosureHash:d,compiler:e.object({workspaceId:a,name:e.string().max(500),repositoryId:a}).strict(),sourceManifest:e.object({base64:e.string().max(28e5),contentHash:d,sizeBytes:e.number().int().positive().max(2e6)}).strict(),policySource:w,qualification:e.object({kind:e.enum(["owner_attested_local","hosted_execution"]),ownerActorId:a,teamId:a,originalEvidence:h,baseline:h,candidate:h,comparisonHash:d,recipe:H}).strict(),createdAt:e.string().datetime(),contentHash:d}).strict();function J(n){let o=x.parse(n),{contentHash:t,...c}=o;if(l(c)!==t||o.qualification.ownerActorId!==o.actorId||o.qualification.teamId!==o.teamId||o.qualification.recipe.externalDatasetBinding.profileId!==o.profileRef.profileId||o.qualification.recipe.externalDatasetBinding.protectedProfileClosureHash!==o.protectedClosureHash)throw new Error("Hosted candidate owner attestation identity differs.");return b(o.policySource),o}f(J,"verifyHostedProfileCandidateExport");var O=e.object({schemaVersion:e.literal("openpond.hostedProfileCandidateAdoption.v1"),id:a,operationId:a,actorId:a,teamId:a,candidateId:a,exportHash:d,executionOrigin:e.enum(["owner_attested_local","hosted_execution"]),qualification:x.shape.qualification,testedCandidateRelease:h,activeRelease:h,expectedCommit:g,committedProfileGit:g,executableSourceHash:d,protectedClosureHash:d,createdAt:e.string().datetime(),contentHash:d}).strict();function R(n){let o=O.parse(n),{contentHash:t,...c}=o;if(l(c)!==t||o.executionOrigin!==o.qualification.kind||o.qualification.ownerActorId!==o.actorId||o.qualification.teamId!==o.teamId)throw new Error("Hosted candidate receipt integrity differs.");return o}f(R,"verifyHostedProfileCandidateReceipt");var T=e.discriminatedUnion("operation",[e.object({operation:e.literal("adopt"),operationId:a,export:x}).strict(),e.object({operation:e.enum(["read","rollback"]),operationId:a,adoptionOperationId:a,profileRepositoryId:a}).strict()]),K=class{static{f(this,"ExperimentImprovementClient")}constructor(n){this.options=n;let o=new URL(n.baseUrl);if(!["http:","https:"].includes(o.protocol)||o.username||o.password||o.hash||o.search||!n.apiKey.trim()||!n.teamId.trim()||!n.actorId.trim())throw new Error("Select the authenticated Improve owner and API origin.");this.origin=o.toString().replace(/\/+$/,"")}options;origin;async hostedCandidate(n,o){let t=T.parse(n);if(t.operation==="adopt"&&(t.export.actorId!==this.options.actorId||t.export.teamId!==this.options.teamId))throw new Error("The hosted candidate export belongs to a different owner.");let{response:c,value:p}=await I(this.options.fetch??fetch,`${this.origin}/v1/profile-candidate-adoptions`,{method:"POST",redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"Content-Type":"application/json","X-OpenPond-Team-Id":this.options.teamId},body:JSON.stringify({teamId:this.options.teamId,command:t}),signal:o},(m,u,r)=>Object.assign(new Error(r),{status:m,code:u}));if(!c.ok){let m=e.object({code:e.string(),message:e.string().optional(),error:e.string().optional()}).passthrough().safeParse(p);throw Object.assign(new Error(m.success?m.data.message??m.data.error??m.data.code:"Hosted candidate operation failed."),{status:c.status,code:m.success?m.data.code:void 0})}let i=R(p);if(i.actorId!==this.options.actorId||i.teamId!==this.options.teamId||i.operationId!==t.operationId||t.operation==="adopt"&&(i.exportHash!==t.export.contentHash||i.candidateId!==t.export.candidateId||i.testedCandidateRelease.contentHash!==t.export.policySource.harnessRelease.contentHash))throw new Error("Hosted candidate readback differs from the exact owner request.");return i}async command(n,o){let t=S.parse(n),{response:c,value:p}=await I(this.options.fetch??fetch,`${this.origin}/v1/experiment-improvements`,{method:"POST",redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"Content-Type":"application/json","X-OpenPond-Team-Id":this.options.teamId},body:JSON.stringify({teamId:this.options.teamId,request:t}),signal:o},(r,s,q)=>Object.assign(new Error(q),{status:r,code:s}));if(!c.ok){let r=e.object({error:e.string(),code:e.string().optional()}).passthrough().safeParse(p);throw Object.assign(new Error(r.success?r.data.error:"The Improve operation failed."),{status:c.status,code:r.success?r.data.code:void 0})}if(t.operation==="options"){let r=P.parse(p);if(r.teamId!==this.options.teamId||l(r.evidence)!==l(t.evidence))throw new Error("The Improve choices changed their exact originating evidence.");return r}if(t.operation==="humanComparisonOptions"){let r=j(p);if(r.candidateId!==t.id||r.actorId!==this.options.actorId||r.teamId!==this.options.teamId)throw new Error("Human discovery belongs to another owner or candidate.");return r}if(t.operation==="instructions"){let r=e.object({candidateId:e.string(),candidateRevision:e.number().int().positive(),path:e.string(),text:e.string().max(25e4),textHash:e.string().regex(/^[a-f0-9]{64}$/),contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict().parse(p);if(r.candidateId!==t.id||v(r.text)!==r.textHash)throw new Error("The candidate instructions belong to a different revision.");return r}let i=t.operation==="list"?E.parse(p):null;if(t.operation==="list"&&i&&(i.states.length>t.limit||i.states.some((r,s)=>t.cursor&&r.id<=t.cursor||s>0&&r.id<=i.states[s-1].id)||i.nextCursor&&(t.cursor&&i.nextCursor<=t.cursor||i.states.some(r=>r.id>i.nextCursor))))throw new Error("The retained candidate page changed its scan boundary.");let u=(i?i.states:[p]).map(r=>{let s=C(r);if(s.actorId!==this.options.actorId||s.teamId!==this.options.teamId||"id"in t&&s.id!==t.id)throw new Error("The Improve response belongs to a different owner or candidate.");if(t.operation==="start"&&s.requestHash!==l(t.request))throw new Error("The Improve request identity changed.");return s});return i?{states:u,nextCursor:i.nextCursor}:u[0]}};export{J as a,K as b};
@@ -1,3 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{F as n,Sa as l,Wa as c}from"./chunk-2DFR7PJ4.js";import{a as t}from"./chunk-FTQLQJQV.js";import{mkdir as f}from"node:fs/promises";import p from"node:path";import a from"node:path";function d(e,o){let i=a.resolve(e),r=a.resolve(o);return r===i||r.startsWith(`${i}${a.sep}`)}t(d,"isHostedProfileSourceWithinRepo");async function u(e){if(!p.isAbsolute(e.repoPath)||!p.isAbsolute(e.outputDir)||!/^[a-f0-9]{40,64}$/.test(e.sourceRevision)||!e.workspaceId.trim()||!e.repositoryId.trim()||!e.profileId.trim())throw new Error("Hosted Profile compile request is invalid.");let o=await n({repoPath:e.repoPath,profileId:e.profileId});if(o.error||o.mode!=="local"||o.activeProfile!==e.profileId||!o.sourcePath||!d(e.repoPath,o.sourcePath))throw new Error("Hosted Profile source is unavailable.");await f(e.outputDir,{recursive:!0});let i=await l({storeDir:e.outputDir,workspaceId:e.workspaceId,name:e.profileId,profile:o,sourceRevision:e.sourceRevision,repositoryId:e.repositoryId}),r=i.harnessRelease.metadata.profile;if(!r||typeof r!="object"||r.id!==e.profileId||r.sourceRevision!==e.sourceRevision||r.repositoryId!==e.repositoryId)throw new Error("Hosted Profile release provenance is invalid.");let s=await c({storeDir:e.outputDir,workspaceId:e.workspaceId,compiled:i,createdAt:new Date().toISOString()});return{workspaceId:e.workspaceId,sourceRevision:s.sourceRevision,harnessRelease:s.harnessRelease,agentSnapshot:s.agentSnapshot,bundlePath:s.bundlePath}}t(u,"compileHostedProfileRelease");async function H(e){if(e.length!==1||e[0].length>16e3||!/^[A-Za-z0-9_-]+$/.test(e[0]))throw new Error("Hosted Profile compile argument is invalid.");let o=JSON.parse(Buffer.from(e[0],"base64url").toString("utf8")),i=await u(o);process.stdout.write(`${JSON.stringify(i)}
3
- `)}t(H,"runHostedProfileCompilerCli");async function y(e){await(await import("./hosted-profile-evaluation-preparation-WVP6CALP.js")).runHostedProfileEvaluationCli(e)}t(y,"runHostedProfileEvaluationCli");async function k(e){await(await import("./hosted-profile-evaluation-inspection-QOY2JKV4.js")).runHostedProfileInspectionCli(e)}t(k,"runHostedProfileInspectionCli");export{u as a,H as b,y as c,k as d};
@@ -1,9 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{Pa as P,Qa as V,Ra as M,Va as E,Wa as q}from"./chunk-2DFR7PJ4.js";import{g as x}from"./chunk-L4235TRQ.js";import{gf as T,h as _,i as A,j as C,o as W}from"./chunk-JIMU3KDA.js";import{l as D,m as L,n as b}from"./chunk-KGNCKIFP.js";import{a as w}from"./chunk-FTQLQJQV.js";import{randomUUID as I}from"node:crypto";import{promises as p}from"node:fs";import{stripTypeScriptTypes as X}from"node:module";import R from"node:path";async function le(e){let r=_.parse(e.overlay),t=A.parse(e.proposal),o=e.validations.map(v=>C.parse(v));if((t.route==="agent"?t.edits.filter(v=>v.target!=="harness.json"&&v.operation!=="delete"):[]).length>0){let v=t.validationPlan.find(s=>s.kind==="component_activation"&&s.required);if(!v)throw new Error("Desktop Work Agent proposals require component-activation validation before review.");if(o.find(s=>s.validationId===v.id)?.status==="passed")throw new Error("Desktop Work cannot accept a passed Agent activation receipt until an Agent source executor exists.")}if(t.overlay.id!==r.id||t.overlay.revision!==r.revision||t.overlay.contentHash!==r.contentHash)throw new Error("Refiner proposal is not bound to the supplied run overlay.");if(r.status!=="frozen")throw new Error("Only a frozen run overlay can advance a Harness workspace.");let n=await e.store.getHarnessWorkspace(t.expectedWorkspace.workspaceId);if(!n)throw new Error(`Harness workspace ${t.expectedWorkspace.workspaceId} does not exist.`);if(n.location!==e.store.harnessStoragePlacement)throw new Error("Refiner workspace does not match the admitted storage placement.");let c=P(e.storeDir,n.id),d=await E({workspaceId:n.id,sourceDir:c.source});if(d.sourceRevision!==n.sourceRevision)throw new Error(`Harness source is ${d.sourceRevision}; workspace expects ${n.sourceRevision}. Record or revert the source change before refinement.`);let h=R.join(c.root,`.source-candidate-${I()}`);await p.cp(c.source,h,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{await K(h,t);let v=await E({workspaceId:n.id,sourceDir:h}),m=(e.now??(()=>new Date().toISOString()))(),s=await q({storeDir:e.storeDir,workspaceId:n.id,compiled:v,createdAt:m});await e.store.saveHarnessReleaseRecord(s),await e.store.saveHarnessImprovementArtifact(n.id,"run_overlay",r),await e.store.saveHarnessImprovementArtifact(n.id,"proposal",t);for(let i of o)await e.store.saveHarnessImprovementArtifact(n.id,"targeted_validation",i);if(!T({workspace:n,proposal:t}).eligible&&!e.reviewAuthority)return e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:n.id,proposal:t,validations:o,nextRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},nextSourceRevision:s.sourceRevision,now:m});let u=R.join(c.root,`.source-backup-${I()}`),l=R.join(c.root,"source-swap.json");await J(l,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:n.id,expectedWorkspaceRevision:n.revision,previousSourceRevision:n.sourceRevision,nextSourceRevision:s.sourceRevision,backupSource:u,candidateSource:h,createdAt:m}),await p.rename(c.source,u),await p.rename(h,c.source);try{let i=e.reviewAuthority?await e.store.advanceReviewedHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:n.id,proposal:t,validations:o,nextRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},nextSourceRevision:s.sourceRevision,reviewer:e.reviewAuthority.reviewer,now:m}):await e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:n.id,proposal:t,validations:o,nextRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},nextSourceRevision:s.sourceRevision,now:m});return i.receipt.decision!=="advanced"?await $(c.source,u):await p.rm(u,{recursive:!0,force:!0}),await p.rm(l,{force:!0}),i}catch(i){throw await $(c.source,u).catch(()=>{}),await p.rm(l,{force:!0}).catch(()=>{}),i}}finally{await p.rm(h,{recursive:!0,force:!0}).catch(()=>{})}}w(le,"applyLocalHarnessRefinerProposal");async function de(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r||r.location!==e.store.harnessStoragePlacement)throw new Error(`Local Harness workspace ${e.workspaceId} does not exist.`);if(r.currentChannel.release?.id!==e.rollbackOf.id||r.currentChannel.release.contentHash!==e.rollbackOf.contentHash)throw new Error("Harness rollback source is no longer the current release.");let t=await e.store.getHarnessReleaseRecord(e.targetRelease.contentHash);if(!t||t.workspaceId!==r.id||t.harnessRelease.id!==e.targetRelease.id)throw new Error("Harness rollback target is unavailable in this workspace.");let o=P(e.storeDir,r.id);if((await E({workspaceId:r.id,sourceDir:o.source})).sourceRevision!==r.sourceRevision)throw new Error("Harness source changed before rollback.");let n=R.join(o.root,`.source-rollback-${I()}`);await p.cp(R.join(t.bundlePath,"source"),n,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{if((await E({workspaceId:r.id,sourceDir:n})).sourceRevision!==t.sourceRevision)throw new Error("Harness rollback bundle does not reproduce its registered source revision.");let d=(e.now??(()=>new Date().toISOString()))(),h=R.join(o.root,`.source-backup-${I()}`),v=R.join(o.root,"source-swap.json");await J(v,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:r.id,expectedWorkspaceRevision:r.revision,previousSourceRevision:r.sourceRevision,nextSourceRevision:t.sourceRevision,backupSource:h,candidateSource:n,createdAt:d}),await p.rename(o.source,h),await p.rename(n,o.source);try{let m=await e.store.rollbackHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:r.id,expectedWorkspaceRevision:r.revision,expectedChannelRevision:r.currentChannel.revision,targetRelease:e.targetRelease,targetSourceRevision:t.sourceRevision,rollbackOf:e.rollbackOf,now:d});return m.receipt.decision!=="rolled_back"?await $(o.source,h):await p.rm(h,{recursive:!0,force:!0}),await p.rm(v,{force:!0}),m}catch(m){throw await $(o.source,h).catch(()=>{}),await p.rm(v,{force:!0}).catch(()=>{}),m}}finally{await p.rm(n,{recursive:!0,force:!0}).catch(()=>{})}}w(de,"rollbackLocalHarnessWorkspaceRelease");async function pe(e){let r=A.parse(e.proposal);if(r.expectedWorkspace.workspaceId!==e.workspace.id)throw new Error("Refiner proposal targets a different Harness workspace.");if(r.route==="memory")return Y({proposal:r,now:e.now});let t=P(e.storeDir,e.workspace.id),o=await E({workspaceId:e.workspace.id,sourceDir:t.source});if(o.sourceRevision!==r.expectedWorkspace.sourceRevision)throw new Error("Refiner proposal source revision no longer matches the Local Harness workspace.");let a=R.join(t.root,`.validation-candidate-${I()}`);await p.cp(t.source,a,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});let n=(e.now??(()=>new Date().toISOString()))();try{await K(a,r);let c=await E({workspaceId:e.workspace.id,sourceDir:a}),d=new Map(c.manifest.files.map(s=>[s.path,s])),h=new Map(r.edits.map(s=>[s.target,s])),v=N(o),m=N(c);return Promise.all(r.validationPlan.map(async s=>{let f="passed",u="The candidate Harness source compiles and preserves its manifest contract.";try{if(s.kind==="observed_recovery"){let l=r.evidence.filter(i=>i.kind==="recovery");if(l.length===0)throw new Error("Observed-recovery validation requires recorded recovery evidence.");u=`Validated ${l.length} immutable recovery evidence reference(s) before candidate advancement.`}else if(s.kind==="prompt"){let l=r.edits.filter(i=>i.route==="prompt"&&i.target!=="harness.json");if(l.length===0)throw new Error("Prompt validation requires an instruction-file edit.");for(let i of l){let g=d.get(i.target);if(i.operation==="delete"){if(g)throw new Error(`Deleted instruction ${i.target} remains declared.`)}else if(g?.kind!=="instruction")throw new Error(`Instruction ${i.target} is not declared in the candidate Harness.`);if(i.content!==null&&/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(i.content))throw new Error(`Instruction ${i.target} appears to contain credential material.`)}u=`Validated ${l.length} textual instruction edit(s) and compiled candidate ${c.harnessRelease.id}.`}else if(s.kind==="skill"){let l=r.edits.filter(i=>i.route==="skill"&&i.target!=="harness.json");if(l.length===0)throw new Error("Skill validation requires a declared Skill-file edit.");for(let i of l){let g=d.get(i.target);if(i.operation==="delete"){if(g)throw new Error(`Deleted Skill ${i.target} remains declared.`);continue}if(g?.kind!=="skill")throw new Error(`Skill ${i.target} is not declared in the candidate Harness.`);let k=h.get(i.target)?.content;if(!k)throw new Error(`Skill edit ${i.target} has no content.`);let H=x(k);if(!H.name||!H.description||H.messages.length>0)throw new Error(`Skill ${i.target} is invalid: ${H.messages.join(" ")}`)}u=`Validated ${l.length} Skill edit(s), Skill frontmatter, and compiled candidate ${c.harnessRelease.id}.`}else if(s.kind==="dependency"){let l=c.manifest.files.find(i=>i.kind==="dependency_lock");if(!l)throw new Error("Candidate Harness has no dependency lock.");JSON.parse(await p.readFile(z(a,l.path),"utf8")),u=`Validated dependency lock ${l.path} and compiled candidate ${c.harnessRelease.id}.`}else if(s.kind==="schema")A.parse(r),u=`Validated proposal, manifest, and candidate release schemas for ${c.harnessRelease.id}.`;else if(s.kind==="package"){let l=r.edits.filter(i=>i.route==="agent"&&i.operation!=="delete"&&i.target!=="harness.json");for(let i of l){if(!i.content)throw new Error(`Agent edit ${i.target} has no source.`);X(i.content,{mode:"transform",sourceUrl:i.target,sourceMap:!1})}u=l.length>0?`Syntax-checked ${l.length} Agent source edit(s) and compiled candidate ${c.harnessRelease.id}.`:`Compiled candidate package ${c.harnessRelease.id} and preserved the Harness source manifest contract.`}else if(s.kind==="component_activation"){let l=r.edits.filter(i=>i.target!=="harness.json");if(l.length===0)throw new Error("Component activation requires a concrete Harness component edit.");if(r.route==="agent"){if(l.filter(g=>g.operation!=="delete").length>0)throw new Error("Desktop Work does not compile or execute released Agent source; use an active instruction or standalone Skill, or add an Agent executor before release.");u=`Confirmed ${l.length} deleted Agent component(s) were inactive in Desktop Work.`}else{if(!["prompt","skill"].includes(r.route))throw new Error(`Desktop Work has no activation policy for ${r.route} proposals.`);let i=r.route==="prompt"?"instruction":"skill";for(let g of l){let k=m.components.find(H=>H.path===g.target&&H.kind===i);if(g.operation==="delete"?k:!k)throw new Error(`${i} ${g.target} is not reflected in the candidate Desktop Work runtime surface.`)}if(v.contentHash===m.contentHash)throw new Error("The candidate does not change the effective Desktop Work runtime surface.");u=`Activated ${l.length} ${i} edit(s) in the candidate Desktop Work runtime surface.`}}else s.kind==="business_formula"?(f="blocked",u="Business or financial logic is retained for review until an approved deterministic fixture supplies inputs and expected outputs."):s.kind==="targeted_evaluation"?(f="blocked",u="This sensitive change requires an explicit authority-preserving targeted Evaluation before release."):s.kind==="file_render"?(f="blocked",u="File-render validation requires an exact produced artifact reference; no artifact was attached to this Harness-source proposal."):(f="blocked",u=`Local targeted validation does not yet own ${s.kind}; it requires its dedicated validator.`)}catch(l){f="failed",u=l instanceof Error?l.message:String(l)}return W({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${s.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:s.id,kind:s.kind,status:f,summary:u,evidenceRefs:r.evidence,createdAt:n,metadata:{candidateHarnessRelease:{id:c.harnessRelease.id,contentHash:c.harnessRelease.contentHash},sourceRevision:c.sourceRevision,...s.kind==="component_activation"?{targetRuntime:"desktop_work",beforeEffectiveRuntimeHash:v.contentHash,afterEffectiveRuntimeHash:m.contentHash,activatedComponentRefs:m.components,inactiveAgentRefs:m.inactiveAgents}:{}}})}))}catch(c){let d=c instanceof Error?c.message:String(c);return r.validationPlan.map(h=>W({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${h.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:h.id,kind:h.kind,status:"failed",summary:d,evidenceRefs:r.evidence,createdAt:n,metadata:{}}))}finally{await p.rm(a,{recursive:!0,force:!0}).catch(()=>{})}}w(pe,"validateLocalHarnessRefinerProposal");function N(e){let r=[...e.agentSnapshot.instructions.map(o=>({kind:"instruction",path:o.path,contentHash:o.contentHash})),...e.agentSnapshot.skills.map(o=>({kind:"skill",path:o.path,contentHash:o.contentHash}))].sort((o,a)=>o.path.localeCompare(a.path)),t=e.agentSnapshot.agents.map(o=>({path:o.path,contentHash:o.contentHash})).sort((o,a)=>o.path.localeCompare(a.path));return{contentHash:L({schemaVersion:"openpond.desktopWorkHarnessSurface.v1",components:r}),components:r,inactiveAgents:t}}w(N,"desktopWorkRuntimeSurface");function Y(e){let r=(e.now??(()=>new Date().toISOString()))(),t=e.proposal.edits.find(o=>o.route==="memory");return e.proposal.validationPlan.map(o=>{let a="passed",n="Memory candidate is bounded, scoped, and contains no obvious credential material.";try{if(o.kind==="observed_recovery"){if(!e.proposal.evidence.some(c=>c.kind==="recovery"))throw new Error("Observed-recovery validation requires recorded recovery evidence.");n="Memory proposal is grounded in immutable recovery evidence."}else if(o.kind==="memory"){if(!t||!/^memory\/[a-z0-9][a-z0-9-]{0,119}$/.test(t.target))throw new Error("Memory proposal requires one safe memory/<slug> target.");let c=e.proposal.metadata.expectedMemory;if(!c||typeof c!="object"||Array.isArray(c))throw new Error("Memory proposal requires an expected revision snapshot.");let d=c;if(d.key!==Z(t.target))throw new Error("Memory proposal expected revision targets a different key.");if(d.revision!==null&&(!Number.isInteger(d.revision)||Number(d.revision)<1))throw new Error("Memory proposal expected revision is invalid.");if(d.contentHash!==null&&typeof d.contentHash!="string")throw new Error("Memory proposal expected content hash is invalid.");if(d.status!==null&&d.status!=="active"&&d.status!=="deleted")throw new Error("Memory proposal expected status is invalid.");if(d.revision===null&&(d.contentHash!==null||d.status!==null))throw new Error("New memory snapshot must not claim existing content or status.");if(d.revision!==null&&(typeof d.contentHash!="string"||d.status===null))throw new Error("Existing memory snapshot requires its content hash and status.");if(t.operation==="delete"&&d.status!=="active")throw new Error("Memory deletion requires an active expected revision.");if(t.operation!=="delete"){if(!t.content?.trim()||t.content.length>24e3)throw new Error("Memory content must contain 1-24,000 characters.");if(/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(t.content))throw new Error("Memory content appears to contain credential material.")}}else a="blocked",n=`Memory validation cannot satisfy ${o.kind}.`}catch(c){a="failed",n=c instanceof Error?c.message:String(c)}return W({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${e.proposal.id}-${o.id}`,proposal:{id:e.proposal.id,contentHash:e.proposal.contentHash},validationId:o.id,kind:o.kind,status:a,summary:n,evidenceRefs:e.proposal.evidence,createdAt:r,metadata:{externalState:"harness_memory"}})})}w(Y,"validateMemoryProposal");function Z(e){let r=e.replaceAll("\\","/"),t=/^memory\/([a-z0-9][a-z0-9-]{0,119})$/.exec(r);if(!t)throw new Error(`Invalid Harness memory target: ${e}.`);return t[1]}w(Z,"memoryKeyFromTarget");async function F(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r)throw new Error(`Harness workspace ${e.workspaceId} does not exist.`);let t=P(e.storeDir,r.id),o=R.join(t.root,"source-swap.json"),a=await p.readFile(o,"utf8").then(JSON.parse).catch(d=>{if(d.code==="ENOENT")return null;throw d});if(!a)return"none";let n=await E({workspaceId:r.id,sourceDir:t.source});if(r.sourceRevision===a.nextSourceRevision&&n.sourceRevision===a.nextSourceRevision)return await p.rm(a.backupSource,{recursive:!0,force:!0}),await p.rm(o,{force:!0}),"completed";let c=await E({workspaceId:r.id,sourceDir:a.backupSource});if(r.sourceRevision===a.previousSourceRevision&&c.sourceRevision===a.previousSourceRevision)return await $(t.source,a.backupSource),await p.rm(o,{force:!0}),"restored";throw new Error("Harness source-swap recovery cannot reconcile filesystem and workspace revisions.")}w(F,"recoverLocalHarnessSourceSwap");async function K(e,r){for(let t of r.edits){let o=z(e,t.target);if(t.operation==="delete"){await p.rm(o,{force:!1});continue}if(t.content===null)throw new Error(`Refiner edit ${t.id} has no content.`);if(t.operation==="create")await p.mkdir(R.dirname(o),{recursive:!0}),await p.writeFile(o,t.content,{flag:"wx"});else{let a=await p.lstat(o);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Refiner update target must be a regular file: ${t.target}`);await p.writeFile(o,t.content,{flag:"w"})}}}w(K,"applyOverlayEdits");function z(e,r){let t=R.resolve(e),o=R.resolve(t,...r.replaceAll("\\","/").split("/")),a=R.relative(t,o);if(!a||a.startsWith("..")||R.isAbsolute(a))throw new Error(`Refiner edit target escapes the Harness source: ${r}`);return o}w(z,"containedPath");async function J(e,r){let t=`${e}.${I()}.tmp`;await p.writeFile(t,`${JSON.stringify(r,null,2)}
3
- `,{flag:"wx"}),await p.rename(t,e)}w(J,"writeSwapJournal");async function $(e,r){await p.rm(e,{recursive:!0,force:!0}),await p.rename(r,e)}w($,"restoreSource");var y="desktop-personal",U="personal-default";async function ve(e){let r=await e.store.getSelectedHarnessWorkspace({ownerKind:"personal",ownerId:y});if(r&&r.metadata.selectionEligible!==!1)return await F({store:e.store,storeDir:e.storeDir,workspaceId:r.id}),O(e.store,r.id,r.currentChannel.release?.contentHash??null);let t=(await e.store.listHarnessWorkspaces({ownerKind:"personal",ownerId:y})).find(n=>n.metadata.selectionEligible!==!1);if(t)return await e.store.selectHarnessWorkspace({ownerKind:"personal",ownerId:y,workspaceId:t.id,updatedAt:(e.now??(()=>new Date().toISOString()))()}),O(e.store,t.id,t.currentChannel.release?.contentHash??null);let o=await e.loadProfileState(),a=o.mode==="local"&&o.sourcePath&&!o.error?await M({store:e.store,storeDir:e.storeDir,id:U,ownerId:y,name:o.activeProfile?.trim()||"Personal Harness",profile:o,now:e.now}):await V({store:e.store,storeDir:e.storeDir,id:U,ownerId:y,name:"Personal Harness",now:e.now});return await e.store.selectHarnessWorkspace({ownerKind:"personal",ownerId:y,workspaceId:a.workspace.id,updatedAt:(e.now??(()=>new Date().toISOString()))()}),a.release}w(ve,"ensureSelectedLocalHarnessWorkspace");async function B(e){let r=await e.getSelectedHarnessWorkspace({ownerKind:"personal",ownerId:y});return r?O(e,r.id,r.currentChannel.release?.contentHash??null):null}w(B,"resolveSelectedLocalHarnessRelease");async function O(e,r,t){if(!t)throw new Error(`Selected Harness workspace ${r} has no current release.`);let o=await e.getHarnessReleaseRecord(t);if(!o||o.workspaceId!==r)throw new Error(`Selected Harness workspace ${r} points to a missing release ${t}.`);return b(o.agentSnapshot,"Selected Agent snapshot"),b(o.harnessRelease,"Selected Harness release"),o}w(O,"requireCurrentRelease");import{promises as Q}from"node:fs";import S from"node:path";async function be(e,r){if(r){let a=await e.getHarnessReleaseRecord(r.contentHash);if(!a||a.harnessRelease.id!==r.id)throw new Error("The selected immutable Harness release is unavailable.");let n=await e.getHarnessWorkspace(a.workspaceId);if(!n||n.ownerScope.kind!=="personal"||n.ownerScope.id!==y)throw new Error("The selected Harness release is not available to this local owner.");return b(a.agentSnapshot,"Selected Agent snapshot"),b(a.harnessRelease,"Selected Harness release"),G({workspace:n,release:a})}let t=await B(e);if(!t)return null;let o=await e.getSelectedHarnessWorkspace({ownerKind:"personal",ownerId:y});if(!o||o.id!==t.workspaceId)throw new Error("Selected Harness workspace changed while its release was being admitted.");return G({workspace:o,release:t})}w(be,"loadSelectedLocalHarnessRuntime");async function G(e){let{workspace:r,release:t}=e;if(t.workspaceId!==r.id)throw new Error("Harness release does not belong to the requested workspace.");let o=S.join(t.bundlePath,"source");await Promise.all(t.harnessRelease.files.map(s=>ee(o,s.path,s.contentHash)));let a=await Promise.all(t.agentSnapshot.instructions.map(async s=>({path:s.path,content:await j(o,s.path,s.contentHash)}))),n=[],c=new Map;for(let s of t.agentSnapshot.skills){let f=await j(o,s.path,s.contentHash),u=x(f);if(!u.name||!u.description||u.messages.length>0)throw new Error(`Released Harness Skill ${s.path} is invalid: ${u.messages.join(" ")||"missing name or description"}`);if(c.has(u.name))throw new Error(`Released Harness has duplicate Skill ${u.name}.`);let l=`${S.posix.dirname(s.path)}/`,i=t.harnessRelease.files.filter(k=>k.visibility==="policy"&&k.path.startsWith(l)&&k.path!==s.path).map(k=>k.path.slice(l.length)).sort(),g={name:u.name,description:u.description,path:s.path,scope:"profile",enabled:!0,sourcePath:o,charCount:f.length,sourceHash:s.contentHash,validationStatus:"valid",validationMessages:[],resourceFiles:i};n.push(g),c.set(g.name,async()=>{let k=await j(o,s.path,s.contentHash),H=x(k);if(!H.name||!H.description||H.messages.length>0)throw new Error(`Released Harness Skill ${s.path} failed validation while loading.`);return{name:H.name,description:H.description,body:H.body,path:s.path,sourceHash:s.contentHash,charCount:k.length,packagePath:S.join(o,...S.posix.dirname(s.path).split("/")),resourceFiles:i}})}n.sort((s,f)=>s.name.localeCompare(f.name));let d={profileSourcePath:o,skills:n,readSkill:c.size>0?async s=>{let f=c.get(s);if(!f)throw new Error(`Released Harness Skill not found: ${s}`);return f()}:null},h=a.sort((s,f)=>s.path.localeCompare(f.path)).map(({path:s,content:f})=>[`Active Harness instruction (${s}):`,f.trim()].join(`
4
- `)).filter(s=>s.trim().length>0),m=[["Harness capability receipt:",JSON.stringify({harnessRelease:{id:t.harnessRelease.id,contentHash:t.harnessRelease.contentHash},agentSnapshot:{id:t.agentSnapshot.id,contentHash:t.agentSnapshot.contentHash},files:t.harnessRelease.files.filter(s=>s.visibility==="policy").map(s=>({path:s.path,contentHash:s.contentHash})),skills:t.agentSnapshot.skills.map(s=>s.path),agents:t.agentSnapshot.agents.map(s=>s.path),tools:t.agentSnapshot.toolDeclarations.map(s=>s.name),capabilityRequirements:t.agentSnapshot.capabilityRequirements})].join(`
5
- `),h.length>0?["Active Harness preflight:","Apply the following released instructions when planning work and immediately before every tool call.","Preflight each call: (1) identify any active instruction that matches the planned operation, (2) inspect the exact tool arguments for a forbidden pattern, and (3) rewrite the call before sending it when a pattern matches. Compliance is required even when the prohibited call might still succeed.",...h].join(`
6
-
7
- `):null].filter(s=>!!s?.trim()).join(`
8
-
9
- `);return{workspace:r,release:t,instructionContext:m,skillRuntime:d}}w(G,"loadLocalHarnessRuntimeFromRelease");async function j(e,r,t){let o=S.resolve(e,...r.split("/")),a=S.relative(S.resolve(e),o);if(!a||a.startsWith("..")||S.isAbsolute(a))throw new Error(`Released Harness asset escapes its bundle: ${r}`);let n=await Q.readFile(o),c=D(n);if(c!==t)throw new Error(`Released Harness asset ${r} is ${c}; expected ${t}.`);return new TextDecoder("utf-8",{fatal:!0}).decode(n)}w(j,"readVerifiedAsset");async function ee(e,r,t){let o=S.resolve(e,...r.split("/")),a=S.relative(S.resolve(e),o);if(!a||a.startsWith("..")||S.isAbsolute(a))throw new Error(`Released Harness asset escapes its bundle: ${r}`);let n=D(await Q.readFile(o));if(n!==t)throw new Error(`Released Harness asset ${r} is ${n}; expected ${t}.`)}w(ee,"verifyAsset");export{le as a,de as b,pe as c,y as d,ve as e,B as f,be as g,G as h};
@@ -1,4 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{g as W}from"./chunk-STDMBJOQ.js";import{c as E}from"./chunk-IR3YJWPW.js";import{P as B}from"./chunk-55G6B54U.js";import{Ua as C,y as k}from"./chunk-KD3QVRIJ.js";import{b as S}from"./chunk-ES2ISFJC.js";import{a as s}from"./chunk-FTQLQJQV.js";import{promises as H}from"node:fs";import F from"node:path";async function Z(e){let c=await W(e.store,e.harnessRelease);if(!c)throw new Error("Profile evaluation Harness release is unavailable.");return Q({...e,runtime:c})}s(Z,"profileEvaluationsForRelease");async function Q(e){let c=e.runtime,r=c.release.harnessRelease;if(r.id!==e.harnessRelease.id||r.contentHash!==e.harnessRelease.contentHash)throw new Error("Profile evaluation runtime differs from its requested release.");let i=r.metadata.profile;if(!i||typeof i!="object"||i.id!==e.ref.profileId||i.sourceRevision!==e.sourceRevision)throw new Error("Profile evaluation release differs from its accepted source.");let a={profileRef:e.ref,sourceRevision:e.sourceRevision,harnessRelease:e.harnessRelease};if(!r.files.some(o=>o.path==="evals/catalog.json"))return{...a,catalogHash:null,definitions:[],suites:[]};let t=F.join(c.release.bundlePath,"source"),d=s(async o=>r.files.some(u=>u.path===o)?H.readFile(F.join(t,...o.split("/"))):void 0,"read"),[n,x,l]=await Promise.all([d("evals/catalog.json"),d("workflows/catalog.json"),d("workflows/actions.json")]),{catalog:m,catalogHash:w}=C({agentSnapshot:c.release.agentSnapshot,harnessRelease:r,catalogBytes:n,workflowBytes:x,actionBytes:l});return{...a,catalogHash:w,definitions:m.definitions,suites:m.suites}}s(Q,"profileEvaluationsForRuntime");var $=S.object({score:S.number().finite().min(0).max(1).nullable(),passed:S.boolean(),feedback:S.string().max(2e4),evidenceRefs:S.array(S.string().max(240)).max(1e3).default([])}).strict().refine(e=>e.score!==null||!e.passed,{message:"Unscorable verifiers cannot pass.",path:["passed"]});function O(e){if(e==="sandbox_process")throw new Error("verifier_sandbox_process_required")}s(O,"assertIsolatedVerifierRuntime");import{Worker as V}from"node:worker_threads";async function D(e){let c=J(await e),[r,i,{QuickJSWASMModule:a}]=await Promise.all([c.importModuleLoader().then(J),c.importFFI(),import("./module-ES6BEMUI-ZVL3F6NW.js").then(J)]),t=await r();t.type="sync";let d=new i(t);return new a(t,d)}s(D,"newQuickJSWASMModuleFromVariant");function J(e){return e&&"default"in e&&e.default?e.default&&"default"in e.default&&e.default.default?e.default.default:e.default:e}s(J,"smartUnwrap");var M=class extends Error{static{s(this,"JavaScriptIsolateExecutionError")}constructor(c){super(c),this.name="JavaScriptIsolateExecutionError"}};async function Ee(e){R(e),e.signal?.throwIfAborted();let c=s(t=>new Error(`${e.errorPrefix}_${t}`),"error"),r=Date.now()+e.timeoutMs,{default:i}=await import("./dist-SKYG5LZO.js");e.signal?.throwIfAborted();let a=await D(i);e.signal?.throwIfAborted();try{return E.withScope(t=>{let d=t.manage(a.newRuntime());d.setMemoryLimit(33554432),d.setMaxStackSize(262144),d.setInterruptHandler(()=>Date.now()>=r||e.signal?.aborted===!0);let n=t.manage(d.newContext());e.deterministic&&t.manage(n.unwrapResult(n.evalCode("globalThis.Date = undefined; Math.random = () => { throw new Error('environment_random_requires_explicit_seed'); };")));let x=t.manage(n.unwrapResult(n.evalCode("JSON.stringify"))),l=t.manage(n.unwrapResult(n.evalCode(`JSON.parse(${JSON.stringify(JSON.stringify(e.value))})`))),m=t.manage(n.unwrapResult(n.evalCode(e.source,`${e.errorPrefix}.mjs`,{type:"module"}))),w=t.manage(N(n,m,r,e.signal,c)),o=t.manage(n.getProp(w,e.exportName));if(n.typeof(o)!=="function")throw c("function_export_missing");let u=t.manage(n.unwrapResult(n.callFunction(o,n.undefined,l))),g=t.manage(N(n,u,r,e.signal,c)),h=t.manage(n.unwrapResult(n.callFunction(x,n.undefined,g)));if(n.typeof(h)!=="string")throw c("result_not_json");let b=n.getString(h);if(new TextEncoder().encode(b).byteLength>e.maxResultBytes)throw c("result_too_large");if(e.signal?.throwIfAborted(),Date.now()>=r)throw c("timeout");let p=JSON.parse(b);return k(p,e.maxResultBytes),p})}catch(t){throw e.signal?.throwIfAborted(),new M(t instanceof Error?t.message:"JavaScript execution failed.")}}s(Ee,"executeJavaScriptIsolate");function R(e){if(!Number.isInteger(e.timeoutMs)||e.timeoutMs<1||e.timeoutMs>3e5)throw new Error(`${e.errorPrefix}_timeout_invalid`);if(!Number.isInteger(e.maxResultBytes)||e.maxResultBytes<1||e.maxResultBytes>4194304)throw new Error(`${e.errorPrefix}_result_limit_invalid`);if(new TextEncoder().encode(e.source).byteLength>524288)throw new Error(`${e.errorPrefix}_source_too_large`);k(e.value,4194304)}s(R,"validateJavaScriptIsolateInput");function N(e,c,r,i,a){for(;;){if(i?.throwIfAborted(),Date.now()>=r)throw a("timeout");let t=e.getPromiseState(c);if(t.type==="fulfilled")return t.notAPromise?t.value.dup():t.value;if(t.type==="rejected")return e.unwrapResult(t);if(e.runtime.executePendingJobs(1).unwrap()===0)throw a("unresolved_promise")}}s(N,"settle");async function I(e){e.signal?.throwIfAborted(),R(e);let{javascriptVerifierWorkerSource:c}=await import("./javascript-verifier-worker-source-F3LSGPOY.js");e.signal?.throwIfAborted();let r=e.signal,i={source:e.source,exportName:e.exportName,value:e.value,timeoutMs:e.timeoutMs,maxResultBytes:e.maxResultBytes,deterministic:e.deterministic===!0,errorPrefix:e.errorPrefix},a=s(t=>new Error(`${e.errorPrefix}_${t}`),"error");return new Promise((t,d)=>{let n=new V(c,{eval:!0,workerData:i,execArgv:[],env:{},resourceLimits:{maxOldGenerationSizeMb:64,maxYoungGenerationSizeMb:16,stackSizeMb:4}}),x=!1,l=s(o=>{x||(x=!0,clearTimeout(w),r?.removeEventListener("abort",m),n.terminate().then(()=>{"error"in o?d(o.error):t(o.result)},d))},"finish"),m=s(()=>l({error:r?.reason instanceof Error?r.reason:a("cancelled")}),"cancel"),w=setTimeout(()=>l({error:a("timeout")}),e.timeoutMs);r?.addEventListener("abort",m,{once:!0}),n.once("error",o=>l({error:o})),n.once("exit",()=>{x||l({error:a("worker_exited_without_result")})}),n.once("message",o=>{try{if(!o||typeof o!="object"||!("ok"in o))throw a("worker_invalid_response");if(o.ok!==!0)throw new Error("error"in o&&typeof o.error=="string"?o.error:`${e.errorPrefix}_execution_failed`);if(!("result"in o))throw a("worker_invalid_response");k(o.result,e.maxResultBytes),l({result:o.result})}catch(u){l({error:u instanceof Error?u:a("worker_invalid_response")})}}),r?.aborted&&m()})}s(I,"executeJavaScriptIsolateInWorker");import{spawn as q}from"node:child_process";async function De(e){e.signal?.throwIfAborted(),R(e);let{javascriptIsolateProcessSource:c}=await import("./javascript-isolate-process-source-ZPQKKLR4.js");e.signal?.throwIfAborted();let{signal:r,stripTypeScript:i,...a}=e,t=s(n=>new Error(`${e.errorPrefix}_${n}`),"error"),d=`globalThis.__openpondIsolateInput = JSON.parse(${JSON.stringify(JSON.stringify(a))});
3
- ${i?`globalThis.__openpondIsolateInput.source = require("node:module").stripTypeScriptTypes(globalThis.__openpondIsolateInput.source, { mode: "strip" });
4
- `:""}${c}`;return new Promise((n,x)=>{let l=q("node",["--max-old-space-size=64","--input-type=commonjs","-"],{stdio:["pipe","pipe","pipe"],env:{PATH:process.env.PATH},windowsHide:!0}),m,w="",o=0,u=0,g=s(p=>{m??=p,l.kill("SIGKILL")},"stop"),h=s(()=>g(r?.reason instanceof Error?r.reason:t("cancelled")),"cancel"),b=setTimeout(()=>g(e.errorPrefix==="candidate"?new M("candidate_timeout"):t("timeout")),e.timeoutMs);r?.addEventListener("abort",h,{once:!0}),l.stdout.setEncoding("utf8"),l.stdout.on("data",p=>{o+=Buffer.byteLength(p),o>e.maxResultBytes+65536?g(t("process_response_too_large")):w+=p}),l.stderr.on("data",p=>{u+=p.byteLength,u>65536&&g(t("process_stderr_too_large"))}),l.once("error",p=>{m??=p}),l.stdin.on("error",p=>g(p)),l.once("close",p=>{if(clearTimeout(b),r?.removeEventListener("abort",h),m){x(m);return}try{if(p!==0)throw t("process_exited_without_result");let f=JSON.parse(w);if(!f||typeof f!="object"||!("ok"in f))throw t("process_invalid_response");if(f.ok!==!0){let _="error"in f&&typeof f.error=="string"?f.error:`${e.errorPrefix}_execution_failed`;throw"executionError"in f&&f.executionError===!0?new M(_):new Error(_)}if(!("result"in f))throw t("process_invalid_response");k(f.result,e.maxResultBytes),n(f.result)}catch(f){x(f instanceof Error?f:t("process_invalid_response"))}}),l.stdin.end(d),r?.aborted&&h()})}s(De,"executeJavaScriptIsolateInProcess");async function Qe(e){return O(e.runtime),$.parse(await I({...e,exportName:e.exportName??"verify",maxResultBytes:65536,errorPrefix:"verifier"}))}s(Qe,"executeJavaScriptVerifierInWorker");function Xe(e){return B(e,j)}s(Xe,"aggregateTasksetEvaluationInWorker");var j=s(async({source:e,module:c,exportName:r,scores:i,timeoutMs:a,signal:t})=>{let d=/\.[cm]?ts$/.test(c)?(await import("node:module")).stripTypeScriptTypes(e,{mode:"strip"}):e;return I({source:d,exportName:r,value:i,timeoutMs:a,signal:t,maxResultBytes:1024,deterministic:!0,errorPrefix:"metric"})},"executeMetric");var Ze=j;import{spawn as G}from"node:child_process";import{realpath as P}from"node:fs/promises";import v from"node:path";function nr(e){return s(async function(r){if(!r.command.trim()||r.command.length>2e4)throw new Error("Candidate command is empty or exceeds its bounded size.");if(r.stdin!==void 0&&Buffer.byteLength(r.stdin)>1e6)throw new Error("Candidate command input exceeds its bounded size.");r.signal?.throwIfAborted();let i=await e.authorize(r);if(i.candidateId!==r.candidateId||i.sessionId!==r.sessionId||i.turnId!==r.turnId||i.candidateRevision!==r.expectedRevision||!i.ownerId)throw new Error("Candidate command admission differs from its durable owner/session/turn/revision.");let a=await P(i.sourceRoot),t=r.cwd?await P(r.cwd):a,d=v.relative(a,t);if(d.startsWith("..")||v.isAbsolute(d))throw new Error("Candidate command cwd escapes its isolated source.");let n=Math.min(Math.max(r.timeoutMs??12e4,1),18e4),x=Math.min(Math.max(r.maxOutputBytes??25e4,1),1e6),l=i.layout==="work"?"/workspace":"/workspace/work",m=["--unshare-all","--die-with-parent","--new-session","--clearenv","--ro-bind","/usr","/usr","--ro-bind","/lib","/lib","--ro-bind","/lib64","/lib64","--symlink","usr/bin","/bin","--symlink","usr/sbin","/sbin","--proc","/proc","--dev","/dev","--tmpfs","/tmp","--dir","/tmp/home","--dir","/runtime","--dir","/workspace","--ro-bind",a,l,"--ro-bind",process.execPath,"/runtime/node","--setenv","HOME","/tmp/home","--setenv","PATH","/runtime:/usr/bin:/bin","--setenv","TMPDIR","/tmp","--setenv","LANG","C.UTF-8","--chdir",`${l}${d?`/${d.split(v.sep).join("/")}`:i.layout==="work"?"/work":""}`];for(let[w,o]of[[i.writablePaths,"--bind"],[i.protectedPaths??[],"--ro-bind"]])for(let u of w){if(v.isAbsolute(u)||u.split(/[\\/]/).includes(".."))throw new Error("Candidate mount path escapes its admitted source.");let g=await P(v.resolve(a,u)),h=v.relative(a,g);if(h.startsWith("..")||v.isAbsolute(h))throw new Error("Candidate mount symlink escapes its admitted source.");m.push(o,g,`${l}${h?`/${h.split(v.sep).join("/")}`:""}`)}i.layout==="profile_case"&&m.push("--symlink","work/inputs","/workspace/inputs","--symlink","work/outputs","/workspace/outputs");for(let w of i.runtimeMounts??[]){let o=v.posix.normalize(w.destination),u=await P(w.source);if(!o.startsWith("/runtime/")&&o!=="/workspace/node_modules"||o==="/runtime/node"||o.includes("\0")||u===a||u.startsWith(`${a}${v.sep}`))throw new Error("Candidate runtime mount must be a separate server-owned public runtime bundle.");m.push("--ro-bind",u,o)}return m.push("--","/bin/sh","-lc",r.command),new Promise((w,o)=>{let u=G(e.bwrapPath??"/usr/bin/bwrap",m,{detached:!0,stdio:[r.stdin===void 0?"ignore":"pipe","pipe","pipe"],env:{PATH:"/usr/bin:/bin"}});r.stdin!==void 0&&u.stdin&&(u.stdin.on("error",()=>{}),u.stdin.end(r.stdin));let g={stdout:[],stderr:[]},h={stdout:0,stderr:0},b={stdout:!1,stderr:!1},p=!1,f=s(()=>{try{u.pid&&process.kill(-u.pid,"SIGKILL")}catch{u.kill("SIGKILL")}},"kill"),_=s(()=>f(),"abort"),z=setTimeout(()=>{p=!0,f()},n);r.signal?.addEventListener("abort",_,{once:!0});for(let y of["stdout","stderr"])u[y].on("data",A=>{let T=Math.max(0,x-h[y]);T&&g[y].push(A.subarray(0,T)),h[y]+=A.byteLength,h[y]>x&&(b[y]=!0)});let L=s(()=>{clearTimeout(z),r.signal?.removeEventListener("abort",_)},"clean");u.once("error",y=>{L(),o(new Error(`Candidate filesystem confinement is unavailable: ${y.message}`))}),u.once("close",y=>{L(),r.signal?.aborted?o(r.signal.reason):w({code:y,stdout:Buffer.concat(g.stdout).toString("utf8"),stderr:Buffer.concat(g.stderr).toString("utf8"),timedOut:p,stdoutTruncated:b.stdout,stderrTruncated:b.stderr})}),r.signal?.aborted&&f()})},"execute")}s(nr,"createCandidateCommandExecutor");export{$ as a,M as b,Ee as c,I as d,De as e,Qe as f,Xe as g,Ze as h,nr as i,Z as j,Q as k};
@@ -1,18 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{d as F}from"./chunk-5CMKGD43.js";import{a as o}from"./chunk-FTQLQJQV.js";import{spawn as nt,spawnSync as At}from"node:child_process";import{accessSync as vt,constants as Rt,existsSync as _t,promises as Bt}from"node:fs";import et from"node:path";var rt="Git is required for OpenPond app workspaces, but macOS reports Apple Command Line Tools are not installed. OpenPond skipped /usr/bin/git to avoid opening the Xcode installer prompt. Install Command Line Tools with `xcode-select --install`, install Git from Homebrew, or put a non-Apple git binary earlier on PATH.",T;function Lt(e){try{return _t(e)?(vt(e,Rt.X_OK),!0):!1}catch{return!1}}o(Lt,"isExecutable");function Ot(){let e=(process.env.PATH??"").split(et.delimiter).map(t=>t.trim()).filter(Boolean);for(let t of e){let n=et.join(t,"git");if(!(n==="/usr/bin/git"||n==="/bin/git")&&Lt(n))return n}return null}o(Ot,"firstNonAppleGitOnPath");function it(){let e=At("/usr/bin/xcode-select",["-p"],{encoding:"utf8",stdio:["ignore","pipe","pipe"]});return e.status===0&&!!e.stdout.trim()}o(it,"appleDeveloperToolsAvailable");function Dt(e){if(e!=="git"||process.platform!=="darwin")return{command:e};if(T!==void 0)return{command:T};let t=Ot();return t?(T=t,{command:t}):it()?(T="git",{command:"git"}):{error:rt}}o(Dt,"resolveWorkspaceCommand");function u(e,t,n,r={},i){return new Promise(s=>{let a=Dt(e);if("error"in a){s({code:1,stdout:"",stderr:a.error});return}let c=nt(a.command,t,{cwd:n,env:{...process.env,...r,GIT_TERMINAL_PROMPT:"0"},stdio:[i===void 0?"ignore":"pipe","pipe","pipe"]}),d=[],p=[];i!==void 0&&c.stdin?.end(i),c.stdout?.on("data",h=>d.push(h)),c.stderr?.on("data",h=>p.push(h)),c.on("error",h=>{s({code:1,stdout:"",stderr:h.message})}),c.on("close",h=>{s({code:h??1,stdout:Buffer.concat(d).toString("utf8"),stderr:Buffer.concat(p).toString("utf8")})})})}o(u,"runCommand");function Gt(e){return!!(e&&e.includes(rt.slice(0,80)))}o(Gt,"isMacOSGitDeveloperToolsMissing");async function ye(e){await Bt.mkdir(e,{recursive:!0});let t=await u("git",["--version"],e);if(t.code===0)return{ok:!0,command:T??"git",version:(t.stdout||t.stderr).trim()};let n=t.stderr.trim()||t.stdout.trim()||"Git is required for OpenPond app workspaces.";return{ok:!1,error:n,installAction:process.platform==="darwin"&&Gt(n)?"macos_command_line_tools":"manual_git_install"}}o(ye,"checkWorkspaceGitAvailability");function be(){if(process.platform!=="darwin")return{ok:!1,error:"Apple Command Line Tools installation is only available on macOS."};if(it())return{ok:!0,message:"Apple Command Line Tools already appear to be installed."};try{return nt("/usr/bin/xcode-select",["--install"],{detached:!0,stdio:"ignore"}).unref(),{ok:!0,message:"Opened the Apple Command Line Tools installer."}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}o(be,"startMacOSCommandLineToolsInstall");import{promises as k}from"node:fs";import m from"node:path";import It from"node:os";var st=24e3,ot=8e4,Tt=512*1024,ct=15*1024*1024,Mt=20*1024*1024,zt=new Set([".cache",".eggs",".git",".ipynb_checkpoints",".mypy_cache",".next",".nox",".nuxt",".openpond",".output",".parcel-cache",".pytest_cache",".pyre",".ruff_cache",".svelte-kit",".tox",".turbo",".venv","__pycache__","artifacts","build","coverage","dist","env","node_modules","out","site-packages","target","venv","volumes"]),$t=new Set([".7z",".avif",".db",".doc",".docx",".gif",".gz",".ico",".jpeg",".jpg",".mov",".mp4",".pdf",".png",".sqlite",".tar",".webp",".xls",".xlsm",".xlsx",".zip"]),Nt=new Map([[".avif","image/avif"],[".gif","image/gif"],[".jpeg","image/jpeg"],[".jpg","image/jpeg"],[".png","image/png"],[".webp","image/webp"]]),Ht=new Map([[".m4v","video/x-m4v"],[".mov","video/quicktime"],[".mp4","video/mp4"],[".webm","video/webm"]]),Ut=new Set([".doc",".docx",".pdf"]);function jt(e){return e.replace(/[^a-zA-Z0-9._-]/g,"-").slice(0,120)||"app"}o(jt,"safeAppSegment");function N(e){if(!e)return"unknown";try{let t=new URL(e).hostname.toLowerCase();if(t==="github.com"||t.endsWith(".github.com"))return"github";if(t==="openpond.ai"||t.endsWith(".openpond.ai"))return"openpond"}catch{return"unknown"}return"local_git"}o(N,"sourceFromRemote");function $(e){return e.replace(/x-access-token:[^@]+@/g,"x-access-token:***@").replace(/Authorization:\s*Basic\s+[A-Za-z0-9+/=]+/gi,"Authorization: Basic ***")}o($,"redactRemoteUrl");async function G(e){try{return await k.access(e),!0}catch{return!1}}o(G,"pathExists");async function O(e){return await G(e)?(await u("git",["rev-parse","--git-dir"],e)).code===0:!1}o(O,"isGitRepo");function X(e){return e.length<=st?e:`${e.slice(0,st)}
3
-
4
- [diff truncated]`}o(X,"truncatePatch");function qt(e){return e.length<=ot?e:`${e.slice(0,ot)}
5
-
6
- [file truncated]`}o(qt,"truncateFileContent");async function I(e,t){let n=m.resolve(e,t),r=m.resolve(e);if(n!==r&&!n.startsWith(`${r}${m.sep}`))return null;try{let i=await k.lstat(n);return!i.isFile()||!Xt(t,i.size)?null:qt(await k.readFile(n,"utf8"))}catch{return null}}o(I,"readWorkspaceFile");async function V(e,t){let n=w(t);if(!n||!Ut.has(m.extname(n).toLowerCase()))return null;let r=m.resolve(e,n),i=m.resolve(e);if(r!==i&&!r.startsWith(`${i}${m.sep}`))return null;try{let s=await k.lstat(r);return!s.isFile()||s.size>Mt?null:(await k.readFile(r)).toString("base64")}catch{return null}}o(V,"readWorkspaceDocumentPreview");function lt(e){return Nt.get(m.extname(e).toLowerCase())??null}o(lt,"workspaceImageContentType");function Kt(e){return Ht.get(m.extname(e).toLowerCase())??null}o(Kt,"localVideoContentType");async function ut(e,t){let n=w(t);if(!n)return null;let r=lt(n);if(!r)return null;let i=m.resolve(e,n),s=m.resolve(e);if(i!==s&&!i.startsWith(`${s}${m.sep}`))return null;try{let a=await k.lstat(i);return!a.isFile()||a.size>ct?null:{path:n,contentType:r,bytes:await k.readFile(i),sizeBytes:a.size}}catch{return null}}o(ut,"readWorkspaceImageFile");async function Re(e){let t=dt(e);if(!t)return null;let n=lt(t);if(!n)return null;let r=m.resolve(t);try{let i=await k.lstat(r);return!i.isFile()||i.size>ct?null:{path:r,contentType:n,bytes:await k.readFile(r),sizeBytes:i.size}}catch{return null}}o(Re,"readLocalImageFile");async function _e(e){let t=dt(e);if(!t)return null;let n=Kt(t);if(!n)return null;let r=m.resolve(t);try{let i=await k.lstat(r);return i.isFile()?{path:r,contentType:n,sizeBytes:i.size}:null}catch{return null}}o(_e,"readLocalVideoFile");function dt(e){let t=e.trim();if(!t)return null;if(t=t.replace(/^['"`]+|['"`]+$/g,""),t.startsWith("file://"))try{t=decodeURIComponent(new URL(t).pathname)}catch{t=t.replace(/^file:\/\//,"")}return t.startsWith("~/")&&(t=m.join(It.homedir(),t.slice(2))),m.isAbsolute(t)?t:null}o(dt,"cleanLocalAssetPath");function Xt(e,t){return t>Tt?!1:!$t.has(m.extname(e).toLowerCase())}o(Xt,"isReadableTextWorkspaceFile");async function pt(e,t){let n=m.resolve(e,t),r=m.resolve(e);if(n!==r&&!n.startsWith(`${r}${m.sep}`))return!1;try{return(await k.lstat(n)).isDirectory()}catch{return!1}}o(pt,"isWorkspaceDirectory");function w(e){let t=e.replace(/\\/g,"/").replace(/^\.\/+/,"");if(!t.trim()||t.startsWith("/"))return null;let n=t.split("/").filter(Boolean);return n.length===0||n.some(r=>r===".."||r===".git")?null:n.join("/")}o(w,"normalizeWorkspaceFilePath");function y(e){let t=w(e);return t?t.split("/").some(n=>zt.has(n)||n===".env"||n.startsWith(".env.")||n.endsWith(".egg-info")||n.endsWith(".pyc")||n.endsWith(".pyo")):!0}o(y,"isGeneratedWorkspacePath");async function ft(e,t){if(y(t))return!1;let n=await u("git",["ls-files","--cached","--others","--exclude-standard","--",t],e);return n.code!==0?!1:n.stdout.split(`
7
- `).map(r=>r.trim()).some(r=>r===t)}o(ft,"isVisibleGitWorkspaceFile");function M(e){if(!e.trim()||e.startsWith("## "))return null;let t=e.slice(0,2),n=e.slice(3).trim(),r=n.includes(" -> ")?n.split(" -> ").pop().trim():n;return r?t==="??"?{path:r,status:"untracked"}:t.includes("A")?{path:r,status:"added"}:t.includes("D")?{path:r,status:"deleted"}:t.includes("R")?{path:r,status:"renamed"}:{path:r,status:"modified"}:null}o(M,"parseStatusLine");function mt(e){let t=e.replace(/^##\s*/,"").split("...")[1]?.trim();if(!t)return{upstreamBranch:null,ahead:0,behind:0};let n=t.indexOf("["),r=(n>=0?t.slice(0,n):t).trim()||null,i=t.match(/ahead\s+(\d+)/),s=t.match(/behind\s+(\d+)/);return{upstreamBranch:r,ahead:i&&Number(i[1])||0,behind:s&&Number(s[1])||0}}o(mt,"parseBranchStatusLine");function H(e){let t=new Map;for(let n of e.split(`
8
- `)){if(!n.trim())continue;let[r,i,...s]=n.split(" "),a=s.join(" ").trim();a&&t.set(a,{additions:r==="-"?0:Number(r)||0,deletions:i==="-"?0:Number(i)||0})}return t}o(H,"parseNumstat");function U(e){return Array.from(new Set(e.filter(Boolean))).sort((t,n)=>t.localeCompare(n))}o(U,"uniqueSortedPaths");var at=2e3;async function ht(e){let t=[];async function n(r,i=""){if(t.length>=at)return;let s;try{s=await k.readdir(r,{withFileTypes:!0})}catch{return}s.sort((a,c)=>a.name.localeCompare(c.name));for(let a of s){if(t.length>=at)return;let c=i?`${i}/${a.name}`:a.name;if(y(c))continue;let d=m.join(r,a.name);a.isDirectory()?await n(d,c):a.isFile()&&t.push(c)}}return o(n,"walk"),await n(e),U(t)}o(ht,"listPlainWorkspaceFiles");function gt(e){let t=e?.trim();if(!t)return null;try{return new URL(t.includes("://")?t:`https://${t}`).host.replace(/\/+$/,"")}catch{return t.replace(/^https?:\/\//i,"").replace(/\/+$/,"")}}o(gt,"normalizeGitHost");function Vt(e){let t=e?.trim();if(!t)return null;try{let n=new URL(t);return{protocol:n.protocol||"https:",host:n.host}}catch{return null}}o(Vt,"normalizeGitBaseUrl");function Yt(e){let t=gt(e);return!t||t==="openpond.ai"||t==="www.openpond.ai"}o(Yt,"isDefaultOpenPondGitHost");function wt(e,t){let n=e.gitOwner?.trim(),r=e.gitRepo?.trim();if(!n||!r)return null;let i=Vt(t),s=gt(e.gitHost),a=i&&Yt(s)?i.host:s||i?.host||"openpond.ai",c=i&&a===i.host?i.protocol:"https:",d=r.endsWith(".git")?r:`${r}.git`;return`${c}//${a}/${n}/${d}`}o(wt,"expectedRemoteUrl");function Jt(e){try{let t=new URL(e).hostname.toLowerCase();return t==="openpond.ai"||t.endsWith(".openpond.ai")}catch{return!1}}o(Jt,"isOpenPondRemote");function Zt(e,t){return!t||!Jt(e)?{}:{GIT_CONFIG_COUNT:"1",GIT_CONFIG_KEY_0:"http.extraHeader",GIT_CONFIG_VALUE_0:`Authorization: Basic ${Buffer.from(`x-access-token:${t}`,"utf8").toString("base64")}`}}o(Zt,"gitBasicAuthEnv");function Y(e){let t=e.trim();if(!t)throw new Error("Branch name is required");if(t.includes(".."))throw new Error("Branch name cannot contain '..'");if(/[~^:\\\s]/.test(t))throw new Error("Branch name contains unsupported characters");if(t.startsWith("/")||t.endsWith("/")||t.startsWith("-"))throw new Error("Branch name is not safe")}o(Y,"assertSafeBranchName");function R(e,t){let n=m.join(e,"workspaces",jt(t));return{workspacePath:n,repoPath:m.join(n,"repo")}}o(R,"appWorkspacePaths");async function kt(e,t,n,r){await k.mkdir(t,{recursive:!0});let i=await G(e),s=await u("git",["clone","--quiet",n,e],t,Zt(n,r));if(s.code!==0)throw i||await k.rm(e,{recursive:!0,force:!0}).catch(()=>null),new Error($(s.stderr.trim()||s.stdout.trim()||"git clone failed"));let a=await u("git",["remote","set-url","origin",n],e);if(a.code!==0)throw new Error($(a.stderr.trim()||a.stdout.trim()||"git remote set-url failed"))}o(kt,"cloneWorkspace");async function Wt(e){let t=await u("git",["rev-parse","--git-path","FETCH_HEAD"],e),n=t.code===0&&t.stdout.trim()?m.resolve(e,t.stdout.trim()):m.join(e,".git","FETCH_HEAD");try{return(await k.stat(n)).mtime.toISOString()}catch{return null}}o(Wt,"lastFetchAt");import{promises as Qt}from"node:fs";async function Te(e,t,n={}){return z(R(e,t.id),t,n)}o(Te,"loadWorkspaceState");async function z(e,t,n={}){let{workspacePath:r,repoPath:i}=e,s=wt(t,n.gitBaseUrl);await Qt.mkdir(r,{recursive:!0});let a=await O(i),c=null;if(!a&&n.clone&&s)try{await kt(i,r,s,n.token),a=!0}catch(g){c=g instanceof Error?g.message:String(g)}if(!a)return n.allowPlainFolder&&await G(i)?{appId:t.id,source:"local_folder",workspacePath:r,repoPath:i,initialized:!0,remoteUrl:null,expectedRemoteUrl:s,currentBranch:null,headCommit:null,upstreamBranch:null,ahead:0,behind:0,diverged:!1,linkedSourceHeadCommit:n.linkedSourceHeadCommit?.trim()||null,aheadOfLinkedSource:0,behindLinkedSource:0,divergedFromLinkedSource:!1,linkedSourceComparisonError:null,lastFetchAt:null,defaultBranch:t.defaultBranch??null,branches:[],dirty:!1,changedFilesCount:0,untrackedFilesCount:0,error:c,updatedAt:F()}:{appId:t.id,source:N(s),workspacePath:r,repoPath:i,initialized:a,remoteUrl:null,expectedRemoteUrl:s,currentBranch:null,headCommit:null,upstreamBranch:null,ahead:0,behind:0,diverged:!1,linkedSourceHeadCommit:n.linkedSourceHeadCommit?.trim()||null,aheadOfLinkedSource:0,behindLinkedSource:0,divergedFromLinkedSource:!1,linkedSourceComparisonError:null,lastFetchAt:null,defaultBranch:t.defaultBranch??null,branches:[],dirty:!1,changedFilesCount:0,untrackedFilesCount:0,error:c,updatedAt:F()};let[d,p,h,b,A]=await Promise.all([u("git",["branch","--show-current"],i),u("git",["branch","--format=%(refname:short)"],i),u("git",["status","--porcelain=v1","-b"],i),u("git",["config","--get","remote.origin.url"],i),u("git",["rev-parse","--verify","HEAD"],i)]),v=b.code===0&&$(b.stdout.trim())||null,S=h.code===0?h.stdout.split(`
9
- `).filter(g=>g.trim()):[],C=mt(S.find(g=>g.startsWith("## "))??""),f=S.filter(g=>{if(g.startsWith("## "))return!1;let D=M(g),tt=D?w(D.path):null;return!!(tt&&!y(tt))}),x=f.filter(g=>g.startsWith("??")).length,E=d.code===0&&d.stdout.trim()?d.stdout.trim():null,L=A.code===0&&A.stdout.trim()||null,q=p.code===0?p.stdout.split(`
10
- `).map(g=>g.trim()).filter(Boolean):[],l=N(v)==="unknown"&&s?s:v??s,W=await te(i,n.linkedSourceHeadCommit,L);return{appId:t.id,source:l?N(l):"local_git",workspacePath:r,repoPath:i,initialized:a,remoteUrl:v,expectedRemoteUrl:s,currentBranch:E,headCommit:L,upstreamBranch:C.upstreamBranch,ahead:C.ahead,behind:C.behind,diverged:C.ahead>0&&C.behind>0,linkedSourceHeadCommit:W.linkedSourceHeadCommit,aheadOfLinkedSource:W.aheadOfLinkedSource,behindLinkedSource:W.behindLinkedSource,divergedFromLinkedSource:W.divergedFromLinkedSource,linkedSourceComparisonError:W.error,lastFetchAt:await Wt(i),defaultBranch:t.defaultBranch??null,branches:q,dirty:f.length>0,changedFilesCount:f.length,untrackedFilesCount:x,error:c,updatedAt:F()}}o(z,"loadWorkspaceStateAtPath");async function te(e,t,n){let r=t?.trim()||null,i={linkedSourceHeadCommit:r,aheadOfLinkedSource:0,behindLinkedSource:0,divergedFromLinkedSource:!1,error:null};if(!r||!n||r===n)return i;let s=await u("git",["rev-list","--left-right","--count",`${r}...${n}`],e);if(s.code!==0)return{...i,error:s.stderr.trim()||s.stdout.trim()||"Unable to compare linked source commit."};let[a,c]=s.stdout.trim().split(/\s+/,2),d=Number(a)||0,p=Number(c)||0;return{linkedSourceHeadCommit:r,aheadOfLinkedSource:p,behindLinkedSource:d,divergedFromLinkedSource:p>0&&d>0,error:null}}o(te,"compareLinkedSourceCommit");async function Me(e,t,n){return ee(R(e,t.id),t,n)}o(Me,"createAndCheckoutBranch");async function ee(e,t,n,r={}){Y(n);let i=await z(e,t,{...r,clone:!1});if(!i.initialized)throw new Error(i.error||"Workspace is not initialized");let s=await u("git",["checkout","-b",n.trim()],i.repoPath);if(s.code!==0)throw new Error(s.stderr.trim()||s.stdout.trim()||"Unable to create branch");return z(e,t,{...r,clone:!1})}o(ee,"createAndCheckoutBranchAtPath");async function ze(e,t,n){return ne(R(e,t.id),t,n)}o(ze,"checkoutBranch");async function ne(e,t,n,r={}){Y(n);let i=await z(e,t,{...r,clone:!1});if(!i.initialized)throw new Error(i.error||"Workspace is not initialized");if(i.dirty&&i.currentBranch!==n.trim())throw new Error("Commit or discard local changes before switching branches");let s=await u("git",["checkout",n.trim()],i.repoPath);if(s.code!==0)throw new Error(s.stderr.trim()||s.stdout.trim()||"Unable to switch branch");return z(e,t,{...r,clone:!1})}o(ne,"checkoutBranchAtPath");import P from"node:path";import{promises as yt}from"node:fs";var re=6,ie=60,Pt=1e4,_=new Map;async function j(e,t,n=re){let r=Math.max(1,Math.floor(n)),i=new Array(e.length),s=0;async function a(){for(;s<e.length;){let c=s;s+=1,i[c]=await t(e[c],c)}}return o(a,"worker"),await Promise.all(Array.from({length:Math.min(r,e.length)},()=>a())),i}o(j,"mapWorkspaceDiffEntriesWithConcurrency");function Xe(){_.clear()}o(Xe,"clearWorkspaceDiffCacheForTests");async function Ve(e,t,n={}){let{repoPath:r}=R(e,t.id);return se(r,t.id,n)}o(Ve,"loadWorkspaceDiff");async function se(e,t,n={}){let r=await O(e);if(!r){let l=await ht(e);return{appId:t,repoPath:e,initialized:l.length>0||await G(e),dirty:!1,filesChanged:0,additions:0,deletions:0,repoFiles:l,files:[],error:null,updatedAt:F()}}let i=await Z(e),s=i.pathPrefix||".",[a,c]=await Promise.all([u("git",["rev-parse","HEAD"],i.commandCwd),u("git",["status","--porcelain=v1","-uall","--",s],i.commandCwd)]);if(c.code!==0)return{appId:t,repoPath:e,initialized:r,dirty:!1,filesChanged:0,additions:0,deletions:0,repoFiles:[],files:[],error:c.stderr.trim()||c.stdout.trim()||"Unable to read workspace diff",updatedAt:F()};let d=c.stdout.split(`
11
- `).map(M).filter(l=>!!l).map(l=>{let W=B(l.path,i.pathPrefix);if(!W)return null;let g=w(W);return g?{...l,path:g}:null}).filter(l=>l?!y(l.path):!1),p=await ae(e,d),h=ce({repoPath:e,workspaceId:t,includeFileDetails:!!n.includeFileDetails,head:a.code===0?a.stdout.trim():"unborn",pathPrefix:i.pathPrefix,status:c.stdout,worktreeSignature:p}),b=_.get(h);if(b)return J(b);let A=(await j(d,async l=>l.status==="deleted"||!await pt(e,l.path)?l:null)).filter(l=>!!l),v=await u("git",["ls-files","--",s],i.commandCwd),S=U([...v.code===0?v.stdout.split(`
12
- `).map(l=>B(l.trim(),i.pathPrefix)).filter(l=>!!l):[],...A.map(l=>l.path)].filter(l=>!y(l))),C=await u("git",["diff","--numstat","HEAD","--",s],i.commandCwd),f=C.code===0?Ct(H(C.stdout),i.pathPrefix):new Map,x=n.includeFileDetails?await ue(i,A.filter(l=>l.status!=="untracked")):new Map,E=await j(A,async l=>{let g=(n.includeFileDetails||l.status==="untracked")&&l.status!=="deleted"?await I(e,l.path):null,D=l.status==="untracked"?{additions:bt(g),deletions:0}:f.get(l.path)??{additions:0,deletions:0};return n.includeFileDetails?Ft(e,l,i,D,{content:g,patch:l.status==="untracked"?null:x.get(l.path)??null}):{path:l.path,status:l.status,additions:D.additions,deletions:D.deletions,patch:"",content:null}}),L=E.reduce((l,W)=>l+W.additions,0),q=E.reduce((l,W)=>l+W.deletions,0),K={appId:t,repoPath:e,initialized:r,dirty:E.length>0,filesChanged:E.length,additions:L,deletions:q,repoFiles:S,files:E,error:null,updatedAt:F()};return le(h,K),J(K)}o(se,"loadWorkspaceDiffAtPath");async function Ye(e,t,n,r){if(!await O(e))throw new Error("Candidate source is not a Git repository.");let s=await Z(e),a=`${n}..${r}`,[c,d,p,h,b]=await Promise.all([u("git",["rev-parse","--verify",`${n}^{commit}`],s.commandCwd),u("git",["rev-parse","--verify",`${r}^{commit}`],s.commandCwd),u("git",["-c","core.quotePath=false","diff","--name-status","--find-renames",a,"--","."],s.commandCwd),u("git",["-c","core.quotePath=false","diff","--no-ext-diff","--unified=80",a,"--","."],s.commandCwd),u("git",["-c","core.quotePath=false","ls-tree","-r","--name-only",r],s.commandCwd)]);if(c.code!==0||d.code!==0)throw new Error("Candidate Git history is no longer available.");if(p.code!==0)throw new Error(p.stderr.trim()||"Unable to read the candidate change.");let A=oe(p.stdout).filter(f=>!y(f.path)),v=h.code===0?xt(h.stdout||h.stderr,""):new Map,S=await j(A,async f=>{let x=await u("git",["diff","--numstat",a,"--",f.path],s.commandCwd),E=x.code===0?[...H(x.stdout).values()][0]??{additions:0,deletions:0}:{additions:0,deletions:0},L=f.status==="deleted"?null:await u("git",["show",`${r}:${f.path}`],s.commandCwd);return{path:f.path,status:f.status,additions:E.additions,deletions:E.deletions,patch:X(v.get(f.path)??""),content:L?.code===0?L.stdout:null}}),C=b.code===0?U(b.stdout.split(`
13
- `).map(f=>f.trim()).filter(f=>f&&!y(f))):S.map(f=>f.path);return{appId:t,repoPath:e,initialized:!0,dirty:S.length>0,filesChanged:S.length,additions:S.reduce((f,x)=>f+x.additions,0),deletions:S.reduce((f,x)=>f+x.deletions,0),repoFiles:C,files:S,error:null,updatedAt:F()}}o(Ye,"loadGitCommitDiffAtPath");function oe(e){return e.split(/\r?\n/).filter(Boolean).flatMap(t=>{let[n,r,i]=t.split(" "),s=n?.[0]??"M",a=s==="R"||s==="C"?i:r,c=a?w(a):null;return c?[{path:c,status:s==="A"||s==="C"?"added":s==="D"?"deleted":s==="R"?"renamed":"modified"}]:[]})}o(oe,"parseCommitDiffEntries");function bt(e){if(!e)return 0;let t=e.endsWith(`
14
- `)?e.slice(0,-1):e;return t?t.split(`
15
- `).length:0}o(bt,"countTextLines");async function ae(e,t){return(await j(t,async r=>{if(r.status==="deleted")return`${r.path} ${r.status} deleted`;let i=P.resolve(e,r.path),s=P.resolve(e);if(i!==s&&!i.startsWith(`${s}${P.sep}`))return`${r.path} ${r.status} outside`;try{let a=await yt.lstat(i),c=a.isDirectory()?"dir":a.isFile()?"file":"other";return`${r.path} ${r.status} ${c} ${a.size} ${Math.trunc(a.mtimeMs)} ${Math.trunc(a.ctimeMs)}`}catch{return`${r.path} ${r.status} missing`}})).sort((r,i)=>r.localeCompare(i)).join(`
16
- `)}o(ae,"workspaceDiffWorktreeSignature");function ce(e){return JSON.stringify(e)}o(ce,"workspaceDiffCacheKey");function le(e,t){for(_.has(e)&&_.delete(e),_.set(e,J(t));_.size>ie;){let n=_.keys().next().value;if(!n)break;_.delete(n)}}o(le,"writeWorkspaceDiffCache");function J(e){return{...e,repoFiles:[...e.repoFiles],files:e.files.map(t=>({...t}))}}o(J,"cloneWorkspaceDiffSummary");async function Z(e){let t=await u("git",["rev-parse","--show-toplevel"],e);if(t.code!==0)return{commandCwd:e,pathPrefix:""};let n=t.stdout.trim();if(!n)return{commandCwd:e,pathPrefix:""};let r=P.relative(P.resolve(n),P.resolve(e)),i=w(r.replace(/\\/g,"/"))??"";return{commandCwd:n,pathPrefix:i}}o(Z,"gitWorkspaceContext");function B(e,t){let n=w(e);return n?t?n===t?null:n.startsWith(`${t}/`)?n.slice(t.length+1):null:n:null}o(B,"pathInWorkspace");function Q(e,t){return t?`${t}/${e}`:e}o(Q,"gitPathForWorkspacePath");function Ct(e,t){let n=new Map;for(let[r,i]of e){let s=B(r,t);s&&n.set(s,i)}return n}o(Ct,"scopedNumstat");async function ue(e,t){if(t.length===0)return new Map;let n=e.pathPrefix||".",r=await u("git",["-c","core.quotePath=false","diff","--no-ext-diff","--unified=80","HEAD","--",n],e.commandCwd);return r.code!==0?new Map:xt(r.stdout||r.stderr,e.pathPrefix)}o(ue,"loadTrackedGitPatchMap");function xt(e,t){let n=new Map;for(let r of e.split(/(?=^diff --git )/m)){if(!r.trim())continue;let i=de(r,t);i&&n.set(i,r)}return n}o(xt,"parseGitPatchStreamByWorkspacePath");function de(e,t){let n=e.split(`
17
- `);for(let a of n){let c=St(a,"+++ ");if(c)return B(c,t)}for(let a of n){let c=St(a,"--- ");if(c)return B(c,t)}for(let a of n)if(a.startsWith("rename to ")){let c=w(a.slice(10).trim());if(c)return B(c,t)}let r=n.find(a=>a.startsWith("diff --git "));if(!r)return null;let i=r.lastIndexOf(" b/");if(i<0)return null;let s=w(r.slice(i+3).trim());return s?B(s,t):null}o(de,"workspacePathForGitPatchChunk");function St(e,t){if(!e.startsWith(t))return null;let n=e.slice(t.length).trim();if(!n||n==="/dev/null")return null;let r=n.startsWith("a/")||n.startsWith("b/")?n.slice(2):n;return w(r)}o(St,"gitPatchMarkerPath");async function Je(e,t,n){let{repoPath:r}=R(e,t.id);return me(r,n)}o(Je,"loadWorkspaceFile");async function Ze(e,t,n){let{repoPath:r}=R(e,t.id);return pe(r,n)}o(Ze,"loadWorkspaceImageFile");async function pe(e,t){let n=await O(e),r=Et(e,t);if(!r)throw new Error("Image not found");if(n&&!await ft(e,r))throw new Error("Image not found");let i=await ut(e,r);if(!i)throw new Error("Image not found");return i}o(pe,"loadWorkspaceImageFileAtPath");function Et(e,t){let n=fe(t);if(!n)return null;if(!P.isAbsolute(n))return w(n);let r=P.relative(P.resolve(e),P.resolve(n));return!r||r.startsWith("..")||P.isAbsolute(r)?null:w(r)}o(Et,"normalizeWorkspaceFileRequestPath");function fe(e){let t=e.trim();if(!t)return null;t=t.replace(/^['"`]+|['"`]+$/g,"");let n=t.indexOf("#");n>=0&&(t=t.slice(0,n));let r=t.indexOf("?");if(r>=0&&(t=t.slice(0,r)),t.startsWith("file://"))try{t=decodeURIComponent(new URL(t).pathname)}catch{t=t.replace(/^file:\/\//,"")}return t.trim()||null}o(fe,"cleanWorkspaceFileRequestPath");async function me(e,t){let n=await O(e),r=Et(e,t);if(!r)throw new Error("File not found");if(y(r))throw new Error("File not found");if(n){let a=await he(e,r);if(a){if(a.content!==null||a.status==="deleted")return a;let c=await V(e,r);return c===null?a:{...a,content:c}}}let i=r,s=await I(e,i)??await V(e,i);if(s===null){let a=await ge(e,r);a&&(i=a,s=await I(e,i))}if(s===null)throw new Error("File not found");return{path:i,status:"unchanged",additions:0,deletions:0,patch:"",content:s}}o(me,"loadWorkspaceFileAtPath");async function he(e,t){let n=await Z(e),r=Q(t,n.pathPrefix),i=await u("git",["status","--porcelain=v1","-uall","--",r],n.commandCwd);if(i.code!==0)return null;let s=i.stdout.split(`
18
- `).map(M).filter(c=>!!c).map(c=>{let d=B(c.path,n.pathPrefix);if(!d)return null;let p=w(d);return p?{...c,path:p}:null}).find(c=>!!(c&&c.path===t));if(!s)return null;let a=s.status==="untracked"?{additions:bt(await I(e,s.path)),deletions:0}:await ke(n,s.path);return Ft(e,s,n,a)}o(he,"loadGitWorkspaceFileAtPath");async function ge(e,t){if(t.includes("/")||!we(t))return null;let n=t.toLowerCase(),r=[],i=[{absolutePath:e,prefix:""}],s=0;for(;i.length>0&&s<Pt;){let c=i.shift(),d;try{d=await yt.readdir(c.absolutePath,{withFileTypes:!0})}catch{continue}d.sort((p,h)=>p.name.localeCompare(h.name));for(let p of d){if(s>=Pt)break;let h=c.prefix?`${c.prefix}/${p.name}`:p.name;if(y(h))continue;s+=1;let b=P.join(c.absolutePath,p.name);p.isDirectory()?i.push({absolutePath:b,prefix:h}):p.isFile()&&p.name.toLowerCase()===n&&r.push(h)}}if(r.length===1)return r[0]??null;let a=r.filter(c=>c.startsWith("docs/working-docs/"));return a.length===1?a[0]??null:null}o(ge,"resolveExplicitMarkdownBasenamePath");function we(e){return/\.(?:md|markdown|mdx)$/i.test(e)}o(we,"isMarkdownWorkspacePath");async function Ft(e,t,n,r,i={}){let s=i.content!==void 0?i.content:t.status==="deleted"?null:await I(e,t.path),a=Q(t.path,n.pathPrefix),c=t.status==="untracked"?["diff","--no-index","--unified=80","--","/dev/null",P.join(e,t.path)]:["diff","--no-ext-diff","--unified=80","HEAD","--",a],d=i.patch??"";if(i.patch===null||i.patch===void 0){let p=await u("git",c,n.commandCwd);d=p.stdout||p.stderr}return{path:t.path,status:t.status,additions:r.additions,deletions:r.deletions,patch:X(d),content:s}}o(Ft,"loadGitWorkspaceFileDetail");async function ke(e,t){let n=Q(t,e.pathPrefix),r=await u("git",["diff","--numstat","HEAD","--",n],e.commandCwd);return r.code!==0?{additions:0,deletions:0}:Ct(H(r.stdout),e.pathPrefix).get(t)??{additions:0,deletions:0}}o(ke,"gitNumstatForFile");export{rt as a,u as b,Gt as c,ye as d,be as e,N as f,$ as g,G as h,O as i,X as j,I as k,V as l,lt as m,Kt as n,ut as o,Re as p,_e as q,pt as r,w as s,y as t,ft as u,M as v,mt as w,H as x,U as y,ht as z,wt as A,Y as B,R as C,kt as D,Wt as E,Te as F,z as G,Me as H,ee as I,ze as J,ne as K,j as L,Xe as M,Ve as N,se as O,Ye as P,Je as Q,Ze as R,pe as S,me as T};
@@ -1,5 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{h as S}from"./chunk-STDMBJOQ.js";import{Ma as A}from"./chunk-2DFR7PJ4.js";import{I as h}from"./chunk-4WEUCGJ3.js";import{g as b,h as H,i as w,m as f}from"./chunk-JIMU3KDA.js";import{c as I,f as P,v as O,w as k}from"./chunk-KD3QVRIJ.js";import{m as g}from"./chunk-KGNCKIFP.js";import{b as c}from"./chunk-ES2ISFJC.js";import{a as u}from"./chunk-FTQLQJQV.js";import{randomUUID as T}from"node:crypto";import{readFile as v}from"node:fs/promises";import p from"node:path";import{randomUUID as $}from"node:crypto";var y=c.object({revision:c.number().int().nonnegative(),overlay:H}).strict(),z=y.extend({proposal:w}).strict(),m=class{constructor(e){this.client=e}client;static{u(this,"HostedHarnessOverlayStorage")}async getHarnessRunOverlay(e){let s=await this.client.request({contractVersion:h,requestId:$(),operation:"harness/overlay/get",params:{runId:e}});return s===null?null:y.parse(s).overlay}async putHarnessRunOverlay(e){let s=H.parse(e.overlay);if(!e.requestId.trim()||s.revision!==(e.expectedRevision===null?0:e.expectedRevision+1))throw new Error("Hosted Harness overlay mutation requires a stable request and next revision.");let r=y.parse(await this.client.request({contractVersion:h,requestId:e.requestId,operation:"harness/overlay/put",params:{runId:s.runId,expectedRevision:e.expectedRevision,overlay:s}}));if(r.revision!==s.revision||r.overlay.contentHash!==s.contentHash)throw new Error("Host Harness overlay response changed committed identity.");return r.overlay}async createHarnessRunOverlay(e){if(e.revision!==0||e.status!=="active")throw new Error("A new Harness run overlay must be active at revision 0.");return this.putHarnessRunOverlay({overlay:e,expectedRevision:null,requestId:`harness-overlay:${e.runId}:${e.contentHash}`})}async ensureHarnessRunOverlay(e){let s=await this.getHarnessRunOverlay(e.runId);if(s){if(s.workspace.workspaceId!==e.workspace.id||s.baseHarnessRelease.id!==e.harnessRelease.id||s.baseHarnessRelease.contentHash!==e.harnessRelease.contentHash)throw new Error("The durable Agent run is already bound to another Harness release.");return s}let r=f({schemaVersion:"openpond.harnessRunOverlay.v1",id:`overlay-${g({runId:e.runId,harnessRelease:e.harnessRelease}).slice(0,24)}`,runId:e.runId,baseHarnessRelease:e.harnessRelease,workspace:{workspaceId:e.workspace.id,revision:e.workspace.revision,sourceRevision:e.workspace.sourceRevision,channelRevision:e.workspace.currentChannel.revision},revision:0,status:"active",edits:[],createdAt:e.admittedAt,updatedAt:e.admittedAt,metadata:{}});return this.createHarnessRunOverlay(r)}async appendHarnessRunOverlayEditsAtomically(e){return this.transition(e,"append")}async freezeHarnessRunOverlayAtomically(e){return this.transition({...e,edits:[]},"freeze")}async abandonHarnessRunOverlayAtomically(e){return this.transition({...e,edits:[]},"abandon")}async freezeHarnessRunOverlayWithProposalAtomically(e){let s=await this.getHarnessRunOverlay(e.runId);if(!s||s.revision!==e.expectedRevision||s.status!=="active")throw new Error("Hosted Harness overlay revision or status changed.");let r=new Set(s.edits.map(i=>i.id));for(let i of e.edits){if(r.has(i.id))throw new Error(`Harness overlay edit id already exists: ${i.id}.`);r.add(i.id)}let{contentHash:l,...n}=s,t=f({...n,revision:s.revision+1,status:"frozen",edits:[...s.edits,...e.edits],updatedAt:e.updatedAt}),d=w.parse(e.buildProposal(t)),a=z.parse(await this.client.request({contractVersion:h,requestId:`harness-proposal:${t.runId}:${d.contentHash}`,operation:"harness/overlay/freezeProposal",params:{runId:t.runId,expectedRevision:s.revision,overlay:t,proposal:d}}));if(a.overlay.contentHash!==t.contentHash||a.proposal.contentHash!==d.contentHash)throw new Error("Host Harness proposal response changed committed identity.");return{overlay:a.overlay,proposal:a.proposal}}async transition(e,s){let r=await this.getHarnessRunOverlay(e.runId);if(!r||r.revision!==e.expectedRevision||r.status==="abandoned"||s!=="abandon"&&r.status!=="active")throw new Error("Hosted Harness overlay revision or status changed.");if(s==="append"&&e.edits.length===0)throw new Error("Harness overlay append requires edits.");let l=new Set(r.edits.map(a=>a.id));for(let a of e.edits){if(l.has(a.id))throw new Error(`Harness overlay edit id already exists: ${a.id}.`);l.add(a.id)}let{contentHash:n,...t}=r,d=f({...t,revision:r.revision+1,status:s==="append"?"active":s==="freeze"?"frozen":"abandoned",edits:[...r.edits,...e.edits],updatedAt:e.updatedAt});return this.putHarnessRunOverlay({overlay:d,expectedRevision:r.revision,requestId:`harness-overlay:${d.runId}:${d.contentHash}`})}};var N=c.object({workspace:b,release:c.object({id:c.string().min(1),contentHash:c.string().regex(/^[a-f0-9]{64}$/),sourceRevision:c.string().min(1),assetsPath:c.string().min(1)}).strict()}).strict();async function C(o,e=null){let s=await o.request({contractVersion:h,requestId:T(),operation:"harness/get",params:{reference:e}});if(s===null)return null;let r=N.parse(s);if(!p.isAbsolute(r.release.assetsPath))throw new Error("Hosted Harness assets path must be absolute.");let[l,n]=await Promise.all([v(p.join(r.release.assetsPath,"agent-snapshot.json"),"utf8"),v(p.join(r.release.assetsPath,"harness-release.json"),"utf8")]),t=A.parse({schemaVersion:"openpond.localHarnessReleaseRecord.v1",workspaceId:r.workspace.id,sourceRevision:r.release.sourceRevision,agentSnapshot:I.parse(JSON.parse(l)),harnessRelease:P.parse(JSON.parse(n)),bundlePath:r.release.assetsPath,createdAt:new Date().toISOString()});if(t.harnessRelease.id!==r.release.id||t.harnessRelease.contentHash!==r.release.contentHash||(e!==null?e.id!==r.release.id||e.contentHash!==r.release.contentHash:r.workspace.currentChannel.release?.contentHash!==r.release.contentHash))throw new Error("Hosted Harness release differs from its bound workspace.");return S({workspace:r.workspace,release:t})}u(C,"loadHostedHarnessRuntime");async function se(o,e){let s=e.profileComponentBinding,r=e.profileWorkflowBinding;if(s){if(r||e.currentProfile?.profileId!==s.profileId)throw new Error("Profile component binding differs from the session Profile reference.");let n=await x(o,s.harnessRelease);if(E(n,s.profileId,s.sourceRevision,e.currentProfile?.repositoryId),s.target.kind==="profile")return n;if(s.target.kind==="skill"){let i=s.target.skillPath;if(!n.release.agentSnapshot.skills.some(j=>j.path===i))throw new Error("Bound Profile Skill is unavailable in its released source.");let R=await v(p.join(n.release.bundlePath,"source",i),"utf8");return{...n,instructionContext:[n.instructionContext,`Released Profile Skill (${i}):
3
- ${R}`].join(`
4
-
5
- `)}}let t=await q(n),d=s.target.actionId,a=t.actions.find(i=>i.id===d);if(!a)throw new Error("Bound Profile Agent action is unavailable in its released source.");return{...n,workflowAction:a}}if(r){if(e.currentProfile?.profileId!==r.profileId)throw new Error("Profile workflow binding differs from the session Profile reference.");let n=await x(o,r.harnessRelease);E(n,r.profileId,r.sourceRevision,e.currentProfile?.repositoryId);let t=await q(n),d=k({binding:r,harnessRelease:n.release.harnessRelease,catalog:t.catalog,catalogHash:t.catalogHash}),a=d.invocation.kind==="agent_action"?d.invocation.actionId:null,i=a?t.actions.find(R=>R.id===a):void 0;if(a&&!i)throw new Error(`Bound Profile action ${a} is missing from its release.`);return{...n,workflow:d,...i?{workflowAction:i}:{}}}let l=await new m(o).getHarnessRunOverlay(e.id);return C(o,l?.baseHarnessRelease??null)}u(se,"loadHostedHarnessRuntimeForSession");async function x(o,e){let s=await C(o,e);if(!s)throw new Error("The bound Profile Harness release is unavailable.");return s}u(x,"requireRelease");function E(o,e,s,r){let l=o.release.harnessRelease.metadata.profile;if(!l||typeof l!="object"||l.id!==e||l.sourceRevision!==s||l.repositoryId!==void 0&&l.repositoryId!==r)throw new Error("Bound Profile source differs from its released Harness source.")}u(E,"assertProfileProvenance");async function q(o){let e=p.join(o.release.bundlePath,"source"),[s,r]=await Promise.all([v(p.join(e,"workflows","catalog.json")),v(p.join(e,"workflows","actions.json"))]);return O({agentSnapshot:o.release.agentSnapshot,harnessRelease:o.release.harnessRelease,catalogBytes:s,actionBytes:r})}u(q,"loadHostedProfileCatalog");export{m as a,C as b,se as c};
@@ -1,8 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{Ka as z,Ma as P,Pa as x,Sa as G,Va as N,Wa as J,Xa as U,Za as W,eb as $}from"./chunk-YDT7L3VZ.js";import{B as C,C as O,Ca as M,D as F,Ea as B,Sb as L,pa as V}from"./chunk-KD3QVRIJ.js";import{k as E,l as H,m as h}from"./chunk-KGNCKIFP.js";import{a as l}from"./chunk-FTQLQJQV.js";import{constants as Q}from"node:fs";import{lstat as ie,open as ce,readdir as le}from"node:fs/promises";import A from"node:path";import{createHash as q}from"node:crypto";import{mkdir as K,readdir as ae,readFile as I,writeFile as X}from"node:fs/promises";import d from"node:path";async function je(e,t){let a=x.parse(e),r=["tasks","assets","environment","graders","rubrics","comparisons","metrics","fixtures"];await Promise.all(r.map(g=>K(d.join(t,g),{recursive:!0})));let o=await re(a,t);if(a.metrics.customAggregator){let g=d.join(t,a.metrics.customAggregator.module),k=q("sha256").update(await I(g)).digest("hex");a=x.parse({...a,metrics:{...a.metrics,customAggregator:{...a.metrics.customAggregator,contentHash:k}}})}let n=d.join(t,"taskset.json"),s=d.join(t,"tasks","tasks.jsonl"),f=d.join(t,"graders","graders.json"),i=d.join(t,"fixtures","grader-fixtures.json"),u=d.join(t,"metrics","policy.json"),c=d.join(t,"assets","manifest.json"),m=d.join(t,"environment","contract.json"),w=d.join(t,"rubrics","preference-review.md"),v=d.join(t,"comparisons","policy.json");return await Promise.all([...J(a)].map(([g,k])=>X(d.join(t,g),k,"utf8"))),{directory:t,files:[n,s,c,m,f,w,v,u,i,...o],draft:a}}l(je,"writeTasksetDraftPackage");async function Re(e){let t=await se(e),a=q("sha256");for(let r of t)a.update(d.relative(e,r).replaceAll(d.sep,"/")),a.update("\0"),a.update(await I(r)),a.update("\0");return a.digest("hex")}l(Re,"hashTasksetDraftPackage");async function Y(e,t){let a=d.basename(e)==="taskset.json"?e:d.join(e,"taskset.json"),r=d.dirname(a),o=l(async f=>{if(!t)return I(f,"utf8");let i=t.get(d.relative(r,f).replaceAll(d.sep,"/"));if(!i)throw Object.assign(new Error("Authored file is absent."),{code:"ENOENT"});return new TextDecoder("utf-8",{fatal:!0}).decode(i)},"read"),n=JSON.parse(await o(a)),s=x.safeParse(n);if(s.success){let[f,i,u,c,m,w]=await Promise.all([ne(d.join(r,"tasks","tasks.jsonl"),o),S(d.join(r,"graders","graders.json"),o),S(d.join(r,"fixtures","grader-fixtures.json"),o),S(d.join(r,"metrics","policy.json"),o),S(d.join(r,"environment","contract.json"),o),S(d.join(r,"comparisons","policy.json"),o)]);return x.parse({...s.data,...f===null?{}:{tasks:f},...i===null?{}:{graders:i},...u===null?{}:{graderFixtures:u},...c===null?{}:{metrics:c},...m===null?{}:{environment:m},...w===null?{}:{review:w}})}return $(n)}l(Y,"readTasksetDraftPackage");async function re(e,t){let a=N(e),r=[];for(let o of a){let n=d.join(t,o.relativePath);await K(d.dirname(n),{recursive:!0});try{await X(n,o.source,{encoding:"utf8",flag:"wx"})}catch(s){if(!oe(s))throw s}r.push(n)}return r}l(re,"writeConfiguredStarterCode");async function se(e){let t=[];async function a(r){let o=await ae(r,{withFileTypes:!0});o.sort((n,s)=>n.name.localeCompare(s.name));for(let n of o){let s=d.join(r,n.name);if(n.isSymbolicLink())throw new Error(`Taskset workspaces cannot contain symbolic links: ${s}`);n.isDirectory()?await a(s):n.isFile()&&t.push(s)}}return l(a,"visit"),await a(e),t}l(se,"packageFiles");async function S(e,t=a=>I(a,"utf8")){try{return JSON.parse(await t(e))}catch(a){if(Z(a))return null;throw a}}l(S,"readOptionalJson");async function ne(e,t=a=>I(a,"utf8")){try{return(await t(e)).split(/\r?\n/).map(r=>r.trim()).filter(Boolean).map(r=>JSON.parse(r))}catch(a){if(Z(a))return null;throw a}}l(ne,"readOptionalJsonLines");function Z(e){return e instanceof Error&&"code"in e&&e.code==="ENOENT"}l(Z,"isMissingFile");function oe(e){return e instanceof Error&&"code"in e&&e.code==="EEXIST"}l(oe,"isFileExists");async function Oe(e){let t=A.resolve(e.directory);if(!(await ie(t)).isDirectory())throw new Error("Dataset upload requires a regular authored folder.");let a=new Map,r=0;async function o(c,m){if(m>30)throw new Error("Dataset folder nesting exceeds 30 levels.");for(let w of(await le(c,{withFileTypes:!0})).sort((v,g)=>v.name<g.name?-1:v.name>g.name?1:0)){if(w.name.startsWith("."))throw new Error("Dataset folders cannot include hidden files or directories.");if(w.isSymbolicLink()||!w.isDirectory()&&!w.isFile())throw new Error("Dataset folders can contain only regular files and directories.");let v=A.join(c,w.name);if(w.isDirectory()){await o(v,m+1);continue}if(a.size>=1e4)throw new Error("Dataset folder exceeds 10,000 files.");let g=await ce(v,Q.O_RDONLY|Q.O_NOFOLLOW);try{let k=await g.stat();if(!k.isFile()||k.size>U-r)throw new Error("Dataset folder exceeds the 64 MiB capture limit.");let j=new Uint8Array(k.size),R=0;for(;R<j.length;){let D=await g.read(j,R,j.length-R,R);if(!D.bytesRead)throw new Error("Dataset file changed during capture.");R+=D.bytesRead}let _=await g.stat();if(_.size!==k.size||_.mtimeMs!==k.mtimeMs||_.ctimeMs!==k.ctimeMs)throw new Error("Dataset file changed during capture.");r+=j.length,a.set(A.relative(t,v).replaceAll(A.sep,"/"),j)}finally{await g.close()}}}l(o,"visit"),await o(t,0);let n=await Y(t,a),s=[...a].map(([c,m])=>({path:c,contentHash:H(m),sizeBytes:m.byteLength})),f=h(s),i=x.parse({...n,id:e.datasetId??n.id,profileId:e.teamId,revision:e.expectedRevision+1,modelScope:null,status:"draft",publishedTasksetRef:null,metadata:{...n.metadata,importedTasksetPackage:{packageHash:f}}});return{workspace:W({schemaVersion:"openpond.tasksetDraftWorkspace.v1",draft:i,files:[...a].filter(([c])=>!G(c)).map(([c,m])=>({path:c,base64:Buffer.from(m).toString("base64"),contentHash:H(m),sizeBytes:m.byteLength}))}),sourceHash:f,sourceFiles:s,capturedBytes:r}}l(Oe,"captureTasksetDraftWorkspace");async function ee(e){let{binding:t,rewards:a}=e.learning,r=M(t,a);if(e.graders.length!==r.length||r.some(({source:i,reward:u})=>!e.graders.some(c=>c.id===i.graderId&&c.version===String(u.revision)&&h(c.metadata.rewardBinding)===h(L(t)))))throw new Error("Prepared Taskset graders do not match their immutable Reward binding.");let o=V.parse({id:e.task.id,clusterKey:e.task.clusterKey,split:e.task.split,input:e.task.input,expectedOutput:e.task.expectedOutput,policyVisibleContext:e.task.policyVisibleContext,privilegedContextRef:e.task.privilegedContextRef,artifactRefs:[],tags:e.task.tags}),n=await B({binding:t,rewards:a,task:o,signal:e.signal,evidence:{output:e.attempt.output,artifactRefs:e.attempt.artifactRefs,runtimeEventRefs:e.attempt.runtimeEventRefs,infrastructureError:e.attempt.infrastructureError},customVerifier:e.customVerifier?async({grader:i})=>{let u=e.graders.find(m=>m.id===i.id);if(u?.kind!=="custom_verifier")throw new Error("Bound verifier projection is missing.");let c=await e.customVerifier({grader:u,task:e.task,attempt:e.attempt,signal:e.signal});return{score:c.score,passed:c.passed,rewardEligible:i.rewardEligible,failureClass:null,feedback:[c.feedback],visibleEvidenceRefs:[],privilegedEvidenceRefs:c.evidenceRefs??[]}}:void 0,modelJudge:e.modelJudge?async({grader:i})=>{let u=e.graders.find(m=>m.id===i.id);if(u?.kind!=="model_judge")throw new Error("Bound judge projection is missing.");let c=await e.modelJudge({grader:u,task:e.task,attempt:e.attempt});return{score:c.score,passed:c.passed,rewardEligible:i.rewardEligible,failureClass:null,feedback:[c.feedback],visibleEvidenceRefs:[],privilegedEvidenceRefs:c.evidenceRefs??[]}}:void 0}),s=n.training.status==="not_configured"?n.evaluation:n.training,f=h(e.graders);return{schemaVersion:"openpond.gradeResult.v1",id:`grade_${h([e.attempt.id,n.contentHash]).slice(0,24)}`,attemptId:e.attempt.id,graderSetHash:f,score:s.score,passed:s.passed===!0,components:n.results.map(i=>{let u=t.sources.find(m=>m.graderId===i.graderId),c=e.graders.find(m=>m.id===i.graderId);return{graderId:i.graderId,graderVersion:c.version,score:i.normalizedScore,passed:i.passed===!0,hardGate:u.hardGate,rewardEligible:u.role==="training"&&i.status==="scored",feedback:i.message?.trim()||null,evidenceRefs:i.evidenceHashes,judge:c.kind==="model_judge"?c.judge:null,calibrationStatus:c.kind==="model_judge"?c.calibrationStatus:"not_applicable"}}),failureClass:e.attempt.infrastructureError?"infrastructure_failure":s.status!=="scored"?"grader_failure":s.passed?null:"policy_failure",feedback:n.results.flatMap(i=>i.message?.trim()?[i.message.trim()]:[]),rewardEligible:n.training.status==="scored",rewardComposition:n,createdAt:e.now?.()??new Date().toISOString()}}l(ee,"gradeLearningBatchAttempt");async function et(e){if(e.learning)return ee({...e,learning:e.learning});if(e.graders.some(o=>o.metadata.rewardBinding!==void 0))throw new Error("This Taskset requires its immutable public Reward binding to grade an attempt.");let t=h(e.graders),a=[];for(let o of e.graders)e.signal?.throwIfAborted(),a.push(e.attempt.infrastructureError?b(o,null,!1,"Infrastructure failure; no reward was produced.",[],!1):await me(o,e.task,e.attempt,e.modelJudge,e.customVerifier,e.signal));let r=F({graders:e.graders,infrastructureError:e.attempt.infrastructureError,components:a.map(o=>({...o,failureClass:o.score===null?"grader_failure":o.passed?null:"policy_failure"}))});return{schemaVersion:"openpond.gradeResult.v1",id:`grade_${h([e.attempt.id,t,a]).slice(0,24)}`,attemptId:e.attempt.id,graderSetHash:t,score:r.score,passed:r.passed,components:a,failureClass:r.failureClass,feedback:e.attempt.infrastructureError?[e.attempt.infrastructureError]:a.flatMap(o=>o.feedback?[o.feedback]:[]),rewardEligible:r.rewardEligible,createdAt:e.now?.()??new Date().toISOString()}}l(et,"gradeAttempt");async function me(e,t,a,r,o,n){if(e.kind==="model_judge"){if(!r)return b(e,null,!1,"Model judge runner is unavailable.",[],!1);if(e.calibrationStatus!=="passed")return b(e,null,!1,"Model judge calibration has not passed.",[],!1);let f=await r({grader:e,task:t,attempt:a});return b(e,f.score,f.passed,f.feedback,f.evidenceRefs??[])}if(e.kind==="human")return b(e,null,!1,"Human review is pending.",[],!1);if(e.kind==="custom_verifier"){if(!o)return b(e,null,!1,"Sandboxed verifier runner is unavailable.",[],!1);let f=await o({grader:e,task:t,attempt:a,signal:n});return b(e,f.score,f.passed,f.feedback,f.evidenceRefs??[])}let s=C({grader:O(e),task:t,evidence:a});return b(e,s.score,s.passed,s.feedback,[...a.artifactRefs,...a.runtimeEventRefs])}l(me,"runGrader");function b(e,t,a,r,o,n=e.rewardEligible){let s=t!==null&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null;return{graderId:e.id,graderVersion:e.version,score:s,passed:s!==null&&a,hardGate:e.hardGate,rewardEligible:s!==null&&n,feedback:r,evidenceRefs:o,judge:e.kind==="model_judge"?e.judge:null,calibrationStatus:e.kind==="model_judge"?e.calibrationStatus:"not_applicable"}}l(b,"component");import{access as ue,mkdir as T,readFile as Tt,writeFile as y}from"node:fs/promises";import p from"node:path";async function $t(e,t,a={}){let r=z.parse(e),o=P(r);if(!o.valid)throw new Error(o.issues.map(s=>`${s.code}: ${s.message}`).join(`
3
- `));await T(p.join(t,"data"),{recursive:!0}),await T(p.join(t,"graders"),{recursive:!0}),await T(p.join(t,"environment"),{recursive:!0}),await T(p.join(t,"fixtures"),{recursive:!0});let n=[p.join(t,"taskset.json"),p.join(t,"capabilities.json"),p.join(t,"data","tasks.jsonl"),p.join(t,"graders","graders.json"),p.join(t,"fixtures","grader-fixtures.json"),p.join(t,"environment","taskset.ts")];await y(n[0],E(r),"utf8"),await y(n[1],E(r.capabilities),"utf8"),await y(n[2],r.tasks.map(s=>JSON.stringify(s)).join(`
4
- `)+`
5
- `,"utf8"),await y(n[3],E(r.graders),"utf8"),await y(n[4],E(r.graderFixtures),"utf8"),await y(n[5],pe(r),"utf8");for(let s of a.generatedFiles??[]){let f=te(s.path,s.role),i=p.join(t,f);await T(p.dirname(i),{recursive:!0}),await y(i,s.content,"utf8"),n.push(i)}for(let s of r.graders){if(s.kind!=="custom_verifier")continue;let f=te(s.module,"verifier");try{await ue(p.join(t,f))}catch{throw new Error(`Custom verifier ${s.id} is missing generated source ${f}.`)}}return{directory:t,files:n,taskset:r}}l($t,"buildTaskset");function te(e,t){let a=e.replaceAll("\\","/");if(p.posix.isAbsolute(a)||a.split("/").includes(".."))throw new Error(`Generated ${t} path must stay inside the Taskset: ${e}.`);let r=t==="verifier"?"graders/":t==="environment"?"environment/":"fixtures/";if(!a.startsWith(r))throw new Error(`Generated ${t} path must start with ${r}.`);return a}l(te,"safeGeneratedPath");function pe(e){return`// Generated by @openpond/taskset-sdk.
6
- export const environment = ${JSON.stringify(e.environment,null,2)} as const;
7
- export const tasks = ${JSON.stringify(e.tasks.map(t=>({id:t.id,input:t.input,split:t.split})),null,2)} as const;
8
- `}l(pe,"generatedEnvironmentSource");export{je as a,Re as b,Y as c,Oe as d,et as e,$t as f};