openpond 0.2.61 → 0.2.62

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 (420) hide show
  1. package/dist/app-server.d.ts +3264 -18
  2. package/dist/app-server.js +1 -1
  3. package/dist/chunks/{acp-FUAWCKBH.js → acp-DYRBDJRU.js} +1 -1
  4. package/dist/chunks/{acp-agent-XBSJ27KI.js → acp-agent-UTLP7C3I.js} +1 -1
  5. package/dist/chunks/{actions-command-LOHNQUWP.js → actions-command-6LF4Z4WK.js} +1 -1
  6. package/dist/chunks/{app-layer-4BFMOMKM.js → app-layer-N2H3RBEN.js} +1 -1
  7. package/dist/chunks/{app-server-connected-apps-Q2VWWJNX.js → app-server-connected-apps-3T546FE7.js} +1 -1
  8. package/dist/chunks/app-server-evaluations-TXD747QA.js +2 -0
  9. package/dist/chunks/{app-server-harness-services-2PSZBT7U.js → app-server-harness-services-BBCDV5P3.js} +1 -1
  10. package/dist/chunks/app-server-runtime-VEJPDAFP.js +2 -0
  11. package/dist/chunks/{apps-7PIBF32Q.js → apps-CTT2XYRR.js} +1 -1
  12. package/dist/chunks/{chunk-KK626T3Z.js → chunk-2EPR4HLF.js} +1 -1
  13. package/dist/chunks/{chunk-5VPU7OS7.js → chunk-2IIBCCOK.js} +1 -1
  14. package/dist/chunks/{chunk-ZISYLRH6.js → chunk-2UDAKLJ4.js} +1 -1
  15. package/dist/chunks/{chunk-BDCTN4PU.js → chunk-2V4LPUBH.js} +1 -1
  16. package/dist/chunks/{chunk-I3X6M6ZO.js → chunk-3R4MSE2S.js} +1 -1
  17. package/dist/chunks/{chunk-OFVUN4KI.js → chunk-47AXSBPV.js} +1 -1
  18. package/dist/chunks/{chunk-BFKYRQMA.js → chunk-4N4EH3RJ.js} +1 -1
  19. package/dist/chunks/chunk-4PZWGNX4.js +86 -0
  20. package/dist/chunks/{chunk-VFLSBDNZ.js → chunk-4RZBGKT7.js} +1 -1
  21. package/dist/chunks/{chunk-VBW2X42G.js → chunk-4TM75R7V.js} +1 -1
  22. package/dist/chunks/chunk-4U2FNXQW.js +2 -0
  23. package/dist/chunks/{chunk-SCCYSPQ5.js → chunk-4ZBOYWQ3.js} +1 -1
  24. package/dist/chunks/{chunk-VWJ5IYQP.js → chunk-547AUVKN.js} +1 -1
  25. package/dist/chunks/{chunk-FJ3HMHT6.js → chunk-557XSPVS.js} +1 -1
  26. package/dist/chunks/{chunk-ZHFH2TZN.js → chunk-557YG77L.js} +1 -1
  27. package/dist/chunks/{chunk-MF35MALN.js → chunk-5A6ER3M2.js} +1 -1
  28. package/dist/chunks/{chunk-U4HZD2GM.js → chunk-5OSM75X5.js} +1 -1
  29. package/dist/chunks/{chunk-TH6Y4K5Z.js → chunk-6SH4B7DV.js} +1 -1
  30. package/dist/chunks/chunk-6XSSM4WT.js +3 -0
  31. package/dist/chunks/{chunk-HN2ZK6EV.js → chunk-7JBB4PXS.js} +1 -1
  32. package/dist/chunks/{chunk-SID4X3YN.js → chunk-7JXZNCBC.js} +1 -1
  33. package/dist/chunks/chunk-7KTARW23.js +2 -0
  34. package/dist/chunks/{chunk-M6JRS5PA.js → chunk-ABF3W2MO.js} +1 -1
  35. package/dist/chunks/{chunk-CGAL7IHZ.js → chunk-AKZPMKWP.js} +1 -1
  36. package/dist/chunks/{chunk-SIV5P6JO.js → chunk-AMO5DVKM.js} +2 -2
  37. package/dist/chunks/chunk-AZ7BL5FL.js +2 -0
  38. package/dist/chunks/{chunk-4RHM4WN2.js → chunk-B42QQUZY.js} +1 -1
  39. package/dist/chunks/{chunk-3DVWJCOA.js → chunk-B4RKHHF7.js} +1 -1
  40. package/dist/chunks/{chunk-CQF6QZEL.js → chunk-BEI4YULC.js} +1 -1
  41. package/dist/chunks/chunk-BKEDG3A4.js +22 -0
  42. package/dist/chunks/{chunk-GEXKTGLY.js → chunk-C7M2WBWZ.js} +14 -14
  43. package/dist/chunks/{chunk-ELYRVTTG.js → chunk-CJUVHE4U.js} +1 -1
  44. package/dist/chunks/{chunk-ZUNG6YDO.js → chunk-EIX2V2KU.js} +1 -1
  45. package/dist/chunks/{chunk-AWPYTDH4.js → chunk-EWOTDVDJ.js} +1 -1
  46. package/dist/chunks/{chunk-B47JMAVW.js → chunk-F4TJ7WQV.js} +1 -1
  47. package/dist/chunks/{chunk-TXBIZDXG.js → chunk-F7D4BMTO.js} +1 -1
  48. package/dist/chunks/{chunk-BWY4D3BN.js → chunk-FFWOTZQM.js} +1 -1
  49. package/dist/chunks/{chunk-6RVF2J47.js → chunk-FUSCTBJI.js} +1 -1
  50. package/dist/chunks/{chunk-BN5AVRUG.js → chunk-GAQLXFOT.js} +1 -1
  51. package/dist/chunks/{chunk-LHENAWLH.js → chunk-GEKORCMN.js} +1 -1
  52. package/dist/chunks/{chunk-ORLJJGZZ.js → chunk-GNCEZ3UP.js} +1 -1
  53. package/dist/chunks/{chunk-WRQEYW3V.js → chunk-GOIKLFXK.js} +1 -1
  54. package/dist/chunks/{chunk-65SM7Y2G.js → chunk-GQGLPKU4.js} +1 -1
  55. package/dist/chunks/{chunk-LBBXVOVR.js → chunk-GSWBNJGZ.js} +1 -1
  56. package/dist/chunks/{chunk-7EAWLYYB.js → chunk-GV3LFSMI.js} +1 -1
  57. package/dist/chunks/{chunk-GQUS7MCH.js → chunk-GW5SE3FM.js} +1 -1
  58. package/dist/chunks/{chunk-I3W27VK4.js → chunk-HBLN4OLY.js} +1 -1
  59. package/dist/chunks/{chunk-SGK4GR44.js → chunk-HFJUXKT5.js} +1 -1
  60. package/dist/chunks/{chunk-4P3X2RXA.js → chunk-HKV7RX5E.js} +1 -1
  61. package/dist/chunks/{chunk-QDBYLJGH.js → chunk-HXZXDDKW.js} +1 -1
  62. package/dist/chunks/{chunk-LNRFRAV5.js → chunk-INO67SEN.js} +1 -1
  63. package/dist/chunks/{chunk-E67M5WGY.js → chunk-IWK3RTLR.js} +1 -1
  64. package/dist/chunks/{chunk-U447MS3Y.js → chunk-J3B2GM4A.js} +1 -1
  65. package/dist/chunks/chunk-JCLTFDVW.js +2 -0
  66. package/dist/chunks/{chunk-25RDE7DV.js → chunk-JEISPWWM.js} +1 -1
  67. package/dist/chunks/{chunk-D4JZALZ4.js → chunk-JIFUGA3U.js} +1 -1
  68. package/dist/chunks/{chunk-H2AUR7OT.js → chunk-JQRMDFF3.js} +1 -1
  69. package/dist/chunks/{chunk-FWIPHEVA.js → chunk-JX6OX6XE.js} +1 -1
  70. package/dist/chunks/{chunk-D5ADDBS5.js → chunk-JY3YSI54.js} +1 -1
  71. package/dist/chunks/{chunk-CM5USMXN.js → chunk-KOKX7PBS.js} +1 -1
  72. package/dist/chunks/{chunk-3ZWLRBYZ.js → chunk-KUPJNBWG.js} +1 -1
  73. package/dist/chunks/chunk-LILXHGIA.js +2 -0
  74. package/dist/chunks/{chunk-MCIIGQT7.js → chunk-LJDBR3RN.js} +1 -1
  75. package/dist/chunks/{chunk-3TYCIYW6.js → chunk-LJPO3TEL.js} +1 -1
  76. package/dist/chunks/{chunk-MHYI7ATG.js → chunk-LRRBYIGH.js} +2 -2
  77. package/dist/chunks/{chunk-P4XM7LUT.js → chunk-M5IX6VUA.js} +1 -1
  78. package/dist/chunks/chunk-MEK7DLX3.js +2 -0
  79. package/dist/chunks/{chunk-TYHCBVQT.js → chunk-MILEWROZ.js} +1 -1
  80. package/dist/chunks/{chunk-ZBBVRYU3.js → chunk-MNFW5WLD.js} +1 -1
  81. package/dist/chunks/{chunk-2VXL6AU3.js → chunk-MNXNZDDW.js} +1 -1
  82. package/dist/chunks/chunk-N5GPINVP.js +2 -0
  83. package/dist/chunks/{chunk-TSAW2QVU.js → chunk-NBE74GLF.js} +1 -1
  84. package/dist/chunks/{chunk-VZXZ6CHS.js → chunk-NE4ESZPT.js} +1 -1
  85. package/dist/chunks/{chunk-CO3OJFPU.js → chunk-NKZNPTLA.js} +1 -1
  86. package/dist/chunks/{chunk-WFVOG5PU.js → chunk-NLQ2UPN2.js} +1 -1
  87. package/dist/chunks/chunk-NOSBNHGC.js +18 -0
  88. package/dist/chunks/{chunk-TTN63EAM.js → chunk-NWOK6NLE.js} +1 -1
  89. package/dist/chunks/{chunk-6MWT6BVU.js → chunk-NWQL6FNF.js} +1 -1
  90. package/dist/chunks/chunk-O3MHHGC5.js +151 -0
  91. package/dist/chunks/{chunk-IUGK6BBY.js → chunk-OCC43RSJ.js} +1 -1
  92. package/dist/chunks/{chunk-BQUWZRWU.js → chunk-P74RR2GB.js} +1 -1
  93. package/dist/chunks/{chunk-PAZDQRYU.js → chunk-PAE3PQEC.js} +1 -1
  94. package/dist/chunks/{chunk-M4ZRCRJM.js → chunk-PGO4FRHU.js} +2 -2
  95. package/dist/chunks/chunk-Q34IF4PW.js +2 -0
  96. package/dist/chunks/{chunk-Q324ZA5M.js → chunk-QAVQJZCM.js} +1 -1
  97. package/dist/chunks/{chunk-EIIGTADO.js → chunk-RBDUMASL.js} +1 -1
  98. package/dist/chunks/{chunk-TMMFF6DO.js → chunk-RH43WLBX.js} +1 -1
  99. package/dist/chunks/{chunk-RPOD6I64.js → chunk-RTJCELRR.js} +1 -1
  100. package/dist/chunks/{chunk-L3GA2CQI.js → chunk-SD64CLJX.js} +1 -1
  101. package/dist/chunks/{chunk-TNHDD3LO.js → chunk-SXMR6E2W.js} +1 -1
  102. package/dist/chunks/{chunk-MLTKB5G3.js → chunk-SZKFNKWO.js} +1 -1
  103. package/dist/chunks/chunk-T4QXKU5Y.js +1 -0
  104. package/dist/chunks/{chunk-PE7UKJXK.js → chunk-T6C5BNXK.js} +1 -1
  105. package/dist/chunks/{chunk-OMICIPPY.js → chunk-T6JN4PND.js} +1 -1
  106. package/dist/chunks/{chunk-OQUKSRU3.js → chunk-TGEGXTPR.js} +1 -1
  107. package/dist/chunks/chunk-TM4VEMNN.js +2 -0
  108. package/dist/chunks/chunk-TUCKED4T.js +4 -0
  109. package/dist/chunks/chunk-TVTFEGTU.js +2 -0
  110. package/dist/chunks/{chunk-HZLV773Y.js → chunk-TW3SRBLU.js} +1 -1
  111. package/dist/chunks/{chunk-BNZTJPK7.js → chunk-U456UP3N.js} +1 -1
  112. package/dist/chunks/chunk-UC3FXTDL.js +9 -0
  113. package/dist/chunks/{chunk-XLULTQLZ.js → chunk-UT6F6AIB.js} +1 -1
  114. package/dist/chunks/{chunk-OJFDI7VM.js → chunk-UTNGEMW5.js} +1 -1
  115. package/dist/chunks/{chunk-DW3GJRY3.js → chunk-VAJSRUAB.js} +1 -1
  116. package/dist/chunks/chunk-VE6ZIGUQ.js +2 -0
  117. package/dist/chunks/{chunk-GLVR74PX.js → chunk-VI32G77S.js} +1 -1
  118. package/dist/chunks/{chunk-ROE24PN5.js → chunk-VK4TPZTA.js} +1 -1
  119. package/dist/chunks/{chunk-Q66LWQGF.js → chunk-VSQXDS6H.js} +1 -1
  120. package/dist/chunks/{chunk-4GZ2FPB5.js → chunk-VWRTE64Y.js} +1 -1
  121. package/dist/chunks/{chunk-QRJPLZF7.js → chunk-W5W4IODW.js} +1 -1
  122. package/dist/chunks/{chunk-57RY3LSR.js → chunk-WGLVSGFA.js} +1 -1
  123. package/dist/chunks/{chunk-I7JCARVH.js → chunk-WQMXEZVE.js} +3 -3
  124. package/dist/chunks/chunk-X4ZT22SG.js +2 -0
  125. package/dist/chunks/{chunk-DGPGOBYZ.js → chunk-XSB3T4JZ.js} +1 -1
  126. package/dist/chunks/{chunk-ZZWAQBA2.js → chunk-XWDFXM3S.js} +1 -1
  127. package/dist/chunks/{chunk-4LZLO4OW.js → chunk-Y2KPHVZK.js} +1 -1
  128. package/dist/chunks/chunk-ZQHPGEYT.js +2 -0
  129. package/dist/chunks/{chunk-T4LLJC5N.js → chunk-ZXT7V64X.js} +1 -1
  130. package/dist/chunks/cli-GCSO2OAI.js +2 -0
  131. package/dist/chunks/{configuration-command-ONGI2BJD.js → configuration-command-BU2RPG33.js} +1 -1
  132. package/dist/chunks/connected-app-executor-UDE7U4KG.js +2 -0
  133. package/dist/chunks/{connected-evidence-4J3YXU4O.js → connected-evidence-GXIY2L7C.js} +1 -1
  134. package/dist/chunks/{connected-starting-assets-OXLT7S4O.js → connected-starting-assets-V5QXRK5Q.js} +1 -1
  135. package/dist/chunks/{connection-HJWE6SEW.js → connection-XMAAGMXJ.js} +1 -1
  136. package/dist/chunks/{continual-CJUZM5ZQ.js → continual-FLW6DAJK.js} +1 -1
  137. package/dist/chunks/{core-commands-JGXU6B4C.js → core-commands-NJ6TGND4.js} +1 -1
  138. package/dist/chunks/{dataset-preparation-authoring-DFGJBMVF.js → dataset-preparation-authoring-IUXUQK3L.js} +1 -1
  139. package/dist/chunks/{datasets-MNHZAZIB.js → datasets-AH56DKLZ.js} +1 -1
  140. package/dist/chunks/{desktop-test-P23MHAIG.js → desktop-test-PYUTEOWO.js} +1 -1
  141. package/dist/chunks/{dist-IIFTZWNR.js → dist-5267UT3V.js} +1 -1
  142. package/dist/chunks/{dist-X64FC6NA.js → dist-HSC43RG4.js} +1 -1
  143. package/dist/chunks/{evaluation-coordination-6NQEH5WU.js → evaluation-coordination-3AUICOC5.js} +1 -1
  144. package/dist/chunks/{experiment-improvements-M27Z5OF4.js → experiment-improvements-YS7GGPDW.js} +1 -1
  145. package/dist/chunks/experiments-EJZK7FPT.js +2 -0
  146. package/dist/chunks/{experiments-signal-R3NNH7WR.js → experiments-signal-NKUIJCIY.js} +1 -1
  147. package/dist/chunks/{extension-C33NUFDL.js → extension-ZM6NI5O5.js} +1 -1
  148. package/dist/chunks/{help-M2VQGPVC.js → help-PXUUREHZ.js} +1 -1
  149. package/dist/chunks/host-profile-evaluation-tools-CTC5JQPD.js +2 -0
  150. package/dist/chunks/host-profile-external-dataset-GJWDY3YT.js +2 -0
  151. package/dist/chunks/hosted-app-server-composition-TLJSKMJT.js +2 -0
  152. package/dist/chunks/hosted-experiment-improvement-TIVXXRPG.js +3 -0
  153. package/dist/chunks/hosted-harness-runtime-SFLJEZFI.js +2 -0
  154. package/dist/chunks/{hosted-profile-candidate-37ZFY2LH.js → hosted-profile-candidate-DKEMVIYG.js} +1 -1
  155. package/dist/chunks/hosted-profile-compiler-V6YR6EHO.js +2 -0
  156. package/dist/chunks/{hosted-profile-evaluation-control-UQBMML6K.js → hosted-profile-evaluation-control-ERCXAPZD.js} +1 -1
  157. package/dist/chunks/{hosted-profile-evaluation-inspection-YASS4T6L.js → hosted-profile-evaluation-inspection-Q3AIIIB6.js} +1 -1
  158. package/dist/chunks/hosted-profile-evaluation-preparation-ELLGH44Z.js +3 -0
  159. package/dist/chunks/{hosted-tasksets-CVUP7MS6.js → hosted-tasksets-X2YCFYEJ.js} +1 -1
  160. package/dist/chunks/{human-review-IJETDOWB.js → human-review-5WM6MSON.js} +1 -1
  161. package/dist/chunks/{import-WLLUIDS6.js → import-JWZSZCE4.js} +1 -1
  162. package/dist/chunks/local-harness-improvement-runtime-IGIKM6GJ.js +2 -0
  163. package/dist/chunks/local-harness-taskset-review-DR2ZIDOH.js +2 -0
  164. package/dist/chunks/{model-projects-AVBQDNYG.js → model-projects-H22KENI4.js} +1 -1
  165. package/dist/chunks/opchat-3S6TSDZO.js +3 -0
  166. package/dist/chunks/opchat-bounded-chat-B7LPCD4U.js +2 -0
  167. package/dist/chunks/{organizations-DJRJWC5I.js → organizations-62YNTZTO.js} +1 -1
  168. package/dist/chunks/{profile-JRS3JNRC.js → profile-ELE2D7HU.js} +1 -1
  169. package/dist/chunks/project-action-payload-32F4X2BB.js +2 -0
  170. package/dist/chunks/{project-agent-2KNJFNZI.js → project-agent-O4REKO6T.js} +1 -1
  171. package/dist/chunks/{published-experiment-source-LFYHKFAO.js → published-experiment-source-DAOTJLIN.js} +1 -1
  172. package/dist/chunks/refiner-profile-service-DYMZ7J3X.js +2 -0
  173. package/dist/chunks/{runtime-CBJF5GMB.js → runtime-776NUSE7.js} +2 -2
  174. package/dist/chunks/{sandbox-command-IIGTPYN3.js → sandbox-command-UQ26NDIX.js} +1 -1
  175. package/dist/chunks/{sandbox-template-FTANKQIA.js → sandbox-template-WP6YCGBK.js} +1 -1
  176. package/dist/chunks/saved-work-PG52WCRQ.js +2 -0
  177. package/dist/chunks/{send-turn-5UB7ZBJV.js → send-turn-RPB65PME.js} +1 -1
  178. package/dist/chunks/{src-4YZF6L6H.js → src-2R4CMCJ5.js} +1 -1
  179. package/dist/chunks/src-AU6LG7E6.js +421 -0
  180. package/dist/chunks/standalone-experiment-turn-owner-SD3SUTKX.js +2 -0
  181. package/dist/chunks/{store-chat-resources-CGW7PDCG.js → store-chat-resources-T4LR7K25.js} +1 -1
  182. package/dist/chunks/{store-continual-support-reviews-GWI2FRII.js → store-continual-support-reviews-R62D2HD6.js} +1 -1
  183. package/dist/chunks/{store-conversation-serving-637AHKBP.js → store-conversation-serving-25O7BAR2.js} +1 -1
  184. package/dist/chunks/{store-create-improve-ZG653Z63.js → store-create-improve-T5E2GUKK.js} +1 -1
  185. package/dist/chunks/{store-datasets-IW6F2QZM.js → store-datasets-5Y4U5L3R.js} +1 -1
  186. package/dist/chunks/{store-evaluation-results-V5J6L4NV.js → store-evaluation-results-WUVJWCFU.js} +1 -1
  187. package/dist/chunks/{store-harness-workspaces-HHMM6GNK.js → store-harness-workspaces-IFEFY5CK.js} +1 -1
  188. package/dist/chunks/{store-human-review-V5H4QDHR.js → store-human-review-ZQNLZRGG.js} +1 -1
  189. package/dist/chunks/store-learned-preference-migration-validation-UH6MJQSH.js +2 -0
  190. package/dist/chunks/{store-local-experiments-A2UWYPVQ.js → store-local-experiments-LOH4F4TF.js} +1 -1
  191. package/dist/chunks/{store-model-batch-review-KMYPYWJR.js → store-model-batch-review-QO4VVKWC.js} +1 -1
  192. package/dist/chunks/{store-model-configuration-UXNC4PGY.js → store-model-configuration-C3HSOFD5.js} +1 -1
  193. package/dist/chunks/store-model-project-preparation-RQ2YTC2Y.js +2 -0
  194. package/dist/chunks/{store-preference-comparison-HTOXLWKF.js → store-preference-comparison-RNIFLJRW.js} +1 -1
  195. package/dist/chunks/{store-schedules-QVWT7AEB.js → store-schedules-DVQ2PP4F.js} +1 -1
  196. package/dist/chunks/{store-sidebar-file-bookmarks-G5Z6NZWL.js → store-sidebar-file-bookmarks-LXWFFYCZ.js} +1 -1
  197. package/dist/chunks/{store-sidebar-preferences-27FFMUWU.js → store-sidebar-preferences-4HH7LX6N.js} +1 -1
  198. package/dist/chunks/{store-subagents-PK7ZWLPR.js → store-subagents-JLW4GD4Q.js} +1 -1
  199. package/dist/chunks/{store-task-inbox-LNDCZOYE.js → store-task-inbox-DL5RYFPO.js} +1 -1
  200. package/dist/chunks/{store-task-inventory-IG6HGWSQ.js → store-task-inventory-NJXRXFLC.js} +1 -1
  201. package/dist/chunks/store-taskset-drafts-UFGN4SGF.js +9 -0
  202. package/dist/chunks/{store-training-NQRRPKEZ.js → store-training-VRLU6NFX.js} +1 -1
  203. package/dist/chunks/{store-training-jobs-F6Y2ZTXP.js → store-training-jobs-3ZHG4LGI.js} +1 -1
  204. package/dist/chunks/{store-training-models-NRSLSBEW.js → store-training-models-KWQD5PRP.js} +1 -1
  205. package/dist/chunks/{store-usage-GFHQYT34.js → store-usage-ZRS3ILF2.js} +1 -1
  206. package/dist/chunks/{taskset-NYLUYX6K.js → taskset-QDMCQQDJ.js} +1 -1
  207. package/dist/chunks/{taskset-packages-I7I5KBFP.js → taskset-packages-CBLJFWDQ.js} +1 -1
  208. package/dist/chunks/{teams-bot-FMAEDGSD.js → teams-bot-GF272RGC.js} +1 -1
  209. package/dist/chunks/{training-UBX6E7SK.js → training-DF5UEPY3.js} +1 -1
  210. package/dist/chunks/{training-error-AYOGHHL2.js → training-error-L5V5IBX3.js} +1 -1
  211. package/dist/chunks/training-hosted-I2NDBYGS.js +2 -0
  212. package/dist/chunks/training-hosted-report-4F25RZZ4.js +2 -0
  213. package/dist/chunks/training-hosted-serving-QAV7ZGGV.js +2 -0
  214. package/dist/chunks/training-project-preparation-XWGRY5ME.js +3 -0
  215. package/dist/chunks/{web-search-Q4OQVUNH.js → web-search-5RUXYIOF.js} +1 -1
  216. package/dist/chunks/{workspaces-XREEVSTS.js → workspaces-JRY2IE7H.js} +1 -1
  217. package/dist/cli.js +2 -2
  218. package/dist/hosted-chat.d.ts +28 -0
  219. package/dist/index.js +1 -1
  220. package/dist/skills/openpond-cli/SKILL.md +15 -2
  221. package/dist/skills/openpond-cli/references/compact-resource-tables.md +3 -3
  222. package/dist/skills/openpond-cli/references/diagnose-and-improve.md +4 -2
  223. package/dist/skills/openpond-cli/references/experiments-and-training.md +155 -10
  224. package/dist/skills/openpond-taskset-authoring/SKILL.md +5 -4
  225. package/dist/skills/openpond-taskset-authoring/artifact.json +7 -7
  226. package/dist/skills/openpond-taskset-authoring/references/failure-diagnosis.md +52 -1
  227. package/dist/web/assets/App-DHJVXTI2.js +54 -0
  228. package/dist/web/assets/App-DpFKLxuA.css +1 -0
  229. package/dist/web/assets/AppDialog-BurL61qE.js +1 -0
  230. package/dist/web/assets/AppTerminalPanel-RjFlF-a4.js +2 -0
  231. package/dist/web/assets/{AppToastContext-BB_2hRfw.js → AppToastContext-DZLErwj0.js} +1 -1
  232. package/dist/web/assets/AppsView-ttlr9ckQ.js +1 -0
  233. package/dist/web/assets/{AttachmentTypeIcon-DOAsVQjt.js → AttachmentTypeIcon-CpMSfHCK.js} +1 -1
  234. package/dist/web/assets/BrowserSidebar-Cp2l0kg0.js +1 -0
  235. package/dist/web/assets/{CartesianChart-DO76yfJb.js → CartesianChart-CEbM980A.js} +1 -1
  236. package/dist/web/assets/{ChatTimelineEntry-IKzZsHoI.js → ChatTimelineEntry-BITv20Ze.js} +1 -1
  237. package/dist/web/assets/{CollaborationTabs-DNoknVMD.js → CollaborationTabs-DrKJmJZK.js} +1 -1
  238. package/dist/web/assets/{CommandMenu-CBY2AJxV.js → CommandMenu-6oj8FUr6.js} +1 -1
  239. package/dist/web/assets/CommunityView-BzpIq1lD.js +1 -0
  240. package/dist/web/assets/ComposerAttachments-6en7m_ov.js +2 -0
  241. package/dist/web/assets/ComposerCreateImproveStrip-ChplO9YP.js +1 -0
  242. package/dist/web/assets/ConversationImportsSettings-DRHgc7j_.js +1 -0
  243. package/dist/web/assets/FilePagePreview-CW4J_1u7.js +2 -0
  244. package/dist/web/assets/GetStartedView-CaBk_mX6.js +1 -0
  245. package/dist/web/assets/GettingStartedDialog-EsH-8Diz.css +1 -0
  246. package/dist/web/assets/GettingStartedDialog-JtFLyU3F.js +1 -0
  247. package/dist/web/assets/{HostedModelLearningReview-B0rbIVvn.js → HostedModelLearningReview-hhcjDifK.js} +1 -1
  248. package/dist/web/assets/HostedModelLearningSettings-CY8198Y1.js +1 -0
  249. package/dist/web/assets/LabModelVersionDetailPage-f0tHT-Sn.js +1 -0
  250. package/dist/web/assets/LabSkillSidebar-HibUEEko.js +1 -0
  251. package/dist/web/assets/{LabsRoute-DOnw39du.js → LabsRoute-B61l1b8P.js} +8 -8
  252. package/dist/web/assets/MainChatThread-egKi0gLk.js +2 -0
  253. package/dist/web/assets/MainPane-2dj6Dg4l.js +95 -0
  254. package/dist/web/assets/{MainPane-CuBUBA9F.css → MainPane-BwHw3UYp.css} +1 -1
  255. package/dist/web/assets/NativeSetupTerminal-3eR9D_R3.css +1 -0
  256. package/dist/web/assets/NativeSetupTerminal-CNHTByLo.js +2 -0
  257. package/dist/web/assets/NativeSkillSidebar-DCdMbSfe.js +1 -0
  258. package/dist/web/assets/NewProjectDialog-t9Imnb__.js +1 -0
  259. package/dist/web/assets/OutputsPage-CeGq_F1S.js +1 -0
  260. package/dist/web/assets/{PageChrome-BBnWAENV.js → PageChrome-VHME5V8j.js} +1 -1
  261. package/dist/web/assets/ProjectsPage-2TMZoEPB.js +1 -0
  262. package/dist/web/assets/RightChatPanelStack-B3mBViGC.js +1 -0
  263. package/dist/web/assets/RightSidebarHomePanel-CxDYSyyx.js +1 -0
  264. package/dist/web/assets/ScheduledWorkPage-Dh47iH11.js +1 -0
  265. package/dist/web/assets/SettingsView-D2bu3tK_.js +5 -0
  266. package/dist/web/assets/TeamChatView-CN17AsgA.js +1 -0
  267. package/dist/web/assets/TerminalOverlay-DlhRpi-X.js +16 -0
  268. package/dist/web/assets/TrainingCreationPanel-DJKzaNFj.js +1 -0
  269. package/dist/web/assets/{TrainingDraftPanel-HznyNCJ4.js → TrainingDraftPanel-BhhZPPuY.js} +1 -1
  270. package/dist/web/assets/{TrainingMetricWorkbench-BmzHLwIP.js → TrainingMetricWorkbench-DBy8F1xp.js} +1 -1
  271. package/dist/web/assets/{UsageSettingsSection-C3oZ1UEP.js → UsageSettingsSection-DTZslBeW.js} +2 -2
  272. package/dist/web/assets/WorkSidebarPanel-Ds-eTQLs.js +1 -0
  273. package/dist/web/assets/WorkspaceDiffPanel-D_iyg2D4.js +11 -0
  274. package/dist/web/assets/WorkspaceEnvironmentMenu-Fn-NlfMQ.js +35 -0
  275. package/dist/web/assets/WorkspaceFileLocation-ChEeZffU.js +1 -0
  276. package/dist/web/assets/WorkspaceGitDialogs-D_RUXhTi.js +1 -0
  277. package/dist/web/assets/{WorkspaceMonacoEditor-DfsL1WIi.js → WorkspaceMonacoEditor-BJxaiDrj.js} +3 -3
  278. package/dist/web/assets/{WorkspacePresentationPreview-WuS_B45u.js → WorkspacePresentationPreview-A28Poeca.js} +1 -1
  279. package/dist/web/assets/{chat-resources-CItQ4mZD.js → chat-resources-3SvnVeKv.js} +1 -1
  280. package/dist/web/assets/{chevron-down-Bnma8EMP.js → chevron-down-dYn0pd4Q.js} +1 -1
  281. package/dist/web/assets/chevron-right-sFx2xRvT.js +1 -0
  282. package/dist/web/assets/{chunk-24N6A6SF-BUjzKvRC.js → chunk-BYNVSWIQ-DWh9SmdB.js} +1 -1
  283. package/dist/web/assets/{chunk-GAIDBPFY-BLuHpurI.js → chunk-ZFYI4P6C-BmsNtSkR.js} +1 -1
  284. package/dist/web/assets/{client-choice-storage-BuNdhYSV.js → client-choice-storage-DTTLbrYt.js} +1 -1
  285. package/dist/web/assets/{cloud-upload-DOftANif.js → cloud-upload-CRMPCFnq.js} +1 -1
  286. package/dist/web/assets/connected-app-mentions-D3wRZLwI.js +1 -0
  287. package/dist/web/assets/copy-DR4ielPn.js +1 -0
  288. package/dist/web/assets/{createLucideIcon-C4b2afqG.js → createLucideIcon-DmttVQ_a.js} +1 -1
  289. package/dist/web/assets/{cssMode-0Hn7tCrE.js → cssMode-d-2GuNvW.js} +1 -1
  290. package/dist/web/assets/external-link-B4rPiZEp.js +1 -0
  291. package/dist/web/assets/{folder-open-wJwCoIDs.js → folder-open-BrIUcUk_.js} +1 -1
  292. package/dist/web/assets/{folder-plus-DnTN6mcP.js → folder-plus-DwImGEt-.js} +1 -1
  293. package/dist/web/assets/{git-commit-horizontal-98y7PP6G.js → git-commit-horizontal-Ds1mkrlW.js} +1 -1
  294. package/dist/web/assets/{htmlMode-JO_QluNH.js → htmlMode-s15GR0Fn.js} +1 -1
  295. package/dist/web/assets/icons-CK5-nxVC.js +1 -0
  296. package/dist/web/assets/{image-C7HVlg3X.js → image-CY-sHbfQ.js} +1 -1
  297. package/dist/web/assets/{index-BsPUniZy.js → index-DYrLeSyY.js} +2 -2
  298. package/dist/web/assets/index-Dezj4Z2p.css +1 -0
  299. package/dist/web/assets/{info-BLWDShaz.js → info-aSvM8YlJ.js} +1 -1
  300. package/dist/web/assets/{jsonMode-BfTXJted.js → jsonMode-vos9H2hz.js} +1 -1
  301. package/dist/web/assets/loader-circle-cyf35w3i.js +1 -0
  302. package/dist/web/assets/{lspLanguageFeatures-68cAgnuv.js → lspLanguageFeatures-pQmEaoMt.js} +1 -1
  303. package/dist/web/assets/{maximize-2-DUWvLap6.js → maximize-2-DgF6ZVOM.js} +1 -1
  304. package/dist/web/assets/{monaco.contribution-_3aU1TTb.js → monaco.contribution-BPwsKvRB.js} +2 -2
  305. package/dist/web/assets/{monaco.contribution-h8U8HXFT.js → monaco.contribution-BbMpa0_-.js} +2 -2
  306. package/dist/web/assets/{monaco.contribution-CWeY6ia1.js → monaco.contribution-CJlccVX3.js} +2 -2
  307. package/dist/web/assets/{monaco.contribution-DOiiDDen.js → monaco.contribution-pWurLXbm.js} +2 -2
  308. package/dist/web/assets/{monitor-B6OuAu13.js → monitor-DlEV241C.js} +1 -1
  309. package/dist/web/assets/{paperclip-DSHxP9CY.js → paperclip-fnRZSIRc.js} +1 -1
  310. package/dist/web/assets/{pdf-RXlFwNte.js → pdf-CT3zVKCE.js} +1 -1
  311. package/dist/web/assets/play-wI_3FLr4.js +1 -0
  312. package/dist/web/assets/plus-DoJe4fLj.js +1 -0
  313. package/dist/web/assets/{presentation-C9WnPDVr.js → presentation-Bb8ecExR.js} +1 -1
  314. package/dist/web/assets/profile-agent-labels-Duh96b8x.js +1 -0
  315. package/dist/web/assets/{python-BQXo7wMt.js → python-DXA1xp0A.js} +1 -1
  316. package/dist/web/assets/{refresh-cw-NXOER_CD.js → refresh-cw-B53QjxMO.js} +1 -1
  317. package/dist/web/assets/{save-BxXc21N6.js → save-V1Q4Fcqa.js} +1 -1
  318. package/dist/web/assets/settings-lists-CtH1A57b.js +5 -0
  319. package/dist/web/assets/square-BqSK-hv9.js +1 -0
  320. package/dist/web/assets/square-terminal-Dmgkm5zY.js +1 -0
  321. package/dist/web/assets/submit-issue-command-DRgUboVW.js +3 -0
  322. package/dist/web/assets/{toggleHighContrast-Di1cRuQ4.js → toggleHighContrast-B-BD2K2Q.js} +1 -1
  323. package/dist/web/assets/{training-managed-adapter-81RrdT1k.js → training-managed-adapter-BXNwgd3P.js} +1 -1
  324. package/dist/web/assets/{training-model-data-CmVo80ZR.js → training-model-data-14942K_Z.js} +5 -5
  325. package/dist/web/assets/{tsMode-PxisJRYB.js → tsMode-DdgIcxK3.js} +1 -1
  326. package/dist/web/assets/ui-theme.generated-D-mc26qt.js +144 -0
  327. package/dist/web/assets/{upload-NXasN1wU.js → upload-82Y6RjLi.js} +1 -1
  328. package/dist/web/assets/{useAccountSettings-Dqqt1vUY.js → useAccountSettings-BgHXNpq_.js} +1 -1
  329. package/dist/web/assets/{useAgentInventory-BV4CUWzJ.js → useAgentInventory-B-LNn3up.js} +1 -1
  330. package/dist/web/assets/{useLocalAgentSchedules-Cc0M_qax.js → useLocalAgentSchedules-CsKv22Hs.js} +1 -1
  331. package/dist/web/assets/{useQuery-ByaRC9SK.js → useQuery-CPC2wsWm.js} +1 -1
  332. package/dist/web/assets/{wifi-off-aVJ3AvT_.js → wifi-off-DXOoDN9l.js} +1 -1
  333. package/dist/web/assets/{workers-u92Boudu.js → workers-Clf4hKt5.js} +1 -1
  334. package/dist/web/assets/x-IPhrr4ju.js +1 -0
  335. package/dist/web/assets/{yaml-BxQUS0ew.js → yaml-I1tf8Uxx.js} +1 -1
  336. package/dist/web/index.html +12 -3
  337. package/docs/command-reference.md +28 -2
  338. package/package.json +2 -1
  339. package/dist/chunks/app-server-evaluations-HAAYVEXB.js +0 -2
  340. package/dist/chunks/app-server-runtime-B6BAJA6L.js +0 -2
  341. package/dist/chunks/chunk-4N3UF3U5.js +0 -2
  342. package/dist/chunks/chunk-6DCXAXVD.js +0 -22
  343. package/dist/chunks/chunk-BLKTUFGB.js +0 -2
  344. package/dist/chunks/chunk-E3EKBPCB.js +0 -2
  345. package/dist/chunks/chunk-F5JDBDYL.js +0 -2
  346. package/dist/chunks/chunk-JEVA7YQL.js +0 -3
  347. package/dist/chunks/chunk-KC7I6E6W.js +0 -2
  348. package/dist/chunks/chunk-OJSK4NSW.js +0 -151
  349. package/dist/chunks/chunk-UBCLPZSQ.js +0 -4
  350. package/dist/chunks/chunk-UJBEWIR3.js +0 -8
  351. package/dist/chunks/chunk-V67IFV26.js +0 -86
  352. package/dist/chunks/chunk-VSUHJ46L.js +0 -18
  353. package/dist/chunks/chunk-X3WEQL3O.js +0 -2
  354. package/dist/chunks/chunk-XK7SPL63.js +0 -2
  355. package/dist/chunks/chunk-YR5ID2SS.js +0 -2
  356. package/dist/chunks/cli-WC45SI7E.js +0 -2
  357. package/dist/chunks/connected-app-executor-TZJB25UZ.js +0 -2
  358. package/dist/chunks/experiments-IWSCFDBB.js +0 -2
  359. package/dist/chunks/host-profile-evaluation-tools-EFB2YIK2.js +0 -2
  360. package/dist/chunks/host-profile-external-dataset-KSNREH3Q.js +0 -2
  361. package/dist/chunks/hosted-app-server-composition-VV545TYL.js +0 -2
  362. package/dist/chunks/hosted-experiment-improvement-NYLADI7S.js +0 -3
  363. package/dist/chunks/hosted-harness-runtime-Z54E5MD7.js +0 -2
  364. package/dist/chunks/hosted-profile-compiler-SW2RWTDZ.js +0 -2
  365. package/dist/chunks/hosted-profile-evaluation-preparation-ZAOGDQXO.js +0 -3
  366. package/dist/chunks/local-harness-improvement-runtime-KB4OP3SM.js +0 -2
  367. package/dist/chunks/local-harness-taskset-review-SUDEUGUU.js +0 -2
  368. package/dist/chunks/opchat-KSOJEL4W.js +0 -3
  369. package/dist/chunks/project-action-payload-SQ5BSQHY.js +0 -2
  370. package/dist/chunks/refiner-profile-service-UWI4NAZ3.js +0 -2
  371. package/dist/chunks/saved-work-QA46KCME.js +0 -2
  372. package/dist/chunks/src-E7NWAN5B.js +0 -420
  373. package/dist/chunks/standalone-experiment-turn-owner-SQJ5HXDZ.js +0 -2
  374. package/dist/chunks/store-learned-preference-migration-validation-KOCW5NOZ.js +0 -2
  375. package/dist/chunks/store-taskset-drafts-TA6X245D.js +0 -9
  376. package/dist/chunks/training-hosted-4R4QTSAN.js +0 -2
  377. package/dist/chunks/training-hosted-report-UQVK6FTG.js +0 -2
  378. package/dist/web/assets/App-Df7uYQGj.css +0 -1
  379. package/dist/web/assets/App-Yy3l2sdD.js +0 -56
  380. package/dist/web/assets/AppTerminalPanel-Dqr6VS3I.js +0 -2
  381. package/dist/web/assets/AppsView-27Fl_-49.js +0 -1
  382. package/dist/web/assets/BrowserSidebar-bnI3sSZO.js +0 -1
  383. package/dist/web/assets/CommunityView-CFKM7FTY.js +0 -1
  384. package/dist/web/assets/ComposerAttachments-BdjBddKf.js +0 -2
  385. package/dist/web/assets/ComposerCreateImproveStrip-ViJ5E0We.js +0 -1
  386. package/dist/web/assets/ConversationImportsSettings-xLl-7G9R.js +0 -1
  387. package/dist/web/assets/FilePagePreview-CTHuPzJt.js +0 -2
  388. package/dist/web/assets/GetStartedView-DvV_RMgM.js +0 -1
  389. package/dist/web/assets/GettingStartedDialog-B1jFmfgd.js +0 -1
  390. package/dist/web/assets/GettingStartedDialog-C73Bdcz2.css +0 -1
  391. package/dist/web/assets/HostedModelLearningSettings-DzAiutjq.js +0 -1
  392. package/dist/web/assets/LabModelVersionDetailPage-CF8FkRUY.js +0 -1
  393. package/dist/web/assets/LabSkillSidebar-gjbl9Nlv.js +0 -1
  394. package/dist/web/assets/MainChatThread-BUKup-JB.js +0 -2
  395. package/dist/web/assets/MainPane-BpE7AKXu.js +0 -92
  396. package/dist/web/assets/NativeSkillSidebar-Br5Lk6iU.js +0 -1
  397. package/dist/web/assets/NewProjectDialog-DyuKPOvF.js +0 -1
  398. package/dist/web/assets/OutputsPage-Dl63CVrw.js +0 -1
  399. package/dist/web/assets/ProjectsPage-BNF1TiyR.js +0 -1
  400. package/dist/web/assets/RightChatPanelStack-CxVAAbp-.js +0 -1
  401. package/dist/web/assets/RightSidebarHomePanel-D46ktZg-.js +0 -1
  402. package/dist/web/assets/ScheduledWorkPage-Cp0Hf-hs.js +0 -1
  403. package/dist/web/assets/SettingsView-BT57Q5Wx.js +0 -5
  404. package/dist/web/assets/TeamChatView-BmxTJ9E5.js +0 -1
  405. package/dist/web/assets/TerminalOverlay-D-Yq8av_.js +0 -16
  406. package/dist/web/assets/TrainingCreationPanel-CwfNPj_G.js +0 -1
  407. package/dist/web/assets/WorkSidebarPanel-myTA9tsh.js +0 -1
  408. package/dist/web/assets/WorkspaceDiffPanel-D0dzFgzW.js +0 -11
  409. package/dist/web/assets/WorkspaceEnvironmentMenu-AUzME1eX.js +0 -35
  410. package/dist/web/assets/WorkspaceFileLocation-Ai8Tz2Mz.js +0 -1
  411. package/dist/web/assets/WorkspaceGitDialogs-D-UCCckC.js +0 -1
  412. package/dist/web/assets/chevron-right-Cxv_xBz5.js +0 -1
  413. package/dist/web/assets/git-dialogs-C631EFyO.css +0 -1
  414. package/dist/web/assets/icons-kaq6k88m.js +0 -1
  415. package/dist/web/assets/index-DUMDOdB2.css +0 -1
  416. package/dist/web/assets/play-BPPQoqMl.js +0 -1
  417. package/dist/web/assets/plus-D18vYzHF.js +0 -1
  418. package/dist/web/assets/settings-lists-DMNPkGYk.js +0 -5
  419. package/dist/web/assets/square-Da8RuqW4.js +0 -1
  420. package/dist/web/assets/ui-theme.generated-R0MY_Jy0.js +0 -136
