openpond 0.2.54 → 0.2.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-server.d.ts +10823 -9118
- package/dist/app-server.js +1 -1
- package/dist/chunks/actions-command-QU4H53OG.js +2 -0
- package/dist/chunks/{app-layer-I7MZYVLL.js → app-layer-NSTE5HIT.js} +1 -1
- package/dist/chunks/app-server-connected-apps-JHGWLBXT.js +2 -0
- package/dist/chunks/app-server-evaluations-GJPFWIDA.js +2 -0
- package/dist/chunks/app-server-harness-services-IH4G6POY.js +2 -0
- package/dist/chunks/app-server-runtime-DVKOZ5B6.js +2 -0
- package/dist/chunks/apps-BKTOR4F7.js +2 -0
- package/dist/chunks/chunk-25MBPJVY.js +2 -0
- package/dist/chunks/chunk-2D4Y3HNW.js +2 -0
- package/dist/chunks/chunk-2IHO4GDJ.js +2 -0
- package/dist/chunks/chunk-2QUCCP6Z.js +2 -0
- package/dist/chunks/chunk-3K4VVB7S.js +6 -0
- package/dist/chunks/chunk-3QIB5FXI.js +10 -0
- package/dist/chunks/chunk-3RCRSMWZ.js +17 -0
- package/dist/chunks/chunk-3VUATFZD.js +2 -0
- package/dist/chunks/chunk-3Z47M3YY.js +2 -0
- package/dist/chunks/{chunk-GXSTZBM6.js → chunk-4D7HWVWD.js} +1 -1
- package/dist/chunks/chunk-4EPSHPZL.js +2 -0
- package/dist/chunks/chunk-4NESNOK5.js +2 -0
- package/dist/chunks/chunk-523TE4BI.js +2 -0
- package/dist/chunks/chunk-5MCNZCVQ.js +2 -0
- package/dist/chunks/chunk-6QSSIT62.js +2 -0
- package/dist/chunks/chunk-6ZFPQYHG.js +2 -0
- package/dist/chunks/chunk-74IIXVAE.js +2 -0
- package/dist/chunks/chunk-74ZXXBGN.js +6 -0
- package/dist/chunks/chunk-773TH7FN.js +2 -0
- package/dist/chunks/chunk-7E6T7GP5.js +2 -0
- package/dist/chunks/chunk-7ED24PP6.js +2 -0
- package/dist/chunks/chunk-7HPDGZOR.js +86 -0
- package/dist/chunks/chunk-7KWD2I6W.js +2 -0
- package/dist/chunks/chunk-7PXZ4X4P.js +2 -0
- package/dist/chunks/chunk-A6USMRWK.js +2 -0
- package/dist/chunks/chunk-ABD5M2D2.js +2 -0
- package/dist/chunks/chunk-ACYFMLWG.js +10 -0
- package/dist/chunks/chunk-AN525SPP.js +6 -0
- package/dist/chunks/chunk-APB2STJK.js +2 -0
- package/dist/chunks/chunk-AY64VY4E.js +2 -0
- package/dist/chunks/{chunk-UJ5EFSEC.js → chunk-B7RFL4N2.js} +1 -1
- package/dist/chunks/chunk-BFKYRQMA.js +2 -0
- package/dist/chunks/chunk-BLXEAZCQ.js +12 -0
- package/dist/chunks/chunk-D74JEERO.js +5 -0
- package/dist/chunks/{chunk-PA7XP42P.js → chunk-DARVPBZ4.js} +1 -1
- package/dist/chunks/chunk-DBK66CJP.js +8 -0
- package/dist/chunks/chunk-DDMZSZFL.js +1 -0
- package/dist/chunks/chunk-DIO5CB6U.js +2 -0
- package/dist/chunks/chunk-DMFUEUAZ.js +5 -0
- package/dist/chunks/chunk-DMVD2RFZ.js +2 -0
- package/dist/chunks/chunk-DUURYZOI.js +2 -0
- package/dist/chunks/chunk-DZUAT3TP.js +1 -0
- package/dist/chunks/chunk-EIEZHFIW.js +6 -0
- package/dist/chunks/chunk-EIRYMSEG.js +19 -0
- package/dist/chunks/{chunk-JDLAHVAJ.js → chunk-EKM2D7JU.js} +1 -1
- package/dist/chunks/chunk-EQFGBL3O.js +2 -0
- package/dist/chunks/chunk-EYPCBBMS.js +2 -0
- package/dist/chunks/chunk-F4KOGISR.js +10 -0
- package/dist/chunks/chunk-F74GBN6K.js +2 -0
- package/dist/chunks/chunk-FEAKTSRS.js +2 -0
- package/dist/chunks/chunk-FFRFSDBM.js +2 -0
- package/dist/chunks/chunk-FTEOCCPB.js +23 -0
- package/dist/chunks/chunk-FUOEIDMA.js +8 -0
- package/dist/chunks/{chunk-AH22RHPS.js → chunk-FV2R5RUN.js} +2 -2
- package/dist/chunks/chunk-FWIPHEVA.js +12 -0
- package/dist/chunks/chunk-FY5KHLMW.js +2 -0
- package/dist/chunks/chunk-G3RXYI2L.js +6 -0
- package/dist/chunks/chunk-GJ2ZJFDD.js +2 -0
- package/dist/chunks/chunk-GLDYJM7O.js +1 -0
- package/dist/chunks/chunk-GPVCOEUH.js +2 -0
- package/dist/chunks/chunk-GW766ZSO.js +5 -0
- package/dist/chunks/chunk-GWCHDF2C.js +4 -0
- package/dist/chunks/chunk-GZ7M5XBP.js +2 -0
- package/dist/chunks/chunk-H6IW2R22.js +140 -0
- package/dist/chunks/chunk-HCYX6RHP.js +2 -0
- package/dist/chunks/chunk-HDL5YSAA.js +2 -0
- package/dist/chunks/chunk-HIOKCIL7.js +2 -0
- package/dist/chunks/chunk-HY3GOBFJ.js +58 -0
- package/dist/chunks/chunk-HZEIRHEB.js +2 -0
- package/dist/chunks/chunk-I2NXNMRZ.js +2 -0
- package/dist/chunks/chunk-I7AQMAQI.js +33 -0
- package/dist/chunks/chunk-IZ6DLEVY.js +2 -0
- package/dist/chunks/chunk-J2TWKFML.js +1871 -0
- package/dist/chunks/chunk-JDEEWOD7.js +2 -0
- package/dist/chunks/chunk-JFXWI3EN.js +6 -0
- package/dist/chunks/chunk-JYKRR7E5.js +5 -0
- package/dist/chunks/chunk-KCJVFLBB.js +2 -0
- package/dist/chunks/{chunk-5CMKGD43.js → chunk-KG325WTN.js} +1 -1
- package/dist/chunks/chunk-KGNCKIFP.js +3 -0
- package/dist/chunks/chunk-KUERKVEU.js +3 -0
- package/dist/chunks/chunk-KVTBX2UP.js +2 -0
- package/dist/chunks/chunk-L6K7ERG5.js +2 -0
- package/dist/chunks/{chunk-N5QNXMIS.js → chunk-LQQNBVEB.js} +1 -1
- package/dist/chunks/{chunk-YJ4PNAST.js → chunk-M4JWQSV7.js} +1 -1
- package/dist/chunks/chunk-MQULU465.js +2 -0
- package/dist/chunks/chunk-N4FFQPLR.js +2 -0
- package/dist/chunks/chunk-N73MU2C3.js +2 -0
- package/dist/chunks/chunk-NHQ36THU.js +3 -0
- package/dist/chunks/{chunk-4SHKI3BH.js → chunk-O6ULLQJ6.js} +1 -1
- package/dist/chunks/chunk-O72BSKSO.js +2 -0
- package/dist/chunks/chunk-OGDADQGH.js +143 -0
- package/dist/chunks/chunk-OIUTWU6K.js +2 -0
- package/dist/chunks/chunk-OLLLZVHF.js +2 -0
- package/dist/chunks/{chunk-XM26DGML.js → chunk-OPNRWESL.js} +1 -1
- package/dist/chunks/chunk-OQKJGTTO.js +4 -0
- package/dist/chunks/chunk-OQPJ7FJF.js +9 -0
- package/dist/chunks/{chunk-R3XFY7VL.js → chunk-OS3LO5J3.js} +1 -1
- package/dist/chunks/{chunk-T5LE6R5S.js → chunk-OSIO7PLX.js} +1 -1
- package/dist/chunks/chunk-OUVIWDL2.js +2 -0
- package/dist/chunks/chunk-PCSIOUHF.js +7 -0
- package/dist/chunks/chunk-PF5R6CMP.js +21 -0
- package/dist/chunks/chunk-PPAPVGJP.js +3 -0
- package/dist/chunks/chunk-PRGBLQVH.js +2 -0
- package/dist/chunks/chunk-PSGGOZFM.js +2 -0
- package/dist/chunks/chunk-PUZQU66L.js +2 -0
- package/dist/chunks/{chunk-WITSXYEW.js → chunk-Q2QL6UWN.js} +1 -1
- package/dist/chunks/chunk-Q4TBTRIG.js +2 -0
- package/dist/chunks/chunk-Q5LEXXJG.js +16 -0
- package/dist/chunks/{chunk-YL6VFJ4P.js → chunk-QDC4OW3S.js} +1 -1
- package/dist/chunks/chunk-QEFHOJFE.js +7 -0
- package/dist/chunks/chunk-QHWGQ3A4.js +5 -0
- package/dist/chunks/chunk-QIKWJ2AA.js +11 -0
- package/dist/chunks/chunk-QNG27G3T.js +6 -0
- package/dist/chunks/chunk-QOGJAQDO.js +3 -0
- package/dist/chunks/chunk-QOTVNQDI.js +4 -0
- package/dist/chunks/{chunk-N3DEA6PG.js → chunk-RAXOSUSW.js} +1 -1
- package/dist/chunks/chunk-RNIAFXMB.js +50 -0
- package/dist/chunks/chunk-S5ESN275.js +42 -0
- package/dist/chunks/chunk-SDAUS5PY.js +2 -0
- package/dist/chunks/chunk-SDXFLO7J.js +5 -0
- package/dist/chunks/chunk-SH5CBAFC.js +2 -0
- package/dist/chunks/chunk-SWUEFLOH.js +2 -0
- package/dist/chunks/chunk-SYUKES6H.js +3 -0
- package/dist/chunks/chunk-T5AACNJI.js +2 -0
- package/dist/chunks/chunk-TRQQNFMO.js +4 -0
- package/dist/chunks/chunk-TVQAPBLZ.js +2 -0
- package/dist/chunks/chunk-UCPGRPWY.js +2 -0
- package/dist/chunks/chunk-UGL7WF3W.js +2 -0
- package/dist/chunks/chunk-UHFZHBGW.js +2 -0
- package/dist/chunks/chunk-UKMA4R6X.js +6 -0
- package/dist/chunks/{chunk-7ZG3IT7C.js → chunk-VRIEKBBH.js} +6 -6
- package/dist/chunks/chunk-VYLGI3IH.js +13 -0
- package/dist/chunks/chunk-W45RKGM6.js +1 -0
- package/dist/chunks/chunk-WJ43MJ3F.js +2 -0
- package/dist/chunks/chunk-WMKYHXVM.js +3 -0
- package/dist/chunks/chunk-WN3V6KDN.js +3 -0
- package/dist/chunks/chunk-X4OSOOSU.js +3 -0
- package/dist/chunks/chunk-XDQMGUWL.js +2 -0
- package/dist/chunks/chunk-XTFPDQMH.js +3 -0
- package/dist/chunks/chunk-XVDFJ3ZF.js +2 -0
- package/dist/chunks/chunk-XW6HGSIT.js +8 -0
- package/dist/chunks/chunk-XXYGGNVM.js +2 -0
- package/dist/chunks/chunk-Y4OWBBDD.js +184 -0
- package/dist/chunks/chunk-YBT2NB32.js +2 -0
- package/dist/chunks/chunk-YCJO3YVD.js +10 -0
- package/dist/chunks/{chunk-YD55Z5H3.js → chunk-YOBN7KTF.js} +11 -11
- package/dist/chunks/chunk-YOQRYNLP.js +2 -0
- package/dist/chunks/chunk-YR5ID2SS.js +2 -0
- package/dist/chunks/chunk-YY7LEQGP.js +2 -0
- package/dist/chunks/chunk-Z4Z5UOZM.js +22 -0
- package/dist/chunks/chunk-Z54O534A.js +3 -0
- package/dist/chunks/chunk-ZCHXGRRU.js +2 -0
- package/dist/chunks/chunk-ZFSHBFG5.js +40 -0
- package/dist/chunks/chunk-ZGTOK7ZK.js +12 -0
- package/dist/chunks/{chunk-NAZ26IZL.js → chunk-ZRDGQDZL.js} +1 -1
- package/dist/chunks/chunk-ZUJ3XUCP.js +2 -0
- package/dist/chunks/chunk-ZZWAQBA2.js +2 -0
- package/dist/chunks/cli-X25RSO2X.js +2 -0
- package/dist/chunks/configuration-command-6C5UO7GE.js +2 -0
- package/dist/chunks/connected-app-executor-IVLGQP65.js +2 -0
- package/dist/chunks/connected-evidence-GH2ATNEX.js +2 -0
- package/dist/chunks/connection-HTF6CC7M.js +2 -0
- package/dist/chunks/{continual-PKK2BOTB.js → continual-6CQAMTTR.js} +3 -3
- package/dist/chunks/core-commands-A2DGGIPS.js +2 -0
- package/dist/chunks/datasets-7BNMVJOY.js +2 -0
- package/dist/chunks/desktop-test-3CUHVLXV.js +3 -0
- package/dist/chunks/dist-OMGUJYPD.js +2 -0
- package/dist/chunks/{chunk-6VF3Q6QJ.js → dist-SKYG5LZO.js} +2 -4
- package/dist/chunks/dist-VYC5VMQB.js +2 -0
- package/dist/chunks/dist-ZVJPJLXR.js +2 -0
- package/dist/chunks/enclave-QS4BUNDU.js +2 -0
- package/dist/chunks/evaluation-coordination-XEF5L7KZ.js +2 -0
- package/dist/chunks/experiment-improvements-KRX2DP27.js +2 -0
- package/dist/chunks/experiments-DFGQYA4O.js +2 -0
- package/dist/chunks/experiments-VFQGE4HC.js +2 -0
- package/dist/chunks/extension-XKXXOP5N.js +4 -0
- package/dist/chunks/{help-WLKSACLZ.js → help-S7THC6IE.js} +1 -1
- package/dist/chunks/host-profile-evaluation-tools-JJQWJUBT.js +2 -0
- package/dist/chunks/host-profile-external-dataset-K3ICDHIP.js +2 -0
- package/dist/chunks/hosted-app-server-composition-BCOO5ANF.js +2 -0
- package/dist/chunks/hosted-experiment-improvement-NFSVS5TU.js +3 -0
- package/dist/chunks/hosted-harness-runtime-723S5ZSH.js +2 -0
- package/dist/chunks/hosted-profile-candidate-2S5LFUWD.js +3 -0
- package/dist/chunks/hosted-profile-compiler-2DQIFSXW.js +2 -0
- package/dist/chunks/hosted-profile-evaluation-control-76BTRTYD.js +2 -0
- package/dist/chunks/hosted-profile-evaluation-inspection-V6Z3A5XJ.js +3 -0
- package/dist/chunks/hosted-profile-evaluation-preparation-IDJYREW3.js +3 -0
- package/dist/chunks/hosted-tasksets-ANAE2PIW.js +2 -0
- package/dist/chunks/human-review-WR777ODH.js +2 -0
- package/dist/chunks/import-MLZUHITH.js +4 -0
- package/dist/chunks/javascript-isolate-process-source-ZPQKKLR4.js +2 -0
- package/dist/chunks/javascript-verifier-worker-source-F3LSGPOY.js +2 -0
- package/dist/chunks/learning-ACEVFL5M.js +2 -0
- package/dist/chunks/local-harness-improvement-runtime-JIQ6ZVDW.js +2 -0
- package/dist/chunks/local-harness-taskset-review-XVYTGAGK.js +2 -0
- package/dist/chunks/local-scope-HVF2GZ5W.js +2 -0
- package/dist/chunks/model-projects-QPO22JPA.js +2 -0
- package/dist/chunks/opchat-T4QTNEIY.js +3 -0
- package/dist/chunks/organizations-75L5DZDV.js +2 -0
- package/dist/chunks/profile-TFZMUEDR.js +3 -0
- package/dist/chunks/profile-training-source-6GOT7AHM.js +2 -0
- package/dist/chunks/project-action-payload-7VGL7OER.js +2 -0
- package/dist/chunks/project-agent-6RRO233B.js +2 -0
- package/dist/chunks/published-experiment-source-DZFENAQA.js +2 -0
- package/dist/chunks/refiner-profile-service-UUIWFJVT.js +2 -0
- package/dist/chunks/runtime-A7OZXM43.js +6 -0
- package/dist/chunks/sandbox-command-IU5XFTJP.js +2 -0
- package/dist/chunks/{sandbox-template-BBGGPJMI.js → sandbox-template-C4V6T36U.js} +1 -1
- package/dist/chunks/saved-work-6BMBFP43.js +2 -0
- package/dist/chunks/send-turn-XTAIS2JN.js +2 -0
- package/dist/chunks/sql-execution-process-source-B4HQM6ZV.js +2 -0
- package/dist/chunks/src-CJM6HY5Y.js +326 -0
- package/dist/chunks/{src-CR6UZYTX.js → src-LMC3K6LH.js} +1 -1
- package/dist/chunks/standalone-experiment-turn-owner-JCY5LL5R.js +2 -0
- package/dist/chunks/store-chat-workflows-S72HZXQR.js +18 -0
- package/dist/chunks/store-continual-support-reviews-HHA6NX7K.js +7 -0
- package/dist/chunks/store-conversation-serving-KPC62UEY.js +2 -0
- package/dist/chunks/store-create-improve-QV54XIZW.js +40 -0
- package/dist/chunks/store-datasets-RXJ33SUN.js +86 -0
- package/dist/chunks/store-evaluation-results-3F3P527G.js +7 -0
- package/dist/chunks/store-harness-evaluation-review-settings-I2R3HPO3.js +29 -0
- package/dist/chunks/store-harness-memory-VINCZ4GK.js +17 -0
- package/dist/chunks/store-harness-refinement-candidates-EA5KFQPH.js +21 -0
- package/dist/chunks/store-harness-workspaces-XUM4Z66X.js +2 -0
- package/dist/chunks/store-human-review-RAH7WMIP.js +7 -0
- package/dist/chunks/store-learned-preference-migration-validation-4CI2IRUF.js +2 -0
- package/dist/chunks/store-learning-WLG6KFIO.js +2 -0
- package/dist/chunks/store-learning-credentials-WZQJ4HPJ.js +2 -0
- package/dist/chunks/store-local-experiments-5LUJR7GI.js +97 -0
- package/dist/chunks/store-model-batch-review-YEGX327M.js +2 -0
- package/dist/chunks/store-model-configuration-5ZURQATB.js +3 -0
- package/dist/chunks/store-preference-comparison-LV32MHVL.js +6 -0
- package/dist/chunks/store-schedules-VGTEQVKH.js +53 -0
- package/dist/chunks/store-sidebar-file-bookmarks-VB5GTLFY.js +18 -0
- package/dist/chunks/store-sidebar-preferences-GWIOG2NH.js +16 -0
- package/dist/chunks/store-subagents-T7R2Z6TB.js +67 -0
- package/dist/chunks/store-task-inbox-JJTBW76C.js +33 -0
- package/dist/chunks/store-task-inventory-OB3F2APC.js +10 -0
- package/dist/chunks/store-taskset-drafts-EKQWWFYQ.js +9 -0
- package/dist/chunks/store-training-G6YLFSIR.js +70 -0
- package/dist/chunks/store-training-jobs-RC46YBF6.js +19 -0
- package/dist/chunks/store-training-models-6BA43IPP.js +49 -0
- package/dist/chunks/store-usage-IE2U2FD3.js +63 -0
- package/dist/chunks/store-work-evidence-QQDKM5AQ.js +8 -0
- package/dist/chunks/taskset-EQRFQBYM.js +2 -0
- package/dist/chunks/taskset-packages-XC6HEE3K.js +2 -0
- package/dist/chunks/{teams-bot-7I4BAUVO.js → teams-bot-EAPGPTHZ.js} +1 -1
- package/dist/chunks/training-UF6RPI4T.js +2 -0
- package/dist/chunks/web-search-CZ3NCLPY.js +2 -0
- package/dist/chunks/workspaces-EKKE5NAC.js +2 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/web/assets/App-CaRMZoxo.css +1 -0
- package/dist/web/assets/App-s-CJswyt.js +154 -0
- package/dist/web/assets/{AppDialog-BdusXgU0.js → AppDialog-t2Fx5tK3.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-C4uRpnBz.js → AppTerminalPanel-Dj1Y32oI.js} +2 -2
- package/dist/web/assets/AppsView-BYE5EBDJ.js +1 -0
- package/dist/web/assets/{BrowserSidebar-Bl7V6YO2.js → BrowserSidebar-jhWi4rVm.js} +1 -1
- package/dist/web/assets/{CartesianChart-BstFbsdn.js → CartesianChart-C1DIx0Ia.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-B8YAf0c1.js → CollaborationTabs-Bdr-HmOL.js} +1 -1
- package/dist/web/assets/{CommandMenu-DZct7zUJ.js → CommandMenu-Ux2yOHAc.js} +1 -1
- package/dist/web/assets/{CommunityView-CR0-W-uG.js → CommunityView-DPEeVKFn.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-DR-Qo7b4.js → ComposerCreateImproveStrip-CEgh4OtN.js} +1 -1
- package/dist/web/assets/{GetStartedView-xqQoMMei.js → GetStartedView-CFHP0AaI.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-D8BGTPVN.js +1 -0
- package/dist/web/assets/{HostedModelLearningSettings-De3i9wF4.js → HostedModelLearningSettings-JS1S7vNO.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-DAY1MmqP.js → LabModelVersionDetailPage-Dx5Q3xV2.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-DLnIgnry.js → LabSkillSidebar-BxffN-pN.js} +1 -1
- package/dist/web/assets/LabsRoute-CyYF8-dw.js +99 -0
- package/dist/web/assets/MainChatThread-DZpcFRFl.js +2 -0
- package/dist/web/assets/MainPane-5DTtwVCk.js +65 -0
- package/dist/web/assets/MainPane-BIM_UJ3q.css +1 -0
- package/dist/web/assets/{MarkdownText-gJMuefaJ.js → MarkdownText-BR4V6lNO.js} +24 -24
- package/dist/web/assets/{NativeSkillSidebar-Dlxb8iOC.js → NativeSkillSidebar-DU9IEgIO.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-DM-cqJ-K.js → NewExperienceSwitcher-mIy6FzCj.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-Cu1q75gq.js → NewProjectDialog-RfTZTHxl.js} +1 -1
- package/dist/web/assets/{OutputsPage-DiXMkasl.js → OutputsPage-Cr1Spf7S.js} +1 -1
- package/dist/web/assets/{ProjectsPage-DqiBHiCB.js → ProjectsPage-CE6QUB-b.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-T6VRWuHo.js +1 -0
- package/dist/web/assets/RightSidebarHomePanel-CK0rP3WT.js +1 -0
- package/dist/web/assets/ScheduledWorkPage-vOrYv8pp.js +1 -0
- package/dist/web/assets/SettingsView-DCKVrfjj.js +5 -0
- package/dist/web/assets/SettingsView-Dulr_xlq.css +1 -0
- package/dist/web/assets/{TeamChatView-DM0adMtj.js → TeamChatView-Bwrjr-vk.js} +2 -2
- package/dist/web/assets/{TerminalOverlay-CFlH51DD.js → TerminalOverlay-DhPoKZAq.js} +1 -1
- package/dist/web/assets/TrainingCreationPanel-BXHfohNm.js +1 -0
- package/dist/web/assets/{TrainingDraftPanel-Bbo3RRie.js → TrainingDraftPanel-C9cRX5qf.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CSRjJUSa.js → UsageSettingsSection-CrdcSGeW.js} +1 -1
- package/dist/web/assets/{WorkSidebarPanel-DwlEMEoG.js → WorkSidebarPanel-DSSikNFQ.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-BAFo0CPN.js +14 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-BVHAhwnJ.js +63 -0
- package/dist/web/assets/WorkspaceGitDialogs-CwVoiDQ2.js +1 -0
- package/dist/web/assets/{WorkspaceMonacoEditor-BR4qxMgU.js → WorkspaceMonacoEditor-TxLyhzNp.js} +3 -3
- package/dist/web/assets/arrow-up-right-C9aE8Mfz.js +1 -0
- package/dist/web/assets/chunk-P3BRSSRD-DUGfuKA8.js +1 -0
- package/dist/web/assets/{clipboard-BZzZ82Bk.js → clipboard-Dk158Qp4.js} +1 -1
- package/dist/web/assets/{cloud-upload-CJPYPVl8.js → cloud-upload-k9eqBsHr.js} +1 -1
- package/dist/web/assets/{cssMode-WC4Rg1l-.js → cssMode-CO35ARZp.js} +1 -1
- package/dist/web/assets/{folder-open-sLZJxLQy.js → folder-open-sYgceW_f.js} +1 -1
- package/dist/web/assets/folder-plus-CS0R49m9.js +1 -0
- package/dist/web/assets/{git-commit-horizontal-Cotm7KEC.js → git-commit-horizontal-DrGxH2h4.js} +1 -1
- package/dist/web/assets/{htmlMode-C6oZGeaB.js → htmlMode-REMmzdfq.js} +1 -1
- package/dist/web/assets/index-3iPNbbER.css +1 -0
- package/dist/web/assets/{index-BxWTVKtn.js → index-C8aCGagb.js} +2 -2
- package/dist/web/assets/info-DLdbiUrh.js +1 -0
- package/dist/web/assets/{jsonMode-BET4LQIn.js → jsonMode-KEdMfkIf.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-BPxA_-Kg.js → lspLanguageFeatures-5KZwEoxW.js} +1 -1
- package/dist/web/assets/minimize-2-CqcI4zcM.js +1 -0
- package/dist/web/assets/{monaco.contribution-DFzEyaHi.js → monaco.contribution-BJGj65F9.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DXzyQfVi.js → monaco.contribution-Cly9Wt7L.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BH6kkO4b.js → monaco.contribution-DO10L0zW.js} +2 -2
- package/dist/web/assets/{monaco.contribution-7AUuf2NS.js → monaco.contribution-omszXBEj.js} +2 -2
- package/dist/web/assets/monitor-BFVCcbxp.js +1 -0
- package/dist/web/assets/play-C469pVZq.js +1 -0
- package/dist/web/assets/{python-PzBkTjWx.js → python-Dw0YcVy9.js} +1 -1
- package/dist/web/assets/{save-DpezrtH2.js → save-CtSjPydi.js} +1 -1
- package/dist/web/assets/square-BuImvLhT.js +1 -0
- package/dist/web/assets/{toggleHighContrast-Cto-fOXm.js → toggleHighContrast-DjCO9lIP.js} +1 -1
- package/dist/web/assets/{tsMode-BYA4LNc6.js → tsMode-BAOnxKd6.js} +1 -1
- package/dist/web/assets/{upload-C5YFNgtS.js → upload-2JkFZo3h.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-CnyTsqlf.js → useLocalAgentSchedules-BNqAisfS.js} +1 -1
- package/dist/web/assets/useProviderSettings-C4L4wDoh.js +5 -0
- package/dist/web/assets/{useProviderSettings-Bw-csWbH.css → useProviderSettings-CmL_BaxP.css} +1 -1
- package/dist/web/assets/{useSessionTurnCache-DICuJSJW.js → useSessionTurnCache-BHU2-Jmz.js} +1 -1
- package/dist/web/assets/{wifi-off-nzHj7JXp.js → wifi-off-CpOAH62M.js} +1 -1
- package/dist/web/assets/{workers-Dboaw6f_.js → workers-0QvlA2T5.js} +1 -1
- package/dist/web/assets/{yaml-uuY5JmO8.js → yaml-BK3qxo7D.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +3 -3
- package/dist/chunks/actions-command-DSO6YOEE.js +0 -2
- package/dist/chunks/app-server-runtime-7AXV6JZI.js +0 -2
- package/dist/chunks/apps-TM74FFQB.js +0 -2
- package/dist/chunks/chunk-2JO2KWT3.js +0 -5
- package/dist/chunks/chunk-2SPZYBDN.js +0 -16
- package/dist/chunks/chunk-37DXASQL.js +0 -191
- package/dist/chunks/chunk-4EEH7MEC.js +0 -2
- package/dist/chunks/chunk-4TZHH5FC.js +0 -2409
- package/dist/chunks/chunk-5TNDPNS3.js +0 -2
- package/dist/chunks/chunk-6JAN4RMN.js +0 -42
- package/dist/chunks/chunk-7QEE4PBI.js +0 -8
- package/dist/chunks/chunk-BX4J2VDU.js +0 -2
- package/dist/chunks/chunk-DALJMSJG.js +0 -33
- package/dist/chunks/chunk-EMKZVP7Z.js +0 -2
- package/dist/chunks/chunk-FPUUZQUP.js +0 -6
- package/dist/chunks/chunk-GCOUYYHG.js +0 -5
- package/dist/chunks/chunk-GS2NKNKG.js +0 -4
- package/dist/chunks/chunk-H2VT22JK.js +0 -2
- package/dist/chunks/chunk-HA7EFTPF.js +0 -23
- package/dist/chunks/chunk-IKWDL3RB.js +0 -17
- package/dist/chunks/chunk-NHFGEVVH.js +0 -518
- package/dist/chunks/chunk-NNF6KCHD.js +0 -3
- package/dist/chunks/chunk-PJM2G7SG.js +0 -21
- package/dist/chunks/chunk-PQHTZ5CP.js +0 -2
- package/dist/chunks/chunk-PYABBF53.js +0 -53
- package/dist/chunks/chunk-QRWPEW3Z.js +0 -24
- package/dist/chunks/chunk-QXVIIM4T.js +0 -2
- package/dist/chunks/chunk-SDEDAHV6.js +0 -160
- package/dist/chunks/chunk-TGIB24K4.js +0 -22
- package/dist/chunks/chunk-UE3DMPGM.js +0 -3
- package/dist/chunks/chunk-USKE34VR.js +0 -9
- package/dist/chunks/chunk-USMZT5FZ.js +0 -18
- package/dist/chunks/chunk-WV2APYWG.js +0 -2
- package/dist/chunks/chunk-YIB3J4RC.js +0 -2
- package/dist/chunks/chunk-Z3D4C7BG.js +0 -12
- package/dist/chunks/cli-JVB345H2.js +0 -2
- package/dist/chunks/configuration-command-MATM4XR5.js +0 -2
- package/dist/chunks/connected-evidence-YDPGNHLP.js +0 -2
- package/dist/chunks/core-commands-MTV4EKXY.js +0 -2
- package/dist/chunks/datasets-CP3IT47T.js +0 -2
- package/dist/chunks/desktop-test-IAZC5MAH.js +0 -3
- package/dist/chunks/dist-4HV2W6V4.js +0 -2
- package/dist/chunks/dist-SAABJU5F.js +0 -2
- package/dist/chunks/evaluation-coordination-EPHLZXYM.js +0 -2
- package/dist/chunks/experiment-improvements-6JTOPA74.js +0 -2
- package/dist/chunks/experiments-XHPFGECH.js +0 -2
- package/dist/chunks/extension-GX7DLW2X.js +0 -4
- package/dist/chunks/hosted-experiment-improvement-HAB3UE6A.js +0 -3
- package/dist/chunks/hosted-harness-runtime-YM23QNDK.js +0 -2
- package/dist/chunks/hosted-profile-candidate-EOBGKQAS.js +0 -3
- package/dist/chunks/hosted-profile-compiler-SCVJI2CP.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-control-RJ6XJZCS.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-inspection-OC4XNGL2.js +0 -3
- package/dist/chunks/hosted-profile-evaluation-preparation-ZD4FM3FD.js +0 -3
- package/dist/chunks/human-review-AAVMISBF.js +0 -2
- package/dist/chunks/import-V3HUGRHR.js +0 -4
- package/dist/chunks/learning-FNBEIAY6.js +0 -2
- package/dist/chunks/opchat-QK43DXTY.js +0 -3
- package/dist/chunks/organizations-SRPAWKC7.js +0 -2
- package/dist/chunks/profile-C6CQNVYE.js +0 -3
- package/dist/chunks/project-agent-GZV5HNYI.js +0 -2
- package/dist/chunks/sandbox-command-4TJXQTKT.js +0 -2
- package/dist/chunks/src-NE6R4XC6.js +0 -329
- package/dist/chunks/taskset-LUG3ZU6J.js +0 -2
- package/dist/chunks/training-XHE6FVII.js +0 -2
- package/dist/chunks/workspaces-MFZ3OO6O.js +0 -2
- package/dist/web/assets/App-CO2F717V.css +0 -1
- package/dist/web/assets/App-CuhaCsfb.js +0 -235
- package/dist/web/assets/AppsView-BS1czXUP.js +0 -1
- package/dist/web/assets/HostedModelLearningReview-CHxxf_Lu.js +0 -1
- package/dist/web/assets/LabsRoute-CXJRJMhr.js +0 -99
- package/dist/web/assets/MainChatThread-BwAla81W.js +0 -2
- package/dist/web/assets/MainPane-CakOBCHw.js +0 -19
- package/dist/web/assets/MainPane-DOWsSew1.css +0 -1
- package/dist/web/assets/RightChatPanelStack-VaOOmxwd.js +0 -1
- package/dist/web/assets/RightSidebarHomePanel-CeSFJM5s.js +0 -1
- package/dist/web/assets/ScheduledWorkPage-D1jRQxFs.js +0 -1
- package/dist/web/assets/SettingsView-BnANbPLS.css +0 -1
- package/dist/web/assets/SettingsView-RA9OXgcu.js +0 -5
- package/dist/web/assets/TrainingCreationPanel-CgIBVGha.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-pGVezNMw.js +0 -14
- package/dist/web/assets/WorkspaceEnvironmentMenu-Byjngd9V.js +0 -32
- package/dist/web/assets/WorkspaceGitDialogs-Dgmg-6XG.js +0 -1
- package/dist/web/assets/arrow-up-right-H0pvnH2s.js +0 -1
- package/dist/web/assets/chunk-UHVJOMWN-BqXRe639.js +0 -1
- package/dist/web/assets/folder-plus-C84wrpt_.js +0 -1
- package/dist/web/assets/index-dSmk3FLJ.css +0 -1
- package/dist/web/assets/info-Dc81lEfw.js +0 -1
- package/dist/web/assets/minimize-2-Bs7MVN3C.js +0 -1
- package/dist/web/assets/monitor-DXL019Wf.js +0 -1
- package/dist/web/assets/play-CXkxUZeU.js +0 -1
- package/dist/web/assets/square-oy7f5Ce6.js +0 -1
- package/dist/web/assets/useProviderSettings-B_KeQjE5.js +0 -5
- /package/dist/chunks/{chunk-OGPHXXCD.js → chunk-BT5YNE5U.js} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as Me,d as Ne,e as qe}from"./chunk-SH5CBAFC.js";import{a as te}from"./chunk-DMVD2RFZ.js";import{b as He,c as _e,h as Ue}from"./chunk-JDEEWOD7.js";import{b as ee}from"./chunk-4NESNOK5.js";import{j as Ee,p as ke,r as Ce}from"./chunk-UKMA4R6X.js";import{a as Q,b as Ae,h as Oe}from"./chunk-KG325WTN.js";import{I as b,M as Te}from"./chunk-VRIEKBBH.js";import{Ua as _,Xa as W,Ya as Pe,a as $}from"./chunk-QOTVNQDI.js";import{p as F,q as N}from"./chunk-WJ43MJ3F.js";import{h as H,i as xe}from"./chunk-Q4TBTRIG.js";import{X as ve,Y as we,_ as Z,b as ue,ba as be,c as ce,ea as Se,fa as V,ja as ye,la as Ie,ma as Re,p as pe,r as de,s as me,t as ge,u as fe,w as he}from"./chunk-I7AQMAQI.js";import{z as M}from"./chunk-Z4Z5UOZM.js";import{v as ie}from"./chunk-TVQAPBLZ.js";import{b as o}from"./chunk-ES2ISFJC.js";import{c as ae,d as B,f as le,h as U}from"./chunk-H7IWJN7L.js";import{a as l}from"./chunk-FTQLQJQV.js";import{promises as ne}from"node:fs";import dt from"node:os";import mt from"node:path";import{createServer as gt}from"node:http";import{randomBytes as ft}from"node:crypto";var ot=o.discriminatedUnion("op",[o.strictObject({op:o.literal("set"),path:o.array(o.string().min(1)).min(1),value:o.unknown()}),o.strictObject({op:o.literal("unset"),path:o.array(o.string().min(1)).min(1)})]),it=o.discriminatedUnion("action",[o.strictObject({action:o.literal("patch"),expectedRevision:o.string(),operations:o.array(ot).max(100)}),o.strictObject({action:o.literal("replace"),expectedRevision:o.string(),text:o.string().max(1048576)}),o.strictObject({action:o.literal("validate"),text:o.string().max(1048576)}),o.strictObject({action:o.literal("restore"),expectedRevision:o.string(),revision:o.string()}),o.strictObject({action:o.literal("trust"),root:o.string(),accountId:o.string(),trusted:o.boolean()}),o.strictObject({action:o.literal("client-state"),owner:o.string(),patch:ye,importOnly:o.boolean().optional()})]);function De(n,e){let t=null;async function r(i,a){let c=U(n).config,p=null,u=null,m=null;try{p=await ce(c),m=await V(n,{projectRoot:i,accountId:a}),i||(t=m)}catch(R){u=B(R,c)}let w=m??(i?null:t);return{path:c,text:p,rawRevision:ue(p),issue:u,effective:w,usingLastValid:!m&&!!w,applies:"next_turn",recoverableRevisions:await de(n),clientState:u?null:await Ie(n)}}l(r,"status");async function s(i){let a=it.parse(i);if(a.action==="validate")return{valid:!0,document:pe(a.text,U(n).config)};if(a.action==="client-state")return Re(n,a.owner,a.patch,a.importOnly);let c=l(async()=>{a.action==="patch"&&await he(n,a.expectedRevision,a.operations),a.action==="replace"&&await me(n,a.expectedRevision,a.text),a.action==="restore"&&await ge(n,a.revision,a.expectedRevision),a.action==="trust"&&await Se(n,a.root,a.accountId,a.trusted)},"mutation");return e?await e(c):await c(),r()}return l(s,"mutate"),{status:r,mutate:s,schema:fe}}l(De,"createConfigurationPayloads");import{Buffer as Be}from"node:buffer";var G={"Access-Control-Allow-Headers":"authorization, content-type, x-openpond-team-id, idempotency-key","Access-Control-Allow-Methods":"GET, POST, PUT, PATCH, DELETE, OPTIONS"},at=25*1024*1024,j=class extends Error{constructor(t,r,s){super(s);this.status=t;this.code=r;this.name="HttpBodyError"}status;code;static{l(this,"HttpBodyError")}};function je(n,e,t={}){for(let[s,i]of Object.entries(G))e.setHeader(s,i);let r=Ve(n.headers.origin);return r?(e.setHeader("Vary",pt(e.getHeader("Vary"))),lt(r,t)?(e.setHeader("Access-Control-Allow-Origin",r),{allowed:!0,origin:r}):{allowed:!1,origin:r}):{allowed:!0,origin:null}}l(je,"applyCorsHeaders");function lt(n,e={}){if(n==="null")return!0;let t=Fe(n);return t?ct(t)?!0:new Set((e.allowedOrigins??[]).map(s=>s?Fe(s):null).filter(s=>!!s)).has(t):!1}l(lt,"isAllowedCorsOrigin");function P(n,e,t){n.writeHead(e,{"Content-Type":"application/json",...G}),n.end(JSON.stringify(t))}l(P,"sendJson");function Kt(n,e,t){n.writeHead(e,{"Content-Type":"text/plain; charset=utf-8",...G}),n.end(t)}l(Kt,"sendText");function Yt(n,e,t,r){n.writeHead(e,{"Content-Type":r,"Content-Length":String(t.byteLength),"Cache-Control":"no-store","X-Content-Type-Options":"nosniff",...G}),n.end(t)}l(Yt,"sendBinary");async function re(n,e={}){let t=e.maxBytes??at,r=Ve(n.headers["content-type"]),s=[],i=0;for await(let c of n){let p=Be.from(c);if(i+=p.byteLength,i>t)throw new j(413,"request_body_too_large",`JSON request body exceeds ${t} bytes.`);s.push(p)}let a=Be.concat(s).toString("utf8").trim();if(!a)return{};if(!ut(r))throw new j(415,"unsupported_media_type","JSON request body requires Content-Type: application/json.");try{return JSON.parse(a)}catch{throw new j(400,"invalid_json","Request body is not valid JSON.")}}l(re,"readJson");function Le(n,e,t){let r=n.headers.authorization;return(typeof r=="string"&&r.startsWith("Bearer ")?r.slice(7):null)===t}l(Le,"hasAuth");function Ve(n){return Array.isArray(n)?n[0]??null:n??null}l(Ve,"headerValue");function ut(n){if(!n)return!1;let e=n.split(";")[0]?.trim().toLowerCase();return e==="application/json"||!!e?.endsWith("+json")}l(ut,"isJsonContentType");function Fe(n){try{let e=new URL(n);return e.protocol!=="http:"&&e.protocol!=="https:"?null:e.origin}catch{return null}}l(Fe,"normalizeOrigin");function ct(n){let e=new URL(n);return e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="::1"||e.hostname==="[::1]"}l(ct,"isLoopbackOrigin");function pt(n){let t=(Array.isArray(n)?n.join(", "):n?String(n):"").split(",").map(r=>r.trim()).filter(Boolean);return t.some(r=>r.toLowerCase()==="origin")||t.push("Origin"),t.join(", ")}l(pt,"appendVaryOrigin");function $e(n){return`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>OpenPond recovery</title>
|
|
3
|
+
<style nonce="${n}">body{font:16px system-ui;background:#171819;color:#eee;max-width:850px;margin:6vh auto;padding:24px}textarea{box-sizing:border-box;width:100%;min-height:280px;background:#222;color:#eee;padding:14px;border:1px solid #777;border-radius:8px;font:14px monospace}button,input,select{font:inherit;margin:6px;padding:8px}pre{white-space:pre-wrap}code{overflow-wrap:anywhere}button{cursor:pointer}p{line-height:1.5}</style>
|
|
4
|
+
<h1>OpenPond needs a storage repair</h1><p id="issue" role="alert">Loading recovery details\u2026</p><p><code id="file"></code></p>
|
|
5
|
+
<p id="action"></p><p>Migration backups and the source installation remain available. Execution services are stopped while recovery is open.</p>
|
|
6
|
+
<details id="editor"><summary>Edit configuration</summary><textarea id="text" aria-label="Configuration TOML" spellcheck="false"></textarea><button id="save">Validate and save</button><button id="reload">Reload file</button><select id="revisions" aria-label="Restore a verified configuration revision"><option value="">Restore a verified revision\u2026</option></select></details>
|
|
7
|
+
<details><summary>Migration sources and diagnostics</summary><pre id="migration"></pre><label>Previous app home <input id="appHome"></label><label>Previous account config <input id="configSource"></label><label>Configuration conflict choices (JSON from the preview) <textarea id="resolutions" aria-label="Migration conflict choices" spellcheck="false" placeholder='[{"path":["chat","steer_active_responses"],"choice":"existing"}]'></textarea></label><button id="preview">Preview migration</button><button id="migrate">Use these sources</button><button id="restart">Restart failed preparation</button><button id="diagnostics">Export diagnostics</button></details>
|
|
8
|
+
<button id="retry">Retry startup</button><p id="message" role="status"></p>
|
|
9
|
+
<script nonce="${n}">
|
|
10
|
+
let token='',state=null,editing=false,revision=null;
|
|
11
|
+
const el=id=>document.getElementById(id);
|
|
12
|
+
async function request(route,body){const r=await fetch(route,{method:body?'POST':'GET',headers:{'Content-Type':'application/json',Authorization:'Bearer '+token},body:body?JSON.stringify(body):undefined});const v=await r.json();if(!r.ok)throw Error(v.error||'Recovery request failed');return v;}
|
|
13
|
+
function message(error){el('message').textContent=error instanceof Error?error.message:String(error);}
|
|
14
|
+
async function load(){state=await request('/v1/recovery');el('issue').textContent=state.issue.message;el('action').textContent=state.issue.action;el('file').textContent=state.issue.path;el('migration').textContent=JSON.stringify(state.migration,null,2);if(!editing){el('text').value=state.config.text||'schema_version = 1\\n';revision=state.config.rawRevision;}el('revisions').replaceChildren(new Option('Restore a verified revision\u2026',''),...state.config.recoverableRevisions.map(r=>new Option(r.createdAt,r.revision)));el('editor').hidden=!state.configEditable;}
|
|
15
|
+
el('text').oninput=()=>{editing=true};
|
|
16
|
+
el('reload').onclick=()=>{editing=false;load().catch(message)};
|
|
17
|
+
el('save').onclick=async()=>{try{await request('/v1/configuration',{action:'replace',text:el('text').value,expectedRevision:revision});editing=false;await load();message('Configuration saved. Retry startup when ready.')}catch(e){message(e)}};
|
|
18
|
+
el('revisions').onchange=async e=>{if(!e.target.value)return;try{await request('/v1/configuration',{action:'restore',revision:e.target.value,expectedRevision:state.config.rawRevision});editing=false;await load();message('Verified revision restored.')}catch(e){message(e)}};
|
|
19
|
+
for(const [id,action] of [['preview','preview'],['migrate','migrate'],['restart','restart']])el(id).onclick=async()=>{try{const result=await request('/v1/recovery',{action,sourceAppHome:el('appHome').value||undefined,sourceConfig:el('configSource').value||undefined,resolutions:el('resolutions').value?JSON.parse(el('resolutions').value):undefined});el('migration').textContent=JSON.stringify(result,null,2);message(action==='preview'?'Review the source paths above.':'Migration operation completed; retry startup.')}catch(e){message(e)}};
|
|
20
|
+
el('diagnostics').onclick=()=>{if(!state)return;const blob=new Blob([JSON.stringify({issue:state.issue,migration:state.migration,config:{path:state.config.path,rawRevision:state.config.rawRevision,issue:state.config.issue}},null,2)],{type:'application/json'});const a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download='openpond-recovery-diagnostics.json';a.click();URL.revokeObjectURL(a.href)};
|
|
21
|
+
el('retry').onclick=async()=>{try{await request('/v1/recovery',{action:'retry'});message('Starting OpenPond\u2026');const timer=setInterval(async()=>{try{const h=await(await fetch('/health')).json();if(!h.recovery){clearInterval(timer);const next=new URLSearchParams(location.hash.slice(1)).get('returnTo');if(next){const u=new URL(next);if(['localhost','127.0.0.1','[::1]'].includes(u.hostname)){location.replace(u.toString());return}}location.reload();}}catch{}},500)}catch(e){message(e)}};
|
|
22
|
+
(async()=>{const params=new URLSearchParams(location.hash.slice(1));token=params.get('openpondToken')||'';if(!token&&window.openpond?.getConnection)token=(await window.openpond.getConnection()).token;if(!token){message('Open the authenticated recovery URL from the launcher.');return}await load()})().catch(message);
|
|
23
|
+
</script></html>`}l($e,"startupRecoveryPage");var ht=o.strictObject({action:o.enum(["preview","migrate","restart","retry"]),sourceAppHome:o.string().optional(),sourceConfig:o.string().optional(),resolutions:ve.optional()});function We(n){return n instanceof ae&&/^(PRIVATE_STORAGE_|UNSAFE_STORAGE_|INVALID_CONFIG|CONFIG_|MIGRATION_|SOURCE_CHANGED_|CREDENTIAL_|UNSUPPORTED_STORAGE_|INVALID_MIGRATION_|INVALID_ACCOUNT_|MISSING_INSTRUCTION_|INVALID_PROFILE_|DATABASE_RECOVERY_)/.test(n.issue.code)}l(We,"isRecoverableStartupError");async function Ge(n,e,t){let r=/^(UNSUPPORTED_STORAGE_|INVALID_MIGRATION_|UNSAFE_STORAGE_|PRIVATE_STORAGE_)/.test(t.issue.code),s=r?await ne.mkdtemp(mt.join(dt.tmpdir(),"openpond-recovery-")):n;return He(s,async()=>{let{token:i,tokenFile:a}=await Ue(s),c=De(n),p=t.issue,u,m=new Promise(f=>{u=f}),w=gt((f,h)=>{(async()=>{let S=new URL(f.url??"/","http://127.0.0.1");if(!je(f,h).allowed){P(h,403,{error:"Origin not allowed"});return}if(f.method==="OPTIONS"){P(h,204,{});return}if(f.method==="GET"&&S.pathname==="/health"){P(h,200,{ok:!0,server:"openpond-app-server",version:Ae,recovery:!0});return}if(f.method==="GET"&&S.pathname==="/"){let v=ft(18).toString("base64");h.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store","Content-Security-Policy":`default-src 'none'; script-src 'nonce-${v}'; style-src 'nonce-${v}'; connect-src 'self'; base-uri 'none'; frame-ancestors 'none'`}),h.end($e(v));return}if(!Le(f,S,i)){P(h,401,{error:"Unauthorized"});return}let x=!r;if(f.method==="GET"&&S.pathname==="/v1/recovery"){P(h,200,{issue:p,configEditable:x,config:r?{path:U(n).config,text:null,rawRevision:"unavailable",issue:p,recoverableRevisions:[]}:await c.status(),migration:await we(n).catch(v=>({issue:B(v,n)}))});return}if(f.method==="POST"&&S.pathname==="/v1/configuration"&&x){P(h,200,await c.mutate(await re(f)));return}if(f.method==="POST"&&S.pathname==="/v1/recovery"){let v=ht.parse(await re(f));if(r&&v.action!=="retry"&&v.action!=="preview")throw t;if(v.action==="restart"){P(h,200,await be(n));return}if(v.action==="preview"||v.action==="migrate"){P(h,200,await Z(n,{sourceAppHome:v.sourceAppHome,sourceConfig:v.sourceConfig,resolutions:v.resolutions,dryRun:v.action==="preview"}));return}await Z(n),await V(n),P(h,200,{ready:!0}),u();return}P(h,503,{error:`${p.message} ${p.action}`,issue:p,recovery:!0})})().catch(S=>{p=B(S,n),P(h,422,{error:`${p.message} ${p.action}`,issue:p})})});await new Promise((f,h)=>{w.once("error",h),w.listen(e,"127.0.0.1",()=>{w.off("error",h),f()})});let R=w.address().port,C=`http://127.0.0.1:${R}`;return await _e(s,C,"startup-recovery"),{url:C,port:R,token:i,tokenFile:a,storePath:U(n).database,repaired:m,close:l(async()=>{w.closeIdleConnections(),await new Promise((f,h)=>w.close(S=>S?h(S):f())),r&&await ne.rm(s,{recursive:!0,force:!0})},"close")}}).catch(async i=>{throw r&&await ne.rm(s,{recursive:!0,force:!0}),i})}l(Ge,"startRecoveryServer");import{createHash as _t}from"node:crypto";import{createHash as vt,randomUUID as Je}from"node:crypto";var wt=o.object({updatedAt:o.string(),id:o.string().min(1)}).strict(),bt=o.object({entries:o.array(H).max(200),nextBefore:wt.nullable()}).strict(),St=o.object({run:H,replayed:o.boolean()}).strict(),J=class{constructor(e){this.client=e}client;static{l(this,"HostedCreateImproveStorage")}async getCreateImproveRun(e){let t=await this.client.request({contractVersion:b,requestId:Je(),operation:"create-improve/execute",params:{action:"get",runId:e}});return t===null?null:H.parse(t)}async listCreateImproveRuns(e={}){let t=Math.max(1,Math.min(1e3,Math.trunc(e.limit??250))),r=Array.isArray(e.state)?[...e.state]:e.state?[e.state]:[],s=[],i=null;for(;s.length<t;){let a=bt.parse(await this.client.request({contractVersion:b,requestId:Je(),operation:"create-improve/execute",params:{action:"page",query:{profileId:e.profileId??null,targetKind:e.targetKind??null,targetId:e.targetId??null,state:r},before:i,limit:Math.min(50,t-s.length)}}));if(e.conversationId&&a.entries.some(c=>c.scope.conversationId!==e.conversationId))throw new Error("Hosted Create/Improve page crossed its conversation scope.");if(s.push(...a.entries),!a.nextBefore)break;if(a.entries.length===0||i&&(a.nextBefore.updatedAt>i.updatedAt||a.nextBefore.updatedAt===i.updatedAt&&a.nextBefore.id>=i.id))throw new Error("Hosted Create/Improve cursor did not advance.");i=a.nextBefore}return s}async upsertCreateImproveRun(e){let t=H.parse(e),r=`create-improve:${vt("sha256").update(JSON.stringify(t)).digest("hex")}`,s=await this.client.request({contractVersion:b,requestId:r,operation:"create-improve/execute",params:{action:"put",run:t}});return H.parse(o.object({run:o.unknown()}).strict().parse(s).run)}async mutateCreateImproveRun(e,t){let r=xe.parse(e),s=await this.getCreateImproveRun(r.runId);if(!s)throw new Error(`Create/Improve run not found: ${r.runId}`);if(s.appliedActionIds.includes(r.actionId))return{run:s,replayed:!0};if(s.revision!==r.expectedRevision)throw new Error(`Create/Improve run changed from revision ${r.expectedRevision} to ${s.revision}. Refresh and try again.`);let i=H.parse(t(s));if(i.id!==s.id||i.revision!==s.revision+1||!i.appliedActionIds.includes(r.actionId))throw new Error("Create/Improve mutation must preserve identity, advance one revision and record its action.");return St.parse(await this.client.request({contractVersion:b,requestId:r.actionId,operation:"create-improve/execute",params:{action:"mutate",mutation:r,next:i}}))}};import{randomUUID as It}from"node:crypto";async function L(n,e){let t=n;for(;;)try{return await e(t)}catch(r){if(!yt(r)||t<=1)throw r;t=Math.max(1,Math.floor(t/2))}}l(L,"hostedBoundedPage");function yt(n){return n instanceof Error?n.message==="Host storage response is too large."||n.message==="Host storage request failed: host_storage_response_too_large":!1}l(yt,"isOversizeResponse");var Rt=o.object({entries:o.array(o.object({sequence:o.number().int().positive(),event:$})).max(200),totalMatchingEvents:o.number().int().nonnegative(),remainingMatchingEvents:o.number().int().nonnegative()}).strict(),z=class{constructor(e){this.client=e}client;static{l(this,"HostedRuntimeEventStorage")}async runtimeEventsForSession(e,t={}){let r=t.limit==null?1e4:Math.max(0,Math.trunc(t.limit));if(r===0)return[];let s=Math.min(r,1e4),i=[],a=Math.max(0,t.afterSequence??0),c=0,p=t.names?new Set(t.names):null;for(;i.length<=s;){let u=await this.runtimeEventPageRows({sessionId:e,afterSequence:a,beforeSequence:null,limit:Math.min(200,s+1-i.length),excludeReasoningDeltas:t.excludeReasoningDeltas});for(let m of u.entries){if(m.sequence<=a)throw new Error("Host event cursor did not advance.");if(a=m.sequence,c+=1,c>1e4)throw new Error("Hosted runtime event scan exceeds 10,000 rows; use a narrower query.");(!p||p.has(m.event.name))&&i.push(m.event)}if(u.entries.length===0||u.remainingMatchingEvents<=u.entries.length)break}if(i.length>s||t.limit==null&&r===1e4&&i.length===s)throw new Error("Hosted runtime event read exceeds 10,000 rows; use a bounded cursor query.");return i}async persistedRuntimeEventsForSession(e,t={}){return this.runtimeEventsForSession(e,t)}async appendRuntimeEvent(e){let t=$.parse(e),r=await this.client.request({contractVersion:b,requestId:t.id,operation:"event/append",params:{event:t}});return o.object({event:$}).strict().parse(r).event}async runtimeEventPageRows(e){let t=Math.max(1,Math.min(1e3,Math.trunc(e.limit))),r=Math.max(0,Math.trunc(e.afterSequence)),s=e.beforeSequence,i=[],a=0,c=0;for(;i.length<t;){let p=Math.min(200,t-i.length),u=await L(p,async m=>Rt.parse(await this.client.request({contractVersion:b,requestId:`event-page:${It()}`,operation:"events/page",params:{sessionId:e.sessionId,afterSequence:r,beforeSequence:s,limit:m,...e.excludeReasoningDeltas?{excludeReasoningDeltas:!0}:{}}})));if(i.length===0&&(a=u.totalMatchingEvents,c=u.remainingMatchingEvents),i=s===null?[...i,...u.entries]:[...u.entries,...i],u.entries.length===0||u.remainingMatchingEvents<=u.entries.length)break;if(s===null){let m=u.entries.at(-1).sequence;if(m<=r)throw new Error("Host event cursor did not advance.");r=m}else{let m=u.entries[0].sequence;if(m>=s)throw new Error("Host event cursor did not advance.");s=m}}return{entries:i,totalMatchingEvents:a,remainingMatchingEvents:c}}};import{randomUUID as T}from"node:crypto";var ze=o.object({revision:o.number().int().min(1),session:F}).strict(),Ke=o.object({revision:o.number().int().min(1),turn:N}).strict(),Tt=o.object({sessions:o.array(F).max(200),nextAfterId:o.string().min(1).nullable()}).strict(),xt=o.object({turns:o.array(N).max(200),nextBeforeSortIndex:o.number().int().nonnegative().nullable()}).strict(),K=class{constructor(e){this.client=e}client;static{l(this,"HostedSessionStorage")}async count(){let e=await this.client.request({contractVersion:b,requestId:T(),operation:"session/count",params:{}});return o.object({count:o.number().int().nonnegative()}).strict().parse(e).count}async get(e){let t=await this.client.request({contractVersion:b,requestId:T(),operation:"session/get",params:{sessionId:e}});return t===null?null:ze.parse(t)}async sessionCount(){return this.count()}async sessionShells(){let e=[],t=null;do{let r=await L(Math.min(10,1001-e.length),async s=>Tt.parse(await this.client.request({contractVersion:b,requestId:T(),operation:"session/page",params:{afterId:t,limit:s}})));if(e.push(...r.sessions),e.length>1e3)throw new Error("Hosted session list exceeds 1,000 rows; use a scoped page query.");if(r.nextAfterId!==null&&(r.sessions.length===0||t!==null&&r.nextAfterId<=t))throw new Error("Host session cursor did not advance.");t=r.nextAfterId}while(t!==null);return e}async getSession(e){return(await this.get(e))?.session??null}async insertSessionAtFront(e){await this.put({session:e,expectedRevision:null,requestId:T()})}async updateSession(e,t){let r=await this.get(e);if(!r)return null;let s=F.parse(t(r.session));if(s.id!==e)throw new Error("A session update cannot change its identity.");return(await this.put({session:s,expectedRevision:r.revision,requestId:T()})).session}async put(e){let t=F.parse(e.session);return ze.parse(await this.client.request({contractVersion:b,requestId:e.requestId,operation:"session/put",params:{sessionId:t.id,expectedRevision:e.expectedRevision,session:t}}))}async readTurn(e){let t=await this.client.request({contractVersion:b,requestId:T(),operation:"turn/get",params:{turnId:e}});return t===null?null:Ke.parse(t)}async getTurn(e){return(await this.readTurn(e))?.turn??null}async turnsForSession(e,t=50){let r=Math.max(1,Math.min(1e3,Math.trunc(t))),s=[],i=null;for(;s.length<r;){let a=await L(Math.min(200,r-s.length),async c=>xt.parse(await this.client.request({contractVersion:b,requestId:T(),operation:"turn/page",params:{sessionId:e,beforeSortIndex:i,limit:c}})));if(s.push(...a.turns),a.nextBeforeSortIndex===null)break;if(i!==null&&a.nextBeforeSortIndex>=i)throw new Error("Host turn cursor did not advance.");i=a.nextBeforeSortIndex}return s}async countTurnsForSession(e){let t=await this.client.request({contractVersion:b,requestId:T(),operation:"turn/count",params:{sessionId:e}});return o.object({count:o.number().int().nonnegative()}).strict().parse(t).count}async hasSubagentParentWakeTurn(e,t){return await this.wakeCount(e,"messageId",t)>0}async countSubagentParentWakeTurns(e,t){return this.wakeCount(e,"fromRunId",t)}async latestAssistantTextForSession(e){let t=await this.client.request({contractVersion:b,requestId:T(),operation:"events/latestAssistantText",params:{sessionId:e}});return o.object({text:o.string().nullable()}).strict().parse(t).text}async wakeCount(e,t,r){let s=await this.client.request({contractVersion:b,requestId:T(),operation:"turn/wakeCount",params:{sessionId:e,key:t,value:r}});return o.object({count:o.number().int().nonnegative()}).strict().parse(s).count}async latestTurnForSession(e,t){let r=await this.client.request({contractVersion:b,requestId:T(),operation:"turn/latest",params:{sessionId:e,status:t??null}});return r===null?null:N.parse(r)}async latestPersistedTurnForSession(e,t){return this.latestTurnForSession(e,t)}async insertTurn(e){await this.putTurn({turn:e,expectedRevision:null,requestId:T()})}async updateTurn(e,t){let r=await this.readTurn(e);if(!r)return null;let s=N.parse(t(r.turn));if(s.id!==e||s.sessionId!==r.turn.sessionId)throw new Error("A turn update cannot change its identity.");return(await this.putTurn({turn:s,expectedRevision:r.revision,requestId:T()})).turn}async putTurn(e){let t=N.parse(e.turn);return Ke.parse(await this.client.request({contractVersion:b,requestId:e.requestId,operation:"turn/put",params:{sessionId:t.sessionId,turnId:t.id,expectedRevision:e.expectedRevision,turn:t}}))}};import{createHash as Pt,randomUUID as Et}from"node:crypto";var k=o.object({ok:o.literal(!0)}).strict(),Y=o.array(_),kt=o.array(o.string()),Ct=o.object({turnId:o.string(),run:M}).strict(),At=o.object({inputs:o.array(_).max(10),hasMore:o.boolean()}).strict(),Ot=o.object({items:o.array(W).max(10),hasMore:o.boolean()}).strict(),Ht=o.object({items:o.array(o.string()).max(200),hasMore:o.boolean()}).strict();function X(n,e){return`inbox:${n}:${Pt("sha256").update(JSON.stringify(e)).digest("hex")}`}l(X,"retryKey");function Ye(n){if(n.senderKind==="ponder"||n.payload.ponderDesktop!==void 0)throw new Error("A desktop Ponder operation must be admitted on its originating local installation.");return{...n,senderKind:n.senderKind}}l(Ye,"hostedInput");var q=class{constructor(e){this.client=e}client;static{l(this,"HostedTaskInboxStorage")}async call(e,t,r=Et()){let s=await this.client.request({contractVersion:b,requestId:r,operation:"task-inbox/execute",params:e});return t.parse(s)}async inputPages(e,t=Number.MAX_SAFE_INTEGER){let r=[],s=0;for(;r.length<t;){let i=await this.call(e(s),At);for(let a of i.inputs){if(a.sequence<=s)throw new Error("Host task input cursor did not advance.");if(s=a.sequence,r.push(a),r.length>=t)break}if(!i.hasMore)return r;if(i.inputs.length===0)throw new Error("Host task input page made no progress.")}return r}async recoverTaskInboxOwners(e){return this.call({action:"recoverTaskInboxOwners",ownerId:e},o.array(o.object({sessionId:o.string(),turnId:o.string()}).strict()))}async hasTaskCompletion(e){return this.call({action:"hasTaskCompletion",turnId:e},o.boolean())}async taskInboxSnapshot(e){let t=await this.call({action:"taskInboxSnapshot",sessionId:e},Pe),[r,s]=await Promise.all([this.inputPages(i=>({action:"taskInboxSnapshotInputs",sessionId:e,afterSequence:i})),this.taskWaitsForSession(e)]);return{...t,inputs:r,waits:s}}async declareTaskWork(e,t,r,s){await this.call({action:"declareTaskWork",sessionId:e,turnId:t,ownerId:r,areas:s},k)}async taskWorkAreas(e){return this.call({action:"taskWorkAreas",sessionId:e},kt)}async admitTaskInput(e){return this.call({action:"admitTaskInput",input:Ye(e)},_)}async admitTaskInputs(e){return this.call({action:"admitTaskInputs",inputs:e.map(Ye)},Y)}async rejectTaskInput(e,t){await this.call({action:"rejectTaskInput",id:e,error:t},k)}async getTaskInput(e){return this.call({action:"getTaskInput",id:e},_.nullable())}async taskInputsForSession(e,t={}){let r=Math.max(1,Math.min(500,t.limit??128)),s=[],i=t.afterSequence??0;for(;s.length<r;){let a=Math.min(10,r-s.length),c=await this.call({action:"taskInputsForSession",sessionId:e,query:{afterSequence:i,pendingOnly:t.pendingOnly,limit:a}},Y);if(!c.length)break;for(let p of c){if(p.sequence<=i)throw new Error("Host task input cursor did not advance.");i=p.sequence,s.push(p)}if(c.length<a)break}return s}async mutateTaskInput(e,t,r){return this.call({action:"mutateTaskInput",sessionId:e,inputId:t,change:r},_,X("mutate",{sessionId:e,inputId:t,change:r}))}async openTaskInboxTurn(e,t,r){await this.call({action:"openTaskInboxTurn",sessionId:e,turnId:t,ownerId:r},k,X("open",{sessionId:e,turnId:t,ownerId:r}))}async renewTaskInboxTurn(e,t,r){await this.call({action:"renewTaskInboxTurn",sessionId:e,turnId:t,ownerId:r},k)}async pendingTaskInputs(e,t){return this.inputPages(r=>({action:"pendingTaskInputs",sessionId:e,turnId:t,afterSequence:r}))}async taskAssignmentInputs(e){return this.inputPages(t=>({action:"taskAssignmentInputs",turnId:e,afterSequence:t}))}async pauseTaskInboxTurn(e,t,r){await this.call({action:"pauseTaskInboxTurn",sessionId:e,turnId:t,ownerId:r},k)}async includeTaskInputs(e,t,r,s){return this.call({action:"includeTaskInputs",sessionId:e,turnId:t,ownerId:r,requestId:s},Y,X("include",{sessionId:e,turnId:t,ownerId:r,requestId:s}))}async settleTaskInputRequest(e,t){await this.call({action:"settleTaskInputRequest",requestId:e,outcome:t},k)}async sealTaskInboxTurn(e,t,r){return this.call({action:"sealTaskInboxTurn",sessionId:e,turnId:t,ownerId:r},o.boolean())}async sealNativeTaskInboxTurn(e,t,r){return this.call({action:"sealNativeTaskInboxTurn",sessionId:e,turnId:t,ownerId:r},Y)}async closeTaskInboxTurn(e,t,r,s){await this.call({action:"closeTaskInboxTurn",sessionId:e,turnId:t,ownerId:r,outcome:s},k)}async taskInboxPaused(e){return this.call({action:"taskInboxPaused",sessionId:e},o.boolean())}async reserveTaskFollowup(e,t,r){return this.call({action:"reserveTaskFollowup",sessionId:e,turnId:t,ownerId:r},_.nullable(),X("reserve",{sessionId:e,turnId:t,ownerId:r}))}async taskInboxWakeTargets(){let e=[],t="";for(;;){let r=await this.call({action:"taskInboxWakeTargets",afterSessionId:t},Ht);for(let s of r.items){if(s<=t)throw new Error("Host task wake cursor did not advance.");t=s,e.push(s)}if(!r.hasMore)return e;if(!r.items.length)throw new Error("Host task wake page made no progress.")}}async createTaskWait(e){return this.call({action:"createTaskWait",value:e},W)}async settleTaskWait(e,t){return this.call({action:"settleTaskWait",id:e,state:t},W)}async taskWaitsForSession(e){let t=[],r="";for(;;){let s=await this.call({action:"taskWaitsForSession",sessionId:e,afterId:r},Ot);for(let i of s.items){if(i.id<=r)throw new Error("Host task wait cursor did not advance.");r=i.id,t.push(i)}if(!s.hasMore)return t;if(!s.items.length)throw new Error("Host task wait page made no progress.")}}async commitSubagentCompletion(e,t){await this.call({action:"commitSubagentCompletion",value:e,turnId:t},k)}async pendingTaskCompletions(e=""){let t=[],r=e;for(;t.length<100;){let s=await this.call({action:"pendingTaskCompletions",afterTurnId:r},o.array(Ct).max(10));for(let i of s){if(i.turnId<=r)throw new Error("Host task completion cursor did not advance.");r=i.turnId,t.push(i)}if(s.length<10)break}return t}async settleTaskCompletion(e,t){await this.call({action:"settleTaskCompletion",turnId:e,inputId:t},k)}async upsertSubagentRun(e){return this.call({action:"upsertSubagentRun",value:M.parse(e)},M)}async getSubagentRun(e){return this.call({action:"getSubagentRun",id:e},M.nullable())}async listSubagentRuns(e={}){let r=[],s="",i=e.status?Array.isArray(e.status)?[...e.status]:[e.status]:null;for(;;){let a=await this.call({action:"listSubagentRuns",query:{parentSessionId:e.parentSessionId,childSessionId:e.childSessionId,status:i,afterId:s,limit:10}},o.array(M).max(10));for(let c of a){if(c.id<=s)throw new Error("Host subagent run cursor did not advance.");if(s=c.id,r.push(c),r.length>1e3)throw new Error("Hosted subagent run list exceeds 1,000 rows; use a narrower session or status query.")}if(a.length<10)break}return r.sort((a,c)=>(c.updatedAt??c.createdAt).localeCompare(a.updatedAt??a.createdAt)),e.limit===void 0?r:r.slice(0,Math.max(1,Math.min(1e3,e.limit)))}async listActiveSubagentRuns(e={}){return this.listSubagentRuns({...e,status:e.status??["queued","running","needs_resume"]})}};var se=class extends q{static{l(this,"HostedTurnRepository")}sessions;events;approvals;usage;createImprove;constructor(e){super(e),this.sessions=new K(e),this.events=new z(e),this.approvals=new Ne(e),this.usage=new qe(e),this.createImprove=new J(e)}sessionShells(){return this.sessions.sessionShells()}sessionCount(){return this.sessions.sessionCount()}getSession(e){return this.sessions.getSession(e)}insertSessionAtFront(e){return this.sessions.insertSessionAtFront(e)}updateSession(e,t){return this.sessions.updateSession(e,t)}getTurn(e){return this.sessions.getTurn(e)}insertTurn(e){return this.sessions.insertTurn(e)}updateTurn(e,t){return this.sessions.updateTurn(e,t)}latestTurnForSession(e,t){return this.sessions.latestTurnForSession(e,t)}latestPersistedTurnForSession(e,t){return this.sessions.latestPersistedTurnForSession(e,t)}turnsForSession(e,t){return this.sessions.turnsForSession(e,t)}countTurnsForSession(e){return this.sessions.countTurnsForSession(e)}hasSubagentParentWakeTurn(e,t){return this.sessions.hasSubagentParentWakeTurn(e,t)}countSubagentParentWakeTurns(e,t){return this.sessions.countSubagentParentWakeTurns(e,t)}latestAssistantTextForSession(e){return this.sessions.latestAssistantTextForSession(e)}appendRuntimeEvent(e){return this.events.appendRuntimeEvent(e)}runtimeEventsForSession(e,t){return this.events.runtimeEventsForSession(e,t)}persistedRuntimeEventsForSession(e,t){return this.events.persistedRuntimeEventsForSession(e,t)}async runtimeEventsForTurn(e,t){let r=await this.getTurn(e);if(!r)return[];let s=(await this.events.runtimeEventsForSession(r.sessionId)).filter(i=>i.turnId===e&&(!t?.names||t.names.includes(i.name)));return t?.limit==null?s:s.slice(0,Math.max(0,t.limit))}runtimeEventPageRows(e){return this.events.runtimeEventPageRows(e)}getApproval(e){return this.approvals.getApproval(e)}async upsertApproval(e){let t=await this.approvals.readApproval(e.id);t&&JSON.stringify(t.approval)===JSON.stringify(e)||await this.approvals.putApproval({approval:e,expectedRevision:t?.revision??null,requestId:`approval:${_t("sha256").update(JSON.stringify({approval:e,revision:t?.revision??null})).digest("hex")}`})}upsertModelUsageRecord(e){return this.usage.upsertModelUsageRecord(e)}listModelUsageRecords(e){return this.usage.listModelUsageRecords(e)}getCreateImproveRun(e){return this.createImprove.getCreateImproveRun(e)}listCreateImproveRuns(e){return this.createImprove.listCreateImproveRuns(e)}upsertCreateImproveRun(e){return this.createImprove.upsertCreateImproveRun(e)}mutateCreateImproveRun(e,t){return this.createImprove.mutateCreateImproveRun(e,t)}};function Xe(n){return new se(n)}l(Xe,"createHostedRuntimeCoreStorage");function oe(n=process.env){let e=n.OPENPOND_API_KEY?.trim(),t=n.OPENPOND_OPCHAT_API_URL?.trim(),r=n.OPENPOND_HOSTED_MODEL_ID?.trim();if(!e||!t||!r)throw new Error("Hosted model stream requires a host credential, API URL, and admitted model.");let s=new URL(t);if(s.protocol!=="https:"||s.username||s.password||s.search||s.hash)throw new Error("Hosted model stream API URL is invalid.");return l(async function*(a){if(a.model!==r)throw new Error("Hosted model selection changed outside host admission.");yield*Ee({...a,apiBaseUrl:s.toString(),token:e,model:r})},"streamHostedModel")}l(oe,"createHostedModelStreamFromEnvironment");import{existsSync as Ut}from"node:fs";import{lstat as Mt,readFile as Nt,realpath as qt}from"node:fs/promises";import y from"node:path";import{fileURLToPath as Dt}from"node:url";var Ze=y.dirname(Dt(import.meta.url));function I(n,e,t){let r=n[e+1];if(!r||r.startsWith("--"))throw new Error(`${t} requires a value.`);return r}l(I,"requireValue");function Qe(n,e){let t=Number.parseInt(n,10);if(!Number.isFinite(t)||t<0||t>65535)throw new Error(`${e} must be a port from 0 to 65535.`);return t}l(Qe,"parsePort");function rt(n){let e="serve",t=Q,r=17874,s=null,i=!1,a=!1,c=null,p,u=!1,m,w,R,C=null,f=null,h=null,S=null,x,v="sqlite_bundle",A=0,E=n[0];if(E&&!E.startsWith("-")){if(E==="serve"||E==="server")e="serve";else if(E==="app-server")e="app-server";else if(E==="web")e="web";else{if(E==="help")return{mode:e,host:t,port:r,webRoot:s,openBrowser:i,printAccessUrl:a,storeDir:c,runtimeStorage:v,help:!0};throw new Error(`Unknown command: ${E}`)}A=1}for(let g=A;g<n.length;g+=1){let d=n[g];if(d==="--help"||d==="-h")return{mode:e,host:t,port:r,webRoot:s,openBrowser:i,printAccessUrl:a,storeDir:c,runtimeStorage:v,help:!0};if(d==="--listen"){let O=Oe(I(n,g,d));t=O.host,r=Qe(String(O.port),d),g+=1}else if(d==="--hostname"||d==="--host")t=I(n,g,d),g+=1;else if(d==="--port")r=Qe(I(n,g,d),d),g+=1;else if(d==="--web-root")s=y.resolve(I(n,g,d)),g+=1;else if(d==="--source-browser-state")R=y.resolve(I(n,g,d)),g+=1;else{if(d==="--store-dir")throw new Error("--store-dir has been replaced by --home. Use --home <directory> or OPENPOND_HOME.");if(d==="--home")c=y.resolve(I(n,g,d)),g+=1;else if(d==="--hosted-cache-home")p=y.resolve(I(n,g,d)),g+=1;else if(d==="--experiment-owner")u=!0;else if(d==="--experiment-harness-package"){if(m)throw new Error("Duplicate Experiment Harness source package.");m=y.resolve(I(n,g,d)),g+=1}else if(d==="--runtime-storage"){if(I(n,g,d)!=="hosted-postgres")throw new Error("Unsupported app-server runtime storage.");v="hosted_postgres",g+=1}else if(d==="--profile-external-dataset-package"){if(w)throw new Error("Duplicate private external Dataset package.");w=y.resolve(I(n,g,d)),g+=1}else if(d==="--profile-source-root")C=y.resolve(I(n,g,d)),g+=1;else if(d==="--profile-repository-id")f=I(n,g,d),g+=1;else if(d==="--profile-id")h=I(n,g,d),g+=1;else if(d==="--profile-revision")S=I(n,g,d),g+=1;else if(d==="--hosted-profile-release"){if(x)throw new Error("Duplicate hosted Profile release descriptor.");let O=I(n,g,d);if(O.length>16e3||!/^[A-Za-z0-9_-]+$/.test(O))throw new Error("Invalid hosted Profile release descriptor.");try{x=Me.parse(JSON.parse(Buffer.from(O,"base64url").toString("utf8")))}catch{throw new Error("Invalid hosted Profile release descriptor.")}g+=1}else if(d==="--open-browser")i=!0;else if(d==="--print-access-url")a=!0;else throw new Error(`Unknown option: ${d}`)}}if(i&&a)throw new Error("--open-browser and --print-access-url cannot be used together.");if(e!=="web"&&(i||a))throw new Error("Browser options are only available in web mode.");let D=[C,f,h,S].filter(Boolean).length;if(D&&(D!==4||e!=="app-server"))throw new Error("Profile source flags require app-server mode and --profile-source-root, --profile-repository-id, --profile-id, and --profile-revision together.");if(v==="hosted_postgres"&&(e!=="app-server"||c||D))throw new Error("Hosted Postgres app-server cannot use --home or local Profile source flags.");if(x&&v!=="hosted_postgres")throw new Error("Hosted Profile release requires hosted Postgres app-server mode.");if(p&&v!=="hosted_postgres")throw new Error("Hosted cache home requires hosted Postgres mode.");if(u&&(e!=="app-server"||v!=="sqlite_bundle"||D||!c))throw new Error("Experiment owner mode requires an isolated app-server home without Profile selection.");if(m&&(!u||y.dirname(m)!==c))throw new Error("Experiment Harness source must be provisioned directly inside its isolated owner home.");return{mode:e,host:t,port:r,webRoot:s,openBrowser:i,printAccessUrl:a,storeDir:c,runtimeStorage:v,sourceBrowserState:R,...w?{profileExternalDatasetPackage:w}:{},...D?{profileSource:{repoPath:C,repositoryId:f,profileId:h,sourceRevision:S}}:{},...x?{admittedProfileRelease:x}:{},...p?{hostedCacheHome:p}:{},...u?{experimentOwner:!0}:{},...m?{experimentHarnessPackage:m}:{},help:!1}}l(rt,"parseCliArgs");function Bt(){return[process.env.OPENPOND_WEB_ROOT,y.resolve(process.cwd(),"apps/web/dist"),y.resolve(Ze,"../../web/dist"),y.resolve(process.cwd(),"web"),y.resolve(Ze,"../web")].filter(n=>!!n)}l(Bt,"defaultWebRootCandidates");function Ft(n){let e=n?[n]:Bt();for(let t of e){let r=y.resolve(t);if(Ut(y.join(r,"index.html")))return r}return null}l(Ft,"resolveWebRoot");function jt(n){let e=n==="0.0.0.0"||n==="::"?"127.0.0.1":n;return e.includes(":")&&!e.startsWith("[")?`[${e}]`:e}l(jt,"formatHostForUrl");function Lt(n){return`http://${jt(n.status.host)}:${n.status.port}`}l(Lt,"browserBaseUrl");function Vt(n,e){let t=new URL(n),r=new URLSearchParams;return r.set("openpondServerUrl",n),r.set("openpondToken",e),t.hash=r.toString(),t.toString()}l(Vt,"tokenizedWebUrl");async function et(n,e=Ce){let t=Vt(n.baseUrl,n.token);if(n.printAccessUrl)return{stdout:[`OpenPond access URL: ${t}`],stderr:[]};if(!n.openBrowser)return{stdout:[`OpenPond web UI: ${n.baseUrl}`],stderr:[]};let r=await e(t);return r.opened?{stdout:[`Opened OpenPond in your browser: ${n.baseUrl}`],stderr:[]}:{stdout:[`OpenPond access URL: ${t}`],stderr:[`Could not open the system browser: ${r.error}`]}}l(et,"resolveWebLaunchMessages");function nt(){console.log(`Usage:
|
|
24
|
+
openpond-app-server serve [--hostname HOST] [--port PORT]
|
|
25
|
+
openpond-app-server app-server [--home DIR]
|
|
26
|
+
openpond-app-server web [--hostname HOST] [--port PORT] [--web-root DIR]
|
|
27
|
+
|
|
28
|
+
Options:
|
|
29
|
+
--listen HOST:PORT Set host and port together
|
|
30
|
+
--hostname HOST Bind host (default ${Q})
|
|
31
|
+
--port PORT Bind port, or 0 for any free port (default ${17874})
|
|
32
|
+
--web-root DIR Directory containing the built web UI for web mode
|
|
33
|
+
--home DIR Local app-server state directory
|
|
34
|
+
--runtime-storage hosted-postgres Host-admitted Postgres app-server mode
|
|
35
|
+
--hosted-profile-release BASE64URL Host-admitted immutable Profile release descriptor
|
|
36
|
+
--profile-source-root DIR Authorized Profile repository source for app-server
|
|
37
|
+
--profile-repository-id ID Source repository identity supplied by the host
|
|
38
|
+
--profile-id ID Profile within that source
|
|
39
|
+
--profile-revision REV Accepted immutable source revision
|
|
40
|
+
--open-browser Open the authenticated web URL in the system browser
|
|
41
|
+
--print-access-url Print the authenticated URL instead of opening it
|
|
42
|
+
`)}l(nt,"printHelp");async function bn(n){let e=rt(process.argv.slice(2));if(e.help){nt();return}let t=e.mode==="web"?Ft(e.webRoot):null;if(e.mode==="web"&&!t)throw new Error("Could not find a built OpenPond web UI. Run `pnpm build:web` or pass --web-root.");if(e.mode==="app-server"){await st(n.createOpenPondAppServer,e.storeDir,e.profileSource,e.runtimeStorage,e.admittedProfileRelease,e.hostedCacheHome,e.experimentOwner,e.experimentHarnessPackage,e.profileExternalDatasetPackage);return}e.storeDir&&(process.env.OPENPOND_HOME=e.storeDir);let r,s=e.port;for(;;)try{r=await n.createOpenPondServer({host:e.host,port:s,webRoot:t,sourceBrowserState:e.sourceBrowserState,...e.storeDir?{storeDir:e.storeDir}:{},httpEnabled:!0});break}catch(p){if(!We(p))throw p;let u=await Ge(le({home:e.storeDir??void 0}),s,p);s=u.port,console.log(`OPENPOND_APP_SERVER_READY ${JSON.stringify({mode:"recovery",url:u.url,tokenFile:u.tokenFile,storePath:u.storePath})}`),console.error(`${p.issue.code}: ${p.issue.message} ${p.issue.action}`);let m=await et({baseUrl:u.url,openBrowser:e.openBrowser,printAccessUrl:e.printAccessUrl,token:u.token});for(let R of m.stdout)console.log(R);for(let R of m.stderr)console.error(R);let w=l(()=>{u.close().finally(()=>process.exit(0))},"close");process.once("SIGINT",w),process.once("SIGTERM",w);try{await u.repaired}finally{process.off("SIGINT",w),process.off("SIGTERM",w),await u.close()}}let i=e.mode==="web"?Lt(r):null;if(console.log(`OPENPOND_APP_SERVER_READY ${JSON.stringify({mode:e.mode,url:r.url,webUrl:null,webRoot:t,tokenFile:r.tokenFile,storePath:r.storePath,runtime:ke()})}`),i){let p=await et({baseUrl:i,openBrowser:e.openBrowser,printAccessUrl:e.printAccessUrl,token:r.token});for(let u of p.stderr)console.error(u);for(let u of p.stdout)console.log(u)}else console.log(`OpenPond API server: ${r.url}`);let a=!1,c=l(async()=>{a||(a=!0,await r.close(),process.exit(0))},"shutdown");process.on("SIGINT",()=>{c()}),process.on("SIGTERM",()=>{c()}),await new Promise(()=>{})}l(bn,"runOpenPondServerCli");async function Sn(n){let e=process.argv.slice(2),t=rt(!e[0]||e[0].startsWith("-")?["app-server",...e]:e);if(t.help){nt();return}if(t.mode!=="app-server")throw new Error("The app-server entrypoint only accepts the app-server command.");await st(n,t.storeDir,t.profileSource,t.runtimeStorage,t.admittedProfileRelease,t.hostedCacheHome,t.experimentOwner,t.experimentHarnessPackage,t.profileExternalDatasetPackage)}l(Sn,"runOpenPondAppServerCli");async function st(n,e,t,r="sqlite_bundle",s,i,a=!1,c,p){let u=new Te;if(r==="hosted_postgres"){if(e||t)throw new Error("Hosted Postgres app-server cannot use local storage sources.");let f=p?await(i&&s?.hostExecution&&!a?te(p,i):Promise.reject(new Error("External Dataset requires its private hosted evaluation owner."))):void 0;await ee({appServer:l(()=>n({...i?{storeDir:i}:{},hostStorageClient:u,...f?{profileExternalDataset:f}:{},runtimeStorage:{kind:"hosted_postgres",client:u,core:Xe(u),inbox:new q(u),...s?{admittedProfileRelease:s}:{}},streamOpenPondHostedChatTurn:oe()}),"appServer"),readable:process.stdin,writable:process.stdout,hostStorageClient:u});return}e&&(process.env.OPENPOND_HOME=e);let m;if(c){if(!a||!e||y.dirname(c)!==e||await qt(c)!==c)throw new Error("Experiment Harness source escaped its isolated owner home.");let f=await Mt(c);if(!f.isFile()||f.size>67108864)throw new Error("Experiment Harness source package is not a bounded regular file.");m={ownerId:"host-experiment-case",sourcePackage:ie(JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(await Nt(c))))}}let w=p?await(e&&t&&!a?te(p,e):Promise.reject(new Error("External Dataset bootstrap requires a private explicit Profile owner."))):void 0,R=w?oe():void 0,C=await n({...e?{storeDir:e}:{},...t?{profileSource:t}:{},...w?{profileExternalDataset:w,profileExternalDatasetClient:u,streamOpenPondHostedChatTurn:l(async function*(f){let h=l(async()=>{await u.request({contractVersion:1,requestId:crypto.randomUUID(),operation:"profile.externalDataset.authorize",params:{bindingHash:w.binding.contentHash}})},"fence");await h();let S=new AbortController,x=!1,v=setInterval(()=>{x||S.signal.aborted||(x=!0,h().catch(A=>S.abort(A)).finally(()=>{x=!1}))},2e3);try{let A=AbortSignal.any([...f.signal?[f.signal]:[],S.signal]);A.throwIfAborted();for await(let E of R({...f,signal:A}))await h(),A.throwIfAborted(),yield E}finally{clearInterval(v),S.abort()}},"streamOpenPondHostedChatTurn"),services:{webSearch:!1,scheduling:!1,connectedApps:!1,tasksets:!1,projectActions:!1,profileActions:!1,backgroundReview:!1}}:{},...m?{experimentHarnessSource:m}:{},...a?{experimentPolicyClient:u,services:{webSearch:!1,scheduling:!1,connectedApps:!1,tasksets:!1,projectActions:!1,profileActions:!1,backgroundReview:!1}}:{},hostStorageClient:u});await ee({appServer:C,readable:process.stdin,writable:process.stdout,hostStorageClient:u})}l(st,"runAgentServer");export{De as a,j as b,je as c,P as d,Kt as e,Yt as f,re as g,Le as h,et as i,bn as j,Sn as k};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as k}from"./chunk-I2NXNMRZ.js";import{f as m}from"./chunk-O72BSKSO.js";import{f as d}from"./chunk-XDQMGUWL.js";import{m as c}from"./chunk-KGNCKIFP.js";import{a as n}from"./chunk-FTQLQJQV.js";import h from"node:path";async function b(o){let{taskset:a}=o,{taskset:f,modelResources:p,learningResources:l}=o.content,u=new Set([...p?.assets??[],...l?.assets??[]].map(e=>e.id)),i=new Map,r=n((e,s=e.path)=>{if(u.has(e.id))return;let t=i.get(e.id);if(t&&(c(t.asset)!==c(e)||t.sourcePath!==s))throw new Error(`Conflicting local Taskset file reference: ${e.id}.`);i.set(e.id,{asset:e,sourcePath:s})},"add");for(let e of d.parse(a.metadata.portableFileInventory??[]))r(e.asset,e.sourcePath);for(let e of f.tasks){let s=a.tasks.find(t=>t.id===e.id);for(let t of e.artifactRefs)r(t,s?.assets?.find(g=>g.id===t.id)?.artifactRef??t.path);for(let t of e.requiredOutputs??[])t.schemaRef&&r(t.schemaRef)}for(let e of f.graders){let s=a.graders.find(t=>t.id===e.id);"verifierRef"in e&&r(e.verifierRef,s?.kind==="custom_verifier"?s.module:e.verifierRef.path),"rubricRef"in e&&r(e.rubricRef)}return m({root:h.join(o.storeDir,"training","tasksets",k(a)),content:o.content,sources:[...i.values()]})}n(b,"captureAuthoredModelTasksetPackage");export{b as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as we}from"./chunk-HCYX6RHP.js";import{j as Te,n as ne}from"./chunk-XDQMGUWL.js";import{C as ke,D as ve}from"./chunk-FTEOCCPB.js";import{Fb as X,Gb as he,Mb as Re,N as pe,P as fe,Q as z,T as Q,U as te,V as ue,W as me,ma as ge,ua as A,xa as ae}from"./chunk-25MBPJVY.js";import{D as U,K as F,i as u,n as q,t as le,x as B}from"./chunk-523TE4BI.js";import{$ as ce,N as R,O as E,P as $,Q as b,d as V,ib as W}from"./chunk-VYLGI3IH.js";import{Ea as ee,Ka as oe,La as de,qa as G,za as ie}from"./chunk-ACYFMLWG.js";import{a as m}from"./chunk-FTQLQJQV.js";import{createHash as Me}from"node:crypto";function w(e,n,a,s){let t=W[a].parse(s),r=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[n,a,t.id,t.revision]);if(r){if(u(JSON.parse(r.payload))!==u(t))throw new Error(`Starter dependency conflicts with an existing revision: ${t.id}.`);return}e.run("INSERT INTO learning_revisions (scope, kind, id, revision, payload) VALUES (?, ?, ?, ?, ?)",[n,a,t.id,t.revision,JSON.stringify(t)]),e.run(`INSERT INTO learning_resources (scope, kind, id, revision) VALUES (?, ?, ?, ?)
|
|
3
|
+
ON CONFLICT (scope, kind, id) DO UPDATE SET revision = excluded.revision
|
|
4
|
+
WHERE learning_resources.revision < excluded.revision`,[n,a,t.id,t.revision])}m(w,"importStarterReleaseInTransaction");function Se(e,n,a){function s(o,d){let g=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[n,o,d.id,d.revision]);g||C(404,"model_reward_unavailable",`The exact ${o} resource is unavailable in this Profile.`);let l=W[o].parse(JSON.parse(g.payload));return b(l),d.contentHash&&l.contentHash!==d.contentHash&&C(409,"model_reward_changed","The selected resource does not match its immutable content hash."),l}m(s,"read");let t=s("binding",a),r=[...new Map(t.sources.map(o=>[u(o.reward),s("reward",o.reward)])).values()],i=new Map;for(let o of r){let d=o.implementation;for(let g of[...o.assets,..."verifierRef"in d?[d.verifierRef]:[],..."rubricRef"in d?[d.rubricRef]:[],..."inputContract"in d?[d.inputContract]:[]])i.has(g.id)||i.set(g.id,s("asset",{id:g.id,revision:1})),V(i.get(g.id),g)}return{rewardBinding:t,rewards:r,assets:[...i.values()]}}m(Se,"readSelectedModelReward");function Y(e,n,a,s){let t=q.parse(n.metadata.rewardBinding),r=m((c,f)=>{let D=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[n.profileId,c,f.id,f.revision]);D||C(404,"model_reward_unavailable",`The exact ${c} resource is unavailable in this Profile.`);let k=W[c].parse(JSON.parse(D.payload));return b(k),f.contentHash&&k.contentHash!==f.contentHash&&C(409,"model_reward_changed","The selected resource does not match its immutable content hash."),k},"read"),i=r("definition",q.parse(n.metadata.taskDefinition));(u(n.policy)!==u(i.execution.policy)||u(n.environment.metadata.portableEnvironment)!==u(i.execution.environment)||u(n.environment.metadata.portableTools)!==u(i.execution.tools))&&C(409,"model_taskset_context_changed","Taskset context differs from its immutable task definition.");let o=r("binding",t),d=[...new Map(o.sources.map(c=>[u(c.reward),r("reward",c.reward)])).values()];n.metadata.rewardExecution!==void 0&&u(n.metadata.rewardExecution)!==u({binding:o,rewards:d})&&C(409,"model_taskset_rewards_changed","Taskset embedded Rewards differ from their immutable binding.");let g=r("binding",a),l=[...new Map(g.sources.map(c=>[u(c.reward),r("reward",c.reward)])).values()],T=new Map((s?.modelResources?.assets??[]).map(c=>[c.id,c])),v=m(c=>{T.has(c)||T.set(c,r("asset",{id:c,revision:1}))},"addAsset");for(let c of[...d,...l]){let f=c.implementation;for(let D of[...c.assets,..."verifierRef"in f?[f.verifierRef]:[],..."rubricRef"in f?[f.rubricRef]:[],..."inputContract"in f?[f.inputContract]:[]])v(D.id)}let h,S=ue.shape.executionResources.parse(n.environment.metadata.portableExecutionResources);if(i.execution.environment.entrypoint==="openpond.javascript-environment.v1"){let c=r("asset",{id:fe(i.execution),revision:1});h=pe.parse(JSON.parse(V(c,c.asset)));for(let f of[h.javascript.module,h.environment.actionSchemaRef,h.environment.observationSchemaRef,h.environment.stateSchemaRef])f&&v(f.id)}for(let c of n.tasks)c.privilegedContextRef&&v(c.privilegedContextRef);u(n.graders)!==u(X(o,d,[...T.values()]))&&C(409,"model_taskset_graders_changed","Taskset graders differ from their immutable Reward binding.");let x=G.parse($({schemaVersion:"openpond.tasksetRelease.v2",id:n.id,revision:n.revision,...i.execution,graders:de(o,d),...n.metrics?{metrics:n.metrics}:{},tasks:n.tasks.map(c=>{let f=Re(c);return c.requiredOutputs===void 0&&c.metadata.portableTaskRecord===void 0&&delete f.requiredOutputs,f}),metadata:n.metadata.derivedPortableMetadata??{localSource:R(n),starter:{taskDefinition:R(i),rewardBinding:t}}}));return{sourcePackage:s?{...s.modelResources,taskset:s.taskset,executionResources:{environment:s.environment,verifierSet:s.verifierSet}}:{taskset:x,taskDefinition:i,rewardBinding:o,rewards:d,assets:[...T.values()],...S?{executionResources:S}:{},...h?{execution:h}:{}},selectedBinding:g,selectedRewards:l,assets:T}}m(Y,"readModelTasksetSource");function C(e,n,a){throw new F(e,{schemaVersion:"openpond.modelProjectApiError.v2",code:n,message:a,retryable:!1,requestId:null,details:{}})}m(C,"fail");function se(e){if(e?.metadata.learning===void 0)return null;let n=ce.parse(e.metadata.learning);return b(n.definition),oe(n.binding,n.rewards),E(n.definition.rewardBinding,R(n.binding))||O(409,"model_batch_binding_changed","Reviewed task definition and Reward binding do not match."),n.binding}m(se,"reviewedTasksetRewardBinding");function rt(e,n,a=!0,s){let t=U(n),{project:r}=t,i=e.get("SELECT payload FROM model_projects WHERE id = ?",[r.id]),o=i?B.parse(JSON.parse(i.payload)):null;o&&o.profileId!==r.profileId&&O(404,"model_not_found","Model is not available in this Profile."),(o?.revision??0)!==t.expectedRevision&&O(409,"model_revision_conflict","Model changed since it was opened. Refresh before saving.");let d=r.trainingSetup.tasksetRef;if(!d||!r.trainingSetup.rewardBindingRef)return null;let g=e.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[d.id,d.revision]),l=g?A.parse(JSON.parse(g.payload)):null;(!l||l.profileId!==r.profileId)&&O(404,"model_taskset_not_found","The selected Taskset revision is not available in this Profile."),(l.contentHash!==d.contentHash||ae(l)!==l.contentHash)&&O(409,"model_taskset_changed","The selected Taskset does not match its immutable content hash.");let T=se(l);if(T)return E(R(T),r.trainingSetup.rewardBindingRef)||O(422,"model_batch_reward_review_required","Changing a reviewed batch's Reward requires regrading and a new reviewed batch."),null;let v=l.metadata.rewardBinding===void 0?null:q.parse(l.metadata.rewardBinding);if(v&&E(v,r.trainingSetup.rewardBindingRef))return null;if(!v&&s&&!s.modelResources&&!s.learningResources){let p=Se(e,r.profileId,r.trainingSetup.rewardBindingRef),_=Te({owner:{scopeId:r.profileId,modelId:r.id},source:s,...p}),M=_e(e,t,a),I=ne({package:_,profileId:r.profileId,name:l.name,createdAt:M.created_at}),H={..._.modelResources,taskset:_.taskset,executionResources:{environment:_.environment,verifierSet:_.verifierSet}};return{taskset:I.taskset,generatedFiles:I.generatedFiles,directoryId:String(I.taskset.environment.metadata.runtimeSourceTasksetId),source:l,sourcePackage:null,derived:H,imported:I}}v||O(422,"model_taskset_derivation_unavailable","This Taskset needs an authored task definition and Reward binding before its Reward can be changed.");let{sourcePackage:h,selectedBinding:S,selectedRewards:x,assets:y}=Y(e,l,r.trainingSetup.rewardBindingRef,s),c=te.safeParse(h.taskset.metadata.modelTasksetDerivation),D=o?.hosted?.apiOrigin&&o.hosted.tasksets.some(p=>{if(!c.success||p.localTasksetId!==l.id||!p.packageHash||!p.localTasksetHash)return!1;let _=e.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND content_hash = ? AND profile_id = ?",[l.id,p.localTasksetHash,r.profileId]),M=_?A.parse(JSON.parse(_.payload)):null;if(!M||M.contentHash!==p.localTasksetHash)return!1;let I=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = 'package' AND id = ? AND revision = ?",[r.profileId,p.releaseId,p.releaseRevision]),H=I?G.parse(JSON.parse(I.payload)):null,N=te.safeParse(H?.metadata.modelTasksetDerivation);return H?.contentHash===p.releaseHash&&N.success&&u(N.data.owner)===u(c.data.owner)&&E(N.data.root,c.data.root)})&&c.success&&c.data.owner.modelId===r.id?c.data.owner:{scopeId:r.profileId,modelId:r.id},k=me({owner:D,source:h,rewardBinding:S,rewards:x,assets:[...y.values()]}),K=_e(e,t,a);if(s){let p=new Map(s.files.map(L=>[L.asset.id,L]));for(let L of k.assets)p.set(L.id,{asset:L.asset,base64:Buffer.from(L.text).toString("base64")});let{taskset:_,executionResources:M,...I}=k;if(!M)throw new Error("Derived imported package is missing execution resources.");let H=ge({schemaVersion:"openpond.tasksetPackage.v1",taskset:_,...M,modelResources:I,files:[...p.values()]}),N=ne({package:H,profileId:r.profileId,name:l.name,createdAt:K.created_at});return{taskset:N.taskset,generatedFiles:N.generatedFiles,directoryId:String(N.taskset.environment.metadata.runtimeSourceTasksetId),source:l,sourcePackage:h,derived:k,imported:N}}let re=`${k.taskset.id}-r${k.taskset.revision}-${$({packageHash:k.taskset.contentHash,preparedAt:K.created_at}).contentHash}`,j=ke(l,K.created_at),ye=new Map(k.taskset.tasks.map(p=>[p.id,p])),Z=[];for(let p of k.taskset.graders)if(p.kind==="custom_verifier"){let _=he(p.verifierRef.contentHash);Z.some(M=>M.path===_)||Z.push({path:_,role:"verifier",content:V(y.get(p.verifierRef.id),p.verifierRef)})}let J=ve({tasksetId:k.taskset.id,now:K.created_at,sourcePackageHash:k.taskset.contentHash,draft:{...j,policy:k.taskset.policy,tasks:j.tasks.map(p=>({...p,metadata:{...p.metadata,portableTaskRecord:ye.get(p.id)}})),environment:{...j.environment,metadata:{...j.environment.metadata,runtimeSourceTasksetId:re,portableExecutionResources:k.executionResources}},graders:X(S,x,[...y.values()]),learningSignals:{...j.learningSignals,rewards:j.learningSignals.rewards.map(p=>({...p,rules:[{id:S.id,points:1,condition:"Execute the published Reward binding with its declared normalization, weights and required gates."}],artifactRef:S.id,metadata:{...p.metadata,rewardBinding:R(S)}}))},metadata:{...j.metadata,portableCapabilities:k.taskset.capabilities,taskDefinition:R(k.taskDefinition),rewardBinding:R(S),rewardExecution:{binding:S,rewards:x},derivedPortableMetadata:k.taskset.metadata,modelTasksetDerivation:k.taskset.metadata.modelTasksetDerivation}}});if(J.metrics=k.taskset.metrics,J.contentHash=ae(J),J.revision!==k.taskset.revision)throw new Error("Derived local and portable Taskset revisions differ.");return{taskset:J,generatedFiles:Z,directoryId:re,source:l,sourcePackage:h,derived:k}}m(rt,"prepareModelTasksetSave");function Pe(e,n,a){let s=n.project.profileId;for(let o of[a.sourcePackage,a.derived]){if(!o)continue;for(let g of o.assets)w(e,s,"asset",g);for(let g of o.rewards)w(e,s,"reward",g);w(e,s,"binding",o.rewardBinding),w(e,s,"package",o.taskset),w(e,s,"definition",o.taskDefinition);let d=o.executionResources??o.execution;d&&w(e,s,"asset",Q(d)),o.execution&&w(e,s,"asset",z(o.execution))}let t=a.taskset;e.get("SELECT content_hash FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[t.id,t.revision])&&O(409,"model_taskset_revision_conflict","The derived Taskset revision was already published. Refresh before saving.");let i=JSON.stringify(t);e.run("INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO UPDATE SET status = excluded.status, payload = excluded.payload, updated_at = excluded.updated_at",[t.id,s,t.status,i,t.createdAt,t.updatedAt]),e.run("INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[t.id,t.revision,t.contentHash,s,t.status,i,t.createdAt,t.updatedAt]),e.run("UPDATE model_project_taskset_preparations SET state = 'committed' WHERE profile_id = ? AND operation_id = ?",[s,n.operationId])}m(Pe,"commitPreparedModelTaskset");function _e(e,n,a){let s=Me("sha256").update(u(n)).digest("hex"),t=n.project.profileId;a&&e.run("INSERT OR IGNORE INTO model_project_taskset_preparations (profile_id, operation_id, request_hash, created_at, state) VALUES (?, ?, ?, ?, 'preparing')",[t,n.operationId,s,new Date().toISOString()]);let r=e.get("SELECT request_hash, created_at FROM model_project_taskset_preparations WHERE profile_id = ? AND operation_id = ?",[t,n.operationId])??{request_hash:s,created_at:new Date().toISOString()};return r.request_hash!==s&&O(409,"model_operation_conflict","This save operation was already used with different Model configuration."),r}m(_e,"recordModelTasksetPreparation");function O(e,n,a){throw new F(e,{schemaVersion:"openpond.modelProjectApiError.v2",code:n,message:a,retryable:!1,requestId:null,details:{}})}m(O,"fail");import{createHash as Ee}from"node:crypto";function Ie(e,n){let a=U(n),s=e.get("SELECT request_hash, payload FROM model_project_save_operations WHERE profile_id = ? AND operation_id = ?",[a.project.profileId,a.operationId]);if(!s)return null;let t=Ee("sha256").update(u(a)).digest("hex");return s.request_hash!==t&&P(409,"model_operation_conflict","This save operation was already used with different Model configuration."),B.parse(JSON.parse(s.payload))}m(Ie,"findModelProjectSave");function vt(e,n,a,s){e.exec("BEGIN IMMEDIATE");try{let t=Oe(e,n,a,s);return e.exec("COMMIT"),t}catch(t){throw e.exec("ROLLBACK"),t}}m(vt,"commitModelProjectSave");function Oe(e,n,a,s){let t=U(n);t.learning&&P(422,"model_learning_hosted_required","Create this Model in a hosted workspace to enable continual learning.");let r=Ee("sha256").update(u(t)).digest("hex"),{project:i,operationId:o,expectedRevision:d}=t,g=Ie(e,t);if(g)return g;let l=e.get("SELECT payload FROM model_projects WHERE id = ?",[i.id]),T=l?B.parse(JSON.parse(l.payload)):null;T&&T.profileId!==i.profileId&&P(404,"model_not_found","Model is not available in this Profile."),(T?.revision??0)!==d&&P(409,"model_revision_conflict","Model changed since it was opened. Refresh before saving.");let v=xe(e,t),h=se(v);h||Ne(e,t);let S=h?R(h):v?.metadata.rewardBinding===void 0?null:q.parse(v.metadata.rewardBinding);v&&i.trainingSetup.rewardBindingRef&&(!S||!E(S,i.trainingSetup.rewardBindingRef))&&!a&&P(409,"model_taskset_preparation_required","Changing this Reward requires publishing its model-owned Taskset revision."),a&&((!i.trainingSetup.tasksetRef||!E(i.trainingSetup.tasksetRef,R(a.source))||!i.trainingSetup.rewardBindingRef||!E(i.trainingSetup.rewardBindingRef,R(a.derived.rewardBinding)))&&P(409,"model_taskset_preparation_changed","The prepared Taskset differs from the selected configuration."),Pe(e,t,a));let x=new Date().toISOString(),y=le.parse({...i.trainingSetup,baseModel:i.trainingSetup.baseModel??i.defaultBaseModel,method:i.trainingSetup.method??(v?.authoringProvenance.buildIntent==="verifiable_reward"?"grpo":v?.authoringProvenance.buildIntent==="demonstrations"?"sft":null),...S?{rewardBindingRef:S}:{},...a?{rewardBindingRef:R(a.derived.rewardBinding),tasksetRef:R(a.taskset),tasksetRelease:null,recipe:null,...i.trainingSetup.evaluationTasksetRef&&E(i.trainingSetup.evaluationTasksetRef,R(a.source))?{evaluationTasksetRef:R(a.taskset)}:{}}:{}}),c=a?.derived??s??(v&&!h&&y.rewardBindingRef&&v.metadata.taskDefinition!==void 0&&v.metadata.rewardBinding!==void 0?Y(e,v,y.rewardBindingRef).sourcePackage:void 0),f=B.parse({...T,...i,trainingSetup:c?we({setup:y,package:c}):y,schemaVersion:"openpond.modelProject.v2",revision:d+1,hosted:T?.hosted??null,tasksetSyncs:T?.tasksetSyncs??[],createdAt:T?.createdAt??x,updatedAt:x});return e.run(`INSERT INTO model_projects (id, profile_id, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
|
|
5
|
+
ON CONFLICT(id) DO UPDATE SET payload = excluded.payload, updated_at = excluded.updated_at`,[f.id,f.profileId,JSON.stringify(f),f.createdAt,f.updatedAt]),e.run("INSERT INTO model_project_save_operations (profile_id, operation_id, request_hash, payload) VALUES (?, ?, ?, ?)",[f.profileId,o,r,JSON.stringify(f)]),f}m(Oe,"saveModelProjectInTransaction");function xe(e,n){let a=n.project.trainingSetup.tasksetRef;if(!a){n.project.trainingSetup.tasksetRelease&&P(400,"model_taskset_required","Choose the Taskset corresponding to this release.");return}let s=e.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[a.id,a.revision]),t=s?A.parse(JSON.parse(s.payload)):null;return(!t||t.profileId!==n.project.profileId)&&P(404,"model_taskset_not_found","The selected Taskset revision is not available in this Profile."),t.contentHash!==a.contentHash&&P(409,"model_taskset_changed","The selected Taskset does not match its immutable content hash."),t}m(xe,"assertTaskset");function Ne(e,n){let a=n.project.trainingSetup.rewardBindingRef;if(!a)return;function s(r,i){let o=e.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[n.project.profileId,r,i.id,i.revision]);o||P(404,"model_reward_unavailable","The exact Reward configuration is unavailable in this Profile.");let d=(r==="binding"?ee:ie).parse(JSON.parse(o.payload));return d.contentHash!==i.contentHash&&P(409,"model_reward_changed","The selected Reward does not match its immutable content hash."),b(d),d}m(s,"read");let t=ee.parse(s("binding",a));for(let r of t.sources)s("reward",r.reward)}m(Ne,"assertReward");function P(e,n,a){throw new F(e,{schemaVersion:"openpond.modelProjectApiError.v2",code:n,message:a,retryable:!1,requestId:null,details:{}})}m(P,"fail");function Pt(e,n){let{taskset:a,package:s}=n,t=a.profileId,r=e.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[a.id,a.revision]);if(r&&u(A.parse(JSON.parse(r.payload)))!==u(a))throw new Error("Imported Taskset revision conflicts with an existing immutable local revision.");let i=e.get("SELECT payload FROM tasksets WHERE id = ?",[a.id]),o=i?A.parse(JSON.parse(i.payload)):null;if(o&&o.profileId!==t)throw new Error("Imported Taskset belongs to another Profile.");w(e,t,"package",s.taskset);let d=s.modelResources;if(d){w(e,t,"definition",d.taskDefinition),w(e,t,"binding",d.rewardBinding);for(let l of d.rewards)w(e,t,"reward",l);for(let l of d.assets)w(e,t,"asset",l);w(e,t,"asset",Q({environment:s.environment,verifierSet:s.verifierSet})),d.execution&&w(e,t,"asset",z(d.execution))}let g=JSON.stringify(a);r||e.run("INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[a.id,a.revision,a.contentHash,t,a.status,g,a.createdAt,a.updatedAt]),(!o||o.revision<a.revision)&&e.run("INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO UPDATE SET status = excluded.status, payload = excluded.payload, updated_at = excluded.updated_at",[a.id,t,a.status,g,a.createdAt,a.updatedAt])}m(Pt,"importTasksetPackageInTransaction");export{w as a,rt as b,Ie as c,vt as d,Oe as e,Pt as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{b as f}from"./chunk-JYKRR7E5.js";import{I as c}from"./chunk-VRIEKBBH.js";import{h as g,j as w,k as I}from"./chunk-QOTVNQDI.js";import{b as m}from"./chunk-DIO5CB6U.js";import{f as R}from"./chunk-ACYFMLWG.js";import{b as r}from"./chunk-ES2ISFJC.js";import{a as d}from"./chunk-FTQLQJQV.js";import n from"node:path";import{readFile as y}from"node:fs/promises";var A=r.object({profileId:r.string().min(1),sourceRevision:r.string().min(1),repositoryId:r.string().min(1),harnessRelease:r.object({id:r.string().min(1),contentHash:r.string().regex(/^[a-f0-9]{64}$/)}).strict(),hostExecution:r.object({conversationId:r.string().min(1),turnId:r.string().min(1)}).strict().optional(),workspaceId:r.string().min(1),assetsPath:r.string().min(1).refine(n.isAbsolute)}).strict();async function _(p,e){let t=A.parse(e),s=await f(p,t.harnessRelease);if(!s||n.resolve(s.release.bundlePath)!==n.resolve(t.assetsPath))throw new Error("Hosted Profile release changed after admission.");let o=s.release.harnessRelease.metadata.profile;if(!o||typeof o!="object"||o.id!==t.profileId||o.sourceRevision!==t.sourceRevision||o.repositoryId!==void 0&&o.repositoryId!==t.repositoryId)throw new Error("Hosted Profile provenance differs from admitted release.");return{profile:I(),profileLibrary:w()}}d(_,"loadHostedProfileStateAndLibrary");async function B(p,e){let t=A.parse(e),s=await f(p,t.harnessRelease);if(!s||n.resolve(s.release.bundlePath)!==n.resolve(t.assetsPath))throw new Error("Hosted Profile workflow release is unavailable.");let o=s.release.harnessRelease.metadata.profile;if(o?.id!==t.profileId||o.sourceRevision!==t.sourceRevision||o.repositoryId!==void 0&&o.repositoryId!==t.repositoryId)throw new Error("Hosted Profile workflow provenance changed.");let a=t.harnessRelease,l={source:"openpond_git",repositoryId:t.repositoryId,profileId:t.profileId};if(!s.release.harnessRelease.files.some(u=>u.path==="workflows/catalog.json"))return{profileRef:l,sourceRevision:t.sourceRevision,harnessRelease:a,workflows:[]};let i=n.join(s.release.bundlePath,"source","workflows"),v=R({agentSnapshot:s.release.agentSnapshot,harnessRelease:s.release.harnessRelease,catalogBytes:await y(n.join(i,"catalog.json")),actionBytes:await y(n.join(i,"actions.json"))});return{profileRef:l,sourceRevision:t.sourceRevision,harnessRelease:a,workflows:v.catalog.workflows.map(u=>({workflow:u,binding:{schemaVersion:"openpond.profileWorkflowBinding.v1",profileId:t.profileId,sourceRevision:t.sourceRevision,harnessRelease:a,catalogHash:v.catalogHash,workflowId:u.id}}))}}d(B,"listHostedProfileWorkflows");import{createHash as U,randomUUID as h}from"node:crypto";var b=r.object({approval:g,revision:r.number().int().positive()}).strict(),P=r.object({record:m}).strict(),x=r.object({startedAt:r.string().min(1),requestOrdinal:r.number().int().nonnegative(),id:r.string().min(1)}).strict(),k=r.object({records:r.array(m).max(200),nextBefore:x.nullable()}).strict(),H=1e4,S=class{constructor(e){this.client=e}client;static{d(this,"HostedApprovalStorage")}async readApproval(e){let t=await this.client.request({contractVersion:c,requestId:h(),operation:"approval/get",params:{approvalId:e}});return t===null?null:b.parse(t)}async getApproval(e){return(await this.readApproval(e))?.approval??null}async putApproval(e){let t=g.parse(e.approval);if(!e.requestId.trim())throw new Error("Approval mutation requires a stable request ID.");return b.parse(await this.client.request({contractVersion:c,requestId:e.requestId,operation:"approval/upsert",params:{approval:t,expectedRevision:e.expectedRevision}}))}},M=class{constructor(e){this.client=e}client;static{d(this,"HostedModelUsageStorage")}async upsertModelUsageRecord(e){let t=m.parse(e),s=U("sha256").update(JSON.stringify(t)).digest("hex"),o=await this.client.request({contractVersion:c,requestId:`usage:${s}`,operation:"usage/upsert",params:{record:t}}),a=P.parse(o).record;if(a.requestId!==t.requestId)throw new Error("Host usage upsert changed request identity.");return a}async getModelUsageRecordByRequestId(e){let t=await this.client.request({contractVersion:c,requestId:h(),operation:"usage/getByRequestId",params:{requestId:e}});return t===null?null:P.parse(t).record}async listModelUsageRecords(e={}){let t=e.limit===void 0||e.limit>=H,s=e.limit===void 0?H:Math.max(1,Math.min(1e4,Math.trunc(e.limit))),o={...e.sessionId?{sessionId:e.sessionId}:{},...e.turnId?{turnId:e.turnId}:{},...e.provider?{provider:e.provider}:{},...e.model?{model:e.model}:{},...e.startedAtFrom?{startedAtFrom:e.startedAtFrom}:{},...e.startedAtTo?{startedAtTo:e.startedAtTo}:{},...e.visibility&&e.visibility!=="all"?{visibility:e.visibility}:{},...e.status&&e.status!=="all"?{status:e.status}:{}},a=[],l=null;for(;a.length<s+(t?1:0);){let i=k.parse(await this.client.request({contractVersion:c,requestId:h(),operation:"usage/page",params:{query:o,before:l,limit:Math.min(200,s+(t?1:0)-a.length)}}));if(a.push(...i.records),a.length>s)throw new Error(`Hosted usage query exceeds ${s} rows; narrow its filters or use a streamed aggregation.`);if(i.nextBefore===null)break;if(i.records.length===0||JSON.stringify(i.nextBefore)===JSON.stringify(l))throw new Error("Host usage cursor did not advance.");l=i.nextBefore}return a}async listModelUsageRecordsComplete(e={}){return this.listModelUsageRecords(e)}};export{A as a,_ as b,B as c,S as d,M as e};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as m}from"./chunk-UKMA4R6X.js";import{e as h}from"./chunk-YR5ID2SS.js";import{a as s}from"./chunk-FTQLQJQV.js";var g=5,A=10,f=1200;function b(e){let r=y(e.endpoint),t=e.fetchImpl??fetch,n=e.apiKey?.trim()||null;return async(i,c)=>{let a=S(i),u=new Headers;u.set("Accept","application/json"),u.set("Content-Type","application/json"),u.set("x-openpond-client","openpond-app"),n&&(n.startsWith("opk_")&&u.set("openpond-api-key",n),u.set("Authorization",`Bearer ${n}`));let l=await t(r,{method:"POST",headers:u,body:JSON.stringify(a),signal:c?.signal});if(!l.ok)throw new Error(`Hosted web search failed: ${l.status} ${await O(l)}`);return w(await l.json(),a.query)}}s(b,"createHostedWebSearchExecutor");function D(e=process.env,r={}){let t=r.loadAccountContext??m;return async(n,i)=>{let c=p(e.OPENPOND_WEB_SEARCH_API_KEY,e.OPENPOND_SEARCH_API_KEY,e.OPENPOND_API_KEY),a=c?null:await t().catch(()=>null),u=E(e,a),l=c??a?.token??null;return b({endpoint:u,apiKey:l,fetchImpl:r.fetchImpl})(n,i)}}s(D,"createWebSearchExecutorFromEnv");function E(e=process.env,r){let t=p(e.OPENPOND_WEB_SEARCH_ENDPOINT);if(t)return y(t);let n=p(e.OPENPOND_SEARCH_API_URL);if(n)return d(n);let i=p(e.OPENPOND_PUBLIC_API_URL,e.OPENPOND_API_URL,r?.apiBaseUrl);if(i)return d(i);let c=p(e.OPENPOND_OPCHAT_API_URL,e.OPENPOND_CHAT_API_URL,r?.chatApiBaseUrl);return d(c||h)}s(E,"resolveWebSearchEndpoint");function d(e){let r=e.trim().replace(/\/+$/,"");if(!r)throw new Error("Hosted web search endpoint is required.");let t=new URL(r);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("Hosted web search endpoint must use http or https.");let n=t.pathname.split("/").filter(Boolean),i=n.findIndex(c=>c.toLowerCase()==="opchat");if(i>=0)t.pathname=`/${[...n.slice(0,i),"v1","search"].join("/")}`;else{let c=n.findIndex(a=>a.toLowerCase()==="search");if(c>=0)t.pathname=`/${n.slice(0,c+1).join("/")}`;else{let a=n.findIndex(u=>u.toLowerCase()==="v1");t.pathname=a>=0?`/${[...n.slice(0,a+1),"search"].join("/")}`:`${t.pathname.replace(/\/+$/,"")}/v1/search`.replace(/\/{2,}/g,"/")}}return t.search="",t.hash="",t.toString()}s(d,"normalizeSearchApiUrl");function S(e){let r=e.query.trim();if(!r)throw new Error("web_search query is required.");let t=_(e.limit),n=Array.isArray(e.domains)?e.domains.map(i=>i.trim()).filter(Boolean).slice(0,10):void 0;return{query:r,limit:t,...typeof e.recencyDays=="number"&&Number.isFinite(e.recencyDays)&&e.recencyDays>=0?{recencyDays:Math.floor(e.recencyDays)}:{},...n&&n.length>0?{domains:n}:{}}}s(S,"normalizeWebSearchRequest");function y(e){let r=e.trim();if(!r)throw new Error("Hosted web search endpoint is required.");let t=new URL(r);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("Hosted web search endpoint must use http or https.");return t.toString()}s(y,"normalizeEndpoint");function p(...e){for(let r of e){let t=r?.trim();if(t)return t}return null}s(p,"firstNonEmpty");function _(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?g:Math.min(Math.floor(e),A)}s(_,"normalizeLimit");function w(e,r){let t=e&&typeof e=="object"?e:{},i=(Array.isArray(t.results)?t.results:Array.isArray(t.items)?t.items:[]).map(P).filter(c=>!!c);return{query:o(t.query)??r,provider:o(t.provider)??"hosted",searchedAt:o(t.searchedAt)??o(t.searched_at)??new Date().toISOString(),results:i,truncated:t.truncated===!0}}s(w,"normalizeWebSearchResult");function P(e,r){if(!e||typeof e!="object")return null;let t=e,n=o(t.url),i=o(t.title);return!n||!i?null:{id:o(t.id)??`result_${r+1}`,title:i,url:n,snippet:R(o(t.snippet)??o(t.description)??o(t.text)??o(t.content)),sourceName:o(t.sourceName)??o(t.source_name)??o(t.source)??I(n),faviconUrl:x(o(t.faviconUrl)??o(t.favicon_url)??o(t.iconUrl)??o(t.icon_url))??N(n),publishedAt:o(t.publishedAt)??o(t.published_at)??o(t.publishedDate)??o(t.published_date),updatedAt:o(t.updatedAt)??o(t.updated_at)??o(t.updatedDate)??o(t.updated_date)}}s(P,"normalizeWebSearchItem");function R(e){if(!e)return"";let r=e.replace(/\s+/g," ").trim();return r.length<=f?r:`${r.slice(0,f-1).trimEnd()}\u2026`}s(R,"normalizeSnippet");function x(e){if(!e)return null;try{let r=new URL(e);return r.protocol!=="http:"&&r.protocol!=="https:"?null:r.toString()}catch{return null}}s(x,"normalizeOptionalUrl");function N(e){try{return new URL("/favicon.ico",e).toString()}catch{return null}}s(N,"faviconUrlFromPageUrl");function I(e){try{return new URL(e).hostname.replace(/^www\./i,"")}catch{return null}}s(I,"hostnameFromUrl");async function O(e){let r=await e.text().catch(()=>"");if(!r)return e.statusText||`HTTP ${e.status}`;try{let t=JSON.parse(r);if(t&&typeof t=="object"){let n=t,i=n.error;return i&&typeof i=="object"?o(i.message)??JSON.stringify(t):o(n.message)??o(n.error)??JSON.stringify(t)}}catch{return r}return r}s(O,"readSearchError");function o(e){return typeof e=="string"&&e.trim()?e.trim():null}s(o,"stringValue");export{b as a,D as b,E as c,d,S as e};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as l}from"./chunk-FTQLQJQV.js";function r(e){return process.platform==="win32"?{command:e,shell:!0}:{command:`set -o pipefail
|
|
3
|
+
${e}`,shell:"/bin/bash"}}l(r,"pipefailLocalShellCommand");function t(e){return`bash -o pipefail -lc ${n(e)}`}l(t,"pipefailSandboxShellCommand");function n(e){return`'${e.replace(/'/g,"'\\''")}'`}l(n,"quotePosixShellArg");export{r as a,t as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{b as e}from"./chunk-ES2ISFJC.js";import{a as o}from"./chunk-FTQLQJQV.js";var i=e.enum(["local","sandbox"]),s=e.enum(["pinned","saved_for_later"]),l=e.object({id:e.string().min(1),workspaceKind:i,workspaceId:e.string().min(1),workspaceName:e.string().min(1),path:e.string().min(1),status:s,order:e.number().int().nonnegative().nullable().default(null),sourceSessionId:e.string().min(1).nullable().default(null),available:e.boolean().default(!0),createdAt:e.string().min(1),updatedAt:e.string().min(1)}),p=e.object({items:e.array(l)}),d=e.object({workspaceKind:i,workspaceId:e.string().trim().min(1),workspaceName:e.string().trim().min(1),path:e.string().trim().min(1),status:e.enum(["pinned","saved_for_later","none"]),order:e.number().int().nonnegative().nullable().optional(),sourceSessionId:e.string().trim().min(1).nullable().optional()}),u=e.enum(["pin","save_for_later","remove","list"]);function c(n){let r=n.trim().replaceAll("\\","/");if(r=r.replace(/^(?:workspace|sandbox):file:/,""),r=r.replace(/^\/workspace\/app\//,""),r=r.replace(/^\.\//,""),!r||r.startsWith("/"))throw new Error("File path must be relative to the workspace.");let a=r.split("/").filter(t=>t&&t!==".");if(a.some(t=>t===".."))throw new Error("File path cannot leave the workspace.");if(a.length===0)throw new Error("File path is required.");return a.join("/")}o(c,"normalizeSidebarFilePath");function b(n){return["sidebar-file",n.workspaceKind,encodeURIComponent(n.workspaceId),encodeURIComponent(c(n.path))].join(":")}o(b,"sidebarFileBookmarkId");export{l as a,d as b,c,b as d};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as S,c as y}from"./chunk-F74GBN6K.js";import{D as h}from"./chunk-Y4OWBBDD.js";import{l as w}from"./chunk-ACYFMLWG.js";import{b as p}from"./chunk-ES2ISFJC.js";import{a as t}from"./chunk-FTQLQJQV.js";var T=p.object({score:p.number().finite().min(0).max(1).nullable(),passed:p.boolean(),feedback:p.string().max(2e4),evidenceRefs:p.array(p.string().max(240)).max(1e3).default([])}).strict().refine(e=>e.score!==null||!e.passed,{message:"Unscorable verifiers cannot pass.",path:["passed"]});function P(e){if(e==="sandbox_process")throw new Error("verifier_sandbox_process_required")}t(P,"assertIsolatedVerifierRuntime");import{Worker as R}from"node:worker_threads";async function g(e){e.signal?.throwIfAborted(),y(e);let{javascriptVerifierWorkerSource:d}=await import("./javascript-verifier-worker-source-F3LSGPOY.js");e.signal?.throwIfAborted();let a=e.signal,x={source:e.source,exportName:e.exportName,value:e.value,timeoutMs:e.timeoutMs,maxResultBytes:e.maxResultBytes,deterministic:e.deterministic===!0,errorPrefix:e.errorPrefix},c=t(i=>new Error(`${e.errorPrefix}_${i}`),"error");return new Promise((i,f)=>{let l=new R(d,{eval:!0,workerData:x,execArgv:[],env:{},resourceLimits:{maxOldGenerationSizeMb:64,maxYoungGenerationSizeMb:16,stackSizeMb:4}}),m=!1,o=t(r=>{m||(m=!0,clearTimeout(I),a?.removeEventListener("abort",u),l.terminate().then(()=>{"error"in r?f(r.error):i(r.result)},f))},"finish"),u=t(()=>o({error:a?.reason instanceof Error?a.reason:c("cancelled")}),"cancel"),I=setTimeout(()=>o({error:c("timeout")}),e.timeoutMs);a?.addEventListener("abort",u,{once:!0}),l.once("error",r=>o({error:r})),l.once("exit",()=>{m||o({error:c("worker_exited_without_result")})}),l.once("message",r=>{try{if(!r||typeof r!="object"||!("ok"in r))throw c("worker_invalid_response");if(r.ok!==!0)throw new Error("error"in r&&typeof r.error=="string"?r.error:`${e.errorPrefix}_execution_failed`);if(!("result"in r))throw c("worker_invalid_response");w(r.result,e.maxResultBytes),o({result:r.result})}catch(_){o({error:_ instanceof Error?_:c("worker_invalid_response")})}}),a?.aborted&&u()})}t(g,"executeJavaScriptIsolateInWorker");import{spawn as B}from"node:child_process";async function H(e){e.signal?.throwIfAborted(),y(e);let{javascriptIsolateProcessSource:d}=await import("./javascript-isolate-process-source-ZPQKKLR4.js");e.signal?.throwIfAborted();let{signal:a,stripTypeScript:x,...c}=e,i=t(l=>new Error(`${e.errorPrefix}_${l}`),"error"),f=`globalThis.__openpondIsolateInput = JSON.parse(${JSON.stringify(JSON.stringify(c))});
|
|
3
|
+
${x?`globalThis.__openpondIsolateInput.source = require("node:module").stripTypeScriptTypes(globalThis.__openpondIsolateInput.source, { mode: "strip" });
|
|
4
|
+
`:""}${d}`;return new Promise((l,m)=>{let o=B("node",["--max-old-space-size=64","--input-type=commonjs","-"],{stdio:["pipe","pipe","pipe"],env:{PATH:process.env.PATH},windowsHide:!0}),u,I="",r=0,_=0,v=t(n=>{u??=n,o.kill("SIGKILL")},"stop"),k=t(()=>v(a?.reason instanceof Error?a.reason:i("cancelled")),"cancel"),J=setTimeout(()=>v(e.errorPrefix==="candidate"?new S("candidate_timeout"):i("timeout")),e.timeoutMs);a?.addEventListener("abort",k,{once:!0}),o.stdout.setEncoding("utf8"),o.stdout.on("data",n=>{r+=Buffer.byteLength(n),r>e.maxResultBytes+65536?v(i("process_response_too_large")):I+=n}),o.stderr.on("data",n=>{_+=n.byteLength,_>65536&&v(i("process_stderr_too_large"))}),o.once("error",n=>{u??=n}),o.stdin.on("error",n=>v(n)),o.once("close",n=>{if(clearTimeout(J),a?.removeEventListener("abort",k),u){m(u);return}try{if(n!==0)throw i("process_exited_without_result");let s=JSON.parse(I);if(!s||typeof s!="object"||!("ok"in s))throw i("process_invalid_response");if(s.ok!==!0){let b="error"in s&&typeof s.error=="string"?s.error:`${e.errorPrefix}_execution_failed`;throw"executionError"in s&&s.executionError===!0?new S(b):new Error(b)}if(!("result"in s))throw i("process_invalid_response");w(s.result,e.maxResultBytes),l(s.result)}catch(s){m(s instanceof Error?s:i("process_invalid_response"))}}),o.stdin.end(f),a?.aborted&&k()})}t(H,"executeJavaScriptIsolateInProcess");async function Y(e){return P(e.runtime),T.parse(await g({...e,exportName:e.exportName??"verify",maxResultBytes:65536,errorPrefix:"verifier"}))}t(Y,"executeJavaScriptVerifierInWorker");function re(e){return h(e,E)}t(re,"aggregateTasksetEvaluationInWorker");var E=t(async({source:e,module:d,exportName:a,scores:x,timeoutMs:c,signal:i})=>{let f=/\.[cm]?ts$/.test(d)?(await import("node:module")).stripTypeScriptTypes(e,{mode:"strip"}):e;return g({source:f,exportName:a,value:x,timeoutMs:c,signal:i,maxResultBytes:1024,deterministic:!0,errorPrefix:"metric"})},"executeMetric");var te=E;export{T as a,g as b,H as c,Y as d,re as e,te as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{b as l,c as h,e as H,f as y,h as m,i as A,j as C,l as R,m as p,n as g}from"./chunk-KGNCKIFP.js";import{b as e}from"./chunk-ES2ISFJC.js";import{a as i}from"./chunk-FTQLQJQV.js";var v=e.object({name:e.string().trim().min(1).max(64).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/),description:e.string().trim().min(1).max(2e3),inputSchema:e.record(e.string(),e.unknown()),inputSchemaHash:h,sideEffect:e.enum(["read","write"]),timeoutMs:e.number().int().positive().max(36e5)}).strict(),j=e.object({id:l,required:e.boolean(),scopes:e.array(e.string().trim().min(1).max(500)).max(100).default([]),portability:e.enum(["portable","host_adapter","local_only","hosted_only"])}).strict();var M=e.object({portable:e.boolean(),blockers:e.array(e.string().trim().min(1).max(2e3)).max(1e3),localOnlyAssetRefs:e.array(l).max(1e4),hostPrivateAssetRefs:e.array(l).max(1e4)}).strict(),I=e.object({schemaVersion:e.literal("openpond.agentSnapshot.v2"),id:l,sourceRelease:y.nullable(),instructions:e.array(m).max(1e4),skills:e.array(m).max(1e4),agents:e.array(m).max(1e4),toolDeclarations:e.array(v).max(200),capabilityRequirements:e.array(j).max(200),dependencyLock:m,portability:M,metadata:H}).strict(),_=I.extend({contentHash:h}).strict(),V=e.object({create:e.literal(!0),reset:e.literal(!0),step:e.literal(!0),collect:e.literal(!0),destroy:e.literal(!0),resetScope:e.enum(["task","attempt"])}).strict(),$=e.object({visibleEvidence:e.array(l).max(1e3),privilegedEvidence:e.array(l).max(1e3),privateVerifierIsolation:e.boolean()}).strict(),z=e.object({schemaVersion:e.literal("openpond.harnessRelease.v2"),id:l,agentSnapshot:y,program:m,tools:e.array(v).max(200),lifecycle:V,graderInterface:$,files:e.array(m).max(1e5),metadata:H}).strict(),E=z.extend({contentHash:h}).strict(),T=e.object({id:l,turn:e.number().int().nonnegative(),kind:e.enum(["message","tool_call","terminal"]),name:l.nullable(),arguments:e.record(e.string(),e.unknown()),content:e.string().max(1e6).nullable()}).strict(),q=e.object({actionId:l,turn:e.number().int().nonnegative(),terminal:e.boolean(),output:e.record(e.string(),e.unknown()),artifactRefs:e.array(A).max(1e5)}).strict();function Q(r){let t=I.parse(r);return _.parse({...t,contentHash:p(t)})}i(Q,"createAgentSnapshot");function W(r){let t=z.parse(r);return E.parse({...t,contentHash:p(t)})}i(W,"createHarnessRelease");var B=e.object({sequence:e.number().int().nonnegative(),type:e.enum(["created","reset","action","observation","terminal","failure","collected","destroyed"]),payloadHash:h,metadata:H}).strict(),ee=e.object({schemaVersion:e.literal("openpond.harnessTrace.v1"),manifest:y,taskId:l,seed:e.string().trim().min(1).max(500),events:e.array(B).max(1e6),actions:e.array(T).max(1e5),observations:e.array(q).max(1e5),terminal:e.boolean(),failureClass:C.nullable(),output:e.record(e.string(),e.unknown()),contentHash:h}).strict();var w=25*1024*1024,F=e.object({path:m.shape.path,base64:e.string().max(Math.ceil(w/3)*4)}).strict(),P=e.object({schemaVersion:e.literal("openpond.harnessSourcePackage.v1"),agentSnapshot:_,harnessRelease:E,files:e.array(F).max(1e4)}).strict(),O=P.extend({contentHash:h}).strict(),D=P.extend({schemaVersion:e.literal("openpond.harnessPolicySourcePackage.v1"),contentHash:h}).strict(),G=e.object({schemaVersion:e.literal("openpond.harnessSourceSelection.v1"),mode:e.enum(["taskset_owned","selected_release"]),harnessRelease:y,sourcePackageHash:h.nullable()}).strict().superRefine((r,t)=>{r.mode==="selected_release"!=(r.sourcePackageHash!==null)&&t.addIssue({code:"custom",path:["sourcePackageHash"],message:"Only a selected release binds a source package."})});function oe(r){let t=G.parse(r.selection);if(t.harnessRelease.id!==r.expectedRelease.id||t.harnessRelease.contentHash!==r.expectedRelease.contentHash)throw new Error("Harness source selection differs from its run manifest.");if(t.mode==="taskset_owned"){if(r.sourcePackage!==void 0&&r.sourcePackage!==null)throw new Error("Taskset-owned execution cannot include a selected Harness source package.");return{selection:t,sourcePackage:null}}let a=x(r.sourcePackage,t.harnessRelease);if(a.contentHash!==t.sourcePackageHash)throw new Error("Harness source selection differs from its captured package.");return{selection:t,sourcePackage:a}}i(oe,"resolveHarnessSourceSelection");function ce(r){if([...r.files.values()].reduce((a,n)=>a+n.byteLength,0)>w)throw new Error("Harness source package exceeds its byte limit.");let t=P.parse({schemaVersion:"openpond.harnessSourcePackage.v1",agentSnapshot:r.agentSnapshot,harnessRelease:r.harnessRelease,files:[...r.files].sort(([a],[n])=>a.localeCompare(n)).map(([a,n])=>({path:a,base64:U(n)}))});return x({...t,contentHash:p(t)})}i(ce,"createHarnessSourcePackage");function ie(r,t){let a=x(r,t),n=new Map(a.harnessRelease.files.map(c=>[c.path,c])),o={schemaVersion:"openpond.harnessPolicySourcePackage.v1",agentSnapshot:a.agentSnapshot,harnessRelease:a.harnessRelease,files:a.files.filter(c=>n.get(c.path)?.visibility==="policy")};return L({...o,contentHash:p(o)},t)}i(ie,"createHarnessPolicySourcePackage");function L(r,t){let a=D.parse(r);g(a,"Harness policy source package"),g(a.agentSnapshot,"Harness policy source Agent snapshot"),g(a.harnessRelease,"Harness policy source release");let{agentSnapshot:n,harnessRelease:o}=a;if(t&&(t.id!==o.id||t.contentHash!==o.contentHash))throw new Error("Harness policy source package differs from the selected release.");if(o.agentSnapshot.id!==n.id||o.agentSnapshot.contentHash!==n.contentHash)throw new Error("Harness policy source release does not bind its Agent snapshot.");let c=new Map;for(let s of o.files){if(c.has(s.path))throw new Error("Harness policy source contains duplicate asset paths.");c.set(s.path,s)}for(let s of[o.program,n.dependencyLock,...n.instructions,...n.skills,...n.agents])if(p(c.get(s.path)??null)!==p(s))throw new Error(`Harness policy source dependency ${s.path} is absent or differs from its release inventory.`);for(let s of[o.program,n.dependencyLock,...n.instructions,...n.skills])if(s.visibility!=="policy")throw new Error(`Harness policy source dependency ${s.path} is private.`);let b=new Set(o.files.filter(s=>s.visibility==="policy").map(s=>s.path)),u=new Set,S=0;for(let s of a.files){if(u.has(s.path))throw new Error("Harness policy source contains duplicate files.");u.add(s.path);let f=c.get(s.path);if(!f||f.visibility!=="policy")throw new Error(`Harness policy source file ${s.path} is not policy-visible.`);let d=k(s.base64);if(S+=d.byteLength,S>w)throw new Error("Harness policy source exceeds its byte limit.");if(d.byteLength!==f.sizeBytes||R(d)!==f.contentHash)throw new Error(`Harness policy source file ${s.path} differs from its immutable bytes.`)}if(u.size!==b.size||[...b].some(s=>!u.has(s)))throw new Error("Harness policy source is missing released policy files.");return a}i(L,"validateHarnessPolicySourcePackage");function le(r,t){let a=L(r,t);return new Map(a.files.map(n=>[n.path,k(n.base64)]))}i(le,"harnessPolicySourcePackageFiles");function x(r,t){let a=O.parse(r);g(a,"Harness source package"),g(a.agentSnapshot,"Harness source Agent snapshot"),g(a.harnessRelease,"Harness source release");let{agentSnapshot:n,harnessRelease:o}=a;if(t&&(t.id!==o.id||t.contentHash!==o.contentHash))throw new Error("Harness source package differs from the selected release.");if(o.agentSnapshot.id!==n.id||o.agentSnapshot.contentHash!==n.contentHash)throw new Error("Harness source release does not bind its Agent snapshot.");let c=new Map,b=new Set;for(let s of o.files){if(s.path.includes("\\")||s.path.includes(":"))throw new Error("Harness source requires portable relative file paths.");if(c.has(s.path)||b.has(s.id))throw new Error("Harness source contains duplicate asset paths or identities.");c.set(s.path,s),b.add(s.id)}for(let s of[o.program,n.dependencyLock,...n.instructions,...n.skills,...n.agents])if(p(c.get(s.path)??null)!==p(s))throw new Error(`Harness source dependency ${s.path} is absent or differs from its release inventory.`);for(let s of[...n.instructions,...n.skills])if(s.visibility!=="policy")throw new Error(`Harness policy source ${s.path} is private.`);let u=new Set,S=0;for(let s of a.files){if(u.has(s.path))throw new Error("Harness source package contains duplicate files.");u.add(s.path);let f=c.get(s.path);if(!f)throw new Error(`Harness source file ${s.path} is not declared by its release.`);let d=k(s.base64);if(S+=d.byteLength,S>w)throw new Error("Harness source package exceeds its byte limit.");if(d.byteLength!==f.sizeBytes||R(d)!==f.contentHash)throw new Error(`Harness source file ${s.path} differs from its immutable bytes.`)}if(u.size!==c.size)throw new Error("Harness source package is missing released files.");return a}i(x,"validateHarnessSourcePackage");function he(r,t){let a=x(r,t);return new Map(a.files.map(n=>[n.path,k(n.base64)]))}i(he,"harnessSourcePackageFiles");function U(r){let t="";for(let a=0;a<r.length;a+=8192)t+=String.fromCharCode(...r.subarray(a,a+8192));return btoa(t)}i(U,"encode");function k(r){let t;try{t=atob(r)}catch{throw new Error("Harness source file is not valid base64.")}if(btoa(t)!==r)throw new Error("Harness source file is not canonical base64.");return Uint8Array.from(t,a=>a.charCodeAt(0))}i(k,"decode");export{v as a,j as b,M as c,I as d,_ as e,V as f,$ as g,z as h,E as i,T as j,q as k,Q as l,W as m,B as n,ee as o,D as p,oe as q,ce as r,ie as s,L as t,le as u,x as v,he as w};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{gb as a,hb as r}from"./chunk-ACYFMLWG.js";import{m as t}from"./chunk-KGNCKIFP.js";import{a as n}from"./chunk-FTQLQJQV.js";var T=r;function f(i,l){let s=new Map(i.map(o=>[o.name,o]));return l.map(o=>{let e=s.get(o.name);if(!a.has(o.name)||o.sideEffect!=="read"||!e||t(e.parameters)!==o.inputSchemaHash)throw new Error(`Standalone Harness tool has no compatible case-scoped implementation: ${o.name}.`);return e})}n(f,"isolateStandaloneExperimentTools");export{T as a,f as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as u}from"./chunk-DMFUEUAZ.js";import{b as a}from"./chunk-DIO5CB6U.js";import{C as o,z as s}from"./chunk-Z4Z5UOZM.js";import{a as e}from"./chunk-FTQLQJQV.js";function p(t){return JSON.parse(t.payload)}e(p,"localAgentScheduleFromRow");function g(t){return s.parse({...JSON.parse(t.payload),updatedAt:t.updated_at})}e(g,"subagentRunFromRow");function _(t,r){let n=s.parse({...t,updatedAt:r});return[n.id,n.parentSessionId,n.parentTurnId,n.childSessionId,n.roleId,n.status,JSON.stringify(n),n.createdAt,r]}e(_,"subagentRunParams");function m(t){return o.parse(JSON.parse(t.payload))}e(m,"subagentMessageFromRow");function R(t){return[t.id,t.fromRunId,t.toRunId,t.toRole,t.kind,JSON.stringify(t),t.createdAt]}e(R,"subagentMessageParams");function S(t){return[t.id,t.localProjectId,t.scheduleName,t.enabled?1:0,t.nextRunAt,JSON.stringify(t),t.createdAt,t.updatedAt]}e(S,"localAgentScheduleParams");function h(t){return JSON.parse(t.payload)}e(h,"localAgentScheduleRunFromRow");function y(t){return[t.id,t.scheduleId,t.localProjectId,t.scheduleName,t.scheduledFor,t.trigger,t.status,JSON.stringify(t),t.createdAt,t.updatedAt]}e(y,"localAgentScheduleRunParams");function b(t){return a.parse({id:t.id,requestId:t.request_id,requestOrdinal:t.request_ordinal,sessionId:t.session_id,turnId:t.turn_id,provider:t.provider,model:t.model,route:t.route,source:t.source,requestKind:t.request_kind,visibility:t.visibility,status:t.status,startedAt:t.started_at,completedAt:t.completed_at,durationMs:t.duration_ms,firstTokenMs:t.first_token_ms,promptTokens:t.prompt_tokens,cachedPromptTokens:t.cached_prompt_tokens,uncachedPromptTokens:t.uncached_prompt_tokens,cacheWritePromptTokens:t.cache_write_prompt_tokens,cacheTelemetrySource:t.cache_telemetry_source,completionTokens:t.completion_tokens,totalTokens:t.total_tokens,errorType:t.error_type,errorMessage:t.error_message,attribution:JSON.parse(t.attribution_json)})}e(b,"modelUsageRecordFromRow");function k(t){return[t.id,t.requestId,t.requestOrdinal,t.sessionId,t.turnId,t.provider,t.model,t.route,t.source,t.requestKind,t.visibility,t.status,t.startedAt,t.completedAt,t.durationMs,t.firstTokenMs,t.promptTokens,t.cachedPromptTokens,t.uncachedPromptTokens,t.cacheWritePromptTokens,t.cacheTelemetrySource,t.completionTokens,t.totalTokens,t.errorType,t.errorMessage,JSON.stringify(t.attribution)]}e(k,"modelUsageRecordParams");function A(){return new Date().toISOString().replace(/\D/g,"").slice(0,14)}e(A,"timestampForPath");function f(t,r){return{...u(JSON.parse(t)),sequence:r}}e(f,"runtimeEventWithSequence");function T(t){return i({sessionId:t.session_id,eventCount:t.event_count,latestEventSequence:t.latest_event_sequence,latestEventAt:t.latest_event_at,latestTurnId:t.latest_turn_id,latestTurnStatus:t.latest_turn_status,pendingApprovalCount:t.pending_approval_count,updatedAt:t.updated_at})}e(T,"threadDetailProjectionFromRow");function i(t){return{sessionId:t.sessionId,eventCount:t.eventCount,latestEventSequence:t.latestEventSequence,latestEventAt:t.latestEventAt,latestTurnId:t.latestTurnId,latestTurnStatus:t.latestTurnStatus,pendingApprovalCount:t.pendingApprovalCount,updatedAt:t.updatedAt}}e(i,"threadDetailProjectionPayload");export{p as a,g as b,_ as c,m as d,R as e,S as f,h as g,y as h,b as i,k as j,A as k,f as l,T as m,i as n};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as z,b as B,c as x}from"./chunk-PF5R6CMP.js";import{a as M}from"./chunk-FEAKTSRS.js";import{x as N}from"./chunk-QOTVNQDI.js";import{n as _}from"./chunk-ACYFMLWG.js";import{l as A,m as S}from"./chunk-KGNCKIFP.js";import{b as I}from"./chunk-ES2ISFJC.js";import{a as u}from"./chunk-FTQLQJQV.js";import{createHash as U}from"node:crypto";function W(n){let p=n.replace(/^\/workspace\/outputs\//,"").replace(/^\/workspace\/work\/outputs\//,"").replace(/^outputs\//,"");if(!p||p.startsWith("/")||p.includes("\0")||p.split(/[\\/]/).some(y=>!y||y==="."||y===".."))throw new Error("Select one file inside this case's writable outputs.");return p}u(W,"confinedProfileOutputPath");var J=u(n=>`'${n.replaceAll("'","'\\''")}'`,"quote");async function D(n){let p=W(n.path),y="const f=require('fs'),p=require('path'),c=require('crypto'),a=JSON.parse(process.argv[1]),r=f.realpathSync('/workspace/work/outputs'),q=f.realpathSync(p.join(r,a.path));if(!q.startsWith(r+'/'))throw Error('Output path escapes the case');const s=f.statSync(q);if(!s.isFile()||s.size>10000000)throw Error('Output exceeds its bound');if(a.offset===undefined){const b=f.readFileSync(q);process.stdout.write(JSON.stringify({size:b.length,hash:c.createHash('sha256').update(b).digest('hex')}))}else{const h=f.openSync(q,'r'),b=Buffer.alloc(Math.min(524288,s.size-a.offset));try{const n=f.readSync(h,b,0,b.length,a.offset);process.stdout.write(b.subarray(0,n).toString('base64'))}finally{f.closeSync(h)}}";async function b(m){let h=await n.command(`/runtime/node -e ${J(y)} ${J(JSON.stringify({path:p,...m!==void 0?{offset:m}:{}}))}`);if(h.code!==0)throw new Error("The confined output could not be read.");return h.stdout}u(b,"read");let v=I.object({size:I.number().int().min(1).max(N),hash:I.string().regex(/^[a-f0-9]{64}$/)}).strict().parse(JSON.parse(await b())),H=[];for(let m=0;m<v.size;m+=524288){let h=await b(m);if(!/^[A-Za-z0-9+/]*={0,2}$/.test(h)||h.length>7e5)throw new Error("Output chunk exceeded its boundary.");let $=Buffer.from(h,"base64");if($.length!==Math.min(524288,v.size-m))throw new Error("The output changed during readback.");H.push($)}let T=Buffer.concat(H),k=U("sha256").update(T).digest("hex"),P=I.object({size:I.number(),hash:I.string()}).strict().parse(JSON.parse(await b()));if(k!==v.hash||P.hash!==k||P.size!==T.length)throw new Error("The output changed before immutable readback.");return{bytes:T,title:p.split("/").at(-1)}}u(D,"readConfinedProfileOutput");import f from"node:path";import{promises as w}from"node:fs";var E=u(n=>`'${n.replaceAll("'","'\\''")}'`,"quote");function le(n){let p=new Map,y=new AbortController,b=n.release,v=n.runtimeNode??"/runtime/node",H=n.runtimeAgentRoot??"/runtime/agent",T=new Set(b.harnessRelease.files.filter(e=>e.visibility!=="policy").map(e=>e.contentHash)),k,P=B({storeDir:n.storeDir,loadArchive:x({storeDir:n.storeDir})});async function m(e){y.signal.throwIfAborted(),await n.authorize({bindingHash:e.manifest.profileEvaluation.externalDatasetBinding?.contentHash??S(e.manifest.profileEvaluation),manifestHash:e.manifest.contentHash,taskId:e.taskId,seed:e.seed}),y.signal.throwIfAborted()}u(m,"fence");async function h(e,t){let i=p.get(e.id),l=i?.manifest.profileEvaluation;if(!i||!l||t.sessionId!==e.id||t.status!=="in_progress"||S(e.metadata?.profileEvaluationRun)!==S({id:i.manifest.id,contentHash:i.manifest.contentHash})||e.currentProfile?.profileId!==l.profileId||t.profileSnapshot?.sourceHash!==l.harnessRelease.contentHash||t.profileSnapshot.revision!==l.sourceRevision)throw new Error("The target tool has no actual admitted source/case/turn authority.");if(i.turnId&&i.turnId!==t.id)throw new Error("The target case already belongs to another turn.");i.turnId=t.id;let s=await n.getTurn(t.id);if(!s||s.sessionId!==e.id||s.status!=="in_progress"||S(s.profileSnapshot)!==S(t.profileSnapshot))throw new Error("The actual target turn is no longer admitted.");return await m(i),i}u(h,"authority");let $=M({authorize:u(async e=>{let t=p.get(e.sessionId);if(!t||t.turnId!==e.turnId||e.candidateId!==t.manifest.id||e.expectedRevision!==1)throw new Error("Target command changed its original admitted source.");return await h(await n.getSession(e.sessionId),await n.getTurn(e.turnId)),{candidateId:t.manifest.id,candidateRevision:1,ownerId:"host-profile-evaluation",sessionId:e.sessionId,turnId:e.turnId,sourceRoot:t.root,layout:"profile_case",writablePaths:["outputs"],...k?{runtimeMounts:[{source:k.source,destination:"/runtime/agent"},{source:f.join(k.source,"node_modules"),destination:"/workspace/node_modules"}]}:{}}},"authorize")});async function O(e,t,i,l,s,a){await m(e);let r=n.executeCommand?await n.executeCommand({sessionId:e.sessionId,turnId:t,sourceRoot:e.root,publicHashes:e.publicHashes,...k?{runtimeRoot:k.source}:{},command:i,cwd:s,stdin:a,timeoutMs:Math.min(e.manifest.limits.timeoutMs,18e4),signal:AbortSignal.any([l,y.signal])}):await $({candidateId:e.manifest.id,expectedRevision:1,sessionId:e.sessionId,turnId:t,command:i,cwd:s,stdin:a,signal:AbortSignal.any([l,y.signal]),maxOutputBytes:75e4,timeoutMs:Math.min(e.manifest.limits.timeoutMs,18e4)});if(await m(e),r.timedOut||r.stdoutTruncated||r.stderrTruncated)throw new Error("The target command exceeded its bounded execution or output.");return r}u(O,"command");async function L(e,t,i,l,s=[]){let a=t.profileEvaluation;if(!a||a.harnessRelease.contentHash!==b.harnessRelease.contentHash||t.population.filter(c=>c.taskId===i&&c.seed===l).length!==1||S(e.metadata?.profileEvaluationRun)!==S({id:t.id,contentHash:t.contentHash}))throw new Error("The target Session differs from its actual sealed source/case admission.");let r=f.join(n.storeDir,"evaluation-policy-cases",S([t.id,e.id])),o={},g={manifest:t,root:r,sessionId:e.id,taskId:i,seed:l,publicHashes:o};await m(g),await w.mkdir(r,{recursive:!0,mode:448});for(let c of b.harnessRelease.files){if(c.visibility!=="policy"||T.has(c.contentHash))continue;let d=f.join(b.bundlePath,"source",c.path),R=await w.realpath(d),K=await w.realpath(f.join(b.bundlePath,"source"));if(!R.startsWith(`${K}${f.sep}`)||(await w.lstat(d)).isSymbolicLink())throw new Error("Released policy source escaped its immutable closure.");let j=await w.readFile(R);if(j.length!==c.sizeBytes||A(j)!==c.contentHash)throw new Error("Released policy source changed before target admission.");let C=f.join(r,c.path);await w.mkdir(f.dirname(C),{recursive:!0,mode:448}),await w.writeFile(C,j,{flag:"wx",mode:256}),o[c.path]=c.contentHash}for(let c of new Set(Object.keys(o).filter(d=>d.startsWith("agents/")).map(d=>d.split("/")[1]))){let d=`agents/${c}`;o[`${d}/agent.ts`]&&!o[`${d}/openpond.yaml`]&&!o[`${d}/agent/agent.ts`]&&(await w.mkdir(f.join(r,d,"agent"),{recursive:!0,mode:448}),await w.rename(f.join(r,d,"agent.ts"),f.join(r,d,"agent","agent.ts")),o[`${d}/agent/agent.ts`]=o[`${d}/agent.ts`],delete o[`${d}/agent.ts`])}for(let c of s){if(c.mediaType!=="application/pdf"||!c.contentsBase64||c.name!==f.basename(c.name))throw new Error("The isolated case has an unsupported input attachment.");let d=Buffer.from(c.contentsBase64,"base64"),R=`inputs/${c.name}`;if(d.length!==c.sizeBytes||d.length>1e7||o[R])throw new Error("The isolated case input identity is invalid.");await w.mkdir(f.join(r,"inputs"),{recursive:!0,mode:448}),await w.writeFile(f.join(r,R),d,{flag:"wx",mode:256}),o[R]=A(d)}await w.mkdir(f.join(r,"outputs"),{mode:448}),await m(g),p.set(e.id,g)}u(L,"admitSession");let F=u(async e=>{let t=await h(e.session,e.turn),i=[],l=u((s,a,r,o)=>i.push({name:s,description:a,parameters:{type:"object",properties:r,additionalProperties:!1},execute:u(async g=>{if(await h(g.session,e.turn)!==t||g.turnId!==e.turn.id)throw new Error("Target tool changed its admitted case.");let d=await o(g.args,g.signal);return await h(g.session,e.turn),{toolCallId:g.callId,name:s,ok:!0,contentText:JSON.stringify(d),data:d}},"execute")}),"define");l("harness_inspect","Inspect this released policy source.",{},async()=>({release:{id:b.harnessRelease.id,contentHash:b.harnessRelease.contentHash},files:Object.entries(t.publicHashes).map(([s,a])=>({path:s,contentHash:a}))}));for(let s of["profile_skill_read","skill_inspect","context_read"])l(s,"Read an exact file from this policy source.",{name:{type:"string"},path:{type:"string"}},async a=>{let r=typeof a.path=="string"?a.path:typeof a.name=="string"?`skills/${a.name}/SKILL.md`:"";if(!t.publicHashes[r])throw new Error("This source file is outside the public policy closure.");let o=await O(t,e.turn.id,`${v} -e ${E("const f=require('fs'),p=process.argv[1],b=f.readFileSync(p);if(b.length>250000)throw Error('Policy source exceeds read bound');process.stdout.write(JSON.stringify({path:p,text:b.toString('utf8')}))")} ${E(`/workspace/work/${r}`)}`,e.signal);if(o.code!==0)throw new Error("The public target file could not be read.");return JSON.parse(o.stdout)});for(let s of["exec_command","work_exec"])l(s,"Run a command inside the policy source namespace and writable outputs.",{command:{type:"string"},cwd:{type:"string"}},async(a,r)=>{if(typeof a.command!="string")throw new Error("Select a target command.");let o=typeof a.cwd=="string"?a.cwd:t.root,g=o.startsWith("/workspace/work/")?f.join(t.root,o.slice(16)):o==="/workspace/work"?t.root:o;return O(t,e.turn.id,a.command,r,g)});l("work_save_output","Save a completed file from this case's outputs into durable output storage.",{path:{type:"string"},suggestedName:{type:"string"}},async(s,a)=>{if(typeof s.path!="string")throw new Error("Select a completed case output.");let r=n.readOutput?await n.readOutput({sessionId:e.session.id,turnId:e.turn.id,path:s.path,signal:a}):await D({path:s.path,command:u(g=>O(t,e.turn.id,g,a),"command")});await h(e.session,e.turn);let o=await n.saveOutput({session:e.session,sourceTurnId:e.turn.id,suggestedName:typeof s.suggestedName=="string"?s.suggestedName:r.title,bytes:r.bytes,validation:[],validationPolicy:"preserve"});return await h(e.session,e.turn),await n.recordOutput(e.session.id,e.turn.id,o),await h(e.session,e.turn),o});for(let s of["list_files","read_files","search_files"])l(s,"Inspect files within the public policy namespace.",{paths:{type:"array",items:{type:"string"}},path:{type:"string"},query:{type:"string"}},async(a,r)=>{let o=await O(t,e.turn.id,`${v} -e ${E(z)}`,r,void 0,JSON.stringify({action:s,args:a,writablePaths:["outputs"]}));if(o.code!==0)throw new Error("The confined target file operation failed.");return JSON.parse(o.stdout)});return i},"resolveTools");async function q(e){let t=await h(e.session,e.turn),i=e.action;if(!_(i.inputSchema,e.value).valid)throw new Error("The actual released Agent action input changed.");if(!Object.keys(t.publicHashes).some(o=>o.startsWith(`agents/${i.agentId}/`)))throw new Error("The Agent action has no public policy source closure.");await m(t),k??=await P(),await m(t);let l=f.join(t.root,"agents",i.agentId),s=`/workspace/work/outputs/${e.turn.id}`,a=["run",i.sourceActionId,"--cwd",`/workspace/work/agents/${i.agentId}`,"--input",JSON.stringify(e.value),"--out-dir",s],r=await O(t,e.turn.id,`${v} ${E(`${H}/${k.cliRelativePath}`)} ${a.map(E).join(" ")}`,e.signal,l);if(r.code!==0)throw new Error(`The confined released Agent action failed: ${r.stderr.slice(0,1e3)}`);return{output:r.stdout,agentSourcePath:`/workspace/work/agents/${i.agentId}`,runPath:s}}return u(q,"executeAction"),{admitSession:L,resolveTools:F,executeAction:q,ownsSession:u(e=>p.has(e),"ownsSession"),settleSession:u(async e=>{let t=p.get(e);try{t?.turnId&&await n.settleRemote?.(e,t.turnId)}finally{p.delete(e)}},"settleSession"),close:u(()=>{y.abort(new Error("Profile evaluation owner closed.")),p.clear()},"close")}}u(le,"createHostProfileEvaluationTools");export{W as a,le as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as he,b as ye,d as Ae,e as L}from"./chunk-BFKYRQMA.js";import{a as D,b as ge,c as Pe,d as we,e as Oe}from"./chunk-6QSSIT62.js";import{j as xe}from"./chunk-3QIB5FXI.js";import{d as N,e as B}from"./chunk-YR5ID2SS.js";import{E as ae,h as re}from"./chunk-Z4Z5UOZM.js";import{d as me}from"./chunk-FFRFSDBM.js";import{a}from"./chunk-FTQLQJQV.js";var De=new URL(B).hostname,be=new URL(N).hostname,$e=`${B}/opchat/v1`;function l(e){if(!e)return null;let n=e.trim();return n?n.replace(/\/+$/,""):null}a(l,"normalizeBaseUrl");function Y(e){let n=l(e);if(!n)return null;try{let o=new URL(n).hostname.toLowerCase();if(o===De)return B;if(o===be||o===`www.${be}`||o==="openpond.live"||o==="www.openpond.live")return B;if(o.startsWith("api."))return n}catch{return null}return null}a(Y,"mapUiBaseToApiBase");function Q(e,n){let t=l(process.env.OPENPOND_API_URL);if(t)return t;let o=l(e?.apiBaseUrl);if(o)return o;let r=l(n.apiBaseUrl);if(r)return r;let s=Y(process.env.OPENPOND_BASE_URL);return s||(Y(e?.baseUrl||n.baseUrl)??B)}a(Q,"resolvePublicApiBaseUrl");function X(e,n,t){return He(e,n,t)}a(X,"resolveHostedChatApiBaseUrl");function He(e,n,t){let o=typeof process<"u"?process.env:{};return J(o.OPENPOND_OPCHAT_API_URL)??J(e?.chatApiBaseUrl??n.chatApiBaseUrl)??J(o.OPENPOND_CHAT_API_URL)??Me(t)}a(He,"resolveOpChatApiBaseUrl");function J(e){let n=l(e);if(!n)return null;try{let t=new URL(n),o=t.pathname.split("/").filter(Boolean),r=o.findIndex(i=>i.toLowerCase()==="opchat");return r>=0?(t.pathname=`/${[...o.slice(0,r+1),"v1"].join("/")}`,t.search="",t.hash="",l(t.toString())??null):o.findIndex(i=>i.toLowerCase()==="v1")>=0?(t.pathname="/opchat/v1",t.search="",t.hash="",l(t.toString())??null):(t.pathname=`${t.pathname.replace(/\/+$/,"")}/opchat/v1`.replace(/\/{2,}/g,"/"),t.search="",t.hash="",l(t.toString())??null)}catch{return null}}a(J,"normalizeOpChatApiBaseUrl");function Me(e){return J(e)??$e}a(Me,"opChatBaseFromPublicApiBase");function $(e){return e?.trim()?e.trim():"production"}a($,"deriveEnvironment");function Z(e,n=process.env){let t=[e?.apiKey,e?.session?.token,e?.token,n.OPENPOND_API_KEY];for(let o of t){let r=typeof o=="string"?o.trim():"";if(r)return r}return null}a(Z,"accountToken");function P(e,n){return!!(e&&n&&e.toLowerCase()===n.toLowerCase())}a(P,"handleEquals");function b(e,n){return l(e)===l(n)}a(b,"baseUrlEquals");function q(e,n){return`${e?.trim().toLowerCase()||""}|${l(n)??"default"}`}a(q,"profileKey");function ee(e){return l(e?.baseUrl)}a(ee,"selectorBaseUrl");function _(e){let n=l(e.baseUrl);return n?{handle:e.handle,baseUrl:n}:{handle:e.handle}}a(_,"selectorFromAccount");function A(e){let n=typeof e?.handle=="string"?e.handle.trim():"";if(!n)return null;let t=l(e?.baseUrl);return t?{handle:n,baseUrl:t}:{handle:n}}a(A,"normalizeActiveProfile");function U(e,n){if(!P(e.handle,n.handle))return!1;let t=ee(n);return t?b(e.baseUrl,t):!l(e.baseUrl)}a(U,"accountMatchesSelector");function se(e,n){if(!P(e.handle,n.handle))return!1;let t=ee(n);return t?b(e.baseUrl,t):!l(e.baseUrl)}a(se,"profileMatchesSelector");function Ue(e,n,t){let o=Array.isArray(e.accounts)?e.accounts:[],r=n||process.env.OPENPOND_ACCOUNT?A({handle:n||process.env.OPENPOND_ACCOUNT||"",baseUrl:t??process.env.OPENPOND_BASE_URL??null}):A(e.activeProfile);if(r){let s=o.find(c=>U(c,r));if(s)return s;let i=o.filter(c=>P(c.handle,r.handle));return i.length===1?i[0]??null:null}return o[0]?o[0]:null}a(Ue,"findActiveAccount");function ke(e){let n=Array.isArray(e.accounts)?e.accounts:[],t=A(e.activeProfile)??(n[0]?_(n[0]):null);return ie(n.map(o=>({handle:o.handle,baseUrl:l(o.baseUrl),apiBaseUrl:l(o.apiBaseUrl),chatApiBaseUrl:l(o.chatApiBaseUrl),environment:$(o.environment),isActive:t?U(o,t):!1,hasApiKey:!!o.apiKey?.trim(),hasSessionToken:!!(o.session?.token?.trim()||o.token?.trim()),sessionAppId:o.session?.appId??null,sessionConversationId:o.session?.conversationId??null})))}a(ke,"fallbackProfilesFromConfig");function ie(e){let n=new Map;for(let t of e){let o=l(t.baseUrl),r=`${t.handle.toLowerCase()}|${o??"default"}`,s={...t,baseUrl:o,apiBaseUrl:l(t.apiBaseUrl),chatApiBaseUrl:l(t.chatApiBaseUrl),environment:$(t.environment),isActive:t.isActive},i=n.get(r);(!i||s.isActive&&!i.isActive||s.hasApiKey&&!i.hasApiKey)&&n.set(r,s)}return Array.from(n.values())}a(ie,"normalizeProfiles");function Be(e){return e.hasApiKey||e.hasSessionToken?"signed_in":"signed_out"}a(Be,"profileAuthHealth");function ze(e,n){return e?{reachable:e.reachable,authenticated:e.authenticated,apiBase:e.apiBase||n,latencyMs:e.latencyMs,status:e.status,service:e.service,checkedAt:e.checkedAt,error:e.error??null}:null}a(ze,"normalizeHealth");function Ee(e){let n=e?.account;return n?{id:n.id??null,email:n.email??null,name:n.name??null,handle:n.handle??null,image:n.image??null,timezone:n.timezone??null,isAdmin:n.isAdmin??null,isVerified:n.isVerified??null,dailyAgentAppId:n.dailyAgentAppId??null,dailyAgentDeploymentId:n.dailyAgentDeploymentId??null,credits:n.credits??null}:null}a(Ee,"normalizeProfile");function Fe(e){return(e??[]).map(n=>({...n,id:n.id||n.userProductId||n.openPondProductId||n.name,name:n.name,type:n.type,status:n.status,isActive:n.isActive??null,price:n.price??null,currency:n.currency??null,credits:n.credits??null}))}a(Fe,"normalizeProducts");function je(e){return e.handle.trim().toLowerCase()==="default"&&!l(e.baseUrl)&&!e.hasApiKey&&!e.hasSessionToken}a(je,"isEmptyDefaultProfile");function Ke(e){let n=e?.trim();return n?n.length>=12?`\u2022\u2022\u2022\u2022\u2022\u2022${n.slice(-6)}`:"\u2022\u2022\u2022\u2022\u2022\u2022":null}a(Ke,"apiKeyHint");function qe(e){return e?.auth?.authType!=="openpond-api-key"||!e.auth.keyAccess?null:{ownerType:e.auth.keyAccess.ownerType,teamId:e.auth.keyAccess.teamId,scopes:e.auth.scopes}}a(qe,"apiKeyAccess");function H(e){let{config:n,profiles:t,account:o,token:r,apiBaseUrl:s,accountResponse:i,accountProfiles:c,health:m,authFailed:g,error:f}=e,w=X(o,n,s),h=Ee(i??null),C=A(n.activeProfile),v=(o?_(o):null)??C,O=h?.handle||o?.handle||v?.handle||null,I=(v?t.find(p=>se(p,v)):null)??t.find(p=>p.isActive)??null,y=g?"auth_error":r?"signed_in":"signed_out",d=h?.name||h?.handle||h?.email||O||"Signed out",R=l(I?.baseUrl||o?.baseUrl||N),k=$(I?.environment||o?.environment),x=A(v)??(O?A({handle:O,baseUrl:I?.baseUrl??o?.baseUrl}):null),j=(t.length>0?t:O?[{handle:O,baseUrl:ee(x)??l(o?.baseUrl),apiBaseUrl:s,chatApiBaseUrl:w,environment:k,isActive:!0,hasApiKey:!!r,hasSessionToken:!1,sessionAppId:null,sessionConversationId:null}]:[]).filter(p=>!je(p));return{state:y,activeProfile:x,label:d,email:h?.email??null,avatarUrl:h?.image??null,environment:k,baseUrl:R,apiBaseUrl:s,chatApiBaseUrl:w,creditsLabel:h?.credits??null,profile:h,products:Fe(i?.products),apiHealth:ze(m??null,s),accounts:j.map(p=>{let T=l(p.baseUrl),Le=n.accounts?.find(fe=>P(fe.handle,p.handle)&&b(fe.baseUrl,T)),oe=c?.[q(p.handle,T)]??null,K=Ee(oe?.response??null);return{handle:p.handle,baseUrl:T,apiBaseUrl:l(p.apiBaseUrl),chatApiBaseUrl:l(p.chatApiBaseUrl),environment:$(p.environment),isActive:x?se(p,x):!1,authHealth:oe?.authFailed?"auth_error":Be(p),displayLabel:K?.name||K?.handle||K?.email||p.handle,email:K?.email??null,avatarUrl:K?.image??null,apiKeyHint:Ke(Le?.apiKey),apiKeyAccess:qe(oe?.response??null)}}),error:f??m?.error??null}}a(H,"toAccountState");async function We(e){try{return ie(await Pe())}catch{return ke(e)}}a(We,"loadProfiles");async function u(e,n){let t=await ge(),o=await We(t),r=Ue(t,e,n),s=Z(r),i=Q(r,t),c=X(r,t,i);return{config:t,profiles:o,account:r,token:s,apiBaseUrl:i,chatApiBaseUrl:c,accountState:H({config:t,profiles:o,account:r,token:s,apiBaseUrl:i})}}a(u,"loadOpenPondAccountContext");async function Ve(e){let n=l(e.baseUrl);return await we(e.handle,{baseUrl:n}),u(e.handle,n)}a(Ve,"switchOpenPondAccount");import{randomUUID as Ge}from"node:crypto";function M(e){return e instanceof Error?e.message:String(e)}a(M,"errorMessage");var Je=15e3;function Ye(e){return e===ae?"OpenPond Chat":e==="deepseek-v4-flash"?"DeepSeek V4 Flash":e.replace(/[-_/]+/g," ")}a(Ye,"displayNameForHostedModel");function Qe(e){let n=typeof e.id=="string"?e.id:null;return n?{id:n,displayName:Ye(n),ownedBy:typeof e.owned_by=="string"?e.owned_by:null,streaming:!0,raw:e}:null}a(Qe,"normalizeHostedModel");async function Xe(){let e=await u();if(!e.token)return{models:[],error:"No OpenPond API key or session token is configured."};try{return{models:(await nn({apiBaseUrl:e.chatApiBaseUrl,token:e.token})).data.map(o=>Qe(o)).filter(o=>!!o),error:null}}catch(n){return{models:[],error:M(n)}}}a(Xe,"loadOpenPondHostedModels");async function Ze(){let e=await u();if(!e.token)return{catalog:null,error:"No OpenPond API key or session token is configured."};let n=new AbortController,t=setTimeout(()=>{n.abort(new Error("OpenPond provider catalog request timed out."))},Je);try{return{catalog:await Se({apiBaseUrl:e.chatApiBaseUrl,token:e.token,signal:n.signal}),error:null}}catch(o){return{catalog:null,error:M(o)}}finally{clearTimeout(t)}}a(Ze,"loadOpenPondProviderCatalog");async function*en(e){let n=await u();if(!n.token)throw new Error("OpenPond is signed out. Add an account in Settings before using OpenPond Chat.");yield*Ce({apiBaseUrl:n.chatApiBaseUrl,token:n.token,model:e.model||ae,messages:e.messages,tools:e.tools,toolChoice:e.toolChoice,requestId:e.requestId,reasoningEffort:e.reasoningEffort,maxTokens:e.maxTokens,temperature:e.temperature,topP:e.topP,signal:e.signal})}a(en,"streamOpenPondHostedChatTurn");async function nn(e){let n=le(e.apiBaseUrl,"models"),t=await fetch(n,{method:"GET",headers:ce(e.token,"application/json"),signal:e.signal});if(!t.ok)throw new Error(`OpenPond OpChat model list failed: ${t.status} ${await ue(t)}`);return await t.json()}a(nn,"listOpChatModels");async function Se(e){let n=le(e.apiBaseUrl,"provider-catalog"),t=await fetch(n,{method:"GET",headers:ce(e.token,"application/json"),signal:e.signal});if(!t.ok)throw new Error(`OpenPond OpChat provider catalog failed: ${t.status} ${await ue(t)}`);let o=await t.json();return!o||typeof o!="object"||!Array.isArray(o.providers)?re.parse(o):re.parse({...o,providers:o.providers.filter(r=>r!==null&&typeof r=="object"&&me.safeParse(r.id).success)})}a(Se,"listOpChatProviderCatalog");async function*Ce(e){let n=le(e.apiBaseUrl,"chat/completions"),t=await fetch(n,{method:"POST",headers:ce(e.token,"text/event-stream",e.requestId),body:JSON.stringify(ln(e,!0)),signal:e.signal});if(!t.ok)throw new Error(`OpenPond OpChat request failed: ${t.status} ${await ue(t)}`);if(!t.body)throw new Error("OpenPond OpChat request failed: streaming response body is missing.");let o=new Map,r=!1,s=null,i={},c="",m=null,g=tn(t.headers),f=t.body.getReader(),w=new TextDecoder,h="",C=[],te=a(()=>{if(C.length===0)return[];let y=C.join(`
|
|
3
|
+
`);if(C=[],y==="[DONE]")return r=!0,[];let d;try{d=JSON.parse(y)}catch{throw new Error("OpenPond OpChat request failed: malformed streaming event.")}if(d&&typeof d=="object"&&"error"in d)throw new Error(`OpenPond OpChat request failed: ${Ie(d)}`);i=d;let R=d&&typeof d=="object"?d:{},k=Array.isArray(R.choices)?R.choices:[],x=k[0]&&typeof k[0]=="object"?k[0]:{},G=x.delta&&typeof x.delta=="object"?x.delta:{},j=[],p=_e(G.reasoning_content);p&&(c+=p,j.push({type:"reasoning_delta",text:p,raw:d}));let T=_e(G.content);return T&&j.push({type:"text_delta",text:T,raw:d}),an(o,G.tool_calls),s=z(x.finish_reason)??s,m=dn(d)??m,j},"consumeEvent"),v=a(y=>{let d=y.endsWith("\r")?y.slice(0,-1):y;return d?d.startsWith(":")?[]:(d.startsWith("data:")&&C.push(d.slice(5).trimStart()),[]):te()},"consumeLine");try{for(;;){let y=await f.read();if(y.done)break;h+=w.decode(y.value,{stream:!0});let d=h.split(`
|
|
4
|
+
`);h=d.pop()??"";for(let R of d)for(let k of v(R))yield k}if(h+=w.decode(),h)for(let y of v(h))yield y;for(let y of te())yield y}finally{f.releaseLock()}if(!r)throw new Error("OpenPond OpChat request failed: stream ended before [DONE].");let O=sn(o);O.length>0&&(yield{type:"tool_call_delta",toolCalls:O,raw:i}),O.length>0&&c&&(yield{type:"continuation",continuation:{kind:"chat_completions_reasoning",reasoningContent:c},raw:i});let I=on(m,g);I&&(yield{type:"usage",usage:I,raw:i}),yield{type:"finish",finishReason:s,raw:i}}a(Ce,"streamOpChatChatCompletion");function tn(e){let n=ve(e,["fireworks-prompt-tokens","prompt-tokens"]),t=ve(e,["fireworks-cached-prompt-tokens","cached-prompt-tokens"]);return t===null?null:{...n===null?{}:{prompt_tokens:n},cached_input_tokens:t,cache_telemetry_source:"provider_response_headers"}}a(tn,"cacheUsageFromResponseHeaders");function ve(e,n){for(let t of n){let o=e.get(t);if(o===null||!/^\d+$/.test(o.trim()))continue;let r=Number(o);if(Number.isSafeInteger(r)&&r>=0)return r}return null}a(ve,"firstHeaderTokenCount");function on(e,n){if(!n||rn(e))return e;let t={...e??{},cached_input_tokens:n.cached_input_tokens,cache_telemetry_source:"provider_response_headers"};return E(e?.prompt_tokens)===null&&n.prompt_tokens!==void 0&&(t.prompt_tokens=n.prompt_tokens),t}a(on,"usageWithResponseHeaderCache");function rn(e){return e?E(e.cached_input_tokens)!==null||E(e.cache_read_input_tokens)!==null||E(e.cache_creation_input_tokens)!==null||E(e.prompt_cache_hit_tokens)!==null||E(e.prompt_cache_miss_tokens)!==null?!0:E(e.prompt_tokens_details?.cached_tokens)!==null||E(e.input_tokens_details?.cached_tokens)!==null:!1}a(rn,"usageHasCacheTelemetry");function E(e){if(typeof e=="number"&&Number.isSafeInteger(e)&&e>=0)return e;if(typeof e!="string"||!/^\d+$/.test(e.trim()))return null;let n=Number(e);return Number.isSafeInteger(n)?n:null}a(E,"usageTokenCount");function an(e,n){Array.isArray(n)&&n.forEach((t,o)=>{if(!t||typeof t!="object")return;let r=t,s=typeof r.index=="number"&&Number.isInteger(r.index)?r.index:o,i=e.get(s)??{arguments:""};typeof r.id=="string"&&(i.id=r.id);let c=r.function&&typeof r.function=="object"?r.function:{};typeof c.name=="string"&&(i.name=`${i.name??""}${c.name}`),typeof c.arguments=="string"&&(i.arguments+=c.arguments),e.set(s,i)})}a(an,"mergeOpChatToolCallDeltas");function sn(e){return[...e.entries()].sort(([n],[t])=>n-t).flatMap(([,n])=>n.id&&n.name?[{id:n.id,type:"function",function:{name:n.name,arguments:n.arguments}}]:[])}a(sn,"completedOpChatToolCalls");function ln(e,n){let t={model:e.model,messages:e.messages.map(un),stream:n};return e.tools&&(t.tools=e.tools),e.toolChoice!==void 0&&(t.tool_choice=e.toolChoice),typeof e.maxTokens=="number"&&(t.max_tokens=e.maxTokens),typeof e.temperature=="number"&&(t.temperature=e.temperature),typeof e.topP=="number"&&(t.top_p=e.topP),Object.assign(t,cn(e.reasoningEffort)),t}a(ln,"buildOpChatBody");function cn(e){return e?e==="off"?{thinking:{type:"disabled"}}:{thinking:{type:"enabled"},reasoning_effort:e}:{}}a(cn,"opChatReasoningFields");function un(e){let{continuation:n,images:t,...o}=e,r=t?.length?[...typeof e.content=="string"&&e.content.trim()?[{type:"text",text:e.content}]:[],...t.map(s=>({type:"image_url",image_url:{url:s.url,...s.detail?{detail:s.detail}:{}}}))]:e.content;return e.role==="assistant"&&n?.kind==="chat_completions_reasoning"?{...o,...r!==void 0?{content:r}:{},reasoning_content:n.reasoningContent}:{...o,...r!==void 0?{content:r}:{}}}a(un,"opChatMessage");function le(e,n){let t=e.trim().replace(/\/+$/,"");if(!t)throw new Error("OpenPond OpChat API base URL is required.");return`${t}/${n}`}a(le,"opChatEndpointUrl");function ce(e,n,t){let o=e.trim();if(!o)throw new Error("OpenPond API key is required for OpChat.");let r=new Headers;r.set("Authorization",`Bearer ${o}`),r.set("Content-Type","application/json"),r.set("Accept",n),r.set("x-openpond-client","openpond-app");let s=t||Ge();return r.set("x-openpond-request-id",s),r.set("x-request-id",s),r}a(ce,"opChatHeaders");async function ue(e){let n=await e.text().catch(()=>"");if(!n)return e.statusText||`HTTP ${e.status}`;try{return Ie(JSON.parse(n))}catch{return n}}a(ue,"readOpChatError");function Ie(e){if(!e||typeof e!="object")return String(e||"unknown_error");let n=e,t=n.error;if(t&&typeof t=="object"){let o=t;return[z(o.code),z(o.type),z(o.message)].filter(Boolean).join(": ")}return[z(n.error),z(n.message)].filter(Boolean).join(": ")||JSON.stringify(e)}a(Ie,"errorMessageFromPayload");function dn(e){if(!e||typeof e!="object")return null;let n=e.usage;return!n||typeof n!="object"?null:n}a(dn,"parseUsage");function z(e){return typeof e=="string"&&e.trim()?e:null}a(z,"stringValue");function _e(e){return typeof e=="string"&&e.length>0?e:null}a(_e,"streamTextValue");import{readFileSync as pn}from"node:fs";var W;function fn(){if(W!==void 0)return W??"openpond-code bundled";try{let e=new URL("../package.json",import.meta.resolve("openpond")),n=JSON.parse(pn(e,"utf8"));W=typeof n.version=="string"?`openpond-code@${n.version}`:null}catch{W=null}return W??"openpond-code bundled"}a(fn,"getBundledRuntimeVersion");import{spawn as mn}from"node:child_process";function Re(e,n=process.platform){return n==="darwin"?{command:"open",args:[e]}:n==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",e]}:{command:"xdg-open",args:[e]}}a(Re,"resolveSystemBrowserCommand");async function hn(e,n={}){let t=n.command??Re(e),o=n.handoffTimeoutMs??1500;return new Promise(r=>{let s=!1,i=null,c=a(g=>{s||(s=!0,i&&clearTimeout(i),r(g))},"finish"),m=mn(t.command,t.args,{detached:!1,shell:!1,stdio:"ignore",windowsHide:!0});m.once("error",g=>{let f=g.code;c({opened:!1,error:f?`browser launcher ${t.command} failed (${f})`:`browser launcher ${t.command} failed`})}),m.once("close",(g,f)=>{if(g===0){c({opened:!0});return}let w=f?`signal ${f}`:`code ${g??"unknown"}`;c({opened:!1,error:`browser launcher ${t.command} exited with ${w}`})}),i=setTimeout(()=>{m.unref(),c({opened:!0})},o),i.unref()})}a(hn,"openUrlWithSystemBrowser");import{createHash as yn}from"node:crypto";function de(e){return yn("sha256").update(JSON.stringify([e.accountState.activeProfile,e.apiBaseUrl,e.chatApiBaseUrl,e.token])).digest("hex")}a(de,"authorityKey");var V=null,F=null;async function An(e){let n=de(e);if(V?.key===n&&V.expiresAt>Date.now())return V.response;if(F?.key===n)return F.promise;V=null;let t={key:n,promise:L(e.apiBaseUrl,e.token)};F=t;try{let o=await t.promise;return F===t&&o.account?.id&&(V={key:n,response:o,expiresAt:Date.now()+5e3}),o}finally{F===t&&(F=null)}}a(An,"authenticate");async function gn(){let e=await u();if(!e.token)return e;let n=await An(e),t=await u();if(de(t)!==de(e))throw new Error("openpond_account_authority_changed");if(!n.account?.id)throw new Error("openpond_authenticated_owner_unavailable");return{...t,accountState:H({...t,accountResponse:n})}}a(gn,"loadAuthenticatedOpenPondAccountContext");function Pn(e){if(!e||typeof e!="object")return null;let n=e,t=typeof n.id=="string"?n.id:null,o=typeof n.name=="string"?n.name:t;if(!t||!o)return null;let r=n.latestDeployment&&typeof n.latestDeployment=="object"?n.latestDeployment:null,s=xe.safeParse(n.sandboxActionRegistry);return{id:t,name:o,description:typeof n.description=="string"?n.description:null,visibility:typeof n.visibility=="string"?n.visibility:null,gitOwner:typeof n.gitOwner=="string"?n.gitOwner:null,gitRepo:typeof n.gitRepo=="string"?n.gitRepo:null,gitHost:typeof n.gitHost=="string"?n.gitHost:null,defaultBranch:typeof n.defaultBranch=="string"?n.defaultBranch:null,sandbox:n.sandbox===!0,sandboxActionRegistry:s.success?s.data:null,sandboxManifestHash:typeof n.sandboxManifestHash=="string"?n.sandboxManifestHash:null,sandboxManifestPath:typeof n.sandboxManifestPath=="string"?n.sandboxManifestPath:null,sandboxManifestSyncedAt:typeof n.sandboxManifestSyncedAt=="string"?n.sandboxManifestSyncedAt:n.sandboxManifestSyncedAt instanceof Date?n.sandboxManifestSyncedAt.toISOString():null,sandboxManifestError:typeof n.sandboxManifestError=="string"?n.sandboxManifestError:null,updatedAt:typeof n.updatedAt=="string"?n.updatedAt:null,latestDeployment:r?{id:typeof r.id=="string"?r.id:void 0,status:typeof r.status=="string"?r.status:void 0,deploymentDomain:typeof r.deploymentDomain=="string"?r.deploymentDomain:null,createdAt:typeof r.createdAt=="string"?r.createdAt:void 0,isProduction:typeof r.isProduction=="boolean"?r.isProduction:null,gitBranch:typeof r.gitBranch=="string"?r.gitBranch:null}:null,scheduleSummary:On(n.scheduleSummary)}}a(Pn,"normalizeApp");function S(e){return typeof e=="string"?e:e instanceof Date?e.toISOString():null}a(S,"normalizeDateString");function wn(e){if(!e||typeof e!="object")return null;let n=e,t=typeof n.id=="string"?n.id:null,o=typeof n.name=="string"?n.name:t,r=typeof n.deploymentId=="string"?n.deploymentId:null;return!t||!o||!r?null:{id:t,name:o,description:typeof n.description=="string"?n.description:null,scheduleType:typeof n.scheduleType=="string"?n.scheduleType:"cron",scheduleExpression:typeof n.scheduleExpression=="string"?n.scheduleExpression:"",enabled:!!n.enabled,rawEnabled:typeof n.rawEnabled=="boolean"?n.rawEnabled:void 0,syncStatus:typeof n.syncStatus=="string"?n.syncStatus:null,syncError:typeof n.syncError=="string"?n.syncError:null,startAt:S(n.startAt),endAt:S(n.endAt),maxRuns:typeof n.maxRuns=="number"?n.maxRuns:null,executionCount:typeof n.executionCount=="number"?n.executionCount:null,lifecycleStatus:typeof n.lifecycleStatus=="string"?n.lifecycleStatus:null,lifecycleReason:typeof n.lifecycleReason=="string"?n.lifecycleReason:null,lastExecutionAt:S(n.lastExecutionAt),lastExecutionStatus:typeof n.lastExecutionStatus=="string"?n.lastExecutionStatus:null,lastRunNowAt:S(n.lastRunNowAt),lastRunNowStatus:typeof n.lastRunNowStatus=="string"?n.lastRunNowStatus:null,updatedAt:S(n.updatedAt)??new Date().toISOString(),deploymentId:r,isProduction:typeof n.isProduction=="boolean"?n.isProduction:void 0,payload:n.payload}}a(wn,"normalizeSchedule");function On(e){if(!e||typeof e!="object")return null;let n=e,t=Array.isArray(n.schedules)?n.schedules.map(wn).filter(i=>!!i):[],o=typeof n.total=="number"?n.total:t.length,r=typeof n.active=="number"?n.active:t.filter(i=>i.enabled).length,s=typeof n.paused=="number"?n.paused:Math.max(0,o-r);return{total:o,active:r,paused:s,enabled:typeof n.enabled=="number"?n.enabled:r,disabled:typeof n.disabled=="number"?n.disabled:s,nextRunAt:S(n.nextRunAt),lastRunAt:S(n.lastRunAt),schedules:t,truncated:typeof n.truncated=="boolean"?n.truncated:void 0}}a(On,"normalizeScheduleSummary");async function xn(e){let n=Array.isArray(e.config.accounts)?e.config.accounts:[],t=await Promise.all(n.map(async o=>{let r=q(o.handle,o.baseUrl),s=Z(o);if(!s)return[r,{response:null,authFailed:!1,error:null}];try{return[r,{response:await L(Q(o,e.config),s),authFailed:!1,error:null}]}catch(i){return[r,{response:null,authFailed:!0,error:M(i)}]}}));return Object.fromEntries(t)}a(xn,"loadAccountProfileLookups");async function Te(e){let n=await xn(e),t=e.account?n[q(e.account.handle,e.account.baseUrl)]??null:null,o=t?.response??null,r=e.token&&t?.authFailed?t.error||"OpenPond account authentication failed.":null;return{account:H({...e,accountResponse:o,accountProfiles:n,authFailed:!!r,error:r})}}a(Te,"loadOpenPondAccountStateForContext");async function bn(){return Te(await u())}a(bn,"loadOpenPondAccountState");async function Ne(e={}){let n=await u(),t=Te(n);if(!n.token)return{...await t,apps:[],error:"No OpenPond API key or session token is configured."};let[o,r]=await Promise.allSettled([t,he(n.apiBaseUrl,n.token,{handle:n.account?.handle,limit:e.limit??20,offset:e.offset??0,includeScheduled:e.includeScheduled??!0})]);if(o.status==="rejected")throw o.reason;return{account:o.value.account,apps:r.status==="fulfilled"?r.value.map(Pn).filter(s=>!!s):[],error:r.status==="rejected"?M(r.reason):null}}a(Ne,"loadOpenPondApps");async function Un(e){let n=await u();if(!n.token)throw new Error("No OpenPond API key or session token is configured.");return{account:n,response:await ye(n.apiBaseUrl,n.token,e)}}a(Un,"createOpenPondRepoApp");import{createHash as kn}from"node:crypto";function Bn(e){return`account-${kn("sha256").update(e).digest("hex").slice(0,8)}`}a(Bn,"fallbackHandleForApiKey");function ne(e){let n=e?.trim();return n?n.replace(/^@/,""):null}a(ne,"normalizeDerivedHandle");async function En(e,n){let t=ne(e.handle);if(t)return t;try{let r=(await L(n,e.apiKey)).account,s=ne(r.handle)??ne(r.email?.split("@")[0])??ne(r.id);if(s)return s}catch{}return Bn(e.apiKey)}a(En,"deriveHandleForApiKey");async function vn(e){let n=e.baseUrl??N,t=l(e.apiBaseUrl)??Y(n)??B,o=l(e.chatApiBaseUrl),r=await En(e,t);return await Oe({handle:r,apiKey:e.apiKey,baseUrl:n,apiBaseUrl:t,chatApiBaseUrl:o,environment:e.environment??"production",setActive:e.setActive}),u(r,n)}a(vn,"saveOpenPondAccount");function _n(e,n,t){let o=l(t),r=e.findIndex(i=>P(i.handle,n)&&b(i.baseUrl,o));if(r!==-1)return r;let s=e.map((i,c)=>({account:i,index:c})).filter(({account:i})=>P(i.handle,n));if(s.length===1)return s[0].index;if(s.length>1)throw new Error(`Multiple OpenPond accounts match ${n}; select one with its base URL.`);return-1}a(_n,"findAccountIndex");async function Sn(e){let n=e.handle.trim();if(!n)throw new Error("OpenPond account handle is required.");return await D(t=>{let o=(t.accounts??[]).map(m=>({...m})),r=_n(o,n,e.baseUrl);if(r===-1)throw new Error(`OpenPond account not found: ${n}`);let s=o[r],i=A(t.activeProfile),c=!!(i&&U(s,i));o.splice(r,1),t.accounts=o,(c||!i||!o.some(m=>U(m,i)))&&(o[0]?t.activeProfile=_(o[0]):delete t.activeProfile)}),u()}a(Sn,"removeOpenPondAccount");async function Cn(){let e;return await D(n=>{let t=A(n.activeProfile),o=(n.accounts??[]).map(s=>({...s})),r=t?o.findIndex(s=>U(s,t)):0;if(r<0||!o[r])throw new Error("No active OpenPond account to log out.");e={...o[r]},delete e.apiKey,delete e.session,o[r]=e,n.accounts=o}),u(e.handle,e.baseUrl)}a(Cn,"signOutOpenPondAccount");function In(e,n,t){let o=l(t),r=e.findIndex(i=>P(i.handle,n)&&b(i.baseUrl,o));if(r!==-1)return r;let s=e.map((i,c)=>({account:i,index:c})).filter(({account:i})=>P(i.handle,n));if(s.length===1)return s[0].index;if(s.length>1)throw new Error(`Multiple OpenPond accounts match ${n}; select one with its current base URL.`);return-1}a(In,"findAccountIndex");function pe(e,n,t){if(t===void 0)return;let o=l(t);if(o){e[n]=o;return}(t===null||t.trim()==="")&&delete e[n]}a(pe,"applyOptionalUrl");async function Rn(e){let n=e.handle.trim();if(!n)throw new Error("OpenPond account handle is required.");let t;return await D(o=>{let r=(o.accounts??[]).map(f=>({...f})),s=In(r,n,e.currentBaseUrl);if(s===-1)throw new Error(`OpenPond account not found: ${n}`);let i=r[s];if(t={...i},e.apiKey!==void 0){let f=e.apiKey.trim();if(!f)throw new Error("OpenPond API key cannot be empty.");t.apiKey=f,delete t.session,delete t.token}if(pe(t,"baseUrl",e.baseUrl),pe(t,"apiBaseUrl",e.apiBaseUrl),pe(t,"chatApiBaseUrl",e.chatApiBaseUrl),e.environment===null?delete t.environment:typeof e.environment=="string"&&e.environment.trim()&&(t.environment=e.environment.trim()),r.findIndex((f,w)=>w!==s&&P(f.handle,t.handle)&&b(f.baseUrl,t.baseUrl))!==-1)throw new Error("Another OpenPond account already uses that handle and base URL.");let m=A(o.activeProfile),g=!!(m&&U(i,m));r[s]=t,o.accounts=r,o.activeProfile=e.setActive||g?_(t):o.activeProfile}),u(t.handle,t.baseUrl)}a(Rn,"updateOpenPondAccountConfig");async function Tn(e){let n=await u();if(!n.token)throw new Error("OpenPond is signed out. Add an account before reading app config.");return Ae(n.apiBaseUrl,n.token,e.appId)}a(Tn,"getOpenPondAppEnvironment");function Nn(e,n){let t="",o=a(r=>{r.startsWith(e)&&n(JSON.parse(r.slice(e.length)))},"processLine");return{push(r){for(t+=r;;){let s=Ln(t);if(s<0)return;let i=t.slice(0,s).replace(/\r$/,""),c=t[s]==="\r"&&t[s+1]===`
|
|
5
|
+
`?2:1;t=t.slice(s+c),o(i)}},flush(){let r=t.trimEnd();t="",r&&o(r)}}}a(Nn,"createReadyLineParser");function Ln(e){let n=e.indexOf(`
|
|
6
|
+
`),t=e.indexOf("\r");return n<0?t:t<0?n:Math.min(n,t)}a(Ln,"nextLineEnd");export{u as a,Ve as b,gn as c,bn as d,Ne as e,Un as f,Xe as g,Ze as h,en as i,Ce as j,vn as k,Sn as l,Cn as m,Rn as n,Tn as o,fn as p,Nn as q,hn as r};
|