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,6 +1,6 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as me,c as $,e as L,f as pe,g as ve,h as fe,i as ge,j as Ie,k as q,m as B}from"./chunk-TIHXUKFD.js";import"./chunk-JQKSXCAJ.js";import{c as de}from"./chunk-GW766ZSO.js";import{i as te}from"./chunk-GOPFFQZU.js";import{a as ae,b as oe,c as ie,d as se,e as le,f as ce,g as ue,i as N}from"./chunk-O3RF72BT.js";import"./chunk-KVTBX2UP.js";import{b as ne}from"./chunk-MMQRHR3V.js";import{b as re}from"./chunk-PCSIOUHF.js";import"./chunk-7KWD2I6W.js";import"./chunk-BQS7Z4AP.js";import"./chunk-XW6HGSIT.js";import{g as E}from"./chunk-57TRXBLT.js";import"./chunk-FKJHEZCW.js";import{A as X,K as ee}from"./chunk-EUMXMT3S.js";import{c as J,d as G,e as W,f as Y,g as Z,j as C}from"./chunk-Q4TBTRIG.js";import"./chunk-DIO5CB6U.js";import"./chunk-GJ2ZJFDD.js";import"./chunk-BFKYRQMA.js";import"./chunk-RZUEVS64.js";import"./chunk-3QIB5FXI.js";import"./chunk-L3KS6MOV.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-YR5ID2SS.js";import"./chunk-APB2STJK.js";import"./chunk-Y4OWBBDD.js";import"./chunk-6ZFPQYHG.js";import"./chunk-JFXWI3EN.js";import"./chunk-6FA3GG5B.js";import"./chunk-MNC4YUDI.js";import{E as M}from"./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{b as d}from"./chunk-ES2ISFJC.js";import{a as i}from"./chunk-FTQLQJQV.js";var Ee=new Set(["applying_source","running_checks","evaluating","awaiting_promotion","opening_pull_request","pull_request_open","reconciling_release","released","ready","ready_local","pushing_hosted","running_hosted_checks","published_hosted"]);function H(e){return Ee.has(e)}i(H,"isCreateImproveMutationState");function z(e){let t=e.run;if(!t)return;let n=e.actionLabel??"Create/Improve update";if(t.plan&&t.plan.runId!==t.id)throw new Error(`${n} requires a plan linked to the submitted run.`);if(t.workflowCapture&&t.workflowCapture.runId!==t.id)throw new Error(`${n} requires workflow capture linked to the submitted run.`);if(t.plan?.approvalId&&!t.approvalIds.includes(t.plan.approvalId))throw new Error(`${n} requires the plan approval id in the run.`)}i(z,"assertCreateImproveRunLinked");function he(e){let t=e.actionLabel??"Create/Improve mutation",n=e.run;if(!n)throw new Error(`${t} requires a Create/Improve run.`);if(z({actionLabel:t,run:n}),!H(n.state))throw new Error(`${t} cannot start before plan approval.`);if(n.plan?.status!=="approved")throw new Error(`${t} requires an approved plan.`)}i(he,"assertCreateImproveMutationApproved");import{randomUUID as F}from"node:crypto";var $e=d.object({id:d.string().trim().min(1).optional(),label:d.string().trim().min(1),value:d.string().trim().min(1).optional(),description:d.string().trim().min(1).nullable().optional()}),Oe=d.object({id:d.string().trim().min(1).optional(),kind:d.preprocess(Ye,d.enum(["single_choice","free_text"]).default("single_choice")),title:d.string().trim().min(1),prompt:d.string().trim().min(1),required:d.boolean().default(!0),options:d.array($e).default([])}),je=d.object({path:d.string().trim().min(1),operation:d.preprocess(Ze,d.enum(["create","update","delete","inspect"])),reason:d.string().trim().min(1)}),De=d.object({name:d.string().trim().min(1),command:d.string().trim().min(1),required:d.boolean().default(!0)}),Me=d.object({targetId:d.string().trim().min(1).optional().nullable(),targetName:d.string().trim().min(1).optional().nullable(),agentId:d.string().trim().min(1).optional().nullable(),agentName:d.string().trim().min(1).optional().nullable(),summary:d.string().trim().min(1),capturedContextSummary:d.string().trim().min(1),actionShape:G,defaultChatAction:d.object({key:d.string().trim().min(1).nullable().optional(),label:d.string().trim().min(1).nullable().optional(),required:d.boolean().default(!0)}).optional().nullable(),sourcePlan:d.array(je).default([]),requirements:d.array(J).default([]),checks:d.array(De).default([])}),ke=d.discriminatedUnion("decision",[d.object({schemaVersion:d.literal("openpond.createImprove.plannerDecision.v1"),decision:d.literal("questions"),summary:d.string().trim().min(1).optional().nullable(),questions:d.array(Oe).min(1)}),d.object({schemaVersion:d.literal("openpond.createImprove.plannerDecision.v1"),decision:d.literal("plan"),plan:Me})]);async function Pe(e){let t=Ve(e.run);if(t)return Ce({run:e.run,decision:t,modelRef:null});let n=Ke(e.run),o=await Re(e.stream,n),a;try{a=we(o)}catch(u){let v=Qe({messages:n,invalidContent:o,error:u}),R=await Re(e.stream,v);try{a=we(R)}catch(I){throw new Error(`Create/Improve planner repair failed: ${K(I)}; initial error: ${K(u)}`)}}return Ce({run:e.run,decision:a,modelRef:e.modelRef??null})}i(Pe,"runModelBackedCreateImprovePlanner");async function Re(e,t){let n="";for await(let o of e(t))o.text&&(n+=o.text);return n}i(Re,"collectPlannerText");function Ce(e){return e.decision.decision==="questions"?Ne(e.run,e.decision,e.modelRef??null):Le(e.run,e.decision.plan,e.modelRef??null)}i(Ce,"createImproveRunFromPlannerDecision");function Ae(e){let t=new Date().toISOString();return C(e.run,{state:"blocked",plan:null,workflowCapture:Q(e.run),blockedReason:e.reason,metadata:{...e.run.metadata,...U(e.modelRef??null),plannerDecision:"blocked",plannerError:e.reason},updatedAt:t})}i(Ae,"createBlockedCreateImprovePlannerRun");function Ne(e,t,n){let o=new Date().toISOString(),a=t.questions.map((u,v)=>Y.parse({id:u.id??`create_improve_question_${v+1}`,kind:u.kind,title:u.title,prompt:u.prompt,required:u.required,status:"pending",options:u.options.map((R,I)=>({id:R.id??`option_${I+1}`,label:R.label,value:R.value??R.label,description:R.description??null,metadata:{}})),answer:null,metadata:{}}));return C(e,{state:"awaiting_questions",plan:null,workflowCapture:Q(e),approvalIds:[],questionIds:a.map(u=>u.id),questions:a,blockedReason:null,metadata:{...e.metadata,...U(n),plannerDecision:"questions",plannerSummary:t.summary??null},updatedAt:o})}i(Ne,"createQuestionRun");function Le(e,t,n){let o=new Date().toISOString(),a=`create_improve_plan_${F()}`,u=`approval_${F()}`,v=Be(e.target,t,e.objective),R=be(v),I=t.actionShape,k=t.checks.length?t.checks:ze(v.kind),w=t.sourcePlan.length?t.sourcePlan:He({run:{...e,target:v},sourceRoot:R}),b=t.defaultChatAction?.key??I.defaultActionKey??(v.kind==="agent"?v.defaultActionKey:null)??"chat",m=e.surface==="lab_improve"?Fe():U(n),f=W.parse({schemaVersion:"openpond.createImprove.plan.v1",id:a,runId:e.id,status:"pending_approval",objective:e.objective,summary:t.summary,capturedContextSummary:t.capturedContextSummary,defaultChatAction:{key:b,label:t.defaultChatAction?.label??v.displayName??"Chat",required:t.defaultChatAction?.required??!0},sourcePlan:w,requirements:t.requirements,checks:k,approvalId:u,approvedAt:null,editedFromPlanId:null,metadata:{...m,target:v,actionShape:I,actionShapeDecisionSource:e.surface==="lab_improve"?"lab_improve_default_planner":"model_planner"},createdAt:o,updatedAt:o}),y=e.questions.map(h=>h.status==="pending"?{...h,status:"skipped"}:h);return C(e,{state:"awaiting_plan_approval",target:v,plan:f,workflowCapture:Q(e),approvalIds:[u],questionIds:y.map(h=>h.id),questions:y,blockedReason:null,metadata:{...e.metadata,...m,plannerDecision:"plan"},updatedAt:o})}i(Le,"createPlanRun");function Be(e,t,n){let o=t.targetId??t.agentId,a=t.targetName??t.agentName;if(e.kind!=="agent")return{...e,id:e.id??o??null,displayName:e.displayName??a??null};let u=D(o??"")||e.id||D(a??"")||et(n),v=e.id===u&&e.defaultActionKey?e.defaultActionKey:`${u}.chat`;return{...e,id:u,displayName:a??e.displayName,defaultActionKey:v}}i(Be,"plannedTarget");function Q(e){if(e.workflowCapture)return e.workflowCapture;let t=new Date().toISOString(),n=S(e.context.tools.flatMap(o=>o.artifactRefs));return Z.parse({schemaVersion:"openpond.createImprove.workflowCapture.v1",id:`workflow_capture_${F()}`,runId:e.id,command:e.command,objective:e.objective,conversationExcerpts:e.context.conversationExcerpts,attachments:e.context.attachments,apps:e.context.apps,tools:e.context.tools,sideEffects:S(e.context.tools.flatMap(o=>o.sideEffects)),profileActions:S(e.context.tools.map(o=>o.name)),externalProviders:S([...e.context.apps.map(o=>o.name),...e.context.tools.map(o=>tt(o.name))]),environmentVariables:[],files:S(e.context.attachments.map(o=>o.ref?`${o.name} (${o.ref})`:o.name)),schedules:[],webhooks:[],channelTargets:["openpond_chat"],outputArtifacts:n,targetRepoAssumptions:e.context.targetRepoAssumptions,traceRefs:n.filter(o=>/\btrace\b|trace[:/-]/i.test(o)),metadata:{source:"create_improve_model_planner",conversationId:e.scope.conversationId,projectId:e.scope.projectId},createdAt:t})}i(Q,"workflowCaptureForRun");function He(e){return e.run.operation==="improve"&&e.run.target.id?[{path:be(e.run.target),operation:"update",reason:e.run.objective},{path:"settings/profile.yaml",operation:"update",reason:"Preserve the active Profile composition and routing."}]:[{path:e.sourceRoot,operation:"create",reason:e.run.objective},{path:"settings/profile.yaml",operation:"update",reason:"Register the workproduct in the active Profile."}]}i(He,"defaultSourcePlan");function ze(e){return e==="agent"?[{name:"inspect",command:"pnpm agent:inspect",required:!0},{name:"build",command:"pnpm build",required:!0},{name:"validate",command:"pnpm agent:validate",required:!0},{name:"eval",command:"pnpm agent:eval",required:!0}]:[{name:"build",command:"pnpm build",required:!0},{name:"validate",command:"pnpm run typecheck",required:!0}]}i(ze,"defaultChecks");function be(e){let t=D(e.id??e.displayName??"")||"draft";return e.kind==="agent"?t==="default"?"agent":`agents/${t}`:e.kind==="skill"?`skills/${e.skillName??t}`:e.kind==="extension"?`extensions/${t}`:e.kind==="model"?`training/models/${t}`:e.kind==="unselected"?"profile":`settings/${e.key??t}`}i(be,"sourceRootForTarget");function U(e){return{planner:{kind:"model",source:"create_improve_model_planner",providerId:e?.providerId??null,modelId:e?.modelId??null}}}i(U,"plannerProvenance");function Fe(){return{planner:{kind:"deterministic",source:"lab_improve_default_planner",providerId:null,modelId:null}}}i(Fe,"deterministicLabPlannerProvenance");function Ke(e){return[{role:"system",content:rt},{role:"user",content:JSON.stringify({run:e,instruction:"Return only openpond.createImprove.plannerDecision.v1 JSON. Ask questions only when the user cannot approve a meaningful plan yet."},null,2)}]}i(Ke,"createImprovePlannerMessages");function Qe(e){return[...e.messages,{role:"assistant",content:We(e.invalidContent)},{role:"user",content:["The previous OpenPond Create/Improve planner decision failed schema validation.","Return only one corrected openpond.createImprove.plannerDecision.v1 JSON object.","Keep the same user intent and plan. Only change fields needed to satisfy the schema.","plan.requirements is only for setup or dependency rows. Use [] when no setup is required.",'For questions use: {"schemaVersion":"openpond.createImprove.plannerDecision.v1","decision":"questions","questions":[{"kind":"free_text","title":"Short label","prompt":"Complete question?","required":true,"options":[]}]}','For a plan use: {"schemaVersion":"openpond.createImprove.plannerDecision.v1","decision":"plan","plan":{...}}',"Do not wrap the JSON in Markdown or add prose.",`Validation error: ${K(e.error)}`].join(`
2
+ import{a as me,c as $,e as L,f as pe,g as ve,h as fe,i as ge,j as Ie,k as q,m as B}from"./chunk-M2SKXY5C.js";import"./chunk-OY5HC2P6.js";import{c as de}from"./chunk-GW766ZSO.js";import{b as ne}from"./chunk-7RC5WPVT.js";import{b as re}from"./chunk-A3L74U3W.js";import"./chunk-7KWD2I6W.js";import"./chunk-XQBIHPPX.js";import{i as te}from"./chunk-7LZISGTA.js";import"./chunk-BFKYRQMA.js";import"./chunk-LO3O45IX.js";import"./chunk-LD7PGREF.js";import"./chunk-XW6HGSIT.js";import{a as ae,b as oe,c as ie,d as se,e as le,f as ce,g as ue,i as N}from"./chunk-UZQNFTLR.js";import"./chunk-KVTBX2UP.js";import{g as E}from"./chunk-FSQWAANK.js";import{A as X,K as ee}from"./chunk-O4FBOUNX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-WYZWDMMF.js";import"./chunk-DG4TYVPF.js";import{c as J,d as G,e as W,f as Y,g as Z,j as C}from"./chunk-PWK5Z5S3.js";import"./chunk-L3KS6MOV.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-YR5ID2SS.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import"./chunk-LHA7RQBA.js";import{E as M}from"./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{A as d}from"./chunk-PF56N7ZY.js";import{a as i}from"./chunk-FTQLQJQV.js";var Ee=new Set(["applying_source","running_checks","evaluating","awaiting_promotion","opening_pull_request","pull_request_open","reconciling_release","released","ready","ready_local","pushing_hosted","running_hosted_checks","published_hosted"]);function H(e){return Ee.has(e)}i(H,"isCreateImproveMutationState");function z(e){let t=e.run;if(!t)return;let n=e.actionLabel??"Create/Improve update";if(t.plan&&t.plan.runId!==t.id)throw new Error(`${n} requires a plan linked to the submitted run.`);if(t.workflowCapture&&t.workflowCapture.runId!==t.id)throw new Error(`${n} requires workflow capture linked to the submitted run.`);if(t.plan?.approvalId&&!t.approvalIds.includes(t.plan.approvalId))throw new Error(`${n} requires the plan approval id in the run.`)}i(z,"assertCreateImproveRunLinked");function he(e){let t=e.actionLabel??"Create/Improve mutation",n=e.run;if(!n)throw new Error(`${t} requires a Create/Improve run.`);if(z({actionLabel:t,run:n}),!H(n.state))throw new Error(`${t} cannot start before plan approval.`);if(n.plan?.status!=="approved")throw new Error(`${t} requires an approved plan.`)}i(he,"assertCreateImproveMutationApproved");import{randomUUID as F}from"node:crypto";var $e=d.object({id:d.string().trim().min(1).optional(),label:d.string().trim().min(1),value:d.string().trim().min(1).optional(),description:d.string().trim().min(1).nullable().optional()}),Oe=d.object({id:d.string().trim().min(1).optional(),kind:d.preprocess(Ye,d.enum(["single_choice","free_text"]).default("single_choice")),title:d.string().trim().min(1),prompt:d.string().trim().min(1),required:d.boolean().default(!0),options:d.array($e).default([])}),je=d.object({path:d.string().trim().min(1),operation:d.preprocess(Ze,d.enum(["create","update","delete","inspect"])),reason:d.string().trim().min(1)}),De=d.object({name:d.string().trim().min(1),command:d.string().trim().min(1),required:d.boolean().default(!0)}),Me=d.object({targetId:d.string().trim().min(1).optional().nullable(),targetName:d.string().trim().min(1).optional().nullable(),agentId:d.string().trim().min(1).optional().nullable(),agentName:d.string().trim().min(1).optional().nullable(),summary:d.string().trim().min(1),capturedContextSummary:d.string().trim().min(1),actionShape:G,defaultChatAction:d.object({key:d.string().trim().min(1).nullable().optional(),label:d.string().trim().min(1).nullable().optional(),required:d.boolean().default(!0)}).optional().nullable(),sourcePlan:d.array(je).default([]),requirements:d.array(J).default([]),checks:d.array(De).default([])}),ke=d.discriminatedUnion("decision",[d.object({schemaVersion:d.literal("openpond.createImprove.plannerDecision.v1"),decision:d.literal("questions"),summary:d.string().trim().min(1).optional().nullable(),questions:d.array(Oe).min(1)}),d.object({schemaVersion:d.literal("openpond.createImprove.plannerDecision.v1"),decision:d.literal("plan"),plan:Me})]);async function Pe(e){let t=Ve(e.run);if(t)return Ce({run:e.run,decision:t,modelRef:null});let n=Ke(e.run),o=await Re(e.stream,n),a;try{a=we(o)}catch(u){let v=Qe({messages:n,invalidContent:o,error:u}),R=await Re(e.stream,v);try{a=we(R)}catch(I){throw new Error(`Create/Improve planner repair failed: ${K(I)}; initial error: ${K(u)}`)}}return Ce({run:e.run,decision:a,modelRef:e.modelRef??null})}i(Pe,"runModelBackedCreateImprovePlanner");async function Re(e,t){let n="";for await(let o of e(t))o.text&&(n+=o.text);return n}i(Re,"collectPlannerText");function Ce(e){return e.decision.decision==="questions"?Ne(e.run,e.decision,e.modelRef??null):Le(e.run,e.decision.plan,e.modelRef??null)}i(Ce,"createImproveRunFromPlannerDecision");function Ae(e){let t=new Date().toISOString();return C(e.run,{state:"blocked",plan:null,workflowCapture:Q(e.run),blockedReason:e.reason,metadata:{...e.run.metadata,...U(e.modelRef??null),plannerDecision:"blocked",plannerError:e.reason},updatedAt:t})}i(Ae,"createBlockedCreateImprovePlannerRun");function Ne(e,t,n){let o=new Date().toISOString(),a=t.questions.map((u,v)=>Y.parse({id:u.id??`create_improve_question_${v+1}`,kind:u.kind,title:u.title,prompt:u.prompt,required:u.required,status:"pending",options:u.options.map((R,I)=>({id:R.id??`option_${I+1}`,label:R.label,value:R.value??R.label,description:R.description??null,metadata:{}})),answer:null,metadata:{}}));return C(e,{state:"awaiting_questions",plan:null,workflowCapture:Q(e),approvalIds:[],questionIds:a.map(u=>u.id),questions:a,blockedReason:null,metadata:{...e.metadata,...U(n),plannerDecision:"questions",plannerSummary:t.summary??null},updatedAt:o})}i(Ne,"createQuestionRun");function Le(e,t,n){let o=new Date().toISOString(),a=`create_improve_plan_${F()}`,u=`approval_${F()}`,v=Be(e.target,t,e.objective),R=be(v),I=t.actionShape,k=t.checks.length?t.checks:ze(v.kind),w=t.sourcePlan.length?t.sourcePlan:He({run:{...e,target:v},sourceRoot:R}),b=t.defaultChatAction?.key??I.defaultActionKey??(v.kind==="agent"?v.defaultActionKey:null)??"chat",m=e.surface==="lab_improve"?Fe():U(n),f=W.parse({schemaVersion:"openpond.createImprove.plan.v1",id:a,runId:e.id,status:"pending_approval",objective:e.objective,summary:t.summary,capturedContextSummary:t.capturedContextSummary,defaultChatAction:{key:b,label:t.defaultChatAction?.label??v.displayName??"Chat",required:t.defaultChatAction?.required??!0},sourcePlan:w,requirements:t.requirements,checks:k,approvalId:u,approvedAt:null,editedFromPlanId:null,metadata:{...m,target:v,actionShape:I,actionShapeDecisionSource:e.surface==="lab_improve"?"lab_improve_default_planner":"model_planner"},createdAt:o,updatedAt:o}),y=e.questions.map(h=>h.status==="pending"?{...h,status:"skipped"}:h);return C(e,{state:"awaiting_plan_approval",target:v,plan:f,workflowCapture:Q(e),approvalIds:[u],questionIds:y.map(h=>h.id),questions:y,blockedReason:null,metadata:{...e.metadata,...m,plannerDecision:"plan"},updatedAt:o})}i(Le,"createPlanRun");function Be(e,t,n){let o=t.targetId??t.agentId,a=t.targetName??t.agentName;if(e.kind!=="agent")return{...e,id:e.id??o??null,displayName:e.displayName??a??null};let u=D(o??"")||e.id||D(a??"")||et(n),v=e.id===u&&e.defaultActionKey?e.defaultActionKey:`${u}.chat`;return{...e,id:u,displayName:a??e.displayName,defaultActionKey:v}}i(Be,"plannedTarget");function Q(e){if(e.workflowCapture)return e.workflowCapture;let t=new Date().toISOString(),n=S(e.context.tools.flatMap(o=>o.artifactRefs));return Z.parse({schemaVersion:"openpond.createImprove.workflowCapture.v1",id:`workflow_capture_${F()}`,runId:e.id,command:e.command,objective:e.objective,conversationExcerpts:e.context.conversationExcerpts,attachments:e.context.attachments,apps:e.context.apps,tools:e.context.tools,sideEffects:S(e.context.tools.flatMap(o=>o.sideEffects)),profileActions:S(e.context.tools.map(o=>o.name)),externalProviders:S([...e.context.apps.map(o=>o.name),...e.context.tools.map(o=>tt(o.name))]),environmentVariables:[],files:S(e.context.attachments.map(o=>o.ref?`${o.name} (${o.ref})`:o.name)),schedules:[],webhooks:[],channelTargets:["openpond_chat"],outputArtifacts:n,targetRepoAssumptions:e.context.targetRepoAssumptions,traceRefs:n.filter(o=>/\btrace\b|trace[:/-]/i.test(o)),metadata:{source:"create_improve_model_planner",conversationId:e.scope.conversationId,projectId:e.scope.projectId},createdAt:t})}i(Q,"workflowCaptureForRun");function He(e){return e.run.operation==="improve"&&e.run.target.id?[{path:be(e.run.target),operation:"update",reason:e.run.objective},{path:"settings/profile.yaml",operation:"update",reason:"Preserve the active Profile composition and routing."}]:[{path:e.sourceRoot,operation:"create",reason:e.run.objective},{path:"settings/profile.yaml",operation:"update",reason:"Register the workproduct in the active Profile."}]}i(He,"defaultSourcePlan");function ze(e){return e==="agent"?[{name:"inspect",command:"pnpm agent:inspect",required:!0},{name:"build",command:"pnpm build",required:!0},{name:"validate",command:"pnpm agent:validate",required:!0},{name:"eval",command:"pnpm agent:eval",required:!0}]:[{name:"build",command:"pnpm build",required:!0},{name:"validate",command:"pnpm run typecheck",required:!0}]}i(ze,"defaultChecks");function be(e){let t=D(e.id??e.displayName??"")||"draft";return e.kind==="agent"?t==="default"?"agent":`agents/${t}`:e.kind==="skill"?`skills/${e.skillName??t}`:e.kind==="extension"?`extensions/${t}`:e.kind==="model"?`training/models/${t}`:e.kind==="unselected"?"profile":`settings/${e.key??t}`}i(be,"sourceRootForTarget");function U(e){return{planner:{kind:"model",source:"create_improve_model_planner",providerId:e?.providerId??null,modelId:e?.modelId??null}}}i(U,"plannerProvenance");function Fe(){return{planner:{kind:"deterministic",source:"lab_improve_default_planner",providerId:null,modelId:null}}}i(Fe,"deterministicLabPlannerProvenance");function Ke(e){return[{role:"system",content:rt},{role:"user",content:JSON.stringify({run:e,instruction:"Return only openpond.createImprove.plannerDecision.v1 JSON. Ask questions only when the user cannot approve a meaningful plan yet."},null,2)}]}i(Ke,"createImprovePlannerMessages");function Qe(e){return[...e.messages,{role:"assistant",content:We(e.invalidContent)},{role:"user",content:["The previous OpenPond Create/Improve planner decision failed schema validation.","Return only one corrected openpond.createImprove.plannerDecision.v1 JSON object.","Keep the same user intent and plan. Only change fields needed to satisfy the schema.","plan.requirements is only for setup or dependency rows. Use [] when no setup is required.",'For questions use: {"schemaVersion":"openpond.createImprove.plannerDecision.v1","decision":"questions","questions":[{"kind":"free_text","title":"Short label","prompt":"Complete question?","required":true,"options":[]}]}','For a plan use: {"schemaVersion":"openpond.createImprove.plannerDecision.v1","decision":"plan","plan":{...}}',"Do not wrap the JSON in Markdown or add prose.",`Validation error: ${K(e.error)}`].join(`
3
3
  `)}]}i(Qe,"createImprovePlannerRepairMessages");function we(e){let t=Xe(e);if(!t)throw new Error("Create/Improve planner returned no JSON decision.");try{return ke.parse(Ue(JSON.parse(t)))}catch(n){throw n instanceof SyntaxError?new Error(`Create/Improve planner returned invalid JSON: ${n.message}`):n}}i(we,"parsePlannerDecision");function Ue(e){if(!j(e))return e;let t=e.decision==="questions"||e.decision==="plan"?e.decision:Array.isArray(e.questions)?"questions":j(e.plan)?"plan":e.decision,n={...e,schemaVersion:"openpond.createImprove.plannerDecision.v1",decision:t};return t==="questions"&&Array.isArray(e.questions)&&(n.questions=e.questions.map(Je)),n}i(Ue,"normalizePlannerDecision");function Ve(e){if(e.operation!=="improve"||e.surface!=="lab_improve")return null;let t=e.target.displayName??e.target.id??"Agent",n=e.target.id==="account-health-agent"||/account health|renewal risk|weekly account review/i.test(e.objective),o=e.target.kind==="agent"?e.target.defaultActionKey??`${e.target.id??"default"}.chat`:"chat";return ke.parse({schemaVersion:"openpond.createImprove.plannerDecision.v1",decision:"plan",plan:{targetId:e.target.id,targetName:t,summary:`Improve ${t}: ${e.objective}`,capturedContextSummary:"The user supplied the desired outcome in Lab. Inspect the existing Profile source and choose the narrowest implementation that achieves it.",actionShape:{mode:n?"chat_and_direct_actions":"chat",label:n?"Account health chat and reviews":"Chat",detail:n?"Preserve chat plus the account summary, renewal triage, and weekly review actions while applying the correction.":"Preserve the Agent's existing chat surface while improving the requested behavior.",defaultActionKey:o,directActionHint:n?"Preserve summarize-account, triage-renewal-risk, and build-weekly-account-review with their existing inputs and artifacts.":null,artifactPolicy:n?"Keep the source diff, checks, evaluations, and weekly-review Markdown and JSON artifacts with the candidate for review.":"Keep the source diff, checks, and evaluation evidence with the candidate for review."},defaultChatAction:{key:o,label:t,required:!0},sourcePlan:[],requirements:[],checks:[]}})}i(Ve,"labImprovePlanDecision");function Je(e,t){if(typeof e=="string"){let u=e.trim();return{kind:"free_text",title:ye(u,t),prompt:u,required:!0,options:[]}}if(!j(e))return e;let n=Array.isArray(e.options)?e.options.map(Ge):[],o=O(e.prompt,e.question,e.text,e.description,e.label,e.title),a=O(e.title,e.label)??(o?ye(o,t):null);return{...e,kind:e.kind??(n.length?"single_choice":"free_text"),title:a,prompt:o,required:typeof e.required=="boolean"?e.required:!0,options:n}}i(Je,"normalizePlannerQuestion");function Ge(e){if(typeof e=="string"){let n=e.trim();return{label:n,value:n}}if(!j(e))return e;let t=O(e.label,e.name,e.title,e.value);return{...e,label:t,value:O(e.value,t)}}i(Ge,"normalizePlannerQuestionOption");function ye(e,t){let n=e.replace(/\s+/g," ").replace(/[?.!]+$/g,"").trim();return n?n.length<=64?n:`${n.slice(0,61).trimEnd()}...`:`Question ${t+1}`}i(ye,"plannerQuestionTitle");function O(...e){for(let t of e)if(typeof t=="string"&&t.trim())return t.trim();return null}i(O,"firstNonEmptyString");function j(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}i(j,"isRecord");function K(e){return e instanceof d.ZodError?JSON.stringify(e.issues):e instanceof Error?e.message:String(e)}i(K,"plannerErrorSummary");function We(e){return e.length<=12e3?e:`${e.slice(0,12e3)}
4
4
  ... [truncated invalid planner output]`}i(We,"truncatePlannerContent");function Ye(e){if(e==null||e==="")return;if(typeof e!="string")return e;let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return["single_choice","single_select","single","choice","select","select_one","radio","dropdown","multiple_choice","multi_choice","multi_select","multiple_select","checkbox","checkboxes"].includes(t)?"single_choice":["free_text","text","freeform","free_form","open_text","open_ended","short_answer","textarea","string"].includes(t)?"free_text":e}i(Ye,"normalizePlannerQuestionKind");function Ze(e){if(e==null||e===""||typeof e!="string")return e;let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return["create","add","author","build","generate","implement","init","initialize","materialize","new","scaffold","write","write_file"].includes(t)?"create":["update","change","configure","edit","enable","modify","patch","register","replace","revise","set","upsert"].includes(t)?"update":["delete","remove","unlink"].includes(t)?"delete":["inspect","audit","check","discover","read","review","validate","verify"].includes(t)?"inspect":e}i(Ze,"normalizePlannerSourcePlanOperation");function Xe(e){let t=e.trim(),o=/^```(?:json)?\s*([\s\S]*?)\s*```$/i.exec(t)?.[1]?.trim()??t;if(o.startsWith("{")&&o.endsWith("}"))return o;let a=o.indexOf("{"),u=o.lastIndexOf("}");return a>=0&&u>a?o.slice(a,u+1):null}i(Xe,"extractJsonObject");function et(e){return D(e.toLowerCase().replace(/['"]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"created-agent")}i(et,"targetIdFromObjective");function D(e){return e.trim().toLowerCase().replace(/['"]/g,"").replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}i(D,"normalizeTargetId");function tt(e){let[t]=e.split(".");return t?.trim()||e}i(tt,"providerNameFromTool");function S(e){return Array.from(new Set(e.map(t=>t?.trim()??"").filter(Boolean)))}i(S,"uniqueNonEmpty");var rt=["You are the OpenPond Create/Improve planner.","Decide the user-facing plan before any Profile source or managed artifact is changed.","Use the objective, target type, conversation context, attachments, selected Profile/project, tools, and prior answers.","Do not rely on hidden keyword lists or hardcoded business examples.","Return only JSON with schemaVersion openpond.createImprove.plannerDecision.v1.","","If the user cannot approve a meaningful plan yet, return questions.","A plain-language desired outcome for an existing workproduct is actionable. Inspect its current source and choose implementation details yourself.","Do not ask the user to choose tools, file paths, search strategies, or other implementation details.","Ask a question only when user intent is missing or an irreversible product choice cannot be inferred safely.","If the request is actionable, return a plan with targetId, targetName, summary, capturedContextSummary, actionShape, sourcePlan, requirements, and checks.","requirements is only for setup and dependencies, never acceptance criteria or task bullets.","Every sourcePlan operation must be create, update, delete, or inspect.","Choose chat, direct_action, or chat_and_direct_actions from the actual behavior being created."].join(`
5
- `);function Se(e){return e.type==="apply_candidate"||e.type==="open_pull_request"||e.type==="reject_candidate"||e.type==="reconcile_pull_request"}i(Se,"isAgentImprovementReleaseAction");async function Te(e){let t=i(()=>new Date().toISOString(),"timestamp"),n=at(e.run,e.action.candidateId);if(!n.git)throw new Error("Agent candidate has no Git lineage.");let o=me(e.run),a=e.run;try{if(e.action.type==="apply_candidate"){let m=a.localProfileCommit?await nt({repoPath:o.repoPath,expectedCommit:a.localProfileCommit,command:e.command}):await Ie({run:a,repoPath:o.repoPath,git:n.git,command:e.command}),f;try{let r=a.tasksetRef?await e.resolveTaskset?.(a.tasksetRef.id,a.tasksetRef.revision,a.tasksetRef.contentHash)??null:null;f=await(e.evaluate??L)({run:a,cwd:o.sourceRoot,sourceRef:o.sourceRootRelativePath,sourceCommit:m,sourceBranch:n.git.baseBranch,candidateId:n.id,subject:"post_release",taskset:r,gradeAttempt:e.gradeTaskAttempt})}catch(r){let l=t(),s=r instanceof Error?r.message:String(r);return C(a,{state:"blocked",localProfileCommit:m,releaseOutcome:{...a.releaseOutcome,status:"pending",profileCommit:m,pullRequest:null,updatedAt:l},externalExecutionRefs:T(a,{kind:"release",id:m,status:"verification_error",metadata:{candidateId:n.id}}),blockedReason:`The change was applied locally, but its post-merge Evals could not run: ${s}`,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"local_verification_error",profileCommit:m,verificationError:s}},updatedAt:l})}let y=t(),h=f.status==="passed"&&f.publishGate==="passed",x=h?$({run:a,candidateId:n.id,outcome:"released",reason:"The promoted Agent passed trusted post-release Taskset evaluation.",receiptRefs:[f.id],timestamp:y}):null;return h&&await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{}),C(a,{state:h?"released":"blocked",candidates:_(a,n.id,{status:h?"accepted":"evaluated",git:{...n.git,worktreePath:h?null:n.git.worktreePath},evaluationReceiptRefs:qe([...n.evaluationReceiptRefs,f.id]),metadata:h?_e(n,{sourceCommit:m,receiptId:f.id,releasedAt:y}):n.metadata,updatedAt:y}),evaluationReceipts:[...a.evaluationReceipts.filter(r=>r.id!==f.id),f],evidenceSnapshots:x?V(a,x):a.evidenceSnapshots,localProfileCommit:m,releaseOutcome:{...a.releaseOutcome,status:h?"released":"pending",profileCommit:m,pullRequest:null,releaseReceiptRef:f.id,updatedAt:y},externalExecutionRefs:T(a,{kind:"release",id:m,status:h?"released":"verification_failed",metadata:{candidateId:n.id,verificationReceiptId:f.id}}),blockedReason:h?null:"The change was applied locally, but the active Agent failed its post-merge Evals.",metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:h?"released":"local_verification_failed",profileCommit:m,postReleaseReceiptId:f.id}},updatedAt:y})}if(e.action.type==="open_pull_request"){let m=await pe({run:a,git:n.git,evaluationSummary:ot(a,n),command:e.command}),f=t();return C(a,{state:"pull_request_open",candidates:_(a,n.id,{git:{...n.git,pullRequest:m},updatedAt:f}),releaseOutcome:{...a.releaseOutcome,status:"pending",pullRequest:m,releaseReceiptRef:`github-pr:${m.number}`,updatedAt:f},externalExecutionRefs:T(a,{kind:"pull_request",id:String(m.number),status:m.state,metadata:{url:m.url,baseBranch:m.baseBranch,headBranch:m.headBranch}}),blockedReason:null,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"pull_request_open",pullRequest:m}},updatedAt:f})}if(e.action.type==="reject_candidate"){let m=e.action.reason?.trim()||"Candidate rejected.";n.git.pullRequest&&await fe({git:n.git,reason:m,cwd:o.repoPath,command:e.command}),await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{});let f=t(),y=$({run:a,candidateId:n.id,outcome:"rejected",reason:m,receiptRefs:n.evaluationReceiptRefs,timestamp:f});return C(a,{state:"rejected",candidates:_(a,n.id,{status:"rejected",git:n.git.pullRequest?{...n.git,pullRequest:{...n.git.pullRequest,state:"closed",updatedAt:f},worktreePath:null}:{...n.git,worktreePath:null},updatedAt:f}),releaseOutcome:{...a.releaseOutcome,status:"rejected",pullRequest:n.git.pullRequest?{...n.git.pullRequest,state:"closed",updatedAt:f}:null,updatedAt:f},evidenceSnapshots:V(a,y),blockedReason:m,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"rejected",rejectionReason:m}},updatedAt:f})}let u=await ve({git:n.git,cwd:o.repoPath,command:e.command});if(u.state==="open"){let m=t();return C(a,{state:"pull_request_open",candidates:_(a,n.id,{git:{...n.git,pullRequest:u},updatedAt:m}),releaseOutcome:{...a.releaseOutcome,status:"pending",pullRequest:u,updatedAt:m},externalExecutionRefs:T(a,{kind:"pull_request",id:String(u.number),status:"open",metadata:{url:u.url}}),blockedReason:null,updatedAt:m})}if(u.state==="closed"){await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{});let m=t();return C(a,{state:"rejected",candidates:_(a,n.id,{status:"rejected",git:{...n.git,pullRequest:u,worktreePath:null},updatedAt:m}),releaseOutcome:{...a.releaseOutcome,status:"rejected",pullRequest:u,updatedAt:m},blockedReason:"The Agent improvement pull request was closed without merge.",updatedAt:m})}let v=await ge({repoPath:o.repoPath,baseBranch:n.git.baseBranch,remoteName:n.git.remoteName,command:e.command}),R=a.tasksetRef?await e.resolveTaskset?.(a.tasksetRef.id,a.tasksetRef.revision,a.tasksetRef.contentHash)??null:null,I=await(e.evaluate??L)({run:a,cwd:o.sourceRoot,sourceRef:o.sourceRootRelativePath,sourceCommit:v,sourceBranch:n.git.baseBranch,candidateId:n.id,subject:"post_release",taskset:R,gradeAttempt:e.gradeTaskAttempt}),k=t(),w=I.status==="passed"&&I.publishGate==="passed",b=w?$({run:a,candidateId:n.id,outcome:"released",reason:"The promoted Agent passed trusted post-release Taskset evaluation.",receiptRefs:[I.id],timestamp:k}):null;return w&&await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{}),C(a,{state:w?"released":"blocked",candidates:_(a,n.id,{status:w?"accepted":"evaluated",git:{...n.git,pullRequest:u,worktreePath:w?null:n.git.worktreePath},evaluationReceiptRefs:qe([...n.evaluationReceiptRefs,I.id]),metadata:w?_e(n,{sourceCommit:v,receiptId:I.id,releasedAt:k}):n.metadata,updatedAt:k}),evaluationReceipts:[...a.evaluationReceipts.filter(m=>m.id!==I.id),I],evidenceSnapshots:b?V(a,b):a.evidenceSnapshots,localProfileCommit:v,releaseOutcome:{...a.releaseOutcome,status:w?"released":"pending",profileCommit:v,pullRequest:u,releaseReceiptRef:I.id,updatedAt:k},externalExecutionRefs:T(a,{kind:"pull_request",id:String(u.number),status:"merged",metadata:{url:u.url,mergeCommit:u.mergeCommit,profileCommit:v,verificationReceiptId:I.id}}),blockedReason:w?null:"The PR merged, but the active Agent failed its post-merge publish-gate Eval.",metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:w?"released":"merged_verification_failed",pullRequest:u,profileCommit:v,postReleaseReceiptId:I.id}},updatedAt:k})}catch(u){let v=t();return C(a,{state:a.state==="rejected"?"rejected":"blocked",blockedReason:u instanceof Error?u.message:String(u),metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"release_action_failed",action:e.action.type}},updatedAt:v})}}i(Te,"executeAgentImprovementReleaseAction");function V(e,t){return[...e.evidenceSnapshots.filter(n=>n.id!==t.id),t]}i(V,"uniqueEvidence");async function nt(e){let n=await(e.command??(async(a,u,v,R)=>{let{runWorkspaceCommand:I}=await import("./workspaces-2TJRDM5K.js");return I(a,u,v,R)}))("git",["rev-parse","HEAD"],e.repoPath),o=n.code===0?n.stdout.trim():"";if(!o||o!==e.expectedCommit)throw new Error("The active Profile moved after the change was applied. Review the current Profile before re-running Evals.");return o}i(nt,"verifyAppliedProfileCommit");function at(e,t){let n=e.candidates.find(o=>o.id===t);if(!n)throw new Error(`Create/Improve candidate not found: ${t}`);return n}i(at,"requireCandidate");function _(e,t,n){return e.candidates.map(o=>o.id===t?{...o,...n}:o)}i(_,"updateCandidate");function _e(e,t){return{...e.metadata,agentPackageLineage:{...A(e.metadata.agentPackageLineage),releasedSourceCommit:t.sourceCommit,postReleaseReceiptId:t.receiptId,releasedAt:t.releasedAt}}}i(_e,"releasedCandidateMetadata");function ot(e,t){return e.evaluationReceipts.filter(o=>o.candidateId===t.id&&(o.subject==="active"||o.subject==="candidate")).map(o=>{let a=o.summaryCounts,u=a?`${a.passed}/${a.total} passed`:o.status;return`- **${o.subject==="active"?"Base":"Candidate"}** \`${o.sourceCommit?.slice(0,12)??"unknown"}\`: ${u}; publish gate ${o.publishGate}.`}).join(`
5
+ `);function Se(e){return e.type==="apply_candidate"||e.type==="open_pull_request"||e.type==="reject_candidate"||e.type==="reconcile_pull_request"}i(Se,"isAgentImprovementReleaseAction");async function Te(e){let t=i(()=>new Date().toISOString(),"timestamp"),n=at(e.run,e.action.candidateId);if(!n.git)throw new Error("Agent candidate has no Git lineage.");let o=me(e.run),a=e.run;try{if(e.action.type==="apply_candidate"){let m=a.localProfileCommit?await nt({repoPath:o.repoPath,expectedCommit:a.localProfileCommit,command:e.command}):await Ie({run:a,repoPath:o.repoPath,git:n.git,command:e.command}),f;try{let r=a.tasksetRef?await e.resolveTaskset?.(a.tasksetRef.id,a.tasksetRef.revision,a.tasksetRef.contentHash)??null:null;f=await(e.evaluate??L)({run:a,cwd:o.sourceRoot,sourceRef:o.sourceRootRelativePath,sourceCommit:m,sourceBranch:n.git.baseBranch,candidateId:n.id,subject:"post_release",taskset:r,gradeAttempt:e.gradeTaskAttempt})}catch(r){let l=t(),s=r instanceof Error?r.message:String(r);return C(a,{state:"blocked",localProfileCommit:m,releaseOutcome:{...a.releaseOutcome,status:"pending",profileCommit:m,pullRequest:null,updatedAt:l},externalExecutionRefs:T(a,{kind:"release",id:m,status:"verification_error",metadata:{candidateId:n.id}}),blockedReason:`The change was applied locally, but its post-merge Evals could not run: ${s}`,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"local_verification_error",profileCommit:m,verificationError:s}},updatedAt:l})}let y=t(),h=f.status==="passed"&&f.publishGate==="passed",x=h?$({run:a,candidateId:n.id,outcome:"released",reason:"The promoted Agent passed trusted post-release Taskset evaluation.",receiptRefs:[f.id],timestamp:y}):null;return h&&await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{}),C(a,{state:h?"released":"blocked",candidates:_(a,n.id,{status:h?"accepted":"evaluated",git:{...n.git,worktreePath:h?null:n.git.worktreePath},evaluationReceiptRefs:qe([...n.evaluationReceiptRefs,f.id]),metadata:h?_e(n,{sourceCommit:m,receiptId:f.id,releasedAt:y}):n.metadata,updatedAt:y}),evaluationReceipts:[...a.evaluationReceipts.filter(r=>r.id!==f.id),f],evidenceSnapshots:x?V(a,x):a.evidenceSnapshots,localProfileCommit:m,releaseOutcome:{...a.releaseOutcome,status:h?"released":"pending",profileCommit:m,pullRequest:null,releaseReceiptRef:f.id,updatedAt:y},externalExecutionRefs:T(a,{kind:"release",id:m,status:h?"released":"verification_failed",metadata:{candidateId:n.id,verificationReceiptId:f.id}}),blockedReason:h?null:"The change was applied locally, but the active Agent failed its post-merge Evals.",metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:h?"released":"local_verification_failed",profileCommit:m,postReleaseReceiptId:f.id}},updatedAt:y})}if(e.action.type==="open_pull_request"){let m=await pe({run:a,git:n.git,evaluationSummary:ot(a,n),command:e.command}),f=t();return C(a,{state:"pull_request_open",candidates:_(a,n.id,{git:{...n.git,pullRequest:m},updatedAt:f}),releaseOutcome:{...a.releaseOutcome,status:"pending",pullRequest:m,releaseReceiptRef:`github-pr:${m.number}`,updatedAt:f},externalExecutionRefs:T(a,{kind:"pull_request",id:String(m.number),status:m.state,metadata:{url:m.url,baseBranch:m.baseBranch,headBranch:m.headBranch}}),blockedReason:null,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"pull_request_open",pullRequest:m}},updatedAt:f})}if(e.action.type==="reject_candidate"){let m=e.action.reason?.trim()||"Candidate rejected.";n.git.pullRequest&&await fe({git:n.git,reason:m,cwd:o.repoPath,command:e.command}),await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{});let f=t(),y=$({run:a,candidateId:n.id,outcome:"rejected",reason:m,receiptRefs:n.evaluationReceiptRefs,timestamp:f});return C(a,{state:"rejected",candidates:_(a,n.id,{status:"rejected",git:n.git.pullRequest?{...n.git,pullRequest:{...n.git.pullRequest,state:"closed",updatedAt:f},worktreePath:null}:{...n.git,worktreePath:null},updatedAt:f}),releaseOutcome:{...a.releaseOutcome,status:"rejected",pullRequest:n.git.pullRequest?{...n.git.pullRequest,state:"closed",updatedAt:f}:null,updatedAt:f},evidenceSnapshots:V(a,y),blockedReason:m,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"rejected",rejectionReason:m}},updatedAt:f})}let u=await ve({git:n.git,cwd:o.repoPath,command:e.command});if(u.state==="open"){let m=t();return C(a,{state:"pull_request_open",candidates:_(a,n.id,{git:{...n.git,pullRequest:u},updatedAt:m}),releaseOutcome:{...a.releaseOutcome,status:"pending",pullRequest:u,updatedAt:m},externalExecutionRefs:T(a,{kind:"pull_request",id:String(u.number),status:"open",metadata:{url:u.url}}),blockedReason:null,updatedAt:m})}if(u.state==="closed"){await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{});let m=t();return C(a,{state:"rejected",candidates:_(a,n.id,{status:"rejected",git:{...n.git,pullRequest:u,worktreePath:null},updatedAt:m}),releaseOutcome:{...a.releaseOutcome,status:"rejected",pullRequest:u,updatedAt:m},blockedReason:"The Agent improvement pull request was closed without merge.",updatedAt:m})}let v=await ge({repoPath:o.repoPath,baseBranch:n.git.baseBranch,remoteName:n.git.remoteName,command:e.command}),R=a.tasksetRef?await e.resolveTaskset?.(a.tasksetRef.id,a.tasksetRef.revision,a.tasksetRef.contentHash)??null:null,I=await(e.evaluate??L)({run:a,cwd:o.sourceRoot,sourceRef:o.sourceRootRelativePath,sourceCommit:v,sourceBranch:n.git.baseBranch,candidateId:n.id,subject:"post_release",taskset:R,gradeAttempt:e.gradeTaskAttempt}),k=t(),w=I.status==="passed"&&I.publishGate==="passed",b=w?$({run:a,candidateId:n.id,outcome:"released",reason:"The promoted Agent passed trusted post-release Taskset evaluation.",receiptRefs:[I.id],timestamp:k}):null;return w&&await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{}),C(a,{state:w?"released":"blocked",candidates:_(a,n.id,{status:w?"accepted":"evaluated",git:{...n.git,pullRequest:u,worktreePath:w?null:n.git.worktreePath},evaluationReceiptRefs:qe([...n.evaluationReceiptRefs,I.id]),metadata:w?_e(n,{sourceCommit:v,receiptId:I.id,releasedAt:k}):n.metadata,updatedAt:k}),evaluationReceipts:[...a.evaluationReceipts.filter(m=>m.id!==I.id),I],evidenceSnapshots:b?V(a,b):a.evidenceSnapshots,localProfileCommit:v,releaseOutcome:{...a.releaseOutcome,status:w?"released":"pending",profileCommit:v,pullRequest:u,releaseReceiptRef:I.id,updatedAt:k},externalExecutionRefs:T(a,{kind:"pull_request",id:String(u.number),status:"merged",metadata:{url:u.url,mergeCommit:u.mergeCommit,profileCommit:v,verificationReceiptId:I.id}}),blockedReason:w?null:"The PR merged, but the active Agent failed its post-merge publish-gate Eval.",metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:w?"released":"merged_verification_failed",pullRequest:u,profileCommit:v,postReleaseReceiptId:I.id}},updatedAt:k})}catch(u){let v=t();return C(a,{state:a.state==="rejected"?"rejected":"blocked",blockedReason:u instanceof Error?u.message:String(u),metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"release_action_failed",action:e.action.type}},updatedAt:v})}}i(Te,"executeAgentImprovementReleaseAction");function V(e,t){return[...e.evidenceSnapshots.filter(n=>n.id!==t.id),t]}i(V,"uniqueEvidence");async function nt(e){let n=await(e.command??(async(a,u,v,R)=>{let{runWorkspaceCommand:I}=await import("./workspaces-5DF4H5EX.js");return I(a,u,v,R)}))("git",["rev-parse","HEAD"],e.repoPath),o=n.code===0?n.stdout.trim():"";if(!o||o!==e.expectedCommit)throw new Error("The active Profile moved after the change was applied. Review the current Profile before re-running Evals.");return o}i(nt,"verifyAppliedProfileCommit");function at(e,t){let n=e.candidates.find(o=>o.id===t);if(!n)throw new Error(`Create/Improve candidate not found: ${t}`);return n}i(at,"requireCandidate");function _(e,t,n){return e.candidates.map(o=>o.id===t?{...o,...n}:o)}i(_,"updateCandidate");function _e(e,t){return{...e.metadata,agentPackageLineage:{...A(e.metadata.agentPackageLineage),releasedSourceCommit:t.sourceCommit,postReleaseReceiptId:t.receiptId,releasedAt:t.releasedAt}}}i(_e,"releasedCandidateMetadata");function ot(e,t){return e.evaluationReceipts.filter(o=>o.candidateId===t.id&&(o.subject==="active"||o.subject==="candidate")).map(o=>{let a=o.summaryCounts,u=a?`${a.passed}/${a.total} passed`:o.status;return`- **${o.subject==="active"?"Base":"Candidate"}** \`${o.sourceCommit?.slice(0,12)??"unknown"}\`: ${u}; publish gate ${o.publishGate}.`}).join(`
6
6
  `)}i(ot,"evaluationSummary");function T(e,t){return[...e.externalExecutionRefs.filter(n=>!(n.kind===t.kind&&n.id===t.id)),t]}i(T,"mergeExternalRef");function qe(e){return[...new Set(e)]}i(qe,"unique");function A(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}i(A,"record");function $t(e){let t=new de("create/improve apply job"),n=e.streamOpenPondHostedChatTurn??te;async function o(r,l){let s=X.parse(l);if(s.runId!==r)throw new Error("Create/Improve action route does not match the submitted run.");let c=await e.mutateCreateImproveRun(s,xe=>se(xe,s)),p=c.replayed?await e.getCreateImproveRun(s.runId)??c.run:c.run,g=await h(p),P=await e.getSession(p.scope.conversationId??g.sessionId);return!c.replayed&&ae(p)&&(p=await k({session:P,turn:g,run:p,signal:new AbortController().signal})),!c.replayed&&H(p.state)&&(he({actionLabel:"Create/Improve action",run:p}),p=le(p,P)),await m({session:P,turnId:g.id,run:p,source:"ui_button"}),!c.replayed&&Se(s)?R({session:P,turn:g,run:p,action:s}):!c.replayed&&y(p)&&v({session:P,turn:g,run:p}),await e.getCreateImproveRun(p.id)??p}i(o,"applyCreateImproveActionPayload");async function a(r,l){let s=ee.parse(l),c=await e.getApproval(r);if(!c||c.kind!=="create_plan")return null;if(c.status!=="pending")throw new Error("Approval not found or already resolved");let p=c.turnId?await e.getTurn(c.turnId):null,g=p?.createImproveRun??(c.providerRequestId?await e.getCreateImproveRun(String(c.providerRequestId)):null);if(!p||!g)throw new Error("Create/Improve approval is missing its run.");let P=s.decision==="accept"||s.decision==="acceptForSession"?"approve_plan":(s.decision==="cancel","cancel");return await o(g.id,{type:P,runId:g.id,expectedRevision:g.revision,actionId:`approval:${r}:${s.decision}`,...P==="cancel"?{reason:s.decision==="cancel"?"Plan review cancelled.":"Plan review declined."}:{}}),e.getApproval(r)}i(a,"resolveCreateImproveApproval");async function u(r){let l=r.run,s=l?.plan??null;if(!l||!s?.approvalId)return null;let c=await e.getApproval(s.approvalId),p=ie({existing:c,session:r.session,turn:r.turn,run:l,status:oe(s.status)});return await e.upsertApproval(p),!c&&p.status==="pending"&&await e.appendRuntimeEvent(E({sessionId:r.session.id,turnId:r.turn.id,name:"approval.requested",source:"server",action:"create_plan",appId:r.session.appId,status:"pending",output:p.title,data:p})),c?.status==="pending"&&p.status!=="pending"&&await e.appendRuntimeEvent(E({sessionId:r.session.id,turnId:r.turn.id,name:"approval.resolved",source:"server",action:"create_plan",appId:r.session.appId,status:p.status==="accepted"||p.status==="accepted_for_session"?"completed":"failed",output:p.title,data:{approvalId:p.id,runId:l.id,status:p.status}})),p}i(u,"syncCreateImprovePlanApproval");function v(r){let l=`${r.run.id}:${r.run.revision}`;if(t.has(l))return;let s=e.turnFollowUpQueue.enqueue({label:`Apply approved ${r.run.target.kind} Create/Improve run`,metadata:{key:l,sessionId:r.session.id,turnId:r.turn.id,runId:r.run.id,revision:r.run.revision}},async()=>{try{await I(r)}catch(c){let p=c instanceof Error?c.message:String(c);await m({session:r.session,turnId:r.turn.id,run:ue(r.run,p),source:"server"})}finally{t.delete(l)}});t.set(l,s)}i(v,"queueCreateImproveExecution");function R(r){let l=`release:${r.run.id}:${r.run.revision}:${r.action.type}`;if(t.has(l))return;let s=e.turnFollowUpQueue.enqueue({label:`${r.action.type.replaceAll("_"," ")} for Agent improvement`,metadata:{key:l,sessionId:r.session.id,turnId:r.turn.id,runId:r.run.id,revision:r.run.revision,action:r.action.type}},async()=>{try{let c=await e.getCreateImproveRun(r.run.id)??r.run,p=await Te({run:c,action:r.action,resolveTaskset:e.resolveTaskset,gradeTaskAttempt:e.gradeTaskAttempt});await m({session:r.session,turnId:r.turn.id,run:p,source:"server"})}finally{t.delete(l)}});t.set(l,s)}i(R,"queueAgentImprovementReleaseAction");async function I(r){let l=await e.getTurn(r.turn.id)??r.turn,s=await e.getCreateImproveRun(r.run.id)??r.run,c=B(s.target);if(!c.canExecute(s))return;let p=c.normalizeResult(await c.execute(s,{session:r.session,turn:l,ensureCodexRuntime:e.ensureCodexRuntime,appendRuntimeEvent:e.appendRuntimeEvent,setProviderTurnId:i(g=>x(r.session.id,r.turn.id,g),"setProviderTurnId"),onRun:i(async g=>{await m({session:r.session,turnId:r.turn.id,run:g,source:"server"})},"onRun"),model:r.session.provider==="codex"?r.session.modelRef?.modelId??null:null,runChecks:e.runLocalCreatePipelineChecks,resolveTaskset:e.resolveTaskset,gradeTaskAttempt:e.gradeTaskAttempt}));await m({session:r.session,turnId:r.turn.id,run:p,source:"server"})}i(I,"runQueuedCreateImproveExecution");async function k(r){if(e.planCreateImprove)return e.planCreateImprove({run:r.run,modelRef:r.turn.modelRef,requestId:`${r.turn.id}:create-improve-planner`,signal:r.signal});let l=r.turn.modelRef?.providerId??r.session.provider,s=r.turn.modelRef?.modelId??(l==="openpond"?M:null);if(l==="openpond"){let c=s||M;return w({...r,provider:l,model:c,modelRef:{providerId:l,modelId:c},requestId:`${r.turn.id}:create-improve-planner`,stream:i(async function*(p){for await(let g of n({model:c,messages:p,requestId:`${r.turn.id}:create-improve-planner`,signal:r.signal}))g.type==="text_delta"&&g.text&&(yield{text:g.text,raw:g.raw}),g.type==="usage"&&(yield{raw:g.raw,usage:g.usage})},"stream")})}if(re(l)&&e.streamLocalByokChatTurn){if(!s)throw new Error(`Create/Improve planner requires a selected model for provider ${l}.`);return w({...r,provider:l,model:s,modelRef:{providerId:l,modelId:s},requestId:`${r.turn.id}:create-improve-planner`,stream:i(c=>e.streamLocalByokChatTurn({providerId:l,modelId:s,messages:c,requestId:`${r.turn.id}:create-improve-planner`,promptCacheKey:r.session.id,signal:r.signal}),"stream")})}throw new Error("Create/Improve planner requires OpenPond Chat or a configured OpenAI-compatible provider.")}i(k,"planCreateImproveForTurn");async function w(r){let l=N(r.turn,r.run),s=await ne({session:r.session,turn:l,provider:r.provider,model:r.model,requestId:r.requestId,requestOrdinal:0,requestKind:"create_improve_planner",upsert:e.upsertModelUsageRecord});try{let c=await Pe({run:r.run,modelRef:r.modelRef,requestId:r.requestId,signal:r.signal,stream:i(async function*(p){for await(let g of r.stream(p))s.observeDelta(g),yield g},"stream")});return l.createImproveRun=c,await s.complete(),c}catch(c){throw await s.fail(c,r.signal.aborted||c instanceof Error&&c.name==="AbortError"?"interrupted":"failed"),c}}i(w,"runRecordedPlanner");async function b(r){let l=await e.getCreateImproveRun(r.run.id)??r.turn.createImproveRun??r.run;return l.state!=="planning"?e.getTurn(r.turn.id):m({session:r.session,turnId:r.turn.id,run:Ae({run:l,modelRef:r.turn.modelRef,reason:`Create/Improve planner failed: ${r.message}`}),source:"server"})}i(b,"persistCreateImprovePlanningFailure");async function m(r){z({actionLabel:"Persist Create/Improve run",run:r.run});let l=r.run.scope.originTurnId?r.run:C(r.run,{scope:{...r.run.scope,originTurnId:r.turnId},updatedAt:new Date().toISOString()});await e.upsertCreateImproveRun(l);let s=await e.updateTurn(r.turnId,c=>{if(c.sessionId!==r.session.id)throw new Error("Turn not found");return N(c,l)});if(!s)throw new Error("Turn not found");return await f(r.session,s,l,r.source),await u({session:r.session,turn:s,run:l}),s}i(m,"persistCreateImproveRun");async function f(r,l,s,c){await e.appendRuntimeEvent(E({sessionId:r.id,turnId:l.id,name:"create_improve.updated",source:c,appId:r.appId,status:ce(s),output:s.blockedReason??s.plan?.summary??s.state,data:{createImproveRun:s}}))}i(f,"appendRunEvent");function y(r){return B(r.target).canExecute(r)}i(y,"shouldExecuteTarget");async function h(r){let l=r.scope.originTurnId;if(!l)throw new Error(`Create/Improve run ${r.id} is not linked to a turn.`);let s=await e.getTurn(l);if(!s)throw new Error(`Create/Improve turn not found: ${l}`);return s}i(h,"turnForRun");async function x(r,l,s){await e.updateTurn(l,c=>c.sessionId===r?{...c,providerTurnId:s}:c)}return i(x,"setTurnProviderTurnId"),{applyCreateImproveActionPayload:o,assertNoLeakedApplyJobs:i(()=>t.assertEmpty(),"assertNoLeakedApplyJobs"),getCreateImproveRun:e.getCreateImproveRun,listCreateImproveRuns:e.listCreateImproveRuns,persistCreateImprovePlanningFailure:b,persistCreateImproveRun:m,planCreateImproveForTurn:k,queueCreateImproveExecution:v,resolveCreateImproveApproval:a,syncCreateImprovePlanApproval:u}}i($t,"createCreateImproveRuntime");export{$t as createCreateImproveRuntime};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as N,b as E,c as P,d as J,e as j,f as S,g as O,h as C,i as R,j as k,k as B,l as q,m as U,n as L,o as l}from"./chunk-JHEFWB6O.js";import{m as v,s as w,t as y}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{b as I,f,g as h,h as p}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 b}from"./chunk-FTQLQJQV.js";async function M(r,o,e,i){if(o==="list-files"){let t=i[1];if(!t)throw new Error("usage: sandbox list-files <sandboxId> [--path <path>]");let n=typeof e.path=="string"?e.path.trim():void 0,s=h(e.maxEntries,"max-entries"),a=e.recursive!==void 0?f(e.recursive):void 0,d=await r.listFiles(t,{...n?{path:n}:{},...a!==void 0?{recursive:a}:{},...s!==void 0?{maxEntries:s}:{}});return console.log(JSON.stringify({sandbox:l(d.sandbox),files:d.files},null,2)),!0}if(o==="upload-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"",s=typeof e.contents=="string"?e.contents:typeof e.content=="string"?e.content:"",a=typeof e.contentsBase64=="string"?e.contentsBase64.trim():typeof e.contentBase64=="string"?e.contentBase64.trim():"";if(!t||!n)throw new Error('usage: sandbox upload-file <sandboxId> --path <path> --contents "text"');if(!s&&!a)throw new Error('usage: sandbox upload-file <sandboxId> --path <path> --contents "text"');let d=a?await r.uploadFileBase64(t,n,a):await r.uploadFile(t,n,s);return console.log(JSON.stringify({sandbox:l(d.sandbox),file:d.file},null,2)),!0}if(o==="download-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"",s=Number(e["offset-bytes"]),a=Number(e["max-bytes"]);if(!t||!n)throw new Error("usage: sandbox download-file <sandboxId> --path <path>");let d=await r.downloadFileResponse(t,{path:n,...Number.isFinite(s)?{offsetBytes:s}:{},...Number.isFinite(a)?{maxBytes:a}:{}});return console.log(JSON.stringify({sandbox:l(d.sandbox),file:d.file,contents:Buffer.from(d.file.contentsBase64,"base64").toString("utf-8")},null,2)),!0}if(o==="search-files"){let t=i[1],n=typeof e.query=="string"?e.query.trim():"";if(!t||!n)throw new Error("usage: sandbox search-files <sandboxId> --query <text> [--path <path>]");let s=typeof e.path=="string"?e.path.trim():void 0,a=h(e.maxResults,"max-results"),d=await r.searchFiles(t,{query:n,...s?{path:s}:{},...a!==void 0?{maxResults:a}:{}});return console.log(JSON.stringify({sandbox:l(d.sandbox),matches:d.matches},null,2)),!0}if(o==="delete-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"";if(!t||!n)throw new Error("usage: sandbox delete-file <sandboxId> --path <path> [--recursive]");let s=await r.deleteFile(t,n,{recursive:f(e.recursive)});return console.log(JSON.stringify({sandbox:l(s.sandbox),deleted:s.deleted},null,2)),!0}if(o==="stat-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"";if(!t||!n)throw new Error("usage: sandbox stat-file <sandboxId> --path <path>");let s=await r.statFile(t,n);return console.log(JSON.stringify({sandbox:l(s.sandbox),file:s.file},null,2)),!0}if(o==="mkdir"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"";if(!t||!n)throw new Error("usage: sandbox mkdir <sandboxId> --path <path> [--recursive false]");let s=await r.mkdir(t,{path:n,recursive:e.recursive!==void 0?f(e.recursive):void 0});return console.log(JSON.stringify({sandbox:l(s.sandbox),directory:s.directory},null,2)),!0}if(o==="move-file"){let t=i[1],n=typeof e.fromPath=="string"?e.fromPath.trim():"",s=typeof e.toPath=="string"?e.toPath.trim():"";if(!t||!n||!s)throw new Error("usage: sandbox move-file <sandboxId> --from-path <path> --to-path <path> [--overwrite]");let a=await r.moveFile(t,{fromPath:n,toPath:s,overwrite:f(e.overwrite)});return console.log(JSON.stringify({sandbox:l(a.sandbox),moved:a.moved,file:a.file},null,2)),!0}return!1}b(M,"handleSandboxFilesCommand");async function T(r,o,e,i){if(o==="git-status"){let t=i[1];if(!t)throw new Error("usage: sandbox git-status <sandboxId>");let n=await r.gitStatus(t);return console.log(JSON.stringify({sandbox:l(n.sandbox),status:n.status},null,2)),!0}if(o==="git-diff"){let t=i[1];if(!t)throw new Error("usage: sandbox git-diff <sandboxId> [--base-ref <ref>]");let n=typeof e.baseRef=="string"&&e.baseRef.trim()?e.baseRef.trim():void 0,s=await r.gitDiff(t,{...n?{baseRef:n}:{}});return console.log(JSON.stringify({sandbox:l(s.sandbox),diff:s.diff},null,2)),!0}if(o==="git-export-patch"){let t=i[1];if(!t)throw new Error("usage: sandbox git-export-patch <sandboxId> [--base-ref <ref>]");let n=typeof e.baseRef=="string"&&e.baseRef.trim()?e.baseRef.trim():void 0,s=await r.gitExportPatch(t,{...n?{baseRef:n}:{}});return console.log(JSON.stringify({sandbox:l(s.sandbox),patch:s.patch},null,2)),!0}if(o==="git-branch"){let t=i[1],n=typeof e.branch=="string"?e.branch.trim():"",s=typeof e.startPoint=="string"&&e.startPoint.trim()?e.startPoint.trim():void 0;if(!t||!n)throw new Error("usage: sandbox git-branch <sandboxId> --branch <name> [--create] [--start-point <ref>]");let a=await r.gitBranch(t,{branch:n,create:f(e.create),...s?{startPoint:s}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),branch:a.branch},null,2)),!0}if(o==="git-commit"){let t=i[1],n=typeof e.message=="string"?e.message.trim():"",s=f(e.all),d=(typeof e.paths=="string"?e.paths:typeof e.path=="string"?e.path:"").split(",").map(g=>g.trim()).filter(Boolean);if(!t||!n||!s&&d.length===0)throw new Error('usage: sandbox git-commit <sandboxId> --message "..." [--all|--paths <csv>]');let c=await r.gitCommit(t,{message:n,...s?{all:!0}:{paths:d}});return console.log(JSON.stringify({sandbox:l(c.sandbox),commit:c.commit},null,2)),!0}if(o==="git-pull"){let t=i[1];if(!t)throw new Error("usage: sandbox git-pull <sandboxId> [--remote origin] [--branch main] [--rebase|--ff-only false]");let n=typeof e.remote=="string"&&e.remote.trim()?e.remote.trim():void 0,s=typeof e.branch=="string"&&e.branch.trim()?e.branch.trim():void 0,a=await r.gitPull(t,{...n?{remote:n}:{},...s?{branch:s}:{},...e.rebase!==void 0?{rebase:f(e.rebase)}:{},...e.ffOnly!==void 0?{ffOnly:f(e.ffOnly)}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),pull:a.pull},null,2)),!0}if(o==="git-push"){let t=i[1];if(!t)throw new Error("usage: sandbox git-push <sandboxId> [--remote origin] [--branch main] [--set-upstream] [--force-with-lease]");let n=typeof e.remote=="string"&&e.remote.trim()?e.remote.trim():void 0,s=typeof e.branch=="string"&&e.branch.trim()?e.branch.trim():void 0,a=await r.gitPush(t,{...n?{remote:n}:{},...s?{branch:s}:{},...e.setUpstream!==void 0?{setUpstream:f(e.setUpstream)}:{},...e.forceWithLease!==void 0?{forceWithLease:f(e.forceWithLease)}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),push:a.push},null,2)),!0}return!1}b(T,"handleSandboxGitCommand");async function F(r,o,e,i){if(o==="process-start"){let t=i[1],n=(typeof e.command=="string"?e.command:null)||i.slice(2).join(" ");if(!t||!n.trim())throw new Error("usage: sandbox process-start <sandboxId> --command <command>");let s=p(e.timeoutSeconds,"timeout-seconds"),a=await r.startProcess(t,{command:n.trim(),...s!==void 0?{timeoutSeconds:s}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),process:a.process},null,2)),!0}if(o==="process-list"){let t=i[1];if(!t)throw new Error("usage: sandbox process-list <sandboxId>");let n=await r.listProcesses(t);return console.log(JSON.stringify({sandbox:l(n.sandbox),processes:n.processes},null,2)),!0}if(o==="process-get"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox process-get <sandboxId> <processId> [--since <cursor>]");let s=p(e.since,"since"),a=await r.getProcess(t,n,{...s!==void 0?{since:s}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),process:a.process,output:a.output,cursor:a.cursor,completed:a.completed},null,2)),!0}if(o==="process-stop"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox process-stop <sandboxId> <processId>");let s=await r.stopProcess(t,n);return console.log(JSON.stringify({sandbox:l(s.sandbox),process:s.process},null,2)),!0}if(o==="process-stream"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox process-stream <sandboxId> <processId> [--since <cursor>]");let s=p(e.since,"since");return await r.streamProcessOutput(t,n,{...s!==void 0?{since:s}:{}}),!0}if(o==="pty-start"){let t=i[1];if(!t)throw new Error("usage: sandbox pty-start <sandboxId> [--command <command>]");let n=(typeof e.command=="string"?e.command:null)||i.slice(2).join(" "),s=p(e.timeoutSeconds,"timeout-seconds"),a=p(e.rows,"rows"),d=p(e.cols,"cols"),c=await r.startPty(t,{...n.trim()?{command:n.trim()}:{},...s!==void 0?{timeoutSeconds:s}:{},...a!==void 0?{rows:a}:{},...d!==void 0?{cols:d}:{}});return console.log(JSON.stringify({sandbox:l(c.sandbox),pty:c.pty},null,2)),!0}if(o==="pty-list"){let t=i[1];if(!t)throw new Error("usage: sandbox pty-list <sandboxId>");let n=await r.listPtys(t);return console.log(JSON.stringify({sandbox:l(n.sandbox),ptys:n.ptys},null,2)),!0}if(o==="pty-get"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox pty-get <sandboxId> <ptyId> [--since <cursor>]");let s=p(e.since,"since"),a=await r.getPty(t,n,{...s!==void 0?{since:s}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),pty:a.pty,output:a.output,cursor:a.cursor,completed:a.completed},null,2)),!0}if(o==="pty-write"){let t=i[1],n=i[2],s=typeof e.inputBase64=="string"?e.inputBase64.trim():"",a=(typeof e.input=="string"?e.input:null)||i.slice(3).join(" ");if(!t||!n||!s&&!a)throw new Error("usage: sandbox pty-write <sandboxId> <ptyId> --input <text>");let d=await r.writePtyInput(t,n,s?{dataBase64:s}:a);return console.log(JSON.stringify({sandbox:l(d.sandbox),pty:d.pty},null,2)),!0}if(o==="pty-stop"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox pty-stop <sandboxId> <ptyId>");let s=await r.stopPty(t,n);return console.log(JSON.stringify({sandbox:l(s.sandbox),pty:s.pty},null,2)),!0}if(o==="pty-stream"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox pty-stream <sandboxId> <ptyId> [--since <cursor>]");let s=p(e.since,"since");return await r.streamPtyOutput(t,n,{...s!==void 0?{since:s}:{}}),!0}return!1}b(F,"handleSandboxProcessCommand");async function A(r,o,e,i){if(o==="replays"||o==="replay-list"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.listReplays({...t?{teamId:t}:{},...n?{projectId:n}:{}});if(f(e.json))return console.log(JSON.stringify(s,null,2)),!0;if(s.replays.length===0)return console.log("no sandbox replays found"),!0;for(let a of s.replays)console.log(O(a));return!0}if(o==="replay-start"||o==="start-replay"){let t=await r.startReplay(k(e));return console.log(JSON.stringify(t,null,2)),!0}if(o==="replay-get"||o==="get-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-get <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=await r.getReplay(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});return console.log(JSON.stringify(a,null,2)),!0}if(o==="replay-logs"||o==="logs-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-logs <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=await r.getReplayLogs(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});for(let d of a.logs)console.log(d);return!0}if(o==="replay-artifacts"||o==="artifacts-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-artifacts <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=await r.getReplayArtifacts(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});return console.log(JSON.stringify({replayId:a.replayId,artifacts:a.artifacts.map(C)},null,2)),!0}if(o==="replay-cancel"||o==="cancel-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-cancel <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=await r.cancelReplay(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});return console.log(JSON.stringify(a,null,2)),!0}if(o==="replay-watch"||o==="watch-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-watch <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=p(e.intervalMs,"interval-ms")??5e3,d=p(e.timeoutMs,"timeout-ms")??900*1e3,c=Date.now(),g=new Set;for(;Date.now()-c<=d;){let u=await r.getReplay(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});for(let m of u.replay.logs)g.has(m)||(g.add(m),console.log(m));if(u.replay.state==="succeeded"||u.replay.state==="failed"||u.replay.state==="canceled"){if(console.log(O(u.replay)),u.replay.state!=="succeeded")throw new Error(`sandbox replay ${u.replay.state}: ${u.replay.error??"no error"}`);return!0}await new Promise(m=>setTimeout(m,a))}throw new Error(`sandbox replay did not finish within ${d}ms`)}return!1}b(A,"handleSandboxReplayCommand");async function V(r,o,e,i){if(o==="runtime-list"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=typeof e.projectId=="string"?e.projectId.trim():"",s=typeof e.agentId=="string"?e.agentId.trim():"",a=await r.listSandboxRuntimes({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{}});return console.log(JSON.stringify({runtimes:a},null,2)),!0}if(o==="runtime-get"){let t=i[1]?.trim();if(!t)throw new Error("usage: sandbox runtime-get <runtimeId>");let n=await r.getSandboxRuntime(t);return console.log(JSON.stringify({runtime:n},null,2)),!0}if(o==="runtime-events"){let t=i[1]?.trim();if(!t)throw new Error("usage: sandbox runtime-events <runtimeId>");return console.log(JSON.stringify(await r.listSandboxRuntimeEvents(t),null,2)),!0}if(o==="runtime-status"){let t=i[1]?.trim(),n=typeof e.status=="string"&&e.status.trim()?e.status.trim():"",s=Number(e.expectedVersion),a=typeof e.summary=="string"&&e.summary.trim()?e.summary.trim():void 0;if(!t||!n||!Number.isInteger(s))throw new Error("usage: sandbox runtime-status <runtimeId> --status <status> --expected-version <n>");let d=await r.updateSandboxRuntimeStatus(t,{status:n,expectedVersion:s,...a?{summary:a}:{}});return console.log(JSON.stringify({runtime:d},null,2)),!0}if(o==="runtime-event"){let t=i[1]?.trim(),n=typeof e.type=="string"&&e.type.trim()?e.type.trim():"",s=typeof e.summary=="string"&&e.summary.trim()?e.summary.trim():void 0,a=typeof e.payload=="string"&&e.payload.trim()?I(e.payload,"payload"):void 0,d=typeof e.lifecycleHint=="string"&&e.lifecycleHint.trim()?I(e.lifecycleHint,"lifecycle-hint"):void 0;if(!t||!n)throw new Error("usage: sandbox runtime-event <runtimeId> --type <eventType> [--summary <text>] [--payload <json>] [--lifecycle-hint <json>]");return console.log(JSON.stringify(await r.emitSandboxRuntimeEvent(t,{type:n,...s?{summary:s}:{},...a?{payload:a}:{},...d?{lifecycleHint:d}:{}}),null,2)),!0}if(o==="runtime-preserve-source"||o==="runtime-preserve"){let t=i[1]?.trim(),n=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():"",s=typeof e.sandboxId=="string"&&e.sandboxId.trim()?e.sandboxId.trim():"",a=typeof e.message=="string"&&e.message.trim()?e.message.trim():"";if(!t)throw new Error("usage: sandbox runtime-preserve-source <runtimeId> [--team-id <id>] [--sandbox-id <id>] [--message <text>]");return console.log(JSON.stringify(await r.runtimes.preserveSource(t,{...s?{sandboxId:s}:{},...a?{message:a}:{}},{...n?{teamId:n}:{}}),null,2)),!0}return!1}b(V,"handleSandboxRuntimeCommand");async function $(r,o,e,i){if(o==="secrets"||o==="secret-list"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=await r.listSecrets({...t?{teamId:t}:{}});if(f(e.json))return console.log(JSON.stringify({secrets:n.map(y)},null,2)),!0;if(n.length===0)return console.log("no sandbox secrets found"),!0;for(let s of n)console.log(`${s.name} ${s.status} v${s.currentVersion??"current"} ${s.secretRef}`);return!0}if(o==="secret-create"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=typeof e.name=="string"?e.name.trim():"",s=typeof e.description=="string"&&e.description.trim()?e.description.trim():void 0,a=e.scope==="project"||e.scope==="template"||e.scope==="team"?e.scope:void 0;if(!n)throw new Error("usage: sandbox secret-create --name <ENV_NAME> [--team-id <id>] [--stdin]");let d=await w(e,`Value for ${n}`),c=await r.createSecret({...t?{teamId:t}:{},name:n,value:d,...s?{description:s}:{},...a?{scope:a}:{}});return console.log(JSON.stringify({secret:y(c)},null,2)),!0}if(o==="secret-rotate"){let t=i[1],n=typeof e.teamId=="string"?e.teamId.trim():"";if(!t)throw new Error("usage: sandbox secret-rotate <secretId> [--team-id <id>] [--stdin]");let s=await w(e,"New secret value"),a=await r.rotateSecret(t,{...n?{teamId:n}:{},value:s});return console.log(JSON.stringify({secret:y(a)},null,2)),!0}if(o==="secret-attach"){let t=i[1],n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.envName=="string"?e.envName.trim():"",a=e.targetType==="sandbox"||e.targetType==="template"||e.targetType==="project"||e.targetType==="agent"||e.targetType==="replay"?e.targetType:void 0,d=typeof e.targetId=="string"?e.targetId.trim():"";if(!t||!s||!a||!d)throw new Error("usage: sandbox secret-attach <secretId> --env-name <ENV_NAME> --target-type sandbox|project|agent|template|replay --target-id <id>");let c=await r.attachSecret(t,{...n?{teamId:n}:{},envName:s,targetType:a,targetId:d});return console.log(JSON.stringify({secret:y(c)},null,2)),!0}if(o==="secret-revoke"||o==="secret-delete"){let t=i[1],n=typeof e.teamId=="string"?e.teamId.trim():"";if(!t)throw new Error(`usage: sandbox ${o} <secretId> [--team-id <id>]`);let s=o==="secret-revoke"?await r.revokeSecret(t,{...n?{teamId:n}:{}}):await r.deleteSecret(t,{...n?{teamId:n}:{}});return console.log(JSON.stringify({secret:y(s)},null,2)),!0}return!1}b($,"handleSandboxSecretsCommand");async function H(r,o,e,i){if(o==="published-snapshot-builds"||o==="published-snapshot-build-list"||o==="template-builds"||o==="template-build-list"){let t=typeof e.teamId=="string"?e.teamId.trim():"";if(!t)throw new Error("usage: sandbox published-snapshot-builds --team-id <id>");let n=await r.listPublishedSnapshotBuilds({teamId:t});if(f(e.json))return console.log(JSON.stringify({builds:n},null,2)),!0;if(n.length===0)return console.log("no published snapshot builds found"),!0;for(let s of n)console.log(S(s));return!0}if(o==="published-snapshot-build-create"||o==="create-published-snapshot-build"||o==="template-build-create"||o==="create-template-build"){let t=await r.createPublishedSnapshotBuild(U(e));return console.log(JSON.stringify({build:t},null,2)),!0}if(o==="published-snapshot-build-get"||o==="get-published-snapshot-build"||o==="template-build-get"||o==="get-template-build"){let t=i[1];if(!t)throw new Error("usage: sandbox published-snapshot-build-get <buildId>");let n=await r.getPublishedSnapshotBuild(t);return console.log(JSON.stringify({build:n},null,2)),!0}if(o==="published-snapshot-build-logs"||o==="published-snapshot-build-log"||o==="template-build-logs"||o==="template-build-log"){let t=i[1];if(!t)throw new Error("usage: sandbox published-snapshot-build-logs <buildId>");let n=await r.getPublishedSnapshotBuildLogs(t);if(f(e.json))return console.log(JSON.stringify(n,null,2)),!0;for(let s of n.logs)console.log(s);return!0}if(o==="published-snapshot-build-cancel"||o==="cancel-published-snapshot-build"||o==="template-build-cancel"||o==="cancel-template-build"){let t=i[1];if(!t)throw new Error("usage: sandbox published-snapshot-build-cancel <buildId>");let n=await r.cancelPublishedSnapshotBuild(t);return console.log(JSON.stringify({build:n},null,2)),!0}if(o==="published-snapshot-build-watch"||o==="watch-published-snapshot-build"||o==="template-build-watch"||o==="watch-template-build"){let t=i[1];if(!t)throw new Error("usage: sandbox published-snapshot-build-watch <buildId>");let n=p(e.intervalMs,"interval-ms")??5e3,s=p(e.timeoutMs,"timeout-ms")??900*1e3,a=Date.now(),d=new Set;for(;Date.now()-a<=s;){let[c,g]=await Promise.all([r.getPublishedSnapshotBuild(t),r.getPublishedSnapshotBuildLogs(t)]);for(let u of g.logs)d.has(u)||(d.add(u),console.log(u));if(c.status==="succeeded"||c.status==="failed"||c.status==="cancelled"){if(console.log(S(c)),c.status!=="succeeded")throw new Error(`published snapshot build ${c.status}: ${c.error??"no error"}`);return!0}await new Promise(u=>setTimeout(u,n))}throw new Error(`published snapshot build did not finish within ${s}ms`)}return!1}b(H,"handleSandboxTemplateBuildsCommand");function G(r){return f(r.async)||f(r.respondAsync)}b(G,"parseSandboxAsyncOption");async function Pe(r,o){let e=o[0]||"list",i=await v(r);if(e==="list"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.agentId=="string"?r.agentId.trim():"",a=await i.list({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{}});if(a.length===0){console.log("no sandboxes found");return}for(let d of a)console.log(P(d));return}if(e==="mcp-config"||e==="mcp-url"){let t=i.mcpServerConfig();console.log(JSON.stringify({...t,headers:{"openpond-api-key":"set OPENPOND_API_KEY or use your saved openpond profile"}},null,2));return}if(!await V(i,e,r,o)){if(e==="pricing"){let t=await i.pricing();console.log(JSON.stringify(t,null,2));return}if(e==="costs"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.agentId=="string"?r.agentId.trim():"",a=await i.costs({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{}});if(f(r.summary)){console.log(JSON.stringify({costs:{teamId:a.costs.teamId,ownerUserId:a.costs.ownerUserId,generatedAt:a.costs.generatedAt,summary:a.costs.summary,lineItems:a.costs.lineItems,tiers:a.costs.pricing.tiers.map(d=>({key:d.key,resources:d.resources,keepRunningEstimate:d.keepRunningEstimate}))}},null,2));return}console.log(JSON.stringify(a,null,2));return}if(!await $(i,e,r,o)){if(e==="snapshots"||e==="snapshot-catalog"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.agentId=="string"?r.agentId.trim():"",a=typeof r.query=="string"&&r.query.trim()?r.query.trim():typeof r.q=="string"&&r.q.trim()?r.q.trim():"",d=typeof r.tag=="string"?r.tag.trim():"",c=typeof r.useCase=="string"?r.useCase.trim():"",g=typeof r.replayState=="string"?r.replayState.trim():"",u=await i.snapshotCatalog({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{},...a?{q:a}:{},...d?{tag:d}:{},...c?{useCase:c}:{},...g==="draft"||g==="validated"||g==="published"?{replayState:g}:{}});if(u.snapshots.length===0){console.log("no sandbox snapshots found");return}for(let m of u.snapshots)console.log(J(m));return}if(e==="published-snapshots"||e==="published-snapshot-catalog"||e==="templates"||e==="template-catalog"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.query=="string"&&r.query.trim()?r.query.trim():typeof r.q=="string"&&r.q.trim()?r.q.trim():"",a=typeof r.name=="string"&&r.name.trim()?r.name.trim():typeof r.templateName=="string"&&r.templateName.trim()?r.templateName.trim():"",d=typeof r.version=="string"?r.version.trim():"",c=typeof r.tag=="string"?r.tag.trim():"",g=typeof r.useCase=="string"?r.useCase.trim():"",u=await i.publishedSnapshots({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{q:s}:{},...a?{name:a}:{},...d?{version:d}:{},...c?{tag:c}:{},...g?{useCase:g}:{}});if(u.publishedSnapshots.length===0){console.log("no published snapshots found");return}for(let m of u.publishedSnapshots)console.log(j(m));return}if(!(await H(i,e,r,o)||await A(i,e,r,o))){if(e==="run-published-snapshot"||e==="published-snapshot-run"||e==="template-launch"||e==="launch-template"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.snapshotId=="string"&&r.snapshotId.trim()?r.snapshotId.trim():typeof r.snapshot=="string"&&r.snapshot.trim()?r.snapshot.trim():"",a=typeof r.templateName=="string"&&r.templateName.trim()?r.templateName.trim():typeof r.name=="string"&&r.name.trim()?r.name.trim():typeof o[1]=="string"&&o[1].trim()?o[1].trim():"",d=typeof r.version=="string"?r.version.trim():"",c=typeof r.useCase=="string"?r.useCase.trim():"";if(!s&&!a&&!c)throw new Error("usage: sandbox run-published-snapshot [--snapshot-id <id>|--name <name>|--use-case <id>] [--version <v>]");let g=typeof r.budgetUsd=="string"&&r.budgetUsd.trim()?r.budgetUsd.trim():typeof r.budget=="string"&&r.budget.trim()?r.budget.trim():"",u=await i.runPublishedSnapshot({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{snapshotId:s}:{},...a?{templateName:a}:{},...d?{version:d}:{},...c?{useCase:c}:{},...g?{budget:{maxUsd:g}}:{},metadata:{source:"openpond-code-published-snapshot-run"}});console.log(JSON.stringify(u,null,2));return}if(e==="snapshot-fork"||e==="fork-snapshot"){let t=o[1];if(!t)throw new Error("snapshot-fork requires <snapshotId>");let n=typeof r.teamId=="string"?r.teamId.trim():"",s=typeof r.projectId=="string"?r.projectId.trim():"",a=typeof r.budgetUsd=="string"&&r.budgetUsd.trim()?r.budgetUsd.trim():typeof r.budget=="string"&&r.budget.trim()?r.budget.trim():"",d=await i.forkSnapshot(t,{...n?{teamId:n}:{},...s?{projectId:s}:{},...a?{budget:{maxUsd:a}}:{},metadata:{source:"openpond-code-snapshot-fork",templateSnapshotId:t}});console.log(JSON.stringify(d,null,2));return}if(e==="snapshot-create"||e==="create-snapshot"){let t=o[1];if(!t)throw new Error("usage: sandbox snapshot-create <sandboxId> --name <name>");let n=await i.createSnapshot(t,L(r));console.log(JSON.stringify(n,null,2));return}if(e==="snapshot-validate"||e==="validate-snapshot"){let t=o[1],n=o[2];if(!t||!n)throw new Error("snapshot-validate requires <sandboxId> <snapshotId>");let s=R(r.cleanup),a=await i.validateSnapshot(t,n,{...s?{cleanup:s}:{}});console.log(JSON.stringify(a,null,2));return}if(e==="snapshot-publish"||e==="publish-snapshot"){let t=o[1],n=o[2];if(!t||!n)throw new Error("snapshot-publish requires <sandboxId> <snapshotId>");let s=await i.publishSnapshot(t,n);console.log(JSON.stringify(s,null,2));return}if(e==="integration-connections"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.agentId=="string"?r.agentId.trim():"",a=r.status==="active"||r.status==="revoked"||r.status==="error"||r.status==="all"?r.status:void 0,d=await i.integrationConnections({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{},...a?{status:a}:{}});console.log(JSON.stringify(d,null,2));return}if(e==="create"){let t=await N(i,B(r));console.log(JSON.stringify({sandbox:l(t.sandbox),...t.runtime?{runtime:t.runtime}:{}},null,2));return}if(e==="exec"){let t=o[1],n=(typeof r.command=="string"?r.command:null)||o.slice(2).join(" ");if(!t||!n.trim())throw new Error("usage: sandbox exec <sandboxId> --command <command>");let s=p(r.timeoutSeconds,"timeout-seconds"),a=await i.exec(t,{command:n.trim(),...s!==void 0?{timeoutSeconds:s}:{}});console.log(JSON.stringify({sandbox:l(a.sandbox),command:a.command},null,2));return}if(e==="port"||e==="preview"){let t=o[1],n=p(r.port,"port");if(!t||n===void 0)throw new Error("usage: sandbox port <sandboxId> --port <port>");let s=typeof r.label=="string"?r.label:void 0,a=typeof r.access=="string"?r.access.trim():"";if(a&&a!=="private"&&a!=="public")throw new Error("sandbox port --access must be private or public");let d=a==="public"?"public":"private",c=typeof r.domain=="string"?r.domain.trim():"",g=typeof r.authToken=="string"?r.authToken:"",u=typeof r.authHeader=="string"?r.authHeader.trim():"",m=typeof r.authHeaderValue=="string"?r.authHeaderValue:"";if(g&&(u||m))throw new Error("sandbox port auth options must use either --auth-token or --auth-header with --auth-header-value");if(u&&!m||!u&&m)throw new Error("sandbox port custom header auth requires both --auth-header and --auth-header-value");let x=await i.openPort(t,{port:n,...s?{label:s}:{},access:d,...r["auto-start"]||r.autoStart?{autoStart:!0}:{},...c?{customDomain:c}:{},...g?{authPolicy:{mode:"bearer",token:g}}:{},...u&&m?{authPolicy:{mode:"header",headerName:u,headerValue:m}}:{}});console.log(JSON.stringify(x.preview,null,2));return}if(e==="stop"){let t=o[1];if(!t)throw new Error("usage: sandbox stop <sandboxId> [--fail-on-unpreserved-changes] [--async]");let n=await i.stop(t,{failOnUnpreservedChanges:f(r.failOnUnpreservedChanges),async:G(r)});console.log(JSON.stringify({sandbox:l(n.sandbox),receipt:n.receipt},null,2));return}if(e==="start"){let t=o[1];if(!t)throw new Error("usage: sandbox start <sandboxId>");let n=await i.start(t);console.log(JSON.stringify({sandbox:await E(i,n.sandbox),receipt:n.receipt},null,2));return}if(e==="delete"){let t=o[1];if(!t)throw new Error("usage: sandbox delete <sandboxId> [--fail-on-unpreserved-changes] [--async]");let n=await i.delete(t,{failOnUnpreservedChanges:f(r.failOnUnpreservedChanges),async:G(r)});console.log(JSON.stringify({sandbox:l(n)},null,2));return}if(e==="receipts"){let t=o[1];if(!t)throw new Error("usage: sandbox receipts <sandboxId>");let n=await i.receipts(t);console.log(JSON.stringify({receipts:n},null,2));return}if(e==="logs"){let t=o[1];if(!t)throw new Error("usage: sandbox logs <sandboxId>");let n=await i.logs(t);for(let s of n)console.log(s);return}if(!(await F(i,e,r,o)||await M(i,e,r,o)||await T(i,e,r,o))){if(e==="billing"){let t=o[1];if(!t)throw new Error("usage: sandbox billing <sandboxId>");let n=await i.billing(t);console.log(JSON.stringify({sandbox:l(n.sandbox),billing:n.billing},null,2));return}if(e==="integration-leases"){let t=o[1];if(!t)throw new Error("usage: sandbox integration-leases <sandboxId>");let n=await i.integrationLeases(t);console.log(JSON.stringify({sandbox:l(n.sandbox),integrationLeases:n.integrationLeases},null,2));return}if(e==="integration-attach"){let t=o[1];if(!t)throw new Error("usage: sandbox integration-attach <sandboxId> --integration-connection <id> --integration-capabilities <csv>");let n=await i.attachIntegrationConnection(t,q(r));console.log(JSON.stringify({sandbox:l(n.sandbox),integrationLeases:n.integrationLeases},null,2));return}if(e==="integration-remove"){let t=o[1],n=typeof r.leaseId=="string"?r.leaseId.trim():"";if(!t||!n)throw new Error("usage: sandbox integration-remove <sandboxId> --lease-id <id>");let s=await i.removeIntegrationLease(t,n);console.log(JSON.stringify({sandbox:l(s.sandbox),integrationLeases:s.integrationLeases},null,2));return}if(e==="smoke"){let t=typeof r.repo=="string"?r.repo.trim():void 0,n=typeof r.budgetUsd=="string"?r.budgetUsd.trim():typeof r.budget=="string"?r.budget.trim():void 0,s=f(r.keep),a=r.preview!==void 0?f(r.preview):!f(r.noPreview),d=f(r.snapshot),c=f(r.fork),g={...t?{repo:t}:{},...n?{budgetUsd:n}:{},keep:s,preview:a,snapshot:d,fork:c};typeof r.expectedMppMode=="string"&&r.expectedMppMode.trim()&&(g.expectedMppMode=r.expectedMppMode.trim());let u=h(r.cpu,"cpu"),m=h(r.memoryGb,"memory-gb"),x=h(r.diskGb,"disk-gb");u!==void 0&&(g.cpu=u),m!==void 0&&(g.memoryGb=m),x!==void 0&&(g.diskGb=x);let z=await i.smoke(g);console.log(JSON.stringify(z,null,2));return}throw new Error("usage: sandbox <list|mcp-config|runtime-list|runtime-get|runtime-events|runtime-status|runtime-event|runtime-preserve-source|pricing|costs|secrets|secret-create|secret-rotate|secret-attach|secret-revoke|secret-delete|snapshots|published-snapshots|run-published-snapshot|snapshot-fork|snapshot-validate|snapshot-publish|create|exec|port|preview|stop|start|delete|receipts|logs|billing|process-start|process-list|process-get|process-stop|process-stream|pty-start|pty-list|pty-get|pty-write|pty-stop|pty-stream|upload-file|download-file|list-files|search-files|delete-file|stat-file|mkdir|move-file|git-status|git-diff|git-export-patch|git-branch|git-commit|git-pull|git-push|smoke> [args]")}}}}}b(Pe,"runSandboxCommand");export{Pe as runSandboxCommand};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as Ee,o as Re}from"./chunk-GL3NX3F3.js";import{m as he}from"./chunk-ARLOVWQ3.js";import{a as ie,b as de,d as ce,e as le,k as me,m as N,n as fe,o as be,r as xe,v as g,w as ge,x as Se}from"./chunk-GUOLMLZN.js";import{c as oe}from"./chunk-JUQMSHNR.js";import"./chunk-U2MAPON2.js";import"./chunk-7UH4YDA7.js";import{f as ue,h as pe}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as M,f as h,h as R}from"./chunk-3M53YXEI.js";import{l as se}from"./chunk-OLDK2LKJ.js";import"./chunk-BT5YNE5U.js";import"./chunk-SF5HJ7PL.js";import"./chunk-FWIPHEVA.js";import{d as ae}from"./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-3A7HZJNE.js";import{c as f,d as we,e as Te,h as O,k as C,q as v,r as ye,s as U,t as Pe,u as ve}from"./chunk-EAPFMACH.js";import"./chunk-6FA3GG5B.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 i}from"./chunk-FTQLQJQV.js";import{promises as P,existsSync as kt}from"node:fs";import b from"node:path";import{Buffer as ht}from"node:buffer";import{promises as y}from"node:fs";import w from"node:path";import{Buffer as Ve}from"node:buffer";import{promises as j}from"node:fs";import S from"node:path";async function q(e,t,n,r){let a=Ie(n,r);if(!a)return[];let o=Oe(n,r),s=typeof r.projectId=="string"&&r.projectId.trim()?r.projectId.trim():typeof r.runtimeProjectId=="string"?r.runtimeProjectId.trim():"",d=typeof r.teamId=="string"?r.teamId.trim():"",c=[];for(let l of a.schedules){let u=Ce({manifest:n,schedule:l,override:o.get(l.name),mode:a.mode,sourceSandboxId:t,teamId:d,projectId:s}),m=await e.createSchedule(u);c.push({id:m.schedule.id,name:m.schedule.name,enabled:m.schedule.enabled,scheduleType:m.schedule.scheduleType,scheduleExpression:m.schedule.scheduleExpression,syncStatus:m.schedule.syncStatus,awsScheduleArn:m.schedule.awsScheduleArn??null,target:m.schedule.target})}return c}i(q,"createSandboxTemplateStartSchedules");function Ie(e,t){let n=t.enableSchedules??t.enableSchedule,r=t.disableSchedules??t.disableSchedule;if(n!==void 0&&r!==void 0)throw new Error("pass only one of --enable-schedules or --disable-schedules");let a=null,o;if(n!==void 0)a="enabled",o=n;else if(r!==void 0)a="disabled",o=r;else if(t.schedules!==void 0){o=t.schedules;let c=typeof t.scheduleMode=="string"?t.scheduleMode.trim().toLowerCase():"disabled";if(c==="none")return null;if(c!=="enabled"&&c!=="disabled")throw new Error("--schedule-mode must be enabled, disabled, or none");a=c}if(!a)return null;if(e.schedules.length===0)return{mode:a,schedules:[]};let s=ke(o,e),d=s===null?e.schedules:e.schedules.filter(c=>s.has(c.name));return{mode:a,schedules:d}}i(Ie,"resolveSandboxTemplateStartScheduleSelection");function ke(e,t){if(e===void 0||e===!0)return null;let n=String(e).trim();if(!n||n==="true"||n.toLowerCase()==="all")return null;if(n.toLowerCase()==="none")return new Set;let r=new Set(t.schedules.map(o=>o.name)),a=new Set(n.split(",").map(o=>o.trim()).filter(Boolean));for(let o of a)if(!r.has(o))throw new Error(`manifest schedule not found: ${o}`);return a}i(ke,"parseSandboxTemplateScheduleNameSelection");function Oe(e,t){let n=typeof t.scheduleOverrides=="string"?t.scheduleOverrides:typeof t.scheduleOverride=="string"?t.scheduleOverride:"";if(!n.trim())return new Map;let r=M(n,"schedule-overrides");if(!r||typeof r!="object"||Array.isArray(r))throw new Error("schedule-overrides must be a JSON object keyed by schedule name");let a=new Set(e.schedules.map(s=>s.name)),o=new Map;for(let[s,d]of Object.entries(r)){if(!a.has(s))throw new Error(`schedule override target does not exist: ${s}`);if(!d||typeof d!="object"||Array.isArray(d))throw new Error(`schedule override for ${s} must be an object`);o.set(s,d)}return o}i(Oe,"parseSandboxTemplateScheduleOverrides");function Ce(e){let t=Me(e.schedule,e.override),n=Ne(t);return{sourceSandboxId:e.sourceSandboxId,...e.teamId?{teamId:e.teamId}:{},...e.projectId?{projectId:e.projectId}:{},name:t.name,...t.description?{description:t.description}:{},...n,...t.timezone?{timezone:t.timezone}:{},enabled:typeof e.override?.enabled=="boolean"?e.override.enabled:e.mode==="enabled",...t.startAt?{startAt:t.startAt}:{},...t.endAt?{endAt:t.endAt}:{},...t.maxRuns!==void 0?{maxRuns:t.maxRuns}:{},runtimePolicy:t.runtimePolicy,target:Ae(e.manifest,t),...t.budget?{budget:t.budget}:{},...t.resources?{resources:t.resources}:{},...t.quotas?{quotas:t.quotas}:{},...t.lifecycle?{lifecycle:t.lifecycle}:{},...t.retentionPolicy?{retentionPolicy:t.retentionPolicy}:{},...t.env?{env:t.env}:{},...t.integrationLeases?{integrationLeases:t.integrationLeases}:{},metadata:{...t.metadata??{},manifestScheduleName:t.name,source:"openpond-code-sandbox-template-start"},managementSource:"openpond.yaml",manifestPath:f}}i(Ce,"buildSandboxTemplateStartScheduleInput");function Me(e,t){return t?{...e,...t,target:e.target||t.target?{...e.target??{},...t.target??{}}:void 0,metadata:e.metadata||t.metadata?{...e.metadata??{},...t.metadata??{}}:void 0}:e}i(Me,"mergeSandboxTemplateScheduleOverride");function Ne(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}i(Ne,"sandboxTemplateScheduleExpression");function Ae(e,t){let n=t.command??t.target?.command??null;if(n)return{kind:"command",command:n,requiresStart:t.requiresStart??t.target?.requiresStart??!1};let r=t.target?.kind??"action";if(r==="start")return{kind:"command",command:e.start.command,requiresStart:t.requiresStart??t.target?.requiresStart??e.start.requiresStart??!1};if(r==="service"){let s=t.target?.name??"",d=e.services.find(c=>c.name===s);if(!d)throw new Error(`schedule service target does not exist: ${s}`);return{kind:"command",command:d.command,requiresStart:t.requiresStart??t.target?.requiresStart??d.requiresStart??!1}}let a=t.actionName??t.action??t.target?.actionName??(t.target?.kind==="action"?t.target?.name:void 0),o=e.actions.find(s=>s.name===a);if(!o)throw new Error(`schedule action target does not exist: ${a??""}`);return{kind:"command",command:o.command,requiresStart:t.requiresStart??t.target?.requiresStart??o.requiresStart??!1}}i(Ae,"sandboxTemplateScheduleCommandTarget");import{existsSync as Ge}from"node:fs";import We from"node:path";import{stdin as Ke}from"node:process";async function D(e,t,n){let r=typeof t.repo=="string"?t.repo.trim():"";if(r)return A(r);await $e(n);let a=await ae(),o=ue(a),s=pe(a),d=await oe(a,o),c=await Se(n,"origin");if(!c){let l=typeof t.teamId=="string"?t.teamId.trim():"",u=await se(s,d,{name:e.name,description:e.description,repoInit:"empty",...l?{teamId:l}:{}});c=ie(u);let m=await g("git",["remote","add","origin",c],{cwd:n});if(m.code!==0)throw new Error(`git remote add failed: ${m.stderr.trim()||m.stdout.trim()||"unknown error"}`)}if(le(c),await Fe(n,t),!h(t.noPush)){let l=await je(n,t);await Be(n,c,l,d,t)}return A(c)}i(D,"resolveSandboxTemplateStartRepo");async function $e(e){let t=We.join(e,".git");if(Ge(t))return;let n=await g("git",["init"],{cwd:e});if(n.code!==0)throw new Error(`git init failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`)}i($e,"ensureGitRepository");async function Fe(e,t){let n=await g("git",["status","--porcelain"],{cwd:e});if(n.code!==0)throw new Error(`git status failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`);let a=(await g("git",["rev-parse","--verify","HEAD"],{cwd:e})).code===0,o=n.stdout.trim().length>0;if(!o&&a)return;if(!(h(t.commit)||h(t.yes)||(Ke.isTTY?await me(a?"Commit local changes before starting the sandbox?":"Create the initial git commit before starting the sandbox?",!a):!1))){if(!a)throw new Error("local repository has no commits; pass --commit or commit before starting");o&&console.warn("warning: uncommitted local changes will not be included in the sandbox");return}let d=await g("git",["add","-A"],{cwd:e});if(d.code!==0)throw new Error(`git add failed: ${d.stderr.trim()||d.stdout.trim()||"unknown error"}`);let c=typeof t.commitMessage=="string"&&t.commitMessage.trim()?t.commitMessage.trim():`start ${f} sandbox`,l=await g("git",["commit","-m",c],{cwd:e});if(l.code!==0){let u=l.stderr.trim()||l.stdout.trim();if(u.includes("nothing to commit")&&a)return;throw new Error(`git commit failed: ${u||"unknown error"}`)}}i(Fe,"ensureGitCommitForSandboxTemplateStart");async function je(e,t){let r=(typeof t.branch=="string"?t.branch.trim():"")||await he(e);if(!r)throw new Error("unable to resolve git branch; pass --branch");return r}i(je,"resolveSandboxTemplateStartBranch");async function Be(e,t,n,r,a){let o;try{o=de(t,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let s=h(a.keepTokenRemote)||h(a.token)||h(a.setRemoteToken),d=t.includes("x-access-token:"),c=!s&&!d?t:null,l=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!d){let m=await g("git",["remote","set-url","origin",o],{cwd:e});if(m.code!==0)throw new Error(`git remote set-url failed: ${ce(m.stderr.trim()||m.stdout.trim()||"unknown error")}`)}if((await g("git",["push","-u","origin",n],{cwd:e,inherit:!0})).code!==0)throw new Error("git push failed")}finally{c&&await g("git",["remote","set-url","origin",c],{cwd:e}).catch(()=>null),l===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=l}}i(Be,"pushGitBranchForSandboxTemplateStart");function $(e){return A(e).replace(/\.git$/,"")}i($,"normalizeSandboxTemplateRepoIdentity");function A(e){let t=new URL(e);t.username="",t.password="";let n=t.toString();return n.endsWith(".git")?n:`${n.replace(/\/$/,"")}.git`}i(A,"normalizeSandboxTemplateRepoUrl");async function _e(e){let t=L(e),n=S.dirname(t),r=await j.readFile(t,"utf8"),a=O(r);if(!a.ok){console.error(C(a.diagnostics)),process.exitCode=1;return}let o=a.manifest,s=G(o,e),d=await B(o,e,n),c=await D(o,e,n),l=await N(e),u=Ye(o,e,c),m=await Qe(l,u,c);await tt(l,m.id);let p=await ut(l,m.id,o,e),x=await V(l,m.id,d.uploadRequests),T={...d.scalars,..._(x,d.uploadRequests)},I=await X(l,m.id,s,T,bt(m)),k=await St(l,m.id,s.ports),E=await q(l,m.id,o,e);console.log(JSON.stringify({ok:!0,file:t,repo:c,executable:{kind:s.kind,name:s.name,command:s.command},sandbox:Re(m),setupCommands:p,uploadedFiles:x,input:T,execution:I,previews:k,schedules:E,expectedArtifacts:s.artifactPaths},null,2))}i(_e,"runSandboxTemplateStart");function G(e,t){let n=v(e),r=typeof t.action=="string"?t.action.trim():"",a=typeof t.service=="string"?t.service.trim():"",o=typeof t.target=="string"?t.target.trim():"",s=typeof t.entrypoint=="string"?t.entrypoint.trim():"",d=r||a||o||s||"start",c=r?"action":a?"service":"",l=n.find(u=>u.name===d&&(!c||u.kind===c));if(!l)throw new Error(`manifest executable not found: ${d}. Available: ${n.map(u=>`${u.kind}:${u.name}`).join(", ")}`);return l}i(G,"resolveSandboxTemplateStartExecutable");function Ye(e,t,n){let r=typeof t.budgetUsd=="string"&&t.budgetUsd.trim()?t.budgetUsd.trim():typeof t.budget=="string"&&t.budget.trim()?t.budget.trim():"0.05",a=R(t.maxDurationSeconds,"max-duration-seconds"),o=R(t.idleTimeoutSeconds,"idle-timeout-seconds"),s=typeof t.teamId=="string"?t.teamId.trim():"",d=typeof t.projectId=="string"?t.projectId.trim():"",c=typeof t.runtimeProjectId=="string"?t.runtimeProjectId.trim():"";if(d&&c&&d!==c)throw new Error("project-id and runtime-project-id must match when both are set");let l=d||c,u=typeof t.agentId=="string"?t.agentId.trim():"",m=typeof t.runtimeAgentId=="string"?t.runtimeAgentId.trim():"";if(u&&m&&u!==m)throw new Error("agent-id and runtime-agent-id must match when both are set");let p=u||m,x=fe(t.workflowMode),T=be(t.runtimePromotionPolicy),I=typeof t.runtimeBaseBranch=="string"&&t.runtimeBaseBranch.trim()?t.runtimeBaseBranch.trim():"",k=typeof t.runtimeBaseSha=="string"&&t.runtimeBaseSha.trim()?t.runtimeBaseSha.trim():"",E=typeof t.runtimeId=="string"&&t.runtimeId.trim()?t.runtimeId.trim():"",te=!!(x||T||I||k||E||c||m),ne=xe(e,t),re=Xe(e);return{sandbox:{repo:n,...s?{teamId:s}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},resources:e.resources??{},networkPolicy:{internetEgress:He(e.network.egress)},budget:{maxUsd:r},quotas:{maxSpendUsd:r,...a!==void 0?{maxDurationSeconds:a}:{},...o!==void 0?{idleTimeoutSeconds:o}:{}},...ne.length>0?{env:ne}:{},...re?{workloadSource:re}:{},volumes:e.volumes,metadata:{source:"openpond-code-sandbox-template-start",manifestFile:f,template:{name:e.name,version:e.version,useCase:e.useCase}}},...te&&E?{runtimeId:E}:{},...te&&!E?{sandboxRuntime:{...s?{teamId:s}:{},...x?{workflowMode:x}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},baseBranch:I||"master",...k?{baseSha:k}:{},...T?{promotionPolicy:T}:{}}}:{}}}i(Ye,"buildSandboxTemplateStartCreateInput");function Xe(e){if(e.runtime.image)return{image:e.runtime.image};if(e.runtime.dockerfile)return{dockerfile:e.runtime.dockerfile}}i(Xe,"sandboxWorkloadSourceFromManifest");function He(e){return e==="allow"?"allow":"block"}i(He,"sandboxTemplateInternetEgressPolicy");async function Qe(e,t,n){let r=Date.now();try{return(await Ee(e,t)).sandbox}catch(a){if(!Ze(a))throw a;return console.warn("warning: sandbox create timed out; checking for the created sandbox record"),et(e,t.sandbox,n,r)}}i(Qe,"createSandboxTemplateStartSandbox");function Ze(e){return e instanceof Error&&/\b(504|timed out|timeout)\b/i.test(e.message)}i(Ze,"isLikelySandboxCreateTimeout");async function et(e,t,n,r){let s=Date.now()+72e4,d=$(n),c=t.metadata??{};for(;Date.now()<s;){let u=(await e.list({...t.teamId?{teamId:t.teamId}:{},...t.projectId?{projectId:t.projectId}:{},...t.agentId?{agentId:t.agentId}:{}})).filter(m=>{if(!m.repo||$(m.repo)!==d)return!1;let p=Date.parse(m.createdAt);return!(Number.isFinite(p)&&p<r-3e4||c.source&&m.metadata?.source!==c.source)}).sort((m,p)=>Date.parse(p.createdAt)-Date.parse(m.createdAt))[0];if(u?.state==="running"||u?.state==="stopped")return u;if(u?.state==="error")throw new Error(`sandbox create failed after timeout: ${u.id}
2
+ import{a as Ee,o as Re}from"./chunk-JHEFWB6O.js";import{m as he}from"./chunk-GAWGIJQG.js";import{a as ie,b as de,d as ce,e as le,k as me,m as N,n as fe,o as be,r as xe,v as g,w as ge,x as Se}from"./chunk-ISFIDCIH.js";import{c as oe}from"./chunk-23P2O7PH.js";import"./chunk-AW5Q6NXT.js";import"./chunk-YVNDDNMK.js";import"./chunk-XRKFTPHD.js";import{f as ue,h as pe}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as M,f as h,h as R}from"./chunk-3M53YXEI.js";import{l as se}from"./chunk-EL454L26.js";import"./chunk-BT5YNE5U.js";import"./chunk-PXS4SVQG.js";import"./chunk-FWIPHEVA.js";import{d as ae}from"./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-3A7HZJNE.js";import{c as f,d as we,e as Te,h as O,k as C,q as v,r as ye,s as U,t as Pe,u as ve}from"./chunk-ERJV5BMC.js";import"./chunk-6FA3GG5B.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 i}from"./chunk-FTQLQJQV.js";import{promises as P,existsSync as kt}from"node:fs";import b from"node:path";import{Buffer as ht}from"node:buffer";import{promises as y}from"node:fs";import w from"node:path";import{Buffer as Ve}from"node:buffer";import{promises as j}from"node:fs";import S from"node:path";async function q(e,t,n,r){let a=Ie(n,r);if(!a)return[];let o=Oe(n,r),s=typeof r.projectId=="string"&&r.projectId.trim()?r.projectId.trim():typeof r.runtimeProjectId=="string"?r.runtimeProjectId.trim():"",d=typeof r.teamId=="string"?r.teamId.trim():"",c=[];for(let l of a.schedules){let u=Ce({manifest:n,schedule:l,override:o.get(l.name),mode:a.mode,sourceSandboxId:t,teamId:d,projectId:s}),m=await e.createSchedule(u);c.push({id:m.schedule.id,name:m.schedule.name,enabled:m.schedule.enabled,scheduleType:m.schedule.scheduleType,scheduleExpression:m.schedule.scheduleExpression,syncStatus:m.schedule.syncStatus,awsScheduleArn:m.schedule.awsScheduleArn??null,target:m.schedule.target})}return c}i(q,"createSandboxTemplateStartSchedules");function Ie(e,t){let n=t.enableSchedules??t.enableSchedule,r=t.disableSchedules??t.disableSchedule;if(n!==void 0&&r!==void 0)throw new Error("pass only one of --enable-schedules or --disable-schedules");let a=null,o;if(n!==void 0)a="enabled",o=n;else if(r!==void 0)a="disabled",o=r;else if(t.schedules!==void 0){o=t.schedules;let c=typeof t.scheduleMode=="string"?t.scheduleMode.trim().toLowerCase():"disabled";if(c==="none")return null;if(c!=="enabled"&&c!=="disabled")throw new Error("--schedule-mode must be enabled, disabled, or none");a=c}if(!a)return null;if(e.schedules.length===0)return{mode:a,schedules:[]};let s=ke(o,e),d=s===null?e.schedules:e.schedules.filter(c=>s.has(c.name));return{mode:a,schedules:d}}i(Ie,"resolveSandboxTemplateStartScheduleSelection");function ke(e,t){if(e===void 0||e===!0)return null;let n=String(e).trim();if(!n||n==="true"||n.toLowerCase()==="all")return null;if(n.toLowerCase()==="none")return new Set;let r=new Set(t.schedules.map(o=>o.name)),a=new Set(n.split(",").map(o=>o.trim()).filter(Boolean));for(let o of a)if(!r.has(o))throw new Error(`manifest schedule not found: ${o}`);return a}i(ke,"parseSandboxTemplateScheduleNameSelection");function Oe(e,t){let n=typeof t.scheduleOverrides=="string"?t.scheduleOverrides:typeof t.scheduleOverride=="string"?t.scheduleOverride:"";if(!n.trim())return new Map;let r=M(n,"schedule-overrides");if(!r||typeof r!="object"||Array.isArray(r))throw new Error("schedule-overrides must be a JSON object keyed by schedule name");let a=new Set(e.schedules.map(s=>s.name)),o=new Map;for(let[s,d]of Object.entries(r)){if(!a.has(s))throw new Error(`schedule override target does not exist: ${s}`);if(!d||typeof d!="object"||Array.isArray(d))throw new Error(`schedule override for ${s} must be an object`);o.set(s,d)}return o}i(Oe,"parseSandboxTemplateScheduleOverrides");function Ce(e){let t=Me(e.schedule,e.override),n=Ne(t);return{sourceSandboxId:e.sourceSandboxId,...e.teamId?{teamId:e.teamId}:{},...e.projectId?{projectId:e.projectId}:{},name:t.name,...t.description?{description:t.description}:{},...n,...t.timezone?{timezone:t.timezone}:{},enabled:typeof e.override?.enabled=="boolean"?e.override.enabled:e.mode==="enabled",...t.startAt?{startAt:t.startAt}:{},...t.endAt?{endAt:t.endAt}:{},...t.maxRuns!==void 0?{maxRuns:t.maxRuns}:{},runtimePolicy:t.runtimePolicy,target:Ae(e.manifest,t),...t.budget?{budget:t.budget}:{},...t.resources?{resources:t.resources}:{},...t.quotas?{quotas:t.quotas}:{},...t.lifecycle?{lifecycle:t.lifecycle}:{},...t.retentionPolicy?{retentionPolicy:t.retentionPolicy}:{},...t.env?{env:t.env}:{},...t.integrationLeases?{integrationLeases:t.integrationLeases}:{},metadata:{...t.metadata??{},manifestScheduleName:t.name,source:"openpond-code-sandbox-template-start"},managementSource:"openpond.yaml",manifestPath:f}}i(Ce,"buildSandboxTemplateStartScheduleInput");function Me(e,t){return t?{...e,...t,target:e.target||t.target?{...e.target??{},...t.target??{}}:void 0,metadata:e.metadata||t.metadata?{...e.metadata??{},...t.metadata??{}}:void 0}:e}i(Me,"mergeSandboxTemplateScheduleOverride");function Ne(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}i(Ne,"sandboxTemplateScheduleExpression");function Ae(e,t){let n=t.command??t.target?.command??null;if(n)return{kind:"command",command:n,requiresStart:t.requiresStart??t.target?.requiresStart??!1};let r=t.target?.kind??"action";if(r==="start")return{kind:"command",command:e.start.command,requiresStart:t.requiresStart??t.target?.requiresStart??e.start.requiresStart??!1};if(r==="service"){let s=t.target?.name??"",d=e.services.find(c=>c.name===s);if(!d)throw new Error(`schedule service target does not exist: ${s}`);return{kind:"command",command:d.command,requiresStart:t.requiresStart??t.target?.requiresStart??d.requiresStart??!1}}let a=t.actionName??t.action??t.target?.actionName??(t.target?.kind==="action"?t.target?.name:void 0),o=e.actions.find(s=>s.name===a);if(!o)throw new Error(`schedule action target does not exist: ${a??""}`);return{kind:"command",command:o.command,requiresStart:t.requiresStart??t.target?.requiresStart??o.requiresStart??!1}}i(Ae,"sandboxTemplateScheduleCommandTarget");import{existsSync as Ge}from"node:fs";import We from"node:path";import{stdin as Ke}from"node:process";async function D(e,t,n){let r=typeof t.repo=="string"?t.repo.trim():"";if(r)return A(r);await $e(n);let a=await ae(),o=ue(a),s=pe(a),d=await oe(a,o),c=await Se(n,"origin");if(!c){let l=typeof t.teamId=="string"?t.teamId.trim():"",u=await se(s,d,{name:e.name,description:e.description,repoInit:"empty",...l?{teamId:l}:{}});c=ie(u);let m=await g("git",["remote","add","origin",c],{cwd:n});if(m.code!==0)throw new Error(`git remote add failed: ${m.stderr.trim()||m.stdout.trim()||"unknown error"}`)}if(le(c),await Fe(n,t),!h(t.noPush)){let l=await je(n,t);await Be(n,c,l,d,t)}return A(c)}i(D,"resolveSandboxTemplateStartRepo");async function $e(e){let t=We.join(e,".git");if(Ge(t))return;let n=await g("git",["init"],{cwd:e});if(n.code!==0)throw new Error(`git init failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`)}i($e,"ensureGitRepository");async function Fe(e,t){let n=await g("git",["status","--porcelain"],{cwd:e});if(n.code!==0)throw new Error(`git status failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`);let a=(await g("git",["rev-parse","--verify","HEAD"],{cwd:e})).code===0,o=n.stdout.trim().length>0;if(!o&&a)return;if(!(h(t.commit)||h(t.yes)||(Ke.isTTY?await me(a?"Commit local changes before starting the sandbox?":"Create the initial git commit before starting the sandbox?",!a):!1))){if(!a)throw new Error("local repository has no commits; pass --commit or commit before starting");o&&console.warn("warning: uncommitted local changes will not be included in the sandbox");return}let d=await g("git",["add","-A"],{cwd:e});if(d.code!==0)throw new Error(`git add failed: ${d.stderr.trim()||d.stdout.trim()||"unknown error"}`);let c=typeof t.commitMessage=="string"&&t.commitMessage.trim()?t.commitMessage.trim():`start ${f} sandbox`,l=await g("git",["commit","-m",c],{cwd:e});if(l.code!==0){let u=l.stderr.trim()||l.stdout.trim();if(u.includes("nothing to commit")&&a)return;throw new Error(`git commit failed: ${u||"unknown error"}`)}}i(Fe,"ensureGitCommitForSandboxTemplateStart");async function je(e,t){let r=(typeof t.branch=="string"?t.branch.trim():"")||await he(e);if(!r)throw new Error("unable to resolve git branch; pass --branch");return r}i(je,"resolveSandboxTemplateStartBranch");async function Be(e,t,n,r,a){let o;try{o=de(t,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let s=h(a.keepTokenRemote)||h(a.token)||h(a.setRemoteToken),d=t.includes("x-access-token:"),c=!s&&!d?t:null,l=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!d){let m=await g("git",["remote","set-url","origin",o],{cwd:e});if(m.code!==0)throw new Error(`git remote set-url failed: ${ce(m.stderr.trim()||m.stdout.trim()||"unknown error")}`)}if((await g("git",["push","-u","origin",n],{cwd:e,inherit:!0})).code!==0)throw new Error("git push failed")}finally{c&&await g("git",["remote","set-url","origin",c],{cwd:e}).catch(()=>null),l===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=l}}i(Be,"pushGitBranchForSandboxTemplateStart");function $(e){return A(e).replace(/\.git$/,"")}i($,"normalizeSandboxTemplateRepoIdentity");function A(e){let t=new URL(e);t.username="",t.password="";let n=t.toString();return n.endsWith(".git")?n:`${n.replace(/\/$/,"")}.git`}i(A,"normalizeSandboxTemplateRepoUrl");async function _e(e){let t=L(e),n=S.dirname(t),r=await j.readFile(t,"utf8"),a=O(r);if(!a.ok){console.error(C(a.diagnostics)),process.exitCode=1;return}let o=a.manifest,s=G(o,e),d=await B(o,e,n),c=await D(o,e,n),l=await N(e),u=Ye(o,e,c),m=await Qe(l,u,c);await tt(l,m.id);let p=await ut(l,m.id,o,e),x=await V(l,m.id,d.uploadRequests),T={...d.scalars,..._(x,d.uploadRequests)},I=await X(l,m.id,s,T,bt(m)),k=await St(l,m.id,s.ports),E=await q(l,m.id,o,e);console.log(JSON.stringify({ok:!0,file:t,repo:c,executable:{kind:s.kind,name:s.name,command:s.command},sandbox:Re(m),setupCommands:p,uploadedFiles:x,input:T,execution:I,previews:k,schedules:E,expectedArtifacts:s.artifactPaths},null,2))}i(_e,"runSandboxTemplateStart");function G(e,t){let n=v(e),r=typeof t.action=="string"?t.action.trim():"",a=typeof t.service=="string"?t.service.trim():"",o=typeof t.target=="string"?t.target.trim():"",s=typeof t.entrypoint=="string"?t.entrypoint.trim():"",d=r||a||o||s||"start",c=r?"action":a?"service":"",l=n.find(u=>u.name===d&&(!c||u.kind===c));if(!l)throw new Error(`manifest executable not found: ${d}. Available: ${n.map(u=>`${u.kind}:${u.name}`).join(", ")}`);return l}i(G,"resolveSandboxTemplateStartExecutable");function Ye(e,t,n){let r=typeof t.budgetUsd=="string"&&t.budgetUsd.trim()?t.budgetUsd.trim():typeof t.budget=="string"&&t.budget.trim()?t.budget.trim():"0.05",a=R(t.maxDurationSeconds,"max-duration-seconds"),o=R(t.idleTimeoutSeconds,"idle-timeout-seconds"),s=typeof t.teamId=="string"?t.teamId.trim():"",d=typeof t.projectId=="string"?t.projectId.trim():"",c=typeof t.runtimeProjectId=="string"?t.runtimeProjectId.trim():"";if(d&&c&&d!==c)throw new Error("project-id and runtime-project-id must match when both are set");let l=d||c,u=typeof t.agentId=="string"?t.agentId.trim():"",m=typeof t.runtimeAgentId=="string"?t.runtimeAgentId.trim():"";if(u&&m&&u!==m)throw new Error("agent-id and runtime-agent-id must match when both are set");let p=u||m,x=fe(t.workflowMode),T=be(t.runtimePromotionPolicy),I=typeof t.runtimeBaseBranch=="string"&&t.runtimeBaseBranch.trim()?t.runtimeBaseBranch.trim():"",k=typeof t.runtimeBaseSha=="string"&&t.runtimeBaseSha.trim()?t.runtimeBaseSha.trim():"",E=typeof t.runtimeId=="string"&&t.runtimeId.trim()?t.runtimeId.trim():"",te=!!(x||T||I||k||E||c||m),ne=xe(e,t),re=Xe(e);return{sandbox:{repo:n,...s?{teamId:s}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},resources:e.resources??{},networkPolicy:{internetEgress:He(e.network.egress)},budget:{maxUsd:r},quotas:{maxSpendUsd:r,...a!==void 0?{maxDurationSeconds:a}:{},...o!==void 0?{idleTimeoutSeconds:o}:{}},...ne.length>0?{env:ne}:{},...re?{workloadSource:re}:{},volumes:e.volumes,metadata:{source:"openpond-code-sandbox-template-start",manifestFile:f,template:{name:e.name,version:e.version,useCase:e.useCase}}},...te&&E?{runtimeId:E}:{},...te&&!E?{sandboxRuntime:{...s?{teamId:s}:{},...x?{workflowMode:x}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},baseBranch:I||"master",...k?{baseSha:k}:{},...T?{promotionPolicy:T}:{}}}:{}}}i(Ye,"buildSandboxTemplateStartCreateInput");function Xe(e){if(e.runtime.image)return{image:e.runtime.image};if(e.runtime.dockerfile)return{dockerfile:e.runtime.dockerfile}}i(Xe,"sandboxWorkloadSourceFromManifest");function He(e){return e==="allow"?"allow":"block"}i(He,"sandboxTemplateInternetEgressPolicy");async function Qe(e,t,n){let r=Date.now();try{return(await Ee(e,t)).sandbox}catch(a){if(!Ze(a))throw a;return console.warn("warning: sandbox create timed out; checking for the created sandbox record"),et(e,t.sandbox,n,r)}}i(Qe,"createSandboxTemplateStartSandbox");function Ze(e){return e instanceof Error&&/\b(504|timed out|timeout)\b/i.test(e.message)}i(Ze,"isLikelySandboxCreateTimeout");async function et(e,t,n,r){let s=Date.now()+72e4,d=$(n),c=t.metadata??{};for(;Date.now()<s;){let u=(await e.list({...t.teamId?{teamId:t.teamId}:{},...t.projectId?{projectId:t.projectId}:{},...t.agentId?{agentId:t.agentId}:{}})).filter(m=>{if(!m.repo||$(m.repo)!==d)return!1;let p=Date.parse(m.createdAt);return!(Number.isFinite(p)&&p<r-3e4||c.source&&m.metadata?.source!==c.source)}).sort((m,p)=>Date.parse(p.createdAt)-Date.parse(m.createdAt))[0];if(u?.state==="running"||u?.state==="stopped")return u;if(u?.state==="error")throw new Error(`sandbox create failed after timeout: ${u.id}
3
3
  ${u.logs.join(`
4
4
  `)}`);await W(3e3)}throw new Error("sandbox create timed out and no matching created sandbox reached running state")}i(et,"recoverTimedOutSandboxCreate");async function tt(e,t){let a=Date.now()+12e4,o=null;for(;Date.now()<a;){try{let s=await e.exec(t,{command:"true",timeoutSeconds:30});if(s.command.status==="succeeded"&&s.command.exitCode===0)return;o=new Error(`readiness command ${s.command.status} with exit code ${String(s.command.exitCode)}`)}catch(s){if(o=s,!nt(s))throw s}await W(3e3)}throw new Error(`sandbox runner was not ready after create: ${rt(o)}`)}i(tt,"waitForSandboxTemplateRunnerReady");function nt(e){return e instanceof Error&&/\b(502|503|504|timed out|timeout|sandbox_not_found|sandbox_not_ready|sandbox_runner_failed)\b/i.test(e.message)}i(nt,"isRetryableSandboxRunnerReadyError");function rt(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown error"}i(rt,"formatUnknownError");function W(e){return new Promise(t=>setTimeout(t,e))}i(W,"sleep");async function B(e,t,n){let r=at(t),a=st(e),o=[],s=ot(t);for(let[c,l]of Object.entries(s)){let u=a.get(c);if(!u)throw new Error(`${c} is not declared as a file upload input in ${f}`);let m=await dt(l,n);if(!u.multiple&&m.length>1)throw new Error(`${c} accepts one file, got ${m.length}`);o.push({inputName:c,localPaths:m,spec:u})}let d=Array.isArray(e.inputs.schema.required)?e.inputs.schema.required.filter(c=>typeof c=="string"):[];for(let c of d)if(a.has(c)&&!o.some(l=>l.inputName===c))throw new Error(`${c} is required; pass --input-file ${c}=<path> or --input-files ${c}=<glob>`);return{scalars:r,uploadRequests:o}}i(B,"resolveSandboxTemplateStartInput");function at(e){let t=typeof e.inputs=="string"?e.inputs:typeof e.inputJson=="string"?e.inputJson:typeof e.params=="string"?e.params:"",n=t?M(t,"inputs"):{};if(!n||typeof n!="object"||Array.isArray(n))throw new Error("inputs must be a JSON object");let r=typeof e.input=="string"?e.input.trim():"";if(r){let[a,o]=J(r,"input");n[a]=o}return n}i(at,"parseSandboxTemplateScalarInputs");function ot(e){let t={},n=typeof e.inputFile=="string"?e.inputFile.trim():"";if(n){let[a,o]=J(n,"input-file");t[a]=o}let r=typeof e.inputFiles=="string"?e.inputFiles.trim():"";if(r){let[a,o]=J(r,"input-files");t[a]=o}return t}i(ot,"parseSandboxTemplateFileInputOptions");function J(e,t){let n=e.indexOf("=");if(n<=0)throw new Error(`${t} must be formatted as name=value`);let r=e.slice(0,n).trim(),a=e.slice(n+1).trim();if(!r||!a)throw new Error(`${t} must be formatted as name=value`);return[r,a]}i(J,"parseKeyValueOption");function st(e){let t=F(e.inputs.schema.properties)??{},n=new Map;for(let[r,a]of Object.entries(t)){let o=F(a);if(!o)continue;let s=F(o["x-openpond-upload"]??o.xOpenPondUpload);if(!s)continue;let d=typeof s.targetPath=="string"&&s.targetPath.trim()?it(s.targetPath):"";if(!d)throw new Error(`${r} upload metadata is missing targetPath`);let c=s.multiple===!0||o.type==="array"||F(o.items)?.format==="file";n.set(r,{inputName:r,multiple:c,targetPath:d})}return n}i(st,"collectSandboxTemplateUploadSpecs");function F(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}i(F,"asPlainRecord");function it(e){let t=e.trim().replace(/\\/g,"/").replace(/^\/workspace\//,"").replace(/^\.\//,"").replace(/^\/+/,"");if(!t||t.split("/").some(n=>n===".."||n===""))throw new Error(`invalid upload target path: ${e}`);if(t.split("/").some(K))throw new Error("sandbox template uploads cannot target .env* files; create sandbox secrets and pass refs with --env-ref");return t}i(it,"normalizeSandboxUploadTargetPath");async function dt(e,t){let n=e.split(",").map(a=>a.trim()).filter(Boolean),r=(await Promise.all(n.map(a=>ct(a,t)))).flat();if(r.length===0)throw new Error(`no files matched ${e}`);return r}i(dt,"expandSandboxTemplateUploadPaths");async function ct(e,t){let n=S.resolve(t,e);if(!e.includes("*")){if(lt(n),!(await j.stat(n)).isFile())throw new Error(`upload path is not a file: ${n}`);return[n]}let r=S.dirname(n),a=S.basename(n),o=mt(a),d=(await j.readdir(r,{withFileTypes:!0})).filter(l=>l.isFile()&&o.test(l.name)).sort((l,u)=>l.name.localeCompare(u.name));if(d.find(l=>K(l.name)))throw new Error("sandbox template uploads cannot include .env* files; create sandbox secrets and pass refs with --env-ref");return d.map(l=>S.join(r,l.name)).sort((l,u)=>l.localeCompare(u))}i(ct,"expandSandboxTemplateUploadPath");function lt(e){if(K(S.basename(e)))throw new Error("sandbox template uploads cannot include .env* files; create sandbox secrets and pass refs with --env-ref")}i(lt,"assertSandboxTemplateUploadPathAllowed");function K(e){return e===".env"||e.startsWith(".env.")}i(K,"isSandboxEnvFileName");function mt(e){let t=e.split("*").map(n=>n.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${t}$`)}i(mt,"globBasenameToRegExp");async function ut(e,t,n,r){let a=R(r.setupTimeoutSeconds,"setup-timeout-seconds")??900,o=[];for(let s of n.setup.commands){let d=await pt(e,t,s,a);if(o.push({command:s,status:d.status,exitCode:d.exitCode}),d.status!=="succeeded"||d.exitCode!==0)throw new Error(`setup command failed: ${s}
5
5
  ${d.output}`)}return o}i(ut,"runSandboxTemplateSetupCommands");async function V(e,t,n){let r=[];for(let a of n)for(let o of a.localPaths){let s=await j.readFile(o),d=Y(a.spec.targetPath,S.basename(o));await e.uploadFileBase64(t,d,s.toString("base64")),r.push({inputName:a.inputName,localPath:o,sandboxPath:d,sizeBytes:s.byteLength})}return r}i(V,"uploadSandboxTemplateStartFiles");function Y(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}i(Y,"joinSandboxUploadPath");function _(e,t){let n={};for(let r of t){let a=e.filter(o=>o.inputName===r.inputName).map(o=>o.sandboxPath);n[r.inputName]=r.spec.multiple?a:a[0]??""}return n}i(_,"formatUploadedFileParams");async function X(e,t,n,r,a={}){await ft(e,t,r);let o=xt(n,a),s=n.timeoutSeconds;if(n.kind==="service")return{kind:"service",process:(await e.startProcess(t,{command:o,...s!==void 0?{timeoutSeconds:s}:{}})).process};let d=await Le(e,t,o,s??900);if(d.status!=="succeeded"||d.exitCode!==0)throw new Error(`template command failed: ${n.name}
@@ -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,f}from"./chunk-52KIORRX.js";import"./chunk-OKBIWRHC.js";import"./chunk-JGWINTT5.js";import"./chunk-SYUKES6H.js";import"./chunk-ZTVXRZ6D.js";import"./chunk-7LZISGTA.js";import"./chunk-BFKYRQMA.js";import"./chunk-LO3O45IX.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"./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-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-6FA3GG5B.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"./chunk-FTQLQJQV.js";export{b as createHostedSavedWork,d as deleteHostedSavedWork,f as hostedWebBaseUrl,a as listHostedSavedWork,e as runHostedSavedWork,c as updateHostedSavedWork};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as o,f as i}from"./chunk-O3RF72BT.js";import"./chunk-KVTBX2UP.js";import{g as s}from"./chunk-57TRXBLT.js";import"./chunk-Q4TBTRIG.js";import"./chunk-ES2ISFJC.js";import{a}from"./chunk-FTQLQJQV.js";function d(n){return a(async function(e){let t=await n.persistCreateImproveRun({session:e.session,turnId:e.turn.id,run:e.run,source:"server"}),r=t.createImproveRun??e.run;return o(r)?(await n.appendRuntimeEvent(s({sessionId:e.session.id,turnId:e.turn.id,name:"create_improve.updated",source:"server",appId:e.session.appId,status:"pending",output:"Create/Improve planner is preparing the plan.",data:{createImproveRun:r}})),r=await n.planCreateImproveForTurn({session:e.session,turn:t,run:r,signal:e.signal}),t=await n.persistCreateImproveRun({session:e.session,turnId:e.turn.id,run:r,source:"server"})):await n.appendRuntimeEvent(s({sessionId:e.session.id,turnId:e.turn.id,name:"create_improve.updated",source:"server",appId:e.session.appId,status:i(r),output:r.state==="awaiting_questions"?"Create/Improve question ready.":"Create/Improve plan ready for review.",data:{createImproveRun:r}})),await n.appendRuntimeEvent(s({sessionId:e.session.id,turnId:e.turn.id,name:"turn.completed",source:"server",appId:e.session.appId,status:"completed",output:r.state==="awaiting_questions"?"Create/Improve paused for questions.":"Create/Improve paused for plan review."})),n.completeTurn(e.session.id,t.id,null)},"handleCreateImproveTurn")}a(d,"createCreateImproveTurnHandler");export{d as createCreateImproveTurnHandler};
2
+ import{a as o,f as i}from"./chunk-UZQNFTLR.js";import"./chunk-KVTBX2UP.js";import{g as s}from"./chunk-FSQWAANK.js";import"./chunk-PWK5Z5S3.js";import"./chunk-PF56N7ZY.js";import{a}from"./chunk-FTQLQJQV.js";function d(n){return a(async function(e){let t=await n.persistCreateImproveRun({session:e.session,turnId:e.turn.id,run:e.run,source:"server"}),r=t.createImproveRun??e.run;return o(r)?(await n.appendRuntimeEvent(s({sessionId:e.session.id,turnId:e.turn.id,name:"create_improve.updated",source:"server",appId:e.session.appId,status:"pending",output:"Create/Improve planner is preparing the plan.",data:{createImproveRun:r}})),r=await n.planCreateImproveForTurn({session:e.session,turn:t,run:r,signal:e.signal}),t=await n.persistCreateImproveRun({session:e.session,turnId:e.turn.id,run:r,source:"server"})):await n.appendRuntimeEvent(s({sessionId:e.session.id,turnId:e.turn.id,name:"create_improve.updated",source:"server",appId:e.session.appId,status:i(r),output:r.state==="awaiting_questions"?"Create/Improve question ready.":"Create/Improve plan ready for review.",data:{createImproveRun:r}})),await n.appendRuntimeEvent(s({sessionId:e.session.id,turnId:e.turn.id,name:"turn.completed",source:"server",appId:e.session.appId,status:"completed",output:r.state==="awaiting_questions"?"Create/Improve paused for questions.":"Create/Improve paused for plan review."})),n.completeTurn(e.session.id,t.id,null)},"handleCreateImproveTurn")}a(d,"createCreateImproveTurnHandler");export{d as createCreateImproveTurnHandler};