@@ -1,2 +1,2 @@
1
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 L,n as M,o as c}from"./chunk-BNZTJPK7.js";import{m as v,s as w,t as y}from"./chunk-Q66LWQGF.js";import"./chunk-TNHDD3LO.js";import"./chunk-HN2ZK6EV.js";import"./chunk-UJBEWIR3.js";import"./chunk-XRKFTPHD.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{b as I,f as g,g as h,h as m}from"./chunk-3M53YXEI.js";import"./chunk-TYHCBVQT.js";import"./chunk-VSUHJ46L.js";import"./chunk-FWIPHEVA.js";import"./chunk-BT5YNE5U.js";import"./chunk-OJFDI7VM.js";import"./chunk-QCSLEMZF.js";import"./chunk-4RHM4WN2.js";import"./chunk-BLKTUFGB.js";import"./chunk-GLUWATL5.js";import"./chunk-OSVGNONV.js";import"./chunk-YBNKGA5C.js";import"./chunk-ZZWAQBA2.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-YR5ID2SS.js";import"./chunk-M6JRS5PA.js";import"./chunk-KCV5VN4X.js";import"./chunk-RV7PUSI2.js";import"./chunk-KK626T3Z.js";import"./chunk-6DCXAXVD.js";import"./chunk-OE22TAXP.js";import"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as b}from"./chunk-FTQLQJQV.js";import{readFile as D,stat as _}from"node:fs/promises";async function U(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,a=h(e.maxEntries,"max-entries"),s=e.recursive!==void 0?g(e.recursive):void 0,d=await r.listFiles(t,{...n?{path:n}:{},...s!==void 0?{recursive:s}:{},...a!==void 0?{maxEntries:a}:{}});return console.log(JSON.stringify({sandbox:c(d.sandbox),files:d.files},null,2)),!0}if(o==="upload-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"",a=typeof e.contents=="string"?e.contents:typeof e.content=="string"?e.content:"",s=typeof e.contentsBase64=="string"?e.contentsBase64.trim():typeof e.contentBase64=="string"?e.contentBase64.trim():"",d=typeof e.fromPath=="string"?e.fromPath.trim():"";if(!t||!n)throw new Error('usage: sandbox upload-file <sandboxId> --path <path> --contents "text"');if(d){if(a||s)throw new Error("Choose --from-path or inline contents for the upload.");let f=await _(d);if(!f.isFile()||f.size>10*1024*1024)throw new Error("Sandbox upload requires a file within 10 MiB.");let u=await D(d);if(u.byteLength>10*1024*1024)throw new Error("Sandbox upload file changed beyond 10 MiB.");s=u.toString("base64")}if(!a&&!s)throw new Error('usage: sandbox upload-file <sandboxId> --path <path> --contents "text"');let l=s?await r.uploadFileBase64(t,n,s):await r.uploadFile(t,n,a);return console.log(JSON.stringify({sandbox:c(l.sandbox),file:l.file},null,2)),!0}if(o==="download-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"",a=m(e.offsetBytes,"offset-bytes"),s=m(e.maxBytes,"max-bytes");if(!t||!n)throw new Error("usage: sandbox download-file <sandboxId> --path <path>");let d=await r.downloadFileResponse(t,{path:n,...a!==void 0?{offsetBytes:a}:{},...s!==void 0?{maxBytes:s}:{}});return console.log(JSON.stringify({sandbox:c(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 a=typeof e.path=="string"?e.path.trim():void 0,s=h(e.maxResults,"max-results"),d=await r.searchFiles(t,{query:n,...a?{path:a}:{},...s!==void 0?{maxResults:s}:{}});return console.log(JSON.stringify({sandbox:c(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 a=await r.deleteFile(t,n,{recursive:g(e.recursive)});return console.log(JSON.stringify({sandbox:c(a.sandbox),deleted:a.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 a=await r.statFile(t,n);return console.log(JSON.stringify({sandbox:c(a.sandbox),file:a.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 a=await r.mkdir(t,{path:n,recursive:e.recursive!==void 0?g(e.recursive):void 0});return console.log(JSON.stringify({sandbox:c(a.sandbox),directory:a.directory},null,2)),!0}if(o==="move-file"){let t=i[1],n=typeof e.fromPath=="string"?e.fromPath.trim():"",a=typeof e.toPath=="string"?e.toPath.trim():"";if(!t||!n||!a)throw new Error("usage: sandbox move-file <sandboxId> --from-path <path> --to-path <path> [--overwrite]");let s=await r.moveFile(t,{fromPath:n,toPath:a,overwrite:g(e.overwrite)});return console.log(JSON.stringify({sandbox:c(s.sandbox),moved:s.moved,file:s.file},null,2)),!0}return!1}b(U,"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:c(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,a=await r.gitDiff(t,{...n?{baseRef:n}:{}});return console.log(JSON.stringify({sandbox:c(a.sandbox),diff:a.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,a=await r.gitExportPatch(t,{...n?{baseRef:n}:{}});return console.log(JSON.stringify({sandbox:c(a.sandbox),patch:a.patch},null,2)),!0}if(o==="git-branch"){let t=i[1],n=typeof e.branch=="string"?e.branch.trim():"",a=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 s=await r.gitBranch(t,{branch:n,create:g(e.create),...a?{startPoint:a}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),branch:s.branch},null,2)),!0}if(o==="git-commit"){let t=i[1],n=typeof e.message=="string"?e.message.trim():"",a=g(e.all),d=(typeof e.paths=="string"?e.paths:typeof e.path=="string"?e.path:"").split(",").map(f=>f.trim()).filter(Boolean);if(!t||!n||!a&&d.length===0)throw new Error('usage: sandbox git-commit <sandboxId> --message "..." [--all|--paths <csv>]');let l=await r.gitCommit(t,{message:n,...a?{all:!0}:{paths:d}});return console.log(JSON.stringify({sandbox:c(l.sandbox),commit:l.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,a=typeof e.branch=="string"&&e.branch.trim()?e.branch.trim():void 0,s=await r.gitPull(t,{...n?{remote:n}:{},...a?{branch:a}:{},...e.rebase!==void 0?{rebase:g(e.rebase)}:{},...e.ffOnly!==void 0?{ffOnly:g(e.ffOnly)}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),pull:s.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,a=typeof e.branch=="string"&&e.branch.trim()?e.branch.trim():void 0,s=await r.gitPush(t,{...n?{remote:n}:{},...a?{branch:a}:{},...e.setUpstream!==void 0?{setUpstream:g(e.setUpstream)}:{},...e.forceWithLease!==void 0?{forceWithLease:g(e.forceWithLease)}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),push:s.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 a=m(e.timeoutSeconds,"timeout-seconds"),s=await r.startProcess(t,{command:n.trim(),...a!==void 0?{timeoutSeconds:a}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),process:s.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:c(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 a=m(e.since,"since"),s=await r.getProcess(t,n,{...a!==void 0?{since:a}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),process:s.process,output:s.output,cursor:s.cursor,completed:s.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 a=await r.stopProcess(t,n);return console.log(JSON.stringify({sandbox:c(a.sandbox),process:a.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 a=m(e.since,"since");return await r.streamProcessOutput(t,n,{...a!==void 0?{since:a}:{}}),!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(" "),a=m(e.timeoutSeconds,"timeout-seconds"),s=m(e.rows,"rows"),d=m(e.cols,"cols"),l=await r.startPty(t,{...n.trim()?{command:n.trim()}:{},...a!==void 0?{timeoutSeconds:a}:{},...s!==void 0?{rows:s}:{},...d!==void 0?{cols:d}:{}});return console.log(JSON.stringify({sandbox:c(l.sandbox),pty:l.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:c(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 a=m(e.since,"since"),s=await r.getPty(t,n,{...a!==void 0?{since:a}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),pty:s.pty,output:s.output,cursor:s.cursor,completed:s.completed},null,2)),!0}if(o==="pty-write"){let t=i[1],n=i[2],a=typeof e.inputBase64=="string"?e.inputBase64.trim():"",s=(typeof e.input=="string"?e.input:null)||i.slice(3).join(" ");if(!t||!n||!a&&!s)throw new Error("usage: sandbox pty-write <sandboxId> <ptyId> --input <text>");let d=await r.writePtyInput(t,n,a?{dataBase64:a}:s);return console.log(JSON.stringify({sandbox:c(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 a=await r.stopPty(t,n);return console.log(JSON.stringify({sandbox:c(a.sandbox),pty:a.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 a=m(e.since,"since");return await r.streamPtyOutput(t,n,{...a!==void 0?{since:a}:{}}),!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():"",a=await r.listReplays({...t?{teamId:t}:{},...n?{projectId:n}:{}});if(g(e.json))return console.log(JSON.stringify(a,null,2)),!0;if(a.replays.length===0)return console.log("no sandbox replays found"),!0;for(let s of a.replays)console.log(O(s));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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.getReplay(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});return console.log(JSON.stringify(s,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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.getReplayLogs(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});for(let d of s.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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.getReplayArtifacts(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});return console.log(JSON.stringify({replayId:s.replayId,artifacts:s.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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.cancelReplay(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});return console.log(JSON.stringify(s,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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=m(e.intervalMs,"interval-ms")??5e3,d=m(e.timeoutMs,"timeout-ms")??900*1e3,l=Date.now(),f=new Set;for(;Date.now()-l<=d;){let u=await r.getReplay(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});for(let p of u.replay.logs)f.has(p)||(f.add(p),console.log(p));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(p=>setTimeout(p,s))}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():"",a=typeof e.agentId=="string"?e.agentId.trim():"",s=await r.listSandboxRuntimes({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{agentId:a}:{}});return console.log(JSON.stringify({runtimes:s},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():"",a=Number(e.expectedVersion),s=typeof e.summary=="string"&&e.summary.trim()?e.summary.trim():void 0;if(!t||!n||!Number.isInteger(a))throw new Error("usage: sandbox runtime-status <runtimeId> --status <status> --expected-version <n>");let d=await r.updateSandboxRuntimeStatus(t,{status:n,expectedVersion:a,...s?{summary:s}:{}});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():"",a=typeof e.summary=="string"&&e.summary.trim()?e.summary.trim():void 0,s=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,...a?{summary:a}:{},...s?{payload:s}:{},...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():"",a=typeof e.sandboxId=="string"&&e.sandboxId.trim()?e.sandboxId.trim():"",s=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,{...a?{sandboxId:a}:{},...s?{message:s}:{}},{...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(g(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 a of n)console.log(`${a.name} ${a.status} v${a.currentVersion??"current"} ${a.secretRef}`);return!0}if(o==="secret-create"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=typeof e.name=="string"?e.name.trim():"",a=typeof e.description=="string"&&e.description.trim()?e.description.trim():void 0,s=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}`),l=await r.createSecret({...t?{teamId:t}:{},name:n,value:d,...a?{description:a}:{},...s?{scope:s}:{}});return console.log(JSON.stringify({secret:y(l)},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 a=await w(e,"New secret value"),s=await r.rotateSecret(t,{...n?{teamId:n}:{},value:a});return console.log(JSON.stringify({secret:y(s)},null,2)),!0}if(o==="secret-attach"){let t=i[1],n=typeof e.teamId=="string"?e.teamId.trim():"",a=typeof e.envName=="string"?e.envName.trim():"",s=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||!a||!s||!d)throw new Error("usage: sandbox secret-attach <secretId> --env-name <ENV_NAME> --target-type sandbox|project|agent|template|replay --target-id <id>");let l=await r.attachSecret(t,{...n?{teamId:n}:{},envName:a,targetType:s,targetId:d});return console.log(JSON.stringify({secret:y(l)},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 a=o==="secret-revoke"?await r.revokeSecret(t,{...n?{teamId:n}:{}}):await r.deleteSecret(t,{...n?{teamId:n}:{}});return console.log(JSON.stringify({secret:y(a)},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(g(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 a of n)console.log(S(a));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(L(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(g(e.json))return console.log(JSON.stringify(n,null,2)),!0;for(let a of n.logs)console.log(a);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=m(e.intervalMs,"interval-ms")??5e3,a=m(e.timeoutMs,"timeout-ms")??900*1e3,s=Date.now(),d=new Set;for(;Date.now()-s<=a;){let[l,f]=await Promise.all([r.getPublishedSnapshotBuild(t),r.getPublishedSnapshotBuildLogs(t)]);for(let u of f.logs)d.has(u)||(d.add(u),console.log(u));if(l.status==="succeeded"||l.status==="failed"||l.status==="cancelled"){if(console.log(S(l)),l.status!=="succeeded")throw new Error(`published snapshot build ${l.status}: ${l.error??"no error"}`);return!0}await new Promise(u=>setTimeout(u,n))}throw new Error(`published snapshot build did not finish within ${a}ms`)}return!1}b(H,"handleSandboxTemplateBuildsCommand");function z(r){return g(r.async)||g(r.respondAsync)}b(z,"parseSandboxAsyncOption");async function Ce(r,o){let e=o[0]||"list",i=await v(r);if(e==="get"){let t=o[1];if(!t||o.length!==2)throw new Error("usage: sandbox get <sandboxId>");console.log(JSON.stringify({sandbox:await i.get(t)},null,2));return}if(e==="list"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",a=typeof r.agentId=="string"?r.agentId.trim():"",s=await i.list({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{agentId:a}:{}});if(s.length===0){console.log("no sandboxes found");return}for(let d of s)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():"",a=typeof r.agentId=="string"?r.agentId.trim():"",s=await i.costs({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{agentId:a}:{}});if(g(r.summary)){console.log(JSON.stringify({costs:{teamId:s.costs.teamId,ownerUserId:s.costs.ownerUserId,generatedAt:s.costs.generatedAt,summary:s.costs.summary,lineItems:s.costs.lineItems,tiers:s.costs.pricing.tiers.map(d=>({key:d.key,resources:d.resources,keepRunningEstimate:d.keepRunningEstimate}))}},null,2));return}console.log(JSON.stringify(s,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():"",a=typeof r.agentId=="string"?r.agentId.trim():"",s=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():"",l=typeof r.useCase=="string"?r.useCase.trim():"",f=typeof r.replayState=="string"?r.replayState.trim():"",u=await i.snapshotCatalog({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{agentId:a}:{},...s?{q:s}:{},...d?{tag:d}:{},...l?{useCase:l}:{},...f==="draft"||f==="validated"||f==="published"?{replayState:f}:{}});if(u.snapshots.length===0){console.log("no sandbox snapshots found");return}for(let p of u.snapshots)console.log(J(p));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():"",a=typeof r.query=="string"&&r.query.trim()?r.query.trim():typeof r.q=="string"&&r.q.trim()?r.q.trim():"",s=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():"",l=typeof r.tag=="string"?r.tag.trim():"",f=typeof r.useCase=="string"?r.useCase.trim():"",u=await i.publishedSnapshots({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{q:a}:{},...s?{name:s}:{},...d?{version:d}:{},...l?{tag:l}:{},...f?{useCase:f}:{}});if(u.publishedSnapshots.length===0){console.log("no published snapshots found");return}for(let p of u.publishedSnapshots)console.log(j(p));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():"",a=typeof r.snapshotId=="string"&&r.snapshotId.trim()?r.snapshotId.trim():typeof r.snapshot=="string"&&r.snapshot.trim()?r.snapshot.trim():"",s=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():"",l=typeof r.useCase=="string"?r.useCase.trim():"";if(!a&&!s&&!l)throw new Error("usage: sandbox run-published-snapshot [--snapshot-id <id>|--name <name>|--use-case <id>] [--version <v>]");let f=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}:{},...a?{snapshotId:a}:{},...s?{templateName:s}:{},...d?{version:d}:{},...l?{useCase:l}:{},...f?{budget:{maxUsd:f}}:{},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():"",a=typeof r.projectId=="string"?r.projectId.trim():"",s=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}:{},...a?{projectId:a}:{},...s?{budget:{maxUsd:s}}:{},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,M(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 a=R(r.cleanup),s=await i.validateSnapshot(t,n,{...a?{cleanup:a}:{}});console.log(JSON.stringify(s,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 a=await i.publishSnapshot(t,n);console.log(JSON.stringify(a,null,2));return}if(e==="integration-connections"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",a=typeof r.agentId=="string"?r.agentId.trim():"",s=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}:{},...a?{agentId:a}:{},...s?{status:s}:{}});console.log(JSON.stringify(d,null,2));return}if(e==="create"){let t=await N(i,B(r));console.log(JSON.stringify({sandbox:c(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 a=m(r.timeoutSeconds,"timeout-seconds"),s=await i.exec(t,{command:n.trim(),...a!==void 0?{timeoutSeconds:a}:{}});console.log(JSON.stringify({sandbox:c(s.sandbox),command:s.command},null,2));return}if(e==="port"||e==="preview"){let t=o[1],n=m(r.port,"port");if(!t||n===void 0)throw new Error("usage: sandbox port <sandboxId> --port <port>");let a=typeof r.label=="string"?r.label:void 0,s=typeof r.access=="string"?r.access.trim():"";if(s&&s!=="private"&&s!=="public")throw new Error("sandbox port --access must be private or public");let d=s==="public"?"public":"private",l=typeof r.domain=="string"?r.domain.trim():"",f=typeof r.authToken=="string"?r.authToken:"",u=typeof r.authHeader=="string"?r.authHeader.trim():"",p=typeof r.authHeaderValue=="string"?r.authHeaderValue:"";if(f&&(u||p))throw new Error("sandbox port auth options must use either --auth-token or --auth-header with --auth-header-value");if(u&&!p||!u&&p)throw new Error("sandbox port custom header auth requires both --auth-header and --auth-header-value");let x=await i.openPort(t,{port:n,...a?{label:a}:{},access:d,...r["auto-start"]||r.autoStart?{autoStart:!0}:{},...l?{customDomain:l}:{},...f?{authPolicy:{mode:"bearer",token:f}}:{},...u&&p?{authPolicy:{mode:"header",headerName:u,headerValue:p}}:{}});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:g(r.failOnUnpreservedChanges),async:z(r)});console.log(JSON.stringify({sandbox:c(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:g(r.failOnUnpreservedChanges),async:z(r)});console.log(JSON.stringify({sandbox:c(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 a of n)console.log(a);return}if(!(await F(i,e,r,o)||await U(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:c(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:c(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:c(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 a=await i.removeIntegrationLease(t,n);console.log(JSON.stringify({sandbox:c(a.sandbox),integrationLeases:a.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,a=g(r.keep),s=r.preview!==void 0?g(r.preview):!g(r.noPreview),d=g(r.snapshot),l=g(r.fork),f={...t?{repo:t}:{},...n?{budgetUsd:n}:{},keep:a,preview:s,snapshot:d,fork:l};typeof r.expectedMppMode=="string"&&r.expectedMppMode.trim()&&(f.expectedMppMode=r.expectedMppMode.trim());let u=h(r.cpu,"cpu"),p=h(r.memoryGb,"memory-gb"),x=h(r.diskGb,"disk-gb");u!==void 0&&(f.cpu=u),p!==void 0&&(f.memoryGb=p),x!==void 0&&(f.diskGb=x);let G=await i.smoke(f);console.log(JSON.stringify(G,null,2));return}throw new Error("usage: sandbox <list|get|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(Ce,"runSandboxCommand");export{Ce as runSandboxCommand};
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 L,n as M,o as c}from"./chunk-U456UP3N.js";import{m as v,s as w,t as y}from"./chunk-VSQXDS6H.js";import"./chunk-SXMR6E2W.js";import"./chunk-7JBB4PXS.js";import"./chunk-UC3FXTDL.js";import"./chunk-XRKFTPHD.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{b as I,f as g,g as h,h as m}from"./chunk-3M53YXEI.js";import"./chunk-MILEWROZ.js";import"./chunk-NOSBNHGC.js";import"./chunk-JX6OX6XE.js";import"./chunk-BT5YNE5U.js";import"./chunk-UTNGEMW5.js";import"./chunk-QCSLEMZF.js";import"./chunk-B42QQUZY.js";import"./chunk-7KTARW23.js";import"./chunk-GLUWATL5.js";import"./chunk-OSVGNONV.js";import"./chunk-XWDFXM3S.js";import"./chunk-YBNKGA5C.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-JCLTFDVW.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-2EPR4HLF.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as b}from"./chunk-FTQLQJQV.js";import{readFile as D,stat as _}from"node:fs/promises";async function U(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,a=h(e.maxEntries,"max-entries"),s=e.recursive!==void 0?g(e.recursive):void 0,d=await r.listFiles(t,{...n?{path:n}:{},...s!==void 0?{recursive:s}:{},...a!==void 0?{maxEntries:a}:{}});return console.log(JSON.stringify({sandbox:c(d.sandbox),files:d.files},null,2)),!0}if(o==="upload-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"",a=typeof e.contents=="string"?e.contents:typeof e.content=="string"?e.content:"",s=typeof e.contentsBase64=="string"?e.contentsBase64.trim():typeof e.contentBase64=="string"?e.contentBase64.trim():"",d=typeof e.fromPath=="string"?e.fromPath.trim():"";if(!t||!n)throw new Error('usage: sandbox upload-file <sandboxId> --path <path> --contents "text"');if(d){if(a||s)throw new Error("Choose --from-path or inline contents for the upload.");let f=await _(d);if(!f.isFile()||f.size>10*1024*1024)throw new Error("Sandbox upload requires a file within 10 MiB.");let u=await D(d);if(u.byteLength>10*1024*1024)throw new Error("Sandbox upload file changed beyond 10 MiB.");s=u.toString("base64")}if(!a&&!s)throw new Error('usage: sandbox upload-file <sandboxId> --path <path> --contents "text"');let l=s?await r.uploadFileBase64(t,n,s):await r.uploadFile(t,n,a);return console.log(JSON.stringify({sandbox:c(l.sandbox),file:l.file},null,2)),!0}if(o==="download-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"",a=m(e.offsetBytes,"offset-bytes"),s=m(e.maxBytes,"max-bytes");if(!t||!n)throw new Error("usage: sandbox download-file <sandboxId> --path <path>");let d=await r.downloadFileResponse(t,{path:n,...a!==void 0?{offsetBytes:a}:{},...s!==void 0?{maxBytes:s}:{}});return console.log(JSON.stringify({sandbox:c(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 a=typeof e.path=="string"?e.path.trim():void 0,s=h(e.maxResults,"max-results"),d=await r.searchFiles(t,{query:n,...a?{path:a}:{},...s!==void 0?{maxResults:s}:{}});return console.log(JSON.stringify({sandbox:c(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 a=await r.deleteFile(t,n,{recursive:g(e.recursive)});return console.log(JSON.stringify({sandbox:c(a.sandbox),deleted:a.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 a=await r.statFile(t,n);return console.log(JSON.stringify({sandbox:c(a.sandbox),file:a.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 a=await r.mkdir(t,{path:n,recursive:e.recursive!==void 0?g(e.recursive):void 0});return console.log(JSON.stringify({sandbox:c(a.sandbox),directory:a.directory},null,2)),!0}if(o==="move-file"){let t=i[1],n=typeof e.fromPath=="string"?e.fromPath.trim():"",a=typeof e.toPath=="string"?e.toPath.trim():"";if(!t||!n||!a)throw new Error("usage: sandbox move-file <sandboxId> --from-path <path> --to-path <path> [--overwrite]");let s=await r.moveFile(t,{fromPath:n,toPath:a,overwrite:g(e.overwrite)});return console.log(JSON.stringify({sandbox:c(s.sandbox),moved:s.moved,file:s.file},null,2)),!0}return!1}b(U,"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:c(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,a=await r.gitDiff(t,{...n?{baseRef:n}:{}});return console.log(JSON.stringify({sandbox:c(a.sandbox),diff:a.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,a=await r.gitExportPatch(t,{...n?{baseRef:n}:{}});return console.log(JSON.stringify({sandbox:c(a.sandbox),patch:a.patch},null,2)),!0}if(o==="git-branch"){let t=i[1],n=typeof e.branch=="string"?e.branch.trim():"",a=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 s=await r.gitBranch(t,{branch:n,create:g(e.create),...a?{startPoint:a}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),branch:s.branch},null,2)),!0}if(o==="git-commit"){let t=i[1],n=typeof e.message=="string"?e.message.trim():"",a=g(e.all),d=(typeof e.paths=="string"?e.paths:typeof e.path=="string"?e.path:"").split(",").map(f=>f.trim()).filter(Boolean);if(!t||!n||!a&&d.length===0)throw new Error('usage: sandbox git-commit <sandboxId> --message "..." [--all|--paths <csv>]');let l=await r.gitCommit(t,{message:n,...a?{all:!0}:{paths:d}});return console.log(JSON.stringify({sandbox:c(l.sandbox),commit:l.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,a=typeof e.branch=="string"&&e.branch.trim()?e.branch.trim():void 0,s=await r.gitPull(t,{...n?{remote:n}:{},...a?{branch:a}:{},...e.rebase!==void 0?{rebase:g(e.rebase)}:{},...e.ffOnly!==void 0?{ffOnly:g(e.ffOnly)}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),pull:s.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,a=typeof e.branch=="string"&&e.branch.trim()?e.branch.trim():void 0,s=await r.gitPush(t,{...n?{remote:n}:{},...a?{branch:a}:{},...e.setUpstream!==void 0?{setUpstream:g(e.setUpstream)}:{},...e.forceWithLease!==void 0?{forceWithLease:g(e.forceWithLease)}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),push:s.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 a=m(e.timeoutSeconds,"timeout-seconds"),s=await r.startProcess(t,{command:n.trim(),...a!==void 0?{timeoutSeconds:a}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),process:s.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:c(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 a=m(e.since,"since"),s=await r.getProcess(t,n,{...a!==void 0?{since:a}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),process:s.process,output:s.output,cursor:s.cursor,completed:s.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 a=await r.stopProcess(t,n);return console.log(JSON.stringify({sandbox:c(a.sandbox),process:a.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 a=m(e.since,"since");return await r.streamProcessOutput(t,n,{...a!==void 0?{since:a}:{}}),!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(" "),a=m(e.timeoutSeconds,"timeout-seconds"),s=m(e.rows,"rows"),d=m(e.cols,"cols"),l=await r.startPty(t,{...n.trim()?{command:n.trim()}:{},...a!==void 0?{timeoutSeconds:a}:{},...s!==void 0?{rows:s}:{},...d!==void 0?{cols:d}:{}});return console.log(JSON.stringify({sandbox:c(l.sandbox),pty:l.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:c(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 a=m(e.since,"since"),s=await r.getPty(t,n,{...a!==void 0?{since:a}:{}});return console.log(JSON.stringify({sandbox:c(s.sandbox),pty:s.pty,output:s.output,cursor:s.cursor,completed:s.completed},null,2)),!0}if(o==="pty-write"){let t=i[1],n=i[2],a=typeof e.inputBase64=="string"?e.inputBase64.trim():"",s=(typeof e.input=="string"?e.input:null)||i.slice(3).join(" ");if(!t||!n||!a&&!s)throw new Error("usage: sandbox pty-write <sandboxId> <ptyId> --input <text>");let d=await r.writePtyInput(t,n,a?{dataBase64:a}:s);return console.log(JSON.stringify({sandbox:c(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 a=await r.stopPty(t,n);return console.log(JSON.stringify({sandbox:c(a.sandbox),pty:a.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 a=m(e.since,"since");return await r.streamPtyOutput(t,n,{...a!==void 0?{since:a}:{}}),!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():"",a=await r.listReplays({...t?{teamId:t}:{},...n?{projectId:n}:{}});if(g(e.json))return console.log(JSON.stringify(a,null,2)),!0;if(a.replays.length===0)return console.log("no sandbox replays found"),!0;for(let s of a.replays)console.log(O(s));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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.getReplay(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});return console.log(JSON.stringify(s,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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.getReplayLogs(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});for(let d of s.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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.getReplayArtifacts(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});return console.log(JSON.stringify({replayId:s.replayId,artifacts:s.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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.cancelReplay(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});return console.log(JSON.stringify(s,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():"",a=typeof e.projectId=="string"?e.projectId.trim():"",s=m(e.intervalMs,"interval-ms")??5e3,d=m(e.timeoutMs,"timeout-ms")??900*1e3,l=Date.now(),f=new Set;for(;Date.now()-l<=d;){let u=await r.getReplay(t,{...n?{teamId:n}:{},...a?{projectId:a}:{}});for(let p of u.replay.logs)f.has(p)||(f.add(p),console.log(p));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(p=>setTimeout(p,s))}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():"",a=typeof e.agentId=="string"?e.agentId.trim():"",s=await r.listSandboxRuntimes({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{agentId:a}:{}});return console.log(JSON.stringify({runtimes:s},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():"",a=Number(e.expectedVersion),s=typeof e.summary=="string"&&e.summary.trim()?e.summary.trim():void 0;if(!t||!n||!Number.isInteger(a))throw new Error("usage: sandbox runtime-status <runtimeId> --status <status> --expected-version <n>");let d=await r.updateSandboxRuntimeStatus(t,{status:n,expectedVersion:a,...s?{summary:s}:{}});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():"",a=typeof e.summary=="string"&&e.summary.trim()?e.summary.trim():void 0,s=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,...a?{summary:a}:{},...s?{payload:s}:{},...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():"",a=typeof e.sandboxId=="string"&&e.sandboxId.trim()?e.sandboxId.trim():"",s=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,{...a?{sandboxId:a}:{},...s?{message:s}:{}},{...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(g(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 a of n)console.log(`${a.name} ${a.status} v${a.currentVersion??"current"} ${a.secretRef}`);return!0}if(o==="secret-create"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=typeof e.name=="string"?e.name.trim():"",a=typeof e.description=="string"&&e.description.trim()?e.description.trim():void 0,s=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}`),l=await r.createSecret({...t?{teamId:t}:{},name:n,value:d,...a?{description:a}:{},...s?{scope:s}:{}});return console.log(JSON.stringify({secret:y(l)},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 a=await w(e,"New secret value"),s=await r.rotateSecret(t,{...n?{teamId:n}:{},value:a});return console.log(JSON.stringify({secret:y(s)},null,2)),!0}if(o==="secret-attach"){let t=i[1],n=typeof e.teamId=="string"?e.teamId.trim():"",a=typeof e.envName=="string"?e.envName.trim():"",s=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||!a||!s||!d)throw new Error("usage: sandbox secret-attach <secretId> --env-name <ENV_NAME> --target-type sandbox|project|agent|template|replay --target-id <id>");let l=await r.attachSecret(t,{...n?{teamId:n}:{},envName:a,targetType:s,targetId:d});return console.log(JSON.stringify({secret:y(l)},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 a=o==="secret-revoke"?await r.revokeSecret(t,{...n?{teamId:n}:{}}):await r.deleteSecret(t,{...n?{teamId:n}:{}});return console.log(JSON.stringify({secret:y(a)},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(g(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 a of n)console.log(S(a));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(L(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(g(e.json))return console.log(JSON.stringify(n,null,2)),!0;for(let a of n.logs)console.log(a);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=m(e.intervalMs,"interval-ms")??5e3,a=m(e.timeoutMs,"timeout-ms")??900*1e3,s=Date.now(),d=new Set;for(;Date.now()-s<=a;){let[l,f]=await Promise.all([r.getPublishedSnapshotBuild(t),r.getPublishedSnapshotBuildLogs(t)]);for(let u of f.logs)d.has(u)||(d.add(u),console.log(u));if(l.status==="succeeded"||l.status==="failed"||l.status==="cancelled"){if(console.log(S(l)),l.status!=="succeeded")throw new Error(`published snapshot build ${l.status}: ${l.error??"no error"}`);return!0}await new Promise(u=>setTimeout(u,n))}throw new Error(`published snapshot build did not finish within ${a}ms`)}return!1}b(H,"handleSandboxTemplateBuildsCommand");function z(r){return g(r.async)||g(r.respondAsync)}b(z,"parseSandboxAsyncOption");async function Ce(r,o){let e=o[0]||"list",i=await v(r);if(e==="get"){let t=o[1];if(!t||o.length!==2)throw new Error("usage: sandbox get <sandboxId>");console.log(JSON.stringify({sandbox:await i.get(t)},null,2));return}if(e==="list"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",a=typeof r.agentId=="string"?r.agentId.trim():"",s=await i.list({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{agentId:a}:{}});if(s.length===0){console.log("no sandboxes found");return}for(let d of s)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():"",a=typeof r.agentId=="string"?r.agentId.trim():"",s=await i.costs({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{agentId:a}:{}});if(g(r.summary)){console.log(JSON.stringify({costs:{teamId:s.costs.teamId,ownerUserId:s.costs.ownerUserId,generatedAt:s.costs.generatedAt,summary:s.costs.summary,lineItems:s.costs.lineItems,tiers:s.costs.pricing.tiers.map(d=>({key:d.key,resources:d.resources,keepRunningEstimate:d.keepRunningEstimate}))}},null,2));return}console.log(JSON.stringify(s,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():"",a=typeof r.agentId=="string"?r.agentId.trim():"",s=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():"",l=typeof r.useCase=="string"?r.useCase.trim():"",f=typeof r.replayState=="string"?r.replayState.trim():"",u=await i.snapshotCatalog({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{agentId:a}:{},...s?{q:s}:{},...d?{tag:d}:{},...l?{useCase:l}:{},...f==="draft"||f==="validated"||f==="published"?{replayState:f}:{}});if(u.snapshots.length===0){console.log("no sandbox snapshots found");return}for(let p of u.snapshots)console.log(J(p));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():"",a=typeof r.query=="string"&&r.query.trim()?r.query.trim():typeof r.q=="string"&&r.q.trim()?r.q.trim():"",s=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():"",l=typeof r.tag=="string"?r.tag.trim():"",f=typeof r.useCase=="string"?r.useCase.trim():"",u=await i.publishedSnapshots({...t?{teamId:t}:{},...n?{projectId:n}:{},...a?{q:a}:{},...s?{name:s}:{},...d?{version:d}:{},...l?{tag:l}:{},...f?{useCase:f}:{}});if(u.publishedSnapshots.length===0){console.log("no published snapshots found");return}for(let p of u.publishedSnapshots)console.log(j(p));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():"",a=typeof r.snapshotId=="string"&&r.snapshotId.trim()?r.snapshotId.trim():typeof r.snapshot=="string"&&r.snapshot.trim()?r.snapshot.trim():"",s=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():"",l=typeof r.useCase=="string"?r.useCase.trim():"";if(!a&&!s&&!l)throw new Error("usage: sandbox run-published-snapshot [--snapshot-id <id>|--name <name>|--use-case <id>] [--version <v>]");let f=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}:{},...a?{snapshotId:a}:{},...s?{templateName:s}:{},...d?{version:d}:{},...l?{useCase:l}:{},...f?{budget:{maxUsd:f}}:{},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():"",a=typeof r.projectId=="string"?r.projectId.trim():"",s=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}:{},...a?{projectId:a}:{},...s?{budget:{maxUsd:s}}:{},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,M(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 a=R(r.cleanup),s=await i.validateSnapshot(t,n,{...a?{cleanup:a}:{}});console.log(JSON.stringify(s,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 a=await i.publishSnapshot(t,n);console.log(JSON.stringify(a,null,2));return}if(e==="integration-connections"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",a=typeof r.agentId=="string"?r.agentId.trim():"",s=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}:{},...a?{agentId:a}:{},...s?{status:s}:{}});console.log(JSON.stringify(d,null,2));return}if(e==="create"){let t=await N(i,B(r));console.log(JSON.stringify({sandbox:c(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 a=m(r.timeoutSeconds,"timeout-seconds"),s=await i.exec(t,{command:n.trim(),...a!==void 0?{timeoutSeconds:a}:{}});console.log(JSON.stringify({sandbox:c(s.sandbox),command:s.command},null,2));return}if(e==="port"||e==="preview"){let t=o[1],n=m(r.port,"port");if(!t||n===void 0)throw new Error("usage: sandbox port <sandboxId> --port <port>");let a=typeof r.label=="string"?r.label:void 0,s=typeof r.access=="string"?r.access.trim():"";if(s&&s!=="private"&&s!=="public")throw new Error("sandbox port --access must be private or public");let d=s==="public"?"public":"private",l=typeof r.domain=="string"?r.domain.trim():"",f=typeof r.authToken=="string"?r.authToken:"",u=typeof r.authHeader=="string"?r.authHeader.trim():"",p=typeof r.authHeaderValue=="string"?r.authHeaderValue:"";if(f&&(u||p))throw new Error("sandbox port auth options must use either --auth-token or --auth-header with --auth-header-value");if(u&&!p||!u&&p)throw new Error("sandbox port custom header auth requires both --auth-header and --auth-header-value");let x=await i.openPort(t,{port:n,...a?{label:a}:{},access:d,...r["auto-start"]||r.autoStart?{autoStart:!0}:{},...l?{customDomain:l}:{},...f?{authPolicy:{mode:"bearer",token:f}}:{},...u&&p?{authPolicy:{mode:"header",headerName:u,headerValue:p}}:{}});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:g(r.failOnUnpreservedChanges),async:z(r)});console.log(JSON.stringify({sandbox:c(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:g(r.failOnUnpreservedChanges),async:z(r)});console.log(JSON.stringify({sandbox:c(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 a of n)console.log(a);return}if(!(await F(i,e,r,o)||await U(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:c(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:c(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:c(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 a=await i.removeIntegrationLease(t,n);console.log(JSON.stringify({sandbox:c(a.sandbox),integrationLeases:a.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,a=g(r.keep),s=r.preview!==void 0?g(r.preview):!g(r.noPreview),d=g(r.snapshot),l=g(r.fork),f={...t?{repo:t}:{},...n?{budgetUsd:n}:{},keep:a,preview:s,snapshot:d,fork:l};typeof r.expectedMppMode=="string"&&r.expectedMppMode.trim()&&(f.expectedMppMode=r.expectedMppMode.trim());let u=h(r.cpu,"cpu"),p=h(r.memoryGb,"memory-gb"),x=h(r.diskGb,"disk-gb");u!==void 0&&(f.cpu=u),p!==void 0&&(f.memoryGb=p),x!==void 0&&(f.diskGb=x);let G=await i.smoke(f);console.log(JSON.stringify(G,null,2));return}throw new Error("usage: sandbox <list|get|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(Ce,"runSandboxCommand");export{Ce 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-BNZTJPK7.js";import{m as he}from"./chunk-VBW2X42G.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-Q66LWQGF.js";import{c as oe}from"./chunk-TNHDD3LO.js";import"./chunk-HN2ZK6EV.js";import"./chunk-UJBEWIR3.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-TYHCBVQT.js";import"./chunk-VSUHJ46L.js";import"./chunk-FWIPHEVA.js";import"./chunk-BT5YNE5U.js";import{d as ae}from"./chunk-OJFDI7VM.js";import"./chunk-QCSLEMZF.js";import"./chunk-4RHM4WN2.js";import"./chunk-BLKTUFGB.js";import"./chunk-GLUWATL5.js";import"./chunk-OSVGNONV.js";import"./chunk-YBNKGA5C.js";import"./chunk-ZZWAQBA2.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-YR5ID2SS.js";import"./chunk-M6JRS5PA.js";import"./chunk-KCV5VN4X.js";import"./chunk-RV7PUSI2.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-KK626T3Z.js";import"./chunk-6DCXAXVD.js";import"./chunk-OE22TAXP.js";import"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.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}
2
+ import{a as Ee,o as Re}from"./chunk-U456UP3N.js";import{m as he}from"./chunk-4TM75R7V.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-VSQXDS6H.js";import{c as oe}from"./chunk-SXMR6E2W.js";import"./chunk-7JBB4PXS.js";import"./chunk-UC3FXTDL.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-MILEWROZ.js";import"./chunk-NOSBNHGC.js";import"./chunk-JX6OX6XE.js";import"./chunk-BT5YNE5U.js";import{d as ae}from"./chunk-UTNGEMW5.js";import"./chunk-QCSLEMZF.js";import"./chunk-B42QQUZY.js";import"./chunk-7KTARW23.js";import"./chunk-GLUWATL5.js";import"./chunk-OSVGNONV.js";import"./chunk-XWDFXM3S.js";import"./chunk-YBNKGA5C.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-JCLTFDVW.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.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-2EPR4HLF.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.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-HKV7RX5E.js";import"./chunk-UT6F6AIB.js";import"./chunk-RTJCELRR.js";import"./chunk-SYUKES6H.js";import"./chunk-VPDG2V2R.js";import"./chunk-GOIKLFXK.js";import"./chunk-MNFW5WLD.js";import"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import"./chunk-N5GPINVP.js";import"./chunk-TW3SRBLU.js";import"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-4N4EH3RJ.js";import"./chunk-HFJUXKT5.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-OSVGNONV.js";import"./chunk-XWDFXM3S.js";import"./chunk-YBNKGA5C.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-JCLTFDVW.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-2EPR4HLF.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.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-2VXL6AU3.js";import"./chunk-KVTBX2UP.js";import{g as s}from"./chunk-FJ3HMHT6.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};
2
+ import{a as o,f as i}from"./chunk-MNXNZDDW.js";import"./chunk-KVTBX2UP.js";import{g as s}from"./chunk-557XSPVS.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};
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
3
- import{q as wt,s as Tt}from"./chunk-ZBBVRYU3.js";import{h as St}from"./chunk-UBCLPZSQ.js";import{i as ge,j as vt,l as he}from"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-LNRFRAV5.js";import"./chunk-2ITZW2CN.js";import"./chunk-CQF6QZEL.js";import"./chunk-D5ADDBS5.js";import"./chunk-QRJPLZF7.js";import"./chunk-PWK5Z5S3.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-OZ6LRNRE.js";import"./chunk-IDOGNIMV.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-TMMFF6DO.js";import"./chunk-BQUWZRWU.js";import"./chunk-BFKYRQMA.js";import"./chunk-SGK4GR44.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-CM5USMXN.js";import"./chunk-WFVOG5PU.js";import"./chunk-XGY4OQLC.js";import"./chunk-VWJ5IYQP.js";import"./chunk-E67M5WGY.js";import"./chunk-PCB65K4G.js";import"./chunk-4N3UF3U5.js";import"./chunk-HZLV773Y.js";import"./chunk-M4ZRCRJM.js";import"./chunk-VNJAAYNQ.js";import"./chunk-XK7SPL63.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-YR5ID2SS.js";import"./chunk-M6JRS5PA.js";import"./chunk-KCV5VN4X.js";import"./chunk-RV7PUSI2.js";import"./chunk-6FA3GG5B.js";import"./chunk-KK626T3Z.js";import{D as Je,E as re,G as ft,I as gt,L as ht,O as yt}from"./chunk-6DCXAXVD.js";import"./chunk-OE22TAXP.js";import{f as pt,h as mt}from"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as i}from"./chunk-FTQLQJQV.js";import{createInterface as oo}from"node:readline/promises";import{stdin as He,stdout as R}from"node:process";import{pathToFileURL as io}from"node:url";function ve(){return{text:"",cursor:0,history:[],historyIndex:null}}i(ve,"createComposer");function bt(e,t){let r=e.text.slice(0,e.cursor),n=e.text.slice(e.cursor);return{...e,text:`${r}${t}${n}`,cursor:e.cursor+t.length,historyIndex:null}}i(bt,"insertText");function ye(e,t){return{...e,text:t,cursor:t.length}}i(ye,"replaceComposerText");function Rr(e){let t=e.text.trim();return t?{state:{text:"",cursor:0,history:[...e.history.filter(r=>r!==t),t].slice(-100),historyIndex:null},action:{type:"submit",text:t}}:{state:{...e,text:"",cursor:0,historyIndex:null},action:{type:"none"}}}i(Rr,"submitComposer");function Pt(e,t){if(t==="ctrl+c")return{state:e,action:{type:"cancel-or-exit"}};if(t==="ctrl+d")return{state:e,action:e.text?{type:"none"}:{type:"exit"}};if(t==="ctrl+l")return{state:e,action:{type:"rerender"}};if(t==="enter")return Rr(e);if(t==="alt+enter")return{state:bt(e,`
3
+ import{q as wt,s as Tt}from"./chunk-MNFW5WLD.js";import{h as St}from"./chunk-TUCKED4T.js";import{i as ge,j as vt,l as he}from"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import"./chunk-N5GPINVP.js";import"./chunk-TW3SRBLU.js";import"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-4N4EH3RJ.js";import"./chunk-HFJUXKT5.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-JCLTFDVW.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-2EPR4HLF.js";import{D as Je,E as re,G as ft,I as gt,L as ht,O as yt}from"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import{f as pt,h as mt}from"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as i}from"./chunk-FTQLQJQV.js";import{createInterface as oo}from"node:readline/promises";import{stdin as He,stdout as R}from"node:process";import{pathToFileURL as io}from"node:url";function ve(){return{text:"",cursor:0,history:[],historyIndex:null}}i(ve,"createComposer");function bt(e,t){let r=e.text.slice(0,e.cursor),n=e.text.slice(e.cursor);return{...e,text:`${r}${t}${n}`,cursor:e.cursor+t.length,historyIndex:null}}i(bt,"insertText");function ye(e,t){return{...e,text:t,cursor:t.length}}i(ye,"replaceComposerText");function Rr(e){let t=e.text.trim();return t?{state:{text:"",cursor:0,history:[...e.history.filter(r=>r!==t),t].slice(-100),historyIndex:null},action:{type:"submit",text:t}}:{state:{...e,text:"",cursor:0,historyIndex:null},action:{type:"none"}}}i(Rr,"submitComposer");function Pt(e,t){if(t==="ctrl+c")return{state:e,action:{type:"cancel-or-exit"}};if(t==="ctrl+d")return{state:e,action:e.text?{type:"none"}:{type:"exit"}};if(t==="ctrl+l")return{state:e,action:{type:"rerender"}};if(t==="enter")return Rr(e);if(t==="alt+enter")return{state:bt(e,`
4
4
  `),action:{type:"none"}};if(t==="backspace")return e.cursor<=0?{state:e,action:{type:"none"}}:{state:{...e,text:`${e.text.slice(0,e.cursor-1)}${e.text.slice(e.cursor)}`,cursor:e.cursor-1},action:{type:"none"}};if(t==="delete")return e.cursor>=e.text.length?{state:e,action:{type:"none"}}:{state:{...e,text:`${e.text.slice(0,e.cursor)}${e.text.slice(e.cursor+1)}`},action:{type:"none"}};if(t==="left")return{state:{...e,cursor:Math.max(0,e.cursor-1)},action:{type:"none"}};if(t==="right")return{state:{...e,cursor:Math.min(e.text.length,e.cursor+1)},action:{type:"none"}};if(t==="home"||t==="ctrl+a")return{state:{...e,cursor:0},action:{type:"none"}};if(t==="end"||t==="ctrl+e")return{state:{...e,cursor:e.text.length},action:{type:"none"}};if(t==="ctrl+u")return{state:{...e,text:e.text.slice(e.cursor),cursor:0},action:{type:"none"}};if(t==="ctrl+k")return{state:{...e,text:e.text.slice(0,e.cursor)},action:{type:"none"}};if(t==="up"){if(e.history.length===0)return{state:e,action:{type:"none"}};let r=e.historyIndex===null?e.history.length-1:Math.max(0,e.historyIndex-1);return{state:ye({...e,historyIndex:r},e.history[r]??""),action:{type:"none"}}}if(t==="down"){if(e.historyIndex===null)return{state:e,action:{type:"none"}};let r=e.historyIndex+1;return r>=e.history.length?{state:{...e,text:"",cursor:0,historyIndex:null},action:{type:"none"}}:{state:ye({...e,historyIndex:r},e.history[r]??""),action:{type:"none"}}}return t.length>0?{state:bt(e,t),action:{type:"none"}}:{state:e,action:{type:"none"}}}i(Pt,"handleComposerKey");var xt="A turn is already running. Wait for it to finish before sending another line.";function Mr(){let e=!1;return{isRunning(){return e},tryStartSubmission(){return e?!1:(e=!0,!0)},failSubmission(){e=!1},applyRuntimeEvent(t){t.name==="turn.started"&&(e=!0),(t.name==="turn.completed"||t.name==="turn.failed"||t.name==="turn.interrupted")&&(e=!1)}}}i(Mr,"createTerminalTurnSubmissionGuard");function Ct(){return Mr()}i(Ct,"createLineModeTurnGuard");var Se=[{name:"help",usage:"/help",description:"show this help"},{name:"providers",usage:"/providers",description:"list providers"},{name:"provider",usage:"/provider [id]",description:"switch provider",requiresArgument:!0},{name:"model",usage:"/model [id]",description:"list or switch model"},{name:"apps",usage:"/apps",description:"list connectable apps"},{name:"install",usage:"/install <app>",description:"open app details",requiresArgument:!0},{name:"projects",usage:"/projects",description:"list projects"},{name:"project",usage:"/project <id>",description:"switch project",requiresArgument:!0},{name:"permissions",usage:"/permissions [ask|full-access]",description:"show or change command access"},{name:"profile",usage:"/profile [status|diff|catalog|check|push]",description:"show or sync profile"},{name:"agents",usage:"/agents",description:"list agents"},{name:"agent",usage:"/agent <id>",description:"select agent",requiresArgument:!0},{name:"run",usage:"/run <action> [json]",description:"run profile action",requiresArgument:!0},{name:"settings",usage:"/settings",description:"show settings"},{name:"logs",usage:"/logs",description:"show recent events"},{name:"compact",usage:"/compact",description:"compact current session"},{name:"clear",usage:"/clear",description:"clear terminal transcript"},{name:"exit",usage:"/exit",description:"exit"},{name:"hooks",usage:"/hooks",description:"show hook status"},{name:"start",usage:"/start",description:"start a new session"}];function Ke(e){if(!e.startsWith("/"))return null;let[t="",...r]=e.slice(1).trim().split(/\s+/),n=t.toLowerCase();if(!n)return null;if(n==="exit"||n==="quit")return{type:"exit"};if(n==="help")return{type:"help"};if(n==="clear")return{type:"clear"};if(n==="agents")return{type:"agents"};if(n==="apps")return{type:"apps"};if(n==="agent")return{type:"agent",id:r.join(" ").trim()};if(n==="install")return{type:"install",id:r.join(" ").trim()};if(n==="projects")return{type:"projects"};if(n==="project")return{type:"project",id:r.join(" ").trim()};if(n==="model")return{type:"model",id:r.join(" ").trim()||null};if(n==="permissions")return{type:"permissions",args:r};if(n==="profile")return{type:"profile",args:r};if(n==="logs")return{type:"logs"};if(n==="providers")return{type:"providers"};if(n==="provider")return{type:"provider",id:r.join(" ").trim()||null};if(n==="compact")return{type:"compact"};if(n==="hooks")return{type:"hooks"};if(n==="start")return{type:"start"};if(n==="run"){let o=r[0]??"",s=r.slice(1).join(" ").trim();return s?{type:"run",action:o,input:JSON.parse(s)}:{type:"run",action:o,input:void 0}}return n==="settings"?{type:"settings",args:r}:{type:"unknown",command:n}}i(Ke,"parseSlashCommand");function It(e){let t=e.trim();if(!t.startsWith("!"))return null;let r=t.slice(1).trim();return r?{command:r}:null}i(It,"parseDirectCommandPrompt");function At(){let e=Math.max(...Se.map(t=>t.usage.length));return["Commands:",...Se.map(t=>`${t.usage.padEnd(e+2)}${t.description}`)].join(`
5
5
  `)}i(At,"helpText");var we=class{static{i(this,"RawInput")}input;onKey;previousRawMode=!1;dataHandler=null;constructor(t,r){this.input=t,this.onKey=r}start(){this.previousRawMode=this.input.isRaw??!1,this.input.setRawMode(!0),this.input.resume(),this.dataHandler=t=>{for(let r of Or(t))this.onKey(r)},this.input.on("data",this.dataHandler)}stop(){this.dataHandler&&this.input.off("data",this.dataHandler),this.dataHandler=null,this.input.setRawMode(this.previousRawMode),this.input.pause()}};function Or(e){let t=e.toString("utf8"),r=[];for(let n=0;n<t.length;n+=1){let o=t[n],s=t[n+1];if(o==="\x1B"){let a=jr(t,n);r.push(a.key),n=a.end;continue}o===""?r.push("ctrl+c"):o===""?r.push("ctrl+d"):o==="\f"?r.push("ctrl+l"):o===""?r.push("ctrl+a"):o===""?r.push("ctrl+e"):o==="\v"?r.push("ctrl+k"):o===""?r.push("ctrl+u"):o==="\x7F"||o==="\b"?r.push("backspace"):o==="\r"||o===`
6
6
  `?r.push("enter"):(o>=" "||o&&s)&&r.push(o)}return r}i(Or,"decodeKeys");function jr(e,t){let r=e.slice(t);return r.startsWith("\x1B\r")||r.startsWith(`\x1B