openpond 0.2.58 → 0.2.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/app-server.d.ts +8 -1
- package/dist/app-server.js +1 -1
- package/dist/chunks/acp-ARBNMIPT.js +2 -0
- package/dist/chunks/acp-agent-53COYDHB.js +21 -0
- package/dist/chunks/{actions-command-QU4H53OG.js → actions-command-6YSZ7EJS.js} +1 -1
- package/dist/chunks/{app-layer-NSTE5HIT.js → app-layer-TVG7KTW6.js} +1 -1
- package/dist/chunks/{app-server-connected-apps-JHGWLBXT.js → app-server-connected-apps-K62M6LCT.js} +1 -1
- package/dist/chunks/{app-server-evaluations-K52NAQLP.js → app-server-evaluations-RM6WXX3H.js} +1 -1
- package/dist/chunks/app-server-harness-services-RLKMWOQ4.js +2 -0
- package/dist/chunks/app-server-runtime-OKMEHNEU.js +2 -0
- package/dist/chunks/apps-YWZL2H34.js +2 -0
- package/dist/chunks/{chunk-DARVPBZ4.js → chunk-23P2O7PH.js} +1 -1
- package/dist/chunks/{chunk-PF5R6CMP.js → chunk-2GICDASL.js} +1 -1
- package/dist/chunks/{chunk-6MI4KKWF.js → chunk-2ITZW2CN.js} +1 -1
- package/dist/chunks/chunk-2MMCZHKL.js +2 -0
- package/dist/chunks/{chunk-ABD5M2D2.js → chunk-2PAJCXFC.js} +1 -1
- package/dist/chunks/chunk-2RNCXDJC.js +5 -0
- package/dist/chunks/{chunk-APB2STJK.js → chunk-2SUMZ73C.js} +1 -1
- package/dist/chunks/{chunk-YOQRYNLP.js → chunk-3CWRTKHY.js} +1 -1
- package/dist/chunks/{chunk-TRQQNFMO.js → chunk-44LWH5U6.js} +1 -1
- package/dist/chunks/{chunk-HPBQ4VTW.js → chunk-52KIORRX.js} +1 -1
- package/dist/chunks/{chunk-NHQ36THU.js → chunk-5RHYSQZ5.js} +1 -1
- package/dist/chunks/{chunk-3QIB5FXI.js → chunk-5ZBLCWEJ.js} +1 -1
- package/dist/chunks/{chunk-FTEOCCPB.js → chunk-637UACKH.js} +1 -1
- package/dist/chunks/chunk-655DQ6AX.js +145 -0
- package/dist/chunks/{chunk-N4FFQPLR.js → chunk-6GWOVHIG.js} +1 -1
- package/dist/chunks/chunk-6HQB3MQO.js +2 -0
- package/dist/chunks/{chunk-UKMA4R6X.js → chunk-7LZISGTA.js} +2 -2
- package/dist/chunks/{chunk-A6USMRWK.js → chunk-7RC5WPVT.js} +1 -1
- package/dist/chunks/{chunk-H6IW2R22.js → chunk-7YTHEMWI.js} +1 -1
- package/dist/chunks/{chunk-PCSIOUHF.js → chunk-A3L74U3W.js} +1 -1
- package/dist/chunks/{chunk-25MBPJVY.js → chunk-A66CSUBJ.js} +1 -1
- package/dist/chunks/{chunk-OUVIWDL2.js → chunk-AGVOGPAZ.js} +1 -1
- package/dist/chunks/{chunk-M4JWQSV7.js → chunk-AW5Q6NXT.js} +1 -1
- package/dist/chunks/{chunk-RWWE5OXU.js → chunk-B46HZ3MX.js} +1 -1
- package/dist/chunks/{chunk-KGNCKIFP.js → chunk-BIPQCJ5V.js} +1 -1
- package/dist/chunks/{chunk-HCYX6RHP.js → chunk-BIQ33JV5.js} +1 -1
- package/dist/chunks/{chunk-JFXWI3EN.js → chunk-BK63OQRW.js} +1 -1
- package/dist/chunks/{chunk-2D4Y3HNW.js → chunk-CFSIU6CW.js} +1 -1
- package/dist/chunks/{chunk-EIEZHFIW.js → chunk-D3RRUWNN.js} +1 -1
- package/dist/chunks/{chunk-X4OSOOSU.js → chunk-D4UX2O45.js} +1 -1
- package/dist/chunks/{chunk-GJ2ZJFDD.js → chunk-DG4TYVPF.js} +1 -1
- package/dist/chunks/{chunk-QIKWJ2AA.js → chunk-DGIEXZJV.js} +1 -1
- package/dist/chunks/{chunk-PRGBLQVH.js → chunk-DIGX56JY.js} +1 -1
- package/dist/chunks/{chunk-JYKRR7E5.js → chunk-DISNCX6R.js} +1 -1
- package/dist/chunks/{chunk-773TH7FN.js → chunk-DK7IKI7O.js} +1 -1
- package/dist/chunks/{chunk-74IIXVAE.js → chunk-DX7YEUNQ.js} +1 -1
- package/dist/chunks/{chunk-523TE4BI.js → chunk-E63VWAQA.js} +1 -1
- package/dist/chunks/{chunk-5MCNZCVQ.js → chunk-EL454L26.js} +1 -1
- package/dist/chunks/{chunk-OS3LO5J3.js → chunk-ENSB6ZTM.js} +1 -1
- package/dist/chunks/{chunk-EAPFMACH.js → chunk-ERJV5BMC.js} +1 -1
- package/dist/chunks/{chunk-RNIAFXMB.js → chunk-EXJGCNRS.js} +1 -1
- package/dist/chunks/chunk-F5KCCDQM.js +2 -0
- package/dist/chunks/chunk-FSQWAANK.js +3 -0
- package/dist/chunks/{chunk-Z54O534A.js → chunk-G5B3PB5X.js} +1 -1
- package/dist/chunks/{chunk-4D7HWVWD.js → chunk-GAWGIJQG.js} +1 -1
- package/dist/chunks/{chunk-IIZ4CWBX.js → chunk-GGGF5NHJ.js} +1 -1
- package/dist/chunks/{chunk-APB4O67E.js → chunk-GOYBYYPQ.js} +1 -1
- package/dist/chunks/{chunk-XDQMGUWL.js → chunk-H3BSIAQO.js} +1 -1
- package/dist/chunks/{chunk-EYPCBBMS.js → chunk-HCEJAOIF.js} +1 -1
- package/dist/chunks/{chunk-OPNRWESL.js → chunk-IFQCOSU6.js} +1 -1
- package/dist/chunks/chunk-IJHZBHEK.js +9 -0
- package/dist/chunks/{chunk-RAXOSUSW.js → chunk-ISFIDCIH.js} +1 -1
- package/dist/chunks/{chunk-OLLLZVHF.js → chunk-ITKTILKI.js} +1 -1
- package/dist/chunks/{chunk-D74JEERO.js → chunk-IUBARBGI.js} +1 -1
- package/dist/chunks/{chunk-O72BSKSO.js → chunk-J24I74EM.js} +1 -1
- package/dist/chunks/{chunk-H4QHIHMK.js → chunk-J7QGHA7G.js} +3 -3
- package/dist/chunks/chunk-JFXINDOQ.js +3 -0
- package/dist/chunks/{chunk-HIOKCIL7.js → chunk-JGWINTT5.js} +1 -1
- package/dist/chunks/{chunk-Q2QL6UWN.js → chunk-JHEFWB6O.js} +1 -1
- package/dist/chunks/{chunk-QNG27G3T.js → chunk-JHMS2WXM.js} +2 -2
- package/dist/chunks/{chunk-PSGGOZFM.js → chunk-JHR3LF2F.js} +1 -1
- package/dist/chunks/{chunk-JE7RJZOA.js → chunk-KGLJU66U.js} +3 -3
- package/dist/chunks/{chunk-XEOEKFG6.js → chunk-KJFRCVQC.js} +1 -1
- package/dist/chunks/chunk-KNO355LC.js +2 -0
- package/dist/chunks/{chunk-ZGTOK7ZK.js → chunk-LD7PGREF.js} +2 -2
- package/dist/chunks/{chunk-I7AQMAQI.js → chunk-LHA7RQBA.js} +6 -6
- package/dist/chunks/{chunk-6QSSIT62.js → chunk-LO3O45IX.js} +1 -1
- package/dist/chunks/{chunk-G3RXYI2L.js → chunk-M2SKXY5C.js} +2 -2
- package/dist/chunks/{chunk-2IHO4GDJ.js → chunk-M3ZQDPRS.js} +1 -1
- package/dist/chunks/{chunk-JDEEWOD7.js → chunk-M4ZF44H5.js} +1 -1
- package/dist/chunks/{chunk-Y4OWBBDD.js → chunk-M55H7KVR.js} +1 -1
- package/dist/chunks/{chunk-JAJ46T5X.js → chunk-MGKMIRYG.js} +1 -1
- package/dist/chunks/{chunk-4EQA2M7K.js → chunk-MJGU2JJ2.js} +2 -2
- package/dist/chunks/{chunk-65PL62KH.js → chunk-MS37ISA4.js} +2 -2
- package/dist/chunks/{chunk-NH6UUX5S.js → chunk-NCKXI2VB.js} +11 -11
- package/dist/chunks/chunk-NHUUCNAD.js +2 -0
- package/dist/chunks/{chunk-O6ULLQJ6.js → chunk-O3VP46SE.js} +1 -1
- package/dist/chunks/chunk-O4FBOUNX.js +2 -0
- package/dist/chunks/chunk-O6IFVTZT.js +9 -0
- package/dist/chunks/{chunk-5IPFI25K.js → chunk-O7B44IYN.js} +1 -1
- package/dist/chunks/{chunk-DMVD2RFZ.js → chunk-OGMDEA3Y.js} +1 -1
- package/dist/chunks/{chunk-BLXEAZCQ.js → chunk-OKBIWRHC.js} +1 -1
- package/dist/chunks/{chunk-FFRFSDBM.js → chunk-ON2RNOCG.js} +1 -1
- package/dist/chunks/{chunk-LQQNBVEB.js → chunk-ONDCV5QC.js} +1 -1
- package/dist/chunks/{chunk-UCPGRPWY.js → chunk-OQ4VGCRG.js} +1 -1
- package/dist/chunks/{chunk-YNH3NMPF.js → chunk-OWK7HU5I.js} +1 -1
- package/dist/chunks/{chunk-DBK66CJP.js → chunk-OY5HC2P6.js} +1 -1
- package/dist/chunks/{chunk-T5AACNJI.js → chunk-P7HRF4FM.js} +1 -1
- package/dist/chunks/{chunk-7ED24PP6.js → chunk-PCNLC5H3.js} +1 -1
- package/dist/chunks/{chunk-ES2ISFJC.js → chunk-PF56N7ZY.js} +1 -1
- package/dist/chunks/{chunk-VVCKLCF3.js → chunk-PKALOVHC.js} +2 -2
- package/dist/chunks/{chunk-ZCHXGRRU.js → chunk-PR5TYTY4.js} +1 -1
- package/dist/chunks/{chunk-Q4TBTRIG.js → chunk-PWK5Z5S3.js} +1 -1
- package/dist/chunks/chunk-PXS4SVQG.js +16 -0
- package/dist/chunks/{chunk-AY64VY4E.js → chunk-QGOPYQW3.js} +1 -1
- package/dist/chunks/{chunk-7E6T7GP5.js → chunk-R7YEURUQ.js} +1 -1
- package/dist/chunks/{chunk-ACYFMLWG.js → chunk-RCA6NGVA.js} +2 -2
- package/dist/chunks/{chunk-DUURYZOI.js → chunk-RG3NH6YQ.js} +1 -1
- package/dist/chunks/{chunk-7SC46OFC.js → chunk-RJIUOLWY.js} +1 -1
- package/dist/chunks/{chunk-F4KOGISR.js → chunk-RXE3FYMJ.js} +1 -1
- package/dist/chunks/chunk-RYGWCN2R.js +2 -0
- package/dist/chunks/{chunk-VYLGI3IH.js → chunk-SFNCAPCJ.js} +1 -1
- package/dist/chunks/{chunk-Z4Z5UOZM.js → chunk-SG6JZ7HD.js} +1 -1
- package/dist/chunks/{chunk-XX6SMFDY.js → chunk-SKRNWRKV.js} +5 -5
- package/dist/chunks/{chunk-ZRDGQDZL.js → chunk-SLZH4Z6C.js} +1 -1
- package/dist/chunks/{chunk-WN3V6KDN.js → chunk-SPDSSMFD.js} +1 -1
- package/dist/chunks/chunk-STWRTNRK.js +2 -0
- package/dist/chunks/{chunk-HZEIRHEB.js → chunk-T5J7HIHR.js} +1 -1
- package/dist/chunks/{chunk-ROGF26KV.js → chunk-TBUAQWFS.js} +1 -1
- package/dist/chunks/{chunk-ZUJ3XUCP.js → chunk-TEPRCBDV.js} +1 -1
- package/dist/chunks/{chunk-HDGTHRY7.js → chunk-TOFMA2L5.js} +2 -2
- package/dist/chunks/{chunk-QOGJAQDO.js → chunk-UFHLLSCE.js} +1 -1
- package/dist/chunks/{chunk-TTVS6JMC.js → chunk-UJKQLO6B.js} +2 -2
- package/dist/chunks/{chunk-OQKJGTTO.js → chunk-UZQNFTLR.js} +1 -1
- package/dist/chunks/{chunk-F74GBN6K.js → chunk-V2HMWCT6.js} +1 -1
- package/dist/chunks/{chunk-6ZFPQYHG.js → chunk-V4KT5FCJ.js} +1 -1
- package/dist/chunks/{chunk-TVQAPBLZ.js → chunk-VHSX3JPX.js} +1 -1
- package/dist/chunks/{chunk-SDXFLO7J.js → chunk-W2SXOGTQ.js} +1 -1
- package/dist/chunks/{chunk-FUOEIDMA.js → chunk-WDEO44UN.js} +1 -1
- package/dist/chunks/{chunk-4NESNOK5.js → chunk-WEHBK3MC.js} +1 -1
- package/dist/chunks/{chunk-4EPSHPZL.js → chunk-WGX7WY4N.js} +1 -1
- package/dist/chunks/{chunk-NC27T4AB.js → chunk-WHREO7A2.js} +1 -1
- package/dist/chunks/{chunk-RNQF63ZR.js → chunk-WS2ZZBAQ.js} +4 -4
- package/dist/chunks/{chunk-DIO5CB6U.js → chunk-WYZWDMMF.js} +1 -1
- package/dist/chunks/{chunk-MQULU465.js → chunk-XO3H32KX.js} +1 -1
- package/dist/chunks/{chunk-EIRYMSEG.js → chunk-XQBIHPPX.js} +1 -1
- package/dist/chunks/chunk-XRKFTPHD.js +2 -0
- package/dist/chunks/{chunk-B7RFL4N2.js → chunk-XSCIOQYE.js} +1 -1
- package/dist/chunks/{chunk-TJ6GVTYB.js → chunk-XTWEWYK7.js} +9 -9
- package/dist/chunks/{chunk-JUHZ5S3R.js → chunk-Y3GIM6WK.js} +1 -1
- package/dist/chunks/{chunk-74ZXXBGN.js → chunk-Y54RKLOI.js} +1 -1
- package/dist/chunks/{chunk-SWUEFLOH.js → chunk-Y777GISF.js} +1 -1
- package/dist/chunks/{chunk-EKM2D7JU.js → chunk-YDU3S6UT.js} +1 -1
- package/dist/chunks/{chunk-UGL7WF3W.js → chunk-YOZIZYSC.js} +1 -1
- package/dist/chunks/{chunk-OSIO7PLX.js → chunk-YQKOB56U.js} +1 -1
- package/dist/chunks/chunk-YVNDDNMK.js +3 -0
- package/dist/chunks/chunk-ZAZKJJOT.js +86 -0
- package/dist/chunks/{chunk-QL4OIPEZ.js → chunk-ZR7LIMJS.js} +2 -2
- package/dist/chunks/{chunk-L3KCP52O.js → chunk-ZTJOOY2F.js} +1 -1
- package/dist/chunks/{chunk-GPVCOEUH.js → chunk-ZTVXRZ6D.js} +1 -1
- package/dist/chunks/cli-CNYNXKGQ.js +2 -0
- package/dist/chunks/configuration-command-5K7EE2J5.js +2 -0
- package/dist/chunks/connected-app-executor-E25XCNAS.js +2 -0
- package/dist/chunks/connected-evidence-QNSO5BTF.js +2 -0
- package/dist/chunks/connection-Y2KCMBYD.js +2 -0
- package/dist/chunks/{continual-6CQAMTTR.js → continual-SOO3QBNQ.js} +1 -1
- package/dist/chunks/core-commands-ZTWPYAFQ.js +2 -0
- package/dist/chunks/datasets-XPUMWGOC.js +2 -0
- package/dist/chunks/desktop-test-HVSW4JHY.js +3 -0
- package/dist/chunks/dist-4N6AHWNN.js +2 -0
- package/dist/chunks/{dist-OMGUJYPD.js → dist-N6R6VNFD.js} +1 -1
- package/dist/chunks/{dist-VYC5VMQB.js → dist-QN7WKZ2D.js} +1 -1
- package/dist/chunks/{enclave-QS4BUNDU.js → enclave-VURYNILU.js} +1 -1
- package/dist/chunks/evaluation-coordination-AOTFPVMS.js +2 -0
- package/dist/chunks/experiment-improvements-75CN3VI7.js +2 -0
- package/dist/chunks/experiments-AGAHM2AK.js +2 -0
- package/dist/chunks/{experiments-VFQGE4HC.js → experiments-DYSHYBGB.js} +1 -1
- package/dist/chunks/{extension-XKXXOP5N.js → extension-UT4CSDJF.js} +1 -1
- package/dist/chunks/help-KU52CFMW.js +8 -0
- package/dist/chunks/host-profile-evaluation-tools-LZDMQCMT.js +2 -0
- package/dist/chunks/host-profile-external-dataset-VK3NJHMC.js +2 -0
- package/dist/chunks/hosted-app-server-composition-P7V7K7CG.js +2 -0
- package/dist/chunks/{hosted-experiment-improvement-HVMDGS75.js → hosted-experiment-improvement-P433KDX2.js} +1 -1
- package/dist/chunks/hosted-harness-runtime-Y4DONWPC.js +2 -0
- package/dist/chunks/{hosted-profile-candidate-EXNN6MVN.js → hosted-profile-candidate-72MMPN6U.js} +1 -1
- package/dist/chunks/hosted-profile-compiler-RXHLK224.js +2 -0
- package/dist/chunks/hosted-profile-evaluation-control-LS4DCSDO.js +2 -0
- package/dist/chunks/{hosted-profile-evaluation-inspection-ZUANDYZ6.js → hosted-profile-evaluation-inspection-3Q6EHO66.js} +1 -1
- package/dist/chunks/{hosted-profile-evaluation-preparation-ORVZ6MBD.js → hosted-profile-evaluation-preparation-ZD27HNLF.js} +1 -1
- package/dist/chunks/{hosted-tasksets-ANAE2PIW.js → hosted-tasksets-V2PQZJN4.js} +1 -1
- package/dist/chunks/human-review-4FJFINQX.js +2 -0
- package/dist/chunks/import-GBHSLA3G.js +3 -0
- package/dist/chunks/{learning-ACEVFL5M.js → learning-U3FZL5YB.js} +1 -1
- package/dist/chunks/local-harness-improvement-runtime-UP2P7UT4.js +2 -0
- package/dist/chunks/local-harness-taskset-review-ZNOKSPJJ.js +2 -0
- package/dist/chunks/{local-scope-HVF2GZ5W.js → local-scope-62GWHDXS.js} +1 -1
- package/dist/chunks/{model-projects-QPO22JPA.js → model-projects-LQ4C6R3X.js} +1 -1
- package/dist/chunks/opchat-Q4PIWPYW.js +3 -0
- package/dist/chunks/organizations-TEH6HBQ3.js +2 -0
- package/dist/chunks/{profile-TFZMUEDR.js → profile-SWPVCGTR.js} +1 -1
- package/dist/chunks/{profile-training-source-6GOT7AHM.js → profile-training-source-J73ZLNSC.js} +1 -1
- package/dist/chunks/project-action-payload-OU3ZPHW7.js +2 -0
- package/dist/chunks/project-agent-J7ILCRBS.js +2 -0
- package/dist/chunks/{published-experiment-source-HVP5IGRH.js → published-experiment-source-HVHKSYDL.js} +1 -1
- package/dist/chunks/refiner-profile-service-E7YU4E3N.js +2 -0
- package/dist/chunks/{runtime-A7OZXM43.js → runtime-LIPHPKKJ.js} +2 -2
- package/dist/chunks/sandbox-command-G6KID3OP.js +2 -0
- package/dist/chunks/{sandbox-template-C4V6T36U.js → sandbox-template-MZTMAUFS.js} +1 -1
- package/dist/chunks/saved-work-LOUWLF37.js +2 -0
- package/dist/chunks/{send-turn-XTAIS2JN.js → send-turn-UEUEGY5W.js} +1 -1
- package/dist/chunks/{src-R36AGJY7.js → src-7WMZOWZZ.js} +107 -100
- package/dist/chunks/{src-DZL5T2MT.js → src-MVAK6D6Y.js} +1 -1
- package/dist/chunks/standalone-experiment-turn-owner-YRKEOEJ2.js +2 -0
- package/dist/chunks/{store-continual-support-reviews-LJPNG4SP.js → store-continual-support-reviews-FJLLNKCY.js} +1 -1
- package/dist/chunks/{store-conversation-serving-KPC62UEY.js → store-conversation-serving-4KWR4IZY.js} +1 -1
- package/dist/chunks/{store-create-improve-SW5FTBTL.js → store-create-improve-JWBJZRAU.js} +1 -1
- package/dist/chunks/{store-datasets-WMA7AJKN.js → store-datasets-4N2M6Y3K.js} +2 -2
- package/dist/chunks/{store-evaluation-results-ZO6R653G.js → store-evaluation-results-OBM4623U.js} +1 -1
- package/dist/chunks/{store-harness-memory-VINCZ4GK.js → store-harness-memory-4HUEMRCD.js} +1 -1
- package/dist/chunks/{store-harness-refinement-candidates-EA5KFQPH.js → store-harness-refinement-candidates-NMRWMN23.js} +1 -1
- package/dist/chunks/store-harness-workspaces-BGONIQDY.js +2 -0
- package/dist/chunks/{store-human-review-7QQ7ZQ6P.js → store-human-review-J75SIZAL.js} +1 -1
- package/dist/chunks/store-learned-preference-migration-validation-VLASM4CT.js +2 -0
- package/dist/chunks/store-learning-TUCQFBLT.js +2 -0
- package/dist/chunks/{store-learning-credentials-WZQJ4HPJ.js → store-learning-credentials-S4RF57NV.js} +1 -1
- package/dist/chunks/{store-local-experiments-SAULQSBN.js → store-local-experiments-LULRLTII.js} +5 -5
- package/dist/chunks/{store-model-batch-review-VKLDYGH3.js → store-model-batch-review-SVL4MT6D.js} +1 -1
- package/dist/chunks/{store-model-configuration-BYRJUR3C.js → store-model-configuration-ZHDSM3XM.js} +2 -2
- package/dist/chunks/{store-preference-comparison-LV32MHVL.js → store-preference-comparison-YMMCKXS5.js} +1 -1
- package/dist/chunks/{store-schedules-VGTEQVKH.js → store-schedules-6Z4QS3NU.js} +1 -1
- package/dist/chunks/{store-sidebar-file-bookmarks-VB5GTLFY.js → store-sidebar-file-bookmarks-MX6EP6OB.js} +2 -2
- package/dist/chunks/{store-sidebar-preferences-GWIOG2NH.js → store-sidebar-preferences-VYREPW26.js} +1 -1
- package/dist/chunks/{store-subagents-T7R2Z6TB.js → store-subagents-WGBCRALX.js} +1 -1
- package/dist/chunks/{store-task-inbox-QPE44OSS.js → store-task-inbox-43BNZSB7.js} +6 -6
- package/dist/chunks/{store-task-inventory-I3RDRI52.js → store-task-inventory-AEW4POAJ.js} +2 -2
- package/dist/chunks/{store-taskset-drafts-2IULRV2W.js → store-taskset-drafts-DKFO2CYB.js} +1 -1
- package/dist/chunks/{store-training-B2TW2MLA.js → store-training-6PFFR6ST.js} +1 -1
- package/dist/chunks/{store-training-jobs-VBNG23RL.js → store-training-jobs-ANDEBQ67.js} +2 -2
- package/dist/chunks/{store-training-models-OMV5FIC4.js → store-training-models-OOI4ZJPX.js} +2 -2
- package/dist/chunks/{store-usage-IE2U2FD3.js → store-usage-U72RNW64.js} +1 -1
- package/dist/chunks/{store-work-evidence-QQDKM5AQ.js → store-work-evidence-NY5OBATB.js} +1 -1
- package/dist/chunks/{taskset-EQRFQBYM.js → taskset-SL3YOXW7.js} +1 -1
- package/dist/chunks/{taskset-packages-XC6HEE3K.js → taskset-packages-3PCEYYDA.js} +1 -1
- package/dist/chunks/{teams-bot-EAPGPTHZ.js → teams-bot-IDEF3BMI.js} +1 -1
- package/dist/chunks/{training-UF6RPI4T.js → training-57ISIC7U.js} +1 -1
- package/dist/chunks/web-search-222Y63QW.js +2 -0
- package/dist/chunks/{workspaces-EKKE5NAC.js → workspaces-5DF4H5EX.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sandbox-template/manifest.js +1 -1
- package/dist/web/assets/{App-CaRMZoxo.css → App-DbYvV_W6.css} +1 -1
- package/dist/web/assets/App-nzE7JU_O.js +154 -0
- package/dist/web/assets/{AppDialog-t2Fx5tK3.js → AppDialog-VtNvqbDm.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-Dj1Y32oI.js → AppTerminalPanel-BMfKdrrN.js} +2 -2
- package/dist/web/assets/AppsView-CdWyrDEb.js +1 -0
- package/dist/web/assets/{BrowserSidebar-jhWi4rVm.js → BrowserSidebar-CtOIciOa.js} +1 -1
- package/dist/web/assets/{CartesianChart-C1DIx0Ia.js → CartesianChart-u1lvLM30.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-Bdr-HmOL.js → CollaborationTabs-CaBfDYRW.js} +1 -1
- package/dist/web/assets/{CommandMenu-Ux2yOHAc.js → CommandMenu-CFW3WJ11.js} +1 -1
- package/dist/web/assets/{CommunityView-DPEeVKFn.js → CommunityView-D2EjaeuH.js} +1 -1
- package/dist/web/assets/ComposerCreateImproveStrip-6wYSJdzv.js +1 -0
- package/dist/web/assets/ConversationImportsSettings-BJ4QhF7p.js +1 -0
- package/dist/web/assets/ConversationImportsSettings-PfUa8V7X.css +1 -0
- package/dist/web/assets/{GetStartedView-CFHP0AaI.js → GetStartedView-DBcOwIJn.js} +1 -1
- package/dist/web/assets/{HostedModelLearningReview-D8BGTPVN.js → HostedModelLearningReview-BNpK6_W9.js} +1 -1
- package/dist/web/assets/{HostedModelLearningSettings-JS1S7vNO.js → HostedModelLearningSettings-SrsdeeoA.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-Dx5Q3xV2.js → LabModelVersionDetailPage-Cd6bRHt9.js} +1 -1
- package/dist/web/assets/LabSkillSidebar-CQfvel4w.js +1 -0
- package/dist/web/assets/{LabsRoute-CyYF8-dw.js → LabsRoute-sXLJt1KR.js} +4 -4
- package/dist/web/assets/MainChatThread-dlDDK2JM.js +2 -0
- package/dist/web/assets/MainPane-DCz38-qy.js +65 -0
- package/dist/web/assets/{MarkdownText-BR4V6lNO.js → MarkdownText-Drjq6-JM.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-DU9IEgIO.js → NativeSkillSidebar-jncZijt-.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-mIy6FzCj.js → NewExperienceSwitcher-DXKzoMaM.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-RfTZTHxl.js → NewProjectDialog-DIyjAxJG.js} +1 -1
- package/dist/web/assets/OutputsPage-Dy1cNr3n.js +1 -0
- package/dist/web/assets/{ProjectsPage-CE6QUB-b.js → ProjectsPage-D2EeybIv.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-4wUL-W9_.js +1 -0
- package/dist/web/assets/{RightSidebarHomePanel-CK0rP3WT.js → RightSidebarHomePanel-Bd_AHUp8.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-vOrYv8pp.js → ScheduledWorkPage-BJkSzwz2.js} +1 -1
- package/dist/web/assets/{SettingsView-DCKVrfjj.js → SettingsView-BhcP72KH.js} +4 -4
- package/dist/web/assets/SettingsView-DjjnCnlb.css +1 -0
- package/dist/web/assets/{TeamChatView-Bwrjr-vk.js → TeamChatView-CR0fdicZ.js} +2 -2
- package/dist/web/assets/{TerminalOverlay-DhPoKZAq.js → TerminalOverlay-DGrZRZ_3.js} +10 -10
- package/dist/web/assets/TrainingCreationPanel-BsTG7aFS.js +1 -0
- package/dist/web/assets/{TrainingDraftPanel-C9cRX5qf.js → TrainingDraftPanel-ByErrht7.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CrdcSGeW.js → UsageSettingsSection-DeYTJbcM.js} +1 -1
- package/dist/web/assets/{WorkSidebarPanel-DSSikNFQ.js → WorkSidebarPanel-DcNvEEoy.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-BAFo0CPN.js → WorkspaceDiffPanel-CdPRcYWN.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-BVHAhwnJ.js → WorkspaceEnvironmentMenu-xUYg-iGn.js} +18 -18
- package/dist/web/assets/{WorkspaceGitDialogs-CwVoiDQ2.js → WorkspaceGitDialogs-CBViLL3S.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-TxLyhzNp.js → WorkspaceMonacoEditor-frxie2_S.js} +3 -3
- package/dist/web/assets/agent-connections-D7ao-vbU.js +1 -0
- package/dist/web/assets/{arrow-up-right-C9aE8Mfz.js → arrow-up-right-DCWPxdbD.js} +1 -1
- package/dist/web/assets/{chunk-P3BRSSRD-DUGfuKA8.js → chunk-P3BRSSRD-B5JXa0Nh.js} +1 -1
- package/dist/web/assets/{clipboard-Dk158Qp4.js → clipboard-B-GnMVLp.js} +1 -1
- package/dist/web/assets/{cloud-upload-k9eqBsHr.js → cloud-upload-DpaGFZ9J.js} +1 -1
- package/dist/web/assets/{cssMode-CO35ARZp.js → cssMode-DJHE7R3W.js} +1 -1
- package/dist/web/assets/{folder-open-sYgceW_f.js → folder-open-B-DFLDFH.js} +1 -1
- package/dist/web/assets/{folder-plus-CS0R49m9.js → folder-plus-CPXxPvSH.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-DrGxH2h4.js → git-commit-horizontal-DCTzcivA.js} +1 -1
- package/dist/web/assets/{htmlMode-REMmzdfq.js → htmlMode-DxZVBAYd.js} +1 -1
- package/dist/web/assets/index-BojtIRzO.css +1 -0
- package/dist/web/assets/{index-C8aCGagb.js → index-Di1MU6Xr.js} +2 -2
- package/dist/web/assets/{info-DLdbiUrh.js → info-BMxsR_bn.js} +1 -1
- package/dist/web/assets/{jsonMode-KEdMfkIf.js → jsonMode-CzWoMkpp.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-5KZwEoxW.js → lspLanguageFeatures-15K7ND6Q.js} +1 -1
- package/dist/web/assets/{minimize-2-CqcI4zcM.js → minimize-2-DwUgqXoR.js} +1 -1
- package/dist/web/assets/{monaco.contribution-Cly9Wt7L.js → monaco.contribution-BBLKjER5.js} +2 -2
- package/dist/web/assets/{monaco.contribution-omszXBEj.js → monaco.contribution-DBjvSu8p.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DO10L0zW.js → monaco.contribution-DUWvjhIG.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BJGj65F9.js → monaco.contribution-w0zfkYLX.js} +2 -2
- package/dist/web/assets/{monitor-BFVCcbxp.js → monitor-Ihu5LVYx.js} +1 -1
- package/dist/web/assets/{play-C469pVZq.js → play-D_YGCdxU.js} +1 -1
- package/dist/web/assets/{python-Dw0YcVy9.js → python-Q4OuoXYc.js} +1 -1
- package/dist/web/assets/{save-CtSjPydi.js → save-DJYUOhtD.js} +1 -1
- package/dist/web/assets/{square-BuImvLhT.js → square-DXtoCBNw.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-DjCO9lIP.js → toggleHighContrast-CaNeuWVE.js} +1 -1
- package/dist/web/assets/{tsMode-BAOnxKd6.js → tsMode-CJnQ2wmM.js} +1 -1
- package/dist/web/assets/{upload-2JkFZo3h.js → upload-fCP3_OEO.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-BNqAisfS.js → useLocalAgentSchedules-BFoH_gwZ.js} +1 -1
- package/dist/web/assets/useProviderSettings-2eysgqiA.js +5 -0
- package/dist/web/assets/{useProviderSettings-CmL_BaxP.css → useProviderSettings-Cktvzinz.css} +1 -1
- package/dist/web/assets/{useSessionTurnCache-BHU2-Jmz.js → useSessionTurnCache-DLF5SPD-.js} +1 -1
- package/dist/web/assets/{wifi-off-CpOAH62M.js → wifi-off-DZoiFrRz.js} +1 -1
- package/dist/web/assets/{workers-0QvlA2T5.js → workers-D5nr74M-.js} +1 -1
- package/dist/web/assets/{yaml-BK3qxo7D.js → yaml-CwsoTJmk.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/command-reference.md +22 -3
- package/docs/conversation-imports.md +57 -0
- package/package.json +1 -1
- package/dist/chunks/app-server-harness-services-QMUOEYOA.js +0 -2
- package/dist/chunks/app-server-runtime-ISGGLQHU.js +0 -2
- package/dist/chunks/apps-BKTOR4F7.js +0 -2
- package/dist/chunks/chunk-3VUATFZD.js +0 -2
- package/dist/chunks/chunk-3Z47M3YY.js +0 -2
- package/dist/chunks/chunk-6UDGARFC.js +0 -143
- package/dist/chunks/chunk-FV2R5RUN.js +0 -3
- package/dist/chunks/chunk-HY3GOBFJ.js +0 -58
- package/dist/chunks/chunk-I3HZKJB3.js +0 -2
- package/dist/chunks/chunk-I3VVWNUW.js +0 -5
- package/dist/chunks/chunk-KG325WTN.js +0 -2
- package/dist/chunks/chunk-Q5LEXXJG.js +0 -16
- package/dist/chunks/chunk-QDC4OW3S.js +0 -2
- package/dist/chunks/chunk-SDAUS5PY.js +0 -2
- package/dist/chunks/chunk-VRIEKBBH.js +0 -9
- package/dist/chunks/chunk-WJ43MJ3F.js +0 -2
- package/dist/chunks/chunk-X2HIHF2I.js +0 -2
- package/dist/chunks/chunk-YBT2NB32.js +0 -2
- package/dist/chunks/chunk-ZTNHW2K7.js +0 -10
- package/dist/chunks/cli-XZENDZ7Z.js +0 -2
- package/dist/chunks/configuration-command-6C5UO7GE.js +0 -2
- package/dist/chunks/connected-app-executor-LQNIU5NR.js +0 -2
- package/dist/chunks/connected-evidence-GH2ATNEX.js +0 -2
- package/dist/chunks/connection-HTF6CC7M.js +0 -2
- package/dist/chunks/core-commands-A2DGGIPS.js +0 -2
- package/dist/chunks/datasets-7BNMVJOY.js +0 -2
- package/dist/chunks/desktop-test-3CUHVLXV.js +0 -3
- package/dist/chunks/dist-ZVJPJLXR.js +0 -2
- package/dist/chunks/evaluation-coordination-XEF5L7KZ.js +0 -2
- package/dist/chunks/experiment-improvements-KRX2DP27.js +0 -2
- package/dist/chunks/experiments-DFGQYA4O.js +0 -2
- package/dist/chunks/help-S7THC6IE.js +0 -8
- package/dist/chunks/host-profile-evaluation-tools-JOFBL5OF.js +0 -2
- package/dist/chunks/host-profile-external-dataset-K3ICDHIP.js +0 -2
- package/dist/chunks/hosted-app-server-composition-T5IWGOTA.js +0 -2
- package/dist/chunks/hosted-harness-runtime-YCKB6NBI.js +0 -2
- package/dist/chunks/hosted-profile-compiler-IYLLHCRY.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-control-TJVER3NW.js +0 -2
- package/dist/chunks/human-review-WR777ODH.js +0 -2
- package/dist/chunks/import-MLZUHITH.js +0 -4
- package/dist/chunks/local-harness-improvement-runtime-QRFGPFRM.js +0 -2
- package/dist/chunks/local-harness-taskset-review-HR7KLY4B.js +0 -2
- package/dist/chunks/opchat-T4QTNEIY.js +0 -3
- package/dist/chunks/organizations-75L5DZDV.js +0 -2
- package/dist/chunks/project-action-payload-JDS6OQAW.js +0 -2
- package/dist/chunks/project-agent-6RRO233B.js +0 -2
- package/dist/chunks/refiner-profile-service-FDTQKY33.js +0 -2
- package/dist/chunks/sandbox-command-IU5XFTJP.js +0 -2
- package/dist/chunks/saved-work-SHEEDZ6Z.js +0 -2
- package/dist/chunks/standalone-experiment-turn-owner-JCY5LL5R.js +0 -2
- package/dist/chunks/store-harness-workspaces-XUM4Z66X.js +0 -2
- package/dist/chunks/store-learned-preference-migration-validation-NADPXOTG.js +0 -2
- package/dist/chunks/store-learning-WLG6KFIO.js +0 -2
- package/dist/chunks/web-search-CZ3NCLPY.js +0 -2
- package/dist/web/assets/App-s-CJswyt.js +0 -154
- package/dist/web/assets/AppsView-BYE5EBDJ.js +0 -1
- package/dist/web/assets/ComposerCreateImproveStrip-CEgh4OtN.js +0 -1
- package/dist/web/assets/LabSkillSidebar-BxffN-pN.js +0 -1
- package/dist/web/assets/MainChatThread-DZpcFRFl.js +0 -2
- package/dist/web/assets/MainPane-5DTtwVCk.js +0 -65
- package/dist/web/assets/OutputsPage-Cr1Spf7S.js +0 -1
- package/dist/web/assets/RightChatPanelStack-T6VRWuHo.js +0 -1
- package/dist/web/assets/SettingsView-Dulr_xlq.css +0 -1
- package/dist/web/assets/TrainingCreationPanel-BXHfohNm.js +0 -1
- package/dist/web/assets/index-3iPNbbER.css +0 -1
- package/dist/web/assets/useProviderSettings-C4L4wDoh.js +0 -5
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{m as B}from"./chunk-ISFIDCIH.js";import"./chunk-23P2O7PH.js";import"./chunk-AW5Q6NXT.js";import"./chunk-YVNDDNMK.js";import"./chunk-XRKFTPHD.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as _,f as b,h as k,i as E}from"./chunk-3M53YXEI.js";import"./chunk-BFKYRQMA.js";import"./chunk-LO3O45IX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-EL454L26.js";import"./chunk-BT5YNE5U.js";import"./chunk-PXS4SVQG.js";import"./chunk-FWIPHEVA.js";import"./chunk-ENSB6ZTM.js";import"./chunk-GLUWATL5.js";import"./chunk-RYGWCN2R.js";import"./chunk-ZZWAQBA2.js";import{d as x,e as C}from"./chunk-YR5ID2SS.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as o}from"./chunk-FTQLQJQV.js";import{createHash as re,randomBytes as se}from"node:crypto";import{createServer as ie}from"node:http";var Ue=new URL(C).hostname,ve=new URL(x).hostname,Se=`${C}/opchat/v1`;import{spawn as oe}from"node:child_process";function M(e,t=process.platform){return t==="darwin"?{command:"open",args:[e]}:t==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",e]}:{command:"xdg-open",args:[e]}}o(M,"resolveSystemBrowserCommand");async function S(e,t={}){let n=t.command??M(e),s=t.handoffTimeoutMs??1500;return new Promise(u=>{let r=!1,i=null,c=o(a=>{r||(r=!0,i&&clearTimeout(i),u(a))},"finish"),p=oe(n.command,n.args,{detached:!1,shell:!1,stdio:"ignore",windowsHide:!0});p.once("error",a=>{let l=a.code;c({opened:!1,error:l?`browser launcher ${n.command} failed (${l})`:`browser launcher ${n.command} failed`})}),p.once("close",(a,l)=>{if(a===0){c({opened:!0});return}let d=l?`signal ${l}`:`code ${a??"unknown"}`;c({opened:!1,error:`browser launcher ${n.command} exited with ${d}`})}),i=setTimeout(()=>{p.unref(),c({opened:!0})},s),i.unref()})}o(S,"openUrlWithSystemBrowser");function ae(e){return[e.slug,`team=${e.teamId}`,`role=${e.role}`,`status=${e.status}`,e.displayName].join(" ")}o(ae,"formatOrganizationLine");function le(e){return[e.email??e.userId,`user=${e.userId}`,`role=${e.role}`,e.createdAt].join(" ")}o(le,"formatOrganizationMemberLine");function ce(e){return e?[e.slug,`team=${e.teamId}`,`status=${e.status}`,`tools=${e.toolset.join(",")||"-"}`,e.resourceUrl].join(" "):"no mcp server configured"}o(ce,"formatOrganizationMcpServerLine");var ue=["estimate.read","estimate.write","estimate.execute","artifacts.read","artifacts.write"];function O(e){let t=e.trim().replace(/\/$/,"");if(!t)throw new Error("MCP resource URL must be non-empty");return new URL(t).toString().replace(/\/$/,"")}o(O,"normalizeMcpResourceUrl");function N(e,t){let n=typeof t.resourceUrl=="string"&&t.resourceUrl.trim()?t.resourceUrl.trim():typeof t.url=="string"&&t.url.trim()?t.url.trim():"";if(n)return O(n);if(!e?.resourceUrl)throw new Error("organization does not have an MCP server; run organizations mcp-generate first");return O(e.resourceUrl)}o(N,"resolveMcpProbeResourceUrl");function D(e,t){let n=typeof t.origin=="string"&&t.origin.trim()?t.origin.trim():"";return n?O(n):new URL(e).origin}o(D,"resolveMcpProbeOrigin");function $(e=32){return se(e).toString("base64url")}o($,"randomOauthToken");function de(e){return re("sha256").update(e).digest("base64url")}o(de,"buildMcpOauthPkceChallenge");function pe(e){let t=typeof e.scope=="string"&&e.scope.trim()?e.scope:typeof e.scopes=="string"&&e.scopes.trim()?e.scopes:"";if(!t)return[...ue];let n=t.split(/[,\s]+/g).map(s=>s.trim()).filter(Boolean);if(n.length===0)throw new Error("scope must include at least one OAuth scope");return n}o(pe,"parseMcpOAuthScopes");function me(e){let t=typeof e.clientId=="string"&&e.clientId.trim()?e.clientId.trim():"openpond-code-mcp-proof";if(t==="true")throw new Error("client-id must be a non-empty value");return t}o(me,"resolveMcpOAuthClientId");function fe(e){let t=k(e.timeoutSeconds,"timeout-seconds")??k(e.timeout,"timeout")??180;if(t<=0)throw new Error("timeout must be greater than zero");return t*1e3}o(fe,"resolveMcpOAuthTimeoutMs");function ge(e){let t=k(e.callbackPort,"callback-port")??0;if(t<0||t>65535)throw new Error("callback-port must be between 0 and 65535");return t}o(ge,"resolveMcpOAuthCallbackPort");function j(e){return new Promise((t,n)=>{e.close(s=>{s?n(s):t()})})}o(j,"closeServer");async function he(e){let t=!1,n=null,s=null,u=null,r=new Promise((a,l)=>{s=a,u=l}),i=o((a,l,d,m,f)=>{if(t){a.writeHead(204).end();return}t=!0,a.writeHead(l,{"cache-control":"no-store","content-type":"text/html; charset=utf-8"}),a.end(d),n&&clearTimeout(n),m?s?.(m):u?.(f??new Error("oauth_callback_failed"))},"settle"),c=ie((a,l)=>{let d=a.headers.host??"127.0.0.1",m=new URL(a.url??"/",`http://${d}`);if(m.pathname!=="/callback"){l.writeHead(404,{"content-type":"text/plain; charset=utf-8"}),l.end("Not found");return}let f=m.searchParams.get("state")??"",g=m.searchParams.get("error")??"",P=m.searchParams.get("code")??"";if(f!==e.expectedState){i(l,400,"<!doctype html><title>OpenPond OAuth failed</title><p>State mismatch. Return to the terminal and retry.</p>",void 0,new Error("oauth_state_mismatch"));return}if(g){i(l,400,"<!doctype html><title>OpenPond OAuth denied</title><p>Authorization was not completed. Return to the terminal.</p>",void 0,new Error(`oauth_authorization_failed:${g}`));return}if(!P){i(l,400,"<!doctype html><title>OpenPond OAuth failed</title><p>Missing authorization code. Return to the terminal and retry.</p>",void 0,new Error("oauth_code_missing"));return}i(l,200,"<!doctype html><title>OpenPond OAuth complete</title><p>Authorization complete. You can return to the terminal.</p>",{code:P,state:f})});await new Promise((a,l)=>{let d=o(f=>{c.off("listening",m),l(f)},"onError"),m=o(()=>{c.off("error",d),a()},"onListening");c.once("error",d),c.once("listening",m),c.listen(e.port,"127.0.0.1")});let p=c.address();if(!p||typeof p.port!="number")throw await j(c),new Error("oauth_callback_listener_failed");return n=setTimeout(()=>{t||(t=!0,u?.(new Error("oauth_callback_timeout")))},e.timeoutMs),{close:o(async()=>{n&&clearTimeout(n),await j(c).catch(()=>{})},"close"),redirectUri:`http://127.0.0.1:${p.port}/callback`,waitForCallback:o(()=>r,"waitForCallback")}}o(he,"startMcpOAuthCallbackListener");function ye(e){S(e)}o(ye,"openUrlWithSystemBrowser");function Pe(e){let t=new URL(e.authorizationEndpoint);return t.searchParams.set("response_type","code"),t.searchParams.set("client_id",e.clientId),t.searchParams.set("redirect_uri",e.redirectUri),t.searchParams.set("code_challenge",e.codeChallenge),t.searchParams.set("code_challenge_method","S256"),t.searchParams.set("resource",e.resourceUrl),t.searchParams.set("scope",e.scopes.join(" ")),t.searchParams.set("state",e.state),t.toString()}o(Pe,"buildMcpOAuthAuthorizeUrl");async function Ae(e){let t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("client_id",e.clientId),t.set("redirect_uri",e.redirectUri),t.set("code",e.code),t.set("code_verifier",e.codeVerifier);let n=await fetch(`${e.origin}/oauth/token`,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:t}),s=await J(n);if(!n.ok)throw new Error(`oauth_token_exchange_failed:${n.status}:${JSON.stringify(s)}`);if(!s||typeof s!="object"||Array.isArray(s))throw new Error("oauth_token_exchange_invalid_response");let u=s;if(typeof u.access_token!="string"||!u.access_token.trim())throw new Error("oauth_token_exchange_missing_access_token");return{access_token:u.access_token,...typeof u.expires_in=="number"?{expires_in:u.expires_in}:{},...typeof u.refresh_token=="string"?{refresh_token:u.refresh_token}:{},...typeof u.scope=="string"?{scope:u.scope}:{},...typeof u.token_type=="string"?{token_type:u.token_type}:{}}}o(Ae,"exchangeMcpOAuthAuthorizationCode");async function J(e){let t=await e.text().catch(()=>"");if(!t)return null;let n=t.trim();if((e.headers.get("content-type")??"").toLowerCase().includes("application/json")||n.startsWith("{")||n.startsWith("["))try{return JSON.parse(n)}catch{return t}return t}o(J,"readMcpProbeBody");async function U(e,t={}){let n=await fetch(e,t);return{url:e,status:n.status,ok:n.ok,headers:{contentType:n.headers.get("content-type"),location:n.headers.get("location"),wwwAuthenticate:n.headers.get("www-authenticate")},body:await J(n)}}o(U,"fetchMcpProbe");function we(e,t,n){return n?{jsonrpc:"2.0",id:e,method:t,params:n}:{jsonrpc:"2.0",id:e,method:t}}o(we,"buildMcpJsonRpcRequest");function F(e){let t=typeof e.arguments=="string"&&e.arguments.trim()?e.arguments:typeof e.args=="string"&&e.args.trim()?e.args:"";if(!t)return{};let n=_(t,"arguments");if(!n||typeof n!="object"||Array.isArray(n))throw new Error("arguments must be a JSON object");return n}o(F,"parseMcpToolArguments");async function R(e){let t={"content-type":"application/json"};return e.accessToken&&(t.authorization=`Bearer ${e.accessToken}`),U(e.resourceUrl,{method:"POST",headers:t,body:JSON.stringify(we(e.id,e.method,e.params))})}o(R,"postMcpJsonRpcProbe");async function q(e){let t=O(e.resourceUrl),n=O(e.origin),s=`${t}/.well-known/oauth-protected-resource`,u=`${n}/.well-known/oauth-authorization-server`,[r,i,c,p,a,l,d]=await Promise.all([U(s),U(u),U(t),R({resourceUrl:t,id:1,method:"initialize"}),R({resourceUrl:t,id:2,method:"tools/list"}),R({resourceUrl:t,id:3,method:"tools/call",params:{name:e.toolName,arguments:e.toolArguments}}),e.accessToken?R({resourceUrl:t,id:4,method:"tools/call",params:{name:e.toolName,arguments:e.toolArguments},accessToken:e.accessToken}):Promise.resolve(null)]);return{resourceUrl:t,origin:n,protectedResource:r,authorizationServer:i,directGetChallenge:c,initialize:p,toolsList:a,unauthenticatedToolCall:l,...d?{authenticatedToolCall:d}:{}}}o(q,"probeOrganizationMcp");function Oe(e){let t=typeof e=="string"?e.trim():"";if(t==="owner"||t==="admin"||t==="member")return t;throw new Error("role must be owner, admin, or member")}o(Oe,"parseOrganizationRole");function be(e){let t=typeof e.displayName=="string"&&e.displayName.trim()?e.displayName.trim():typeof e.name=="string"&&e.name.trim()?e.name.trim():"";if(!t)throw new Error("usage: organizations create --name <name> [--slug <slug>]");return{displayName:t,...typeof e.slug=="string"&&e.slug.trim()?{slug:e.slug.trim()}:{},...typeof e.primaryContactEmail=="string"&&e.primaryContactEmail.trim()?{primaryContactEmail:e.primaryContactEmail.trim()}:{},...typeof e.customDomain=="string"&&e.customDomain.trim()?{customDomain:e.customDomain.trim()}:{}}}o(be,"buildOrganizationCreateInput");function ke(e){let t={},n=typeof e.displayName=="string"&&e.displayName.trim()?e.displayName.trim():typeof e.name=="string"&&e.name.trim()?e.name.trim():"";if(n&&(t.displayName=n),typeof e.slug=="string"&&e.slug.trim()&&(t.slug=e.slug.trim()),typeof e.primaryContactEmail=="string"&&(t.primaryContactEmail=e.primaryContactEmail.trim()||null),typeof e.customDomain=="string"&&(t.customDomain=e.customDomain.trim()||null),typeof e.status=="string"&&e.status.trim()){let s=e.status.trim();if(s!=="active"&&s!=="disabled"&&s!=="archived")throw new Error("status must be active, disabled, or archived");t.status=s}if(Object.keys(t).length===0)throw new Error("organizations update requires at least one changed field");return t}o(ke,"buildOrganizationUpdateInput");function xe(e){let t=typeof e.email=="string"?e.email.trim():"";if(!t)throw new Error("usage: organizations member-upsert <slug> --email <email> --role <role>");return{email:t,role:Oe(e.role)}}o(xe,"buildOrganizationMemberInput");function Ce(e){return{...typeof e.origin=="string"&&e.origin.trim()?{origin:e.origin.trim()}:{},...typeof e.toolset=="string"&&e.toolset.trim()?{toolset:E(e.toolset)}:{}}}o(Ce,"buildOrganizationMcpGenerateInput");async function Nn(e,t){let n=t[0]||"list",s=await B(e),u=b(e.json);if(n==="list"){let r=await s.listOrganizations();if(u){console.log(JSON.stringify({organizations:r},null,2));return}if(r.length===0){console.log("no organizations found");return}for(let i of r)console.log(ae(i));return}if(n==="create"){let r=await s.createOrganization(be(e));console.log(JSON.stringify({organization:r},null,2));return}if(n==="get"){let r=t[1];if(!r)throw new Error("usage: organizations get <slug>");let i=await s.getOrganization(r);console.log(JSON.stringify({organization:i},null,2));return}if(n==="update"){let r=t[1];if(!r)throw new Error("usage: organizations update <slug> [--name <name>]");let i=await s.updateOrganization(r,ke(e));console.log(JSON.stringify({organization:i},null,2));return}if(n==="members"||n==="member-list"){let r=t[1];if(!r)throw new Error("usage: organizations members <slug>");let i=await s.listOrganizationMembers(r);if(u){console.log(JSON.stringify({members:i},null,2));return}if(i.length===0){console.log("no organization members found");return}for(let c of i)console.log(le(c));return}if(n==="member-upsert"||n==="member-add"){let r=t[1];if(!r)throw new Error("usage: organizations member-upsert <slug> --email <email> --role <role>");let i=await s.upsertOrganizationMember(r,xe(e));console.log(JSON.stringify({member:i},null,2));return}if(n==="mcp-get"||n==="mcp-server"){let r=t[1];if(!r)throw new Error("usage: organizations mcp-get <slug>");let i=await s.getOrganizationMcpServer(r);if(u){console.log(JSON.stringify({mcpServer:i},null,2));return}console.log(ce(i));return}if(n==="mcp-generate"){let r=t[1];if(!r)throw new Error("usage: organizations mcp-generate <slug> [--origin <url>]");let i=await s.generateOrganizationMcpServer(r,Ce(e));console.log(JSON.stringify({mcpServer:i},null,2));return}if(n==="mcp-probe"||n==="mcp-inspect"){let r=t[1];if(!r)throw new Error("usage: organizations mcp-probe <slug> [--origin <url>] [--tool <name>] [--arguments <json>] [--access-token <token>]");let i=await s.getOrganizationMcpServer(r),c=N(i,e),p=D(c,e),a=typeof e.tool=="string"&&e.tool.trim()?e.tool.trim():typeof e.toolName=="string"&&e.toolName.trim()?e.toolName.trim():"estimate_search_history",l=F(e),d=typeof e.accessToken=="string"&&e.accessToken.trim()?e.accessToken.trim():"",m=await q({resourceUrl:c,origin:p,toolName:a,toolArguments:l,...d?{accessToken:d}:{}});console.log(JSON.stringify({mcpServer:i,probe:m},null,2));return}if(n==="mcp-authorize"||n==="mcp-oauth"){let r=t[1];if(!r)throw new Error("usage: organizations mcp-authorize <slug> [--origin <url>] [--scope <csv|space>] [--tool <name>] [--arguments <json>] [--open]");let i=await s.getOrganizationMcpServer(r),c=N(i,e),p=D(c,e),a=me(e),l=pe(e),d=$(18),m=$(48),f=de(m),g=await he({expectedState:d,port:ge(e),timeoutMs:fe(e)}),P=Pe({authorizationEndpoint:`${p}/oauth/authorize`,clientId:a,codeChallenge:f,redirectUri:g.redirectUri,resourceUrl:c,scopes:l,state:d});if(console.error("Open this URL to authorize the organization MCP connection:"),console.error(P),console.error(`Waiting for OAuth callback on ${g.redirectUri}`),b(e.open))try{ye(P)}catch(A){console.error(`Unable to open a browser automatically: ${A instanceof Error?A.message:String(A)}`)}try{let A=await g.waitForCallback(),y=await Ae({clientId:a,code:A.code,codeVerifier:m,origin:p,redirectUri:g.redirectUri}),K=typeof e.tool=="string"&&e.tool.trim()?e.tool.trim():typeof e.toolName=="string"&&e.toolName.trim()?e.toolName.trim():"estimate_search_history",G=F(e),W=await q({accessToken:y.access_token,origin:p,resourceUrl:c,toolArguments:G,toolName:K}),V=b(e.printToken);console.log(JSON.stringify({mcpServer:i,oauth:{accessTokenReceived:!0,clientId:a,expiresIn:y.expires_in??null,refreshTokenReceived:!!y.refresh_token,scope:y.scope??l.join(" "),tokenType:y.token_type??"Bearer",...V?{accessToken:y.access_token,refreshToken:y.refresh_token??null}:{}},probe:W},null,2))}finally{await g.close()}return}if(n==="mcp-rotate"||n==="mcp-disable"||n==="mcp-enable"){let r=t[1];if(!r)throw new Error(`usage: organizations ${n} <slug>`);let i=n==="mcp-rotate"?await s.rotateOrganizationMcpServer(r):n==="mcp-disable"?await s.disableOrganizationMcpServer(r):await s.enableOrganizationMcpServer(r);console.log(JSON.stringify({mcpServer:i},null,2));return}throw new Error("usage: organizations <list|create|get|update|members|member-upsert|mcp-get|mcp-generate|mcp-probe|mcp-authorize|mcp-rotate|mcp-disable|mcp-enable> [args]")}o(Nn,"runOrganizationsCommand");export{ue as DEFAULT_MCP_AUTHORIZE_SCOPES,we as buildMcpJsonRpcRequest,Pe as buildMcpOAuthAuthorizeUrl,de as buildMcpOauthPkceChallenge,be as buildOrganizationCreateInput,Ce as buildOrganizationMcpGenerateInput,xe as buildOrganizationMemberInput,ke as buildOrganizationUpdateInput,j as closeServer,Ae as exchangeMcpOAuthAuthorizationCode,U as fetchMcpProbe,ae as formatOrganizationLine,ce as formatOrganizationMcpServerLine,le as formatOrganizationMemberLine,O as normalizeMcpResourceUrl,ye as openUrlWithSystemBrowser,pe as parseMcpOAuthScopes,F as parseMcpToolArguments,Oe as parseOrganizationRole,R as postMcpJsonRpcProbe,q as probeOrganizationMcp,$ as randomOauthToken,J as readMcpProbeBody,ge as resolveMcpOAuthCallbackPort,me as resolveMcpOAuthClientId,fe as resolveMcpOAuthTimeoutMs,D as resolveMcpProbeOrigin,N as resolveMcpProbeResourceUrl,Nn as runOrganizationsCommand,he as startMcpOAuthCallbackListener};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{i as Ie,j as K,k as W,r as $e,s as Re}from"./chunk-ZRDGQDZL.js";import{m as G}from"./chunk-RAXOSUSW.js";import"./chunk-DARVPBZ4.js";import"./chunk-M4JWQSV7.js";import"./chunk-FV2R5RUN.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c as f,d as B,f as S}from"./chunk-3M53YXEI.js";import{e as ie}from"./chunk-H6IW2R22.js";import{a as fe}from"./chunk-L3KS6MOV.js";import"./chunk-DZUAT3TP.js";import"./chunk-XDQMGUWL.js";import"./chunk-FTEOCCPB.js";import{la as ue}from"./chunk-25MBPJVY.js";import"./chunk-WN3V6KDN.js";import"./chunk-523TE4BI.js";import"./chunk-ZCHXGRRU.js";import"./chunk-X37KMV27.js";import{G as Pe,I as ke,J as ye,K as R,e as Q,f as he,g as X,h as ge,i as me,j as pe,q as ee,s as Se,t as we,x}from"./chunk-LQQNBVEB.js";import"./chunk-EKM2D7JU.js";import"./chunk-5MCNZCVQ.js";import"./chunk-BT5YNE5U.js";import"./chunk-Q5LEXXJG.js";import"./chunk-FWIPHEVA.js";import"./chunk-OS3LO5J3.js";import"./chunk-GLUWATL5.js";import"./chunk-QDC4OW3S.js";import"./chunk-ZZWAQBA2.js";import"./chunk-YR5ID2SS.js";import"./chunk-YBT2NB32.js";import"./chunk-74ZXXBGN.js";import"./chunk-APB2STJK.js";import"./chunk-I7AQMAQI.js";import"./chunk-Z4Z5UOZM.js";import"./chunk-EAPFMACH.js";import"./chunk-6FA3GG5B.js";import"./chunk-Y4OWBBDD.js";import"./chunk-6ZFPQYHG.js";import"./chunk-JFXWI3EN.js";import"./chunk-FFRFSDBM.js";import"./chunk-VYLGI3IH.js";import{$a as de,Xa as le,Ya as ce,c as ae}from"./chunk-ACYFMLWG.js";import"./chunk-TVQAPBLZ.js";import"./chunk-KGNCKIFP.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as i}from"./chunk-FTQLQJQV.js";import{readFile as qe}from"node:fs/promises";import L from"node:path";import{promises as A}from"node:fs";import b from"node:path";async function oe(e,t){let o=b.join(e,t),n=await A.lstat(o).catch(l=>{if(l.code==="ENOENT")return null;throw l});if(!n)return[];if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`Profile source directory is not a regular directory: ${t}`);let a=[];for(let l of await A.readdir(o,{withFileTypes:!0})){let h=b.join(o,l.name),d=b.relative(e,h).split(b.sep).join("/");if(l.isSymbolicLink())throw new Error(`Profile source contains a symlink: ${d}`);if(l.isDirectory())a.push(...await oe(e,d));else if(l.isFile())a.push(d);else throw new Error(`Profile source contains a non-regular file: ${d}`)}return a.sort()}i(oe,"sourceFiles");async function Ce(e,t=new Set){let{skills:o,skillCatalog:n}=await fe(e);if(n.error)throw new Error(`Profile Skills: ${n.error}`);for(let s of o)if(s.validationStatus!=="valid")throw new Error(`Profile Skill ${s.name}: ${s.validationMessages.join(" ")}`);let a=new Set(o.map(s=>s.path)),l=[...await oe(e,"workflows"),...await oe(e,"evals")].sort(),h=l.filter(s=>s.startsWith("workflows/")),d=h.some(s=>/^workflows\/[^/]+\/(PROMPT\.md|ACTION\.json)$/.test(s)),u=h.includes("workflows/catalog.json");if(d&&u)throw new Error("Workflow packages and legacy workflows/catalog.json cannot coexist.");let y=d?ie({files:new Map(await Promise.all(h.map(async s=>[s,await A.readFile(b.join(e,s),"utf8")]))),skillPaths:a,actionIds:t}).catalog:u?ae({catalog:JSON.parse(await A.readFile(b.join(e,"workflows/catalog.json"),"utf8")),sourcePaths:a,actionIds:t}):{workflows:[]},$=new Set(y.workflows.map(s=>s.id)),C=l.filter(s=>/^workflows\/[^/]+\/evals\/[^/]+\.json$/.test(s)||/^evals\/definitions\/[^/]+\.json$/.test(s)),w=l.filter(s=>/^evals\/suites\/[^/]+\.json$/.test(s));if(l.includes("evals/catalog.json")&&(C.length||w.length))throw new Error("Evaluation packages and legacy evals/catalog.json cannot coexist.");let j=await Promise.all(C.map(async s=>{let r=le.parse(JSON.parse(await A.readFile(b.join(e,s),"utf8"))),m=/^workflows\/([^/]+)\/evals\//.exec(s)?.[1];if(m&&(r.target.kind!=="workflow"||r.target.workflowId!==m))throw new Error(`Evaluation ${r.id} must target its containing Workflow ${m}.`);return r})),N=await Promise.all(w.map(async s=>ce.parse(JSON.parse(await A.readFile(b.join(e,s),"utf8"))))),_=l.includes("evals/catalog.json")?JSON.parse(await A.readFile(b.join(e,"evals/catalog.json"),"utf8")):{schemaVersion:"openpond.profileEvaluations.v1",definitions:j,suites:N},P=de({catalog:_,workflowIds:$,skillPaths:a,actionIds:t}).catalog,g=l.filter(s=>/^evals\/tasksets\/[^/]+\.json$/.test(s)),O=new Map;for(let s of g){let r=ue(JSON.parse(await A.readFile(b.join(e,s),"utf8"))).taskset;if(s!==`evals/tasksets/${r.contentHash}.json`)throw new Error(`Frozen Taskset file name differs from its content hash: ${s}.`);O.set(r.contentHash,r)}for(let s of P.definitions){let r=s.tasksetRelease.contentHash,m=`evals/tasksets/${r}.json`,H=O.get(r);if(!H)throw new Error(`Evaluation ${s.id} is missing Taskset ${m}.`);if(H.id!==s.tasksetRelease.id||H.contentHash!==r)throw new Error(`Evaluation ${s.id} references a different frozen Taskset.`);let E=new Set(H.tasks.filter(k=>k.split===s.split).map(k=>k.id));for(let k of s.taskIds)if(!E.has(k))throw new Error(`Evaluation ${s.id} references missing Taskset case ${k} in split ${s.split}.`)}return{workflows:y.workflows.length,skills:o.length,evaluations:P.definitions.length,tasksets:O.size}}i(Ce,"checkLocalProfileSource");import te from"node:path";async function Ae(e){if(!e.state.sourcePath)throw new Error("Active OpenPond profile is missing a source path.");let t=e.state.agents.find(s=>s.id===e.agentId);if(!t)throw new Error(`Profile agent not found for hosted materialization: ${e.agentId}`);if(!t.enabled)throw new Error(`Profile agent is disabled: ${e.agentId}`);let o=xe(e.state.sourcePath,t.path),n=await Ie(o),a=await K(o,n.entries),l=W(n,a.entries),h=await Me({client:e.client,teamId:e.teamId,projectId:e.projectId??null,profileProjectId:e.profileProjectId,profileName:e.profileName,agentId:e.agentId,localHead:e.localHead,hostedHead:e.hostedHead}),d=await e.client.projects.uploadSource(h.id,{teamId:e.teamId,entries:l.entries,branch:e.sourceRef,commitMessage:`Materialize OpenPond profile agent ${e.agentId}`}),u=await e.client.projects.sync(d.id,{teamId:e.teamId}),y=be(u)??be(d),$=je(u)??je(d)??e.sourceRef,C=`openpond-profile-agent:${e.profileProjectId}:${e.profileName}:${e.agentId}`,w=(await e.client.agents.list({teamId:e.teamId})).find(s=>s.externalId===C),j=await e.client.agents.upsert({teamId:e.teamId,projectId:u.id,name:t.name||e.agentId,slug:_e(e.profileName,e.agentId),selectedEntrypoint:Ne(e.state,e.agentId),triggerType:"manual",runtimeSource:{mode:"latest_source",...$?{sourceRef:$}:{},...y?{sourceCommitSha:y}:{}},metadata:{...w?.metadata??{},source:"openpond_profile_agent_materialization",profileProjectId:e.profileProjectId,profileName:e.profileName,profileAgentId:e.agentId,profileSourcePath:t.path,localHead:e.localHead,hostedHead:e.hostedHead},externalId:C}),N=v(a.uploadMetadata),_=v(N?.commands),P=v(N?.dependencySetup),g=Ue(P?.commands),O=[I(_?.validate),I(_?.eval)].filter(s=>!!s);return{status:"uploaded",agentId:e.agentId,runtimeAgentId:j.id,projectId:u.id,sourceRoot:o,sourceRef:$,sourceCommitSha:y??null,manifestHash:u.sandboxManifestHash??null,manifestPath:u.sandboxManifestPath??null,manifestSyncedAt:u.sandboxManifestSyncedAt??null,fileCount:l.fileCount,totalBytes:l.totalBytes,generatedManifestPath:a.generatedManifestPath,synthesizedOpenPondYaml:a.synthesizedOpenPondYaml,uploadMetadataPath:a.uploadMetadataPath,setupCommands:g,validationCommands:O,materializedAt:new Date().toISOString()}}i(Ae,"materializeHostedProfileAgentSource");async function Me(e){if(e.projectId)try{return await e.client.projects.get(e.projectId,{teamId:e.teamId})}catch{}return e.client.projects.upsert({teamId:e.teamId,name:`OpenPond profile ${e.profileName} ${e.agentId}`,sourceType:"manual",externalId:`openpond-profile:${e.profileProjectId}:${e.profileName}:${e.agentId}`,description:`Materialized OpenPond profile agent ${e.agentId} for hosted Team execution.`,metadata:{source:"openpond_profile_agent_materialization",profileProjectId:e.profileProjectId,profileName:e.profileName,profileAgentId:e.agentId,localHead:e.localHead,hostedHead:e.hostedHead}})}i(Me,"getOrCreateHostedSourceProject");function xe(e,t){let o=t.replace(/\\/g,"/"),n=te.resolve(e,o),a=te.relative(e,n);if(a.startsWith("..")||te.isAbsolute(a))throw new Error(`Profile agent path escapes profile source: ${t}`);return o==="agent/agent.ts"||o.endsWith("/agent.ts")?e:n}i(xe,"resolveProfileAgentSourceRoot");function Ne(e,t){let o=e.actionCatalog.find(n=>n.agentId===t&&(n.sourceActionId==="chat"||n.name==="chat"))??e.actionCatalog.find(n=>n.agentId===t);return{scope:"action",name:typeof o?.sourceActionId=="string"&&o.sourceActionId||typeof o?.name=="string"&&o.name||"chat"}}i(Ne,"hostedEntrypointForProfileAgent");function _e(e,t){return`openpond-profile-${e}-${t}`.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"openpond-profile-agent"}i(_e,"hostedRuntimeAgentSlug");function be(e){let t=v(e),o=v(t?.sourceConfig),n=v(t?.metadata);return I(o?.sourceCommitSha)??I(o?.commitSha)??I(o?.remoteSha)??I(n?.projectSourceUploadCommitSha)??I(n?.sourceCommitSha)??I(t?.templateRemoteSha)}i(be,"sandboxProjectSourceCommitSha");function je(e){let t=v(e),o=v(t?.sourceConfig);return I(o?.sourceRef)??I(o?.branch)??I(t?.gitBranch)??I(t?.defaultBranch)}i(je,"sandboxProjectSourceRef");function v(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}i(v,"record");function I(e){return typeof e=="string"&&e.trim()?e.trim():null}i(I,"text");function Ue(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}i(Ue,"stringArray");import{createHash as Fe,randomUUID as Le}from"node:crypto";function ve(e){let t=e.explicitKey?.trim();if(t)return t;let o=e.sourceHead?.trim()||"unknown-source",n=e.targetProjectId?.trim()||"no-target-project",a=Te(e.input).slice(0,16),l=`profile-push-run:${e.localHead}:${o}:${e.runtimeAgentId}:${n}:${a}`;return e.retry?`${l}:retry:${(e.randomId??Le)()}`:l}i(ve,"buildHostedRunIdempotencyKey");function Te(e){return Fe("sha256").update(ne(e)).digest("hex")}i(Te,"hashStableJson");function ne(e){return e===void 0?"undefined":e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(t=>ne(t)).join(",")}]`:`{${Object.entries(e).sort(([t],[o])=>t.localeCompare(o)).map(([t,o])=>`${JSON.stringify(t)}:${ne(o)}`).join(",")}}`}i(ne,"stableJsonStringify");async function zo(e){let t=await Se({repoPath:f(e,"path")||ee(),profile:f(e,"profile")||"default",template:f(e,"template")||"blank-agent",force:S(e.force)});if(S(e.json)){console.log(JSON.stringify(t,null,2));return}console.log(`Initialized OpenPond profile ${t.activeProfile} at ${t.repoPath}`),console.log(`Profile source: ${t.sourcePath}`)}i(zo,"runOpenPondInitCommand");async function Mo(e,t){let o=t[0]??"current";if(o==="load"){let n=f(e,"path")||t[1];if(!n)throw new Error("usage: openpond profile load --path <dir> [--profile <name>]");let a=await we(n,f(e,"profile")||void 0);if(S(e.json)){console.log(JSON.stringify(a,null,2));return}console.log(`Loaded OpenPond profile ${a.activeProfile} from ${a.repoPath}`);return}if(o==="current"||o==="status"){let n=await x();if(S(e.json)){console.log(JSON.stringify(n,null,2));return}re(n);return}if(o==="diff"){let n=await x();if(S(e.json)){console.log(JSON.stringify({diff:n.diff,profile:n},null,2));return}to(n);return}if(o==="catalog"){let n=await x();if(S(e.json)){console.log(JSON.stringify({catalog:n.catalog,actions:n.actionCatalog,profile:n},null,2));return}no(n);return}if(o==="commit"){await Je(e,t.slice(1));return}if(o==="push"){await De(e);return}if(o==="check"){let n=f(e,"kind")||t[1]||"all";if(!["all","inspect","build","validate","eval"].includes(n))throw new Error("check kind must be one of inspect, build, validate, eval, all");if(n==="all"||n==="validate"){let a=await x();if(!a.sourcePath)throw new Error("No active Profile source to validate.");let l=await Ce(a.sourcePath,new Set(a.actionCatalog.map(h=>h.id)));console.log(`Profile source valid: ${l.workflows} Workflows, ${l.skills} Skills, ${l.evaluations} evaluations, ${l.tasksets} frozen Tasksets.`)}await ke(n);return}if(o==="ensure-hosted"){await He(e);return}if(o==="hosted"){let n=t[1]??"status";if(n==="ensure"){await He(e);return}if(n==="status"||n==="current"){await eo(e);return}throw new Error("usage: openpond profile hosted [status|ensure] --team-id <id> [--json]")}if(o==="agents"){if((t[1]??"list")!=="list")throw new Error("usage: openpond profile agents list [--json]");await oo(e,["list"]);return}throw new Error("usage: openpond profile <status|diff|catalog|commit|push|load|check|agents|hosted|ensure-hosted> [args]")}i(Mo,"runOpenPondProfileCommand");async function Je(e,t){let o=f(e,"message")||f(e,"commitMessage")||t.join(" ").trim()||void 0,n=await ye(o);if(S(e.json)){console.log(JSON.stringify(n,null,2));return}if(!n.committed){console.log("No profile changes to commit."),re(n.state);return}console.log("Committed OpenPond profile changes."),n.stdout.trim()&&console.log(n.stdout.trim()),re(n.state)}i(Je,"runProfileCommitCommand");async function De(e){let t=B(e,"usage: openpond profile push"),o=await x();if(o.error)throw new Error(o.error);if(!o.repoPath||!o.sourcePath||!o.manifestPath)throw new Error("No active OpenPond profile. Run `openpond init`.");if(!o.git?.isRepo)throw new Error("Active OpenPond profile source is not Git-backed. Run `openpond init` or reload a Git-backed profile.");if(!o.git.head)throw new Error("Profile source must have a committed Git head before push. Run `openpond profile commit` first.");if(o.git.dirty)throw new Error("Profile source has uncommitted changes. Run `openpond profile commit` before push.");let n=await G(e),a=S(e.ensureHosted)?await n.profile.ensureHosted({teamId:t}):await n.profile.get({teamId:t});if(!a)throw new Error("No hosted OpenPond profile repo found. Run `openpond profile ensure-hosted --team-id <id>` first, or pass `--ensure-hosted` to push.");let l=S(e.force),h=a.sourceUpload?.sourceCommitSha??null,d=o.hosted?.sourceCommitSha??null;if(d&&h!==d&&!l)throw new Error(["Hosted profile source changed since the last local push.",`Last pushed hosted head: ${d}`,`Current hosted head: ${h??"none"}`,"Inspect hosted changes before pushing, or rerun with --force to overwrite explicitly."].join(`
|
|
2
|
+
import{i as Ie,j as K,k as W,r as $e,s as Re}from"./chunk-SLZH4Z6C.js";import{m as G}from"./chunk-ISFIDCIH.js";import"./chunk-23P2O7PH.js";import"./chunk-AW5Q6NXT.js";import"./chunk-YVNDDNMK.js";import"./chunk-XRKFTPHD.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c as f,d as B,f as S}from"./chunk-3M53YXEI.js";import{e as ie}from"./chunk-7YTHEMWI.js";import{a as fe}from"./chunk-L3KS6MOV.js";import"./chunk-DZUAT3TP.js";import"./chunk-H3BSIAQO.js";import"./chunk-637UACKH.js";import{la as ue}from"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-X37KMV27.js";import{G as Pe,I as ke,J as ye,K as R,e as Q,f as he,g as X,h as ge,i as me,j as pe,q as ee,s as Se,t as we,x}from"./chunk-ONDCV5QC.js";import"./chunk-YDU3S6UT.js";import"./chunk-EL454L26.js";import"./chunk-BT5YNE5U.js";import"./chunk-PXS4SVQG.js";import"./chunk-FWIPHEVA.js";import"./chunk-ENSB6ZTM.js";import"./chunk-GLUWATL5.js";import"./chunk-RYGWCN2R.js";import"./chunk-ZZWAQBA2.js";import"./chunk-YR5ID2SS.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-ERJV5BMC.js";import"./chunk-6FA3GG5B.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-SFNCAPCJ.js";import{c as ae,gb as le,hb as ce,kb as de}from"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as i}from"./chunk-FTQLQJQV.js";import{readFile as qe}from"node:fs/promises";import L from"node:path";import{promises as A}from"node:fs";import b from"node:path";async function oe(e,t){let o=b.join(e,t),n=await A.lstat(o).catch(l=>{if(l.code==="ENOENT")return null;throw l});if(!n)return[];if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`Profile source directory is not a regular directory: ${t}`);let a=[];for(let l of await A.readdir(o,{withFileTypes:!0})){let h=b.join(o,l.name),d=b.relative(e,h).split(b.sep).join("/");if(l.isSymbolicLink())throw new Error(`Profile source contains a symlink: ${d}`);if(l.isDirectory())a.push(...await oe(e,d));else if(l.isFile())a.push(d);else throw new Error(`Profile source contains a non-regular file: ${d}`)}return a.sort()}i(oe,"sourceFiles");async function Ce(e,t=new Set){let{skills:o,skillCatalog:n}=await fe(e);if(n.error)throw new Error(`Profile Skills: ${n.error}`);for(let s of o)if(s.validationStatus!=="valid")throw new Error(`Profile Skill ${s.name}: ${s.validationMessages.join(" ")}`);let a=new Set(o.map(s=>s.path)),l=[...await oe(e,"workflows"),...await oe(e,"evals")].sort(),h=l.filter(s=>s.startsWith("workflows/")),d=h.some(s=>/^workflows\/[^/]+\/(PROMPT\.md|ACTION\.json)$/.test(s)),u=h.includes("workflows/catalog.json");if(d&&u)throw new Error("Workflow packages and legacy workflows/catalog.json cannot coexist.");let y=d?ie({files:new Map(await Promise.all(h.map(async s=>[s,await A.readFile(b.join(e,s),"utf8")]))),skillPaths:a,actionIds:t}).catalog:u?ae({catalog:JSON.parse(await A.readFile(b.join(e,"workflows/catalog.json"),"utf8")),sourcePaths:a,actionIds:t}):{workflows:[]},$=new Set(y.workflows.map(s=>s.id)),C=l.filter(s=>/^workflows\/[^/]+\/evals\/[^/]+\.json$/.test(s)||/^evals\/definitions\/[^/]+\.json$/.test(s)),w=l.filter(s=>/^evals\/suites\/[^/]+\.json$/.test(s));if(l.includes("evals/catalog.json")&&(C.length||w.length))throw new Error("Evaluation packages and legacy evals/catalog.json cannot coexist.");let j=await Promise.all(C.map(async s=>{let r=le.parse(JSON.parse(await A.readFile(b.join(e,s),"utf8"))),m=/^workflows\/([^/]+)\/evals\//.exec(s)?.[1];if(m&&(r.target.kind!=="workflow"||r.target.workflowId!==m))throw new Error(`Evaluation ${r.id} must target its containing Workflow ${m}.`);return r})),N=await Promise.all(w.map(async s=>ce.parse(JSON.parse(await A.readFile(b.join(e,s),"utf8"))))),_=l.includes("evals/catalog.json")?JSON.parse(await A.readFile(b.join(e,"evals/catalog.json"),"utf8")):{schemaVersion:"openpond.profileEvaluations.v1",definitions:j,suites:N},P=de({catalog:_,workflowIds:$,skillPaths:a,actionIds:t}).catalog,g=l.filter(s=>/^evals\/tasksets\/[^/]+\.json$/.test(s)),O=new Map;for(let s of g){let r=ue(JSON.parse(await A.readFile(b.join(e,s),"utf8"))).taskset;if(s!==`evals/tasksets/${r.contentHash}.json`)throw new Error(`Frozen Taskset file name differs from its content hash: ${s}.`);O.set(r.contentHash,r)}for(let s of P.definitions){let r=s.tasksetRelease.contentHash,m=`evals/tasksets/${r}.json`,H=O.get(r);if(!H)throw new Error(`Evaluation ${s.id} is missing Taskset ${m}.`);if(H.id!==s.tasksetRelease.id||H.contentHash!==r)throw new Error(`Evaluation ${s.id} references a different frozen Taskset.`);let E=new Set(H.tasks.filter(k=>k.split===s.split).map(k=>k.id));for(let k of s.taskIds)if(!E.has(k))throw new Error(`Evaluation ${s.id} references missing Taskset case ${k} in split ${s.split}.`)}return{workflows:y.workflows.length,skills:o.length,evaluations:P.definitions.length,tasksets:O.size}}i(Ce,"checkLocalProfileSource");import te from"node:path";async function Ae(e){if(!e.state.sourcePath)throw new Error("Active OpenPond profile is missing a source path.");let t=e.state.agents.find(s=>s.id===e.agentId);if(!t)throw new Error(`Profile agent not found for hosted materialization: ${e.agentId}`);if(!t.enabled)throw new Error(`Profile agent is disabled: ${e.agentId}`);let o=xe(e.state.sourcePath,t.path),n=await Ie(o),a=await K(o,n.entries),l=W(n,a.entries),h=await Me({client:e.client,teamId:e.teamId,projectId:e.projectId??null,profileProjectId:e.profileProjectId,profileName:e.profileName,agentId:e.agentId,localHead:e.localHead,hostedHead:e.hostedHead}),d=await e.client.projects.uploadSource(h.id,{teamId:e.teamId,entries:l.entries,branch:e.sourceRef,commitMessage:`Materialize OpenPond profile agent ${e.agentId}`}),u=await e.client.projects.sync(d.id,{teamId:e.teamId}),y=be(u)??be(d),$=je(u)??je(d)??e.sourceRef,C=`openpond-profile-agent:${e.profileProjectId}:${e.profileName}:${e.agentId}`,w=(await e.client.agents.list({teamId:e.teamId})).find(s=>s.externalId===C),j=await e.client.agents.upsert({teamId:e.teamId,projectId:u.id,name:t.name||e.agentId,slug:_e(e.profileName,e.agentId),selectedEntrypoint:Ne(e.state,e.agentId),triggerType:"manual",runtimeSource:{mode:"latest_source",...$?{sourceRef:$}:{},...y?{sourceCommitSha:y}:{}},metadata:{...w?.metadata??{},source:"openpond_profile_agent_materialization",profileProjectId:e.profileProjectId,profileName:e.profileName,profileAgentId:e.agentId,profileSourcePath:t.path,localHead:e.localHead,hostedHead:e.hostedHead},externalId:C}),N=v(a.uploadMetadata),_=v(N?.commands),P=v(N?.dependencySetup),g=Ue(P?.commands),O=[I(_?.validate),I(_?.eval)].filter(s=>!!s);return{status:"uploaded",agentId:e.agentId,runtimeAgentId:j.id,projectId:u.id,sourceRoot:o,sourceRef:$,sourceCommitSha:y??null,manifestHash:u.sandboxManifestHash??null,manifestPath:u.sandboxManifestPath??null,manifestSyncedAt:u.sandboxManifestSyncedAt??null,fileCount:l.fileCount,totalBytes:l.totalBytes,generatedManifestPath:a.generatedManifestPath,synthesizedOpenPondYaml:a.synthesizedOpenPondYaml,uploadMetadataPath:a.uploadMetadataPath,setupCommands:g,validationCommands:O,materializedAt:new Date().toISOString()}}i(Ae,"materializeHostedProfileAgentSource");async function Me(e){if(e.projectId)try{return await e.client.projects.get(e.projectId,{teamId:e.teamId})}catch{}return e.client.projects.upsert({teamId:e.teamId,name:`OpenPond profile ${e.profileName} ${e.agentId}`,sourceType:"manual",externalId:`openpond-profile:${e.profileProjectId}:${e.profileName}:${e.agentId}`,description:`Materialized OpenPond profile agent ${e.agentId} for hosted Team execution.`,metadata:{source:"openpond_profile_agent_materialization",profileProjectId:e.profileProjectId,profileName:e.profileName,profileAgentId:e.agentId,localHead:e.localHead,hostedHead:e.hostedHead}})}i(Me,"getOrCreateHostedSourceProject");function xe(e,t){let o=t.replace(/\\/g,"/"),n=te.resolve(e,o),a=te.relative(e,n);if(a.startsWith("..")||te.isAbsolute(a))throw new Error(`Profile agent path escapes profile source: ${t}`);return o==="agent/agent.ts"||o.endsWith("/agent.ts")?e:n}i(xe,"resolveProfileAgentSourceRoot");function Ne(e,t){let o=e.actionCatalog.find(n=>n.agentId===t&&(n.sourceActionId==="chat"||n.name==="chat"))??e.actionCatalog.find(n=>n.agentId===t);return{scope:"action",name:typeof o?.sourceActionId=="string"&&o.sourceActionId||typeof o?.name=="string"&&o.name||"chat"}}i(Ne,"hostedEntrypointForProfileAgent");function _e(e,t){return`openpond-profile-${e}-${t}`.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"openpond-profile-agent"}i(_e,"hostedRuntimeAgentSlug");function be(e){let t=v(e),o=v(t?.sourceConfig),n=v(t?.metadata);return I(o?.sourceCommitSha)??I(o?.commitSha)??I(o?.remoteSha)??I(n?.projectSourceUploadCommitSha)??I(n?.sourceCommitSha)??I(t?.templateRemoteSha)}i(be,"sandboxProjectSourceCommitSha");function je(e){let t=v(e),o=v(t?.sourceConfig);return I(o?.sourceRef)??I(o?.branch)??I(t?.gitBranch)??I(t?.defaultBranch)}i(je,"sandboxProjectSourceRef");function v(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}i(v,"record");function I(e){return typeof e=="string"&&e.trim()?e.trim():null}i(I,"text");function Ue(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}i(Ue,"stringArray");import{createHash as Fe,randomUUID as Le}from"node:crypto";function ve(e){let t=e.explicitKey?.trim();if(t)return t;let o=e.sourceHead?.trim()||"unknown-source",n=e.targetProjectId?.trim()||"no-target-project",a=Te(e.input).slice(0,16),l=`profile-push-run:${e.localHead}:${o}:${e.runtimeAgentId}:${n}:${a}`;return e.retry?`${l}:retry:${(e.randomId??Le)()}`:l}i(ve,"buildHostedRunIdempotencyKey");function Te(e){return Fe("sha256").update(ne(e)).digest("hex")}i(Te,"hashStableJson");function ne(e){return e===void 0?"undefined":e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(t=>ne(t)).join(",")}]`:`{${Object.entries(e).sort(([t],[o])=>t.localeCompare(o)).map(([t,o])=>`${JSON.stringify(t)}:${ne(o)}`).join(",")}}`}i(ne,"stableJsonStringify");async function zo(e){let t=await Se({repoPath:f(e,"path")||ee(),profile:f(e,"profile")||"default",template:f(e,"template")||"blank-agent",force:S(e.force)});if(S(e.json)){console.log(JSON.stringify(t,null,2));return}console.log(`Initialized OpenPond profile ${t.activeProfile} at ${t.repoPath}`),console.log(`Profile source: ${t.sourcePath}`)}i(zo,"runOpenPondInitCommand");async function Mo(e,t){let o=t[0]??"current";if(o==="load"){let n=f(e,"path")||t[1];if(!n)throw new Error("usage: openpond profile load --path <dir> [--profile <name>]");let a=await we(n,f(e,"profile")||void 0);if(S(e.json)){console.log(JSON.stringify(a,null,2));return}console.log(`Loaded OpenPond profile ${a.activeProfile} from ${a.repoPath}`);return}if(o==="current"||o==="status"){let n=await x();if(S(e.json)){console.log(JSON.stringify(n,null,2));return}re(n);return}if(o==="diff"){let n=await x();if(S(e.json)){console.log(JSON.stringify({diff:n.diff,profile:n},null,2));return}to(n);return}if(o==="catalog"){let n=await x();if(S(e.json)){console.log(JSON.stringify({catalog:n.catalog,actions:n.actionCatalog,profile:n},null,2));return}no(n);return}if(o==="commit"){await Je(e,t.slice(1));return}if(o==="push"){await De(e);return}if(o==="check"){let n=f(e,"kind")||t[1]||"all";if(!["all","inspect","build","validate","eval"].includes(n))throw new Error("check kind must be one of inspect, build, validate, eval, all");if(n==="all"||n==="validate"){let a=await x();if(!a.sourcePath)throw new Error("No active Profile source to validate.");let l=await Ce(a.sourcePath,new Set(a.actionCatalog.map(h=>h.id)));console.log(`Profile source valid: ${l.workflows} Workflows, ${l.skills} Skills, ${l.evaluations} evaluations, ${l.tasksets} frozen Tasksets.`)}await ke(n);return}if(o==="ensure-hosted"){await He(e);return}if(o==="hosted"){let n=t[1]??"status";if(n==="ensure"){await He(e);return}if(n==="status"||n==="current"){await eo(e);return}throw new Error("usage: openpond profile hosted [status|ensure] --team-id <id> [--json]")}if(o==="agents"){if((t[1]??"list")!=="list")throw new Error("usage: openpond profile agents list [--json]");await oo(e,["list"]);return}throw new Error("usage: openpond profile <status|diff|catalog|commit|push|load|check|agents|hosted|ensure-hosted> [args]")}i(Mo,"runOpenPondProfileCommand");async function Je(e,t){let o=f(e,"message")||f(e,"commitMessage")||t.join(" ").trim()||void 0,n=await ye(o);if(S(e.json)){console.log(JSON.stringify(n,null,2));return}if(!n.committed){console.log("No profile changes to commit."),re(n.state);return}console.log("Committed OpenPond profile changes."),n.stdout.trim()&&console.log(n.stdout.trim()),re(n.state)}i(Je,"runProfileCommitCommand");async function De(e){let t=B(e,"usage: openpond profile push"),o=await x();if(o.error)throw new Error(o.error);if(!o.repoPath||!o.sourcePath||!o.manifestPath)throw new Error("No active OpenPond profile. Run `openpond init`.");if(!o.git?.isRepo)throw new Error("Active OpenPond profile source is not Git-backed. Run `openpond init` or reload a Git-backed profile.");if(!o.git.head)throw new Error("Profile source must have a committed Git head before push. Run `openpond profile commit` first.");if(o.git.dirty)throw new Error("Profile source has uncommitted changes. Run `openpond profile commit` before push.");let n=await G(e),a=S(e.ensureHosted)?await n.profile.ensureHosted({teamId:t}):await n.profile.get({teamId:t});if(!a)throw new Error("No hosted OpenPond profile repo found. Run `openpond profile ensure-hosted --team-id <id>` first, or pass `--ensure-hosted` to push.");let l=S(e.force),h=a.sourceUpload?.sourceCommitSha??null,d=o.hosted?.sourceCommitSha??null;if(d&&h!==d&&!l)throw new Error(["Hosted profile source changed since the last local push.",`Last pushed hosted head: ${d}`,`Current hosted head: ${h??"none"}`,"Inspect hosted changes before pushing, or rerun with --force to overwrite explicitly."].join(`
|
|
3
3
|
`));let u=f(e,"hostedSourceAgentId"),y=S(e.hostedSourceChecks),$=S(e.publishHostedSource),C=f(e,"hostedRunAgentId"),w=u||(y||$?C:null),j=JSON.parse(await qe(o.manifestPath,"utf8")),N=Ge(j),_=j.profiles[o.activeProfile??j.defaultProfile]?.path??"profiles/default",P=await Ke({state:o,hostedSourceAgentId:w}),g=await n.profile.push({teamId:t,entries:P.entries,branch:o.git.branch??"main",commitMessage:f(e,"commitMessage")||f(e,"message")||`Push OpenPond profile ${o.activeProfile??"default"} at ${o.git.shortHead??o.git.head}`,expectedSourceCommitSha:h,localHeadSha:o.git.head,manifest:N,sourcePath:_,agents:o.agents.map(c=>({id:c.id,path:c.path,enabled:c.enabled}))}),O=new Date().toISOString(),s=o.hosted?.lastPushedLocalHead===o.git.head&&o.hosted?.sourceCommitSha===g.sourceUpload.sourceCommitSha,r={status:"pushed",promotionStatus:s?o.hosted?.promotionStatus??"uploaded":"uploaded",hostedRunStatus:s?o.hosted?.hostedRunStatus??"not_started":"not_started",pushedAt:O,teamId:t,projectId:g.profile.project.id,localHead:o.git.head,hostedHead:g.sourceUpload.sourceCommitSha,sourceRef:g.sourceUpload.sourceRef,hostedRunAgentId:s?o.hosted?.hostedRunAgentId??null:null,hostedRunId:s?o.hosted?.hostedRunId??null:null,hostedRunAt:s?o.hosted?.hostedRunAt??null:null,hostedSourceMaterialization:s?o.hosted?.hostedSourceMaterialization??null:null,hostedSourceCheck:s?o.hosted?.hostedSourceCheck??null:null,hostedPublish:s?o.hosted?.hostedPublish??null:null,hostedRun:s?o.hosted?.hostedRun??null:null};await R(r);let m=w??Ve(o,C),H=Re(e.hostedSourceDispatch,"hosted-source-dispatch")??"coding_core",E=null,k=null,Z=null;if(w&&(y||$||u))try{let c=await Ae({client:n,teamId:t,profileProjectId:g.profile.project.id,profileName:o.activeProfile??j.defaultProfile,state:o,agentId:w,sourceRef:g.sourceUpload.sourceRef??o.git.branch??"main",localHead:o.git.head,hostedHead:g.sourceUpload.sourceCommitSha,projectId:f(e,"hostedSourceProjectId")||(o.hosted?.hostedSourceMaterialization?.agentId===w?o.hosted.hostedSourceMaterialization.projectId:null)});r={...r,promotionStatus:"hosted_source_materialized",hostedSourceMaterialization:c},m=c.runtimeAgentId??w,await R(r)}catch(c){let p=c instanceof Error?c.message:String(c);throw r={...r,promotionStatus:"hosted_source_materialize_failed",hostedSourceMaterialization:{status:"failed",agentId:w,projectId:f(e,"hostedSourceProjectId")??null,error:p},error:p},await R(r),new Error(`Hosted source materialization failed after push: ${p}`)}if(y||$){if(!w)throw new Error("--hosted-source-agent-id or --hosted-run-agent-id is required for hosted source checks or publish.");if(!m)throw new Error("Unable to resolve the hosted runtime agent for source checks.");try{if(E=await n.agents.sourceDeployPlan(m,{teamId:t}),y){let c=r.hostedSourceMaterialization?.sourceRef??g.sourceUpload.sourceRef,p=r.hostedSourceMaterialization?.sourceCommitSha??g.sourceUpload.sourceCommitSha;if(k=await n.agents.requestSourceChecks(m,{teamId:t,...c?{sourceRef:c}:{},...p?{baseSha:p}:{},checkKind:$e(f(e,"hostedCheckKind")||f(e,"checkKind"))??"all",dispatch:H,metadata:{source:"openpond_profile_push_checks",localHead:o.git.head,hostedHead:g.sourceUpload.sourceCommitSha,materializedProjectId:r.hostedSourceMaterialization?.projectId??null,materializedSourceCommitSha:r.hostedSourceMaterialization?.sourceCommitSha??null,sourceRef:c,dispatch:H}}),k.dispatchResult?.status==="failed")throw new Error(k.dispatchResult.error??"hosted_source_check_dispatch_failed");if(k.dispatchResult?.status==="completed"){let J=Y(k.sourceCheckStatus);Ze(J)&&(await Ye({client:n,teamId:t,runtimeAgentId:m,sourceRef:c,sourceCommitSha:p,validatedAt:new Date().toISOString()}),E=await n.agents.sourceDeployPlan(m,{teamId:t}))}}r={...r,promotionStatus:y?"hosted_source_check_pending":r.promotionStatus,hostedSourceCheck:X({agentId:m,status:y?"requested":"deploy_plan_ready",deployPlan:E,checkResult:k})},await R(r)}catch(c){let p=c instanceof Error?c.message:String(c);throw r={...r,promotionStatus:"hosted_source_check_failed",hostedSourceCheck:X({agentId:m,status:"failed",deployPlan:E,checkedAt:new Date().toISOString(),error:p}),error:p},await R(r),new Error(`Hosted source check failed after push: ${p}`)}}if($){if(!w)throw new Error("--hosted-source-agent-id or --hosted-run-agent-id is required for hosted source publish.");if(!m)throw new Error("Unable to resolve the hosted runtime agent for source publish.");try{let c=f(e,"expectedManifestHash")||r.hostedSourceCheck?.manifestHash||E?.source.manifestHash||void 0;Z=await n.agents.publishSource(m,{teamId:t,...c?{expectedManifestHash:c}:{},...r.hostedSourceMaterialization?.sourceCommitSha??g.sourceUpload.sourceCommitSha?{expectedSourceCommitSha:r.hostedSourceMaterialization?.sourceCommitSha??g.sourceUpload.sourceCommitSha}:{}}),r={...r,promotionStatus:"hosted_source_published",hostedPublish:ge({agentId:m,publishResult:Z})},await R(r)}catch(c){let p=c instanceof Error?c.message:String(c);throw r={...r,promotionStatus:"hosted_source_publish_failed",hostedPublish:{status:"failed",agentId:m,error:p},error:p},await R(r),new Error(`Hosted source publish failed after push: ${p}`)}}let z=null;if(C){let c=m||C,p=new Date().toISOString(),J=so(e,"hostedRunInput")??{prompt:"hello",channel:"openpond_chat"},D=f(e,"hostedRunConversationId")||f(e,"conversationId"),U=f(e,"hostedRunTargetProjectId"),se=ve({explicitKey:f(e,"hostedRunIdempotencyKey"),retry:S(e.hostedRunRetry),localHead:o.git.head,sourceHead:r.hostedSourceMaterialization?.sourceCommitSha??g.sourceUpload.sourceCommitSha,runtimeAgentId:c,targetProjectId:U,input:J});await R({...r,promotionStatus:"hosted_run_pending",hostedRunStatus:"running",hostedRunAgentId:c,hostedRunAt:p});try{z=await n.agents.run(c,{teamId:t,...D?{conversationId:D}:{},...U?{targetProjectId:U}:{},...U?{targetProject:{id:U}}:{},idempotencyKey:se,input:J,metadata:{source:"openpond_profile_push_run",...D?{conversationId:D}:{},targetProjectId:U||null,localHead:o.git.head,hostedHead:g.sourceUpload.sourceCommitSha,hostedRunIdempotencyKey:se,hostedRunRetry:S(e.hostedRunRetry),materializedProjectId:r.hostedSourceMaterialization?.projectId??null,materializedSourceCommitSha:r.hostedSourceMaterialization?.sourceCommitSha??null,sourceRef:r.hostedSourceMaterialization?.sourceRef??g.sourceUpload.sourceRef,publishedSnapshotId:r.hostedPublish?.snapshotId??null,manifestHash:r.hostedPublish?.manifestHash??r.hostedSourceCheck?.manifestHash??null},runtimeSourcePolicy:$?{requirePublishedSnapshot:!0,source:"diagnostic"}:{allowLatestSource:!0,source:"diagnostic"}});let F=me({agentId:c,runResult:z}),M=pe(F);await R({...r,promotionStatus:M==="passed"?"hosted_run_passed":M==="failed"?"hosted_run_failed":"hosted_run_pending",hostedRunStatus:M,hostedRunAgentId:c,hostedRunId:z.run.id,hostedRunAt:z.run.createdAt??p,hostedRun:F})}catch(F){let M=F instanceof Error?F.message:String(F);throw await R({...r,promotionStatus:"hosted_run_failed",hostedRunStatus:"failed",hostedRunAgentId:c,hostedRunAt:new Date().toISOString(),hostedRun:{status:"failed",agentId:c,error:M},error:M}),new Error(`Hosted invocation failed to start after push: ${M}`)}}if(S(e.json)){console.log(JSON.stringify({...g,uploaded:Be(P),hostedSourceMaterialization:r.hostedSourceMaterialization??null,hostedSourceChecks:k,hostedSourcePublish:Z,hostedRun:z},null,2));return}console.log(`Pushed OpenPond profile ${o.activeProfile??"default"} to hosted profile repo.`),console.log(`Project id: ${g.profile.project.id}`),console.log(`Local head: ${o.git.head}`),console.log(`Hosted source commit: ${g.sourceUpload.sourceCommitSha??"unknown"}`),console.log(`Uploaded ${P.fileCount} file(s), ${P.totalBytes} byte(s) via ${P.transport.mode} (limits: ${P.limits.maxFiles} files, ${P.limits.maxFileBytes} bytes/file, ${P.limits.maxTotalBytes} bytes total).`),console.log(z?`Hosted invocation: running ${z.run.id}`:"Hosted invocation: not started"),r.hostedSourceMaterialization&&console.log(`Hosted materialized: ${r.hostedSourceMaterialization.status}`+(r.hostedSourceMaterialization.projectId?` ${r.hostedSourceMaterialization.projectId}`:"")+(r.hostedSourceMaterialization.sourceCommitSha?` ${r.hostedSourceMaterialization.sourceCommitSha}`:"")),r.hostedSourceCheck&&console.log(`Hosted source checks: ${r.hostedSourceCheck.status}`),r.hostedPublish&&console.log(`Hosted publish: ${r.hostedPublish.status}`+(r.hostedPublish.snapshotId?` ${r.hostedPublish.snapshotId}`:"")),console.log(`Uploaded files: ${P.fileCount}`)}i(De,"runProfilePushCommand");function Be(e){return{fileCount:e.fileCount,totalBytes:e.totalBytes,limits:e.limits,transport:e.transport}}i(Be,"summarizeProfileSourceUpload");function Ge(e){return{...e,profiles:Object.fromEntries(Object.entries(e.profiles).map(([t,o])=>[t,{path:o.path,defaultAgent:o.defaultAgent??"default",enabledAgents:o.enabledAgents??[]}]))}}i(Ge,"normalizeHostedProfileManifest");async function Ke(e){let t=e.state.repoPath;if(!t)throw new Error("Active OpenPond profile is missing a repository path.");let o=await he(t);if(!e.hostedSourceAgentId)return o;if(!e.state.sourcePath)throw new Error("Active OpenPond profile is missing a source path.");let n=e.state.agents.find(d=>d.id===e.hostedSourceAgentId);if(!n)throw new Error(`Profile agent not found for hosted source upload: ${e.hostedSourceAgentId}`);let a=We(e.state.sourcePath,n.path),l=L.relative(t,a).replace(/\\/g,"/");if(l.startsWith("..")||L.isAbsolute(l))throw new Error(`Profile agent path escapes profile repo: ${n.path}`);let h=await K(a,[]);return h.entries.length===0?o:W(o,h.entries.map(d=>({...d,path:l?`${l}/${d.path}`:d.path})))}i(Ke,"collectProfileSourceUploadForPush");function We(e,t){let o=t.replace(/\\/g,"/"),n=L.resolve(e,o),a=L.relative(e,n);if(a.startsWith("..")||L.isAbsolute(a))throw new Error(`Profile agent path escapes profile source: ${t}`);return o==="agent/agent.ts"||o.endsWith("/agent.ts")?e:n}i(We,"resolveProfileAgentSourceRoot");function Y(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}i(Y,"record");function T(e){return typeof e=="string"&&e.trim()?e.trim():null}i(T,"text");function Ve(e,t){if(!t)return null;let o=e.hosted?.hostedSourceMaterialization;return o?.agentId===t&&o.runtimeAgentId?o.runtimeAgentId:t}i(Ve,"resolveHostedRuntimeAgentIdForRun");async function Ye(e){!e.sourceRef||!e.sourceCommitSha||await e.client.agents.update(e.runtimeAgentId,{teamId:e.teamId,runtimeSource:{mode:"latest_source",sourceRef:e.sourceRef,sourceCommitSha:e.sourceCommitSha,buildStatus:"succeeded",validationStatus:"passed",validatedAt:e.validatedAt}})}i(Ye,"bindValidatedHostedRuntimeSource");function Ze(e){if(!e)return!1;let t=T(e.finalResultState)?.toLowerCase();if(t&&t!=="completed"&&!Ee(t))return!1;let o=Array.isArray(e.checkRuns)?e.checkRuns.map(Y).filter(u=>!!u):[];if(o.some(Qe))return!1;let n=o.some(u=>V(u).includes("build")&&q(u)),a=q(Y(e.validation))||o.some(u=>V(u).includes("validate")&&q(u)),l=Y(e.eval),d=!((T(e.requestedCheckKind)??"all")==="all"||(T(e.requestedCheckKind)??"")==="eval"||!!l||o.some(u=>V(u).includes("eval")))||q(l)||o.some(u=>V(u).includes("eval")&&q(u));return n&&a&&d}i(Ze,"sourceCheckStatusPassed");function V(e){return(T(e.command)??"").toLowerCase()}i(V,"checkRunCommand");function Qe(e){let t=e.passed;if(typeof t=="boolean")return!t;let o=e.exitCode;if(typeof o=="number"&&o!==0)return!0;let n=T(e.status)?.toLowerCase();return!!(n&&Xe(n))}i(Qe,"checkRunFailed");function q(e){if(!e)return!1;if(typeof e.passed=="boolean")return e.passed;let t=Oe(e.failed)??Oe(e.failedCount);if(t!==null&&t>0)return!1;let o=e.exitCode;if(typeof o=="number")return o===0;let n=T(e.status)?.toLowerCase();return!!(n&&Ee(n))}i(q,"checkEvidencePassed");function Oe(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){let t=Number(e);return Number.isFinite(t)?t:null}return null}i(Oe,"numericEvidence");function Ee(e){return e==="passed"||e==="succeeded"||e==="success"}i(Ee,"passingStatus");function Xe(e){return e==="failed"||e==="failure"||e==="cancelled"}i(Xe,"failingStatus");async function eo(e){let t=B(e,"usage: openpond profile hosted status"),n=await(await G(e)).profile.get({teamId:t});if(S(e.json)){console.log(JSON.stringify({profile:n},null,2));return}if(!n){console.log("No hosted OpenPond profile repo found."),console.log("Run `openpond profile ensure-hosted --team-id <id>` to create one.");return}ze(n)}i(eo,"runHostedProfileStatusCommand");async function He(e){let t=B(e,"usage: openpond profile ensure-hosted"),n=await(await G(e)).profile.ensureHosted({teamId:t});if(S(e.json)){console.log(JSON.stringify({profile:n},null,2));return}ze(n)}i(He,"runHostedProfileEnsureCommand");async function oo(e,t){if((t[0]??"list")!=="list")throw new Error("usage: openpond agents list [--json]");let n=await x();if(n.error)throw new Error(n.error);if(S(e.json)){console.log(JSON.stringify({agents:n.agents,profile:n},null,2));return}if(n.mode==="none"){console.log("No active OpenPond profile. Run `openpond init`.");return}if(n.agents.length===0){console.log(`No agents found in ${n.activeProfile}.`);return}for(let a of n.agents)console.log(`${a.id} ${a.enabled?"enabled":"disabled"} ${a.path}`)}i(oo,"runOpenPondAgentsCommand");async function xo(e,t,o){let n=f(t,"cwd"),a=[...o,...ro(t,new Set(["cwd","account","profile","handle","baseUrl"]))];await Pe({command:e,cwd:n?L.resolve(n):void 0,args:a,inherit:!0})}i(xo,"runOpenPondProfileSdkAlias");function re(e){if(e.mode==="none"){console.log("No active OpenPond profile."),console.log(`Default location: ${ee()}`);return}if(console.log(`Mode: ${e.mode}`),console.log(`Repo: ${e.repoPath}`),console.log(`Profile: ${e.activeProfile}`),console.log(`Source: ${e.sourcePath??"missing"}`),console.log(`State: ${e.summary.message}`),e.git&&(console.log(`Git: ${e.git.branch??"detached"} ${e.git.shortHead??"no-head"}${e.git.dirty?" dirty":" clean"}`),e.git.upstream&&console.log(`Upstream: ${e.git.upstream} ahead ${e.git.ahead??"?"} behind ${e.git.behind??"?"}`)),(e.hosted?.projectId||e.hosted?.sourceCommitSha)&&(console.log(`Hosted: ${e.hosted.projectId??"unbound"} ${e.hosted.sourceCommitSha??"no-source-head"}`),e.hosted.hostedSourceMaterialization&&console.log(`Hosted materialized: ${e.hosted.hostedSourceMaterialization.status}`+(e.hosted.hostedSourceMaterialization.agentId?` ${e.hosted.hostedSourceMaterialization.agentId}`:"")+(e.hosted.hostedSourceMaterialization.sourceCommitSha?` ${e.hosted.hostedSourceMaterialization.sourceCommitSha}`:"")),e.hosted.hostedSourceCheck&&console.log(`Hosted checks: ${e.hosted.hostedSourceCheck.status}`+(e.hosted.hostedSourceCheck.sandboxId?` sandbox ${e.hosted.hostedSourceCheck.sandboxId}`:"")),e.hosted.hostedPublish&&console.log(`Hosted publish: ${e.hosted.hostedPublish.status}`+(e.hosted.hostedPublish.snapshotId?` ${e.hosted.hostedPublish.snapshotId}`:"")),e.hosted.hostedRun&&console.log(`Hosted run: ${e.hosted.hostedRun.status}`+(e.hosted.hostedRun.runId?` ${e.hosted.hostedRun.runId}`:"")+(e.hosted.hostedRun.runtimeId?` runtime ${e.hosted.hostedRun.runtimeId}`:""))),console.log(`Catalog: ${e.catalog.actionCount} action(s)${e.catalog.stale?" stale":""}`),console.log(`Setup gate: ${e.setupGate.status} (${e.setupGate.blockingCount} blocking, ${e.setupGate.optionalMissingCount} optional missing)`),e.summary.defaultAction&&console.log(`Default action: ${e.summary.defaultAction}`),e.setupGate.blockingRequirements.length>0){console.log("Blocking setup:");for(let t of e.setupGate.blockingRequirements.slice(0,10))console.log(` ${Q(t)}`);e.setupGate.blockingRequirements.length>10&&console.log(` ... ${e.setupGate.blockingRequirements.length-10} more`)}if(!e.summary.checkFresh&&e.summary.checkStaleReason?console.log(`Checks: stale - ${e.summary.checkStaleReason}`):e.summary.checkFresh&&console.log("Checks: fresh"),e.lastCheck&&console.log(`Last check: ${e.lastCheck.command} ${e.lastCheck.status} at ${e.lastCheck.checkedAt}`),e.error&&console.log(`Error: ${e.error}`),e.agents.length>0){console.log("Agents:");for(let t of e.agents)console.log(` ${t.id} (${t.enabled?"enabled":"disabled"}) ${t.path}`)}if(e.skills.length>0){console.log("Skills:");for(let t of e.skills){let o=t.validationStatus==="valid"?"valid":t.validationStatus;console.log(` ${t.name} (${o}) ${t.path}`)}}}i(re,"printProfileState");function to(e){if(e.mode==="none"){console.log("No active OpenPond profile.");return}console.log(`Profile: ${e.activeProfile}`),console.log(`State: ${e.summary.message}`);let t=[["Changed agents",e.diff.changedAgents],["New agents",e.diff.newAgents],["Deleted agents",e.diff.deletedAgents],["Changed skills",e.diff.changedSkills],["Changed actions",e.diff.changedActions],["Changed extensions",e.diff.changedExtensions],["Setup changes",e.diff.setupChanges],["Env requirement changes",e.diff.envRequirementChanges]];for(let[o,n]of t)n.length!==0&&console.log(`${o}: ${n.join(", ")}`);if(e.diff.files.length===0){console.log("No source changes.");return}console.log("Files:");for(let o of e.diff.files)console.log(` ${o.status.padEnd(2)} ${o.path}`)}i(to,"printProfileDiff");function no(e){if(e.mode==="none"){console.log("No active OpenPond profile.");return}if(console.log(`Profile: ${e.activeProfile}`),console.log(`Catalog: ${e.catalog.actionCount} action(s)${e.catalog.stale?" stale":""}`),console.log(`Setup gate: ${e.setupGate.status} (${e.setupGate.blockingCount} blocking, ${e.setupGate.optionalMissingCount} optional missing)`),e.catalog.generatedAt&&console.log(`Generated at: ${e.catalog.generatedAt}`),e.catalog.error&&console.log(`Catalog error: ${e.catalog.error}`),e.actionCatalog.length===0){console.log("No catalog actions found. Run `openpond inspect` or `openpond build`.");return}for(let o of e.actionCatalog){let n=o.label??o.name??o.id,a=o.visibility??"default",l=e.setupGate.blockingRequirements.filter(d=>d.actionId===o.id),h=l.length?`setup_required:${l.map(d=>d.label).join(",")}`:"setup_ready";console.log(`${o.id} ${a} ${h} ${n}`)}let t=e.setupGate.blockingRequirements.filter(o=>o.actionId===null);if(t.length>0){console.log("Source setup blockers:");for(let o of t)console.log(` ${Q(o)}`)}}i(no,"printProfileCatalog");function ze(e){if(console.log(`Hosted profile repo: ${e.project.name}`),console.log(`Project id: ${e.project.id}`),console.log(`Role: ${e.project.role??"profile"}`),console.log(`Default profile: ${e.defaultProfile}`),console.log(`Source path: ${e.sourcePath}`),console.log(`Seed status: ${e.seedStatus}`),e.sourceUpload?.sourceRef&&console.log(`Source ref: ${e.sourceUpload.sourceRef}`),e.sourceUpload?.sourceCommitSha&&console.log(`Source commit: ${e.sourceUpload.sourceCommitSha}`),e.seededAt&&console.log(`Seeded at: ${e.seededAt}`),e.agents.length>0){console.log("Agents:");for(let t of e.agents)console.log(` ${t.id} (${t.enabled?"enabled":"disabled"}) ${t.path}`)}}i(ze,"printHostedProfileSummary");function ro(e,t){let o=[],n=new Set(["force","json"]);for(let[a,l]of Object.entries(e)){if(t.has(a))continue;let h=`--${a.replace(/[A-Z]/g,d=>`-${d.toLowerCase()}`)}`;if(l===!0||n.has(a)&&l==="true")o.push(h);else{if(n.has(a)&&l==="false")continue;typeof l=="string"&&o.push(h,l)}}return o}i(ro,"optionArgs");function so(e,t){let o=f(e,t);if(!o)return null;let n=JSON.parse(o);if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`--${t} must be a JSON object`);return n}i(so,"parseJsonObjectOption");export{Ke as collectProfileSourceUploadForPush,oo as runOpenPondAgentsCommand,zo as runOpenPondInitCommand,Mo as runOpenPondProfileCommand,xo as runOpenPondProfileSdkAlias};
|
package/dist/chunks/{profile-training-source-6GOT7AHM.js → profile-training-source-J73ZLNSC.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as a}from"./chunk-
|
|
2
|
+
import{b as a}from"./chunk-DX7YEUNQ.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import"./chunk-FTQLQJQV.js";export{a as profileTrainingSource};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{w as a}from"./chunk-G5B3PB5X.js";import"./chunk-KJFRCVQC.js";import"./chunk-OKBIWRHC.js";import"./chunk-JGWINTT5.js";import"./chunk-SYUKES6H.js";import"./chunk-ZTVXRZ6D.js";import"./chunk-7LZISGTA.js";import"./chunk-BFKYRQMA.js";import"./chunk-LO3O45IX.js";import"./chunk-XW6HGSIT.js";import"./chunk-FSQWAANK.js";import"./chunk-ZR7LIMJS.js";import"./chunk-OQPJ7FJF.js";import"./chunk-PCNLC5H3.js";import"./chunk-P7HRF4FM.js";import"./chunk-UFHLLSCE.js";import"./chunk-2ITZW2CN.js";import"./chunk-HCEJAOIF.js";import"./chunk-6GWOVHIG.js";import"./chunk-QGOPYQW3.js";import"./chunk-O4FBOUNX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-WYZWDMMF.js";import"./chunk-DG4TYVPF.js";import"./chunk-PWK5Z5S3.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-2MMCZHKL.js";import"./chunk-WGX7WY4N.js";import"./chunk-XO3H32KX.js";import"./chunk-DIGX56JY.js";import"./chunk-R7YEURUQ.js";import"./chunk-DZUAT3TP.js";import"./chunk-H3BSIAQO.js";import"./chunk-637UACKH.js";import"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-RYGWCN2R.js";import"./chunk-ZZWAQBA2.js";import"./chunk-YR5ID2SS.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import"./chunk-FTQLQJQV.js";export{a as createProjectActionRunPayload};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as b,b as Y,c as F,d as H,e as W,f as z,g as X,h as E,i as y,j as v,k as C,l as Z,m as ee,n as A,o as te,p as _,q as j,r as re,s as ne,t as x,u as M,v as R,w as J,x as N,y as U,z as T}from"./chunk-SLZH4Z6C.js";import{m as h,n as I,v as P}from"./chunk-ISFIDCIH.js";import"./chunk-23P2O7PH.js";import"./chunk-AW5Q6NXT.js";import"./chunk-YVNDDNMK.js";import"./chunk-XRKFTPHD.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c as u,d,e as w,f as S}from"./chunk-3M53YXEI.js";import"./chunk-YDU3S6UT.js";import"./chunk-EL454L26.js";import"./chunk-BT5YNE5U.js";import"./chunk-PXS4SVQG.js";import"./chunk-FWIPHEVA.js";import"./chunk-ENSB6ZTM.js";import"./chunk-GLUWATL5.js";import"./chunk-RYGWCN2R.js";import"./chunk-ZZWAQBA2.js";import"./chunk-YR5ID2SS.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-ERJV5BMC.js";import"./chunk-6FA3GG5B.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as g}from"./chunk-FTQLQJQV.js";function k(e){let o=e.gitRepo?`${e.gitOwner??"_"}/${e.gitRepo}`:e.internalRepoPath??e.templateRepoUrl??e.normalizedSourceIdentity;return[e.id,e.status,e.sourceType,e.name,o].join(" ")}g(k,"formatProjectLine");function L(e){let o=e.selectedEntrypoint.name?`${e.selectedEntrypoint.scope}:${e.selectedEntrypoint.name}`:e.selectedEntrypoint.scope,i=e.runtimeSource?[e.runtimeSource.mode,e.runtimeSource.publishedSnapshotName??e.runtimeSource.publishedSnapshotId??e.runtimeSource.sourceRef].filter(a=>!!a).join(":"):"latest_source";return[e.id,e.status,e.triggerType,e.defaultWorkflowMode,i,o,e.name].join(" ")}g(L,"formatAgentLine");async function B(e,o,i){let a=i[1]?.trim(),t=i[2]?.trim(),n="usage: agent source <deploy-plan|checks|manifest-snapshots|setup|publish> <agent-id> --team-id <id>",r=d(o,n);if(!a||!t)throw new Error(n);if(a==="deploy-plan"){let s=await e.agents.sourceDeployPlan(t,{teamId:r});console.log(JSON.stringify({deployPlan:s},null,2));return}if(a==="manifest-snapshots"){let s=await e.agents.manifestSnapshots(t,{teamId:r,limit:x(o.limit)});console.log(JSON.stringify({manifestSnapshots:s},null,2));return}if(a==="checks"){let s=await e.agents.requestSourceChecks(t,M(r,o));console.log(JSON.stringify(s,null,2));return}if(a==="setup"){let s=typeof o.provider=="string"?o.provider.trim():"",l=typeof o.allowedActions=="string"?o.allowedActions.split(",").map(c=>c.trim()).filter(Boolean):[];if(!s||l.length===0)throw new Error(`${n}; setup requires --provider and --allowed-actions`);let p=await e.agents.configureSourceSetup(t,{teamId:r,integrationBindings:[{provider:s,mode:"connected",connectionMode:"member_connection",grantPolicy:"read_only",allowedActions:l,enabled:!0}]});console.log(JSON.stringify(p,null,2));return}if(a==="publish"){let s=await e.agents.publishSource(t,R(r,o));console.log(JSON.stringify(s,null,2));return}throw new Error(n)}g(B,"runAgentSourceWorkflow");import G from"node:path";var Q=new Set(["inspect","build","validate","eval","traces"]);function $(e,o){return Q.has(e)?!0:e==="run"&&!u(o,"teamId")}g($,"shouldDelegateLocalAgentSdkCommand");async function q(e,o){let i=o[0]||"inspect",a=G.resolve(u(e,"cwd")||u(e,"path")||"."),t=[i,...o.slice(1),"--cwd",a];S(e.json)&&t.push("--json"),D(t,e,"input","input"),D(t,e,"inputFile","input-file");let n=b(a),r=await P(n.command,[...n.args,...t],{cwd:a,inherit:!0});r.code!==0&&(process.exitCode=r.code??1)}g(q,"runLocalAgentSdkCommand");function D(e,o,i,a){let t=u(o,i);t&&e.push(`--${a}`,t)}g(D,"appendForwardedOption");async function Oe(e,o){let i=o[0]||"list";if($(i,e)){await q(e,o);return}let a=await h(e);if(i==="list"){let t=d(e,"usage: agent list"),n=await a.agents.list({teamId:t});if(S(e.json)){console.log(JSON.stringify({agents:n},null,2));return}if(n.length===0){console.log("no sandbox agents found");return}for(let r of n)console.log(L(r));return}if(i==="create"||i==="upsert"){let t=await a.agents.upsert(U(e));console.log(JSON.stringify({agent:t},null,2));return}if(i==="get"){let t=o[1]?.trim(),n=d(e,"usage: agent get <agentId>");if(!t)throw new Error("usage: agent get <agentId> --team-id <id>");let r=await a.agents.get(t,{teamId:n});console.log(JSON.stringify({agent:r},null,2));return}if(i==="run"){let t=o[1]?.trim(),n=d(e,"usage: agent run <agentId>");if(!t)throw new Error("usage: agent run <agentId> --team-id <id>");let r=u(e,"idempotencyKey"),s=u(e,"conversationId"),l=u(e,"targetProjectId"),p=A(e.triggerType),c=I(e.workflowMode),m=w(e,"input","input"),f=w(e,"metadata","metadata"),O=j(e),K=await a.agents.run(t,{teamId:n,...s?{conversationId:s}:{},...r?{idempotencyKey:r}:{},...l?{targetProjectId:l}:{},...l?{targetProject:{id:l}}:{},...p?{triggerType:p}:{},...c?{workflowMode:c}:{},...m?{input:m}:{},...f?{metadata:f}:{},...O?{runtimeSourcePolicy:O}:{}});console.log(JSON.stringify(K,null,2));return}if(i==="bind-runtime-source"||i==="bind-source"){let t=o[1]?.trim(),n=d(e,"usage: agent bind-source <agentId>");if(!t)throw new Error("usage: agent bind-source <agentId> --team-id <id> --source-mode latest_source|published_snapshot|auto");let r=_(e);if(!r?.mode)throw new Error("usage: agent bind-source <agentId> --team-id <id> --source-mode latest_source|published_snapshot|auto");let s=await a.agents.update(t,{teamId:n,runtimeSource:r});console.log(JSON.stringify({agent:s,agentSource:s.runtimeSource},null,2));return}if(i==="run-test"){let t=o[1]?.trim(),n=d(e,"usage: agent run-test <agentId>");if(!t)throw new Error("usage: agent run-test <agentId> --team-id <id>");let r=u(e,"idempotencyKey"),s=u(e,"conversationId"),l=u(e,"targetProjectId"),p=w(e,"input","input"),c=w(e,"metadata","metadata"),m=I(e.workflowMode),f=await a.agents.run(t,{teamId:n,...s?{conversationId:s}:{},...r?{idempotencyKey:r}:{},...l?{targetProjectId:l}:{},...l?{targetProject:{id:l}}:{},...m?{workflowMode:m}:{},...p?{input:p}:{},metadata:{...c??{},source:"agent_run_test"},runtimeSourcePolicy:j(e,"diagnostic")});console.log(JSON.stringify({resolvedRuntimeSource:f.run.runtimeSource,agent:f.agent,run:f.run,sandbox:f.sandbox??null},null,2));return}if(i==="source"){await B(a,e,o);return}if(i==="update"){let t=o[1]?.trim(),n=d(e,"usage: agent update <agentId>");if(!t)throw new Error("usage: agent update <agentId> --team-id <id>");let r=await a.agents.update(t,T(n,e));console.log(JSON.stringify({agent:r},null,2));return}if(i==="archive"){let t=o[1]?.trim(),n=d(e,"usage: agent archive <agentId>");if(!t)throw new Error("usage: agent archive <agentId> --team-id <id>");let r=await a.agents.archive(t,{teamId:n});console.log(JSON.stringify({agent:r},null,2));return}throw new Error("usage: agent <inspect|build|validate|eval|traces|list|create|upsert|get|update|run|run-test|bind-source|source|edit|archive> [--team-id <id>] [--project-id <id>] [--name <name>]")}g(Oe,"runAgentCommand");import V from"node:path";async function xe(e,o){let i=o[0]||"list",a=await h(e);if(i==="list"){let t=d(e,"usage: project list"),n=await a.projects.list({teamId:t});if(S(e.json)){console.log(JSON.stringify({projects:n},null,2));return}if(n.length===0){console.log("no sandbox projects found");return}for(let r of n)console.log(k(r));return}if(i==="create"||i==="upsert"){let t=await a.projects.upsert(J(e));console.log(JSON.stringify({project:t},null,2));return}if(i==="get"){let t=o[1]?.trim(),n=d(e,"usage: project get <projectId>");if(!t)throw new Error("usage: project get <projectId> --team-id <id>");let r=await a.projects.get(t,{teamId:n});console.log(JSON.stringify({project:r},null,2));return}if(i==="update"){let t=o[1]?.trim(),n=d(e,"usage: project update <projectId>");if(!t)throw new Error("usage: project update <projectId> --team-id <id>");let r=await a.projects.update(t,N(n,e));console.log(JSON.stringify({project:r},null,2));return}if(i==="sync"){let t=o[1]?.trim(),n=d(e,"usage: project sync <projectId>");if(!t)throw new Error("usage: project sync <projectId> --team-id <id>");let r=await a.projects.sync(t,{teamId:n});console.log(JSON.stringify({project:r},null,2));return}if(i==="source-upload"||i==="upload-source"){let t=o[1]?.trim(),n=d(e,"usage: project source-upload <projectId>");if(!t)throw new Error("usage: project source-upload <projectId> --team-id <id> [--path <dir>]");let r=V.resolve(u(e,"path")||"."),s=await E(r,e),l=u(e,"commitMessage")||u(e,"commit-message")||"Upload OpenPond project source",p=await y(r),c=await v(r,p.entries),m=C(p,c.entries),f=await a.projects.uploadSource(t,{teamId:n,entries:m.entries,...s?{branch:s}:{},commitMessage:l});console.log(JSON.stringify({project:f,uploaded:{path:r,branch:s,fileCount:m.fileCount,totalBytes:m.totalBytes,limits:m.limits,transport:m.transport,...c.generatedManifestPath?{agentSdk:{generatedManifestPath:c.generatedManifestPath,generatedEntryCount:c.entries.length,synthesizedOpenPondYaml:c.synthesizedOpenPondYaml,uploadMetadataPath:c.uploadMetadataPath,uploadMetadataHash:c.uploadMetadataHash,commands:c.uploadMetadata?.commands,dependencySetup:c.uploadMetadata?.dependencySetup,packageManager:c.uploadMetadata?.packageManager,sourceTreeMode:c.uploadMetadata?.sourceTreeMode,artifactHashes:c.uploadMetadata?.artifactHashes}}:{}}},null,2));return}if(i==="archive"){let t=o[1]?.trim(),n=d(e,"usage: project archive <projectId>");if(!t)throw new Error("usage: project archive <projectId> --team-id <id>");let r=await a.projects.archive(t,{teamId:n});console.log(JSON.stringify({project:r},null,2));return}throw new Error("usage: project <list|create|upsert|get|update|sync|source-upload|archive> [--team-id <id>] [--name <name>]")}g(xe,"runProjectCommand");export{W as PROJECT_SOURCE_UPLOAD_CONCURRENCY,z as PROJECT_SOURCE_UPLOAD_LIMITS,H as PROJECT_SOURCE_UPLOAD_MAX_BYTES,Y as PROJECT_SOURCE_UPLOAD_MAX_FILES,F as PROJECT_SOURCE_UPLOAD_MAX_FILE_BYTES,X as PROJECT_SOURCE_UPLOAD_TRANSPORT,M as buildAgentSourceChecksInput,_ as buildAgentSourceConfig,j as buildAgentSourcePolicy,R as buildAgentSourcePublishInput,T as buildAgentUpdateInput,U as buildAgentUpsertInput,N as buildProjectUpdateInput,J as buildProjectUpsertInput,y as collectProjectSourceUploadEntries,L as formatAgentLine,k as formatProjectLine,ee as parseAgentEntrypointScope,ne as parseAgentSourceCheckDispatch,re as parseAgentSourceCheckKind,te as parseAgentSourceMode,A as parseAgentTriggerType,x as parsePositiveLimit,Z as parseProjectSourceType,b as resolveLocalAgentSdkCommand,Oe as runAgentCommand,B as runAgentSourceWorkflow,xe as runProjectCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as b}from"./chunk-
|
|
2
|
+
import{a as b}from"./chunk-OQ4VGCRG.js";import{a as x}from"./chunk-M3ZQDPRS.js";import"./chunk-ZR7LIMJS.js";import"./chunk-OQPJ7FJF.js";import"./chunk-PCNLC5H3.js";import"./chunk-P7HRF4FM.js";import"./chunk-UFHLLSCE.js";import"./chunk-2ITZW2CN.js";import"./chunk-HCEJAOIF.js";import"./chunk-6GWOVHIG.js";import"./chunk-QGOPYQW3.js";import"./chunk-O4FBOUNX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-WYZWDMMF.js";import{a as H}from"./chunk-DG4TYVPF.js";import"./chunk-PWK5Z5S3.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-2MMCZHKL.js";import"./chunk-WGX7WY4N.js";import"./chunk-XO3H32KX.js";import"./chunk-DIGX56JY.js";import"./chunk-R7YEURUQ.js";import"./chunk-DZUAT3TP.js";import"./chunk-H3BSIAQO.js";import"./chunk-637UACKH.js";import"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-SFNCAPCJ.js";import{ob as k}from"./chunk-RCA6NGVA.js";import{v as E,w as R}from"./chunk-VHSX3JPX.js";import{k as S,l as g,m as n}from"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as p}from"./chunk-FTQLQJQV.js";import{randomUUID as v}from"node:crypto";import{promises as t}from"node:fs";import i from"node:path";async function J(r){let o=k.parse(r.reference),e=E(r.sourcePackage,o.harnessRelease);if(e.contentHash!==o.sourcePackageHash||n(o.agentSnapshot)!==n({id:e.agentSnapshot.id,contentHash:e.agentSnapshot.contentHash}))throw new Error("Published Experiment source differs from its admitted immutable closure.");if(!r.ownerId.trim())throw new Error("Published Experiment source requires its trusted execution owner.");b(e);let c=`experiment-source-${n({ownerId:r.ownerId,reference:o})}`,a=await r.store.getHarnessReleaseRecord(o.harnessRelease.contentHash);if(a){let s=await r.store.getHarnessWorkspace(a.workspaceId);if(!s||s.id!==c||s.ownerScope.kind!=="personal"||s.ownerScope.id!==r.ownerId||s.metadata.experimentSourcePackageHash!==e.contentHash||n(a.agentSnapshot)!==n(e.agentSnapshot)||n(a.harnessRelease)!==n(e.harnessRelease))throw new Error("Published Experiment source is already retained under a different owner or immutable closure.");return await y(a.bundlePath,e),{workspace:s,release:a}}let l=i.join(r.storeDir,"library","harnesses","releases"),h=i.join(l,e.harnessRelease.contentHash),d=i.join(l,`.${e.harnessRelease.contentHash}.experiment-${v()}`);await t.mkdir(l,{recursive:!0,mode:448});try{await t.mkdir(i.join(d,"source"),{recursive:!0,mode:448});for(let[s,m]of R(e)){let w=i.join(d,"source",...s.split("/"));await t.mkdir(i.dirname(w),{recursive:!0,mode:448}),await t.writeFile(w,m,{flag:"wx",mode:384})}for(let[s,m]of[["agent-snapshot.json",e.agentSnapshot],["harness-release.json",e.harnessRelease]])await t.writeFile(i.join(d,s),S(m),{flag:"wx",mode:384});try{await t.rename(d,h)}catch(s){if(!["EEXIST","ENOTEMPTY"].includes(s.code??""))throw s}await y(h,e)}finally{await t.rm(d,{recursive:!0,force:!0})}let u=x.parse({schemaVersion:"openpond.localHarnessReleaseRecord.v1",workspaceId:c,sourceRevision:e.contentHash,agentSnapshot:e.agentSnapshot,harnessRelease:e.harnessRelease,bundlePath:h,createdAt:r.createdAt}),f=H.parse({schemaVersion:"openpond.harnessWorkspace.v1",id:c,ownerScope:{kind:"personal",id:r.ownerId},name:"Experiment source",location:"local",sourceRevision:e.contentHash,revision:0,dirty:!1,currentChannel:{name:"personal",release:o.harnessRelease,revision:1},createdAt:r.createdAt,updatedAt:r.createdAt,metadata:{selectionEligible:!1,experimentSourcePackageHash:e.contentHash}});return await r.store.createHarnessWorkspaceWithRelease({workspace:f,release:u}),{workspace:f,release:u}}p(J,"installPublishedExperimentSource");async function y(r,o){if(await t.realpath(r)!==i.resolve(r))throw new Error("Published Experiment bundle cannot be a symbolic link.");for(let[c,a]of[["agent-snapshot.json",o.agentSnapshot],["harness-release.json",o.harnessRelease]]){let l=i.join(r,c);if(!(await t.lstat(l)).isFile()||n(JSON.parse(await t.readFile(l,"utf8")))!==n(a))throw new Error("Retained published Experiment release metadata changed.")}for(let c of o.harnessRelease.files){let a=i.join(r,"source",...c.path.split("/"));if(!(await t.lstat(a)).isFile()||await t.realpath(a)!==a)throw new Error("Published Experiment source must contain regular immutable files.");let l=await t.readFile(a);if(l.byteLength!==c.sizeBytes||g(l)!==c.contentHash)throw new Error("Retained published Experiment source differs from its released bytes.")}}p(y,"verifyBundle");export{J as installPublishedExperimentSource};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h}from"./chunk-STWRTNRK.js";import"./chunk-ZR7LIMJS.js";import"./chunk-OQPJ7FJF.js";import"./chunk-PCNLC5H3.js";import"./chunk-P7HRF4FM.js";import"./chunk-UFHLLSCE.js";import"./chunk-2ITZW2CN.js";import"./chunk-HCEJAOIF.js";import"./chunk-6GWOVHIG.js";import"./chunk-QGOPYQW3.js";import"./chunk-O4FBOUNX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-WYZWDMMF.js";import"./chunk-DG4TYVPF.js";import"./chunk-PWK5Z5S3.js";import"./chunk-DDMZSZFL.js";import"./chunk-W45RKGM6.js";import"./chunk-2MMCZHKL.js";import"./chunk-WGX7WY4N.js";import"./chunk-XO3H32KX.js";import"./chunk-DIGX56JY.js";import"./chunk-R7YEURUQ.js";import"./chunk-DZUAT3TP.js";import"./chunk-H3BSIAQO.js";import"./chunk-637UACKH.js";import"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import"./chunk-FTQLQJQV.js";export{f as activateRefinerRelease,b as createRefinerProfileRoutePayloads,h as initializeRefinerProfile,c as inspectRefinerProfile,d as loadActiveRefinerRelease,a as refinerProfilePaths,g as rollbackRefinerRelease,e as updateRefinerProfile};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as me,c as $,e as L,f as pe,g as ve,h as fe,i as ge,j as Ie,k as q,m as B}from"./chunk-G3RXYI2L.js";import"./chunk-DBK66CJP.js";import{c as de}from"./chunk-GW766ZSO.js";import{i as te}from"./chunk-UKMA4R6X.js";import{a as ae,b as oe,c as ie,d as se,e as le,f as ce,g as ue,i as N}from"./chunk-OQKJGTTO.js";import"./chunk-KVTBX2UP.js";import{b as ne}from"./chunk-A6USMRWK.js";import{b as re}from"./chunk-PCSIOUHF.js";import"./chunk-7KWD2I6W.js";import"./chunk-ZGTOK7ZK.js";import"./chunk-XW6HGSIT.js";import{g as E}from"./chunk-KG325WTN.js";import"./chunk-EIRYMSEG.js";import{A as X,K as ee}from"./chunk-WJ43MJ3F.js";import{c as J,d as G,e as W,f as Y,g as Z,j as C}from"./chunk-Q4TBTRIG.js";import"./chunk-DIO5CB6U.js";import"./chunk-GJ2ZJFDD.js";import"./chunk-BFKYRQMA.js";import"./chunk-6QSSIT62.js";import"./chunk-3QIB5FXI.js";import"./chunk-L3KS6MOV.js";import"./chunk-MQULU465.js";import"./chunk-PRGBLQVH.js";import"./chunk-7E6T7GP5.js";import"./chunk-DZUAT3TP.js";import"./chunk-XDQMGUWL.js";import"./chunk-FTEOCCPB.js";import"./chunk-25MBPJVY.js";import"./chunk-WN3V6KDN.js";import"./chunk-523TE4BI.js";import"./chunk-ZCHXGRRU.js";import"./chunk-YR5ID2SS.js";import"./chunk-APB2STJK.js";import"./chunk-I7AQMAQI.js";import{E as M}from"./chunk-Z4Z5UOZM.js";import"./chunk-6FA3GG5B.js";import"./chunk-Y4OWBBDD.js";import"./chunk-6ZFPQYHG.js";import"./chunk-JFXWI3EN.js";import"./chunk-FFRFSDBM.js";import"./chunk-VYLGI3IH.js";import"./chunk-ACYFMLWG.js";import"./chunk-TVQAPBLZ.js";import"./chunk-KGNCKIFP.js";import{b as d}from"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as i}from"./chunk-FTQLQJQV.js";var Ee=new Set(["applying_source","running_checks","evaluating","awaiting_promotion","opening_pull_request","pull_request_open","reconciling_release","released","ready","ready_local","pushing_hosted","running_hosted_checks","published_hosted"]);function H(e){return Ee.has(e)}i(H,"isCreateImproveMutationState");function z(e){let t=e.run;if(!t)return;let n=e.actionLabel??"Create/Improve update";if(t.plan&&t.plan.runId!==t.id)throw new Error(`${n} requires a plan linked to the submitted run.`);if(t.workflowCapture&&t.workflowCapture.runId!==t.id)throw new Error(`${n} requires workflow capture linked to the submitted run.`);if(t.plan?.approvalId&&!t.approvalIds.includes(t.plan.approvalId))throw new Error(`${n} requires the plan approval id in the run.`)}i(z,"assertCreateImproveRunLinked");function he(e){let t=e.actionLabel??"Create/Improve mutation",n=e.run;if(!n)throw new Error(`${t} requires a Create/Improve run.`);if(z({actionLabel:t,run:n}),!H(n.state))throw new Error(`${t} cannot start before plan approval.`);if(n.plan?.status!=="approved")throw new Error(`${t} requires an approved plan.`)}i(he,"assertCreateImproveMutationApproved");import{randomUUID as F}from"node:crypto";var $e=d.object({id:d.string().trim().min(1).optional(),label:d.string().trim().min(1),value:d.string().trim().min(1).optional(),description:d.string().trim().min(1).nullable().optional()}),Oe=d.object({id:d.string().trim().min(1).optional(),kind:d.preprocess(Ye,d.enum(["single_choice","free_text"]).default("single_choice")),title:d.string().trim().min(1),prompt:d.string().trim().min(1),required:d.boolean().default(!0),options:d.array($e).default([])}),je=d.object({path:d.string().trim().min(1),operation:d.preprocess(Ze,d.enum(["create","update","delete","inspect"])),reason:d.string().trim().min(1)}),De=d.object({name:d.string().trim().min(1),command:d.string().trim().min(1),required:d.boolean().default(!0)}),Me=d.object({targetId:d.string().trim().min(1).optional().nullable(),targetName:d.string().trim().min(1).optional().nullable(),agentId:d.string().trim().min(1).optional().nullable(),agentName:d.string().trim().min(1).optional().nullable(),summary:d.string().trim().min(1),capturedContextSummary:d.string().trim().min(1),actionShape:G,defaultChatAction:d.object({key:d.string().trim().min(1).nullable().optional(),label:d.string().trim().min(1).nullable().optional(),required:d.boolean().default(!0)}).optional().nullable(),sourcePlan:d.array(je).default([]),requirements:d.array(J).default([]),checks:d.array(De).default([])}),ke=d.discriminatedUnion("decision",[d.object({schemaVersion:d.literal("openpond.createImprove.plannerDecision.v1"),decision:d.literal("questions"),summary:d.string().trim().min(1).optional().nullable(),questions:d.array(Oe).min(1)}),d.object({schemaVersion:d.literal("openpond.createImprove.plannerDecision.v1"),decision:d.literal("plan"),plan:Me})]);async function Pe(e){let t=Ve(e.run);if(t)return Ce({run:e.run,decision:t,modelRef:null});let n=Ke(e.run),o=await Re(e.stream,n),a;try{a=we(o)}catch(u){let v=Qe({messages:n,invalidContent:o,error:u}),R=await Re(e.stream,v);try{a=we(R)}catch(I){throw new Error(`Create/Improve planner repair failed: ${K(I)}; initial error: ${K(u)}`)}}return Ce({run:e.run,decision:a,modelRef:e.modelRef??null})}i(Pe,"runModelBackedCreateImprovePlanner");async function Re(e,t){let n="";for await(let o of e(t))o.text&&(n+=o.text);return n}i(Re,"collectPlannerText");function Ce(e){return e.decision.decision==="questions"?Ne(e.run,e.decision,e.modelRef??null):Le(e.run,e.decision.plan,e.modelRef??null)}i(Ce,"createImproveRunFromPlannerDecision");function Ae(e){let t=new Date().toISOString();return C(e.run,{state:"blocked",plan:null,workflowCapture:Q(e.run),blockedReason:e.reason,metadata:{...e.run.metadata,...U(e.modelRef??null),plannerDecision:"blocked",plannerError:e.reason},updatedAt:t})}i(Ae,"createBlockedCreateImprovePlannerRun");function Ne(e,t,n){let o=new Date().toISOString(),a=t.questions.map((u,v)=>Y.parse({id:u.id??`create_improve_question_${v+1}`,kind:u.kind,title:u.title,prompt:u.prompt,required:u.required,status:"pending",options:u.options.map((R,I)=>({id:R.id??`option_${I+1}`,label:R.label,value:R.value??R.label,description:R.description??null,metadata:{}})),answer:null,metadata:{}}));return C(e,{state:"awaiting_questions",plan:null,workflowCapture:Q(e),approvalIds:[],questionIds:a.map(u=>u.id),questions:a,blockedReason:null,metadata:{...e.metadata,...U(n),plannerDecision:"questions",plannerSummary:t.summary??null},updatedAt:o})}i(Ne,"createQuestionRun");function Le(e,t,n){let o=new Date().toISOString(),a=`create_improve_plan_${F()}`,u=`approval_${F()}`,v=Be(e.target,t,e.objective),R=be(v),I=t.actionShape,k=t.checks.length?t.checks:ze(v.kind),w=t.sourcePlan.length?t.sourcePlan:He({run:{...e,target:v},sourceRoot:R}),b=t.defaultChatAction?.key??I.defaultActionKey??(v.kind==="agent"?v.defaultActionKey:null)??"chat",m=e.surface==="lab_improve"?Fe():U(n),f=W.parse({schemaVersion:"openpond.createImprove.plan.v1",id:a,runId:e.id,status:"pending_approval",objective:e.objective,summary:t.summary,capturedContextSummary:t.capturedContextSummary,defaultChatAction:{key:b,label:t.defaultChatAction?.label??v.displayName??"Chat",required:t.defaultChatAction?.required??!0},sourcePlan:w,requirements:t.requirements,checks:k,approvalId:u,approvedAt:null,editedFromPlanId:null,metadata:{...m,target:v,actionShape:I,actionShapeDecisionSource:e.surface==="lab_improve"?"lab_improve_default_planner":"model_planner"},createdAt:o,updatedAt:o}),y=e.questions.map(h=>h.status==="pending"?{...h,status:"skipped"}:h);return C(e,{state:"awaiting_plan_approval",target:v,plan:f,workflowCapture:Q(e),approvalIds:[u],questionIds:y.map(h=>h.id),questions:y,blockedReason:null,metadata:{...e.metadata,...m,plannerDecision:"plan"},updatedAt:o})}i(Le,"createPlanRun");function Be(e,t,n){let o=t.targetId??t.agentId,a=t.targetName??t.agentName;if(e.kind!=="agent")return{...e,id:e.id??o??null,displayName:e.displayName??a??null};let u=D(o??"")||e.id||D(a??"")||et(n),v=e.id===u&&e.defaultActionKey?e.defaultActionKey:`${u}.chat`;return{...e,id:u,displayName:a??e.displayName,defaultActionKey:v}}i(Be,"plannedTarget");function Q(e){if(e.workflowCapture)return e.workflowCapture;let t=new Date().toISOString(),n=S(e.context.tools.flatMap(o=>o.artifactRefs));return Z.parse({schemaVersion:"openpond.createImprove.workflowCapture.v1",id:`workflow_capture_${F()}`,runId:e.id,command:e.command,objective:e.objective,conversationExcerpts:e.context.conversationExcerpts,attachments:e.context.attachments,apps:e.context.apps,tools:e.context.tools,sideEffects:S(e.context.tools.flatMap(o=>o.sideEffects)),profileActions:S(e.context.tools.map(o=>o.name)),externalProviders:S([...e.context.apps.map(o=>o.name),...e.context.tools.map(o=>tt(o.name))]),environmentVariables:[],files:S(e.context.attachments.map(o=>o.ref?`${o.name} (${o.ref})`:o.name)),schedules:[],webhooks:[],channelTargets:["openpond_chat"],outputArtifacts:n,targetRepoAssumptions:e.context.targetRepoAssumptions,traceRefs:n.filter(o=>/\btrace\b|trace[:/-]/i.test(o)),metadata:{source:"create_improve_model_planner",conversationId:e.scope.conversationId,projectId:e.scope.projectId},createdAt:t})}i(Q,"workflowCaptureForRun");function He(e){return e.run.operation==="improve"&&e.run.target.id?[{path:be(e.run.target),operation:"update",reason:e.run.objective},{path:"settings/profile.yaml",operation:"update",reason:"Preserve the active Profile composition and routing."}]:[{path:e.sourceRoot,operation:"create",reason:e.run.objective},{path:"settings/profile.yaml",operation:"update",reason:"Register the workproduct in the active Profile."}]}i(He,"defaultSourcePlan");function ze(e){return e==="agent"?[{name:"inspect",command:"pnpm agent:inspect",required:!0},{name:"build",command:"pnpm build",required:!0},{name:"validate",command:"pnpm agent:validate",required:!0},{name:"eval",command:"pnpm agent:eval",required:!0}]:[{name:"build",command:"pnpm build",required:!0},{name:"validate",command:"pnpm run typecheck",required:!0}]}i(ze,"defaultChecks");function be(e){let t=D(e.id??e.displayName??"")||"draft";return e.kind==="agent"?t==="default"?"agent":`agents/${t}`:e.kind==="skill"?`skills/${e.skillName??t}`:e.kind==="extension"?`extensions/${t}`:e.kind==="model"?`training/models/${t}`:e.kind==="unselected"?"profile":`settings/${e.key??t}`}i(be,"sourceRootForTarget");function U(e){return{planner:{kind:"model",source:"create_improve_model_planner",providerId:e?.providerId??null,modelId:e?.modelId??null}}}i(U,"plannerProvenance");function Fe(){return{planner:{kind:"deterministic",source:"lab_improve_default_planner",providerId:null,modelId:null}}}i(Fe,"deterministicLabPlannerProvenance");function Ke(e){return[{role:"system",content:rt},{role:"user",content:JSON.stringify({run:e,instruction:"Return only openpond.createImprove.plannerDecision.v1 JSON. Ask questions only when the user cannot approve a meaningful plan yet."},null,2)}]}i(Ke,"createImprovePlannerMessages");function Qe(e){return[...e.messages,{role:"assistant",content:We(e.invalidContent)},{role:"user",content:["The previous OpenPond Create/Improve planner decision failed schema validation.","Return only one corrected openpond.createImprove.plannerDecision.v1 JSON object.","Keep the same user intent and plan. Only change fields needed to satisfy the schema.","plan.requirements is only for setup or dependency rows. Use [] when no setup is required.",'For questions use: {"schemaVersion":"openpond.createImprove.plannerDecision.v1","decision":"questions","questions":[{"kind":"free_text","title":"Short label","prompt":"Complete question?","required":true,"options":[]}]}','For a plan use: {"schemaVersion":"openpond.createImprove.plannerDecision.v1","decision":"plan","plan":{...}}',"Do not wrap the JSON in Markdown or add prose.",`Validation error: ${K(e.error)}`].join(`
|
|
2
|
+
import{a as me,c as $,e as L,f as pe,g as ve,h as fe,i as ge,j as Ie,k as q,m as B}from"./chunk-M2SKXY5C.js";import"./chunk-OY5HC2P6.js";import{c as de}from"./chunk-GW766ZSO.js";import{b as ne}from"./chunk-7RC5WPVT.js";import{b as re}from"./chunk-A3L74U3W.js";import"./chunk-7KWD2I6W.js";import"./chunk-XQBIHPPX.js";import{i as te}from"./chunk-7LZISGTA.js";import"./chunk-BFKYRQMA.js";import"./chunk-LO3O45IX.js";import"./chunk-LD7PGREF.js";import"./chunk-XW6HGSIT.js";import{a as ae,b as oe,c as ie,d as se,e as le,f as ce,g as ue,i as N}from"./chunk-UZQNFTLR.js";import"./chunk-KVTBX2UP.js";import{g as E}from"./chunk-FSQWAANK.js";import{A as X,K as ee}from"./chunk-O4FBOUNX.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-WYZWDMMF.js";import"./chunk-DG4TYVPF.js";import{c as J,d as G,e as W,f as Y,g as Z,j as C}from"./chunk-PWK5Z5S3.js";import"./chunk-L3KS6MOV.js";import"./chunk-XO3H32KX.js";import"./chunk-DIGX56JY.js";import"./chunk-R7YEURUQ.js";import"./chunk-DZUAT3TP.js";import"./chunk-H3BSIAQO.js";import"./chunk-637UACKH.js";import"./chunk-A66CSUBJ.js";import"./chunk-SPDSSMFD.js";import"./chunk-E63VWAQA.js";import"./chunk-PR5TYTY4.js";import"./chunk-YR5ID2SS.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-6FA3GG5B.js";import"./chunk-LHA7RQBA.js";import{E as M}from"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import{A as d}from"./chunk-PF56N7ZY.js";import{a as i}from"./chunk-FTQLQJQV.js";var Ee=new Set(["applying_source","running_checks","evaluating","awaiting_promotion","opening_pull_request","pull_request_open","reconciling_release","released","ready","ready_local","pushing_hosted","running_hosted_checks","published_hosted"]);function H(e){return Ee.has(e)}i(H,"isCreateImproveMutationState");function z(e){let t=e.run;if(!t)return;let n=e.actionLabel??"Create/Improve update";if(t.plan&&t.plan.runId!==t.id)throw new Error(`${n} requires a plan linked to the submitted run.`);if(t.workflowCapture&&t.workflowCapture.runId!==t.id)throw new Error(`${n} requires workflow capture linked to the submitted run.`);if(t.plan?.approvalId&&!t.approvalIds.includes(t.plan.approvalId))throw new Error(`${n} requires the plan approval id in the run.`)}i(z,"assertCreateImproveRunLinked");function he(e){let t=e.actionLabel??"Create/Improve mutation",n=e.run;if(!n)throw new Error(`${t} requires a Create/Improve run.`);if(z({actionLabel:t,run:n}),!H(n.state))throw new Error(`${t} cannot start before plan approval.`);if(n.plan?.status!=="approved")throw new Error(`${t} requires an approved plan.`)}i(he,"assertCreateImproveMutationApproved");import{randomUUID as F}from"node:crypto";var $e=d.object({id:d.string().trim().min(1).optional(),label:d.string().trim().min(1),value:d.string().trim().min(1).optional(),description:d.string().trim().min(1).nullable().optional()}),Oe=d.object({id:d.string().trim().min(1).optional(),kind:d.preprocess(Ye,d.enum(["single_choice","free_text"]).default("single_choice")),title:d.string().trim().min(1),prompt:d.string().trim().min(1),required:d.boolean().default(!0),options:d.array($e).default([])}),je=d.object({path:d.string().trim().min(1),operation:d.preprocess(Ze,d.enum(["create","update","delete","inspect"])),reason:d.string().trim().min(1)}),De=d.object({name:d.string().trim().min(1),command:d.string().trim().min(1),required:d.boolean().default(!0)}),Me=d.object({targetId:d.string().trim().min(1).optional().nullable(),targetName:d.string().trim().min(1).optional().nullable(),agentId:d.string().trim().min(1).optional().nullable(),agentName:d.string().trim().min(1).optional().nullable(),summary:d.string().trim().min(1),capturedContextSummary:d.string().trim().min(1),actionShape:G,defaultChatAction:d.object({key:d.string().trim().min(1).nullable().optional(),label:d.string().trim().min(1).nullable().optional(),required:d.boolean().default(!0)}).optional().nullable(),sourcePlan:d.array(je).default([]),requirements:d.array(J).default([]),checks:d.array(De).default([])}),ke=d.discriminatedUnion("decision",[d.object({schemaVersion:d.literal("openpond.createImprove.plannerDecision.v1"),decision:d.literal("questions"),summary:d.string().trim().min(1).optional().nullable(),questions:d.array(Oe).min(1)}),d.object({schemaVersion:d.literal("openpond.createImprove.plannerDecision.v1"),decision:d.literal("plan"),plan:Me})]);async function Pe(e){let t=Ve(e.run);if(t)return Ce({run:e.run,decision:t,modelRef:null});let n=Ke(e.run),o=await Re(e.stream,n),a;try{a=we(o)}catch(u){let v=Qe({messages:n,invalidContent:o,error:u}),R=await Re(e.stream,v);try{a=we(R)}catch(I){throw new Error(`Create/Improve planner repair failed: ${K(I)}; initial error: ${K(u)}`)}}return Ce({run:e.run,decision:a,modelRef:e.modelRef??null})}i(Pe,"runModelBackedCreateImprovePlanner");async function Re(e,t){let n="";for await(let o of e(t))o.text&&(n+=o.text);return n}i(Re,"collectPlannerText");function Ce(e){return e.decision.decision==="questions"?Ne(e.run,e.decision,e.modelRef??null):Le(e.run,e.decision.plan,e.modelRef??null)}i(Ce,"createImproveRunFromPlannerDecision");function Ae(e){let t=new Date().toISOString();return C(e.run,{state:"blocked",plan:null,workflowCapture:Q(e.run),blockedReason:e.reason,metadata:{...e.run.metadata,...U(e.modelRef??null),plannerDecision:"blocked",plannerError:e.reason},updatedAt:t})}i(Ae,"createBlockedCreateImprovePlannerRun");function Ne(e,t,n){let o=new Date().toISOString(),a=t.questions.map((u,v)=>Y.parse({id:u.id??`create_improve_question_${v+1}`,kind:u.kind,title:u.title,prompt:u.prompt,required:u.required,status:"pending",options:u.options.map((R,I)=>({id:R.id??`option_${I+1}`,label:R.label,value:R.value??R.label,description:R.description??null,metadata:{}})),answer:null,metadata:{}}));return C(e,{state:"awaiting_questions",plan:null,workflowCapture:Q(e),approvalIds:[],questionIds:a.map(u=>u.id),questions:a,blockedReason:null,metadata:{...e.metadata,...U(n),plannerDecision:"questions",plannerSummary:t.summary??null},updatedAt:o})}i(Ne,"createQuestionRun");function Le(e,t,n){let o=new Date().toISOString(),a=`create_improve_plan_${F()}`,u=`approval_${F()}`,v=Be(e.target,t,e.objective),R=be(v),I=t.actionShape,k=t.checks.length?t.checks:ze(v.kind),w=t.sourcePlan.length?t.sourcePlan:He({run:{...e,target:v},sourceRoot:R}),b=t.defaultChatAction?.key??I.defaultActionKey??(v.kind==="agent"?v.defaultActionKey:null)??"chat",m=e.surface==="lab_improve"?Fe():U(n),f=W.parse({schemaVersion:"openpond.createImprove.plan.v1",id:a,runId:e.id,status:"pending_approval",objective:e.objective,summary:t.summary,capturedContextSummary:t.capturedContextSummary,defaultChatAction:{key:b,label:t.defaultChatAction?.label??v.displayName??"Chat",required:t.defaultChatAction?.required??!0},sourcePlan:w,requirements:t.requirements,checks:k,approvalId:u,approvedAt:null,editedFromPlanId:null,metadata:{...m,target:v,actionShape:I,actionShapeDecisionSource:e.surface==="lab_improve"?"lab_improve_default_planner":"model_planner"},createdAt:o,updatedAt:o}),y=e.questions.map(h=>h.status==="pending"?{...h,status:"skipped"}:h);return C(e,{state:"awaiting_plan_approval",target:v,plan:f,workflowCapture:Q(e),approvalIds:[u],questionIds:y.map(h=>h.id),questions:y,blockedReason:null,metadata:{...e.metadata,...m,plannerDecision:"plan"},updatedAt:o})}i(Le,"createPlanRun");function Be(e,t,n){let o=t.targetId??t.agentId,a=t.targetName??t.agentName;if(e.kind!=="agent")return{...e,id:e.id??o??null,displayName:e.displayName??a??null};let u=D(o??"")||e.id||D(a??"")||et(n),v=e.id===u&&e.defaultActionKey?e.defaultActionKey:`${u}.chat`;return{...e,id:u,displayName:a??e.displayName,defaultActionKey:v}}i(Be,"plannedTarget");function Q(e){if(e.workflowCapture)return e.workflowCapture;let t=new Date().toISOString(),n=S(e.context.tools.flatMap(o=>o.artifactRefs));return Z.parse({schemaVersion:"openpond.createImprove.workflowCapture.v1",id:`workflow_capture_${F()}`,runId:e.id,command:e.command,objective:e.objective,conversationExcerpts:e.context.conversationExcerpts,attachments:e.context.attachments,apps:e.context.apps,tools:e.context.tools,sideEffects:S(e.context.tools.flatMap(o=>o.sideEffects)),profileActions:S(e.context.tools.map(o=>o.name)),externalProviders:S([...e.context.apps.map(o=>o.name),...e.context.tools.map(o=>tt(o.name))]),environmentVariables:[],files:S(e.context.attachments.map(o=>o.ref?`${o.name} (${o.ref})`:o.name)),schedules:[],webhooks:[],channelTargets:["openpond_chat"],outputArtifacts:n,targetRepoAssumptions:e.context.targetRepoAssumptions,traceRefs:n.filter(o=>/\btrace\b|trace[:/-]/i.test(o)),metadata:{source:"create_improve_model_planner",conversationId:e.scope.conversationId,projectId:e.scope.projectId},createdAt:t})}i(Q,"workflowCaptureForRun");function He(e){return e.run.operation==="improve"&&e.run.target.id?[{path:be(e.run.target),operation:"update",reason:e.run.objective},{path:"settings/profile.yaml",operation:"update",reason:"Preserve the active Profile composition and routing."}]:[{path:e.sourceRoot,operation:"create",reason:e.run.objective},{path:"settings/profile.yaml",operation:"update",reason:"Register the workproduct in the active Profile."}]}i(He,"defaultSourcePlan");function ze(e){return e==="agent"?[{name:"inspect",command:"pnpm agent:inspect",required:!0},{name:"build",command:"pnpm build",required:!0},{name:"validate",command:"pnpm agent:validate",required:!0},{name:"eval",command:"pnpm agent:eval",required:!0}]:[{name:"build",command:"pnpm build",required:!0},{name:"validate",command:"pnpm run typecheck",required:!0}]}i(ze,"defaultChecks");function be(e){let t=D(e.id??e.displayName??"")||"draft";return e.kind==="agent"?t==="default"?"agent":`agents/${t}`:e.kind==="skill"?`skills/${e.skillName??t}`:e.kind==="extension"?`extensions/${t}`:e.kind==="model"?`training/models/${t}`:e.kind==="unselected"?"profile":`settings/${e.key??t}`}i(be,"sourceRootForTarget");function U(e){return{planner:{kind:"model",source:"create_improve_model_planner",providerId:e?.providerId??null,modelId:e?.modelId??null}}}i(U,"plannerProvenance");function Fe(){return{planner:{kind:"deterministic",source:"lab_improve_default_planner",providerId:null,modelId:null}}}i(Fe,"deterministicLabPlannerProvenance");function Ke(e){return[{role:"system",content:rt},{role:"user",content:JSON.stringify({run:e,instruction:"Return only openpond.createImprove.plannerDecision.v1 JSON. Ask questions only when the user cannot approve a meaningful plan yet."},null,2)}]}i(Ke,"createImprovePlannerMessages");function Qe(e){return[...e.messages,{role:"assistant",content:We(e.invalidContent)},{role:"user",content:["The previous OpenPond Create/Improve planner decision failed schema validation.","Return only one corrected openpond.createImprove.plannerDecision.v1 JSON object.","Keep the same user intent and plan. Only change fields needed to satisfy the schema.","plan.requirements is only for setup or dependency rows. Use [] when no setup is required.",'For questions use: {"schemaVersion":"openpond.createImprove.plannerDecision.v1","decision":"questions","questions":[{"kind":"free_text","title":"Short label","prompt":"Complete question?","required":true,"options":[]}]}','For a plan use: {"schemaVersion":"openpond.createImprove.plannerDecision.v1","decision":"plan","plan":{...}}',"Do not wrap the JSON in Markdown or add prose.",`Validation error: ${K(e.error)}`].join(`
|
|
3
3
|
`)}]}i(Qe,"createImprovePlannerRepairMessages");function we(e){let t=Xe(e);if(!t)throw new Error("Create/Improve planner returned no JSON decision.");try{return ke.parse(Ue(JSON.parse(t)))}catch(n){throw n instanceof SyntaxError?new Error(`Create/Improve planner returned invalid JSON: ${n.message}`):n}}i(we,"parsePlannerDecision");function Ue(e){if(!j(e))return e;let t=e.decision==="questions"||e.decision==="plan"?e.decision:Array.isArray(e.questions)?"questions":j(e.plan)?"plan":e.decision,n={...e,schemaVersion:"openpond.createImprove.plannerDecision.v1",decision:t};return t==="questions"&&Array.isArray(e.questions)&&(n.questions=e.questions.map(Je)),n}i(Ue,"normalizePlannerDecision");function Ve(e){if(e.operation!=="improve"||e.surface!=="lab_improve")return null;let t=e.target.displayName??e.target.id??"Agent",n=e.target.id==="account-health-agent"||/account health|renewal risk|weekly account review/i.test(e.objective),o=e.target.kind==="agent"?e.target.defaultActionKey??`${e.target.id??"default"}.chat`:"chat";return ke.parse({schemaVersion:"openpond.createImprove.plannerDecision.v1",decision:"plan",plan:{targetId:e.target.id,targetName:t,summary:`Improve ${t}: ${e.objective}`,capturedContextSummary:"The user supplied the desired outcome in Lab. Inspect the existing Profile source and choose the narrowest implementation that achieves it.",actionShape:{mode:n?"chat_and_direct_actions":"chat",label:n?"Account health chat and reviews":"Chat",detail:n?"Preserve chat plus the account summary, renewal triage, and weekly review actions while applying the correction.":"Preserve the Agent's existing chat surface while improving the requested behavior.",defaultActionKey:o,directActionHint:n?"Preserve summarize-account, triage-renewal-risk, and build-weekly-account-review with their existing inputs and artifacts.":null,artifactPolicy:n?"Keep the source diff, checks, evaluations, and weekly-review Markdown and JSON artifacts with the candidate for review.":"Keep the source diff, checks, and evaluation evidence with the candidate for review."},defaultChatAction:{key:o,label:t,required:!0},sourcePlan:[],requirements:[],checks:[]}})}i(Ve,"labImprovePlanDecision");function Je(e,t){if(typeof e=="string"){let u=e.trim();return{kind:"free_text",title:ye(u,t),prompt:u,required:!0,options:[]}}if(!j(e))return e;let n=Array.isArray(e.options)?e.options.map(Ge):[],o=O(e.prompt,e.question,e.text,e.description,e.label,e.title),a=O(e.title,e.label)??(o?ye(o,t):null);return{...e,kind:e.kind??(n.length?"single_choice":"free_text"),title:a,prompt:o,required:typeof e.required=="boolean"?e.required:!0,options:n}}i(Je,"normalizePlannerQuestion");function Ge(e){if(typeof e=="string"){let n=e.trim();return{label:n,value:n}}if(!j(e))return e;let t=O(e.label,e.name,e.title,e.value);return{...e,label:t,value:O(e.value,t)}}i(Ge,"normalizePlannerQuestionOption");function ye(e,t){let n=e.replace(/\s+/g," ").replace(/[?.!]+$/g,"").trim();return n?n.length<=64?n:`${n.slice(0,61).trimEnd()}...`:`Question ${t+1}`}i(ye,"plannerQuestionTitle");function O(...e){for(let t of e)if(typeof t=="string"&&t.trim())return t.trim();return null}i(O,"firstNonEmptyString");function j(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}i(j,"isRecord");function K(e){return e instanceof d.ZodError?JSON.stringify(e.issues):e instanceof Error?e.message:String(e)}i(K,"plannerErrorSummary");function We(e){return e.length<=12e3?e:`${e.slice(0,12e3)}
|
|
4
4
|
... [truncated invalid planner output]`}i(We,"truncatePlannerContent");function Ye(e){if(e==null||e==="")return;if(typeof e!="string")return e;let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return["single_choice","single_select","single","choice","select","select_one","radio","dropdown","multiple_choice","multi_choice","multi_select","multiple_select","checkbox","checkboxes"].includes(t)?"single_choice":["free_text","text","freeform","free_form","open_text","open_ended","short_answer","textarea","string"].includes(t)?"free_text":e}i(Ye,"normalizePlannerQuestionKind");function Ze(e){if(e==null||e===""||typeof e!="string")return e;let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return["create","add","author","build","generate","implement","init","initialize","materialize","new","scaffold","write","write_file"].includes(t)?"create":["update","change","configure","edit","enable","modify","patch","register","replace","revise","set","upsert"].includes(t)?"update":["delete","remove","unlink"].includes(t)?"delete":["inspect","audit","check","discover","read","review","validate","verify"].includes(t)?"inspect":e}i(Ze,"normalizePlannerSourcePlanOperation");function Xe(e){let t=e.trim(),o=/^```(?:json)?\s*([\s\S]*?)\s*```$/i.exec(t)?.[1]?.trim()??t;if(o.startsWith("{")&&o.endsWith("}"))return o;let a=o.indexOf("{"),u=o.lastIndexOf("}");return a>=0&&u>a?o.slice(a,u+1):null}i(Xe,"extractJsonObject");function et(e){return D(e.toLowerCase().replace(/['"]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"created-agent")}i(et,"targetIdFromObjective");function D(e){return e.trim().toLowerCase().replace(/['"]/g,"").replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}i(D,"normalizeTargetId");function tt(e){let[t]=e.split(".");return t?.trim()||e}i(tt,"providerNameFromTool");function S(e){return Array.from(new Set(e.map(t=>t?.trim()??"").filter(Boolean)))}i(S,"uniqueNonEmpty");var rt=["You are the OpenPond Create/Improve planner.","Decide the user-facing plan before any Profile source or managed artifact is changed.","Use the objective, target type, conversation context, attachments, selected Profile/project, tools, and prior answers.","Do not rely on hidden keyword lists or hardcoded business examples.","Return only JSON with schemaVersion openpond.createImprove.plannerDecision.v1.","","If the user cannot approve a meaningful plan yet, return questions.","A plain-language desired outcome for an existing workproduct is actionable. Inspect its current source and choose implementation details yourself.","Do not ask the user to choose tools, file paths, search strategies, or other implementation details.","Ask a question only when user intent is missing or an irreversible product choice cannot be inferred safely.","If the request is actionable, return a plan with targetId, targetName, summary, capturedContextSummary, actionShape, sourcePlan, requirements, and checks.","requirements is only for setup and dependencies, never acceptance criteria or task bullets.","Every sourcePlan operation must be create, update, delete, or inspect.","Choose chat, direct_action, or chat_and_direct_actions from the actual behavior being created."].join(`
|
|
5
|
-
`);function Se(e){return e.type==="apply_candidate"||e.type==="open_pull_request"||e.type==="reject_candidate"||e.type==="reconcile_pull_request"}i(Se,"isAgentImprovementReleaseAction");async function Te(e){let t=i(()=>new Date().toISOString(),"timestamp"),n=at(e.run,e.action.candidateId);if(!n.git)throw new Error("Agent candidate has no Git lineage.");let o=me(e.run),a=e.run;try{if(e.action.type==="apply_candidate"){let m=a.localProfileCommit?await nt({repoPath:o.repoPath,expectedCommit:a.localProfileCommit,command:e.command}):await Ie({run:a,repoPath:o.repoPath,git:n.git,command:e.command}),f;try{let r=a.tasksetRef?await e.resolveTaskset?.(a.tasksetRef.id,a.tasksetRef.revision,a.tasksetRef.contentHash)??null:null;f=await(e.evaluate??L)({run:a,cwd:o.sourceRoot,sourceRef:o.sourceRootRelativePath,sourceCommit:m,sourceBranch:n.git.baseBranch,candidateId:n.id,subject:"post_release",taskset:r,gradeAttempt:e.gradeTaskAttempt})}catch(r){let l=t(),s=r instanceof Error?r.message:String(r);return C(a,{state:"blocked",localProfileCommit:m,releaseOutcome:{...a.releaseOutcome,status:"pending",profileCommit:m,pullRequest:null,updatedAt:l},externalExecutionRefs:T(a,{kind:"release",id:m,status:"verification_error",metadata:{candidateId:n.id}}),blockedReason:`The change was applied locally, but its post-merge Evals could not run: ${s}`,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"local_verification_error",profileCommit:m,verificationError:s}},updatedAt:l})}let y=t(),h=f.status==="passed"&&f.publishGate==="passed",x=h?$({run:a,candidateId:n.id,outcome:"released",reason:"The promoted Agent passed trusted post-release Taskset evaluation.",receiptRefs:[f.id],timestamp:y}):null;return h&&await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{}),C(a,{state:h?"released":"blocked",candidates:_(a,n.id,{status:h?"accepted":"evaluated",git:{...n.git,worktreePath:h?null:n.git.worktreePath},evaluationReceiptRefs:qe([...n.evaluationReceiptRefs,f.id]),metadata:h?_e(n,{sourceCommit:m,receiptId:f.id,releasedAt:y}):n.metadata,updatedAt:y}),evaluationReceipts:[...a.evaluationReceipts.filter(r=>r.id!==f.id),f],evidenceSnapshots:x?V(a,x):a.evidenceSnapshots,localProfileCommit:m,releaseOutcome:{...a.releaseOutcome,status:h?"released":"pending",profileCommit:m,pullRequest:null,releaseReceiptRef:f.id,updatedAt:y},externalExecutionRefs:T(a,{kind:"release",id:m,status:h?"released":"verification_failed",metadata:{candidateId:n.id,verificationReceiptId:f.id}}),blockedReason:h?null:"The change was applied locally, but the active Agent failed its post-merge Evals.",metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:h?"released":"local_verification_failed",profileCommit:m,postReleaseReceiptId:f.id}},updatedAt:y})}if(e.action.type==="open_pull_request"){let m=await pe({run:a,git:n.git,evaluationSummary:ot(a,n),command:e.command}),f=t();return C(a,{state:"pull_request_open",candidates:_(a,n.id,{git:{...n.git,pullRequest:m},updatedAt:f}),releaseOutcome:{...a.releaseOutcome,status:"pending",pullRequest:m,releaseReceiptRef:`github-pr:${m.number}`,updatedAt:f},externalExecutionRefs:T(a,{kind:"pull_request",id:String(m.number),status:m.state,metadata:{url:m.url,baseBranch:m.baseBranch,headBranch:m.headBranch}}),blockedReason:null,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"pull_request_open",pullRequest:m}},updatedAt:f})}if(e.action.type==="reject_candidate"){let m=e.action.reason?.trim()||"Candidate rejected.";n.git.pullRequest&&await fe({git:n.git,reason:m,cwd:o.repoPath,command:e.command}),await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{});let f=t(),y=$({run:a,candidateId:n.id,outcome:"rejected",reason:m,receiptRefs:n.evaluationReceiptRefs,timestamp:f});return C(a,{state:"rejected",candidates:_(a,n.id,{status:"rejected",git:n.git.pullRequest?{...n.git,pullRequest:{...n.git.pullRequest,state:"closed",updatedAt:f},worktreePath:null}:{...n.git,worktreePath:null},updatedAt:f}),releaseOutcome:{...a.releaseOutcome,status:"rejected",pullRequest:n.git.pullRequest?{...n.git.pullRequest,state:"closed",updatedAt:f}:null,updatedAt:f},evidenceSnapshots:V(a,y),blockedReason:m,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"rejected",rejectionReason:m}},updatedAt:f})}let u=await ve({git:n.git,cwd:o.repoPath,command:e.command});if(u.state==="open"){let m=t();return C(a,{state:"pull_request_open",candidates:_(a,n.id,{git:{...n.git,pullRequest:u},updatedAt:m}),releaseOutcome:{...a.releaseOutcome,status:"pending",pullRequest:u,updatedAt:m},externalExecutionRefs:T(a,{kind:"pull_request",id:String(u.number),status:"open",metadata:{url:u.url}}),blockedReason:null,updatedAt:m})}if(u.state==="closed"){await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{});let m=t();return C(a,{state:"rejected",candidates:_(a,n.id,{status:"rejected",git:{...n.git,pullRequest:u,worktreePath:null},updatedAt:m}),releaseOutcome:{...a.releaseOutcome,status:"rejected",pullRequest:u,updatedAt:m},blockedReason:"The Agent improvement pull request was closed without merge.",updatedAt:m})}let v=await ge({repoPath:o.repoPath,baseBranch:n.git.baseBranch,remoteName:n.git.remoteName,command:e.command}),R=a.tasksetRef?await e.resolveTaskset?.(a.tasksetRef.id,a.tasksetRef.revision,a.tasksetRef.contentHash)??null:null,I=await(e.evaluate??L)({run:a,cwd:o.sourceRoot,sourceRef:o.sourceRootRelativePath,sourceCommit:v,sourceBranch:n.git.baseBranch,candidateId:n.id,subject:"post_release",taskset:R,gradeAttempt:e.gradeTaskAttempt}),k=t(),w=I.status==="passed"&&I.publishGate==="passed",b=w?$({run:a,candidateId:n.id,outcome:"released",reason:"The promoted Agent passed trusted post-release Taskset evaluation.",receiptRefs:[I.id],timestamp:k}):null;return w&&await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{}),C(a,{state:w?"released":"blocked",candidates:_(a,n.id,{status:w?"accepted":"evaluated",git:{...n.git,pullRequest:u,worktreePath:w?null:n.git.worktreePath},evaluationReceiptRefs:qe([...n.evaluationReceiptRefs,I.id]),metadata:w?_e(n,{sourceCommit:v,receiptId:I.id,releasedAt:k}):n.metadata,updatedAt:k}),evaluationReceipts:[...a.evaluationReceipts.filter(m=>m.id!==I.id),I],evidenceSnapshots:b?V(a,b):a.evidenceSnapshots,localProfileCommit:v,releaseOutcome:{...a.releaseOutcome,status:w?"released":"pending",profileCommit:v,pullRequest:u,releaseReceiptRef:I.id,updatedAt:k},externalExecutionRefs:T(a,{kind:"pull_request",id:String(u.number),status:"merged",metadata:{url:u.url,mergeCommit:u.mergeCommit,profileCommit:v,verificationReceiptId:I.id}}),blockedReason:w?null:"The PR merged, but the active Agent failed its post-merge publish-gate Eval.",metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:w?"released":"merged_verification_failed",pullRequest:u,profileCommit:v,postReleaseReceiptId:I.id}},updatedAt:k})}catch(u){let v=t();return C(a,{state:a.state==="rejected"?"rejected":"blocked",blockedReason:u instanceof Error?u.message:String(u),metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"release_action_failed",action:e.action.type}},updatedAt:v})}}i(Te,"executeAgentImprovementReleaseAction");function V(e,t){return[...e.evidenceSnapshots.filter(n=>n.id!==t.id),t]}i(V,"uniqueEvidence");async function nt(e){let n=await(e.command??(async(a,u,v,R)=>{let{runWorkspaceCommand:I}=await import("./workspaces-
|
|
5
|
+
`);function Se(e){return e.type==="apply_candidate"||e.type==="open_pull_request"||e.type==="reject_candidate"||e.type==="reconcile_pull_request"}i(Se,"isAgentImprovementReleaseAction");async function Te(e){let t=i(()=>new Date().toISOString(),"timestamp"),n=at(e.run,e.action.candidateId);if(!n.git)throw new Error("Agent candidate has no Git lineage.");let o=me(e.run),a=e.run;try{if(e.action.type==="apply_candidate"){let m=a.localProfileCommit?await nt({repoPath:o.repoPath,expectedCommit:a.localProfileCommit,command:e.command}):await Ie({run:a,repoPath:o.repoPath,git:n.git,command:e.command}),f;try{let r=a.tasksetRef?await e.resolveTaskset?.(a.tasksetRef.id,a.tasksetRef.revision,a.tasksetRef.contentHash)??null:null;f=await(e.evaluate??L)({run:a,cwd:o.sourceRoot,sourceRef:o.sourceRootRelativePath,sourceCommit:m,sourceBranch:n.git.baseBranch,candidateId:n.id,subject:"post_release",taskset:r,gradeAttempt:e.gradeTaskAttempt})}catch(r){let l=t(),s=r instanceof Error?r.message:String(r);return C(a,{state:"blocked",localProfileCommit:m,releaseOutcome:{...a.releaseOutcome,status:"pending",profileCommit:m,pullRequest:null,updatedAt:l},externalExecutionRefs:T(a,{kind:"release",id:m,status:"verification_error",metadata:{candidateId:n.id}}),blockedReason:`The change was applied locally, but its post-merge Evals could not run: ${s}`,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"local_verification_error",profileCommit:m,verificationError:s}},updatedAt:l})}let y=t(),h=f.status==="passed"&&f.publishGate==="passed",x=h?$({run:a,candidateId:n.id,outcome:"released",reason:"The promoted Agent passed trusted post-release Taskset evaluation.",receiptRefs:[f.id],timestamp:y}):null;return h&&await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{}),C(a,{state:h?"released":"blocked",candidates:_(a,n.id,{status:h?"accepted":"evaluated",git:{...n.git,worktreePath:h?null:n.git.worktreePath},evaluationReceiptRefs:qe([...n.evaluationReceiptRefs,f.id]),metadata:h?_e(n,{sourceCommit:m,receiptId:f.id,releasedAt:y}):n.metadata,updatedAt:y}),evaluationReceipts:[...a.evaluationReceipts.filter(r=>r.id!==f.id),f],evidenceSnapshots:x?V(a,x):a.evidenceSnapshots,localProfileCommit:m,releaseOutcome:{...a.releaseOutcome,status:h?"released":"pending",profileCommit:m,pullRequest:null,releaseReceiptRef:f.id,updatedAt:y},externalExecutionRefs:T(a,{kind:"release",id:m,status:h?"released":"verification_failed",metadata:{candidateId:n.id,verificationReceiptId:f.id}}),blockedReason:h?null:"The change was applied locally, but the active Agent failed its post-merge Evals.",metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:h?"released":"local_verification_failed",profileCommit:m,postReleaseReceiptId:f.id}},updatedAt:y})}if(e.action.type==="open_pull_request"){let m=await pe({run:a,git:n.git,evaluationSummary:ot(a,n),command:e.command}),f=t();return C(a,{state:"pull_request_open",candidates:_(a,n.id,{git:{...n.git,pullRequest:m},updatedAt:f}),releaseOutcome:{...a.releaseOutcome,status:"pending",pullRequest:m,releaseReceiptRef:`github-pr:${m.number}`,updatedAt:f},externalExecutionRefs:T(a,{kind:"pull_request",id:String(m.number),status:m.state,metadata:{url:m.url,baseBranch:m.baseBranch,headBranch:m.headBranch}}),blockedReason:null,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"pull_request_open",pullRequest:m}},updatedAt:f})}if(e.action.type==="reject_candidate"){let m=e.action.reason?.trim()||"Candidate rejected.";n.git.pullRequest&&await fe({git:n.git,reason:m,cwd:o.repoPath,command:e.command}),await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{});let f=t(),y=$({run:a,candidateId:n.id,outcome:"rejected",reason:m,receiptRefs:n.evaluationReceiptRefs,timestamp:f});return C(a,{state:"rejected",candidates:_(a,n.id,{status:"rejected",git:n.git.pullRequest?{...n.git,pullRequest:{...n.git.pullRequest,state:"closed",updatedAt:f},worktreePath:null}:{...n.git,worktreePath:null},updatedAt:f}),releaseOutcome:{...a.releaseOutcome,status:"rejected",pullRequest:n.git.pullRequest?{...n.git.pullRequest,state:"closed",updatedAt:f}:null,updatedAt:f},evidenceSnapshots:V(a,y),blockedReason:m,metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"rejected",rejectionReason:m}},updatedAt:f})}let u=await ve({git:n.git,cwd:o.repoPath,command:e.command});if(u.state==="open"){let m=t();return C(a,{state:"pull_request_open",candidates:_(a,n.id,{git:{...n.git,pullRequest:u},updatedAt:m}),releaseOutcome:{...a.releaseOutcome,status:"pending",pullRequest:u,updatedAt:m},externalExecutionRefs:T(a,{kind:"pull_request",id:String(u.number),status:"open",metadata:{url:u.url}}),blockedReason:null,updatedAt:m})}if(u.state==="closed"){await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{});let m=t();return C(a,{state:"rejected",candidates:_(a,n.id,{status:"rejected",git:{...n.git,pullRequest:u,worktreePath:null},updatedAt:m}),releaseOutcome:{...a.releaseOutcome,status:"rejected",pullRequest:u,updatedAt:m},blockedReason:"The Agent improvement pull request was closed without merge.",updatedAt:m})}let v=await ge({repoPath:o.repoPath,baseBranch:n.git.baseBranch,remoteName:n.git.remoteName,command:e.command}),R=a.tasksetRef?await e.resolveTaskset?.(a.tasksetRef.id,a.tasksetRef.revision,a.tasksetRef.contentHash)??null:null,I=await(e.evaluate??L)({run:a,cwd:o.sourceRoot,sourceRef:o.sourceRootRelativePath,sourceCommit:v,sourceBranch:n.git.baseBranch,candidateId:n.id,subject:"post_release",taskset:R,gradeAttempt:e.gradeTaskAttempt}),k=t(),w=I.status==="passed"&&I.publishGate==="passed",b=w?$({run:a,candidateId:n.id,outcome:"released",reason:"The promoted Agent passed trusted post-release Taskset evaluation.",receiptRefs:[I.id],timestamp:k}):null;return w&&await q({repoPath:o.repoPath,git:n.git,command:e.command}).catch(()=>{}),C(a,{state:w?"released":"blocked",candidates:_(a,n.id,{status:w?"accepted":"evaluated",git:{...n.git,pullRequest:u,worktreePath:w?null:n.git.worktreePath},evaluationReceiptRefs:qe([...n.evaluationReceiptRefs,I.id]),metadata:w?_e(n,{sourceCommit:v,receiptId:I.id,releasedAt:k}):n.metadata,updatedAt:k}),evaluationReceipts:[...a.evaluationReceipts.filter(m=>m.id!==I.id),I],evidenceSnapshots:b?V(a,b):a.evidenceSnapshots,localProfileCommit:v,releaseOutcome:{...a.releaseOutcome,status:w?"released":"pending",profileCommit:v,pullRequest:u,releaseReceiptRef:I.id,updatedAt:k},externalExecutionRefs:T(a,{kind:"pull_request",id:String(u.number),status:"merged",metadata:{url:u.url,mergeCommit:u.mergeCommit,profileCommit:v,verificationReceiptId:I.id}}),blockedReason:w?null:"The PR merged, but the active Agent failed its post-merge publish-gate Eval.",metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:w?"released":"merged_verification_failed",pullRequest:u,profileCommit:v,postReleaseReceiptId:I.id}},updatedAt:k})}catch(u){let v=t();return C(a,{state:a.state==="rejected"?"rejected":"blocked",blockedReason:u instanceof Error?u.message:String(u),metadata:{...a.metadata,agentImprovement:{...A(a.metadata.agentImprovement),status:"release_action_failed",action:e.action.type}},updatedAt:v})}}i(Te,"executeAgentImprovementReleaseAction");function V(e,t){return[...e.evidenceSnapshots.filter(n=>n.id!==t.id),t]}i(V,"uniqueEvidence");async function nt(e){let n=await(e.command??(async(a,u,v,R)=>{let{runWorkspaceCommand:I}=await import("./workspaces-5DF4H5EX.js");return I(a,u,v,R)}))("git",["rev-parse","HEAD"],e.repoPath),o=n.code===0?n.stdout.trim():"";if(!o||o!==e.expectedCommit)throw new Error("The active Profile moved after the change was applied. Review the current Profile before re-running Evals.");return o}i(nt,"verifyAppliedProfileCommit");function at(e,t){let n=e.candidates.find(o=>o.id===t);if(!n)throw new Error(`Create/Improve candidate not found: ${t}`);return n}i(at,"requireCandidate");function _(e,t,n){return e.candidates.map(o=>o.id===t?{...o,...n}:o)}i(_,"updateCandidate");function _e(e,t){return{...e.metadata,agentPackageLineage:{...A(e.metadata.agentPackageLineage),releasedSourceCommit:t.sourceCommit,postReleaseReceiptId:t.receiptId,releasedAt:t.releasedAt}}}i(_e,"releasedCandidateMetadata");function ot(e,t){return e.evaluationReceipts.filter(o=>o.candidateId===t.id&&(o.subject==="active"||o.subject==="candidate")).map(o=>{let a=o.summaryCounts,u=a?`${a.passed}/${a.total} passed`:o.status;return`- **${o.subject==="active"?"Base":"Candidate"}** \`${o.sourceCommit?.slice(0,12)??"unknown"}\`: ${u}; publish gate ${o.publishGate}.`}).join(`
|
|
6
6
|
`)}i(ot,"evaluationSummary");function T(e,t){return[...e.externalExecutionRefs.filter(n=>!(n.kind===t.kind&&n.id===t.id)),t]}i(T,"mergeExternalRef");function qe(e){return[...new Set(e)]}i(qe,"unique");function A(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}i(A,"record");function $t(e){let t=new de("create/improve apply job"),n=e.streamOpenPondHostedChatTurn??te;async function o(r,l){let s=X.parse(l);if(s.runId!==r)throw new Error("Create/Improve action route does not match the submitted run.");let c=await e.mutateCreateImproveRun(s,xe=>se(xe,s)),p=c.replayed?await e.getCreateImproveRun(s.runId)??c.run:c.run,g=await h(p),P=await e.getSession(p.scope.conversationId??g.sessionId);return!c.replayed&&ae(p)&&(p=await k({session:P,turn:g,run:p,signal:new AbortController().signal})),!c.replayed&&H(p.state)&&(he({actionLabel:"Create/Improve action",run:p}),p=le(p,P)),await m({session:P,turnId:g.id,run:p,source:"ui_button"}),!c.replayed&&Se(s)?R({session:P,turn:g,run:p,action:s}):!c.replayed&&y(p)&&v({session:P,turn:g,run:p}),await e.getCreateImproveRun(p.id)??p}i(o,"applyCreateImproveActionPayload");async function a(r,l){let s=ee.parse(l),c=await e.getApproval(r);if(!c||c.kind!=="create_plan")return null;if(c.status!=="pending")throw new Error("Approval not found or already resolved");let p=c.turnId?await e.getTurn(c.turnId):null,g=p?.createImproveRun??(c.providerRequestId?await e.getCreateImproveRun(String(c.providerRequestId)):null);if(!p||!g)throw new Error("Create/Improve approval is missing its run.");let P=s.decision==="accept"||s.decision==="acceptForSession"?"approve_plan":(s.decision==="cancel","cancel");return await o(g.id,{type:P,runId:g.id,expectedRevision:g.revision,actionId:`approval:${r}:${s.decision}`,...P==="cancel"?{reason:s.decision==="cancel"?"Plan review cancelled.":"Plan review declined."}:{}}),e.getApproval(r)}i(a,"resolveCreateImproveApproval");async function u(r){let l=r.run,s=l?.plan??null;if(!l||!s?.approvalId)return null;let c=await e.getApproval(s.approvalId),p=ie({existing:c,session:r.session,turn:r.turn,run:l,status:oe(s.status)});return await e.upsertApproval(p),!c&&p.status==="pending"&&await e.appendRuntimeEvent(E({sessionId:r.session.id,turnId:r.turn.id,name:"approval.requested",source:"server",action:"create_plan",appId:r.session.appId,status:"pending",output:p.title,data:p})),c?.status==="pending"&&p.status!=="pending"&&await e.appendRuntimeEvent(E({sessionId:r.session.id,turnId:r.turn.id,name:"approval.resolved",source:"server",action:"create_plan",appId:r.session.appId,status:p.status==="accepted"||p.status==="accepted_for_session"?"completed":"failed",output:p.title,data:{approvalId:p.id,runId:l.id,status:p.status}})),p}i(u,"syncCreateImprovePlanApproval");function v(r){let l=`${r.run.id}:${r.run.revision}`;if(t.has(l))return;let s=e.turnFollowUpQueue.enqueue({label:`Apply approved ${r.run.target.kind} Create/Improve run`,metadata:{key:l,sessionId:r.session.id,turnId:r.turn.id,runId:r.run.id,revision:r.run.revision}},async()=>{try{await I(r)}catch(c){let p=c instanceof Error?c.message:String(c);await m({session:r.session,turnId:r.turn.id,run:ue(r.run,p),source:"server"})}finally{t.delete(l)}});t.set(l,s)}i(v,"queueCreateImproveExecution");function R(r){let l=`release:${r.run.id}:${r.run.revision}:${r.action.type}`;if(t.has(l))return;let s=e.turnFollowUpQueue.enqueue({label:`${r.action.type.replaceAll("_"," ")} for Agent improvement`,metadata:{key:l,sessionId:r.session.id,turnId:r.turn.id,runId:r.run.id,revision:r.run.revision,action:r.action.type}},async()=>{try{let c=await e.getCreateImproveRun(r.run.id)??r.run,p=await Te({run:c,action:r.action,resolveTaskset:e.resolveTaskset,gradeTaskAttempt:e.gradeTaskAttempt});await m({session:r.session,turnId:r.turn.id,run:p,source:"server"})}finally{t.delete(l)}});t.set(l,s)}i(R,"queueAgentImprovementReleaseAction");async function I(r){let l=await e.getTurn(r.turn.id)??r.turn,s=await e.getCreateImproveRun(r.run.id)??r.run,c=B(s.target);if(!c.canExecute(s))return;let p=c.normalizeResult(await c.execute(s,{session:r.session,turn:l,ensureCodexRuntime:e.ensureCodexRuntime,appendRuntimeEvent:e.appendRuntimeEvent,setProviderTurnId:i(g=>x(r.session.id,r.turn.id,g),"setProviderTurnId"),onRun:i(async g=>{await m({session:r.session,turnId:r.turn.id,run:g,source:"server"})},"onRun"),model:r.session.provider==="codex"?r.session.modelRef?.modelId??null:null,runChecks:e.runLocalCreatePipelineChecks,resolveTaskset:e.resolveTaskset,gradeTaskAttempt:e.gradeTaskAttempt}));await m({session:r.session,turnId:r.turn.id,run:p,source:"server"})}i(I,"runQueuedCreateImproveExecution");async function k(r){if(e.planCreateImprove)return e.planCreateImprove({run:r.run,modelRef:r.turn.modelRef,requestId:`${r.turn.id}:create-improve-planner`,signal:r.signal});let l=r.turn.modelRef?.providerId??r.session.provider,s=r.turn.modelRef?.modelId??(l==="openpond"?M:null);if(l==="openpond"){let c=s||M;return w({...r,provider:l,model:c,modelRef:{providerId:l,modelId:c},requestId:`${r.turn.id}:create-improve-planner`,stream:i(async function*(p){for await(let g of n({model:c,messages:p,requestId:`${r.turn.id}:create-improve-planner`,signal:r.signal}))g.type==="text_delta"&&g.text&&(yield{text:g.text,raw:g.raw}),g.type==="usage"&&(yield{raw:g.raw,usage:g.usage})},"stream")})}if(re(l)&&e.streamLocalByokChatTurn){if(!s)throw new Error(`Create/Improve planner requires a selected model for provider ${l}.`);return w({...r,provider:l,model:s,modelRef:{providerId:l,modelId:s},requestId:`${r.turn.id}:create-improve-planner`,stream:i(c=>e.streamLocalByokChatTurn({providerId:l,modelId:s,messages:c,requestId:`${r.turn.id}:create-improve-planner`,promptCacheKey:r.session.id,signal:r.signal}),"stream")})}throw new Error("Create/Improve planner requires OpenPond Chat or a configured OpenAI-compatible provider.")}i(k,"planCreateImproveForTurn");async function w(r){let l=N(r.turn,r.run),s=await ne({session:r.session,turn:l,provider:r.provider,model:r.model,requestId:r.requestId,requestOrdinal:0,requestKind:"create_improve_planner",upsert:e.upsertModelUsageRecord});try{let c=await Pe({run:r.run,modelRef:r.modelRef,requestId:r.requestId,signal:r.signal,stream:i(async function*(p){for await(let g of r.stream(p))s.observeDelta(g),yield g},"stream")});return l.createImproveRun=c,await s.complete(),c}catch(c){throw await s.fail(c,r.signal.aborted||c instanceof Error&&c.name==="AbortError"?"interrupted":"failed"),c}}i(w,"runRecordedPlanner");async function b(r){let l=await e.getCreateImproveRun(r.run.id)??r.turn.createImproveRun??r.run;return l.state!=="planning"?e.getTurn(r.turn.id):m({session:r.session,turnId:r.turn.id,run:Ae({run:l,modelRef:r.turn.modelRef,reason:`Create/Improve planner failed: ${r.message}`}),source:"server"})}i(b,"persistCreateImprovePlanningFailure");async function m(r){z({actionLabel:"Persist Create/Improve run",run:r.run});let l=r.run.scope.originTurnId?r.run:C(r.run,{scope:{...r.run.scope,originTurnId:r.turnId},updatedAt:new Date().toISOString()});await e.upsertCreateImproveRun(l);let s=await e.updateTurn(r.turnId,c=>{if(c.sessionId!==r.session.id)throw new Error("Turn not found");return N(c,l)});if(!s)throw new Error("Turn not found");return await f(r.session,s,l,r.source),await u({session:r.session,turn:s,run:l}),s}i(m,"persistCreateImproveRun");async function f(r,l,s,c){await e.appendRuntimeEvent(E({sessionId:r.id,turnId:l.id,name:"create_improve.updated",source:c,appId:r.appId,status:ce(s),output:s.blockedReason??s.plan?.summary??s.state,data:{createImproveRun:s}}))}i(f,"appendRunEvent");function y(r){return B(r.target).canExecute(r)}i(y,"shouldExecuteTarget");async function h(r){let l=r.scope.originTurnId;if(!l)throw new Error(`Create/Improve run ${r.id} is not linked to a turn.`);let s=await e.getTurn(l);if(!s)throw new Error(`Create/Improve turn not found: ${l}`);return s}i(h,"turnForRun");async function x(r,l,s){await e.updateTurn(l,c=>c.sessionId===r?{...c,providerTurnId:s}:c)}return i(x,"setTurnProviderTurnId"),{applyCreateImproveActionPayload:o,assertNoLeakedApplyJobs:i(()=>t.assertEmpty(),"assertNoLeakedApplyJobs"),getCreateImproveRun:e.getCreateImproveRun,listCreateImproveRuns:e.listCreateImproveRuns,persistCreateImprovePlanningFailure:b,persistCreateImproveRun:m,planCreateImproveForTurn:k,queueCreateImproveExecution:v,resolveCreateImproveApproval:a,syncCreateImprovePlanApproval:u}}i($t,"createCreateImproveRuntime");export{$t as createCreateImproveRuntime};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as N,b as E,c as P,d as J,e as j,f as S,g as O,h as C,i as R,j as k,k as B,l as q,m as U,n as L,o as l}from"./chunk-JHEFWB6O.js";import{m as v,s as w,t as y}from"./chunk-ISFIDCIH.js";import"./chunk-23P2O7PH.js";import"./chunk-AW5Q6NXT.js";import"./chunk-YVNDDNMK.js";import"./chunk-XRKFTPHD.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{b as I,f,g as h,h as p}from"./chunk-3M53YXEI.js";import"./chunk-EL454L26.js";import"./chunk-BT5YNE5U.js";import"./chunk-PXS4SVQG.js";import"./chunk-FWIPHEVA.js";import"./chunk-ENSB6ZTM.js";import"./chunk-GLUWATL5.js";import"./chunk-RYGWCN2R.js";import"./chunk-ZZWAQBA2.js";import"./chunk-YR5ID2SS.js";import"./chunk-KNO355LC.js";import"./chunk-Y54RKLOI.js";import"./chunk-2SUMZ73C.js";import"./chunk-M55H7KVR.js";import"./chunk-BK63OQRW.js";import"./chunk-V4KT5FCJ.js";import"./chunk-LHA7RQBA.js";import"./chunk-SG6JZ7HD.js";import"./chunk-ON2RNOCG.js";import"./chunk-H7IWJN7L.js";import"./chunk-SFNCAPCJ.js";import"./chunk-RCA6NGVA.js";import"./chunk-VHSX3JPX.js";import"./chunk-BIPQCJ5V.js";import"./chunk-PF56N7ZY.js";import{a as b}from"./chunk-FTQLQJQV.js";async function M(r,o,e,i){if(o==="list-files"){let t=i[1];if(!t)throw new Error("usage: sandbox list-files <sandboxId> [--path <path>]");let n=typeof e.path=="string"?e.path.trim():void 0,s=h(e.maxEntries,"max-entries"),a=e.recursive!==void 0?f(e.recursive):void 0,d=await r.listFiles(t,{...n?{path:n}:{},...a!==void 0?{recursive:a}:{},...s!==void 0?{maxEntries:s}:{}});return console.log(JSON.stringify({sandbox:l(d.sandbox),files:d.files},null,2)),!0}if(o==="upload-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"",s=typeof e.contents=="string"?e.contents:typeof e.content=="string"?e.content:"",a=typeof e.contentsBase64=="string"?e.contentsBase64.trim():typeof e.contentBase64=="string"?e.contentBase64.trim():"";if(!t||!n)throw new Error('usage: sandbox upload-file <sandboxId> --path <path> --contents "text"');if(!s&&!a)throw new Error('usage: sandbox upload-file <sandboxId> --path <path> --contents "text"');let d=a?await r.uploadFileBase64(t,n,a):await r.uploadFile(t,n,s);return console.log(JSON.stringify({sandbox:l(d.sandbox),file:d.file},null,2)),!0}if(o==="download-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"",s=Number(e["offset-bytes"]),a=Number(e["max-bytes"]);if(!t||!n)throw new Error("usage: sandbox download-file <sandboxId> --path <path>");let d=await r.downloadFileResponse(t,{path:n,...Number.isFinite(s)?{offsetBytes:s}:{},...Number.isFinite(a)?{maxBytes:a}:{}});return console.log(JSON.stringify({sandbox:l(d.sandbox),file:d.file,contents:Buffer.from(d.file.contentsBase64,"base64").toString("utf-8")},null,2)),!0}if(o==="search-files"){let t=i[1],n=typeof e.query=="string"?e.query.trim():"";if(!t||!n)throw new Error("usage: sandbox search-files <sandboxId> --query <text> [--path <path>]");let s=typeof e.path=="string"?e.path.trim():void 0,a=h(e.maxResults,"max-results"),d=await r.searchFiles(t,{query:n,...s?{path:s}:{},...a!==void 0?{maxResults:a}:{}});return console.log(JSON.stringify({sandbox:l(d.sandbox),matches:d.matches},null,2)),!0}if(o==="delete-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"";if(!t||!n)throw new Error("usage: sandbox delete-file <sandboxId> --path <path> [--recursive]");let s=await r.deleteFile(t,n,{recursive:f(e.recursive)});return console.log(JSON.stringify({sandbox:l(s.sandbox),deleted:s.deleted},null,2)),!0}if(o==="stat-file"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"";if(!t||!n)throw new Error("usage: sandbox stat-file <sandboxId> --path <path>");let s=await r.statFile(t,n);return console.log(JSON.stringify({sandbox:l(s.sandbox),file:s.file},null,2)),!0}if(o==="mkdir"){let t=i[1],n=typeof e.path=="string"?e.path.trim():"";if(!t||!n)throw new Error("usage: sandbox mkdir <sandboxId> --path <path> [--recursive false]");let s=await r.mkdir(t,{path:n,recursive:e.recursive!==void 0?f(e.recursive):void 0});return console.log(JSON.stringify({sandbox:l(s.sandbox),directory:s.directory},null,2)),!0}if(o==="move-file"){let t=i[1],n=typeof e.fromPath=="string"?e.fromPath.trim():"",s=typeof e.toPath=="string"?e.toPath.trim():"";if(!t||!n||!s)throw new Error("usage: sandbox move-file <sandboxId> --from-path <path> --to-path <path> [--overwrite]");let a=await r.moveFile(t,{fromPath:n,toPath:s,overwrite:f(e.overwrite)});return console.log(JSON.stringify({sandbox:l(a.sandbox),moved:a.moved,file:a.file},null,2)),!0}return!1}b(M,"handleSandboxFilesCommand");async function T(r,o,e,i){if(o==="git-status"){let t=i[1];if(!t)throw new Error("usage: sandbox git-status <sandboxId>");let n=await r.gitStatus(t);return console.log(JSON.stringify({sandbox:l(n.sandbox),status:n.status},null,2)),!0}if(o==="git-diff"){let t=i[1];if(!t)throw new Error("usage: sandbox git-diff <sandboxId> [--base-ref <ref>]");let n=typeof e.baseRef=="string"&&e.baseRef.trim()?e.baseRef.trim():void 0,s=await r.gitDiff(t,{...n?{baseRef:n}:{}});return console.log(JSON.stringify({sandbox:l(s.sandbox),diff:s.diff},null,2)),!0}if(o==="git-export-patch"){let t=i[1];if(!t)throw new Error("usage: sandbox git-export-patch <sandboxId> [--base-ref <ref>]");let n=typeof e.baseRef=="string"&&e.baseRef.trim()?e.baseRef.trim():void 0,s=await r.gitExportPatch(t,{...n?{baseRef:n}:{}});return console.log(JSON.stringify({sandbox:l(s.sandbox),patch:s.patch},null,2)),!0}if(o==="git-branch"){let t=i[1],n=typeof e.branch=="string"?e.branch.trim():"",s=typeof e.startPoint=="string"&&e.startPoint.trim()?e.startPoint.trim():void 0;if(!t||!n)throw new Error("usage: sandbox git-branch <sandboxId> --branch <name> [--create] [--start-point <ref>]");let a=await r.gitBranch(t,{branch:n,create:f(e.create),...s?{startPoint:s}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),branch:a.branch},null,2)),!0}if(o==="git-commit"){let t=i[1],n=typeof e.message=="string"?e.message.trim():"",s=f(e.all),d=(typeof e.paths=="string"?e.paths:typeof e.path=="string"?e.path:"").split(",").map(g=>g.trim()).filter(Boolean);if(!t||!n||!s&&d.length===0)throw new Error('usage: sandbox git-commit <sandboxId> --message "..." [--all|--paths <csv>]');let c=await r.gitCommit(t,{message:n,...s?{all:!0}:{paths:d}});return console.log(JSON.stringify({sandbox:l(c.sandbox),commit:c.commit},null,2)),!0}if(o==="git-pull"){let t=i[1];if(!t)throw new Error("usage: sandbox git-pull <sandboxId> [--remote origin] [--branch main] [--rebase|--ff-only false]");let n=typeof e.remote=="string"&&e.remote.trim()?e.remote.trim():void 0,s=typeof e.branch=="string"&&e.branch.trim()?e.branch.trim():void 0,a=await r.gitPull(t,{...n?{remote:n}:{},...s?{branch:s}:{},...e.rebase!==void 0?{rebase:f(e.rebase)}:{},...e.ffOnly!==void 0?{ffOnly:f(e.ffOnly)}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),pull:a.pull},null,2)),!0}if(o==="git-push"){let t=i[1];if(!t)throw new Error("usage: sandbox git-push <sandboxId> [--remote origin] [--branch main] [--set-upstream] [--force-with-lease]");let n=typeof e.remote=="string"&&e.remote.trim()?e.remote.trim():void 0,s=typeof e.branch=="string"&&e.branch.trim()?e.branch.trim():void 0,a=await r.gitPush(t,{...n?{remote:n}:{},...s?{branch:s}:{},...e.setUpstream!==void 0?{setUpstream:f(e.setUpstream)}:{},...e.forceWithLease!==void 0?{forceWithLease:f(e.forceWithLease)}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),push:a.push},null,2)),!0}return!1}b(T,"handleSandboxGitCommand");async function F(r,o,e,i){if(o==="process-start"){let t=i[1],n=(typeof e.command=="string"?e.command:null)||i.slice(2).join(" ");if(!t||!n.trim())throw new Error("usage: sandbox process-start <sandboxId> --command <command>");let s=p(e.timeoutSeconds,"timeout-seconds"),a=await r.startProcess(t,{command:n.trim(),...s!==void 0?{timeoutSeconds:s}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),process:a.process},null,2)),!0}if(o==="process-list"){let t=i[1];if(!t)throw new Error("usage: sandbox process-list <sandboxId>");let n=await r.listProcesses(t);return console.log(JSON.stringify({sandbox:l(n.sandbox),processes:n.processes},null,2)),!0}if(o==="process-get"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox process-get <sandboxId> <processId> [--since <cursor>]");let s=p(e.since,"since"),a=await r.getProcess(t,n,{...s!==void 0?{since:s}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),process:a.process,output:a.output,cursor:a.cursor,completed:a.completed},null,2)),!0}if(o==="process-stop"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox process-stop <sandboxId> <processId>");let s=await r.stopProcess(t,n);return console.log(JSON.stringify({sandbox:l(s.sandbox),process:s.process},null,2)),!0}if(o==="process-stream"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox process-stream <sandboxId> <processId> [--since <cursor>]");let s=p(e.since,"since");return await r.streamProcessOutput(t,n,{...s!==void 0?{since:s}:{}}),!0}if(o==="pty-start"){let t=i[1];if(!t)throw new Error("usage: sandbox pty-start <sandboxId> [--command <command>]");let n=(typeof e.command=="string"?e.command:null)||i.slice(2).join(" "),s=p(e.timeoutSeconds,"timeout-seconds"),a=p(e.rows,"rows"),d=p(e.cols,"cols"),c=await r.startPty(t,{...n.trim()?{command:n.trim()}:{},...s!==void 0?{timeoutSeconds:s}:{},...a!==void 0?{rows:a}:{},...d!==void 0?{cols:d}:{}});return console.log(JSON.stringify({sandbox:l(c.sandbox),pty:c.pty},null,2)),!0}if(o==="pty-list"){let t=i[1];if(!t)throw new Error("usage: sandbox pty-list <sandboxId>");let n=await r.listPtys(t);return console.log(JSON.stringify({sandbox:l(n.sandbox),ptys:n.ptys},null,2)),!0}if(o==="pty-get"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox pty-get <sandboxId> <ptyId> [--since <cursor>]");let s=p(e.since,"since"),a=await r.getPty(t,n,{...s!==void 0?{since:s}:{}});return console.log(JSON.stringify({sandbox:l(a.sandbox),pty:a.pty,output:a.output,cursor:a.cursor,completed:a.completed},null,2)),!0}if(o==="pty-write"){let t=i[1],n=i[2],s=typeof e.inputBase64=="string"?e.inputBase64.trim():"",a=(typeof e.input=="string"?e.input:null)||i.slice(3).join(" ");if(!t||!n||!s&&!a)throw new Error("usage: sandbox pty-write <sandboxId> <ptyId> --input <text>");let d=await r.writePtyInput(t,n,s?{dataBase64:s}:a);return console.log(JSON.stringify({sandbox:l(d.sandbox),pty:d.pty},null,2)),!0}if(o==="pty-stop"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox pty-stop <sandboxId> <ptyId>");let s=await r.stopPty(t,n);return console.log(JSON.stringify({sandbox:l(s.sandbox),pty:s.pty},null,2)),!0}if(o==="pty-stream"){let t=i[1],n=i[2];if(!t||!n)throw new Error("usage: sandbox pty-stream <sandboxId> <ptyId> [--since <cursor>]");let s=p(e.since,"since");return await r.streamPtyOutput(t,n,{...s!==void 0?{since:s}:{}}),!0}return!1}b(F,"handleSandboxProcessCommand");async function A(r,o,e,i){if(o==="replays"||o==="replay-list"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=typeof e.projectId=="string"?e.projectId.trim():"",s=await r.listReplays({...t?{teamId:t}:{},...n?{projectId:n}:{}});if(f(e.json))return console.log(JSON.stringify(s,null,2)),!0;if(s.replays.length===0)return console.log("no sandbox replays found"),!0;for(let a of s.replays)console.log(O(a));return!0}if(o==="replay-start"||o==="start-replay"){let t=await r.startReplay(k(e));return console.log(JSON.stringify(t,null,2)),!0}if(o==="replay-get"||o==="get-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-get <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=await r.getReplay(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});return console.log(JSON.stringify(a,null,2)),!0}if(o==="replay-logs"||o==="logs-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-logs <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=await r.getReplayLogs(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});for(let d of a.logs)console.log(d);return!0}if(o==="replay-artifacts"||o==="artifacts-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-artifacts <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=await r.getReplayArtifacts(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});return console.log(JSON.stringify({replayId:a.replayId,artifacts:a.artifacts.map(C)},null,2)),!0}if(o==="replay-cancel"||o==="cancel-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-cancel <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=await r.cancelReplay(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});return console.log(JSON.stringify(a,null,2)),!0}if(o==="replay-watch"||o==="watch-replay"){let t=i[1];if(!t)throw new Error("usage: sandbox replay-watch <replayId> [--team-id <id>]");let n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.projectId=="string"?e.projectId.trim():"",a=p(e.intervalMs,"interval-ms")??5e3,d=p(e.timeoutMs,"timeout-ms")??900*1e3,c=Date.now(),g=new Set;for(;Date.now()-c<=d;){let u=await r.getReplay(t,{...n?{teamId:n}:{},...s?{projectId:s}:{}});for(let m of u.replay.logs)g.has(m)||(g.add(m),console.log(m));if(u.replay.state==="succeeded"||u.replay.state==="failed"||u.replay.state==="canceled"){if(console.log(O(u.replay)),u.replay.state!=="succeeded")throw new Error(`sandbox replay ${u.replay.state}: ${u.replay.error??"no error"}`);return!0}await new Promise(m=>setTimeout(m,a))}throw new Error(`sandbox replay did not finish within ${d}ms`)}return!1}b(A,"handleSandboxReplayCommand");async function V(r,o,e,i){if(o==="runtime-list"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=typeof e.projectId=="string"?e.projectId.trim():"",s=typeof e.agentId=="string"?e.agentId.trim():"",a=await r.listSandboxRuntimes({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{}});return console.log(JSON.stringify({runtimes:a},null,2)),!0}if(o==="runtime-get"){let t=i[1]?.trim();if(!t)throw new Error("usage: sandbox runtime-get <runtimeId>");let n=await r.getSandboxRuntime(t);return console.log(JSON.stringify({runtime:n},null,2)),!0}if(o==="runtime-events"){let t=i[1]?.trim();if(!t)throw new Error("usage: sandbox runtime-events <runtimeId>");return console.log(JSON.stringify(await r.listSandboxRuntimeEvents(t),null,2)),!0}if(o==="runtime-status"){let t=i[1]?.trim(),n=typeof e.status=="string"&&e.status.trim()?e.status.trim():"",s=Number(e.expectedVersion),a=typeof e.summary=="string"&&e.summary.trim()?e.summary.trim():void 0;if(!t||!n||!Number.isInteger(s))throw new Error("usage: sandbox runtime-status <runtimeId> --status <status> --expected-version <n>");let d=await r.updateSandboxRuntimeStatus(t,{status:n,expectedVersion:s,...a?{summary:a}:{}});return console.log(JSON.stringify({runtime:d},null,2)),!0}if(o==="runtime-event"){let t=i[1]?.trim(),n=typeof e.type=="string"&&e.type.trim()?e.type.trim():"",s=typeof e.summary=="string"&&e.summary.trim()?e.summary.trim():void 0,a=typeof e.payload=="string"&&e.payload.trim()?I(e.payload,"payload"):void 0,d=typeof e.lifecycleHint=="string"&&e.lifecycleHint.trim()?I(e.lifecycleHint,"lifecycle-hint"):void 0;if(!t||!n)throw new Error("usage: sandbox runtime-event <runtimeId> --type <eventType> [--summary <text>] [--payload <json>] [--lifecycle-hint <json>]");return console.log(JSON.stringify(await r.emitSandboxRuntimeEvent(t,{type:n,...s?{summary:s}:{},...a?{payload:a}:{},...d?{lifecycleHint:d}:{}}),null,2)),!0}if(o==="runtime-preserve-source"||o==="runtime-preserve"){let t=i[1]?.trim(),n=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():"",s=typeof e.sandboxId=="string"&&e.sandboxId.trim()?e.sandboxId.trim():"",a=typeof e.message=="string"&&e.message.trim()?e.message.trim():"";if(!t)throw new Error("usage: sandbox runtime-preserve-source <runtimeId> [--team-id <id>] [--sandbox-id <id>] [--message <text>]");return console.log(JSON.stringify(await r.runtimes.preserveSource(t,{...s?{sandboxId:s}:{},...a?{message:a}:{}},{...n?{teamId:n}:{}}),null,2)),!0}return!1}b(V,"handleSandboxRuntimeCommand");async function $(r,o,e,i){if(o==="secrets"||o==="secret-list"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=await r.listSecrets({...t?{teamId:t}:{}});if(f(e.json))return console.log(JSON.stringify({secrets:n.map(y)},null,2)),!0;if(n.length===0)return console.log("no sandbox secrets found"),!0;for(let s of n)console.log(`${s.name} ${s.status} v${s.currentVersion??"current"} ${s.secretRef}`);return!0}if(o==="secret-create"){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=typeof e.name=="string"?e.name.trim():"",s=typeof e.description=="string"&&e.description.trim()?e.description.trim():void 0,a=e.scope==="project"||e.scope==="template"||e.scope==="team"?e.scope:void 0;if(!n)throw new Error("usage: sandbox secret-create --name <ENV_NAME> [--team-id <id>] [--stdin]");let d=await w(e,`Value for ${n}`),c=await r.createSecret({...t?{teamId:t}:{},name:n,value:d,...s?{description:s}:{},...a?{scope:a}:{}});return console.log(JSON.stringify({secret:y(c)},null,2)),!0}if(o==="secret-rotate"){let t=i[1],n=typeof e.teamId=="string"?e.teamId.trim():"";if(!t)throw new Error("usage: sandbox secret-rotate <secretId> [--team-id <id>] [--stdin]");let s=await w(e,"New secret value"),a=await r.rotateSecret(t,{...n?{teamId:n}:{},value:s});return console.log(JSON.stringify({secret:y(a)},null,2)),!0}if(o==="secret-attach"){let t=i[1],n=typeof e.teamId=="string"?e.teamId.trim():"",s=typeof e.envName=="string"?e.envName.trim():"",a=e.targetType==="sandbox"||e.targetType==="template"||e.targetType==="project"||e.targetType==="agent"||e.targetType==="replay"?e.targetType:void 0,d=typeof e.targetId=="string"?e.targetId.trim():"";if(!t||!s||!a||!d)throw new Error("usage: sandbox secret-attach <secretId> --env-name <ENV_NAME> --target-type sandbox|project|agent|template|replay --target-id <id>");let c=await r.attachSecret(t,{...n?{teamId:n}:{},envName:s,targetType:a,targetId:d});return console.log(JSON.stringify({secret:y(c)},null,2)),!0}if(o==="secret-revoke"||o==="secret-delete"){let t=i[1],n=typeof e.teamId=="string"?e.teamId.trim():"";if(!t)throw new Error(`usage: sandbox ${o} <secretId> [--team-id <id>]`);let s=o==="secret-revoke"?await r.revokeSecret(t,{...n?{teamId:n}:{}}):await r.deleteSecret(t,{...n?{teamId:n}:{}});return console.log(JSON.stringify({secret:y(s)},null,2)),!0}return!1}b($,"handleSandboxSecretsCommand");async function H(r,o,e,i){if(o==="published-snapshot-builds"||o==="published-snapshot-build-list"||o==="template-builds"||o==="template-build-list"){let t=typeof e.teamId=="string"?e.teamId.trim():"";if(!t)throw new Error("usage: sandbox published-snapshot-builds --team-id <id>");let n=await r.listPublishedSnapshotBuilds({teamId:t});if(f(e.json))return console.log(JSON.stringify({builds:n},null,2)),!0;if(n.length===0)return console.log("no published snapshot builds found"),!0;for(let s of n)console.log(S(s));return!0}if(o==="published-snapshot-build-create"||o==="create-published-snapshot-build"||o==="template-build-create"||o==="create-template-build"){let t=await r.createPublishedSnapshotBuild(U(e));return console.log(JSON.stringify({build:t},null,2)),!0}if(o==="published-snapshot-build-get"||o==="get-published-snapshot-build"||o==="template-build-get"||o==="get-template-build"){let t=i[1];if(!t)throw new Error("usage: sandbox published-snapshot-build-get <buildId>");let n=await r.getPublishedSnapshotBuild(t);return console.log(JSON.stringify({build:n},null,2)),!0}if(o==="published-snapshot-build-logs"||o==="published-snapshot-build-log"||o==="template-build-logs"||o==="template-build-log"){let t=i[1];if(!t)throw new Error("usage: sandbox published-snapshot-build-logs <buildId>");let n=await r.getPublishedSnapshotBuildLogs(t);if(f(e.json))return console.log(JSON.stringify(n,null,2)),!0;for(let s of n.logs)console.log(s);return!0}if(o==="published-snapshot-build-cancel"||o==="cancel-published-snapshot-build"||o==="template-build-cancel"||o==="cancel-template-build"){let t=i[1];if(!t)throw new Error("usage: sandbox published-snapshot-build-cancel <buildId>");let n=await r.cancelPublishedSnapshotBuild(t);return console.log(JSON.stringify({build:n},null,2)),!0}if(o==="published-snapshot-build-watch"||o==="watch-published-snapshot-build"||o==="template-build-watch"||o==="watch-template-build"){let t=i[1];if(!t)throw new Error("usage: sandbox published-snapshot-build-watch <buildId>");let n=p(e.intervalMs,"interval-ms")??5e3,s=p(e.timeoutMs,"timeout-ms")??900*1e3,a=Date.now(),d=new Set;for(;Date.now()-a<=s;){let[c,g]=await Promise.all([r.getPublishedSnapshotBuild(t),r.getPublishedSnapshotBuildLogs(t)]);for(let u of g.logs)d.has(u)||(d.add(u),console.log(u));if(c.status==="succeeded"||c.status==="failed"||c.status==="cancelled"){if(console.log(S(c)),c.status!=="succeeded")throw new Error(`published snapshot build ${c.status}: ${c.error??"no error"}`);return!0}await new Promise(u=>setTimeout(u,n))}throw new Error(`published snapshot build did not finish within ${s}ms`)}return!1}b(H,"handleSandboxTemplateBuildsCommand");function G(r){return f(r.async)||f(r.respondAsync)}b(G,"parseSandboxAsyncOption");async function Pe(r,o){let e=o[0]||"list",i=await v(r);if(e==="list"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.agentId=="string"?r.agentId.trim():"",a=await i.list({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{}});if(a.length===0){console.log("no sandboxes found");return}for(let d of a)console.log(P(d));return}if(e==="mcp-config"||e==="mcp-url"){let t=i.mcpServerConfig();console.log(JSON.stringify({...t,headers:{"openpond-api-key":"set OPENPOND_API_KEY or use your saved openpond profile"}},null,2));return}if(!await V(i,e,r,o)){if(e==="pricing"){let t=await i.pricing();console.log(JSON.stringify(t,null,2));return}if(e==="costs"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.agentId=="string"?r.agentId.trim():"",a=await i.costs({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{}});if(f(r.summary)){console.log(JSON.stringify({costs:{teamId:a.costs.teamId,ownerUserId:a.costs.ownerUserId,generatedAt:a.costs.generatedAt,summary:a.costs.summary,lineItems:a.costs.lineItems,tiers:a.costs.pricing.tiers.map(d=>({key:d.key,resources:d.resources,keepRunningEstimate:d.keepRunningEstimate}))}},null,2));return}console.log(JSON.stringify(a,null,2));return}if(!await $(i,e,r,o)){if(e==="snapshots"||e==="snapshot-catalog"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.agentId=="string"?r.agentId.trim():"",a=typeof r.query=="string"&&r.query.trim()?r.query.trim():typeof r.q=="string"&&r.q.trim()?r.q.trim():"",d=typeof r.tag=="string"?r.tag.trim():"",c=typeof r.useCase=="string"?r.useCase.trim():"",g=typeof r.replayState=="string"?r.replayState.trim():"",u=await i.snapshotCatalog({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{},...a?{q:a}:{},...d?{tag:d}:{},...c?{useCase:c}:{},...g==="draft"||g==="validated"||g==="published"?{replayState:g}:{}});if(u.snapshots.length===0){console.log("no sandbox snapshots found");return}for(let m of u.snapshots)console.log(J(m));return}if(e==="published-snapshots"||e==="published-snapshot-catalog"||e==="templates"||e==="template-catalog"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.query=="string"&&r.query.trim()?r.query.trim():typeof r.q=="string"&&r.q.trim()?r.q.trim():"",a=typeof r.name=="string"&&r.name.trim()?r.name.trim():typeof r.templateName=="string"&&r.templateName.trim()?r.templateName.trim():"",d=typeof r.version=="string"?r.version.trim():"",c=typeof r.tag=="string"?r.tag.trim():"",g=typeof r.useCase=="string"?r.useCase.trim():"",u=await i.publishedSnapshots({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{q:s}:{},...a?{name:a}:{},...d?{version:d}:{},...c?{tag:c}:{},...g?{useCase:g}:{}});if(u.publishedSnapshots.length===0){console.log("no published snapshots found");return}for(let m of u.publishedSnapshots)console.log(j(m));return}if(!(await H(i,e,r,o)||await A(i,e,r,o))){if(e==="run-published-snapshot"||e==="published-snapshot-run"||e==="template-launch"||e==="launch-template"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.snapshotId=="string"&&r.snapshotId.trim()?r.snapshotId.trim():typeof r.snapshot=="string"&&r.snapshot.trim()?r.snapshot.trim():"",a=typeof r.templateName=="string"&&r.templateName.trim()?r.templateName.trim():typeof r.name=="string"&&r.name.trim()?r.name.trim():typeof o[1]=="string"&&o[1].trim()?o[1].trim():"",d=typeof r.version=="string"?r.version.trim():"",c=typeof r.useCase=="string"?r.useCase.trim():"";if(!s&&!a&&!c)throw new Error("usage: sandbox run-published-snapshot [--snapshot-id <id>|--name <name>|--use-case <id>] [--version <v>]");let g=typeof r.budgetUsd=="string"&&r.budgetUsd.trim()?r.budgetUsd.trim():typeof r.budget=="string"&&r.budget.trim()?r.budget.trim():"",u=await i.runPublishedSnapshot({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{snapshotId:s}:{},...a?{templateName:a}:{},...d?{version:d}:{},...c?{useCase:c}:{},...g?{budget:{maxUsd:g}}:{},metadata:{source:"openpond-code-published-snapshot-run"}});console.log(JSON.stringify(u,null,2));return}if(e==="snapshot-fork"||e==="fork-snapshot"){let t=o[1];if(!t)throw new Error("snapshot-fork requires <snapshotId>");let n=typeof r.teamId=="string"?r.teamId.trim():"",s=typeof r.projectId=="string"?r.projectId.trim():"",a=typeof r.budgetUsd=="string"&&r.budgetUsd.trim()?r.budgetUsd.trim():typeof r.budget=="string"&&r.budget.trim()?r.budget.trim():"",d=await i.forkSnapshot(t,{...n?{teamId:n}:{},...s?{projectId:s}:{},...a?{budget:{maxUsd:a}}:{},metadata:{source:"openpond-code-snapshot-fork",templateSnapshotId:t}});console.log(JSON.stringify(d,null,2));return}if(e==="snapshot-create"||e==="create-snapshot"){let t=o[1];if(!t)throw new Error("usage: sandbox snapshot-create <sandboxId> --name <name>");let n=await i.createSnapshot(t,L(r));console.log(JSON.stringify(n,null,2));return}if(e==="snapshot-validate"||e==="validate-snapshot"){let t=o[1],n=o[2];if(!t||!n)throw new Error("snapshot-validate requires <sandboxId> <snapshotId>");let s=R(r.cleanup),a=await i.validateSnapshot(t,n,{...s?{cleanup:s}:{}});console.log(JSON.stringify(a,null,2));return}if(e==="snapshot-publish"||e==="publish-snapshot"){let t=o[1],n=o[2];if(!t||!n)throw new Error("snapshot-publish requires <sandboxId> <snapshotId>");let s=await i.publishSnapshot(t,n);console.log(JSON.stringify(s,null,2));return}if(e==="integration-connections"){let t=typeof r.teamId=="string"?r.teamId.trim():"",n=typeof r.projectId=="string"?r.projectId.trim():"",s=typeof r.agentId=="string"?r.agentId.trim():"",a=r.status==="active"||r.status==="revoked"||r.status==="error"||r.status==="all"?r.status:void 0,d=await i.integrationConnections({...t?{teamId:t}:{},...n?{projectId:n}:{},...s?{agentId:s}:{},...a?{status:a}:{}});console.log(JSON.stringify(d,null,2));return}if(e==="create"){let t=await N(i,B(r));console.log(JSON.stringify({sandbox:l(t.sandbox),...t.runtime?{runtime:t.runtime}:{}},null,2));return}if(e==="exec"){let t=o[1],n=(typeof r.command=="string"?r.command:null)||o.slice(2).join(" ");if(!t||!n.trim())throw new Error("usage: sandbox exec <sandboxId> --command <command>");let s=p(r.timeoutSeconds,"timeout-seconds"),a=await i.exec(t,{command:n.trim(),...s!==void 0?{timeoutSeconds:s}:{}});console.log(JSON.stringify({sandbox:l(a.sandbox),command:a.command},null,2));return}if(e==="port"||e==="preview"){let t=o[1],n=p(r.port,"port");if(!t||n===void 0)throw new Error("usage: sandbox port <sandboxId> --port <port>");let s=typeof r.label=="string"?r.label:void 0,a=typeof r.access=="string"?r.access.trim():"";if(a&&a!=="private"&&a!=="public")throw new Error("sandbox port --access must be private or public");let d=a==="public"?"public":"private",c=typeof r.domain=="string"?r.domain.trim():"",g=typeof r.authToken=="string"?r.authToken:"",u=typeof r.authHeader=="string"?r.authHeader.trim():"",m=typeof r.authHeaderValue=="string"?r.authHeaderValue:"";if(g&&(u||m))throw new Error("sandbox port auth options must use either --auth-token or --auth-header with --auth-header-value");if(u&&!m||!u&&m)throw new Error("sandbox port custom header auth requires both --auth-header and --auth-header-value");let x=await i.openPort(t,{port:n,...s?{label:s}:{},access:d,...r["auto-start"]||r.autoStart?{autoStart:!0}:{},...c?{customDomain:c}:{},...g?{authPolicy:{mode:"bearer",token:g}}:{},...u&&m?{authPolicy:{mode:"header",headerName:u,headerValue:m}}:{}});console.log(JSON.stringify(x.preview,null,2));return}if(e==="stop"){let t=o[1];if(!t)throw new Error("usage: sandbox stop <sandboxId> [--fail-on-unpreserved-changes] [--async]");let n=await i.stop(t,{failOnUnpreservedChanges:f(r.failOnUnpreservedChanges),async:G(r)});console.log(JSON.stringify({sandbox:l(n.sandbox),receipt:n.receipt},null,2));return}if(e==="start"){let t=o[1];if(!t)throw new Error("usage: sandbox start <sandboxId>");let n=await i.start(t);console.log(JSON.stringify({sandbox:await E(i,n.sandbox),receipt:n.receipt},null,2));return}if(e==="delete"){let t=o[1];if(!t)throw new Error("usage: sandbox delete <sandboxId> [--fail-on-unpreserved-changes] [--async]");let n=await i.delete(t,{failOnUnpreservedChanges:f(r.failOnUnpreservedChanges),async:G(r)});console.log(JSON.stringify({sandbox:l(n)},null,2));return}if(e==="receipts"){let t=o[1];if(!t)throw new Error("usage: sandbox receipts <sandboxId>");let n=await i.receipts(t);console.log(JSON.stringify({receipts:n},null,2));return}if(e==="logs"){let t=o[1];if(!t)throw new Error("usage: sandbox logs <sandboxId>");let n=await i.logs(t);for(let s of n)console.log(s);return}if(!(await F(i,e,r,o)||await M(i,e,r,o)||await T(i,e,r,o))){if(e==="billing"){let t=o[1];if(!t)throw new Error("usage: sandbox billing <sandboxId>");let n=await i.billing(t);console.log(JSON.stringify({sandbox:l(n.sandbox),billing:n.billing},null,2));return}if(e==="integration-leases"){let t=o[1];if(!t)throw new Error("usage: sandbox integration-leases <sandboxId>");let n=await i.integrationLeases(t);console.log(JSON.stringify({sandbox:l(n.sandbox),integrationLeases:n.integrationLeases},null,2));return}if(e==="integration-attach"){let t=o[1];if(!t)throw new Error("usage: sandbox integration-attach <sandboxId> --integration-connection <id> --integration-capabilities <csv>");let n=await i.attachIntegrationConnection(t,q(r));console.log(JSON.stringify({sandbox:l(n.sandbox),integrationLeases:n.integrationLeases},null,2));return}if(e==="integration-remove"){let t=o[1],n=typeof r.leaseId=="string"?r.leaseId.trim():"";if(!t||!n)throw new Error("usage: sandbox integration-remove <sandboxId> --lease-id <id>");let s=await i.removeIntegrationLease(t,n);console.log(JSON.stringify({sandbox:l(s.sandbox),integrationLeases:s.integrationLeases},null,2));return}if(e==="smoke"){let t=typeof r.repo=="string"?r.repo.trim():void 0,n=typeof r.budgetUsd=="string"?r.budgetUsd.trim():typeof r.budget=="string"?r.budget.trim():void 0,s=f(r.keep),a=r.preview!==void 0?f(r.preview):!f(r.noPreview),d=f(r.snapshot),c=f(r.fork),g={...t?{repo:t}:{},...n?{budgetUsd:n}:{},keep:s,preview:a,snapshot:d,fork:c};typeof r.expectedMppMode=="string"&&r.expectedMppMode.trim()&&(g.expectedMppMode=r.expectedMppMode.trim());let u=h(r.cpu,"cpu"),m=h(r.memoryGb,"memory-gb"),x=h(r.diskGb,"disk-gb");u!==void 0&&(g.cpu=u),m!==void 0&&(g.memoryGb=m),x!==void 0&&(g.diskGb=x);let z=await i.smoke(g);console.log(JSON.stringify(z,null,2));return}throw new Error("usage: sandbox <list|mcp-config|runtime-list|runtime-get|runtime-events|runtime-status|runtime-event|runtime-preserve-source|pricing|costs|secrets|secret-create|secret-rotate|secret-attach|secret-revoke|secret-delete|snapshots|published-snapshots|run-published-snapshot|snapshot-fork|snapshot-validate|snapshot-publish|create|exec|port|preview|stop|start|delete|receipts|logs|billing|process-start|process-list|process-get|process-stop|process-stream|pty-start|pty-list|pty-get|pty-write|pty-stop|pty-stream|upload-file|download-file|list-files|search-files|delete-file|stat-file|mkdir|move-file|git-status|git-diff|git-export-patch|git-branch|git-commit|git-pull|git-push|smoke> [args]")}}}}}b(Pe,"runSandboxCommand");export{Pe as runSandboxCommand};
|