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
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{d as c,e as i}from"./chunk-
|
|
2
|
+
import{d as c,e as i}from"./chunk-WDEO44UN.js";import{j as l}from"./chunk-DG4TYVPF.js";import{m as o}from"./chunk-BIPQCJ5V.js";import{a as n}from"./chunk-FTQLQJQV.js";async function u(e,s){let a=await e.getHarnessRunOverlay(s);if(!a)return c(e);let t=await e.getHarnessWorkspace(a.workspace.workspaceId),r=await e.getHarnessReleaseRecord(a.baseHarnessRelease.contentHash);if(!t||!r||r.harnessRelease.id!==a.baseHarnessRelease.id)throw new Error("Durable Agent run overlay references an unavailable Harness release.");return i({workspace:t,release:r})}n(u,"loadLocalHarnessRuntimeForAgentRun");async function m(e){let s=await e.store.getHarnessRunOverlay(e.runId);if(s){if(s.workspace.workspaceId!==e.workspace.id||s.baseHarnessRelease.id!==e.harnessRelease.id||s.baseHarnessRelease.contentHash!==e.harnessRelease.contentHash)throw new Error("The durable Agent run is already bound to a different Harness release; start a fresh run or explicitly rebase its overlay.");return s}let a=l({schemaVersion:"openpond.harnessRunOverlay.v1",id:`overlay-${o({runId:e.runId,harnessRelease:e.harnessRelease}).slice(0,24)}`,runId:e.runId,baseHarnessRelease:e.harnessRelease,workspace:{workspaceId:e.workspace.id,revision:e.workspace.revision,sourceRevision:e.workspace.sourceRevision,channelRevision:e.workspace.currentChannel.revision},revision:0,status:"active",edits:[],createdAt:e.admittedAt,updatedAt:e.admittedAt,metadata:{}});return e.store.createHarnessRunOverlay(a)}n(m,"ensureLocalHarnessRunOverlay");export{u as a,m as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{r as m,s as u}from"./chunk-
|
|
2
|
+
import{r as m,s as u}from"./chunk-VHSX3JPX.js";import{l as h}from"./chunk-BIPQCJ5V.js";import{a as o}from"./chunk-FTQLQJQV.js";import x from"node:path";import{randomUUID as H}from"node:crypto";import{access as E,mkdir as c,readFile as b,realpath as l,rename as P,rm as S,writeFile as v}from"node:fs/promises";import n from"node:path";async function p(r){let e=n.join(r.storeDir,"training","harnesses",r.harnessHash,"source"),s=!1;try{await E(e),s=!0}catch(a){if(a.code!=="ENOENT")throw a}if(s)return d(e,r.files);await c(n.dirname(e),{recursive:!0});let t=`${e}.materializing-${H()}`;await c(t);try{let a=await l(r.sourcePath);for(let i of r.files){let R=await w(a,i),f=y(t,i.path);await c(n.dirname(f),{recursive:!0}),await v(f,R,{flag:"wx",mode:384})}try{await P(t,e)}catch(i){if(!["EEXIST","ENOTEMPTY","EPERM"].includes(i.code??""))throw i}return await d(e,r.files)}finally{await S(t,{recursive:!0,force:!0})}}o(p,"materializeHarnessSource");async function d(r,e){let s=await l(r),t=new Map;for(let a of e)t.set(a.path,await w(s,a));return t}o(d,"verifyFiles");async function w(r,e){let s=y(r,e.path),t=await l(s);g(r,t);let a=await b(t);if(a.byteLength!==e.sizeBytes||h(a)!==e.contentHash)throw new Error(`Released Harness file ${e.path} does not match its immutable bytes.`);return a}o(w,"readVerifiedFile");function y(r,e){let s=n.resolve(r,...e.split("/"));return g(r,s),s}o(y,"containedPath");function g(r,e){let s=n.relative(r,e);if(!s||s===".."||s.startsWith(`..${n.sep}`)||n.isAbsolute(s))throw new Error("Released Harness file escapes its execution directory.")}o(g,"assertContained");async function $(r){let{release:e}=r,s=await p({sourcePath:x.join(e.bundlePath,"source"),storeDir:r.storeDir,harnessHash:e.harnessRelease.contentHash,files:e.harnessRelease.files}),t=m({agentSnapshot:e.agentSnapshot,harnessRelease:e.harnessRelease,files:s});return u(t,{id:e.harnessRelease.id,contentHash:e.harnessRelease.contentHash})}o($,"profileTrainingSource");export{p as a,$ as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as y}from"./chunk-ZCHXGRRU.js";import{l as v}from"./chunk-ACYFMLWG.js";import{b as e}from"./chunk-ES2ISFJC.js";import{a as s}from"./chunk-FTQLQJQV.js";var te="application/vnd.openpond.training+json;version=2",M="application/vnd.openpond.model-project+json;version=2",ne=1048576,ae=67108864,oe=8388608,h=524288,J=8388608,u=class extends Error{static{s(this,"OpenPondProtocolError")}code;constructor(t,n){super(n),this.name="OpenPondProtocolError",this.code=t}};function w(t){return JSON.stringify(S(t))}s(w,"canonicalJson");function $(t){return new TextEncoder().encode(w(t)).byteLength}s($,"canonicalJsonByteLength");async function O(t){let n=new TextEncoder().encode(w(t)),i=await globalThis.crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(i),o=>o.toString(16).padStart(2,"0")).join("")}s(O,"canonicalSha256");function x(t,n,i){let o=$(t);if(o>n)throw new u("payload_too_large",`${i} is ${o} bytes; the maximum is ${n} bytes.`)}s(x,"assertCanonicalPayloadSize");function H(t,n,i){let o=new TextEncoder().encode(t).byteLength;if(o>n)throw new u("response_too_large",`${i} is ${o} bytes; the maximum is ${n} bytes.`);try{return JSON.parse(t)}catch{throw new u("invalid_json",`${i} was not valid JSON.`)}}s(H,"parseBoundedJson");function S(t){if(t===null||typeof t=="string"||typeof t=="boolean")return t;if(typeof t=="number"){if(!Number.isFinite(t))throw new u("non_json_value","Canonical JSON cannot contain a non-finite number.");return Object.is(t,-0)?0:t}if(Array.isArray(t))return t.map(n=>S(n));if(typeof t=="object"){let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)throw new u("non_json_value","Canonical JSON accepts only plain objects.");let i={};for(let o of Object.keys(t).sort()){let r=t[o];if(r===void 0||typeof r=="function"||typeof r=="symbol")throw new u("non_json_value",`Canonical JSON cannot contain ${typeof r} at ${o}.`);i[o]=S(r)}return i}throw new u("non_json_value",`Canonical JSON cannot contain ${typeof t}.`)}s(S,"normalizeCanonicalJson");var a=e.string().trim().min(1).max(500),d=e.string().regex(/^[a-f0-9]{64}$/),c=e.string().datetime({offset:!0}),m=e.object({id:a,contentHash:d}).strict(),P=m.extend({revision:e.number().int().positive()}).strict(),p=e.object({schemaVersion:e.literal("openpond.baseModelPreference.v1"),modelId:a,revision:e.string().trim().min(1).max(256).nullable(),tokenizerRevision:e.string().trim().min(1).max(256).nullable(),chatTemplateHash:e.string().trim().min(8).max(256).nullable(),modelAssetId:a.nullable(),source:e.enum(["managed","local","builtin"])}).strict(),T=e.enum(["sft","dpo","grpo","ppo","sdft","opd","opsd","sdpo"]),B=e.object({schemaVersion:e.string().regex(/^openpond\.[A-Za-z0-9]+Recipe\.v\d+$/),method:T,parameterization:e.enum(["lora","full"])}).catchall(e.unknown()),D=e.object({profileProjectId:a,sourceRevision:e.string().regex(/^[a-f0-9]{40,64}$/),harnessRelease:m}).strict(),U=e.object({profileProjectId:a,sourceRevision:e.string().regex(/^[a-f0-9]{40,64}$/),catalogHash:d,definitionId:a,harnessRelease:m,tasksetRelease:m}).strict(),E=e.object({tasksetRef:P.nullable().default(null),evaluationTasksetRef:P.nullable().optional(),profileSource:D.nullable().optional(),profileEvaluation:U.nullable().optional(),rewardBindingRef:P.nullable().optional(),tasksetRelease:m.nullable().default(null),harnessRelease:m.nullable().default(null),baseModel:p.nullable().default(null),method:T.nullable().default(null),destinationId:a.nullable().default(null),managedRolloutPlacement:e.enum(["local","remote"]).default("remote"),managedGpuPlacementObjective:e.enum(["fast","balanced","economical"]).default("balanced"),managedGpuRequirement:e.enum(["any","h100_hbm3"]).default("any"),runPreset:e.enum(["small","standard","custom","small_experiment"]).nullable().default(null),recipe:B.nullable().default(null),preferredMaximumSpendUsd:e.number().nonnegative().nullable().default(null),preferredRetentionDays:e.number().int().nonnegative().nullable().default(null)}).strict(),N=E.omit({managedGpuRequirement:!0}),q=e.object({schemaVersion:e.literal("openpond.hostedModelProjectLink.v1"),apiOrigin:e.string().url().refine(t=>new URL(t).origin===t,"Use a canonical API origin.").nullable().default(null),teamId:a,projectId:a,portableProjectId:a,revision:e.number().int().positive(),etag:d,syncedSourceRevision:e.number().int().positive(),syncedAt:c,tasksets:e.array(e.object({localTasksetId:a,localTasksetHash:d.nullable().default(null),releaseId:a,releaseRevision:e.number().int().positive(),releaseHash:d,packageHash:d.nullable().default(null),hostedTasksetId:a,syncedAt:c}).strict()).max(1e4).default([])}).strict(),L=e.object({localTasksetId:a,releaseId:a,releaseRevision:e.number().int().positive(),releaseHash:d,state:e.enum(["syncing","synced","sync_failed"]),hostedTasksetId:a.nullable().default(null),lastAttemptAt:c,syncedAt:c.nullable().default(null),lastError:e.string().trim().min(1).max(5e3).nullable().default(null)}).strict(),V=e.object({schemaVersion:e.literal("openpond.modelProject.v2"),id:a,profileId:a,revision:e.number().int().positive().default(1),name:e.string().trim().min(1).max(200),objective:e.string().trim().max(5e3).nullable(),defaultBaseModel:p.nullable(),defaultDestinationId:a.nullable(),trainingSetup:E,hosted:q.nullable().default(null),tasksetSyncs:e.array(L).max(1e4).default([]),createdAt:c,updatedAt:c}).strict(),k=V.pick({id:!0,profileId:!0,name:!0,objective:!0,defaultBaseModel:!0,defaultDestinationId:!0,trainingSetup:!0}),G=e.object({schemaVersion:e.literal("openpond.modelProjectSave.v1"),operationId:a,expectedRevision:e.number().int().nonnegative(),project:k,learning:y.optional()}).strict().superRefine((t,n)=>{t.learning&&t.expectedRevision!==0&&n.addIssue({code:"custom",path:["learning"],message:"Use learning settings to edit an existing Model's policy."})}),Y=e.object({schemaVersion:e.literal("openpond.modelProjectConfigurationCheck.v1"),configurationHash:d,projectId:a,expectedRevision:e.number().int().nonnegative(),checkedAt:c,canSave:e.boolean(),deferred:e.array(e.enum(["base_model","taskset"])).max(2),findings:e.array(e.object({code:a,severity:e.enum(["error","warning"]),message:e.string().min(1).max(5e3),field:e.string().min(1).max(500).nullable()}).strict()).max(100)}).strict(),z=e.object({id:a,name:e.string().min(1).max(500),available:e.boolean(),preference:p}).strict();async function re(t){let n=g(t);return O({project:n.project,expectedRevision:n.expectedRevision,...n.learning?{learning:n.learning}:{}})}s(re,"modelProjectConfigurationHash");function g(t){try{v(t,h)}catch{throw new C(400,{schemaVersion:"openpond.modelProjectApiError.v2",code:"model_configuration_json_invalid",message:"Model configuration must be bounded JSON data.",retryable:!1,requestId:null,details:{}})}return G.parse(t)}s(g,"parseModelProjectSaveRequest");async function ie(t,n,i){v(t,h);let o=k.parse(t);x(o,h,"Model configuration");let r=i?y.parse(i):void 0,l=await O({project:o,expectedRevision:n,...r?{learning:r}:{}});return g({schemaVersion:"openpond.modelProjectSave.v1",operationId:`model-save:${l}`,expectedRevision:n,project:o,...r?{learning:r}:{}})}s(ie,"createModelProjectSaveRequest");var X=e.object({schemaVersion:e.literal("openpond.hostedModelProjectSync.v2"),portableProjectId:a,name:e.string().trim().min(1).max(200),objective:e.string().trim().max(5e3).nullable(),defaultBaseModel:p.nullable(),defaultDestinationId:a.nullable(),trainingSetup:N,sourceRevision:e.number().int().positive(),sourceUpdatedAt:c,expectedEtag:d.nullable().default(null)}).strict(),b=e.object({id:a,teamId:a,portableProjectId:a,name:e.string().trim().min(1).max(200),objective:e.string().trim().max(5e3).nullable(),defaultBaseModel:p.nullable(),defaultDestinationId:a.nullable(),trainingSetup:N,sourceRevision:e.number().int().positive(),sourceUpdatedAt:c,revision:e.number().int().positive(),etag:d,createdAt:c,updatedAt:c}).strict(),F=e.object({kind:e.enum(["taskset_release","harness_release","dataset_release","evidence_set","model_version","reward_model_version","evaluation_receipt"]),ref:m,role:e.string().trim().min(1).max(200).nullable().default(null),updatedAt:c}).strict(),Z=e.object({project:b,resources:e.array(F).max(1e4),jobCount:e.number().int().nonnegative(),latestJobIds:e.array(a).max(100)}).strict(),K=e.object({schemaVersion:e.literal("openpond.modelProjectApiError.v2"),code:e.string().trim().min(1).max(200),message:e.string().trim().min(1).max(5e3),retryable:e.boolean().default(!1),requestId:e.string().trim().min(1).max(500).nullable().default(null),details:e.record(e.string(),e.unknown()).default({})}).strict(),C=class extends Error{static{s(this,"OpenPondModelProjectApiError")}status;code;retryable;requestId;details;constructor(t,n){super(n.message),this.name="OpenPondModelProjectApiError",this.status=t,this.code=n.code,this.retryable=n.retryable,this.requestId=n.requestId,this.details=n.details}};function R(t){let n={};return new Headers(t).forEach((i,o)=>{n[o]=i}),n}s(R,"headersRecord");function se(t){let n=t.fetch??fetch,i=t.baseUrl.replace(/\/$/,"");async function o(r,l){let j=typeof t.headers=="function"?await t.headers():t.headers??{},f=await n(`${i}${r}`,{...l,headers:{accept:M,...l?.body?{"content-type":M}:{},...R(j),...R(l?.headers)}}),I=H(await f.text(),J,"Model Project API response");if(!f.ok){let _=K.safeParse(I);throw _.success?new C(f.status,_.data):new u("invalid_error_response",`Model Project request failed with HTTP ${f.status} and an invalid error envelope.`)}return I}return s(o,"request"),{async configurationCandidates(){return e.object({candidates:e.array(z).max(1e3)}).strict().parse(await o("/v1/model-projects/configuration/candidates",{headers:{accept:"application/json"}})).candidates},async checkConfiguration(r){let l=g(r);return Y.parse(await o("/v1/model-projects/configuration/check",{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(l)}))},async saveConfiguration(r){let l=g(r);return b.parse(await o("/v1/model-projects/configuration/save",{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(l)}))},async upsert(r){x(r,h,"Model Project sync");let l=X.parse(r),j=await o(`/v1/model-projects/${encodeURIComponent(l.portableProjectId)}`,{method:"PUT",body:JSON.stringify(l)});return b.parse(A(j,"project"))},async list(){let r=await o("/v1/model-projects");return e.array(b).parse(A(r,"projects"))},async get(r){let l=await o(`/v1/model-projects/${encodeURIComponent(a.parse(r))}`);return Z.parse(l)}}}s(se,"createModelProjectsClient");function A(t,n){return!t||typeof t!="object"||Array.isArray(t)?t:n in t?t[n]:t}s(A,"unwrapObject");export{te as a,M as b,ne as c,ae as d,oe as e,h as f,J as g,u as h,w as i,O as j,x as k,H as l,m,P as n,p as o,T as p,B as q,D as r,U as s,E as t,N as u,q as v,L as w,V as x,k as y,G as z,Y as A,z as B,re as C,g as D,ie as E,X as F,b as G,F as H,Z as I,K as J,C as K,se as L};
|
|
2
|
+
import{a as y}from"./chunk-PR5TYTY4.js";import{l as v}from"./chunk-RCA6NGVA.js";import{A as e}from"./chunk-PF56N7ZY.js";import{a as s}from"./chunk-FTQLQJQV.js";var te="application/vnd.openpond.training+json;version=2",M="application/vnd.openpond.model-project+json;version=2",ne=1048576,ae=67108864,oe=8388608,h=524288,J=8388608,u=class extends Error{static{s(this,"OpenPondProtocolError")}code;constructor(t,n){super(n),this.name="OpenPondProtocolError",this.code=t}};function w(t){return JSON.stringify(S(t))}s(w,"canonicalJson");function $(t){return new TextEncoder().encode(w(t)).byteLength}s($,"canonicalJsonByteLength");async function O(t){let n=new TextEncoder().encode(w(t)),i=await globalThis.crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(i),o=>o.toString(16).padStart(2,"0")).join("")}s(O,"canonicalSha256");function x(t,n,i){let o=$(t);if(o>n)throw new u("payload_too_large",`${i} is ${o} bytes; the maximum is ${n} bytes.`)}s(x,"assertCanonicalPayloadSize");function H(t,n,i){let o=new TextEncoder().encode(t).byteLength;if(o>n)throw new u("response_too_large",`${i} is ${o} bytes; the maximum is ${n} bytes.`);try{return JSON.parse(t)}catch{throw new u("invalid_json",`${i} was not valid JSON.`)}}s(H,"parseBoundedJson");function S(t){if(t===null||typeof t=="string"||typeof t=="boolean")return t;if(typeof t=="number"){if(!Number.isFinite(t))throw new u("non_json_value","Canonical JSON cannot contain a non-finite number.");return Object.is(t,-0)?0:t}if(Array.isArray(t))return t.map(n=>S(n));if(typeof t=="object"){let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)throw new u("non_json_value","Canonical JSON accepts only plain objects.");let i={};for(let o of Object.keys(t).sort()){let r=t[o];if(r===void 0||typeof r=="function"||typeof r=="symbol")throw new u("non_json_value",`Canonical JSON cannot contain ${typeof r} at ${o}.`);i[o]=S(r)}return i}throw new u("non_json_value",`Canonical JSON cannot contain ${typeof t}.`)}s(S,"normalizeCanonicalJson");var a=e.string().trim().min(1).max(500),d=e.string().regex(/^[a-f0-9]{64}$/),c=e.string().datetime({offset:!0}),m=e.object({id:a,contentHash:d}).strict(),P=m.extend({revision:e.number().int().positive()}).strict(),p=e.object({schemaVersion:e.literal("openpond.baseModelPreference.v1"),modelId:a,revision:e.string().trim().min(1).max(256).nullable(),tokenizerRevision:e.string().trim().min(1).max(256).nullable(),chatTemplateHash:e.string().trim().min(8).max(256).nullable(),modelAssetId:a.nullable(),source:e.enum(["managed","local","builtin"])}).strict(),T=e.enum(["sft","dpo","grpo","ppo","sdft","opd","opsd","sdpo"]),B=e.object({schemaVersion:e.string().regex(/^openpond\.[A-Za-z0-9]+Recipe\.v\d+$/),method:T,parameterization:e.enum(["lora","full"])}).catchall(e.unknown()),D=e.object({profileProjectId:a,sourceRevision:e.string().regex(/^[a-f0-9]{40,64}$/),harnessRelease:m}).strict(),U=e.object({profileProjectId:a,sourceRevision:e.string().regex(/^[a-f0-9]{40,64}$/),catalogHash:d,definitionId:a,harnessRelease:m,tasksetRelease:m}).strict(),E=e.object({tasksetRef:P.nullable().default(null),evaluationTasksetRef:P.nullable().optional(),profileSource:D.nullable().optional(),profileEvaluation:U.nullable().optional(),rewardBindingRef:P.nullable().optional(),tasksetRelease:m.nullable().default(null),harnessRelease:m.nullable().default(null),baseModel:p.nullable().default(null),method:T.nullable().default(null),destinationId:a.nullable().default(null),managedRolloutPlacement:e.enum(["local","remote"]).default("remote"),managedGpuPlacementObjective:e.enum(["fast","balanced","economical"]).default("balanced"),managedGpuRequirement:e.enum(["any","h100_hbm3"]).default("any"),runPreset:e.enum(["small","standard","custom","small_experiment"]).nullable().default(null),recipe:B.nullable().default(null),preferredMaximumSpendUsd:e.number().nonnegative().nullable().default(null),preferredRetentionDays:e.number().int().nonnegative().nullable().default(null)}).strict(),N=E.omit({managedGpuRequirement:!0}),q=e.object({schemaVersion:e.literal("openpond.hostedModelProjectLink.v1"),apiOrigin:e.string().url().refine(t=>new URL(t).origin===t,"Use a canonical API origin.").nullable().default(null),teamId:a,projectId:a,portableProjectId:a,revision:e.number().int().positive(),etag:d,syncedSourceRevision:e.number().int().positive(),syncedAt:c,tasksets:e.array(e.object({localTasksetId:a,localTasksetHash:d.nullable().default(null),releaseId:a,releaseRevision:e.number().int().positive(),releaseHash:d,packageHash:d.nullable().default(null),hostedTasksetId:a,syncedAt:c}).strict()).max(1e4).default([])}).strict(),L=e.object({localTasksetId:a,releaseId:a,releaseRevision:e.number().int().positive(),releaseHash:d,state:e.enum(["syncing","synced","sync_failed"]),hostedTasksetId:a.nullable().default(null),lastAttemptAt:c,syncedAt:c.nullable().default(null),lastError:e.string().trim().min(1).max(5e3).nullable().default(null)}).strict(),V=e.object({schemaVersion:e.literal("openpond.modelProject.v2"),id:a,profileId:a,revision:e.number().int().positive().default(1),name:e.string().trim().min(1).max(200),objective:e.string().trim().max(5e3).nullable(),defaultBaseModel:p.nullable(),defaultDestinationId:a.nullable(),trainingSetup:E,hosted:q.nullable().default(null),tasksetSyncs:e.array(L).max(1e4).default([]),createdAt:c,updatedAt:c}).strict(),k=V.pick({id:!0,profileId:!0,name:!0,objective:!0,defaultBaseModel:!0,defaultDestinationId:!0,trainingSetup:!0}),G=e.object({schemaVersion:e.literal("openpond.modelProjectSave.v1"),operationId:a,expectedRevision:e.number().int().nonnegative(),project:k,learning:y.optional()}).strict().superRefine((t,n)=>{t.learning&&t.expectedRevision!==0&&n.addIssue({code:"custom",path:["learning"],message:"Use learning settings to edit an existing Model's policy."})}),Y=e.object({schemaVersion:e.literal("openpond.modelProjectConfigurationCheck.v1"),configurationHash:d,projectId:a,expectedRevision:e.number().int().nonnegative(),checkedAt:c,canSave:e.boolean(),deferred:e.array(e.enum(["base_model","taskset"])).max(2),findings:e.array(e.object({code:a,severity:e.enum(["error","warning"]),message:e.string().min(1).max(5e3),field:e.string().min(1).max(500).nullable()}).strict()).max(100)}).strict(),z=e.object({id:a,name:e.string().min(1).max(500),available:e.boolean(),preference:p}).strict();async function re(t){let n=g(t);return O({project:n.project,expectedRevision:n.expectedRevision,...n.learning?{learning:n.learning}:{}})}s(re,"modelProjectConfigurationHash");function g(t){try{v(t,h)}catch{throw new C(400,{schemaVersion:"openpond.modelProjectApiError.v2",code:"model_configuration_json_invalid",message:"Model configuration must be bounded JSON data.",retryable:!1,requestId:null,details:{}})}return G.parse(t)}s(g,"parseModelProjectSaveRequest");async function ie(t,n,i){v(t,h);let o=k.parse(t);x(o,h,"Model configuration");let r=i?y.parse(i):void 0,l=await O({project:o,expectedRevision:n,...r?{learning:r}:{}});return g({schemaVersion:"openpond.modelProjectSave.v1",operationId:`model-save:${l}`,expectedRevision:n,project:o,...r?{learning:r}:{}})}s(ie,"createModelProjectSaveRequest");var X=e.object({schemaVersion:e.literal("openpond.hostedModelProjectSync.v2"),portableProjectId:a,name:e.string().trim().min(1).max(200),objective:e.string().trim().max(5e3).nullable(),defaultBaseModel:p.nullable(),defaultDestinationId:a.nullable(),trainingSetup:N,sourceRevision:e.number().int().positive(),sourceUpdatedAt:c,expectedEtag:d.nullable().default(null)}).strict(),b=e.object({id:a,teamId:a,portableProjectId:a,name:e.string().trim().min(1).max(200),objective:e.string().trim().max(5e3).nullable(),defaultBaseModel:p.nullable(),defaultDestinationId:a.nullable(),trainingSetup:N,sourceRevision:e.number().int().positive(),sourceUpdatedAt:c,revision:e.number().int().positive(),etag:d,createdAt:c,updatedAt:c}).strict(),F=e.object({kind:e.enum(["taskset_release","harness_release","dataset_release","evidence_set","model_version","reward_model_version","evaluation_receipt"]),ref:m,role:e.string().trim().min(1).max(200).nullable().default(null),updatedAt:c}).strict(),Z=e.object({project:b,resources:e.array(F).max(1e4),jobCount:e.number().int().nonnegative(),latestJobIds:e.array(a).max(100)}).strict(),K=e.object({schemaVersion:e.literal("openpond.modelProjectApiError.v2"),code:e.string().trim().min(1).max(200),message:e.string().trim().min(1).max(5e3),retryable:e.boolean().default(!1),requestId:e.string().trim().min(1).max(500).nullable().default(null),details:e.record(e.string(),e.unknown()).default({})}).strict(),C=class extends Error{static{s(this,"OpenPondModelProjectApiError")}status;code;retryable;requestId;details;constructor(t,n){super(n.message),this.name="OpenPondModelProjectApiError",this.status=t,this.code=n.code,this.retryable=n.retryable,this.requestId=n.requestId,this.details=n.details}};function R(t){let n={};return new Headers(t).forEach((i,o)=>{n[o]=i}),n}s(R,"headersRecord");function se(t){let n=t.fetch??fetch,i=t.baseUrl.replace(/\/$/,"");async function o(r,l){let j=typeof t.headers=="function"?await t.headers():t.headers??{},f=await n(`${i}${r}`,{...l,headers:{accept:M,...l?.body?{"content-type":M}:{},...R(j),...R(l?.headers)}}),I=H(await f.text(),J,"Model Project API response");if(!f.ok){let _=K.safeParse(I);throw _.success?new C(f.status,_.data):new u("invalid_error_response",`Model Project request failed with HTTP ${f.status} and an invalid error envelope.`)}return I}return s(o,"request"),{async configurationCandidates(){return e.object({candidates:e.array(z).max(1e3)}).strict().parse(await o("/v1/model-projects/configuration/candidates",{headers:{accept:"application/json"}})).candidates},async checkConfiguration(r){let l=g(r);return Y.parse(await o("/v1/model-projects/configuration/check",{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(l)}))},async saveConfiguration(r){let l=g(r);return b.parse(await o("/v1/model-projects/configuration/save",{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(l)}))},async upsert(r){x(r,h,"Model Project sync");let l=X.parse(r),j=await o(`/v1/model-projects/${encodeURIComponent(l.portableProjectId)}`,{method:"PUT",body:JSON.stringify(l)});return b.parse(A(j,"project"))},async list(){let r=await o("/v1/model-projects");return e.array(b).parse(A(r,"projects"))},async get(r){let l=await o(`/v1/model-projects/${encodeURIComponent(a.parse(r))}`);return Z.parse(l)}}}s(se,"createModelProjectsClient");function A(t,n){return!t||typeof t!="object"||Array.isArray(t)?t:n in t?t[n]:t}s(A,"unwrapObject");export{te as a,M as b,ne as c,ae as d,oe as e,h as f,J as g,u as h,w as i,O as j,x as k,H as l,m,P as n,p as o,T as p,B as q,D as r,U as s,E as t,N as u,q as v,L as w,V as x,k as y,G as z,Y as A,z as B,re as C,g as D,ie as E,X as F,b as G,F as H,Z as I,K as J,C as K,se as L};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as I,b as v}from"./chunk-GLUWATL5.js";import{E as L,F as E}from"./chunk-I7AQMAQI.js";import{f as x}from"./chunk-H7IWJN7L.js";import{a}from"./chunk-FTQLQJQV.js";var T=class extends Error{constructor(t,e){super(`API request timed out after ${t}ms: ${e}`);this.timeoutMs=t;this.requestUrl=e;this.name="ApiTimeoutError"}timeoutMs;requestUrl;static{a(this,"ApiTimeoutError")}code="OPENPOND_API_TIMEOUT"},w=class extends Error{constructor(t,e){super(`API response exceeded ${t} bytes: ${e}`);this.maximumBytes=t;this.requestUrl=e;this.name="ApiResponseTooLargeError"}maximumBytes;requestUrl;static{a(this,"ApiResponseTooLargeError")}code="OPENPOND_API_RESPONSE_TOO_LARGE"},O=class extends Error{constructor(t,e,o,r=null){let c=r||e;super(`${o} failed: ${t}${c?` ${c}`:""}`);this.status=t;this.apiMessage=r;this.name="OpenPondApiError",this.code=e||"OPENPOND_API_ERROR"}status;apiMessage;static{a(this,"OpenPondApiError")}code};async function i(s,n,t,e={}){let{timeoutMs:o=3e4,maxResponseBytes:r=8388608,explicitBearerAuth:c=!1,...p}=e,d=`${s}${t}`,m=new Headers(p.headers);m.set("Content-Type","application/json");let g=c?void 0:process.env.OPENPOND_API_KEY,h=n?.trim()||"",u=!c&&h.startsWith("opk_"),S=g||(u?h:null);S&&!m.has("openpond-api-key")&&m.set("openpond-api-key",S),n?m.set("Authorization",u?`ApiKey ${h}`:`Bearer ${n}`):g&&!m.has("Authorization")&&m.set("Authorization",`ApiKey ${g}`);let y=new AbortController,f=new T(o,d),R=o>0?setTimeout(()=>y.abort(f),o):null;R?.unref?.();let P=U(p.signal,y.signal,o),k=a(()=>{R&&clearTimeout(R)},"cleanup");try{let A=await fetch(d,{...p,headers:m,signal:P});return C(A,{cleanup:k,maximumBytes:r,requestUrl:d,timeoutController:y,timeoutError:f})}catch(A){throw k(),y.signal.aborted?f:A}}a(i,"apiFetch");async function l(s,n){let t;try{let e=await s.text();t=e?JSON.parse(e):{}}catch(e){if(e instanceof T||e instanceof w)throw e;t={}}if(!s.ok){let e=typeof t.error=="string"?t.error:null,o=typeof t.message=="string"?t.message:null;throw new O(s.status,e,n,o)}return t}a(l,"readApiJson");function C(s,n){if(!s.body)return n.cleanup(),s;let t=Number(s.headers.get("content-length"));if(n.maximumBytes>0&&Number.isFinite(t)&&t>n.maximumBytes)throw n.cleanup(),s.body.cancel(),new w(n.maximumBytes,n.requestUrl);let e=s.body.getReader(),o=0,r=new ReadableStream({async pull(c){try{let p=await e.read();if(p.done){n.cleanup(),c.close();return}if(o+=p.value.byteLength,n.maximumBytes>0&&o>n.maximumBytes){n.cleanup(),await e.cancel(),c.error(new w(n.maximumBytes,n.requestUrl));return}c.enqueue(p.value)}catch(p){n.cleanup(),c.error(n.timeoutController.signal.aborted?n.timeoutError:p)}},async cancel(c){n.cleanup(),await e.cancel(c)}});return new Response(r,{headers:s.headers,status:s.status,statusText:s.statusText})}a(C,"boundedResponse");function U(s,n,t){return t<=0?s??void 0:s?AbortSignal.any([s,n]):n}a(U,"composedSignal");async function _(s,n,t,e,o){let r=await i(s,n,`/v4/apps/${t}/commits`,{method:"POST",body:JSON.stringify({files:e,message:o})});if(!r.ok){let c=await r.text().catch(()=>"");throw new Error(`Commit failed: ${r.status} ${c}`)}return await r.json()}a(_,"commitFiles");async function j(s,n,t,e){let o=e?.environment??"production",r=await i(s,n,`/v4/apps/${t}/deployments`,{method:"POST",body:JSON.stringify({environment:o,...e?.commitSha?{commitSha:e.commitSha}:{},...e?.branch?{branch:e.branch}:{}})});if(!r.ok){let c=await r.text().catch(()=>"");throw new Error(`Deploy failed: ${r.status} ${c}`)}return await r.json()}a(j,"deployApp");async function B(s,n,t,e){let o=await i(s,n,`/v4/apps/${encodeURIComponent(t)}/deployments/promote-preview`,{method:"POST",body:JSON.stringify(e)});return l(o,"Preview promotion")}a(B,"promotePreviewToProduction");async function G(s,n,t,e){let o=await i(s,n,`/v1/apps/${encodeURIComponent(t)}/lifecycle/start`,{method:"POST",body:JSON.stringify(e)});return l(o,"App lifecycle start")}a(G,"startAppLifecycle");async function M(s,n,t){let e=await i(s,n,`/apps/deployments/${t}/logs`,{method:"GET"});if(!e.ok){let c=await e.text().catch(()=>"");throw new Error(`Deployment logs failed: ${e.status} ${c}`)}let o=await e.json().catch(()=>({}));return(Array.isArray(o.logs)?o.logs:[]).map(c=>{let p=typeof c.createdAt=="string"?c.createdAt:c.createdAt instanceof Date?c.createdAt.toISOString():new Date().toISOString();return{id:typeof c.id=="string"?c.id:`${Math.random()}`,type:typeof c.type=="string"?c.type:void 0,message:typeof c.message=="string"?c.message:"",createdAt:p}})}a(M,"getDeploymentLogs");async function J(s,n,t){let e=await i(s,n,`/apps/deployments/${t}/status`,{method:"GET"});if(!e.ok){let r=await e.text().catch(()=>"");throw new Error(`Deployment status failed: ${e.status} ${r}`)}return{status:(await e.json().catch(()=>({}))).deployment?.status}}a(J,"getDeploymentStatus");async function H(s,n,t,e){let o=new URLSearchParams;e?.status&&e.status.length>0&&o.set("status",e.status.join(",")),e?.createdAfter&&o.set("createdAfter",e.createdAfter),e?.branch&&o.set("branch",e.branch);let r=o.toString(),c=await i(s,n,`/apps/${t}/deployments/latest${r?`?${r}`:""}`,{method:"GET"});if(!c.ok){let d=await c.text().catch(()=>"");throw new Error(`Latest deployment lookup failed: ${c.status} ${d}`)}let p=await c.json().catch(()=>({}));return p.deployment?{id:p.deployment.id,status:p.deployment.status}:null}a(H,"getLatestDeploymentForApp");async function F(s,n,t){let e=await i(s,n,`/apps/deployments/${t}`,{method:"GET"});if(!e.ok){let r=await e.text().catch(()=>"");throw new Error(`Deployment fetch failed: ${e.status} ${r}`)}return(await e.json().catch(()=>({}))).deployment??null}a(F,"getDeploymentDetail");var V=new URL(v).hostname,D=new URL(I).hostname;async function ae(s,n,t){let e=new URLSearchParams;t?.handle&&e.set("handle",t.handle),typeof t?.limit=="number"&&Number.isFinite(t.limit)&&e.set("limit",String(Math.max(1,Math.floor(t.limit)))),typeof t?.offset=="number"&&Number.isFinite(t.offset)&&e.set("offset",String(Math.max(0,Math.floor(t.offset)))),typeof t?.includeScheduled=="boolean"&&e.set("includeScheduled",t.includeScheduled?"true":"false");let o=e.toString(),r=await i(s,n,`/apps/list${o?`?${o}`:""}`,{method:"GET"});if(!r.ok){let p=await r.text().catch(()=>"");throw new Error(`Apps list failed: ${r.status} ${p}`)}let c=await r.json().catch(()=>({}));return Array.isArray(c.apps)?c.apps:[]}a(ae,"listApps");async function ie(s,n,t){let e=await i(s,n,"/api/projects/local",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Create project failed: ${e.status} ${o}`)}return await e.json()}a(ie,"createLocalProject");async function ce(s,n,t){let e=await i(s,n,"/apps/repo/create",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Repo create failed: ${e.status} ${o}`)}return await e.json()}a(ce,"createRepo");async function pe(s,n,t,e){let o=await i(s,n,`/apps/${encodeURIComponent(t)}/code-visibility`,{method:"PATCH",body:JSON.stringify({codeVisibility:e})});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Code visibility update failed: ${o.status} ${r}`)}return await o.json()}a(pe,"updateAppCodeVisibility");async function ue(s,n,t,e){let o=await i(s,n,"/v4/apps/headless",{method:"POST",body:JSON.stringify({items:t,...e?{teamId:e}:{}})});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Headless create failed: ${o.status} ${r}`)}return await o.json()}a(ue,"createHeadlessApps");async function le(s,n,t){let e=await i(s,n,`/v4/apps/${t}/template/status`,{method:"GET"});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Template status failed: ${e.status} ${o}`)}return await e.json()}a(le,"getTemplateStatus");async function de(s,n,t){let e=await i(s,n,`/v4/apps/${t}/template/branches`,{method:"GET"});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Template branches failed: ${e.status} ${o}`)}return await e.json()}a(de,"listTemplateBranches");async function me(s,n,t,e){let o=await i(s,n,`/v4/apps/${t}/template/deploy-latest`,{method:"POST",body:JSON.stringify(e)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Template deploy failed: ${o.status} ${r}`)}return await o.json()}a(me,"deployLatestTemplate");async function ge(s,n,t,e){let o=await i(s,n,`/v4/apps/${t}/environment`,{method:"POST",body:JSON.stringify(e)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Environment update failed: ${o.status} ${r}`)}return await o.json()}a(ge,"updateAppEnvironment");async function he(s,n,t){let e=await i(s,n,`/v4/apps/${t}/environment`,{method:"GET"});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Environment get failed: ${e.status} ${o}`)}return await e.json()}a(he,"getAppEnvironment");async function ye(s,n){let t=await i(s,n,"/api/tools/manifest",{method:"GET"});if(!t.ok){let e=await t.text().catch(()=>"");throw new Error(`Manifest fetch failed: ${t.status} ${e}`)}return await t.json()}a(ye,"fetchToolManifest");async function fe(s,n){let t=await i(s,n,"/apps/tools",{method:"GET"});if(!t.ok){let e=await t.text().catch(()=>"");throw new Error(`Tools lookup failed: ${t.status} ${e}`)}return await t.json()}a(fe,"listUserTools");async function Re(s,n,t){let e=await i(s,n,`/apps/${encodeURIComponent(t)}/schedules`,{method:"GET"});if(!e.ok){let r=await e.text().catch(()=>"");throw new Error(`Schedules lookup failed: ${e.status} ${r}`)}let o=await e.json().catch(()=>({}));return{schedules:Array.isArray(o.schedules)?o.schedules:[]}}a(Re,"listAppSchedules");async function we(s,n,t={}){let e=new URLSearchParams;t.domain&&e.set("domain",t.domain),t.opentoolVersion&&e.set("opentoolVersion",t.opentoolVersion),typeof t.limit=="number"&&e.set("limit",String(t.limit));for(let c of t.tags??[])e.append("tag",c);let o=e.toString(),r=await i(s,n,`/v1/opentool/recipes${o?`?${o}`:""}`,{method:"GET"});return l(r,"OpenTool recipe list")}a(we,"listOpenToolRecipes");async function Se(s,n,t){let e=await i(s,n,"/v1/opentool/recipes/search",{method:"POST",body:JSON.stringify(t)});return l(e,"OpenTool recipe search")}a(Se,"searchOpenToolRecipes");async function xe(s,n,t){let e=new URLSearchParams;typeof t.includeExamples=="boolean"&&e.set("includeExamples",String(t.includeExamples)),typeof t.includeTests=="boolean"&&e.set("includeTests",String(t.includeTests)),t.opentoolVersion&&e.set("opentoolVersion",t.opentoolVersion);let o=e.toString(),r=await i(s,n,`/v1/opentool/recipes/${encodeURIComponent(t.id)}${o?`?${o}`:""}`,{method:"GET"});return l(r,"OpenTool recipe get")}a(xe,"getOpenToolRecipe");async function Te(s,n,t){let e=await i(s,n,"/v1/opentool/rules",{method:"POST",body:JSON.stringify(t)});return l(e,"OpenTool rules get")}a(Te,"getOpenToolRules");function b(s){let n=new URLSearchParams;typeof s=="number"&&Number.isFinite(s)&&n.set("limit",String(Math.max(1,Math.floor(s))));let t=n.toString();return t?`?${t}`:""}a(b,"buildLimitQuery");function N(s){if(Array.isArray(s))return s;if(!s||typeof s!="object")return[];let n=s;return Array.isArray(n.logs)?n.logs:Array.isArray(n.runs)?n.runs:Array.isArray(n.scheduleRuns)?n.scheduleRuns:Array.isArray(n.items)?n.items:[]}a(N,"normalizeScheduleExecutionLogs");async function Pe(s,n,t,e){let o={...e?.preferredScheduleId?{preferredScheduleId:e.preferredScheduleId}:{},...e?.scheduleId?{scheduleId:e.scheduleId}:{},...e?.startAt?{startAt:e.startAt}:{},...e&&"endAt"in e?{endAt:e.endAt??null}:{}},r=await i(s,n,`/apps/${encodeURIComponent(t)}/schedules/start`,{method:"POST",body:JSON.stringify(o)});return l(r,"Schedule start")}a(Pe,"startAppSchedules");async function Ae(s,n,t){let e=await i(s,n,`/apps/${encodeURIComponent(t)}/schedules/stop`,{method:"POST",body:JSON.stringify({})});return l(e,"Schedule stop")}a(Ae,"stopAppSchedules");async function Ee(s,n){let t=await i(s,n,"/apps/schedules/current/stop",{method:"POST",body:JSON.stringify({})});return l(t,"Current schedule stop")}a(Ee,"stopCurrentAppSchedules");async function Oe(s,n,t){let e=await i(s,n,"/v1/schedules/run",{method:"POST",body:JSON.stringify({scheduleId:t.scheduleId})});return l(e,"Schedule run")}a(Oe,"runScheduleNow");async function be(s,n,t,e){let o=await i(s,n,`/apps/${encodeURIComponent(t)}/schedules/${encodeURIComponent(e)}`,{method:"DELETE"});return l(o,"Schedule delete")}a(be,"deleteOrArchiveSchedule");async function $e(s,n,t,e){let o=await i(s,n,`/v1/schedules/${encodeURIComponent(t)}/execution-logs${b(e?.limit)}`,{method:"GET"}),r=await l(o,"Schedule execution logs");return{logs:N(r)}}a($e,"listScheduleExecutionLogs");async function ke(s,n,t,e){let o=await i(s,n,`/v1/deployments/${encodeURIComponent(t)}/schedule-execution-logs${b(e?.limit)}`,{method:"GET"}),r=await l(o,"Deployment schedule execution logs");return{logs:N(r)}}a(ke,"listDeploymentScheduleExecutionLogs");async function Le(s,n,t){let e=await i(s,n,`/v1/schedule-execution-logs/${encodeURIComponent(t)}`,{method:"GET"});return l(e,"Schedule execution log")}a(Le,"getScheduleExecutionLog");async function Ie(s,n,t,e){let o=await i(s,n,`/v1/apps/${encodeURIComponent(t)}/execution-timeline${b(e?.limit)}`,{method:"GET"});return l(o,"App execution timeline")}a(Ie,"getAppExecutionTimeline");async function ve(s,n,t){return i(s,n,"/apps/agent/create",{method:"POST",body:JSON.stringify(t)})}a(ve,"createAgentFromPrompt");async function De(s,n,t){let e=new URLSearchParams;t?.appId&&e.set("appId",t.appId);let o=e.toString(),r=await i(s,n,`/apps/performance${o?`?${o}`:""}`,{method:"GET"});if(!r.ok){let c=await r.text().catch(()=>"");throw new Error(`Performance lookup failed: ${r.status} ${c}`)}return await r.json()}a(De,"getUserPerformance");async function Ne(s,n,t){let e=new URLSearchParams({appId:t}),o=await i(s,n,`/apps/summary?${e.toString()}`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Summary lookup failed: ${o.status} ${r}`)}return await o.json()}a(Ne,"getAppRuntimeSummary");async function z(s,n){let t=await i(s,n,"/v1/account",{method:"GET"});if(!t.ok){let e=await t.text().catch(()=>"");throw new Error(`Account lookup failed: ${t.status} ${e}`)}return await t.json()}a(z,"getOpenPondAccount");async function qe(s,n){let t=new Date().toISOString(),e=Date.now(),o=s.replace(/\/$/,"");try{let r=await i(o,null,"/health",{method:"GET",headers:{Accept:"application/json"}}),c=Date.now()-e,p=await r.json().catch(()=>({})),d=null,m=null;if(n?.trim())try{let g=await z(o,n);d=!0,m=g.account}catch{d=!1}return{reachable:r.ok,authenticated:d,apiBase:o,latencyMs:c,status:r.status,service:typeof p.service=="string"?p.service:null,checkedAt:t,account:m,...r.ok?{}:{error:r.statusText||`HTTP ${r.status}`}}}catch(r){return{reachable:!1,authenticated:n?.trim()?!1:null,apiBase:o,latencyMs:Date.now()-e,status:null,service:null,checkedAt:t,error:r instanceof Error?r.message:String(r)}}}a(qe,"checkOpenPondApiHealth");async function Ce(s,n,t){let e=await i(s,n,"/apps/assistant/run",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Assistant run failed: ${e.status} ${o}`)}return await e.json()}a(Ce,"runAssistantMode");async function Ue(s,n,t){let e=await i(s,n,"/apps/agent/digest",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Agent digest failed: ${e.status} ${o}`)}return await e.json()}a(Ue,"postAgentDigest");async function _e(s,n,t){let e=await i(s,n,"/apps/tools/execute",{method:"POST",body:JSON.stringify(t)}),o=await e.text().catch(()=>""),r=null;try{r=o?JSON.parse(o):null}catch{r=o}return e.ok?{ok:!0,status:e.status,data:r}:{ok:!1,status:e.status,error:r&&typeof r=="object"&&"error"in r?String(r.error):o||e.statusText}}a(_e,"executeUserTool");async function je(s,n,t){let e=await i(s,n,"/apps/backtests/run",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Backtest run failed: ${e.status} ${o}`)}return await e.json()}a(je,"submitBacktestRun");async function Be(s,n,t){let e=t.query&&Object.keys(t.query).length>0?`?${new URLSearchParams(t.query).toString()}`:"",o=await i(s,n,`/apps/backtests/tx${e}`,{method:t.method,body:t.method==="POST"&&t.body!==void 0?JSON.stringify(t.body):void 0});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Backtests request failed: ${o.status} ${r}`)}return await o.json()}a(Be,"submitBacktestTx");async function Ge(s,n,t){let e=new URLSearchParams(t).toString(),o=await i(s,n,`/apps/backtests/detail?${e}`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Backtest detail failed: ${o.status} ${r}`)}return await o.json()}a(Ge,"submitBacktestDetail");function K(s){let n=s.trim().replace(/^\/+/,"");return encodeURIComponent(n||"tool")}a(K,"normalizeToolPathSegment");function W(s){let n=s.replace(/\/$/,""),t=process.env.OPENPOND_TOOL_URL;if(t)return t.replace(/\/$/,"");try{let e=new URL(n),o=e.hostname.toLowerCase(),r=o==="apps.openpond.live"?null:o===V||o===D||o===`www.${D}`||o==="openpond.live"||o==="www.openpond.live"?"https://apps.openpond.live":null;if(r)return r;let c=o==="localhost"||o==="127.0.0.1",p=e.port||(e.protocol==="https:"?"443":"80");if(c&&p==="3000")return n}catch{}return n}a(W,"resolveWorkerBaseUrl");async function Me(s,n,t){let e=W(s),o=K(t.toolName),c=`${t.deploymentId?`/${t.appId}/deployments/${t.deploymentId}`:`/${t.appId}`}/${o}`,p=new Headers(t.headers||{}),d=t.method??"POST",m=t.body===void 0||d==="GET"?void 0:JSON.stringify(t.body),g=await i(e,n,c,{method:d,body:m,headers:p}),h=await g.text().catch(()=>""),u=null;try{u=h?JSON.parse(h):null}catch{u=h}let S=u&&typeof u=="object"&&"ok"in u?!!u.ok:!0,y=g.ok&&S,f=u&&typeof u=="object"&&"status"in u&&Number(u.status)||g.status,R=u&&typeof u=="object"&&"error"in u?String(u.error):g.ok?void 0:h||g.statusText,P=u&&typeof u=="object"&&"data"in u?u.data:u;return{ok:y,status:f,data:P,error:R}}a(Me,"executeHostedTool");import{createHash as Y}from"node:crypto";var X=3600*1e3;function $(s){return Y("sha256").update(JSON.stringify([s.apiBase.replace(/\/$/,""),s.apiKey.trim()])).digest("hex")}a($,"buildCacheKey");async function q(s,n){let t=await L(x(),s,$(n),{allowStale:!0});return!t||Date.now()-Date.parse(t.updatedAt)>=(n.ttlMs??X)?null:t.payload}a(q,"cached");async function Ye(s){return q("cloud.apps",s)}a(Ye,"getCachedApps");async function Xe(s){await E(x(),"cloud.apps",$(s),s.apps)}a(Xe,"setCachedApps");async function Qe(s){return q("cloud.tools",s)}a(Qe,"getCachedTools");async function Ze(s){await E(x(),"cloud.tools",$(s),s.tools)}a(Ze,"setCachedTools");var it=["openpond-generic-v1","openpond-work-v1","openpond-coding-core-v1","openpond-agent-harness-v1"];export{i as a,_ as b,j as c,B as d,G as e,M as f,J as g,H as h,F as i,ae as j,ie as k,ce as l,pe as m,ue as n,le as o,de as p,me as q,ge as r,he as s,ye as t,fe as u,Re as v,we as w,Se as x,xe as y,Te as z,Pe as A,Ae as B,Ee as C,Oe as D,be as E,$e as F,ke as G,Le as H,Ie as I,ve as J,De as K,Ne as L,z as M,qe as N,Ce as O,Ue as P,_e as Q,je as R,Be as S,Ge as T,W as U,Me as V,X as W,Ye as X,Xe as Y,Qe as Z,Ze as _,it as $};
|
|
2
|
+
import{a as I,b as v}from"./chunk-GLUWATL5.js";import{E as L,F as E}from"./chunk-LHA7RQBA.js";import{f as x}from"./chunk-H7IWJN7L.js";import{a}from"./chunk-FTQLQJQV.js";var T=class extends Error{constructor(t,e){super(`API request timed out after ${t}ms: ${e}`);this.timeoutMs=t;this.requestUrl=e;this.name="ApiTimeoutError"}timeoutMs;requestUrl;static{a(this,"ApiTimeoutError")}code="OPENPOND_API_TIMEOUT"},w=class extends Error{constructor(t,e){super(`API response exceeded ${t} bytes: ${e}`);this.maximumBytes=t;this.requestUrl=e;this.name="ApiResponseTooLargeError"}maximumBytes;requestUrl;static{a(this,"ApiResponseTooLargeError")}code="OPENPOND_API_RESPONSE_TOO_LARGE"},O=class extends Error{constructor(t,e,o,r=null){let c=r||e;super(`${o} failed: ${t}${c?` ${c}`:""}`);this.status=t;this.apiMessage=r;this.name="OpenPondApiError",this.code=e||"OPENPOND_API_ERROR"}status;apiMessage;static{a(this,"OpenPondApiError")}code};async function i(s,n,t,e={}){let{timeoutMs:o=3e4,maxResponseBytes:r=8388608,explicitBearerAuth:c=!1,...p}=e,d=`${s}${t}`,m=new Headers(p.headers);m.set("Content-Type","application/json");let g=c?void 0:process.env.OPENPOND_API_KEY,h=n?.trim()||"",u=!c&&h.startsWith("opk_"),S=g||(u?h:null);S&&!m.has("openpond-api-key")&&m.set("openpond-api-key",S),n?m.set("Authorization",u?`ApiKey ${h}`:`Bearer ${n}`):g&&!m.has("Authorization")&&m.set("Authorization",`ApiKey ${g}`);let y=new AbortController,f=new T(o,d),R=o>0?setTimeout(()=>y.abort(f),o):null;R?.unref?.();let P=U(p.signal,y.signal,o),k=a(()=>{R&&clearTimeout(R)},"cleanup");try{let A=await fetch(d,{...p,headers:m,signal:P});return C(A,{cleanup:k,maximumBytes:r,requestUrl:d,timeoutController:y,timeoutError:f})}catch(A){throw k(),y.signal.aborted?f:A}}a(i,"apiFetch");async function l(s,n){let t;try{let e=await s.text();t=e?JSON.parse(e):{}}catch(e){if(e instanceof T||e instanceof w)throw e;t={}}if(!s.ok){let e=typeof t.error=="string"?t.error:null,o=typeof t.message=="string"?t.message:null;throw new O(s.status,e,n,o)}return t}a(l,"readApiJson");function C(s,n){if(!s.body)return n.cleanup(),s;let t=Number(s.headers.get("content-length"));if(n.maximumBytes>0&&Number.isFinite(t)&&t>n.maximumBytes)throw n.cleanup(),s.body.cancel(),new w(n.maximumBytes,n.requestUrl);let e=s.body.getReader(),o=0,r=new ReadableStream({async pull(c){try{let p=await e.read();if(p.done){n.cleanup(),c.close();return}if(o+=p.value.byteLength,n.maximumBytes>0&&o>n.maximumBytes){n.cleanup(),await e.cancel(),c.error(new w(n.maximumBytes,n.requestUrl));return}c.enqueue(p.value)}catch(p){n.cleanup(),c.error(n.timeoutController.signal.aborted?n.timeoutError:p)}},async cancel(c){n.cleanup(),await e.cancel(c)}});return new Response(r,{headers:s.headers,status:s.status,statusText:s.statusText})}a(C,"boundedResponse");function U(s,n,t){return t<=0?s??void 0:s?AbortSignal.any([s,n]):n}a(U,"composedSignal");async function _(s,n,t,e,o){let r=await i(s,n,`/v4/apps/${t}/commits`,{method:"POST",body:JSON.stringify({files:e,message:o})});if(!r.ok){let c=await r.text().catch(()=>"");throw new Error(`Commit failed: ${r.status} ${c}`)}return await r.json()}a(_,"commitFiles");async function j(s,n,t,e){let o=e?.environment??"production",r=await i(s,n,`/v4/apps/${t}/deployments`,{method:"POST",body:JSON.stringify({environment:o,...e?.commitSha?{commitSha:e.commitSha}:{},...e?.branch?{branch:e.branch}:{}})});if(!r.ok){let c=await r.text().catch(()=>"");throw new Error(`Deploy failed: ${r.status} ${c}`)}return await r.json()}a(j,"deployApp");async function B(s,n,t,e){let o=await i(s,n,`/v4/apps/${encodeURIComponent(t)}/deployments/promote-preview`,{method:"POST",body:JSON.stringify(e)});return l(o,"Preview promotion")}a(B,"promotePreviewToProduction");async function G(s,n,t,e){let o=await i(s,n,`/v1/apps/${encodeURIComponent(t)}/lifecycle/start`,{method:"POST",body:JSON.stringify(e)});return l(o,"App lifecycle start")}a(G,"startAppLifecycle");async function M(s,n,t){let e=await i(s,n,`/apps/deployments/${t}/logs`,{method:"GET"});if(!e.ok){let c=await e.text().catch(()=>"");throw new Error(`Deployment logs failed: ${e.status} ${c}`)}let o=await e.json().catch(()=>({}));return(Array.isArray(o.logs)?o.logs:[]).map(c=>{let p=typeof c.createdAt=="string"?c.createdAt:c.createdAt instanceof Date?c.createdAt.toISOString():new Date().toISOString();return{id:typeof c.id=="string"?c.id:`${Math.random()}`,type:typeof c.type=="string"?c.type:void 0,message:typeof c.message=="string"?c.message:"",createdAt:p}})}a(M,"getDeploymentLogs");async function J(s,n,t){let e=await i(s,n,`/apps/deployments/${t}/status`,{method:"GET"});if(!e.ok){let r=await e.text().catch(()=>"");throw new Error(`Deployment status failed: ${e.status} ${r}`)}return{status:(await e.json().catch(()=>({}))).deployment?.status}}a(J,"getDeploymentStatus");async function H(s,n,t,e){let o=new URLSearchParams;e?.status&&e.status.length>0&&o.set("status",e.status.join(",")),e?.createdAfter&&o.set("createdAfter",e.createdAfter),e?.branch&&o.set("branch",e.branch);let r=o.toString(),c=await i(s,n,`/apps/${t}/deployments/latest${r?`?${r}`:""}`,{method:"GET"});if(!c.ok){let d=await c.text().catch(()=>"");throw new Error(`Latest deployment lookup failed: ${c.status} ${d}`)}let p=await c.json().catch(()=>({}));return p.deployment?{id:p.deployment.id,status:p.deployment.status}:null}a(H,"getLatestDeploymentForApp");async function F(s,n,t){let e=await i(s,n,`/apps/deployments/${t}`,{method:"GET"});if(!e.ok){let r=await e.text().catch(()=>"");throw new Error(`Deployment fetch failed: ${e.status} ${r}`)}return(await e.json().catch(()=>({}))).deployment??null}a(F,"getDeploymentDetail");var V=new URL(v).hostname,D=new URL(I).hostname;async function ae(s,n,t){let e=new URLSearchParams;t?.handle&&e.set("handle",t.handle),typeof t?.limit=="number"&&Number.isFinite(t.limit)&&e.set("limit",String(Math.max(1,Math.floor(t.limit)))),typeof t?.offset=="number"&&Number.isFinite(t.offset)&&e.set("offset",String(Math.max(0,Math.floor(t.offset)))),typeof t?.includeScheduled=="boolean"&&e.set("includeScheduled",t.includeScheduled?"true":"false");let o=e.toString(),r=await i(s,n,`/apps/list${o?`?${o}`:""}`,{method:"GET"});if(!r.ok){let p=await r.text().catch(()=>"");throw new Error(`Apps list failed: ${r.status} ${p}`)}let c=await r.json().catch(()=>({}));return Array.isArray(c.apps)?c.apps:[]}a(ae,"listApps");async function ie(s,n,t){let e=await i(s,n,"/api/projects/local",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Create project failed: ${e.status} ${o}`)}return await e.json()}a(ie,"createLocalProject");async function ce(s,n,t){let e=await i(s,n,"/apps/repo/create",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Repo create failed: ${e.status} ${o}`)}return await e.json()}a(ce,"createRepo");async function pe(s,n,t,e){let o=await i(s,n,`/apps/${encodeURIComponent(t)}/code-visibility`,{method:"PATCH",body:JSON.stringify({codeVisibility:e})});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Code visibility update failed: ${o.status} ${r}`)}return await o.json()}a(pe,"updateAppCodeVisibility");async function ue(s,n,t,e){let o=await i(s,n,"/v4/apps/headless",{method:"POST",body:JSON.stringify({items:t,...e?{teamId:e}:{}})});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Headless create failed: ${o.status} ${r}`)}return await o.json()}a(ue,"createHeadlessApps");async function le(s,n,t){let e=await i(s,n,`/v4/apps/${t}/template/status`,{method:"GET"});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Template status failed: ${e.status} ${o}`)}return await e.json()}a(le,"getTemplateStatus");async function de(s,n,t){let e=await i(s,n,`/v4/apps/${t}/template/branches`,{method:"GET"});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Template branches failed: ${e.status} ${o}`)}return await e.json()}a(de,"listTemplateBranches");async function me(s,n,t,e){let o=await i(s,n,`/v4/apps/${t}/template/deploy-latest`,{method:"POST",body:JSON.stringify(e)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Template deploy failed: ${o.status} ${r}`)}return await o.json()}a(me,"deployLatestTemplate");async function ge(s,n,t,e){let o=await i(s,n,`/v4/apps/${t}/environment`,{method:"POST",body:JSON.stringify(e)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Environment update failed: ${o.status} ${r}`)}return await o.json()}a(ge,"updateAppEnvironment");async function he(s,n,t){let e=await i(s,n,`/v4/apps/${t}/environment`,{method:"GET"});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Environment get failed: ${e.status} ${o}`)}return await e.json()}a(he,"getAppEnvironment");async function ye(s,n){let t=await i(s,n,"/api/tools/manifest",{method:"GET"});if(!t.ok){let e=await t.text().catch(()=>"");throw new Error(`Manifest fetch failed: ${t.status} ${e}`)}return await t.json()}a(ye,"fetchToolManifest");async function fe(s,n){let t=await i(s,n,"/apps/tools",{method:"GET"});if(!t.ok){let e=await t.text().catch(()=>"");throw new Error(`Tools lookup failed: ${t.status} ${e}`)}return await t.json()}a(fe,"listUserTools");async function Re(s,n,t){let e=await i(s,n,`/apps/${encodeURIComponent(t)}/schedules`,{method:"GET"});if(!e.ok){let r=await e.text().catch(()=>"");throw new Error(`Schedules lookup failed: ${e.status} ${r}`)}let o=await e.json().catch(()=>({}));return{schedules:Array.isArray(o.schedules)?o.schedules:[]}}a(Re,"listAppSchedules");async function we(s,n,t={}){let e=new URLSearchParams;t.domain&&e.set("domain",t.domain),t.opentoolVersion&&e.set("opentoolVersion",t.opentoolVersion),typeof t.limit=="number"&&e.set("limit",String(t.limit));for(let c of t.tags??[])e.append("tag",c);let o=e.toString(),r=await i(s,n,`/v1/opentool/recipes${o?`?${o}`:""}`,{method:"GET"});return l(r,"OpenTool recipe list")}a(we,"listOpenToolRecipes");async function Se(s,n,t){let e=await i(s,n,"/v1/opentool/recipes/search",{method:"POST",body:JSON.stringify(t)});return l(e,"OpenTool recipe search")}a(Se,"searchOpenToolRecipes");async function xe(s,n,t){let e=new URLSearchParams;typeof t.includeExamples=="boolean"&&e.set("includeExamples",String(t.includeExamples)),typeof t.includeTests=="boolean"&&e.set("includeTests",String(t.includeTests)),t.opentoolVersion&&e.set("opentoolVersion",t.opentoolVersion);let o=e.toString(),r=await i(s,n,`/v1/opentool/recipes/${encodeURIComponent(t.id)}${o?`?${o}`:""}`,{method:"GET"});return l(r,"OpenTool recipe get")}a(xe,"getOpenToolRecipe");async function Te(s,n,t){let e=await i(s,n,"/v1/opentool/rules",{method:"POST",body:JSON.stringify(t)});return l(e,"OpenTool rules get")}a(Te,"getOpenToolRules");function b(s){let n=new URLSearchParams;typeof s=="number"&&Number.isFinite(s)&&n.set("limit",String(Math.max(1,Math.floor(s))));let t=n.toString();return t?`?${t}`:""}a(b,"buildLimitQuery");function N(s){if(Array.isArray(s))return s;if(!s||typeof s!="object")return[];let n=s;return Array.isArray(n.logs)?n.logs:Array.isArray(n.runs)?n.runs:Array.isArray(n.scheduleRuns)?n.scheduleRuns:Array.isArray(n.items)?n.items:[]}a(N,"normalizeScheduleExecutionLogs");async function Pe(s,n,t,e){let o={...e?.preferredScheduleId?{preferredScheduleId:e.preferredScheduleId}:{},...e?.scheduleId?{scheduleId:e.scheduleId}:{},...e?.startAt?{startAt:e.startAt}:{},...e&&"endAt"in e?{endAt:e.endAt??null}:{}},r=await i(s,n,`/apps/${encodeURIComponent(t)}/schedules/start`,{method:"POST",body:JSON.stringify(o)});return l(r,"Schedule start")}a(Pe,"startAppSchedules");async function Ae(s,n,t){let e=await i(s,n,`/apps/${encodeURIComponent(t)}/schedules/stop`,{method:"POST",body:JSON.stringify({})});return l(e,"Schedule stop")}a(Ae,"stopAppSchedules");async function Ee(s,n){let t=await i(s,n,"/apps/schedules/current/stop",{method:"POST",body:JSON.stringify({})});return l(t,"Current schedule stop")}a(Ee,"stopCurrentAppSchedules");async function Oe(s,n,t){let e=await i(s,n,"/v1/schedules/run",{method:"POST",body:JSON.stringify({scheduleId:t.scheduleId})});return l(e,"Schedule run")}a(Oe,"runScheduleNow");async function be(s,n,t,e){let o=await i(s,n,`/apps/${encodeURIComponent(t)}/schedules/${encodeURIComponent(e)}`,{method:"DELETE"});return l(o,"Schedule delete")}a(be,"deleteOrArchiveSchedule");async function $e(s,n,t,e){let o=await i(s,n,`/v1/schedules/${encodeURIComponent(t)}/execution-logs${b(e?.limit)}`,{method:"GET"}),r=await l(o,"Schedule execution logs");return{logs:N(r)}}a($e,"listScheduleExecutionLogs");async function ke(s,n,t,e){let o=await i(s,n,`/v1/deployments/${encodeURIComponent(t)}/schedule-execution-logs${b(e?.limit)}`,{method:"GET"}),r=await l(o,"Deployment schedule execution logs");return{logs:N(r)}}a(ke,"listDeploymentScheduleExecutionLogs");async function Le(s,n,t){let e=await i(s,n,`/v1/schedule-execution-logs/${encodeURIComponent(t)}`,{method:"GET"});return l(e,"Schedule execution log")}a(Le,"getScheduleExecutionLog");async function Ie(s,n,t,e){let o=await i(s,n,`/v1/apps/${encodeURIComponent(t)}/execution-timeline${b(e?.limit)}`,{method:"GET"});return l(o,"App execution timeline")}a(Ie,"getAppExecutionTimeline");async function ve(s,n,t){return i(s,n,"/apps/agent/create",{method:"POST",body:JSON.stringify(t)})}a(ve,"createAgentFromPrompt");async function De(s,n,t){let e=new URLSearchParams;t?.appId&&e.set("appId",t.appId);let o=e.toString(),r=await i(s,n,`/apps/performance${o?`?${o}`:""}`,{method:"GET"});if(!r.ok){let c=await r.text().catch(()=>"");throw new Error(`Performance lookup failed: ${r.status} ${c}`)}return await r.json()}a(De,"getUserPerformance");async function Ne(s,n,t){let e=new URLSearchParams({appId:t}),o=await i(s,n,`/apps/summary?${e.toString()}`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Summary lookup failed: ${o.status} ${r}`)}return await o.json()}a(Ne,"getAppRuntimeSummary");async function z(s,n){let t=await i(s,n,"/v1/account",{method:"GET"});if(!t.ok){let e=await t.text().catch(()=>"");throw new Error(`Account lookup failed: ${t.status} ${e}`)}return await t.json()}a(z,"getOpenPondAccount");async function qe(s,n){let t=new Date().toISOString(),e=Date.now(),o=s.replace(/\/$/,"");try{let r=await i(o,null,"/health",{method:"GET",headers:{Accept:"application/json"}}),c=Date.now()-e,p=await r.json().catch(()=>({})),d=null,m=null;if(n?.trim())try{let g=await z(o,n);d=!0,m=g.account}catch{d=!1}return{reachable:r.ok,authenticated:d,apiBase:o,latencyMs:c,status:r.status,service:typeof p.service=="string"?p.service:null,checkedAt:t,account:m,...r.ok?{}:{error:r.statusText||`HTTP ${r.status}`}}}catch(r){return{reachable:!1,authenticated:n?.trim()?!1:null,apiBase:o,latencyMs:Date.now()-e,status:null,service:null,checkedAt:t,error:r instanceof Error?r.message:String(r)}}}a(qe,"checkOpenPondApiHealth");async function Ce(s,n,t){let e=await i(s,n,"/apps/assistant/run",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Assistant run failed: ${e.status} ${o}`)}return await e.json()}a(Ce,"runAssistantMode");async function Ue(s,n,t){let e=await i(s,n,"/apps/agent/digest",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Agent digest failed: ${e.status} ${o}`)}return await e.json()}a(Ue,"postAgentDigest");async function _e(s,n,t){let e=await i(s,n,"/apps/tools/execute",{method:"POST",body:JSON.stringify(t)}),o=await e.text().catch(()=>""),r=null;try{r=o?JSON.parse(o):null}catch{r=o}return e.ok?{ok:!0,status:e.status,data:r}:{ok:!1,status:e.status,error:r&&typeof r=="object"&&"error"in r?String(r.error):o||e.statusText}}a(_e,"executeUserTool");async function je(s,n,t){let e=await i(s,n,"/apps/backtests/run",{method:"POST",body:JSON.stringify(t)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`Backtest run failed: ${e.status} ${o}`)}return await e.json()}a(je,"submitBacktestRun");async function Be(s,n,t){let e=t.query&&Object.keys(t.query).length>0?`?${new URLSearchParams(t.query).toString()}`:"",o=await i(s,n,`/apps/backtests/tx${e}`,{method:t.method,body:t.method==="POST"&&t.body!==void 0?JSON.stringify(t.body):void 0});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Backtests request failed: ${o.status} ${r}`)}return await o.json()}a(Be,"submitBacktestTx");async function Ge(s,n,t){let e=new URLSearchParams(t).toString(),o=await i(s,n,`/apps/backtests/detail?${e}`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Backtest detail failed: ${o.status} ${r}`)}return await o.json()}a(Ge,"submitBacktestDetail");function K(s){let n=s.trim().replace(/^\/+/,"");return encodeURIComponent(n||"tool")}a(K,"normalizeToolPathSegment");function W(s){let n=s.replace(/\/$/,""),t=process.env.OPENPOND_TOOL_URL;if(t)return t.replace(/\/$/,"");try{let e=new URL(n),o=e.hostname.toLowerCase(),r=o==="apps.openpond.live"?null:o===V||o===D||o===`www.${D}`||o==="openpond.live"||o==="www.openpond.live"?"https://apps.openpond.live":null;if(r)return r;let c=o==="localhost"||o==="127.0.0.1",p=e.port||(e.protocol==="https:"?"443":"80");if(c&&p==="3000")return n}catch{}return n}a(W,"resolveWorkerBaseUrl");async function Me(s,n,t){let e=W(s),o=K(t.toolName),c=`${t.deploymentId?`/${t.appId}/deployments/${t.deploymentId}`:`/${t.appId}`}/${o}`,p=new Headers(t.headers||{}),d=t.method??"POST",m=t.body===void 0||d==="GET"?void 0:JSON.stringify(t.body),g=await i(e,n,c,{method:d,body:m,headers:p}),h=await g.text().catch(()=>""),u=null;try{u=h?JSON.parse(h):null}catch{u=h}let S=u&&typeof u=="object"&&"ok"in u?!!u.ok:!0,y=g.ok&&S,f=u&&typeof u=="object"&&"status"in u&&Number(u.status)||g.status,R=u&&typeof u=="object"&&"error"in u?String(u.error):g.ok?void 0:h||g.statusText,P=u&&typeof u=="object"&&"data"in u?u.data:u;return{ok:y,status:f,data:P,error:R}}a(Me,"executeHostedTool");import{createHash as Y}from"node:crypto";var X=3600*1e3;function $(s){return Y("sha256").update(JSON.stringify([s.apiBase.replace(/\/$/,""),s.apiKey.trim()])).digest("hex")}a($,"buildCacheKey");async function q(s,n){let t=await L(x(),s,$(n),{allowStale:!0});return!t||Date.now()-Date.parse(t.updatedAt)>=(n.ttlMs??X)?null:t.payload}a(q,"cached");async function Ye(s){return q("cloud.apps",s)}a(Ye,"getCachedApps");async function Xe(s){await E(x(),"cloud.apps",$(s),s.apps)}a(Xe,"setCachedApps");async function Qe(s){return q("cloud.tools",s)}a(Qe,"getCachedTools");async function Ze(s){await E(x(),"cloud.tools",$(s),s.tools)}a(Ze,"setCachedTools");var it=["openpond-generic-v1","openpond-work-v1","openpond-coding-core-v1","openpond-agent-harness-v1"];export{i as a,_ as b,j as c,B as d,G as e,M as f,J as g,H as h,F as i,ae as j,ie as k,ce as l,pe as m,ue as n,le as o,de as p,me as q,ge as r,he as s,ye as t,fe as u,Re as v,we as w,Se as x,xe as y,Te as z,Pe as A,Ae as B,Ee as C,Oe as D,be as E,$e as F,ke as G,Le as H,Ie as I,ve as J,De as K,Ne as L,z as M,qe as N,Ce as O,Ue as P,_e as Q,je as R,Be as S,Ge as T,W as U,Me as V,X as W,Ye as X,Xe as Y,Qe as Z,Ze as _,it as $};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{P as H,Q as L,_ as S}from"./chunk-I7AQMAQI.js";import{f as A,h as O}from"./chunk-H7IWJN7L.js";import{a as l}from"./chunk-FTQLQJQV.js";import Q from"node:path";var U="default",z=["apiKey","baseUrl","apiBaseUrl","chatApiBaseUrl","token","appId","conversationId"];function re(){return V()}l(re,"getConfigPath");function V(){return O(A()).config}l(V,"getGlobalConfigPath");function m(n,e){return Object.prototype.hasOwnProperty.call(n,e)}l(m,"hasOwn");function h(n){if(typeof n!="string")return null;let e=n.trim();return e.length>0?e:null}l(h,"normalizeHandle");function d(n){if(typeof n!="string")return null;let e=n.trim();return e?e.replace(/\/$/,""):null}l(d,"normalizeBaseUrl");function q(n){let e=h(n);if(!e)throw new Error("profile handle must be non-empty");return e}l(q,"requireHandle");function W(n){if(typeof n!="string")throw new Error("apiKey must be a non-empty string");let e=n.trim();if(!e)throw new Error("apiKey must be a non-empty string");return e}l(W,"requireApiKey");function b(n,e){let t=h(n),s=h(e);return!!(t&&s&&t.toLowerCase()===s.toLowerCase())}l(b,"handleEquals");function v(n,e,t){let s=d(t);return n.findIndex(i=>b(i.handle,e)?s?d(i.baseUrl)===s:!0:!1)}l(v,"findAccountIndex");function P(n){let e=h(n.handle)??U,t=d(n.baseUrl);return t?{handle:e,baseUrl:t}:{handle:e}}l(P,"selectorFromAccount");function y(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=h(typeof e.handle=="string"?e.handle:void 0);if(!t)return null;let s=d(typeof e.baseUrl=="string"?e.baseUrl:void 0);return s?{handle:t,baseUrl:s}:{handle:t}}l(y,"sanitizeActiveProfile");function B(n){if(!n||typeof n!="object"||Array.isArray(n))return;let e=n,t=typeof e.repoPath=="string"?e.repoPath.trim():"",s=typeof e.profile=="string"&&e.profile.trim()?e.profile.trim():"default";if(!t)return;let i={repoPath:t,profile:s,mode:"local"};if(e.lastCheck&&typeof e.lastCheck=="object"&&!Array.isArray(e.lastCheck)){let o=e.lastCheck,a=o.command,u=o.status,c=o.checkedAt;(a==="inspect"||a==="build"||a==="validate"||a==="eval"||a==="run")&&(u==="passed"||u==="failed")&&typeof c=="string"&&(i.lastCheck={command:a,status:u,checkedAt:c,...typeof o.exitCode=="number"||o.exitCode===null?{exitCode:o.exitCode}:{},...typeof o.sourceHead=="string"||o.sourceHead===null?{sourceHead:o.sourceHead}:{}})}if(e.lastPush&&typeof e.lastPush=="object"&&!Array.isArray(e.lastPush)){let o=e.lastPush,a=o.status,u=o.pushedAt;(a==="pushed"||a==="failed")&&typeof u=="string"&&(i.lastPush={status:a,pushedAt:u,...typeof o.teamId=="string"||o.teamId===null?{teamId:o.teamId}:{},...typeof o.projectId=="string"||o.projectId===null?{projectId:o.projectId}:{},...typeof o.localHead=="string"||o.localHead===null?{localHead:o.localHead}:{},...typeof o.hostedHead=="string"||o.hostedHead===null?{hostedHead:o.hostedHead}:{},...typeof o.sourceRef=="string"||o.sourceRef===null?{sourceRef:o.sourceRef}:{},...o.promotionStatus==="uploaded"||o.promotionStatus==="hosted_source_materialized"||o.promotionStatus==="hosted_source_materialize_failed"||o.promotionStatus==="hosted_source_check_pending"||o.promotionStatus==="hosted_source_check_failed"||o.promotionStatus==="hosted_source_published"||o.promotionStatus==="hosted_source_publish_failed"||o.promotionStatus==="hosted_run_pending"||o.promotionStatus==="hosted_run_passed"||o.promotionStatus==="hosted_run_failed"||o.promotionStatus===null?{promotionStatus:o.promotionStatus}:{},...o.hostedRunStatus==="not_started"||o.hostedRunStatus==="running"||o.hostedRunStatus==="passed"||o.hostedRunStatus==="failed"||o.hostedRunStatus===null?{hostedRunStatus:o.hostedRunStatus}:{},...typeof o.hostedRunAgentId=="string"||o.hostedRunAgentId===null?{hostedRunAgentId:o.hostedRunAgentId}:{},...typeof o.hostedRunId=="string"||o.hostedRunId===null?{hostedRunId:o.hostedRunId}:{},...typeof o.hostedRunAt=="string"||o.hostedRunAt===null?{hostedRunAt:o.hostedRunAt}:{},...w(o.hostedSourceMaterialization)?{hostedSourceMaterialization:w(o.hostedSourceMaterialization)}:{},...E(o.hostedSourceCheck)?{hostedSourceCheck:E(o.hostedSourceCheck)}:{},...K(o.hostedPublish)?{hostedPublish:K(o.hostedPublish)}:{},...M(o.hostedRun)?{hostedRun:M(o.hostedRun)}:{},...typeof o.error=="string"||o.error===null?{error:o.error}:{}})}if(Array.isArray(e.profiles)){let o=e.profiles.flatMap(a=>{let u=B(a);if(!u)return[];let c=a,p=c.source==="github"||c.source==="openpond_git"?c.source:"local",C=typeof c.repositoryId=="string"&&c.repositoryId.trim()?c.repositoryId.trim():Q.resolve(u.repoPath);return[{source:p,repositoryId:C,repoPath:u.repoPath,profile:u.profile,...u.lastCheck?{lastCheck:u.lastCheck}:{},...u.lastPush?{lastPush:u.lastPush}:{}}]});o.length>0&&(i.profiles=o)}return i}l(B,"sanitizeLocalOpenPondProfile");function w(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=R(e.status);return t?{status:t,...r(e,"agentId"),...r(e,"runtimeAgentId"),...r(e,"projectId"),...r(e,"sourceRoot"),...r(e,"sourceRef"),...r(e,"sourceCommitSha"),...r(e,"manifestHash"),...r(e,"manifestPath"),...r(e,"manifestSyncedAt"),...T(e,"fileCount"),...T(e,"totalBytes"),...r(e,"generatedManifestPath"),...k(e,"synthesizedOpenPondYaml"),...r(e,"uploadMetadataPath"),...f(e,"setupCommands"),...f(e,"validationCommands"),...r(e,"materializedAt"),...r(e,"error")}:null}l(w,"sanitizeHostedMaterializationStatus");function E(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=R(e.status);return t?{status:t,...r(e,"agentId"),...r(e,"deployPlanStatus"),...k(e,"canRun"),...k(e,"canDeploy"),...r(e,"sourceRef"),...r(e,"sourceCommitSha"),...r(e,"manifestHash"),...r(e,"manifestPath"),...f(e,"setupCommands"),...f(e,"validationCommands"),...f(e,"requiredChecks"),...f(e,"evalNames"),...f(e,"blockedReasons"),...f(e,"staleReasons"),...r(e,"runtimeId"),...r(e,"sandboxId"),...f(e,"traceArtifactRefs"),...f(e,"evalResultArtifactRefs"),...f(e,"validatorArtifactRefs"),...r(e,"checkedAt"),...r(e,"error")}:null}l(E,"sanitizeHostedSourceCheckStatus");function K(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=R(e.status);return t?{status:t,...r(e,"agentId"),...r(e,"snapshotId"),...r(e,"sourceRef"),...r(e,"sourceCommitSha"),...r(e,"manifestHash"),...r(e,"manifestPath"),...r(e,"buildStatus"),...r(e,"validationStatus"),...r(e,"evalStatus"),...r(e,"publishedAt"),...r(e,"error")}:null}l(K,"sanitizeHostedPublishStatus");function M(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=R(e.status);return t?{status:t,...r(e,"agentId"),...r(e,"runId"),...r(e,"runtimeId"),...r(e,"sandboxId"),...r(e,"sourceRef"),...r(e,"sourceCommitSha"),...r(e,"manifestHash"),...r(e,"setupGateStatus"),...f(e,"setupRequirementRefs"),...f(e,"artifactRefs"),...f(e,"traceArtifactRefs"),...f(e,"evalArtifactRefs"),...r(e,"startedAt"),...r(e,"completedAt"),...r(e,"error")}:null}l(M,"sanitizeHostedRunSummary");function r(n,e){let t=n[e];return typeof t=="string"||t===null?{[e]:t}:{}}l(r,"nullableStringProp");function k(n,e){let t=n[e];return typeof t=="boolean"||t===null?{[e]:t}:{}}l(k,"nullableBooleanProp");function T(n,e){let t=n[e];return typeof t=="number"||t===null?{[e]:t}:{}}l(T,"nullableNumberProp");function f(n,e){let t=n[e];if(!Array.isArray(t))return{};let s=t.filter(i=>typeof i=="string");return{[e]:s}}l(f,"stringArrayProp");function R(n){return typeof n=="string"&&n.trim()?n.trim():null}l(R,"stringField");function D(n,e){if(!b(n.handle,e.handle))return!1;let t=d(e.baseUrl);return t?d(n.baseUrl)===t:!d(n.baseUrl)}l(D,"accountMatchesSelector");function I(n,e,t={}){let s=d(e.baseUrl);if(s)return v(n,e.handle,s);let i=n.findIndex(a=>D(a,e));if(i!==-1)return i;let o=n.map((a,u)=>({account:a,index:u})).filter(({account:a})=>b(a.handle,e.handle));if(o.length>1&&t.requireUnambiguous)throw new Error(`multiple profiles found for ${e.handle}; pass --base-url to select one`);return o[0]?.index??-1}l(I,"findAccountIndexForSelector");function X(n){if(!n||typeof n!="object"||Array.isArray(n))return;let e=n,t={};return typeof e.token=="string"&&(t.token=e.token),(typeof e.appId=="string"||e.appId===null)&&(t.appId=e.appId),(typeof e.conversationId=="string"||e.conversationId===null)&&(t.conversationId=e.conversationId),Object.keys(t).length>0?t:void 0}l(X,"sanitizeSession");function Z(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=h(typeof e.handle=="string"?e.handle:void 0);if(!t)return null;let s={handle:t};typeof e.apiKey=="string"&&(s.apiKey=e.apiKey),typeof e.baseUrl=="string"&&(s.baseUrl=e.baseUrl),typeof e.apiBaseUrl=="string"&&(s.apiBaseUrl=e.apiBaseUrl),typeof e.chatApiBaseUrl=="string"&&(s.chatApiBaseUrl=e.chatApiBaseUrl),typeof e.environment=="string"&&(s.environment=e.environment);let i=X(e.session);return i&&(s.session=i),s}l(Z,"sanitizeAccount");function ee(n){let e={};return typeof n.token=="string"&&(e.token=n.token),(typeof n.appId=="string"||n.appId===null)&&(e.appId=n.appId),(typeof n.conversationId=="string"||n.conversationId===null)&&(e.conversationId=n.conversationId),Object.keys(e).length>0?e:void 0}l(ee,"extractLegacySession");function ne(n,e){let t={handle:e};typeof n.apiKey=="string"&&(t.apiKey=n.apiKey),typeof n.baseUrl=="string"&&(t.baseUrl=n.baseUrl),typeof n.apiBaseUrl=="string"&&(t.apiBaseUrl=n.apiBaseUrl),typeof n.chatApiBaseUrl=="string"&&(t.chatApiBaseUrl=n.chatApiBaseUrl);let s=ee(n);return s&&(t.session=s),t}l(ne,"extractLegacyAccount");function x(n){let e={};typeof n.lspEnabled=="boolean"&&(e.lspEnabled=n.lspEnabled),(n.executionMode==="local"||n.executionMode==="hosted")&&(e.executionMode=n.executionMode),(n.mode==="general"||n.mode==="builder")&&(e.mode=n.mode);let t=B(n.openpondProfile);t&&(e.openpondProfile=t);let s=[],i=Array.isArray(n.accounts)?n.accounts:[];for(let c of i){let p=Z(c);p&&v(s,p.handle,p.baseUrl)===-1&&s.push(p)}if(s.length===0){let c=y(n.activeProfile)?.handle||U;s.push(ne(n,c))}let o=y(n.activeProfile),a=o?I(s,o):-1,u=s[a===-1?0:a];return e.accounts=s,e.activeProfile=P(u),e}l(x,"normalizeGlobalConfig");function N(n,e,t){let s=n.accounts??[],i=d(t??process.env.OPENPOND_BASE_URL),o=h(e);if(o)return i?{handle:o,baseUrl:i}:{handle:o};let a=h(process.env.OPENPOND_ACCOUNT);if(a)return i?{handle:a,baseUrl:i}:{handle:a};let u=y(n.activeProfile);return u?i?{handle:u.handle,baseUrl:i}:u:s[0]?P(s[0]):{handle:U}}l(N,"resolveRequestedProfile");function G(n,e,t){let s=d(t);if(s){let o=v(n,e,s);if(o!==-1)return n[o]}else{let o=n.filter(a=>b(a.handle,e));if(o.length>1)throw new Error(`multiple profiles found for ${e}; pass --base-url to select one`);if(o.length===1)return o[0]}let i={handle:e};return s&&(i.baseUrl=s),n.push(i),i}l(G,"ensureAccount");function j(n){n.session&&Object.keys(n.session).length===0&&delete n.session}l(j,"cleanupAccount");function te(n,e,t,s){let i=t===null||t===void 0&&s.undefinedDeletes;switch(e){case"apiKey":{if(i){delete n.apiKey;return}typeof t=="string"&&(n.apiKey=t);return}case"baseUrl":{if(i){delete n.baseUrl;return}typeof t=="string"&&(n.baseUrl=t);return}case"apiBaseUrl":{if(i){delete n.apiBaseUrl;return}typeof t=="string"&&(n.apiBaseUrl=t);return}case"chatApiBaseUrl":{if(i){delete n.chatApiBaseUrl;return}typeof t=="string"&&(n.chatApiBaseUrl=t);return}case"token":case"appId":case"conversationId":{if(n.session||(n.session={}),i){delete n.session[e],j(n);return}(typeof t=="string"||t===null)&&(n.session[e]=t),j(n);return}}}l(te,"applyScopedKey");function $(n,e,t){if(!z.some(c=>m(e,c)))return!1;let i=n.accounts??[],o=y(e.activeProfile)??N(n),a=d(m(e,"baseUrl")?e.baseUrl??null:o.baseUrl??process.env.OPENPOND_BASE_URL),u=G(i,o.handle,a);for(let c of z)m(e,c)&&te(u,c,e[c],t);return n.accounts=i,n.activeProfile=P(u),!0}l($,"applyAccountPatch");function F(n,e){if(m(e,"lspEnabled")&&(typeof e.lspEnabled=="boolean"?n.lspEnabled=e.lspEnabled:e.lspEnabled===null&&delete n.lspEnabled),m(e,"executionMode")&&(e.executionMode==="local"||e.executionMode==="hosted"?n.executionMode=e.executionMode:e.executionMode===null&&delete n.executionMode),m(e,"mode")&&(e.mode==="general"||e.mode==="builder"?n.mode=e.mode:e.mode===null&&delete n.mode),m(e,"activeProfile")){let t=y(e.activeProfile);if(t){let s=I(n.accounts??[],t);n.activeProfile=s===-1?t:P((n.accounts??[])[s])}else e.activeProfile===null&&delete n.activeProfile}if(m(e,"openpondProfile")){let t=B(e.openpondProfile);t?n.openpondProfile=t:e.openpondProfile===null&&delete n.openpondProfile}}l(F,"applyTopLevelPatch");async function oe(n){let e=A();await S(e),await L(e,()=>n)}l(oe,"writeGlobalConfig");async function _(n){let e=A();return await S(e),await L(e,t=>{let s=x(t);return n(s),s})}l(_,"updateGlobalConfig");async function Y(){let n=A();return await S(n),x(await H(n))}l(Y,"loadGlobalConfig");async function le(n={}){let e=await Y(),t=e.accounts??[],s=N(e,n.account,n.baseUrl),i=I(t,s,{requireUnambiguous:!0}),o=i===-1?null:t[i],a=o?.session;return{...e,activeProfile:o?P(o):s,apiKey:o?.apiKey,baseUrl:o?.baseUrl,apiBaseUrl:o?.apiBaseUrl,chatApiBaseUrl:o?.chatApiBaseUrl,token:a?.token,appId:a?.appId,conversationId:a?.conversationId}}l(le,"loadConfig");async function J(){let n=await Y(),e=y(n.activeProfile);return(n.accounts??[]).map(t=>{let s=h(t.handle)??U;return{handle:s,baseUrl:d(t.baseUrl),apiBaseUrl:d(t.apiBaseUrl),chatApiBaseUrl:d(t.chatApiBaseUrl),environment:t.environment?.trim()||null,isActive:!!(e&&D({...t,handle:s},e)),hasApiKey:!!t.apiKey?.trim(),hasSessionToken:!!t.session?.token?.trim(),sessionAppId:t.session?.appId??null,sessionConversationId:t.session?.conversationId??null}})}l(J,"listConfiguredProfiles");async function ae(n,e={}){let t=q(n),s=d(e.baseUrl),i=-1;await _(a=>{let u=a.accounts??[];if(i=I(u,s?{handle:t,baseUrl:s}:{handle:t},{requireUnambiguous:!0}),i===-1)throw new Error(`profile not found: ${t}`);a.activeProfile=P(u[i])});let o=await J();return o.find(a=>a.isActive)??o[i]}l(ae,"setActiveProfile");async function ue(n){let e=q(n.handle),t=W(n.apiKey),s=d(n.baseUrl),i=d(n.apiBaseUrl),o=d(n.chatApiBaseUrl),a={handle:e};await _(p=>{let C=p.accounts??[],g=G(C,e,s);g.apiKey=t,s&&(g.baseUrl=s),i?g.apiBaseUrl=i:n.apiBaseUrl===null&&delete g.apiBaseUrl,o?g.chatApiBaseUrl=o:n.chatApiBaseUrl===null&&delete g.chatApiBaseUrl,n.environment===null?delete g.environment:typeof n.environment=="string"&&n.environment.trim()&&(g.environment=n.environment.trim()),p.accounts=C,a=P(g),n.setActive!==!1&&(p.activeProfile=a)});let c=(await J()).find(p=>b(p.handle,a.handle)?s?d(p.baseUrl)===s:!0:!1);if(!c)throw new Error(`failed to save profile: ${e}`);return c}l(ue,"saveProfileApiKey");async function ce(n){let e=x(n);F(e,n),$(e,n,{undefinedDeletes:!0}),await oe(e)}l(ce,"saveConfig");async function de(n){await _(e=>{F(e,n),$(e,n,{undefinedDeletes:!1})})}l(de,"saveGlobalConfig");export{re as a,_ as b,Y as c,le as d,J as e,ae as f,ue as g,ce as h,de as i};
|
|
2
|
+
import{P as H,Q as L,_ as S}from"./chunk-LHA7RQBA.js";import{f as A,h as O}from"./chunk-H7IWJN7L.js";import{a as l}from"./chunk-FTQLQJQV.js";import Q from"node:path";var U="default",z=["apiKey","baseUrl","apiBaseUrl","chatApiBaseUrl","token","appId","conversationId"];function re(){return V()}l(re,"getConfigPath");function V(){return O(A()).config}l(V,"getGlobalConfigPath");function m(n,e){return Object.prototype.hasOwnProperty.call(n,e)}l(m,"hasOwn");function h(n){if(typeof n!="string")return null;let e=n.trim();return e.length>0?e:null}l(h,"normalizeHandle");function d(n){if(typeof n!="string")return null;let e=n.trim();return e?e.replace(/\/$/,""):null}l(d,"normalizeBaseUrl");function q(n){let e=h(n);if(!e)throw new Error("profile handle must be non-empty");return e}l(q,"requireHandle");function W(n){if(typeof n!="string")throw new Error("apiKey must be a non-empty string");let e=n.trim();if(!e)throw new Error("apiKey must be a non-empty string");return e}l(W,"requireApiKey");function b(n,e){let t=h(n),s=h(e);return!!(t&&s&&t.toLowerCase()===s.toLowerCase())}l(b,"handleEquals");function v(n,e,t){let s=d(t);return n.findIndex(i=>b(i.handle,e)?s?d(i.baseUrl)===s:!0:!1)}l(v,"findAccountIndex");function P(n){let e=h(n.handle)??U,t=d(n.baseUrl);return t?{handle:e,baseUrl:t}:{handle:e}}l(P,"selectorFromAccount");function y(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=h(typeof e.handle=="string"?e.handle:void 0);if(!t)return null;let s=d(typeof e.baseUrl=="string"?e.baseUrl:void 0);return s?{handle:t,baseUrl:s}:{handle:t}}l(y,"sanitizeActiveProfile");function B(n){if(!n||typeof n!="object"||Array.isArray(n))return;let e=n,t=typeof e.repoPath=="string"?e.repoPath.trim():"",s=typeof e.profile=="string"&&e.profile.trim()?e.profile.trim():"default";if(!t)return;let i={repoPath:t,profile:s,mode:"local"};if(e.lastCheck&&typeof e.lastCheck=="object"&&!Array.isArray(e.lastCheck)){let o=e.lastCheck,a=o.command,u=o.status,c=o.checkedAt;(a==="inspect"||a==="build"||a==="validate"||a==="eval"||a==="run")&&(u==="passed"||u==="failed")&&typeof c=="string"&&(i.lastCheck={command:a,status:u,checkedAt:c,...typeof o.exitCode=="number"||o.exitCode===null?{exitCode:o.exitCode}:{},...typeof o.sourceHead=="string"||o.sourceHead===null?{sourceHead:o.sourceHead}:{}})}if(e.lastPush&&typeof e.lastPush=="object"&&!Array.isArray(e.lastPush)){let o=e.lastPush,a=o.status,u=o.pushedAt;(a==="pushed"||a==="failed")&&typeof u=="string"&&(i.lastPush={status:a,pushedAt:u,...typeof o.teamId=="string"||o.teamId===null?{teamId:o.teamId}:{},...typeof o.projectId=="string"||o.projectId===null?{projectId:o.projectId}:{},...typeof o.localHead=="string"||o.localHead===null?{localHead:o.localHead}:{},...typeof o.hostedHead=="string"||o.hostedHead===null?{hostedHead:o.hostedHead}:{},...typeof o.sourceRef=="string"||o.sourceRef===null?{sourceRef:o.sourceRef}:{},...o.promotionStatus==="uploaded"||o.promotionStatus==="hosted_source_materialized"||o.promotionStatus==="hosted_source_materialize_failed"||o.promotionStatus==="hosted_source_check_pending"||o.promotionStatus==="hosted_source_check_failed"||o.promotionStatus==="hosted_source_published"||o.promotionStatus==="hosted_source_publish_failed"||o.promotionStatus==="hosted_run_pending"||o.promotionStatus==="hosted_run_passed"||o.promotionStatus==="hosted_run_failed"||o.promotionStatus===null?{promotionStatus:o.promotionStatus}:{},...o.hostedRunStatus==="not_started"||o.hostedRunStatus==="running"||o.hostedRunStatus==="passed"||o.hostedRunStatus==="failed"||o.hostedRunStatus===null?{hostedRunStatus:o.hostedRunStatus}:{},...typeof o.hostedRunAgentId=="string"||o.hostedRunAgentId===null?{hostedRunAgentId:o.hostedRunAgentId}:{},...typeof o.hostedRunId=="string"||o.hostedRunId===null?{hostedRunId:o.hostedRunId}:{},...typeof o.hostedRunAt=="string"||o.hostedRunAt===null?{hostedRunAt:o.hostedRunAt}:{},...w(o.hostedSourceMaterialization)?{hostedSourceMaterialization:w(o.hostedSourceMaterialization)}:{},...E(o.hostedSourceCheck)?{hostedSourceCheck:E(o.hostedSourceCheck)}:{},...K(o.hostedPublish)?{hostedPublish:K(o.hostedPublish)}:{},...M(o.hostedRun)?{hostedRun:M(o.hostedRun)}:{},...typeof o.error=="string"||o.error===null?{error:o.error}:{}})}if(Array.isArray(e.profiles)){let o=e.profiles.flatMap(a=>{let u=B(a);if(!u)return[];let c=a,p=c.source==="github"||c.source==="openpond_git"?c.source:"local",C=typeof c.repositoryId=="string"&&c.repositoryId.trim()?c.repositoryId.trim():Q.resolve(u.repoPath);return[{source:p,repositoryId:C,repoPath:u.repoPath,profile:u.profile,...u.lastCheck?{lastCheck:u.lastCheck}:{},...u.lastPush?{lastPush:u.lastPush}:{}}]});o.length>0&&(i.profiles=o)}return i}l(B,"sanitizeLocalOpenPondProfile");function w(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=R(e.status);return t?{status:t,...r(e,"agentId"),...r(e,"runtimeAgentId"),...r(e,"projectId"),...r(e,"sourceRoot"),...r(e,"sourceRef"),...r(e,"sourceCommitSha"),...r(e,"manifestHash"),...r(e,"manifestPath"),...r(e,"manifestSyncedAt"),...T(e,"fileCount"),...T(e,"totalBytes"),...r(e,"generatedManifestPath"),...k(e,"synthesizedOpenPondYaml"),...r(e,"uploadMetadataPath"),...f(e,"setupCommands"),...f(e,"validationCommands"),...r(e,"materializedAt"),...r(e,"error")}:null}l(w,"sanitizeHostedMaterializationStatus");function E(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=R(e.status);return t?{status:t,...r(e,"agentId"),...r(e,"deployPlanStatus"),...k(e,"canRun"),...k(e,"canDeploy"),...r(e,"sourceRef"),...r(e,"sourceCommitSha"),...r(e,"manifestHash"),...r(e,"manifestPath"),...f(e,"setupCommands"),...f(e,"validationCommands"),...f(e,"requiredChecks"),...f(e,"evalNames"),...f(e,"blockedReasons"),...f(e,"staleReasons"),...r(e,"runtimeId"),...r(e,"sandboxId"),...f(e,"traceArtifactRefs"),...f(e,"evalResultArtifactRefs"),...f(e,"validatorArtifactRefs"),...r(e,"checkedAt"),...r(e,"error")}:null}l(E,"sanitizeHostedSourceCheckStatus");function K(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=R(e.status);return t?{status:t,...r(e,"agentId"),...r(e,"snapshotId"),...r(e,"sourceRef"),...r(e,"sourceCommitSha"),...r(e,"manifestHash"),...r(e,"manifestPath"),...r(e,"buildStatus"),...r(e,"validationStatus"),...r(e,"evalStatus"),...r(e,"publishedAt"),...r(e,"error")}:null}l(K,"sanitizeHostedPublishStatus");function M(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=R(e.status);return t?{status:t,...r(e,"agentId"),...r(e,"runId"),...r(e,"runtimeId"),...r(e,"sandboxId"),...r(e,"sourceRef"),...r(e,"sourceCommitSha"),...r(e,"manifestHash"),...r(e,"setupGateStatus"),...f(e,"setupRequirementRefs"),...f(e,"artifactRefs"),...f(e,"traceArtifactRefs"),...f(e,"evalArtifactRefs"),...r(e,"startedAt"),...r(e,"completedAt"),...r(e,"error")}:null}l(M,"sanitizeHostedRunSummary");function r(n,e){let t=n[e];return typeof t=="string"||t===null?{[e]:t}:{}}l(r,"nullableStringProp");function k(n,e){let t=n[e];return typeof t=="boolean"||t===null?{[e]:t}:{}}l(k,"nullableBooleanProp");function T(n,e){let t=n[e];return typeof t=="number"||t===null?{[e]:t}:{}}l(T,"nullableNumberProp");function f(n,e){let t=n[e];if(!Array.isArray(t))return{};let s=t.filter(i=>typeof i=="string");return{[e]:s}}l(f,"stringArrayProp");function R(n){return typeof n=="string"&&n.trim()?n.trim():null}l(R,"stringField");function D(n,e){if(!b(n.handle,e.handle))return!1;let t=d(e.baseUrl);return t?d(n.baseUrl)===t:!d(n.baseUrl)}l(D,"accountMatchesSelector");function I(n,e,t={}){let s=d(e.baseUrl);if(s)return v(n,e.handle,s);let i=n.findIndex(a=>D(a,e));if(i!==-1)return i;let o=n.map((a,u)=>({account:a,index:u})).filter(({account:a})=>b(a.handle,e.handle));if(o.length>1&&t.requireUnambiguous)throw new Error(`multiple profiles found for ${e.handle}; pass --base-url to select one`);return o[0]?.index??-1}l(I,"findAccountIndexForSelector");function X(n){if(!n||typeof n!="object"||Array.isArray(n))return;let e=n,t={};return typeof e.token=="string"&&(t.token=e.token),(typeof e.appId=="string"||e.appId===null)&&(t.appId=e.appId),(typeof e.conversationId=="string"||e.conversationId===null)&&(t.conversationId=e.conversationId),Object.keys(t).length>0?t:void 0}l(X,"sanitizeSession");function Z(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n,t=h(typeof e.handle=="string"?e.handle:void 0);if(!t)return null;let s={handle:t};typeof e.apiKey=="string"&&(s.apiKey=e.apiKey),typeof e.baseUrl=="string"&&(s.baseUrl=e.baseUrl),typeof e.apiBaseUrl=="string"&&(s.apiBaseUrl=e.apiBaseUrl),typeof e.chatApiBaseUrl=="string"&&(s.chatApiBaseUrl=e.chatApiBaseUrl),typeof e.environment=="string"&&(s.environment=e.environment);let i=X(e.session);return i&&(s.session=i),s}l(Z,"sanitizeAccount");function ee(n){let e={};return typeof n.token=="string"&&(e.token=n.token),(typeof n.appId=="string"||n.appId===null)&&(e.appId=n.appId),(typeof n.conversationId=="string"||n.conversationId===null)&&(e.conversationId=n.conversationId),Object.keys(e).length>0?e:void 0}l(ee,"extractLegacySession");function ne(n,e){let t={handle:e};typeof n.apiKey=="string"&&(t.apiKey=n.apiKey),typeof n.baseUrl=="string"&&(t.baseUrl=n.baseUrl),typeof n.apiBaseUrl=="string"&&(t.apiBaseUrl=n.apiBaseUrl),typeof n.chatApiBaseUrl=="string"&&(t.chatApiBaseUrl=n.chatApiBaseUrl);let s=ee(n);return s&&(t.session=s),t}l(ne,"extractLegacyAccount");function x(n){let e={};typeof n.lspEnabled=="boolean"&&(e.lspEnabled=n.lspEnabled),(n.executionMode==="local"||n.executionMode==="hosted")&&(e.executionMode=n.executionMode),(n.mode==="general"||n.mode==="builder")&&(e.mode=n.mode);let t=B(n.openpondProfile);t&&(e.openpondProfile=t);let s=[],i=Array.isArray(n.accounts)?n.accounts:[];for(let c of i){let p=Z(c);p&&v(s,p.handle,p.baseUrl)===-1&&s.push(p)}if(s.length===0){let c=y(n.activeProfile)?.handle||U;s.push(ne(n,c))}let o=y(n.activeProfile),a=o?I(s,o):-1,u=s[a===-1?0:a];return e.accounts=s,e.activeProfile=P(u),e}l(x,"normalizeGlobalConfig");function N(n,e,t){let s=n.accounts??[],i=d(t??process.env.OPENPOND_BASE_URL),o=h(e);if(o)return i?{handle:o,baseUrl:i}:{handle:o};let a=h(process.env.OPENPOND_ACCOUNT);if(a)return i?{handle:a,baseUrl:i}:{handle:a};let u=y(n.activeProfile);return u?i?{handle:u.handle,baseUrl:i}:u:s[0]?P(s[0]):{handle:U}}l(N,"resolveRequestedProfile");function G(n,e,t){let s=d(t);if(s){let o=v(n,e,s);if(o!==-1)return n[o]}else{let o=n.filter(a=>b(a.handle,e));if(o.length>1)throw new Error(`multiple profiles found for ${e}; pass --base-url to select one`);if(o.length===1)return o[0]}let i={handle:e};return s&&(i.baseUrl=s),n.push(i),i}l(G,"ensureAccount");function j(n){n.session&&Object.keys(n.session).length===0&&delete n.session}l(j,"cleanupAccount");function te(n,e,t,s){let i=t===null||t===void 0&&s.undefinedDeletes;switch(e){case"apiKey":{if(i){delete n.apiKey;return}typeof t=="string"&&(n.apiKey=t);return}case"baseUrl":{if(i){delete n.baseUrl;return}typeof t=="string"&&(n.baseUrl=t);return}case"apiBaseUrl":{if(i){delete n.apiBaseUrl;return}typeof t=="string"&&(n.apiBaseUrl=t);return}case"chatApiBaseUrl":{if(i){delete n.chatApiBaseUrl;return}typeof t=="string"&&(n.chatApiBaseUrl=t);return}case"token":case"appId":case"conversationId":{if(n.session||(n.session={}),i){delete n.session[e],j(n);return}(typeof t=="string"||t===null)&&(n.session[e]=t),j(n);return}}}l(te,"applyScopedKey");function $(n,e,t){if(!z.some(c=>m(e,c)))return!1;let i=n.accounts??[],o=y(e.activeProfile)??N(n),a=d(m(e,"baseUrl")?e.baseUrl??null:o.baseUrl??process.env.OPENPOND_BASE_URL),u=G(i,o.handle,a);for(let c of z)m(e,c)&&te(u,c,e[c],t);return n.accounts=i,n.activeProfile=P(u),!0}l($,"applyAccountPatch");function F(n,e){if(m(e,"lspEnabled")&&(typeof e.lspEnabled=="boolean"?n.lspEnabled=e.lspEnabled:e.lspEnabled===null&&delete n.lspEnabled),m(e,"executionMode")&&(e.executionMode==="local"||e.executionMode==="hosted"?n.executionMode=e.executionMode:e.executionMode===null&&delete n.executionMode),m(e,"mode")&&(e.mode==="general"||e.mode==="builder"?n.mode=e.mode:e.mode===null&&delete n.mode),m(e,"activeProfile")){let t=y(e.activeProfile);if(t){let s=I(n.accounts??[],t);n.activeProfile=s===-1?t:P((n.accounts??[])[s])}else e.activeProfile===null&&delete n.activeProfile}if(m(e,"openpondProfile")){let t=B(e.openpondProfile);t?n.openpondProfile=t:e.openpondProfile===null&&delete n.openpondProfile}}l(F,"applyTopLevelPatch");async function oe(n){let e=A();await S(e),await L(e,()=>n)}l(oe,"writeGlobalConfig");async function _(n){let e=A();return await S(e),await L(e,t=>{let s=x(t);return n(s),s})}l(_,"updateGlobalConfig");async function Y(){let n=A();return await S(n),x(await H(n))}l(Y,"loadGlobalConfig");async function le(n={}){let e=await Y(),t=e.accounts??[],s=N(e,n.account,n.baseUrl),i=I(t,s,{requireUnambiguous:!0}),o=i===-1?null:t[i],a=o?.session;return{...e,activeProfile:o?P(o):s,apiKey:o?.apiKey,baseUrl:o?.baseUrl,apiBaseUrl:o?.apiBaseUrl,chatApiBaseUrl:o?.chatApiBaseUrl,token:a?.token,appId:a?.appId,conversationId:a?.conversationId}}l(le,"loadConfig");async function J(){let n=await Y(),e=y(n.activeProfile);return(n.accounts??[]).map(t=>{let s=h(t.handle)??U;return{handle:s,baseUrl:d(t.baseUrl),apiBaseUrl:d(t.apiBaseUrl),chatApiBaseUrl:d(t.chatApiBaseUrl),environment:t.environment?.trim()||null,isActive:!!(e&&D({...t,handle:s},e)),hasApiKey:!!t.apiKey?.trim(),hasSessionToken:!!t.session?.token?.trim(),sessionAppId:t.session?.appId??null,sessionConversationId:t.session?.conversationId??null}})}l(J,"listConfiguredProfiles");async function ae(n,e={}){let t=q(n),s=d(e.baseUrl),i=-1;await _(a=>{let u=a.accounts??[];if(i=I(u,s?{handle:t,baseUrl:s}:{handle:t},{requireUnambiguous:!0}),i===-1)throw new Error(`profile not found: ${t}`);a.activeProfile=P(u[i])});let o=await J();return o.find(a=>a.isActive)??o[i]}l(ae,"setActiveProfile");async function ue(n){let e=q(n.handle),t=W(n.apiKey),s=d(n.baseUrl),i=d(n.apiBaseUrl),o=d(n.chatApiBaseUrl),a={handle:e};await _(p=>{let C=p.accounts??[],g=G(C,e,s);g.apiKey=t,s&&(g.baseUrl=s),i?g.apiBaseUrl=i:n.apiBaseUrl===null&&delete g.apiBaseUrl,o?g.chatApiBaseUrl=o:n.chatApiBaseUrl===null&&delete g.chatApiBaseUrl,n.environment===null?delete g.environment:typeof n.environment=="string"&&n.environment.trim()&&(g.environment=n.environment.trim()),p.accounts=C,a=P(g),n.setActive!==!1&&(p.activeProfile=a)});let c=(await J()).find(p=>b(p.handle,a.handle)?s?d(p.baseUrl)===s:!0:!1);if(!c)throw new Error(`failed to save profile: ${e}`);return c}l(ue,"saveProfileApiKey");async function ce(n){let e=x(n);F(e,n),$(e,n,{undefinedDeletes:!0}),await oe(e)}l(ce,"saveConfig");async function de(n){await _(e=>{F(e,n),$(e,n,{undefinedDeletes:!1})})}l(de,"saveGlobalConfig");export{re as a,_ as b,Y as c,le as d,J as e,ae as f,ue as g,ce as h,de as i};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as k}from"./chunk-6FA3GG5B.js";import{
|
|
2
|
+
import{a as k}from"./chunk-6FA3GG5B.js";import{A as e}from"./chunk-PF56N7ZY.js";import{a as r}from"./chunk-FTQLQJQV.js";var b=3e3,h=9999,l="openpond.yaml",ie="openpond-template-plan.json",M="openpond.sandboxTemplate.buildPlan.v1",C=["google","github","x"],S=new Set([22,2222,2375,2376,3108,5900,5901,6080,7818]),w=e.array(e.string().trim().min(1).max(1e3)).max(50),d=e.string().trim().min(1).max(4096).refine(N,{message:"path must be a relative workspace path"}),O=e.string().trim().min(1).max(500).refine(t=>!t.includes("\0")&&!/\s/.test(t),"image ref must be a single OCI reference"),D=e.string().trim().regex(/^sha256:[0-9a-f]{64}$/i),R=e.string().trim().min(1).max(500).refine(t=>t.startsWith("/")&&!t.includes("\0"),"workspaceRoot must be an absolute guest path"),$=e.object({ref:O,digest:D.optional(),registrySecretRef:e.string().trim().min(1).max(500).optional(),platform:e.literal("linux/amd64").optional(),workspaceRoot:R.optional()}).strict(),q=e.object({context:d.default("."),path:d.default("Dockerfile"),target:e.string().trim().min(1).max(191).optional(),buildArgs:e.record(e.string().max(191),e.string().max(500)).optional(),registrySecretRefs:e.array(e.string().trim().min(1).max(500)).max(10).optional(),platform:e.literal("linux/amd64").optional(),workspaceRoot:R.optional()}).strict(),L=e.object({base:e.string().trim().min(1).max(120).optional(),snapshot:e.string().trim().min(1).max(191).optional(),image:$.optional(),dockerfile:q.optional()}).strict().superRefine((t,a)=>{[t.base,t.snapshot,t.image,t.dockerfile].filter(Boolean).length!==1&&a.addIssue({code:e.ZodIssueCode.custom,message:"runtime must declare exactly one of base, snapshot, image, or dockerfile"})}),T=e.object({cpu:e.number().positive().max(8).optional(),memoryGb:e.number().positive().max(32).optional(),diskGb:e.number().positive().max(100).optional()}).strict(),V=e.object({provider:e.enum(C),scopes:e.array(e.string().trim().min(1).max(200)).max(100).default([]),capabilities:e.array(e.string().trim().min(1).max(200)).max(100).default([])}).strict(),z=e.object({models:e.array(e.string().trim().min(1).max(200)).max(100).default([]),scopes:e.array(e.string().trim().min(1).max(200)).max(100).default([])}).strict(),Z=e.object({opchat:z.optional()}).catchall(e.record(e.string(),e.unknown())).default({}),j=e.object({name:e.string().trim().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).max(63).optional(),mountPath:e.string().trim().min(1).max(256).optional(),storageGb:e.number().int().positive().max(100).optional(),deleteOnSandboxDelete:e.boolean().optional()}).strict(),E=e.object({port:e.number().int().min(b).max(h).refine(t=>!S.has(t),{message:"preview port is reserved"}),protocol:e.literal("http").default("http"),label:e.string().trim().min(1).max(80).optional(),access:e.enum(["private","public"]).default("private"),path:e.string().trim().min(1).max(512).refine(t=>t.startsWith("/"),{message:"preview path must start with /"}).default("/")}).strict(),_=e.object({command:e.string().trim().min(1).max(1e3),cwd:d.optional(),timeoutSeconds:e.number().int().positive().max(86400).optional(),requiresStart:e.boolean().default(!1),ports:e.array(E).max(20).default([]),artifactPaths:e.array(d).max(100).default([])}).strict(),I=_.extend({name:e.string().trim().min(1).max(80)}).strict(),F=e.object({name:e.string().trim().min(1).max(80).optional(),service:e.string().trim().min(1).max(80).optional(),port:e.number().int().min(b).max(h).refine(t=>!S.has(t),{message:"app MCP port is reserved"}),path:e.string().trim().min(1).max(512).refine(t=>t.startsWith("/"),{message:"app MCP path must start with /"}).default("/mcp")}).strict(),B=e.object({name:e.string().trim().min(1).max(80).optional(),port:e.number().int().min(b).max(h).refine(t=>!S.has(t),{message:"validation probe port is reserved"}),path:e.string().trim().min(1).max(512).refine(t=>t.startsWith("/"),{message:"validation probe path must start with /"}).default("/"),expectedStatus:e.number().int().min(100).max(599).default(200)}).strict(),W=e.record(e.string(),e.unknown()).refine(t=>t.type==="object","input schema must be a JSON schema object"),J=e.object({name:e.string().trim().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(191),required:e.boolean().default(!1),secret:e.boolean().default(!0),description:e.string().trim().max(500).optional()}).strict(),g=e.string().trim().min(1).max(120),G=e.object({name:e.string().trim().min(1).max(120),description:e.string().trim().max(500).optional(),cron:e.string().trim().min(1).max(500).optional(),rate:e.string().trim().min(1).max(500).optional(),once:g.optional(),scheduleType:e.enum(["rate","cron","once"]).optional(),scheduleExpression:e.string().trim().min(1).max(500).optional(),timezone:e.string().trim().min(1).max(100).optional(),enabled:e.boolean().default(!0),startAt:g.optional(),endAt:g.optional(),maxRuns:e.number().int().positive().nullable().optional(),runtimePolicy:e.enum(["run_and_stop","run_and_archive","run_and_delete","use_existing_running"]).default("run_and_stop"),action:e.string().trim().min(1).max(120).optional(),actionName:e.string().trim().min(1).max(120).optional(),command:e.string().trim().min(1).max(2e3).optional(),target:e.object({kind:e.enum(["start","action","service","command"]).optional(),name:e.string().trim().min(1).max(120).optional(),actionName:e.string().trim().min(1).max(120).optional(),command:e.string().trim().min(1).max(2e3).optional(),requiresStart:e.boolean().optional()}).strict().optional(),requiresStart:e.boolean().optional(),budget:e.object({maxUsd:e.string().trim().min(1).max(40).optional()}).strict().optional(),resources:T.optional(),quotas:e.record(e.string(),e.unknown()).optional(),lifecycle:e.record(e.string(),e.unknown()).optional(),retentionPolicy:e.record(e.string(),e.unknown()).optional(),env:e.array(e.object({name:e.string().trim().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(191),value:e.string().optional(),secretRef:e.string().optional()}).strict()).max(100).optional(),integrationLeases:e.array(e.record(e.string(),e.unknown())).max(20).optional(),metadata:e.record(e.string(),e.unknown()).optional()}).strict().superRefine((t,a)=>{[t.cron,t.rate,t.once,t.scheduleExpression].filter(m=>typeof m=="string"&&m.trim()).length!==1&&a.addIssue({code:e.ZodIssueCode.custom,path:["scheduleExpression"],message:"schedule must declare exactly one of cron, rate, once, or scheduleExpression"}),t.scheduleExpression&&!t.scheduleType&&a.addIssue({code:e.ZodIssueCode.custom,path:["scheduleType"],message:"scheduleType is required with scheduleExpression"});let i=t.command??t.target?.command??null,o=t.target?.name??null,s=t.actionName??t.action??t.target?.actionName??(t.target?.kind==="action"?o:null),c=t.target?.kind??(i?"command":"action");c==="action"&&!s&&a.addIssue({code:e.ZodIssueCode.custom,path:["action"],message:"schedule action target is required"}),c==="service"&&!o&&a.addIssue({code:e.ZodIssueCode.custom,path:["target","name"],message:"schedule service target name is required"}),c==="command"&&!i&&a.addIssue({code:e.ZodIssueCode.custom,path:["command"],message:"schedule command target is required"})}),v=e.object({schemaVersion:e.literal(1),name:e.string().trim().min(1).max(80).regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/),version:e.string().trim().min(1).max(40),useCase:e.string().trim().min(1).max(80),description:e.string().trim().min(1).max(500),runtime:L,resources:T.optional(),setup:e.object({commands:w.default([])}).strict().default({commands:[]}),validation:e.object({commands:w.min(1),probes:e.array(B).max(20).default([])}).strict(),start:_,actions:e.array(I).max(20).default([]),services:e.array(I).max(20).default([]),schedules:e.array(G).max(20).default([]),mcp:e.object({endpoints:e.array(F).max(10).default([])}).strict().default({endpoints:[]}),volumes:e.array(j).max(5).default([]),integrations:e.object({requiredLeases:e.array(V).max(20).default([])}).strict().default({requiredLeases:[]}),permissions:Z,inputs:e.object({schema:W.default({type:"object"}),env:e.array(J).max(100).default([])}).strict().default({schema:{type:"object"},env:[]}),artifacts:e.object({paths:e.array(d).max(100).default([])}).strict().default({paths:[]}),network:e.object({egress:e.enum(["restricted","allow","block"]).default("restricted")}).strict().default({egress:"restricted"})}).strict().superRefine((t,a)=>{Q(t,a),y(a,t.volumes.flatMap(n=>n.name?[n.name]:[]),"volume names must be unique","volumes"),ee(t,a),te(t,a),ae(t,a),ne(t,a)}),me=e.object({path:e.string(),message:e.string(),code:e.string()});function K(t){let a;try{a=k.load(t)}catch(n){return{ok:!1,manifest:null,diagnostics:[{path:"$",code:"invalid_yaml",message:n instanceof Error?n.message:"Invalid YAML"}]}}return U(a)}r(K,"validateSandboxTemplateYaml");function U(t){if(!t||typeof t!="object"||Array.isArray(t))return{ok:!1,manifest:null,diagnostics:[{path:"$",code:"invalid_type",message:`${l} must be an object`}]};if(Object.prototype.hasOwnProperty.call(t,"databases"))return{ok:!1,manifest:null,diagnostics:[{path:"$.databases",code:"database_resources_removed",message:"managed database requests are unsupported for Firecracker sandbox templates; use a durable volume with SQLite or files instead"}]};let a=v.safeParse(t);return a.success?{ok:!0,manifest:a.data,diagnostics:[]}:{ok:!1,manifest:null,diagnostics:a.error.issues.map(n=>({path:H(n.path),code:n.code,message:n.message}))}}r(U,"validateSandboxTemplateManifest");function ce(t){let a=K(t);if(!a.ok)throw new Error(X(a.diagnostics));return a.manifest}r(ce,"parseSandboxTemplateYaml");function X(t){return t.map(a=>`${a.path}: ${a.message}`).join(`
|
|
3
3
|
`)}r(X,"formatSandboxTemplateDiagnostics");function pe(t){return v.parse(t)}r(pe,"defineSandboxTemplate");function de(t={}){return T.parse(t)}r(de,"sandboxTemplateResources");function le(t){return j.parse({...t,deleteOnSandboxDelete:t.deleteOnSandboxDelete??!1})}r(le,"sandboxTemplateDurableVolume");function ue(t,a={}){return E.parse({...a,port:t})}r(ue,"sandboxTemplatePreviewPort");function ge(t){let a=d.parse(t.targetPath),n=t.accept?.map(s=>s.trim()).filter(s=>s.length>0),i={targetPath:a,...n&&n.length>0?{accept:n}:{}},o={...t.title?.trim()?{title:t.title.trim()}:{},...t.description?.trim()?{description:t.description.trim()}:{},"x-openpond-upload":i};return t.multiple?{...o,"x-openpond-upload":{...i,multiple:!0},type:"array",items:{type:"string",format:"file"}}:{...o,type:"string",format:"file"}}r(ge,"sandboxTemplateFileInput");function A(t){return[{kind:"start",name:"start",...t.start,artifactPaths:f(t.start,t)},...t.actions.map(a=>({kind:"action",name:a.name,command:a.command,cwd:a.cwd,timeoutSeconds:a.timeoutSeconds,requiresStart:a.requiresStart,ports:a.ports,artifactPaths:f(a,t)})),...t.services.map(a=>({kind:"service",name:a.name,command:a.command,cwd:a.cwd,timeoutSeconds:a.timeoutSeconds,requiresStart:a.requiresStart,ports:a.ports,artifactPaths:f(a,t)}))]}r(A,"sandboxTemplateExecutableEntries");function Y(t){let a=A(t);return{template:{name:t.name,version:t.version,useCase:t.useCase,runtime:t.runtime},resources:t.resources??null,volumes:t.volumes,executables:a.map(n=>({kind:n.kind,name:n.name,command:n.command,cwd:n.cwd??null,timeoutSeconds:n.timeoutSeconds??null,requiresStart:n.requiresStart,ports:n.ports.map(i=>i.port),artifactPaths:n.artifactPaths})),ports:a.flatMap(n=>n.ports.map(i=>({executable:n.name,kind:n.kind,port:i.port,access:i.access,label:i.label??null}))),appMcpEndpoints:t.mcp.endpoints.map(n=>({name:n.name??null,service:n.service??null,port:n.port,path:n.path})),validation:{commands:t.validation.commands,probes:t.validation.probes},schedules:t.schedules}}r(Y,"sandboxTemplateBuildMetadata");function xe(t){return{kind:M,schemaVersion:1,manifestFile:t.manifestFile,projectRoot:t.projectRoot,manifest:t.manifest,metadata:Y(t.manifest),executables:A(t.manifest)}}r(xe,"sandboxTemplateBuildPlan");function fe(t){let a=t.name.trim()||"Sandbox Template",n=se(a),i=t.description?.trim()||`Local scaffold for ${a}.`;return{".gitignore":["node_modules","artifacts",".DS_Store",""].join(`
|
|
4
4
|
`),"README.md":[`# ${a}`,"","Local sandbox template scaffold.","","## Commands","","- `pnpm dev` starts the preview service on port 3000.","- `pnpm process` writes a sample artifact.",`- \`pnpm validate\` validates ${l}.`,""].join(`
|
|
5
5
|
`),"package.json":`${JSON.stringify({private:!0,type:"module",scripts:{dev:"node src/server.ts",process:"node scripts/process.ts",validate:`openpond sandbox-template validate --file ${l}`}},null,2)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as v}from"./chunk-
|
|
2
|
+
import{a as v}from"./chunk-M3ZQDPRS.js";import{a as B}from"./chunk-KCJVFLBB.js";import{a as W,b as f,c as T,d as b,e as C,l as D,m as Q,n as J}from"./chunk-6GWOVHIG.js";import{a as M,b as P,c as N}from"./chunk-QGOPYQW3.js";import{a as u,e as h,f as y,g as S,h as H,i as x,j as E}from"./chunk-DG4TYVPF.js";import{Db as L}from"./chunk-M55H7KVR.js";import{e as O}from"./chunk-BK63OQRW.js";import{a as w}from"./chunk-FTQLQJQV.js";var _={run_overlay:h,evaluation_review:O,refinement_candidate:M,refinement_candidate_lifecycle:P,cross_run_refinement_request:N,training_qualification:L,proposal:y,targeted_validation:S,merge_receipt:x,observation:W,trigger_decision:f,route_decision:T,apply_receipt:C,refiner_outcome:b};function k(o){return[o.id,o.ownerScope.kind,o.ownerScope.id,o.location,o.revision,o.sourceRevision,o.currentChannel.revision,o.currentChannel.release?.contentHash??null,JSON.stringify(o),o.createdAt,o.updatedAt]}w(k,"harnessWorkspaceParams");function g(o){let{createdAt:r,...e}=o;return e}w(g,"immutableHarnessReleaseRecord");var K=class extends B{static{w(this,"SqliteHarnessWorkspaceStore")}async createHarnessWorkspace(r){let e=u.parse(r);await this.ready;let s=this.writeQueue.then(()=>this.run(`INSERT INTO harness_workspaces (
|
|
3
3
|
id, owner_kind, owner_id, location, revision, source_revision,
|
|
4
4
|
channel_revision, current_release_hash, payload, created_at, updated_at
|
|
5
5
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,k(e)));return this.writeQueue=s.catch(()=>{}),await s,e}async createHarnessWorkspaceWithRelease(r){let e=u.parse(r.workspace),s=v.parse(r.release);if(s.workspaceId!==e.id||e.currentChannel.release?.id!==s.harnessRelease.id||e.currentChannel.release.contentHash!==s.harnessRelease.contentHash||e.sourceRevision!==s.sourceRevision)throw new Error("Initial Harness workspace and release record are not bound to the same source and release.");await this.ready;let a=this.writeQueue.then(async()=>{await this.exec("BEGIN IMMEDIATE");try{await this.run(`INSERT INTO harness_workspaces (
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as b}from"./chunk-D4UX2O45.js";import{b as P}from"./chunk-MS37ISA4.js";import{b as _}from"./chunk-7RC5WPVT.js";import{g as h}from"./chunk-FSQWAANK.js";import{h as T}from"./chunk-6GWOVHIG.js";import{q as x}from"./chunk-O4FBOUNX.js";import{h as E,j as I,k as y}from"./chunk-Y54RKLOI.js";import{F as w}from"./chunk-SG6JZ7HD.js";import{a as l}from"./chunk-FTQLQJQV.js";function L(e){let a=e.result.proposal,d=a?.edits.find(t=>t.target!=="harness.json")??a?.edits[0]??null,c=e.result.outcome.metadata.routed===!0,n=a?e.result.applyReceipt?.decision==="applied"?"applied":"retained":c?"routed":"no_action",r=a?.baseHarnessRelease??e.trigger.harnessRelease,o=n==="applied"?e.result.advanceReceipt?.nextRelease??r:null;return{schemaVersion:"openpond.localHarnessRefinerActivityDisplay.v1",visibility:C(e.session)?"always":"material_only",state:"completed",workspaceId:e.result.workspace.id,result:n,decision:a?"propose":c?"route":"no_action",route:a?.route??g(e.result.outcome.metadata.route),operation:d?.operation??null,target:d?.target??null,summary:d?.summary??g(e.result.outcome.metadata.summary)??U(n,a?.route??g(e.result.outcome.metadata.route)),expectedOutcome:a?.expectedOutcome??g(e.result.outcome.metadata.expectedOutcome),reason:e.result.outcome.reason,evidenceBasis:B(e.result),critiqueStatus:a?"passed":"not_applicable",validationStatus:W(e.result),validationReceipts:e.result.validations.map(t=>({id:t.id,contentHash:t.contentHash,status:t.status,summary:t.summary})),edits:a?.edits.map(t=>({id:t.id,operation:t.operation,target:t.target,summary:t.summary,content:t.content}))??[],trigger:{id:e.trigger.id,contentHash:e.trigger.contentHash},outcome:{id:e.result.outcome.id,contentHash:e.result.outcome.contentHash},proposal:a?{id:a.id,contentHash:a.contentHash}:null,applyReceipt:e.result.applyReceipt?{id:e.result.applyReceipt.id,contentHash:e.result.applyReceipt.contentHash}:null,advanceReceipt:e.result.advanceReceipt?{id:e.result.advanceReceipt.id,contentHash:e.result.advanceReceipt.contentHash}:null,inputHarness:r,outputHarness:o}}l(L,"localHarnessRefinerActivityDisplay");function B(e){let a=e.proposal?.metadata.evidenceBasis??e.outcome.metadata.evidenceBasis,d=E.safeParse(a);return d.success?d.data:null}l(B,"evidenceBasisFromResult");function W(e){if(!e.proposal)return"not_applicable";let a=new Map(e.validations.map(c=>[c.validationId,c])),d=e.proposal.validationPlan.filter(c=>c.required);return d.some(c=>!a.has(c.id))?"pending":d.every(c=>a.get(c.id)?.status==="passed")?"passed":"failed"}l(W,"proposalValidationStatus");function C(e){return e.metadata?.automatedTasksetWorkAttempt===!0||typeof e.metadata?.tasksetId=="string"||typeof e.metadata?.benchmarkRuntime=="string"}l(C,"isEvaluationSession");function g(e){return typeof e=="string"&&e.trim()?e.trim():null}l(g,"stringMetadata");function U(e,a){return e==="no_action"?"No reusable change":e==="routed"?a?`${k(a)} issue routed`:"Issue routed":e==="applied"?a?`${k(a)} change`:"Harness change":a?`${k(a)} change`:"Harness change"}l(U,"resultSummary");function k(e){return e.length>0?`${e[0].toUpperCase()}${e.slice(1)}`:e}l(k,"titleCase");function G(e){let a=new Set,d=l((async function(n){if(q(n.session))return;let r=await b({store:e.store,...n});if(!r)return;let o=r.trigger;if(o.decision==="route_deterministically"&&o.deterministicRoute){let t=T({schemaVersion:"openpond.improvementRouteDecision.v1",id:`route-${o.contentHash.slice(0,24)}`,trigger:{id:o.id,contentHash:o.contentHash},route:o.deterministicRoute,authority:"runtime_service",automatic:!0,reason:o.reason,createdAt:o.createdAt,metadata:{}});await e.store.saveHarnessImprovementArtifact(n.turn.harnessSnapshot.workspaceId,"route_decision",t);return}o.decision==="queue_refiner"&&await c(n,o,!1)}),"processLocalHarnessImprovementBoundary");async function c(n,r,o){if(r.decision!=="queue_refiner")throw new Error("Only queued Harness Refiner triggers can be enqueued.");if(a.has(r.contentHash))return;a.add(r.contentHash);let t=Date.now();try{await e.appendRuntimeEvent(h({sessionId:n.session.id,turnId:n.turn.id,name:"harness.refiner.queued",source:"server",appId:n.session.appId,status:"pending",output:r.reason,data:{triggerId:r.id,timeoutMs:I,maxOutputTokens:y,execution:"public_package",recoveredAfterRestart:o,activity:{schemaVersion:"openpond.localHarnessRefinerActivityDisplay.v1",visibility:D(n.session),state:"running",summary:"Reviewing this Work for a reusable improvement"}}}))}catch(f){throw a.delete(r.contentHash),f}e.queue.enqueue({label:"Refine the Local Harness from a recovered execution detour",metadata:{key:r.contentHash,sessionId:n.session.id,turnId:n.turn.id,triggerId:r.id,recoveredAfterRestart:o}},async()=>{let f=0,p=Date.now(),u=null,i=null;try{await e.appendRuntimeEvent(h({sessionId:n.session.id,turnId:n.turn.id,name:"harness.refiner.started",source:"server",appId:n.session.appId,status:"started",data:{triggerId:r.id,queueWaitMs:Math.max(0,p-t),timeoutMs:I,maxOutputTokens:y,execution:"public_package",recoveredAfterRestart:o,activity:{schemaVersion:"openpond.localHarnessRefinerActivityDisplay.v1",visibility:D(n.session),state:"running",summary:"Reviewing this Work for a reusable improvement"}}})),await e.prepareReview?.(r);let s=await P({store:e.store,storeDir:e.storeDir,loadActiveRefinerRelease:e.loadActiveRefinerRelease,trigger:r,signal:new AbortController().signal,stream:l(async function*({messages:O,signal:S}){u===null&&(u=Date.now());let M=f++,A=`harness-refiner:${r.id}:${M}`,v=await _({session:n.session,turn:n.turn,provider:"openpond",model:w,requestId:A,requestOrdinal:M,requestKind:"harness_refiner",upsert:e.upsertModelUsageRecord});try{for await(let m of e.streamOpenPondHostedChatTurn({model:w,messages:O,requestId:A,reasoningEffort:"low",maxTokens:y,signal:S}))m.type==="text_delta"&&m.text?(v.observeDelta({text:m.text}),yield{text:m.text}):m.type==="reasoning_delta"&&m.text?v.observeDelta({reasoningText:m.text}):m.type==="usage"&&v.observeDelta({usage:m.usage});await v.complete(),i=Date.now()}catch(m){throw i=Date.now(),await v.fail(m,S.aborted?"interrupted":"failed"),m}},"stream")}),R=Date.now(),H=L({session:n.session,trigger:r,result:s});await e.appendRuntimeEvent(h({sessionId:n.session.id,turnId:n.turn.id,name:"harness.refiner.completed",source:"server",appId:n.session.appId,status:"completed",output:s.outcome.reason,data:{recoveredAfterRestart:o,trigger:{id:r.id,contentHash:r.contentHash},outcome:{id:s.outcome.id,contentHash:s.outcome.contentHash,decision:s.outcome.decision,routed:s.outcome.metadata.routed===!0,route:typeof s.outcome.metadata.route=="string"?s.outcome.metadata.route:null},proposal:s.proposal?{id:s.proposal.id,contentHash:s.proposal.contentHash}:null,workspaceAdvance:s.advanceReceipt?.decision??null,activity:H,timing:{queueWaitMs:Math.max(0,p-t),modelDurationMs:u===null||i===null?null:Math.max(0,i-u),materializationDurationMs:i===null?null:Math.max(0,R-i),totalJobDurationMs:Math.max(0,R-p)}}}))}catch(s){let R=Date.now();throw await e.appendRuntimeEvent(h({sessionId:n.session.id,turnId:n.turn.id,name:"harness.refiner.failed",source:"server",appId:n.session.appId,status:"failed",output:s instanceof Error?s.message:String(s),data:{triggerId:r.id,recoveredAfterRestart:o,activity:{schemaVersion:"openpond.localHarnessRefinerActivityDisplay.v1",visibility:D(n.session),state:"failed",summary:"Refiner review failed",reason:s instanceof Error?s.message:String(s)},timing:{queueWaitMs:Math.max(0,p-t),modelDurationMs:u===null||i===null?null:Math.max(0,i-u),totalJobDurationMs:Math.max(0,R-p)}}})).catch(()=>{}),s}finally{a.delete(r.contentHash)}})}return l(c,"enqueueTrigger"),d.reconcilePending=async()=>{let n=await e.store.listPendingHarnessRefinerTriggers(),r=0;for(let{workspaceId:o,trigger:t}of n){let[f,p]=await Promise.all([e.store.getSession(t.runRef),e.store.getTurn(t.turnId)]);if(!f||!p||p.sessionId!==f.id)throw new Error(`Pending Harness Refiner trigger ${t.id} references an unavailable session or turn.`);if(q(f))continue;let u=p;if(!u.harnessSnapshot){let[i,s]=await Promise.all([e.store.getHarnessWorkspace(o),e.store.getHarnessRunOverlay(t.runRef)]),R=!!(i&&s&&t.overlay&&s.id===t.overlay.id&&s.revision===t.overlay.revision&&s.contentHash===t.overlay.contentHash&&s.workspace.workspaceId===o&&s.workspace.revision===i.revision&&s.workspace.sourceRevision===i.sourceRevision&&s.workspace.channelRevision===i.currentChannel.revision&&s.baseHarnessRelease.id===t.harnessRelease.id&&s.baseHarnessRelease.contentHash===t.harnessRelease.contentHash);if(!i||!s||!t.overlay||!R)throw new Error(`Pending Harness Refiner trigger ${t.id} cannot reconstruct its missing Harness snapshot.`);u=await e.store.updateTurn(u.id,H=>x.parse({...H,harnessSnapshot:{schemaVersion:"openpond.harnessTurnSnapshot.v1",workspaceId:o,workspaceRevision:s.workspace.revision,sourceRevision:s.workspace.sourceRevision,channelName:i.currentChannel.name,channelRevision:s.workspace.channelRevision,harnessRelease:t.harnessRelease,overlay:t.overlay}}))??u}if(u.harnessSnapshot?.workspaceId!==o)throw new Error(`Pending Harness Refiner trigger ${t.id} no longer matches its Harness workspace.`);await c({session:f,turn:u},t,!0),r+=1}return r},d}l(G,"createLocalHarnessImprovementRuntime");function q(e){return e.metadata?.source==="experiment-improvement"&&typeof e.metadata.refinementCandidate=="object"?!0:e.metadata?.automatedTasksetWorkAttempt===!0&&typeof e.metadata.parentModelRunId=="string"&&e.metadata.parentModelRunId.trim().length>0}l(q,"parentModelRunOwnsRefinement");function D(e){return e.metadata?.automatedTasksetWorkAttempt===!0||typeof e.metadata?.tasksetId=="string"||typeof e.metadata?.benchmarkRuntime=="string"?"always":"material_only"}l(D,"refinerActivityVisibility");export{G as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as n}from"./chunk-FTQLQJQV.js";var s="127.0.0.1";var d="0.2.49",h=["You are OpenPond Chat. Respond in the user's language. If the user's latest message is language-neutral, ambiguous, or only a short test, respond in English. Be concise and directly answer the latest request. Do not use emojis. Use Markdown when it improves scanability.","If you emit reasoning or thinking content, keep it sparse and user-readable: at most one short sentence for major progress, decisions, or blockers. Omit reasoning for routine searches, reads, tool calls, and obvious next steps. Do not restate the user request, narrate every action, or include code blocks, code excerpts, diffs, raw tool payloads, or markdown examples in reasoning. Put necessary code or exact snippets only in the final assistant answer.","When the user asks to show or preview an image that is available as a workspace path or signed image URL, use Markdown image syntax like  instead of a bare path or raw HTML.","Final responses:","- After substantial work, including research, analysis, document creation, and coding, finish with a concise, self-contained wrap-up. The user should understand the outcome without reading progress updates or tool output.","- Lead with the result and summarize the meaningful changes or findings. Link relevant deliverables and supporting sources when available, using links the user can open.","- Report what was actually checked and what the evidence establishes when verification matters. Distinguish completed work from anything unfinished, unverified, or still running; never imply that starting an operation confirms its success.","- If genuinely blocked, state what was completed, the blocker, and the specific input or action needed to continue. Continue authorized work until complete or genuinely blocked before giving the wrap-up.","- For code changes, explain what changed and why, reference important files when useful, and report relevant checks and their results. Use Changed Files or Verification sections only when they make the answer easier to read.","- Match the length and structure to the task and respect the user's requested output format. Simple questions and small actions need a direct answer, without a separate recap or fixed headings. Avoid repeating the work log or adding generic next steps.","Do not mention raw tool JSON, internal repo paths, or origin/remote URLs unless the user explicitly asks for them or they are necessary to explain a git/deploy failure."].join(`
|
|
3
|
+
`);import{randomUUID as c}from"node:crypto";import i from"node:path";import{fileURLToPath as p}from"node:url";function u(){return new Date().toISOString()}n(u,"now");function l(e){if(typeof e=="string")return e;if(e instanceof Error)return e.message||e.name;if(e==null)return"";try{return JSON.stringify(e)}catch{return String(e)}}n(l,"textFromUnknown");function k(e){if(!e||typeof e!="object")return"";let t=e;for(let r of["delta","text","output","chunk","message"])if(typeof t[r]=="string")return t[r];return t.delta&&typeof t.delta=="object"?l(t.delta):""}n(k,"extractDelta");function x(e){return{id:c(),timestamp:u(),...e}}n(x,"event");function E(e){let t=e.replace(/^https?:\/\//,""),[r,o]=t.split(":");return{host:r||s,port:o?Number.parseInt(o,10):17874}}n(E,"parseListen");function b(e){return(process.argv[1]?i.resolve(process.argv[1]):"")===i.resolve(p(e))}n(b,"isCliEntrypoint");export{s as a,d as b,h as c,u as d,l as e,k as f,x as g,E as h,b as i};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as F,b as H,d as _}from"./chunk-
|
|
2
|
+
import{a as F,b as H,d as _}from"./chunk-KJFRCVQC.js";import{t as j}from"./chunk-OKBIWRHC.js";import{a as R}from"./chunk-7LZISGTA.js";import{b as P,s as C,t as N,z as x}from"./chunk-XW6HGSIT.js";import{g as U}from"./chunk-FSQWAANK.js";import{r as D}from"./chunk-O4FBOUNX.js";import{b as I,c as T}from"./chunk-YR5ID2SS.js";import{a as n}from"./chunk-FTQLQJQV.js";import{randomUUID as Pt}from"node:crypto";var ot="https://api.openpond.ai";async function K(t){let e=await R(),o=e.token?.trim();if(!o)throw new Error("OpenPond account API key is required to manage organizations.");let r=rt(e);if(t.type==="list")return m(r,o,"/v1/organizations");if(t.type==="invitations_list")return m(r,o,"/v1/teams/invitations");if(t.type==="invitation_accept"||t.type==="invitation_decline"){let i=t.type==="invitation_accept"?"accept":"decline";return m(r,o,`/v1/teams/invitations/${i}`,{method:"POST",body:JSON.stringify(t.payload??{})})}if(t.type==="create")return m(r,o,"/v1/organizations",{method:"POST",body:JSON.stringify(t.payload??{})});if(t.type==="get")return m(r,o,`/v1/organizations/${encodeURIComponent(t.slug)}`);if(t.type==="update")return m(r,o,`/v1/organizations/${encodeURIComponent(t.slug)}`,{method:"PATCH",body:JSON.stringify(t.payload??{})});if(t.type==="members")return m(r,o,`/v1/organizations/${encodeURIComponent(t.slug)}/members`);if(t.type==="member_upsert")return m(r,o,`/v1/organizations/${encodeURIComponent(t.slug)}/members`,{method:"POST",body:JSON.stringify(t.payload??{})});if(t.type==="mcp_get")return m(r,o,`/v1/organizations/${encodeURIComponent(t.slug)}/mcp-server`);if(t.type==="mcp_generate")return m(r,o,`/v1/organizations/${encodeURIComponent(t.slug)}/mcp-server`,{method:"POST",body:JSON.stringify(t.payload??{})});if(t.type==="mcp_rotate")return m(r,o,`/v1/organizations/${encodeURIComponent(t.slug)}/mcp-server/rotate`,{method:"POST"});if(t.type==="mcp_disable")return m(r,o,`/v1/organizations/${encodeURIComponent(t.slug)}/mcp-server/disable`,{method:"POST"});if(t.type==="mcp_enable")return m(r,o,`/v1/organizations/${encodeURIComponent(t.slug)}/mcp-server/enable`,{method:"POST"});throw new Error(`Unsupported organization action: ${t.type}`)}n(K,"organizationRequestPayload");async function m(t,e,o,r={}){let i=await I(t,e,o,r),a=await i.json().catch(()=>({}));if(!i.ok){let l=typeof a.message=="string"?a.message:typeof a.error=="string"?a.error:i.statusText;throw new Error(l)}return a}n(m,"openPondApiRequest");function rt(t){return S(process.env.OPENPOND_API_URL)??S(t.apiBaseUrl)??S(t.account?.apiBaseUrl)??S(t.config.apiBaseUrl)??M(t.account?.baseUrl)??M(t.config.baseUrl)??ot}n(rt,"resolveApiBaseUrl");function M(t){let e=S(t);if(!e)return null;try{let o=new URL(e);if(o.hostname==="openpond.ai")return"https://api.openpond.ai";if(!o.hostname.startsWith("api.")&&o.hostname.endsWith(".openpond.ai"))return o.hostname=`api.${o.hostname}`,o.origin}catch{return e}return e}n(M,"normalizeOpenPondWebBaseAsApi");function S(t){let e=t?.trim();return e?e.replace(/\/$/,""):null}n(S,"normalizeOptionalUrl");import{promises as y}from"node:fs";import nt from"node:os";import g from"node:path";var at=5e3,it=32*1024*1024,st=250*1024*1024;async function J(t){let e=await O(t),o=await z(e.rootPath),r=[];for(let i of e.files)r.push({path:i.path,type:"file",contentsBase64:(await y.readFile(i.absolutePath)).toString("base64")});return{rootPath:e.rootPath,headCommit:o,entries:r,totalBytes:e.totalBytes,skipped:e.skipped}}n(J,"collectLocalProjectSourceUploadBundle");async function Ft(t){let e=await O(t),o=await z(e.rootPath);return{rootPath:e.rootPath,headCommit:o,fileCount:e.files.length,byteCount:e.totalBytes,skippedCount:e.skipped.length,initializedEmptyProject:e.files.length===0,skipped:e.skipped}}n(Ft,"previewLocalProjectSourceUpload");async function W(t,e){let o=pt(e.branch),r=await O(t),i=await z(r.rootPath);if(t.repoPath&&r.files.length>0&&await ut(r.rootPath))try{return await G({cwd:r.rootPath,repoUrl:e.repoUrl,apiKey:e.apiKey,branch:o}),{rootPath:r.rootPath,branch:o,headCommit:i,fileCount:r.files.length,byteCount:r.totalBytes,skipped:r.skipped,initializedEmptyProject:!1,transport:"git_head"}}catch(c){if(!yt(c))throw c}let a=await y.mkdtemp(g.join(nt.tmpdir(),"openpond-cloud-source-")),l=r.files.length===0;try{return l?await y.writeFile(g.join(a,"README.md"),e.fallbackReadme,"utf8"):await mt(r,a),await gt({cwd:a,branch:o,commitMessage:e.commitMessage,repoUrl:e.repoUrl,apiKey:e.apiKey}),await G({cwd:a,repoUrl:e.repoUrl,apiKey:e.apiKey,branch:o}),{rootPath:r.rootPath,branch:o,headCommit:i,fileCount:l?1:r.files.length,byteCount:l?Buffer.byteLength(e.fallbackReadme,"utf8"):r.totalBytes,skipped:r.skipped,initializedEmptyProject:l,transport:"snapshot"}}finally{await y.rm(a,{recursive:!0,force:!0})}}n(W,"pushLocalProjectSourceToGit");async function O(t){let e=t.repoPath??t.workspacePath,o=t.repoPath?await dt(e):await ct(e),r=[],i=[],a=0;for(let l of o){if(r.length>=at){i.push({path:l,reason:"total_limit"});continue}let c=C(l);if(!c){i.push({path:l,reason:"invalid_path"});continue}if(N(c)&&!q(c)){i.push({path:c,reason:"generated"});continue}let d=g.resolve(e,c),u=g.resolve(e);if(d!==u&&!d.startsWith(`${u}${g.sep}`)){i.push({path:c,reason:"invalid_path"});continue}try{let f=await y.lstat(d);if(!f.isFile()){i.push({path:c,reason:"not_file"});continue}if(f.size>it){i.push({path:c,reason:"too_large",sizeBytes:f.size});continue}if(a+f.size>st){i.push({path:c,reason:"total_limit",sizeBytes:f.size});continue}r.push({path:c,absolutePath:d,sizeBytes:f.size}),a+=f.size}catch{i.push({path:c,reason:"read_error"})}}return{rootPath:e,files:r,totalBytes:a,skipped:i}}n(O,"selectLocalProjectSourceFiles");async function ct(t){let e=await x(t),o=await lt(t);return Array.from(new Set([...e,...o])).sort((r,i)=>r.localeCompare(i))}n(ct,"listLocalProjectSourceUploadFiles");async function lt(t){let e=[],o=g.join(t,".openpond","skills");async function r(i){let a=g.join(t,i),l;try{l=await y.readdir(a,{withFileTypes:!0})}catch{return}l.sort((c,d)=>c.name.localeCompare(d.name));for(let c of l){let d=g.join(i,c.name).replace(/\\/g,"/"),u=C(d);if(u){if(c.isDirectory()){await r(u);continue}c.isFile()&&q(u)&&e.push(u)}}}return n(r,"visit"),await r(g.relative(t,o).replace(/\\/g,"/")),e}n(lt,"listGeneratedSkillSourceUploadFiles");function q(t){let e=C(t);if(!e)return!1;let o=e.split("/"),r=o.indexOf(".openpond");return r>=0&&o[r+1]==="skills"&&o.length>r+3}n(q,"isAllowedGeneratedSourceUploadPath");async function dt(t){let e=await P("git",["ls-files","-z","--cached","--others","--exclude-standard"],t);return e.code!==0?x(t):Array.from(new Set(e.stdout.split("\0").map(o=>o.trim()).filter(Boolean))).sort((o,r)=>o.localeCompare(r))}n(dt,"gitVisibleProjectFiles");function pt(t){let e=t.trim()||"main";if(e.length>120||e.startsWith("/")||e.endsWith("/")||e.includes("..")||!/^[A-Za-z0-9._/-]+$/.test(e))throw new Error("Cloud source branch contains unsupported characters.");return e}n(pt,"normalizeGitBranchName");async function ut(t){if((await P("git",["rev-parse","--verify","HEAD"],t)).code!==0)return!1;let o=await P("git",["status","--porcelain=v1"],t);return o.code===0&&o.stdout.trim().length===0}n(ut,"gitRepoHasCleanHead");async function z(t){let e=await P("git",["rev-parse","--verify","HEAD"],t);return e.code===0&&e.stdout.trim()||null}n(z,"readGitHeadCommit");async function mt(t,e){for(let o of t.files){let r=g.resolve(e,o.path),i=g.resolve(e);r!==i&&!r.startsWith(`${i}${g.sep}`)||(await y.mkdir(g.dirname(r),{recursive:!0}),await y.copyFile(o.absolutePath,r))}}n(mt,"copySelectedFilesToSnapshot");async function gt(t){await w(t.cwd,["init"],"Initialize Cloud source snapshot"),await w(t.cwd,["checkout","-B",t.branch],"Create Cloud source branch"),await w(t.cwd,["config","user.name","OpenPond Desktop"],"Configure Git user"),await w(t.cwd,["config","user.email","desktop@openpond.ai"],"Configure Git email"),await ft({cwd:t.cwd,repoUrl:t.repoUrl,apiKey:t.apiKey,branch:t.branch}),await w(t.cwd,["add","-A"],"Stage Cloud source snapshot"),await w(t.cwd,["commit","-m",t.commitMessage],"Commit Cloud source snapshot")}n(gt,"createSnapshotCommit");async function ft(t){let e=`refs/remotes/openpond/${t.branch}`,o=await V(t.cwd,["fetch","--depth=1",t.repoUrl,`refs/heads/${t.branch}:${e}`],t.apiKey);if(o.code!==0){let r=`${o.stderr}
|
|
3
3
|
${o.stdout}`;if(ht(r))return;throw new Error(`Fetch Cloud source parent failed: ${E(o)}`)}await w(t.cwd,["reset","--mixed",e],"Attach Cloud source snapshot to remote branch")}n(ft,"applyRemoteBranchParent");async function G(t){let e=await V(t.cwd,["push",t.repoUrl,`HEAD:${t.branch}`],t.apiKey);if(e.code!==0)throw new Error(`Push Cloud source to OpenPond Git failed: ${E(e)}`)}n(G,"pushGitHead");async function V(t,e,o){let r=Buffer.from(`openpond:${o}`,"utf8").toString("base64");return P("git",["-c",`http.extraHeader=Authorization: Basic ${r}`,...e],t)}n(V,"runGitWithAuth");function yt(t){let e=t instanceof Error?t.message:String(t);return e.includes("non-fast-forward")||e.includes("fetch first")||e.includes("remote contains work that you do not")}n(yt,"isNonFastForwardPushError");function ht(t){return t.includes("couldn't find remote ref")||t.includes("could not find remote ref")||t.includes("Remote branch")&&t.includes("not found")}n(ht,"isMissingRemoteRefOutput");function E(t){return(t.stderr||t.stdout||"Git command failed").trim().replace(/\s+/g," ").slice(0,500)}n(E,"formatGitError");async function w(t,e,o){let r=await P("git",e,t);if(r.code!==0)throw new Error(`${o} failed: ${E(r)}`)}n(w,"runGitOrThrow");var wt=new Set(["github_repo","internal_repo","template","manual"]);function Jt(t,e){return e&&t.status!=="active"?{...t,status:"active"}:t}n(Jt,"codexHistorySessionWithLiveStatus");async function Wt(){try{let t=p(await K({type:"list"})),e=L(t.organizations),o=(e.length>0?e:L(t.teams)).map(bt).filter(a=>!!a?.teamId),r=await Promise.all(o.map(async a=>{try{let l=p(await j({type:"project_list",payload:{teamId:a.teamId}}));return L(l.projects).map(c=>X(c,a)).filter(c=>!!c)}catch{return[]}})),i=new Map;for(let a of r.flat())i.set(`${a.teamId}:${a.id}`,a);return Array.from(i.values()).sort((a,l)=>{let c=Date.parse(a.updatedAt??"")||0,d=Date.parse(l.updatedAt??"")||0;return c!==d?d-c:a.name.localeCompare(l.name)})}catch{return[]}}n(Wt,"fetchCloudProjects");function bt(t){let e=s(t.teamId)??s(t.id);return e?{teamId:e,slug:s(t.slug),displayName:s(t.displayName)??s(t.name)}:null}n(bt,"normalizeOpenPondOrganization");function X(t,e){let o=s(t.id),r=s(t.teamId)??e.teamId;if(!o||!r||s(t.status)==="archived"||s(t.archivedAt))return null;let a=s(t.name)??s(t.slug)??o,l=$(t.sourceType);return{id:o,teamId:r,name:a,slug:s(t.slug),sourceType:l,sourceLabel:Y(t,l),defaultBranch:s(t.defaultBranch)??s(t.gitBranch),internalRepoPath:s(t.internalRepoPath),manifestPath:s(t.sandboxManifestPath),manifestHash:s(t.sandboxManifestHash),syncedAt:s(t.sandboxManifestSyncedAt),organizationName:e.displayName,organizationSlug:e.slug,createdAt:s(t.createdAt),updatedAt:s(t.updatedAt)}}n(X,"normalizeCloudProject");function $(t){return typeof t=="string"&&wt.has(t)?t:"manual"}n($,"normalizeCloudProjectSourceType");function Y(t,e){if(e==="github_repo"){let o=s(t.gitOwner),r=s(t.gitRepo);if(o&&r)return`${o}/${r}`}return e==="internal_repo"?s(t.internalRepoPath)??"Internal repo":e==="template"?s(t.templateRepoUrl)??s(t.templateSourceProjectId)??"Template":s(t.normalizedSourceIdentity)}n(Y,"cloudProjectSourceLabel");function qt(t){return typeof t=="boolean"?t:null}n(qt,"booleanValue");function p(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}n(p,"asRecord");function Vt(t){let e=p(t);return Object.keys(e).length>0?e:null}n(Vt,"nonEmptyRecord");function L(t){return Array.isArray(t)?t.map(p).filter(e=>Object.keys(e).length>0):[]}n(L,"asRecordArray");function s(t){return typeof t=="string"&&t.trim()?t.trim():null}n(s,"stringValue");function Xt(t){if(!t)return null;if(t==="request_only"||t==="coding_core")return t;throw new Error("hostedSourceDispatch must be one of request_only, coding_core.")}n(Xt,"parseHostedSourceDispatch");function jt(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.trim().length>0).map(e=>e.trim()):[]}n(jt,"stringArrayValue");function Yt(t){let e=t.code===0||t.code===null?"completed":"failed",o=t.stdout.trim()||t.stderr.trim()||`Ran profile action ${t.action}.`,r=[],i=[];try{let a=JSON.parse(t.stdout),l=p(a),c=p(l.result),d=s(c.text)??s(c.summary)??s(c.message);d&&(o=d),r=jt(c.artifactRefs);let u=s(l.traceArtifactRef);i=u?[u]:[]}catch{}return{artifactRefs:r,output:o,responseSummary:{status:e==="completed"?"available":"failed",text:o},status:e,traceArtifactRefs:i}}n(Yt,"profileActionRunSummary");function Zt(t){let e=At(t.name),o=t.id.replace(/^local_/,"").replace(/[^a-z0-9]/gi,"").slice(0,16);return`desktop-${e}-${o||"project"}`}n(Zt,"internalRepoPathForLocalProject");function At(t){return t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"project"}n(At,"slugifyInternalRepoSegment");async function Qt(t){try{let e=await W(t.localProject,{repoUrl:t.repoUrl,apiKey:t.apiKey,branch:t.branch,commitMessage:t.commitMessage,fallbackReadme:t.fallbackReadme}),o=p(await j({type:"project_sync",projectId:t.targetProjectId,payload:{teamId:t.teamId}}).catch(()=>({})));return{rootPath:e.rootPath,branch:e.branch,headCommit:e.headCommit,fileCount:e.fileCount,byteCount:e.byteCount,skippedCount:e.skipped.length,initializedEmptyProject:e.initializedEmptyProject,transport:e.transport,syncPayload:o}}catch{let e=await J(t.localProject),o=e.entries.length===0,r=o?[{path:"README.md",type:"file",contentsBase64:Buffer.from(t.fallbackReadme,"utf8").toString("base64")}]:e.entries,i=o?Buffer.byteLength(t.fallbackReadme,"utf8"):e.totalBytes,a=p(await j({type:"project_source_upload",projectId:t.targetProjectId,payload:{teamId:t.teamId,entries:r,branch:t.branch,commitMessage:t.commitMessage,metadata:{source:"openpond-app-local-project-cloud-setup",transport:"api_source_upload"}}}));return{rootPath:e.rootPath,branch:t.branch,headCommit:e.headCommit,fileCount:r.length,byteCount:i,skippedCount:e.skipped.length,initializedEmptyProject:o,transport:"api_source_upload",syncPayload:a}}}n(Qt,"uploadLocalProjectCloudSource");async function te(t){try{let e=p(await j({type:"project_get",projectId:t.projectId,payload:{teamId:t.teamId}})),o=p(e.project);return Object.keys(o).length>0?o:t.fallback}catch{return t.fallback}}n(te,"sandboxProjectRecordOrFallback");async function ee(t){let e=p(await j({type:"project_upsert",payload:{teamId:t.teamId,name:t.projectName,sourceType:"internal_repo",normalizedSourceIdentity:t.internalRepoPath,defaultBranch:t.branch,sourceConfig:{sourceType:"internal_repo",sourceValue:t.internalRepoPath},metadata:{source:"openpond-app-local-project-cloud-setup",localProjectId:t.localProjectId}}})),o=p(e.project);if(Object.keys(o).length===0)throw new Error("OpenPond Cloud Project response did not include a project.");return o}n(ee,"upsertInternalSandboxProject");function oe(t,e,o,r){let i=X({...t,teamId:e},{teamId:e,slug:null,displayName:null});if(i)return i;let a=s(t.id);if(!a)throw new Error("OpenPond Cloud Project response did not include a project id.");return{id:a,teamId:e,name:s(t.name)??o,slug:s(t.slug),sourceType:$(t.sourceType),sourceLabel:Y(t,$(t.sourceType)),defaultBranch:s(t.defaultBranch)??s(t.gitBranch)??r,internalRepoPath:s(t.internalRepoPath),manifestPath:s(t.sandboxManifestPath),manifestHash:s(t.sandboxManifestHash),syncedAt:s(t.sandboxManifestSyncedAt),organizationName:null,organizationSlug:null,createdAt:s(t.createdAt),updatedAt:s(t.updatedAt)}}n(oe,"cloudProjectFromSandboxRecord");function re(t){if(!t)return{};let e=St(t.searchParams.get("limit"));return{...e?{maxEvents:e}:{},tail:t.searchParams.get("tail")==="1"}}n(re,"codexHistoryThreadReadOptions");function ne(t){return`${t}_turn_attachment_${Pt()}`}n(ne,"nextCodexHistoryTurnId");function St(t){if(!t)return;let e=Number.parseInt(t,10);if(!(!Number.isFinite(e)||e<=0))return Math.min(5e4,e)}n(St,"positiveIntegerParam");var It={"tools.web_search":!0,"tools.view_image":!0,"features.web_search_request":!0};function ae(t){return{...It,approvals_reviewer:t==="auto-review"?"auto_review":"user"}}n(ae,"codexHistorySessionConfig");import Z from"node:path";import{promises as Rt}from"node:fs";async function ue(t){let e=await Ct(t.workspacePath);return(await Rt.stat(e).catch(()=>null))?.isDirectory()?(await _({projectRoot:t.workspacePath,build:"always"}).catalog()).actions.map(a=>D.parse({...a,sourcePath:t.workspacePath,implementation:{...a.implementation,projectId:t.id,projectRoot:Z.resolve(t.workspacePath)}})):[]}n(ue,"localProjectActionCatalog");async function Q(t){return _({projectRoot:t.projectRoot,build:"always"}).run({actionId:t.actionId,input:t.value,runId:t.runId,idempotencyKey:t.idempotencyKey,signal:t.signal})}n(Q,"runLocalProjectAction");async function Ct(t){try{let e=await H(t);return Z.resolve(t,e.sourceDirectory??"openpond/actions")}catch(e){throw new Error(`Cannot load ${F}: ${e instanceof Error?e.message:String(e)}`)}}n(Ct,"projectActionSourceDirectory");var kt="https://api.openpond.ai";async function B(t={}){let e=await(t.loadAccountContext??R)(),o=e.token?.trim();if(!o)throw new Error("OpenPond account API key is required.");return{apiBaseUrl:_t(e),token:o}}n(B,"resolveHostedApiAccess");async function ye(t={}){return{...await B(t),teamId:Ut(t.teamId)}}n(ye,"resolveManagedAdapterUserAccess");function he(t){let e=new Headers;return t.startsWith("opk_")?(e.set("Authorization",`ApiKey ${t}`),e.set("openpond-api-key",t)):e.set("Authorization",`Bearer ${t}`),e}n(he,"hostedApiAuthHeaders");function _t(t){return k(t.apiBaseUrl)??k(t.account?.apiBaseUrl)??k(t.config.apiBaseUrl)??tt(t.account?.baseUrl)??tt(t.config.baseUrl)??kt}n(_t,"resolveApiBaseUrl");function Ut(t){let e=t?.trim();if(!e||!/^[A-Za-z0-9_-]{3,191}$/.test(e))throw new Error("Select an OpenPond workspace before using OpenPond Managed RL.");return e}n(Ut,"managedAdapterTeamId");function tt(t){let e=k(t);if(!e)return null;try{let o=new URL(e);if(o.hostname==="openpond.ai")return"https://api.openpond.ai";if(!o.hostname.startsWith("api.")&&o.hostname.endsWith(".openpond.ai"))return o.hostname=`api.${o.hostname}`,o.origin}catch{return e}return e}n(tt,"normalizeOpenPondWebBaseAsApi");function k(t){let e=t?.trim();return e?e.replace(/\/$/,""):null}n(k,"normalizeOptionalUrl");async function et(t,e={}){let o=await(e.resolveAccess??B)(),r=await(e.fetch??I)(o.apiBaseUrl,o.token,`/v1/project-actions/${encodeURIComponent(t.projectId)}/actions/${encodeURIComponent(t.actionId)}?teamId=${encodeURIComponent(t.teamId)}`,{method:"POST",body:JSON.stringify({input:t.value,releaseId:t.releaseId,idempotencyKey:t.idempotencyKey,callerType:"work",callerId:t.callerId}),signal:t.signal,timeoutMs:900*1e3}),i=await T(r,"Run hosted Project Action");if(i.invocation.status==="failed")throw new Error(i.invocation.failureMessage||i.invocation.failureCode||"Hosted Project Action failed.");return i.invocation}n(et,"runHostedProjectAction");function _e(t){return n(async function(o){let r=p(o),i=s(r.action)??s(r.actionName);if(!i)throw new Error("Project Action name is required.");let a=p(r.metadata);if(s(a.execution)==="hosted"){let b=await et({projectId:A(a,"projectId"),teamId:A(a,"teamId"),releaseId:A(a,"releaseId"),actionId:i,value:r.input??{},idempotencyKey:s(a.toolCallId)?`${A(a,"turnId")}:${A(a,"toolCallId")}`:void 0,callerId:s(a.turnId)??void 0}),v=s(a.sessionId);return v&&await t.appendRuntimeEvent(U({name:"workspace_action_result",sessionId:v,turnId:A(a,"turnId"),source:"chat_action",action:"project_action_run",appId:null,status:"completed",output:JSON.stringify(b.resultJson),data:{openPondHostedProjectActionRun:!0,action:{name:i,label:s(a.selectedActionLabel)??i},releaseId:b.releaseId,invocationId:b.id,traces:b.traceJson,outputs:b.outputJson}})),b}let l=s(a.projectId);if(!l)throw new Error("Project Action Project id is required.");let c=await t.resolveProjectRoot(l);if(!c)throw new Error("Project Action Project is not registered locally.");let d=s(a.sessionId),u=s(a.turnId)??`openpond_project_action_${Date.now()}`,f=s(a.toolCallId),h=await Q({projectRoot:c,actionId:i,value:r.input??{},runId:f??void 0,idempotencyKey:f?`${u}:${f}`:null});return d&&await t.appendRuntimeEvent(U({name:"workspace_action_result",sessionId:d,turnId:u,source:"chat_action",action:"project_action_run",appId:null,status:"completed",output:JSON.stringify(h.output),data:{openPondProjectActionRun:!0,action:{name:i,label:s(a.selectedActionLabel)??i},runId:h.runId,traces:h.traces,outputs:h.outputs,outputDirectory:h.outputDirectory,durationMs:h.durationMs}})),h},"projectActionRunPayload")}n(_e,"createProjectActionRunPayload");function A(t,e){let o=s(t[e]);if(!o)throw new Error(`Hosted Project Action ${e} is required.`);return o}n(A,"requiredMetadata");export{K as a,Ft as b,Jt as c,Wt as d,qt as e,p as f,Vt as g,s as h,Xt as i,Yt as j,Zt as k,Qt as l,te as m,ee as n,oe as o,re as p,ne as q,ae as r,ue as s,B as t,ye as u,he as v,_e as w};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as me,b as D,c as G,d as j,e as z,g as ye,i as T,j as we,k as S,l as he,v as B,x as F}from"./chunk-RAXOSUSW.js";import{a as re,b as L,c as R}from"./chunk-DARVPBZ4.js";import{a as Z,b as ee,c as te}from"./chunk-FV2R5RUN.js";import{b as H,c as be,d as ve,f as w,h as P,i as Re}from"./chunk-BSHAIAXY.js";import{a as M,f as v,k as X}from"./chunk-3M53YXEI.js";import{M as pe,N as ue,R as ge,V as fe,h as $,i as ie,l as ae,n as se,o as ce,p as le,q as de}from"./chunk-5MCNZCVQ.js";import{d as y,e as ne,f as oe,g as C}from"./chunk-OS3LO5J3.js";import{a as g}from"./chunk-FTQLQJQV.js";import{promises as V,existsSync as W}from"node:fs";import U from"node:path";import{stdin as $e}from"node:process";async function Ge(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ce(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(Ge,"runTemplateStatus");async function je(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await le(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(je,"runTemplateBranches");async function ze(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,f=X(s),c=await de(n,i,a.id,{environment:f});console.log(JSON.stringify(c,null,2))}g(ze,"runTemplateUpdate");async function He(e){let o=await y(),t=w(o),r=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,n=r?r.trim():await L();if(!n)throw new Error("API key is required");n.startsWith("opk_")||console.log("warning: API keys usually start with opk_."),await C({handle:o.activeProfile?.handle||"default",apiKey:n,baseUrl:t,apiBaseUrl:o.apiBaseUrl,chatApiBaseUrl:o.chatApiBaseUrl,setActive:!0}),console.log("Saved account credentials to the encrypted OpenPond credential store.")}g(He,"runLogin");async function Fe(e,o){let t=o[0]||"list";if(t==="list"){let r=await ne();console.log(JSON.stringify({profiles:r},null,2));return}if(t==="use"){let r=o[1];if(!r)throw new Error("usage: profiles use <name> [--base-url <url>]");let n=await oe(r,{baseUrl:H(e)});console.log(JSON.stringify({profile:n},null,2));return}if(t==="save"){let r=o[1];if(!r)throw new Error("usage: profiles save <name> --api-key <key> [--base-url <url>] [--api-base-url <url>] [--chat-api-base-url <url>]");let n=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,i=n?n.trim():await L(),a=typeof e.environment=="string"?e.environment:typeof e.env=="string"?e.env:void 0,s=await C({handle:r,apiKey:i,baseUrl:H(e),apiBaseUrl:be(e),chatApiBaseUrl:ve(e),environment:a,setActive:!0});console.log(JSON.stringify({profile:s},null,2));return}throw new Error("usage: profiles <list|use|save> [args]")}g(Fe,"runProfiles");async function Ve(){let e=await y(),o=w(e),t=P(e),r=await R(e,o),n=await pe(t,r);console.log(JSON.stringify(n,null,2))}g(Ve,"runAccount");async function We(e){let o=await y(),t=P(o),r=re(o),n=await ue(t,r);console.log(JSON.stringify(n,null,2))}g(We,"runHealth");async function qe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.branch=="string"?String(e.branch):void 0,f=await $(n,i,a.id,{branch:s});if(!f?.id){console.log("no deployments found");return}let c=await ie(n,i,f.id),d=(c&&Array.isArray(c.toolsJson)?c.toolsJson:null)||(c&&typeof c.metadataJson=="object"&&c.metadataJson?c.metadataJson.tools:null),u=Array.isArray(d)?d:[];if(u.length===0){console.log("no tools found");return}for(let l of u){let m=l,h=m.profile||m.function,I=m.name||h?.name||"unknown",p=m.description||h?.description||"";console.log(p?`${I} - ${p}`:I)}}g(qe,"runToolList");async function Ye(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=await $(i,a,s.id,{branch:f});if(!c?.id)throw new Error("no deployments found");let d;if(typeof e.body=="string")try{d=JSON.parse(e.body)}catch{throw new Error("tool body must be valid JSON")}let u=typeof e.method=="string"?String(e.method).toUpperCase():"POST",l=await fe(n,a,{appId:s.id,deploymentId:c.id,toolName:t,method:u,body:d,headers:a?{"openpond-api-key":a}:void 0});if(!l.ok)throw new Error(l.error||`tool failed (${l.status})`);let m=l.data??{ok:!0};console.log(JSON.stringify(m,null,2))}g(Ye,"runToolRun");async function Qe(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,d=c?{id:c}:await $(i,a,s.id,{branch:f});if(!d?.id)throw new Error("no deployments found");let u=typeof e.body=="string"?M(String(e.body),"body"):{};if(!u||typeof u!="object"||Array.isArray(u))throw new Error("body must be a JSON object");let l=typeof e.method=="string"?String(e.method).toUpperCase():"POST",m={...u,appId:s.id,deploymentId:d.id,toolName:t,method:l},h=await ge(i,a,m);console.log(JSON.stringify(h,null,2))}g(Qe,"runBacktestRun");async function Xe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a,handle:s,repo:f}=await T(n,i,o),c=typeof e.branch=="string"?String(e.branch):void 0,d=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,u=d?{id:d}:await $(n,i,a.id,{branch:c});if(!u?.id){console.log("no deployments found");return}await we({baseUrl:n,apiKey:i,deploymentId:u.id,prefix:`[${s}/${f}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}g(Xe,"runDeployWatch");async function Ze(e,o){let r=((typeof e.name=="string"?e.name:null)||o.join(" ")).trim();if(!r)throw new Error("usage: repo create --name <name> [--team-id <id>] [--path <dir>] [--template <owner/repo|url>] [--template-branch <branch>] [--empty|--opentool] [--sandbox] [--token] [--auto-schedule-migration <true|false>]");let n=await y(),i=w(n),a=await R(n,i),s=P(n),f=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0,c=typeof e.template=="string"?e.template.trim():"";if(c&&(e.empty==="true"||e.opentool==="true"))throw new Error("choose one: --template or --empty/--opentool");if(e.empty==="true"&&e.opentool==="true")throw new Error("choose one: --empty or --opentool");let d=typeof e.description=="string"?e.description.trim():void 0,u=typeof e.templateBranch=="string"&&e.templateBranch.trim().length>0?e.templateBranch.trim():void 0,l=typeof e.env=="string"?M(e.env,"env"):void 0;if(l){if(typeof l!="object"||Array.isArray(l))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(l))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}if(c){e.deployOnPush!==void 0&&console.warn("deploy-on-push is not used for template create (auto deploys)");let b=Re(c,i),k=(await se(s,a,[{name:r,...d?{description:d}:{},templateRepoUrl:b,...u?{templateBranch:u}:{},...l?{envVars:l}:{}}],f)).items?.[0];if(!k||k.status!=="ok"||!k.appId)throw new Error(k?.error||"Template create failed");console.log(`app_id: ${k.appId}`),k.deploymentId&&console.log(`deployment_id: ${k.deploymentId}`),k.conversationId&&console.log(`conversation_id: ${k.conversationId}`);return}let m=process.cwd(),h=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,I=h&&h.trim().length>0?h.trim():$e.isTTY?await he(m):m,p=U.resolve(I);if(W(p)){if(!(await V.stat(p)).isDirectory())throw new Error(`path is not a directory: ${p}`)}else await V.mkdir(p,{recursive:!0});let Pe=(await V.readdir(p)).filter(b=>b!==".git").length===0,x=v(e.yes)||v(e.force);if(!Pe&&!x&&!await S(`Directory is not empty (${p}). Continue?`,!1)){console.log("aborted");return}let ke=U.join(p,".git");if(!W(ke)){if(!(x?!0:await S("Initialize git repository here?",!0))){console.log("aborted");return}let A=await B("git",["init"],{cwd:p});if(A.code!==0)throw new Error(`git init failed: ${A.stderr.trim()||A.stdout.trim()||"unknown error"}`)}let K=await F(p,"origin");if(K&&!x&&!await S(`Remote "origin" already set (${K}). Replace it?`,!1)){console.log("aborted");return}let q=e.opentool==="true"?"opentool":"empty",Te=v(e.sandbox),Be=v(e.deployOnPush),N=e.autoScheduleMigration,Y=typeof N=="string"||typeof N=="boolean",Ee=Y?v(N):void 0,E=await ae(s,a,{name:r,...f?{teamId:f}:{},...d?{description:d}:{},...q?{repoInit:q}:{},...Te?{sandbox:!0}:{},...l?{envVars:l}:{},...Be?{deployOnPush:!0}:{},...Y?{autoScheduleMigration:Ee}:{}}),O=me(E);z(O);let J=v(e.token)||v(e.setRemoteToken),Oe=D(O,a),Q=J?Oe:O,_=await B("git",K?["remote","set-url","origin",Q]:["remote","add","origin",Q],{cwd:p});if(_.code!==0)throw new Error(`git remote failed: ${j(_.stderr.trim()||_.stdout.trim()||"unknown error")}`);let Ae=J?G(O):O;console.log(`app_id: ${E.appId}`),E.gitOwner&&E.gitRepo&&console.log(`repo: ${E.gitOwner}/${E.gitRepo}`),console.log(`remote: ${Ae}`),console.log('next: git add . && git commit -m "init"');let Ie=E.defaultBranch||"master";console.log(`next: openpond repo push --path ${p} --branch ${Ie}`),J||console.log(`token-remote (non-interactive): git -C ${p} remote set-url origin ${G(O)}`);try{await ye({apiBase:s,apiKey:a,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}g(Ze,"runRepoCreate");async function Se(e){let o=await B("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e});if(o.code!==0)return null;let t=o.stdout.trim();return t.length>0?t:null}g(Se,"resolveGitBranch");async function et(e){let o=await y(),t=w(o),r=await R(o,t),n=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,i=U.resolve(n&&n.trim().length>0?n.trim():"."),a=U.join(i,".git");if(!W(a))throw new Error(`git repo not found at ${i} (missing .git)`);let s=await F(i,"origin");if(!s)throw new Error("origin remote not set; run `openpond repo create` first");z(s);let c=(typeof e.branch=="string"?e.branch.trim():"")||await Se(i);if(!c)throw new Error("unable to resolve git branch; pass --branch");let d;try{d=D(s,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let u=v(e.keepTokenRemote)||v(e.token)||v(e.setRemoteToken),l=s.includes("x-access-token:"),m=!u&&!l?s:null,h=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!l){let p=await B("git",["remote","set-url","origin",d],{cwd:i});if(p.code!==0)throw new Error(`git remote set-url failed: ${j(p.stderr.trim()||p.stdout.trim()||"unknown error")}`)}if((await B("git",["push","-u","origin",c],{cwd:i,inherit:!0})).code!==0)throw new Error("git push failed")}finally{m&&await B("git",["remote","set-url","origin",m],{cwd:i}).catch(()=>null),h===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=h}}g(et,"runRepoPush");async function tt(e){if(e.length===0)throw new Error("usage: opentool <init|validate|build> [args]");let o=process.platform==="win32"?"npx.cmd":"npx";if((await B(o,["opentool",...e],{inherit:!0})).code!==0)throw new Error("opentool command failed")}g(tt,"runOpentool");async function nt(){let e="openpond",o=Z(),t=await te(e),r=`npm i -g ${e}@${t}`,n=ee(o,t);if(n===0){console.log(`${e} is up to date (${o})`);return}if(n===-1){console.log(`Update available: ${o} -> ${t}`),console.log(`Run: ${r}`);return}if(n===1){console.log(`Installed version (${o}) is newer than npm latest (${t}).`);return}if(o===t){console.log(`${e} is up to date (${o})`);return}console.log(`Installed: ${o}`),console.log(`Latest: ${t}`),console.log(`Run: ${r}`)}g(nt,"runCheckUpdate");export{Ge as a,je as b,ze as c,He as d,Fe as e,Ve as f,We as g,qe as h,Ye as i,Qe as j,Xe as k,Ze as l,Se as m,et as n,tt as o,nt as p};
|
|
2
|
+
import{a as me,b as D,c as G,d as j,e as z,g as ye,i as T,j as we,k as S,l as he,v as B,x as F}from"./chunk-ISFIDCIH.js";import{a as re,b as L,c as R}from"./chunk-23P2O7PH.js";import{a as Z,b as ee,c as te}from"./chunk-XRKFTPHD.js";import{b as H,c as be,d as ve,f as w,h as P,i as Re}from"./chunk-BSHAIAXY.js";import{a as M,f as v,k as X}from"./chunk-3M53YXEI.js";import{M as pe,N as ue,R as ge,V as fe,h as $,i as ie,l as ae,n as se,o as ce,p as le,q as de}from"./chunk-EL454L26.js";import{d as y,e as ne,f as oe,g as C}from"./chunk-ENSB6ZTM.js";import{a as g}from"./chunk-FTQLQJQV.js";import{promises as V,existsSync as W}from"node:fs";import U from"node:path";import{stdin as $e}from"node:process";async function Ge(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ce(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(Ge,"runTemplateStatus");async function je(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await le(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(je,"runTemplateBranches");async function ze(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,f=X(s),c=await de(n,i,a.id,{environment:f});console.log(JSON.stringify(c,null,2))}g(ze,"runTemplateUpdate");async function He(e){let o=await y(),t=w(o),r=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,n=r?r.trim():await L();if(!n)throw new Error("API key is required");n.startsWith("opk_")||console.log("warning: API keys usually start with opk_."),await C({handle:o.activeProfile?.handle||"default",apiKey:n,baseUrl:t,apiBaseUrl:o.apiBaseUrl,chatApiBaseUrl:o.chatApiBaseUrl,setActive:!0}),console.log("Saved account credentials to the encrypted OpenPond credential store.")}g(He,"runLogin");async function Fe(e,o){let t=o[0]||"list";if(t==="list"){let r=await ne();console.log(JSON.stringify({profiles:r},null,2));return}if(t==="use"){let r=o[1];if(!r)throw new Error("usage: profiles use <name> [--base-url <url>]");let n=await oe(r,{baseUrl:H(e)});console.log(JSON.stringify({profile:n},null,2));return}if(t==="save"){let r=o[1];if(!r)throw new Error("usage: profiles save <name> --api-key <key> [--base-url <url>] [--api-base-url <url>] [--chat-api-base-url <url>]");let n=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,i=n?n.trim():await L(),a=typeof e.environment=="string"?e.environment:typeof e.env=="string"?e.env:void 0,s=await C({handle:r,apiKey:i,baseUrl:H(e),apiBaseUrl:be(e),chatApiBaseUrl:ve(e),environment:a,setActive:!0});console.log(JSON.stringify({profile:s},null,2));return}throw new Error("usage: profiles <list|use|save> [args]")}g(Fe,"runProfiles");async function Ve(){let e=await y(),o=w(e),t=P(e),r=await R(e,o),n=await pe(t,r);console.log(JSON.stringify(n,null,2))}g(Ve,"runAccount");async function We(e){let o=await y(),t=P(o),r=re(o),n=await ue(t,r);console.log(JSON.stringify(n,null,2))}g(We,"runHealth");async function qe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.branch=="string"?String(e.branch):void 0,f=await $(n,i,a.id,{branch:s});if(!f?.id){console.log("no deployments found");return}let c=await ie(n,i,f.id),d=(c&&Array.isArray(c.toolsJson)?c.toolsJson:null)||(c&&typeof c.metadataJson=="object"&&c.metadataJson?c.metadataJson.tools:null),u=Array.isArray(d)?d:[];if(u.length===0){console.log("no tools found");return}for(let l of u){let m=l,h=m.profile||m.function,I=m.name||h?.name||"unknown",p=m.description||h?.description||"";console.log(p?`${I} - ${p}`:I)}}g(qe,"runToolList");async function Ye(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=await $(i,a,s.id,{branch:f});if(!c?.id)throw new Error("no deployments found");let d;if(typeof e.body=="string")try{d=JSON.parse(e.body)}catch{throw new Error("tool body must be valid JSON")}let u=typeof e.method=="string"?String(e.method).toUpperCase():"POST",l=await fe(n,a,{appId:s.id,deploymentId:c.id,toolName:t,method:u,body:d,headers:a?{"openpond-api-key":a}:void 0});if(!l.ok)throw new Error(l.error||`tool failed (${l.status})`);let m=l.data??{ok:!0};console.log(JSON.stringify(m,null,2))}g(Ye,"runToolRun");async function Qe(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,d=c?{id:c}:await $(i,a,s.id,{branch:f});if(!d?.id)throw new Error("no deployments found");let u=typeof e.body=="string"?M(String(e.body),"body"):{};if(!u||typeof u!="object"||Array.isArray(u))throw new Error("body must be a JSON object");let l=typeof e.method=="string"?String(e.method).toUpperCase():"POST",m={...u,appId:s.id,deploymentId:d.id,toolName:t,method:l},h=await ge(i,a,m);console.log(JSON.stringify(h,null,2))}g(Qe,"runBacktestRun");async function Xe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a,handle:s,repo:f}=await T(n,i,o),c=typeof e.branch=="string"?String(e.branch):void 0,d=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,u=d?{id:d}:await $(n,i,a.id,{branch:c});if(!u?.id){console.log("no deployments found");return}await we({baseUrl:n,apiKey:i,deploymentId:u.id,prefix:`[${s}/${f}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}g(Xe,"runDeployWatch");async function Ze(e,o){let r=((typeof e.name=="string"?e.name:null)||o.join(" ")).trim();if(!r)throw new Error("usage: repo create --name <name> [--team-id <id>] [--path <dir>] [--template <owner/repo|url>] [--template-branch <branch>] [--empty|--opentool] [--sandbox] [--token] [--auto-schedule-migration <true|false>]");let n=await y(),i=w(n),a=await R(n,i),s=P(n),f=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0,c=typeof e.template=="string"?e.template.trim():"";if(c&&(e.empty==="true"||e.opentool==="true"))throw new Error("choose one: --template or --empty/--opentool");if(e.empty==="true"&&e.opentool==="true")throw new Error("choose one: --empty or --opentool");let d=typeof e.description=="string"?e.description.trim():void 0,u=typeof e.templateBranch=="string"&&e.templateBranch.trim().length>0?e.templateBranch.trim():void 0,l=typeof e.env=="string"?M(e.env,"env"):void 0;if(l){if(typeof l!="object"||Array.isArray(l))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(l))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}if(c){e.deployOnPush!==void 0&&console.warn("deploy-on-push is not used for template create (auto deploys)");let b=Re(c,i),k=(await se(s,a,[{name:r,...d?{description:d}:{},templateRepoUrl:b,...u?{templateBranch:u}:{},...l?{envVars:l}:{}}],f)).items?.[0];if(!k||k.status!=="ok"||!k.appId)throw new Error(k?.error||"Template create failed");console.log(`app_id: ${k.appId}`),k.deploymentId&&console.log(`deployment_id: ${k.deploymentId}`),k.conversationId&&console.log(`conversation_id: ${k.conversationId}`);return}let m=process.cwd(),h=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,I=h&&h.trim().length>0?h.trim():$e.isTTY?await he(m):m,p=U.resolve(I);if(W(p)){if(!(await V.stat(p)).isDirectory())throw new Error(`path is not a directory: ${p}`)}else await V.mkdir(p,{recursive:!0});let Pe=(await V.readdir(p)).filter(b=>b!==".git").length===0,x=v(e.yes)||v(e.force);if(!Pe&&!x&&!await S(`Directory is not empty (${p}). Continue?`,!1)){console.log("aborted");return}let ke=U.join(p,".git");if(!W(ke)){if(!(x?!0:await S("Initialize git repository here?",!0))){console.log("aborted");return}let A=await B("git",["init"],{cwd:p});if(A.code!==0)throw new Error(`git init failed: ${A.stderr.trim()||A.stdout.trim()||"unknown error"}`)}let K=await F(p,"origin");if(K&&!x&&!await S(`Remote "origin" already set (${K}). Replace it?`,!1)){console.log("aborted");return}let q=e.opentool==="true"?"opentool":"empty",Te=v(e.sandbox),Be=v(e.deployOnPush),N=e.autoScheduleMigration,Y=typeof N=="string"||typeof N=="boolean",Ee=Y?v(N):void 0,E=await ae(s,a,{name:r,...f?{teamId:f}:{},...d?{description:d}:{},...q?{repoInit:q}:{},...Te?{sandbox:!0}:{},...l?{envVars:l}:{},...Be?{deployOnPush:!0}:{},...Y?{autoScheduleMigration:Ee}:{}}),O=me(E);z(O);let J=v(e.token)||v(e.setRemoteToken),Oe=D(O,a),Q=J?Oe:O,_=await B("git",K?["remote","set-url","origin",Q]:["remote","add","origin",Q],{cwd:p});if(_.code!==0)throw new Error(`git remote failed: ${j(_.stderr.trim()||_.stdout.trim()||"unknown error")}`);let Ae=J?G(O):O;console.log(`app_id: ${E.appId}`),E.gitOwner&&E.gitRepo&&console.log(`repo: ${E.gitOwner}/${E.gitRepo}`),console.log(`remote: ${Ae}`),console.log('next: git add . && git commit -m "init"');let Ie=E.defaultBranch||"master";console.log(`next: openpond repo push --path ${p} --branch ${Ie}`),J||console.log(`token-remote (non-interactive): git -C ${p} remote set-url origin ${G(O)}`);try{await ye({apiBase:s,apiKey:a,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}g(Ze,"runRepoCreate");async function Se(e){let o=await B("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e});if(o.code!==0)return null;let t=o.stdout.trim();return t.length>0?t:null}g(Se,"resolveGitBranch");async function et(e){let o=await y(),t=w(o),r=await R(o,t),n=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,i=U.resolve(n&&n.trim().length>0?n.trim():"."),a=U.join(i,".git");if(!W(a))throw new Error(`git repo not found at ${i} (missing .git)`);let s=await F(i,"origin");if(!s)throw new Error("origin remote not set; run `openpond repo create` first");z(s);let c=(typeof e.branch=="string"?e.branch.trim():"")||await Se(i);if(!c)throw new Error("unable to resolve git branch; pass --branch");let d;try{d=D(s,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let u=v(e.keepTokenRemote)||v(e.token)||v(e.setRemoteToken),l=s.includes("x-access-token:"),m=!u&&!l?s:null,h=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!l){let p=await B("git",["remote","set-url","origin",d],{cwd:i});if(p.code!==0)throw new Error(`git remote set-url failed: ${j(p.stderr.trim()||p.stdout.trim()||"unknown error")}`)}if((await B("git",["push","-u","origin",c],{cwd:i,inherit:!0})).code!==0)throw new Error("git push failed")}finally{m&&await B("git",["remote","set-url","origin",m],{cwd:i}).catch(()=>null),h===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=h}}g(et,"runRepoPush");async function tt(e){if(e.length===0)throw new Error("usage: opentool <init|validate|build> [args]");let o=process.platform==="win32"?"npx.cmd":"npx";if((await B(o,["opentool",...e],{inherit:!0})).code!==0)throw new Error("opentool command failed")}g(tt,"runOpentool");async function nt(){let e="openpond",o=Z(),t=await te(e),r=`npm i -g ${e}@${t}`,n=ee(o,t);if(n===0){console.log(`${e} is up to date (${o})`);return}if(n===-1){console.log(`Update available: ${o} -> ${t}`),console.log(`Run: ${r}`);return}if(n===1){console.log(`Installed version (${o}) is newer than npm latest (${t}).`);return}if(o===t){console.log(`${e} is up to date (${o})`);return}console.log(`Installed: ${o}`),console.log(`Latest: ${t}`),console.log(`Run: ${r}`)}g(nt,"runCheckUpdate");export{Ge as a,je as b,ze as c,He as d,Fe as e,Ve as f,We as g,qe as h,Ye as i,Qe as j,Xe as k,Ze as l,Se as m,et as n,tt as o,nt as p};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as E,c as g}from"./chunk-
|
|
2
|
+
import{a as E,c as g}from"./chunk-TOFMA2L5.js";import{e as v}from"./chunk-OWK7HU5I.js";import{l as C}from"./chunk-RCA6NGVA.js";import{m as h}from"./chunk-BIPQCJ5V.js";import{A as p}from"./chunk-PF56N7ZY.js";import{a as d}from"./chunk-FTQLQJQV.js";function _(n){let i=new Map;async function f(e){C(e,8388608);let o=v.parse(e);if(o.kind==="profile")return n.executeProfile(o.request);let s=h(o),l=i.get(o.id);if(l){if(l.hash!==s)throw new Error("Experiment case operation already owns different admitted inputs.");return l.result}if(i.size>=100)throw new Error("Experiment case execution capacity reached.");let c=new AbortController,a=x(o,c.signal);i.set(o.id,{hash:s,controller:c,result:a});try{return await a}finally{i.delete(o.id)}}d(f,"execute");async function x(e,o){let s=AbortSignal.any([o,AbortSignal.timeout(e.timeoutMs)]);if(s.throwIfAborted(),e.harness){if(!n.executeHarness||e.environment.kind!=="text")throw new Error("The selected standalone Harness has no compatible native Experiment adapter.");return n.executeHarness(e,s)}let l=await n.resolvePolicy(e);if(s.throwIfAborted(),e.environment.kind==="javascript"){let r=n.resolveEnvironment?await n.resolveEnvironment(e):g;return E({taskId:e.taskId,instructions:`${e.instructions}
|
|
3
3
|
${JSON.stringify({policyVisibleContext:e.policyVisibleContext})}`,input:e.input,definition:e.environment.definition,asset:e.environment.asset,initialState:e.environment.initialState,seed:e.environment.seed,timeoutMs:e.timeoutMs,execute:r,policy:l,signal:s})}let c=[{role:"system",text:e.instructions},{role:"user",text:JSON.stringify({input:e.input,policyVisibleContext:e.policyVisibleContext})}],a=null,u=null,m="completed";try{let r=await l({messages:c,tools:[],signal:s});if(s.throwIfAborted(),r.toolCalls.length)throw new Error("Text cases do not support tool calls.");a=r.text,c.push({role:"assistant",text:r.text,toolCalls:[]})}catch(r){u=r instanceof Error?r.message:"Experiment policy failed.",m=o.aborted?"cancelled":s.aborted?"timed_out":"policy_failure"}let t={schemaVersion:"openpond.javascriptEnvironmentAttempt.v1",taskId:e.taskId,status:m,output:a,error:u,messages:c,collected:m==="completed",environmentCleanupComplete:!0,snapshot:null};return{...t,contentHash:h(t)}}return d(x,"run"),{execute:f,cancel(e){let o=i.get(e);return o?.controller.abort(new Error("experiment_case_cancelled")),{id:e,cancelled:!!o}},async close(){for(let e of i.values())e.controller.abort(new Error("experiment_runtime_closed"));await Promise.allSettled([...i.values()].map(e=>e.result))}}}d(_,"createExperimentCaseService");function A(n){let i=0,f=new Map;return async({messages:x,tools:e,signal:o})=>{let s=`experiment:${n.request.id}:${i++}`,l=0,c=x.map(t=>{if(t.role==="tool")return{role:"tool",tool_call_id:t.callId,name:t.name,content:JSON.stringify(t.observation)};if(t.role==="assistant"){let r=f.get(l++);return{role:"assistant",content:t.text,...r?{continuation:r}:{},...t.toolCalls.length?{tool_calls:t.toolCalls.map(y=>({id:y.id,type:"function",function:{name:y.name,arguments:JSON.stringify(y.arguments)}}))}:{}}}return{role:t.role,content:t.text}}),a="",u=[],m;for await(let t of n.stream({model:n.request.model.modelId,messages:[...n.request.model.messages,...c],tools:e.map(r=>({type:"function",function:{name:r.name,description:r.description,parameters:r.inputSchema}})),requestId:s,maxTokens:n.request.model.maxOutputTokens,temperature:n.request.model.temperature,topP:n.request.model.topP,signal:o})){if(o.throwIfAborted(),t.type==="text_delta"&&(a+=t.text,a.length>262144))throw new Error("Experiment policy response exceeded its retained-output limit.");if(t.type==="tool_call_delta"&&(u=t.toolCalls,u.length>200))throw new Error("Experiment policy response exceeded its tool-call limit.");t.type==="continuation"&&(m=t.continuation),t.type==="usage"&&await n.onUsage?.({requestId:s,usage:t.usage})}return m&&f.set(i-1,m),{text:a,toolCalls:u.map(t=>({id:p.string().min(1).parse(t.id),name:p.string().min(1).parse(t.function?.name),arguments:p.record(p.string(),p.unknown()).parse(JSON.parse(p.string().parse(t.function?.arguments)))}))}}}d(A,"createLocalExperimentPolicy");export{_ as a,A as b};
|