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
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as k}from"./chunk-I2NXNMRZ.js";import{f as m}from"./chunk-O72BSKSO.js";import{f as d}from"./chunk-XDQMGUWL.js";import{m as c}from"./chunk-KGNCKIFP.js";import{a as n}from"./chunk-FTQLQJQV.js";import h from"node:path";async function b(o){let{taskset:a}=o,{taskset:f,modelResources:p,learningResources:l}=o.content,u=new Set([...p?.assets??[],...l?.assets??[]].map(e=>e.id)),i=new Map,r=n((e,s=e.path)=>{if(u.has(e.id))return;let t=i.get(e.id);if(t&&(c(t.asset)!==c(e)||t.sourcePath!==s))throw new Error(`Conflicting local Taskset file reference: ${e.id}.`);i.set(e.id,{asset:e,sourcePath:s})},"add");for(let e of d.parse(a.metadata.portableFileInventory??[]))r(e.asset,e.sourcePath);for(let e of f.tasks){let s=a.tasks.find(t=>t.id===e.id);for(let t of e.artifactRefs)r(t,s?.assets?.find(g=>g.id===t.id)?.artifactRef??t.path);for(let t of e.requiredOutputs??[])t.schemaRef&&r(t.schemaRef)}for(let e of f.graders){let s=a.graders.find(t=>t.id===e.id);"verifierRef"in e&&r(e.verifierRef,s?.kind==="custom_verifier"?s.module:e.verifierRef.path),"rubricRef"in e&&r(e.rubricRef)}return m({root:h.join(o.storeDir,"training","tasksets",k(a)),content:o.content,sources:[...i.values()]})}n(b,"captureAuthoredModelTasksetPackage");export{b as a};
@@ -0,0 +1,5 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as we}from"./chunk-HCYX6RHP.js";import{j as Te,n as ne}from"./chunk-XDQMGUWL.js";import{C as ke,D as ve}from"./chunk-FTEOCCPB.js";import{Fb as X,Gb as he,Mb as Re,N as pe,P as fe,Q as z,T as Q,U as te,V as ue,W as me,ma as ge,ua as A,xa as ae}from"./chunk-25MBPJVY.js";import{D as U,K as F,i as u,n as q,t as le,x as B}from"./chunk-523TE4BI.js";import{$ as ce,N as R,O as E,P as $,Q as b,d as V,ib as W}from"./chunk-VYLGI3IH.js";import{Ea as ee,Ka as oe,La as de,qa as G,za as ie}from"./chunk-ACYFMLWG.js";import{a as m}from"./chunk-FTQLQJQV.js";import{createHash as Me}from"node:crypto";function w(e,n,a,s){let t=W[a].parse(s),r=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[n,a,t.id,t.revision]);if(r){if(u(JSON.parse(r.payload))!==u(t))throw new Error(`Starter dependency conflicts with an existing revision: ${t.id}.`);return}e.run("INSERT INTO learning_revisions (scope, kind, id, revision, payload) VALUES (?, ?, ?, ?, ?)",[n,a,t.id,t.revision,JSON.stringify(t)]),e.run(`INSERT INTO learning_resources (scope, kind, id, revision) VALUES (?, ?, ?, ?)
3
+ ON CONFLICT (scope, kind, id) DO UPDATE SET revision = excluded.revision
4
+ WHERE learning_resources.revision < excluded.revision`,[n,a,t.id,t.revision])}m(w,"importStarterReleaseInTransaction");function Se(e,n,a){function s(o,d){let g=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[n,o,d.id,d.revision]);g||C(404,"model_reward_unavailable",`The exact ${o} resource is unavailable in this Profile.`);let l=W[o].parse(JSON.parse(g.payload));return b(l),d.contentHash&&l.contentHash!==d.contentHash&&C(409,"model_reward_changed","The selected resource does not match its immutable content hash."),l}m(s,"read");let t=s("binding",a),r=[...new Map(t.sources.map(o=>[u(o.reward),s("reward",o.reward)])).values()],i=new Map;for(let o of r){let d=o.implementation;for(let g of[...o.assets,..."verifierRef"in d?[d.verifierRef]:[],..."rubricRef"in d?[d.rubricRef]:[],..."inputContract"in d?[d.inputContract]:[]])i.has(g.id)||i.set(g.id,s("asset",{id:g.id,revision:1})),V(i.get(g.id),g)}return{rewardBinding:t,rewards:r,assets:[...i.values()]}}m(Se,"readSelectedModelReward");function Y(e,n,a,s){let t=q.parse(n.metadata.rewardBinding),r=m((c,f)=>{let D=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[n.profileId,c,f.id,f.revision]);D||C(404,"model_reward_unavailable",`The exact ${c} resource is unavailable in this Profile.`);let k=W[c].parse(JSON.parse(D.payload));return b(k),f.contentHash&&k.contentHash!==f.contentHash&&C(409,"model_reward_changed","The selected resource does not match its immutable content hash."),k},"read"),i=r("definition",q.parse(n.metadata.taskDefinition));(u(n.policy)!==u(i.execution.policy)||u(n.environment.metadata.portableEnvironment)!==u(i.execution.environment)||u(n.environment.metadata.portableTools)!==u(i.execution.tools))&&C(409,"model_taskset_context_changed","Taskset context differs from its immutable task definition.");let o=r("binding",t),d=[...new Map(o.sources.map(c=>[u(c.reward),r("reward",c.reward)])).values()];n.metadata.rewardExecution!==void 0&&u(n.metadata.rewardExecution)!==u({binding:o,rewards:d})&&C(409,"model_taskset_rewards_changed","Taskset embedded Rewards differ from their immutable binding.");let g=r("binding",a),l=[...new Map(g.sources.map(c=>[u(c.reward),r("reward",c.reward)])).values()],T=new Map((s?.modelResources?.assets??[]).map(c=>[c.id,c])),v=m(c=>{T.has(c)||T.set(c,r("asset",{id:c,revision:1}))},"addAsset");for(let c of[...d,...l]){let f=c.implementation;for(let D of[...c.assets,..."verifierRef"in f?[f.verifierRef]:[],..."rubricRef"in f?[f.rubricRef]:[],..."inputContract"in f?[f.inputContract]:[]])v(D.id)}let h,S=ue.shape.executionResources.parse(n.environment.metadata.portableExecutionResources);if(i.execution.environment.entrypoint==="openpond.javascript-environment.v1"){let c=r("asset",{id:fe(i.execution),revision:1});h=pe.parse(JSON.parse(V(c,c.asset)));for(let f of[h.javascript.module,h.environment.actionSchemaRef,h.environment.observationSchemaRef,h.environment.stateSchemaRef])f&&v(f.id)}for(let c of n.tasks)c.privilegedContextRef&&v(c.privilegedContextRef);u(n.graders)!==u(X(o,d,[...T.values()]))&&C(409,"model_taskset_graders_changed","Taskset graders differ from their immutable Reward binding.");let x=G.parse($({schemaVersion:"openpond.tasksetRelease.v2",id:n.id,revision:n.revision,...i.execution,graders:de(o,d),...n.metrics?{metrics:n.metrics}:{},tasks:n.tasks.map(c=>{let f=Re(c);return c.requiredOutputs===void 0&&c.metadata.portableTaskRecord===void 0&&delete f.requiredOutputs,f}),metadata:n.metadata.derivedPortableMetadata??{localSource:R(n),starter:{taskDefinition:R(i),rewardBinding:t}}}));return{sourcePackage:s?{...s.modelResources,taskset:s.taskset,executionResources:{environment:s.environment,verifierSet:s.verifierSet}}:{taskset:x,taskDefinition:i,rewardBinding:o,rewards:d,assets:[...T.values()],...S?{executionResources:S}:{},...h?{execution:h}:{}},selectedBinding:g,selectedRewards:l,assets:T}}m(Y,"readModelTasksetSource");function C(e,n,a){throw new F(e,{schemaVersion:"openpond.modelProjectApiError.v2",code:n,message:a,retryable:!1,requestId:null,details:{}})}m(C,"fail");function se(e){if(e?.metadata.learning===void 0)return null;let n=ce.parse(e.metadata.learning);return b(n.definition),oe(n.binding,n.rewards),E(n.definition.rewardBinding,R(n.binding))||O(409,"model_batch_binding_changed","Reviewed task definition and Reward binding do not match."),n.binding}m(se,"reviewedTasksetRewardBinding");function rt(e,n,a=!0,s){let t=U(n),{project:r}=t,i=e.get("SELECT payload FROM model_projects WHERE id = ?",[r.id]),o=i?B.parse(JSON.parse(i.payload)):null;o&&o.profileId!==r.profileId&&O(404,"model_not_found","Model is not available in this Profile."),(o?.revision??0)!==t.expectedRevision&&O(409,"model_revision_conflict","Model changed since it was opened. Refresh before saving.");let d=r.trainingSetup.tasksetRef;if(!d||!r.trainingSetup.rewardBindingRef)return null;let g=e.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[d.id,d.revision]),l=g?A.parse(JSON.parse(g.payload)):null;(!l||l.profileId!==r.profileId)&&O(404,"model_taskset_not_found","The selected Taskset revision is not available in this Profile."),(l.contentHash!==d.contentHash||ae(l)!==l.contentHash)&&O(409,"model_taskset_changed","The selected Taskset does not match its immutable content hash.");let T=se(l);if(T)return E(R(T),r.trainingSetup.rewardBindingRef)||O(422,"model_batch_reward_review_required","Changing a reviewed batch's Reward requires regrading and a new reviewed batch."),null;let v=l.metadata.rewardBinding===void 0?null:q.parse(l.metadata.rewardBinding);if(v&&E(v,r.trainingSetup.rewardBindingRef))return null;if(!v&&s&&!s.modelResources&&!s.learningResources){let p=Se(e,r.profileId,r.trainingSetup.rewardBindingRef),_=Te({owner:{scopeId:r.profileId,modelId:r.id},source:s,...p}),M=_e(e,t,a),I=ne({package:_,profileId:r.profileId,name:l.name,createdAt:M.created_at}),H={..._.modelResources,taskset:_.taskset,executionResources:{environment:_.environment,verifierSet:_.verifierSet}};return{taskset:I.taskset,generatedFiles:I.generatedFiles,directoryId:String(I.taskset.environment.metadata.runtimeSourceTasksetId),source:l,sourcePackage:null,derived:H,imported:I}}v||O(422,"model_taskset_derivation_unavailable","This Taskset needs an authored task definition and Reward binding before its Reward can be changed.");let{sourcePackage:h,selectedBinding:S,selectedRewards:x,assets:y}=Y(e,l,r.trainingSetup.rewardBindingRef,s),c=te.safeParse(h.taskset.metadata.modelTasksetDerivation),D=o?.hosted?.apiOrigin&&o.hosted.tasksets.some(p=>{if(!c.success||p.localTasksetId!==l.id||!p.packageHash||!p.localTasksetHash)return!1;let _=e.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND content_hash = ? AND profile_id = ?",[l.id,p.localTasksetHash,r.profileId]),M=_?A.parse(JSON.parse(_.payload)):null;if(!M||M.contentHash!==p.localTasksetHash)return!1;let I=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = 'package' AND id = ? AND revision = ?",[r.profileId,p.releaseId,p.releaseRevision]),H=I?G.parse(JSON.parse(I.payload)):null,N=te.safeParse(H?.metadata.modelTasksetDerivation);return H?.contentHash===p.releaseHash&&N.success&&u(N.data.owner)===u(c.data.owner)&&E(N.data.root,c.data.root)})&&c.success&&c.data.owner.modelId===r.id?c.data.owner:{scopeId:r.profileId,modelId:r.id},k=me({owner:D,source:h,rewardBinding:S,rewards:x,assets:[...y.values()]}),K=_e(e,t,a);if(s){let p=new Map(s.files.map(L=>[L.asset.id,L]));for(let L of k.assets)p.set(L.id,{asset:L.asset,base64:Buffer.from(L.text).toString("base64")});let{taskset:_,executionResources:M,...I}=k;if(!M)throw new Error("Derived imported package is missing execution resources.");let H=ge({schemaVersion:"openpond.tasksetPackage.v1",taskset:_,...M,modelResources:I,files:[...p.values()]}),N=ne({package:H,profileId:r.profileId,name:l.name,createdAt:K.created_at});return{taskset:N.taskset,generatedFiles:N.generatedFiles,directoryId:String(N.taskset.environment.metadata.runtimeSourceTasksetId),source:l,sourcePackage:h,derived:k,imported:N}}let re=`${k.taskset.id}-r${k.taskset.revision}-${$({packageHash:k.taskset.contentHash,preparedAt:K.created_at}).contentHash}`,j=ke(l,K.created_at),ye=new Map(k.taskset.tasks.map(p=>[p.id,p])),Z=[];for(let p of k.taskset.graders)if(p.kind==="custom_verifier"){let _=he(p.verifierRef.contentHash);Z.some(M=>M.path===_)||Z.push({path:_,role:"verifier",content:V(y.get(p.verifierRef.id),p.verifierRef)})}let J=ve({tasksetId:k.taskset.id,now:K.created_at,sourcePackageHash:k.taskset.contentHash,draft:{...j,policy:k.taskset.policy,tasks:j.tasks.map(p=>({...p,metadata:{...p.metadata,portableTaskRecord:ye.get(p.id)}})),environment:{...j.environment,metadata:{...j.environment.metadata,runtimeSourceTasksetId:re,portableExecutionResources:k.executionResources}},graders:X(S,x,[...y.values()]),learningSignals:{...j.learningSignals,rewards:j.learningSignals.rewards.map(p=>({...p,rules:[{id:S.id,points:1,condition:"Execute the published Reward binding with its declared normalization, weights and required gates."}],artifactRef:S.id,metadata:{...p.metadata,rewardBinding:R(S)}}))},metadata:{...j.metadata,portableCapabilities:k.taskset.capabilities,taskDefinition:R(k.taskDefinition),rewardBinding:R(S),rewardExecution:{binding:S,rewards:x},derivedPortableMetadata:k.taskset.metadata,modelTasksetDerivation:k.taskset.metadata.modelTasksetDerivation}}});if(J.metrics=k.taskset.metrics,J.contentHash=ae(J),J.revision!==k.taskset.revision)throw new Error("Derived local and portable Taskset revisions differ.");return{taskset:J,generatedFiles:Z,directoryId:re,source:l,sourcePackage:h,derived:k}}m(rt,"prepareModelTasksetSave");function Pe(e,n,a){let s=n.project.profileId;for(let o of[a.sourcePackage,a.derived]){if(!o)continue;for(let g of o.assets)w(e,s,"asset",g);for(let g of o.rewards)w(e,s,"reward",g);w(e,s,"binding",o.rewardBinding),w(e,s,"package",o.taskset),w(e,s,"definition",o.taskDefinition);let d=o.executionResources??o.execution;d&&w(e,s,"asset",Q(d)),o.execution&&w(e,s,"asset",z(o.execution))}let t=a.taskset;e.get("SELECT content_hash FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[t.id,t.revision])&&O(409,"model_taskset_revision_conflict","The derived Taskset revision was already published. Refresh before saving.");let i=JSON.stringify(t);e.run("INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO UPDATE SET status = excluded.status, payload = excluded.payload, updated_at = excluded.updated_at",[t.id,s,t.status,i,t.createdAt,t.updatedAt]),e.run("INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[t.id,t.revision,t.contentHash,s,t.status,i,t.createdAt,t.updatedAt]),e.run("UPDATE model_project_taskset_preparations SET state = 'committed' WHERE profile_id = ? AND operation_id = ?",[s,n.operationId])}m(Pe,"commitPreparedModelTaskset");function _e(e,n,a){let s=Me("sha256").update(u(n)).digest("hex"),t=n.project.profileId;a&&e.run("INSERT OR IGNORE INTO model_project_taskset_preparations (profile_id, operation_id, request_hash, created_at, state) VALUES (?, ?, ?, ?, 'preparing')",[t,n.operationId,s,new Date().toISOString()]);let r=e.get("SELECT request_hash, created_at FROM model_project_taskset_preparations WHERE profile_id = ? AND operation_id = ?",[t,n.operationId])??{request_hash:s,created_at:new Date().toISOString()};return r.request_hash!==s&&O(409,"model_operation_conflict","This save operation was already used with different Model configuration."),r}m(_e,"recordModelTasksetPreparation");function O(e,n,a){throw new F(e,{schemaVersion:"openpond.modelProjectApiError.v2",code:n,message:a,retryable:!1,requestId:null,details:{}})}m(O,"fail");import{createHash as Ee}from"node:crypto";function Ie(e,n){let a=U(n),s=e.get("SELECT request_hash, payload FROM model_project_save_operations WHERE profile_id = ? AND operation_id = ?",[a.project.profileId,a.operationId]);if(!s)return null;let t=Ee("sha256").update(u(a)).digest("hex");return s.request_hash!==t&&P(409,"model_operation_conflict","This save operation was already used with different Model configuration."),B.parse(JSON.parse(s.payload))}m(Ie,"findModelProjectSave");function vt(e,n,a,s){e.exec("BEGIN IMMEDIATE");try{let t=Oe(e,n,a,s);return e.exec("COMMIT"),t}catch(t){throw e.exec("ROLLBACK"),t}}m(vt,"commitModelProjectSave");function Oe(e,n,a,s){let t=U(n);t.learning&&P(422,"model_learning_hosted_required","Create this Model in a hosted workspace to enable continual learning.");let r=Ee("sha256").update(u(t)).digest("hex"),{project:i,operationId:o,expectedRevision:d}=t,g=Ie(e,t);if(g)return g;let l=e.get("SELECT payload FROM model_projects WHERE id = ?",[i.id]),T=l?B.parse(JSON.parse(l.payload)):null;T&&T.profileId!==i.profileId&&P(404,"model_not_found","Model is not available in this Profile."),(T?.revision??0)!==d&&P(409,"model_revision_conflict","Model changed since it was opened. Refresh before saving.");let v=xe(e,t),h=se(v);h||Ne(e,t);let S=h?R(h):v?.metadata.rewardBinding===void 0?null:q.parse(v.metadata.rewardBinding);v&&i.trainingSetup.rewardBindingRef&&(!S||!E(S,i.trainingSetup.rewardBindingRef))&&!a&&P(409,"model_taskset_preparation_required","Changing this Reward requires publishing its model-owned Taskset revision."),a&&((!i.trainingSetup.tasksetRef||!E(i.trainingSetup.tasksetRef,R(a.source))||!i.trainingSetup.rewardBindingRef||!E(i.trainingSetup.rewardBindingRef,R(a.derived.rewardBinding)))&&P(409,"model_taskset_preparation_changed","The prepared Taskset differs from the selected configuration."),Pe(e,t,a));let x=new Date().toISOString(),y=le.parse({...i.trainingSetup,baseModel:i.trainingSetup.baseModel??i.defaultBaseModel,method:i.trainingSetup.method??(v?.authoringProvenance.buildIntent==="verifiable_reward"?"grpo":v?.authoringProvenance.buildIntent==="demonstrations"?"sft":null),...S?{rewardBindingRef:S}:{},...a?{rewardBindingRef:R(a.derived.rewardBinding),tasksetRef:R(a.taskset),tasksetRelease:null,recipe:null,...i.trainingSetup.evaluationTasksetRef&&E(i.trainingSetup.evaluationTasksetRef,R(a.source))?{evaluationTasksetRef:R(a.taskset)}:{}}:{}}),c=a?.derived??s??(v&&!h&&y.rewardBindingRef&&v.metadata.taskDefinition!==void 0&&v.metadata.rewardBinding!==void 0?Y(e,v,y.rewardBindingRef).sourcePackage:void 0),f=B.parse({...T,...i,trainingSetup:c?we({setup:y,package:c}):y,schemaVersion:"openpond.modelProject.v2",revision:d+1,hosted:T?.hosted??null,tasksetSyncs:T?.tasksetSyncs??[],createdAt:T?.createdAt??x,updatedAt:x});return e.run(`INSERT INTO model_projects (id, profile_id, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
5
+ ON CONFLICT(id) DO UPDATE SET payload = excluded.payload, updated_at = excluded.updated_at`,[f.id,f.profileId,JSON.stringify(f),f.createdAt,f.updatedAt]),e.run("INSERT INTO model_project_save_operations (profile_id, operation_id, request_hash, payload) VALUES (?, ?, ?, ?)",[f.profileId,o,r,JSON.stringify(f)]),f}m(Oe,"saveModelProjectInTransaction");function xe(e,n){let a=n.project.trainingSetup.tasksetRef;if(!a){n.project.trainingSetup.tasksetRelease&&P(400,"model_taskset_required","Choose the Taskset corresponding to this release.");return}let s=e.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[a.id,a.revision]),t=s?A.parse(JSON.parse(s.payload)):null;return(!t||t.profileId!==n.project.profileId)&&P(404,"model_taskset_not_found","The selected Taskset revision is not available in this Profile."),t.contentHash!==a.contentHash&&P(409,"model_taskset_changed","The selected Taskset does not match its immutable content hash."),t}m(xe,"assertTaskset");function Ne(e,n){let a=n.project.trainingSetup.rewardBindingRef;if(!a)return;function s(r,i){let o=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[n.project.profileId,r,i.id,i.revision]);o||P(404,"model_reward_unavailable","The exact Reward configuration is unavailable in this Profile.");let d=(r==="binding"?ee:ie).parse(JSON.parse(o.payload));return d.contentHash!==i.contentHash&&P(409,"model_reward_changed","The selected Reward does not match its immutable content hash."),b(d),d}m(s,"read");let t=ee.parse(s("binding",a));for(let r of t.sources)s("reward",r.reward)}m(Ne,"assertReward");function P(e,n,a){throw new F(e,{schemaVersion:"openpond.modelProjectApiError.v2",code:n,message:a,retryable:!1,requestId:null,details:{}})}m(P,"fail");function Pt(e,n){let{taskset:a,package:s}=n,t=a.profileId,r=e.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[a.id,a.revision]);if(r&&u(A.parse(JSON.parse(r.payload)))!==u(a))throw new Error("Imported Taskset revision conflicts with an existing immutable local revision.");let i=e.get("SELECT payload FROM tasksets WHERE id = ?",[a.id]),o=i?A.parse(JSON.parse(i.payload)):null;if(o&&o.profileId!==t)throw new Error("Imported Taskset belongs to another Profile.");w(e,t,"package",s.taskset);let d=s.modelResources;if(d){w(e,t,"definition",d.taskDefinition),w(e,t,"binding",d.rewardBinding);for(let l of d.rewards)w(e,t,"reward",l);for(let l of d.assets)w(e,t,"asset",l);w(e,t,"asset",Q({environment:s.environment,verifierSet:s.verifierSet})),d.execution&&w(e,t,"asset",z(d.execution))}let g=JSON.stringify(a);r||e.run("INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[a.id,a.revision,a.contentHash,t,a.status,g,a.createdAt,a.updatedAt]),(!o||o.revision<a.revision)&&e.run("INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO UPDATE SET status = excluded.status, payload = excluded.payload, updated_at = excluded.updated_at",[a.id,t,a.status,g,a.createdAt,a.updatedAt])}m(Pt,"importTasksetPackageInTransaction");export{w as a,rt as b,Ie as c,vt as d,Oe as e,Pt as f};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{b as f}from"./chunk-JYKRR7E5.js";import{I as c}from"./chunk-VRIEKBBH.js";import{h as g,j as w,k as I}from"./chunk-QOTVNQDI.js";import{b as m}from"./chunk-DIO5CB6U.js";import{f as R}from"./chunk-ACYFMLWG.js";import{b as r}from"./chunk-ES2ISFJC.js";import{a as d}from"./chunk-FTQLQJQV.js";import n from"node:path";import{readFile as y}from"node:fs/promises";var A=r.object({profileId:r.string().min(1),sourceRevision:r.string().min(1),repositoryId:r.string().min(1),harnessRelease:r.object({id:r.string().min(1),contentHash:r.string().regex(/^[a-f0-9]{64}$/)}).strict(),hostExecution:r.object({conversationId:r.string().min(1),turnId:r.string().min(1)}).strict().optional(),workspaceId:r.string().min(1),assetsPath:r.string().min(1).refine(n.isAbsolute)}).strict();async function _(p,e){let t=A.parse(e),s=await f(p,t.harnessRelease);if(!s||n.resolve(s.release.bundlePath)!==n.resolve(t.assetsPath))throw new Error("Hosted Profile release changed after admission.");let o=s.release.harnessRelease.metadata.profile;if(!o||typeof o!="object"||o.id!==t.profileId||o.sourceRevision!==t.sourceRevision||o.repositoryId!==void 0&&o.repositoryId!==t.repositoryId)throw new Error("Hosted Profile provenance differs from admitted release.");return{profile:I(),profileLibrary:w()}}d(_,"loadHostedProfileStateAndLibrary");async function B(p,e){let t=A.parse(e),s=await f(p,t.harnessRelease);if(!s||n.resolve(s.release.bundlePath)!==n.resolve(t.assetsPath))throw new Error("Hosted Profile workflow release is unavailable.");let o=s.release.harnessRelease.metadata.profile;if(o?.id!==t.profileId||o.sourceRevision!==t.sourceRevision||o.repositoryId!==void 0&&o.repositoryId!==t.repositoryId)throw new Error("Hosted Profile workflow provenance changed.");let a=t.harnessRelease,l={source:"openpond_git",repositoryId:t.repositoryId,profileId:t.profileId};if(!s.release.harnessRelease.files.some(u=>u.path==="workflows/catalog.json"))return{profileRef:l,sourceRevision:t.sourceRevision,harnessRelease:a,workflows:[]};let i=n.join(s.release.bundlePath,"source","workflows"),v=R({agentSnapshot:s.release.agentSnapshot,harnessRelease:s.release.harnessRelease,catalogBytes:await y(n.join(i,"catalog.json")),actionBytes:await y(n.join(i,"actions.json"))});return{profileRef:l,sourceRevision:t.sourceRevision,harnessRelease:a,workflows:v.catalog.workflows.map(u=>({workflow:u,binding:{schemaVersion:"openpond.profileWorkflowBinding.v1",profileId:t.profileId,sourceRevision:t.sourceRevision,harnessRelease:a,catalogHash:v.catalogHash,workflowId:u.id}}))}}d(B,"listHostedProfileWorkflows");import{createHash as U,randomUUID as h}from"node:crypto";var b=r.object({approval:g,revision:r.number().int().positive()}).strict(),P=r.object({record:m}).strict(),x=r.object({startedAt:r.string().min(1),requestOrdinal:r.number().int().nonnegative(),id:r.string().min(1)}).strict(),k=r.object({records:r.array(m).max(200),nextBefore:x.nullable()}).strict(),H=1e4,S=class{constructor(e){this.client=e}client;static{d(this,"HostedApprovalStorage")}async readApproval(e){let t=await this.client.request({contractVersion:c,requestId:h(),operation:"approval/get",params:{approvalId:e}});return t===null?null:b.parse(t)}async getApproval(e){return(await this.readApproval(e))?.approval??null}async putApproval(e){let t=g.parse(e.approval);if(!e.requestId.trim())throw new Error("Approval mutation requires a stable request ID.");return b.parse(await this.client.request({contractVersion:c,requestId:e.requestId,operation:"approval/upsert",params:{approval:t,expectedRevision:e.expectedRevision}}))}},M=class{constructor(e){this.client=e}client;static{d(this,"HostedModelUsageStorage")}async upsertModelUsageRecord(e){let t=m.parse(e),s=U("sha256").update(JSON.stringify(t)).digest("hex"),o=await this.client.request({contractVersion:c,requestId:`usage:${s}`,operation:"usage/upsert",params:{record:t}}),a=P.parse(o).record;if(a.requestId!==t.requestId)throw new Error("Host usage upsert changed request identity.");return a}async getModelUsageRecordByRequestId(e){let t=await this.client.request({contractVersion:c,requestId:h(),operation:"usage/getByRequestId",params:{requestId:e}});return t===null?null:P.parse(t).record}async listModelUsageRecords(e={}){let t=e.limit===void 0||e.limit>=H,s=e.limit===void 0?H:Math.max(1,Math.min(1e4,Math.trunc(e.limit))),o={...e.sessionId?{sessionId:e.sessionId}:{},...e.turnId?{turnId:e.turnId}:{},...e.provider?{provider:e.provider}:{},...e.model?{model:e.model}:{},...e.startedAtFrom?{startedAtFrom:e.startedAtFrom}:{},...e.startedAtTo?{startedAtTo:e.startedAtTo}:{},...e.visibility&&e.visibility!=="all"?{visibility:e.visibility}:{},...e.status&&e.status!=="all"?{status:e.status}:{}},a=[],l=null;for(;a.length<s+(t?1:0);){let i=k.parse(await this.client.request({contractVersion:c,requestId:h(),operation:"usage/page",params:{query:o,before:l,limit:Math.min(200,s+(t?1:0)-a.length)}}));if(a.push(...i.records),a.length>s)throw new Error(`Hosted usage query exceeds ${s} rows; narrow its filters or use a streamed aggregation.`);if(i.nextBefore===null)break;if(i.records.length===0||JSON.stringify(i.nextBefore)===JSON.stringify(l))throw new Error("Host usage cursor did not advance.");l=i.nextBefore}return a}async listModelUsageRecordsComplete(e={}){return this.listModelUsageRecords(e)}};export{A as a,_ as b,B as c,S as d,M as e};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as m}from"./chunk-UKMA4R6X.js";import{e as h}from"./chunk-YR5ID2SS.js";import{a as s}from"./chunk-FTQLQJQV.js";var g=5,A=10,f=1200;function b(e){let r=y(e.endpoint),t=e.fetchImpl??fetch,n=e.apiKey?.trim()||null;return async(i,c)=>{let a=S(i),u=new Headers;u.set("Accept","application/json"),u.set("Content-Type","application/json"),u.set("x-openpond-client","openpond-app"),n&&(n.startsWith("opk_")&&u.set("openpond-api-key",n),u.set("Authorization",`Bearer ${n}`));let l=await t(r,{method:"POST",headers:u,body:JSON.stringify(a),signal:c?.signal});if(!l.ok)throw new Error(`Hosted web search failed: ${l.status} ${await O(l)}`);return w(await l.json(),a.query)}}s(b,"createHostedWebSearchExecutor");function D(e=process.env,r={}){let t=r.loadAccountContext??m;return async(n,i)=>{let c=p(e.OPENPOND_WEB_SEARCH_API_KEY,e.OPENPOND_SEARCH_API_KEY,e.OPENPOND_API_KEY),a=c?null:await t().catch(()=>null),u=E(e,a),l=c??a?.token??null;return b({endpoint:u,apiKey:l,fetchImpl:r.fetchImpl})(n,i)}}s(D,"createWebSearchExecutorFromEnv");function E(e=process.env,r){let t=p(e.OPENPOND_WEB_SEARCH_ENDPOINT);if(t)return y(t);let n=p(e.OPENPOND_SEARCH_API_URL);if(n)return d(n);let i=p(e.OPENPOND_PUBLIC_API_URL,e.OPENPOND_API_URL,r?.apiBaseUrl);if(i)return d(i);let c=p(e.OPENPOND_OPCHAT_API_URL,e.OPENPOND_CHAT_API_URL,r?.chatApiBaseUrl);return d(c||h)}s(E,"resolveWebSearchEndpoint");function d(e){let r=e.trim().replace(/\/+$/,"");if(!r)throw new Error("Hosted web search endpoint is required.");let t=new URL(r);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("Hosted web search endpoint must use http or https.");let n=t.pathname.split("/").filter(Boolean),i=n.findIndex(c=>c.toLowerCase()==="opchat");if(i>=0)t.pathname=`/${[...n.slice(0,i),"v1","search"].join("/")}`;else{let c=n.findIndex(a=>a.toLowerCase()==="search");if(c>=0)t.pathname=`/${n.slice(0,c+1).join("/")}`;else{let a=n.findIndex(u=>u.toLowerCase()==="v1");t.pathname=a>=0?`/${[...n.slice(0,a+1),"search"].join("/")}`:`${t.pathname.replace(/\/+$/,"")}/v1/search`.replace(/\/{2,}/g,"/")}}return t.search="",t.hash="",t.toString()}s(d,"normalizeSearchApiUrl");function S(e){let r=e.query.trim();if(!r)throw new Error("web_search query is required.");let t=_(e.limit),n=Array.isArray(e.domains)?e.domains.map(i=>i.trim()).filter(Boolean).slice(0,10):void 0;return{query:r,limit:t,...typeof e.recencyDays=="number"&&Number.isFinite(e.recencyDays)&&e.recencyDays>=0?{recencyDays:Math.floor(e.recencyDays)}:{},...n&&n.length>0?{domains:n}:{}}}s(S,"normalizeWebSearchRequest");function y(e){let r=e.trim();if(!r)throw new Error("Hosted web search endpoint is required.");let t=new URL(r);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("Hosted web search endpoint must use http or https.");return t.toString()}s(y,"normalizeEndpoint");function p(...e){for(let r of e){let t=r?.trim();if(t)return t}return null}s(p,"firstNonEmpty");function _(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?g:Math.min(Math.floor(e),A)}s(_,"normalizeLimit");function w(e,r){let t=e&&typeof e=="object"?e:{},i=(Array.isArray(t.results)?t.results:Array.isArray(t.items)?t.items:[]).map(P).filter(c=>!!c);return{query:o(t.query)??r,provider:o(t.provider)??"hosted",searchedAt:o(t.searchedAt)??o(t.searched_at)??new Date().toISOString(),results:i,truncated:t.truncated===!0}}s(w,"normalizeWebSearchResult");function P(e,r){if(!e||typeof e!="object")return null;let t=e,n=o(t.url),i=o(t.title);return!n||!i?null:{id:o(t.id)??`result_${r+1}`,title:i,url:n,snippet:R(o(t.snippet)??o(t.description)??o(t.text)??o(t.content)),sourceName:o(t.sourceName)??o(t.source_name)??o(t.source)??I(n),faviconUrl:x(o(t.faviconUrl)??o(t.favicon_url)??o(t.iconUrl)??o(t.icon_url))??N(n),publishedAt:o(t.publishedAt)??o(t.published_at)??o(t.publishedDate)??o(t.published_date),updatedAt:o(t.updatedAt)??o(t.updated_at)??o(t.updatedDate)??o(t.updated_date)}}s(P,"normalizeWebSearchItem");function R(e){if(!e)return"";let r=e.replace(/\s+/g," ").trim();return r.length<=f?r:`${r.slice(0,f-1).trimEnd()}\u2026`}s(R,"normalizeSnippet");function x(e){if(!e)return null;try{let r=new URL(e);return r.protocol!=="http:"&&r.protocol!=="https:"?null:r.toString()}catch{return null}}s(x,"normalizeOptionalUrl");function N(e){try{return new URL("/favicon.ico",e).toString()}catch{return null}}s(N,"faviconUrlFromPageUrl");function I(e){try{return new URL(e).hostname.replace(/^www\./i,"")}catch{return null}}s(I,"hostnameFromUrl");async function O(e){let r=await e.text().catch(()=>"");if(!r)return e.statusText||`HTTP ${e.status}`;try{let t=JSON.parse(r);if(t&&typeof t=="object"){let n=t,i=n.error;return i&&typeof i=="object"?o(i.message)??JSON.stringify(t):o(n.message)??o(n.error)??JSON.stringify(t)}}catch{return r}return r}s(O,"readSearchError");function o(e){return typeof e=="string"&&e.trim()?e.trim():null}s(o,"stringValue");export{b as a,D as b,E as c,d,S as e};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as l}from"./chunk-FTQLQJQV.js";function r(e){return process.platform==="win32"?{command:e,shell:!0}:{command:`set -o pipefail
3
+ ${e}`,shell:"/bin/bash"}}l(r,"pipefailLocalShellCommand");function t(e){return`bash -o pipefail -lc ${n(e)}`}l(t,"pipefailSandboxShellCommand");function n(e){return`'${e.replace(/'/g,"'\\''")}'`}l(n,"quotePosixShellArg");export{r as a,t as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{b as e}from"./chunk-ES2ISFJC.js";import{a as o}from"./chunk-FTQLQJQV.js";var i=e.enum(["local","sandbox"]),s=e.enum(["pinned","saved_for_later"]),l=e.object({id:e.string().min(1),workspaceKind:i,workspaceId:e.string().min(1),workspaceName:e.string().min(1),path:e.string().min(1),status:s,order:e.number().int().nonnegative().nullable().default(null),sourceSessionId:e.string().min(1).nullable().default(null),available:e.boolean().default(!0),createdAt:e.string().min(1),updatedAt:e.string().min(1)}),p=e.object({items:e.array(l)}),d=e.object({workspaceKind:i,workspaceId:e.string().trim().min(1),workspaceName:e.string().trim().min(1),path:e.string().trim().min(1),status:e.enum(["pinned","saved_for_later","none"]),order:e.number().int().nonnegative().nullable().optional(),sourceSessionId:e.string().trim().min(1).nullable().optional()}),u=e.enum(["pin","save_for_later","remove","list"]);function c(n){let r=n.trim().replaceAll("\\","/");if(r=r.replace(/^(?:workspace|sandbox):file:/,""),r=r.replace(/^\/workspace\/app\//,""),r=r.replace(/^\.\//,""),!r||r.startsWith("/"))throw new Error("File path must be relative to the workspace.");let a=r.split("/").filter(t=>t&&t!==".");if(a.some(t=>t===".."))throw new Error("File path cannot leave the workspace.");if(a.length===0)throw new Error("File path is required.");return a.join("/")}o(c,"normalizeSidebarFilePath");function b(n){return["sidebar-file",n.workspaceKind,encodeURIComponent(n.workspaceId),encodeURIComponent(c(n.path))].join(":")}o(b,"sidebarFileBookmarkId");export{l as a,d as b,c,b as d};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as S,c as y}from"./chunk-F74GBN6K.js";import{D as h}from"./chunk-Y4OWBBDD.js";import{l as w}from"./chunk-ACYFMLWG.js";import{b as p}from"./chunk-ES2ISFJC.js";import{a as t}from"./chunk-FTQLQJQV.js";var T=p.object({score:p.number().finite().min(0).max(1).nullable(),passed:p.boolean(),feedback:p.string().max(2e4),evidenceRefs:p.array(p.string().max(240)).max(1e3).default([])}).strict().refine(e=>e.score!==null||!e.passed,{message:"Unscorable verifiers cannot pass.",path:["passed"]});function P(e){if(e==="sandbox_process")throw new Error("verifier_sandbox_process_required")}t(P,"assertIsolatedVerifierRuntime");import{Worker as R}from"node:worker_threads";async function g(e){e.signal?.throwIfAborted(),y(e);let{javascriptVerifierWorkerSource:d}=await import("./javascript-verifier-worker-source-F3LSGPOY.js");e.signal?.throwIfAborted();let a=e.signal,x={source:e.source,exportName:e.exportName,value:e.value,timeoutMs:e.timeoutMs,maxResultBytes:e.maxResultBytes,deterministic:e.deterministic===!0,errorPrefix:e.errorPrefix},c=t(i=>new Error(`${e.errorPrefix}_${i}`),"error");return new Promise((i,f)=>{let l=new R(d,{eval:!0,workerData:x,execArgv:[],env:{},resourceLimits:{maxOldGenerationSizeMb:64,maxYoungGenerationSizeMb:16,stackSizeMb:4}}),m=!1,o=t(r=>{m||(m=!0,clearTimeout(I),a?.removeEventListener("abort",u),l.terminate().then(()=>{"error"in r?f(r.error):i(r.result)},f))},"finish"),u=t(()=>o({error:a?.reason instanceof Error?a.reason:c("cancelled")}),"cancel"),I=setTimeout(()=>o({error:c("timeout")}),e.timeoutMs);a?.addEventListener("abort",u,{once:!0}),l.once("error",r=>o({error:r})),l.once("exit",()=>{m||o({error:c("worker_exited_without_result")})}),l.once("message",r=>{try{if(!r||typeof r!="object"||!("ok"in r))throw c("worker_invalid_response");if(r.ok!==!0)throw new Error("error"in r&&typeof r.error=="string"?r.error:`${e.errorPrefix}_execution_failed`);if(!("result"in r))throw c("worker_invalid_response");w(r.result,e.maxResultBytes),o({result:r.result})}catch(_){o({error:_ instanceof Error?_:c("worker_invalid_response")})}}),a?.aborted&&u()})}t(g,"executeJavaScriptIsolateInWorker");import{spawn as B}from"node:child_process";async function H(e){e.signal?.throwIfAborted(),y(e);let{javascriptIsolateProcessSource:d}=await import("./javascript-isolate-process-source-ZPQKKLR4.js");e.signal?.throwIfAborted();let{signal:a,stripTypeScript:x,...c}=e,i=t(l=>new Error(`${e.errorPrefix}_${l}`),"error"),f=`globalThis.__openpondIsolateInput = JSON.parse(${JSON.stringify(JSON.stringify(c))});
3
+ ${x?`globalThis.__openpondIsolateInput.source = require("node:module").stripTypeScriptTypes(globalThis.__openpondIsolateInput.source, { mode: "strip" });
4
+ `:""}${d}`;return new Promise((l,m)=>{let o=B("node",["--max-old-space-size=64","--input-type=commonjs","-"],{stdio:["pipe","pipe","pipe"],env:{PATH:process.env.PATH},windowsHide:!0}),u,I="",r=0,_=0,v=t(n=>{u??=n,o.kill("SIGKILL")},"stop"),k=t(()=>v(a?.reason instanceof Error?a.reason:i("cancelled")),"cancel"),J=setTimeout(()=>v(e.errorPrefix==="candidate"?new S("candidate_timeout"):i("timeout")),e.timeoutMs);a?.addEventListener("abort",k,{once:!0}),o.stdout.setEncoding("utf8"),o.stdout.on("data",n=>{r+=Buffer.byteLength(n),r>e.maxResultBytes+65536?v(i("process_response_too_large")):I+=n}),o.stderr.on("data",n=>{_+=n.byteLength,_>65536&&v(i("process_stderr_too_large"))}),o.once("error",n=>{u??=n}),o.stdin.on("error",n=>v(n)),o.once("close",n=>{if(clearTimeout(J),a?.removeEventListener("abort",k),u){m(u);return}try{if(n!==0)throw i("process_exited_without_result");let s=JSON.parse(I);if(!s||typeof s!="object"||!("ok"in s))throw i("process_invalid_response");if(s.ok!==!0){let b="error"in s&&typeof s.error=="string"?s.error:`${e.errorPrefix}_execution_failed`;throw"executionError"in s&&s.executionError===!0?new S(b):new Error(b)}if(!("result"in s))throw i("process_invalid_response");w(s.result,e.maxResultBytes),l(s.result)}catch(s){m(s instanceof Error?s:i("process_invalid_response"))}}),o.stdin.end(f),a?.aborted&&k()})}t(H,"executeJavaScriptIsolateInProcess");async function Y(e){return P(e.runtime),T.parse(await g({...e,exportName:e.exportName??"verify",maxResultBytes:65536,errorPrefix:"verifier"}))}t(Y,"executeJavaScriptVerifierInWorker");function re(e){return h(e,E)}t(re,"aggregateTasksetEvaluationInWorker");var E=t(async({source:e,module:d,exportName:a,scores:x,timeoutMs:c,signal:i})=>{let f=/\.[cm]?ts$/.test(d)?(await import("node:module")).stripTypeScriptTypes(e,{mode:"strip"}):e;return g({source:f,exportName:a,value:x,timeoutMs:c,signal:i,maxResultBytes:1024,deterministic:!0,errorPrefix:"metric"})},"executeMetric");var te=E;export{T as a,g as b,H as c,Y as d,re as e,te as f};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{b as l,c as h,e as H,f as y,h as m,i as A,j as C,l as R,m as p,n as g}from"./chunk-KGNCKIFP.js";import{b as e}from"./chunk-ES2ISFJC.js";import{a as i}from"./chunk-FTQLQJQV.js";var v=e.object({name:e.string().trim().min(1).max(64).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/),description:e.string().trim().min(1).max(2e3),inputSchema:e.record(e.string(),e.unknown()),inputSchemaHash:h,sideEffect:e.enum(["read","write"]),timeoutMs:e.number().int().positive().max(36e5)}).strict(),j=e.object({id:l,required:e.boolean(),scopes:e.array(e.string().trim().min(1).max(500)).max(100).default([]),portability:e.enum(["portable","host_adapter","local_only","hosted_only"])}).strict();var M=e.object({portable:e.boolean(),blockers:e.array(e.string().trim().min(1).max(2e3)).max(1e3),localOnlyAssetRefs:e.array(l).max(1e4),hostPrivateAssetRefs:e.array(l).max(1e4)}).strict(),I=e.object({schemaVersion:e.literal("openpond.agentSnapshot.v2"),id:l,sourceRelease:y.nullable(),instructions:e.array(m).max(1e4),skills:e.array(m).max(1e4),agents:e.array(m).max(1e4),toolDeclarations:e.array(v).max(200),capabilityRequirements:e.array(j).max(200),dependencyLock:m,portability:M,metadata:H}).strict(),_=I.extend({contentHash:h}).strict(),V=e.object({create:e.literal(!0),reset:e.literal(!0),step:e.literal(!0),collect:e.literal(!0),destroy:e.literal(!0),resetScope:e.enum(["task","attempt"])}).strict(),$=e.object({visibleEvidence:e.array(l).max(1e3),privilegedEvidence:e.array(l).max(1e3),privateVerifierIsolation:e.boolean()}).strict(),z=e.object({schemaVersion:e.literal("openpond.harnessRelease.v2"),id:l,agentSnapshot:y,program:m,tools:e.array(v).max(200),lifecycle:V,graderInterface:$,files:e.array(m).max(1e5),metadata:H}).strict(),E=z.extend({contentHash:h}).strict(),T=e.object({id:l,turn:e.number().int().nonnegative(),kind:e.enum(["message","tool_call","terminal"]),name:l.nullable(),arguments:e.record(e.string(),e.unknown()),content:e.string().max(1e6).nullable()}).strict(),q=e.object({actionId:l,turn:e.number().int().nonnegative(),terminal:e.boolean(),output:e.record(e.string(),e.unknown()),artifactRefs:e.array(A).max(1e5)}).strict();function Q(r){let t=I.parse(r);return _.parse({...t,contentHash:p(t)})}i(Q,"createAgentSnapshot");function W(r){let t=z.parse(r);return E.parse({...t,contentHash:p(t)})}i(W,"createHarnessRelease");var B=e.object({sequence:e.number().int().nonnegative(),type:e.enum(["created","reset","action","observation","terminal","failure","collected","destroyed"]),payloadHash:h,metadata:H}).strict(),ee=e.object({schemaVersion:e.literal("openpond.harnessTrace.v1"),manifest:y,taskId:l,seed:e.string().trim().min(1).max(500),events:e.array(B).max(1e6),actions:e.array(T).max(1e5),observations:e.array(q).max(1e5),terminal:e.boolean(),failureClass:C.nullable(),output:e.record(e.string(),e.unknown()),contentHash:h}).strict();var w=25*1024*1024,F=e.object({path:m.shape.path,base64:e.string().max(Math.ceil(w/3)*4)}).strict(),P=e.object({schemaVersion:e.literal("openpond.harnessSourcePackage.v1"),agentSnapshot:_,harnessRelease:E,files:e.array(F).max(1e4)}).strict(),O=P.extend({contentHash:h}).strict(),D=P.extend({schemaVersion:e.literal("openpond.harnessPolicySourcePackage.v1"),contentHash:h}).strict(),G=e.object({schemaVersion:e.literal("openpond.harnessSourceSelection.v1"),mode:e.enum(["taskset_owned","selected_release"]),harnessRelease:y,sourcePackageHash:h.nullable()}).strict().superRefine((r,t)=>{r.mode==="selected_release"!=(r.sourcePackageHash!==null)&&t.addIssue({code:"custom",path:["sourcePackageHash"],message:"Only a selected release binds a source package."})});function oe(r){let t=G.parse(r.selection);if(t.harnessRelease.id!==r.expectedRelease.id||t.harnessRelease.contentHash!==r.expectedRelease.contentHash)throw new Error("Harness source selection differs from its run manifest.");if(t.mode==="taskset_owned"){if(r.sourcePackage!==void 0&&r.sourcePackage!==null)throw new Error("Taskset-owned execution cannot include a selected Harness source package.");return{selection:t,sourcePackage:null}}let a=x(r.sourcePackage,t.harnessRelease);if(a.contentHash!==t.sourcePackageHash)throw new Error("Harness source selection differs from its captured package.");return{selection:t,sourcePackage:a}}i(oe,"resolveHarnessSourceSelection");function ce(r){if([...r.files.values()].reduce((a,n)=>a+n.byteLength,0)>w)throw new Error("Harness source package exceeds its byte limit.");let t=P.parse({schemaVersion:"openpond.harnessSourcePackage.v1",agentSnapshot:r.agentSnapshot,harnessRelease:r.harnessRelease,files:[...r.files].sort(([a],[n])=>a.localeCompare(n)).map(([a,n])=>({path:a,base64:U(n)}))});return x({...t,contentHash:p(t)})}i(ce,"createHarnessSourcePackage");function ie(r,t){let a=x(r,t),n=new Map(a.harnessRelease.files.map(c=>[c.path,c])),o={schemaVersion:"openpond.harnessPolicySourcePackage.v1",agentSnapshot:a.agentSnapshot,harnessRelease:a.harnessRelease,files:a.files.filter(c=>n.get(c.path)?.visibility==="policy")};return L({...o,contentHash:p(o)},t)}i(ie,"createHarnessPolicySourcePackage");function L(r,t){let a=D.parse(r);g(a,"Harness policy source package"),g(a.agentSnapshot,"Harness policy source Agent snapshot"),g(a.harnessRelease,"Harness policy source release");let{agentSnapshot:n,harnessRelease:o}=a;if(t&&(t.id!==o.id||t.contentHash!==o.contentHash))throw new Error("Harness policy source package differs from the selected release.");if(o.agentSnapshot.id!==n.id||o.agentSnapshot.contentHash!==n.contentHash)throw new Error("Harness policy source release does not bind its Agent snapshot.");let c=new Map;for(let s of o.files){if(c.has(s.path))throw new Error("Harness policy source contains duplicate asset paths.");c.set(s.path,s)}for(let s of[o.program,n.dependencyLock,...n.instructions,...n.skills,...n.agents])if(p(c.get(s.path)??null)!==p(s))throw new Error(`Harness policy source dependency ${s.path} is absent or differs from its release inventory.`);for(let s of[o.program,n.dependencyLock,...n.instructions,...n.skills])if(s.visibility!=="policy")throw new Error(`Harness policy source dependency ${s.path} is private.`);let b=new Set(o.files.filter(s=>s.visibility==="policy").map(s=>s.path)),u=new Set,S=0;for(let s of a.files){if(u.has(s.path))throw new Error("Harness policy source contains duplicate files.");u.add(s.path);let f=c.get(s.path);if(!f||f.visibility!=="policy")throw new Error(`Harness policy source file ${s.path} is not policy-visible.`);let d=k(s.base64);if(S+=d.byteLength,S>w)throw new Error("Harness policy source exceeds its byte limit.");if(d.byteLength!==f.sizeBytes||R(d)!==f.contentHash)throw new Error(`Harness policy source file ${s.path} differs from its immutable bytes.`)}if(u.size!==b.size||[...b].some(s=>!u.has(s)))throw new Error("Harness policy source is missing released policy files.");return a}i(L,"validateHarnessPolicySourcePackage");function le(r,t){let a=L(r,t);return new Map(a.files.map(n=>[n.path,k(n.base64)]))}i(le,"harnessPolicySourcePackageFiles");function x(r,t){let a=O.parse(r);g(a,"Harness source package"),g(a.agentSnapshot,"Harness source Agent snapshot"),g(a.harnessRelease,"Harness source release");let{agentSnapshot:n,harnessRelease:o}=a;if(t&&(t.id!==o.id||t.contentHash!==o.contentHash))throw new Error("Harness source package differs from the selected release.");if(o.agentSnapshot.id!==n.id||o.agentSnapshot.contentHash!==n.contentHash)throw new Error("Harness source release does not bind its Agent snapshot.");let c=new Map,b=new Set;for(let s of o.files){if(s.path.includes("\\")||s.path.includes(":"))throw new Error("Harness source requires portable relative file paths.");if(c.has(s.path)||b.has(s.id))throw new Error("Harness source contains duplicate asset paths or identities.");c.set(s.path,s),b.add(s.id)}for(let s of[o.program,n.dependencyLock,...n.instructions,...n.skills,...n.agents])if(p(c.get(s.path)??null)!==p(s))throw new Error(`Harness source dependency ${s.path} is absent or differs from its release inventory.`);for(let s of[...n.instructions,...n.skills])if(s.visibility!=="policy")throw new Error(`Harness policy source ${s.path} is private.`);let u=new Set,S=0;for(let s of a.files){if(u.has(s.path))throw new Error("Harness source package contains duplicate files.");u.add(s.path);let f=c.get(s.path);if(!f)throw new Error(`Harness source file ${s.path} is not declared by its release.`);let d=k(s.base64);if(S+=d.byteLength,S>w)throw new Error("Harness source package exceeds its byte limit.");if(d.byteLength!==f.sizeBytes||R(d)!==f.contentHash)throw new Error(`Harness source file ${s.path} differs from its immutable bytes.`)}if(u.size!==c.size)throw new Error("Harness source package is missing released files.");return a}i(x,"validateHarnessSourcePackage");function he(r,t){let a=x(r,t);return new Map(a.files.map(n=>[n.path,k(n.base64)]))}i(he,"harnessSourcePackageFiles");function U(r){let t="";for(let a=0;a<r.length;a+=8192)t+=String.fromCharCode(...r.subarray(a,a+8192));return btoa(t)}i(U,"encode");function k(r){let t;try{t=atob(r)}catch{throw new Error("Harness source file is not valid base64.")}if(btoa(t)!==r)throw new Error("Harness source file is not canonical base64.");return Uint8Array.from(t,a=>a.charCodeAt(0))}i(k,"decode");export{v as a,j as b,M as c,I as d,_ as e,V as f,$ as g,z as h,E as i,T as j,q as k,Q as l,W as m,B as n,ee as o,D as p,oe as q,ce as r,ie as s,L as t,le as u,x as v,he as w};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{gb as a,hb as r}from"./chunk-ACYFMLWG.js";import{m as t}from"./chunk-KGNCKIFP.js";import{a as n}from"./chunk-FTQLQJQV.js";var T=r;function f(i,l){let s=new Map(i.map(o=>[o.name,o]));return l.map(o=>{let e=s.get(o.name);if(!a.has(o.name)||o.sideEffect!=="read"||!e||t(e.parameters)!==o.inputSchemaHash)throw new Error(`Standalone Harness tool has no compatible case-scoped implementation: ${o.name}.`);return e})}n(f,"isolateStandaloneExperimentTools");export{T as a,f as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as u}from"./chunk-DMFUEUAZ.js";import{b as a}from"./chunk-DIO5CB6U.js";import{C as o,z as s}from"./chunk-Z4Z5UOZM.js";import{a as e}from"./chunk-FTQLQJQV.js";function p(t){return JSON.parse(t.payload)}e(p,"localAgentScheduleFromRow");function g(t){return s.parse({...JSON.parse(t.payload),updatedAt:t.updated_at})}e(g,"subagentRunFromRow");function _(t,r){let n=s.parse({...t,updatedAt:r});return[n.id,n.parentSessionId,n.parentTurnId,n.childSessionId,n.roleId,n.status,JSON.stringify(n),n.createdAt,r]}e(_,"subagentRunParams");function m(t){return o.parse(JSON.parse(t.payload))}e(m,"subagentMessageFromRow");function R(t){return[t.id,t.fromRunId,t.toRunId,t.toRole,t.kind,JSON.stringify(t),t.createdAt]}e(R,"subagentMessageParams");function S(t){return[t.id,t.localProjectId,t.scheduleName,t.enabled?1:0,t.nextRunAt,JSON.stringify(t),t.createdAt,t.updatedAt]}e(S,"localAgentScheduleParams");function h(t){return JSON.parse(t.payload)}e(h,"localAgentScheduleRunFromRow");function y(t){return[t.id,t.scheduleId,t.localProjectId,t.scheduleName,t.scheduledFor,t.trigger,t.status,JSON.stringify(t),t.createdAt,t.updatedAt]}e(y,"localAgentScheduleRunParams");function b(t){return a.parse({id:t.id,requestId:t.request_id,requestOrdinal:t.request_ordinal,sessionId:t.session_id,turnId:t.turn_id,provider:t.provider,model:t.model,route:t.route,source:t.source,requestKind:t.request_kind,visibility:t.visibility,status:t.status,startedAt:t.started_at,completedAt:t.completed_at,durationMs:t.duration_ms,firstTokenMs:t.first_token_ms,promptTokens:t.prompt_tokens,cachedPromptTokens:t.cached_prompt_tokens,uncachedPromptTokens:t.uncached_prompt_tokens,cacheWritePromptTokens:t.cache_write_prompt_tokens,cacheTelemetrySource:t.cache_telemetry_source,completionTokens:t.completion_tokens,totalTokens:t.total_tokens,errorType:t.error_type,errorMessage:t.error_message,attribution:JSON.parse(t.attribution_json)})}e(b,"modelUsageRecordFromRow");function k(t){return[t.id,t.requestId,t.requestOrdinal,t.sessionId,t.turnId,t.provider,t.model,t.route,t.source,t.requestKind,t.visibility,t.status,t.startedAt,t.completedAt,t.durationMs,t.firstTokenMs,t.promptTokens,t.cachedPromptTokens,t.uncachedPromptTokens,t.cacheWritePromptTokens,t.cacheTelemetrySource,t.completionTokens,t.totalTokens,t.errorType,t.errorMessage,JSON.stringify(t.attribution)]}e(k,"modelUsageRecordParams");function A(){return new Date().toISOString().replace(/\D/g,"").slice(0,14)}e(A,"timestampForPath");function f(t,r){return{...u(JSON.parse(t)),sequence:r}}e(f,"runtimeEventWithSequence");function T(t){return i({sessionId:t.session_id,eventCount:t.event_count,latestEventSequence:t.latest_event_sequence,latestEventAt:t.latest_event_at,latestTurnId:t.latest_turn_id,latestTurnStatus:t.latest_turn_status,pendingApprovalCount:t.pending_approval_count,updatedAt:t.updated_at})}e(T,"threadDetailProjectionFromRow");function i(t){return{sessionId:t.sessionId,eventCount:t.eventCount,latestEventSequence:t.latestEventSequence,latestEventAt:t.latestEventAt,latestTurnId:t.latestTurnId,latestTurnStatus:t.latestTurnStatus,pendingApprovalCount:t.pendingApprovalCount,updatedAt:t.updatedAt}}e(i,"threadDetailProjectionPayload");export{p as a,g as b,_ as c,m as d,R as e,S as f,h as g,y as h,b as i,k as j,A as k,f as l,T as m,i as n};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as z,b as B,c as x}from"./chunk-PF5R6CMP.js";import{a as M}from"./chunk-FEAKTSRS.js";import{x as N}from"./chunk-QOTVNQDI.js";import{n as _}from"./chunk-ACYFMLWG.js";import{l as A,m as S}from"./chunk-KGNCKIFP.js";import{b as I}from"./chunk-ES2ISFJC.js";import{a as u}from"./chunk-FTQLQJQV.js";import{createHash as U}from"node:crypto";function W(n){let p=n.replace(/^\/workspace\/outputs\//,"").replace(/^\/workspace\/work\/outputs\//,"").replace(/^outputs\//,"");if(!p||p.startsWith("/")||p.includes("\0")||p.split(/[\\/]/).some(y=>!y||y==="."||y===".."))throw new Error("Select one file inside this case's writable outputs.");return p}u(W,"confinedProfileOutputPath");var J=u(n=>`'${n.replaceAll("'","'\\''")}'`,"quote");async function D(n){let p=W(n.path),y="const f=require('fs'),p=require('path'),c=require('crypto'),a=JSON.parse(process.argv[1]),r=f.realpathSync('/workspace/work/outputs'),q=f.realpathSync(p.join(r,a.path));if(!q.startsWith(r+'/'))throw Error('Output path escapes the case');const s=f.statSync(q);if(!s.isFile()||s.size>10000000)throw Error('Output exceeds its bound');if(a.offset===undefined){const b=f.readFileSync(q);process.stdout.write(JSON.stringify({size:b.length,hash:c.createHash('sha256').update(b).digest('hex')}))}else{const h=f.openSync(q,'r'),b=Buffer.alloc(Math.min(524288,s.size-a.offset));try{const n=f.readSync(h,b,0,b.length,a.offset);process.stdout.write(b.subarray(0,n).toString('base64'))}finally{f.closeSync(h)}}";async function b(m){let h=await n.command(`/runtime/node -e ${J(y)} ${J(JSON.stringify({path:p,...m!==void 0?{offset:m}:{}}))}`);if(h.code!==0)throw new Error("The confined output could not be read.");return h.stdout}u(b,"read");let v=I.object({size:I.number().int().min(1).max(N),hash:I.string().regex(/^[a-f0-9]{64}$/)}).strict().parse(JSON.parse(await b())),H=[];for(let m=0;m<v.size;m+=524288){let h=await b(m);if(!/^[A-Za-z0-9+/]*={0,2}$/.test(h)||h.length>7e5)throw new Error("Output chunk exceeded its boundary.");let $=Buffer.from(h,"base64");if($.length!==Math.min(524288,v.size-m))throw new Error("The output changed during readback.");H.push($)}let T=Buffer.concat(H),k=U("sha256").update(T).digest("hex"),P=I.object({size:I.number(),hash:I.string()}).strict().parse(JSON.parse(await b()));if(k!==v.hash||P.hash!==k||P.size!==T.length)throw new Error("The output changed before immutable readback.");return{bytes:T,title:p.split("/").at(-1)}}u(D,"readConfinedProfileOutput");import f from"node:path";import{promises as w}from"node:fs";var E=u(n=>`'${n.replaceAll("'","'\\''")}'`,"quote");function le(n){let p=new Map,y=new AbortController,b=n.release,v=n.runtimeNode??"/runtime/node",H=n.runtimeAgentRoot??"/runtime/agent",T=new Set(b.harnessRelease.files.filter(e=>e.visibility!=="policy").map(e=>e.contentHash)),k,P=B({storeDir:n.storeDir,loadArchive:x({storeDir:n.storeDir})});async function m(e){y.signal.throwIfAborted(),await n.authorize({bindingHash:e.manifest.profileEvaluation.externalDatasetBinding?.contentHash??S(e.manifest.profileEvaluation),manifestHash:e.manifest.contentHash,taskId:e.taskId,seed:e.seed}),y.signal.throwIfAborted()}u(m,"fence");async function h(e,t){let i=p.get(e.id),l=i?.manifest.profileEvaluation;if(!i||!l||t.sessionId!==e.id||t.status!=="in_progress"||S(e.metadata?.profileEvaluationRun)!==S({id:i.manifest.id,contentHash:i.manifest.contentHash})||e.currentProfile?.profileId!==l.profileId||t.profileSnapshot?.sourceHash!==l.harnessRelease.contentHash||t.profileSnapshot.revision!==l.sourceRevision)throw new Error("The target tool has no actual admitted source/case/turn authority.");if(i.turnId&&i.turnId!==t.id)throw new Error("The target case already belongs to another turn.");i.turnId=t.id;let s=await n.getTurn(t.id);if(!s||s.sessionId!==e.id||s.status!=="in_progress"||S(s.profileSnapshot)!==S(t.profileSnapshot))throw new Error("The actual target turn is no longer admitted.");return await m(i),i}u(h,"authority");let $=M({authorize:u(async e=>{let t=p.get(e.sessionId);if(!t||t.turnId!==e.turnId||e.candidateId!==t.manifest.id||e.expectedRevision!==1)throw new Error("Target command changed its original admitted source.");return await h(await n.getSession(e.sessionId),await n.getTurn(e.turnId)),{candidateId:t.manifest.id,candidateRevision:1,ownerId:"host-profile-evaluation",sessionId:e.sessionId,turnId:e.turnId,sourceRoot:t.root,layout:"profile_case",writablePaths:["outputs"],...k?{runtimeMounts:[{source:k.source,destination:"/runtime/agent"},{source:f.join(k.source,"node_modules"),destination:"/workspace/node_modules"}]}:{}}},"authorize")});async function O(e,t,i,l,s,a){await m(e);let r=n.executeCommand?await n.executeCommand({sessionId:e.sessionId,turnId:t,sourceRoot:e.root,publicHashes:e.publicHashes,...k?{runtimeRoot:k.source}:{},command:i,cwd:s,stdin:a,timeoutMs:Math.min(e.manifest.limits.timeoutMs,18e4),signal:AbortSignal.any([l,y.signal])}):await $({candidateId:e.manifest.id,expectedRevision:1,sessionId:e.sessionId,turnId:t,command:i,cwd:s,stdin:a,signal:AbortSignal.any([l,y.signal]),maxOutputBytes:75e4,timeoutMs:Math.min(e.manifest.limits.timeoutMs,18e4)});if(await m(e),r.timedOut||r.stdoutTruncated||r.stderrTruncated)throw new Error("The target command exceeded its bounded execution or output.");return r}u(O,"command");async function L(e,t,i,l,s=[]){let a=t.profileEvaluation;if(!a||a.harnessRelease.contentHash!==b.harnessRelease.contentHash||t.population.filter(c=>c.taskId===i&&c.seed===l).length!==1||S(e.metadata?.profileEvaluationRun)!==S({id:t.id,contentHash:t.contentHash}))throw new Error("The target Session differs from its actual sealed source/case admission.");let r=f.join(n.storeDir,"evaluation-policy-cases",S([t.id,e.id])),o={},g={manifest:t,root:r,sessionId:e.id,taskId:i,seed:l,publicHashes:o};await m(g),await w.mkdir(r,{recursive:!0,mode:448});for(let c of b.harnessRelease.files){if(c.visibility!=="policy"||T.has(c.contentHash))continue;let d=f.join(b.bundlePath,"source",c.path),R=await w.realpath(d),K=await w.realpath(f.join(b.bundlePath,"source"));if(!R.startsWith(`${K}${f.sep}`)||(await w.lstat(d)).isSymbolicLink())throw new Error("Released policy source escaped its immutable closure.");let j=await w.readFile(R);if(j.length!==c.sizeBytes||A(j)!==c.contentHash)throw new Error("Released policy source changed before target admission.");let C=f.join(r,c.path);await w.mkdir(f.dirname(C),{recursive:!0,mode:448}),await w.writeFile(C,j,{flag:"wx",mode:256}),o[c.path]=c.contentHash}for(let c of new Set(Object.keys(o).filter(d=>d.startsWith("agents/")).map(d=>d.split("/")[1]))){let d=`agents/${c}`;o[`${d}/agent.ts`]&&!o[`${d}/openpond.yaml`]&&!o[`${d}/agent/agent.ts`]&&(await w.mkdir(f.join(r,d,"agent"),{recursive:!0,mode:448}),await w.rename(f.join(r,d,"agent.ts"),f.join(r,d,"agent","agent.ts")),o[`${d}/agent/agent.ts`]=o[`${d}/agent.ts`],delete o[`${d}/agent.ts`])}for(let c of s){if(c.mediaType!=="application/pdf"||!c.contentsBase64||c.name!==f.basename(c.name))throw new Error("The isolated case has an unsupported input attachment.");let d=Buffer.from(c.contentsBase64,"base64"),R=`inputs/${c.name}`;if(d.length!==c.sizeBytes||d.length>1e7||o[R])throw new Error("The isolated case input identity is invalid.");await w.mkdir(f.join(r,"inputs"),{recursive:!0,mode:448}),await w.writeFile(f.join(r,R),d,{flag:"wx",mode:256}),o[R]=A(d)}await w.mkdir(f.join(r,"outputs"),{mode:448}),await m(g),p.set(e.id,g)}u(L,"admitSession");let F=u(async e=>{let t=await h(e.session,e.turn),i=[],l=u((s,a,r,o)=>i.push({name:s,description:a,parameters:{type:"object",properties:r,additionalProperties:!1},execute:u(async g=>{if(await h(g.session,e.turn)!==t||g.turnId!==e.turn.id)throw new Error("Target tool changed its admitted case.");let d=await o(g.args,g.signal);return await h(g.session,e.turn),{toolCallId:g.callId,name:s,ok:!0,contentText:JSON.stringify(d),data:d}},"execute")}),"define");l("harness_inspect","Inspect this released policy source.",{},async()=>({release:{id:b.harnessRelease.id,contentHash:b.harnessRelease.contentHash},files:Object.entries(t.publicHashes).map(([s,a])=>({path:s,contentHash:a}))}));for(let s of["profile_skill_read","skill_inspect","context_read"])l(s,"Read an exact file from this policy source.",{name:{type:"string"},path:{type:"string"}},async a=>{let r=typeof a.path=="string"?a.path:typeof a.name=="string"?`skills/${a.name}/SKILL.md`:"";if(!t.publicHashes[r])throw new Error("This source file is outside the public policy closure.");let o=await O(t,e.turn.id,`${v} -e ${E("const f=require('fs'),p=process.argv[1],b=f.readFileSync(p);if(b.length>250000)throw Error('Policy source exceeds read bound');process.stdout.write(JSON.stringify({path:p,text:b.toString('utf8')}))")} ${E(`/workspace/work/${r}`)}`,e.signal);if(o.code!==0)throw new Error("The public target file could not be read.");return JSON.parse(o.stdout)});for(let s of["exec_command","work_exec"])l(s,"Run a command inside the policy source namespace and writable outputs.",{command:{type:"string"},cwd:{type:"string"}},async(a,r)=>{if(typeof a.command!="string")throw new Error("Select a target command.");let o=typeof a.cwd=="string"?a.cwd:t.root,g=o.startsWith("/workspace/work/")?f.join(t.root,o.slice(16)):o==="/workspace/work"?t.root:o;return O(t,e.turn.id,a.command,r,g)});l("work_save_output","Save a completed file from this case's outputs into durable output storage.",{path:{type:"string"},suggestedName:{type:"string"}},async(s,a)=>{if(typeof s.path!="string")throw new Error("Select a completed case output.");let r=n.readOutput?await n.readOutput({sessionId:e.session.id,turnId:e.turn.id,path:s.path,signal:a}):await D({path:s.path,command:u(g=>O(t,e.turn.id,g,a),"command")});await h(e.session,e.turn);let o=await n.saveOutput({session:e.session,sourceTurnId:e.turn.id,suggestedName:typeof s.suggestedName=="string"?s.suggestedName:r.title,bytes:r.bytes,validation:[],validationPolicy:"preserve"});return await h(e.session,e.turn),await n.recordOutput(e.session.id,e.turn.id,o),await h(e.session,e.turn),o});for(let s of["list_files","read_files","search_files"])l(s,"Inspect files within the public policy namespace.",{paths:{type:"array",items:{type:"string"}},path:{type:"string"},query:{type:"string"}},async(a,r)=>{let o=await O(t,e.turn.id,`${v} -e ${E(z)}`,r,void 0,JSON.stringify({action:s,args:a,writablePaths:["outputs"]}));if(o.code!==0)throw new Error("The confined target file operation failed.");return JSON.parse(o.stdout)});return i},"resolveTools");async function q(e){let t=await h(e.session,e.turn),i=e.action;if(!_(i.inputSchema,e.value).valid)throw new Error("The actual released Agent action input changed.");if(!Object.keys(t.publicHashes).some(o=>o.startsWith(`agents/${i.agentId}/`)))throw new Error("The Agent action has no public policy source closure.");await m(t),k??=await P(),await m(t);let l=f.join(t.root,"agents",i.agentId),s=`/workspace/work/outputs/${e.turn.id}`,a=["run",i.sourceActionId,"--cwd",`/workspace/work/agents/${i.agentId}`,"--input",JSON.stringify(e.value),"--out-dir",s],r=await O(t,e.turn.id,`${v} ${E(`${H}/${k.cliRelativePath}`)} ${a.map(E).join(" ")}`,e.signal,l);if(r.code!==0)throw new Error(`The confined released Agent action failed: ${r.stderr.slice(0,1e3)}`);return{output:r.stdout,agentSourcePath:`/workspace/work/agents/${i.agentId}`,runPath:s}}return u(q,"executeAction"),{admitSession:L,resolveTools:F,executeAction:q,ownsSession:u(e=>p.has(e),"ownsSession"),settleSession:u(async e=>{let t=p.get(e);try{t?.turnId&&await n.settleRemote?.(e,t.turnId)}finally{p.delete(e)}},"settleSession"),close:u(()=>{y.abort(new Error("Profile evaluation owner closed.")),p.clear()},"close")}}u(le,"createHostProfileEvaluationTools");export{W as a,le as b};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as ye,b as Ae,d as ge,e as L}from"./chunk-BFKYRQMA.js";import{a as D,b as Pe,c as we,d as Oe,e as xe}from"./chunk-DLVPSCTB.js";import{ba as he}from"./chunk-JIMU3KDA.js";import{d as N,e as B}from"./chunk-YR5ID2SS.js";import{H as ae,c as me,k as re}from"./chunk-JUJSA7KI.js";import{a}from"./chunk-FTQLQJQV.js";import{randomUUID as Ge}from"node:crypto";var De=new URL(B).hostname,be=new URL(N).hostname,$e=`${B}/opchat/v1`;function l(e){if(!e)return null;let n=e.trim();return n?n.replace(/\/+$/,""):null}a(l,"normalizeBaseUrl");function Y(e){let n=l(e);if(!n)return null;try{let o=new URL(n).hostname.toLowerCase();if(o===De)return B;if(o===be||o===`www.${be}`||o==="openpond.live"||o==="www.openpond.live")return B;if(o.startsWith("api."))return n}catch{return null}return null}a(Y,"mapUiBaseToApiBase");function Q(e,n){let t=l(process.env.OPENPOND_API_URL);if(t)return t;let o=l(e?.apiBaseUrl);if(o)return o;let r=l(n.apiBaseUrl);if(r)return r;let s=Y(process.env.OPENPOND_BASE_URL);return s||(Y(e?.baseUrl||n.baseUrl)??B)}a(Q,"resolvePublicApiBaseUrl");function X(e,n,t){return He(e,n,t)}a(X,"resolveHostedChatApiBaseUrl");function He(e,n,t){let o=typeof process<"u"?process.env:{};return J(o.OPENPOND_OPCHAT_API_URL)??J(e?.chatApiBaseUrl??n.chatApiBaseUrl)??J(o.OPENPOND_CHAT_API_URL)??Me(t)}a(He,"resolveOpChatApiBaseUrl");function J(e){let n=l(e);if(!n)return null;try{let t=new URL(n),o=t.pathname.split("/").filter(Boolean),r=o.findIndex(i=>i.toLowerCase()==="opchat");return r>=0?(t.pathname=`/${[...o.slice(0,r+1),"v1"].join("/")}`,t.search="",t.hash="",l(t.toString())??null):o.findIndex(i=>i.toLowerCase()==="v1")>=0?(t.pathname="/opchat/v1",t.search="",t.hash="",l(t.toString())??null):(t.pathname=`${t.pathname.replace(/\/+$/,"")}/opchat/v1`.replace(/\/{2,}/g,"/"),t.search="",t.hash="",l(t.toString())??null)}catch{return null}}a(J,"normalizeOpChatApiBaseUrl");function Me(e){return J(e)??$e}a(Me,"opChatBaseFromPublicApiBase");function $(e){return e?.trim()?e.trim():"production"}a($,"deriveEnvironment");function Z(e,n=process.env){let t=[e?.apiKey,e?.session?.token,e?.token,n.OPENPOND_API_KEY];for(let o of t){let r=typeof o=="string"?o.trim():"";if(r)return r}return null}a(Z,"accountToken");function P(e,n){return!!(e&&n&&e.toLowerCase()===n.toLowerCase())}a(P,"handleEquals");function b(e,n){return l(e)===l(n)}a(b,"baseUrlEquals");function q(e,n){return`${e?.trim().toLowerCase()||""}|${l(n)??"default"}`}a(q,"profileKey");function ee(e){return l(e?.baseUrl)}a(ee,"selectorBaseUrl");function _(e){let n=l(e.baseUrl);return n?{handle:e.handle,baseUrl:n}:{handle:e.handle}}a(_,"selectorFromAccount");function A(e){let n=typeof e?.handle=="string"?e.handle.trim():"";if(!n)return null;let t=l(e?.baseUrl);return t?{handle:n,baseUrl:t}:{handle:n}}a(A,"normalizeActiveProfile");function U(e,n){if(!P(e.handle,n.handle))return!1;let t=ee(n);return t?b(e.baseUrl,t):!l(e.baseUrl)}a(U,"accountMatchesSelector");function se(e,n){if(!P(e.handle,n.handle))return!1;let t=ee(n);return t?b(e.baseUrl,t):!l(e.baseUrl)}a(se,"profileMatchesSelector");function Ue(e,n,t){let o=Array.isArray(e.accounts)?e.accounts:[],r=n||process.env.OPENPOND_ACCOUNT?A({handle:n||process.env.OPENPOND_ACCOUNT||"",baseUrl:t??process.env.OPENPOND_BASE_URL??null}):A(e.activeProfile);if(r){let s=o.find(c=>U(c,r));if(s)return s;let i=o.filter(c=>P(c.handle,r.handle));return i.length===1?i[0]??null:null}return o[0]?o[0]:null}a(Ue,"findActiveAccount");function ke(e){let n=Array.isArray(e.accounts)?e.accounts:[],t=A(e.activeProfile)??(n[0]?_(n[0]):null);return ie(n.map(o=>({handle:o.handle,baseUrl:l(o.baseUrl),apiBaseUrl:l(o.apiBaseUrl),chatApiBaseUrl:l(o.chatApiBaseUrl),environment:$(o.environment),isActive:t?U(o,t):!1,hasApiKey:!!o.apiKey?.trim(),hasSessionToken:!!(o.session?.token?.trim()||o.token?.trim()),sessionAppId:o.session?.appId??null,sessionConversationId:o.session?.conversationId??null})))}a(ke,"fallbackProfilesFromConfig");function ie(e){let n=new Map;for(let t of e){let o=l(t.baseUrl),r=`${t.handle.toLowerCase()}|${o??"default"}`,s={...t,baseUrl:o,apiBaseUrl:l(t.apiBaseUrl),chatApiBaseUrl:l(t.chatApiBaseUrl),environment:$(t.environment),isActive:t.isActive},i=n.get(r);(!i||s.isActive&&!i.isActive||s.hasApiKey&&!i.hasApiKey)&&n.set(r,s)}return Array.from(n.values())}a(ie,"normalizeProfiles");function Be(e){return e.hasApiKey||e.hasSessionToken?"signed_in":"signed_out"}a(Be,"profileAuthHealth");function ze(e,n){return e?{reachable:e.reachable,authenticated:e.authenticated,apiBase:e.apiBase||n,latencyMs:e.latencyMs,status:e.status,service:e.service,checkedAt:e.checkedAt,error:e.error??null}:null}a(ze,"normalizeHealth");function Ee(e){let n=e?.account;return n?{id:n.id??null,email:n.email??null,name:n.name??null,handle:n.handle??null,image:n.image??null,timezone:n.timezone??null,isAdmin:n.isAdmin??null,isVerified:n.isVerified??null,dailyAgentAppId:n.dailyAgentAppId??null,dailyAgentDeploymentId:n.dailyAgentDeploymentId??null,credits:n.credits??null}:null}a(Ee,"normalizeProfile");function Fe(e){return(e??[]).map(n=>({...n,id:n.id||n.userProductId||n.openPondProductId||n.name,name:n.name,type:n.type,status:n.status,isActive:n.isActive??null,price:n.price??null,currency:n.currency??null,credits:n.credits??null}))}a(Fe,"normalizeProducts");function je(e){return e.handle.trim().toLowerCase()==="default"&&!l(e.baseUrl)&&!e.hasApiKey&&!e.hasSessionToken}a(je,"isEmptyDefaultProfile");function Ke(e){let n=e?.trim();return n?n.length>=12?`\u2022\u2022\u2022\u2022\u2022\u2022${n.slice(-6)}`:"\u2022\u2022\u2022\u2022\u2022\u2022":null}a(Ke,"apiKeyHint");function qe(e){return e?.auth?.authType!=="openpond-api-key"||!e.auth.keyAccess?null:{ownerType:e.auth.keyAccess.ownerType,teamId:e.auth.keyAccess.teamId,scopes:e.auth.scopes}}a(qe,"apiKeyAccess");function H(e){let{config:n,profiles:t,account:o,token:r,apiBaseUrl:s,accountResponse:i,accountProfiles:c,health:m,authFailed:g,error:f}=e,w=X(o,n,s),h=Ee(i??null),C=A(n.activeProfile),v=(o?_(o):null)??C,O=h?.handle||o?.handle||v?.handle||null,I=(v?t.find(p=>se(p,v)):null)??t.find(p=>p.isActive)??null,y=g?"auth_error":r?"signed_in":"signed_out",d=h?.name||h?.handle||h?.email||O||"Signed out",R=l(I?.baseUrl||o?.baseUrl||N),k=$(I?.environment||o?.environment),x=A(v)??(O?A({handle:O,baseUrl:I?.baseUrl??o?.baseUrl}):null),j=(t.length>0?t:O?[{handle:O,baseUrl:ee(x)??l(o?.baseUrl),apiBaseUrl:s,chatApiBaseUrl:w,environment:k,isActive:!0,hasApiKey:!!r,hasSessionToken:!1,sessionAppId:null,sessionConversationId:null}]:[]).filter(p=>!je(p));return{state:y,activeProfile:x,label:d,email:h?.email??null,avatarUrl:h?.image??null,environment:k,baseUrl:R,apiBaseUrl:s,chatApiBaseUrl:w,creditsLabel:h?.credits??null,profile:h,products:Fe(i?.products),apiHealth:ze(m??null,s),accounts:j.map(p=>{let T=l(p.baseUrl),Le=n.accounts?.find(fe=>P(fe.handle,p.handle)&&b(fe.baseUrl,T)),oe=c?.[q(p.handle,T)]??null,K=Ee(oe?.response??null);return{handle:p.handle,baseUrl:T,apiBaseUrl:l(p.apiBaseUrl),chatApiBaseUrl:l(p.chatApiBaseUrl),environment:$(p.environment),isActive:x?se(p,x):!1,authHealth:oe?.authFailed?"auth_error":Be(p),displayLabel:K?.name||K?.handle||K?.email||p.handle,email:K?.email??null,avatarUrl:K?.image??null,apiKeyHint:Ke(Le?.apiKey),apiKeyAccess:qe(oe?.response??null)}}),error:f??m?.error??null}}a(H,"toAccountState");async function We(e){try{return ie(await we())}catch{return ke(e)}}a(We,"loadProfiles");async function u(e,n){let t=await Pe(),o=await We(t),r=Ue(t,e,n),s=Z(r),i=Q(r,t),c=X(r,t,i);return{config:t,profiles:o,account:r,token:s,apiBaseUrl:i,chatApiBaseUrl:c,accountState:H({config:t,profiles:o,account:r,token:s,apiBaseUrl:i})}}a(u,"loadOpenPondAccountContext");async function Ve(e){let n=l(e.baseUrl);return await Oe(e.handle,{baseUrl:n}),u(e.handle,n)}a(Ve,"switchOpenPondAccount");function M(e){return e instanceof Error?e.message:String(e)}a(M,"errorMessage");var Je=15e3;function Ye(e){return e===ae?"OpenPond Chat":e==="deepseek-v4-flash"?"DeepSeek V4 Flash":e.replace(/[-_/]+/g," ")}a(Ye,"displayNameForHostedModel");function Qe(e){let n=typeof e.id=="string"?e.id:null;return n?{id:n,displayName:Ye(n),ownedBy:typeof e.owned_by=="string"?e.owned_by:null,streaming:!0,raw:e}:null}a(Qe,"normalizeHostedModel");async function Xe(){let e=await u();if(!e.token)return{models:[],error:"No OpenPond API key or session token is configured."};try{return{models:(await nn({apiBaseUrl:e.chatApiBaseUrl,token:e.token})).data.map(o=>Qe(o)).filter(o=>!!o),error:null}}catch(n){return{models:[],error:M(n)}}}a(Xe,"loadOpenPondHostedModels");async function Ze(){let e=await u();if(!e.token)return{catalog:null,error:"No OpenPond API key or session token is configured."};let n=new AbortController,t=setTimeout(()=>{n.abort(new Error("OpenPond provider catalog request timed out."))},Je);try{return{catalog:await Se({apiBaseUrl:e.chatApiBaseUrl,token:e.token,signal:n.signal}),error:null}}catch(o){return{catalog:null,error:M(o)}}finally{clearTimeout(t)}}a(Ze,"loadOpenPondProviderCatalog");async function*en(e){let n=await u();if(!n.token)throw new Error("OpenPond is signed out. Add an account in Settings before using OpenPond Chat.");yield*Ce({apiBaseUrl:n.chatApiBaseUrl,token:n.token,model:e.model||ae,messages:e.messages,tools:e.tools,toolChoice:e.toolChoice,requestId:e.requestId,reasoningEffort:e.reasoningEffort,maxTokens:e.maxTokens,temperature:e.temperature,topP:e.topP,signal:e.signal})}a(en,"streamOpenPondHostedChatTurn");async function nn(e){let n=le(e.apiBaseUrl,"models"),t=await fetch(n,{method:"GET",headers:ce(e.token,"application/json"),signal:e.signal});if(!t.ok)throw new Error(`OpenPond OpChat model list failed: ${t.status} ${await ue(t)}`);return await t.json()}a(nn,"listOpChatModels");async function Se(e){let n=le(e.apiBaseUrl,"provider-catalog"),t=await fetch(n,{method:"GET",headers:ce(e.token,"application/json"),signal:e.signal});if(!t.ok)throw new Error(`OpenPond OpChat provider catalog failed: ${t.status} ${await ue(t)}`);let o=await t.json();return!o||typeof o!="object"||!Array.isArray(o.providers)?re.parse(o):re.parse({...o,providers:o.providers.filter(r=>r!==null&&typeof r=="object"&&me.safeParse(r.id).success)})}a(Se,"listOpChatProviderCatalog");async function*Ce(e){let n=le(e.apiBaseUrl,"chat/completions"),t=await fetch(n,{method:"POST",headers:ce(e.token,"text/event-stream",e.requestId),body:JSON.stringify(ln(e,!0)),signal:e.signal});if(!t.ok)throw new Error(`OpenPond OpChat request failed: ${t.status} ${await ue(t)}`);if(!t.body)throw new Error("OpenPond OpChat request failed: streaming response body is missing.");let o=new Map,r=!1,s=null,i={},c="",m=null,g=tn(t.headers),f=t.body.getReader(),w=new TextDecoder,h="",C=[],te=a(()=>{if(C.length===0)return[];let y=C.join(`
2
+ import{a as he,b as ye,d as Ae,e as L}from"./chunk-BFKYRQMA.js";import{a as D,b as ge,c as Pe,d as we,e as Oe}from"./chunk-6QSSIT62.js";import{j as xe}from"./chunk-3QIB5FXI.js";import{d as N,e as B}from"./chunk-YR5ID2SS.js";import{E as ae,h as re}from"./chunk-Z4Z5UOZM.js";import{d as me}from"./chunk-FFRFSDBM.js";import{a}from"./chunk-FTQLQJQV.js";var De=new URL(B).hostname,be=new URL(N).hostname,$e=`${B}/opchat/v1`;function l(e){if(!e)return null;let n=e.trim();return n?n.replace(/\/+$/,""):null}a(l,"normalizeBaseUrl");function Y(e){let n=l(e);if(!n)return null;try{let o=new URL(n).hostname.toLowerCase();if(o===De)return B;if(o===be||o===`www.${be}`||o==="openpond.live"||o==="www.openpond.live")return B;if(o.startsWith("api."))return n}catch{return null}return null}a(Y,"mapUiBaseToApiBase");function Q(e,n){let t=l(process.env.OPENPOND_API_URL);if(t)return t;let o=l(e?.apiBaseUrl);if(o)return o;let r=l(n.apiBaseUrl);if(r)return r;let s=Y(process.env.OPENPOND_BASE_URL);return s||(Y(e?.baseUrl||n.baseUrl)??B)}a(Q,"resolvePublicApiBaseUrl");function X(e,n,t){return He(e,n,t)}a(X,"resolveHostedChatApiBaseUrl");function He(e,n,t){let o=typeof process<"u"?process.env:{};return J(o.OPENPOND_OPCHAT_API_URL)??J(e?.chatApiBaseUrl??n.chatApiBaseUrl)??J(o.OPENPOND_CHAT_API_URL)??Me(t)}a(He,"resolveOpChatApiBaseUrl");function J(e){let n=l(e);if(!n)return null;try{let t=new URL(n),o=t.pathname.split("/").filter(Boolean),r=o.findIndex(i=>i.toLowerCase()==="opchat");return r>=0?(t.pathname=`/${[...o.slice(0,r+1),"v1"].join("/")}`,t.search="",t.hash="",l(t.toString())??null):o.findIndex(i=>i.toLowerCase()==="v1")>=0?(t.pathname="/opchat/v1",t.search="",t.hash="",l(t.toString())??null):(t.pathname=`${t.pathname.replace(/\/+$/,"")}/opchat/v1`.replace(/\/{2,}/g,"/"),t.search="",t.hash="",l(t.toString())??null)}catch{return null}}a(J,"normalizeOpChatApiBaseUrl");function Me(e){return J(e)??$e}a(Me,"opChatBaseFromPublicApiBase");function $(e){return e?.trim()?e.trim():"production"}a($,"deriveEnvironment");function Z(e,n=process.env){let t=[e?.apiKey,e?.session?.token,e?.token,n.OPENPOND_API_KEY];for(let o of t){let r=typeof o=="string"?o.trim():"";if(r)return r}return null}a(Z,"accountToken");function P(e,n){return!!(e&&n&&e.toLowerCase()===n.toLowerCase())}a(P,"handleEquals");function b(e,n){return l(e)===l(n)}a(b,"baseUrlEquals");function q(e,n){return`${e?.trim().toLowerCase()||""}|${l(n)??"default"}`}a(q,"profileKey");function ee(e){return l(e?.baseUrl)}a(ee,"selectorBaseUrl");function _(e){let n=l(e.baseUrl);return n?{handle:e.handle,baseUrl:n}:{handle:e.handle}}a(_,"selectorFromAccount");function A(e){let n=typeof e?.handle=="string"?e.handle.trim():"";if(!n)return null;let t=l(e?.baseUrl);return t?{handle:n,baseUrl:t}:{handle:n}}a(A,"normalizeActiveProfile");function U(e,n){if(!P(e.handle,n.handle))return!1;let t=ee(n);return t?b(e.baseUrl,t):!l(e.baseUrl)}a(U,"accountMatchesSelector");function se(e,n){if(!P(e.handle,n.handle))return!1;let t=ee(n);return t?b(e.baseUrl,t):!l(e.baseUrl)}a(se,"profileMatchesSelector");function Ue(e,n,t){let o=Array.isArray(e.accounts)?e.accounts:[],r=n||process.env.OPENPOND_ACCOUNT?A({handle:n||process.env.OPENPOND_ACCOUNT||"",baseUrl:t??process.env.OPENPOND_BASE_URL??null}):A(e.activeProfile);if(r){let s=o.find(c=>U(c,r));if(s)return s;let i=o.filter(c=>P(c.handle,r.handle));return i.length===1?i[0]??null:null}return o[0]?o[0]:null}a(Ue,"findActiveAccount");function ke(e){let n=Array.isArray(e.accounts)?e.accounts:[],t=A(e.activeProfile)??(n[0]?_(n[0]):null);return ie(n.map(o=>({handle:o.handle,baseUrl:l(o.baseUrl),apiBaseUrl:l(o.apiBaseUrl),chatApiBaseUrl:l(o.chatApiBaseUrl),environment:$(o.environment),isActive:t?U(o,t):!1,hasApiKey:!!o.apiKey?.trim(),hasSessionToken:!!(o.session?.token?.trim()||o.token?.trim()),sessionAppId:o.session?.appId??null,sessionConversationId:o.session?.conversationId??null})))}a(ke,"fallbackProfilesFromConfig");function ie(e){let n=new Map;for(let t of e){let o=l(t.baseUrl),r=`${t.handle.toLowerCase()}|${o??"default"}`,s={...t,baseUrl:o,apiBaseUrl:l(t.apiBaseUrl),chatApiBaseUrl:l(t.chatApiBaseUrl),environment:$(t.environment),isActive:t.isActive},i=n.get(r);(!i||s.isActive&&!i.isActive||s.hasApiKey&&!i.hasApiKey)&&n.set(r,s)}return Array.from(n.values())}a(ie,"normalizeProfiles");function Be(e){return e.hasApiKey||e.hasSessionToken?"signed_in":"signed_out"}a(Be,"profileAuthHealth");function ze(e,n){return e?{reachable:e.reachable,authenticated:e.authenticated,apiBase:e.apiBase||n,latencyMs:e.latencyMs,status:e.status,service:e.service,checkedAt:e.checkedAt,error:e.error??null}:null}a(ze,"normalizeHealth");function Ee(e){let n=e?.account;return n?{id:n.id??null,email:n.email??null,name:n.name??null,handle:n.handle??null,image:n.image??null,timezone:n.timezone??null,isAdmin:n.isAdmin??null,isVerified:n.isVerified??null,dailyAgentAppId:n.dailyAgentAppId??null,dailyAgentDeploymentId:n.dailyAgentDeploymentId??null,credits:n.credits??null}:null}a(Ee,"normalizeProfile");function Fe(e){return(e??[]).map(n=>({...n,id:n.id||n.userProductId||n.openPondProductId||n.name,name:n.name,type:n.type,status:n.status,isActive:n.isActive??null,price:n.price??null,currency:n.currency??null,credits:n.credits??null}))}a(Fe,"normalizeProducts");function je(e){return e.handle.trim().toLowerCase()==="default"&&!l(e.baseUrl)&&!e.hasApiKey&&!e.hasSessionToken}a(je,"isEmptyDefaultProfile");function Ke(e){let n=e?.trim();return n?n.length>=12?`\u2022\u2022\u2022\u2022\u2022\u2022${n.slice(-6)}`:"\u2022\u2022\u2022\u2022\u2022\u2022":null}a(Ke,"apiKeyHint");function qe(e){return e?.auth?.authType!=="openpond-api-key"||!e.auth.keyAccess?null:{ownerType:e.auth.keyAccess.ownerType,teamId:e.auth.keyAccess.teamId,scopes:e.auth.scopes}}a(qe,"apiKeyAccess");function H(e){let{config:n,profiles:t,account:o,token:r,apiBaseUrl:s,accountResponse:i,accountProfiles:c,health:m,authFailed:g,error:f}=e,w=X(o,n,s),h=Ee(i??null),C=A(n.activeProfile),v=(o?_(o):null)??C,O=h?.handle||o?.handle||v?.handle||null,I=(v?t.find(p=>se(p,v)):null)??t.find(p=>p.isActive)??null,y=g?"auth_error":r?"signed_in":"signed_out",d=h?.name||h?.handle||h?.email||O||"Signed out",R=l(I?.baseUrl||o?.baseUrl||N),k=$(I?.environment||o?.environment),x=A(v)??(O?A({handle:O,baseUrl:I?.baseUrl??o?.baseUrl}):null),j=(t.length>0?t:O?[{handle:O,baseUrl:ee(x)??l(o?.baseUrl),apiBaseUrl:s,chatApiBaseUrl:w,environment:k,isActive:!0,hasApiKey:!!r,hasSessionToken:!1,sessionAppId:null,sessionConversationId:null}]:[]).filter(p=>!je(p));return{state:y,activeProfile:x,label:d,email:h?.email??null,avatarUrl:h?.image??null,environment:k,baseUrl:R,apiBaseUrl:s,chatApiBaseUrl:w,creditsLabel:h?.credits??null,profile:h,products:Fe(i?.products),apiHealth:ze(m??null,s),accounts:j.map(p=>{let T=l(p.baseUrl),Le=n.accounts?.find(fe=>P(fe.handle,p.handle)&&b(fe.baseUrl,T)),oe=c?.[q(p.handle,T)]??null,K=Ee(oe?.response??null);return{handle:p.handle,baseUrl:T,apiBaseUrl:l(p.apiBaseUrl),chatApiBaseUrl:l(p.chatApiBaseUrl),environment:$(p.environment),isActive:x?se(p,x):!1,authHealth:oe?.authFailed?"auth_error":Be(p),displayLabel:K?.name||K?.handle||K?.email||p.handle,email:K?.email??null,avatarUrl:K?.image??null,apiKeyHint:Ke(Le?.apiKey),apiKeyAccess:qe(oe?.response??null)}}),error:f??m?.error??null}}a(H,"toAccountState");async function We(e){try{return ie(await Pe())}catch{return ke(e)}}a(We,"loadProfiles");async function u(e,n){let t=await ge(),o=await We(t),r=Ue(t,e,n),s=Z(r),i=Q(r,t),c=X(r,t,i);return{config:t,profiles:o,account:r,token:s,apiBaseUrl:i,chatApiBaseUrl:c,accountState:H({config:t,profiles:o,account:r,token:s,apiBaseUrl:i})}}a(u,"loadOpenPondAccountContext");async function Ve(e){let n=l(e.baseUrl);return await we(e.handle,{baseUrl:n}),u(e.handle,n)}a(Ve,"switchOpenPondAccount");import{randomUUID as Ge}from"node:crypto";function M(e){return e instanceof Error?e.message:String(e)}a(M,"errorMessage");var Je=15e3;function Ye(e){return e===ae?"OpenPond Chat":e==="deepseek-v4-flash"?"DeepSeek V4 Flash":e.replace(/[-_/]+/g," ")}a(Ye,"displayNameForHostedModel");function Qe(e){let n=typeof e.id=="string"?e.id:null;return n?{id:n,displayName:Ye(n),ownedBy:typeof e.owned_by=="string"?e.owned_by:null,streaming:!0,raw:e}:null}a(Qe,"normalizeHostedModel");async function Xe(){let e=await u();if(!e.token)return{models:[],error:"No OpenPond API key or session token is configured."};try{return{models:(await nn({apiBaseUrl:e.chatApiBaseUrl,token:e.token})).data.map(o=>Qe(o)).filter(o=>!!o),error:null}}catch(n){return{models:[],error:M(n)}}}a(Xe,"loadOpenPondHostedModels");async function Ze(){let e=await u();if(!e.token)return{catalog:null,error:"No OpenPond API key or session token is configured."};let n=new AbortController,t=setTimeout(()=>{n.abort(new Error("OpenPond provider catalog request timed out."))},Je);try{return{catalog:await Se({apiBaseUrl:e.chatApiBaseUrl,token:e.token,signal:n.signal}),error:null}}catch(o){return{catalog:null,error:M(o)}}finally{clearTimeout(t)}}a(Ze,"loadOpenPondProviderCatalog");async function*en(e){let n=await u();if(!n.token)throw new Error("OpenPond is signed out. Add an account in Settings before using OpenPond Chat.");yield*Ce({apiBaseUrl:n.chatApiBaseUrl,token:n.token,model:e.model||ae,messages:e.messages,tools:e.tools,toolChoice:e.toolChoice,requestId:e.requestId,reasoningEffort:e.reasoningEffort,maxTokens:e.maxTokens,temperature:e.temperature,topP:e.topP,signal:e.signal})}a(en,"streamOpenPondHostedChatTurn");async function nn(e){let n=le(e.apiBaseUrl,"models"),t=await fetch(n,{method:"GET",headers:ce(e.token,"application/json"),signal:e.signal});if(!t.ok)throw new Error(`OpenPond OpChat model list failed: ${t.status} ${await ue(t)}`);return await t.json()}a(nn,"listOpChatModels");async function Se(e){let n=le(e.apiBaseUrl,"provider-catalog"),t=await fetch(n,{method:"GET",headers:ce(e.token,"application/json"),signal:e.signal});if(!t.ok)throw new Error(`OpenPond OpChat provider catalog failed: ${t.status} ${await ue(t)}`);let o=await t.json();return!o||typeof o!="object"||!Array.isArray(o.providers)?re.parse(o):re.parse({...o,providers:o.providers.filter(r=>r!==null&&typeof r=="object"&&me.safeParse(r.id).success)})}a(Se,"listOpChatProviderCatalog");async function*Ce(e){let n=le(e.apiBaseUrl,"chat/completions"),t=await fetch(n,{method:"POST",headers:ce(e.token,"text/event-stream",e.requestId),body:JSON.stringify(ln(e,!0)),signal:e.signal});if(!t.ok)throw new Error(`OpenPond OpChat request failed: ${t.status} ${await ue(t)}`);if(!t.body)throw new Error("OpenPond OpChat request failed: streaming response body is missing.");let o=new Map,r=!1,s=null,i={},c="",m=null,g=tn(t.headers),f=t.body.getReader(),w=new TextDecoder,h="",C=[],te=a(()=>{if(C.length===0)return[];let y=C.join(`
3
3
  `);if(C=[],y==="[DONE]")return r=!0,[];let d;try{d=JSON.parse(y)}catch{throw new Error("OpenPond OpChat request failed: malformed streaming event.")}if(d&&typeof d=="object"&&"error"in d)throw new Error(`OpenPond OpChat request failed: ${Ie(d)}`);i=d;let R=d&&typeof d=="object"?d:{},k=Array.isArray(R.choices)?R.choices:[],x=k[0]&&typeof k[0]=="object"?k[0]:{},G=x.delta&&typeof x.delta=="object"?x.delta:{},j=[],p=_e(G.reasoning_content);p&&(c+=p,j.push({type:"reasoning_delta",text:p,raw:d}));let T=_e(G.content);return T&&j.push({type:"text_delta",text:T,raw:d}),an(o,G.tool_calls),s=z(x.finish_reason)??s,m=dn(d)??m,j},"consumeEvent"),v=a(y=>{let d=y.endsWith("\r")?y.slice(0,-1):y;return d?d.startsWith(":")?[]:(d.startsWith("data:")&&C.push(d.slice(5).trimStart()),[]):te()},"consumeLine");try{for(;;){let y=await f.read();if(y.done)break;h+=w.decode(y.value,{stream:!0});let d=h.split(`
4
- `);h=d.pop()??"";for(let R of d)for(let k of v(R))yield k}if(h+=w.decode(),h)for(let y of v(h))yield y;for(let y of te())yield y}finally{f.releaseLock()}if(!r)throw new Error("OpenPond OpChat request failed: stream ended before [DONE].");let O=sn(o);O.length>0&&(yield{type:"tool_call_delta",toolCalls:O,raw:i}),O.length>0&&c&&(yield{type:"continuation",continuation:{kind:"chat_completions_reasoning",reasoningContent:c},raw:i});let I=on(m,g);I&&(yield{type:"usage",usage:I,raw:i}),yield{type:"finish",finishReason:s,raw:i}}a(Ce,"streamOpChatChatCompletion");function tn(e){let n=ve(e,["fireworks-prompt-tokens","prompt-tokens"]),t=ve(e,["fireworks-cached-prompt-tokens","cached-prompt-tokens"]);return t===null?null:{...n===null?{}:{prompt_tokens:n},cached_input_tokens:t,cache_telemetry_source:"provider_response_headers"}}a(tn,"cacheUsageFromResponseHeaders");function ve(e,n){for(let t of n){let o=e.get(t);if(o===null||!/^\d+$/.test(o.trim()))continue;let r=Number(o);if(Number.isSafeInteger(r)&&r>=0)return r}return null}a(ve,"firstHeaderTokenCount");function on(e,n){if(!n||rn(e))return e;let t={...e??{},cached_input_tokens:n.cached_input_tokens,cache_telemetry_source:"provider_response_headers"};return E(e?.prompt_tokens)===null&&n.prompt_tokens!==void 0&&(t.prompt_tokens=n.prompt_tokens),t}a(on,"usageWithResponseHeaderCache");function rn(e){return e?E(e.cached_input_tokens)!==null||E(e.cache_read_input_tokens)!==null||E(e.cache_creation_input_tokens)!==null||E(e.prompt_cache_hit_tokens)!==null||E(e.prompt_cache_miss_tokens)!==null?!0:E(e.prompt_tokens_details?.cached_tokens)!==null||E(e.input_tokens_details?.cached_tokens)!==null:!1}a(rn,"usageHasCacheTelemetry");function E(e){if(typeof e=="number"&&Number.isSafeInteger(e)&&e>=0)return e;if(typeof e!="string"||!/^\d+$/.test(e.trim()))return null;let n=Number(e);return Number.isSafeInteger(n)?n:null}a(E,"usageTokenCount");function an(e,n){Array.isArray(n)&&n.forEach((t,o)=>{if(!t||typeof t!="object")return;let r=t,s=typeof r.index=="number"&&Number.isInteger(r.index)?r.index:o,i=e.get(s)??{arguments:""};typeof r.id=="string"&&(i.id=r.id);let c=r.function&&typeof r.function=="object"?r.function:{};typeof c.name=="string"&&(i.name=`${i.name??""}${c.name}`),typeof c.arguments=="string"&&(i.arguments+=c.arguments),e.set(s,i)})}a(an,"mergeOpChatToolCallDeltas");function sn(e){return[...e.entries()].sort(([n],[t])=>n-t).flatMap(([,n])=>n.id&&n.name?[{id:n.id,type:"function",function:{name:n.name,arguments:n.arguments}}]:[])}a(sn,"completedOpChatToolCalls");function ln(e,n){let t={model:e.model,messages:e.messages.map(un),stream:n};return e.tools&&(t.tools=e.tools),e.toolChoice!==void 0&&(t.tool_choice=e.toolChoice),typeof e.maxTokens=="number"&&(t.max_tokens=e.maxTokens),typeof e.temperature=="number"&&(t.temperature=e.temperature),typeof e.topP=="number"&&(t.top_p=e.topP),Object.assign(t,cn(e.reasoningEffort)),t}a(ln,"buildOpChatBody");function cn(e){return e?e==="off"?{thinking:{type:"disabled"}}:{thinking:{type:"enabled"},reasoning_effort:e}:{}}a(cn,"opChatReasoningFields");function un(e){let{continuation:n,images:t,...o}=e,r=t?.length?[...typeof e.content=="string"&&e.content.trim()?[{type:"text",text:e.content}]:[],...t.map(s=>({type:"image_url",image_url:{url:s.url,...s.detail?{detail:s.detail}:{}}}))]:e.content;return e.role==="assistant"&&n?.kind==="chat_completions_reasoning"?{...o,...r!==void 0?{content:r}:{},reasoning_content:n.reasoningContent}:{...o,...r!==void 0?{content:r}:{}}}a(un,"opChatMessage");function le(e,n){let t=e.trim().replace(/\/+$/,"");if(!t)throw new Error("OpenPond OpChat API base URL is required.");return`${t}/${n}`}a(le,"opChatEndpointUrl");function ce(e,n,t){let o=e.trim();if(!o)throw new Error("OpenPond API key is required for OpChat.");let r=new Headers;r.set("Authorization",`Bearer ${o}`),r.set("Content-Type","application/json"),r.set("Accept",n),r.set("x-openpond-client","openpond-app");let s=t||Ge();return r.set("x-openpond-request-id",s),r.set("x-request-id",s),r}a(ce,"opChatHeaders");async function ue(e){let n=await e.text().catch(()=>"");if(!n)return e.statusText||`HTTP ${e.status}`;try{return Ie(JSON.parse(n))}catch{return n}}a(ue,"readOpChatError");function Ie(e){if(!e||typeof e!="object")return String(e||"unknown_error");let n=e,t=n.error;if(t&&typeof t=="object"){let o=t;return[z(o.code),z(o.type),z(o.message)].filter(Boolean).join(": ")}return[z(n.error),z(n.message)].filter(Boolean).join(": ")||JSON.stringify(e)}a(Ie,"errorMessageFromPayload");function dn(e){if(!e||typeof e!="object")return null;let n=e.usage;return!n||typeof n!="object"?null:n}a(dn,"parseUsage");function z(e){return typeof e=="string"&&e.trim()?e:null}a(z,"stringValue");function _e(e){return typeof e=="string"&&e.length>0?e:null}a(_e,"streamTextValue");import{readFileSync as pn}from"node:fs";var W;function fn(){if(W!==void 0)return W??"openpond-code bundled";try{let e=new URL("../package.json",import.meta.resolve("openpond")),n=JSON.parse(pn(e,"utf8"));W=typeof n.version=="string"?`openpond-code@${n.version}`:null}catch{W=null}return W??"openpond-code bundled"}a(fn,"getBundledRuntimeVersion");import{spawn as mn}from"node:child_process";function Re(e,n=process.platform){return n==="darwin"?{command:"open",args:[e]}:n==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",e]}:{command:"xdg-open",args:[e]}}a(Re,"resolveSystemBrowserCommand");async function hn(e,n={}){let t=n.command??Re(e),o=n.handoffTimeoutMs??1500;return new Promise(r=>{let s=!1,i=null,c=a(g=>{s||(s=!0,i&&clearTimeout(i),r(g))},"finish"),m=mn(t.command,t.args,{detached:!1,shell:!1,stdio:"ignore",windowsHide:!0});m.once("error",g=>{let f=g.code;c({opened:!1,error:f?`browser launcher ${t.command} failed (${f})`:`browser launcher ${t.command} failed`})}),m.once("close",(g,f)=>{if(g===0){c({opened:!0});return}let w=f?`signal ${f}`:`code ${g??"unknown"}`;c({opened:!1,error:`browser launcher ${t.command} exited with ${w}`})}),i=setTimeout(()=>{m.unref(),c({opened:!0})},o),i.unref()})}a(hn,"openUrlWithSystemBrowser");import{createHash as yn}from"node:crypto";function de(e){return yn("sha256").update(JSON.stringify([e.accountState.activeProfile,e.apiBaseUrl,e.chatApiBaseUrl,e.token])).digest("hex")}a(de,"authorityKey");var V=null,F=null;async function An(e){let n=de(e);if(V?.key===n&&V.expiresAt>Date.now())return V.response;if(F?.key===n)return F.promise;V=null;let t={key:n,promise:L(e.apiBaseUrl,e.token)};F=t;try{let o=await t.promise;return F===t&&o.account?.id&&(V={key:n,response:o,expiresAt:Date.now()+5e3}),o}finally{F===t&&(F=null)}}a(An,"authenticate");async function gn(){let e=await u();if(!e.token)return e;let n=await An(e),t=await u();if(de(t)!==de(e))throw new Error("openpond_account_authority_changed");if(!n.account?.id)throw new Error("openpond_authenticated_owner_unavailable");return{...t,accountState:H({...t,accountResponse:n})}}a(gn,"loadAuthenticatedOpenPondAccountContext");function Pn(e){if(!e||typeof e!="object")return null;let n=e,t=typeof n.id=="string"?n.id:null,o=typeof n.name=="string"?n.name:t;if(!t||!o)return null;let r=n.latestDeployment&&typeof n.latestDeployment=="object"?n.latestDeployment:null,s=he.safeParse(n.sandboxActionRegistry);return{id:t,name:o,description:typeof n.description=="string"?n.description:null,visibility:typeof n.visibility=="string"?n.visibility:null,gitOwner:typeof n.gitOwner=="string"?n.gitOwner:null,gitRepo:typeof n.gitRepo=="string"?n.gitRepo:null,gitHost:typeof n.gitHost=="string"?n.gitHost:null,defaultBranch:typeof n.defaultBranch=="string"?n.defaultBranch:null,sandbox:n.sandbox===!0,sandboxActionRegistry:s.success?s.data:null,sandboxManifestHash:typeof n.sandboxManifestHash=="string"?n.sandboxManifestHash:null,sandboxManifestPath:typeof n.sandboxManifestPath=="string"?n.sandboxManifestPath:null,sandboxManifestSyncedAt:typeof n.sandboxManifestSyncedAt=="string"?n.sandboxManifestSyncedAt:n.sandboxManifestSyncedAt instanceof Date?n.sandboxManifestSyncedAt.toISOString():null,sandboxManifestError:typeof n.sandboxManifestError=="string"?n.sandboxManifestError:null,updatedAt:typeof n.updatedAt=="string"?n.updatedAt:null,latestDeployment:r?{id:typeof r.id=="string"?r.id:void 0,status:typeof r.status=="string"?r.status:void 0,deploymentDomain:typeof r.deploymentDomain=="string"?r.deploymentDomain:null,createdAt:typeof r.createdAt=="string"?r.createdAt:void 0,isProduction:typeof r.isProduction=="boolean"?r.isProduction:null,gitBranch:typeof r.gitBranch=="string"?r.gitBranch:null}:null,scheduleSummary:On(n.scheduleSummary)}}a(Pn,"normalizeApp");function S(e){return typeof e=="string"?e:e instanceof Date?e.toISOString():null}a(S,"normalizeDateString");function wn(e){if(!e||typeof e!="object")return null;let n=e,t=typeof n.id=="string"?n.id:null,o=typeof n.name=="string"?n.name:t,r=typeof n.deploymentId=="string"?n.deploymentId:null;return!t||!o||!r?null:{id:t,name:o,description:typeof n.description=="string"?n.description:null,scheduleType:typeof n.scheduleType=="string"?n.scheduleType:"cron",scheduleExpression:typeof n.scheduleExpression=="string"?n.scheduleExpression:"",enabled:!!n.enabled,rawEnabled:typeof n.rawEnabled=="boolean"?n.rawEnabled:void 0,syncStatus:typeof n.syncStatus=="string"?n.syncStatus:null,syncError:typeof n.syncError=="string"?n.syncError:null,startAt:S(n.startAt),endAt:S(n.endAt),maxRuns:typeof n.maxRuns=="number"?n.maxRuns:null,executionCount:typeof n.executionCount=="number"?n.executionCount:null,lifecycleStatus:typeof n.lifecycleStatus=="string"?n.lifecycleStatus:null,lifecycleReason:typeof n.lifecycleReason=="string"?n.lifecycleReason:null,lastExecutionAt:S(n.lastExecutionAt),lastExecutionStatus:typeof n.lastExecutionStatus=="string"?n.lastExecutionStatus:null,lastRunNowAt:S(n.lastRunNowAt),lastRunNowStatus:typeof n.lastRunNowStatus=="string"?n.lastRunNowStatus:null,updatedAt:S(n.updatedAt)??new Date().toISOString(),deploymentId:r,isProduction:typeof n.isProduction=="boolean"?n.isProduction:void 0,payload:n.payload}}a(wn,"normalizeSchedule");function On(e){if(!e||typeof e!="object")return null;let n=e,t=Array.isArray(n.schedules)?n.schedules.map(wn).filter(i=>!!i):[],o=typeof n.total=="number"?n.total:t.length,r=typeof n.active=="number"?n.active:t.filter(i=>i.enabled).length,s=typeof n.paused=="number"?n.paused:Math.max(0,o-r);return{total:o,active:r,paused:s,enabled:typeof n.enabled=="number"?n.enabled:r,disabled:typeof n.disabled=="number"?n.disabled:s,nextRunAt:S(n.nextRunAt),lastRunAt:S(n.lastRunAt),schedules:t,truncated:typeof n.truncated=="boolean"?n.truncated:void 0}}a(On,"normalizeScheduleSummary");async function xn(e){let n=Array.isArray(e.config.accounts)?e.config.accounts:[],t=await Promise.all(n.map(async o=>{let r=q(o.handle,o.baseUrl),s=Z(o);if(!s)return[r,{response:null,authFailed:!1,error:null}];try{return[r,{response:await L(Q(o,e.config),s),authFailed:!1,error:null}]}catch(i){return[r,{response:null,authFailed:!0,error:M(i)}]}}));return Object.fromEntries(t)}a(xn,"loadAccountProfileLookups");async function Te(e){let n=await xn(e),t=e.account?n[q(e.account.handle,e.account.baseUrl)]??null:null,o=t?.response??null,r=e.token&&t?.authFailed?t.error||"OpenPond account authentication failed.":null;return{account:H({...e,accountResponse:o,accountProfiles:n,authFailed:!!r,error:r})}}a(Te,"loadOpenPondAccountStateForContext");async function bn(){return Te(await u())}a(bn,"loadOpenPondAccountState");async function Ne(e={}){let n=await u(),t=Te(n);if(!n.token)return{...await t,apps:[],error:"No OpenPond API key or session token is configured."};let[o,r]=await Promise.allSettled([t,ye(n.apiBaseUrl,n.token,{handle:n.account?.handle,limit:e.limit??20,offset:e.offset??0,includeScheduled:e.includeScheduled??!0})]);if(o.status==="rejected")throw o.reason;return{account:o.value.account,apps:r.status==="fulfilled"?r.value.map(Pn).filter(s=>!!s):[],error:r.status==="rejected"?M(r.reason):null}}a(Ne,"loadOpenPondApps");async function Un(e){let n=await u();if(!n.token)throw new Error("No OpenPond API key or session token is configured.");return{account:n,response:await Ae(n.apiBaseUrl,n.token,e)}}a(Un,"createOpenPondRepoApp");import{createHash as kn}from"node:crypto";function Bn(e){return`account-${kn("sha256").update(e).digest("hex").slice(0,8)}`}a(Bn,"fallbackHandleForApiKey");function ne(e){let n=e?.trim();return n?n.replace(/^@/,""):null}a(ne,"normalizeDerivedHandle");async function En(e,n){let t=ne(e.handle);if(t)return t;try{let r=(await L(n,e.apiKey)).account,s=ne(r.handle)??ne(r.email?.split("@")[0])??ne(r.id);if(s)return s}catch{}return Bn(e.apiKey)}a(En,"deriveHandleForApiKey");async function vn(e){let n=e.baseUrl??N,t=l(e.apiBaseUrl)??Y(n)??B,o=l(e.chatApiBaseUrl),r=await En(e,t);return await xe({handle:r,apiKey:e.apiKey,baseUrl:n,apiBaseUrl:t,chatApiBaseUrl:o,environment:e.environment??"production",setActive:e.setActive}),u(r,n)}a(vn,"saveOpenPondAccount");function _n(e,n,t){let o=l(t),r=e.findIndex(i=>P(i.handle,n)&&b(i.baseUrl,o));if(r!==-1)return r;let s=e.map((i,c)=>({account:i,index:c})).filter(({account:i})=>P(i.handle,n));if(s.length===1)return s[0].index;if(s.length>1)throw new Error(`Multiple OpenPond accounts match ${n}; select one with its base URL.`);return-1}a(_n,"findAccountIndex");async function Sn(e){let n=e.handle.trim();if(!n)throw new Error("OpenPond account handle is required.");return await D(t=>{let o=(t.accounts??[]).map(m=>({...m})),r=_n(o,n,e.baseUrl);if(r===-1)throw new Error(`OpenPond account not found: ${n}`);let s=o[r],i=A(t.activeProfile),c=!!(i&&U(s,i));o.splice(r,1),t.accounts=o,(c||!i||!o.some(m=>U(m,i)))&&(o[0]?t.activeProfile=_(o[0]):delete t.activeProfile)}),u()}a(Sn,"removeOpenPondAccount");async function Cn(){let e;return await D(n=>{let t=A(n.activeProfile),o=(n.accounts??[]).map(s=>({...s})),r=t?o.findIndex(s=>U(s,t)):0;if(r<0||!o[r])throw new Error("No active OpenPond account to log out.");e={...o[r]},delete e.apiKey,delete e.session,o[r]=e,n.accounts=o}),u(e.handle,e.baseUrl)}a(Cn,"signOutOpenPondAccount");function In(e,n,t){let o=l(t),r=e.findIndex(i=>P(i.handle,n)&&b(i.baseUrl,o));if(r!==-1)return r;let s=e.map((i,c)=>({account:i,index:c})).filter(({account:i})=>P(i.handle,n));if(s.length===1)return s[0].index;if(s.length>1)throw new Error(`Multiple OpenPond accounts match ${n}; select one with its current base URL.`);return-1}a(In,"findAccountIndex");function pe(e,n,t){if(t===void 0)return;let o=l(t);if(o){e[n]=o;return}(t===null||t.trim()==="")&&delete e[n]}a(pe,"applyOptionalUrl");async function Rn(e){let n=e.handle.trim();if(!n)throw new Error("OpenPond account handle is required.");let t;return await D(o=>{let r=(o.accounts??[]).map(f=>({...f})),s=In(r,n,e.currentBaseUrl);if(s===-1)throw new Error(`OpenPond account not found: ${n}`);let i=r[s];if(t={...i},e.apiKey!==void 0){let f=e.apiKey.trim();if(!f)throw new Error("OpenPond API key cannot be empty.");t.apiKey=f,delete t.session,delete t.token}if(pe(t,"baseUrl",e.baseUrl),pe(t,"apiBaseUrl",e.apiBaseUrl),pe(t,"chatApiBaseUrl",e.chatApiBaseUrl),e.environment===null?delete t.environment:typeof e.environment=="string"&&e.environment.trim()&&(t.environment=e.environment.trim()),r.findIndex((f,w)=>w!==s&&P(f.handle,t.handle)&&b(f.baseUrl,t.baseUrl))!==-1)throw new Error("Another OpenPond account already uses that handle and base URL.");let m=A(o.activeProfile),g=!!(m&&U(i,m));r[s]=t,o.accounts=r,o.activeProfile=e.setActive||g?_(t):o.activeProfile}),u(t.handle,t.baseUrl)}a(Rn,"updateOpenPondAccountConfig");async function Tn(e){let n=await u();if(!n.token)throw new Error("OpenPond is signed out. Add an account before reading app config.");return ge(n.apiBaseUrl,n.token,e.appId)}a(Tn,"getOpenPondAppEnvironment");function Nn(e,n){let t="",o=a(r=>{r.startsWith(e)&&n(JSON.parse(r.slice(e.length)))},"processLine");return{push(r){for(t+=r;;){let s=Ln(t);if(s<0)return;let i=t.slice(0,s).replace(/\r$/,""),c=t[s]==="\r"&&t[s+1]===`
4
+ `);h=d.pop()??"";for(let R of d)for(let k of v(R))yield k}if(h+=w.decode(),h)for(let y of v(h))yield y;for(let y of te())yield y}finally{f.releaseLock()}if(!r)throw new Error("OpenPond OpChat request failed: stream ended before [DONE].");let O=sn(o);O.length>0&&(yield{type:"tool_call_delta",toolCalls:O,raw:i}),O.length>0&&c&&(yield{type:"continuation",continuation:{kind:"chat_completions_reasoning",reasoningContent:c},raw:i});let I=on(m,g);I&&(yield{type:"usage",usage:I,raw:i}),yield{type:"finish",finishReason:s,raw:i}}a(Ce,"streamOpChatChatCompletion");function tn(e){let n=ve(e,["fireworks-prompt-tokens","prompt-tokens"]),t=ve(e,["fireworks-cached-prompt-tokens","cached-prompt-tokens"]);return t===null?null:{...n===null?{}:{prompt_tokens:n},cached_input_tokens:t,cache_telemetry_source:"provider_response_headers"}}a(tn,"cacheUsageFromResponseHeaders");function ve(e,n){for(let t of n){let o=e.get(t);if(o===null||!/^\d+$/.test(o.trim()))continue;let r=Number(o);if(Number.isSafeInteger(r)&&r>=0)return r}return null}a(ve,"firstHeaderTokenCount");function on(e,n){if(!n||rn(e))return e;let t={...e??{},cached_input_tokens:n.cached_input_tokens,cache_telemetry_source:"provider_response_headers"};return E(e?.prompt_tokens)===null&&n.prompt_tokens!==void 0&&(t.prompt_tokens=n.prompt_tokens),t}a(on,"usageWithResponseHeaderCache");function rn(e){return e?E(e.cached_input_tokens)!==null||E(e.cache_read_input_tokens)!==null||E(e.cache_creation_input_tokens)!==null||E(e.prompt_cache_hit_tokens)!==null||E(e.prompt_cache_miss_tokens)!==null?!0:E(e.prompt_tokens_details?.cached_tokens)!==null||E(e.input_tokens_details?.cached_tokens)!==null:!1}a(rn,"usageHasCacheTelemetry");function E(e){if(typeof e=="number"&&Number.isSafeInteger(e)&&e>=0)return e;if(typeof e!="string"||!/^\d+$/.test(e.trim()))return null;let n=Number(e);return Number.isSafeInteger(n)?n:null}a(E,"usageTokenCount");function an(e,n){Array.isArray(n)&&n.forEach((t,o)=>{if(!t||typeof t!="object")return;let r=t,s=typeof r.index=="number"&&Number.isInteger(r.index)?r.index:o,i=e.get(s)??{arguments:""};typeof r.id=="string"&&(i.id=r.id);let c=r.function&&typeof r.function=="object"?r.function:{};typeof c.name=="string"&&(i.name=`${i.name??""}${c.name}`),typeof c.arguments=="string"&&(i.arguments+=c.arguments),e.set(s,i)})}a(an,"mergeOpChatToolCallDeltas");function sn(e){return[...e.entries()].sort(([n],[t])=>n-t).flatMap(([,n])=>n.id&&n.name?[{id:n.id,type:"function",function:{name:n.name,arguments:n.arguments}}]:[])}a(sn,"completedOpChatToolCalls");function ln(e,n){let t={model:e.model,messages:e.messages.map(un),stream:n};return e.tools&&(t.tools=e.tools),e.toolChoice!==void 0&&(t.tool_choice=e.toolChoice),typeof e.maxTokens=="number"&&(t.max_tokens=e.maxTokens),typeof e.temperature=="number"&&(t.temperature=e.temperature),typeof e.topP=="number"&&(t.top_p=e.topP),Object.assign(t,cn(e.reasoningEffort)),t}a(ln,"buildOpChatBody");function cn(e){return e?e==="off"?{thinking:{type:"disabled"}}:{thinking:{type:"enabled"},reasoning_effort:e}:{}}a(cn,"opChatReasoningFields");function un(e){let{continuation:n,images:t,...o}=e,r=t?.length?[...typeof e.content=="string"&&e.content.trim()?[{type:"text",text:e.content}]:[],...t.map(s=>({type:"image_url",image_url:{url:s.url,...s.detail?{detail:s.detail}:{}}}))]:e.content;return e.role==="assistant"&&n?.kind==="chat_completions_reasoning"?{...o,...r!==void 0?{content:r}:{},reasoning_content:n.reasoningContent}:{...o,...r!==void 0?{content:r}:{}}}a(un,"opChatMessage");function le(e,n){let t=e.trim().replace(/\/+$/,"");if(!t)throw new Error("OpenPond OpChat API base URL is required.");return`${t}/${n}`}a(le,"opChatEndpointUrl");function ce(e,n,t){let o=e.trim();if(!o)throw new Error("OpenPond API key is required for OpChat.");let r=new Headers;r.set("Authorization",`Bearer ${o}`),r.set("Content-Type","application/json"),r.set("Accept",n),r.set("x-openpond-client","openpond-app");let s=t||Ge();return r.set("x-openpond-request-id",s),r.set("x-request-id",s),r}a(ce,"opChatHeaders");async function ue(e){let n=await e.text().catch(()=>"");if(!n)return e.statusText||`HTTP ${e.status}`;try{return Ie(JSON.parse(n))}catch{return n}}a(ue,"readOpChatError");function Ie(e){if(!e||typeof e!="object")return String(e||"unknown_error");let n=e,t=n.error;if(t&&typeof t=="object"){let o=t;return[z(o.code),z(o.type),z(o.message)].filter(Boolean).join(": ")}return[z(n.error),z(n.message)].filter(Boolean).join(": ")||JSON.stringify(e)}a(Ie,"errorMessageFromPayload");function dn(e){if(!e||typeof e!="object")return null;let n=e.usage;return!n||typeof n!="object"?null:n}a(dn,"parseUsage");function z(e){return typeof e=="string"&&e.trim()?e:null}a(z,"stringValue");function _e(e){return typeof e=="string"&&e.length>0?e:null}a(_e,"streamTextValue");import{readFileSync as pn}from"node:fs";var W;function fn(){if(W!==void 0)return W??"openpond-code bundled";try{let e=new URL("../package.json",import.meta.resolve("openpond")),n=JSON.parse(pn(e,"utf8"));W=typeof n.version=="string"?`openpond-code@${n.version}`:null}catch{W=null}return W??"openpond-code bundled"}a(fn,"getBundledRuntimeVersion");import{spawn as mn}from"node:child_process";function Re(e,n=process.platform){return n==="darwin"?{command:"open",args:[e]}:n==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",e]}:{command:"xdg-open",args:[e]}}a(Re,"resolveSystemBrowserCommand");async function hn(e,n={}){let t=n.command??Re(e),o=n.handoffTimeoutMs??1500;return new Promise(r=>{let s=!1,i=null,c=a(g=>{s||(s=!0,i&&clearTimeout(i),r(g))},"finish"),m=mn(t.command,t.args,{detached:!1,shell:!1,stdio:"ignore",windowsHide:!0});m.once("error",g=>{let f=g.code;c({opened:!1,error:f?`browser launcher ${t.command} failed (${f})`:`browser launcher ${t.command} failed`})}),m.once("close",(g,f)=>{if(g===0){c({opened:!0});return}let w=f?`signal ${f}`:`code ${g??"unknown"}`;c({opened:!1,error:`browser launcher ${t.command} exited with ${w}`})}),i=setTimeout(()=>{m.unref(),c({opened:!0})},o),i.unref()})}a(hn,"openUrlWithSystemBrowser");import{createHash as yn}from"node:crypto";function de(e){return yn("sha256").update(JSON.stringify([e.accountState.activeProfile,e.apiBaseUrl,e.chatApiBaseUrl,e.token])).digest("hex")}a(de,"authorityKey");var V=null,F=null;async function An(e){let n=de(e);if(V?.key===n&&V.expiresAt>Date.now())return V.response;if(F?.key===n)return F.promise;V=null;let t={key:n,promise:L(e.apiBaseUrl,e.token)};F=t;try{let o=await t.promise;return F===t&&o.account?.id&&(V={key:n,response:o,expiresAt:Date.now()+5e3}),o}finally{F===t&&(F=null)}}a(An,"authenticate");async function gn(){let e=await u();if(!e.token)return e;let n=await An(e),t=await u();if(de(t)!==de(e))throw new Error("openpond_account_authority_changed");if(!n.account?.id)throw new Error("openpond_authenticated_owner_unavailable");return{...t,accountState:H({...t,accountResponse:n})}}a(gn,"loadAuthenticatedOpenPondAccountContext");function Pn(e){if(!e||typeof e!="object")return null;let n=e,t=typeof n.id=="string"?n.id:null,o=typeof n.name=="string"?n.name:t;if(!t||!o)return null;let r=n.latestDeployment&&typeof n.latestDeployment=="object"?n.latestDeployment:null,s=xe.safeParse(n.sandboxActionRegistry);return{id:t,name:o,description:typeof n.description=="string"?n.description:null,visibility:typeof n.visibility=="string"?n.visibility:null,gitOwner:typeof n.gitOwner=="string"?n.gitOwner:null,gitRepo:typeof n.gitRepo=="string"?n.gitRepo:null,gitHost:typeof n.gitHost=="string"?n.gitHost:null,defaultBranch:typeof n.defaultBranch=="string"?n.defaultBranch:null,sandbox:n.sandbox===!0,sandboxActionRegistry:s.success?s.data:null,sandboxManifestHash:typeof n.sandboxManifestHash=="string"?n.sandboxManifestHash:null,sandboxManifestPath:typeof n.sandboxManifestPath=="string"?n.sandboxManifestPath:null,sandboxManifestSyncedAt:typeof n.sandboxManifestSyncedAt=="string"?n.sandboxManifestSyncedAt:n.sandboxManifestSyncedAt instanceof Date?n.sandboxManifestSyncedAt.toISOString():null,sandboxManifestError:typeof n.sandboxManifestError=="string"?n.sandboxManifestError:null,updatedAt:typeof n.updatedAt=="string"?n.updatedAt:null,latestDeployment:r?{id:typeof r.id=="string"?r.id:void 0,status:typeof r.status=="string"?r.status:void 0,deploymentDomain:typeof r.deploymentDomain=="string"?r.deploymentDomain:null,createdAt:typeof r.createdAt=="string"?r.createdAt:void 0,isProduction:typeof r.isProduction=="boolean"?r.isProduction:null,gitBranch:typeof r.gitBranch=="string"?r.gitBranch:null}:null,scheduleSummary:On(n.scheduleSummary)}}a(Pn,"normalizeApp");function S(e){return typeof e=="string"?e:e instanceof Date?e.toISOString():null}a(S,"normalizeDateString");function wn(e){if(!e||typeof e!="object")return null;let n=e,t=typeof n.id=="string"?n.id:null,o=typeof n.name=="string"?n.name:t,r=typeof n.deploymentId=="string"?n.deploymentId:null;return!t||!o||!r?null:{id:t,name:o,description:typeof n.description=="string"?n.description:null,scheduleType:typeof n.scheduleType=="string"?n.scheduleType:"cron",scheduleExpression:typeof n.scheduleExpression=="string"?n.scheduleExpression:"",enabled:!!n.enabled,rawEnabled:typeof n.rawEnabled=="boolean"?n.rawEnabled:void 0,syncStatus:typeof n.syncStatus=="string"?n.syncStatus:null,syncError:typeof n.syncError=="string"?n.syncError:null,startAt:S(n.startAt),endAt:S(n.endAt),maxRuns:typeof n.maxRuns=="number"?n.maxRuns:null,executionCount:typeof n.executionCount=="number"?n.executionCount:null,lifecycleStatus:typeof n.lifecycleStatus=="string"?n.lifecycleStatus:null,lifecycleReason:typeof n.lifecycleReason=="string"?n.lifecycleReason:null,lastExecutionAt:S(n.lastExecutionAt),lastExecutionStatus:typeof n.lastExecutionStatus=="string"?n.lastExecutionStatus:null,lastRunNowAt:S(n.lastRunNowAt),lastRunNowStatus:typeof n.lastRunNowStatus=="string"?n.lastRunNowStatus:null,updatedAt:S(n.updatedAt)??new Date().toISOString(),deploymentId:r,isProduction:typeof n.isProduction=="boolean"?n.isProduction:void 0,payload:n.payload}}a(wn,"normalizeSchedule");function On(e){if(!e||typeof e!="object")return null;let n=e,t=Array.isArray(n.schedules)?n.schedules.map(wn).filter(i=>!!i):[],o=typeof n.total=="number"?n.total:t.length,r=typeof n.active=="number"?n.active:t.filter(i=>i.enabled).length,s=typeof n.paused=="number"?n.paused:Math.max(0,o-r);return{total:o,active:r,paused:s,enabled:typeof n.enabled=="number"?n.enabled:r,disabled:typeof n.disabled=="number"?n.disabled:s,nextRunAt:S(n.nextRunAt),lastRunAt:S(n.lastRunAt),schedules:t,truncated:typeof n.truncated=="boolean"?n.truncated:void 0}}a(On,"normalizeScheduleSummary");async function xn(e){let n=Array.isArray(e.config.accounts)?e.config.accounts:[],t=await Promise.all(n.map(async o=>{let r=q(o.handle,o.baseUrl),s=Z(o);if(!s)return[r,{response:null,authFailed:!1,error:null}];try{return[r,{response:await L(Q(o,e.config),s),authFailed:!1,error:null}]}catch(i){return[r,{response:null,authFailed:!0,error:M(i)}]}}));return Object.fromEntries(t)}a(xn,"loadAccountProfileLookups");async function Te(e){let n=await xn(e),t=e.account?n[q(e.account.handle,e.account.baseUrl)]??null:null,o=t?.response??null,r=e.token&&t?.authFailed?t.error||"OpenPond account authentication failed.":null;return{account:H({...e,accountResponse:o,accountProfiles:n,authFailed:!!r,error:r})}}a(Te,"loadOpenPondAccountStateForContext");async function bn(){return Te(await u())}a(bn,"loadOpenPondAccountState");async function Ne(e={}){let n=await u(),t=Te(n);if(!n.token)return{...await t,apps:[],error:"No OpenPond API key or session token is configured."};let[o,r]=await Promise.allSettled([t,he(n.apiBaseUrl,n.token,{handle:n.account?.handle,limit:e.limit??20,offset:e.offset??0,includeScheduled:e.includeScheduled??!0})]);if(o.status==="rejected")throw o.reason;return{account:o.value.account,apps:r.status==="fulfilled"?r.value.map(Pn).filter(s=>!!s):[],error:r.status==="rejected"?M(r.reason):null}}a(Ne,"loadOpenPondApps");async function Un(e){let n=await u();if(!n.token)throw new Error("No OpenPond API key or session token is configured.");return{account:n,response:await ye(n.apiBaseUrl,n.token,e)}}a(Un,"createOpenPondRepoApp");import{createHash as kn}from"node:crypto";function Bn(e){return`account-${kn("sha256").update(e).digest("hex").slice(0,8)}`}a(Bn,"fallbackHandleForApiKey");function ne(e){let n=e?.trim();return n?n.replace(/^@/,""):null}a(ne,"normalizeDerivedHandle");async function En(e,n){let t=ne(e.handle);if(t)return t;try{let r=(await L(n,e.apiKey)).account,s=ne(r.handle)??ne(r.email?.split("@")[0])??ne(r.id);if(s)return s}catch{}return Bn(e.apiKey)}a(En,"deriveHandleForApiKey");async function vn(e){let n=e.baseUrl??N,t=l(e.apiBaseUrl)??Y(n)??B,o=l(e.chatApiBaseUrl),r=await En(e,t);return await Oe({handle:r,apiKey:e.apiKey,baseUrl:n,apiBaseUrl:t,chatApiBaseUrl:o,environment:e.environment??"production",setActive:e.setActive}),u(r,n)}a(vn,"saveOpenPondAccount");function _n(e,n,t){let o=l(t),r=e.findIndex(i=>P(i.handle,n)&&b(i.baseUrl,o));if(r!==-1)return r;let s=e.map((i,c)=>({account:i,index:c})).filter(({account:i})=>P(i.handle,n));if(s.length===1)return s[0].index;if(s.length>1)throw new Error(`Multiple OpenPond accounts match ${n}; select one with its base URL.`);return-1}a(_n,"findAccountIndex");async function Sn(e){let n=e.handle.trim();if(!n)throw new Error("OpenPond account handle is required.");return await D(t=>{let o=(t.accounts??[]).map(m=>({...m})),r=_n(o,n,e.baseUrl);if(r===-1)throw new Error(`OpenPond account not found: ${n}`);let s=o[r],i=A(t.activeProfile),c=!!(i&&U(s,i));o.splice(r,1),t.accounts=o,(c||!i||!o.some(m=>U(m,i)))&&(o[0]?t.activeProfile=_(o[0]):delete t.activeProfile)}),u()}a(Sn,"removeOpenPondAccount");async function Cn(){let e;return await D(n=>{let t=A(n.activeProfile),o=(n.accounts??[]).map(s=>({...s})),r=t?o.findIndex(s=>U(s,t)):0;if(r<0||!o[r])throw new Error("No active OpenPond account to log out.");e={...o[r]},delete e.apiKey,delete e.session,o[r]=e,n.accounts=o}),u(e.handle,e.baseUrl)}a(Cn,"signOutOpenPondAccount");function In(e,n,t){let o=l(t),r=e.findIndex(i=>P(i.handle,n)&&b(i.baseUrl,o));if(r!==-1)return r;let s=e.map((i,c)=>({account:i,index:c})).filter(({account:i})=>P(i.handle,n));if(s.length===1)return s[0].index;if(s.length>1)throw new Error(`Multiple OpenPond accounts match ${n}; select one with its current base URL.`);return-1}a(In,"findAccountIndex");function pe(e,n,t){if(t===void 0)return;let o=l(t);if(o){e[n]=o;return}(t===null||t.trim()==="")&&delete e[n]}a(pe,"applyOptionalUrl");async function Rn(e){let n=e.handle.trim();if(!n)throw new Error("OpenPond account handle is required.");let t;return await D(o=>{let r=(o.accounts??[]).map(f=>({...f})),s=In(r,n,e.currentBaseUrl);if(s===-1)throw new Error(`OpenPond account not found: ${n}`);let i=r[s];if(t={...i},e.apiKey!==void 0){let f=e.apiKey.trim();if(!f)throw new Error("OpenPond API key cannot be empty.");t.apiKey=f,delete t.session,delete t.token}if(pe(t,"baseUrl",e.baseUrl),pe(t,"apiBaseUrl",e.apiBaseUrl),pe(t,"chatApiBaseUrl",e.chatApiBaseUrl),e.environment===null?delete t.environment:typeof e.environment=="string"&&e.environment.trim()&&(t.environment=e.environment.trim()),r.findIndex((f,w)=>w!==s&&P(f.handle,t.handle)&&b(f.baseUrl,t.baseUrl))!==-1)throw new Error("Another OpenPond account already uses that handle and base URL.");let m=A(o.activeProfile),g=!!(m&&U(i,m));r[s]=t,o.accounts=r,o.activeProfile=e.setActive||g?_(t):o.activeProfile}),u(t.handle,t.baseUrl)}a(Rn,"updateOpenPondAccountConfig");async function Tn(e){let n=await u();if(!n.token)throw new Error("OpenPond is signed out. Add an account before reading app config.");return Ae(n.apiBaseUrl,n.token,e.appId)}a(Tn,"getOpenPondAppEnvironment");function Nn(e,n){let t="",o=a(r=>{r.startsWith(e)&&n(JSON.parse(r.slice(e.length)))},"processLine");return{push(r){for(t+=r;;){let s=Ln(t);if(s<0)return;let i=t.slice(0,s).replace(/\r$/,""),c=t[s]==="\r"&&t[s+1]===`
5
5
  `?2:1;t=t.slice(s+c),o(i)}},flush(){let r=t.trimEnd();t="",r&&o(r)}}}a(Nn,"createReadyLineParser");function Ln(e){let n=e.indexOf(`
6
6
  `),t=e.indexOf("\r");return n<0?t:t<0?n:Math.min(n,t)}a(Ln,"nextLineEnd");export{u as a,Ve as b,gn as c,bn as d,Ne as e,Un as f,Xe as g,Ze as h,en as i,Ce as j,vn as k,Sn as l,Cn as m,Rn as n,Tn as o,fn as p,Nn as q,hn as r};