openpond 0.2.67 → 0.2.68
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.
- package/dist/app-server.d.ts +668 -1
- package/dist/app-server.js +1 -1
- package/dist/chunks/{account-context-TIJOM22A.js → account-context-MWB6HN6I.js} +1 -1
- package/dist/chunks/{acp-NASAJV5E.js → acp-2OIXATRY.js} +1 -1
- package/dist/chunks/{acp-agent-C3CRF6DT.js → acp-agent-PAGX2B47.js} +1 -1
- package/dist/chunks/actions-command-2VE6YI4W.js +2 -0
- package/dist/chunks/{app-layer-XIEZ6ALX.js → app-layer-YNEUEOEP.js} +1 -1
- package/dist/chunks/{app-server-connected-apps-IB6M35NS.js → app-server-connected-apps-TZOAUOYR.js} +1 -1
- package/dist/chunks/app-server-evaluations-RRLYWLPK.js +2 -0
- package/dist/chunks/app-server-harness-services-XXM336NU.js +2 -0
- package/dist/chunks/app-server-runtime-GBX65JJ7.js +2 -0
- package/dist/chunks/apps-RSFEJOQN.js +2 -0
- package/dist/chunks/chunk-2PXKSAG6.js +2 -0
- package/dist/chunks/{chunk-XEU4J4GJ.js → chunk-2TGHZXJE.js} +2 -2
- package/dist/chunks/{chunk-AXO6OHJB.js → chunk-3A2Y7UK3.js} +1 -1
- package/dist/chunks/chunk-3Z4VM2LF.js +4 -0
- package/dist/chunks/{chunk-V3T2OJBZ.js → chunk-4BUM6JEC.js} +2 -2
- package/dist/chunks/chunk-4G3GTEVS.js +23 -0
- package/dist/chunks/{chunk-43QYVOYA.js → chunk-4KNPCJR4.js} +1 -1
- package/dist/chunks/chunk-4KTGYHCE.js +2 -0
- package/dist/chunks/chunk-4PUOWSDE.js +13 -0
- package/dist/chunks/chunk-55YD4UTW.js +2 -0
- package/dist/chunks/chunk-5G7BQAUA.js +2 -0
- package/dist/chunks/chunk-65FJWWXG.js +2 -0
- package/dist/chunks/{chunk-4EZI4KCT.js → chunk-65WRWLUD.js} +1 -1
- package/dist/chunks/chunk-6D3FI2XT.js +2 -0
- package/dist/chunks/chunk-73TW6BKK.js +6 -0
- package/dist/chunks/{chunk-5TPYBXWM.js → chunk-7NCM6GBN.js} +1 -1
- package/dist/chunks/chunk-7OFD6TFD.js +2 -0
- package/dist/chunks/chunk-7OKZCJHS.js +3 -0
- package/dist/chunks/{chunk-ADOCQA4D.js → chunk-7PKDJHT6.js} +1 -1
- package/dist/chunks/chunk-7RJOCGQ6.js +2 -0
- package/dist/chunks/{chunk-YR5URT73.js → chunk-7RSQOC5M.js} +3 -3
- package/dist/chunks/{chunk-FVK4W27G.js → chunk-AFH462DO.js} +1 -1
- package/dist/chunks/{chunk-GUG2SWRZ.js → chunk-AFKFN25T.js} +1 -1
- package/dist/chunks/chunk-AFYYIJ6K.js +2 -0
- package/dist/chunks/{chunk-U3MVH2YT.js → chunk-APKXXAUF.js} +1 -1
- package/dist/chunks/chunk-AQUZCWM3.js +2 -0
- package/dist/chunks/chunk-AUO5DCEU.js +2 -0
- package/dist/chunks/chunk-AYOMVI7J.js +2 -0
- package/dist/chunks/{chunk-RWRKUO5D.js → chunk-B66QCXH2.js} +1 -1
- package/dist/chunks/{chunk-SODAOLAP.js → chunk-BHKXPWFB.js} +1 -1
- package/dist/chunks/chunk-BU6MW65V.js +10 -0
- package/dist/chunks/{chunk-P6NQYXN6.js → chunk-CCZ276IA.js} +1 -1
- package/dist/chunks/{chunk-YONDU5TN.js → chunk-CIZI6Z7D.js} +1 -1
- package/dist/chunks/{chunk-ATFV2NA4.js → chunk-CO23RRN7.js} +1 -1
- package/dist/chunks/{chunk-QAFXQHHG.js → chunk-D6L6UNUQ.js} +2 -2
- package/dist/chunks/chunk-DDOIPTOM.js +2 -0
- package/dist/chunks/{chunk-CSU7RDA5.js → chunk-DKOVZ6R2.js} +3 -3
- package/dist/chunks/chunk-DRLP7GIU.js +2 -0
- package/dist/chunks/{chunk-DAEUVT2I.js → chunk-DRTHKWHK.js} +1 -1
- package/dist/chunks/{chunk-XDFXKRTI.js → chunk-DWF3FCY4.js} +1 -1
- package/dist/chunks/{chunk-W3ZILZUL.js → chunk-DWM5G7BU.js} +1 -1
- package/dist/chunks/chunk-DXJC3QW7.js +2 -0
- package/dist/chunks/{chunk-IDILAYCW.js → chunk-E2JB5OCO.js} +1 -1
- package/dist/chunks/{chunk-GI7LTJV3.js → chunk-EDYCSW22.js} +1 -1
- package/dist/chunks/{chunk-4JYTFEND.js → chunk-EFP75UEX.js} +1 -1
- package/dist/chunks/{chunk-CX7HKSQ4.js → chunk-EGP6DF34.js} +2 -2
- package/dist/chunks/{chunk-D5OFN47Z.js → chunk-ESYPMD7Q.js} +1 -1
- package/dist/chunks/{chunk-PWKJ5KLZ.js → chunk-EXYSD45J.js} +1 -1
- package/dist/chunks/{chunk-R6VI7MX5.js → chunk-EYTTZ5H4.js} +1 -1
- package/dist/chunks/chunk-FKUWCJ73.js +161 -0
- package/dist/chunks/{chunk-WD6ANOLL.js → chunk-FNGZ4UDZ.js} +1 -1
- package/dist/chunks/{chunk-JFZ6USNQ.js → chunk-G7X73SBG.js} +1 -1
- package/dist/chunks/{chunk-36FNNR5N.js → chunk-GEYZVOGD.js} +1 -1
- package/dist/chunks/{chunk-ULJZ7NUF.js → chunk-GY7YSD6J.js} +1 -1
- package/dist/chunks/{chunk-CWAQOFLP.js → chunk-GYYJ47GX.js} +1 -1
- package/dist/chunks/chunk-HG2YFMVU.js +4 -0
- package/dist/chunks/{chunk-YQBL5P6R.js → chunk-HKVFU3B3.js} +1 -1
- package/dist/chunks/{chunk-VEXJV5H5.js → chunk-IIT66347.js} +4 -4
- package/dist/chunks/{chunk-B2K5WQZE.js → chunk-IO5DZUKL.js} +1 -1
- package/dist/chunks/chunk-J256AEEE.js +2 -0
- package/dist/chunks/{chunk-CRDKBFRN.js → chunk-JEMECEQH.js} +1 -1
- package/dist/chunks/{chunk-7P5SH3CI.js → chunk-JPUSTFZC.js} +1 -1
- package/dist/chunks/{chunk-YMCF5GR2.js → chunk-JQOVC35K.js} +1 -1
- package/dist/chunks/{chunk-6LFTQBXP.js → chunk-JT5YQ52I.js} +1 -1
- package/dist/chunks/chunk-JVMSN7LH.js +2 -0
- package/dist/chunks/{chunk-HORMGT2Q.js → chunk-JXYJQT5Q.js} +1 -1
- package/dist/chunks/{chunk-WDKZMXIU.js → chunk-K7KBFM2T.js} +1 -1
- package/dist/chunks/{chunk-UBTP3QWI.js → chunk-KCLMA2IH.js} +1 -1
- package/dist/chunks/chunk-KDER7R45.js +2 -0
- package/dist/chunks/{chunk-IXZ5ZGIL.js → chunk-KOC3YJEU.js} +2 -2
- package/dist/chunks/{chunk-R6MMWEH4.js → chunk-KP2MYTP5.js} +1 -1
- package/dist/chunks/{chunk-TV2LE2BD.js → chunk-KU4TPDPH.js} +2 -2
- package/dist/chunks/{chunk-WJSJXK2N.js → chunk-KUE46HTH.js} +1 -1
- package/dist/chunks/chunk-LVXL7T5O.js +2 -0
- package/dist/chunks/{chunk-TSQ2I6XV.js → chunk-M4A7G4S5.js} +2 -2
- package/dist/chunks/{chunk-MX7KV5DA.js → chunk-M4ZHFDRJ.js} +1 -1
- package/dist/chunks/{chunk-26ID6A5C.js → chunk-MEJLWNRS.js} +1 -1
- package/dist/chunks/{chunk-XT5WUQGT.js → chunk-MIFVX5PK.js} +1 -1
- package/dist/chunks/{chunk-4VZJQRQI.js → chunk-MOXIGLN2.js} +1 -1
- package/dist/chunks/{chunk-UKSSFB4Q.js → chunk-N5EAVX4G.js} +1 -1
- package/dist/chunks/{chunk-4B7EGNYX.js → chunk-NMMHXYDJ.js} +1 -1
- package/dist/chunks/{chunk-EBOTNBUS.js → chunk-NRYC4NH6.js} +1 -1
- package/dist/chunks/chunk-NSSZ2ZIU.js +2 -0
- package/dist/chunks/{chunk-4TTXNVCE.js → chunk-OFJPOTES.js} +1 -1
- package/dist/chunks/chunk-OIH2LPIT.js +2 -0
- package/dist/chunks/chunk-OUJ63LMU.js +2 -0
- package/dist/chunks/{chunk-SD2XDZQW.js → chunk-P4QM63L3.js} +1 -1
- package/dist/chunks/chunk-PACLKDTN.js +2 -0
- package/dist/chunks/{chunk-VPAEFG7X.js → chunk-PAYFJHPO.js} +1 -1
- package/dist/chunks/{chunk-OPTJYDZN.js → chunk-PHZZBXDO.js} +1 -1
- package/dist/chunks/{chunk-HPTEJBP4.js → chunk-PKJHN666.js} +1 -1
- package/dist/chunks/{chunk-HNDAGZCF.js → chunk-PLROXHG2.js} +1 -1
- package/dist/chunks/{chunk-UNE52L3Y.js → chunk-PNPV2LDE.js} +1 -1
- package/dist/chunks/{chunk-2RSGVLZT.js → chunk-PSY6IRJE.js} +8 -8
- package/dist/chunks/{chunk-SVNEPXU3.js → chunk-Q73RKX7I.js} +1 -1
- package/dist/chunks/{chunk-IF5A3XWP.js → chunk-Q7FBVLLB.js} +1 -1
- package/dist/chunks/{chunk-V5AOM5MZ.js → chunk-Q7P34B2O.js} +1 -1
- package/dist/chunks/{chunk-375PADDM.js → chunk-QLGP2OAQ.js} +1 -1
- package/dist/chunks/{chunk-QQLS5FB7.js → chunk-QUNQM2E3.js} +1 -1
- package/dist/chunks/chunk-R2FYCJL6.js +2 -0
- package/dist/chunks/{chunk-6HQUIKC5.js → chunk-R4EEGWXB.js} +1 -1
- package/dist/chunks/chunk-RBTDSI4L.js +11 -0
- package/dist/chunks/chunk-RCQYEHHD.js +2 -0
- package/dist/chunks/{chunk-TGULVWPV.js → chunk-RFQD6B44.js} +1 -1
- package/dist/chunks/{chunk-3WJQ4IGK.js → chunk-RPM4FDRX.js} +1 -1
- package/dist/chunks/{chunk-MCBRB5D6.js → chunk-RY46UPBO.js} +4 -4
- package/dist/chunks/{chunk-K3LS5SK7.js → chunk-SDHG6CKU.js} +1 -1
- package/dist/chunks/{chunk-XKZ4PFMQ.js → chunk-SO4GMSNP.js} +1 -1
- package/dist/chunks/{chunk-O6ZYDHEJ.js → chunk-SSHE6B7Z.js} +1 -1
- package/dist/chunks/{chunk-SH7POUVX.js → chunk-SV7ZBEK2.js} +6 -6
- package/dist/chunks/{chunk-BJXPQIVD.js → chunk-U7D6Q744.js} +1 -1
- package/dist/chunks/chunk-U7X5ZLAL.js +2 -0
- package/dist/chunks/{chunk-N54CPLVD.js → chunk-UANH7U3Y.js} +1 -1
- package/dist/chunks/{chunk-BUZ7CBJC.js → chunk-UGFSAG4U.js} +1 -1
- package/dist/chunks/chunk-ULTV6INR.js +2 -0
- package/dist/chunks/{chunk-V3ILZQER.js → chunk-UMAVVMXL.js} +7 -7
- package/dist/chunks/chunk-V24VHT76.js +2 -0
- package/dist/chunks/chunk-VEBW7NKD.js +2 -0
- package/dist/chunks/chunk-VJR2GNRY.js +2 -0
- package/dist/chunks/{chunk-JD76ANPN.js → chunk-VJYOKU3C.js} +1 -1
- package/dist/chunks/{chunk-H2XG5N7D.js → chunk-VWWKWYSQ.js} +1 -1
- package/dist/chunks/chunk-WCNPGKST.js +2 -0
- package/dist/chunks/chunk-WD4KAKEX.js +2 -0
- package/dist/chunks/chunk-WGQ3FMRF.js +2 -0
- package/dist/chunks/{chunk-6C3CXME7.js → chunk-WNXUSELC.js} +1 -1
- package/dist/chunks/{chunk-RS526BG7.js → chunk-WZ35ICTE.js} +3 -3
- package/dist/chunks/chunk-XHACK2KR.js +2 -0
- package/dist/chunks/chunk-XOPHFUUY.js +2 -0
- package/dist/chunks/{chunk-YKTJPCYZ.js → chunk-XQAUHXL4.js} +4 -4
- package/dist/chunks/{chunk-ZVMQLIRA.js → chunk-XT4CSKHM.js} +1 -1
- package/dist/chunks/{chunk-KQD36SBJ.js → chunk-XY7HFXLH.js} +1 -1
- package/dist/chunks/{chunk-UXO33ST5.js → chunk-XYZV3FKD.js} +1 -1
- package/dist/chunks/{chunk-GC6RJBRZ.js → chunk-Y2WNZWT2.js} +1 -1
- package/dist/chunks/chunk-Y4I6CFZJ.js +2 -0
- package/dist/chunks/chunk-YDZBX4XQ.js +2 -0
- package/dist/chunks/chunk-YI6ME6PU.js +22 -0
- package/dist/chunks/{chunk-H42UW6IF.js → chunk-YXMYK5P7.js} +1 -1
- package/dist/chunks/{chunk-QFL2VQKX.js → chunk-Z33RVGP6.js} +1 -1
- package/dist/chunks/{chunk-OY4B7Y3T.js → chunk-ZDEIVUUI.js} +1 -1
- package/dist/chunks/{chunk-XGJG2ZKE.js → chunk-ZIQJDTQB.js} +1 -1
- package/dist/chunks/{chunk-IR2Y2VQY.js → chunk-ZYLLPRPU.js} +1 -1
- package/dist/chunks/cli-R7TAP6Z2.js +2 -0
- package/dist/chunks/{command-NWOZXU57.js → command-LNOVZQSK.js} +3 -3
- package/dist/chunks/{configuration-command-ZEIBQKB3.js → configuration-command-CNITTZRP.js} +1 -1
- package/dist/chunks/connected-app-executor-FGWCLOJO.js +2 -0
- package/dist/chunks/connected-evidence-5VZBYNWN.js +2 -0
- package/dist/chunks/{connected-starting-assets-66Y46ZPM.js → connected-starting-assets-KWOFEIE4.js} +1 -1
- package/dist/chunks/{connection-GDWPMHPC.js → connection-VMBXW5PD.js} +1 -1
- package/dist/chunks/{continual-TNPTWTKK.js → continual-FVOLGGOE.js} +1 -1
- package/dist/chunks/core-commands-BPYXVT7O.js +2 -0
- package/dist/chunks/dataset-preparation-authoring-UUYFWWCT.js +4 -0
- package/dist/chunks/datasets-E5TXSVIY.js +2 -0
- package/dist/chunks/desktop-test-FX7DTY4N.js +3 -0
- package/dist/chunks/dist-2MKJC6HN.js +2 -0
- package/dist/chunks/{dist-GR56E3QK.js → dist-DKE7RJZN.js} +1 -1
- package/dist/chunks/evaluation-coordination-KUTZEEPB.js +2 -0
- package/dist/chunks/experiment-improvements-PQNR5YHN.js +2 -0
- package/dist/chunks/experiments-Z4BJWT3Y.js +2 -0
- package/dist/chunks/experiments-signal-3GCLKUWZ.js +2 -0
- package/dist/chunks/{extension-UH34ZF7N.js → extension-3EKIT6BB.js} +1 -1
- package/dist/chunks/{help-O53DTZGN.js → help-K6YLZ3KL.js} +1 -1
- package/dist/chunks/host-profile-evaluation-tools-UF4ATIUF.js +2 -0
- package/dist/chunks/host-profile-external-dataset-KSEPXY2S.js +2 -0
- package/dist/chunks/hosted-app-server-composition-LA3BZ4SE.js +2 -0
- package/dist/chunks/hosted-experiment-improvement-VG2WE7XZ.js +3 -0
- package/dist/chunks/hosted-harness-runtime-MMTLCL23.js +2 -0
- package/dist/chunks/hosted-profile-candidate-PTGQLPZO.js +3 -0
- package/dist/chunks/hosted-profile-compiler-FS5R6CHJ.js +2 -0
- package/dist/chunks/hosted-profile-evaluation-control-UUEZEMXU.js +2 -0
- package/dist/chunks/hosted-profile-evaluation-inspection-4F7OEF4T.js +3 -0
- package/dist/chunks/hosted-profile-evaluation-preparation-LIJJZDHQ.js +3 -0
- package/dist/chunks/hosted-tasksets-NXVF4AQA.js +2 -0
- package/dist/chunks/human-review-2ZOB7CJZ.js +2 -0
- package/dist/chunks/{import-OBAKUJPM.js → import-YHYKZ6JN.js} +2 -2
- package/dist/chunks/{learning-CRR6NRPN.js → learning-LAXMGWSQ.js} +1 -1
- package/dist/chunks/learning-Y3UKNUGE.js +2 -0
- package/dist/chunks/local-harness-improvement-runtime-3YJQRYXC.js +2 -0
- package/dist/chunks/local-harness-taskset-review-XQHQ6JCR.js +2 -0
- package/dist/chunks/{model-projects-HP4DELCP.js → model-projects-6YWVD2TS.js} +1 -1
- package/dist/chunks/opchat-XXI2ZM53.js +3 -0
- package/dist/chunks/opchat-bounded-chat-3MZGCRLY.js +2 -0
- package/dist/chunks/organizations-W7HI2JA4.js +2 -0
- package/dist/chunks/{profile-3WZJ65CT.js → profile-P2SJPBOJ.js} +1 -1
- package/dist/chunks/project-action-payload-LTIQBX77.js +2 -0
- package/dist/chunks/project-agent-XRIXMXQK.js +2 -0
- package/dist/chunks/published-experiment-source-SDXUVPE7.js +2 -0
- package/dist/chunks/refiner-profile-service-56VYLZQJ.js +2 -0
- package/dist/chunks/{runtime-XP4DEGR3.js → runtime-Q7JUJO4D.js} +2 -2
- package/dist/chunks/sandbox-command-HVA5FJU4.js +2 -0
- package/dist/chunks/{sandbox-template-YFMHEMUQ.js → sandbox-template-U536EEWY.js} +1 -1
- package/dist/chunks/saved-work-KSIQPXC2.js +2 -0
- package/dist/chunks/{send-turn-D3GTSSHI.js → send-turn-YLY3YNEQ.js} +1 -1
- package/dist/chunks/setup-RMZ2BHLM.js +2 -0
- package/dist/chunks/{src-GQPWOPYA.js → src-C3ZUESMK.js} +1 -1
- package/dist/chunks/src-SGQYVBNQ.js +424 -0
- package/dist/chunks/standalone-experiment-turn-owner-TW5MTWIO.js +2 -0
- package/dist/chunks/store-chat-resources-IRHBW2EC.js +2 -0
- package/dist/chunks/{store-continual-support-reviews-VVRQO2JK.js → store-continual-support-reviews-3KK42L4I.js} +1 -1
- package/dist/chunks/store-conversation-serving-IVURK52V.js +2 -0
- package/dist/chunks/{store-create-improve-2XI36AET.js → store-create-improve-UTCLBXF2.js} +1 -1
- package/dist/chunks/{store-datasets-UFY422NG.js → store-datasets-4AQOVAQY.js} +1 -1
- package/dist/chunks/store-evaluation-results-PK2P3IMH.js +7 -0
- package/dist/chunks/{store-harness-workspaces-SGUEYDO2.js → store-harness-workspaces-YEXB4IRV.js} +1 -1
- package/dist/chunks/store-human-review-O4BVHP25.js +7 -0
- package/dist/chunks/store-learned-preference-migration-validation-44SVX6YB.js +2 -0
- package/dist/chunks/{store-learning-BFOT4QVT.js → store-learning-SIUQIY5C.js} +1 -1
- package/dist/chunks/{store-learning-credentials-DYTMWQTC.js → store-learning-credentials-BUHR7SN6.js} +1 -1
- package/dist/chunks/store-local-experiments-BHVTKPPE.js +97 -0
- package/dist/chunks/store-model-batch-review-RVAYUVK2.js +2 -0
- package/dist/chunks/{store-model-configuration-NJFWSYSA.js → store-model-configuration-6L3OYXF4.js} +1 -1
- package/dist/chunks/store-model-project-preparation-AAEKCF6V.js +2 -0
- package/dist/chunks/store-modification-recordings-LCPK6K2T.js +9 -0
- package/dist/chunks/{store-preference-comparison-MZAYONCK.js → store-preference-comparison-5YVIQNVB.js} +1 -1
- package/dist/chunks/{store-sidebar-file-bookmarks-J3JEVAYR.js → store-sidebar-file-bookmarks-WLMYDA4E.js} +1 -1
- package/dist/chunks/{store-sidebar-preferences-2JHTFXJK.js → store-sidebar-preferences-AFMYIDWT.js} +1 -1
- package/dist/chunks/{store-subagents-PUBQVWSU.js → store-subagents-KFPVSTRO.js} +1 -1
- package/dist/chunks/{store-task-inbox-3BREANOX.js → store-task-inbox-L6IQTY26.js} +1 -1
- package/dist/chunks/{store-task-inventory-5HRZCDUT.js → store-task-inventory-QWS2C656.js} +1 -1
- package/dist/chunks/store-taskset-drafts-FRFL6ITK.js +9 -0
- package/dist/chunks/{store-training-S3FXWLT6.js → store-training-FYXZU2FE.js} +1 -1
- package/dist/chunks/{store-training-jobs-2LCXPA7G.js → store-training-jobs-3N3VKPIY.js} +1 -1
- package/dist/chunks/{store-training-models-7AMKS7ZW.js → store-training-models-VOFVGPZR.js} +1 -1
- package/dist/chunks/{taskset-PLKWRT4X.js → taskset-UDDLFYKV.js} +1 -1
- package/dist/chunks/taskset-catalog-RZYEBCRQ.js +2 -0
- package/dist/chunks/taskset-packages-T6B6HYKZ.js +2 -0
- package/dist/chunks/taskset-packages-WMG5DUBN.js +2 -0
- package/dist/chunks/{teams-bot-VQXUA7U4.js → teams-bot-MPWL2PP4.js} +1 -1
- package/dist/chunks/tool-learning-ZQ6NSJ5K.js +2 -0
- package/dist/chunks/training-5NT2YB2L.js +2 -0
- package/dist/chunks/training-5UMT45UL.js +2 -0
- package/dist/chunks/training-UY6KRG4M.js +2 -0
- package/dist/chunks/{training-error-LQKCOQDJ.js → training-error-WF463UNZ.js} +1 -1
- package/dist/chunks/{training-hardware-ESXRWUIK.js → training-hardware-UWQCRDMV.js} +1 -1
- package/dist/chunks/training-hosted-CKSDRVL6.js +2 -0
- package/dist/chunks/training-hosted-alphaedit-HSMRDJTD.js +2 -0
- package/dist/chunks/training-hosted-decision-7JALOU6O.js +2 -0
- package/dist/chunks/training-hosted-engram-SXO75MFG.js +2 -0
- package/dist/chunks/{training-hosted-learning-WQ2IP5FP.js → training-hosted-learning-E2N32YU5.js} +1 -1
- package/dist/chunks/training-hosted-modification-comparison-TXFDJFTG.js +2 -0
- package/dist/chunks/training-hosted-neuron-training-J42WK4EH.js +2 -0
- package/dist/chunks/training-hosted-serving-report-BAEABGJH.js +2 -0
- package/dist/chunks/training-hosted-steering-T556BUBG.js +2 -0
- package/dist/chunks/training-model-start-P3PXDWNT.js +2 -0
- package/dist/chunks/web-search-ZEKJHZW4.js +2 -0
- package/dist/chunks/{workspaces-MCS2AQX6.js → workspaces-EK62ANTB.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sandbox/types/billing.d.ts +87 -6
- package/dist/sandbox/types/io.d.ts +3 -0
- package/dist/sandbox-template/manifest.js +1 -1
- package/dist/skills/manifest.json +3 -3
- package/dist/skills/openpond-cli/references/experiments-and-training.md +461 -1
- package/dist/web/assets/App-CCuh99JW.js +54 -0
- package/dist/web/assets/{AppDialog-BvskhHE9.js → AppDialog-CxjDHVk9.js} +1 -1
- package/dist/web/assets/AppTerminalPanel-CKJIVpKa.js +2 -0
- package/dist/web/assets/{AppToastContext-D2788RqX.js → AppToastContext-EpiT1dHs.js} +1 -1
- package/dist/web/assets/AppsView-BsMyPX_3.js +1 -0
- package/dist/web/assets/{AttachmentTypeIcon-DVluUHuc.js → AttachmentTypeIcon-BXvZy5gB.js} +1 -1
- package/dist/web/assets/BrowserSidebar-BIIV4aq4.js +1 -0
- package/dist/web/assets/{CartesianChart-DdBZ69lI.js → CartesianChart-brqLBqnF.js} +1 -1
- package/dist/web/assets/ChatTimelineEntry-CwZbn16X.js +8 -0
- package/dist/web/assets/{CollaborationTabs-ba6WupeJ.js → CollaborationTabs-BU4uc4tZ.js} +1 -1
- package/dist/web/assets/{CommandMenu-D7wTaEgl.js → CommandMenu-DkWpXR55.js} +1 -1
- package/dist/web/assets/CommunityView-CsSxJZGn.js +1 -0
- package/dist/web/assets/{ComposerAttachments-aO90qXYz.js → ComposerAttachments-BdJGCYzI.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-BPUJBSyS.js → ComposerCreateImproveStrip-CWy0j1vv.js} +1 -1
- package/dist/web/assets/{ConversationImportsSettings-Bo836wKJ.js → ConversationImportsSettings-DCmiakbZ.js} +1 -1
- package/dist/web/assets/DatasetReviewImport-DEnF_pGu.js +1 -0
- package/dist/web/assets/ExperimentTrainingDataWorkspace-WhwQ0QBi.js +2 -0
- package/dist/web/assets/{FilePagePreview-C6wIp6uX.js → FilePagePreview-BRhhz99q.js} +2 -2
- package/dist/web/assets/{GetStartedView-CxMv8q-h.js → GetStartedView-CLVD-qEi.js} +1 -1
- package/dist/web/assets/{GettingStartedDialog-CEb0cS-o.js → GettingStartedDialog-CMxaAMg-.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-Cn-j-rDo.js +1 -0
- package/dist/web/assets/HostedModelLearningSettings-VNBvf38S.js +1 -0
- package/dist/web/assets/{HtmlVisual-CCuUkYT8.js → HtmlVisual-D5y2WG9L.js} +10 -10
- package/dist/web/assets/LabModelVersionDetailPage-BxRmYD6h.js +1 -0
- package/dist/web/assets/{TrainingRunLineage-PXzWR65d.css → LabModelWorkspace-DOrgCk9Z.css} +1 -1
- package/dist/web/assets/LabModelWorkspace-u2Ulm_z4.js +1 -0
- package/dist/web/assets/{LabSkillSidebar-CFROlATQ.js → LabSkillSidebar-C7IceJTJ.js} +1 -1
- package/dist/web/assets/LabsRoute-C9Y0GU34.css +1 -0
- package/dist/web/assets/LabsRoute-CbztQaEf.js +74 -0
- package/dist/web/assets/LearningBatchesPage-B1NZTBSv.css +1 -0
- package/dist/web/assets/LearningBatchesPage-CJqgZNvM.js +26 -0
- package/dist/web/assets/MainChatThread-DNMfrrRq.js +2 -0
- package/dist/web/assets/{MainPane-BOWkynGB.css → MainPane-BZlNLfTM.css} +1 -1
- package/dist/web/assets/MainPane-CQQxSDPS.js +13 -0
- package/dist/web/assets/ModelProjectPageHeader-Dge19aE1.js +1 -0
- package/dist/web/assets/NativeSetupTerminal-D4JnbpyD.js +2 -0
- package/dist/web/assets/{NativeSkillSidebar-MAJWS4mL.js → NativeSkillSidebar-Jzx1BeKV.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-MQiUBVx3.js → NewProjectDialog-DcnGzEd9.js} +1 -1
- package/dist/web/assets/{OutputsPage-DpF-aRTu.js → OutputsPage-Cmk15Vt_.js} +1 -1
- package/dist/web/assets/{PageChrome-8gH2hyDb.js → PageChrome-Cz_fCqtn.js} +1 -1
- package/dist/web/assets/{ProjectsPage-BQ98oGyu.js → ProjectsPage-BZ3Eo3Mz.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-C6H2vU9N.js +1 -0
- package/dist/web/assets/RightSidebarHomePanel-BfMMVkM1.js +1 -0
- package/dist/web/assets/{ScheduledWorkPage-CGCqZz_H.js → ScheduledWorkPage-CAkSwM0T.js} +1 -1
- package/dist/web/assets/{SettingsView-CqpMFLxy.js → SettingsView-DvQXGw3_.js} +3 -3
- package/dist/web/assets/{TasksetDraftEditorPrimitives-DJvIvzBb.js → TasksetDraftEditorPrimitives-JuU1k8vr.js} +1 -1
- package/dist/web/assets/TeamChatView-DmHjr8W9.js +1 -0
- package/dist/web/assets/{TerminalOverlay-D--M876l.js → TerminalOverlay-DlaM9d8F.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-DDUoHQHU.js → TrainingCreationPanel-ClpylNsr.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-CwLXn3Z7.js → TrainingDraftPanel-6tH2xSDj.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CGwPregx.js → UsageSettingsSection-CzDqxOYM.js} +2 -2
- package/dist/web/assets/WorkSidebarPanel-CY-AHZ4-.js +1 -0
- package/dist/web/assets/WorkspaceDiffPanel-B4e0lyF7.js +11 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-D01ZkZZF.js +35 -0
- package/dist/web/assets/{WorkspaceFileLocation-D-ctFM4d.js → WorkspaceFileLocation-C5s_njZb.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-CQ28j3R7.js → WorkspaceGitDialogs-DjPZ6KIh.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-BrZs6-EW.js → WorkspaceMonacoEditor-CC4sfOiU.js} +3 -3
- package/dist/web/assets/{WorkspacePdfPreview-CU6PSjjN.js → WorkspacePdfPreview-vszQqFa4.js} +2 -2
- package/dist/web/assets/{WorkspacePresentationPreview-IjXVXpIy.js → WorkspacePresentationPreview-DQTvhaRD.js} +1 -1
- package/dist/web/assets/api-client-DJRVOFzS.js +1 -0
- package/dist/web/assets/{app-models-CKXrDTEU.js → app-models-BUdzQbXo.js} +1 -1
- package/dist/web/assets/bot-Doyx3T4j.js +1 -0
- package/dist/web/assets/{browser-sidebar-links-D9v2cyJa.js → browser-sidebar-links-PVPCrsDJ.js} +1 -1
- package/dist/web/assets/chat-resources-Beh5lB36.js +1 -0
- package/dist/web/assets/chevron-down-DX1hzujj.js +1 -0
- package/dist/web/assets/chevron-right-DHN0y3KC.js +1 -0
- package/dist/web/assets/chevron-up-_QrW88NF.js +1 -0
- package/dist/web/assets/{chunk-TLSP5JKG-BrrVo5rJ.js → chunk-3BYFS4RO-ztZjcMmt.js} +1 -1
- package/dist/web/assets/chunk-AG6UJ3DI-D9KZjTYP.js +1 -0
- package/dist/web/assets/chunk-C3TS766N-ppRhs95p.js +1 -0
- package/dist/web/assets/chunk-GCUWJUUM-Dy6oUNJ6.js +9 -0
- package/dist/web/assets/chunk-GS5HEE4M-C0RLeIsy.js +1 -0
- package/dist/web/assets/{chunk-H3JZ3P5T-CzpTARDY.js → chunk-H3JZ3P5T-DolwEJXo.js} +2 -2
- package/dist/web/assets/chunk-Q4RGCEOI-Cr-dg4Nk.js +1 -0
- package/dist/web/assets/client-DwZ92xtu.js +1 -0
- package/dist/web/assets/{client-choice-storage-DUWsS4X0.js → client-choice-storage-DitqKiIT.js} +1 -1
- package/dist/web/assets/cloud-upload-HdzNTgr2.js +1 -0
- package/dist/web/assets/common-BWVSBnpX.js +1 -0
- package/dist/web/assets/copy-DTQhoBNg.js +1 -0
- package/dist/web/assets/create-pipeline-DsZzNkt9.js +1 -0
- package/dist/web/assets/{cssMode-SclUkqPt.js → cssMode-BRTtfXxU.js} +1 -1
- package/dist/web/assets/dataset-workspaces-BTPi71mz.js +1 -0
- package/dist/web/assets/external-link-H1629UU6.js +1 -0
- package/dist/web/assets/folder-open-CAGdWOrr.js +1 -0
- package/dist/web/assets/folder-plus-C14cs2mE.js +1 -0
- package/dist/web/assets/git-commit-horizontal-DFUfuVvF.js +1 -0
- package/dist/web/assets/{htmlMode-X3mQtOeh.js → htmlMode-BVaCcL76.js} +1 -1
- package/dist/web/assets/icons-Bk2b68aC.js +1 -0
- package/dist/web/assets/image-0DPVY6Ev.js +1 -0
- package/dist/web/assets/{index-LXNhSUEL.js → index-B6XX_0h3.js} +2 -2
- package/dist/web/assets/info-C8b_tafZ.js +1 -0
- package/dist/web/assets/{intake-contracts-wCkD2ErR.js → intake-contracts-B8JZKYwb.js} +1 -1
- package/dist/web/assets/{jsonMode-BoKiIdHd.js → jsonMode-BCKKQmmV.js} +1 -1
- package/dist/web/assets/loader-circle-y-SSPwpk.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-CO2mzpy1.js → lspLanguageFeatures-DozmNUOx.js} +1 -1
- package/dist/web/assets/maximize-2-CByk9-zN.js +1 -0
- package/dist/web/assets/message-square-C889vRqm.js +1 -0
- package/dist/web/assets/{monaco.contribution-wacA5FjV.js → monaco.contribution-B9q6qbbo.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CVe3mWSY.js → monaco.contribution-BITdsRbn.js} +2 -2
- package/dist/web/assets/{monaco.contribution-hrusiaZi.js → monaco.contribution-BqA-XZ44.js} +2 -2
- package/dist/web/assets/{monaco.contribution-C7CAQIKF.js → monaco.contribution-DxAV1oS5.js} +2 -2
- package/dist/web/assets/monitor-BtxlcLuI.js +1 -0
- package/dist/web/assets/paperclip-BeIdaspf.js +1 -0
- package/dist/web/assets/{pdf-Ct3M2mVw.js → pdf-perlzwEB.js} +1 -1
- package/dist/web/assets/play-CHXXdkuO.js +1 -0
- package/dist/web/assets/plus-DFFWjhPw.js +1 -0
- package/dist/web/assets/{ponder-desktop-D-zB6X4L.js → ponder-desktop-Ca-9KggQ.js} +1 -1
- package/dist/web/assets/presentation-0bzvu6_u.js +1 -0
- package/dist/web/assets/{profile-ref-CCxrOCio.js → profile-ref-D8lxL7dW.js} +1 -1
- package/dist/web/assets/{python-C0-pUUAU.js → python-B9hOnkOI.js} +1 -1
- package/dist/web/assets/refresh-cw-D61-Ozk3.js +1 -0
- package/dist/web/assets/{requests-DjSt-duM.js → requests-DmeUYik4.js} +1 -1
- package/dist/web/assets/reward-checks-DJJZYgf8.js +7 -0
- package/dist/web/assets/save-iEMNZoPe.js +1 -0
- package/dist/web/assets/schemas-Brv9Vmnk.js +64 -0
- package/dist/web/assets/settings-BC-bzgk6.js +21 -0
- package/dist/web/assets/settings-lists-C84qxFmP.js +5 -0
- package/dist/web/assets/square-BE_4JMR3.js +1 -0
- package/dist/web/assets/square-terminal-Djpzo2Qs.js +1 -0
- package/dist/web/assets/{submit-issue-command-Gk3RKrY-.js → submit-issue-command-HfKzyxg5.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-BnYUBgZB.js → toggleHighContrast-ClsXu39R.js} +1 -1
- package/dist/web/assets/training-DWfghwfZ.js +1 -0
- package/dist/web/assets/{training-model-data-CxR3xpmK.js → training-model-data-CIysl8wH.js} +4 -4
- package/dist/web/assets/{tsMode-BVNyOY8h.js → tsMode-nbmaMc-D.js} +1 -1
- package/dist/web/assets/upload-C6ug8RD-.js +1 -0
- package/dist/web/assets/{useAccountSettings-4_XfwJQi.js → useAccountSettings-Dr9h4Qz_.js} +1 -1
- package/dist/web/assets/{useAgentInventory-CVuamyT3.js → useAgentInventory-ByCk2JAv.js} +1 -1
- package/dist/web/assets/useChatContextSelection-C0eMm2g6.js +1 -0
- package/dist/web/assets/{useLocalAgentSchedules-CmwN4ohy.js → useLocalAgentSchedules-Do0y_leJ.js} +1 -1
- package/dist/web/assets/useQuery-D2MQ7e5U.js +1 -0
- package/dist/web/assets/wifi-off-Dr-CapyW.js +1 -0
- package/dist/web/assets/work-outputs-D_8TovAK.js +1 -0
- package/dist/web/assets/{workers-CjtQ2aBD.js → workers-DKvM2NdM.js} +1 -1
- package/dist/web/assets/x-Jx2jlP9u.js +1 -0
- package/dist/web/assets/{yaml-N1KUjBZ8.js → yaml-C02vq4ar.js} +1 -1
- package/dist/web/index.html +1 -1
- package/docs/command-reference.md +93 -3
- package/package.json +1 -1
- package/dist/chunks/actions-command-BYPLSGZL.js +0 -2
- package/dist/chunks/app-server-evaluations-5YZUFXQ2.js +0 -2
- package/dist/chunks/app-server-harness-services-N5F5QVZI.js +0 -2
- package/dist/chunks/app-server-runtime-HJ2N57DL.js +0 -2
- package/dist/chunks/apps-WJTW64NW.js +0 -2
- package/dist/chunks/chunk-263WS3TB.js +0 -2
- package/dist/chunks/chunk-2UZHLO2V.js +0 -23
- package/dist/chunks/chunk-2W22IXHB.js +0 -2
- package/dist/chunks/chunk-46RMTR2Z.js +0 -2
- package/dist/chunks/chunk-4JJ4RYIB.js +0 -6
- package/dist/chunks/chunk-4NN5OLKW.js +0 -161
- package/dist/chunks/chunk-543QHE3D.js +0 -2
- package/dist/chunks/chunk-5QOFUGYQ.js +0 -2
- package/dist/chunks/chunk-5ZNE43XC.js +0 -10
- package/dist/chunks/chunk-6IS5OLI5.js +0 -2
- package/dist/chunks/chunk-7HAGSE7L.js +0 -2
- package/dist/chunks/chunk-AXYAEWWA.js +0 -2
- package/dist/chunks/chunk-B7XJBP4U.js +0 -2
- package/dist/chunks/chunk-BBIA24GD.js +0 -10
- package/dist/chunks/chunk-CJDGLPNX.js +0 -4
- package/dist/chunks/chunk-FCXDPVGJ.js +0 -3
- package/dist/chunks/chunk-FE2ENE3U.js +0 -2
- package/dist/chunks/chunk-H6EUFJJK.js +0 -2
- package/dist/chunks/chunk-IOSBGCRT.js +0 -2
- package/dist/chunks/chunk-K6DB5QWG.js +0 -2
- package/dist/chunks/chunk-LI56PPCN.js +0 -2
- package/dist/chunks/chunk-OE2OOWEQ.js +0 -2
- package/dist/chunks/chunk-OYIFH2OM.js +0 -2
- package/dist/chunks/chunk-QOUOU7FE.js +0 -22
- package/dist/chunks/chunk-R5GRESW3.js +0 -2
- package/dist/chunks/chunk-TERKCK4I.js +0 -2
- package/dist/chunks/chunk-TS5HNRZB.js +0 -2
- package/dist/chunks/chunk-V3KEG6MI.js +0 -2
- package/dist/chunks/chunk-WGISITX6.js +0 -4
- package/dist/chunks/chunk-XD4ZIQZ2.js +0 -2
- package/dist/chunks/chunk-XHU4BZQY.js +0 -13
- package/dist/chunks/chunk-ZWEY66RT.js +0 -2
- package/dist/chunks/cli-HV32F7HD.js +0 -2
- package/dist/chunks/connected-app-executor-DFHWNMRM.js +0 -2
- package/dist/chunks/connected-evidence-WOM6N5HO.js +0 -2
- package/dist/chunks/core-commands-GWRHH53F.js +0 -2
- package/dist/chunks/dataset-preparation-authoring-WJ2XEUO7.js +0 -4
- package/dist/chunks/datasets-XIMF54QN.js +0 -2
- package/dist/chunks/desktop-test-HF42V2EP.js +0 -3
- package/dist/chunks/dist-T6ES2TSM.js +0 -2
- package/dist/chunks/evaluation-coordination-WZT6FDMS.js +0 -2
- package/dist/chunks/experiment-improvements-H35VS6XZ.js +0 -2
- package/dist/chunks/experiments-F54C32EE.js +0 -2
- package/dist/chunks/experiments-signal-ONIGTGYR.js +0 -2
- package/dist/chunks/host-profile-evaluation-tools-LMCJ3MDJ.js +0 -2
- package/dist/chunks/host-profile-external-dataset-4HOXANWK.js +0 -2
- package/dist/chunks/hosted-app-server-composition-Y64A2A2B.js +0 -2
- package/dist/chunks/hosted-experiment-improvement-B2V2WIUI.js +0 -3
- package/dist/chunks/hosted-harness-runtime-C7I4KSDK.js +0 -2
- package/dist/chunks/hosted-profile-candidate-CXPVEEYQ.js +0 -3
- package/dist/chunks/hosted-profile-compiler-FGCI2VRW.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-control-INNUYMBD.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-inspection-UPTBRYMS.js +0 -3
- package/dist/chunks/hosted-profile-evaluation-preparation-TIQSVKLQ.js +0 -3
- package/dist/chunks/hosted-tasksets-7VMYOTIO.js +0 -2
- package/dist/chunks/human-review-7XC77NQP.js +0 -2
- package/dist/chunks/learning-3XDGIYUL.js +0 -2
- package/dist/chunks/local-harness-improvement-runtime-UIKQSAMM.js +0 -2
- package/dist/chunks/local-harness-taskset-review-6KJN3EQL.js +0 -2
- package/dist/chunks/opchat-NWYWWIA7.js +0 -3
- package/dist/chunks/opchat-bounded-chat-ICURZM6R.js +0 -2
- package/dist/chunks/organizations-7DBQGCCV.js +0 -2
- package/dist/chunks/project-action-payload-7DRABTHY.js +0 -2
- package/dist/chunks/project-agent-AXJOWXRU.js +0 -2
- package/dist/chunks/published-experiment-source-YBBPLNF2.js +0 -2
- package/dist/chunks/refiner-profile-service-ATEFPF5O.js +0 -2
- package/dist/chunks/sandbox-command-CF2PJCFX.js +0 -2
- package/dist/chunks/saved-work-3OAVRBH3.js +0 -2
- package/dist/chunks/setup-RHIMFI2Y.js +0 -2
- package/dist/chunks/src-V236S6MV.js +0 -424
- package/dist/chunks/standalone-experiment-turn-owner-CDRMGLWW.js +0 -2
- package/dist/chunks/store-chat-resources-P4EKCLSY.js +0 -2
- package/dist/chunks/store-conversation-serving-YFEZYQD3.js +0 -2
- package/dist/chunks/store-evaluation-results-VBH4R2U7.js +0 -7
- package/dist/chunks/store-human-review-RFCVZ3HP.js +0 -7
- package/dist/chunks/store-learned-preference-migration-validation-FNBGGZU6.js +0 -2
- package/dist/chunks/store-local-experiments-XPXGYXNM.js +0 -97
- package/dist/chunks/store-model-batch-review-J2L5JQV2.js +0 -2
- package/dist/chunks/store-model-project-preparation-OCLIFKI2.js +0 -2
- package/dist/chunks/store-taskset-drafts-BNKUVHPA.js +0 -9
- package/dist/chunks/taskset-packages-SXBLYHSP.js +0 -2
- package/dist/chunks/taskset-packages-V5T4V7YN.js +0 -2
- package/dist/chunks/tool-learning-47XQKELE.js +0 -2
- package/dist/chunks/training-7VQNCOGH.js +0 -2
- package/dist/chunks/training-VKLPNCMC.js +0 -2
- package/dist/chunks/training-hosted-NNE6BP6S.js +0 -2
- package/dist/chunks/training-hosted-serving-report-VZ4SMLMG.js +0 -2
- package/dist/chunks/training-model-start-G7YDZ7ZG.js +0 -2
- package/dist/chunks/web-search-56QRZGPR.js +0 -2
- package/dist/web/assets/App-DmEA-Lia.js +0 -53
- package/dist/web/assets/AppTerminalPanel-ScQKJV4z.js +0 -2
- package/dist/web/assets/AppsView-B1uNg9IQ.js +0 -1
- package/dist/web/assets/BrowserSidebar-DfVQoJHn.js +0 -1
- package/dist/web/assets/ChatTimelineEntry-Bbc6HRks.js +0 -8
- package/dist/web/assets/CommunityView-mO58f2B0.js +0 -1
- package/dist/web/assets/HostedModelLearningReview-BQIS7hkd.js +0 -1
- package/dist/web/assets/HostedModelLearningSettings-BQ-YeFMT.js +0 -1
- package/dist/web/assets/LabModelVersionDetailPage-BkHeVbAx.js +0 -1
- package/dist/web/assets/LabsRoute-CE45yAXJ.css +0 -1
- package/dist/web/assets/LabsRoute-YA9YckKj.js +0 -101
- package/dist/web/assets/MainChatThread-DpyPgGKW.js +0 -2
- package/dist/web/assets/MainPane-WOeodByM.js +0 -10
- package/dist/web/assets/NativeSetupTerminal-fmG2c65K.js +0 -2
- package/dist/web/assets/RightChatPanelStack-Bs7A4dLs.js +0 -1
- package/dist/web/assets/RightSidebarHomePanel-C-D4kba2.js +0 -1
- package/dist/web/assets/TeamChatView-DjmIaLO1.js +0 -1
- package/dist/web/assets/TrainingRunLineage-CtYe1KGX.js +0 -1
- package/dist/web/assets/WorkSidebarPanel-C6wWuo7U.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-JDOUmrC-.js +0 -11
- package/dist/web/assets/WorkspaceEnvironmentMenu-sfL5LZeB.js +0 -35
- package/dist/web/assets/api-client-Dgz-fOMl.js +0 -1
- package/dist/web/assets/bot-Cd761lRF.js +0 -1
- package/dist/web/assets/chat-resources-BUDXdoG0.js +0 -1
- package/dist/web/assets/chevron-down-DEbd6Ek-.js +0 -1
- package/dist/web/assets/chevron-right-DLYNg_Oq.js +0 -1
- package/dist/web/assets/chevron-up-DFJJccDl.js +0 -1
- package/dist/web/assets/chunk-GHPCQXG5-DKDBSd8H.js +0 -9
- package/dist/web/assets/chunk-GJRXJL6G-luaxRTYI.js +0 -1
- package/dist/web/assets/chunk-JDQVAG3R-C0-rh1aR.js +0 -1
- package/dist/web/assets/chunk-XMVSQIK4-BBU7r_NH.js +0 -1
- package/dist/web/assets/client-BNjO4Xi8.js +0 -1
- package/dist/web/assets/cloud-upload-CoM1FGeB.js +0 -1
- package/dist/web/assets/common-CFsO2ppZ.js +0 -1
- package/dist/web/assets/copy-BGOhV6Pk.js +0 -1
- package/dist/web/assets/create-pipeline-DRR0Qeec.js +0 -1
- package/dist/web/assets/createLucideIcon-Bv-_eGcE.js +0 -1
- package/dist/web/assets/external-link-CVXsNeO3.js +0 -1
- package/dist/web/assets/folder-open-MnOmh19D.js +0 -1
- package/dist/web/assets/folder-plus-BRddLBtO.js +0 -1
- package/dist/web/assets/git-commit-horizontal-Bm4rkXug.js +0 -1
- package/dist/web/assets/icons-CZxmQtZs.js +0 -1
- package/dist/web/assets/image-BViGUAiq.js +0 -1
- package/dist/web/assets/info-DYPIbKKD.js +0 -1
- package/dist/web/assets/loader-circle-JFgFNsP5.js +0 -1
- package/dist/web/assets/maximize-2-DXZCQO0b.js +0 -1
- package/dist/web/assets/message-square-cOCAL8J1.js +0 -1
- package/dist/web/assets/models-route-CWcJuOd0.js +0 -1
- package/dist/web/assets/monitor-B35XSAvn.js +0 -1
- package/dist/web/assets/paperclip-CKgDxioG.js +0 -1
- package/dist/web/assets/play-DzqLr7fM.js +0 -1
- package/dist/web/assets/plus-Ddp1vXnw.js +0 -1
- package/dist/web/assets/presentation-B0S9v7ib.js +0 -1
- package/dist/web/assets/refresh-cw-D45mW-vs.js +0 -1
- package/dist/web/assets/reward-checks-D139zwha.js +0 -7
- package/dist/web/assets/save-Gu4R_82E.js +0 -1
- package/dist/web/assets/schemas-C9IwV7NS.js +0 -64
- package/dist/web/assets/settings-DdonLCIN.js +0 -21
- package/dist/web/assets/settings-lists-CFHFtO0D.js +0 -5
- package/dist/web/assets/square-Dqduqyyu.js +0 -1
- package/dist/web/assets/square-terminal-DS3zwi6X.js +0 -1
- package/dist/web/assets/training-QBuGBGJd.js +0 -2
- package/dist/web/assets/upload-ABSJxuUM.js +0 -1
- package/dist/web/assets/useQuery-CCjwL8VI.js +0 -1
- package/dist/web/assets/wifi-off-DGJH7Pke.js +0 -1
- package/dist/web/assets/work-outputs-CnbRtTLg.js +0 -1
- package/dist/web/assets/x-B-_zJVOZ.js +0 -1
- /package/dist/chunks/{chunk-SFR32TMJ.js → chunk-JXLDEYRW.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as Ne}from"./chunk-SYUKES6H.js";import{a as B,b as W,c as ze,d as Le,e as q,f as ie,i as de,o as Be,q as ce}from"./chunk-7HAGSE7L.js";import{a as ue}from"./chunk-MCBRB5D6.js";import{k as ae,m as se,n as Ue}from"./chunk-OQPJ7FJF.js";import{c as Te}from"./chunk-LI56PPCN.js";import{a as re,b as oe}from"./chunk-WJSJXK2N.js";import{rb as L}from"./chunk-5ZNE43XC.js";import{f as G,m as f,n as _e}from"./chunk-HIQPGYVH.js";import{a as ke}from"./chunk-2LJCJOJ7.js";import{a as Oe,c as $e,d as je}from"./chunk-AMC4Z7G4.js";import{b as z}from"./chunk-JCLTFDVW.js";import{l as K,m as qe}from"./chunk-I6VMRQF4.js";import{h as Ae}from"./chunk-XHU4BZQY.js";import{Sa as Pe,ea as Ce,wb as Ee}from"./chunk-ZY32SZ2P.js";import{A as a}from"./chunk-X2J2P5ZT.js";import{a as d}from"./chunk-FTQLQJQV.js";function jt(t,e){let n=t.token?.trim();if(!n||t.accountState.state!=="signed_in"||!t.accountState.activeProfile)throw new Error("A signed-in OpenPond account is required.");let r=ke(t.apiBaseUrl,{apiBaseUrl:t.apiBaseUrl}),o=/\/api\/sandboxes\/?$/.test(r)?r.replace(/\/api\/sandboxes\/?$/,"/v1"):r.replace(/\/sandboxes\/?$/,"");return{audience:new URL(o).origin,async request(s){let i=n.startsWith("opk_"),u=await z(o,n,s.path,{method:s.method??"GET",signal:s.signal,explicitBearerAuth:!i,headers:{...i?{"openpond-api-key":n}:{},...s.idempotencyKey?{"idempotency-key":s.idempotencyKey}:{},...e?{"X-OpenPond-Team-Id":e}:{}},...s.body?{body:JSON.stringify(s.body)}:{},...s.timeoutMs!==void 0?{timeoutMs:s.timeoutMs}:{}}),c=await u.json().catch(()=>({}));if(!u.ok)throw new Error(typeof c.error=="string"?c.error:`OpenPond API request failed with status ${u.status}`);return c}}}d(jt,"createCapturedOpenPondPublicApiClient");var _t=3e4,Tt=8*1024*1024,Mn={timeoutMs:900*1e3,maxResponseBytes:64*1024*1024},Fe=class extends Error{static{d(this,"ApiTimeoutError")}timeoutMs;requestUrl;code="OPENPOND_API_TIMEOUT";constructor(t,e){super(`API request timed out after ${t}ms: ${e}`),this.timeoutMs=t,this.requestUrl=e,this.name="ApiTimeoutError"}},pe=class extends Error{static{d(this,"ApiResponseTooLargeError")}maximumBytes;requestUrl;code="OPENPOND_API_RESPONSE_TOO_LARGE";constructor(t,e){super(`API response exceeded ${t} bytes: ${e}`),this.maximumBytes=t,this.requestUrl=e,this.name="ApiResponseTooLargeError"}},He=class extends Error{static{d(this,"OpenPondApiError")}status;apiMessage;code;constructor(t,e,n,r=null){let o=r||e;super(`${n} failed: ${t}${o?` ${o}`:""}`),this.status=t,this.apiMessage=r,this.name="OpenPondApiError",this.code=e||"OPENPOND_API_ERROR"}};async function X(t,e,n,r={}){let{timeoutMs:o=_t,maxResponseBytes:s=Tt,explicitBearerAuth:i=!1,...u}=r,c=`${t}${n}`,p=new Headers(u.headers);p.set("Content-Type","application/json");let b=i?void 0:process.env.OPENPOND_API_KEY,l=e?.trim()||"",g=!i&&l.startsWith("opk_"),P=b||(g?l:null);P&&!p.has("openpond-api-key")&&p.set("openpond-api-key",P),e?p.set("Authorization",g?`ApiKey ${l}`:`Bearer ${e}`):b&&!p.has("Authorization")&&p.set("Authorization",`ApiKey ${b}`);let T=new AbortController,U=new Fe(o,c),j=o>0?setTimeout(()=>T.abort(U),o):null;j?.unref?.();let ne=Lt(u.signal,T.signal,o),J=d(()=>{j&&clearTimeout(j)},"cleanup");try{let R=await fetch(c,{...u,headers:p,signal:ne});return zt(R,{cleanup:J,maximumBytes:s,requestUrl:c,timeoutController:T,timeoutError:U})}catch(R){throw J(),T.signal.aborted?U:R}}d(X,"apiFetch");async function me(t,e){let n;try{let r=await t.text();n=r?JSON.parse(r):{}}catch(r){if(r instanceof Fe||r instanceof pe)throw r;n={}}if(!t.ok){let r=typeof n.error=="string"?n.error:null,o=typeof n.message=="string"?n.message:null;throw new He(t.status,r,e,o)}return n}d(me,"readApiJson");function zt(t,e){if(!t.body)return e.cleanup(),t;let n=Number(t.headers.get("content-length"));if(e.maximumBytes>0&&Number.isFinite(n)&&n>e.maximumBytes)throw e.cleanup(),t.body.cancel(),new pe(e.maximumBytes,e.requestUrl);let r=t.body.getReader(),o=0,s=new ReadableStream({async pull(i){try{let u=await r.read();if(u.done){e.cleanup(),i.close();return}if(o+=u.value.byteLength,e.maximumBytes>0&&o>e.maximumBytes){e.cleanup(),await r.cancel(),i.error(new pe(e.maximumBytes,e.requestUrl));return}i.enqueue(u.value)}catch(u){e.cleanup(),i.error(e.timeoutController.signal.aborted?e.timeoutError:u)}},async cancel(i){e.cleanup(),await r.cancel(i)}});return new Response(s,{headers:t.headers,status:t.status,statusText:t.statusText})}d(zt,"boundedResponse");function Lt(t,e,n){return n<=0?t??void 0:t?AbortSignal.any([t,e]):e}d(Lt,"composedSignal");var C=a.string().min(1).max(200),_=a.string().regex(/^[a-f0-9]{64}$/),le=a.object({operationId:C,name:a.string().trim().min(1).max(500),projectId:C,dataset:G.extend({revision:a.number().int().positive()}).strict(),caseIds:a.array(C).min(1).max(1e4)}).strict().superRefine((t,e)=>{new Set(t.caseIds).size!==t.caseIds.length&&e.addIssue({code:"custom",message:"Select each case once."})}),Bt=B.extend({inputHash:_,outputHash:_.nullable(),task:Ce,taskHash:_}).strict(),Nt=a.object({schemaVersion:a.literal("openpond.connectedRecordedExecution.v1"),id:C,teamId:C,ownerUserId:C,request:le,manifest:Ee,sources:a.array(Bt).min(1).max(1e4),contentHash:_}).strict();function Me(t){let e=Nt.parse(t),{contentHash:n,...r}=e,{contentHash:o,...s}=e.manifest;if(f(r)!==n||f(s)!==o||e.manifest.teamId!==e.teamId||e.manifest.id!==e.id||e.manifest.operationId!==e.request.operationId||f(e.manifest.dataset)!==f(e.request.dataset)||e.sources.length!==e.request.caseIds.length||e.sources.length!==e.manifest.population.length||e.sources.some((i,u)=>i.taskHash!==f(i.task)||i.task.id!==e.request.caseIds[u]||i.boundaryId!==i.task.id||e.manifest.population[u]?.caseId!==i.boundaryId))throw new Error("Recorded execution identity or population integrity failed.");return e}d(Me,"verifyConnectedRecordedExecution");var Ft=a.object({projectId:C.optional(),cursor:C.optional(),limit:a.number().int().min(1).max(50).default(20)}).strict(),Ht=a.object({id:C,teamId:C,ownerUserId:C,projectId:C,name:a.string().min(1).max(500),dataset:le.shape.dataset,manifestHash:_,contentHash:_,caseCount:a.number().int().min(1).max(1e4),createdAt:a.string().datetime()}).strict(),Mt=a.object({teamId:C,items:a.array(Ht).max(50),nextCursor:C.nullable()}).strict(),Dt=a.object({datasetId:a.string().trim().min(1).max(240),expectedRevision:a.number().int().positive(),operationId:a.string().trim().min(1).max(240),graders:a.array(Pe).min(1).max(100).optional()}).strict().superRefine((t,e)=>{t.graders&&new Set(t.graders.map(n=>n.id)).size!==t.graders.length&&e.addIssue({code:"custom",path:["graders"],message:"Choose one exact revision of each grader."})}),N=a.string().min(1).max(500),k=a.number().int().nonnegative(),Jt=a.object({teamId:N,ownerUserId:N,projectId:N.nullable(),status:a.enum(["active","paused","archived"]),revision:k,state:a.enum(["collecting","pending","attention","paused","archived"]),lastReconciledAt:a.string().datetime().nullable(),lastCapturedAt:a.string().datetime().nullable(),historyDays:a.number().int().positive(),sources:k,tasks:k,datasets:a.array(a.object({datasetId:N,projection:a.enum(["turn","conversation"]),revision:k}).strict()).max(2),latestBatch:a.object({operationId:N,updatedAt:a.string().datetime(),scanned:k,captured:k,unchanged:k,pending:k,failed:k,excluded:k,paused:k,hasMore:a.boolean()}).strict().nullable()}).strict(),h=a.string().min(1).max(500),E=a.string().regex(/^[a-f0-9]{64}$/),De=a.object({teamId:h,projectId:h.nullable(),status:a.enum(["active","paused","archived"]),revision:a.number().int().nonnegative()}).strict(),Kt=a.object({teamId:h,operationId:h,projectId:h.nullable(),outcomes:a.array(a.object({conversationId:h,state:a.enum(["captured","unchanged","pending","paused","excluded","failed"]),sourceId:h.optional(),snapshotHash:E.optional(),reason:a.string().optional()}).strict()).max(50),nextCursor:h.nullable()}).strict(),Gt=a.object({teamId:h,ref:B,origin:W.shape.source,sessionId:h,projectId:h,capturedAt:a.string().datetime(),unmappedEvidence:a.object({count:a.number().int().nonnegative().max(1e5),contentHash:E}).strict(),evidence:a.object({input:a.array(K),observed:a.array(K),answer:a.json(),boundary:qe}).strict()}).strict(),Wt=a.object({teamId:h,sourceId:h,snapshotHash:E,contentHash:E,count:a.number().int().nonnegative(),offset:a.number().int().nonnegative(),events:a.array(K).max(50),nextOffset:a.number().int().nonnegative().nullable()}).strict(),Xt=a.object({teamId:h,source:q.shape.source,sourceHash:E,previewHash:E,destination:q.shape.destination,issues:a.array(a.object({file:a.string(),message:a.string()}).strict()).max(100),sessions:a.array(a.object({sessionHash:E,sessionId:h,origin:W.shape.source,exporterVersion:a.string().nullable(),eventCount:a.number().int().nonnegative(),boundaries:a.array(a.object({id:h,projection:a.enum(["turn","conversation"]),answer:a.boolean(),process:a.enum(["retained","partial","absent"]),terminal:a.enum(["completed","failed","cancelled","unknown"])}).strict()).max(5001),warnings:a.array(a.string()).max(100),sample:a.array(a.object({role:a.enum(["user","assistant","system","tool"]).nullable(),text:a.string().max(4e3)}).strict()).max(3)}).strict()).max(1e3)}).strict(),Je=a.object({teamId:h,operationId:h,requestHash:E,previewHash:E,projectId:h.optional(),state:a.enum(["admitting","publishing","completed","failed"]),outcomes:a.array(a.object({sessionHash:E,sourceId:h,status:a.enum(["imported","already_present"]),datasets:a.array(a.object({datasetId:h,revision:a.number().int().positive(),changed:a.boolean()}).strict()).max(2)}).strict()).max(1e3),error:a.string().optional()}).strict(),Ke=class extends Error{static{d(this,"ConnectedEvidenceError")}constructor(t,e,n){super(n),this.status=t,this.code=e,this.name="ConnectedEvidenceError"}status;code},ir=class{static{d(this,"ConnectedEvidenceClient")}constructor(t){this.options=t;let e=new URL(t.baseUrl);if(!["http:","https:"].includes(e.protocol)||e.username||e.password||e.search||e.hash||!t.apiKey.trim()||!t.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=e.toString().replace(/\/+$/,"")}options;baseUrl;async capture(t,e){let n=ze.parse(t),r=Kt.parse(await this.request("/capture","POST",n,e));if(this.scope(r.teamId),r.operationId!==n.operationId||r.outcomes.length>n.limit||n.conversationId&&r.outcomes.some(o=>o.conversationId!==n.conversationId))throw new Error("Capture receipt differs from its requested source or operation.");return r}async retainStartingAssets(t,e){let n=Be.parse(t),r=ce(await this.request("/starting-assets","POST",n,e));if(this.scope(r.teamId),r.operationId!==n.operationId||r.requestHash!==f(n)||f(r.source)!==f(n.source)||r.assets.length!==n.proofs.length||r.assets.some((o,s)=>o.path!==n.proofs[s].path))throw new Error("Starting assets differ from the exact source, operation or selected paths.");return r}async startingAssets(t,e){let n=ce(await this.request(`/starting-assets/${encodeURIComponent(h.parse(t))}`,"GET",void 0,e));if(this.scope(n.teamId),n.id!==t)throw new Error("Starting assets identity mismatch.");return n}async list(t={},e){let n=a.object({projectId:h.optional(),cursor:h.optional(),limit:a.number().int().min(1).max(50).default(20)}).strict().parse(t),r=new URLSearchParams(Object.entries(n).filter(([,s])=>s!==void 0).map(([s,i])=>[s,String(i)])),o=a.object({teamId:h,items:a.array(W).max(50),nextCursor:h.nullable()}).strict().parse(await this.request(`?${r}`,"GET",void 0,e));if(this.scope(o.teamId),o.items.length>n.limit||new Set(o.items.map(s=>s.sourceId)).size!==o.items.length||o.nextCursor!==null&&o.nextCursor===n.cursor||n.projectId&&o.items.some(s=>s.projectId!==n.projectId))throw new Error("Connected source page differs from its requested scope.");return o}async read(t,e){let n=B.parse(t),r=Gt.parse(await this.request(`/${encodeURIComponent(n.id)}/cases/${encodeURIComponent(n.boundaryId)}?snapshotHash=${n.snapshotHash}&revisionHash=${n.boundaryRevisionHash}`,"GET",void 0,e));if(this.scope(r.teamId),f(r.ref)!==f(n)||r.evidence.boundary.id!==n.boundaryId||r.evidence.boundary.revisionHash!==n.boundaryRevisionHash||f(r.evidence.input)!==r.evidence.boundary.inputHash||f(r.evidence.observed)!==n.boundaryRevisionHash||r.evidence.boundary.outputHash!==null&&f(r.evidence.answer)!==r.evidence.boundary.outputHash)throw new Error("Connected case readback differs from its exact snapshot or cutoff.");return r}async setCollection(t,e){let n=De.parse(await this.request("/collection","PUT",a.object({paused:a.boolean()}).strict().parse({paused:t}),e));return this.scope(n.teamId),n}async collection(t){let e=De.parse(await this.request("/collection","GET",void 0,t));return this.scope(e.teamId),e}async collectionStatus(t){let e=Jt.parse(await this.request("/collection/status","GET",void 0,t));return this.scope(e.teamId),e}async unmappedEvents(t,e){let n=a.object({id:h,snapshotHash:E,contentHash:E,offset:a.number().int().nonnegative().default(0),limit:a.number().int().min(1).max(50).default(20)}).strict().parse(t),r=Wt.parse(await this.request(`/${encodeURIComponent(n.id)}/unmapped-events?snapshotHash=${n.snapshotHash}&offset=${n.offset}&limit=${n.limit}`,"GET",void 0,e));if(this.scope(r.teamId),r.sourceId!==n.id||r.snapshotHash!==n.snapshotHash||r.contentHash!==n.contentHash||r.offset!==n.offset||r.events.length>n.limit||r.events.some((o,s)=>o.sequence!==n.offset+s)||r.nextOffset!==null&&r.nextOffset!==n.offset+r.events.length)throw new Error("Unmapped source event page differs from its pinned snapshot.");return r}async homeSummary(t,e){let n=a.object({from:a.string().datetime(),to:a.string().datetime(),projectId:h.optional()}).strict(),r=n.parse(t),o=new URLSearchParams(Object.entries(r)),s=a.object({teamId:h,range:n,activity:a.object({conversations:a.number().int().nonnegative(),turns:a.number().int().nonnegative(),chatTurns:a.number().int().nonnegative(),workTurns:a.number().int().nonnegative()}).strict(),accounting:a.object({contextSnapshots:a.number().int().nonnegative()}).strict(),usage:Oe}).strict().parse(await this.request(`/summary?${o}`,"GET",void 0,e));if(this.scope(s.teamId),f(s.range)!==f(r)||s.activity.chatTurns+s.activity.workTurns!==s.activity.turns)throw new Error("Activity summary differs from its requested range.");for(let i of[s.usage.days,s.usage.modes,s.usage.models]){if(new Set(i.map(u=>u.key)).size!==i.length)throw new Error("Duplicate usage summary group.");for(let u of Object.keys(s.usage.total))if(i.reduce((c,p)=>c+p[u],0)!==s.usage.total[u])throw new Error("Usage totals differ from their displayed groups.")}return s}async uploadPart(t,e){let n=Le.parse(t),r=a.object({teamId:h,hash:E,parts:a.number().int(),index:a.number().int()}).strict().parse(await this.request("/imports/upload","POST",n,e));if(this.scope(r.teamId),r.hash!==n.hash||r.parts!==n.parts||r.index!==n.index)throw new Error("Upload receipt differs from its part identity.");return r}async preview(t,e){let n=q.parse(t),r=Xt.parse(await this.request("/imports/preview","POST",n,e));if(this.scope(r.teamId),r.source!==n.source||f(r.destination)!==f(n.destination)||r.sessions.some(o=>o.origin!==n.source)||new Set(r.sessions.map(o=>o.sessionHash)).size!==r.sessions.length)throw new Error("Import preview differs from its source or destination.");return r}async commit(t,e){let n=ie.parse(t),r=Je.parse(await this.request("/imports/commit","POST",n,e));if(this.scope(r.teamId),r.operationId!==n.operationId||r.previewHash!==n.previewHash||r.requestHash!==f(n)||r.outcomes.some(o=>!n.selection.some(s=>s.sessionHash===o.sessionHash))||r.state==="completed"&&r.outcomes.length!==n.selection.length)throw new Error("Import receipt differs from its exact selection or operation.");return r}async readImport(t,e){let n=h.parse(t),r=Je.parse(await this.request(`/imports/${encodeURIComponent(n)}`,"GET",void 0,e));if(this.scope(r.teamId),r.operationId!==n)throw new Error("Import identity mismatch.");return r}async prepareRecorded(t,e){let n=le.parse(t),r=Me(await this.request("/recorded-executions","POST",n,e));if(this.scope(r.teamId),f(r.request)!==f(n))throw new Error("Recorded admission differs from its selected Dataset/cases.");return r}async listRecordedExecutions(t={},e){let n=Ft.parse(t),r=new URLSearchParams(Object.entries(n).filter(([,s])=>s!==void 0).map(([s,i])=>[s,String(i)])),o=Mt.parse(await this.request(`/recorded-executions?${r}`,"GET",void 0,e));if(this.scope(o.teamId),o.items.length>n.limit||o.items.some((s,i)=>s.teamId!==o.teamId||n.projectId&&s.projectId!==n.projectId||n.cursor&&s.id<=n.cursor||i>0&&s.id<=o.items[i-1].id)||o.items.some(s=>s.ownerUserId!==o.items[0]?.ownerUserId)||o.nextCursor!==null&&(n.cursor!==void 0&&o.nextCursor<=n.cursor||o.items.length>0&&o.nextCursor<o.items.at(-1).id))throw new Error("Recorded execution page differs from its requested scope or cursor.");return o}async recordedExecution(t,e){let n=Me(await this.request(`/recorded-executions/${encodeURIComponent(h.parse(t))}`,"GET",void 0,e));if(this.scope(n.teamId),n.id!==t)throw new Error("Recorded execution identity mismatch.");return n}async publishDataset(t,e){let n=Dt.parse(t),r=de.parse(await this.request("/datasets/publish","POST",n,e));this.scope(r.teamId);let o=r.workspace.draft.metadata.connectedPublication;if(r.datasetId!==n.datasetId||!r.publication||!o||typeof o!="object"||!("requestHash"in o)||o.requestHash!==f(n))throw new Error("Published Dataset identity or original selection mismatch.");return r}async createSelection(t,e){let n=a.object({operationId:h.max(240),projectId:h.max(240),name:a.string().trim().min(1).max(200),cases:a.array(B).min(1).max(500)}).strict().parse(t),r=de.parse(await this.request("/datasets/selection","POST",n,e));if(this.scope(r.teamId),r.originProjectId!==n.projectId||r.workspace.draft.tasks.length!==n.cases.length||r.workspace.draft.tasks.some((o,s)=>f(o.input&&typeof o.input=="object"&&!Array.isArray(o.input)?o.input.connectedEvidenceRef:null)!==f(n.cases[s])))throw new Error("Selected Dataset differs from its exact source population.");return r}scope(t){if(t!==this.options.teamId)throw new Error("Connected evidence workspace mismatch.")}async request(t,e,n,r){let{response:o,value:s}=await Te(this.options.fetch??fetch,`${this.baseUrl}/v1/connected-evidence${t}`,{method:e,signal:r,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,"Content-Type":"application/json",Accept:"application/json"},...n===void 0?{}:{body:JSON.stringify(n)}},(i,u,c)=>new Ke(i,u,c));if(!o.ok){let i=a.object({code:a.string(),message:a.string()}).safeParse(s);throw new Ke(o.status,i.success?i.data.code:"connected_request_failed",i.success?i.data.message:"Connected evidence request failed.")}return s}},I=a.string().trim().min(1).max(240),ur=a.object({id:I,expectedRevision:a.number().int().positive(),manifest:$e}).strict().refine(t=>t.id===t.manifest.connectionId&&t.expectedRevision===t.manifest.connectionRevision,"Collector coverage scope differs from its connection."),pr=a.object({id:I,cutoff:a.iso.datetime().optional()}).strict(),mr=a.object({schemaVersion:a.literal("openpond.connectedSyncCoverageReceipt.v1"),id:I,teamId:I,ownerUserId:I,connectionId:I,connectionRevision:a.number().int().positive(),receivedAt:a.iso.datetime(),summary:je}).strict(),lr=a.object({id:I,source:q.shape.source,machineId:I,sourceInstanceId:I,sourceLabel:a.string().trim().min(1).max(200),sourceRoot:a.string().min(1).max(2e3),destination:q.shape.destination,since:a.string().datetime().nullable(),keepSyncing:a.boolean(),expectedRevision:a.number().int().nonnegative()}).strict(),hr=a.object({id:I,expectedRevision:a.number().int().positive(),action:a.enum(["pause","resume","disconnect"])}).strict(),fr=a.object({id:I,operationId:I,expectedRevision:a.number().int().positive()}).strict(),yr=a.object({id:I,expectedRevision:a.number().int().positive(),pendingOperations:a.number().int().min(0).max(1e4),error:a.string().max(500).nullable(),completedSyncRevision:a.number().int().nonnegative().default(0)}).strict(),gr=a.object({teamId:I,id:I,revision:a.number().int().positive(),source:q.shape.source,sourceLabel:a.string(),sourceRoot:a.string(),taskDatasetId:I.nullable(),conversationDatasetId:I.nullable(),machineId:I,sourceInstanceId:I,projectId:I,datasetIds:a.array(I).max(2),since:a.string().datetime().nullable(),keepSyncing:a.boolean(),state:a.enum(["active","paused","disconnected"]),health:a.enum(["online","offline"]),lastHeartbeatAt:a.string().datetime().nullable(),lastAdmissionAt:a.string().datetime().nullable(),pendingOperations:a.number().int().nonnegative(),admittedTasks:a.number().int().nonnegative(),error:a.string().nullable(),requestedSyncRevision:a.number().int().nonnegative().default(0),completedSyncRevision:a.number().int().nonnegative().default(0),syncRequestedAt:a.string().datetime().nullable().default(null),syncCompletedAt:a.string().datetime().nullable().default(null)}).strict().refine(t=>t.completedSyncRevision<=t.requestedSyncRevision&&t.requestedSyncRevision<=t.revision,"Invalid sync acknowledgement generation."),br=a.object({connectionId:I,expectedRevision:a.number().int().positive(),request:ie}).strict();function Pr(t){let e=d(r=>`/v1/training/candidate-evaluations/${encodeURIComponent(r)}`,"path");function n(r,o,s){let i=Zt.parse(r);if(i.teamId!==o||s&&i.id!==s)throw new Error("The preparation belongs to another workspace or candidate operation.");return i}return d(n,"read"),{async options(r,o={}){let s=new URLSearchParams({teamId:r,...o}),i=Yt.parse(await t(`/v1/training/candidates?${s}`));if(i.teamId!==r)throw new Error("The candidate catalog belongs to another workspace.");return i},async save(r){let o=We.parse(r),s=n(await t(`/v1/training/candidate-evaluations?teamId=${encodeURIComponent(o.teamId)}`,{method:"POST",body:JSON.stringify(o)}),o.teamId);if(s.requestHash!==f(o))throw new Error("The saved preparation differs from the selected candidate or frozen evaluation.");return s},async get(r,o){return n(await t(`${e(o)}?teamId=${encodeURIComponent(r)}`),r,o)},async control(r,o,s,i){let u=Qt.parse(i),c=n(await t(`${e(o)}/${s}?teamId=${encodeURIComponent(r)}`,{method:"POST",body:JSON.stringify(u)}),r,o);if(c.requestHash!==u.requestHash)throw new Error("The command returned a different frozen evaluation.");return c}}}d(Pr,"createCandidateEvaluationClient");var S=a.string().trim().min(1).max(200),he=a.string().regex(/^[a-f0-9]{64}$/),Ge=a.object({id:S,contentHash:he}).strict(),Vt=a.object({artifact:Ge,trainingJobId:S,configurationId:S,baseProfileId:S,ready:a.boolean(),reason:a.string().max(1e3).nullable()}).strict(),Yt=a.object({teamId:S,ownerUserId:S,items:a.array(Vt).max(100),nextCursor:S.nullable()}).strict(),We=a.object({teamId:S,operationId:S,artifact:Ge,configuration:L}).strict().superRefine((t,e)=>{(t.configuration.request.teamId!==t.teamId||t.configuration.request.policy.kind==="fixture"||t.configuration.request.policy.candidate)&&e.addIssue({code:"custom",message:"Choose one exact model-backed evaluation before preparing the trained version."})}),Zt=a.object({schemaVersion:a.literal("openpond.candidateEvaluationPreparation.v1"),teamId:S,ownerUserId:S,id:S,revision:a.number().int().positive(),requestHash:he,request:We,trainingJobId:S,dispatchId:S,lastOperationId:S.nullable(),runtime:a.object({poolId:S,endpointId:S.nullable(),baseProfileId:S,workerImageDigest:a.string().regex(/^sha256:[a-f0-9]{64}$/),modelId:S.nullable()}).strict().nullable(),state:a.enum(["configured","preparing","ready","dispatching","submitted","cleaning","completed","failed","cancelled"]),experimentId:S.nullable(),authorizedAt:a.iso.datetime().nullable(),cancelledAt:a.iso.datetime().nullable(),reason:a.string().max(1e3).nullable(),createdAt:a.iso.datetime(),updatedAt:a.iso.datetime()}).strict().superRefine((t,e)=>{(t.requestHash!==f(t.request)||!t.runtime&&["ready","dispatching","submitted","completed"].includes(t.state))&&e.addIssue({code:"custom",message:"The exact candidate preparation request or runtime changed."})}),Qt=a.object({operationId:S,expectedRevision:a.number().int().positive(),requestHash:he}).strict();var x=a.string().trim().min(1).max(200),F=a.string().regex(/^[a-f0-9]{64}$/),H=a.string().datetime(),Xe=a.object({operationId:x,id:x.optional(),expectedRevision:a.number().int().nonnegative(),teamId:x,projectId:x.nullable(),enabled:a.boolean(),configuration:L,cadence:a.discriminatedUnion("kind",[a.object({kind:a.literal("interval"),seconds:a.number().int().min(60).max(31536e3)}).strict(),a.object({kind:a.literal("nightly"),calendar:Ae}).strict()]),maximumTotalSpendUsd:a.number().finite().positive().max(1e4),maximumAttempts:a.number().int().min(1).max(20)}).strict().superRefine((t,e)=>{(t.configuration.request.teamId!==t.teamId||(t.configuration.request.project?.id??null)!==t.projectId)&&e.addIssue({code:"custom",message:"The scheduled Experiment must retain its actual workspace and Project."}),t.configuration.maximumCostUsd>t.maximumTotalSpendUsd&&e.addIssue({code:"custom",message:"The run ceiling exceeds the approved cumulative schedule ceiling."})}),en=a.object({id:x,scheduledAt:H,coalescedThroughAt:H,coalescedCount:a.number().int().nonnegative(),configurationHash:F,operationId:x,state:a.enum(["reserved","dispatching","running","cleaning","completed","failed","cancelled","uncertain"]),executionId:x.nullable(),attempt:a.number().int().positive(),maximumCostUsd:a.number().finite().positive(),actualSpendUsd:a.number().finite().nonnegative().nullable(),cleanupComplete:a.boolean(),error:a.string().max(4e3).nullable()}).strict(),tn=a.object({schemaVersion:a.literal("openpond.experimentEvaluationSchedule.v1"),id:x,revision:a.number().int().positive(),actorId:x,teamId:x,projectId:x.nullable(),operationId:x,requestHash:F,configuration:L,configurationHash:F,cadence:Xe.shape.cadence,state:a.enum(["scheduled","disabled","blocked"]),nextRunAt:H.nullable(),maximumTotalSpendUsd:a.number().finite().positive(),maximumAttempts:a.number().int().positive(),lastEvaluatedConfigurationHash:F.nullable(),newerUnevaluatedRelease:G.nullable(),fires:a.array(en).max(1e4),reason:a.string().max(4e3).nullable(),createdAt:H,updatedAt:H,contentHash:F}).strict();function nn(t){let{operationId:e,request:n,...r}=t,{operationId:o,...s}=n;return f({...r,request:s})}d(nn,"scheduledExperimentHash");function rn(t){let e=tn.parse(t);if(_e(e,"Scheduled Experiment"),e.configurationHash!==nn(e.configuration)||e.configuration.request.teamId!==e.teamId||(e.configuration.request.project?.id??null)!==e.projectId)throw new Error("Scheduled Experiment immutable authority differs from its recipe.");return e}d(rn,"verifyExperimentEvaluationSchedule");function $r(t){return rn({...t,contentHash:f(t)})}d($r,"sealExperimentEvaluationSchedule");var on=a.object({teamId:x,id:x,operationId:x,expectedRevision:a.number().int().positive(),action:a.enum(["cancel_active","retry_active","pause"])}).strict(),jr=a.discriminatedUnion("operation",[a.object({operation:a.literal("publish"),request:Xe}).strict(),a.object({operation:a.literal("control"),request:on}).strict(),a.object({operation:a.literal("read"),id:x}).strict(),a.object({operation:a.literal("list"),cursor:x.optional(),limit:a.number().int().min(1).max(100).default(50)}).strict()]);function an(t){return{list:d((e={})=>t.listSandboxRuntimes(e),"list"),create:d(e=>t.createSandboxRuntime(e),"create"),handle:d((e,n=null)=>t.sandboxRuntime(e,n),"handle"),get:d(e=>t.getSandboxRuntime(e),"get"),createSandbox:d((e,n={},r={})=>t.createSandboxRuntimeSandbox(e,n,r),"createSandbox"),updateStatus:d((e,n)=>t.updateSandboxRuntimeStatus(e,n),"updateStatus"),events:d(e=>t.listSandboxRuntimeEvents(e),"events"),event:d((e,n)=>t.emitSandboxRuntimeEvent(e,n),"event"),checkpoint:d((e,n={})=>t.checkpointSandboxRuntime(e,n),"checkpoint"),promote:d((e,n,r={})=>t.promoteSandboxRuntime(e,n,r),"promote"),preserveSource:d((e,n={},r={})=>t.preserveSandboxRuntimeSource(e,n,r),"preserveSource")}}d(an,"createSandboxRuntimeNamespace");function sn(t){return{list:d((e={})=>t.list(e),"list"),create:d(e=>t.create(e),"create"),get:d(e=>t.get(e),"get"),pricing:d(()=>t.pricing(),"pricing"),costs:d((e={})=>t.costs(e),"costs")}}d(sn,"createSandboxNamespace");function dn(t){return{list:d(e=>t.listProjects(e),"list"),upsert:d(e=>t.upsertProject(e),"upsert"),upsertGitRemote:d(e=>t.upsertProjectGitRemote(e),"upsertGitRemote"),get:d((e,n)=>t.getProject(e,n),"get"),update:d((e,n)=>t.updateProject(e,n),"update"),sync:d((e,n)=>t.syncProject(e,n),"sync"),ensureGitRemote:d((e,n)=>t.ensureProjectGitRemote(e,n),"ensureGitRemote"),getGitRemote:d((e,n)=>t.ensureProjectGitRemote(e,n),"getGitRemote"),git:d((e,n)=>t.ensureProjectGitRemote(e,n),"git"),uploadSource:d((e,n)=>t.uploadProjectSource(e,n),"uploadSource"),archive:d((e,n)=>t.archiveProject(e,n),"archive")}}d(dn,"createSandboxProjectNamespace");function cn(t){return{get:d(e=>t.getHostedProfile(e),"get"),status:d(e=>t.getHostedProfile(e),"status"),ensureHosted:d(e=>t.ensureHostedProfile(e),"ensureHosted"),push:d(e=>t.pushHostedProfile(e),"push")}}d(cn,"createSandboxProfileNamespace");function un(t){return{list:d(e=>t.listAgents(e),"list"),upsert:d(e=>t.upsertAgent(e),"upsert"),get:d((e,n)=>t.getAgent(e,n),"get"),update:d((e,n)=>t.updateAgent(e,n),"update"),archive:d((e,n)=>t.archiveAgent(e,n),"archive"),run:d((e,n)=>t.runAgent(e,n),"run"),sourceDeployPlan:d((e,n)=>t.getAgentSourceDeployPlan(e,n),"sourceDeployPlan"),manifestSnapshots:d((e,n)=>t.listAgentManifestSnapshots(e,n),"manifestSnapshots"),requestSourceChecks:d((e,n)=>t.requestAgentSourceChecks(e,n),"requestSourceChecks"),configureSourceSetup:d((e,n)=>t.configureAgentSourceSetup(e,n),"configureSourceSetup"),publishSource:d((e,n)=>t.publishAgentSource(e,n),"publishSource")}}d(un,"createSandboxAgentNamespace");function pn(t,e,n=null){let r=d(async(c={},p={})=>{let b=await t.getSandboxRuntime(e);return b.sandboxId?t.get(b.sandboxId):t.createSandboxRuntimeSandbox(e,c,p).then(l=>l.sandbox)},"currentSandbox"),o=d(async(c={},p={})=>{let b=await t.getSandboxRuntime(e);if(!b.sandboxId)return t.createSandboxRuntimeSandbox(e,c,p).then(g=>g.sandbox);let l=await t.get(b.sandboxId);return l.state==="stopped"?t.start(l.id,p).then(g=>g.sandbox):l.state==="archived"?t.restore(l.id).then(g=>g.sandbox):l.state==="deleted"||l.state==="error"?t.createSandboxRuntimeSandbox(e,c,p).then(g=>g.sandbox):l},"resume");return{id:e,initial:n,get:d(()=>t.getSandboxRuntime(e),"get"),sandbox:r,resume:o,createSandbox:d((c={},p={})=>t.createSandboxRuntimeSandbox(e,c,p),"createSandbox"),status:d(async c=>{if(typeof c!="string")return t.updateSandboxRuntimeStatus(e,c);let p=await t.getSandboxRuntime(e);return t.updateSandboxRuntimeStatus(e,{status:c,expectedVersion:p.version})},"status"),events:d(()=>t.listSandboxRuntimeEvents(e),"events"),event:d(c=>t.emitSandboxRuntimeEvent(e,c),"event"),recordCommit:d((c,p={})=>t.emitSandboxRuntimeEvent(e,{...p,type:p.type??"git.commit",commitSha:c}),"recordCommit"),checkpointHint:d((c={})=>t.emitSandboxRuntimeEvent(e,{type:"workflow.checkpoint_hint",summary:c.summary??c.reason??"Workflow checkpoint hint",payload:{...c.payload,reason:c.reason??null},artifactRefs:c.artifactRefs,lifecycleHint:{kind:"checkpoint",reason:c.reason??null}}),"checkpointHint"),waitForUser:d(async(c={})=>{await t.emitSandboxRuntimeEvent(e,{type:"workflow.waiting_for_user",summary:c.summary??c.reason??"Waiting for user",payload:{...c.payload,reason:c.reason??null},lifecycleHint:{kind:"waiting_for_user",reason:c.reason??null}});let p=await t.getSandboxRuntime(e);return p.status==="waiting_for_user"?p:t.updateSandboxRuntimeStatus(e,{status:"waiting_for_user",expectedVersion:p.version,summary:c.summary??c.reason,metadata:{workflowWaitForUserReason:c.reason??null}})},"waitForUser"),keepAlive:d((c={})=>{let p=mn(c);return t.emitSandboxRuntimeEvent(e,{type:"workflow.keepalive",summary:c.summary??c.reason??"Workflow keepalive",payload:{...c.payload,reason:c.reason??null,keepaliveUntil:p},lifecycleHint:{kind:"keepalive",reason:c.reason??null,keepaliveUntil:p}})},"keepAlive"),checkpoint:d(c=>t.checkpointSandboxRuntime(e,c),"checkpoint"),files:{write:d(async(c,p)=>t.uploadFile((await o()).id,c,p),"write"),read:d(async c=>t.downloadFile((await o()).id,c),"read"),readResponse:d(async c=>t.downloadFileResponse((await o()).id,c),"readResponse"),list:d(async(c={})=>t.listFiles((await o()).id,c),"list"),delete:d(async(c,p={})=>t.deleteFile((await o()).id,c,p),"delete"),search:d(async c=>t.searchFiles((await o()).id,c),"search"),stat:d(async c=>t.statFile((await o()).id,c),"stat"),mkdir:d(async c=>t.mkdir((await o()).id,c),"mkdir"),move:d(async c=>t.moveFile((await o()).id,c),"move")},commands:{run:d(async c=>t.exec((await o()).id,typeof c=="string"?{command:c}:c),"run")},ports:{expose:d(async c=>t.openPort((await o()).id,typeof c=="number"?{port:c}:c),"expose")},promote:d((c,p={})=>t.promoteSandboxRuntime(e,c,p),"promote"),preserveSource:d((c={},p={})=>t.preserveSandboxRuntimeSource(e,c,p),"preserveSource"),archive:d(async c=>{let p=c??(await t.getSandboxRuntime(e)).version;return t.updateSandboxRuntimeStatus(e,{status:"archived",expectedVersion:p})},"archive")}}d(pn,"createSandboxRuntimeHandle");function mn(t){if(t?.until instanceof Date)return t.until.toISOString();if(typeof t?.until=="string"&&t.until.trim())return new Date(t.until).toISOString();let e=typeof t?.seconds=="number"&&Number.isFinite(t.seconds)?Math.max(1,Math.trunc(t.seconds)):60;return new Date(Date.now()+e*1e3).toISOString()}d(mn,"runtimeKeepaliveUntilIso");async function ln(t,e={}){let n=`openpond-code-smoke-${Date.now()}`,r=`openpond-code-exec-ok:${n}`,o=`openpond-code-preview-ok:${n}`,s=`openpond-code-file-ok:${n}`,i=4173,u=null,c=null,p=!1,b=!1;try{let l=await Ye(t,await t.create({repo:e.repo??"https://github.com/octocat/Hello-World",resources:{cpu:e.cpu??1,memoryGb:e.memoryGb??1,diskGb:e.diskGb??8},budget:{maxUsd:e.budgetUsd??"0.05"},quotas:{maxSpendUsd:e.budgetUsd??"0.05",maxDurationSeconds:600,idleTimeoutSeconds:600,maxOpenPorts:2},metadata:{runId:n,source:"openpond-code-sandbox-smoke"}},{async:!0}));u=l.id;let g=e.expectedMppMode;if(g&&l.reservation.mpp?.mode!==g)throw new Error(`expected ${g} reservation, got ${l.reservation.mpp?.mode??"none"}`);if(!g&&!l.reservation.mpp?.mode)throw new Error("expected sandbox reservation MPP metadata");let P=await t.exec(l.id,{command:[`printf '${r}\\n'`,"test -f README && printf 'repo-clone-ok\\n'","cat > server.cjs <<'EOF'","const { createServer } = require('node:http');",`createServer((_request, response) => response.end('${o}')).listen(${i}, '0.0.0.0');`,"EOF","nohup node server.cjs > server.log 2>&1 & sleep 1"].join(`
|
|
2
|
+
import{b as Ne}from"./chunk-SYUKES6H.js";import{a as B,b as W,c as ze,d as Le,e as q,f as ie,i as de,o as Be,q as ce}from"./chunk-U7X5ZLAL.js";import{a as ue}from"./chunk-RY46UPBO.js";import{k as ae,m as se,n as Pe}from"./chunk-OQPJ7FJF.js";import{c as Te}from"./chunk-Y4I6CFZJ.js";import{E as L}from"./chunk-WGQ3FMRF.js";import{f as G,m as f,n as _e}from"./chunk-HIQPGYVH.js";import{a as Ce}from"./chunk-2LJCJOJ7.js";import{a as Oe,c as $e,d as je}from"./chunk-AMC4Z7G4.js";import{l as K,m as qe}from"./chunk-I6VMRQF4.js";import{h as Ue}from"./chunk-4PUOWSDE.js";import{Sa as Ae,ea as Ee,wb as ke}from"./chunk-ZY32SZ2P.js";import{a as re,b as oe}from"./chunk-KUE46HTH.js";import{b as z}from"./chunk-JCLTFDVW.js";import{A as a}from"./chunk-X2J2P5ZT.js";import{a as d}from"./chunk-FTQLQJQV.js";function jt(t,e){let n=t.token?.trim();if(!n||t.accountState.state!=="signed_in"||!t.accountState.activeProfile)throw new Error("A signed-in OpenPond account is required.");let r=Ce(t.apiBaseUrl,{apiBaseUrl:t.apiBaseUrl}),o=/\/api\/sandboxes\/?$/.test(r)?r.replace(/\/api\/sandboxes\/?$/,"/v1"):r.replace(/\/sandboxes\/?$/,"");return{audience:new URL(o).origin,async request(s){let i=n.startsWith("opk_"),u=await z(o,n,s.path,{method:s.method??"GET",signal:s.signal,explicitBearerAuth:!i,headers:{...i?{"openpond-api-key":n}:{},...s.idempotencyKey?{"idempotency-key":s.idempotencyKey}:{},...e?{"X-OpenPond-Team-Id":e}:{}},...s.body?{body:JSON.stringify(s.body)}:{},...s.timeoutMs!==void 0?{timeoutMs:s.timeoutMs}:{}}),c=await u.json().catch(()=>({}));if(!u.ok)throw new Error(typeof c.error=="string"?c.error:`OpenPond API request failed with status ${u.status}`);return c}}}d(jt,"createCapturedOpenPondPublicApiClient");var _t=3e4,Tt=8*1024*1024,Mn={timeoutMs:900*1e3,maxResponseBytes:64*1024*1024},Fe=class extends Error{static{d(this,"ApiTimeoutError")}timeoutMs;requestUrl;code="OPENPOND_API_TIMEOUT";constructor(t,e){super(`API request timed out after ${t}ms: ${e}`),this.timeoutMs=t,this.requestUrl=e,this.name="ApiTimeoutError"}},pe=class extends Error{static{d(this,"ApiResponseTooLargeError")}maximumBytes;requestUrl;code="OPENPOND_API_RESPONSE_TOO_LARGE";constructor(t,e){super(`API response exceeded ${t} bytes: ${e}`),this.maximumBytes=t,this.requestUrl=e,this.name="ApiResponseTooLargeError"}},He=class extends Error{static{d(this,"OpenPondApiError")}status;apiMessage;code;constructor(t,e,n,r=null){let o=r||e;super(`${n} failed: ${t}${o?` ${o}`:""}`),this.status=t,this.apiMessage=r,this.name="OpenPondApiError",this.code=e||"OPENPOND_API_ERROR"}};async function X(t,e,n,r={}){let{timeoutMs:o=_t,maxResponseBytes:s=Tt,explicitBearerAuth:i=!1,...u}=r,c=`${t}${n}`,p=new Headers(u.headers);p.set("Content-Type","application/json");let b=i?void 0:process.env.OPENPOND_API_KEY,l=e?.trim()||"",g=!i&&l.startsWith("opk_"),P=b||(g?l:null);P&&!p.has("openpond-api-key")&&p.set("openpond-api-key",P),e?p.set("Authorization",g?`ApiKey ${l}`:`Bearer ${e}`):b&&!p.has("Authorization")&&p.set("Authorization",`ApiKey ${b}`);let T=new AbortController,U=new Fe(o,c),j=o>0?setTimeout(()=>T.abort(U),o):null;j?.unref?.();let ne=Lt(u.signal,T.signal,o),J=d(()=>{j&&clearTimeout(j)},"cleanup");try{let R=await fetch(c,{...u,headers:p,signal:ne});return zt(R,{cleanup:J,maximumBytes:s,requestUrl:c,timeoutController:T,timeoutError:U})}catch(R){throw J(),T.signal.aborted?U:R}}d(X,"apiFetch");async function me(t,e){let n;try{let r=await t.text();n=r?JSON.parse(r):{}}catch(r){if(r instanceof Fe||r instanceof pe)throw r;n={}}if(!t.ok){let r=typeof n.error=="string"?n.error:null,o=typeof n.message=="string"?n.message:null;throw new He(t.status,r,e,o)}return n}d(me,"readApiJson");function zt(t,e){if(!t.body)return e.cleanup(),t;let n=Number(t.headers.get("content-length"));if(e.maximumBytes>0&&Number.isFinite(n)&&n>e.maximumBytes)throw e.cleanup(),t.body.cancel(),new pe(e.maximumBytes,e.requestUrl);let r=t.body.getReader(),o=0,s=new ReadableStream({async pull(i){try{let u=await r.read();if(u.done){e.cleanup(),i.close();return}if(o+=u.value.byteLength,e.maximumBytes>0&&o>e.maximumBytes){e.cleanup(),await r.cancel(),i.error(new pe(e.maximumBytes,e.requestUrl));return}i.enqueue(u.value)}catch(u){e.cleanup(),i.error(e.timeoutController.signal.aborted?e.timeoutError:u)}},async cancel(i){e.cleanup(),await r.cancel(i)}});return new Response(s,{headers:t.headers,status:t.status,statusText:t.statusText})}d(zt,"boundedResponse");function Lt(t,e,n){return n<=0?t??void 0:t?AbortSignal.any([t,e]):e}d(Lt,"composedSignal");var C=a.string().min(1).max(200),_=a.string().regex(/^[a-f0-9]{64}$/),le=a.object({operationId:C,name:a.string().trim().min(1).max(500),projectId:C,dataset:G.extend({revision:a.number().int().positive()}).strict(),caseIds:a.array(C).min(1).max(1e4)}).strict().superRefine((t,e)=>{new Set(t.caseIds).size!==t.caseIds.length&&e.addIssue({code:"custom",message:"Select each case once."})}),Bt=B.extend({inputHash:_,outputHash:_.nullable(),task:Ee,taskHash:_}).strict(),Nt=a.object({schemaVersion:a.literal("openpond.connectedRecordedExecution.v1"),id:C,teamId:C,ownerUserId:C,request:le,manifest:ke,sources:a.array(Bt).min(1).max(1e4),contentHash:_}).strict();function Me(t){let e=Nt.parse(t),{contentHash:n,...r}=e,{contentHash:o,...s}=e.manifest;if(f(r)!==n||f(s)!==o||e.manifest.teamId!==e.teamId||e.manifest.id!==e.id||e.manifest.operationId!==e.request.operationId||f(e.manifest.dataset)!==f(e.request.dataset)||e.sources.length!==e.request.caseIds.length||e.sources.length!==e.manifest.population.length||e.sources.some((i,u)=>i.taskHash!==f(i.task)||i.task.id!==e.request.caseIds[u]||i.boundaryId!==i.task.id||e.manifest.population[u]?.caseId!==i.boundaryId))throw new Error("Recorded execution identity or population integrity failed.");return e}d(Me,"verifyConnectedRecordedExecution");var Ft=a.object({projectId:C.optional(),cursor:C.optional(),limit:a.number().int().min(1).max(50).default(20)}).strict(),Ht=a.object({id:C,teamId:C,ownerUserId:C,projectId:C,name:a.string().min(1).max(500),dataset:le.shape.dataset,manifestHash:_,contentHash:_,caseCount:a.number().int().min(1).max(1e4),createdAt:a.string().datetime()}).strict(),Mt=a.object({teamId:C,items:a.array(Ht).max(50),nextCursor:C.nullable()}).strict(),Dt=a.object({datasetId:a.string().trim().min(1).max(240),expectedRevision:a.number().int().positive(),operationId:a.string().trim().min(1).max(240),graders:a.array(Ae).min(1).max(100).optional()}).strict().superRefine((t,e)=>{t.graders&&new Set(t.graders.map(n=>n.id)).size!==t.graders.length&&e.addIssue({code:"custom",path:["graders"],message:"Choose one exact revision of each grader."})}),N=a.string().min(1).max(500),k=a.number().int().nonnegative(),Jt=a.object({teamId:N,ownerUserId:N,projectId:N.nullable(),status:a.enum(["active","paused","archived"]),revision:k,state:a.enum(["collecting","pending","attention","paused","archived"]),lastReconciledAt:a.string().datetime().nullable(),lastCapturedAt:a.string().datetime().nullable(),historyDays:a.number().int().positive(),sources:k,tasks:k,datasets:a.array(a.object({datasetId:N,projection:a.enum(["turn","conversation"]),revision:k}).strict()).max(2),latestBatch:a.object({operationId:N,updatedAt:a.string().datetime(),scanned:k,captured:k,unchanged:k,pending:k,failed:k,excluded:k,paused:k,hasMore:a.boolean()}).strict().nullable()}).strict(),h=a.string().min(1).max(500),E=a.string().regex(/^[a-f0-9]{64}$/),De=a.object({teamId:h,projectId:h.nullable(),status:a.enum(["active","paused","archived"]),revision:a.number().int().nonnegative()}).strict(),Kt=a.object({teamId:h,operationId:h,projectId:h.nullable(),outcomes:a.array(a.object({conversationId:h,state:a.enum(["captured","unchanged","pending","paused","excluded","failed"]),sourceId:h.optional(),snapshotHash:E.optional(),reason:a.string().optional()}).strict()).max(50),nextCursor:h.nullable()}).strict(),Gt=a.object({teamId:h,ref:B,origin:W.shape.source,sessionId:h,projectId:h,capturedAt:a.string().datetime(),unmappedEvidence:a.object({count:a.number().int().nonnegative().max(1e5),contentHash:E}).strict(),evidence:a.object({input:a.array(K),observed:a.array(K),answer:a.json(),boundary:qe}).strict()}).strict(),Wt=a.object({teamId:h,sourceId:h,snapshotHash:E,contentHash:E,count:a.number().int().nonnegative(),offset:a.number().int().nonnegative(),events:a.array(K).max(50),nextOffset:a.number().int().nonnegative().nullable()}).strict(),Xt=a.object({teamId:h,source:q.shape.source,sourceHash:E,previewHash:E,destination:q.shape.destination,issues:a.array(a.object({file:a.string(),message:a.string()}).strict()).max(100),sessions:a.array(a.object({sessionHash:E,sessionId:h,origin:W.shape.source,exporterVersion:a.string().nullable(),eventCount:a.number().int().nonnegative(),boundaries:a.array(a.object({id:h,projection:a.enum(["turn","conversation"]),answer:a.boolean(),process:a.enum(["retained","partial","absent"]),terminal:a.enum(["completed","failed","cancelled","unknown"])}).strict()).max(5001),warnings:a.array(a.string()).max(100),sample:a.array(a.object({role:a.enum(["user","assistant","system","tool"]).nullable(),text:a.string().max(4e3)}).strict()).max(3)}).strict()).max(1e3)}).strict(),Je=a.object({teamId:h,operationId:h,requestHash:E,previewHash:E,projectId:h.optional(),state:a.enum(["admitting","publishing","completed","failed"]),outcomes:a.array(a.object({sessionHash:E,sourceId:h,status:a.enum(["imported","already_present"]),datasets:a.array(a.object({datasetId:h,revision:a.number().int().positive(),changed:a.boolean()}).strict()).max(2)}).strict()).max(1e3),error:a.string().optional()}).strict(),Ke=class extends Error{static{d(this,"ConnectedEvidenceError")}constructor(t,e,n){super(n),this.status=t,this.code=e,this.name="ConnectedEvidenceError"}status;code},ir=class{static{d(this,"ConnectedEvidenceClient")}constructor(t){this.options=t;let e=new URL(t.baseUrl);if(!["http:","https:"].includes(e.protocol)||e.username||e.password||e.search||e.hash||!t.apiKey.trim()||!t.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=e.toString().replace(/\/+$/,"")}options;baseUrl;async capture(t,e){let n=ze.parse(t),r=Kt.parse(await this.request("/capture","POST",n,e));if(this.scope(r.teamId),r.operationId!==n.operationId||r.outcomes.length>n.limit||n.conversationId&&r.outcomes.some(o=>o.conversationId!==n.conversationId))throw new Error("Capture receipt differs from its requested source or operation.");return r}async retainStartingAssets(t,e){let n=Be.parse(t),r=ce(await this.request("/starting-assets","POST",n,e));if(this.scope(r.teamId),r.operationId!==n.operationId||r.requestHash!==f(n)||f(r.source)!==f(n.source)||r.assets.length!==n.proofs.length||r.assets.some((o,s)=>o.path!==n.proofs[s].path))throw new Error("Starting assets differ from the exact source, operation or selected paths.");return r}async startingAssets(t,e){let n=ce(await this.request(`/starting-assets/${encodeURIComponent(h.parse(t))}`,"GET",void 0,e));if(this.scope(n.teamId),n.id!==t)throw new Error("Starting assets identity mismatch.");return n}async list(t={},e){let n=a.object({projectId:h.optional(),cursor:h.optional(),limit:a.number().int().min(1).max(50).default(20)}).strict().parse(t),r=new URLSearchParams(Object.entries(n).filter(([,s])=>s!==void 0).map(([s,i])=>[s,String(i)])),o=a.object({teamId:h,items:a.array(W).max(50),nextCursor:h.nullable()}).strict().parse(await this.request(`?${r}`,"GET",void 0,e));if(this.scope(o.teamId),o.items.length>n.limit||new Set(o.items.map(s=>s.sourceId)).size!==o.items.length||o.nextCursor!==null&&o.nextCursor===n.cursor||n.projectId&&o.items.some(s=>s.projectId!==n.projectId))throw new Error("Connected source page differs from its requested scope.");return o}async read(t,e){let n=B.parse(t),r=Gt.parse(await this.request(`/${encodeURIComponent(n.id)}/cases/${encodeURIComponent(n.boundaryId)}?snapshotHash=${n.snapshotHash}&revisionHash=${n.boundaryRevisionHash}`,"GET",void 0,e));if(this.scope(r.teamId),f(r.ref)!==f(n)||r.evidence.boundary.id!==n.boundaryId||r.evidence.boundary.revisionHash!==n.boundaryRevisionHash||f(r.evidence.input)!==r.evidence.boundary.inputHash||f(r.evidence.observed)!==n.boundaryRevisionHash||r.evidence.boundary.outputHash!==null&&f(r.evidence.answer)!==r.evidence.boundary.outputHash)throw new Error("Connected case readback differs from its exact snapshot or cutoff.");return r}async setCollection(t,e){let n=De.parse(await this.request("/collection","PUT",a.object({paused:a.boolean()}).strict().parse({paused:t}),e));return this.scope(n.teamId),n}async collection(t){let e=De.parse(await this.request("/collection","GET",void 0,t));return this.scope(e.teamId),e}async collectionStatus(t){let e=Jt.parse(await this.request("/collection/status","GET",void 0,t));return this.scope(e.teamId),e}async unmappedEvents(t,e){let n=a.object({id:h,snapshotHash:E,contentHash:E,offset:a.number().int().nonnegative().default(0),limit:a.number().int().min(1).max(50).default(20)}).strict().parse(t),r=Wt.parse(await this.request(`/${encodeURIComponent(n.id)}/unmapped-events?snapshotHash=${n.snapshotHash}&offset=${n.offset}&limit=${n.limit}`,"GET",void 0,e));if(this.scope(r.teamId),r.sourceId!==n.id||r.snapshotHash!==n.snapshotHash||r.contentHash!==n.contentHash||r.offset!==n.offset||r.events.length>n.limit||r.events.some((o,s)=>o.sequence!==n.offset+s)||r.nextOffset!==null&&r.nextOffset!==n.offset+r.events.length)throw new Error("Unmapped source event page differs from its pinned snapshot.");return r}async homeSummary(t,e){let n=a.object({from:a.string().datetime(),to:a.string().datetime(),projectId:h.optional()}).strict(),r=n.parse(t),o=new URLSearchParams(Object.entries(r)),s=a.object({teamId:h,range:n,activity:a.object({conversations:a.number().int().nonnegative(),turns:a.number().int().nonnegative(),chatTurns:a.number().int().nonnegative(),workTurns:a.number().int().nonnegative()}).strict(),accounting:a.object({contextSnapshots:a.number().int().nonnegative()}).strict(),usage:Oe}).strict().parse(await this.request(`/summary?${o}`,"GET",void 0,e));if(this.scope(s.teamId),f(s.range)!==f(r)||s.activity.chatTurns+s.activity.workTurns!==s.activity.turns)throw new Error("Activity summary differs from its requested range.");for(let i of[s.usage.days,s.usage.modes,s.usage.models]){if(new Set(i.map(u=>u.key)).size!==i.length)throw new Error("Duplicate usage summary group.");for(let u of Object.keys(s.usage.total))if(i.reduce((c,p)=>c+p[u],0)!==s.usage.total[u])throw new Error("Usage totals differ from their displayed groups.")}return s}async uploadPart(t,e){let n=Le.parse(t),r=a.object({teamId:h,hash:E,parts:a.number().int(),index:a.number().int()}).strict().parse(await this.request("/imports/upload","POST",n,e));if(this.scope(r.teamId),r.hash!==n.hash||r.parts!==n.parts||r.index!==n.index)throw new Error("Upload receipt differs from its part identity.");return r}async preview(t,e){let n=q.parse(t),r=Xt.parse(await this.request("/imports/preview","POST",n,e));if(this.scope(r.teamId),r.source!==n.source||f(r.destination)!==f(n.destination)||r.sessions.some(o=>o.origin!==n.source)||new Set(r.sessions.map(o=>o.sessionHash)).size!==r.sessions.length)throw new Error("Import preview differs from its source or destination.");return r}async commit(t,e){let n=ie.parse(t),r=Je.parse(await this.request("/imports/commit","POST",n,e));if(this.scope(r.teamId),r.operationId!==n.operationId||r.previewHash!==n.previewHash||r.requestHash!==f(n)||r.outcomes.some(o=>!n.selection.some(s=>s.sessionHash===o.sessionHash))||r.state==="completed"&&r.outcomes.length!==n.selection.length)throw new Error("Import receipt differs from its exact selection or operation.");return r}async readImport(t,e){let n=h.parse(t),r=Je.parse(await this.request(`/imports/${encodeURIComponent(n)}`,"GET",void 0,e));if(this.scope(r.teamId),r.operationId!==n)throw new Error("Import identity mismatch.");return r}async prepareRecorded(t,e){let n=le.parse(t),r=Me(await this.request("/recorded-executions","POST",n,e));if(this.scope(r.teamId),f(r.request)!==f(n))throw new Error("Recorded admission differs from its selected Dataset/cases.");return r}async listRecordedExecutions(t={},e){let n=Ft.parse(t),r=new URLSearchParams(Object.entries(n).filter(([,s])=>s!==void 0).map(([s,i])=>[s,String(i)])),o=Mt.parse(await this.request(`/recorded-executions?${r}`,"GET",void 0,e));if(this.scope(o.teamId),o.items.length>n.limit||o.items.some((s,i)=>s.teamId!==o.teamId||n.projectId&&s.projectId!==n.projectId||n.cursor&&s.id<=n.cursor||i>0&&s.id<=o.items[i-1].id)||o.items.some(s=>s.ownerUserId!==o.items[0]?.ownerUserId)||o.nextCursor!==null&&(n.cursor!==void 0&&o.nextCursor<=n.cursor||o.items.length>0&&o.nextCursor<o.items.at(-1).id))throw new Error("Recorded execution page differs from its requested scope or cursor.");return o}async recordedExecution(t,e){let n=Me(await this.request(`/recorded-executions/${encodeURIComponent(h.parse(t))}`,"GET",void 0,e));if(this.scope(n.teamId),n.id!==t)throw new Error("Recorded execution identity mismatch.");return n}async publishDataset(t,e){let n=Dt.parse(t),r=de.parse(await this.request("/datasets/publish","POST",n,e));this.scope(r.teamId);let o=r.workspace.draft.metadata.connectedPublication;if(r.datasetId!==n.datasetId||!r.publication||!o||typeof o!="object"||!("requestHash"in o)||o.requestHash!==f(n))throw new Error("Published Dataset identity or original selection mismatch.");return r}async createSelection(t,e){let n=a.object({operationId:h.max(240),projectId:h.max(240),name:a.string().trim().min(1).max(200),cases:a.array(B).min(1).max(500)}).strict().parse(t),r=de.parse(await this.request("/datasets/selection","POST",n,e));if(this.scope(r.teamId),r.originProjectId!==n.projectId||r.workspace.draft.tasks.length!==n.cases.length||r.workspace.draft.tasks.some((o,s)=>f(o.input&&typeof o.input=="object"&&!Array.isArray(o.input)?o.input.connectedEvidenceRef:null)!==f(n.cases[s])))throw new Error("Selected Dataset differs from its exact source population.");return r}scope(t){if(t!==this.options.teamId)throw new Error("Connected evidence workspace mismatch.")}async request(t,e,n,r){let{response:o,value:s}=await Te(this.options.fetch??fetch,`${this.baseUrl}/v1/connected-evidence${t}`,{method:e,signal:r,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,"Content-Type":"application/json",Accept:"application/json"},...n===void 0?{}:{body:JSON.stringify(n)}},(i,u,c)=>new Ke(i,u,c));if(!o.ok){let i=a.object({code:a.string(),message:a.string()}).safeParse(s);throw new Ke(o.status,i.success?i.data.code:"connected_request_failed",i.success?i.data.message:"Connected evidence request failed.")}return s}},I=a.string().trim().min(1).max(240),ur=a.object({id:I,expectedRevision:a.number().int().positive(),manifest:$e}).strict().refine(t=>t.id===t.manifest.connectionId&&t.expectedRevision===t.manifest.connectionRevision,"Collector coverage scope differs from its connection."),pr=a.object({id:I,cutoff:a.iso.datetime().optional()}).strict(),mr=a.object({schemaVersion:a.literal("openpond.connectedSyncCoverageReceipt.v1"),id:I,teamId:I,ownerUserId:I,connectionId:I,connectionRevision:a.number().int().positive(),receivedAt:a.iso.datetime(),summary:je}).strict(),lr=a.object({id:I,source:q.shape.source,machineId:I,sourceInstanceId:I,sourceLabel:a.string().trim().min(1).max(200),sourceRoot:a.string().min(1).max(2e3),destination:q.shape.destination,since:a.string().datetime().nullable(),keepSyncing:a.boolean(),expectedRevision:a.number().int().nonnegative()}).strict(),hr=a.object({id:I,expectedRevision:a.number().int().positive(),action:a.enum(["pause","resume","disconnect"])}).strict(),fr=a.object({id:I,operationId:I,expectedRevision:a.number().int().positive()}).strict(),yr=a.object({id:I,expectedRevision:a.number().int().positive(),pendingOperations:a.number().int().min(0).max(1e4),error:a.string().max(500).nullable(),completedSyncRevision:a.number().int().nonnegative().default(0)}).strict(),gr=a.object({teamId:I,id:I,revision:a.number().int().positive(),source:q.shape.source,sourceLabel:a.string(),sourceRoot:a.string(),taskDatasetId:I.nullable(),conversationDatasetId:I.nullable(),machineId:I,sourceInstanceId:I,projectId:I,datasetIds:a.array(I).max(2),since:a.string().datetime().nullable(),keepSyncing:a.boolean(),state:a.enum(["active","paused","disconnected"]),health:a.enum(["online","offline"]),lastHeartbeatAt:a.string().datetime().nullable(),lastAdmissionAt:a.string().datetime().nullable(),pendingOperations:a.number().int().nonnegative(),admittedTasks:a.number().int().nonnegative(),error:a.string().nullable(),requestedSyncRevision:a.number().int().nonnegative().default(0),completedSyncRevision:a.number().int().nonnegative().default(0),syncRequestedAt:a.string().datetime().nullable().default(null),syncCompletedAt:a.string().datetime().nullable().default(null)}).strict().refine(t=>t.completedSyncRevision<=t.requestedSyncRevision&&t.requestedSyncRevision<=t.revision,"Invalid sync acknowledgement generation."),br=a.object({connectionId:I,expectedRevision:a.number().int().positive(),request:ie}).strict();function Pr(t){let e=d(r=>`/v1/training/candidate-evaluations/${encodeURIComponent(r)}`,"path");function n(r,o,s){let i=Zt.parse(r);if(i.teamId!==o||s&&i.id!==s)throw new Error("The preparation belongs to another workspace or candidate operation.");return i}return d(n,"read"),{async options(r,o={}){let s=new URLSearchParams({teamId:r,...o}),i=Yt.parse(await t(`/v1/training/candidates?${s}`));if(i.teamId!==r)throw new Error("The candidate catalog belongs to another workspace.");return i},async save(r){let o=We.parse(r),s=n(await t(`/v1/training/candidate-evaluations?teamId=${encodeURIComponent(o.teamId)}`,{method:"POST",body:JSON.stringify(o)}),o.teamId);if(s.requestHash!==f(o))throw new Error("The saved preparation differs from the selected candidate or frozen evaluation.");return s},async get(r,o){return n(await t(`${e(o)}?teamId=${encodeURIComponent(r)}`),r,o)},async control(r,o,s,i){let u=Qt.parse(i),c=n(await t(`${e(o)}/${s}?teamId=${encodeURIComponent(r)}`,{method:"POST",body:JSON.stringify(u)}),r,o);if(c.requestHash!==u.requestHash)throw new Error("The command returned a different frozen evaluation.");return c}}}d(Pr,"createCandidateEvaluationClient");var S=a.string().trim().min(1).max(200),he=a.string().regex(/^[a-f0-9]{64}$/),Ge=a.object({id:S,contentHash:he}).strict(),Vt=a.object({artifact:Ge,trainingJobId:S,configurationId:S,baseProfileId:S,ready:a.boolean(),reason:a.string().max(1e3).nullable()}).strict(),Yt=a.object({teamId:S,ownerUserId:S,items:a.array(Vt).max(100),nextCursor:S.nullable()}).strict(),We=a.object({teamId:S,operationId:S,artifact:Ge,configuration:L}).strict().superRefine((t,e)=>{(t.configuration.request.teamId!==t.teamId||t.configuration.request.policy.kind==="fixture"||t.configuration.request.policy.candidate)&&e.addIssue({code:"custom",message:"Choose one exact model-backed evaluation before preparing the trained version."})}),Zt=a.object({schemaVersion:a.literal("openpond.candidateEvaluationPreparation.v1"),teamId:S,ownerUserId:S,id:S,revision:a.number().int().positive(),requestHash:he,request:We,trainingJobId:S,dispatchId:S,lastOperationId:S.nullable(),runtime:a.object({poolId:S,endpointId:S.nullable(),baseProfileId:S,workerImageDigest:a.string().regex(/^sha256:[a-f0-9]{64}$/),modelId:S.nullable()}).strict().nullable(),state:a.enum(["configured","preparing","ready","dispatching","submitted","cleaning","completed","failed","cancelled"]),experimentId:S.nullable(),authorizedAt:a.iso.datetime().nullable(),cancelledAt:a.iso.datetime().nullable(),reason:a.string().max(1e3).nullable(),createdAt:a.iso.datetime(),updatedAt:a.iso.datetime()}).strict().superRefine((t,e)=>{(t.requestHash!==f(t.request)||!t.runtime&&["ready","dispatching","submitted","completed"].includes(t.state))&&e.addIssue({code:"custom",message:"The exact candidate preparation request or runtime changed."})}),Qt=a.object({operationId:S,expectedRevision:a.number().int().positive(),requestHash:he}).strict();var x=a.string().trim().min(1).max(200),F=a.string().regex(/^[a-f0-9]{64}$/),H=a.string().datetime(),Xe=a.object({operationId:x,id:x.optional(),expectedRevision:a.number().int().nonnegative(),teamId:x,projectId:x.nullable(),enabled:a.boolean(),configuration:L,cadence:a.discriminatedUnion("kind",[a.object({kind:a.literal("interval"),seconds:a.number().int().min(60).max(31536e3)}).strict(),a.object({kind:a.literal("nightly"),calendar:Ue}).strict()]),maximumTotalSpendUsd:a.number().finite().positive().max(1e4),maximumAttempts:a.number().int().min(1).max(20)}).strict().superRefine((t,e)=>{(t.configuration.request.teamId!==t.teamId||(t.configuration.request.project?.id??null)!==t.projectId)&&e.addIssue({code:"custom",message:"The scheduled Experiment must retain its actual workspace and Project."}),t.configuration.maximumCostUsd>t.maximumTotalSpendUsd&&e.addIssue({code:"custom",message:"The run ceiling exceeds the approved cumulative schedule ceiling."})}),en=a.object({id:x,scheduledAt:H,coalescedThroughAt:H,coalescedCount:a.number().int().nonnegative(),configurationHash:F,operationId:x,state:a.enum(["reserved","dispatching","running","cleaning","completed","failed","cancelled","uncertain"]),executionId:x.nullable(),attempt:a.number().int().positive(),maximumCostUsd:a.number().finite().positive(),actualSpendUsd:a.number().finite().nonnegative().nullable(),cleanupComplete:a.boolean(),error:a.string().max(4e3).nullable()}).strict(),tn=a.object({schemaVersion:a.literal("openpond.experimentEvaluationSchedule.v1"),id:x,revision:a.number().int().positive(),actorId:x,teamId:x,projectId:x.nullable(),operationId:x,requestHash:F,configuration:L,configurationHash:F,cadence:Xe.shape.cadence,state:a.enum(["scheduled","disabled","blocked"]),nextRunAt:H.nullable(),maximumTotalSpendUsd:a.number().finite().positive(),maximumAttempts:a.number().int().positive(),lastEvaluatedConfigurationHash:F.nullable(),newerUnevaluatedRelease:G.nullable(),fires:a.array(en).max(1e4),reason:a.string().max(4e3).nullable(),createdAt:H,updatedAt:H,contentHash:F}).strict();function nn(t){let{operationId:e,request:n,...r}=t,{operationId:o,...s}=n;return f({...r,request:s})}d(nn,"scheduledExperimentHash");function rn(t){let e=tn.parse(t);if(_e(e,"Scheduled Experiment"),e.configurationHash!==nn(e.configuration)||e.configuration.request.teamId!==e.teamId||(e.configuration.request.project?.id??null)!==e.projectId)throw new Error("Scheduled Experiment immutable authority differs from its recipe.");return e}d(rn,"verifyExperimentEvaluationSchedule");function $r(t){return rn({...t,contentHash:f(t)})}d($r,"sealExperimentEvaluationSchedule");var on=a.object({teamId:x,id:x,operationId:x,expectedRevision:a.number().int().positive(),action:a.enum(["cancel_active","retry_active","pause"])}).strict(),jr=a.discriminatedUnion("operation",[a.object({operation:a.literal("publish"),request:Xe}).strict(),a.object({operation:a.literal("control"),request:on}).strict(),a.object({operation:a.literal("read"),id:x}).strict(),a.object({operation:a.literal("list"),cursor:x.optional(),limit:a.number().int().min(1).max(100).default(50)}).strict()]);function an(t){return{list:d((e={})=>t.listSandboxRuntimes(e),"list"),create:d(e=>t.createSandboxRuntime(e),"create"),handle:d((e,n=null)=>t.sandboxRuntime(e,n),"handle"),get:d(e=>t.getSandboxRuntime(e),"get"),createSandbox:d((e,n={},r={})=>t.createSandboxRuntimeSandbox(e,n,r),"createSandbox"),updateStatus:d((e,n)=>t.updateSandboxRuntimeStatus(e,n),"updateStatus"),events:d(e=>t.listSandboxRuntimeEvents(e),"events"),event:d((e,n)=>t.emitSandboxRuntimeEvent(e,n),"event"),checkpoint:d((e,n={})=>t.checkpointSandboxRuntime(e,n),"checkpoint"),promote:d((e,n,r={})=>t.promoteSandboxRuntime(e,n,r),"promote"),preserveSource:d((e,n={},r={})=>t.preserveSandboxRuntimeSource(e,n,r),"preserveSource")}}d(an,"createSandboxRuntimeNamespace");function sn(t){return{list:d((e={})=>t.list(e),"list"),create:d(e=>t.create(e),"create"),get:d(e=>t.get(e),"get"),pricing:d(()=>t.pricing(),"pricing"),costs:d((e={})=>t.costs(e),"costs")}}d(sn,"createSandboxNamespace");function dn(t){return{list:d(e=>t.listProjects(e),"list"),upsert:d(e=>t.upsertProject(e),"upsert"),upsertGitRemote:d(e=>t.upsertProjectGitRemote(e),"upsertGitRemote"),get:d((e,n)=>t.getProject(e,n),"get"),update:d((e,n)=>t.updateProject(e,n),"update"),sync:d((e,n)=>t.syncProject(e,n),"sync"),ensureGitRemote:d((e,n)=>t.ensureProjectGitRemote(e,n),"ensureGitRemote"),getGitRemote:d((e,n)=>t.ensureProjectGitRemote(e,n),"getGitRemote"),git:d((e,n)=>t.ensureProjectGitRemote(e,n),"git"),uploadSource:d((e,n)=>t.uploadProjectSource(e,n),"uploadSource"),archive:d((e,n)=>t.archiveProject(e,n),"archive")}}d(dn,"createSandboxProjectNamespace");function cn(t){return{get:d(e=>t.getHostedProfile(e),"get"),status:d(e=>t.getHostedProfile(e),"status"),ensureHosted:d(e=>t.ensureHostedProfile(e),"ensureHosted"),push:d(e=>t.pushHostedProfile(e),"push")}}d(cn,"createSandboxProfileNamespace");function un(t){return{list:d(e=>t.listAgents(e),"list"),upsert:d(e=>t.upsertAgent(e),"upsert"),get:d((e,n)=>t.getAgent(e,n),"get"),update:d((e,n)=>t.updateAgent(e,n),"update"),archive:d((e,n)=>t.archiveAgent(e,n),"archive"),run:d((e,n)=>t.runAgent(e,n),"run"),sourceDeployPlan:d((e,n)=>t.getAgentSourceDeployPlan(e,n),"sourceDeployPlan"),manifestSnapshots:d((e,n)=>t.listAgentManifestSnapshots(e,n),"manifestSnapshots"),requestSourceChecks:d((e,n)=>t.requestAgentSourceChecks(e,n),"requestSourceChecks"),configureSourceSetup:d((e,n)=>t.configureAgentSourceSetup(e,n),"configureSourceSetup"),publishSource:d((e,n)=>t.publishAgentSource(e,n),"publishSource")}}d(un,"createSandboxAgentNamespace");function pn(t,e,n=null){let r=d(async(c={},p={})=>{let b=await t.getSandboxRuntime(e);return b.sandboxId?t.get(b.sandboxId):t.createSandboxRuntimeSandbox(e,c,p).then(l=>l.sandbox)},"currentSandbox"),o=d(async(c={},p={})=>{let b=await t.getSandboxRuntime(e);if(!b.sandboxId)return t.createSandboxRuntimeSandbox(e,c,p).then(g=>g.sandbox);let l=await t.get(b.sandboxId);return l.state==="stopped"?t.start(l.id,p).then(g=>g.sandbox):l.state==="archived"?t.restore(l.id).then(g=>g.sandbox):l.state==="deleted"||l.state==="error"?t.createSandboxRuntimeSandbox(e,c,p).then(g=>g.sandbox):l},"resume");return{id:e,initial:n,get:d(()=>t.getSandboxRuntime(e),"get"),sandbox:r,resume:o,createSandbox:d((c={},p={})=>t.createSandboxRuntimeSandbox(e,c,p),"createSandbox"),status:d(async c=>{if(typeof c!="string")return t.updateSandboxRuntimeStatus(e,c);let p=await t.getSandboxRuntime(e);return t.updateSandboxRuntimeStatus(e,{status:c,expectedVersion:p.version})},"status"),events:d(()=>t.listSandboxRuntimeEvents(e),"events"),event:d(c=>t.emitSandboxRuntimeEvent(e,c),"event"),recordCommit:d((c,p={})=>t.emitSandboxRuntimeEvent(e,{...p,type:p.type??"git.commit",commitSha:c}),"recordCommit"),checkpointHint:d((c={})=>t.emitSandboxRuntimeEvent(e,{type:"workflow.checkpoint_hint",summary:c.summary??c.reason??"Workflow checkpoint hint",payload:{...c.payload,reason:c.reason??null},artifactRefs:c.artifactRefs,lifecycleHint:{kind:"checkpoint",reason:c.reason??null}}),"checkpointHint"),waitForUser:d(async(c={})=>{await t.emitSandboxRuntimeEvent(e,{type:"workflow.waiting_for_user",summary:c.summary??c.reason??"Waiting for user",payload:{...c.payload,reason:c.reason??null},lifecycleHint:{kind:"waiting_for_user",reason:c.reason??null}});let p=await t.getSandboxRuntime(e);return p.status==="waiting_for_user"?p:t.updateSandboxRuntimeStatus(e,{status:"waiting_for_user",expectedVersion:p.version,summary:c.summary??c.reason,metadata:{workflowWaitForUserReason:c.reason??null}})},"waitForUser"),keepAlive:d((c={})=>{let p=mn(c);return t.emitSandboxRuntimeEvent(e,{type:"workflow.keepalive",summary:c.summary??c.reason??"Workflow keepalive",payload:{...c.payload,reason:c.reason??null,keepaliveUntil:p},lifecycleHint:{kind:"keepalive",reason:c.reason??null,keepaliveUntil:p}})},"keepAlive"),checkpoint:d(c=>t.checkpointSandboxRuntime(e,c),"checkpoint"),files:{write:d(async(c,p)=>t.uploadFile((await o()).id,c,p),"write"),read:d(async c=>t.downloadFile((await o()).id,c),"read"),readResponse:d(async c=>t.downloadFileResponse((await o()).id,c),"readResponse"),list:d(async(c={})=>t.listFiles((await o()).id,c),"list"),delete:d(async(c,p={})=>t.deleteFile((await o()).id,c,p),"delete"),search:d(async c=>t.searchFiles((await o()).id,c),"search"),stat:d(async c=>t.statFile((await o()).id,c),"stat"),mkdir:d(async c=>t.mkdir((await o()).id,c),"mkdir"),move:d(async c=>t.moveFile((await o()).id,c),"move")},commands:{run:d(async c=>t.exec((await o()).id,typeof c=="string"?{command:c}:c),"run")},ports:{expose:d(async c=>t.openPort((await o()).id,typeof c=="number"?{port:c}:c),"expose")},promote:d((c,p={})=>t.promoteSandboxRuntime(e,c,p),"promote"),preserveSource:d((c={},p={})=>t.preserveSandboxRuntimeSource(e,c,p),"preserveSource"),archive:d(async c=>{let p=c??(await t.getSandboxRuntime(e)).version;return t.updateSandboxRuntimeStatus(e,{status:"archived",expectedVersion:p})},"archive")}}d(pn,"createSandboxRuntimeHandle");function mn(t){if(t?.until instanceof Date)return t.until.toISOString();if(typeof t?.until=="string"&&t.until.trim())return new Date(t.until).toISOString();let e=typeof t?.seconds=="number"&&Number.isFinite(t.seconds)?Math.max(1,Math.trunc(t.seconds)):60;return new Date(Date.now()+e*1e3).toISOString()}d(mn,"runtimeKeepaliveUntilIso");async function ln(t,e={}){let n=`openpond-code-smoke-${Date.now()}`,r=`openpond-code-exec-ok:${n}`,o=`openpond-code-preview-ok:${n}`,s=`openpond-code-file-ok:${n}`,i=4173,u=null,c=null,p=!1,b=!1;try{let l=await Ye(t,await t.create({repo:e.repo??"https://github.com/octocat/Hello-World",resources:{cpu:e.cpu??1,memoryGb:e.memoryGb??1,diskGb:e.diskGb??8},budget:{maxUsd:e.budgetUsd??"0.05"},quotas:{maxSpendUsd:e.budgetUsd??"0.05",maxDurationSeconds:600,idleTimeoutSeconds:600,maxOpenPorts:2},metadata:{runId:n,source:"openpond-code-sandbox-smoke"}},{async:!0}));u=l.id;let g=e.expectedMppMode;if(g&&l.reservation.mpp?.mode!==g)throw new Error(`expected ${g} reservation, got ${l.reservation.mpp?.mode??"none"}`);if(!g&&!l.reservation.mpp?.mode)throw new Error("expected sandbox reservation MPP metadata");let P=await t.exec(l.id,{command:[`printf '${r}\\n'`,"test -f README && printf 'repo-clone-ok\\n'","cat > server.cjs <<'EOF'","const { createServer } = require('node:http');",`createServer((_request, response) => response.end('${o}')).listen(${i}, '0.0.0.0');`,"EOF","nohup node server.cjs > server.log 2>&1 & sleep 1"].join(`
|
|
3
3
|
`),timeoutSeconds:120});if(P.command.status!=="succeeded")throw new Error(`expected command success, got ${P.command.status}`);if(!P.command.output.includes(r))throw new Error("expected exec marker");if(await t.uploadFile(l.id,"openpond-code-smoke.txt",s),await t.downloadFile(l.id,"openpond-code-smoke.txt")!==s)throw new Error("expected file roundtrip marker");let U=null;if(e.snapshot||e.fork){let R=await t.createSnapshot(l.id,{async:!0,name:`openpond-code-smoke-${n}`,replay:{entrypoints:[{command:"cat openpond-code-smoke.txt",name:"default"}],retention:{class:"pinned"},safety:{cleanup:"delete",idleTimeoutSeconds:600,internetEgress:"block",maxDurationSeconds:600,maxSpendUsd:e.budgetUsd??"0.05",publicPreview:!1},validation:{commands:[{command:"test -f openpond-code-smoke.txt"}]}}}),A=R.snapshot??(await yn(t,l.id,R.snapshotJob?.snapshotId)).snapshot;if(U=A.id,A.state!=="ready")throw new Error(`expected ready snapshot, got ${A.state}`)}if(e.fork){if(!U)throw new Error("expected snapshot id before fork");let R=await Ye(t,(await t.forkSnapshot(U,{budget:{maxUsd:e.budgetUsd??"0.05"},metadata:{source:"openpond-code-sandbox-smoke-fork",templateSnapshotId:U}},{async:!0})).sandbox);c=R.id;let A=await t.exec(R.id,{command:"cat openpond-code-smoke.txt",timeoutSeconds:120});if(A.command.status!=="succeeded")throw new Error(`expected fork command success, got ${A.command.status}`);if(!A.command.output.includes(s))throw new Error("expected fork snapshot marker");e.keep||(await fe(t,R.id),b=!0)}let j=null;if(e.preview!==!1){let R=await t.openPort(l.id,{label:"openpond-code-smoke",port:i}),A=await fetch(R.preview.url);j=A.status;let $t=await A.text();if(A.status!==200)throw new Error(`expected preview HTTP 200, got ${A.status}`);if(!$t.includes(o))throw new Error("expected preview marker")}let{sandbox:ne,receipts:J}=await hn(t,l.id);return e.keep||(await fe(t,l.id),p=!0),{deleted:p,execOutput:P.command.output.trim(),fileRoundtrip:!0,forkSandboxId:c,previewStatus:j,receiptRefs:J.map(R=>R.mpp.receiptRef??null),reservationRef:l.reservation.mpp?.reservationRef??null,runId:n,sandboxId:l.id,snapshotId:U,state:ne.state}}finally{c&&!e.keep&&!b&&await Ve(t,c),u&&!e.keep&&!p&&await Ve(t,u)}}d(ln,"runSandboxSmoke");async function hn(t,e){try{await t.stop(e)}catch{await t.stop(e,{async:!0})}let n=await Qe(t,e,new Set(["stopped","deleted"]),"stop"),r=await fn(t,e);if(r.length===0)throw new Error("expected receipt readback");return{sandbox:n,receipts:r}}d(hn,"stopSandboxForSmoke");async function fe(t,e){try{let n=await t.delete(e);if(n.state==="deleted")return n;await t.delete(e,{async:!0})}catch{await t.delete(e,{async:!0})}return Qe(t,e,new Set(["deleted"]),"delete")}d(fe,"deleteSandboxForSmoke");async function Ve(t,e){try{await fe(t,e)}catch{await t.delete(e,{async:!0}).catch(()=>{})}}d(Ve,"cleanupSandboxBestEffort");async function Qe(t,e,n,r){let i=Date.now()+3e5,u=await t.get(e);for(;Date.now()<i;){if(n.has(u.state))return u;if(u.state==="error")throw new Error(`sandbox ${r} failed: ${e}`);await V(3e3),u=await t.get(e)}throw new Error(`sandbox ${r} did not reach ${[...n].join("/")} before timeout: ${e} (${u.state})`)}d(Qe,"waitForSandboxState");async function fn(t,e){let o=Date.now()+12e4,s=await t.receipts(e);for(;Date.now()<o;){if(s.length>0)return s;await V(3e3),s=await t.receipts(e)}return s}d(fn,"waitForReceipts");async function Ye(t,e){if(e.state==="running"||e.state==="stopped")return e;if(e.state==="error")throw new Error(`sandbox create failed: ${e.id}
|
|
4
4
|
${e.logs.join(`
|
|
5
5
|
`)}`);let n=12*6e4,r=3e3,o=Date.now()+n,s=e;for(;Date.now()<o;){if(await V(r),s=await t.get(e.id),s.state==="running"||s.state==="stopped")return s;if(s.state==="error")throw new Error(`sandbox create failed: ${s.id}
|
|
@@ -9,4 +9,4 @@ ${s.logs.join(`
|
|
|
9
9
|
`);for(;u!==-1;){let c=o.slice(0,u);o=o.slice(u+2);let p=In(c);p&&process.stdout.write(p),u=o.indexOf(`
|
|
10
10
|
|
|
11
11
|
`)}}}finally{n.releaseLock()}}d(Ze,"streamSandboxEventOutput");function bn(t){return typeof t=="string"?{dataBase64:Buffer.from(t,"utf-8").toString("base64")}:t instanceof Uint8Array?{dataBase64:Buffer.from(t).toString("base64")}:t}d(bn,"normalizePtyInput");function In(t){if(!t.includes("event: output"))return null;let e=t.split(/\r?\n/).filter(n=>n.startsWith("data: ")).map(n=>n.slice(6));if(e.length===0)return null;try{let n=JSON.parse(e.join(`
|
|
12
|
-
`));return typeof n.output=="string"?n.output:null}catch{return null}}d(In,"parseProcessOutputEvent");function O(t,e={}){let n=t.trim().replace(/\/$/,"");if(!n)throw new Error("sandbox API URL must be non-empty");let r=new URL(n),o=r.pathname.replace(/\/$/,"");if(o.endsWith("/v1/sandboxes")||o.endsWith("/api/sandboxes"))return`${r.origin}${o}`;if(o.endsWith("/v1"))return`${r.origin}${o}/sandboxes`;if(r.origin===gn)return`${ye}/v1/sandboxes`;let s=e.apiBaseUrl?new URL(e.apiBaseUrl).origin:ye;return r.origin===s?`${r.origin}${o}/v1/sandboxes`:`${r.origin}${o}/api/sandboxes`}d(O,"normalizeSandboxApiUrl");function Sn(t){let e="/sandboxes";if(!t.endsWith(e))throw new Error("sandbox API URL must end with /sandboxes");return t.slice(0,-e.length)}d(Sn,"apiRootUrlFromSandboxApiUrl");var wn=class{static{d(this,"OpenPondSandboxInstanceClient")}apiKey;apiRootUrl;sandboxApiUrl;customEndpoint;constructor(t){this.apiKey=t.apiKey,this.customEndpoint=t.customEndpoint??!1;let e=t.sandboxApiUrl??t.baseUrl??ye;this.sandboxApiUrl=O(e,{apiBaseUrl:this.customEndpoint?void 0:e}),this.apiRootUrl=Sn(this.sandboxApiUrl)}create(t,e={}){return this.request("",{method:"POST",...this.customEndpoint?{timeoutMs:18e4}:{},headers:M(e),body:JSON.stringify(t)}).then(n=>n.sandbox)}get(t){return this.request(`/${encodeURIComponent(t)}`).then(e=>e.sandbox)}exec(t,e){return this.request(`/${encodeURIComponent(t)}/exec`,{method:"POST",body:JSON.stringify(e)})}startProcess(t,e){return this.request(`/${encodeURIComponent(t)}/processes`,{method:"POST",body:JSON.stringify(e)})}listProcesses(t){return this.request(`/${encodeURIComponent(t)}/processes`)}getProcess(t,e,n={}){let r=new URLSearchParams;return n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),this.request(`/${encodeURIComponent(t)}/processes/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`)}stopProcess(t,e){return this.request(`/${encodeURIComponent(t)}/processes/${encodeURIComponent(e)}`,{method:"DELETE"})}async streamProcessOutput(t,e,n={}){let r=new URLSearchParams;n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),await Ze({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(t)}/processes/${encodeURIComponent(e)}/stream${r.size>0?`?${r.toString()}`:""}`})}startPty(t,e={}){return this.request(`/${encodeURIComponent(t)}/pty`,{method:"POST",body:JSON.stringify(e)})}listPtys(t){return this.request(`/${encodeURIComponent(t)}/pty`)}getPty(t,e,n={}){let r=new URLSearchParams;return n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),this.request(`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`)}writePtyInput(t,e,n){return this.request(`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}/input`,{method:"POST",body:JSON.stringify(bn(n))})}stopPty(t,e){return this.request(`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}`,{method:"DELETE"})}async streamPtyOutput(t,e,n={}){let r=new URLSearchParams;n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),await Ze({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}/stream${r.size>0?`?${r.toString()}`:""}`})}uploadFile(t,e,n){return this.uploadFileBase64(t,e,Buffer.from(n,"utf-8").toString("base64"))}uploadFileBase64(t,e,n){return this.request(`/${encodeURIComponent(t)}/files`,{method:"POST",body:JSON.stringify({path:e,contentsBase64:n})})}async downloadFile(t,e){let n=await this.downloadFileResponse(t,e);return Buffer.from(n.file.contentsBase64,"base64").toString("utf-8")}downloadFileResponse(t,e){let n=typeof e=="string"?{path:e}:e,r=new URLSearchParams({path:n.path});return n.offsetBytes!==void 0&&r.set("offsetBytes",String(n.offsetBytes)),n.maxBytes!==void 0&&r.set("maxBytes",String(n.maxBytes)),this.request(`/${encodeURIComponent(t)}/files?${r.toString()}`)}listFiles(t,e={}){let n=new URLSearchParams({list:"1"});return e.path&&n.set("path",e.path),e.recursive!==void 0&&n.set("recursive",String(e.recursive)),e.maxEntries!==void 0&&n.set("maxEntries",String(e.maxEntries)),this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`)}deleteFile(t,e,n={}){let r=new URLSearchParams({path:e});return n.recursive!==void 0&&r.set("recursive",String(n.recursive)),this.request(`/${encodeURIComponent(t)}/files?${r.toString()}`,{method:"DELETE"})}statFile(t,e){let n=new URLSearchParams({stat:"1",path:e});return this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`)}mkdir(t,e){let n=typeof e=="string"?{path:e}:e,r=new URLSearchParams({path:n.path});return n.recursive!==void 0&&r.set("recursive",String(n.recursive)),this.request(`/${encodeURIComponent(t)}/files?${r.toString()}`,{method:"PUT"})}moveFile(t,e){let n=new URLSearchParams({fromPath:e.fromPath,toPath:e.toPath});return e.overwrite!==void 0&&n.set("overwrite",String(e.overwrite)),this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`,{method:"PATCH"})}searchFiles(t,e){let n=new URLSearchParams({search:"1",query:e.query});return e.path&&n.set("path",e.path),e.maxResults!==void 0&&n.set("maxResults",String(e.maxResults)),this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`)}openPort(t,e){return this.request(`/${encodeURIComponent(t)}/ports`,{method:"POST",body:JSON.stringify(e)})}createSnapshot(t,e){return this.request(`/${encodeURIComponent(t)}/snapshots`,{method:"POST",body:JSON.stringify(e)})}updateSnapshot(t,e,n){return this.request(`/${encodeURIComponent(t)}/snapshots/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)})}validateSnapshot(t,e,n={}){return this.request(`/${encodeURIComponent(t)}/snapshots/${encodeURIComponent(e)}/validate`,{method:"POST",body:JSON.stringify(n)})}publishSnapshot(t,e){return this.request(`/${encodeURIComponent(t)}/snapshots/${encodeURIComponent(e)}/publish`,{method:"POST"})}fork(t,e={}){return this.request(`/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify(e)})}stop(t,e={}){let n=new URLSearchParams;return e.failOnUnpreservedChanges&&n.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(t)}/stop${n.size>0?`?${n.toString()}`:""}`,{method:"POST",headers:M(e)})}start(t,e={}){return this.request(`/${encodeURIComponent(t)}/start`,{method:"POST",headers:M(e)})}restore(t){return this.request(`/${encodeURIComponent(t)}/restore`,{method:"POST"})}delete(t,e={}){let n=new URLSearchParams;return e.failOnUnpreservedChanges&&n.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`,{method:"DELETE",headers:M(e)}).then(r=>r.sandbox)}receipts(t){return this.request(`/${encodeURIComponent(t)}/receipts`).then(e=>e.receipts)}logs(t){return this.request(`/${encodeURIComponent(t)}/logs`).then(e=>e.logs)}gitStatus(t){return this.request(`/${encodeURIComponent(t)}/git/status`)}gitDiff(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/diff`,{method:"POST",body:JSON.stringify(e)})}gitExportPatch(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/export-patch`,{method:"POST",body:JSON.stringify(e)})}gitBranch(t,e){return this.request(`/${encodeURIComponent(t)}/git/branch`,{method:"POST",body:JSON.stringify(e)})}gitCommit(t,e){return this.request(`/${encodeURIComponent(t)}/git/commit`,{method:"POST",body:JSON.stringify(e)})}gitPull(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/pull`,{method:"POST",body:JSON.stringify(e)})}gitPush(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/push`,{method:"POST",body:JSON.stringify(e)})}billing(t){return this.request(`/${encodeURIComponent(t)}/billing`)}pricing(){return this.request("/pricing")}costs(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),this.request(`/costs${e.size>0?`?${e.toString()}`:""}`)}integrationLeases(t){return this.request(`/${encodeURIComponent(t)}/integrations`)}attachIntegrationConnection(t,e){return this.request(`/${encodeURIComponent(t)}/integrations`,{method:"POST",body:JSON.stringify(e)})}removeIntegrationLease(t,e){return this.request(`/${encodeURIComponent(t)}/integrations`,{method:"DELETE",body:JSON.stringify({leaseId:e})})}async request(t,e={}){let n=await X(this.sandboxApiUrl,this.apiKey,t,this.customEndpoint?{...e,explicitBearerAuth:!0,redirect:"error"}:e);return me(n,"Sandbox request")}async requestApiRoot(t,e={}){let n=await X(this.apiRootUrl,this.apiKey,t,this.customEndpoint?{...e,explicitBearerAuth:!0,redirect:"error"}:e);return me(n,"OpenPond API request")}},xn=class extends wn{static{d(this,"OpenPondSandboxClient")}runtimes=an(this);sandboxes=sn(this);profile=cn(this);projects=dn(this);agents=un(this);list(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),this.request(e.size>0?`?${e.toString()}`:"").then(n=>n.sandboxes)}listSecrets(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets${e.size>0?`?${e.toString()}`:""}`).then(n=>n.secrets)}getSecret(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`).then(r=>r.secret)}createSecret(t){return this.requestApiRoot("/sandbox-secrets",{method:"POST",body:JSON.stringify(t)}).then(e=>e.secret)}rotateSecret(t,e){let n=new URLSearchParams;e.teamId&&n.set("teamId",e.teamId);let{teamId:r,...o}=e;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}/rotate${n.size>0?`?${n.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)}).then(s=>s.secret)}attachSecret(t,e){let n=new URLSearchParams;e.teamId&&n.set("teamId",e.teamId);let{teamId:r,...o}=e;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}/attach${n.size>0?`?${n.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)}).then(s=>s.secret)}revokeSecret(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}/revoke${n.size>0?`?${n.toString()}`:""}`,{method:"POST"}).then(r=>r.secret)}deleteSecret(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`,{method:"DELETE"}).then(r=>r.secret)}snapshotCatalog(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),t.q&&e.set("q",t.q),t.kind&&e.set("kind",t.kind),t.replayState&&e.set("replayState",t.replayState),t.visibility&&e.set("visibility",t.visibility),t.tag&&e.set("tag",t.tag),t.useCase&&e.set("useCase",t.useCase),t.limit&&e.set("limit",String(t.limit)),this.request(`/catalog/snapshots${e.size>0?`?${e.toString()}`:""}`)}listSandboxRuntimes(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),this.requestApiRoot(`/runtimes${e.size>0?`?${e.toString()}`:""}`).then(n=>n.runtimes)}listProjects(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects?${e.toString()}`).then(n=>n.projects)}upsertProject(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects?${e.toString()}`,{method:"POST",body:JSON.stringify(t)}).then(n=>n.project)}getHostedProfile(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/profile?${e.toString()}`).then(n=>n.profile)}ensureHostedProfile(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/profile/ensure?${e.toString()}`,{method:"POST"}).then(n=>{if(!n.profile)throw new Error("hosted_profile_missing");return n.profile})}pushHostedProfile(t){let e=new URLSearchParams({teamId:t.teamId}),{teamId:n,...r}=t;return this.requestApiRoot(`/profile/push?${e.toString()}`,{method:"POST",body:JSON.stringify(r)})}async upsertProjectGitRemote(t){let e=await this.upsertProject(t);return this.ensureProjectGitRemote(e.id,{teamId:t.teamId})}getProject(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}?${n.toString()}`).then(r=>r.project)}syncProject(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}/sync?${n.toString()}`,{method:"POST"}).then(r=>r.project)}ensureProjectGitRemote(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}/git?${n.toString()}`,{method:"POST"})}uploadProjectSource(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/projects/${encodeURIComponent(t)}/source?${n.toString()}`,{method:"POST",body:JSON.stringify(o)}).then(s=>s.project)}updateProject(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/projects/${encodeURIComponent(t)}?${n.toString()}`,{method:"PATCH",body:JSON.stringify(o)}).then(s=>s.project)}archiveProject(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}?${n.toString()}`,{method:"DELETE"}).then(r=>r.project)}listAgents(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents?${e.toString()}`).then(n=>n.agents)}upsertAgent(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents?${e.toString()}`,{method:"POST",body:JSON.stringify(t)}).then(n=>n.agent)}getAgent(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(t)}?${n.toString()}`).then(r=>r.agent)}archiveAgent(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(t)}?${n.toString()}`,{method:"DELETE"}).then(r=>r.agent)}updateAgent(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}?${n.toString()}`,{method:"PATCH",body:JSON.stringify(o)}).then(s=>s.agent)}runAgent(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/run?${n.toString()}`,{method:"POST",headers:{Prefer:"respond-async"},body:JSON.stringify(o)})}getAgentSourceDeployPlan(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/deploy-plan?${n.toString()}`).then(r=>r.deployPlan)}listAgentManifestSnapshots(t,e){let n=new URLSearchParams({teamId:e.teamId});return e.limit!==void 0&&n.set("limit",String(e.limit)),this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/manifest-snapshots?${n.toString()}`).then(r=>r.manifestSnapshots)}requestAgentSourceChecks(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/checks?${n.toString()}`,{method:"POST",body:JSON.stringify(o),timeoutMs:900*1e3})}configureAgentSourceSetup(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/setup?${n.toString()}`,{method:"POST",body:JSON.stringify(o)})}publishAgentSource(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/publish?${n.toString()}`,{method:"POST",body:JSON.stringify(o)})}getMicrosoftTeamsBotOverview(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/teams/bot/overview?${e.toString()}`)}bindMicrosoftTeamsBotConversation(t){return this.requestApiRoot("/teams/bot/bindings",{method:"POST",body:JSON.stringify(t)})}rebindMicrosoftTeamsBotConversation(t,e){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)})}unlinkMicrosoftTeamsBotConversation(t){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(t.bindingId)}`,{method:"DELETE",body:JSON.stringify({teamId:t.teamId})})}sendMicrosoftTeamsBotDiagnostic(t){return this.requestApiRoot("/teams/bot/diagnostics",{method:"POST",body:JSON.stringify(t)})}sendMicrosoftTeamsBotDiagnosticRun(t){return this.requestApiRoot("/teams/bot/diagnostics/run",{method:"POST",body:JSON.stringify(t)})}createSandboxRuntime(t){return this.requestApiRoot("/runtimes",{method:"POST",body:JSON.stringify(t)}).then(e=>e.runtime)}sandboxRuntime(t,e=null){return pn(this,t,e)}getSandboxRuntime(t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}`).then(e=>e.runtime)}createSandboxRuntimeSandbox(t,e={},n={}){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/sandbox`,{method:"POST",headers:M(n),body:JSON.stringify(e)})}updateSandboxRuntimeStatus(t,e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/status`,{method:"PATCH",body:JSON.stringify(e)}).then(n=>n.runtime)}listSandboxRuntimeEvents(t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/events`)}emitSandboxRuntimeEvent(t,e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/events`,{method:"POST",body:JSON.stringify(e)})}checkpointSandboxRuntime(t,e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/checkpoints`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.runtime)}promoteSandboxRuntime(t,e,n={}){let r=new URLSearchParams;return n.teamId&&r.set("teamId",n.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/promote${r.size>0?`?${r.toString()}`:""}`,{method:"POST",body:JSON.stringify(e)})}preserveSandboxRuntimeSource(t,e={},n={}){let r=new URLSearchParams;return n.teamId&&r.set("teamId",n.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/preserve-source${r.size>0?`?${r.toString()}`:""}`,{method:"POST",body:JSON.stringify(e)})}forkSnapshot(t,e={},n={}){let r=new URLSearchParams;e.teamId&&r.set("teamId",e.teamId),e.projectId&&r.set("projectId",e.projectId),n.async&&r.set("async","1");let{teamId:o,projectId:s,...i}=e;return this.request(`/catalog/snapshots/${encodeURIComponent(t)}/fork${r.size>0?`?${r.toString()}`:""}`,{method:"POST",headers:n.async?{Prefer:"respond-async"}:void 0,body:JSON.stringify({...i,snapshotId:t})})}templates(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.q&&e.set("q",t.q),t.name&&e.set("name",t.name),t.version&&e.set("version",t.version),t.visibility&&e.set("visibility",t.visibility),t.tag&&e.set("tag",t.tag),t.useCase&&e.set("useCase",t.useCase),t.limit&&e.set("limit",String(t.limit)),this.request(`/templates${e.size>0?`?${e.toString()}`:""}`)}publishedSnapshots(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.q&&e.set("q",t.q),t.name&&e.set("name",t.name),t.version&&e.set("version",t.version),t.visibility&&e.set("visibility",t.visibility),t.tag&&e.set("tag",t.tag),t.useCase&&e.set("useCase",t.useCase),t.limit&&e.set("limit",String(t.limit)),this.request(`/published-snapshots${e.size>0?`?${e.toString()}`:""}`).then(n=>{let r=n.publishedSnapshots??n.templates;return{...n,templates:r,publishedSnapshots:r}})}launchTemplate(t){let e=new URLSearchParams;t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId);let{teamId:n,projectId:r,...o}=t;return this.request(`/templates/launch${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)})}runPublishedSnapshot(t){let e=new URLSearchParams;t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId);let{teamId:n,projectId:r,...o}=t;return this.request(`/published-snapshots/launch${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)}).then(s=>{let i=s.publishedSnapshot??s.template;return{...s,template:i,publishedSnapshot:i}})}listSchedules(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.sourceSandboxId&&e.set("sourceSandboxId",t.sourceSandboxId),this.request(`/schedules${e.size>0?`?${e.toString()}`:""}`)}createSchedule(t){let e=new URLSearchParams;t.projectId&&e.set("projectId",t.projectId);let{projectId:n,...r}=t;return this.request(`/schedules${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(r)})}getSchedule(t){return this.request(`/schedules/${encodeURIComponent(t)}`)}updateSchedule(t,e){return this.request(`/schedules/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)})}deleteSchedule(t){return this.request(`/schedules/${encodeURIComponent(t)}`,{method:"DELETE"})}listScheduleRuns(t,e={}){let n=new URLSearchParams;return e.limit!==void 0&&n.set("limit",String(e.limit)),this.request(`/schedules/${encodeURIComponent(t)}/runs${n.size>0?`?${n.toString()}`:""}`)}runScheduleNow(t,e={}){return this.request(`/schedules/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(e)})}listTemplateBuilds(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/sandbox-template-builds?${e.toString()}`).then(n=>n.builds)}createTemplateBuild(t){return this.requestApiRoot("/sandbox-template-builds",{method:"POST",body:JSON.stringify(t)}).then(e=>e.build)}getTemplateBuild(t){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(t)}`).then(e=>e.build)}getTemplateBuildLogs(t){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(t)}/logs`)}cancelTemplateBuild(t){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(t)}/cancel`,{method:"POST"}).then(e=>e.build)}listPublishedSnapshotBuilds(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/published-snapshot-builds?${e.toString()}`).then(n=>n.builds)}createPublishedSnapshotBuild(t){return this.requestApiRoot("/published-snapshot-builds",{method:"POST",body:JSON.stringify(t)}).then(e=>e.build)}getPublishedSnapshotBuild(t){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(t)}`).then(e=>e.build)}getPublishedSnapshotBuildLogs(t){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(t)}/logs`)}cancelPublishedSnapshotBuild(t){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(t)}/cancel`,{method:"POST"}).then(e=>e.build)}listOrganizations(){return this.requestApiRoot("/organizations").then(t=>t.organizations??t.teams??[])}createOrganization(t){return this.requestApiRoot("/organizations",{method:"POST",body:JSON.stringify(t)}).then(e=>e.organization)}getOrganization(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}`).then(e=>e.organization)}updateOrganization(t,e){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)}).then(n=>n.organization)}listOrganizationMembers(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/members`).then(e=>e.members)}upsertOrganizationMember(t,e){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/members`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.member)}getOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server`).then(e=>e.mcpServer)}generateOrganizationMcpServer(t,e={}){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.mcpServer)}rotateOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server/rotate`,{method:"POST"}).then(e=>e.mcpServer)}disableOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server/disable`,{method:"POST"}).then(e=>e.mcpServer)}enableOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server/enable`,{method:"POST"}).then(e=>e.mcpServer)}startReplay(t){let e=new URLSearchParams;t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId);let{teamId:n,projectId:r,...o}=t;return this.requestApiRoot(`/sandbox-replays${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)})}listReplays(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays${e.size>0?`?${e.toString()}`:""}`)}getReplay(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`)}getReplayLogs(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}/logs${n.size>0?`?${n.toString()}`:""}`)}getReplayArtifacts(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}/artifacts${n.size>0?`?${n.toString()}`:""}`)}cancelReplay(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}/cancel${n.size>0?`?${n.toString()}`:""}`,{method:"POST"})}integrationConnections(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),t.status&&e.set("status",t.status),this.requestApiRoot(`/integrations/connections${e.size>0?`?${e.toString()}`:""}`)}mcpServerConfig(){return{name:"openpond-sandboxes",transport:"streamable-http",url:`${this.sandboxApiUrl}/mcp`,headers:{"openpond-api-key":this.apiKey}}}smoke(t={}){return ln(this,t)}};function Y(t){return new xn(t)}d(Y,"createOpenPondSandboxClient");var Br=a.object({choices:a.array(a.object({message:a.object({content:a.string().nullable().optional(),tool_calls:a.array(a.object({id:a.string().min(1),type:a.literal("function"),function:a.object({name:a.string().min(1),arguments:a.string()})})).optional()})})).min(1)});var Nr=100*1024*1024;var Fr=Object.freeze({".avif":"image/avif",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".gif":"image/gif",".html":"text/html",".jpeg":"image/jpeg",".jpg":"image/jpeg",".json":"application/json",".m4a":"audio/mp4",".md":"text/markdown",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".pdf":"application/pdf",".png":"image/png",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".svg":"image/svg+xml",".tsv":"text/tab-separated-values",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".webp":"image/webp",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});function $(t){let e=t?.trim();return e?e.replace(/\/$/,""):null}d($,"normalizeOptionalUrl");function m(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}d(m,"asRecord");var et=["workspacePurpose","purpose"];function tt(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e={...t};for(let n of et)delete e[n];return e}d(tt,"sanitizeCreateMetadata");function vn(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e={...t};for(let r of et)delete e[r];let n=tt(e.metadata);return n?e.metadata=n:delete e.metadata,e}d(vn,"sanitizeSandboxRuntimeInput");function Z(t){let e=m(t);if(e.sandboxRuntime)throw new Error("Sandbox runtime settings must use /v1/runtimes before materializing a sandbox.");let n={};typeof e.repo=="string"&&e.repo.trim()&&(n.repo=e.repo.trim()),typeof e.teamId=="string"&&e.teamId.trim()&&(n.teamId=e.teamId.trim()),typeof e.projectId=="string"&&e.projectId.trim()&&(n.projectId=e.projectId.trim()),typeof e.agentId=="string"&&e.agentId.trim()&&(n.agentId=e.agentId.trim()),typeof e.command=="string"&&e.command.trim()&&(n.command=e.command.trim()),typeof e.runtimeProfileId=="string"&&e.runtimeProfileId.trim()&&(n.runtimeProfileId=e.runtimeProfileId.trim()),e.workloadSource&&typeof e.workloadSource=="object"&&!Array.isArray(e.workloadSource)&&(n.workloadSource=e.workloadSource),e.sourceArchive&&typeof e.sourceArchive=="object"&&!Array.isArray(e.sourceArchive)&&(n.sourceArchive=e.sourceArchive),(e.visibility==="private"||e.visibility==="team")&&(n.visibility=e.visibility),e.resources&&typeof e.resources=="object"&&!Array.isArray(e.resources)&&(n.resources=e.resources),e.budget&&typeof e.budget=="object"&&!Array.isArray(e.budget)&&(n.budget=e.budget),"env"in e&&(n.env=ve(e.env)),e.networkPolicy&&typeof e.networkPolicy=="object"&&!Array.isArray(e.networkPolicy)&&(n.networkPolicy=e.networkPolicy),e.quotas&&typeof e.quotas=="object"&&!Array.isArray(e.quotas)&&(n.quotas=e.quotas),Array.isArray(e.volumes)&&(n.volumes=e.volumes),"integrationLeases"in e&&(n.integrationLeases=ot(e.integrationLeases)),Array.isArray(e.integrationConnectionLeases)&&(n.integrationConnectionLeases=e.integrationConnectionLeases);let r=tt(e.metadata);return r&&(n.metadata=r),n}d(Z,"normalizeCreateInput");function be(t){let e=m(t),n=vn(e)??{},r={};return typeof n.teamId=="string"&&n.teamId.trim()&&(r.teamId=n.teamId.trim()),typeof n.projectId=="string"&&n.projectId.trim()&&(r.projectId=n.projectId.trim()),typeof n.agentId=="string"&&n.agentId.trim()&&(r.agentId=n.agentId.trim()),typeof n.workflowMode=="string"&&n.workflowMode.trim()?r.workflowMode=n.workflowMode.trim():typeof n.mode=="string"&&n.mode.trim()&&(r.workflowMode=n.mode.trim()),typeof n.baseBranch=="string"&&n.baseBranch.trim()&&(r.baseBranch=n.baseBranch.trim()),typeof n.baseSha=="string"&&n.baseSha.trim()&&(r.baseSha=n.baseSha.trim()),typeof n.sandboxId=="string"&&n.sandboxId.trim()&&(r.sandboxId=n.sandboxId.trim()),typeof n.rootfsSnapshotId=="string"&&n.rootfsSnapshotId.trim()&&(r.rootfsSnapshotId=n.rootfsSnapshotId.trim()),typeof n.dependencySnapshotId=="string"&&n.dependencySnapshotId.trim()&&(r.dependencySnapshotId=n.dependencySnapshotId.trim()),typeof n.runtimeProfileId=="string"&&n.runtimeProfileId.trim()&&(r.runtimeProfileId=n.runtimeProfileId.trim()),typeof n.promotionPolicy=="string"&&n.promotionPolicy.trim()&&(r.promotionPolicy=n.promotionPolicy.trim()),n.metadata&&typeof n.metadata=="object"&&!Array.isArray(n.metadata)&&(r.metadata=n.metadata),r}d(be,"normalizeSandboxRuntimeCreateInput");function Q(t){return Z(t)}d(Q,"normalizeSandboxRuntimeSandboxCreateInput");function nt(t){return m(t)}d(nt,"normalizeSnapshotCreateInput");function y(t){let e=m(t),n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",o=typeof e.agentId=="string"?e.agentId.trim():"";return{...n?{teamId:n}:{},...r?{projectId:r}:{},...o?{agentId:o}:{}}}d(y,"normalizeSandboxListInput");function rt(t){let e=m(t),n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",{teamId:o,projectId:s,appId:i,...u}=e,c=u;return n&&(c.teamId=n),r&&(c.projectId=r),c}d(rt,"normalizeReplayStartInput");function Ie(t){if(t==="active"||t==="revoked"||t==="error"||t==="all")return t}d(Ie,"normalizeIntegrationStatusFilter");function Se(t){let e=m(t),n=typeof e.connectionId=="string"?e.connectionId.trim():"";if(!n)throw new Error("Sandbox integration connection is required.");let r=st(e.capabilities);if(r.length===0)throw new Error("Sandbox integration capabilities are required.");at(e.provider,r);let o=it(e.scopes,"Sandbox integration scopes"),s=dt(e.expiresAt),i=En(e.ttlSeconds),u=ct(e.resourcePolicy);return{connectionId:n,capabilities:r,...o.length>0?{scopes:o}:{},...u?{resourcePolicy:u}:{},...s?{expiresAt:s}:{},...i!==void 0?{ttlSeconds:i}:{},...typeof e.required=="boolean"?{required:e.required}:{}}}d(Se,"normalizeIntegrationAttachInput");function ot(t){if(t==null)return[];if(!Array.isArray(t))throw new Error("Sandbox integration leases must be an array.");return t.map(e=>Rn(e))}d(ot,"normalizeIntegrationLeaseRefsForRuntime");function Rn(t){let e=m(t),n=typeof e.leaseId=="string"?e.leaseId.trim():"";if(!n)throw new Error("Sandbox integration leaseId is required.");if("connectionId"in e)throw new Error("Sandbox integration leases must use leaseId/proxy refs, not connection ids.");Pn(e);let r=Cn(e.provider),o=st(e.capabilities);if(o.length===0)throw new Error("Sandbox integration lease capabilities are required.");at(r,o);let s=it(e.scopes,"Sandbox integration lease scopes"),i=ct(e.resourcePolicy),u=dt(e.expiresAt),c=typeof e.proxyUrl=="string"?e.proxyUrl.trim():"";return{leaseId:n,provider:r,capabilities:o,...s.length>0?{scopes:s}:{},...i?{resourcePolicy:i}:{},...u?{expiresAt:u}:{},...c?{proxyUrl:c}:{},...typeof e.required=="boolean"?{required:e.required}:{}}}d(Rn,"normalizeIntegrationLeaseRefForRuntime");function Cn(t){if(typeof t!="string")throw new Error("Sandbox integration lease provider is required.");let e=se(t);if(!e)throw new Error(`Sandbox integration provider is not supported: ${t}`);if(!ae(e)?.leasePolicy.leaseable)throw new Error(`Sandbox integration provider is not leaseable: ${e}`);return e}d(Cn,"normalizeLeaseableIntegrationProvider");function Pn(t){for(let e of Object.keys(t))if(ut(e))throw new Error("Sandbox integration leases must not include secrets or credentials.")}d(Pn,"assertNoSensitiveIntegrationLeaseKeys");function at(t,e){if(t==null||t==="")return;if(typeof t!="string")throw new Error("Sandbox integration provider must be a string.");let n=se(t);if(!n)throw new Error(`Sandbox integration provider is not supported: ${t}`);let r=ae(n);if(!r?.leasePolicy.leaseable)throw new Error(`Sandbox integration provider is not leaseable: ${n}`);let o=new Set(r.leasePolicy.allowedCapabilityIds),s=e.filter(i=>!o.has(i));if(s.length>0)throw new Error(`Sandbox integration capabilities are not allowed for ${n}: ${s.join(", ")}`)}d(at,"validateIntegrationCapabilitiesForProvider");function we(t){let e=m(t),n=typeof e.leaseId=="string"?e.leaseId.trim():"";if(!n)throw new Error("Sandbox integration lease is required.");return n}d(we,"normalizeIntegrationLeaseId");function st(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e.trim():"").filter(Boolean):[]}d(st,"normalizeStringArray");function it(t,e){if(t==null)return[];if(!Array.isArray(t))throw new Error(`${e} must be an array of strings.`);return t.map(n=>{if(typeof n!="string")throw new Error(`${e} must contain only strings.`);let r=n.trim();if(!r)throw new Error(`${e} must not contain empty values.`);return r})}d(it,"normalizeOptionalStringArray");function En(t){if(t==null||t==="")return;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw new Error("Sandbox integration ttlSeconds must be a positive number.");return Math.max(1,Math.floor(e))}d(En,"normalizeIntegrationTtlSeconds");function dt(t){if(t==null||t==="")return;if(typeof t!="string")throw new Error("Sandbox integration expiresAt must be an ISO timestamp string.");let e=t.trim();if(!e)return;let n=Date.parse(e);if(!Number.isFinite(n))throw new Error("Sandbox integration expiresAt must be a valid ISO timestamp.");return e}d(dt,"normalizeIntegrationExpiresAt");function ct(t){if(t==null)return;if(typeof t!="object"||Array.isArray(t))throw new Error("Sandbox integration resourcePolicy must be an object.");if(ge(t,[]),JSON.stringify(t).length>16*1024)throw new Error("Sandbox integration resourcePolicy is too large.");return t}d(ct,"normalizeIntegrationResourcePolicy");function ge(t,e){if(!(!t||typeof t!="object")){if(e.length>8)throw new Error("Sandbox integration resourcePolicy is too deeply nested.");if(Array.isArray(t)){for(let n of t)ge(n,e);return}for(let[n,r]of Object.entries(t)){if(ut(n))throw new Error("Sandbox integration resourcePolicy must not include secrets or credentials.");ge(r,[...e,n])}}}d(ge,"assertNoSensitiveResourcePolicyKeys");function ut(t){let e=t.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("accesstoken")||e.includes("refreshtoken")||e.includes("idtoken")||e.includes("oauth")||e.includes("bearer")||e.includes("authorization")||e.includes("cookie")||e.includes("secret")||e.includes("password")||e.includes("credential")}d(ut,"isSensitivePolicyKey");function pt(t){let e=m(t),n=typeof e.command=="string"?e.command.trim():"";if(!n)throw new Error("Sandbox command is required.");let r=typeof e.timeoutSeconds=="number"&&Number.isFinite(e.timeoutSeconds)?Math.max(1,Math.floor(e.timeoutSeconds)):void 0,o=Ne(n);return r?{command:o,timeoutSeconds:r}:{command:o}}d(pt,"normalizeExecInput");function mt(t){let e=m(t),n=typeof e.command=="string"?e.command.trim():"";if(!n)throw new Error("Sandbox process command is required.");let r=typeof e.timeoutSeconds=="number"&&Number.isFinite(e.timeoutSeconds)?Math.max(1,Math.floor(e.timeoutSeconds)):void 0;return r?{command:n,timeoutSeconds:r}:{command:n}}d(mt,"normalizeProcessStartInput");function lt(t){let e=m(t),n=Number(e.since);return Number.isFinite(n)?{since:Math.max(0,Math.floor(n))}:{}}d(lt,"normalizeProcessCursorInput");function ht(t){let e=m(t),n=typeof e.port=="number"?e.port:Number(e.port);if(!Number.isInteger(n)||n<re||n>oe)throw new Error(`Sandbox preview port must be between ${re} and ${oe}.`);let r=typeof e.label=="string"&&e.label.trim()?e.label.trim():void 0,o=e.access==="public"||e.access==="private"?e.access:void 0,s=e.autoStart===!0,i=typeof e.customDomain=="string"&&e.customDomain.trim()?e.customDomain.trim():void 0,u={port:n,...r?{label:r}:{},...o?{access:o}:{},...s?{autoStart:s}:{},...i?{customDomain:i}:{}};return e.cors&&typeof e.cors=="object"&&!Array.isArray(e.cors)&&(u.cors=e.cors),e.headerPolicy&&typeof e.headerPolicy=="object"&&!Array.isArray(e.headerPolicy)&&(u.headerPolicy=e.headerPolicy),e.authPolicy&&typeof e.authPolicy=="object"&&!Array.isArray(e.authPolicy)&&(u.authPolicy=e.authPolicy),u}d(ht,"normalizeOpenPortInput");function ft(t){let e=m(t),n={};if(e.template&&typeof e.template=="object"&&!Array.isArray(e.template)){let r=m(e.template),o={};typeof r.description=="string"?o.description=r.description.trim():r.description===null&&(o.description=null),Array.isArray(r.tags)&&(o.tags=r.tags.map(s=>typeof s=="string"?s.trim():"").filter(Boolean).slice(0,20)),(r.visibility==="private"||r.visibility==="team")&&(o.visibility=r.visibility),typeof r.useCase=="string"?o.useCase=r.useCase.trim():r.useCase===null&&(o.useCase=null),Object.keys(o).length>0&&(n.template=o)}if(e.retention&&typeof e.retention=="object"&&!Array.isArray(e.retention)){let r=m(e.retention),o={};(r.class==="ephemeral"||r.class==="cached"||r.class==="pinned")&&(o.class=r.class),r.ttlSeconds===null?o.ttlSeconds=null:typeof r.ttlSeconds=="number"&&Number.isFinite(r.ttlSeconds)&&(o.ttlSeconds=Math.max(1,Math.floor(r.ttlSeconds))),Object.keys(o).length>0&&(n.retention=o)}if(!n.template&&!n.retention)throw new Error("Snapshot update requires template or retention changes.");return n}d(ft,"normalizeSnapshotUpdateInput");function yt(t){let e=m(t),n=typeof e.cleanup=="string"?e.cleanup.trim():"";return n==="delete"||n==="stop"||n==="archive"?{cleanup:n}:{}}d(yt,"normalizeSnapshotValidateInput");function xe(t){let e=m(t),n={};return typeof e.snapshotId=="string"&&e.snapshotId.trim()&&(n.snapshotId=e.snapshotId.trim()),(e.visibility==="private"||e.visibility==="team")&&(n.visibility=e.visibility),e.resources&&typeof e.resources=="object"&&!Array.isArray(e.resources)&&(n.resources=e.resources),e.budget&&typeof e.budget=="object"&&!Array.isArray(e.budget)&&(n.budget=e.budget),e.networkPolicy&&typeof e.networkPolicy=="object"&&!Array.isArray(e.networkPolicy)&&(n.networkPolicy=e.networkPolicy),e.quotas&&typeof e.quotas=="object"&&!Array.isArray(e.quotas)&&(n.quotas=e.quotas),Array.isArray(e.volumes)&&(n.volumes=e.volumes),"integrationLeases"in e&&(n.integrationLeases=ot(e.integrationLeases)),"env"in e&&(n.env=ve(e.env)),e.metadata&&typeof e.metadata=="object"&&!Array.isArray(e.metadata)&&(n.metadata=e.metadata),n}d(xe,"normalizeForkInput");function ve(t){if(t==null)return[];if(!Array.isArray(t))throw new Error("Sandbox env must be an array.");return t.map(e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Sandbox env entries must be objects.");let n=e;if("value"in n)throw new Error("Sandbox env entries must use secretRef, not inline values.");let r=typeof n.name=="string"?n.name.trim():"",o=typeof n.secretRef=="string"?n.secretRef.trim():"";if(!r||!o)throw new Error("Sandbox env entries require name and secretRef.");return{name:r,secretRef:o}})}d(ve,"normalizeSandboxEnvRefsForApp");function gt(t){let e=m(t),n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",o=typeof e.snapshotId=="string"?e.snapshotId.trim():"",s=typeof e.templateName=="string"?e.templateName.trim():"",i=typeof e.version=="string"?e.version.trim():"",u=typeof e.useCase=="string"?e.useCase.trim():"";if(!o&&!s&&!u)throw new Error("Sandbox template launch requires snapshotId, templateName, or useCase.");return{...xe(t),...n?{teamId:n}:{},...r?{projectId:r}:{},...o?{snapshotId:o}:{},...s?{templateName:s}:{},...i?{version:i}:{},...u?{useCase:u}:{}}}d(gt,"normalizeTemplateLaunchInput");function bt(t){let e=m(t),n=typeof e.path=="string"?e.path.trim():"",r=Number(e.maxEntries);return{...n?{path:n}:{},...typeof e.recursive=="boolean"?{recursive:e.recursive}:{},...Number.isFinite(r)?{maxEntries:r}:{}}}d(bt,"normalizeListFilesInput");function It(t){let e=m(t),n=typeof e.query=="string"?e.query.trim():"";if(!n)throw new Error("Sandbox file search query is required.");let r=typeof e.path=="string"?e.path.trim():"",o=Number(e.maxResults);return{query:n,...r?{path:r}:{},...Number.isFinite(o)?{maxResults:o}:{}}}d(It,"normalizeSearchFilesInput");function D(t){let e=m(t),n=typeof e.path=="string"?e.path.trim():"";if(!n)throw new Error("Sandbox file path is required.");return{path:n,recursive:typeof e.recursive=="boolean"?e.recursive:void 0}}d(D,"normalizeDeleteFileInput");function St(t){let e=D(t),n=m(t),r=Number(n.offsetBytes),o=Number(n.maxBytes);return{path:e.path,...Number.isFinite(r)?{offsetBytes:r}:{},...Number.isFinite(o)?{maxBytes:o}:{}}}d(St,"normalizeDownloadFileInput");function wt(t){let e=m(t),n=typeof e.path=="string"?e.path.trim():"",r=typeof e.contents=="string"?e.contents:"",o=typeof e.contentsBase64=="string"?e.contentsBase64.trim():"";if(!n)throw new Error("Sandbox file path is required.");if(!r&&!o)throw new Error("Sandbox file contents are required.");return{path:n,contents:r,contentsBase64:o}}d(wt,"normalizeUploadFileInput");function xt(t){let e=m(t),n=typeof e.fromPath=="string"?e.fromPath.trim():"",r=typeof e.toPath=="string"?e.toPath.trim():"";if(!n||!r)throw new Error("Sandbox file source and target paths are required.");return{fromPath:n,toPath:r,overwrite:typeof e.overwrite=="boolean"?e.overwrite:void 0}}d(xt,"normalizeMoveFileInput");function vt(t){let e=m(t),n=typeof e.branch=="string"?e.branch.trim():"",r=typeof e.startPoint=="string"?e.startPoint.trim():"";if(!n)throw new Error("Sandbox git branch name is required.");return{branch:n,create:e.create===!0,...r?{startPoint:r}:{}}}d(vt,"normalizeGitBranchInput");function Rt(t){let e=m(t),n=typeof e.message=="string"?e.message.trim():"",r=e.all===!0,o=Array.isArray(e.paths)?e.paths.filter(s=>typeof s=="string"&&s.trim()!==""):[];if(!n)throw new Error("Sandbox git commit message is required.");if(!r&&o.length===0)throw new Error("Sandbox git commit requires all=true or at least one path.");return{message:n,...r?{all:!0}:{paths:o.map(s=>s.trim())}}}d(Rt,"normalizeGitCommitInput");function Ct(t){let e=m(t),n=typeof e.remote=="string"?e.remote.trim():"",r=typeof e.branch=="string"?e.branch.trim():"",o=e.rebase===!0,s=typeof e.ffOnly=="boolean"?e.ffOnly:void 0;if(o&&s)throw new Error("Sandbox git pull cannot use rebase and ff-only together.");return{...n?{remote:n}:{},...r?{branch:r}:{},...o?{rebase:o}:{},...typeof s=="boolean"?{ffOnly:s}:{}}}d(Ct,"normalizeGitPullInput");function Pt(t){let e=m(t),n=typeof e.remote=="string"?e.remote.trim():"",r=typeof e.branch=="string"?e.branch.trim():"";return{...n?{remote:n}:{},...r?{branch:r}:{},...e.setUpstream===!0?{setUpstream:!0}:{},...e.forceWithLease===!0?{forceWithLease:!0}:{}}}d(Pt,"normalizeGitPushInput");async function ro(){return(await te()).client}d(ro,"resolveOpenPondSandboxClient");var An="https://api.openpond.ai";async function oo(t){let{client:e,context:n,apiKey:r,sandboxApiUrl:o}=await te(),s=zn(n,o);if(t.type==="list")return{sandboxes:await e.list(y(t.payload)),account:s};if(t.type==="snapshot_catalog"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.agentId=="string"?i.agentId.trim():"",b=typeof i.q=="string"?i.q.trim():"",l=typeof i.tag=="string"?i.tag.trim():"",g=typeof i.useCase=="string"?i.useCase.trim():"",P=i.replayState==="draft"||i.replayState==="validated"||i.replayState==="published"?i.replayState:void 0;return{...await e.snapshotCatalog({...u?{teamId:u}:{},...c?{projectId:c}:{},...p?{agentId:p}:{},...b?{q:b}:{},...l?{tag:l}:{},...g?{useCase:g}:{},...P?{replayState:P}:{}}),account:s}}if(t.type==="snapshot_create")return{...await e.createSnapshot(t.sandboxId,nt(t.payload)),account:s};if(t.type==="template_catalog"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.q=="string"?i.q.trim():"",b=typeof i.name=="string"?i.name.trim():"",l=typeof i.version=="string"?i.version.trim():"",g=typeof i.tag=="string"?i.tag.trim():"",P=typeof i.useCase=="string"?i.useCase.trim():"";return{...await e.templates({...u?{teamId:u}:{},...c?{projectId:c}:{},...p?{q:p}:{},...b?{name:b}:{},...l?{version:l}:{},...g?{tag:g}:{},...P?{useCase:P}:{}}),account:s}}if(t.type==="integration_connections"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.agentId=="string"?i.agentId.trim():"",b=Ie(i.status),l={...c?{projectId:c}:{},...p?{agentId:p}:{},status:b??"all"};return{...u?await e.integrationConnections({teamId:u,...l}):await Re(e,l),account:s}}if(t.type==="connected_app_status"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.agentId=="string"?i.agentId.trim():"",b=Ie(i.status)??"all",l={...c?{projectId:c}:{},...p?{agentId:p}:{},status:b},g=u?await e.integrationConnections({teamId:u,...l}):await Re(e,l);return{teamId:g.teamId,apps:Ue({connections:g.connections}),account:s}}if(t.type==="sandbox_runtime_list")return{runtimes:await e.listSandboxRuntimes(y(t.payload)),account:s};if(t.type==="sandbox_runtime_get")return{runtime:await e.getSandboxRuntime(t.runtimeId),account:s};if(t.type==="sandbox_runtime_create")return{runtime:await e.createSandboxRuntime(be(t.payload)),account:s};if(t.type==="sandbox_runtime_sandbox_create")return{...await e.createSandboxRuntimeSandbox(t.runtimeId,Q(t.payload),{respondAsync:!0}),account:s};if(t.type==="sandbox_runtime_resume"){let i=await e.sandboxRuntime(t.runtimeId).resume(Q(t.payload),{respondAsync:!0});return{runtime:await e.getSandboxRuntime(t.runtimeId),sandbox:i,account:s}}if(t.type==="sandbox_runtime_preserve_source"){let i=m(t.payload);return{...await e.preserveSandboxRuntimeSource(t.runtimeId,{...typeof i.sandboxId=="string"&&i.sandboxId.trim()?{sandboxId:i.sandboxId.trim()}:{},...typeof i.message=="string"&&i.message.trim()?{message:i.message.trim()}:{},...i.source==="profile"?{source:"profile"}:{}},y(t.payload)),account:s}}if(t.type==="sandbox_runtime_promote"){let i=m(t.payload);return{...await e.promoteSandboxRuntime(t.runtimeId,{expectedTargetSha:typeof i.expectedTargetSha=="string"?i.expectedTargetSha.trim():"",...i.validationState==="pending"||i.validationState==="passed"?{validationState:i.validationState}:{},...typeof i.summary=="string"&&i.summary.trim()?{summary:i.summary.trim()}:{}},y(t.payload)),account:s}}if(t.type==="project_list")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/projects",y(t.payload))}),account:s};if(t.type==="profile_get")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/profile",y(t.payload))}),account:s};if(t.type==="profile_ensure")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/profile/ensure",y(t.payload)),method:"POST"}),account:s};if(t.type==="profile_push"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/profile/push",y(i)),method:"POST",body:c}),account:s}}if(t.type==="project_upsert")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/projects",y(t.payload)),method:"POST",body:m(t.payload)}),account:s};if(t.type==="project_get")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}`,y(t.payload))}),account:s};if(t.type==="project_workspace")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/workspace`,y(t.payload))}),account:s};if(t.type==="project_git")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/git`,y(t.payload)),method:"POST"}),account:s};if(t.type==="project_sync")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/sync`,y(t.payload)),method:"POST"}),account:s};if(t.type==="project_source_upload"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/source`,y(i)),method:"POST",body:c}),account:s}}if(t.type==="project_archive")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}`,y(t.payload)),method:"DELETE"}),account:s};if(t.type==="agent_list")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/agents",y(t.payload))}),account:s};if(t.type==="agent_upsert")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/agents",y(t.payload)),method:"POST",body:m(t.payload)}),account:s};if(t.type==="agent_run")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/run`,y(t.payload)),method:"POST",body:m(t.payload)}),account:s};if(t.type==="agent_source_deploy_plan")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/source/deploy-plan`,y(t.payload))}),account:s};if(t.type==="agent_source_checks"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/source/checks`,y(i)),method:"POST",body:c,timeoutMs:900*1e3}),account:s}}if(t.type==="agent_source_publish"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/source/publish`,y(i)),method:"POST",body:c}),account:s}}if(t.type==="create")return{sandbox:await e.create(Z(t.payload)),account:s};if(t.type==="get")return{sandbox:await e.get(t.sandboxId),account:s};if(t.type==="start")return{...await e.start(t.sandboxId,{respondAsync:!0}),account:s};if(t.type==="delete"){let i=await Et(e,t.sandboxId,{failOnUnpreservedChanges:t.failOnUnpreservedChanges}),u=await e.delete(t.sandboxId,i).catch(c=>kt("delete",e,t.sandboxId,c));return At("delete",u),{sandbox:u,account:s}}if(t.type==="exec")return{...await e.exec(t.sandboxId,pt(t.payload)),account:s};if(t.type==="action_run")return{...await Tn({apiKey:r,sandboxApiUrl:o,path:`/sandboxes/${encodeURIComponent(t.sandboxId)}/actions/${encodeURIComponent(t.actionName)}/run`,method:"POST",body:m(t.payload)}),account:s};if(t.type==="open_port")return{...await e.openPort(t.sandboxId,ht(t.payload)),account:s};if(t.type==="snapshot_update")return{...await e.updateSnapshot(t.sandboxId,t.snapshotId,ft(t.payload)),account:s};if(t.type==="snapshot_validate")return{...await e.validateSnapshot(t.sandboxId,t.snapshotId,yt(t.payload)),account:s};if(t.type==="snapshot_publish")return{...await e.publishSnapshot(t.sandboxId,t.snapshotId),account:s};if(t.type==="replays")return{...await e.listReplays(y(t.payload)),account:s};if(t.type==="replay_start")return{...await e.startReplay(rt(t.payload)),account:s};if(t.type==="replay_get")return{...await e.getReplay(t.replayId,y(t.payload)),account:s};if(t.type==="replay_logs")return{...await e.getReplayLogs(t.replayId,y(t.payload)),account:s};if(t.type==="replay_artifacts")return{...await e.getReplayArtifacts(t.replayId,y(t.payload)),account:s};if(t.type==="replay_cancel")return{...await e.cancelReplay(t.replayId,y(t.payload)),account:s};if(t.type==="schedule_create")return{...await e.createSchedule(m(t.payload)),account:s};if(t.type==="template_launch")return{...await e.launchTemplate(gt(t.payload)),account:s};if(t.type==="fork")return{...await e.fork(t.sandboxId,xe(t.payload)),account:s};if(t.type==="stop"){let i=await Et(e,t.sandboxId,{failOnUnpreservedChanges:t.failOnUnpreservedChanges}),u=await e.stop(t.sandboxId,i).catch(c=>kt("stop",e,t.sandboxId,c));return At("stop",u.sandbox),{...u,account:s}}if(t.type==="receipts")return{receipts:await e.receipts(t.sandboxId),account:s};if(t.type==="logs")return{logs:await e.logs(t.sandboxId),account:s};if(t.type==="integration_leases")return{...await e.integrationLeases(t.sandboxId),account:s};if(t.type==="integration_attach")return{...await e.attachIntegrationConnection(t.sandboxId,Se(t.payload)),account:s};if(t.type==="integration_remove")return{...await e.removeIntegrationLease(t.sandboxId,we(t.payload)),account:s};if(t.type==="process_start")return{...await e.startProcess(t.sandboxId,mt(t.payload)),account:s};if(t.type==="process_get")return{...await e.getProcess(t.sandboxId,t.processId,lt(t.payload)),account:s};if(t.type==="upload_file"){let i=wt(t.payload);return{...i.contentsBase64?await e.uploadFileBase64(t.sandboxId,i.path,i.contentsBase64):await e.uploadFile(t.sandboxId,i.path,i.contents),account:s}}if(t.type==="download_file"){let i=St(t.payload);return{...await e.downloadFileResponse(t.sandboxId,i),account:s}}if(t.type==="list_files")return{...await e.listFiles(t.sandboxId,bt(t.payload)),account:s};if(t.type==="search_files")return{...await e.searchFiles(t.sandboxId,It(t.payload)),account:s};if(t.type==="delete_file"){let i=D(t.payload);return{...await e.deleteFile(t.sandboxId,i.path,{recursive:i.recursive}),account:s}}if(t.type==="stat_file"){let i=D(t.payload);return{...await e.statFile(t.sandboxId,i.path),account:s}}if(t.type==="mkdir"){let i=D(t.payload);return{...await e.mkdir(t.sandboxId,{path:i.path,recursive:i.recursive}),account:s}}if(t.type==="move_file"){let i=xt(t.payload);return{...await e.moveFile(t.sandboxId,i),account:s}}if(t.type==="git_status")return{...await e.gitStatus(t.sandboxId),account:s};if(t.type==="git_diff"){let i=m(t.payload),u=typeof i.baseRef=="string"?i.baseRef.trim():"";return{...await e.gitDiff(t.sandboxId,{...u?{baseRef:u}:{}}),account:s}}if(t.type==="git_export_patch"){let i=m(t.payload),u=typeof i.baseRef=="string"?i.baseRef.trim():"";return{...await e.gitExportPatch(t.sandboxId,{...u?{baseRef:u}:{}}),account:s}}if(t.type==="git_branch")return{...await e.gitBranch(t.sandboxId,vt(t.payload)),account:s};if(t.type==="git_commit")return{...await e.gitCommit(t.sandboxId,Rt(t.payload)),account:s};if(t.type==="git_pull")return{...await e.gitPull(t.sandboxId,Ct(t.payload)),account:s};if(t.type==="git_push")return{...await e.gitPush(t.sandboxId,Pt(t.payload)),account:s};throw new Error(`Unsupported sandbox action: ${t.type}`)}d(oo,"sandboxRequestPayload");async function ao(t={}){let{client:e}=await te();return t.teamId?e.integrationConnections(t):Re(e,{...t.projectId?{projectId:t.projectId}:{},...t.agentId?{agentId:t.agentId}:{},status:t.status??"all"})}d(ao,"listSandboxIntegrationConnections");async function Et(t,e,n={}){let r=await t.get(e).then(o=>!Ut(o)).catch(()=>!0);return{failOnUnpreservedChanges:n.failOnUnpreservedChanges,...r?{respondAsync:!0}:{}}}d(Et,"sandboxLifecycleRequestOptions");function Ut(t){return t.reservation.status==="reserved"&&(t.state==="creating"||qt.has(t.state))}d(Ut,"sandboxLifecycleRequiresSynchronousAccounting");function At(t,e){if(qt.has(e.state)&&e.reservation.status==="reserved")throw new Error(`Sandbox ${t} reached ${e.state}, but reservation ${e.reservation.id} is still reserved. Cleanup accounting has not settled; retry status before treating cleanup as complete.`)}d(At,"assertTerminalSandboxLifecycleSettled");async function kt(t,e,n,r){let o=await e.get(n).catch(()=>null);if(o&&Ut(o)){let s=r instanceof Error?r.message:String(r);throw new Error(`Sandbox ${t} failed while sandbox ${n} is still creating with active reservation ${o.reservation.id}. Cleanup accounting has not settled; retry status before treating cleanup as complete. Original error: ${s}`)}throw r instanceof Error?r:new Error(String(r))}d(kt,"throwSandboxLifecycleRequestFailure");var qt=new Set(["stopped","archived","deleted","error"]);async function Re(t,e){let n=await t.listOrganizations().catch(()=>{throw new Error("Connected app status is unavailable because organizations could not be loaded.")}),r=$n(n),o=On(n)||null;if(r.length===0)return{teamId:o,connections:[]};let s=await Promise.all(r.map(u=>t.integrationConnections({teamId:u,...e.projectId?{projectId:e.projectId}:{},...e.agentId?{agentId:e.agentId}:{},status:e.status}).catch(()=>null))),i=qn(s);return{teamId:kn(i)??o??i.find(u=>u.teamId.trim())?.teamId.trim()??null,connections:Un(i)}}d(Re,"resolveImplicitConnectedAppStatusConnections");function kn(t){for(let e of t){if((e.connections?.length??0)===0)continue;let n=e.teamId?.trim();if(n)return n}return null}d(kn,"connectedAppStatusTeamIdWithConnections");function Un(t){let e=[],n=new Set;for(let r of t)for(let o of r.connections??[]){let s=o.id.trim()||[o.teamId,o.provider,o.providerAccountId].join(":");n.has(s)||(n.add(s),e.push(o))}return e}d(Un,"mergeConnectedAppStatusConnectionResults");function qn(t){let e=t.filter(o=>o!==null),n=t.length-e.length,r=e.reduce((o,s)=>o+(s.connections?.length??0),0);if(n>0&&r===0)throw new Error("Connected app status is unavailable because one or more team integration connection lookups could not be loaded.");return e}d(qn,"successfulConnectedAppStatusConnectionResults");function On(t){let e=t.filter(n=>Ot(n)==="active");return ee(e.find(n=>n.role==="owner"))??ee(e.find(n=>n.role==="admin"))??ee(e[0])??""}d(On,"selectImplicitConnectedAppStatusTeamId");function $n(t){let e=[],n=new Set;for(let r of t){if(Ot(r)!=="active")continue;let o=ee(r);!o||n.has(o)||(n.add(o),e.push(o))}return e}d($n,"implicitConnectedAppStatusTeamIds");function ee(t){if(!t)return null;let e=t.id;return(typeof t.teamId=="string"?t.teamId:typeof e=="string"?e:"").trim()||null}d(ee,"organizationTeamId");function Ot(t){return typeof t.status=="string"?t.status:"active"}d(Ot,"organizationStatus");async function te(){let t=$(process.env.OPENPOND_SANDBOX_API_URL),e=process.env.OPENPOND_SANDBOX_API_KEY?.trim();if(e&&t)return{client:Y({apiKey:e,sandboxApiUrl:t}),context:await ue().catch(()=>null),apiKey:e,sandboxApiUrl:O(t,{apiBaseUrl:t})};let n=await ue(),r=n.token?.trim();if(!r)throw new Error("OpenPond account API key is required to manage sandboxes.");if(t)return{client:Y({apiKey:r,sandboxApiUrl:t}),context:n,apiKey:r,sandboxApiUrl:O(t,{apiBaseUrl:t})};let o=Ln(n);return{client:Y({apiKey:r,baseUrl:o}),context:n,apiKey:r,sandboxApiUrl:O(o,{apiBaseUrl:o})}}d(te,"resolveSandboxClient");function jn(t){return O(t,{apiBaseUrl:t}).replace(/\/sandboxes\/?$/,"")}d(jn,"sandboxApiRootUrl");function _n(t){let e=O(t,{apiBaseUrl:t});return/\/api\/sandboxes\/?$/.test(e)?e.replace(/\/api\/sandboxes\/?$/,"/v1"):e.replace(/\/sandboxes\/?$/,"")}d(_n,"sandboxPublicApiRootUrl");function v(t,e){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),e.agentId&&n.set("agentId",e.agentId),`${t}${n.size>0?`?${n.toString()}`:""}`}d(v,"sandboxScopedCollectionPath");async function Tn(t){let e=await z(jn(t.sandboxApiUrl),t.apiKey,t.path,{method:t.method??"GET",...t.body?{body:JSON.stringify(t.body)}:{}}),n=await e.json().catch(()=>({}));if(!e.ok){let r=typeof n.error=="string"?n.error:`Sandbox API request failed with status ${e.status}`;throw new Error(r)}return n}d(Tn,"requestSandboxApiRoot");async function w(t){let e=await z(_n(t.sandboxApiUrl),t.apiKey,t.path,{method:t.method??"GET",signal:t.signal,headers:{...t.idempotencyKey?{"idempotency-key":t.idempotencyKey}:{},...t.teamId?{"X-OpenPond-Team-Id":t.teamId}:{}},...t.body?{body:JSON.stringify(t.body)}:{},...t.timeoutMs!==void 0?{timeoutMs:t.timeoutMs}:{}}),n=await e.json().catch(()=>({}));if(!e.ok){let r=typeof n.error=="string"?n.error:`Sandbox API request failed with status ${e.status}`;throw new Error(r)}return n}d(w,"requestSandboxPublicApiRoot");async function so(t){let{apiKey:e,sandboxApiUrl:n}=await te();return w({apiKey:e,sandboxApiUrl:n,...t})}d(so,"requestOpenPondPublicApi");function zn(t,e){if(!t)return{label:"Sandbox API",handle:null,baseUrl:null,sandboxApiUrl:e,state:"signed_out"};let n=t.accountState;return{label:n.label,handle:n.activeProfile?.handle??t.account?.handle??null,baseUrl:n.baseUrl??t.account?.baseUrl??null,sandboxApiUrl:e,state:n.state}}d(zn,"sandboxAccountSummary");function Ln(t){return $(process.env.OPENPOND_SANDBOX_BASE_URL)??$(process.env.OPENPOND_API_URL)??$(t.apiBaseUrl)??$(t.account?.baseUrl)??$(t.config.baseUrl)??An}d(Ln,"resolveSandboxBaseUrl");export{ir as a,Pr as b,Xe as c,nn as d,rn as e,$r as f,on as g,jr as h,jt as i,ro as j,oo as k,ao as l,so as m};
|
|
12
|
+
`));return typeof n.output=="string"?n.output:null}catch{return null}}d(In,"parseProcessOutputEvent");function O(t,e={}){let n=t.trim().replace(/\/$/,"");if(!n)throw new Error("sandbox API URL must be non-empty");let r=new URL(n),o=r.pathname.replace(/\/$/,"");if(o.endsWith("/v1/sandboxes")||o.endsWith("/api/sandboxes"))return`${r.origin}${o}`;if(o.endsWith("/v1"))return`${r.origin}${o}/sandboxes`;if(r.origin===gn)return`${ye}/v1/sandboxes`;let s=e.apiBaseUrl?new URL(e.apiBaseUrl).origin:ye;return r.origin===s?`${r.origin}${o}/v1/sandboxes`:`${r.origin}${o}/api/sandboxes`}d(O,"normalizeSandboxApiUrl");function Sn(t){let e="/sandboxes";if(!t.endsWith(e))throw new Error("sandbox API URL must end with /sandboxes");return t.slice(0,-e.length)}d(Sn,"apiRootUrlFromSandboxApiUrl");var wn=class{static{d(this,"OpenPondSandboxInstanceClient")}apiKey;apiRootUrl;sandboxApiUrl;customEndpoint;constructor(t){this.apiKey=t.apiKey,this.customEndpoint=t.customEndpoint??!1;let e=t.sandboxApiUrl??t.baseUrl??ye;this.sandboxApiUrl=O(e,{apiBaseUrl:this.customEndpoint?void 0:e}),this.apiRootUrl=Sn(this.sandboxApiUrl)}create(t,e={}){return this.request("",{method:"POST",...this.customEndpoint?{timeoutMs:18e4}:{},headers:M(e),body:JSON.stringify(t)}).then(n=>n.sandbox)}get(t){return this.request(`/${encodeURIComponent(t)}`).then(e=>e.sandbox)}exec(t,e){return this.request(`/${encodeURIComponent(t)}/exec`,{method:"POST",body:JSON.stringify(e)})}startProcess(t,e){return this.request(`/${encodeURIComponent(t)}/processes`,{method:"POST",body:JSON.stringify(e)})}listProcesses(t){return this.request(`/${encodeURIComponent(t)}/processes`)}getProcess(t,e,n={}){let r=new URLSearchParams;return n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),this.request(`/${encodeURIComponent(t)}/processes/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`)}stopProcess(t,e){return this.request(`/${encodeURIComponent(t)}/processes/${encodeURIComponent(e)}`,{method:"DELETE"})}async streamProcessOutput(t,e,n={}){let r=new URLSearchParams;n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),await Ze({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(t)}/processes/${encodeURIComponent(e)}/stream${r.size>0?`?${r.toString()}`:""}`})}startPty(t,e={}){return this.request(`/${encodeURIComponent(t)}/pty`,{method:"POST",body:JSON.stringify(e)})}listPtys(t){return this.request(`/${encodeURIComponent(t)}/pty`)}getPty(t,e,n={}){let r=new URLSearchParams;return n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),this.request(`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`)}writePtyInput(t,e,n){return this.request(`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}/input`,{method:"POST",body:JSON.stringify(bn(n))})}stopPty(t,e){return this.request(`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}`,{method:"DELETE"})}async streamPtyOutput(t,e,n={}){let r=new URLSearchParams;n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),await Ze({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}/stream${r.size>0?`?${r.toString()}`:""}`})}uploadFile(t,e,n){return this.uploadFileBase64(t,e,Buffer.from(n,"utf-8").toString("base64"))}uploadFileBase64(t,e,n){return this.request(`/${encodeURIComponent(t)}/files`,{method:"POST",body:JSON.stringify({path:e,contentsBase64:n})})}async downloadFile(t,e){let n=await this.downloadFileResponse(t,e);return Buffer.from(n.file.contentsBase64,"base64").toString("utf-8")}downloadFileResponse(t,e){let n=typeof e=="string"?{path:e}:e,r=new URLSearchParams({path:n.path});return n.offsetBytes!==void 0&&r.set("offsetBytes",String(n.offsetBytes)),n.maxBytes!==void 0&&r.set("maxBytes",String(n.maxBytes)),this.request(`/${encodeURIComponent(t)}/files?${r.toString()}`)}listFiles(t,e={}){let n=new URLSearchParams({list:"1"});return e.path&&n.set("path",e.path),e.recursive!==void 0&&n.set("recursive",String(e.recursive)),e.maxEntries!==void 0&&n.set("maxEntries",String(e.maxEntries)),this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`)}deleteFile(t,e,n={}){let r=new URLSearchParams({path:e});return n.recursive!==void 0&&r.set("recursive",String(n.recursive)),this.request(`/${encodeURIComponent(t)}/files?${r.toString()}`,{method:"DELETE"})}statFile(t,e){let n=new URLSearchParams({stat:"1",path:e});return this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`)}mkdir(t,e){let n=typeof e=="string"?{path:e}:e,r=new URLSearchParams({path:n.path});return n.recursive!==void 0&&r.set("recursive",String(n.recursive)),this.request(`/${encodeURIComponent(t)}/files?${r.toString()}`,{method:"PUT"})}moveFile(t,e){let n=new URLSearchParams({fromPath:e.fromPath,toPath:e.toPath});return e.overwrite!==void 0&&n.set("overwrite",String(e.overwrite)),this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`,{method:"PATCH"})}searchFiles(t,e){let n=new URLSearchParams({search:"1",query:e.query});return e.path&&n.set("path",e.path),e.maxResults!==void 0&&n.set("maxResults",String(e.maxResults)),this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`)}openPort(t,e){return this.request(`/${encodeURIComponent(t)}/ports`,{method:"POST",body:JSON.stringify(e)})}createSnapshot(t,e){return this.request(`/${encodeURIComponent(t)}/snapshots`,{method:"POST",body:JSON.stringify(e)})}updateSnapshot(t,e,n){return this.request(`/${encodeURIComponent(t)}/snapshots/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)})}validateSnapshot(t,e,n={}){return this.request(`/${encodeURIComponent(t)}/snapshots/${encodeURIComponent(e)}/validate`,{method:"POST",body:JSON.stringify(n)})}publishSnapshot(t,e){return this.request(`/${encodeURIComponent(t)}/snapshots/${encodeURIComponent(e)}/publish`,{method:"POST"})}fork(t,e={}){return this.request(`/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify(e)})}stop(t,e={}){let n=new URLSearchParams;return e.failOnUnpreservedChanges&&n.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(t)}/stop${n.size>0?`?${n.toString()}`:""}`,{method:"POST",headers:M(e)})}start(t,e={}){return this.request(`/${encodeURIComponent(t)}/start`,{method:"POST",headers:M(e)})}restore(t){return this.request(`/${encodeURIComponent(t)}/restore`,{method:"POST"})}delete(t,e={}){let n=new URLSearchParams;return e.failOnUnpreservedChanges&&n.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`,{method:"DELETE",headers:M(e)}).then(r=>r.sandbox)}receipts(t){return this.request(`/${encodeURIComponent(t)}/receipts`).then(e=>e.receipts)}logs(t){return this.request(`/${encodeURIComponent(t)}/logs`).then(e=>e.logs)}gitStatus(t){return this.request(`/${encodeURIComponent(t)}/git/status`)}gitDiff(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/diff`,{method:"POST",body:JSON.stringify(e)})}gitExportPatch(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/export-patch`,{method:"POST",body:JSON.stringify(e)})}gitBranch(t,e){return this.request(`/${encodeURIComponent(t)}/git/branch`,{method:"POST",body:JSON.stringify(e)})}gitCommit(t,e){return this.request(`/${encodeURIComponent(t)}/git/commit`,{method:"POST",body:JSON.stringify(e)})}gitPull(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/pull`,{method:"POST",body:JSON.stringify(e)})}gitPush(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/push`,{method:"POST",body:JSON.stringify(e)})}billing(t){return this.request(`/${encodeURIComponent(t)}/billing`)}pricing(){return this.request("/pricing")}costs(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),this.request(`/costs${e.size>0?`?${e.toString()}`:""}`)}integrationLeases(t){return this.request(`/${encodeURIComponent(t)}/integrations`)}attachIntegrationConnection(t,e){return this.request(`/${encodeURIComponent(t)}/integrations`,{method:"POST",body:JSON.stringify(e)})}removeIntegrationLease(t,e){return this.request(`/${encodeURIComponent(t)}/integrations`,{method:"DELETE",body:JSON.stringify({leaseId:e})})}async request(t,e={}){let n=await X(this.sandboxApiUrl,this.apiKey,t,this.customEndpoint?{...e,explicitBearerAuth:!0,redirect:"error"}:e);return me(n,"Sandbox request")}async requestApiRoot(t,e={}){let n=await X(this.apiRootUrl,this.apiKey,t,this.customEndpoint?{...e,explicitBearerAuth:!0,redirect:"error"}:e);return me(n,"OpenPond API request")}},xn=class extends wn{static{d(this,"OpenPondSandboxClient")}runtimes=an(this);sandboxes=sn(this);profile=cn(this);projects=dn(this);agents=un(this);list(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),this.request(e.size>0?`?${e.toString()}`:"").then(n=>n.sandboxes)}listSecrets(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets${e.size>0?`?${e.toString()}`:""}`).then(n=>n.secrets)}getSecret(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`).then(r=>r.secret)}createSecret(t){return this.requestApiRoot("/sandbox-secrets",{method:"POST",body:JSON.stringify(t)}).then(e=>e.secret)}rotateSecret(t,e){let n=new URLSearchParams;e.teamId&&n.set("teamId",e.teamId);let{teamId:r,...o}=e;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}/rotate${n.size>0?`?${n.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)}).then(s=>s.secret)}attachSecret(t,e){let n=new URLSearchParams;e.teamId&&n.set("teamId",e.teamId);let{teamId:r,...o}=e;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}/attach${n.size>0?`?${n.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)}).then(s=>s.secret)}revokeSecret(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}/revoke${n.size>0?`?${n.toString()}`:""}`,{method:"POST"}).then(r=>r.secret)}deleteSecret(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`,{method:"DELETE"}).then(r=>r.secret)}snapshotCatalog(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),t.q&&e.set("q",t.q),t.kind&&e.set("kind",t.kind),t.replayState&&e.set("replayState",t.replayState),t.visibility&&e.set("visibility",t.visibility),t.tag&&e.set("tag",t.tag),t.useCase&&e.set("useCase",t.useCase),t.limit&&e.set("limit",String(t.limit)),this.request(`/catalog/snapshots${e.size>0?`?${e.toString()}`:""}`)}listSandboxRuntimes(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),this.requestApiRoot(`/runtimes${e.size>0?`?${e.toString()}`:""}`).then(n=>n.runtimes)}listProjects(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects?${e.toString()}`).then(n=>n.projects)}upsertProject(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects?${e.toString()}`,{method:"POST",body:JSON.stringify(t)}).then(n=>n.project)}getHostedProfile(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/profile?${e.toString()}`).then(n=>n.profile)}ensureHostedProfile(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/profile/ensure?${e.toString()}`,{method:"POST"}).then(n=>{if(!n.profile)throw new Error("hosted_profile_missing");return n.profile})}pushHostedProfile(t){let e=new URLSearchParams({teamId:t.teamId}),{teamId:n,...r}=t;return this.requestApiRoot(`/profile/push?${e.toString()}`,{method:"POST",body:JSON.stringify(r)})}async upsertProjectGitRemote(t){let e=await this.upsertProject(t);return this.ensureProjectGitRemote(e.id,{teamId:t.teamId})}getProject(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}?${n.toString()}`).then(r=>r.project)}syncProject(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}/sync?${n.toString()}`,{method:"POST"}).then(r=>r.project)}ensureProjectGitRemote(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}/git?${n.toString()}`,{method:"POST"})}uploadProjectSource(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/projects/${encodeURIComponent(t)}/source?${n.toString()}`,{method:"POST",body:JSON.stringify(o)}).then(s=>s.project)}updateProject(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/projects/${encodeURIComponent(t)}?${n.toString()}`,{method:"PATCH",body:JSON.stringify(o)}).then(s=>s.project)}archiveProject(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}?${n.toString()}`,{method:"DELETE"}).then(r=>r.project)}listAgents(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents?${e.toString()}`).then(n=>n.agents)}upsertAgent(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents?${e.toString()}`,{method:"POST",body:JSON.stringify(t)}).then(n=>n.agent)}getAgent(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(t)}?${n.toString()}`).then(r=>r.agent)}archiveAgent(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(t)}?${n.toString()}`,{method:"DELETE"}).then(r=>r.agent)}updateAgent(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}?${n.toString()}`,{method:"PATCH",body:JSON.stringify(o)}).then(s=>s.agent)}runAgent(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/run?${n.toString()}`,{method:"POST",headers:{Prefer:"respond-async"},body:JSON.stringify(o)})}getAgentSourceDeployPlan(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/deploy-plan?${n.toString()}`).then(r=>r.deployPlan)}listAgentManifestSnapshots(t,e){let n=new URLSearchParams({teamId:e.teamId});return e.limit!==void 0&&n.set("limit",String(e.limit)),this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/manifest-snapshots?${n.toString()}`).then(r=>r.manifestSnapshots)}requestAgentSourceChecks(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/checks?${n.toString()}`,{method:"POST",body:JSON.stringify(o),timeoutMs:900*1e3})}configureAgentSourceSetup(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/setup?${n.toString()}`,{method:"POST",body:JSON.stringify(o)})}publishAgentSource(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/publish?${n.toString()}`,{method:"POST",body:JSON.stringify(o)})}getMicrosoftTeamsBotOverview(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/teams/bot/overview?${e.toString()}`)}bindMicrosoftTeamsBotConversation(t){return this.requestApiRoot("/teams/bot/bindings",{method:"POST",body:JSON.stringify(t)})}rebindMicrosoftTeamsBotConversation(t,e){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)})}unlinkMicrosoftTeamsBotConversation(t){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(t.bindingId)}`,{method:"DELETE",body:JSON.stringify({teamId:t.teamId})})}sendMicrosoftTeamsBotDiagnostic(t){return this.requestApiRoot("/teams/bot/diagnostics",{method:"POST",body:JSON.stringify(t)})}sendMicrosoftTeamsBotDiagnosticRun(t){return this.requestApiRoot("/teams/bot/diagnostics/run",{method:"POST",body:JSON.stringify(t)})}createSandboxRuntime(t){return this.requestApiRoot("/runtimes",{method:"POST",body:JSON.stringify(t)}).then(e=>e.runtime)}sandboxRuntime(t,e=null){return pn(this,t,e)}getSandboxRuntime(t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}`).then(e=>e.runtime)}createSandboxRuntimeSandbox(t,e={},n={}){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/sandbox`,{method:"POST",headers:M(n),body:JSON.stringify(e)})}updateSandboxRuntimeStatus(t,e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/status`,{method:"PATCH",body:JSON.stringify(e)}).then(n=>n.runtime)}listSandboxRuntimeEvents(t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/events`)}emitSandboxRuntimeEvent(t,e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/events`,{method:"POST",body:JSON.stringify(e)})}checkpointSandboxRuntime(t,e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/checkpoints`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.runtime)}promoteSandboxRuntime(t,e,n={}){let r=new URLSearchParams;return n.teamId&&r.set("teamId",n.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/promote${r.size>0?`?${r.toString()}`:""}`,{method:"POST",body:JSON.stringify(e)})}preserveSandboxRuntimeSource(t,e={},n={}){let r=new URLSearchParams;return n.teamId&&r.set("teamId",n.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/preserve-source${r.size>0?`?${r.toString()}`:""}`,{method:"POST",body:JSON.stringify(e)})}forkSnapshot(t,e={},n={}){let r=new URLSearchParams;e.teamId&&r.set("teamId",e.teamId),e.projectId&&r.set("projectId",e.projectId),n.async&&r.set("async","1");let{teamId:o,projectId:s,...i}=e;return this.request(`/catalog/snapshots/${encodeURIComponent(t)}/fork${r.size>0?`?${r.toString()}`:""}`,{method:"POST",headers:n.async?{Prefer:"respond-async"}:void 0,body:JSON.stringify({...i,snapshotId:t})})}templates(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.q&&e.set("q",t.q),t.name&&e.set("name",t.name),t.version&&e.set("version",t.version),t.visibility&&e.set("visibility",t.visibility),t.tag&&e.set("tag",t.tag),t.useCase&&e.set("useCase",t.useCase),t.limit&&e.set("limit",String(t.limit)),this.request(`/templates${e.size>0?`?${e.toString()}`:""}`)}publishedSnapshots(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.q&&e.set("q",t.q),t.name&&e.set("name",t.name),t.version&&e.set("version",t.version),t.visibility&&e.set("visibility",t.visibility),t.tag&&e.set("tag",t.tag),t.useCase&&e.set("useCase",t.useCase),t.limit&&e.set("limit",String(t.limit)),this.request(`/published-snapshots${e.size>0?`?${e.toString()}`:""}`).then(n=>{let r=n.publishedSnapshots??n.templates;return{...n,templates:r,publishedSnapshots:r}})}launchTemplate(t){let e=new URLSearchParams;t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId);let{teamId:n,projectId:r,...o}=t;return this.request(`/templates/launch${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)})}runPublishedSnapshot(t){let e=new URLSearchParams;t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId);let{teamId:n,projectId:r,...o}=t;return this.request(`/published-snapshots/launch${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)}).then(s=>{let i=s.publishedSnapshot??s.template;return{...s,template:i,publishedSnapshot:i}})}listSchedules(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.sourceSandboxId&&e.set("sourceSandboxId",t.sourceSandboxId),this.request(`/schedules${e.size>0?`?${e.toString()}`:""}`)}createSchedule(t){let e=new URLSearchParams;t.projectId&&e.set("projectId",t.projectId);let{projectId:n,...r}=t;return this.request(`/schedules${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(r)})}getSchedule(t){return this.request(`/schedules/${encodeURIComponent(t)}`)}updateSchedule(t,e){return this.request(`/schedules/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)})}deleteSchedule(t){return this.request(`/schedules/${encodeURIComponent(t)}`,{method:"DELETE"})}listScheduleRuns(t,e={}){let n=new URLSearchParams;return e.limit!==void 0&&n.set("limit",String(e.limit)),this.request(`/schedules/${encodeURIComponent(t)}/runs${n.size>0?`?${n.toString()}`:""}`)}runScheduleNow(t,e={}){return this.request(`/schedules/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(e)})}listTemplateBuilds(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/sandbox-template-builds?${e.toString()}`).then(n=>n.builds)}createTemplateBuild(t){return this.requestApiRoot("/sandbox-template-builds",{method:"POST",body:JSON.stringify(t)}).then(e=>e.build)}getTemplateBuild(t){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(t)}`).then(e=>e.build)}getTemplateBuildLogs(t){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(t)}/logs`)}cancelTemplateBuild(t){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(t)}/cancel`,{method:"POST"}).then(e=>e.build)}listPublishedSnapshotBuilds(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/published-snapshot-builds?${e.toString()}`).then(n=>n.builds)}createPublishedSnapshotBuild(t){return this.requestApiRoot("/published-snapshot-builds",{method:"POST",body:JSON.stringify(t)}).then(e=>e.build)}getPublishedSnapshotBuild(t){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(t)}`).then(e=>e.build)}getPublishedSnapshotBuildLogs(t){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(t)}/logs`)}cancelPublishedSnapshotBuild(t){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(t)}/cancel`,{method:"POST"}).then(e=>e.build)}listOrganizations(){return this.requestApiRoot("/organizations").then(t=>t.organizations??t.teams??[])}createOrganization(t){return this.requestApiRoot("/organizations",{method:"POST",body:JSON.stringify(t)}).then(e=>e.organization)}getOrganization(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}`).then(e=>e.organization)}updateOrganization(t,e){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)}).then(n=>n.organization)}listOrganizationMembers(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/members`).then(e=>e.members)}upsertOrganizationMember(t,e){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/members`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.member)}getOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server`).then(e=>e.mcpServer)}generateOrganizationMcpServer(t,e={}){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.mcpServer)}rotateOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server/rotate`,{method:"POST"}).then(e=>e.mcpServer)}disableOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server/disable`,{method:"POST"}).then(e=>e.mcpServer)}enableOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server/enable`,{method:"POST"}).then(e=>e.mcpServer)}startReplay(t){let e=new URLSearchParams;t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId);let{teamId:n,projectId:r,...o}=t;return this.requestApiRoot(`/sandbox-replays${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)})}listReplays(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays${e.size>0?`?${e.toString()}`:""}`)}getReplay(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`)}getReplayLogs(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}/logs${n.size>0?`?${n.toString()}`:""}`)}getReplayArtifacts(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}/artifacts${n.size>0?`?${n.toString()}`:""}`)}cancelReplay(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}/cancel${n.size>0?`?${n.toString()}`:""}`,{method:"POST"})}integrationConnections(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),t.status&&e.set("status",t.status),this.requestApiRoot(`/integrations/connections${e.size>0?`?${e.toString()}`:""}`)}mcpServerConfig(){return{name:"openpond-sandboxes",transport:"streamable-http",url:`${this.sandboxApiUrl}/mcp`,headers:{"openpond-api-key":this.apiKey}}}smoke(t={}){return ln(this,t)}};function Y(t){return new xn(t)}d(Y,"createOpenPondSandboxClient");var Br=a.object({choices:a.array(a.object({message:a.object({content:a.string().nullable().optional(),tool_calls:a.array(a.object({id:a.string().min(1),type:a.literal("function"),function:a.object({name:a.string().min(1),arguments:a.string()})})).optional()})})).min(1)});var Nr=100*1024*1024;var Fr=Object.freeze({".avif":"image/avif",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".gif":"image/gif",".html":"text/html",".jpeg":"image/jpeg",".jpg":"image/jpeg",".json":"application/json",".m4a":"audio/mp4",".md":"text/markdown",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".pdf":"application/pdf",".png":"image/png",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".svg":"image/svg+xml",".tsv":"text/tab-separated-values",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".webp":"image/webp",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});function $(t){let e=t?.trim();return e?e.replace(/\/$/,""):null}d($,"normalizeOptionalUrl");function m(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}d(m,"asRecord");var et=["workspacePurpose","purpose"];function tt(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e={...t};for(let n of et)delete e[n];return e}d(tt,"sanitizeCreateMetadata");function vn(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e={...t};for(let r of et)delete e[r];let n=tt(e.metadata);return n?e.metadata=n:delete e.metadata,e}d(vn,"sanitizeSandboxRuntimeInput");function Z(t){let e=m(t);if(e.sandboxRuntime)throw new Error("Sandbox runtime settings must use /v1/runtimes before materializing a sandbox.");let n={};typeof e.repo=="string"&&e.repo.trim()&&(n.repo=e.repo.trim()),typeof e.teamId=="string"&&e.teamId.trim()&&(n.teamId=e.teamId.trim()),typeof e.projectId=="string"&&e.projectId.trim()&&(n.projectId=e.projectId.trim()),typeof e.agentId=="string"&&e.agentId.trim()&&(n.agentId=e.agentId.trim()),typeof e.command=="string"&&e.command.trim()&&(n.command=e.command.trim()),typeof e.runtimeProfileId=="string"&&e.runtimeProfileId.trim()&&(n.runtimeProfileId=e.runtimeProfileId.trim()),e.workloadSource&&typeof e.workloadSource=="object"&&!Array.isArray(e.workloadSource)&&(n.workloadSource=e.workloadSource),e.sourceArchive&&typeof e.sourceArchive=="object"&&!Array.isArray(e.sourceArchive)&&(n.sourceArchive=e.sourceArchive),(e.visibility==="private"||e.visibility==="team")&&(n.visibility=e.visibility),e.resources&&typeof e.resources=="object"&&!Array.isArray(e.resources)&&(n.resources=e.resources),e.budget&&typeof e.budget=="object"&&!Array.isArray(e.budget)&&(n.budget=e.budget),"env"in e&&(n.env=ve(e.env)),e.networkPolicy&&typeof e.networkPolicy=="object"&&!Array.isArray(e.networkPolicy)&&(n.networkPolicy=e.networkPolicy),e.quotas&&typeof e.quotas=="object"&&!Array.isArray(e.quotas)&&(n.quotas=e.quotas),Array.isArray(e.volumes)&&(n.volumes=e.volumes),"integrationLeases"in e&&(n.integrationLeases=ot(e.integrationLeases)),Array.isArray(e.integrationConnectionLeases)&&(n.integrationConnectionLeases=e.integrationConnectionLeases);let r=tt(e.metadata);return r&&(n.metadata=r),n}d(Z,"normalizeCreateInput");function be(t){let e=m(t),n=vn(e)??{},r={};return typeof n.teamId=="string"&&n.teamId.trim()&&(r.teamId=n.teamId.trim()),typeof n.projectId=="string"&&n.projectId.trim()&&(r.projectId=n.projectId.trim()),typeof n.agentId=="string"&&n.agentId.trim()&&(r.agentId=n.agentId.trim()),typeof n.workflowMode=="string"&&n.workflowMode.trim()?r.workflowMode=n.workflowMode.trim():typeof n.mode=="string"&&n.mode.trim()&&(r.workflowMode=n.mode.trim()),typeof n.baseBranch=="string"&&n.baseBranch.trim()&&(r.baseBranch=n.baseBranch.trim()),typeof n.baseSha=="string"&&n.baseSha.trim()&&(r.baseSha=n.baseSha.trim()),typeof n.sandboxId=="string"&&n.sandboxId.trim()&&(r.sandboxId=n.sandboxId.trim()),typeof n.rootfsSnapshotId=="string"&&n.rootfsSnapshotId.trim()&&(r.rootfsSnapshotId=n.rootfsSnapshotId.trim()),typeof n.dependencySnapshotId=="string"&&n.dependencySnapshotId.trim()&&(r.dependencySnapshotId=n.dependencySnapshotId.trim()),typeof n.runtimeProfileId=="string"&&n.runtimeProfileId.trim()&&(r.runtimeProfileId=n.runtimeProfileId.trim()),typeof n.promotionPolicy=="string"&&n.promotionPolicy.trim()&&(r.promotionPolicy=n.promotionPolicy.trim()),n.metadata&&typeof n.metadata=="object"&&!Array.isArray(n.metadata)&&(r.metadata=n.metadata),r}d(be,"normalizeSandboxRuntimeCreateInput");function Q(t){return Z(t)}d(Q,"normalizeSandboxRuntimeSandboxCreateInput");function nt(t){return m(t)}d(nt,"normalizeSnapshotCreateInput");function y(t){let e=m(t),n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",o=typeof e.agentId=="string"?e.agentId.trim():"";return{...n?{teamId:n}:{},...r?{projectId:r}:{},...o?{agentId:o}:{}}}d(y,"normalizeSandboxListInput");function rt(t){let e=m(t),n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",{teamId:o,projectId:s,appId:i,...u}=e,c=u;return n&&(c.teamId=n),r&&(c.projectId=r),c}d(rt,"normalizeReplayStartInput");function Ie(t){if(t==="active"||t==="revoked"||t==="error"||t==="all")return t}d(Ie,"normalizeIntegrationStatusFilter");function Se(t){let e=m(t),n=typeof e.connectionId=="string"?e.connectionId.trim():"";if(!n)throw new Error("Sandbox integration connection is required.");let r=st(e.capabilities);if(r.length===0)throw new Error("Sandbox integration capabilities are required.");at(e.provider,r);let o=it(e.scopes,"Sandbox integration scopes"),s=dt(e.expiresAt),i=En(e.ttlSeconds),u=ct(e.resourcePolicy);return{connectionId:n,capabilities:r,...o.length>0?{scopes:o}:{},...u?{resourcePolicy:u}:{},...s?{expiresAt:s}:{},...i!==void 0?{ttlSeconds:i}:{},...typeof e.required=="boolean"?{required:e.required}:{}}}d(Se,"normalizeIntegrationAttachInput");function ot(t){if(t==null)return[];if(!Array.isArray(t))throw new Error("Sandbox integration leases must be an array.");return t.map(e=>Rn(e))}d(ot,"normalizeIntegrationLeaseRefsForRuntime");function Rn(t){let e=m(t),n=typeof e.leaseId=="string"?e.leaseId.trim():"";if(!n)throw new Error("Sandbox integration leaseId is required.");if("connectionId"in e)throw new Error("Sandbox integration leases must use leaseId/proxy refs, not connection ids.");Pn(e);let r=Cn(e.provider),o=st(e.capabilities);if(o.length===0)throw new Error("Sandbox integration lease capabilities are required.");at(r,o);let s=it(e.scopes,"Sandbox integration lease scopes"),i=ct(e.resourcePolicy),u=dt(e.expiresAt),c=typeof e.proxyUrl=="string"?e.proxyUrl.trim():"";return{leaseId:n,provider:r,capabilities:o,...s.length>0?{scopes:s}:{},...i?{resourcePolicy:i}:{},...u?{expiresAt:u}:{},...c?{proxyUrl:c}:{},...typeof e.required=="boolean"?{required:e.required}:{}}}d(Rn,"normalizeIntegrationLeaseRefForRuntime");function Cn(t){if(typeof t!="string")throw new Error("Sandbox integration lease provider is required.");let e=se(t);if(!e)throw new Error(`Sandbox integration provider is not supported: ${t}`);if(!ae(e)?.leasePolicy.leaseable)throw new Error(`Sandbox integration provider is not leaseable: ${e}`);return e}d(Cn,"normalizeLeaseableIntegrationProvider");function Pn(t){for(let e of Object.keys(t))if(ut(e))throw new Error("Sandbox integration leases must not include secrets or credentials.")}d(Pn,"assertNoSensitiveIntegrationLeaseKeys");function at(t,e){if(t==null||t==="")return;if(typeof t!="string")throw new Error("Sandbox integration provider must be a string.");let n=se(t);if(!n)throw new Error(`Sandbox integration provider is not supported: ${t}`);let r=ae(n);if(!r?.leasePolicy.leaseable)throw new Error(`Sandbox integration provider is not leaseable: ${n}`);let o=new Set(r.leasePolicy.allowedCapabilityIds),s=e.filter(i=>!o.has(i));if(s.length>0)throw new Error(`Sandbox integration capabilities are not allowed for ${n}: ${s.join(", ")}`)}d(at,"validateIntegrationCapabilitiesForProvider");function we(t){let e=m(t),n=typeof e.leaseId=="string"?e.leaseId.trim():"";if(!n)throw new Error("Sandbox integration lease is required.");return n}d(we,"normalizeIntegrationLeaseId");function st(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e.trim():"").filter(Boolean):[]}d(st,"normalizeStringArray");function it(t,e){if(t==null)return[];if(!Array.isArray(t))throw new Error(`${e} must be an array of strings.`);return t.map(n=>{if(typeof n!="string")throw new Error(`${e} must contain only strings.`);let r=n.trim();if(!r)throw new Error(`${e} must not contain empty values.`);return r})}d(it,"normalizeOptionalStringArray");function En(t){if(t==null||t==="")return;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw new Error("Sandbox integration ttlSeconds must be a positive number.");return Math.max(1,Math.floor(e))}d(En,"normalizeIntegrationTtlSeconds");function dt(t){if(t==null||t==="")return;if(typeof t!="string")throw new Error("Sandbox integration expiresAt must be an ISO timestamp string.");let e=t.trim();if(!e)return;let n=Date.parse(e);if(!Number.isFinite(n))throw new Error("Sandbox integration expiresAt must be a valid ISO timestamp.");return e}d(dt,"normalizeIntegrationExpiresAt");function ct(t){if(t==null)return;if(typeof t!="object"||Array.isArray(t))throw new Error("Sandbox integration resourcePolicy must be an object.");if(ge(t,[]),JSON.stringify(t).length>16*1024)throw new Error("Sandbox integration resourcePolicy is too large.");return t}d(ct,"normalizeIntegrationResourcePolicy");function ge(t,e){if(!(!t||typeof t!="object")){if(e.length>8)throw new Error("Sandbox integration resourcePolicy is too deeply nested.");if(Array.isArray(t)){for(let n of t)ge(n,e);return}for(let[n,r]of Object.entries(t)){if(ut(n))throw new Error("Sandbox integration resourcePolicy must not include secrets or credentials.");ge(r,[...e,n])}}}d(ge,"assertNoSensitiveResourcePolicyKeys");function ut(t){let e=t.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("accesstoken")||e.includes("refreshtoken")||e.includes("idtoken")||e.includes("oauth")||e.includes("bearer")||e.includes("authorization")||e.includes("cookie")||e.includes("secret")||e.includes("password")||e.includes("credential")}d(ut,"isSensitivePolicyKey");function pt(t){let e=m(t),n=typeof e.command=="string"?e.command.trim():"";if(!n)throw new Error("Sandbox command is required.");let r=typeof e.timeoutSeconds=="number"&&Number.isFinite(e.timeoutSeconds)?Math.max(1,Math.floor(e.timeoutSeconds)):void 0,o=Ne(n);return r?{command:o,timeoutSeconds:r}:{command:o}}d(pt,"normalizeExecInput");function mt(t){let e=m(t),n=typeof e.command=="string"?e.command.trim():"";if(!n)throw new Error("Sandbox process command is required.");let r=typeof e.timeoutSeconds=="number"&&Number.isFinite(e.timeoutSeconds)?Math.max(1,Math.floor(e.timeoutSeconds)):void 0;return r?{command:n,timeoutSeconds:r}:{command:n}}d(mt,"normalizeProcessStartInput");function lt(t){let e=m(t),n=Number(e.since);return Number.isFinite(n)?{since:Math.max(0,Math.floor(n))}:{}}d(lt,"normalizeProcessCursorInput");function ht(t){let e=m(t),n=typeof e.port=="number"?e.port:Number(e.port);if(!Number.isInteger(n)||n<re||n>oe)throw new Error(`Sandbox preview port must be between ${re} and ${oe}.`);let r=typeof e.label=="string"&&e.label.trim()?e.label.trim():void 0,o=e.access==="public"||e.access==="private"?e.access:void 0,s=e.autoStart===!0,i=typeof e.customDomain=="string"&&e.customDomain.trim()?e.customDomain.trim():void 0,u={port:n,...r?{label:r}:{},...o?{access:o}:{},...s?{autoStart:s}:{},...i?{customDomain:i}:{}};return e.cors&&typeof e.cors=="object"&&!Array.isArray(e.cors)&&(u.cors=e.cors),e.headerPolicy&&typeof e.headerPolicy=="object"&&!Array.isArray(e.headerPolicy)&&(u.headerPolicy=e.headerPolicy),e.authPolicy&&typeof e.authPolicy=="object"&&!Array.isArray(e.authPolicy)&&(u.authPolicy=e.authPolicy),u}d(ht,"normalizeOpenPortInput");function ft(t){let e=m(t),n={};if(e.template&&typeof e.template=="object"&&!Array.isArray(e.template)){let r=m(e.template),o={};typeof r.description=="string"?o.description=r.description.trim():r.description===null&&(o.description=null),Array.isArray(r.tags)&&(o.tags=r.tags.map(s=>typeof s=="string"?s.trim():"").filter(Boolean).slice(0,20)),(r.visibility==="private"||r.visibility==="team")&&(o.visibility=r.visibility),typeof r.useCase=="string"?o.useCase=r.useCase.trim():r.useCase===null&&(o.useCase=null),Object.keys(o).length>0&&(n.template=o)}if(e.retention&&typeof e.retention=="object"&&!Array.isArray(e.retention)){let r=m(e.retention),o={};(r.class==="ephemeral"||r.class==="cached"||r.class==="pinned")&&(o.class=r.class),r.ttlSeconds===null?o.ttlSeconds=null:typeof r.ttlSeconds=="number"&&Number.isFinite(r.ttlSeconds)&&(o.ttlSeconds=Math.max(1,Math.floor(r.ttlSeconds))),Object.keys(o).length>0&&(n.retention=o)}if(!n.template&&!n.retention)throw new Error("Snapshot update requires template or retention changes.");return n}d(ft,"normalizeSnapshotUpdateInput");function yt(t){let e=m(t),n=typeof e.cleanup=="string"?e.cleanup.trim():"";return n==="delete"||n==="stop"||n==="archive"?{cleanup:n}:{}}d(yt,"normalizeSnapshotValidateInput");function xe(t){let e=m(t),n={};return typeof e.snapshotId=="string"&&e.snapshotId.trim()&&(n.snapshotId=e.snapshotId.trim()),(e.visibility==="private"||e.visibility==="team")&&(n.visibility=e.visibility),e.resources&&typeof e.resources=="object"&&!Array.isArray(e.resources)&&(n.resources=e.resources),e.budget&&typeof e.budget=="object"&&!Array.isArray(e.budget)&&(n.budget=e.budget),e.networkPolicy&&typeof e.networkPolicy=="object"&&!Array.isArray(e.networkPolicy)&&(n.networkPolicy=e.networkPolicy),e.quotas&&typeof e.quotas=="object"&&!Array.isArray(e.quotas)&&(n.quotas=e.quotas),Array.isArray(e.volumes)&&(n.volumes=e.volumes),"integrationLeases"in e&&(n.integrationLeases=ot(e.integrationLeases)),"env"in e&&(n.env=ve(e.env)),e.metadata&&typeof e.metadata=="object"&&!Array.isArray(e.metadata)&&(n.metadata=e.metadata),n}d(xe,"normalizeForkInput");function ve(t){if(t==null)return[];if(!Array.isArray(t))throw new Error("Sandbox env must be an array.");return t.map(e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Sandbox env entries must be objects.");let n=e;if("value"in n)throw new Error("Sandbox env entries must use secretRef, not inline values.");let r=typeof n.name=="string"?n.name.trim():"",o=typeof n.secretRef=="string"?n.secretRef.trim():"";if(!r||!o)throw new Error("Sandbox env entries require name and secretRef.");return{name:r,secretRef:o}})}d(ve,"normalizeSandboxEnvRefsForApp");function gt(t){let e=m(t),n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",o=typeof e.snapshotId=="string"?e.snapshotId.trim():"",s=typeof e.templateName=="string"?e.templateName.trim():"",i=typeof e.version=="string"?e.version.trim():"",u=typeof e.useCase=="string"?e.useCase.trim():"";if(!o&&!s&&!u)throw new Error("Sandbox template launch requires snapshotId, templateName, or useCase.");return{...xe(t),...n?{teamId:n}:{},...r?{projectId:r}:{},...o?{snapshotId:o}:{},...s?{templateName:s}:{},...i?{version:i}:{},...u?{useCase:u}:{}}}d(gt,"normalizeTemplateLaunchInput");function bt(t){let e=m(t),n=typeof e.path=="string"?e.path.trim():"",r=Number(e.maxEntries);return{...n?{path:n}:{},...typeof e.recursive=="boolean"?{recursive:e.recursive}:{},...Number.isFinite(r)?{maxEntries:r}:{}}}d(bt,"normalizeListFilesInput");function It(t){let e=m(t),n=typeof e.query=="string"?e.query.trim():"";if(!n)throw new Error("Sandbox file search query is required.");let r=typeof e.path=="string"?e.path.trim():"",o=Number(e.maxResults);return{query:n,...r?{path:r}:{},...Number.isFinite(o)?{maxResults:o}:{}}}d(It,"normalizeSearchFilesInput");function D(t){let e=m(t),n=typeof e.path=="string"?e.path.trim():"";if(!n)throw new Error("Sandbox file path is required.");return{path:n,recursive:typeof e.recursive=="boolean"?e.recursive:void 0}}d(D,"normalizeDeleteFileInput");function St(t){let e=D(t),n=m(t),r=Number(n.offsetBytes),o=Number(n.maxBytes);return{path:e.path,...Number.isFinite(r)?{offsetBytes:r}:{},...Number.isFinite(o)?{maxBytes:o}:{}}}d(St,"normalizeDownloadFileInput");function wt(t){let e=m(t),n=typeof e.path=="string"?e.path.trim():"",r=typeof e.contents=="string"?e.contents:"",o=typeof e.contentsBase64=="string"?e.contentsBase64.trim():"";if(!n)throw new Error("Sandbox file path is required.");if(!r&&!o)throw new Error("Sandbox file contents are required.");return{path:n,contents:r,contentsBase64:o}}d(wt,"normalizeUploadFileInput");function xt(t){let e=m(t),n=typeof e.fromPath=="string"?e.fromPath.trim():"",r=typeof e.toPath=="string"?e.toPath.trim():"";if(!n||!r)throw new Error("Sandbox file source and target paths are required.");return{fromPath:n,toPath:r,overwrite:typeof e.overwrite=="boolean"?e.overwrite:void 0}}d(xt,"normalizeMoveFileInput");function vt(t){let e=m(t),n=typeof e.branch=="string"?e.branch.trim():"",r=typeof e.startPoint=="string"?e.startPoint.trim():"";if(!n)throw new Error("Sandbox git branch name is required.");return{branch:n,create:e.create===!0,...r?{startPoint:r}:{}}}d(vt,"normalizeGitBranchInput");function Rt(t){let e=m(t),n=typeof e.message=="string"?e.message.trim():"",r=e.all===!0,o=Array.isArray(e.paths)?e.paths.filter(s=>typeof s=="string"&&s.trim()!==""):[];if(!n)throw new Error("Sandbox git commit message is required.");if(!r&&o.length===0)throw new Error("Sandbox git commit requires all=true or at least one path.");return{message:n,...r?{all:!0}:{paths:o.map(s=>s.trim())}}}d(Rt,"normalizeGitCommitInput");function Ct(t){let e=m(t),n=typeof e.remote=="string"?e.remote.trim():"",r=typeof e.branch=="string"?e.branch.trim():"",o=e.rebase===!0,s=typeof e.ffOnly=="boolean"?e.ffOnly:void 0;if(o&&s)throw new Error("Sandbox git pull cannot use rebase and ff-only together.");return{...n?{remote:n}:{},...r?{branch:r}:{},...o?{rebase:o}:{},...typeof s=="boolean"?{ffOnly:s}:{}}}d(Ct,"normalizeGitPullInput");function Pt(t){let e=m(t),n=typeof e.remote=="string"?e.remote.trim():"",r=typeof e.branch=="string"?e.branch.trim():"";return{...n?{remote:n}:{},...r?{branch:r}:{},...e.setUpstream===!0?{setUpstream:!0}:{},...e.forceWithLease===!0?{forceWithLease:!0}:{}}}d(Pt,"normalizeGitPushInput");async function ro(){return(await te()).client}d(ro,"resolveOpenPondSandboxClient");var An="https://api.openpond.ai";async function oo(t){let{client:e,context:n,apiKey:r,sandboxApiUrl:o}=await te(),s=zn(n,o);if(t.type==="list")return{sandboxes:await e.list(y(t.payload)),account:s};if(t.type==="snapshot_catalog"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.agentId=="string"?i.agentId.trim():"",b=typeof i.q=="string"?i.q.trim():"",l=typeof i.tag=="string"?i.tag.trim():"",g=typeof i.useCase=="string"?i.useCase.trim():"",P=i.replayState==="draft"||i.replayState==="validated"||i.replayState==="published"?i.replayState:void 0;return{...await e.snapshotCatalog({...u?{teamId:u}:{},...c?{projectId:c}:{},...p?{agentId:p}:{},...b?{q:b}:{},...l?{tag:l}:{},...g?{useCase:g}:{},...P?{replayState:P}:{}}),account:s}}if(t.type==="snapshot_create")return{...await e.createSnapshot(t.sandboxId,nt(t.payload)),account:s};if(t.type==="template_catalog"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.q=="string"?i.q.trim():"",b=typeof i.name=="string"?i.name.trim():"",l=typeof i.version=="string"?i.version.trim():"",g=typeof i.tag=="string"?i.tag.trim():"",P=typeof i.useCase=="string"?i.useCase.trim():"";return{...await e.templates({...u?{teamId:u}:{},...c?{projectId:c}:{},...p?{q:p}:{},...b?{name:b}:{},...l?{version:l}:{},...g?{tag:g}:{},...P?{useCase:P}:{}}),account:s}}if(t.type==="integration_connections"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.agentId=="string"?i.agentId.trim():"",b=Ie(i.status),l={...c?{projectId:c}:{},...p?{agentId:p}:{},status:b??"all"};return{...u?await e.integrationConnections({teamId:u,...l}):await Re(e,l),account:s}}if(t.type==="connected_app_status"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.agentId=="string"?i.agentId.trim():"",b=Ie(i.status)??"all",l={...c?{projectId:c}:{},...p?{agentId:p}:{},status:b},g=u?await e.integrationConnections({teamId:u,...l}):await Re(e,l);return{teamId:g.teamId,apps:Pe({connections:g.connections}),account:s}}if(t.type==="sandbox_runtime_list")return{runtimes:await e.listSandboxRuntimes(y(t.payload)),account:s};if(t.type==="sandbox_runtime_get")return{runtime:await e.getSandboxRuntime(t.runtimeId),account:s};if(t.type==="sandbox_runtime_create")return{runtime:await e.createSandboxRuntime(be(t.payload)),account:s};if(t.type==="sandbox_runtime_sandbox_create")return{...await e.createSandboxRuntimeSandbox(t.runtimeId,Q(t.payload),{respondAsync:!0}),account:s};if(t.type==="sandbox_runtime_resume"){let i=await e.sandboxRuntime(t.runtimeId).resume(Q(t.payload),{respondAsync:!0});return{runtime:await e.getSandboxRuntime(t.runtimeId),sandbox:i,account:s}}if(t.type==="sandbox_runtime_preserve_source"){let i=m(t.payload);return{...await e.preserveSandboxRuntimeSource(t.runtimeId,{...typeof i.sandboxId=="string"&&i.sandboxId.trim()?{sandboxId:i.sandboxId.trim()}:{},...typeof i.message=="string"&&i.message.trim()?{message:i.message.trim()}:{},...i.source==="profile"?{source:"profile"}:{}},y(t.payload)),account:s}}if(t.type==="sandbox_runtime_promote"){let i=m(t.payload);return{...await e.promoteSandboxRuntime(t.runtimeId,{expectedTargetSha:typeof i.expectedTargetSha=="string"?i.expectedTargetSha.trim():"",...i.validationState==="pending"||i.validationState==="passed"?{validationState:i.validationState}:{},...typeof i.summary=="string"&&i.summary.trim()?{summary:i.summary.trim()}:{}},y(t.payload)),account:s}}if(t.type==="project_list")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/projects",y(t.payload))}),account:s};if(t.type==="profile_get")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/profile",y(t.payload))}),account:s};if(t.type==="profile_ensure")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/profile/ensure",y(t.payload)),method:"POST"}),account:s};if(t.type==="profile_push"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/profile/push",y(i)),method:"POST",body:c}),account:s}}if(t.type==="project_upsert")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/projects",y(t.payload)),method:"POST",body:m(t.payload)}),account:s};if(t.type==="project_get")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}`,y(t.payload))}),account:s};if(t.type==="project_workspace")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/workspace`,y(t.payload))}),account:s};if(t.type==="project_git")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/git`,y(t.payload)),method:"POST"}),account:s};if(t.type==="project_sync")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/sync`,y(t.payload)),method:"POST"}),account:s};if(t.type==="project_source_upload"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/source`,y(i)),method:"POST",body:c}),account:s}}if(t.type==="project_archive")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}`,y(t.payload)),method:"DELETE"}),account:s};if(t.type==="agent_list")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/agents",y(t.payload))}),account:s};if(t.type==="agent_upsert")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/agents",y(t.payload)),method:"POST",body:m(t.payload)}),account:s};if(t.type==="agent_run")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/run`,y(t.payload)),method:"POST",body:m(t.payload)}),account:s};if(t.type==="agent_source_deploy_plan")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/source/deploy-plan`,y(t.payload))}),account:s};if(t.type==="agent_source_checks"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/source/checks`,y(i)),method:"POST",body:c,timeoutMs:900*1e3}),account:s}}if(t.type==="agent_source_publish"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/source/publish`,y(i)),method:"POST",body:c}),account:s}}if(t.type==="create")return{sandbox:await e.create(Z(t.payload)),account:s};if(t.type==="get")return{sandbox:await e.get(t.sandboxId),account:s};if(t.type==="start")return{...await e.start(t.sandboxId,{respondAsync:!0}),account:s};if(t.type==="delete"){let i=await Et(e,t.sandboxId,{failOnUnpreservedChanges:t.failOnUnpreservedChanges}),u=await e.delete(t.sandboxId,i).catch(c=>kt("delete",e,t.sandboxId,c));return At("delete",u),{sandbox:u,account:s}}if(t.type==="exec")return{...await e.exec(t.sandboxId,pt(t.payload)),account:s};if(t.type==="action_run")return{...await Tn({apiKey:r,sandboxApiUrl:o,path:`/sandboxes/${encodeURIComponent(t.sandboxId)}/actions/${encodeURIComponent(t.actionName)}/run`,method:"POST",body:m(t.payload)}),account:s};if(t.type==="open_port")return{...await e.openPort(t.sandboxId,ht(t.payload)),account:s};if(t.type==="snapshot_update")return{...await e.updateSnapshot(t.sandboxId,t.snapshotId,ft(t.payload)),account:s};if(t.type==="snapshot_validate")return{...await e.validateSnapshot(t.sandboxId,t.snapshotId,yt(t.payload)),account:s};if(t.type==="snapshot_publish")return{...await e.publishSnapshot(t.sandboxId,t.snapshotId),account:s};if(t.type==="replays")return{...await e.listReplays(y(t.payload)),account:s};if(t.type==="replay_start")return{...await e.startReplay(rt(t.payload)),account:s};if(t.type==="replay_get")return{...await e.getReplay(t.replayId,y(t.payload)),account:s};if(t.type==="replay_logs")return{...await e.getReplayLogs(t.replayId,y(t.payload)),account:s};if(t.type==="replay_artifacts")return{...await e.getReplayArtifacts(t.replayId,y(t.payload)),account:s};if(t.type==="replay_cancel")return{...await e.cancelReplay(t.replayId,y(t.payload)),account:s};if(t.type==="schedule_create")return{...await e.createSchedule(m(t.payload)),account:s};if(t.type==="template_launch")return{...await e.launchTemplate(gt(t.payload)),account:s};if(t.type==="fork")return{...await e.fork(t.sandboxId,xe(t.payload)),account:s};if(t.type==="stop"){let i=await Et(e,t.sandboxId,{failOnUnpreservedChanges:t.failOnUnpreservedChanges}),u=await e.stop(t.sandboxId,i).catch(c=>kt("stop",e,t.sandboxId,c));return At("stop",u.sandbox),{...u,account:s}}if(t.type==="receipts")return{receipts:await e.receipts(t.sandboxId),account:s};if(t.type==="logs")return{logs:await e.logs(t.sandboxId),account:s};if(t.type==="integration_leases")return{...await e.integrationLeases(t.sandboxId),account:s};if(t.type==="integration_attach")return{...await e.attachIntegrationConnection(t.sandboxId,Se(t.payload)),account:s};if(t.type==="integration_remove")return{...await e.removeIntegrationLease(t.sandboxId,we(t.payload)),account:s};if(t.type==="process_start")return{...await e.startProcess(t.sandboxId,mt(t.payload)),account:s};if(t.type==="process_get")return{...await e.getProcess(t.sandboxId,t.processId,lt(t.payload)),account:s};if(t.type==="upload_file"){let i=wt(t.payload);return{...i.contentsBase64?await e.uploadFileBase64(t.sandboxId,i.path,i.contentsBase64):await e.uploadFile(t.sandboxId,i.path,i.contents),account:s}}if(t.type==="download_file"){let i=St(t.payload);return{...await e.downloadFileResponse(t.sandboxId,i),account:s}}if(t.type==="list_files")return{...await e.listFiles(t.sandboxId,bt(t.payload)),account:s};if(t.type==="search_files")return{...await e.searchFiles(t.sandboxId,It(t.payload)),account:s};if(t.type==="delete_file"){let i=D(t.payload);return{...await e.deleteFile(t.sandboxId,i.path,{recursive:i.recursive}),account:s}}if(t.type==="stat_file"){let i=D(t.payload);return{...await e.statFile(t.sandboxId,i.path),account:s}}if(t.type==="mkdir"){let i=D(t.payload);return{...await e.mkdir(t.sandboxId,{path:i.path,recursive:i.recursive}),account:s}}if(t.type==="move_file"){let i=xt(t.payload);return{...await e.moveFile(t.sandboxId,i),account:s}}if(t.type==="git_status")return{...await e.gitStatus(t.sandboxId),account:s};if(t.type==="git_diff"){let i=m(t.payload),u=typeof i.baseRef=="string"?i.baseRef.trim():"";return{...await e.gitDiff(t.sandboxId,{...u?{baseRef:u}:{}}),account:s}}if(t.type==="git_export_patch"){let i=m(t.payload),u=typeof i.baseRef=="string"?i.baseRef.trim():"";return{...await e.gitExportPatch(t.sandboxId,{...u?{baseRef:u}:{}}),account:s}}if(t.type==="git_branch")return{...await e.gitBranch(t.sandboxId,vt(t.payload)),account:s};if(t.type==="git_commit")return{...await e.gitCommit(t.sandboxId,Rt(t.payload)),account:s};if(t.type==="git_pull")return{...await e.gitPull(t.sandboxId,Ct(t.payload)),account:s};if(t.type==="git_push")return{...await e.gitPush(t.sandboxId,Pt(t.payload)),account:s};throw new Error(`Unsupported sandbox action: ${t.type}`)}d(oo,"sandboxRequestPayload");async function ao(t={}){let{client:e}=await te();return t.teamId?e.integrationConnections(t):Re(e,{...t.projectId?{projectId:t.projectId}:{},...t.agentId?{agentId:t.agentId}:{},status:t.status??"all"})}d(ao,"listSandboxIntegrationConnections");async function Et(t,e,n={}){let r=await t.get(e).then(o=>!Ut(o)).catch(()=>!0);return{failOnUnpreservedChanges:n.failOnUnpreservedChanges,...r?{respondAsync:!0}:{}}}d(Et,"sandboxLifecycleRequestOptions");function Ut(t){return t.reservation.status==="reserved"&&(t.state==="creating"||qt.has(t.state))}d(Ut,"sandboxLifecycleRequiresSynchronousAccounting");function At(t,e){if(qt.has(e.state)&&e.reservation.status==="reserved")throw new Error(`Sandbox ${t} reached ${e.state}, but reservation ${e.reservation.id} is still reserved. Cleanup accounting has not settled; retry status before treating cleanup as complete.`)}d(At,"assertTerminalSandboxLifecycleSettled");async function kt(t,e,n,r){let o=await e.get(n).catch(()=>null);if(o&&Ut(o)){let s=r instanceof Error?r.message:String(r);throw new Error(`Sandbox ${t} failed while sandbox ${n} is still creating with active reservation ${o.reservation.id}. Cleanup accounting has not settled; retry status before treating cleanup as complete. Original error: ${s}`)}throw r instanceof Error?r:new Error(String(r))}d(kt,"throwSandboxLifecycleRequestFailure");var qt=new Set(["stopped","archived","deleted","error"]);async function Re(t,e){let n=await t.listOrganizations().catch(()=>{throw new Error("Connected app status is unavailable because organizations could not be loaded.")}),r=$n(n),o=On(n)||null;if(r.length===0)return{teamId:o,connections:[]};let s=await Promise.all(r.map(u=>t.integrationConnections({teamId:u,...e.projectId?{projectId:e.projectId}:{},...e.agentId?{agentId:e.agentId}:{},status:e.status}).catch(()=>null))),i=qn(s);return{teamId:kn(i)??o??i.find(u=>u.teamId.trim())?.teamId.trim()??null,connections:Un(i)}}d(Re,"resolveImplicitConnectedAppStatusConnections");function kn(t){for(let e of t){if((e.connections?.length??0)===0)continue;let n=e.teamId?.trim();if(n)return n}return null}d(kn,"connectedAppStatusTeamIdWithConnections");function Un(t){let e=[],n=new Set;for(let r of t)for(let o of r.connections??[]){let s=o.id.trim()||[o.teamId,o.provider,o.providerAccountId].join(":");n.has(s)||(n.add(s),e.push(o))}return e}d(Un,"mergeConnectedAppStatusConnectionResults");function qn(t){let e=t.filter(o=>o!==null),n=t.length-e.length,r=e.reduce((o,s)=>o+(s.connections?.length??0),0);if(n>0&&r===0)throw new Error("Connected app status is unavailable because one or more team integration connection lookups could not be loaded.");return e}d(qn,"successfulConnectedAppStatusConnectionResults");function On(t){let e=t.filter(n=>Ot(n)==="active");return ee(e.find(n=>n.role==="owner"))??ee(e.find(n=>n.role==="admin"))??ee(e[0])??""}d(On,"selectImplicitConnectedAppStatusTeamId");function $n(t){let e=[],n=new Set;for(let r of t){if(Ot(r)!=="active")continue;let o=ee(r);!o||n.has(o)||(n.add(o),e.push(o))}return e}d($n,"implicitConnectedAppStatusTeamIds");function ee(t){if(!t)return null;let e=t.id;return(typeof t.teamId=="string"?t.teamId:typeof e=="string"?e:"").trim()||null}d(ee,"organizationTeamId");function Ot(t){return typeof t.status=="string"?t.status:"active"}d(Ot,"organizationStatus");async function te(){let t=$(process.env.OPENPOND_SANDBOX_API_URL),e=process.env.OPENPOND_SANDBOX_API_KEY?.trim();if(e&&t)return{client:Y({apiKey:e,sandboxApiUrl:t}),context:await ue().catch(()=>null),apiKey:e,sandboxApiUrl:O(t,{apiBaseUrl:t})};let n=await ue(),r=n.token?.trim();if(!r)throw new Error("OpenPond account API key is required to manage sandboxes.");if(t)return{client:Y({apiKey:r,sandboxApiUrl:t}),context:n,apiKey:r,sandboxApiUrl:O(t,{apiBaseUrl:t})};let o=Ln(n);return{client:Y({apiKey:r,baseUrl:o}),context:n,apiKey:r,sandboxApiUrl:O(o,{apiBaseUrl:o})}}d(te,"resolveSandboxClient");function jn(t){return O(t,{apiBaseUrl:t}).replace(/\/sandboxes\/?$/,"")}d(jn,"sandboxApiRootUrl");function _n(t){let e=O(t,{apiBaseUrl:t});return/\/api\/sandboxes\/?$/.test(e)?e.replace(/\/api\/sandboxes\/?$/,"/v1"):e.replace(/\/sandboxes\/?$/,"")}d(_n,"sandboxPublicApiRootUrl");function v(t,e){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),e.agentId&&n.set("agentId",e.agentId),`${t}${n.size>0?`?${n.toString()}`:""}`}d(v,"sandboxScopedCollectionPath");async function Tn(t){let e=await z(jn(t.sandboxApiUrl),t.apiKey,t.path,{method:t.method??"GET",...t.body?{body:JSON.stringify(t.body)}:{}}),n=await e.json().catch(()=>({}));if(!e.ok){let r=typeof n.error=="string"?n.error:`Sandbox API request failed with status ${e.status}`;throw new Error(r)}return n}d(Tn,"requestSandboxApiRoot");async function w(t){let e=await z(_n(t.sandboxApiUrl),t.apiKey,t.path,{method:t.method??"GET",signal:t.signal,headers:{...t.idempotencyKey?{"idempotency-key":t.idempotencyKey}:{},...t.teamId?{"X-OpenPond-Team-Id":t.teamId}:{}},...t.body?{body:JSON.stringify(t.body)}:{},...t.timeoutMs!==void 0?{timeoutMs:t.timeoutMs}:{}}),n=await e.json().catch(()=>({}));if(!e.ok){let r=typeof n.error=="string"?n.error:`Sandbox API request failed with status ${e.status}`;throw new Error(r)}return n}d(w,"requestSandboxPublicApiRoot");async function so(t){let{apiKey:e,sandboxApiUrl:n}=await te();return w({apiKey:e,sandboxApiUrl:n,...t})}d(so,"requestOpenPondPublicApi");function zn(t,e){if(!t)return{label:"Sandbox API",handle:null,baseUrl:null,sandboxApiUrl:e,state:"signed_out"};let n=t.accountState;return{label:n.label,handle:n.activeProfile?.handle??t.account?.handle??null,baseUrl:n.baseUrl??t.account?.baseUrl??null,sandboxApiUrl:e,state:n.state}}d(zn,"sandboxAccountSummary");function Ln(t){return $(process.env.OPENPOND_SANDBOX_BASE_URL)??$(process.env.OPENPOND_API_URL)??$(t.apiBaseUrl)??$(t.account?.baseUrl)??$(t.config.baseUrl)??An}d(Ln,"resolveSandboxBaseUrl");export{ir as a,Pr as b,Xe as c,nn as d,rn as e,$r as f,on as g,jr as h,jt as i,ro as j,oo as k,ao as l,so as m};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a
|
|
2
|
+
import{a as b,c as p,d as S,e as _,f as O,g as x}from"./chunk-PNPV2LDE.js";import{Ab as y,Cb as f,Db as w,Eb as c,Fb as R,Gb as q,M as m,mb as g,wb as L}from"./chunk-4PUOWSDE.js";import{v as h}from"./chunk-ZY32SZ2P.js";import{a}from"./chunk-TBODQT4W.js";import{A as i}from"./chunk-X2J2P5ZT.js";import{a as l}from"./chunk-FTQLQJQV.js";var C=i.object({batchId:i.string().trim().min(1).max(500),modelProjectId:i.string().trim().min(1).max(500)}).strict(),k=i.object({batchId:i.string().min(1),projectId:i.string().min(1),tasksetId:i.string().min(1),releaseId:i.string().min(1),revision:i.number().int().positive(),contentHash:i.string().regex(/^[a-f0-9]{64}$/)}).strict(),P=class{static{l(this,"OpenPondLearningClient")}#e;constructor(e){if(!e.apiKey.trim()||!e.scope.trim())throw new Error("Learning API key and scope are required.");let t=new URL(e.baseUrl);if(!["http:","https:"].includes(t.protocol)||t.username||t.password||t.search||t.hash)throw new Error("Learning base URL must be an HTTP(S) endpoint without credentials, query, or fragment.");this.#e={...e,baseUrl:t.toString().replace(/\/+$/,"")}}async command(e,t={}){f(e);let s=w.parse({scope:this.#e.scope,command:e}),n=q.parse(await this.#t("commands",s,t));if(n.operationId!==e.operationId)throw new a(502,"operation_identity_mismatch","Learning response did not match the submitted operation.",null);return n}submitExample(e,t={}){return this.command({action:"submit_example",operationId:e.idempotencyKey,example:e},t)}submitFeedback(e,t={}){return this.command({action:"submit_feedback",operationId:e.idempotencyKey,feedback:e},t)}async get(e,t,s,n={}){let r=c.parse({action:"get",scope:this.#e.scope,kind:e,id:t,...s===void 0?{}:{revision:s}});return g[e].parse(await this.#t("read",r,n))}async inspectEvidence(e,t={}){let s=c.parse({action:"inspect_evidence",scope:this.#e.scope,evidence:e}),n=R.parse(await this.#t("read",s,t));if(!m(n.evidence,e))throw new a(502,"evidence_identity_mismatch","Inspection did not match the requested evidence release.",null);return n}async inspectTaskQueue(e=null,t={}){let s=c.parse({action:"inspect_task_queue",scope:this.#e.scope,modelProjectId:e}),n=y.parse(await this.#t("read",s,t));if(n.modelProjectId!==e)throw new a(502,"model_identity_mismatch","Task queue did not match the requested Model.",null);return n}async inspectPolicy(e,t={}){let s=c.parse({action:"inspect_policy",scope:this.#e.scope,policy:e}),n=L.parse(await this.#t("read",s,t));if(!m(n.policy,e))throw new a(502,"policy_identity_mismatch","Inspection did not match the requested policy release.",null);return n}async createSourceCredential(e,t={}){let s=p.parse({...e,action:"create",scope:this.#e.scope}),n=S.parse(await this.#t("credentials",s,t));if(this.#n(n.credential,e.sourceId),n.apiKey!==e.apiKey||!e.apiKey.startsWith(`${n.credential.keyPrefix}_`))throw new a(502,"credential_identity_mismatch","Credential response did not match the prepared credential.",null);return n}async listSourceCredentials(e,t={},s={}){let n=p.parse({...t,action:"list",scope:this.#e.scope,sourceId:e}),r=_.parse(await this.#t("credentials",n,s));if(r.items.length>(t.limit??30))throw new a(502,"credential_page_invalid","Credential response exceeded the requested page size.",null);for(let o of r.items)this.#n(o,e);return r}async revokeSourceCredential(e,t,s={}){let n=p.parse({action:"revoke",scope:this.#e.scope,sourceId:e,id:t}),r=b.parse(await this.#t("credentials",n,s));if(this.#n(r,e),r.id!==t||r.revokedAt===null)throw new a(502,"credential_revocation_mismatch","Credential revocation did not match the requested credential.",null);return r}async sourceConfiguration(e,t={}){let s=O.parse({scope:this.#e.scope,sourceId:e}),n=x.parse(await this.#t("source-config",s,t));if(n.scope!==this.#e.scope||n.source.id!==e)throw new a(502,"source_identity_mismatch","Source configuration did not match the requested source.",null);return n}#n(e,t){if(e.scope!==this.#e.scope||e.sourceId!==t)throw new a(502,"credential_scope_mismatch","Credential response did not match the requested source.",null)}async list(e,t={},s={}){let n=c.parse({action:"list",scope:this.#e.scope,kind:e,...t});return i.object({items:i.array(g[e]).max(100),nextCursor:i.string().nullable()}).strict().parse(await this.#t("read",n,s))}async publishBatch(e,t={}){let s=C.parse(e),n=k.parse(await this.#t("publish-batch",{...s,scope:this.#e.scope},t));if(n.batchId!==s.batchId)throw new a(502,"batch_identity_mismatch","Published batch response did not match the requested batch.",null);return n}async#t(e,t,s){h(t,16777216);let n=await(this.#e.fetch??globalThis.fetch)(`${this.#e.baseUrl}/v1/learning/${e}`,{method:"POST",headers:{Authorization:`Bearer ${this.#e.apiKey}`,"Content-Type":"application/json",Accept:"application/json","X-OpenPond-Team-Id":this.#e.scope},body:JSON.stringify(t),signal:s.signal,redirect:"error"}),r=await I(n);if(!n.ok){let o=i.object({code:i.string().optional(),error:i.string().optional()}).passthrough().safeParse(r);throw new a(n.status,o.success?o.data.code??"learning_request_failed":"learning_request_failed",o.success?o.data.error??`Learning request failed (${n.status}).`:`Learning request failed (${n.status}).`,r)}return r}};async function I(u){let t=u.body?.getReader();if(!t)throw new a(u.status,"empty_response","Learning response was empty.",null);let s=new TextDecoder,n=0,r="";try{for(;;){let d=await t.read();if(d.done)break;if(n+=d.value.byteLength,n>16777216)throw new a(u.status,"response_too_large","Learning response exceeded 16 MiB; request a smaller page.",null);r+=s.decode(d.value,{stream:!0})}r+=s.decode();let o=JSON.parse(r);return h(o,16777216),o}finally{await t.cancel(),t.releaseLock()}}l(I,"readBoundedLearningResponse");export{C as a,P as b,I as c};
|