openpond 0.2.59 → 0.2.60

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 (365) hide show
  1. package/README.md +27 -0
  2. package/dist/app-server.d.ts +7 -0
  3. package/dist/app-server.js +1 -1
  4. package/dist/chunks/acp-ARBNMIPT.js +2 -0
  5. package/dist/chunks/acp-agent-53COYDHB.js +21 -0
  6. package/dist/chunks/{actions-command-JJ3CU7J6.js → actions-command-6YSZ7EJS.js} +1 -1
  7. package/dist/chunks/{app-layer-KAUZAHGE.js → app-layer-TVG7KTW6.js} +1 -1
  8. package/dist/chunks/{app-server-connected-apps-SXGZOUJJ.js → app-server-connected-apps-K62M6LCT.js} +1 -1
  9. package/dist/chunks/{app-server-evaluations-N4OMTPCI.js → app-server-evaluations-RM6WXX3H.js} +1 -1
  10. package/dist/chunks/app-server-harness-services-RLKMWOQ4.js +2 -0
  11. package/dist/chunks/app-server-runtime-OKMEHNEU.js +2 -0
  12. package/dist/chunks/apps-YWZL2H34.js +2 -0
  13. package/dist/chunks/{chunk-JUQMSHNR.js → chunk-23P2O7PH.js} +1 -1
  14. package/dist/chunks/{chunk-PF5R6CMP.js → chunk-2GICDASL.js} +1 -1
  15. package/dist/chunks/{chunk-6MI4KKWF.js → chunk-2ITZW2CN.js} +1 -1
  16. package/dist/chunks/chunk-2MMCZHKL.js +2 -0
  17. package/dist/chunks/{chunk-EOBHQ3JT.js → chunk-2PAJCXFC.js} +1 -1
  18. package/dist/chunks/{chunk-GYJQKCEO.js → chunk-2RNCXDJC.js} +1 -1
  19. package/dist/chunks/{chunk-APB2STJK.js → chunk-2SUMZ73C.js} +1 -1
  20. package/dist/chunks/{chunk-DZUN5YWB.js → chunk-3CWRTKHY.js} +1 -1
  21. package/dist/chunks/{chunk-TRQQNFMO.js → chunk-44LWH5U6.js} +1 -1
  22. package/dist/chunks/{chunk-BVQWVIGK.js → chunk-52KIORRX.js} +1 -1
  23. package/dist/chunks/{chunk-TG7P7BSV.js → chunk-5RHYSQZ5.js} +1 -1
  24. package/dist/chunks/{chunk-3QIB5FXI.js → chunk-5ZBLCWEJ.js} +1 -1
  25. package/dist/chunks/{chunk-25JDHAZ5.js → chunk-637UACKH.js} +1 -1
  26. package/dist/chunks/{chunk-VRODAXFS.js → chunk-655DQ6AX.js} +26 -26
  27. package/dist/chunks/{chunk-N4FFQPLR.js → chunk-6GWOVHIG.js} +1 -1
  28. package/dist/chunks/chunk-6HQB3MQO.js +2 -0
  29. package/dist/chunks/{chunk-GOPFFQZU.js → chunk-7LZISGTA.js} +2 -2
  30. package/dist/chunks/{chunk-MMQRHR3V.js → chunk-7RC5WPVT.js} +1 -1
  31. package/dist/chunks/{chunk-H6IW2R22.js → chunk-7YTHEMWI.js} +1 -1
  32. package/dist/chunks/{chunk-PCSIOUHF.js → chunk-A3L74U3W.js} +1 -1
  33. package/dist/chunks/{chunk-XMKCCLGB.js → chunk-A66CSUBJ.js} +1 -1
  34. package/dist/chunks/{chunk-OUVIWDL2.js → chunk-AGVOGPAZ.js} +1 -1
  35. package/dist/chunks/{chunk-U2MAPON2.js → chunk-AW5Q6NXT.js} +1 -1
  36. package/dist/chunks/{chunk-7AVNZF36.js → chunk-B46HZ3MX.js} +1 -1
  37. package/dist/chunks/{chunk-KGNCKIFP.js → chunk-BIPQCJ5V.js} +1 -1
  38. package/dist/chunks/{chunk-776WNDV2.js → chunk-BIQ33JV5.js} +1 -1
  39. package/dist/chunks/{chunk-JFXWI3EN.js → chunk-BK63OQRW.js} +1 -1
  40. package/dist/chunks/{chunk-BO5JZYWG.js → chunk-CFSIU6CW.js} +1 -1
  41. package/dist/chunks/{chunk-WC42WOLG.js → chunk-D3RRUWNN.js} +1 -1
  42. package/dist/chunks/{chunk-X4OSOOSU.js → chunk-D4UX2O45.js} +1 -1
  43. package/dist/chunks/{chunk-GJ2ZJFDD.js → chunk-DG4TYVPF.js} +1 -1
  44. package/dist/chunks/{chunk-QIKWJ2AA.js → chunk-DGIEXZJV.js} +1 -1
  45. package/dist/chunks/{chunk-JMBQYBPI.js → chunk-DIGX56JY.js} +1 -1
  46. package/dist/chunks/{chunk-4GPXTISD.js → chunk-DISNCX6R.js} +1 -1
  47. package/dist/chunks/{chunk-EWOSLZDX.js → chunk-DK7IKI7O.js} +1 -1
  48. package/dist/chunks/{chunk-74IIXVAE.js → chunk-DX7YEUNQ.js} +1 -1
  49. package/dist/chunks/{chunk-523TE4BI.js → chunk-E63VWAQA.js} +1 -1
  50. package/dist/chunks/{chunk-OLDK2LKJ.js → chunk-EL454L26.js} +1 -1
  51. package/dist/chunks/{chunk-WRI4XKSK.js → chunk-ENSB6ZTM.js} +1 -1
  52. package/dist/chunks/{chunk-EAPFMACH.js → chunk-ERJV5BMC.js} +1 -1
  53. package/dist/chunks/{chunk-RNIAFXMB.js → chunk-EXJGCNRS.js} +1 -1
  54. package/dist/chunks/chunk-F5KCCDQM.js +2 -0
  55. package/dist/chunks/{chunk-57TRXBLT.js → chunk-FSQWAANK.js} +1 -1
  56. package/dist/chunks/{chunk-BGJYITVI.js → chunk-G5B3PB5X.js} +1 -1
  57. package/dist/chunks/{chunk-ARLOVWQ3.js → chunk-GAWGIJQG.js} +1 -1
  58. package/dist/chunks/{chunk-ABZ2ZOLU.js → chunk-GGGF5NHJ.js} +1 -1
  59. package/dist/chunks/{chunk-4EDIRCD3.js → chunk-GOYBYYPQ.js} +1 -1
  60. package/dist/chunks/{chunk-H7ATCPPB.js → chunk-H3BSIAQO.js} +1 -1
  61. package/dist/chunks/{chunk-RBZH6A6M.js → chunk-HCEJAOIF.js} +1 -1
  62. package/dist/chunks/{chunk-OPNRWESL.js → chunk-IFQCOSU6.js} +1 -1
  63. package/dist/chunks/{chunk-VGRMAGOK.js → chunk-IJHZBHEK.js} +2 -2
  64. package/dist/chunks/{chunk-GUOLMLZN.js → chunk-ISFIDCIH.js} +1 -1
  65. package/dist/chunks/{chunk-PY6K2JRH.js → chunk-ITKTILKI.js} +1 -1
  66. package/dist/chunks/{chunk-3CDEBKSU.js → chunk-IUBARBGI.js} +1 -1
  67. package/dist/chunks/{chunk-2L5XWJJ5.js → chunk-J24I74EM.js} +1 -1
  68. package/dist/chunks/{chunk-IRV6GWGG.js → chunk-J7QGHA7G.js} +3 -3
  69. package/dist/chunks/{chunk-FAYASU7Z.js → chunk-JGWINTT5.js} +1 -1
  70. package/dist/chunks/{chunk-GL3NX3F3.js → chunk-JHEFWB6O.js} +1 -1
  71. package/dist/chunks/{chunk-V34H7Y2T.js → chunk-JHMS2WXM.js} +2 -2
  72. package/dist/chunks/{chunk-PSGGOZFM.js → chunk-JHR3LF2F.js} +1 -1
  73. package/dist/chunks/{chunk-O4VIXU7A.js → chunk-KGLJU66U.js} +3 -3
  74. package/dist/chunks/{chunk-XEOEKFG6.js → chunk-KJFRCVQC.js} +1 -1
  75. package/dist/chunks/chunk-KNO355LC.js +2 -0
  76. package/dist/chunks/{chunk-BQS7Z4AP.js → chunk-LD7PGREF.js} +2 -2
  77. package/dist/chunks/{chunk-MNC4YUDI.js → chunk-LHA7RQBA.js} +1 -1
  78. package/dist/chunks/{chunk-RZUEVS64.js → chunk-LO3O45IX.js} +1 -1
  79. package/dist/chunks/{chunk-TIHXUKFD.js → chunk-M2SKXY5C.js} +2 -2
  80. package/dist/chunks/{chunk-2IHO4GDJ.js → chunk-M3ZQDPRS.js} +1 -1
  81. package/dist/chunks/{chunk-DPHAN6N3.js → chunk-M4ZF44H5.js} +1 -1
  82. package/dist/chunks/{chunk-Y4OWBBDD.js → chunk-M55H7KVR.js} +1 -1
  83. package/dist/chunks/{chunk-NTB2O4RP.js → chunk-MGKMIRYG.js} +1 -1
  84. package/dist/chunks/{chunk-XJZSIXEO.js → chunk-MJGU2JJ2.js} +2 -2
  85. package/dist/chunks/{chunk-7K7O3CKY.js → chunk-MS37ISA4.js} +2 -2
  86. package/dist/chunks/{chunk-BRORSFJX.js → chunk-NCKXI2VB.js} +11 -11
  87. package/dist/chunks/chunk-NHUUCNAD.js +2 -0
  88. package/dist/chunks/{chunk-2WKUBGIF.js → chunk-O3VP46SE.js} +1 -1
  89. package/dist/chunks/{chunk-EUMXMT3S.js → chunk-O4FBOUNX.js} +1 -1
  90. package/dist/chunks/chunk-O6IFVTZT.js +9 -0
  91. package/dist/chunks/{chunk-ZH3K7LKQ.js → chunk-O7B44IYN.js} +1 -1
  92. package/dist/chunks/{chunk-ZAN4DYLH.js → chunk-OGMDEA3Y.js} +1 -1
  93. package/dist/chunks/{chunk-BL3YH2QU.js → chunk-OKBIWRHC.js} +1 -1
  94. package/dist/chunks/{chunk-FFRFSDBM.js → chunk-ON2RNOCG.js} +1 -1
  95. package/dist/chunks/{chunk-76M2MEHV.js → chunk-ONDCV5QC.js} +1 -1
  96. package/dist/chunks/{chunk-UCPGRPWY.js → chunk-OQ4VGCRG.js} +1 -1
  97. package/dist/chunks/{chunk-GVZLGS2U.js → chunk-OWK7HU5I.js} +1 -1
  98. package/dist/chunks/{chunk-JQKSXCAJ.js → chunk-OY5HC2P6.js} +1 -1
  99. package/dist/chunks/{chunk-T5AACNJI.js → chunk-P7HRF4FM.js} +1 -1
  100. package/dist/chunks/{chunk-7ED24PP6.js → chunk-PCNLC5H3.js} +1 -1
  101. package/dist/chunks/{chunk-ES2ISFJC.js → chunk-PF56N7ZY.js} +1 -1
  102. package/dist/chunks/{chunk-OX3XZKGK.js → chunk-PKALOVHC.js} +2 -2
  103. package/dist/chunks/{chunk-ZCHXGRRU.js → chunk-PR5TYTY4.js} +1 -1
  104. package/dist/chunks/{chunk-Q4TBTRIG.js → chunk-PWK5Z5S3.js} +1 -1
  105. package/dist/chunks/chunk-PXS4SVQG.js +16 -0
  106. package/dist/chunks/{chunk-AY64VY4E.js → chunk-QGOPYQW3.js} +1 -1
  107. package/dist/chunks/{chunk-LPWBIGKW.js → chunk-R7YEURUQ.js} +1 -1
  108. package/dist/chunks/{chunk-ACYFMLWG.js → chunk-RCA6NGVA.js} +2 -2
  109. package/dist/chunks/{chunk-DUURYZOI.js → chunk-RG3NH6YQ.js} +1 -1
  110. package/dist/chunks/{chunk-ATAOHSFR.js → chunk-RJIUOLWY.js} +1 -1
  111. package/dist/chunks/{chunk-37MWETFU.js → chunk-RXE3FYMJ.js} +1 -1
  112. package/dist/chunks/chunk-RYGWCN2R.js +2 -0
  113. package/dist/chunks/{chunk-VYLGI3IH.js → chunk-SFNCAPCJ.js} +1 -1
  114. package/dist/chunks/{chunk-Z4Z5UOZM.js → chunk-SG6JZ7HD.js} +1 -1
  115. package/dist/chunks/{chunk-IFDALGZE.js → chunk-SKRNWRKV.js} +5 -5
  116. package/dist/chunks/{chunk-ANFDRKUU.js → chunk-SLZH4Z6C.js} +1 -1
  117. package/dist/chunks/{chunk-WN3V6KDN.js → chunk-SPDSSMFD.js} +1 -1
  118. package/dist/chunks/{chunk-EQOV34UH.js → chunk-STWRTNRK.js} +1 -1
  119. package/dist/chunks/{chunk-XMWXH7TS.js → chunk-T5J7HIHR.js} +1 -1
  120. package/dist/chunks/{chunk-E72UU4VX.js → chunk-TBUAQWFS.js} +1 -1
  121. package/dist/chunks/{chunk-ZUJ3XUCP.js → chunk-TEPRCBDV.js} +1 -1
  122. package/dist/chunks/{chunk-2G4BEISF.js → chunk-TOFMA2L5.js} +2 -2
  123. package/dist/chunks/{chunk-TKLBP3MM.js → chunk-UFHLLSCE.js} +1 -1
  124. package/dist/chunks/{chunk-BE6SS65L.js → chunk-UJKQLO6B.js} +2 -2
  125. package/dist/chunks/{chunk-O3RF72BT.js → chunk-UZQNFTLR.js} +1 -1
  126. package/dist/chunks/{chunk-F74GBN6K.js → chunk-V2HMWCT6.js} +1 -1
  127. package/dist/chunks/{chunk-6ZFPQYHG.js → chunk-V4KT5FCJ.js} +1 -1
  128. package/dist/chunks/{chunk-TVQAPBLZ.js → chunk-VHSX3JPX.js} +1 -1
  129. package/dist/chunks/{chunk-22VMH6JV.js → chunk-W2SXOGTQ.js} +1 -1
  130. package/dist/chunks/{chunk-PH6IORGZ.js → chunk-WDEO44UN.js} +1 -1
  131. package/dist/chunks/{chunk-LNCHFVHT.js → chunk-WEHBK3MC.js} +1 -1
  132. package/dist/chunks/{chunk-KO3HNMLJ.js → chunk-WGX7WY4N.js} +1 -1
  133. package/dist/chunks/{chunk-CKMSBAI2.js → chunk-WHREO7A2.js} +1 -1
  134. package/dist/chunks/{chunk-N6ENLEMY.js → chunk-WS2ZZBAQ.js} +3 -3
  135. package/dist/chunks/{chunk-DIO5CB6U.js → chunk-WYZWDMMF.js} +1 -1
  136. package/dist/chunks/{chunk-MQULU465.js → chunk-XO3H32KX.js} +1 -1
  137. package/dist/chunks/{chunk-FKJHEZCW.js → chunk-XQBIHPPX.js} +1 -1
  138. package/dist/chunks/chunk-XRKFTPHD.js +2 -0
  139. package/dist/chunks/{chunk-YHHF4Q7Y.js → chunk-XSCIOQYE.js} +1 -1
  140. package/dist/chunks/{chunk-COHMDT7A.js → chunk-XTWEWYK7.js} +7 -7
  141. package/dist/chunks/{chunk-AQD7K4Z5.js → chunk-Y3GIM6WK.js} +1 -1
  142. package/dist/chunks/{chunk-74ZXXBGN.js → chunk-Y54RKLOI.js} +1 -1
  143. package/dist/chunks/{chunk-C37PUHA6.js → chunk-Y777GISF.js} +1 -1
  144. package/dist/chunks/{chunk-PFSMXKTI.js → chunk-YDU3S6UT.js} +1 -1
  145. package/dist/chunks/{chunk-UGL7WF3W.js → chunk-YOZIZYSC.js} +1 -1
  146. package/dist/chunks/{chunk-OSIO7PLX.js → chunk-YQKOB56U.js} +1 -1
  147. package/dist/chunks/chunk-YVNDDNMK.js +3 -0
  148. package/dist/chunks/{chunk-U5FKRYJO.js → chunk-ZAZKJJOT.js} +1 -1
  149. package/dist/chunks/{chunk-2RNQQNB7.js → chunk-ZR7LIMJS.js} +1 -1
  150. package/dist/chunks/{chunk-PQJTYOR2.js → chunk-ZTJOOY2F.js} +1 -1
  151. package/dist/chunks/{chunk-GPVCOEUH.js → chunk-ZTVXRZ6D.js} +1 -1
  152. package/dist/chunks/cli-CNYNXKGQ.js +2 -0
  153. package/dist/chunks/configuration-command-5K7EE2J5.js +2 -0
  154. package/dist/chunks/connected-app-executor-E25XCNAS.js +2 -0
  155. package/dist/chunks/connected-evidence-QNSO5BTF.js +2 -0
  156. package/dist/chunks/connection-Y2KCMBYD.js +2 -0
  157. package/dist/chunks/{continual-WFPIDWPH.js → continual-SOO3QBNQ.js} +1 -1
  158. package/dist/chunks/core-commands-ZTWPYAFQ.js +2 -0
  159. package/dist/chunks/datasets-XPUMWGOC.js +2 -0
  160. package/dist/chunks/desktop-test-HVSW4JHY.js +3 -0
  161. package/dist/chunks/dist-4N6AHWNN.js +2 -0
  162. package/dist/chunks/{dist-OMGUJYPD.js → dist-N6R6VNFD.js} +1 -1
  163. package/dist/chunks/{dist-OGLX76LL.js → dist-QN7WKZ2D.js} +1 -1
  164. package/dist/chunks/{enclave-QS4BUNDU.js → enclave-VURYNILU.js} +1 -1
  165. package/dist/chunks/evaluation-coordination-AOTFPVMS.js +2 -0
  166. package/dist/chunks/experiment-improvements-75CN3VI7.js +2 -0
  167. package/dist/chunks/experiments-AGAHM2AK.js +2 -0
  168. package/dist/chunks/{experiments-VFQGE4HC.js → experiments-DYSHYBGB.js} +1 -1
  169. package/dist/chunks/{extension-JCUA3RWV.js → extension-UT4CSDJF.js} +1 -1
  170. package/dist/chunks/help-KU52CFMW.js +8 -0
  171. package/dist/chunks/host-profile-evaluation-tools-LZDMQCMT.js +2 -0
  172. package/dist/chunks/host-profile-external-dataset-VK3NJHMC.js +2 -0
  173. package/dist/chunks/hosted-app-server-composition-P7V7K7CG.js +2 -0
  174. package/dist/chunks/{hosted-experiment-improvement-42YWXB3P.js → hosted-experiment-improvement-P433KDX2.js} +1 -1
  175. package/dist/chunks/hosted-harness-runtime-Y4DONWPC.js +2 -0
  176. package/dist/chunks/{hosted-profile-candidate-HVVC43XQ.js → hosted-profile-candidate-72MMPN6U.js} +1 -1
  177. package/dist/chunks/hosted-profile-compiler-RXHLK224.js +2 -0
  178. package/dist/chunks/hosted-profile-evaluation-control-LS4DCSDO.js +2 -0
  179. package/dist/chunks/{hosted-profile-evaluation-inspection-BUWLCKCD.js → hosted-profile-evaluation-inspection-3Q6EHO66.js} +1 -1
  180. package/dist/chunks/{hosted-profile-evaluation-preparation-3XLRR6UH.js → hosted-profile-evaluation-preparation-ZD27HNLF.js} +1 -1
  181. package/dist/chunks/{hosted-tasksets-THKM5QY5.js → hosted-tasksets-V2PQZJN4.js} +1 -1
  182. package/dist/chunks/human-review-4FJFINQX.js +2 -0
  183. package/dist/chunks/{import-CBDJ4DME.js → import-GBHSLA3G.js} +1 -1
  184. package/dist/chunks/{learning-ACEVFL5M.js → learning-U3FZL5YB.js} +1 -1
  185. package/dist/chunks/local-harness-improvement-runtime-UP2P7UT4.js +2 -0
  186. package/dist/chunks/local-harness-taskset-review-ZNOKSPJJ.js +2 -0
  187. package/dist/chunks/{local-scope-HVF2GZ5W.js → local-scope-62GWHDXS.js} +1 -1
  188. package/dist/chunks/{model-projects-QPO22JPA.js → model-projects-LQ4C6R3X.js} +1 -1
  189. package/dist/chunks/opchat-Q4PIWPYW.js +3 -0
  190. package/dist/chunks/organizations-TEH6HBQ3.js +2 -0
  191. package/dist/chunks/{profile-Y2MCSOUK.js → profile-SWPVCGTR.js} +1 -1
  192. package/dist/chunks/{profile-training-source-6GOT7AHM.js → profile-training-source-J73ZLNSC.js} +1 -1
  193. package/dist/chunks/project-action-payload-OU3ZPHW7.js +2 -0
  194. package/dist/chunks/project-agent-J7ILCRBS.js +2 -0
  195. package/dist/chunks/{published-experiment-source-5TMGLKDM.js → published-experiment-source-HVHKSYDL.js} +1 -1
  196. package/dist/chunks/refiner-profile-service-E7YU4E3N.js +2 -0
  197. package/dist/chunks/{runtime-QFXCXSVB.js → runtime-LIPHPKKJ.js} +2 -2
  198. package/dist/chunks/sandbox-command-G6KID3OP.js +2 -0
  199. package/dist/chunks/{sandbox-template-XWWPWWNR.js → sandbox-template-MZTMAUFS.js} +1 -1
  200. package/dist/chunks/saved-work-LOUWLF37.js +2 -0
  201. package/dist/chunks/{send-turn-SIXOZUVJ.js → send-turn-UEUEGY5W.js} +1 -1
  202. package/dist/chunks/{src-EZAKCCUV.js → src-7WMZOWZZ.js} +102 -95
  203. package/dist/chunks/{src-6SHCCYEN.js → src-MVAK6D6Y.js} +1 -1
  204. package/dist/chunks/standalone-experiment-turn-owner-YRKEOEJ2.js +2 -0
  205. package/dist/chunks/{store-continual-support-reviews-GDX6CSUU.js → store-continual-support-reviews-FJLLNKCY.js} +1 -1
  206. package/dist/chunks/{store-conversation-serving-W55XMDH4.js → store-conversation-serving-4KWR4IZY.js} +1 -1
  207. package/dist/chunks/{store-create-improve-A7E7CUPZ.js → store-create-improve-JWBJZRAU.js} +1 -1
  208. package/dist/chunks/{store-datasets-HKF3EO7B.js → store-datasets-4N2M6Y3K.js} +2 -2
  209. package/dist/chunks/{store-evaluation-results-645RFBGR.js → store-evaluation-results-OBM4623U.js} +1 -1
  210. package/dist/chunks/{store-harness-memory-VINCZ4GK.js → store-harness-memory-4HUEMRCD.js} +1 -1
  211. package/dist/chunks/{store-harness-refinement-candidates-EA5KFQPH.js → store-harness-refinement-candidates-NMRWMN23.js} +1 -1
  212. package/dist/chunks/store-harness-workspaces-BGONIQDY.js +2 -0
  213. package/dist/chunks/{store-human-review-F5KESW52.js → store-human-review-J75SIZAL.js} +1 -1
  214. package/dist/chunks/store-learned-preference-migration-validation-VLASM4CT.js +2 -0
  215. package/dist/chunks/store-learning-TUCQFBLT.js +2 -0
  216. package/dist/chunks/{store-learning-credentials-WZQJ4HPJ.js → store-learning-credentials-S4RF57NV.js} +1 -1
  217. package/dist/chunks/{store-local-experiments-HWQWNTIU.js → store-local-experiments-LULRLTII.js} +5 -5
  218. package/dist/chunks/{store-model-batch-review-TOCSDVAP.js → store-model-batch-review-SVL4MT6D.js} +1 -1
  219. package/dist/chunks/{store-model-configuration-6543ASY2.js → store-model-configuration-ZHDSM3XM.js} +2 -2
  220. package/dist/chunks/{store-preference-comparison-LV32MHVL.js → store-preference-comparison-YMMCKXS5.js} +1 -1
  221. package/dist/chunks/{store-schedules-VGTEQVKH.js → store-schedules-6Z4QS3NU.js} +1 -1
  222. package/dist/chunks/{store-sidebar-file-bookmarks-53B7QIGS.js → store-sidebar-file-bookmarks-MX6EP6OB.js} +2 -2
  223. package/dist/chunks/{store-sidebar-preferences-YXGEJVUO.js → store-sidebar-preferences-VYREPW26.js} +1 -1
  224. package/dist/chunks/{store-subagents-HRCAK7VZ.js → store-subagents-WGBCRALX.js} +1 -1
  225. package/dist/chunks/{store-task-inbox-WF74W4U2.js → store-task-inbox-43BNZSB7.js} +6 -6
  226. package/dist/chunks/{store-task-inventory-KHCTEZVK.js → store-task-inventory-AEW4POAJ.js} +2 -2
  227. package/dist/chunks/{store-taskset-drafts-3ACG5AVX.js → store-taskset-drafts-DKFO2CYB.js} +1 -1
  228. package/dist/chunks/{store-training-R46WOGXB.js → store-training-6PFFR6ST.js} +1 -1
  229. package/dist/chunks/{store-training-jobs-D4LECE7O.js → store-training-jobs-ANDEBQ67.js} +2 -2
  230. package/dist/chunks/{store-training-models-EQVNXOVB.js → store-training-models-OOI4ZJPX.js} +2 -2
  231. package/dist/chunks/{store-usage-IE2U2FD3.js → store-usage-U72RNW64.js} +1 -1
  232. package/dist/chunks/{store-work-evidence-QQDKM5AQ.js → store-work-evidence-NY5OBATB.js} +1 -1
  233. package/dist/chunks/{taskset-NR2X2UOK.js → taskset-SL3YOXW7.js} +1 -1
  234. package/dist/chunks/{taskset-packages-ONULEIVI.js → taskset-packages-3PCEYYDA.js} +1 -1
  235. package/dist/chunks/{teams-bot-CHUYMD6K.js → teams-bot-IDEF3BMI.js} +1 -1
  236. package/dist/chunks/{training-IDSGYGU2.js → training-57ISIC7U.js} +1 -1
  237. package/dist/chunks/web-search-222Y63QW.js +2 -0
  238. package/dist/chunks/{workspaces-2TJRDM5K.js → workspaces-5DF4H5EX.js} +1 -1
  239. package/dist/cli.js +1 -1
  240. package/dist/index.js +1 -1
  241. package/dist/sandbox-template/manifest.js +1 -1
  242. package/dist/web/assets/{App-CaRMZoxo.css → App-DbYvV_W6.css} +1 -1
  243. package/dist/web/assets/{App-pcwmC4IR.js → App-nzE7JU_O.js} +4 -4
  244. package/dist/web/assets/{AppDialog-CdHad7GT.js → AppDialog-VtNvqbDm.js} +1 -1
  245. package/dist/web/assets/{AppTerminalPanel-CrmoOgd4.js → AppTerminalPanel-BMfKdrrN.js} +2 -2
  246. package/dist/web/assets/{AppsView-0P6cBsD4.js → AppsView-CdWyrDEb.js} +1 -1
  247. package/dist/web/assets/{BrowserSidebar-Cb6edJw6.js → BrowserSidebar-CtOIciOa.js} +1 -1
  248. package/dist/web/assets/{CartesianChart-B2Sxi0lv.js → CartesianChart-u1lvLM30.js} +1 -1
  249. package/dist/web/assets/{CollaborationTabs-PP0AIXhb.js → CollaborationTabs-CaBfDYRW.js} +1 -1
  250. package/dist/web/assets/{CommandMenu-GfQIMe6W.js → CommandMenu-CFW3WJ11.js} +1 -1
  251. package/dist/web/assets/{CommunityView-V6KmMl5n.js → CommunityView-D2EjaeuH.js} +1 -1
  252. package/dist/web/assets/{ComposerCreateImproveStrip-oeVeyhPX.js → ComposerCreateImproveStrip-6wYSJdzv.js} +1 -1
  253. package/dist/web/assets/{ConversationImportsSettings-CuQcvVgE.js → ConversationImportsSettings-BJ4QhF7p.js} +1 -1
  254. package/dist/web/assets/{GetStartedView-2oZ068h_.js → GetStartedView-DBcOwIJn.js} +1 -1
  255. package/dist/web/assets/{HostedModelLearningReview-DLzak_Vf.js → HostedModelLearningReview-BNpK6_W9.js} +1 -1
  256. package/dist/web/assets/{HostedModelLearningSettings-Eca6Pd9R.js → HostedModelLearningSettings-SrsdeeoA.js} +1 -1
  257. package/dist/web/assets/{LabModelVersionDetailPage-DsBblnMp.js → LabModelVersionDetailPage-Cd6bRHt9.js} +1 -1
  258. package/dist/web/assets/{LabSkillSidebar-DDknttrB.js → LabSkillSidebar-CQfvel4w.js} +1 -1
  259. package/dist/web/assets/{LabsRoute-CgNiUHsy.js → LabsRoute-sXLJt1KR.js} +4 -4
  260. package/dist/web/assets/{MainChatThread-yCVg99LU.js → MainChatThread-dlDDK2JM.js} +2 -2
  261. package/dist/web/assets/{MainPane-C86le7UF.js → MainPane-DCz38-qy.js} +4 -4
  262. package/dist/web/assets/{MarkdownText-BBVriBCj.js → MarkdownText-Drjq6-JM.js} +1 -1
  263. package/dist/web/assets/{NativeSkillSidebar-D2uVZkqh.js → NativeSkillSidebar-jncZijt-.js} +1 -1
  264. package/dist/web/assets/{NewExperienceSwitcher-DuD6GScJ.js → NewExperienceSwitcher-DXKzoMaM.js} +1 -1
  265. package/dist/web/assets/{NewProjectDialog-B6XZkJrU.js → NewProjectDialog-DIyjAxJG.js} +1 -1
  266. package/dist/web/assets/{OutputsPage-PUlmcWjv.js → OutputsPage-Dy1cNr3n.js} +1 -1
  267. package/dist/web/assets/{ProjectsPage-DWBRmej6.js → ProjectsPage-D2EeybIv.js} +1 -1
  268. package/dist/web/assets/{RightChatPanelStack-HaCVep4t.js → RightChatPanelStack-4wUL-W9_.js} +1 -1
  269. package/dist/web/assets/{RightSidebarHomePanel-BUtdPb2L.js → RightSidebarHomePanel-Bd_AHUp8.js} +1 -1
  270. package/dist/web/assets/{ScheduledWorkPage-Dg9GkGrT.js → ScheduledWorkPage-BJkSzwz2.js} +1 -1
  271. package/dist/web/assets/{SettingsView-DtldfnV-.js → SettingsView-BhcP72KH.js} +3 -3
  272. package/dist/web/assets/{TeamChatView-C71JX4je.js → TeamChatView-CR0fdicZ.js} +1 -1
  273. package/dist/web/assets/{TerminalOverlay-B4F6Q36s.js → TerminalOverlay-DGrZRZ_3.js} +10 -10
  274. package/dist/web/assets/{TrainingCreationPanel-B9MxFzQx.js → TrainingCreationPanel-BsTG7aFS.js} +1 -1
  275. package/dist/web/assets/{TrainingDraftPanel-7C48sHfC.js → TrainingDraftPanel-ByErrht7.js} +1 -1
  276. package/dist/web/assets/{UsageSettingsSection-CC57FcUB.js → UsageSettingsSection-DeYTJbcM.js} +1 -1
  277. package/dist/web/assets/{WorkSidebarPanel-Cto1usLM.js → WorkSidebarPanel-DcNvEEoy.js} +1 -1
  278. package/dist/web/assets/{WorkspaceDiffPanel-CL7wi3kp.js → WorkspaceDiffPanel-CdPRcYWN.js} +3 -3
  279. package/dist/web/assets/{WorkspaceEnvironmentMenu-zdzSDofs.js → WorkspaceEnvironmentMenu-xUYg-iGn.js} +1 -1
  280. package/dist/web/assets/{WorkspaceGitDialogs-CZSmjnrc.js → WorkspaceGitDialogs-CBViLL3S.js} +1 -1
  281. package/dist/web/assets/{WorkspaceMonacoEditor-TrUDJMKb.js → WorkspaceMonacoEditor-frxie2_S.js} +3 -3
  282. package/dist/web/assets/{agent-connections-4Dza2mDg.js → agent-connections-D7ao-vbU.js} +1 -1
  283. package/dist/web/assets/{arrow-up-right-xKb5kWQJ.js → arrow-up-right-DCWPxdbD.js} +1 -1
  284. package/dist/web/assets/{chunk-P3BRSSRD-BsGTkgyC.js → chunk-P3BRSSRD-B5JXa0Nh.js} +1 -1
  285. package/dist/web/assets/{clipboard-BgjV3aCx.js → clipboard-B-GnMVLp.js} +1 -1
  286. package/dist/web/assets/{cloud-upload-Bw9XUsKQ.js → cloud-upload-DpaGFZ9J.js} +1 -1
  287. package/dist/web/assets/{cssMode-DxsFJGb-.js → cssMode-DJHE7R3W.js} +1 -1
  288. package/dist/web/assets/{folder-open-CbmUjIYS.js → folder-open-B-DFLDFH.js} +1 -1
  289. package/dist/web/assets/{folder-plus-slsst7Ct.js → folder-plus-CPXxPvSH.js} +1 -1
  290. package/dist/web/assets/{git-commit-horizontal-BIS-8MuS.js → git-commit-horizontal-DCTzcivA.js} +1 -1
  291. package/dist/web/assets/{htmlMode-BE4VOrZo.js → htmlMode-DxZVBAYd.js} +1 -1
  292. package/dist/web/assets/index-BojtIRzO.css +1 -0
  293. package/dist/web/assets/{index-DEg0S7Qk.js → index-Di1MU6Xr.js} +2 -2
  294. package/dist/web/assets/{info-5bL9xSSf.js → info-BMxsR_bn.js} +1 -1
  295. package/dist/web/assets/{jsonMode-CYimnBhD.js → jsonMode-CzWoMkpp.js} +1 -1
  296. package/dist/web/assets/{lspLanguageFeatures-CiFuk-P7.js → lspLanguageFeatures-15K7ND6Q.js} +1 -1
  297. package/dist/web/assets/{minimize-2-BGVWKvTg.js → minimize-2-DwUgqXoR.js} +1 -1
  298. package/dist/web/assets/{monaco.contribution-DkLVGT8N.js → monaco.contribution-BBLKjER5.js} +2 -2
  299. package/dist/web/assets/{monaco.contribution-BTY4dJ0f.js → monaco.contribution-DBjvSu8p.js} +2 -2
  300. package/dist/web/assets/{monaco.contribution-DUE3CQph.js → monaco.contribution-DUWvjhIG.js} +2 -2
  301. package/dist/web/assets/{monaco.contribution-C7sMrcos.js → monaco.contribution-w0zfkYLX.js} +2 -2
  302. package/dist/web/assets/{monitor-B5hx_tzp.js → monitor-Ihu5LVYx.js} +1 -1
  303. package/dist/web/assets/{play-pmSO95Qg.js → play-D_YGCdxU.js} +1 -1
  304. package/dist/web/assets/{python-CiZvL3LX.js → python-Q4OuoXYc.js} +1 -1
  305. package/dist/web/assets/{save-CvYL4DUg.js → save-DJYUOhtD.js} +1 -1
  306. package/dist/web/assets/{square-DT_uFOml.js → square-DXtoCBNw.js} +1 -1
  307. package/dist/web/assets/{toggleHighContrast-CrE1_HY0.js → toggleHighContrast-CaNeuWVE.js} +1 -1
  308. package/dist/web/assets/{tsMode-CI_PdZmj.js → tsMode-CJnQ2wmM.js} +1 -1
  309. package/dist/web/assets/{upload-PVi8vC3T.js → upload-fCP3_OEO.js} +1 -1
  310. package/dist/web/assets/{useLocalAgentSchedules-BHJNVf42.js → useLocalAgentSchedules-BFoH_gwZ.js} +1 -1
  311. package/dist/web/assets/{useProviderSettings-CU3zXyie.js → useProviderSettings-2eysgqiA.js} +1 -1
  312. package/dist/web/assets/{useSessionTurnCache-BE7cipLX.js → useSessionTurnCache-DLF5SPD-.js} +1 -1
  313. package/dist/web/assets/{wifi-off-7WiFuOhD.js → wifi-off-DZoiFrRz.js} +1 -1
  314. package/dist/web/assets/{workers-Cv8r4CvM.js → workers-D5nr74M-.js} +1 -1
  315. package/dist/web/assets/{yaml-Bj7mdkV2.js → yaml-CwsoTJmk.js} +1 -1
  316. package/dist/web/index.html +2 -2
  317. package/docs/command-reference.md +12 -0
  318. package/package.json +1 -1
  319. package/dist/chunks/app-server-harness-services-DDFUMNYC.js +0 -2
  320. package/dist/chunks/app-server-runtime-SVB6L26M.js +0 -2
  321. package/dist/chunks/apps-EZB56RHV.js +0 -2
  322. package/dist/chunks/chunk-7UH4YDA7.js +0 -3
  323. package/dist/chunks/chunk-CGWA54LE.js +0 -2
  324. package/dist/chunks/chunk-K44RHALX.js +0 -2
  325. package/dist/chunks/chunk-MFMYWZK2.js +0 -2
  326. package/dist/chunks/chunk-P2RSBSCT.js +0 -2
  327. package/dist/chunks/chunk-QDC4OW3S.js +0 -2
  328. package/dist/chunks/chunk-SF5HJ7PL.js +0 -16
  329. package/dist/chunks/chunk-YBT2NB32.js +0 -2
  330. package/dist/chunks/chunk-YCQSVHCD.js +0 -9
  331. package/dist/chunks/cli-5DFVQL5Y.js +0 -2
  332. package/dist/chunks/configuration-command-JS6U3RMC.js +0 -2
  333. package/dist/chunks/connected-app-executor-UBMGMV76.js +0 -2
  334. package/dist/chunks/connected-evidence-NLAIEVQ3.js +0 -2
  335. package/dist/chunks/connection-NZSD3U5O.js +0 -2
  336. package/dist/chunks/core-commands-U4IBRRY5.js +0 -2
  337. package/dist/chunks/datasets-UX47DTTB.js +0 -2
  338. package/dist/chunks/desktop-test-UUU7PD4P.js +0 -3
  339. package/dist/chunks/dist-W5MJYSPF.js +0 -2
  340. package/dist/chunks/evaluation-coordination-3YQN5JQW.js +0 -2
  341. package/dist/chunks/experiment-improvements-ZRVD2AGY.js +0 -2
  342. package/dist/chunks/experiments-JEB5A2N5.js +0 -2
  343. package/dist/chunks/help-KA4OINP5.js +0 -8
  344. package/dist/chunks/host-profile-evaluation-tools-2URLU5SG.js +0 -2
  345. package/dist/chunks/host-profile-external-dataset-B2AQNSDR.js +0 -2
  346. package/dist/chunks/hosted-app-server-composition-VJQ3FM4I.js +0 -2
  347. package/dist/chunks/hosted-harness-runtime-BM4WONJN.js +0 -2
  348. package/dist/chunks/hosted-profile-compiler-RKDWHYK3.js +0 -2
  349. package/dist/chunks/hosted-profile-evaluation-control-57V24UGU.js +0 -2
  350. package/dist/chunks/human-review-CSYAW4PC.js +0 -2
  351. package/dist/chunks/local-harness-improvement-runtime-3T6E7I5Q.js +0 -2
  352. package/dist/chunks/local-harness-taskset-review-LQPQBALH.js +0 -2
  353. package/dist/chunks/opchat-6ADSONAD.js +0 -3
  354. package/dist/chunks/organizations-GT24ZTCN.js +0 -2
  355. package/dist/chunks/project-action-payload-GHSLE7K3.js +0 -2
  356. package/dist/chunks/project-agent-YYSQIHVE.js +0 -2
  357. package/dist/chunks/refiner-profile-service-ZK7KAFP5.js +0 -2
  358. package/dist/chunks/sandbox-command-U6346TVJ.js +0 -2
  359. package/dist/chunks/saved-work-SWHZ4OLO.js +0 -2
  360. package/dist/chunks/standalone-experiment-turn-owner-LIAQWTGI.js +0 -2
  361. package/dist/chunks/store-harness-workspaces-XUM4Z66X.js +0 -2
  362. package/dist/chunks/store-learned-preference-migration-validation-V27XD4I7.js +0 -2
  363. package/dist/chunks/store-learning-WLG6KFIO.js +0 -2
  364. package/dist/chunks/web-search-BPON7H5N.js +0 -2
  365. package/dist/web/assets/index-erq7hUne.css +0 -1
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import"./chunk-W45RKGM6.js";import{a as we}from"./chunk-WC42WOLG.js";import{e as Te,f as ge}from"./chunk-22VMH6JV.js";import"./chunk-GLDYJM7O.js";import{h as x,j as L}from"./chunk-776WNDV2.js";import{d as F,f as me,g as ke,i as N,j as D,k as ue}from"./chunk-2L5XWJJ5.js";import{a as H,b as g,c as $}from"./chunk-JQKSXCAJ.js";import"./chunk-2RNQQNB7.js";import"./chunk-OQPJ7FJF.js";import"./chunk-EUMXMT3S.js";import"./chunk-Q4TBTRIG.js";import"./chunk-T5AACNJI.js";import"./chunk-TKLBP3MM.js";import"./chunk-RBZH6A6M.js";import"./chunk-DIO5CB6U.js";import"./chunk-7ED24PP6.js";import{a as he}from"./chunk-KCJVFLBB.js";import"./chunk-N4FFQPLR.js";import"./chunk-AY64VY4E.js";import"./chunk-GJ2ZJFDD.js";import"./chunk-3QIB5FXI.js";import"./chunk-6MI4KKWF.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-CGWA54LE.js";import"./chunk-KO3HNMLJ.js";import"./chunk-MQULU465.js";import"./chunk-JMBQYBPI.js";import"./chunk-LPWBIGKW.js";import"./chunk-DZUAT3TP.js";import{d as de,e as ce,f as q,n as fe,p as le,q as pe}from"./chunk-H7ATCPPB.js";import{C as ne,k as y,l as se,m as re,o as ie,p as oe}from"./chunk-25JDHAZ5.js";import{Ib as A,U as ae,b as Y,c as X,ca as O,e as B,i as Z,ua as T,xa as _}from"./chunk-XMKCCLGB.js";import"./chunk-WN3V6KDN.js";import{n as ee,x as S,y as te}from"./chunk-523TE4BI.js";import"./chunk-ZCHXGRRU.js";import"./chunk-YBT2NB32.js";import"./chunk-74ZXXBGN.js";import"./chunk-APB2STJK.js";import"./chunk-Y4OWBBDD.js";import"./chunk-6ZFPQYHG.js";import"./chunk-JFXWI3EN.js";import"./chunk-6FA3GG5B.js";import{e as j,f as K}from"./chunk-MNC4YUDI.js";import"./chunk-Z4Z5UOZM.js";import"./chunk-FFRFSDBM.js";import"./chunk-H7IWJN7L.js";import{N as J,O as M}from"./chunk-VYLGI3IH.js";import"./chunk-ACYFMLWG.js";import"./chunk-TVQAPBLZ.js";import{m}from"./chunk-KGNCKIFP.js";import{b as u}from"./chunk-ES2ISFJC.js";import{a as h}from"./chunk-FTQLQJQV.js";import{randomUUID as Ze}from"node:crypto";import{cp as et,mkdir as tt,readdir as at,rename as Q,rm as Ae,stat as st}from"node:fs/promises";import I from"node:path";function Ee(o,t,e,a){let s=t.modelScope;if(!s)return;let i=o.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[s.modelId,t.profileId]);if(!i)throw new Error("Taskset draft Model was not found in this Profile.");let r=S.parse(JSON.parse(i.payload)),n={id:e.id,revision:e.revision,contentHash:e.contentHash};return Te(o,{schemaVersion:"openpond.modelProjectSave.v1",operationId:`draft-publication:${m({draftId:t.id,revision:t.revision,scope:s,tasksetRef:n})}`,expectedRevision:s.expectedModelRevision,project:te.strip().parse({...r,trainingSetup:{...r.trainingSetup,tasksetRef:n,rewardBindingRef:e.metadata.rewardBinding===void 0?null:ee.parse(e.metadata.rewardBinding),tasksetRelease:null,recipe:null,...r.trainingSetup.evaluationTasksetRef&&r.trainingSetup.tasksetRef&&M(r.trainingSetup.evaluationTasksetRef,r.trainingSetup.tasksetRef)?{evaluationTasksetRef:n}:{}}})},null,a?.modelResources?{...a.modelResources,taskset:a.taskset,executionResources:{environment:a.environment,verifierSet:a.verifierSet}}:a??void 0)}h(Ee,"selectTasksetDraftModel");import{createHash as We,randomUUID as je}from"node:crypto";import{lstat as ve,mkdir as ye,readdir as Je,readFile as Be,rename as $e,rm as qe,writeFile as Ue}from"node:fs/promises";import R from"node:path";var b=le.extend({workspaceHash:u.string().regex(/^[a-f0-9]{64}$/).nullable()}).strict();async function Pe(o){let{db:t,profileId:e}=o,a=X.parse(o.request),s=h(()=>{let w=t.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[a.modelId,e]);if(!w)throw new Error("Taskset draft Model was not found in this Profile.");return S.parse(JSON.parse(w.payload))},"requireModel"),i=s(),r=m(a),n=t.get("SELECT request_hash, state, payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[e,a.operationId]);if(n){if(n.request_hash!==r)throw new Error("Taskset draft operation was reused with different input.");if(n.state==="deleted")throw new Error("This Taskset draft was deleted.");return b.parse(JSON.parse(n.payload))}if(!o.source)return null;if(i.revision!==a.expectedModelRevision)throw new Error("Model changed before draft initialization. Refresh before editing.");let f=i.trainingSetup.tasksetRef,p=f?t.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ? AND profile_id = ?",[f.id,f.revision,e]):null,d=p?T.parse(JSON.parse(p.payload)):null;if(!d||!f||d.contentHash!==f.contentHash)throw new Error("The selected source Taskset is unavailable.");let l=o.source,c=i.hosted?.apiOrigin?i.hosted.tasksets.find(w=>w.localTasksetId===d.id&&w.localTasksetHash===d.contentHash&&w.packageHash===l.contentHash&&w.releaseId===l.taskset.id&&w.releaseRevision===l.taskset.revision&&w.releaseHash===l.taskset.contentHash):null,k=typeof d.metadata.importedPackageHash=="string"?d.metadata.importedPackageHash:c?.packageHash;if(k?k!==l.contentHash:!M(J(A({taskset:d,adapterId:F(d)}).tasksetRelease),J(l.taskset)))throw new Error("Taskset draft package differs from its selected source.");let v=l.modelResources?ae.safeParse(l.taskset.metadata.modelTasksetDerivation):Y.safeParse(l.taskset.metadata.modelTasksetAuthoring),xe=c&&v.success&&v.data.owner.modelId===i.id?v.data.owner:{scopeId:e,modelId:i.id},Le=de({request:a,owner:xe,source:l}),Ce=pe({sourceDraft:ne(d),source:l,preparation:Le,expectedModelRevision:a.expectedModelRevision});await N(o.home,l);let G=b.parse({...Ce,workspaceHash:null}),ze=G.draft;t.exec("BEGIN IMMEDIATE");try{let w=t.get("SELECT request_hash FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[e,a.operationId]);if(w&&w.request_hash!==r)throw new Error("Taskset draft operation was reused with different input.");if(!w&&s().revision!==a.expectedModelRevision)throw new Error("Model changed during draft initialization. Refresh before editing.");t.run("INSERT INTO model_taskset_draft_operations (profile_id, operation_id, request_hash, draft_id, state, payload) VALUES (?, ?, ?, ?, 'prepared', ?) ON CONFLICT(profile_id, operation_id) DO NOTHING",[e,a.operationId,r,ze.id,JSON.stringify(G)]),t.exec("COMMIT")}catch(w){throw t.exec("ROLLBACK"),w}let W=t.get("SELECT request_hash, payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[e,a.operationId]);if(!W||W.request_hash!==r)throw new Error("Taskset draft operation was reused with different input.");return b.parse(JSON.parse(W.payload))}h(Pe,"prepareDraftInitialization");async function Se(o){let{initialized:t,workspacePath:e}=o;if(o.completed())return;if(t.workspaceHash)try{if(await ve(e),o.completed())return;if(await U(e),await g(e)!==t.workspaceHash)throw new Error("Prepared Taskset draft files changed before initialization completed.");return}catch(s){if(s.code!=="ENOENT")throw s}let a=`${e}.initializing-${je()}`;await ye(R.dirname(e),{recursive:!0});try{let s=t.draft.modelScope?.source;if(!s)throw new Error("Taskset draft lost its source preparation.");let i=await D(o.home,s.sourcePackageHash),r=new Map;for(let f of t.filePaths){let p=i.files.find(d=>d.asset.id===f.assetId);if(!p)throw new Error("Taskset draft source asset is missing.");for(let d of f.paths){if(d.includes("\\")||R.posix.isAbsolute(d)||d.split("/").some(k=>!k||k==="."||k===".."||k.startsWith(".env")))throw new Error("Taskset draft source path is invalid.");let l=r.get(d);if(l&&l!==p.asset.contentHash)throw new Error("Taskset draft source paths conflict.");if(l)continue;let c=R.join(a,d);await ye(R.dirname(c),{recursive:!0}),await Ue(c,O(p),{flag:"wx"}),r.set(d,p.asset.contentHash)}}await H(t.draft,a);for(let[f,p]of r)if(We("sha256").update(await Be(R.join(a,f))).digest("hex")!==p)throw new Error(`Taskset draft source asset conflicts with authoring file ${f}.`);let n=await g(a);if(o.retainHash({...t,workspaceHash:n}),o.completed())return;try{await $e(a,e)}catch(f){if(!["EEXIST","ENOTEMPTY"].includes(f.code??""))throw f;if(o.completed())return;if(await U(e),await g(e)!==n)throw new Error("Prepared Taskset draft files changed before initialization completed.")}}finally{await qe(a,{recursive:!0,force:!0})}}h(Se,"materializeDraftInitialization");async function U(o){let t=await ve(o);if(!t.isDirectory()||t.isSymbolicLink())throw new Error("Taskset draft source must be a regular directory.");for(let e of await Je(o,{withFileTypes:!0})){if(e.name.startsWith(".env")||e.isSymbolicLink())throw new Error("Taskset draft source contains a prohibited file.");if(e.isDirectory())await U(R.join(o,e.name));else if(!e.isFile())throw new Error("Taskset draft source must contain regular files.")}}h(U,"assertRegularTree");import Ve from"node:path";async function De(o){let t=A({taskset:o.taskset,adapterId:F(o.taskset)}),e=await me({root:o.directory,content:{schemaVersion:"openpond.tasksetPackage.v1",taskset:t.tasksetRelease,environment:t.environmentRelease,verifierSet:t.verifierSetRelease},sources:q.parse(o.taskset.metadata.portableFileInventory??[])}),a=o.preparation.authoringGraph==="bound"?await D(o.home,o.preparation.sourcePackageHash):void 0,s=ce({preparation:o.preparation,edited:e,source:a});if(s.modelResources){let c=fe({package:s,profileId:o.taskset.profileId,name:o.taskset.name,createdAt:o.taskset.createdAt}),k=T.parse({...c.taskset,authoringProvenance:o.taskset.authoringProvenance,metadata:{...c.taskset.metadata,sourcePackageHash:o.taskset.metadata.sourcePackageHash}}),v=T.parse({...k,contentHash:_(k)});return await ue({home:o.home,...c,taskset:v}),{taskset:v,directory:Ve.join(o.home,"training","tasksets",String(v.environment.metadata.runtimeSourceTasksetId))}}let i=q.parse(o.taskset.metadata.portableFileInventory??[]),r=s.files.map(c=>({asset:c.asset,sourcePath:i.find(k=>k.asset.id===c.asset.id)?.sourcePath??c.asset.path})),n=s.taskset.environment.entrypoint==="openpond.javascript-environment.v1"?s.files.find(c=>c.asset.path==="environment/execution.json"):void 0,f=`model-draft-${m({packageHash:s.contentHash,taskset:o.taskset})}`,p=T.parse({...o.taskset,id:s.taskset.id,revision:s.taskset.revision,metadata:{...o.taskset.metadata,portableFileInventory:r,importedPackageHash:s.contentHash,derivedPortableMetadata:s.taskset.metadata},environment:{...o.taskset.environment,metadata:{...o.taskset.environment.metadata,runtimeSourceTasksetId:f,portableExecutionResources:{environment:s.environment,verifierSet:s.verifierSet}}}}),d=T.parse({...p,contentHash:_(p)}),l=await x(o.home,{taskset:d,generatedFiles:n?[{path:n.asset.path,role:"environment",content:new TextDecoder("utf-8",{fatal:!0}).decode(O(n))}]:[]},f,{source:{directory:o.directory,packageHash:await g(o.directory)},verify:h(c=>L(c,d),"verify")});return await N(o.home,s),{directory:l,taskset:d}}h(De,"materializeModelTasksetDraftPublication");import{constants as V}from"node:fs";import{createHash as Qe}from"node:crypto";import{lstat as be,mkdir as Ge,open as Ke,readdir as Ye,rm as Re}from"node:fs/promises";import C from"node:path";var P=h((o,t)=>K(C.join(o,"state","taskset-draft-writes"),t),"withTasksetDraftLock"),_e=re,Xe=h(o=>Qe("sha256").update(o).digest("hex"),"digest");async function z(o,t,e=!1){B.parse(t);let a=o;for(let s of["",...t.split("/").slice(0,-1)]){s&&(a=C.join(a,s)),e&&await Ge(a,{recursive:!1}).catch(r=>{if(r.code!=="EEXIST")throw r});let i=await be(a);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Taskset draft paths must use regular directories.")}return C.join(o,t)}h(z,"regularPath");async function He(o,t){let e=await z(o,t),a=await Ke(e,V.O_RDONLY|V.O_NOFOLLOW|V.O_NONBLOCK);try{let s=await a.stat();if(!s.isFile()||s.size>se)throw new Error("Taskset draft file must be a regular file within the 6 MB editing limit.");let i=Buffer.alloc(s.size),r=0;for(;r<i.length;){let n=await a.read(i,r,i.length-r,r);if(!n.bytesRead)throw new Error("Taskset draft file changed during reading.");r+=n.bytesRead}if((await a.read(Buffer.alloc(1),0,1,r)).bytesRead)throw new Error("Taskset draft file changed during reading.");return i}finally{await a.close()}}h(He,"readBytes");async function Ie(o,t){let e=await He(o,t);return ie(t,e)}h(Ie,"readTasksetDraftFile");async function Me(o){let t=[];async function e(a=""){for(let s of await Ye(C.join(o,a),{withFileTypes:!0})){let i=a?`${a}/${s.name}`:s.name;if(B.parse(i),s.isSymbolicLink())throw new Error("Taskset draft files cannot contain symbolic links.");if(s.isDirectory()){await e(i);continue}if(!s.isFile())throw new Error("Taskset draft files must be regular files.");if(t.length>=1e4)throw new Error("Taskset draft file inventory exceeds its limit.");let r=await be(await z(o,i));if(!r.isFile()||r.isSymbolicLink())throw new Error("Taskset draft files must be regular files.");t.push({path:i,sizeBytes:r.size,writable:_e(i)})}}return h(e,"visit"),await z(o,"taskset.json"),await e(),t.sort((a,s)=>a.path.localeCompare(s.path))}h(Me,"listTasksetDraftFiles");async function Oe(o,t,e){if(!_e(t.path))throw new Error("This file is managed by the Taskset forms or retained source history.");let a=null;try{a=await He(o,t.path)}catch(r){if(r.code!=="ENOENT")throw r}if((a?Xe(a):null)!==t.expectedFileHash)throw new Error("Taskset draft file changed. Reload it before saving.");if(!a&&t.content===null)throw new Error("Taskset draft file does not exist.");let s=t.content?oe(t.content):null,i=await z(o,t.path,!0);s?await j(i,s):await Re(i);try{return await e()}catch(r){throw a?await j(i,a):await Re(i,{force:!0}),r}}h(Oe,"mutateTasksetDraftFile");var E=u.object({schemaVersion:u.literal("openpond.tasksetDraftPointer.v1"),id:u.string().trim().min(1),profileId:u.string().trim().min(1),modelScope:y.shape.modelScope,status:u.enum(["draft","validating","needs_review","published"]),revision:u.number().int().positive(),workspacePath:u.string().trim().min(1),packageHash:u.string().regex(/^[a-f0-9]{64}$/),publishedTasksetRef:u.object({id:u.string().trim().min(1),revision:u.number().int().positive(),contentHash:u.string().trim().min(8)}).nullable(),createdAt:u.string().trim().min(1),updatedAt:u.string().trim().min(1)}),Fe=class extends he{static{h(this,"SqliteTasksetDraftStore")}async initializeModelTasksetDraft(t,e,a){await this.ready;let s=this.writeQueue.then(()=>P(this.home,async()=>{let i=this.database,r=await Pe({db:i,home:this.home,profileId:t,request:e,source:a});if(!r)return null;let n=h(()=>{let d=i.get("SELECT state FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[t,e.operationId]);if(d?.state==="deleted")throw new Error("This Taskset draft was deleted.");let l=i.get("SELECT payload FROM taskset_drafts WHERE id = ?",[r.draft.id]);if(!l){if(d?.state==="ready")throw new Error("The initialized Taskset draft is unavailable.");return!1}let c=E.parse(JSON.parse(l.payload));if(c.profileId!==t||c.modelScope?.source?.requestHash!==r.draft.modelScope?.source?.requestHash)throw new Error("Taskset draft identity conflicts with its initialization.");return!0},"completed"),f=this.workspacePath(r.draft.id);await Se({home:this.home,initialized:r,workspacePath:f,completed:n,retainHash:h(d=>{let l=i.get("SELECT payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[t,e.operationId]),c=b.parse(JSON.parse(l.payload));if(c.workspaceHash&&c.workspaceHash!==d.workspaceHash)throw new Error("Taskset draft initialization produced different files on retry.");i.run("UPDATE model_taskset_draft_operations SET payload = ? WHERE profile_id = ? AND operation_id = ? AND state = 'prepared'",[JSON.stringify(d),t,e.operationId])},"retainHash")}),i.exec("BEGIN IMMEDIATE");try{if(!n()){let d=i.get("SELECT payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[t,e.operationId]),l=b.parse(JSON.parse(d.payload)),c=l.draft,k=E.parse({schemaVersion:"openpond.tasksetDraftPointer.v1",id:c.id,profileId:t,modelScope:c.modelScope,status:c.status,revision:c.revision,workspacePath:f,packageHash:l.workspaceHash,publishedTasksetRef:c.publishedTasksetRef,createdAt:c.createdAt,updatedAt:c.updatedAt});i.run("INSERT INTO taskset_drafts (id, profile_id, status, revision, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)",[c.id,t,c.status,c.revision,JSON.stringify(k),c.createdAt,c.updatedAt]),i.run("UPDATE model_taskset_draft_operations SET state = 'ready' WHERE profile_id = ? AND operation_id = ?",[t,e.operationId])}i.exec("COMMIT")}catch(d){throw i.exec("ROLLBACK"),d}let p=i.get("SELECT payload FROM taskset_drafts WHERE id = ?",[r.draft.id]);return this.draftFromStoredPayload(JSON.parse(p.payload))}));return this.writeQueue=s.then(()=>{},()=>{}),s}async saveTasksetDraft(t,e,a={}){let s=y.parse(t);await this.ready;let i=this.writeQueue.then(()=>P(this.home,async()=>{let r=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ?",[s.id]),n=r?E.safeParse(JSON.parse(r.payload)):null;if(n?.success){if(n.data.profileId!==s.profileId)throw new Error("Taskset draft profile cannot change.");if(m(n.data.modelScope?{...n.data.modelScope,expectedModelRevision:0}:null)!==m(s.modelScope?{...s.modelScope,expectedModelRevision:0}:null)||!a.refreshModelRevision&&m(n.data.modelScope)!==m(s.modelScope))throw new Error("Taskset draft Model ownership cannot change.");if(n.data.status==="published")throw new Error("Published Taskset drafts are immutable. Initialize a new draft to revise the Taskset.");if(s.revision<n.data.revision||e!==void 0&&n.data.revision!==e)throw new Error("Taskset draft changed before saving. Refresh before saving.")}else if(e!==void 0)throw new Error("Taskset draft is unavailable for saving.");if((!n?.success||a.refreshModelRevision)&&s.modelScope){let c=this.database.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[s.modelScope.modelId,s.profileId]);if(!c)throw new Error("Taskset draft Model was not found in this Profile.");if(S.parse(JSON.parse(c.payload)).revision!==s.modelScope.expectedModelRevision)throw new Error("Taskset draft Model changed. Refresh before editing.")}let f=this.workspacePath(s.id),d=(await H(s,f)).draft,l=E.parse({schemaVersion:"openpond.tasksetDraftPointer.v1",id:d.id,profileId:d.profileId,modelScope:d.modelScope,status:d.status,revision:d.revision,workspacePath:f,packageHash:await g(f),publishedTasksetRef:d.publishedTasksetRef,createdAt:d.createdAt,updatedAt:d.updatedAt});return await this.savePointer(l,!0),d}));return this.writeQueue=i.then(()=>{},()=>{}),i}async importTasksetDraftPackage(t){let e=I.resolve(t.packagePath),s=(await st(e)).isDirectory()?e:I.dirname(e);await Ne(s);let i=await g(s),r=await $(s),n=await this.getTasksetDraft(r.id);if(n){let c=n.metadata.importedTasksetPackage;if(c&&typeof c=="object"&&!Array.isArray(c)&&c.packageHash===i&&n.profileId===t.profileId)return n;throw new Error(`Taskset draft ${r.id} already exists. Import a package with a distinct Taskset id.`)}let f=y.parse({...r,profileId:t.profileId,modelScope:null,status:"draft",revision:1,publishedTasksetRef:null,metadata:{...r.metadata,importedTasksetPackage:{packageHash:i,importedAt:new Date().toISOString()}},updatedAt:new Date().toISOString()}),p=this.workspacePath(f.id),d=`${p}.import-${process.pid}-${Date.now()}`;await tt(I.dirname(p),{recursive:!0});try{await et(s,d,{recursive:!0,errorOnExist:!0,force:!1,preserveTimestamps:!0}),await H(f,d),await Q(d,p)}catch(c){throw await Ae(d,{recursive:!0,force:!0}),c}let l=E.parse({schemaVersion:"openpond.tasksetDraftPointer.v1",id:f.id,profileId:f.profileId,status:f.status,revision:f.revision,workspacePath:p,packageHash:await g(p),publishedTasksetRef:f.publishedTasksetRef,createdAt:f.createdAt,updatedAt:f.updatedAt});return await this.savePointer(l),this.draftFromStoredPayload(l)}async materializePublishedTasksetPackage(t){let e=await this.getTasksetDraftWorkspace(t.draftId);if(!e)throw new Error(`Taskset draft ${t.draftId} workspace was not found.`);if(t.taskset.metadata.sourcePackageHash!==void 0&&t.taskset.metadata.sourcePackageHash!==e.packageHash)throw new Error("Taskset draft files changed before publication. Refresh before publishing.");let a=`draft-${m({taskset:t.taskset,packageHash:e.packageHash})}`,s=await ke(t.taskset,e.workspacePath),i=T.parse({...s.taskset,metadata:{...s.taskset.metadata,sourcePackageHash:e.packageHash},environment:{...s.taskset.environment,metadata:{...s.taskset.environment.metadata,runtimeSourceTasksetId:a}}}),r=T.parse({...i,contentHash:_(i)}),n=await x(this.home,{taskset:r,generatedFiles:s.generatedFiles},a,{source:{directory:e.workspacePath,packageHash:e.packageHash},verify:h(p=>L(p,r),"verify")}),f=await this.getTasksetDraft(t.draftId);return f?.modelScope?.source?De({home:this.home,directory:n,taskset:r,preparation:f.modelScope.source}):{directory:n,taskset:r}}async finalizeTasksetDraftPublication(t){await this.ready;let e=y.parse(t.draft),a=T.parse(t.taskset),s=e.modelScope?.source?.authoringGraph==="bound"&&typeof a.metadata.importedPackageHash=="string"?await D(this.home,a.metadata.importedPackageHash):null,i=this.writeQueue.then(()=>P(this.home,async()=>{let r=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ?",[e.id]);if(!r)throw new Error("Taskset draft was deleted before publication.");let n=E.parse(JSON.parse(r.payload));if(n.profileId!==e.profileId||a.profileId!==e.profileId)throw new Error("Taskset publication belongs to another Profile.");if(m(n.modelScope)!==m(e.modelScope))throw new Error("Taskset draft Model ownership cannot change.");if(n.status==="published"&&n.publishedTasksetRef){let c=n.publishedTasksetRef,k=this.database.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ? AND content_hash = ?",[c.id,c.revision,c.contentHash]);if(!k)throw new Error("Published draft lost its immutable Taskset revision.");return{draft:y.parse({...e,status:n.status,revision:n.revision,publishedTasksetRef:c,updatedAt:n.updatedAt}),taskset:T.parse(JSON.parse(k.payload))}}if(n.revision!==e.revision||a.metadata.sourcePackageHash!==t.packageHash)throw new Error("Taskset draft changed before publication. Refresh before publishing.");let f=n.modelScope?.source,p=f?.authoringGraph==="bound"&&a.metadata.modelTasksetDerivation&&typeof a.metadata.modelTasksetDerivation=="object"?{...a.metadata.modelTasksetDerivation,schemaVersion:f.lineage.schemaVersion}:a.metadata.modelTasksetAuthoring;if(f&&(a.id!==f.tasksetId||a.revision!==f.tasksetRevision||m(p)!==m(f.lineage)))throw new Error("Taskset publication differs from its retained source preparation.");let d=y.parse({...e,status:"published",revision:e.revision+1,publishedTasksetRef:{id:a.id,revision:a.revision,contentHash:a.contentHash},updatedAt:new Date().toISOString()}),l=E.parse({...n,status:d.status,revision:d.revision,publishedTasksetRef:d.publishedTasksetRef,updatedAt:d.updatedAt});return we(this.database,a,()=>{if(s&&ge(this.database,{package:s,taskset:a,generatedFiles:[]}),Ee(this.database,e,a,s),this.database.get("SELECT revision FROM taskset_drafts WHERE id = ?",[e.id])?.revision!==e.revision)throw new Error("Taskset draft changed during publication.");this.database.run("UPDATE taskset_drafts SET status = ?, revision = ?, payload = ?, updated_at = ? WHERE id = ?",[l.status,l.revision,JSON.stringify(l),l.updatedAt,e.id])}),{draft:d,taskset:a}}));return this.writeQueue=i.then(()=>{},()=>{}),i}async getTasksetDraft(t){let e=await this.getParsedPayload("SELECT payload FROM taskset_drafts WHERE id = ?",[t],a=>a);return e===null?null:this.draftFromStoredPayload(e)}async listTasksetDrafts(t){await this.ready,await this.writeQueue;let e=await this.all(t?"SELECT payload FROM taskset_drafts WHERE profile_id = ? ORDER BY updated_at DESC":"SELECT payload FROM taskset_drafts ORDER BY updated_at DESC",t?[t]:[]);return Promise.all(e.map(a=>this.draftFromStoredPayload(JSON.parse(a.payload))))}async readHumanPublishedTasksetDraft(t,e){let a=(await this.listTasksetDrafts(t)).filter(r=>r.status==="published"&&r.modelScope===null&&m(r.publishedTasksetRef)===m(e));if(a.length!==1)return null;let s=a[0],i=await this.getTasksetDraftWorkspace(s.id);return i?{draft:s,workspace:i}:null}async getTasksetDraftWorkspace(t){let e=await this.getParsedPayload("SELECT payload FROM taskset_drafts WHERE id = ?",[t],s=>s);if(e===null)return null;let a=await this.pointerFromStoredPayload(e);return{draftId:a.id,workspacePath:a.workspacePath,packageHash:await g(a.workspacePath)}}async deleteTasksetDraft(t){await this.ready;let e=this.writeQueue.then(()=>P(this.home,async()=>{let a=this.workspacePath(t),s=`${a}.delete-${Ze()}`,i=!1;try{await Q(a,s),i=!0}catch(r){if(r.code!=="ENOENT")throw r}try{this.database.exec("BEGIN IMMEDIATE");try{this.database.run("DELETE FROM taskset_drafts WHERE id = ?",[t]),this.database.run("UPDATE model_taskset_draft_operations SET state = 'deleted' WHERE draft_id = ?",[t]),this.database.exec("COMMIT")}catch(r){throw this.database.exec("ROLLBACK"),r}}catch(r){throw i&&await Q(s,a).catch(()=>{}),r}i&&await Ae(s,{recursive:!0,force:!0})}));this.writeQueue=e.catch(()=>{}),await e}async tasksetDraftFiles(t,e,a){return await this.ready,P(this.home,async()=>{let s=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ? AND profile_id = ?",[e,t]);if(!s)throw new Error("Taskset draft was not found in this Profile.");let i=E.parse(JSON.parse(s.payload));if(a!==void 0){let n=await Ie(i.workspacePath,a);return{draftRevision:i.revision,file:{...n,writable:n.writable&&i.status!=="published"}}}let r=await Me(i.workspacePath);return{draftRevision:i.revision,files:r.map(n=>({...n,writable:n.writable&&i.status!=="published"}))}})}async saveTasksetDraftFile(t,e){let a=Z.parse(e);await this.ready;let s=this.writeQueue.then(()=>P(this.home,async()=>{let i=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ? AND profile_id = ?",[a.draftId,t]);if(!i)throw new Error("Taskset draft was not found in this Profile.");let r=E.parse(JSON.parse(i.payload));if(r.status==="published")throw new Error("Published Taskset drafts are immutable.");if(r.revision!==a.expectedDraftRevision)throw new Error("Taskset draft changed. Reload before saving a file.");return Oe(r.workspacePath,a,async()=>{let n=E.parse({...r,revision:r.revision+1,packageHash:await g(r.workspacePath),updatedAt:new Date().toISOString()}),f=await this.draftFromStoredPayload(n);this.database.exec("BEGIN IMMEDIATE");try{if(this.database.get("SELECT revision FROM taskset_drafts WHERE id = ? AND profile_id = ?",[a.draftId,t])?.revision!==r.revision)throw new Error("Taskset draft changed during file saving.");this.database.run("UPDATE taskset_drafts SET revision = ?, payload = ?, updated_at = ? WHERE id = ?",[n.revision,JSON.stringify(n),n.updatedAt,n.id]),this.database.exec("COMMIT")}catch(p){throw this.database.exec("ROLLBACK"),p}return f})}));return this.writeQueue=s.then(()=>{},()=>{}),s}workspacePath(t){let e=m(t).slice(0,24);return I.join(this.home,"workspaces","tasksets",`taskset-${e}`)}async draftFromStoredPayload(t){let e=await this.pointerFromStoredPayload(t),a=await $(e.workspacePath);return y.parse({...a,id:e.id,profileId:e.profileId,modelScope:e.modelScope,status:e.status,revision:e.revision,publishedTasksetRef:e.publishedTasksetRef,createdAt:e.createdAt,updatedAt:e.updatedAt})}async pointerFromStoredPayload(t){let e=E.safeParse(t);if(e.success)return e.data;let a=y.parse(t);await this.saveTasksetDraft(a);let s=await this.getParsedPayload("SELECT payload FROM taskset_drafts WHERE id = ?",[a.id],E.parse);if(!s)throw new Error(`Taskset draft ${a.id} migration failed.`);return s}async savePointer(t,e=!1){await(e?this.run.bind(this):this.upsertPayload.bind(this))(`INSERT INTO taskset_drafts (id, profile_id, status, revision, payload, created_at, updated_at)
2
+ import"./chunk-W45RKGM6.js";import{a as me}from"./chunk-D3RRUWNN.js";import{e as ke,f as Te}from"./chunk-W2SXOGTQ.js";import"./chunk-GLDYJM7O.js";import{h as F,j as x}from"./chunk-BIQ33JV5.js";import{d as N,e as ue,g as L,h as D,i as we,k as ge}from"./chunk-J24I74EM.js";import{a as H,b as g,c as $}from"./chunk-OY5HC2P6.js";import{a as he}from"./chunk-KCJVFLBB.js";import"./chunk-ZR7LIMJS.js";import"./chunk-OQPJ7FJF.js";import"./chunk-PCNLC5H3.js";import"./chunk-P7HRF4FM.js";import"./chunk-UFHLLSCE.js";import"./chunk-2ITZW2CN.js";import"./chunk-HCEJAOIF.js";import"./chunk-6GWOVHIG.js";import"./chunk-QGOPYQW3.js";import"./chunk-O4FBOUNX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-WYZWDMMF.js";import"./chunk-DG4TYVPF.js";import"./chunk-PWK5Z5S3.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-2MMCZHKL.js";import"./chunk-WGX7WY4N.js";import"./chunk-XO3H32KX.js";import"./chunk-DIGX56JY.js";import"./chunk-R7YEURUQ.js";import"./chunk-DZUAT3TP.js";import{d as de,e as ce,f as q,n as fe,p as le,q as pe}from"./chunk-H3BSIAQO.js";import{C as ne,k as y,l as se,m as re,o as ie,p as oe}from"./chunk-637UACKH.js";import{Ib as A,U as ae,b as Y,c as X,ca as O,e as B,i as Z,ua as T,xa as _}from"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import{n as ee,x as S,y as te}from"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import{e as j,f as K}from"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import{N as J,O as M}from"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import{m}from"./chunk-BIPQCJ5V.js";import{A as u}from"./chunk-PF56N7ZY.js";import{a as h}from"./chunk-FTQLQJQV.js";import{randomUUID as Ze}from"node:crypto";import{cp as et,mkdir as tt,readdir as at,rename as Q,rm as Ae,stat as st}from"node:fs/promises";import I from"node:path";function Ee(o,t,e,a){let s=t.modelScope;if(!s)return;let i=o.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[s.modelId,t.profileId]);if(!i)throw new Error("Taskset draft Model was not found in this Profile.");let r=S.parse(JSON.parse(i.payload)),n={id:e.id,revision:e.revision,contentHash:e.contentHash};return ke(o,{schemaVersion:"openpond.modelProjectSave.v1",operationId:`draft-publication:${m({draftId:t.id,revision:t.revision,scope:s,tasksetRef:n})}`,expectedRevision:s.expectedModelRevision,project:te.strip().parse({...r,trainingSetup:{...r.trainingSetup,tasksetRef:n,rewardBindingRef:e.metadata.rewardBinding===void 0?null:ee.parse(e.metadata.rewardBinding),tasksetRelease:null,recipe:null,...r.trainingSetup.evaluationTasksetRef&&r.trainingSetup.tasksetRef&&M(r.trainingSetup.evaluationTasksetRef,r.trainingSetup.tasksetRef)?{evaluationTasksetRef:n}:{}}})},null,a?.modelResources?{...a.modelResources,taskset:a.taskset,executionResources:{environment:a.environment,verifierSet:a.verifierSet}}:a??void 0)}h(Ee,"selectTasksetDraftModel");import{createHash as We,randomUUID as je}from"node:crypto";import{lstat as ve,mkdir as ye,readdir as Je,readFile as Be,rename as $e,rm as qe,writeFile as Ue}from"node:fs/promises";import R from"node:path";var b=le.extend({workspaceHash:u.string().regex(/^[a-f0-9]{64}$/).nullable()}).strict();async function Pe(o){let{db:t,profileId:e}=o,a=X.parse(o.request),s=h(()=>{let w=t.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[a.modelId,e]);if(!w)throw new Error("Taskset draft Model was not found in this Profile.");return S.parse(JSON.parse(w.payload))},"requireModel"),i=s(),r=m(a),n=t.get("SELECT request_hash, state, payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[e,a.operationId]);if(n){if(n.request_hash!==r)throw new Error("Taskset draft operation was reused with different input.");if(n.state==="deleted")throw new Error("This Taskset draft was deleted.");return b.parse(JSON.parse(n.payload))}if(!o.source)return null;if(i.revision!==a.expectedModelRevision)throw new Error("Model changed before draft initialization. Refresh before editing.");let f=i.trainingSetup.tasksetRef,p=f?t.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ? AND profile_id = ?",[f.id,f.revision,e]):null,d=p?T.parse(JSON.parse(p.payload)):null;if(!d||!f||d.contentHash!==f.contentHash)throw new Error("The selected source Taskset is unavailable.");let l=o.source,c=i.hosted?.apiOrigin?i.hosted.tasksets.find(w=>w.localTasksetId===d.id&&w.localTasksetHash===d.contentHash&&w.packageHash===l.contentHash&&w.releaseId===l.taskset.id&&w.releaseRevision===l.taskset.revision&&w.releaseHash===l.taskset.contentHash):null,k=typeof d.metadata.importedPackageHash=="string"?d.metadata.importedPackageHash:c?.packageHash;if(k?k!==l.contentHash:!M(J(A({taskset:d,adapterId:N(d)}).tasksetRelease),J(l.taskset)))throw new Error("Taskset draft package differs from its selected source.");let v=l.modelResources?ae.safeParse(l.taskset.metadata.modelTasksetDerivation):Y.safeParse(l.taskset.metadata.modelTasksetAuthoring),xe=c&&v.success&&v.data.owner.modelId===i.id?v.data.owner:{scopeId:e,modelId:i.id},Le=de({request:a,owner:xe,source:l}),Ce=pe({sourceDraft:ne(d),source:l,preparation:Le,expectedModelRevision:a.expectedModelRevision});await L(o.home,l);let G=b.parse({...Ce,workspaceHash:null}),ze=G.draft;t.exec("BEGIN IMMEDIATE");try{let w=t.get("SELECT request_hash FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[e,a.operationId]);if(w&&w.request_hash!==r)throw new Error("Taskset draft operation was reused with different input.");if(!w&&s().revision!==a.expectedModelRevision)throw new Error("Model changed during draft initialization. Refresh before editing.");t.run("INSERT INTO model_taskset_draft_operations (profile_id, operation_id, request_hash, draft_id, state, payload) VALUES (?, ?, ?, ?, 'prepared', ?) ON CONFLICT(profile_id, operation_id) DO NOTHING",[e,a.operationId,r,ze.id,JSON.stringify(G)]),t.exec("COMMIT")}catch(w){throw t.exec("ROLLBACK"),w}let W=t.get("SELECT request_hash, payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[e,a.operationId]);if(!W||W.request_hash!==r)throw new Error("Taskset draft operation was reused with different input.");return b.parse(JSON.parse(W.payload))}h(Pe,"prepareDraftInitialization");async function Se(o){let{initialized:t,workspacePath:e}=o;if(o.completed())return;if(t.workspaceHash)try{if(await ve(e),o.completed())return;if(await U(e),await g(e)!==t.workspaceHash)throw new Error("Prepared Taskset draft files changed before initialization completed.");return}catch(s){if(s.code!=="ENOENT")throw s}let a=`${e}.initializing-${je()}`;await ye(R.dirname(e),{recursive:!0});try{let s=t.draft.modelScope?.source;if(!s)throw new Error("Taskset draft lost its source preparation.");let i=await D(o.home,s.sourcePackageHash),r=new Map;for(let f of t.filePaths){let p=i.files.find(d=>d.asset.id===f.assetId);if(!p)throw new Error("Taskset draft source asset is missing.");for(let d of f.paths){if(d.includes("\\")||R.posix.isAbsolute(d)||d.split("/").some(k=>!k||k==="."||k===".."||k.startsWith(".env")))throw new Error("Taskset draft source path is invalid.");let l=r.get(d);if(l&&l!==p.asset.contentHash)throw new Error("Taskset draft source paths conflict.");if(l)continue;let c=R.join(a,d);await ye(R.dirname(c),{recursive:!0}),await Ue(c,O(p),{flag:"wx"}),r.set(d,p.asset.contentHash)}}await H(t.draft,a);for(let[f,p]of r)if(We("sha256").update(await Be(R.join(a,f))).digest("hex")!==p)throw new Error(`Taskset draft source asset conflicts with authoring file ${f}.`);let n=await g(a);if(o.retainHash({...t,workspaceHash:n}),o.completed())return;try{await $e(a,e)}catch(f){if(!["EEXIST","ENOTEMPTY"].includes(f.code??""))throw f;if(o.completed())return;if(await U(e),await g(e)!==n)throw new Error("Prepared Taskset draft files changed before initialization completed.")}}finally{await qe(a,{recursive:!0,force:!0})}}h(Se,"materializeDraftInitialization");async function U(o){let t=await ve(o);if(!t.isDirectory()||t.isSymbolicLink())throw new Error("Taskset draft source must be a regular directory.");for(let e of await Je(o,{withFileTypes:!0})){if(e.name.startsWith(".env")||e.isSymbolicLink())throw new Error("Taskset draft source contains a prohibited file.");if(e.isDirectory())await U(R.join(o,e.name));else if(!e.isFile())throw new Error("Taskset draft source must contain regular files.")}}h(U,"assertRegularTree");import Ve from"node:path";async function De(o){let t=A({taskset:o.taskset,adapterId:N(o.taskset)}),e=await ge({root:o.directory,content:{schemaVersion:"openpond.tasksetPackage.v1",taskset:t.tasksetRelease,environment:t.environmentRelease,verifierSet:t.verifierSetRelease},sources:q.parse(o.taskset.metadata.portableFileInventory??[])}),a=o.preparation.authoringGraph==="bound"?await D(o.home,o.preparation.sourcePackageHash):void 0,s=ce({preparation:o.preparation,edited:e,source:a});if(s.modelResources){let c=fe({package:s,profileId:o.taskset.profileId,name:o.taskset.name,createdAt:o.taskset.createdAt}),k=T.parse({...c.taskset,authoringProvenance:o.taskset.authoringProvenance,metadata:{...c.taskset.metadata,sourcePackageHash:o.taskset.metadata.sourcePackageHash}}),v=T.parse({...k,contentHash:_(k)});return await we({home:o.home,...c,taskset:v}),{taskset:v,directory:Ve.join(o.home,"training","tasksets",String(v.environment.metadata.runtimeSourceTasksetId))}}let i=q.parse(o.taskset.metadata.portableFileInventory??[]),r=s.files.map(c=>({asset:c.asset,sourcePath:i.find(k=>k.asset.id===c.asset.id)?.sourcePath??c.asset.path})),n=s.taskset.environment.entrypoint==="openpond.javascript-environment.v1"?s.files.find(c=>c.asset.path==="environment/execution.json"):void 0,f=`model-draft-${m({packageHash:s.contentHash,taskset:o.taskset})}`,p=T.parse({...o.taskset,id:s.taskset.id,revision:s.taskset.revision,metadata:{...o.taskset.metadata,portableFileInventory:r,importedPackageHash:s.contentHash,derivedPortableMetadata:s.taskset.metadata},environment:{...o.taskset.environment,metadata:{...o.taskset.environment.metadata,runtimeSourceTasksetId:f,portableExecutionResources:{environment:s.environment,verifierSet:s.verifierSet}}}}),d=T.parse({...p,contentHash:_(p)}),l=await F(o.home,{taskset:d,generatedFiles:n?[{path:n.asset.path,role:"environment",content:new TextDecoder("utf-8",{fatal:!0}).decode(O(n))}]:[]},f,{source:{directory:o.directory,packageHash:await g(o.directory)},verify:h(c=>x(c,d),"verify")});return await L(o.home,s),{directory:l,taskset:d}}h(De,"materializeModelTasksetDraftPublication");import{constants as V}from"node:fs";import{createHash as Qe}from"node:crypto";import{lstat as be,mkdir as Ge,open as Ke,readdir as Ye,rm as Re}from"node:fs/promises";import C from"node:path";var P=h((o,t)=>K(C.join(o,"state","taskset-draft-writes"),t),"withTasksetDraftLock"),_e=re,Xe=h(o=>Qe("sha256").update(o).digest("hex"),"digest");async function z(o,t,e=!1){B.parse(t);let a=o;for(let s of["",...t.split("/").slice(0,-1)]){s&&(a=C.join(a,s)),e&&await Ge(a,{recursive:!1}).catch(r=>{if(r.code!=="EEXIST")throw r});let i=await be(a);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Taskset draft paths must use regular directories.")}return C.join(o,t)}h(z,"regularPath");async function He(o,t){let e=await z(o,t),a=await Ke(e,V.O_RDONLY|V.O_NOFOLLOW|V.O_NONBLOCK);try{let s=await a.stat();if(!s.isFile()||s.size>se)throw new Error("Taskset draft file must be a regular file within the 6 MB editing limit.");let i=Buffer.alloc(s.size),r=0;for(;r<i.length;){let n=await a.read(i,r,i.length-r,r);if(!n.bytesRead)throw new Error("Taskset draft file changed during reading.");r+=n.bytesRead}if((await a.read(Buffer.alloc(1),0,1,r)).bytesRead)throw new Error("Taskset draft file changed during reading.");return i}finally{await a.close()}}h(He,"readBytes");async function Ie(o,t){let e=await He(o,t);return ie(t,e)}h(Ie,"readTasksetDraftFile");async function Me(o){let t=[];async function e(a=""){for(let s of await Ye(C.join(o,a),{withFileTypes:!0})){let i=a?`${a}/${s.name}`:s.name;if(B.parse(i),s.isSymbolicLink())throw new Error("Taskset draft files cannot contain symbolic links.");if(s.isDirectory()){await e(i);continue}if(!s.isFile())throw new Error("Taskset draft files must be regular files.");if(t.length>=1e4)throw new Error("Taskset draft file inventory exceeds its limit.");let r=await be(await z(o,i));if(!r.isFile()||r.isSymbolicLink())throw new Error("Taskset draft files must be regular files.");t.push({path:i,sizeBytes:r.size,writable:_e(i)})}}return h(e,"visit"),await z(o,"taskset.json"),await e(),t.sort((a,s)=>a.path.localeCompare(s.path))}h(Me,"listTasksetDraftFiles");async function Oe(o,t,e){if(!_e(t.path))throw new Error("This file is managed by the Taskset forms or retained source history.");let a=null;try{a=await He(o,t.path)}catch(r){if(r.code!=="ENOENT")throw r}if((a?Xe(a):null)!==t.expectedFileHash)throw new Error("Taskset draft file changed. Reload it before saving.");if(!a&&t.content===null)throw new Error("Taskset draft file does not exist.");let s=t.content?oe(t.content):null,i=await z(o,t.path,!0);s?await j(i,s):await Re(i);try{return await e()}catch(r){throw a?await j(i,a):await Re(i,{force:!0}),r}}h(Oe,"mutateTasksetDraftFile");var E=u.object({schemaVersion:u.literal("openpond.tasksetDraftPointer.v1"),id:u.string().trim().min(1),profileId:u.string().trim().min(1),modelScope:y.shape.modelScope,status:u.enum(["draft","validating","needs_review","published"]),revision:u.number().int().positive(),workspacePath:u.string().trim().min(1),packageHash:u.string().regex(/^[a-f0-9]{64}$/),publishedTasksetRef:u.object({id:u.string().trim().min(1),revision:u.number().int().positive(),contentHash:u.string().trim().min(8)}).nullable(),createdAt:u.string().trim().min(1),updatedAt:u.string().trim().min(1)}),Fe=class extends he{static{h(this,"SqliteTasksetDraftStore")}async initializeModelTasksetDraft(t,e,a){await this.ready;let s=this.writeQueue.then(()=>P(this.home,async()=>{let i=this.database,r=await Pe({db:i,home:this.home,profileId:t,request:e,source:a});if(!r)return null;let n=h(()=>{let d=i.get("SELECT state FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[t,e.operationId]);if(d?.state==="deleted")throw new Error("This Taskset draft was deleted.");let l=i.get("SELECT payload FROM taskset_drafts WHERE id = ?",[r.draft.id]);if(!l){if(d?.state==="ready")throw new Error("The initialized Taskset draft is unavailable.");return!1}let c=E.parse(JSON.parse(l.payload));if(c.profileId!==t||c.modelScope?.source?.requestHash!==r.draft.modelScope?.source?.requestHash)throw new Error("Taskset draft identity conflicts with its initialization.");return!0},"completed"),f=this.workspacePath(r.draft.id);await Se({home:this.home,initialized:r,workspacePath:f,completed:n,retainHash:h(d=>{let l=i.get("SELECT payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[t,e.operationId]),c=b.parse(JSON.parse(l.payload));if(c.workspaceHash&&c.workspaceHash!==d.workspaceHash)throw new Error("Taskset draft initialization produced different files on retry.");i.run("UPDATE model_taskset_draft_operations SET payload = ? WHERE profile_id = ? AND operation_id = ? AND state = 'prepared'",[JSON.stringify(d),t,e.operationId])},"retainHash")}),i.exec("BEGIN IMMEDIATE");try{if(!n()){let d=i.get("SELECT payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[t,e.operationId]),l=b.parse(JSON.parse(d.payload)),c=l.draft,k=E.parse({schemaVersion:"openpond.tasksetDraftPointer.v1",id:c.id,profileId:t,modelScope:c.modelScope,status:c.status,revision:c.revision,workspacePath:f,packageHash:l.workspaceHash,publishedTasksetRef:c.publishedTasksetRef,createdAt:c.createdAt,updatedAt:c.updatedAt});i.run("INSERT INTO taskset_drafts (id, profile_id, status, revision, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)",[c.id,t,c.status,c.revision,JSON.stringify(k),c.createdAt,c.updatedAt]),i.run("UPDATE model_taskset_draft_operations SET state = 'ready' WHERE profile_id = ? AND operation_id = ?",[t,e.operationId])}i.exec("COMMIT")}catch(d){throw i.exec("ROLLBACK"),d}let p=i.get("SELECT payload FROM taskset_drafts WHERE id = ?",[r.draft.id]);return this.draftFromStoredPayload(JSON.parse(p.payload))}));return this.writeQueue=s.then(()=>{},()=>{}),s}async saveTasksetDraft(t,e,a={}){let s=y.parse(t);await this.ready;let i=this.writeQueue.then(()=>P(this.home,async()=>{let r=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ?",[s.id]),n=r?E.safeParse(JSON.parse(r.payload)):null;if(n?.success){if(n.data.profileId!==s.profileId)throw new Error("Taskset draft profile cannot change.");if(m(n.data.modelScope?{...n.data.modelScope,expectedModelRevision:0}:null)!==m(s.modelScope?{...s.modelScope,expectedModelRevision:0}:null)||!a.refreshModelRevision&&m(n.data.modelScope)!==m(s.modelScope))throw new Error("Taskset draft Model ownership cannot change.");if(n.data.status==="published")throw new Error("Published Taskset drafts are immutable. Initialize a new draft to revise the Taskset.");if(s.revision<n.data.revision||e!==void 0&&n.data.revision!==e)throw new Error("Taskset draft changed before saving. Refresh before saving.")}else if(e!==void 0)throw new Error("Taskset draft is unavailable for saving.");if((!n?.success||a.refreshModelRevision)&&s.modelScope){let c=this.database.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[s.modelScope.modelId,s.profileId]);if(!c)throw new Error("Taskset draft Model was not found in this Profile.");if(S.parse(JSON.parse(c.payload)).revision!==s.modelScope.expectedModelRevision)throw new Error("Taskset draft Model changed. Refresh before editing.")}let f=this.workspacePath(s.id),d=(await H(s,f)).draft,l=E.parse({schemaVersion:"openpond.tasksetDraftPointer.v1",id:d.id,profileId:d.profileId,modelScope:d.modelScope,status:d.status,revision:d.revision,workspacePath:f,packageHash:await g(f),publishedTasksetRef:d.publishedTasksetRef,createdAt:d.createdAt,updatedAt:d.updatedAt});return await this.savePointer(l,!0),d}));return this.writeQueue=i.then(()=>{},()=>{}),i}async importTasksetDraftPackage(t){let e=I.resolve(t.packagePath),s=(await st(e)).isDirectory()?e:I.dirname(e);await Ne(s);let i=await g(s),r=await $(s),n=await this.getTasksetDraft(r.id);if(n){let c=n.metadata.importedTasksetPackage;if(c&&typeof c=="object"&&!Array.isArray(c)&&c.packageHash===i&&n.profileId===t.profileId)return n;throw new Error(`Taskset draft ${r.id} already exists. Import a package with a distinct Taskset id.`)}let f=y.parse({...r,profileId:t.profileId,modelScope:null,status:"draft",revision:1,publishedTasksetRef:null,metadata:{...r.metadata,importedTasksetPackage:{packageHash:i,importedAt:new Date().toISOString()}},updatedAt:new Date().toISOString()}),p=this.workspacePath(f.id),d=`${p}.import-${process.pid}-${Date.now()}`;await tt(I.dirname(p),{recursive:!0});try{await et(s,d,{recursive:!0,errorOnExist:!0,force:!1,preserveTimestamps:!0}),await H(f,d),await Q(d,p)}catch(c){throw await Ae(d,{recursive:!0,force:!0}),c}let l=E.parse({schemaVersion:"openpond.tasksetDraftPointer.v1",id:f.id,profileId:f.profileId,status:f.status,revision:f.revision,workspacePath:p,packageHash:await g(p),publishedTasksetRef:f.publishedTasksetRef,createdAt:f.createdAt,updatedAt:f.updatedAt});return await this.savePointer(l),this.draftFromStoredPayload(l)}async materializePublishedTasksetPackage(t){let e=await this.getTasksetDraftWorkspace(t.draftId);if(!e)throw new Error(`Taskset draft ${t.draftId} workspace was not found.`);if(t.taskset.metadata.sourcePackageHash!==void 0&&t.taskset.metadata.sourcePackageHash!==e.packageHash)throw new Error("Taskset draft files changed before publication. Refresh before publishing.");let a=`draft-${m({taskset:t.taskset,packageHash:e.packageHash})}`,s=await ue(t.taskset,e.workspacePath),i=T.parse({...s.taskset,metadata:{...s.taskset.metadata,sourcePackageHash:e.packageHash},environment:{...s.taskset.environment,metadata:{...s.taskset.environment.metadata,runtimeSourceTasksetId:a}}}),r=T.parse({...i,contentHash:_(i)}),n=await F(this.home,{taskset:r,generatedFiles:s.generatedFiles},a,{source:{directory:e.workspacePath,packageHash:e.packageHash},verify:h(p=>x(p,r),"verify")}),f=await this.getTasksetDraft(t.draftId);return f?.modelScope?.source?De({home:this.home,directory:n,taskset:r,preparation:f.modelScope.source}):{directory:n,taskset:r}}async finalizeTasksetDraftPublication(t){await this.ready;let e=y.parse(t.draft),a=T.parse(t.taskset),s=e.modelScope?.source?.authoringGraph==="bound"&&typeof a.metadata.importedPackageHash=="string"?await D(this.home,a.metadata.importedPackageHash):null,i=this.writeQueue.then(()=>P(this.home,async()=>{let r=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ?",[e.id]);if(!r)throw new Error("Taskset draft was deleted before publication.");let n=E.parse(JSON.parse(r.payload));if(n.profileId!==e.profileId||a.profileId!==e.profileId)throw new Error("Taskset publication belongs to another Profile.");if(m(n.modelScope)!==m(e.modelScope))throw new Error("Taskset draft Model ownership cannot change.");if(n.status==="published"&&n.publishedTasksetRef){let c=n.publishedTasksetRef,k=this.database.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ? AND content_hash = ?",[c.id,c.revision,c.contentHash]);if(!k)throw new Error("Published draft lost its immutable Taskset revision.");return{draft:y.parse({...e,status:n.status,revision:n.revision,publishedTasksetRef:c,updatedAt:n.updatedAt}),taskset:T.parse(JSON.parse(k.payload))}}if(n.revision!==e.revision||a.metadata.sourcePackageHash!==t.packageHash)throw new Error("Taskset draft changed before publication. Refresh before publishing.");let f=n.modelScope?.source,p=f?.authoringGraph==="bound"&&a.metadata.modelTasksetDerivation&&typeof a.metadata.modelTasksetDerivation=="object"?{...a.metadata.modelTasksetDerivation,schemaVersion:f.lineage.schemaVersion}:a.metadata.modelTasksetAuthoring;if(f&&(a.id!==f.tasksetId||a.revision!==f.tasksetRevision||m(p)!==m(f.lineage)))throw new Error("Taskset publication differs from its retained source preparation.");let d=y.parse({...e,status:"published",revision:e.revision+1,publishedTasksetRef:{id:a.id,revision:a.revision,contentHash:a.contentHash},updatedAt:new Date().toISOString()}),l=E.parse({...n,status:d.status,revision:d.revision,publishedTasksetRef:d.publishedTasksetRef,updatedAt:d.updatedAt});return me(this.database,a,()=>{if(s&&Te(this.database,{package:s,taskset:a,generatedFiles:[]}),Ee(this.database,e,a,s),this.database.get("SELECT revision FROM taskset_drafts WHERE id = ?",[e.id])?.revision!==e.revision)throw new Error("Taskset draft changed during publication.");this.database.run("UPDATE taskset_drafts SET status = ?, revision = ?, payload = ?, updated_at = ? WHERE id = ?",[l.status,l.revision,JSON.stringify(l),l.updatedAt,e.id])}),{draft:d,taskset:a}}));return this.writeQueue=i.then(()=>{},()=>{}),i}async getTasksetDraft(t){let e=await this.getParsedPayload("SELECT payload FROM taskset_drafts WHERE id = ?",[t],a=>a);return e===null?null:this.draftFromStoredPayload(e)}async listTasksetDrafts(t){await this.ready,await this.writeQueue;let e=await this.all(t?"SELECT payload FROM taskset_drafts WHERE profile_id = ? ORDER BY updated_at DESC":"SELECT payload FROM taskset_drafts ORDER BY updated_at DESC",t?[t]:[]);return Promise.all(e.map(a=>this.draftFromStoredPayload(JSON.parse(a.payload))))}async readHumanPublishedTasksetDraft(t,e){let a=(await this.listTasksetDrafts(t)).filter(r=>r.status==="published"&&r.modelScope===null&&m(r.publishedTasksetRef)===m(e));if(a.length!==1)return null;let s=a[0],i=await this.getTasksetDraftWorkspace(s.id);return i?{draft:s,workspace:i}:null}async getTasksetDraftWorkspace(t){let e=await this.getParsedPayload("SELECT payload FROM taskset_drafts WHERE id = ?",[t],s=>s);if(e===null)return null;let a=await this.pointerFromStoredPayload(e);return{draftId:a.id,workspacePath:a.workspacePath,packageHash:await g(a.workspacePath)}}async deleteTasksetDraft(t){await this.ready;let e=this.writeQueue.then(()=>P(this.home,async()=>{let a=this.workspacePath(t),s=`${a}.delete-${Ze()}`,i=!1;try{await Q(a,s),i=!0}catch(r){if(r.code!=="ENOENT")throw r}try{this.database.exec("BEGIN IMMEDIATE");try{this.database.run("DELETE FROM taskset_drafts WHERE id = ?",[t]),this.database.run("UPDATE model_taskset_draft_operations SET state = 'deleted' WHERE draft_id = ?",[t]),this.database.exec("COMMIT")}catch(r){throw this.database.exec("ROLLBACK"),r}}catch(r){throw i&&await Q(s,a).catch(()=>{}),r}i&&await Ae(s,{recursive:!0,force:!0})}));this.writeQueue=e.catch(()=>{}),await e}async tasksetDraftFiles(t,e,a){return await this.ready,P(this.home,async()=>{let s=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ? AND profile_id = ?",[e,t]);if(!s)throw new Error("Taskset draft was not found in this Profile.");let i=E.parse(JSON.parse(s.payload));if(a!==void 0){let n=await Ie(i.workspacePath,a);return{draftRevision:i.revision,file:{...n,writable:n.writable&&i.status!=="published"}}}let r=await Me(i.workspacePath);return{draftRevision:i.revision,files:r.map(n=>({...n,writable:n.writable&&i.status!=="published"}))}})}async saveTasksetDraftFile(t,e){let a=Z.parse(e);await this.ready;let s=this.writeQueue.then(()=>P(this.home,async()=>{let i=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ? AND profile_id = ?",[a.draftId,t]);if(!i)throw new Error("Taskset draft was not found in this Profile.");let r=E.parse(JSON.parse(i.payload));if(r.status==="published")throw new Error("Published Taskset drafts are immutable.");if(r.revision!==a.expectedDraftRevision)throw new Error("Taskset draft changed. Reload before saving a file.");return Oe(r.workspacePath,a,async()=>{let n=E.parse({...r,revision:r.revision+1,packageHash:await g(r.workspacePath),updatedAt:new Date().toISOString()}),f=await this.draftFromStoredPayload(n);this.database.exec("BEGIN IMMEDIATE");try{if(this.database.get("SELECT revision FROM taskset_drafts WHERE id = ? AND profile_id = ?",[a.draftId,t])?.revision!==r.revision)throw new Error("Taskset draft changed during file saving.");this.database.run("UPDATE taskset_drafts SET revision = ?, payload = ?, updated_at = ? WHERE id = ?",[n.revision,JSON.stringify(n),n.updatedAt,n.id]),this.database.exec("COMMIT")}catch(p){throw this.database.exec("ROLLBACK"),p}return f})}));return this.writeQueue=s.then(()=>{},()=>{}),s}workspacePath(t){let e=m(t).slice(0,24);return I.join(this.home,"workspaces","tasksets",`taskset-${e}`)}async draftFromStoredPayload(t){let e=await this.pointerFromStoredPayload(t),a=await $(e.workspacePath);return y.parse({...a,id:e.id,profileId:e.profileId,modelScope:e.modelScope,status:e.status,revision:e.revision,publishedTasksetRef:e.publishedTasksetRef,createdAt:e.createdAt,updatedAt:e.updatedAt})}async pointerFromStoredPayload(t){let e=E.safeParse(t);if(e.success)return e.data;let a=y.parse(t);await this.saveTasksetDraft(a);let s=await this.getParsedPayload("SELECT payload FROM taskset_drafts WHERE id = ?",[a.id],E.parse);if(!s)throw new Error(`Taskset draft ${a.id} migration failed.`);return s}async savePointer(t,e=!1){await(e?this.run.bind(this):this.upsertPayload.bind(this))(`INSERT INTO taskset_drafts (id, profile_id, status, revision, payload, created_at, updated_at)
3
3
  VALUES (?, ?, ?, ?, ?, ?, ?)
4
4
  ON CONFLICT(id) DO UPDATE SET
5
5
  profile_id = excluded.profile_id,
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as A}from"./chunk-WC42WOLG.js";import{a as M}from"./chunk-PY6K2JRH.js";import{d as N}from"./chunk-57TRXBLT.js";import"./chunk-DMFUEUAZ.js";import"./chunk-2RNQQNB7.js";import"./chunk-OQPJ7FJF.js";import"./chunk-EUMXMT3S.js";import"./chunk-Q4TBTRIG.js";import"./chunk-T5AACNJI.js";import"./chunk-TKLBP3MM.js";import"./chunk-RBZH6A6M.js";import"./chunk-DIO5CB6U.js";import"./chunk-7ED24PP6.js";import{a as L}from"./chunk-KCJVFLBB.js";import"./chunk-N4FFQPLR.js";import"./chunk-AY64VY4E.js";import"./chunk-GJ2ZJFDD.js";import"./chunk-3QIB5FXI.js";import"./chunk-6MI4KKWF.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-CGWA54LE.js";import"./chunk-KO3HNMLJ.js";import"./chunk-MQULU465.js";import{A as g,B as C,h as l,i as k,l as _,r as O,s as T,t as w,u as f,v as I}from"./chunk-JMBQYBPI.js";import"./chunk-LPWBIGKW.js";import"./chunk-DZUAT3TP.js";import"./chunk-H7ATCPPB.js";import"./chunk-25JDHAZ5.js";import{B as p,sa as S,ua as m}from"./chunk-XMKCCLGB.js";import"./chunk-WN3V6KDN.js";import"./chunk-523TE4BI.js";import"./chunk-ZCHXGRRU.js";import"./chunk-YBT2NB32.js";import"./chunk-74ZXXBGN.js";import"./chunk-APB2STJK.js";import"./chunk-Y4OWBBDD.js";import"./chunk-6ZFPQYHG.js";import"./chunk-JFXWI3EN.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z4Z5UOZM.js";import"./chunk-FFRFSDBM.js";import"./chunk-VYLGI3IH.js";import"./chunk-ACYFMLWG.js";import"./chunk-TVQAPBLZ.js";import"./chunk-KGNCKIFP.js";import"./chunk-ES2ISFJC.js";import{a as o}from"./chunk-FTQLQJQV.js";function h(s,t,a,e,n,r,d){return{schemaVersion:"openpond.trainingChatSearchResult.v1",query:s,offset:t,limit:a,total:e,hasMore:t+n.length<e,indexedChats:r,totalChats:d,indexing:r<d,entries:n.map(i=>({sessionId:i.session_id,title:i.title,updatedAt:i.updated_at,snippet:i.snippet?.trim()||null}))}}o(h,"trainingChatSearchResult");function P(s){let t=s.normalize("NFKC").match(/[\p{L}\p{N}_]+/gu)?.slice(0,24)??[];return t.length?t.map(a=>`"${a.replaceAll('"','""')}"*`).join(" AND "):null}o(P,"trainingChatFtsQuery");function D(s,t,a){let e=s.get(t)??[];e.push(a),s.set(t,e)}o(D,"appendTrainingChatSearchText");var F=class extends L{static{o(this,"SqliteTrainingStore")}async trainingChatSearchSignatures(t){await this.ready,await this.writeQueue;let a=await this.all("SELECT session_id, signature FROM training_chat_search_documents WHERE source = ?",[t]);return new Map(a.map(e=>[e.session_id,e.signature]))}async openPondTrainingChatSearchEvidence(t){await this.ready,await this.writeQueue;let a=[...new Set(t)].slice(0,500);if(!a.length)return[];let e=a.map(()=>"?").join(", "),[n,r,d]=await Promise.all([this.all(`SELECT payload FROM projection_session_shells WHERE id IN (${e})`,a),this.all(`SELECT session_id, payload FROM turns WHERE session_id IN (${e}) ORDER BY sort_index ASC`,a),this.all(`SELECT session_id, payload FROM events
2
+ import{a as A}from"./chunk-D3RRUWNN.js";import{a as M}from"./chunk-ITKTILKI.js";import"./chunk-DMFUEUAZ.js";import{a as L}from"./chunk-KCJVFLBB.js";import{d as N}from"./chunk-FSQWAANK.js";import"./chunk-ZR7LIMJS.js";import"./chunk-OQPJ7FJF.js";import"./chunk-PCNLC5H3.js";import"./chunk-P7HRF4FM.js";import"./chunk-UFHLLSCE.js";import"./chunk-2ITZW2CN.js";import"./chunk-HCEJAOIF.js";import"./chunk-6GWOVHIG.js";import"./chunk-QGOPYQW3.js";import"./chunk-O4FBOUNX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-WYZWDMMF.js";import"./chunk-DG4TYVPF.js";import"./chunk-PWK5Z5S3.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-2MMCZHKL.js";import"./chunk-WGX7WY4N.js";import"./chunk-XO3H32KX.js";import{A as g,B as C,h as l,i as k,l as _,r as O,s as T,t as w,u as f,v as I}from"./chunk-DIGX56JY.js";import"./chunk-R7YEURUQ.js";import"./chunk-DZUAT3TP.js";import"./chunk-H3BSIAQO.js";import"./chunk-637UACKH.js";import{B as p,sa as S,ua as m}from"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as o}from"./chunk-FTQLQJQV.js";function h(s,t,a,e,n,r,d){return{schemaVersion:"openpond.trainingChatSearchResult.v1",query:s,offset:t,limit:a,total:e,hasMore:t+n.length<e,indexedChats:r,totalChats:d,indexing:r<d,entries:n.map(i=>({sessionId:i.session_id,title:i.title,updatedAt:i.updated_at,snippet:i.snippet?.trim()||null}))}}o(h,"trainingChatSearchResult");function P(s){let t=s.normalize("NFKC").match(/[\p{L}\p{N}_]+/gu)?.slice(0,24)??[];return t.length?t.map(a=>`"${a.replaceAll('"','""')}"*`).join(" AND "):null}o(P,"trainingChatFtsQuery");function D(s,t,a){let e=s.get(t)??[];e.push(a),s.set(t,e)}o(D,"appendTrainingChatSearchText");var F=class extends L{static{o(this,"SqliteTrainingStore")}async trainingChatSearchSignatures(t){await this.ready,await this.writeQueue;let a=await this.all("SELECT session_id, signature FROM training_chat_search_documents WHERE source = ?",[t]);return new Map(a.map(e=>[e.session_id,e.signature]))}async openPondTrainingChatSearchEvidence(t){await this.ready,await this.writeQueue;let a=[...new Set(t)].slice(0,500);if(!a.length)return[];let e=a.map(()=>"?").join(", "),[n,r,d]=await Promise.all([this.all(`SELECT payload FROM projection_session_shells WHERE id IN (${e})`,a),this.all(`SELECT session_id, payload FROM turns WHERE session_id IN (${e}) ORDER BY sort_index ASC`,a),this.all(`SELECT session_id, payload FROM events
3
3
  WHERE name = 'assistant.delta' AND session_id IN (${e})
4
4
  ORDER BY sequence ASC`,a)]),i=new Map;for(let u of r){let c=JSON.parse(u.payload);c.prompt.trim()&&D(i,u.session_id,c.prompt)}for(let u of d){let c=JSON.parse(u.payload);c.output?.trim()&&D(i,u.session_id,c.output)}return n.map(u=>{let c=M(JSON.parse(u.payload));return{session:c,body:i.get(c.id)?.join(`
5
5
  `)??""}})}async syncTrainingChatSearchDocuments(t,a){await this.ready;let e=this.writeQueue.then(async()=>{let n=await this.all("SELECT session_id, signature FROM training_chat_search_documents WHERE source = ?",[t]),r=new Map(n.map(i=>[i.session_id,i.signature])),d=new Set(a.map(i=>i.sessionId));await this.exec("BEGIN IMMEDIATE");try{for(let i of r.keys())d.has(i)||(await this.run("DELETE FROM training_chat_search_fts WHERE session_id = ?",[i]),await this.run("DELETE FROM training_chat_search_documents WHERE session_id = ?",[i]));for(let i of a)r.get(i.sessionId)!==i.signature&&(await this.run("DELETE FROM training_chat_search_fts WHERE session_id = ?",[i.sessionId]),await this.run(`INSERT INTO training_chat_search_documents (session_id, source, signature, title, updated_at, eligible, body_indexed)
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as u}from"./chunk-OUVIWDL2.js";import"./chunk-2RNQQNB7.js";import"./chunk-OQPJ7FJF.js";import"./chunk-EUMXMT3S.js";import"./chunk-Q4TBTRIG.js";import"./chunk-T5AACNJI.js";import{$ as E,D as S,aa as c,ba as o,ea as _,ga as s,ha as T,na as p,oa as g}from"./chunk-TKLBP3MM.js";import"./chunk-RBZH6A6M.js";import"./chunk-DIO5CB6U.js";import"./chunk-7ED24PP6.js";import{a as f}from"./chunk-KCJVFLBB.js";import"./chunk-N4FFQPLR.js";import"./chunk-AY64VY4E.js";import"./chunk-GJ2ZJFDD.js";import"./chunk-3QIB5FXI.js";import"./chunk-6MI4KKWF.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-CGWA54LE.js";import"./chunk-KO3HNMLJ.js";import"./chunk-MQULU465.js";import"./chunk-JMBQYBPI.js";import"./chunk-LPWBIGKW.js";import"./chunk-DZUAT3TP.js";import"./chunk-H7ATCPPB.js";import"./chunk-25JDHAZ5.js";import"./chunk-XMKCCLGB.js";import"./chunk-WN3V6KDN.js";import"./chunk-523TE4BI.js";import"./chunk-ZCHXGRRU.js";import"./chunk-YBT2NB32.js";import"./chunk-74ZXXBGN.js";import"./chunk-APB2STJK.js";import"./chunk-Y4OWBBDD.js";import"./chunk-6ZFPQYHG.js";import"./chunk-JFXWI3EN.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z4Z5UOZM.js";import"./chunk-FFRFSDBM.js";import"./chunk-VYLGI3IH.js";import"./chunk-ACYFMLWG.js";import"./chunk-TVQAPBLZ.js";import"./chunk-KGNCKIFP.js";import"./chunk-ES2ISFJC.js";import{a as d}from"./chunk-FTQLQJQV.js";var l="('openpond_managed')",P=class extends f{static{d(this,"SqliteTrainingJobsStore")}async saveModelProject(t){let a=E.parse(t);return await this.upsertPayload(`INSERT INTO model_projects (id, profile_id, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
2
+ import{a as u}from"./chunk-AGVOGPAZ.js";import{a as S}from"./chunk-KCJVFLBB.js";import"./chunk-ZR7LIMJS.js";import"./chunk-OQPJ7FJF.js";import"./chunk-PCNLC5H3.js";import"./chunk-P7HRF4FM.js";import{$ as E,D as f,aa as c,ba as o,ea as _,ga as s,ha as T,na as p,oa as g}from"./chunk-UFHLLSCE.js";import"./chunk-2ITZW2CN.js";import"./chunk-HCEJAOIF.js";import"./chunk-6GWOVHIG.js";import"./chunk-QGOPYQW3.js";import"./chunk-O4FBOUNX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-WYZWDMMF.js";import"./chunk-DG4TYVPF.js";import"./chunk-PWK5Z5S3.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-2MMCZHKL.js";import"./chunk-WGX7WY4N.js";import"./chunk-XO3H32KX.js";import"./chunk-DIGX56JY.js";import"./chunk-R7YEURUQ.js";import"./chunk-DZUAT3TP.js";import"./chunk-H3BSIAQO.js";import"./chunk-637UACKH.js";import"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as d}from"./chunk-FTQLQJQV.js";var l="('openpond_managed')",P=class extends S{static{d(this,"SqliteTrainingJobsStore")}async saveModelProject(t){let a=E.parse(t);return await this.upsertPayload(`INSERT INTO model_projects (id, profile_id, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
3
3
  ON CONFLICT(id) DO UPDATE SET profile_id = excluded.profile_id, payload = excluded.payload, updated_at = excluded.updated_at`,[a.id,a.profileId,JSON.stringify(a),a.createdAt,a.updatedAt]),a}async getModelProject(t){return this.getParsedPayload("SELECT payload FROM model_projects WHERE id = ?",[t],h)}async listModelProjects(t){return this.listParsedPayloads(t?"SELECT payload FROM model_projects WHERE profile_id = ? ORDER BY updated_at DESC":"SELECT payload FROM model_projects ORDER BY updated_at DESC",t?[t]:[],h)}async saveTrainingPlan(t){let a=c.parse(t),e=await this.getTrainingPlan(a.id);if(e&&e.contentHash!==a.contentHash)throw new Error(`Training Plan ${a.id} is immutable and already has different content.`);return await this.upsertPayload(`INSERT INTO training_plans (id, taskset_id, destination_id, payload, created_at) VALUES (?, ?, ?, ?, ?)
4
4
  ON CONFLICT(id) DO UPDATE SET taskset_id = excluded.taskset_id, destination_id = excluded.destination_id, payload = excluded.payload`,[a.id,a.tasksetId,a.destinationId,JSON.stringify(a),a.createdAt]),a}async listTrainingPlans(t){return this.listParsedPayloads(t?`SELECT payload FROM training_plans WHERE taskset_id = ? AND destination_id IN ${l} ORDER BY created_at DESC`:`SELECT payload FROM training_plans WHERE destination_id IN ${l} ORDER BY created_at DESC`,t?[t]:[],c.parse)}async getTrainingPlan(t){return this.getParsedPayload(`SELECT payload FROM training_plans WHERE id = ? AND destination_id IN ${l}`,[t],c.parse)}async saveTrainingBundle(t){let a=o.parse(t);return await this.upsertPayload(`INSERT INTO training_bundles (id, plan_id, content_hash, payload, created_at) VALUES (?, ?, ?, ?, ?)
5
5
  ON CONFLICT(id) DO UPDATE SET plan_id = excluded.plan_id, content_hash = excluded.content_hash, payload = excluded.payload`,[a.id,a.planId,a.contentHash,JSON.stringify(a),a.createdAt]),a}async getTrainingBundle(t){return this.getParsedPayload("SELECT payload FROM training_bundles WHERE id = ?",[t],o.parse)}async listTrainingBundles(t){return this.listParsedPayloads(t?"SELECT payload FROM training_bundles WHERE plan_id = ? ORDER BY created_at DESC":"SELECT payload FROM training_bundles ORDER BY created_at DESC",t?[t]:[],o.parse)}async findTrainingBundleByPlanAndHash(t,a){return this.getParsedPayload("SELECT payload FROM training_bundles WHERE plan_id = ? AND content_hash = ?",[t,a],o.parse)}async saveTrainingJob(t){let a=s.parse(t),e=await this.getTrainingJob(a.id),n=e?.metadata.activityAuthority,r=a.metadata.activityAuthority;if(n!==void 0){let A=u.parse(n);if(r!==void 0&&JSON.stringify(u.parse(r))!==JSON.stringify(A))throw new Error("Training activity ownership cannot change during reconciliation.");a={...a,metadata:{...a.metadata,activityAuthority:A}}}else if(r!==void 0){if(e)throw new Error("Historical training activity cannot be assigned a guessed owner.");a={...a,metadata:{...a.metadata,activityAuthority:u.parse(r)}}}await this.upsertPayload(`INSERT INTO training_jobs (id, plan_id, destination_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)
@@ -16,4 +16,4 @@ import{a as u}from"./chunk-OUVIWDL2.js";import"./chunk-2RNQQNB7.js";import"./chu
16
16
  ORDER BY updated_at DESC,id DESC LIMIT ?`,[t.teamId,t.actorId,...t.projectId?[t.projectId]:[],Math.min(100,Math.max(1,t.limit??100))]);return{count:Number(a[0]?.total??0),items:a.map(e=>{let n=s.parse(JSON.parse(e.payload)),r=typeof n.metadata.modelProjectId=="string"?n.metadata.modelProjectId:null;if(!r)throw new Error("This qualified local training job has no retained model route.");return{kind:"training",location:"local",id:n.id,name:n.id,phase:typeof n.metadata.phase=="string"?n.metadata.phase:n.status,updatedAt:n.updatedAt,href:`/models/${encodeURIComponent(r)}/runs/${encodeURIComponent(`job:${n.id}`)}`}})}}async listTrainingJobs(){return this.listParsedPayloads(`SELECT payload FROM training_jobs WHERE destination_id IN ${l} ORDER BY updated_at DESC`,[],s.parse)}async saveTrainingJobEvent(t){let a=T.parse(t);return await this.upsertPayload(`INSERT INTO training_job_events (id, job_id, sequence, payload, created_at) VALUES (?, ?, ?, ?, ?)
17
17
  ON CONFLICT(id) DO UPDATE SET job_id = excluded.job_id, sequence = excluded.sequence, payload = excluded.payload`,[a.id,a.jobId,a.sequence,JSON.stringify(a),a.timestamp]),a}async listTrainingJobEvents(t){return this.listParsedPayloads("SELECT payload FROM training_job_events WHERE job_id = ? ORDER BY sequence ASC",[t],T.parse)}async saveTrainingArtifact(t){let a=p.parse(t);return await this.upsertPayload(`INSERT INTO training_artifacts (id, job_id, kind, payload, created_at) VALUES (?, ?, ?, ?, ?)
18
18
  ON CONFLICT(id) DO UPDATE SET job_id = excluded.job_id, kind = excluded.kind, payload = excluded.payload`,[a.id,a.jobId,a.kind,JSON.stringify(a),a.createdAt]),a}async listTrainingArtifacts(t){return this.listParsedPayloads(t?"SELECT payload FROM training_artifacts WHERE job_id = ? ORDER BY created_at DESC":"SELECT payload FROM training_artifacts ORDER BY created_at DESC",t?[t]:[],p.parse)}async getTrainingArtifact(t){return this.getParsedPayload("SELECT payload FROM training_artifacts WHERE id = ?",[t],p.parse)}async saveModelArtifactLineage(t){let a=g.parse(t);return await this.upsertPayload(`INSERT INTO model_artifact_lineage (id, artifact_id, taskset_id, payload, created_at) VALUES (?, ?, ?, ?, ?)
19
- ON CONFLICT(id) DO UPDATE SET artifact_id = excluded.artifact_id, taskset_id = excluded.taskset_id, payload = excluded.payload`,[a.id,a.artifactId,a.tasksetId,JSON.stringify(a),a.importedAt]),a}async updateModelArtifactLineageServing(t,a){let e=a===null?null:S.parse(a);await this.upsertPayload("UPDATE model_artifact_lineage SET payload = json_set(payload, '$.managedServing', json(?)) WHERE id = ?",[JSON.stringify(e),t])}async updateModelArtifactLineageReview(t,a){let e=g.pick({status:!0,rejectedAt:!0,rejectionReason:!0,frozenEvaluationArtifactId:!0}).parse(a);await this.upsertPayload("UPDATE model_artifact_lineage SET payload = json_set(payload, '$.status', ?, '$.rejectedAt', ?, '$.rejectionReason', ?, '$.frozenEvaluationArtifactId', ?) WHERE id = ?",[e.status,e.rejectedAt,e.rejectionReason,e.frozenEvaluationArtifactId,t])}async listModelArtifactLineage(t){return this.listParsedPayloads(t?"SELECT payload FROM model_artifact_lineage WHERE taskset_id = ? ORDER BY created_at DESC":"SELECT payload FROM model_artifact_lineage ORDER BY created_at DESC",t?[t]:[],R)}async getModelArtifactLineage(t){return this.getParsedPayload("SELECT payload FROM model_artifact_lineage WHERE id = ?",[t],R)}};function h(i){return E.parse(O(i))}d(h,"parseStoredModelProject");function O(i){return!m(i)||typeof i.defaultDestinationId!="string"||i.defaultDestinationId==="openpond_managed"?i:{...i,defaultDestinationId:null}}d(O,"normalizeStoredModelProjectDestination");function R(i){return g.parse(N(i))}d(R,"parseStoredModelArtifactLineage");function N(i){if(!m(i)||!m(i.managedServing))return i;let t=i.managedServing.source;return t!=="openpond_fireworks"&&t!=="openpond_training"?i:{...i,managedServing:null}}d(N,"normalizeStoredManagedServingProjection");function m(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}d(m,"isRecord");export{P as SqliteTrainingJobsStore};
19
+ ON CONFLICT(id) DO UPDATE SET artifact_id = excluded.artifact_id, taskset_id = excluded.taskset_id, payload = excluded.payload`,[a.id,a.artifactId,a.tasksetId,JSON.stringify(a),a.importedAt]),a}async updateModelArtifactLineageServing(t,a){let e=a===null?null:f.parse(a);await this.upsertPayload("UPDATE model_artifact_lineage SET payload = json_set(payload, '$.managedServing', json(?)) WHERE id = ?",[JSON.stringify(e),t])}async updateModelArtifactLineageReview(t,a){let e=g.pick({status:!0,rejectedAt:!0,rejectionReason:!0,frozenEvaluationArtifactId:!0}).parse(a);await this.upsertPayload("UPDATE model_artifact_lineage SET payload = json_set(payload, '$.status', ?, '$.rejectedAt', ?, '$.rejectionReason', ?, '$.frozenEvaluationArtifactId', ?) WHERE id = ?",[e.status,e.rejectedAt,e.rejectionReason,e.frozenEvaluationArtifactId,t])}async listModelArtifactLineage(t){return this.listParsedPayloads(t?"SELECT payload FROM model_artifact_lineage WHERE taskset_id = ? ORDER BY created_at DESC":"SELECT payload FROM model_artifact_lineage ORDER BY created_at DESC",t?[t]:[],R)}async getModelArtifactLineage(t){return this.getParsedPayload("SELECT payload FROM model_artifact_lineage WHERE id = ?",[t],R)}};function h(i){return E.parse(O(i))}d(h,"parseStoredModelProject");function O(i){return!m(i)||typeof i.defaultDestinationId!="string"||i.defaultDestinationId==="openpond_managed"?i:{...i,defaultDestinationId:null}}d(O,"normalizeStoredModelProjectDestination");function R(i){return g.parse(N(i))}d(R,"parseStoredModelArtifactLineage");function N(i){if(!m(i)||!m(i.managedServing))return i;let t=i.managedServing.source;return t!=="openpond_fireworks"&&t!=="openpond_training"?i:{...i,managedServing:null}}d(N,"normalizeStoredManagedServingProjection");function m(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}d(m,"isRecord");export{P as SqliteTrainingJobsStore};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as O}from"./chunk-DZUN5YWB.js";import{Na as P}from"./chunk-2RNQQNB7.js";import"./chunk-OQPJ7FJF.js";import"./chunk-EUMXMT3S.js";import"./chunk-Q4TBTRIG.js";import"./chunk-T5AACNJI.js";import{U as S,ga as C,h as c,m as p,o as E,p as y,qa as u,r as R,u as m,w as _}from"./chunk-TKLBP3MM.js";import"./chunk-RBZH6A6M.js";import"./chunk-DIO5CB6U.js";import"./chunk-7ED24PP6.js";import{a as M}from"./chunk-KCJVFLBB.js";import"./chunk-N4FFQPLR.js";import"./chunk-AY64VY4E.js";import"./chunk-GJ2ZJFDD.js";import"./chunk-3QIB5FXI.js";import"./chunk-6MI4KKWF.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-CGWA54LE.js";import"./chunk-KO3HNMLJ.js";import"./chunk-MQULU465.js";import"./chunk-JMBQYBPI.js";import"./chunk-LPWBIGKW.js";import"./chunk-DZUAT3TP.js";import"./chunk-H7ATCPPB.js";import"./chunk-25JDHAZ5.js";import"./chunk-XMKCCLGB.js";import"./chunk-WN3V6KDN.js";import"./chunk-523TE4BI.js";import"./chunk-ZCHXGRRU.js";import"./chunk-YBT2NB32.js";import"./chunk-74ZXXBGN.js";import"./chunk-APB2STJK.js";import"./chunk-Y4OWBBDD.js";import"./chunk-6ZFPQYHG.js";import"./chunk-JFXWI3EN.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z4Z5UOZM.js";import"./chunk-FFRFSDBM.js";import"./chunk-VYLGI3IH.js";import"./chunk-ACYFMLWG.js";import"./chunk-TVQAPBLZ.js";import"./chunk-KGNCKIFP.js";import"./chunk-ES2ISFJC.js";import{a as l}from"./chunk-FTQLQJQV.js";function w(r,t,e){let a=P.safeParse(e.metadata.portableExecutionRef);return r.kind!=="training"||r.status!=="failed"||r.receipt!==null||t.status!=="succeeded"||t.receipt?.schemaVersion!=="openpond.modelRunReceipt.v1"||t.failure!==null||e.status!=="failed"||e.metadata.phase!=="artifact_collection_failed"||e.metadata.modelRunId!==r.id||!a.success||t.receipt.providerRunId!==(a.data.providerJobId??a.data.runId)||t.receipt.assignmentHash!==e.metadata.harnessRunManifestHash?!1:JSON.stringify({...r,status:t.status,receipt:t.receipt,adapterArtifactLineageId:t.adapterArtifactLineageId,failure:null,completedAt:t.completedAt,updatedAt:t.updatedAt})===JSON.stringify(t)}l(w,"isArtifactCollectionRecoveryTransition");function g(r,t){if(r.kind!=="evaluation"||!["failed","cancelled"].includes(r.status)||t.status!=="running"||t.receipt!==null||t.failure!==null||t.completedAt!==null||!r.evaluation)return!1;let e=r.evaluation.attemptPlan.filter(d=>d.stage==="baseline"||d.stage==="adaptation").reduce((d,n)=>d+n.attemptCount,0),a=r.evaluation.attemptPlan.reduce((d,n)=>d+n.attemptCount,0),i=r.evaluation.attemptPlan.find(d=>d.stage==="candidate_adaptation"),o=e+(i?.attemptCount??0);return!(r.evaluationProgress?.stage==="refiner"&&r.evaluationProgress.completedAttempts===e||r.evaluationProgress?.stage==="candidate_adaptation"&&r.evaluationProgress.completedAttempts>=e&&r.evaluationProgress.completedAttempts<=o||["candidate_adaptation","candidate","comparison"].includes(r.evaluationProgress?.stage??"")&&r.evaluationProgress?.completedAttempts===a)||!r.evaluationProgress?.accounting?!1:JSON.stringify({...r,status:"running",receipt:null,failure:null,completedAt:null,updatedAt:t.updatedAt})===JSON.stringify(t)}l(g,"isCheckpointResumeTransition");var T=class extends M{static{l(this,"SqliteTrainingModelStore")}async saveModelCurrencySnapshot(t){let e=_.parse(t),a=await this.getModelCurrencySnapshot(e.id);if(a){if(a.contentHash===e.contentHash&&JSON.stringify(a)===JSON.stringify(e))return a;throw new Error("An immutable Model Currency Snapshot cannot be replaced.")}return await this.upsertPayload(`INSERT INTO model_currency_snapshots
2
+ import{a as O}from"./chunk-3CWRTKHY.js";import{a as P}from"./chunk-KCJVFLBB.js";import{Na as C}from"./chunk-ZR7LIMJS.js";import"./chunk-OQPJ7FJF.js";import"./chunk-PCNLC5H3.js";import"./chunk-P7HRF4FM.js";import{U as S,ga as M,h as c,m as p,o as E,p as y,qa as u,r as R,u as m,w as _}from"./chunk-UFHLLSCE.js";import"./chunk-2ITZW2CN.js";import"./chunk-HCEJAOIF.js";import"./chunk-6GWOVHIG.js";import"./chunk-QGOPYQW3.js";import"./chunk-O4FBOUNX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-WYZWDMMF.js";import"./chunk-DG4TYVPF.js";import"./chunk-PWK5Z5S3.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-2MMCZHKL.js";import"./chunk-WGX7WY4N.js";import"./chunk-XO3H32KX.js";import"./chunk-DIGX56JY.js";import"./chunk-R7YEURUQ.js";import"./chunk-DZUAT3TP.js";import"./chunk-H3BSIAQO.js";import"./chunk-637UACKH.js";import"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as l}from"./chunk-FTQLQJQV.js";function w(r,t,e){let a=C.safeParse(e.metadata.portableExecutionRef);return r.kind!=="training"||r.status!=="failed"||r.receipt!==null||t.status!=="succeeded"||t.receipt?.schemaVersion!=="openpond.modelRunReceipt.v1"||t.failure!==null||e.status!=="failed"||e.metadata.phase!=="artifact_collection_failed"||e.metadata.modelRunId!==r.id||!a.success||t.receipt.providerRunId!==(a.data.providerJobId??a.data.runId)||t.receipt.assignmentHash!==e.metadata.harnessRunManifestHash?!1:JSON.stringify({...r,status:t.status,receipt:t.receipt,adapterArtifactLineageId:t.adapterArtifactLineageId,failure:null,completedAt:t.completedAt,updatedAt:t.updatedAt})===JSON.stringify(t)}l(w,"isArtifactCollectionRecoveryTransition");function g(r,t){if(r.kind!=="evaluation"||!["failed","cancelled"].includes(r.status)||t.status!=="running"||t.receipt!==null||t.failure!==null||t.completedAt!==null||!r.evaluation)return!1;let e=r.evaluation.attemptPlan.filter(d=>d.stage==="baseline"||d.stage==="adaptation").reduce((d,n)=>d+n.attemptCount,0),a=r.evaluation.attemptPlan.reduce((d,n)=>d+n.attemptCount,0),i=r.evaluation.attemptPlan.find(d=>d.stage==="candidate_adaptation"),o=e+(i?.attemptCount??0);return!(r.evaluationProgress?.stage==="refiner"&&r.evaluationProgress.completedAttempts===e||r.evaluationProgress?.stage==="candidate_adaptation"&&r.evaluationProgress.completedAttempts>=e&&r.evaluationProgress.completedAttempts<=o||["candidate_adaptation","candidate","comparison"].includes(r.evaluationProgress?.stage??"")&&r.evaluationProgress?.completedAttempts===a)||!r.evaluationProgress?.accounting?!1:JSON.stringify({...r,status:"running",receipt:null,failure:null,completedAt:null,updatedAt:t.updatedAt})===JSON.stringify(t)}l(g,"isCheckpointResumeTransition");var T=class extends P{static{l(this,"SqliteTrainingModelStore")}async saveModelCurrencySnapshot(t){let e=_.parse(t),a=await this.getModelCurrencySnapshot(e.id);if(a){if(a.contentHash===e.contentHash&&JSON.stringify(a)===JSON.stringify(e))return a;throw new Error("An immutable Model Currency Snapshot cannot be replaced.")}return await this.upsertPayload(`INSERT INTO model_currency_snapshots
3
3
  (id, series_id, entry_id, evidence_state, content_hash, payload, created_at)
4
4
  VALUES (?, ?, ?, ?, ?, ?, ?)`,[e.id,e.seriesId,e.entryId,e.evidenceState,e.contentHash,JSON.stringify(e),e.projectedAt]),e}async getModelCurrencySnapshot(t){return this.getParsedPayload("SELECT payload FROM model_currency_snapshots WHERE id = ?",[t],_.parse)}async listModelCurrencySnapshots(t={}){return t.entryId?this.listParsedPayloads("SELECT payload FROM model_currency_snapshots WHERE entry_id = ? ORDER BY created_at DESC",[t.entryId],_.parse):t.seriesId?this.listParsedPayloads("SELECT payload FROM model_currency_snapshots WHERE series_id = ? ORDER BY created_at DESC",[t.seriesId],_.parse):this.listParsedPayloads("SELECT payload FROM model_currency_snapshots ORDER BY created_at DESC",[],_.parse)}async saveModelComparisonSeries(t){let e=c.parse(t),a=await this.getModelComparisonSeries(e.id);if(a&&(a.profileId!==e.profileId||a.modelProjectId!==e.modelProjectId||a.createdAt!==e.createdAt))throw new Error("A Model Comparison Series cannot change its immutable ownership.");if(a&&e.revision!==a.revision+1){if(JSON.stringify(a)===JSON.stringify(e))return a;throw new Error("A Model Comparison Series update requires the next revision.")}if(a?.scheduleSealedAt&&!v(a,e))throw new Error("A sealed Model Comparison Series definition is immutable.");return await this.upsertPayload(`INSERT INTO model_comparison_series
5
5
  (id, profile_id, model_project_id, status, payload, created_at, updated_at)
@@ -28,7 +28,7 @@ import{a as O}from"./chunk-DZUN5YWB.js";import{Na as P}from"./chunk-2RNQQNB7.js"
28
28
  updated_at = excluded.updated_at`,[e.id,e.rewardModelId,e.profileId,e.taskset.id,e.status,JSON.stringify(e),e.startedAt,e.updatedAt]),e}async getRewardModelRun(t){return this.getParsedPayload("SELECT payload FROM reward_model_runs WHERE id = ?",[t],R.parse)}async listRewardModelRuns(t={}){return t.tasksetId?this.listParsedPayloads("SELECT payload FROM reward_model_runs WHERE taskset_id = ? ORDER BY updated_at DESC",[t.tasksetId],R.parse):t.profileId?this.listParsedPayloads("SELECT payload FROM reward_model_runs WHERE profile_id = ? ORDER BY updated_at DESC",[t.profileId],R.parse):this.listParsedPayloads("SELECT payload FROM reward_model_runs ORDER BY updated_at DESC",[],R.parse)}async saveModelVersion(t){let e=E.parse(t),a=await this.getModelVersion(e.id);if(a&&a.contentHash!==e.contentHash)throw new Error(`Model Version ${e.id} is immutable and already has different content.`);let i=(await this.listModelVersions({modelId:e.modelId})).find(o=>o.version===e.version);if(i&&i.id!==e.id)throw new Error(`Model ${e.modelId} already has version ${e.version}.`);return await this.upsertPayload(`INSERT INTO model_versions
29
29
  (id, model_id, profile_id, version_number, kind, payload, created_at)
30
30
  VALUES (?, ?, ?, ?, ?, ?, ?)
31
- ON CONFLICT(id) DO UPDATE SET payload = excluded.payload`,[e.id,e.modelId,e.profileId,e.version,e.kind,JSON.stringify(e),e.createdAt]),e}async getModelVersion(t){return this.getParsedPayload("SELECT payload FROM model_versions WHERE id = ?",[t],E.parse)}async listModelVersions(t={}){return t.modelId?this.listParsedPayloads("SELECT payload FROM model_versions WHERE model_id = ? ORDER BY version_number DESC",[t.modelId],E.parse):t.profileId?this.listParsedPayloads("SELECT payload FROM model_versions WHERE profile_id = ? ORDER BY created_at DESC",[t.profileId],E.parse):this.listParsedPayloads("SELECT payload FROM model_versions ORDER BY created_at DESC",[],E.parse)}async saveModelRun(t,e={}){let a=m.parse(t),i=await this.getModelRun(a.id);if(i&&JSON.stringify(i)===JSON.stringify(a))return i;let o=!1;if(e.recoverCollectionForJobId){let s=await this.getParsedPayload("SELECT payload FROM training_jobs WHERE id = ?",[e.recoverCollectionForJobId],C.parse);if(o=!!(i&&s&&w(i,a,s)),!o)throw new Error("Model Run collection recovery must preserve the failed Job's execution and lineage.")}if(i&&(i.modelId!==a.modelId||i.modelVersionId!==a.modelVersionId||i.profileId!==a.profileId||i.taskset.id!==a.taskset.id||JSON.stringify(i.comparisonSeriesEntry??null)!==JSON.stringify(a.comparisonSeriesEntry??null)))throw new Error("A Model Run cannot change its immutable lineage.");if(i&&["succeeded","failed","cancelled"].includes(i.status)&&JSON.stringify(i)!==JSON.stringify(a)&&!g(i,a)&&!o)throw new Error(`Terminal Model Run ${a.id} is immutable.`);return await this.upsertPayload(`INSERT INTO model_runs
31
+ ON CONFLICT(id) DO UPDATE SET payload = excluded.payload`,[e.id,e.modelId,e.profileId,e.version,e.kind,JSON.stringify(e),e.createdAt]),e}async getModelVersion(t){return this.getParsedPayload("SELECT payload FROM model_versions WHERE id = ?",[t],E.parse)}async listModelVersions(t={}){return t.modelId?this.listParsedPayloads("SELECT payload FROM model_versions WHERE model_id = ? ORDER BY version_number DESC",[t.modelId],E.parse):t.profileId?this.listParsedPayloads("SELECT payload FROM model_versions WHERE profile_id = ? ORDER BY created_at DESC",[t.profileId],E.parse):this.listParsedPayloads("SELECT payload FROM model_versions ORDER BY created_at DESC",[],E.parse)}async saveModelRun(t,e={}){let a=m.parse(t),i=await this.getModelRun(a.id);if(i&&JSON.stringify(i)===JSON.stringify(a))return i;let o=!1;if(e.recoverCollectionForJobId){let s=await this.getParsedPayload("SELECT payload FROM training_jobs WHERE id = ?",[e.recoverCollectionForJobId],M.parse);if(o=!!(i&&s&&w(i,a,s)),!o)throw new Error("Model Run collection recovery must preserve the failed Job's execution and lineage.")}if(i&&(i.modelId!==a.modelId||i.modelVersionId!==a.modelVersionId||i.profileId!==a.profileId||i.taskset.id!==a.taskset.id||JSON.stringify(i.comparisonSeriesEntry??null)!==JSON.stringify(a.comparisonSeriesEntry??null)))throw new Error("A Model Run cannot change its immutable lineage.");if(i&&["succeeded","failed","cancelled"].includes(i.status)&&JSON.stringify(i)!==JSON.stringify(a)&&!g(i,a)&&!o)throw new Error(`Terminal Model Run ${a.id} is immutable.`);return await this.upsertPayload(`INSERT INTO model_runs
32
32
  (id, model_id, model_version_id, profile_id, taskset_id, status, payload, created_at, updated_at)
33
33
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
34
34
  ON CONFLICT(id) DO UPDATE SET
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{i as r,j as c,l as _}from"./chunk-UGL7WF3W.js";import"./chunk-DMFUEUAZ.js";import{b as u}from"./chunk-DIO5CB6U.js";import{a as l}from"./chunk-KCJVFLBB.js";import{O as a}from"./chunk-Z4Z5UOZM.js";import"./chunk-FFRFSDBM.js";import"./chunk-KGNCKIFP.js";import"./chunk-ES2ISFJC.js";import{a as d}from"./chunk-FTQLQJQV.js";var m=class extends l{static{d(this,"SqliteUsageStore")}async upsertModelUsageRecord(e){await this.ready;let t=u.parse(e),s=this.writeQueue.then(async()=>{await this.run(`INSERT INTO model_usage_records (
2
+ import{i as r,j as c,l as _}from"./chunk-YOZIZYSC.js";import"./chunk-DMFUEUAZ.js";import{a as u}from"./chunk-KCJVFLBB.js";import{b as l}from"./chunk-WYZWDMMF.js";import{O as a}from"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as d}from"./chunk-FTQLQJQV.js";var m=class extends u{static{d(this,"SqliteUsageStore")}async upsertModelUsageRecord(e){await this.ready;let t=l.parse(e),s=this.writeQueue.then(async()=>{await this.run(`INSERT INTO model_usage_records (
3
3
  id,
4
4
  request_id,
5
5
  request_ordinal,
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as u}from"./chunk-KCJVFLBB.js";import{C as k,h as n,u as d,y as p}from"./chunk-6ZFPQYHG.js";import"./chunk-FFRFSDBM.js";import"./chunk-KGNCKIFP.js";import{b as t}from"./chunk-ES2ISFJC.js";import{a as s}from"./chunk-FTQLQJQV.js";var w=t.object({kind:t.enum(["private_trace","sanitized_trace","evidence_receipt","consent_receipt","output_revision","output_content","validation_evidence","correction","feedback_receipt"]),visibility:t.enum(["private","portable"]),ref:n.nullable(),contentHash:t.string().regex(/^[a-f0-9]{64}$/),path:t.string().trim().min(1).max(8192),sizeBytes:t.number().int().nonnegative()}).strict(),a=t.object({schemaVersion:t.literal("openpond.storedWorkEvidenceProjection.v1"),sourceSessionId:t.string().trim().min(1),sourceTurnId:t.string().trim().min(1),sourceRevisionHash:t.string().regex(/^[a-f0-9]{64}$/),receipt:p,trace:d,artifacts:t.array(w).min(3).max(10100),createdAt:t.string().datetime({offset:!0})}).strict(),c=t.object({schemaVersion:t.literal("openpond.storedWorkFeedback.v1"),receipt:k,artifacts:t.array(w).min(1).max(4),createdAt:t.string().datetime({offset:!0})}).strict(),h=class extends u{static{s(this,"SqliteWorkEvidenceStore")}async saveWorkEvidenceProjection(r){let e=a.parse(r);await this.ready;let o=this.writeQueue.then(async()=>{await this.run(`INSERT OR IGNORE INTO work_evidence_receipts (
2
+ import{a as u}from"./chunk-KCJVFLBB.js";import{C as k,h as n,u as d,y as p}from"./chunk-V4KT5FCJ.js";import"./chunk-ON2RNOCG.js";import"./chunk-BIPQCJ5V.js";import{A as t}from"./chunk-PF56N7ZY.js";import{a as s}from"./chunk-FTQLQJQV.js";var w=t.object({kind:t.enum(["private_trace","sanitized_trace","evidence_receipt","consent_receipt","output_revision","output_content","validation_evidence","correction","feedback_receipt"]),visibility:t.enum(["private","portable"]),ref:n.nullable(),contentHash:t.string().regex(/^[a-f0-9]{64}$/),path:t.string().trim().min(1).max(8192),sizeBytes:t.number().int().nonnegative()}).strict(),a=t.object({schemaVersion:t.literal("openpond.storedWorkEvidenceProjection.v1"),sourceSessionId:t.string().trim().min(1),sourceTurnId:t.string().trim().min(1),sourceRevisionHash:t.string().regex(/^[a-f0-9]{64}$/),receipt:p,trace:d,artifacts:t.array(w).min(3).max(10100),createdAt:t.string().datetime({offset:!0})}).strict(),c=t.object({schemaVersion:t.literal("openpond.storedWorkFeedback.v1"),receipt:k,artifacts:t.array(w).min(1).max(4),createdAt:t.string().datetime({offset:!0})}).strict(),h=class extends u{static{s(this,"SqliteWorkEvidenceStore")}async saveWorkEvidenceProjection(r){let e=a.parse(r);await this.ready;let o=this.writeQueue.then(async()=>{await this.run(`INSERT OR IGNORE INTO work_evidence_receipts (
3
3
  id, source_revision_hash, source_session_id, source_turn_id, payload, created_at
4
4
  ) VALUES (?, ?, ?, ?, ?, ?)`,[e.receipt.id,e.sourceRevisionHash,e.sourceSessionId,e.sourceTurnId,JSON.stringify(e),e.createdAt]);let i=await this.get("SELECT payload FROM work_evidence_receipts WHERE source_revision_hash = ?",[e.sourceRevisionHash]);if(!i)throw new Error("Work evidence projection was not persisted.");if(a.parse(JSON.parse(i.payload)).receipt.contentHash!==e.receipt.contentHash)throw new Error("An immutable Work source revision already has different evidence.")});return this.writeQueue=o.catch(()=>{}),await o,await this.getWorkEvidenceProjectionBySourceRevision(e.sourceRevisionHash)}async getWorkEvidenceProjectionBySourceRevision(r){await this.ready,await this.writeQueue;let e=await this.get("SELECT payload FROM work_evidence_receipts WHERE source_revision_hash = ?",[r]);return e?a.parse(JSON.parse(e.payload)):null}async getWorkEvidenceProjection(r){await this.ready,await this.writeQueue;let e=await this.get("SELECT payload FROM work_evidence_receipts WHERE id = ?",[r]);return e?a.parse(JSON.parse(e.payload)):null}async listWorkEvidenceProjections(r=100){await this.ready,await this.writeQueue;let e=Math.min(Math.max(Math.trunc(r),1),1e3);return(await this.all(`SELECT payload FROM work_evidence_receipts
5
5
  ORDER BY created_at DESC, id DESC LIMIT ?`,[e])).map(i=>a.parse(JSON.parse(i.payload)))}async saveWorkFeedback(r){let e=c.parse(r);await this.ready;let o=this.writeQueue.then(async()=>{await this.run(`INSERT OR IGNORE INTO work_feedback_receipts (
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as g,c as h,d as m}from"./chunk-NPOHW5OU.js";import{c as f}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c as n,f as u}from"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-MNC4YUDI.js";import"./chunk-Z4Z5UOZM.js";import"./chunk-FFRFSDBM.js";import"./chunk-H7IWJN7L.js";import"./chunk-KGNCKIFP.js";import"./chunk-ES2ISFJC.js";import{a as c}from"./chunk-FTQLQJQV.js";import w from"node:path";async function A(r,l,k={}){let[t,e]=l;if(!t||!e||l.length!==2||!["import","publish","readiness","delete-draft"].includes(t))throw new Error("usage: taskset <import|publish|readiness|delete-draft> <package-path|draft-id|taskset-id> [--profile <id>] [--model <id>] [--json]");let i=f(r)??process.env.OPENPOND_LOCAL_API_URL?.replace(/\/$/,"")??g,d=new URL(i);if(d.protocol!=="http:"||!["127.0.0.1","localhost","::1"].includes(d.hostname))throw new Error("Taskset package import is available only through the local OpenPond app API.");let a=new m({baseUrl:i,request:k.request??await h(i)}),s=t==="import"?await a.importTasksetDraftPackage({packagePath:w.resolve(e),profileId:n(r,"profile")||"default"}):t==="publish"?await a.publishTasksetDraft(e,n(r,"model")||null):t==="readiness"?await a.tasksetReadiness(e):await a.deleteTasksetDraft(e);if(u(r.json)){console.log(JSON.stringify(s,null,2));return}let o=s&&typeof s=="object"?s:{};if(t==="import"){console.log(`Imported Taskset draft ${String(o.name??o.id??e)}.`),console.log("Open it in Models \u2192 Tasksets to review it, or publish it with the OpenPond CLI.");return}if(t==="publish"){let p=o.taskset&&typeof o.taskset=="object"?o.taskset:{};console.log(`Published Taskset ${String(p.name??p.id??e)}.`);return}if(t==="readiness"){console.log(`Checked Taskset ${e} readiness.`),console.log(JSON.stringify(s,null,2));return}console.log(`Deleted unpublished Taskset draft ${e}.`)}c(A,"runTasksetCommand");export{A as runTasksetCommand};
2
+ import{a as g,c as h,d as m}from"./chunk-NPOHW5OU.js";import{c as f}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c as n,f as u}from"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as c}from"./chunk-FTQLQJQV.js";import w from"node:path";async function A(r,l,k={}){let[t,e]=l;if(!t||!e||l.length!==2||!["import","publish","readiness","delete-draft"].includes(t))throw new Error("usage: taskset <import|publish|readiness|delete-draft> <package-path|draft-id|taskset-id> [--profile <id>] [--model <id>] [--json]");let i=f(r)??process.env.OPENPOND_LOCAL_API_URL?.replace(/\/$/,"")??g,d=new URL(i);if(d.protocol!=="http:"||!["127.0.0.1","localhost","::1"].includes(d.hostname))throw new Error("Taskset package import is available only through the local OpenPond app API.");let a=new m({baseUrl:i,request:k.request??await h(i)}),s=t==="import"?await a.importTasksetDraftPackage({packagePath:w.resolve(e),profileId:n(r,"profile")||"default"}):t==="publish"?await a.publishTasksetDraft(e,n(r,"model")||null):t==="readiness"?await a.tasksetReadiness(e):await a.deleteTasksetDraft(e);if(u(r.json)){console.log(JSON.stringify(s,null,2));return}let o=s&&typeof s=="object"?s:{};if(t==="import"){console.log(`Imported Taskset draft ${String(o.name??o.id??e)}.`),console.log("Open it in Models \u2192 Tasksets to review it, or publish it with the OpenPond CLI.");return}if(t==="publish"){let p=o.taskset&&typeof o.taskset=="object"?o.taskset:{};console.log(`Published Taskset ${String(p.name??p.id??e)}.`);return}if(t==="readiness"){console.log(`Checked Taskset ${e} readiness.`),console.log(JSON.stringify(s,null,2));return}console.log(`Deleted unpublished Taskset draft ${e}.`)}c(A,"runTasksetCommand");export{A as runTasksetCommand};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import"./chunk-DZUAT3TP.js";import{a as F,b as G,c as H,d as Q,e as R,f as S,g as T,h as U,i as V,j as W,k as X,l as Y,m as Z,n as _,o as $,p as aa,q as ba,r as ca}from"./chunk-H7ATCPPB.js";import{c as y,d as z,e as A,f as B,g as C,h as D,i as E}from"./chunk-25JDHAZ5.js";import{$ as m,Fb as I,Gb as J,Hb as K,Ib as L,Jb as M,Kb as N,Lb as O,Mb as P,Z as k,_ as l,a as b,aa as n,b as c,ba as o,c as d,ca as p,d as e,da as q,e as f,ea as r,f as g,g as h,h as i,ha as s,i as j,ia as t,ja as u,ka as v,la as w,ma as x}from"./chunk-XMKCCLGB.js";import"./chunk-WN3V6KDN.js";import"./chunk-523TE4BI.js";import"./chunk-ZCHXGRRU.js";import"./chunk-APB2STJK.js";import"./chunk-Y4OWBBDD.js";import"./chunk-6ZFPQYHG.js";import"./chunk-JFXWI3EN.js";import"./chunk-FFRFSDBM.js";import"./chunk-VYLGI3IH.js";import{h as a}from"./chunk-ACYFMLWG.js";import"./chunk-TVQAPBLZ.js";import"./chunk-KGNCKIFP.js";import"./chunk-ES2ISFJC.js";import"./chunk-FTQLQJQV.js";export{S as AuthoredTasksetFileInventorySchema,n as MAX_TASKSET_PACKAGE_BYTES,a as ModelBatchReviewError,F as ModelBatchReviewInspectionSchema,H as ModelBatchReviewReceiptSchema,G as ModelBatchReviewRequestSchema,b as ModelTasksetAuthoringOwnerSchema,c as ModelTasksetAuthoringSchema,e as ModelTasksetDraftPreparationSchema,d as ModelTasksetDraftRequestSchema,E as OpenPondTasksetPackageClient,D as OpenPondTasksetPackageError,h as TasksetDraftFileContentSchema,g as TasksetDraftFileInfoSchema,j as TasksetDraftFileMutationSchema,f as TasksetDraftFilePathSchema,i as TasksetDraftFileSchema,aa as TasksetDraftSourceInitializationSchema,s as TasksetPackageContentSchema,o as TasksetPackageFileSchema,k as TasksetPackageLearningResourcesSchema,y as TasksetPackageModelConfigurationSchema,z as TasksetPackagePublicationSchema,B as TasksetPackageReadbackSchema,A as TasksetPackageReceiptSchema,t as TasksetPackageSchema,C as TasksetReleasePackageReadbackSchema,Z as beginModelBatchReview,W as bindOrdinaryModelTasksetReward,V as compileModelTasksetDraftWorkspace,x as createTasksetPackage,r as createTasksetPackageExecutionFile,p as decodeTasksetPackageFile,Y as findModelBatchReview,X as inspectModelBatchPackage,T as isGeneratedTasksetPublicationFilePath,l as learningPackageContextFiles,J as learningVerifierModule,L as materializePortableTasksetRelease,ca as materializeTasksetDraftWorkspace,N as portableTasksetEnvironment,O as portableTasksetTools,U as prepareAuthoredTasksetSource,_ as prepareImportedTasksetPackage,Q as prepareModelTasksetDraft,ba as prepareTasksetDraftSource,I as projectLearningBatchGraders,P as projectPortableTaskRecord,M as projectPreferenceComparisonRelease,R as publishModelTasksetDraftPackage,K as resolvePortableTasksetRewardExecution,q as resolveTasksetPackageExecution,v as resolveTasksetPackageInstructions,u as tasksetPackageRewardBinding,$ as tasksetPackageSourceId,m as validateTasksetLearningResources,w as validateTasksetPackage};
2
+ import"./chunk-DZUAT3TP.js";import{a as F,b as G,c as H,d as Q,e as R,f as S,g as T,h as U,i as V,j as W,k as X,l as Y,m as Z,n as _,o as $,p as aa,q as ba,r as ca}from"./chunk-H3BSIAQO.js";import{c as y,d as z,e as A,f as B,g as C,h as D,i as E}from"./chunk-637UACKH.js";import{$ as m,Fb as I,Gb as J,Hb as K,Ib as L,Jb as M,Kb as N,Lb as O,Mb as P,Z as k,_ as l,a as b,aa as n,b as c,ba as o,c as d,ca as p,d as e,da as q,e as f,ea as r,f as g,g as h,h as i,ha as s,i as j,ia as t,ja as u,ka as v,la as w,ma as x}from"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-ON2RNOCG.js";import"./chunk-SFNCAPCJ.js";import{h as a}from"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import"./chunk-FTQLQJQV.js";export{S as AuthoredTasksetFileInventorySchema,n as MAX_TASKSET_PACKAGE_BYTES,a as ModelBatchReviewError,F as ModelBatchReviewInspectionSchema,H as ModelBatchReviewReceiptSchema,G as ModelBatchReviewRequestSchema,b as ModelTasksetAuthoringOwnerSchema,c as ModelTasksetAuthoringSchema,e as ModelTasksetDraftPreparationSchema,d as ModelTasksetDraftRequestSchema,E as OpenPondTasksetPackageClient,D as OpenPondTasksetPackageError,h as TasksetDraftFileContentSchema,g as TasksetDraftFileInfoSchema,j as TasksetDraftFileMutationSchema,f as TasksetDraftFilePathSchema,i as TasksetDraftFileSchema,aa as TasksetDraftSourceInitializationSchema,s as TasksetPackageContentSchema,o as TasksetPackageFileSchema,k as TasksetPackageLearningResourcesSchema,y as TasksetPackageModelConfigurationSchema,z as TasksetPackagePublicationSchema,B as TasksetPackageReadbackSchema,A as TasksetPackageReceiptSchema,t as TasksetPackageSchema,C as TasksetReleasePackageReadbackSchema,Z as beginModelBatchReview,W as bindOrdinaryModelTasksetReward,V as compileModelTasksetDraftWorkspace,x as createTasksetPackage,r as createTasksetPackageExecutionFile,p as decodeTasksetPackageFile,Y as findModelBatchReview,X as inspectModelBatchPackage,T as isGeneratedTasksetPublicationFilePath,l as learningPackageContextFiles,J as learningVerifierModule,L as materializePortableTasksetRelease,ca as materializeTasksetDraftWorkspace,N as portableTasksetEnvironment,O as portableTasksetTools,U as prepareAuthoredTasksetSource,_ as prepareImportedTasksetPackage,Q as prepareModelTasksetDraft,ba as prepareTasksetDraftSource,I as projectLearningBatchGraders,P as projectPortableTaskRecord,M as projectPreferenceComparisonRelease,R as publishModelTasksetDraftPackage,K as resolvePortableTasksetRewardExecution,q as resolveTasksetPackageExecution,v as resolveTasksetPackageInstructions,u as tasksetPackageRewardBinding,$ as tasksetPackageSourceId,m as validateTasksetLearningResources,w as validateTasksetPackage};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{m as f}from"./chunk-GUOLMLZN.js";import"./chunk-JUQMSHNR.js";import"./chunk-U2MAPON2.js";import"./chunk-7UH4YDA7.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as g,c as a,d}from"./chunk-3M53YXEI.js";import"./chunk-OLDK2LKJ.js";import"./chunk-BT5YNE5U.js";import"./chunk-SF5HJ7PL.js";import"./chunk-FWIPHEVA.js";import"./chunk-WRI4XKSK.js";import"./chunk-GLUWATL5.js";import"./chunk-QDC4OW3S.js";import"./chunk-ZZWAQBA2.js";import"./chunk-YR5ID2SS.js";import"./chunk-YBT2NB32.js";import"./chunk-74ZXXBGN.js";import"./chunk-APB2STJK.js";import"./chunk-Y4OWBBDD.js";import"./chunk-6ZFPQYHG.js";import"./chunk-JFXWI3EN.js";import"./chunk-MNC4YUDI.js";import"./chunk-Z4Z5UOZM.js";import"./chunk-FFRFSDBM.js";import"./chunk-H7IWJN7L.js";import"./chunk-VYLGI3IH.js";import"./chunk-ACYFMLWG.js";import"./chunk-TVQAPBLZ.js";import"./chunk-KGNCKIFP.js";import"./chunk-ES2ISFJC.js";import{a as s}from"./chunk-FTQLQJQV.js";function c(){return["usage: teams-bot <overview|bind|rebind|diagnostics|diagnostic-run>"," teams-bot overview --team-id <id>"," teams-bot bind --team-id <id> --token <token> [--project-id <id>] [--agent-id <id>] [--microsoft-connection-id <id>]"," teams-bot rebind <bindingId> --team-id <id> [--project-id <id>] [--agent-id <id>] [--microsoft-connection-id <id>]"," teams-bot diagnostics <bindingId> --team-id <id>"," teams-bot diagnostic-run <bindingId> --team-id <id> --prompt <text> [--attachments-json <json-array>] [--action-input-json <json-object>]"].join(`
2
+ import{m as f}from"./chunk-ISFIDCIH.js";import"./chunk-23P2O7PH.js";import"./chunk-AW5Q6NXT.js";import"./chunk-YVNDDNMK.js";import"./chunk-XRKFTPHD.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as g,c as a,d}from"./chunk-3M53YXEI.js";import"./chunk-EL454L26.js";import"./chunk-BT5YNE5U.js";import"./chunk-PXS4SVQG.js";import"./chunk-FWIPHEVA.js";import"./chunk-ENSB6ZTM.js";import"./chunk-GLUWATL5.js";import"./chunk-RYGWCN2R.js";import"./chunk-ZZWAQBA2.js";import"./chunk-YR5ID2SS.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as s}from"./chunk-FTQLQJQV.js";function c(){return["usage: teams-bot <overview|bind|rebind|diagnostics|diagnostic-run>"," teams-bot overview --team-id <id>"," teams-bot bind --team-id <id> --token <token> [--project-id <id>] [--agent-id <id>] [--microsoft-connection-id <id>]"," teams-bot rebind <bindingId> --team-id <id> [--project-id <id>] [--agent-id <id>] [--microsoft-connection-id <id>]"," teams-bot diagnostics <bindingId> --team-id <id>"," teams-bot diagnostic-run <bindingId> --team-id <id> --prompt <text> [--attachments-json <json-array>] [--action-input-json <json-object>]"].join(`
3
3
  `)}s(c,"usage");function u(n,o){if(!(o in n))return;let t=a(n,o);return!t||t==="null"||t==="none"?null:t}s(u,"nullableOption");function b(n){let o=d(n,"usage: teams-bot rebind <bindingId>"),t=u(n,"sandboxId"),r=u(n,"projectId"),i=u(n,"agentId"),e=u(n,"microsoftConnectionId");return{teamId:o,...t!==void 0?{sandboxId:t}:{},...r!==void 0?{projectId:r}:{},...i!==void 0?{agentId:i}:{},...e!==void 0?{microsoftConnectionId:e}:{}}}s(b,"bindingTargetInput");function l(n){let o=a(n,"attachmentsJson");if(!o)return;let t=g(o,"attachments-json");if(!Array.isArray(t))throw new Error("attachments-json must be a JSON array");for(let r of t)if(!r||typeof r!="object"||Array.isArray(r))throw new Error("attachments-json entries must be JSON objects");return t}s(l,"attachmentsInput");function w(n){let o=a(n,"actionInputJson");if(!o)return;let t=g(o,"action-input-json");if(!t||typeof t!="object"||Array.isArray(t))throw new Error("action-input-json must be a JSON object");return t}s(w,"actionInput");async function j(n,o){let t=o[0]||"overview",r=await f(n);if(t==="overview"){let i=d(n,"usage: teams-bot overview");console.log(JSON.stringify(await r.getMicrosoftTeamsBotOverview({teamId:i}),null,2));return}if(t==="bind"){let i=a(n,"token");if(!i)throw new Error(c());let e=await r.bindMicrosoftTeamsBotConversation({...b(n),token:i});console.log(JSON.stringify(e,null,2));return}if(t==="rebind"){let i=o[1]?.trim();if(!i)throw new Error(c());let e=await r.rebindMicrosoftTeamsBotConversation(i,b(n));console.log(JSON.stringify(e,null,2));return}if(t==="diagnostics"){let i=o[1]?.trim(),e=d(n,"usage: teams-bot diagnostics <bindingId>");if(!i)throw new Error(c());console.log(JSON.stringify(await r.sendMicrosoftTeamsBotDiagnostic({teamId:e,bindingId:i}),null,2));return}if(t==="diagnostic-run"){let i=o[1]?.trim(),e=d(n,"usage: teams-bot diagnostic-run <bindingId>"),m=a(n,"prompt");if(!i||!m)throw new Error(c());console.log(JSON.stringify(await r.sendMicrosoftTeamsBotDiagnosticRun({teamId:e,bindingId:i,prompt:m,attachments:l(n),actionInput:w(n)}),null,2));return}throw new Error(c())}s(j,"runTeamsBotCommand");export{j as runTeamsBotCommand};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-NPOHW5OU.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-MNC4YUDI.js";import"./chunk-Z4Z5UOZM.js";import"./chunk-FFRFSDBM.js";import"./chunk-H7IWJN7L.js";import"./chunk-KGNCKIFP.js";import"./chunk-ES2ISFJC.js";import"./chunk-FTQLQJQV.js";export{a as DEFAULT_LOCAL_TRAINING_API_URL,d as TrainingApiClient,c as createLocalAuthenticatedRequest,b as runTrainingCommand};
2
+ import{a,b,c,d}from"./chunk-NPOHW5OU.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import"./chunk-FTQLQJQV.js";export{a as DEFAULT_LOCAL_TRAINING_API_URL,d as TrainingApiClient,c as createLocalAuthenticatedRequest,b as runTrainingCommand};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a,b,c,d,e}from"./chunk-Y777GISF.js";import"./chunk-7LZISGTA.js";import"./chunk-BFKYRQMA.js";import"./chunk-LO3O45IX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-YR5ID2SS.js";import"./chunk-6FA3GG5B.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import"./chunk-FTQLQJQV.js";export{a as createHostedWebSearchExecutor,b as createWebSearchExecutorFromEnv,d as normalizeSearchApiUrl,e as normalizeWebSearchRequest,c as resolveWebSearchEndpoint};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as F,b as G,c as H,d as I,e as J,f as K,g as L,h as M,i as N,j as O,k as P,l as Q,m as R,n as S,o as T}from"./chunk-BQS7Z4AP.js";import{A,B,C,D,E,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-XW6HGSIT.js";import"./chunk-57TRXBLT.js";import"./chunk-FTQLQJQV.js";export{a as MACOS_GIT_MISSING_DEVELOPER_TOOLS_ERROR,C as appWorkspacePaths,B as assertSafeBranchName,d as checkWorkspaceGitAvailability,J as checkoutBranch,K as checkoutBranchAtPath,M as clearWorkspaceDiffCacheForTests,D as cloneWorkspace,H as createAndCheckoutBranch,I as createAndCheckoutBranchAtPath,A as expectedRemoteUrl,t as isGeneratedWorkspacePath,i as isGitRepo,c as isMacOSGitDeveloperToolsMissing,u as isVisibleGitWorkspaceFile,r as isWorkspaceDirectory,E as lastFetchAt,z as listPlainWorkspaceFiles,P as loadGitCommitDiffAtPath,N as loadWorkspaceDiff,O as loadWorkspaceDiffAtPath,Q as loadWorkspaceFile,T as loadWorkspaceFileAtPath,R as loadWorkspaceImageFile,S as loadWorkspaceImageFileAtPath,F as loadWorkspaceState,G as loadWorkspaceStateAtPath,n as localVideoContentType,L as mapWorkspaceDiffEntriesWithConcurrency,s as normalizeWorkspaceFilePath,w as parseBranchStatusLine,x as parseNumstat,v as parseStatusLine,h as pathExists,p as readLocalImageFile,q as readLocalVideoFile,l as readWorkspaceDocumentPreview,k as readWorkspaceFile,o as readWorkspaceImageFile,g as redactRemoteUrl,b as runWorkspaceCommand,f as sourceFromRemote,e as startMacOSCommandLineToolsInstall,j as truncatePatch,y as uniqueSortedPaths,m as workspaceImageContentType};
2
+ import{a as F,b as G,c as H,d as I,e as J,f as K,g as L,h as M,i as N,j as O,k as P,l as Q,m as R,n as S,o as T}from"./chunk-LD7PGREF.js";import{A,B,C,D,E,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-XW6HGSIT.js";import"./chunk-FSQWAANK.js";import"./chunk-FTQLQJQV.js";export{a as MACOS_GIT_MISSING_DEVELOPER_TOOLS_ERROR,C as appWorkspacePaths,B as assertSafeBranchName,d as checkWorkspaceGitAvailability,S as checkoutBranch,T as checkoutBranchAtPath,G as clearWorkspaceDiffCacheForTests,D as cloneWorkspace,Q as createAndCheckoutBranch,R as createAndCheckoutBranchAtPath,A as expectedRemoteUrl,t as isGeneratedWorkspacePath,i as isGitRepo,c as isMacOSGitDeveloperToolsMissing,u as isVisibleGitWorkspaceFile,r as isWorkspaceDirectory,E as lastFetchAt,z as listPlainWorkspaceFiles,J as loadGitCommitDiffAtPath,H as loadWorkspaceDiff,I as loadWorkspaceDiffAtPath,K as loadWorkspaceFile,N as loadWorkspaceFileAtPath,L as loadWorkspaceImageFile,M as loadWorkspaceImageFileAtPath,O as loadWorkspaceState,P as loadWorkspaceStateAtPath,n as localVideoContentType,F as mapWorkspaceDiffEntriesWithConcurrency,s as normalizeWorkspaceFilePath,w as parseBranchStatusLine,x as parseNumstat,v as parseStatusLine,h as pathExists,p as readLocalImageFile,q as readLocalVideoFile,l as readWorkspaceDocumentPreview,k as readWorkspaceFile,o as readWorkspaceImageFile,g as redactRemoteUrl,b as runWorkspaceCommand,f as sourceFromRemote,e as startMacOSCommandLineToolsInstall,j as truncatePatch,y as uniqueSortedPaths,m as workspaceImageContentType};
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
3
- import{b as u}from"./chunks/chunk-U2MAPON2.js";import{a as c,j as d}from"./chunks/chunk-7UH4YDA7.js";import{a as m,b as l}from"./chunks/chunk-BSHAIAXY.js";import"./chunks/chunk-XWPC3AN4.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import"./chunks/chunk-GLUWATL5.js";import{a as n}from"./chunks/chunk-FTQLQJQV.js";function f(e){return!e.command&&s(e.options.version)?"version":s(e.options.checkUpdate)?"check-update":!e.command&&s(e.options.help)?"help":!e.command&&s(e.options.tui)?"tui":e.command?"command":"ui"}n(f,"resolveCliTopLevelAction");async function C(e=process.argv.slice(2)){if(await w(e))return;let{command:t,options:o,rest:r}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-OGLX76LL.js")).resolveOpenPondHome({home:o.home}));let i=f({command:t,options:o});if(i==="version"){console.log(c());return}if(i==="check-update"){await(await import("./chunks/core-commands-U4IBRRY5.js")).runCheckUpdate();return}if(i==="help"){(await import("./chunks/help-KA4OINP5.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),i==="tui"){await(await import("./chunks/app-layer-KAUZAHGE.js")).runOpenPondTerminalCommand(o,r);return}if(i==="ui"){await(await import("./chunks/app-layer-KAUZAHGE.js")).runOpenPondServerCommand("web",o,r);return}await d({command:t,options:o,rest:r})||((await import("./chunks/help-KA4OINP5.js")).printHelp(),process.exit(1))}n(C,"runOpenPondCli");async function w(e){if(e[0]==="__inspect-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-RKDWHYK3.js")).runHostedProfileInspectionCli(e.slice(1)),!0;if(e[0]==="__prepare-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-RKDWHYK3.js")).runHostedProfileEvaluationCli(e.slice(1)),!0;if(e[0]==="__hosted-experiment-improvement")return await(await import("./chunks/hosted-experiment-improvement-42YWXB3P.js")).runHostedExperimentImprovementCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile-candidate")return await(await import("./chunks/hosted-profile-candidate-HVVC43XQ.js")).runHostedProfileCandidateCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile")return await(await import("./chunks/hosted-profile-compiler-RKDWHYK3.js")).runHostedProfileCompilerCli(e.slice(1)),!0;if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:t},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-SVB6L26M.js"),import("./chunks/cli-5DFVQL5Y.js")]);return await o(t),!0}if(e[0]==="__server"){process.argv=[process.execPath,"openpond-server",...e.slice(1)];let[{createOpenPondServer:t},{runOpenPondServerCli:o}]=await Promise.all([import("./chunks/src-EZAKCCUV.js"),import("./chunks/cli-5DFVQL5Y.js")]),{createOpenPondAppServer:r}=await import("./chunks/app-server-runtime-SVB6L26M.js");return await o({createOpenPondServer:t,createOpenPondAppServer:r}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-6SHCCYEN.js")).runOpenPondTerminalCli(e.slice(1)),!0):!1}n(w,"runEmbeddedCompanion");C().catch(e=>{let t=e instanceof Error?e.message:String(e),o=e.issue;if(process.argv.includes("--json")&&!(e instanceof Error&&e.name==="OpenPondChildProcessExitError"))console.log(JSON.stringify({error:o??{code:"CLI_ERROR",message:t}}));else if(o&&typeof o=="object"){let i=o;console.error(`${i.code}: ${i.message}
3
+ import{b as u}from"./chunks/chunk-AW5Q6NXT.js";import{g as d}from"./chunks/chunk-YVNDDNMK.js";import{a as c}from"./chunks/chunk-XRKFTPHD.js";import{a as m,b as l}from"./chunks/chunk-BSHAIAXY.js";import"./chunks/chunk-XWPC3AN4.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import"./chunks/chunk-GLUWATL5.js";import{a as n}from"./chunks/chunk-FTQLQJQV.js";function f(e){return!e.command&&s(e.options.version)?"version":s(e.options.checkUpdate)?"check-update":!e.command&&s(e.options.help)?"help":!e.command&&s(e.options.tui)?"tui":e.command?"command":"ui"}n(f,"resolveCliTopLevelAction");async function C(e=process.argv.slice(2)){if(await w(e))return;let{command:t,options:o,rest:r}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-QN7WKZ2D.js")).resolveOpenPondHome({home:o.home}));let i=f({command:t,options:o});if(i==="version"){console.log(c());return}if(i==="check-update"){await(await import("./chunks/core-commands-ZTWPYAFQ.js")).runCheckUpdate();return}if(i==="help"){(await import("./chunks/help-KU52CFMW.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),i==="tui"){await(await import("./chunks/app-layer-TVG7KTW6.js")).runOpenPondTerminalCommand(o,r);return}if(i==="ui"){await(await import("./chunks/app-layer-TVG7KTW6.js")).runOpenPondServerCommand("web",o,r);return}await d({command:t,options:o,rest:r})||((await import("./chunks/help-KU52CFMW.js")).printHelp(),process.exit(1))}n(C,"runOpenPondCli");async function w(e){if(e[0]==="__inspect-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-RXHLK224.js")).runHostedProfileInspectionCli(e.slice(1)),!0;if(e[0]==="__prepare-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-RXHLK224.js")).runHostedProfileEvaluationCli(e.slice(1)),!0;if(e[0]==="__hosted-experiment-improvement")return await(await import("./chunks/hosted-experiment-improvement-P433KDX2.js")).runHostedExperimentImprovementCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile-candidate")return await(await import("./chunks/hosted-profile-candidate-72MMPN6U.js")).runHostedProfileCandidateCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile")return await(await import("./chunks/hosted-profile-compiler-RXHLK224.js")).runHostedProfileCompilerCli(e.slice(1)),!0;if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:t},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-OKMEHNEU.js"),import("./chunks/cli-CNYNXKGQ.js")]);return await o(t),!0}if(e[0]==="__server"){process.argv=[process.execPath,"openpond-server",...e.slice(1)];let[{createOpenPondServer:t},{runOpenPondServerCli:o}]=await Promise.all([import("./chunks/src-7WMZOWZZ.js"),import("./chunks/cli-CNYNXKGQ.js")]),{createOpenPondAppServer:r}=await import("./chunks/app-server-runtime-OKMEHNEU.js");return await o({createOpenPondServer:t,createOpenPondAppServer:r}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-MVAK6D6Y.js")).runOpenPondTerminalCli(e.slice(1)),!0):!1}n(w,"runEmbeddedCompanion");C().catch(e=>{let t=e instanceof Error?e.message:String(e),o=e.issue;if(process.argv.includes("--json")&&!(e instanceof Error&&e.name==="OpenPondChildProcessExitError"))console.log(JSON.stringify({error:o??{code:"CLI_ERROR",message:t}}));else if(o&&typeof o=="object"){let i=o;console.error(`${i.code}: ${i.message}
4
4
  ${i.path}
5
5
  ${i.action}`)}else console.error(t);let r=typeof e.exitCode=="number"?e.exitCode:1;process.exit(r)});export{C as runOpenPondCli};
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as fe,b as $e,c as ge,d as ye,e as Ve,f as Re,g as Ae,h as Ye,i as Ce,j as Oe,k as Qe}from"./chunks/chunk-JEVA7YQL.js";import{a as ze,b as de,c as Je}from"./chunks/chunk-22UARBPW.js";import"./chunks/chunk-X37KMV27.js";import{A as zt,B as Jt,C as $t,D as Vt,E as Yt,F as Qt,G as Xt,H as Zt,I as en,J as tn,K as nn,L as on,b as Ot,c as St,d as Tt,e as Pt,f as wt,g as Et,h as xt,i as bt,j as Lt,k as Bt,l as Dt,m as It,n as vt,o as Ut,p as Mt,q as _t,r as Ht,s as Nt,t as qt,u as kt,v as Kt,w as Ft,x as Gt,y as jt,z as Wt}from"./chunks/chunk-76M2MEHV.js";import"./chunks/chunk-PFSMXKTI.js";import{$ as Ct,A as z,B as J,C as $,D as V,E as Y,F as Q,G as X,H as Z,I as ee,J as te,K as ne,L as oe,M as se,N as re,O as ae,P as je,Q as le,U as We,V as pe,W as ie,X as ce,Y as ue,Z as me,_ as he,a as qe,b as ke,c as E,d as x,e as b,f as L,g as B,h as D,i as I,j as v,k as Ke,l as U,n as Fe,o as M,p as _,q as H,r as N,s as q,t as Ge,u as k,v as K,w as F,x as G,y as j,z as W}from"./chunks/chunk-OLDK2LKJ.js";import"./chunks/chunk-BT5YNE5U.js";import"./chunks/chunk-SF5HJ7PL.js";import{a as Rt,b as At}from"./chunks/chunk-FWIPHEVA.js";import{a as be,b as Le,c as Be,d as De,e as Ie,f as ve,g as Ue,h as Me,i as _e}from"./chunks/chunk-WRI4XKSK.js";import{a as P,b as w,c as He,d as Ne}from"./chunks/chunk-GLUWATL5.js";import"./chunks/chunk-QDC4OW3S.js";import{a as yt}from"./chunks/chunk-ZZWAQBA2.js";import"./chunks/chunk-YR5ID2SS.js";import"./chunks/chunk-YBT2NB32.js";import"./chunks/chunk-74ZXXBGN.js";import"./chunks/chunk-APB2STJK.js";import"./chunks/chunk-Y4OWBBDD.js";import"./chunks/chunk-6ZFPQYHG.js";import"./chunks/chunk-JFXWI3EN.js";import"./chunks/chunk-3A7HZJNE.js";import{a as sn,b as rn,c as an,d as ln,e as pn,f as cn,g as un,h as mn,i as hn,j as dn,k as fn,l as gn,m as yn,n as Rn,o as An,p as Cn,q as On,r as Sn,s as Tn,t as Pn,u as wn}from"./chunks/chunk-EAPFMACH.js";import"./chunks/chunk-6FA3GG5B.js";import"./chunks/chunk-MNC4YUDI.js";import"./chunks/chunk-Z4Z5UOZM.js";import"./chunks/chunk-FFRFSDBM.js";import"./chunks/chunk-H7IWJN7L.js";import"./chunks/chunk-VYLGI3IH.js";import"./chunks/chunk-ACYFMLWG.js";import"./chunks/chunk-TVQAPBLZ.js";import"./chunks/chunk-KGNCKIFP.js";import"./chunks/chunk-ES2ISFJC.js";import{a as s}from"./chunks/chunk-FTQLQJQV.js";function Xe(t,e=14){if(t.length<e+1)return null;let r=0,o=0;for(let l=1;l<=e;l+=1){let m=t[l]-t[l-1];m>=0?r+=m:o-=m}let a=r/e,i=o/e;for(let l=e+1;l<t.length;l+=1){let m=t[l]-t[l-1],d=m>0?m:0,n=m<0?-m:0;a=(a*(e-1)+d)/e,i=(i*(e-1)+n)/e}return i===0?100:100-100/(1+a/i)}s(Xe,"computeRsi");function T(t,e){if(t.length<e)return[];let r=[],o=0;for(let a=0;a<t.length;a+=1)o+=t[a],a>=e&&(o-=t[a-e]),a>=e-1&&r.push(o/e);return r}s(T,"computeSmaSeries");function Ze(t,e){let r=T(t,e);return r.length>0?r[r.length-1]:null}s(Ze,"computeSma");function A(t,e){if(t.length<e)return[];let r=2/(e+1),a=t.slice(0,e).reduce((p,l)=>p+l,0)/e,i=[a];for(let p=e;p<t.length;p+=1)a=t[p]*r+a*(1-r),i.push(a);return i}s(A,"computeEmaSeries");function et(t,e){let r=A(t,e);return r.length>0?r[r.length-1]:null}s(et,"computeEma");function tt(t){let e=A(t,12),r=A(t,26);if(e.length===0||r.length===0)return null;let o=e.length-r.length,a=r.map((m,d)=>e[d+o]-m),i=A(a,9);if(i.length===0)return null;let p=a[a.length-1],l=i[i.length-1];return{macd:p,signalLine:l,histogram:p-l}}s(tt,"computeMacd");function nt(t,e,r,o){if(t.length<o)return null;let a=e==="ema"?A(t,r):T(t,r),i=e==="ema"?A(t,o):T(t,o);if(a.length===0||i.length===0)return null;let p=a.length-i.length;if(p<0)return null;let l=i.length-1,m=a[l+p],d=i[l],n=l-1,c=n>=0?a[n+p]:null,u=n>=0?i[n]:null,h="neutral";return c!=null&&u!=null?c<=u&&m>d?h="bullish-cross":c>=u&&m<d?h="bearish-cross":m>d?h="bullish":m<d&&(h="bearish"):m>d?h="bullish":m<d&&(h="bearish"),{fast:m,slow:d,signal:h}}s(nt,"computeMaCross");function ot(t,e=20,r=2){if(t.length<e)return null;let o=t.slice(-e),a=o.reduce((l,m)=>l+m,0)/e,i=o.reduce((l,m)=>l+Math.pow(m-a,2),0)/e,p=Math.sqrt(i);return{middle:a,upper:a+r*p,lower:a-r*p}}s(ot,"computeBollinger");function st(t,e=24){if(t.length<2)return null;let r=t[t.length-1],o=Math.max(0,t.length-1-e),a=t[o];if(a===0)return null;let i=(r-a)/a*100;return{previous:a,percent:i}}s(st,"computePriceChange");function rt(t,e=14){if(t.length<e+1)return null;let r=[];for(let i=1;i<t.length;i+=1){let p=t[i],l=t[i-1],m=p.high-p.low,d=Math.abs(p.high-l.close),n=Math.abs(p.low-l.close);r.push(Math.max(m,d,n))}return r.length<e?null:r.slice(-e).reduce((i,p)=>i+p,0)/e}s(rt,"computeAtr");function Te(t){return t.replace(/\/$/,"")}s(Te,"resolveUrl");function at(t){let e=process.env.OPENPOND_BASE_URL,r=t.baseUrl||e||P;return Te(r.trim())}s(at,"resolveBaseUrl");function lt(t){let e=process.env.OPENPOND_API_URL,r=t.apiUrl||e||w;return Te(r.trim())}s(lt,"resolveApiUrl");function pt(t,e){return fe({apiBaseUrl:e,opChatApiBaseUrl:t.opChatApiUrl,chatApiBaseUrl:t.chatApiUrl})}s(pt,"resolveChatApiUrl");function it(t,e){let r=process.env.OPENPOND_TOOL_URL,o=t.toolUrl||r||e;return Te(o.trim())}s(it,"resolveToolUrl");function ct(t){let e=t.apiKey?.trim();if(e)return e;let r=process.env.OPENPOND_API_KEY?.trim();if(r)return r;throw new Error("OPENPOND_API_KEY is required")}s(ct,"resolveApiKey");function ut(t){let e=t.split("/").filter(Boolean);if(e.length!==2)throw new Error("expected <handle>/<repo>");return{handle:e[0],repo:e[1]}}s(ut,"parseHandleRepo");function Pe(t){return(t||"").trim().toLowerCase()}s(Pe,"normalizeRepoName");function mt(t){if(!t||typeof t!="object")return{name:"unknown",raw:t};let e=t,r=e.profile||e.function,o=typeof e.name=="string"?e.name:typeof r?.name=="string"?r.name:"unknown",a=typeof e.description=="string"?e.description:typeof r?.description=="string"?r.description:void 0;return{name:o,description:a,raw:t}}s(mt,"normalizeToolSummary");function ht(t){if(!t)return[];if(Array.isArray(t.toolsJson))return t.toolsJson;if(t.metadataJson&&typeof t.metadataJson=="object"){let e=t.metadataJson.tools;if(Array.isArray(e))return e}return[]}s(ht,"extractDeploymentTools");async function O(t){let{handle:e,repo:r}=ut(t.target),o=await Se({apiBase:t.apiBase,apiKey:t.apiKey,useCache:t.useCache,cacheTtlMs:t.cacheTtlMs,forceRefresh:t.forceRefresh}),a=Pe(r),i=o.find(p=>p.handle&&p.handle!==e?!1:[p.repo,p.gitRepo,p.id].map(Pe).includes(a));if(!i)throw new Error(`app not found for ${e}/${r}`);return{app:i,handle:e,repo:r}}s(O,"resolveAppTarget");async function Se(t){if(t.useCache&&!t.forceRefresh){let r=await ce({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(r)return r}let e=await v(t.apiBase,t.apiKey);return t.useCache&&await ue({apiBase:t.apiBase,apiKey:t.apiKey,apps:e}),e}s(Se,"fetchAppsWithCache");async function we(t){if(t.useCache&&!t.forceRefresh){let o=await me({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(o)return o}let e=await k(t.apiBase,t.apiKey),r=Array.isArray(e.tools)?e.tools:[];return t.useCache&&await he({apiBase:t.apiBase,apiKey:t.apiKey,tools:r}),r}s(we,"fetchToolsWithCache");function dt(t){if(!t)return"POST";let e=t.toUpperCase();switch(e){case"GET":case"POST":case"PUT":case"DELETE":return e;default:throw new Error("method must be GET, POST, PUT, or DELETE")}}s(dt,"normalizeMethod");async function ft(t,e){let r,o,a;return await de(t,{...e,onConversationId:s(i=>{r=i,e?.onConversationId?.(i)},"onConversationId"),onItems:s(i=>{for(let p of i){let l=p;!o&&typeof l.appId=="string"&&(o=l.appId,e?.onAppId?.(l.appId)),!a&&typeof l.deploymentId=="string"&&(a=l.deploymentId,e?.onDeploymentId?.(l.deploymentId))}e?.onItems?.(i)},"onItems")}),{conversationId:r,appId:o,deploymentId:a}}s(ft,"consumeAgentCreateStream");function vn(t){let e=ct(t),r=at(t),o=lt(t),a=pt(t,o),i=it(t,r),p=t.cacheTtlMs??ie,l=t.useCache!==!1,m=s(async()=>{l&&await Promise.all([Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0}),we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0})])},"refreshCache"),d=s(async(n,c)=>(await D(o,e,n,{branch:c}))?.id??null,"resolveLatestDeploymentId");return{baseUrl:r,apiUrl:o,chatApiUrl:a,toolUrl:i,apiKey:e,account:{get:s(async()=>se(o,e),"get"),health:s(async()=>re(o,e),"health")},chat:{providers:s(async()=>Re({apiBaseUrl:a,token:e}),"providers"),provider:s(async n=>Ae({apiBaseUrl:a,token:e,provider:n}),"provider"),models:s(async()=>ge({apiBaseUrl:a,token:e}),"models"),model:s(async n=>ye({apiBaseUrl:a,token:e,model:n}),"model"),send:s(async n=>Ce({...n,apiBaseUrl:a,token:e}),"send"),stream:s(n=>Oe({...n,apiBaseUrl:a,token:e}),"stream")},tool:{list:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)return{app:u,deploymentId:null,tools:[]};let g=await I(o,e,h),y=ht(g).map(mt);return{app:u,deploymentId:h,tools:y}},"list"),run:s(async(n,c,u)=>{let{app:h}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:u?.forceRefresh}),g=u?.deploymentId||await d(h.id,u?.branch);if(!g)throw new Error("no deployments found");let f=dt(u?.method);return pe(i,e,{appId:h.id,deploymentId:g,toolName:c,method:f,body:u?.body,headers:u?.headers})},"run")},deploy:{watch:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)throw new Error("no deployments found");let g=c?.intervalMs??5e3,f=c?.timeoutMs??240*1e3,y=[],S=new Set,Ee=Date.now(),R=null;for(;Date.now()-Ee<f;){let xe=await L(o,e,h);for(let C of xe)S.has(C.id)||(S.add(C.id),y.push(C),c?.onLog?.(C));if(R=(await B(o,e,h)).status??null,c?.onStatus?.(R),R==="failed")return{deploymentId:h,status:R,logs:y};if(R==="running"||R==="deployed")return{deploymentId:h,status:R,logs:y};await new Promise(C=>setTimeout(C,g))}return{deploymentId:h,status:"timeout",logs:y}},"watch")},template:{status:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return M(o,e,u.id)},"status"),branches:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return _(o,e,u.id)},"branches"),update:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.environment==="preview"?"preview":"production";return H(o,e,u.id,{environment:h})},"update")},opentool:{recipesList:s(async(n={})=>F(o,e,n),"recipesList"),recipesSearch:s(async n=>G(o,e,n),"recipesSearch"),recipeGet:s(async n=>j(o,e,n),"recipeGet"),rulesGet:s(async n=>W(o,e,n),"rulesGet")},apps:{list:s(async n=>{let c=await Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh});return n?.handle?c.filter(u=>u.handle===n.handle):c},"list"),tools:s(async n=>we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh}),"tools"),performance:s(async n=>ne(o,e,{appId:n?.appId}),"performance"),summary:s(async n=>oe(o,e,n.appId),"summary"),schedules:s(async n=>K(o,e,n.appId),"schedules"),schedulesStart:s(async n=>{let{appId:c,...u}=n;return z(o,e,c,u)},"schedulesStart"),schedulesStop:s(async n=>J(o,e,n.appId),"schedulesStop"),schedulesStopCurrent:s(async()=>$(o,e),"schedulesStopCurrent"),scheduleRunNow:s(async n=>V(o,e,n),"scheduleRunNow"),scheduleDelete:s(async n=>Y(o,e,n.appId,n.scheduleId),"scheduleDelete"),scheduleExecutionLogs:s(async n=>Q(o,e,n.scheduleId,{limit:n.limit}),"scheduleExecutionLogs"),scheduleExecutionLog:s(async n=>Z(o,e,n.runId),"scheduleExecutionLog"),deploymentScheduleExecutionLogs:s(async n=>X(o,e,n.deploymentId,{limit:n.limit}),"deploymentScheduleExecutionLogs"),executionTimeline:s(async n=>ee(o,e,n.appId,{limit:n.limit}),"executionTimeline"),assistantRun:s(async n=>ae(o,e,n),"assistantRun"),agentCreate:s(async(n,c)=>{let{refreshCache:u,...h}=n,g={...h,streamDeployLogs:h.streamDeployLogs??!0},f=await te(o,e,g);if(!f.ok){let S=await f.text().catch(()=>"");throw new Error(`agent create failed: ${f.status} ${S}`)}let y=await ft(f,c);if(l&&u!==!1)try{await m()}catch{}return y},"agentCreate"),toolsExecute:s(async n=>le(o,e,n),"toolsExecute"),deploy:s(async n=>E(o,e,n.appId,{environment:n.environment,commitSha:n.commitSha,branch:n.branch}),"deploy"),startApp:s(async n=>{let{appId:c,...u}=n;return b(o,e,c,u)},"startApp"),promotePreview:s(async n=>{let{appId:c,...u}=n;return x(o,e,c,u)},"promotePreview"),envGet:s(async n=>q(o,e,n.appId),"envGet"),envSet:s(async n=>N(o,e,n.appId,{envVars:n.envVars}),"envSet")},repo:{create:s(async n=>{let{refreshCache:c,...u}=n,h=await U(o,e,u);if(l&&c!==!1)try{await m()}catch{}return h},"create")},cache:{refresh:m}}}s(vn,"createClient");export{ie as DEFAULT_CACHE_TTL_MS,It as DEFAULT_LOCAL_PROFILE,w as DEFAULT_OPENPOND_API_BASE_URL,Ne as DEFAULT_OPENPOND_CHAT_API_BASE_URL,He as DEFAULT_OPENPOND_OPCHAT_API_BASE_URL,P as DEFAULT_OPENPOND_WEB_BASE_URL,vt as DEFAULT_PROFILE_AGENT,an as OPENPOND_MANIFEST_FILE_NAME,Ot as OpenPondProfileSetupRequiredError,Rt as OpenPondSandboxClient,Dt as PROFILE_MANIFEST,Bt as PROFILE_REPO_MANIFEST,Ct as SANDBOX_RUNTIME_PROFILE_IDS,ln as SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME,pn as SANDBOX_TEMPLATE_BUILD_PLAN_KIND,rn as SANDBOX_TEMPLATE_PREVIEW_PORT_MAX,sn as SANDBOX_TEMPLATE_PREVIEW_PORT_MIN,cn as SandboxTemplateManifestSchema,un as SandboxTemplateValidationDiagnosticSchema,qe as apiFetch,Tt as assertOpenPondProfileActionReady,St as buildOpenPondProfileSetupGate,re as checkOpenPondApiHealth,wt as collectProfileSourceUploadEntries,tn as commitActiveProfileChanges,ke as commitFiles,rt as computeAtr,ot as computeBollinger,et as computeEma,A as computeEmaSeries,nt as computeMaCross,tt as computeMacd,st as computePriceChange,Xe as computeRsi,Ze as computeSma,T as computeSmaSeries,ft as consumeAgentCreateStream,de as consumeStream,te as createAgentFromPrompt,vn as createClient,Fe as createHeadlessApps,Ke as createLocalProject,At as createOpenPondSandboxClient,U as createRepo,_t as defaultLocalProfileRepoPath,gn as defineSandboxTemplate,Y as deleteOrArchiveSchedule,E as deployApp,H as deployLatestTemplate,Ht as emptyProfileState,pe as executeHostedTool,le as executeUserTool,Ge as fetchToolManifest,Pt as formatOpenPondProfileSetupRequirement,fn as formatSandboxTemplateDiagnostics,Je as formatStreamItem,q as getAppEnvironment,ee as getAppExecutionTimeline,oe as getAppRuntimeSummary,ce as getCachedApps,me as getCachedTools,be as getConfigPath,I as getDeploymentDetail,L as getDeploymentLogs,B as getDeploymentStatus,D as getLatestDeploymentForApp,ye as getOpChatModel,Ae as getOpChatProvider,se as getOpenPondAccount,j as getOpenToolRecipe,W as getOpenToolRules,Z as getScheduleExecutionLog,M as getTemplateStatus,ne as getUserPerformance,xt as hostedPublishStatusFromPayload,Lt as hostedRunStatusFromRunSummary,bt as hostedRunSummaryFromPayload,Et as hostedSourceCheckStatusFromPayload,Nt as initLocalProfileRepo,Vt as inspectOpenPondProfileSource,Ft as installAgentPackageIntoActiveProfile,K as listAppSchedules,v as listApps,Ie as listConfiguredProfiles,X as listDeploymentScheduleExecutionLogs,Ve as listHostedModels,Ye as listHostedProviders,ge as listOpChatModels,Re as listOpChatProviders,F as listOpenToolRecipes,Q as listScheduleExecutionLogs,_ as listTemplateBranches,k as listUserTools,De as loadConfig,Be as loadGlobalConfig,qt as loadLocalProfileRepo,Wt as loadOpenPondProfileLibrary,Gt as loadOpenPondProfileState,zt as loadOpenPondProfileStateForRef,Yt as loadOpenPondProfileStateFromSource,Mt as mergeActiveLocalProfileConfig,Ut as mergeProfileRepoManifestEntry,ze as normalizeDataFrames,yt as normalizeSandboxApiUrl,jt as openPondProfileRef,dn as parseSandboxTemplateYaml,je as postAgentDigest,on as prepareAgentSdkRuntimePackage,x as promotePreviewToProduction,kt as registerLocalProfileRepo,$t as removeOpenPondProfile,Kt as renameActiveProfileAgent,Qt as requireActiveLocalProfile,$e as resolveHostedChatApiBaseUrl,fe as resolveOpChatApiBaseUrl,We as resolveWorkerBaseUrl,Zt as runAgentSdkProjectCommand,ae as runAssistantMode,Qe as runOpChatSmoke,en as runProfileCheck,Xt as runProfileSdkCommand,V as runScheduleNow,Sn as sandboxTemplateBuildMetadata,Tn as sandboxTemplateBuildPlan,Rn as sandboxTemplateDurableVolume,On as sandboxTemplateExecutableEntries,Cn as sandboxTemplateFileInput,wn as sandboxTemplateJsonSchema,An as sandboxTemplatePreviewPort,yn as sandboxTemplateResources,Pn as sandboxTemplateScaffoldFiles,Me as saveConfig,_e as saveGlobalConfig,Ue as saveProfileApiKey,nn as saveProfilePushStatus,G as searchOpenToolRecipes,Jt as selectOpenPondProfile,Ce as sendHostedChatTurn,ve as setActiveProfile,ue as setCachedApps,he as setCachedTools,b as startAppLifecycle,z as startAppSchedules,J as stopAppSchedules,$ as stopCurrentAppSchedules,Oe as streamHostedChatTurn,N as updateAppEnvironment,Le as updateGlobalConfig,hn as validateSandboxTemplateManifest,mn as validateSandboxTemplateYaml};
2
+ import{a as ze,b as de,c as Je}from"./chunks/chunk-22UARBPW.js";import{a as fe,b as $e,c as ge,d as ye,e as Ve,f as Re,g as Ae,h as Ye,i as Ce,j as Oe,k as Qe}from"./chunks/chunk-JEVA7YQL.js";import"./chunks/chunk-X37KMV27.js";import{A as zt,B as Jt,C as $t,D as Vt,E as Yt,F as Qt,G as Xt,H as Zt,I as en,J as tn,K as nn,L as on,b as Ot,c as St,d as Tt,e as Pt,f as wt,g as Et,h as xt,i as bt,j as Lt,k as Bt,l as Dt,m as It,n as vt,o as Ut,p as Mt,q as _t,r as Ht,s as Nt,t as qt,u as kt,v as Kt,w as Ft,x as Gt,y as jt,z as Wt}from"./chunks/chunk-ONDCV5QC.js";import"./chunks/chunk-YDU3S6UT.js";import{$ as Ct,A as z,B as J,C as $,D as V,E as Y,F as Q,G as X,H as Z,I as ee,J as te,K as ne,L as oe,M as se,N as re,O as ae,P as je,Q as le,U as We,V as pe,W as ie,X as ce,Y as ue,Z as me,_ as he,a as qe,b as ke,c as E,d as x,e as b,f as L,g as B,h as D,i as I,j as v,k as Ke,l as U,n as Fe,o as M,p as _,q as H,r as N,s as q,t as Ge,u as k,v as K,w as F,x as G,y as j,z as W}from"./chunks/chunk-EL454L26.js";import"./chunks/chunk-BT5YNE5U.js";import"./chunks/chunk-PXS4SVQG.js";import{a as Rt,b as At}from"./chunks/chunk-FWIPHEVA.js";import{a as be,b as Le,c as Be,d as De,e as Ie,f as ve,g as Ue,h as Me,i as _e}from"./chunks/chunk-ENSB6ZTM.js";import{a as P,b as w,c as He,d as Ne}from"./chunks/chunk-GLUWATL5.js";import"./chunks/chunk-RYGWCN2R.js";import{a as yt}from"./chunks/chunk-ZZWAQBA2.js";import"./chunks/chunk-YR5ID2SS.js";import"./chunks/chunk-KNO355LC.js";import"./chunks/chunk-Y54RKLOI.js";import"./chunks/chunk-2SUMZ73C.js";import"./chunks/chunk-M55H7KVR.js";import"./chunks/chunk-BK63OQRW.js";import"./chunks/chunk-V4KT5FCJ.js";import"./chunks/chunk-3A7HZJNE.js";import{a as sn,b as rn,c as an,d as ln,e as pn,f as cn,g as un,h as mn,i as hn,j as dn,k as fn,l as gn,m as yn,n as Rn,o as An,p as Cn,q as On,r as Sn,s as Tn,t as Pn,u as wn}from"./chunks/chunk-ERJV5BMC.js";import"./chunks/chunk-6FA3GG5B.js";import"./chunks/chunk-LHA7RQBA.js";import"./chunks/chunk-SG6JZ7HD.js";import"./chunks/chunk-ON2RNOCG.js";import"./chunks/chunk-H7IWJN7L.js";import"./chunks/chunk-SFNCAPCJ.js";import"./chunks/chunk-RCA6NGVA.js";import"./chunks/chunk-VHSX3JPX.js";import"./chunks/chunk-BIPQCJ5V.js";import"./chunks/chunk-PF56N7ZY.js";import{a as s}from"./chunks/chunk-FTQLQJQV.js";function Xe(t,e=14){if(t.length<e+1)return null;let r=0,o=0;for(let l=1;l<=e;l+=1){let m=t[l]-t[l-1];m>=0?r+=m:o-=m}let a=r/e,i=o/e;for(let l=e+1;l<t.length;l+=1){let m=t[l]-t[l-1],d=m>0?m:0,n=m<0?-m:0;a=(a*(e-1)+d)/e,i=(i*(e-1)+n)/e}return i===0?100:100-100/(1+a/i)}s(Xe,"computeRsi");function T(t,e){if(t.length<e)return[];let r=[],o=0;for(let a=0;a<t.length;a+=1)o+=t[a],a>=e&&(o-=t[a-e]),a>=e-1&&r.push(o/e);return r}s(T,"computeSmaSeries");function Ze(t,e){let r=T(t,e);return r.length>0?r[r.length-1]:null}s(Ze,"computeSma");function A(t,e){if(t.length<e)return[];let r=2/(e+1),a=t.slice(0,e).reduce((p,l)=>p+l,0)/e,i=[a];for(let p=e;p<t.length;p+=1)a=t[p]*r+a*(1-r),i.push(a);return i}s(A,"computeEmaSeries");function et(t,e){let r=A(t,e);return r.length>0?r[r.length-1]:null}s(et,"computeEma");function tt(t){let e=A(t,12),r=A(t,26);if(e.length===0||r.length===0)return null;let o=e.length-r.length,a=r.map((m,d)=>e[d+o]-m),i=A(a,9);if(i.length===0)return null;let p=a[a.length-1],l=i[i.length-1];return{macd:p,signalLine:l,histogram:p-l}}s(tt,"computeMacd");function nt(t,e,r,o){if(t.length<o)return null;let a=e==="ema"?A(t,r):T(t,r),i=e==="ema"?A(t,o):T(t,o);if(a.length===0||i.length===0)return null;let p=a.length-i.length;if(p<0)return null;let l=i.length-1,m=a[l+p],d=i[l],n=l-1,c=n>=0?a[n+p]:null,u=n>=0?i[n]:null,h="neutral";return c!=null&&u!=null?c<=u&&m>d?h="bullish-cross":c>=u&&m<d?h="bearish-cross":m>d?h="bullish":m<d&&(h="bearish"):m>d?h="bullish":m<d&&(h="bearish"),{fast:m,slow:d,signal:h}}s(nt,"computeMaCross");function ot(t,e=20,r=2){if(t.length<e)return null;let o=t.slice(-e),a=o.reduce((l,m)=>l+m,0)/e,i=o.reduce((l,m)=>l+Math.pow(m-a,2),0)/e,p=Math.sqrt(i);return{middle:a,upper:a+r*p,lower:a-r*p}}s(ot,"computeBollinger");function st(t,e=24){if(t.length<2)return null;let r=t[t.length-1],o=Math.max(0,t.length-1-e),a=t[o];if(a===0)return null;let i=(r-a)/a*100;return{previous:a,percent:i}}s(st,"computePriceChange");function rt(t,e=14){if(t.length<e+1)return null;let r=[];for(let i=1;i<t.length;i+=1){let p=t[i],l=t[i-1],m=p.high-p.low,d=Math.abs(p.high-l.close),n=Math.abs(p.low-l.close);r.push(Math.max(m,d,n))}return r.length<e?null:r.slice(-e).reduce((i,p)=>i+p,0)/e}s(rt,"computeAtr");function Te(t){return t.replace(/\/$/,"")}s(Te,"resolveUrl");function at(t){let e=process.env.OPENPOND_BASE_URL,r=t.baseUrl||e||P;return Te(r.trim())}s(at,"resolveBaseUrl");function lt(t){let e=process.env.OPENPOND_API_URL,r=t.apiUrl||e||w;return Te(r.trim())}s(lt,"resolveApiUrl");function pt(t,e){return fe({apiBaseUrl:e,opChatApiBaseUrl:t.opChatApiUrl,chatApiBaseUrl:t.chatApiUrl})}s(pt,"resolveChatApiUrl");function it(t,e){let r=process.env.OPENPOND_TOOL_URL,o=t.toolUrl||r||e;return Te(o.trim())}s(it,"resolveToolUrl");function ct(t){let e=t.apiKey?.trim();if(e)return e;let r=process.env.OPENPOND_API_KEY?.trim();if(r)return r;throw new Error("OPENPOND_API_KEY is required")}s(ct,"resolveApiKey");function ut(t){let e=t.split("/").filter(Boolean);if(e.length!==2)throw new Error("expected <handle>/<repo>");return{handle:e[0],repo:e[1]}}s(ut,"parseHandleRepo");function Pe(t){return(t||"").trim().toLowerCase()}s(Pe,"normalizeRepoName");function mt(t){if(!t||typeof t!="object")return{name:"unknown",raw:t};let e=t,r=e.profile||e.function,o=typeof e.name=="string"?e.name:typeof r?.name=="string"?r.name:"unknown",a=typeof e.description=="string"?e.description:typeof r?.description=="string"?r.description:void 0;return{name:o,description:a,raw:t}}s(mt,"normalizeToolSummary");function ht(t){if(!t)return[];if(Array.isArray(t.toolsJson))return t.toolsJson;if(t.metadataJson&&typeof t.metadataJson=="object"){let e=t.metadataJson.tools;if(Array.isArray(e))return e}return[]}s(ht,"extractDeploymentTools");async function O(t){let{handle:e,repo:r}=ut(t.target),o=await Se({apiBase:t.apiBase,apiKey:t.apiKey,useCache:t.useCache,cacheTtlMs:t.cacheTtlMs,forceRefresh:t.forceRefresh}),a=Pe(r),i=o.find(p=>p.handle&&p.handle!==e?!1:[p.repo,p.gitRepo,p.id].map(Pe).includes(a));if(!i)throw new Error(`app not found for ${e}/${r}`);return{app:i,handle:e,repo:r}}s(O,"resolveAppTarget");async function Se(t){if(t.useCache&&!t.forceRefresh){let r=await ce({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(r)return r}let e=await v(t.apiBase,t.apiKey);return t.useCache&&await ue({apiBase:t.apiBase,apiKey:t.apiKey,apps:e}),e}s(Se,"fetchAppsWithCache");async function we(t){if(t.useCache&&!t.forceRefresh){let o=await me({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(o)return o}let e=await k(t.apiBase,t.apiKey),r=Array.isArray(e.tools)?e.tools:[];return t.useCache&&await he({apiBase:t.apiBase,apiKey:t.apiKey,tools:r}),r}s(we,"fetchToolsWithCache");function dt(t){if(!t)return"POST";let e=t.toUpperCase();switch(e){case"GET":case"POST":case"PUT":case"DELETE":return e;default:throw new Error("method must be GET, POST, PUT, or DELETE")}}s(dt,"normalizeMethod");async function ft(t,e){let r,o,a;return await de(t,{...e,onConversationId:s(i=>{r=i,e?.onConversationId?.(i)},"onConversationId"),onItems:s(i=>{for(let p of i){let l=p;!o&&typeof l.appId=="string"&&(o=l.appId,e?.onAppId?.(l.appId)),!a&&typeof l.deploymentId=="string"&&(a=l.deploymentId,e?.onDeploymentId?.(l.deploymentId))}e?.onItems?.(i)},"onItems")}),{conversationId:r,appId:o,deploymentId:a}}s(ft,"consumeAgentCreateStream");function vn(t){let e=ct(t),r=at(t),o=lt(t),a=pt(t,o),i=it(t,r),p=t.cacheTtlMs??ie,l=t.useCache!==!1,m=s(async()=>{l&&await Promise.all([Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0}),we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0})])},"refreshCache"),d=s(async(n,c)=>(await D(o,e,n,{branch:c}))?.id??null,"resolveLatestDeploymentId");return{baseUrl:r,apiUrl:o,chatApiUrl:a,toolUrl:i,apiKey:e,account:{get:s(async()=>se(o,e),"get"),health:s(async()=>re(o,e),"health")},chat:{providers:s(async()=>Re({apiBaseUrl:a,token:e}),"providers"),provider:s(async n=>Ae({apiBaseUrl:a,token:e,provider:n}),"provider"),models:s(async()=>ge({apiBaseUrl:a,token:e}),"models"),model:s(async n=>ye({apiBaseUrl:a,token:e,model:n}),"model"),send:s(async n=>Ce({...n,apiBaseUrl:a,token:e}),"send"),stream:s(n=>Oe({...n,apiBaseUrl:a,token:e}),"stream")},tool:{list:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)return{app:u,deploymentId:null,tools:[]};let g=await I(o,e,h),y=ht(g).map(mt);return{app:u,deploymentId:h,tools:y}},"list"),run:s(async(n,c,u)=>{let{app:h}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:u?.forceRefresh}),g=u?.deploymentId||await d(h.id,u?.branch);if(!g)throw new Error("no deployments found");let f=dt(u?.method);return pe(i,e,{appId:h.id,deploymentId:g,toolName:c,method:f,body:u?.body,headers:u?.headers})},"run")},deploy:{watch:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)throw new Error("no deployments found");let g=c?.intervalMs??5e3,f=c?.timeoutMs??240*1e3,y=[],S=new Set,Ee=Date.now(),R=null;for(;Date.now()-Ee<f;){let xe=await L(o,e,h);for(let C of xe)S.has(C.id)||(S.add(C.id),y.push(C),c?.onLog?.(C));if(R=(await B(o,e,h)).status??null,c?.onStatus?.(R),R==="failed")return{deploymentId:h,status:R,logs:y};if(R==="running"||R==="deployed")return{deploymentId:h,status:R,logs:y};await new Promise(C=>setTimeout(C,g))}return{deploymentId:h,status:"timeout",logs:y}},"watch")},template:{status:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return M(o,e,u.id)},"status"),branches:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return _(o,e,u.id)},"branches"),update:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.environment==="preview"?"preview":"production";return H(o,e,u.id,{environment:h})},"update")},opentool:{recipesList:s(async(n={})=>F(o,e,n),"recipesList"),recipesSearch:s(async n=>G(o,e,n),"recipesSearch"),recipeGet:s(async n=>j(o,e,n),"recipeGet"),rulesGet:s(async n=>W(o,e,n),"rulesGet")},apps:{list:s(async n=>{let c=await Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh});return n?.handle?c.filter(u=>u.handle===n.handle):c},"list"),tools:s(async n=>we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh}),"tools"),performance:s(async n=>ne(o,e,{appId:n?.appId}),"performance"),summary:s(async n=>oe(o,e,n.appId),"summary"),schedules:s(async n=>K(o,e,n.appId),"schedules"),schedulesStart:s(async n=>{let{appId:c,...u}=n;return z(o,e,c,u)},"schedulesStart"),schedulesStop:s(async n=>J(o,e,n.appId),"schedulesStop"),schedulesStopCurrent:s(async()=>$(o,e),"schedulesStopCurrent"),scheduleRunNow:s(async n=>V(o,e,n),"scheduleRunNow"),scheduleDelete:s(async n=>Y(o,e,n.appId,n.scheduleId),"scheduleDelete"),scheduleExecutionLogs:s(async n=>Q(o,e,n.scheduleId,{limit:n.limit}),"scheduleExecutionLogs"),scheduleExecutionLog:s(async n=>Z(o,e,n.runId),"scheduleExecutionLog"),deploymentScheduleExecutionLogs:s(async n=>X(o,e,n.deploymentId,{limit:n.limit}),"deploymentScheduleExecutionLogs"),executionTimeline:s(async n=>ee(o,e,n.appId,{limit:n.limit}),"executionTimeline"),assistantRun:s(async n=>ae(o,e,n),"assistantRun"),agentCreate:s(async(n,c)=>{let{refreshCache:u,...h}=n,g={...h,streamDeployLogs:h.streamDeployLogs??!0},f=await te(o,e,g);if(!f.ok){let S=await f.text().catch(()=>"");throw new Error(`agent create failed: ${f.status} ${S}`)}let y=await ft(f,c);if(l&&u!==!1)try{await m()}catch{}return y},"agentCreate"),toolsExecute:s(async n=>le(o,e,n),"toolsExecute"),deploy:s(async n=>E(o,e,n.appId,{environment:n.environment,commitSha:n.commitSha,branch:n.branch}),"deploy"),startApp:s(async n=>{let{appId:c,...u}=n;return b(o,e,c,u)},"startApp"),promotePreview:s(async n=>{let{appId:c,...u}=n;return x(o,e,c,u)},"promotePreview"),envGet:s(async n=>q(o,e,n.appId),"envGet"),envSet:s(async n=>N(o,e,n.appId,{envVars:n.envVars}),"envSet")},repo:{create:s(async n=>{let{refreshCache:c,...u}=n,h=await U(o,e,u);if(l&&c!==!1)try{await m()}catch{}return h},"create")},cache:{refresh:m}}}s(vn,"createClient");export{ie as DEFAULT_CACHE_TTL_MS,It as DEFAULT_LOCAL_PROFILE,w as DEFAULT_OPENPOND_API_BASE_URL,Ne as DEFAULT_OPENPOND_CHAT_API_BASE_URL,He as DEFAULT_OPENPOND_OPCHAT_API_BASE_URL,P as DEFAULT_OPENPOND_WEB_BASE_URL,vt as DEFAULT_PROFILE_AGENT,an as OPENPOND_MANIFEST_FILE_NAME,Ot as OpenPondProfileSetupRequiredError,Rt as OpenPondSandboxClient,Dt as PROFILE_MANIFEST,Bt as PROFILE_REPO_MANIFEST,Ct as SANDBOX_RUNTIME_PROFILE_IDS,ln as SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME,pn as SANDBOX_TEMPLATE_BUILD_PLAN_KIND,rn as SANDBOX_TEMPLATE_PREVIEW_PORT_MAX,sn as SANDBOX_TEMPLATE_PREVIEW_PORT_MIN,cn as SandboxTemplateManifestSchema,un as SandboxTemplateValidationDiagnosticSchema,qe as apiFetch,Tt as assertOpenPondProfileActionReady,St as buildOpenPondProfileSetupGate,re as checkOpenPondApiHealth,wt as collectProfileSourceUploadEntries,tn as commitActiveProfileChanges,ke as commitFiles,rt as computeAtr,ot as computeBollinger,et as computeEma,A as computeEmaSeries,nt as computeMaCross,tt as computeMacd,st as computePriceChange,Xe as computeRsi,Ze as computeSma,T as computeSmaSeries,ft as consumeAgentCreateStream,de as consumeStream,te as createAgentFromPrompt,vn as createClient,Fe as createHeadlessApps,Ke as createLocalProject,At as createOpenPondSandboxClient,U as createRepo,_t as defaultLocalProfileRepoPath,gn as defineSandboxTemplate,Y as deleteOrArchiveSchedule,E as deployApp,H as deployLatestTemplate,Ht as emptyProfileState,pe as executeHostedTool,le as executeUserTool,Ge as fetchToolManifest,Pt as formatOpenPondProfileSetupRequirement,fn as formatSandboxTemplateDiagnostics,Je as formatStreamItem,q as getAppEnvironment,ee as getAppExecutionTimeline,oe as getAppRuntimeSummary,ce as getCachedApps,me as getCachedTools,be as getConfigPath,I as getDeploymentDetail,L as getDeploymentLogs,B as getDeploymentStatus,D as getLatestDeploymentForApp,ye as getOpChatModel,Ae as getOpChatProvider,se as getOpenPondAccount,j as getOpenToolRecipe,W as getOpenToolRules,Z as getScheduleExecutionLog,M as getTemplateStatus,ne as getUserPerformance,xt as hostedPublishStatusFromPayload,Lt as hostedRunStatusFromRunSummary,bt as hostedRunSummaryFromPayload,Et as hostedSourceCheckStatusFromPayload,Nt as initLocalProfileRepo,Vt as inspectOpenPondProfileSource,Ft as installAgentPackageIntoActiveProfile,K as listAppSchedules,v as listApps,Ie as listConfiguredProfiles,X as listDeploymentScheduleExecutionLogs,Ve as listHostedModels,Ye as listHostedProviders,ge as listOpChatModels,Re as listOpChatProviders,F as listOpenToolRecipes,Q as listScheduleExecutionLogs,_ as listTemplateBranches,k as listUserTools,De as loadConfig,Be as loadGlobalConfig,qt as loadLocalProfileRepo,Wt as loadOpenPondProfileLibrary,Gt as loadOpenPondProfileState,zt as loadOpenPondProfileStateForRef,Yt as loadOpenPondProfileStateFromSource,Mt as mergeActiveLocalProfileConfig,Ut as mergeProfileRepoManifestEntry,ze as normalizeDataFrames,yt as normalizeSandboxApiUrl,jt as openPondProfileRef,dn as parseSandboxTemplateYaml,je as postAgentDigest,on as prepareAgentSdkRuntimePackage,x as promotePreviewToProduction,kt as registerLocalProfileRepo,$t as removeOpenPondProfile,Kt as renameActiveProfileAgent,Qt as requireActiveLocalProfile,$e as resolveHostedChatApiBaseUrl,fe as resolveOpChatApiBaseUrl,We as resolveWorkerBaseUrl,Zt as runAgentSdkProjectCommand,ae as runAssistantMode,Qe as runOpChatSmoke,en as runProfileCheck,Xt as runProfileSdkCommand,V as runScheduleNow,Sn as sandboxTemplateBuildMetadata,Tn as sandboxTemplateBuildPlan,Rn as sandboxTemplateDurableVolume,On as sandboxTemplateExecutableEntries,Cn as sandboxTemplateFileInput,wn as sandboxTemplateJsonSchema,An as sandboxTemplatePreviewPort,yn as sandboxTemplateResources,Pn as sandboxTemplateScaffoldFiles,Me as saveConfig,_e as saveGlobalConfig,Ue as saveProfileApiKey,nn as saveProfilePushStatus,G as searchOpenToolRecipes,Jt as selectOpenPondProfile,Ce as sendHostedChatTurn,ve as setActiveProfile,ue as setCachedApps,he as setCachedTools,b as startAppLifecycle,z as startAppSchedules,J as stopAppSchedules,$ as stopCurrentAppSchedules,Oe as streamHostedChatTurn,N as updateAppEnvironment,Le as updateGlobalConfig,hn as validateSandboxTemplateManifest,mn as validateSandboxTemplateYaml};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import"../chunks/chunk-3A7HZJNE.js";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"../chunks/chunk-EAPFMACH.js";import"../chunks/chunk-6FA3GG5B.js";import"../chunks/chunk-ES2ISFJC.js";import"../chunks/chunk-FTQLQJQV.js";export{c as OPENPOND_MANIFEST_FILE_NAME,d as SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME,e as SANDBOX_TEMPLATE_BUILD_PLAN_KIND,b as SANDBOX_TEMPLATE_PREVIEW_PORT_MAX,a as SANDBOX_TEMPLATE_PREVIEW_PORT_MIN,f as SandboxTemplateManifestSchema,g as SandboxTemplateValidationDiagnosticSchema,l as defineSandboxTemplate,k as formatSandboxTemplateDiagnostics,j as parseSandboxTemplateYaml,r as sandboxTemplateBuildMetadata,s as sandboxTemplateBuildPlan,n as sandboxTemplateDurableVolume,q as sandboxTemplateExecutableEntries,p as sandboxTemplateFileInput,u as sandboxTemplateJsonSchema,o as sandboxTemplatePreviewPort,m as sandboxTemplateResources,t as sandboxTemplateScaffoldFiles,i as validateSandboxTemplateManifest,h as validateSandboxTemplateYaml};
2
+ import"../chunks/chunk-3A7HZJNE.js";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"../chunks/chunk-ERJV5BMC.js";import"../chunks/chunk-6FA3GG5B.js";import"../chunks/chunk-PF56N7ZY.js";import"../chunks/chunk-FTQLQJQV.js";export{c as OPENPOND_MANIFEST_FILE_NAME,d as SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME,e as SANDBOX_TEMPLATE_BUILD_PLAN_KIND,b as SANDBOX_TEMPLATE_PREVIEW_PORT_MAX,a as SANDBOX_TEMPLATE_PREVIEW_PORT_MIN,f as SandboxTemplateManifestSchema,g as SandboxTemplateValidationDiagnosticSchema,l as defineSandboxTemplate,k as formatSandboxTemplateDiagnostics,j as parseSandboxTemplateYaml,r as sandboxTemplateBuildMetadata,s as sandboxTemplateBuildPlan,n as sandboxTemplateDurableVolume,q as sandboxTemplateExecutableEntries,p as sandboxTemplateFileInput,u as sandboxTemplateJsonSchema,o as sandboxTemplatePreviewPort,m as sandboxTemplateResources,t as sandboxTemplateScaffoldFiles,i as validateSandboxTemplateManifest,h as validateSandboxTemplateYaml};
@@ -1 +1 @@
1
- .sidebar-task-menu{position:fixed;z-index:1000;width:192px;max-height:calc(100vh - 16px);overflow-y:auto;padding:4px;border:0;border-radius:8px;background:var(--panel);color:var(--text);box-shadow:0 8px 24px #0006}.sidebar-task-menu button{display:flex;align-items:center;gap:8px;width:100%;min-height:32px;padding:6px 8px;border:0;border-radius:4px;background:transparent;color:inherit;font:inherit;font-size:12px;text-align:left;cursor:pointer}.sidebar-task-menu button:hover,.sidebar-task-menu button:focus-visible{background:#000;outline:none}.sidebar-task-menu .task-menu-done{border-top:1px solid var(--border);margin-top:4px}.sidebar-task-menu-trigger.is-open{opacity:1;pointer-events:auto}.sidebar-row.sidebar-task-row.has-running-dot .row-meta{align-self:center;margin-top:0}@media(hover:none){.sidebar-task-menu-trigger{opacity:1;pointer-events:auto}}.sidebar-row-actions.sidebar-task-menu-trigger{background:transparent;padding:0}.sidebar-task-row:hover .sidebar-task-menu-trigger .sidebar-row-action,.sidebar-task-row:focus-within .sidebar-task-menu-trigger .sidebar-row-action,.sidebar-task-menu-trigger.is-open .sidebar-row-action{background:var(--panel)}.sidebar .sidebar-row.sidebar-task-row{display:grid;grid-template-columns:24px minmax(0,1fr) auto;min-width:0;max-width:100%;gap:8px;border:1px solid var(--border);margin:4px 6px;width:calc(100% - 12px);border-radius:8px}.sidebar .sidebar-pinned-section,.sidebar .sidebar-projects-section,.sidebar .sidebar-ordinary-section{padding-inline:6px}.sidebar-pinned-section>.section-header,.sidebar-projects-section>.section-header,.sidebar-ordinary-section>.section-header{margin-inline:8px}.sidebar :is(.sidebar-pinned-section,.sidebar-projects-section,.sidebar-ordinary-section) .sidebar-task-row{width:100%;margin-inline:0}.sidebar .sidebar-task-row .row-meta{position:static;display:flex;align-items:center;align-self:center;gap:2px;min-width:0;width:auto;height:auto}.sidebar .sidebar-task-row .row-meta-status{flex:0 0 auto}.sidebar .sidebar-task-row .sidebar-task-menu-trigger{position:static;transform:none;flex:0 0 auto}.sidebar-title-slot{display:flex;min-width:0;max-width:100%;align-items:center;gap:3px;overflow:hidden}.sidebar-source-slot,.conversation-source-icon{width:24px;flex:0 0 24px;display:inline-flex;align-items:center;justify-content:center}.conversation-source-icon{height:24px}.conversation-source-icon img{width:16px;height:16px;object-fit:contain}.conversation-source-icon{font-size:17px;color:var(--muted)}.sidebar .sidebar-task-row .row-label-shell{display:flex;flex-direction:column;align-items:flex-start;flex:1 1 0;min-width:0;max-width:100%;overflow:hidden}.sidebar .sidebar-task-row .sidebar-session-title-line,.sidebar .sidebar-task-row .sidebar-task-title{min-width:0;max-width:100%;overflow:hidden}.sidebar .sidebar-task-row .sidebar-task-title-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sidebar .sidebar-child-toggle{position:static;flex:0 0 15px;width:15px}.sidebar-inbox-row{min-height:54px;padding-top:8px;padding-bottom:8px}.sidebar-inbox-project{display:flex;align-items:center;gap:5px;min-width:0;min-height:18px;max-width:100%;text-align:left;overflow:hidden;white-space:nowrap;color:var(--muted);font-size:11px;line-height:18px}.sidebar-inbox-project-name{overflow:hidden;text-overflow:ellipsis}.sidebar-inbox-project time{flex:0 0 auto}.sidebar-inbox-done{display:inline-grid;place-items:center;width:30px;height:30px;flex:0 0 auto;border:0;background:transparent;color:var(--muted);border-radius:7px}.sidebar-inbox-done:hover,.sidebar-inbox-done:focus-visible{background:#80808033;color:var(--text)}.sidebar-threads-header{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:10px 12px 5px;font-size:12px;color:var(--muted)}.sidebar-threads-header-actions{display:flex;gap:4px;align-items:center}.sidebar-threads-header .sidebar-icon.active{color:var(--text);background:#8080802e}.sidebar-thread-inbox .section-actions{opacity:1}.sidebar-inbox-date{margin:16px 12px 6px;font-size:12px;font-weight:500;color:var(--muted)}.sidebar-threads-header-actions{margin-left:auto}.native-setup-terminal{position:fixed;inset:auto 0 0;height:min(420px,70vh);z-index:120}.native-setup-terminal .guake-terminal-overlay{height:100%}.provider-plan-usage{display:grid;gap:12px;padding-top:12px;border-top:1px solid var(--border);font-size:12px}.plan-usage-heading,.plan-usage-window>div{display:flex;align-items:center;justify-content:space-between;gap:12px}.plan-usage-heading{justify-content:flex-end;color:var(--muted)}.plan-usage-refresh{display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:5px;cursor:pointer}.plan-usage-refresh:hover{color:var(--text);background:var(--hover)}.plan-usage-refresh:disabled{opacity:.5;cursor:default}.plan-usage-window{display:grid;gap:5px}.plan-usage-window strong{font-weight:500;font-variant-numeric:tabular-nums}.plan-usage-window meter{width:100%;height:6px;border:0;border-radius:6px;overflow:hidden;background:#353535}.plan-usage-window meter::-webkit-meter-bar{background:#353535;border:0;border-radius:6px}.plan-usage-window meter::-webkit-meter-optimum-value{background:#8ccdaa}.plan-usage-window meter::-webkit-meter-suboptimum-value{background:#e3ba79}.plan-usage-window meter::-webkit-meter-even-less-good-value{background:#e28b84}.plan-usage-window meter::-moz-meter-bar{background:#8ccdaa}.provider-plan-usage small,.provider-plan-usage p{color:var(--muted);line-height:1.5;font-size:11px;margin:0}.plan-usage-note{opacity:.8}.user-auth-plan-usage{padding:6px;border-top:1px solid var(--border)}.plan-usage-compact{display:flex;align-items:center;justify-content:space-between;width:100%;gap:18px;border:0;border-radius:5px;padding:7px 8px;background:transparent;color:inherit;font-size:12px;text-align:left;cursor:pointer}.plan-usage-compact:hover,.plan-usage-compact:focus-visible{background:#ffffff0f}.plan-usage-compact-values{display:flex;align-items:baseline;justify-content:flex-end;flex-wrap:wrap;gap:6px 12px}.plan-usage-compact-value{display:flex;align-items:baseline;gap:5px;white-space:nowrap}.plan-usage-compact-values strong{font-weight:500;font-variant-numeric:tabular-nums}.plan-usage-compact-value small{font-size:10px;color:var(--muted)}.app-shell:has(>.desktop-navigation-rail){grid-template-columns:52px var(--sidebar-width) minmax(0,1fr)}.app-shell.sidebar-closed:has(>.desktop-navigation-rail){grid-template-columns:52px 0 minmax(0,1fr)}.app-shell .content-shell{grid-column:3}.desktop-navigation-rail{grid-column:1;grid-row:1;z-index:25;min-height:0;display:flex;flex-direction:column;align-items:center;gap:18px;padding:10px 6px;background:var(--shell-navigation-bg)}.app-shell>.sidebar{grid-column:2;grid-row:1}.app-shell:has(>.desktop-navigation-rail)>.sidebar-resize-handle{grid-column:2 / 3}.desktop-rail-destinations{display:flex;flex-direction:column;align-items:center;gap:7px;width:36px;flex:0 0 auto}.desktop-rail-button{width:36px;height:36px;border:0;border-radius:9px;display:grid;place-items:center;color:var(--muted);background:transparent}.desktop-rail-button:hover,.desktop-rail-button.active{background:#80808029;color:var(--text)}.desktop-rail-button:focus-visible{outline:2px solid var(--text);outline-offset:2px}.desktop-navigation-rail [data-rail-tooltip]{position:relative}.desktop-navigation-rail [data-rail-tooltip]:after{content:attr(data-rail-tooltip);position:absolute;z-index:60;left:calc(100% + 12px);top:50%;transform:translateY(-50%);padding:7px 10px;border:1px solid var(--border);border-radius:7px;background:var(--panel);color:var(--text);box-shadow:0 4px 16px #00000040;font-size:12px;font-weight:500;line-height:1.3;white-space:nowrap;pointer-events:none;opacity:0;visibility:hidden;transition:opacity .1s ease,visibility .1s ease}.desktop-navigation-rail [data-rail-tooltip]:hover:after,.desktop-navigation-rail [data-rail-tooltip]:focus-visible:after{opacity:1;visibility:visible}.desktop-rail-account{margin-top:auto;width:36px}.desktop-rail-account .user-auth-trigger{width:36px;height:36px;padding:0;grid-template-columns:1fr;gap:0;place-items:center}.desktop-rail-account .user-auth-name{display:none}.desktop-rail-account .user-auth-menu{position:fixed;left:52px;bottom:12px;max-width:calc(100vw - 64px)}@media(max-width:980px){.app-shell.sidebar-open:has(>.desktop-navigation-rail),.app-shell.sidebar-closed:has(>.desktop-navigation-rail){grid-template-columns:52px 0 minmax(0,1fr)}.app-shell>.sidebar{position:absolute;grid-column:1 / -1;left:52px;top:0;bottom:0;max-width:calc(100vw - 52px)}.app-shell:has(>.desktop-navigation-rail)>.sidebar-resize-handle{grid-column:1 / -1;left:calc(52px + min(var(--sidebar-width),86vw,calc(100vw - 52px)))}}.human-review-inbox-control{position:relative;display:inline-grid;place-items:center;flex:0 0 32px;min-width:32px;overflow:visible}.human-review-inbox-control svg{flex-shrink:0}.human-review-inbox-count{position:absolute;top:-3px;right:-6px;min-width:15px;padding:1px 3px;border-radius:8px;background:var(--text);color:var(--bg);font-size:9px;line-height:12px;text-align:center}@media(min-width:700px)and (max-width:980px){.app-shell.sidebar-open:has(>.desktop-navigation-rail){grid-template-columns:52px min(var(--sidebar-width),32vw) minmax(0,1fr)}.app-shell.sidebar-open:has(>.desktop-navigation-rail)>.sidebar{position:relative;grid-column:2;left:0;width:min(var(--sidebar-width),32vw)}.app-shell.sidebar-open:has(>.desktop-navigation-rail)>.sidebar-resize-handle{grid-column:2 / 3;left:auto}}.desktop-rail-button.desktop-training-entry,.desktop-rail-button.desktop-training-entry:hover,.desktop-rail-button.desktop-training-entry.active{color:#74d4df}
1
+ .sidebar-task-menu{position:fixed;z-index:1000;width:192px;max-height:calc(100vh - 16px);overflow-y:auto;padding:4px;border:0;border-radius:8px;background:var(--panel);color:var(--text);box-shadow:0 8px 24px #0006}.sidebar-task-menu button{display:flex;align-items:center;gap:8px;width:100%;min-height:32px;padding:6px 8px;border:0;border-radius:4px;background:transparent;color:inherit;font:inherit;font-size:12px;text-align:left;cursor:pointer}.sidebar-task-menu button:hover,.sidebar-task-menu button:focus-visible{background:#000;outline:none}.sidebar-task-menu .task-menu-done{border-top:1px solid var(--border);margin-top:4px}.sidebar-task-menu-trigger.is-open{opacity:1;pointer-events:auto}.sidebar-row.sidebar-task-row.has-running-dot .row-meta{align-self:center;margin-top:0}@media(hover:none){.sidebar-task-menu-trigger{opacity:1;pointer-events:auto}}.sidebar-row-actions.sidebar-task-menu-trigger{background:transparent;padding:0}.sidebar-task-row:hover .sidebar-task-menu-trigger .sidebar-row-action,.sidebar-task-row:focus-within .sidebar-task-menu-trigger .sidebar-row-action,.sidebar-task-menu-trigger.is-open .sidebar-row-action{background:var(--panel)}.sidebar .sidebar-row.sidebar-task-row{display:grid;grid-template-columns:24px minmax(0,1fr) auto;min-width:0;max-width:100%;gap:8px;border:1px solid var(--border);margin:4px 6px;width:calc(100% - 12px);border-radius:8px}.sidebar .sidebar-pinned-section,.sidebar .sidebar-projects-section,.sidebar .sidebar-ordinary-section{padding-inline:6px}.sidebar-pinned-section>.section-header,.sidebar-projects-section>.section-header,.sidebar-ordinary-section>.section-header{margin-inline:8px}.sidebar :is(.sidebar-pinned-section,.sidebar-projects-section,.sidebar-ordinary-section) .sidebar-task-row{width:100%;margin-inline:0}.sidebar .sidebar-task-row .row-meta{position:static;display:flex;align-items:center;align-self:center;gap:2px;min-width:0;width:auto;height:auto}.sidebar .sidebar-task-row .row-meta-status{flex:0 0 auto}.sidebar .sidebar-task-row .sidebar-task-menu-trigger{position:static;transform:none;flex:0 0 auto}.sidebar-title-slot{display:flex;min-width:0;max-width:100%;align-items:center;gap:3px;overflow:hidden}.sidebar-source-slot,.conversation-source-icon{width:24px;flex:0 0 24px;display:inline-flex;align-items:center;justify-content:center}.conversation-source-icon{height:24px}.conversation-source-icon img{width:16px;height:16px;object-fit:contain}.conversation-source-icon{font-size:17px;color:var(--muted)}.sidebar .sidebar-task-row .row-label-shell{display:flex;flex-direction:column;align-items:flex-start;flex:1 1 0;min-width:0;max-width:100%;overflow:hidden}.sidebar .sidebar-task-row .sidebar-session-title-line,.sidebar .sidebar-task-row .sidebar-task-title{min-width:0;max-width:100%;overflow:hidden}.sidebar .sidebar-task-row .sidebar-task-title-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sidebar .sidebar-child-toggle{position:static;flex:0 0 15px;width:15px}.sidebar-inbox-row{min-height:54px;padding-top:8px;padding-bottom:8px}.sidebar-inbox-project{display:flex;align-items:center;gap:5px;min-width:0;min-height:18px;max-width:100%;text-align:left;overflow:hidden;white-space:nowrap;color:var(--muted);font-size:11px;line-height:18px}.sidebar-inbox-project-name{overflow:hidden;text-overflow:ellipsis}.sidebar-inbox-project time{flex:0 0 auto}.sidebar-inbox-done{display:inline-grid;place-items:center;width:30px;height:30px;flex:0 0 auto;border:0;background:transparent;color:var(--muted);border-radius:7px}.sidebar-inbox-done:hover,.sidebar-inbox-done:focus-visible{background:#80808033;color:var(--text)}.sidebar-threads-header{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:10px 12px 5px;font-size:12px;color:var(--muted)}.sidebar-threads-header-actions{display:flex;gap:4px;align-items:center}.sidebar-threads-header .sidebar-icon.active{color:var(--text);background:#8080802e}.sidebar-thread-inbox .section-actions{opacity:1}.sidebar-inbox-date{margin:16px 12px 6px;font-size:12px;font-weight:500;color:var(--muted)}.sidebar-threads-header-actions{margin-left:auto}.native-setup-terminal{position:fixed;inset:auto 0 0;height:min(420px,70vh);z-index:120}.native-setup-terminal .guake-terminal-overlay{height:100%}.provider-plan-usage{display:grid;gap:12px;padding-top:12px;border-top:1px solid var(--border);font-size:12px}.plan-usage-heading,.plan-usage-window>div{display:flex;align-items:center;justify-content:space-between;gap:12px}.plan-usage-heading{justify-content:flex-end;color:var(--muted)}.plan-usage-refresh{display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:5px;cursor:pointer}.plan-usage-refresh:hover{color:var(--text);background:var(--hover)}.plan-usage-refresh:disabled{opacity:.5;cursor:default}.plan-usage-window{display:grid;gap:5px}.plan-usage-window strong{font-weight:500;font-variant-numeric:tabular-nums}.plan-usage-window meter{width:100%;height:6px;border:0;border-radius:6px;overflow:hidden;background:#353535}.plan-usage-window meter::-webkit-meter-bar{background:#353535;border:0;border-radius:6px}.plan-usage-window meter::-webkit-meter-optimum-value{background:#8ccdaa}.plan-usage-window meter::-webkit-meter-suboptimum-value{background:#e3ba79}.plan-usage-window meter::-webkit-meter-even-less-good-value{background:#e28b84}.plan-usage-window meter::-moz-meter-bar{background:#8ccdaa}.provider-plan-usage small,.provider-plan-usage p{color:var(--muted);line-height:1.5;font-size:11px;margin:0}.plan-usage-note{opacity:.8}.user-auth-plan-usage{padding:6px;border-top:1px solid var(--border)}.plan-usage-compact{display:flex;align-items:center;justify-content:space-between;width:100%;gap:18px;border:0;border-radius:5px;padding:7px 8px;background:transparent;color:inherit;font-size:12px;text-align:left;cursor:pointer}.plan-usage-compact:hover,.plan-usage-compact:focus-visible{background:#ffffff0f}.plan-usage-compact-values{display:flex;align-items:baseline;justify-content:flex-end;flex-wrap:wrap;gap:6px 12px}.plan-usage-compact-value{display:flex;align-items:baseline;gap:5px;white-space:nowrap}.plan-usage-compact-values strong{font-weight:500;font-variant-numeric:tabular-nums}.plan-usage-compact-value small{font-size:10px;color:var(--muted)}.app-shell:has(>.desktop-navigation-rail){grid-template-columns:52px var(--sidebar-width) minmax(0,1fr)}.app-shell.sidebar-closed:has(>.desktop-navigation-rail){grid-template-columns:52px 0 minmax(0,1fr)}.app-shell .content-shell{grid-column:3}.desktop-navigation-rail{grid-column:1;grid-row:1;z-index:25;min-height:0;display:flex;flex-direction:column;align-items:center;gap:18px;padding:10px 6px;background:var(--shell-navigation-bg)}.platform-macos>.desktop-navigation-rail{padding-top:53px}.app-shell>.sidebar{grid-column:2;grid-row:1}.app-shell:has(>.desktop-navigation-rail)>.sidebar-resize-handle{grid-column:2 / 3}.desktop-rail-destinations{display:flex;flex-direction:column;align-items:center;gap:7px;width:36px;flex:0 0 auto}.desktop-rail-button{width:36px;height:36px;border:0;border-radius:9px;display:grid;place-items:center;color:var(--muted);background:transparent}.desktop-rail-button:hover,.desktop-rail-button.active{background:#80808029;color:var(--text)}.desktop-rail-button:focus-visible{outline:2px solid var(--text);outline-offset:2px}.desktop-navigation-rail [data-rail-tooltip]{position:relative}.desktop-navigation-rail [data-rail-tooltip]:after{content:attr(data-rail-tooltip);position:absolute;z-index:60;left:calc(100% + 12px);top:50%;transform:translateY(-50%);padding:7px 10px;border:1px solid var(--border);border-radius:7px;background:var(--panel);color:var(--text);box-shadow:0 4px 16px #00000040;font-size:12px;font-weight:500;line-height:1.3;white-space:nowrap;pointer-events:none;opacity:0;visibility:hidden;transition:opacity .1s ease,visibility .1s ease}.desktop-navigation-rail [data-rail-tooltip]:hover:after,.desktop-navigation-rail [data-rail-tooltip]:focus-visible:after{opacity:1;visibility:visible}.desktop-rail-account{margin-top:auto;width:36px}.desktop-rail-account .user-auth-trigger{width:36px;height:36px;padding:0;grid-template-columns:1fr;gap:0;place-items:center}.desktop-rail-account .user-auth-name{display:none}.desktop-rail-account .user-auth-menu{position:fixed;left:52px;bottom:12px;max-width:calc(100vw - 64px)}@media(max-width:980px){.app-shell.sidebar-open:has(>.desktop-navigation-rail),.app-shell.sidebar-closed:has(>.desktop-navigation-rail){grid-template-columns:52px 0 minmax(0,1fr)}.app-shell>.sidebar{position:absolute;grid-column:1 / -1;left:52px;top:0;bottom:0;max-width:calc(100vw - 52px)}.app-shell:has(>.desktop-navigation-rail)>.sidebar-resize-handle{grid-column:1 / -1;left:calc(52px + min(var(--sidebar-width),86vw,calc(100vw - 52px)))}}.human-review-inbox-control{position:relative;display:inline-grid;place-items:center;flex:0 0 32px;min-width:32px;overflow:visible}.human-review-inbox-control svg{flex-shrink:0}.human-review-inbox-count{position:absolute;top:-3px;right:-6px;min-width:15px;padding:1px 3px;border-radius:8px;background:var(--text);color:var(--bg);font-size:9px;line-height:12px;text-align:center}@media(min-width:700px)and (max-width:980px){.app-shell.sidebar-open:has(>.desktop-navigation-rail){grid-template-columns:52px min(var(--sidebar-width),32vw) minmax(0,1fr)}.app-shell.sidebar-open:has(>.desktop-navigation-rail)>.sidebar{position:relative;grid-column:2;left:0;width:min(var(--sidebar-width),32vw)}.app-shell.sidebar-open:has(>.desktop-navigation-rail)>.sidebar-resize-handle{grid-column:2 / 3;left:auto}}.desktop-rail-button.desktop-training-entry,.desktop-rail-button.desktop-training-entry:hover,.desktop-rail-button.desktop-training-entry.active{color:#74d4df}