openpond 0.2.53 → 0.2.55
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 +1514 -100
- package/dist/app-server.js +1 -1
- package/dist/chunks/actions-command-WTFZA7LF.js +2 -0
- package/dist/chunks/{app-layer-I7MZYVLL.js → app-layer-Y2UERCPY.js} +1 -1
- package/dist/chunks/app-server-runtime-2RM3N4I6.js +2 -0
- package/dist/chunks/apps-KDNWYO3G.js +2 -0
- package/dist/chunks/chunk-2DFR7PJ4.js +2460 -0
- package/dist/chunks/chunk-4CRM2ADK.js +2 -0
- package/dist/chunks/{chunk-7ZG3IT7C.js → chunk-4WEUCGJ3.js} +6 -6
- package/dist/chunks/chunk-55G6B54U.js +6 -0
- package/dist/chunks/chunk-73G5UYBB.js +12 -0
- package/dist/chunks/{chunk-DALJMSJG.js → chunk-ARQEJOEK.js} +24 -24
- package/dist/chunks/chunk-B7QDZPNX.js +2 -0
- package/dist/chunks/chunk-BFKYRQMA.js +2 -0
- package/dist/chunks/{chunk-AH22RHPS.js → chunk-BQAF5P7K.js} +2 -2
- package/dist/chunks/{chunk-YJ4PNAST.js → chunk-BTI4N7YO.js} +1 -1
- package/dist/chunks/chunk-C6D4WAYN.js +6 -0
- package/dist/chunks/chunk-CGBI2VYJ.js +2 -0
- package/dist/chunks/chunk-DLVPSCTB.js +2 -0
- package/dist/chunks/{chunk-UJ5EFSEC.js → chunk-G6JMQGX7.js} +1 -1
- package/dist/chunks/chunk-GGIG3XU7.js +3 -0
- package/dist/chunks/chunk-IODUCRBA.js +58 -0
- package/dist/chunks/chunk-JIMU3KDA.js +24 -0
- package/dist/chunks/chunk-JUJSA7KI.js +22 -0
- package/dist/chunks/chunk-K5SBVO3B.js +195 -0
- package/dist/chunks/chunk-KD3QVRIJ.js +21 -0
- package/dist/chunks/chunk-KGNCKIFP.js +3 -0
- package/dist/chunks/chunk-L4235TRQ.js +140 -0
- package/dist/chunks/{chunk-N5QNXMIS.js → chunk-MH3LHSGX.js} +1 -1
- package/dist/chunks/chunk-MVF3F5QS.js +2 -0
- package/dist/chunks/{chunk-N3DEA6PG.js → chunk-NNIRIUSY.js} +1 -1
- package/dist/chunks/{chunk-WITSXYEW.js → chunk-NOTXPD2T.js} +1 -1
- package/dist/chunks/{chunk-T5LE6R5S.js → chunk-OSIO7PLX.js} +1 -1
- package/dist/chunks/chunk-OULAKUIN.js +2 -0
- package/dist/chunks/chunk-OWNLDB2O.js +2 -0
- package/dist/chunks/{chunk-NAZ26IZL.js → chunk-Q7AXHFZV.js} +1 -1
- package/dist/chunks/chunk-QDHMP5FS.js +2 -0
- package/dist/chunks/chunk-QKD5OMDI.js +2 -0
- package/dist/chunks/{chunk-YD55Z5H3.js → chunk-QRAKXZOC.js} +10 -10
- package/dist/chunks/{chunk-JDLAHVAJ.js → chunk-R27YGT77.js} +1 -1
- package/dist/chunks/chunk-R2BSIRYL.js +3 -0
- package/dist/chunks/chunk-SHQOIROR.js +42 -0
- package/dist/chunks/chunk-STDMBJOQ.js +9 -0
- package/dist/chunks/chunk-T4QGDQHP.js +4 -0
- package/dist/chunks/{chunk-R3XFY7VL.js → chunk-TERVLCRG.js} +1 -1
- package/dist/chunks/{chunk-PA7XP42P.js → chunk-U2YMBCX7.js} +1 -1
- package/dist/chunks/{chunk-GXSTZBM6.js → chunk-UA5DA5I2.js} +1 -1
- package/dist/chunks/chunk-VJEZPDBS.js +5 -0
- package/dist/chunks/chunk-WDFLCNRC.js +8 -0
- package/dist/chunks/chunk-WZYRAR7X.js +16 -0
- package/dist/chunks/chunk-YDT7L3VZ.js +24 -0
- package/dist/chunks/chunk-YR5ID2SS.js +2 -0
- package/dist/chunks/chunk-YUPBAWBJ.js +554 -0
- package/dist/chunks/cli-465VC2WP.js +2 -0
- package/dist/chunks/{configuration-command-MATM4XR5.js → configuration-command-LAAP2EXT.js} +1 -1
- package/dist/chunks/connected-evidence-XM626247.js +2 -0
- package/dist/chunks/{continual-PKK2BOTB.js → continual-TTGJ6YTR.js} +1 -1
- package/dist/chunks/core-commands-W7EK552V.js +2 -0
- package/dist/chunks/datasets-QJWYTTQL.js +2 -0
- package/dist/chunks/desktop-test-3B2D34NF.js +3 -0
- package/dist/chunks/dist-FAJX2UBW.js +2 -0
- package/dist/chunks/{dist-4HV2W6V4.js → dist-HUAE2KFZ.js} +1 -1
- package/dist/chunks/{chunk-6VF3Q6QJ.js → dist-SKYG5LZO.js} +2 -4
- package/dist/chunks/evaluation-coordination-2MONR4AX.js +2 -0
- package/dist/chunks/experiment-improvements-WVQ5FK46.js +2 -0
- package/dist/chunks/experiments-S5UQ32QB.js +2 -0
- package/dist/chunks/extension-DWMY6D2R.js +4 -0
- package/dist/chunks/{help-WLKSACLZ.js → help-A72QDRNG.js} +1 -1
- package/dist/chunks/hosted-experiment-improvement-2OWOQLHC.js +3 -0
- package/dist/chunks/hosted-harness-runtime-TGFMAV7W.js +2 -0
- package/dist/chunks/hosted-profile-candidate-WQSI6HZO.js +3 -0
- package/dist/chunks/hosted-profile-compiler-Z2A4TEA6.js +2 -0
- package/dist/chunks/hosted-profile-evaluation-control-FKGARUEE.js +2 -0
- package/dist/chunks/hosted-profile-evaluation-inspection-QOY2JKV4.js +3 -0
- package/dist/chunks/hosted-profile-evaluation-preparation-WVP6CALP.js +3 -0
- package/dist/chunks/human-review-TGHQKXFZ.js +2 -0
- package/dist/chunks/{import-V3HUGRHR.js → import-4UE5XNSG.js} +1 -1
- 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-R2XBMMEM.js +2 -0
- package/dist/chunks/opchat-WULL6CUP.js +3 -0
- package/dist/chunks/organizations-I37HISVX.js +2 -0
- package/dist/chunks/profile-NOZ6TVXL.js +3 -0
- package/dist/chunks/project-agent-T6XKC54C.js +2 -0
- package/dist/chunks/sandbox-command-STB47FRY.js +2 -0
- package/dist/chunks/{sandbox-template-BBGGPJMI.js → sandbox-template-LKGBDVJ4.js} +1 -1
- package/dist/chunks/sql-execution-process-source-B4HQM6ZV.js +2 -0
- package/dist/chunks/src-T3KWWCAH.js +322 -0
- package/dist/chunks/{src-CR6UZYTX.js → src-ZWJ5IO7A.js} +1 -1
- package/dist/chunks/{taskset-LUG3ZU6J.js → taskset-RNYDR4GS.js} +1 -1
- package/dist/chunks/{teams-bot-7I4BAUVO.js → teams-bot-H7XT23XB.js} +1 -1
- package/dist/chunks/{training-XHE6FVII.js → training-M6FAPRSJ.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/web/assets/App-CLFfy_Av.js +154 -0
- package/dist/web/assets/App-CTlAPuCY.css +1 -0
- package/dist/web/assets/{AppDialog-BdusXgU0.js → AppDialog-CPHTPqrx.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-C4uRpnBz.js → AppTerminalPanel-BVj5Tj93.js} +2 -2
- package/dist/web/assets/AppsView-O69zEBY3.js +1 -0
- package/dist/web/assets/{BrowserSidebar-Bl7V6YO2.js → BrowserSidebar-Pr_Kpe8p.js} +1 -1
- package/dist/web/assets/{CartesianChart-BstFbsdn.js → CartesianChart-JPqo6YOf.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-B8YAf0c1.js → CollaborationTabs-CAJcQFn2.js} +1 -1
- package/dist/web/assets/{CommandMenu-DZct7zUJ.js → CommandMenu-B-w53n9A.js} +1 -1
- package/dist/web/assets/{CommunityView-CR0-W-uG.js → CommunityView-DbZKK8_P.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-DR-Qo7b4.js → ComposerCreateImproveStrip-3_083PF4.js} +1 -1
- package/dist/web/assets/{GetStartedView-xqQoMMei.js → GetStartedView-D7JGm_6c.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-DwgMfZ7_.js +1 -0
- package/dist/web/assets/{HostedModelLearningSettings-De3i9wF4.js → HostedModelLearningSettings-JRfQadRl.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-DAY1MmqP.js → LabModelVersionDetailPage-BUYflJY_.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-DLnIgnry.js → LabSkillSidebar-BBiqk7Rf.js} +1 -1
- package/dist/web/assets/LabsRoute-Ci6vUnSd.js +99 -0
- package/dist/web/assets/MainChatThread-BQK3oI2N.js +2 -0
- package/dist/web/assets/MainPane-D3ojiN-p.js +18 -0
- package/dist/web/assets/{MarkdownText-gJMuefaJ.js → MarkdownText-DOdOVFXL.js} +25 -25
- package/dist/web/assets/{NativeSkillSidebar-Dlxb8iOC.js → NativeSkillSidebar-CRI_ri8z.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-DM-cqJ-K.js → NewExperienceSwitcher-DhYtfE68.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-Cu1q75gq.js → NewProjectDialog-D8sy1gOz.js} +1 -1
- package/dist/web/assets/{OutputsPage-DiXMkasl.js → OutputsPage-CbWgrhXA.js} +1 -1
- package/dist/web/assets/{ProjectsPage-DqiBHiCB.js → ProjectsPage-DLB67lyA.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-ozSKnDyX.js +1 -0
- package/dist/web/assets/{RightSidebarHomePanel-CeSFJM5s.js → RightSidebarHomePanel-CKs3OwhD.js} +1 -1
- package/dist/web/assets/ScheduledWorkPage-Cafv_QnR.js +1 -0
- package/dist/web/assets/SettingsView-T1vYDPjh.js +5 -0
- package/dist/web/assets/{TeamChatView-DM0adMtj.js → TeamChatView-vIrmXOY_.js} +2 -2
- package/dist/web/assets/{TerminalOverlay-CFlH51DD.js → TerminalOverlay-CAmF__Dq.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-CgIBVGha.js → TrainingCreationPanel-D75K0yk5.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-Bbo3RRie.js → TrainingDraftPanel-D7XZePAk.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CSRjJUSa.js → UsageSettingsSection-CYTmp7PG.js} +1 -1
- package/dist/web/assets/WorkSidebarPanel-CODMjVHY.js +1 -0
- package/dist/web/assets/WorkspaceDiffPanel-DQGoIjH9.js +14 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-c1pHDskn.js +63 -0
- package/dist/web/assets/{WorkspaceGitDialogs-Dgmg-6XG.js → WorkspaceGitDialogs-DrVtapQQ.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-BR4qxMgU.js → WorkspaceMonacoEditor-BCKzvSj2.js} +3 -3
- package/dist/web/assets/arrow-up-right-CP4hZdrJ.js +1 -0
- package/dist/web/assets/chunk-NOJECMB7-Bhcms-w5.js +1 -0
- package/dist/web/assets/{clipboard-BZzZ82Bk.js → clipboard-BgrXorn-.js} +1 -1
- package/dist/web/assets/{cloud-upload-CJPYPVl8.js → cloud-upload-B_zYztb6.js} +1 -1
- package/dist/web/assets/{cssMode-WC4Rg1l-.js → cssMode-DanjGgA8.js} +1 -1
- package/dist/web/assets/{folder-open-sLZJxLQy.js → folder-open-CdVKbtGq.js} +1 -1
- package/dist/web/assets/folder-plus-Cc5KElB6.js +1 -0
- package/dist/web/assets/{git-commit-horizontal-Cotm7KEC.js → git-commit-horizontal-CjGIIgRi.js} +1 -1
- package/dist/web/assets/{htmlMode-C6oZGeaB.js → htmlMode-DRGDF_UL.js} +1 -1
- package/dist/web/assets/index-B5re-RJy.css +1 -0
- package/dist/web/assets/{index-BxWTVKtn.js → index-BE-wXZ5R.js} +2 -2
- package/dist/web/assets/info-BLj0RvhA.js +1 -0
- package/dist/web/assets/{jsonMode-BET4LQIn.js → jsonMode-CCu0j2GD.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-BPxA_-Kg.js → lspLanguageFeatures-s_Lhm7P6.js} +1 -1
- package/dist/web/assets/minimize-2-Cyg_zD9z.js +1 -0
- package/dist/web/assets/{monaco.contribution-DXzyQfVi.js → monaco.contribution-CAzXvYkn.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DFzEyaHi.js → monaco.contribution-CY7mRgOB.js} +2 -2
- package/dist/web/assets/{monaco.contribution-7AUuf2NS.js → monaco.contribution-aUeLcBEg.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BH6kkO4b.js → monaco.contribution-mUPNK9ra.js} +2 -2
- package/dist/web/assets/monitor-DZvOs_wC.js +1 -0
- package/dist/web/assets/play-BJPzemuY.js +1 -0
- package/dist/web/assets/{python-PzBkTjWx.js → python-B_qnnVaG.js} +1 -1
- package/dist/web/assets/{save-DpezrtH2.js → save-BDy9tA3E.js} +1 -1
- package/dist/web/assets/square-Cb2c5td4.js +1 -0
- package/dist/web/assets/{toggleHighContrast-Cto-fOXm.js → toggleHighContrast-MhO1JLyR.js} +1 -1
- package/dist/web/assets/{tsMode-BYA4LNc6.js → tsMode-DfBXJb9V.js} +1 -1
- package/dist/web/assets/{upload-C5YFNgtS.js → upload-D56kThRh.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-CnyTsqlf.js → useLocalAgentSchedules-DMnGfswi.js} +1 -1
- package/dist/web/assets/useProviderSettings-Bv5B9eNk.js +5 -0
- package/dist/web/assets/{useSessionTurnCache-DICuJSJW.js → useSessionTurnCache-ClAY8gze.js} +1 -1
- package/dist/web/assets/{wifi-off-nzHj7JXp.js → wifi-off-C9lWJmVm.js} +1 -1
- package/dist/web/assets/{workers-Dboaw6f_.js → workers-BYzrH8by.js} +1 -1
- package/dist/web/assets/{yaml-uuY5JmO8.js → yaml-D3T8UkT3.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-KZP2LB5X.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-3LX6RU3C.js +0 -3
- package/dist/chunks/chunk-4SHKI3BH.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-AFUDIT36.js +0 -2
- package/dist/chunks/chunk-BX4J2VDU.js +0 -2
- 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-L3KS6MOV.js +0 -2
- 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-USKE34VR.js +0 -9
- package/dist/chunks/chunk-WV2APYWG.js +0 -2
- package/dist/chunks/chunk-XGE2XI6M.js +0 -191
- package/dist/chunks/chunk-XM26DGML.js +0 -3
- package/dist/chunks/chunk-YIB3J4RC.js +0 -2
- package/dist/chunks/chunk-YL6VFJ4P.js +0 -2
- package/dist/chunks/chunk-Z3D4C7BG.js +0 -12
- package/dist/chunks/cli-JVB345H2.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-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-OZAOZ2ES.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-control-RJ6XJZCS.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-inspection-SJIDXPHI.js +0 -3
- package/dist/chunks/hosted-profile-evaluation-preparation-26EI5LJR.js +0 -3
- package/dist/chunks/human-review-AAVMISBF.js +0 -2
- 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-P3VYLFLI.js +0 -329
- 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/RightChatPanelStack-VaOOmxwd.js +0 -1
- package/dist/web/assets/ScheduledWorkPage-D1jRQxFs.js +0 -1
- package/dist/web/assets/SettingsView-RA9OXgcu.js +0 -5
- package/dist/web/assets/WorkSidebarPanel-DwlEMEoG.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/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
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{ka as P,ma as h,na as E}from"./chunk-WV2APYWG.js";import{b as u,m as f}from"./chunk-NNF6KCHD.js";import{b as d}from"./chunk-ES2ISFJC.js";import{a as c}from"./chunk-FTQLQJQV.js";var S=d.object({id:u,runIds:d.array(u).min(2).max(100)}).strict();function j(r){return async s=>{let i=S.parse(s),l=await r.selectedProfile();if(!l)throw new Error("Select a Profile before comparing its evaluation runs.");let a=[];for(let e of i.runIds){let t=await r.store.getProfileEvaluationRun(e);if(!t||f(t.profileRef)!==f(l.ref))throw new Error(`Profile evaluation run ${e} is unavailable in the selected Profile.`);a.push({manifest:t.manifest,result:t.metric})}let o=await r.store.getProfileEvaluationComparison(i.id),n=P({id:i.id,members:a,createdAt:o?.createdAt??new Date().toISOString()});return r.store.saveProfileEvaluationComparison(l.ref,n)}}c(j,"createProfileEvaluationComparisonService");import{promises as m}from"node:fs";import v from"node:path";var y=d.object({id:u,evidenceKind:d.enum(["run","suite","comparison"]),evidenceId:u}).strict();function w(r){return v.join(r,"evals","reports")}c(w,"reportDirectory");async function R(r){let s=await m.lstat(r).catch(i=>{if(i.code==="ENOENT")return null;throw i});if(s&&(!s.isDirectory()||s.isSymbolicLink()))throw new Error("Profile evaluation report directory must be a regular directory.");s||await m.mkdir(r)}c(R,"ensureRegularDirectory");async function k(r){let s,i;if(r.evidenceKind==="run")s=[r.evidenceId],i="";else if(r.evidenceKind==="suite"){let o=await r.store.getProfileEvaluationSuiteRun(r.evidenceId);if(!o||o.profileId!==r.profileRef.profileId)throw new Error("Profile evaluation suite is unavailable.");s=o.members.map(n=>n.runManifest.id),i=o.contentHash}else{let o=await r.store.getProfileEvaluationComparison(r.evidenceId);if(!o)throw new Error("Profile evaluation comparison is unavailable.");s=o.members.map(n=>n.runManifest.id),i=o.contentHash}let l=await Promise.all(s.map(o=>r.store.getProfileEvaluationRun(o)));if(l.some(o=>!o||f(o.profileRef)!==f(r.profileRef)))throw new Error("Profile evaluation report is missing authorized run evidence.");let a=l;if(r.evidenceKind==="run"&&(i=a[0].contentHash),r.evidenceKind!=="run"){let o=r.evidenceKind==="suite"?(await r.store.getProfileEvaluationSuiteRun(r.evidenceId)).members.map(n=>n.runHash):(await r.store.getProfileEvaluationComparison(r.evidenceId)).members.map(n=>n.metricResultHash);for(let[n,e]of a.entries())if(r.evidenceKind==="suite"&&o[n]!==e.contentHash||r.evidenceKind==="comparison"&&o[n]!==e.metric.contentHash)throw new Error("Profile evaluation report evidence differs from retained member runs.")}return{runs:a,primary:{kind:r.evidenceKind,id:r.evidenceId,contentHash:i}}}c(k,"loadRuns");async function H(r){let s=y.parse(r.request),{runs:i,primary:l}=await k({store:r.store,profileRef:r.profileRef,evidenceKind:s.evidenceKind,evidenceId:s.evidenceId}),a=c(e=>[...new Map(e.map(t=>[f(t),t])).values()],"unique"),o=a(i.map(e=>f(e.manifest.metricPolicy))),n=i.map(e=>e.metric.value).filter(e=>e!==null);return h({schemaVersion:"openpond.profileEvaluationReport.v1",id:s.id,createdAt:new Date().toISOString(),testedSources:a(i.map(e=>({profileId:e.manifest.profileEvaluation.profileId,sourceRevision:e.manifest.profileEvaluation.sourceRevision,harnessRelease:e.manifest.profileEvaluation.harnessRelease}))),tasksetReleases:a(i.map(e=>e.manifest.tasksetRelease)),metricPolicyHashes:o,modelConfigurationHashes:a(i.map(e=>e.manifest.policy.kind==="model"?e.manifest.policy.configurationHash:f(e.manifest.policy))),evidence:[l,...i.filter(e=>l.kind!=="run"||e.manifest.id!==l.id).map(e=>({kind:"run",id:e.manifest.id,contentHash:e.contentHash}))],summary:{totalChecks:i.length,passedChecks:i.filter(e=>e.passed).length,failedChecks:i.filter(e=>!e.passed&&e.metric.value!==null).length,unscoredChecks:i.filter(e=>!e.passed&&e.metric.value===null).length,meanScore:o.length===1&&n.length===i.length?n.reduce((e,t)=>e+t,0)/n.length:null}})}c(H,"buildProfileEvaluationReport");function q(r){return{list:c(async()=>{let l=await r.selectedProfile();if(!l)return[];let a=w(l.sourcePath),o=await m.lstat(a).catch(t=>{if(t.code==="ENOENT")return null;throw t});if(!o)return[];if(!o.isDirectory()||o.isSymbolicLink())throw new Error("Profile evaluation report directory is unsafe.");let n=await m.readdir(a,{withFileTypes:!0});return(await Promise.all(n.filter(t=>t.name.endsWith(".json")).map(async t=>{if(!t.isFile()||t.isSymbolicLink())throw new Error("Profile evaluation report must be a regular file.");let p=E(JSON.parse(await m.readFile(v.join(a,t.name),"utf8")));if(`${p.id}.json`!==t.name||p.testedSources.some(g=>g.profileId!==l.ref.profileId))throw new Error("Profile evaluation report differs from its source location.");return p}))).sort((t,p)=>p.createdAt.localeCompare(t.createdAt))},"list"),save:c(async l=>{let a=await r.selectedProfile();if(!a?.gitBacked)throw new Error("Select a Git-backed Profile before saving an evaluation report.");let o=await H({store:r.store,profileRef:a.ref,request:l}),n=v.join(a.sourcePath,"evals");await R(n);let e=w(a.sourcePath);return await R(e),await m.writeFile(v.join(e,`${o.id}.json`),`${JSON.stringify(o,null,2)}
|
|
3
|
-
`,{flag:"wx"}),o},"save")}}c(q,"createProfileEvaluationReportService");export{j as a,H as b,q as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as fe,c as ge,d as ye,f as Re,g as Ae,i as Ce,j as Oe}from"./chunk-JEVA7YQL.js";import{b as de}from"./chunk-22UARBPW.js";import{A as z,B as J,C as $,D as V,E as Y,F as Q,G as X,H as Z,I as ee,J as te,K as ne,L as oe,M as se,N as re,O as ae,Q as le,V as pe,W as ie,X as ce,Y as ue,Z as me,_ as he,c as E,d as b,e as x,f as L,g as B,h as D,i as I,j as v,l as U,o as M,p as _,q as H,r as N,s as q,u as k,v as K,w as F,x as G,y as j,z as W}from"./chunk-QXVIIM4T.js";import{a as P,b as w}from"./chunk-GLUWATL5.js";import{a as s}from"./chunk-FTQLQJQV.js";function xe(t,e=14){if(t.length<e+1)return null;let r=0,o=0;for(let l=1;l<=e;l+=1){let m=t[l]-t[l-1];m>=0?r+=m:o-=m}let a=r/e,i=o/e;for(let l=e+1;l<t.length;l+=1){let m=t[l]-t[l-1],d=m>0?m:0,n=m<0?-m:0;a=(a*(e-1)+d)/e,i=(i*(e-1)+n)/e}return i===0?100:100-100/(1+a/i)}s(xe,"computeRsi");function T(t,e){if(t.length<e)return[];let r=[],o=0;for(let a=0;a<t.length;a+=1)o+=t[a],a>=e&&(o-=t[a-e]),a>=e-1&&r.push(o/e);return r}s(T,"computeSmaSeries");function Le(t,e){let r=T(t,e);return r.length>0?r[r.length-1]:null}s(Le,"computeSma");function A(t,e){if(t.length<e)return[];let r=2/(e+1),a=t.slice(0,e).reduce((p,l)=>p+l,0)/e,i=[a];for(let p=e;p<t.length;p+=1)a=t[p]*r+a*(1-r),i.push(a);return i}s(A,"computeEmaSeries");function Be(t,e){let r=A(t,e);return r.length>0?r[r.length-1]:null}s(Be,"computeEma");function De(t){let e=A(t,12),r=A(t,26);if(e.length===0||r.length===0)return null;let o=e.length-r.length,a=r.map((m,d)=>e[d+o]-m),i=A(a,9);if(i.length===0)return null;let p=a[a.length-1],l=i[i.length-1];return{macd:p,signalLine:l,histogram:p-l}}s(De,"computeMacd");function Ie(t,e,r,o){if(t.length<o)return null;let a=e==="ema"?A(t,r):T(t,r),i=e==="ema"?A(t,o):T(t,o);if(a.length===0||i.length===0)return null;let p=a.length-i.length;if(p<0)return null;let l=i.length-1,m=a[l+p],d=i[l],n=l-1,c=n>=0?a[n+p]:null,u=n>=0?i[n]:null,h="neutral";return c!=null&&u!=null?c<=u&&m>d?h="bullish-cross":c>=u&&m<d?h="bearish-cross":m>d?h="bullish":m<d&&(h="bearish"):m>d?h="bullish":m<d&&(h="bearish"),{fast:m,slow:d,signal:h}}s(Ie,"computeMaCross");function ve(t,e=20,r=2){if(t.length<e)return null;let o=t.slice(-e),a=o.reduce((l,m)=>l+m,0)/e,i=o.reduce((l,m)=>l+Math.pow(m-a,2),0)/e,p=Math.sqrt(i);return{middle:a,upper:a+r*p,lower:a-r*p}}s(ve,"computeBollinger");function Ue(t,e=24){if(t.length<2)return null;let r=t[t.length-1],o=Math.max(0,t.length-1-e),a=t[o];if(a===0)return null;let i=(r-a)/a*100;return{previous:a,percent:i}}s(Ue,"computePriceChange");function Me(t,e=14){if(t.length<e+1)return null;let r=[];for(let i=1;i<t.length;i+=1){let p=t[i],l=t[i-1],m=p.high-p.low,d=Math.abs(p.high-l.close),n=Math.abs(p.low-l.close);r.push(Math.max(m,d,n))}return r.length<e?null:r.slice(-e).reduce((i,p)=>i+p,0)/e}s(Me,"computeAtr");function Te(t){return t.replace(/\/$/,"")}s(Te,"resolveUrl");function _e(t){let e=process.env.OPENPOND_BASE_URL,r=t.baseUrl||e||P;return Te(r.trim())}s(_e,"resolveBaseUrl");function He(t){let e=process.env.OPENPOND_API_URL,r=t.apiUrl||e||w;return Te(r.trim())}s(He,"resolveApiUrl");function Ne(t,e){return fe({apiBaseUrl:e,opChatApiBaseUrl:t.opChatApiUrl,chatApiBaseUrl:t.chatApiUrl})}s(Ne,"resolveChatApiUrl");function qe(t,e){let r=process.env.OPENPOND_TOOL_URL,o=t.toolUrl||r||e;return Te(o.trim())}s(qe,"resolveToolUrl");function ke(t){let e=t.apiKey?.trim();if(e)return e;let r=process.env.OPENPOND_API_KEY?.trim();if(r)return r;throw new Error("OPENPOND_API_KEY is required")}s(ke,"resolveApiKey");function Ke(t){let e=t.split("/").filter(Boolean);if(e.length!==2)throw new Error("expected <handle>/<repo>");return{handle:e[0],repo:e[1]}}s(Ke,"parseHandleRepo");function Pe(t){return(t||"").trim().toLowerCase()}s(Pe,"normalizeRepoName");function Fe(t){if(!t||typeof t!="object")return{name:"unknown",raw:t};let e=t,r=e.profile||e.function,o=typeof e.name=="string"?e.name:typeof r?.name=="string"?r.name:"unknown",a=typeof e.description=="string"?e.description:typeof r?.description=="string"?r.description:void 0;return{name:o,description:a,raw:t}}s(Fe,"normalizeToolSummary");function Ge(t){if(!t)return[];if(Array.isArray(t.toolsJson))return t.toolsJson;if(t.metadataJson&&typeof t.metadataJson=="object"){let e=t.metadataJson.tools;if(Array.isArray(e))return e}return[]}s(Ge,"extractDeploymentTools");async function O(t){let{handle:e,repo:r}=Ke(t.target),o=await Se({apiBase:t.apiBase,apiKey:t.apiKey,useCache:t.useCache,cacheTtlMs:t.cacheTtlMs,forceRefresh:t.forceRefresh}),a=Pe(r),i=o.find(p=>p.handle&&p.handle!==e?!1:[p.repo,p.gitRepo,p.id].map(Pe).includes(a));if(!i)throw new Error(`app not found for ${e}/${r}`);return{app:i,handle:e,repo:r}}s(O,"resolveAppTarget");async function Se(t){if(t.useCache&&!t.forceRefresh){let r=await ce({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(r)return r}let e=await v(t.apiBase,t.apiKey);return t.useCache&&await ue({apiBase:t.apiBase,apiKey:t.apiKey,apps:e}),e}s(Se,"fetchAppsWithCache");async function we(t){if(t.useCache&&!t.forceRefresh){let o=await me({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(o)return o}let e=await k(t.apiBase,t.apiKey),r=Array.isArray(e.tools)?e.tools:[];return t.useCache&&await he({apiBase:t.apiBase,apiKey:t.apiKey,tools:r}),r}s(we,"fetchToolsWithCache");function je(t){if(!t)return"POST";let e=t.toUpperCase();switch(e){case"GET":case"POST":case"PUT":case"DELETE":return e;default:throw new Error("method must be GET, POST, PUT, or DELETE")}}s(je,"normalizeMethod");async function We(t,e){let r,o,a;return await de(t,{...e,onConversationId:s(i=>{r=i,e?.onConversationId?.(i)},"onConversationId"),onItems:s(i=>{for(let p of i){let l=p;!o&&typeof l.appId=="string"&&(o=l.appId,e?.onAppId?.(l.appId)),!a&&typeof l.deploymentId=="string"&&(a=l.deploymentId,e?.onDeploymentId?.(l.deploymentId))}e?.onItems?.(i)},"onItems")}),{conversationId:r,appId:o,deploymentId:a}}s(We,"consumeAgentCreateStream");function Pt(t){let e=ke(t),r=_e(t),o=He(t),a=Ne(t,o),i=qe(t,r),p=t.cacheTtlMs??ie,l=t.useCache!==!1,m=s(async()=>{l&&await Promise.all([Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0}),we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0})])},"refreshCache"),d=s(async(n,c)=>(await D(o,e,n,{branch:c}))?.id??null,"resolveLatestDeploymentId");return{baseUrl:r,apiUrl:o,chatApiUrl:a,toolUrl:i,apiKey:e,account:{get:s(async()=>se(o,e),"get"),health:s(async()=>re(o,e),"health")},chat:{providers:s(async()=>Re({apiBaseUrl:a,token:e}),"providers"),provider:s(async n=>Ae({apiBaseUrl:a,token:e,provider:n}),"provider"),models:s(async()=>ge({apiBaseUrl:a,token:e}),"models"),model:s(async n=>ye({apiBaseUrl:a,token:e,model:n}),"model"),send:s(async n=>Ce({...n,apiBaseUrl:a,token:e}),"send"),stream:s(n=>Oe({...n,apiBaseUrl:a,token:e}),"stream")},tool:{list:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)return{app:u,deploymentId:null,tools:[]};let g=await I(o,e,h),y=Ge(g).map(Fe);return{app:u,deploymentId:h,tools:y}},"list"),run:s(async(n,c,u)=>{let{app:h}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:u?.forceRefresh}),g=u?.deploymentId||await d(h.id,u?.branch);if(!g)throw new Error("no deployments found");let f=je(u?.method);return pe(i,e,{appId:h.id,deploymentId:g,toolName:c,method:f,body:u?.body,headers:u?.headers})},"run")},deploy:{watch:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)throw new Error("no deployments found");let g=c?.intervalMs??5e3,f=c?.timeoutMs??240*1e3,y=[],S=new Set,Ee=Date.now(),R=null;for(;Date.now()-Ee<f;){let be=await L(o,e,h);for(let C of be)S.has(C.id)||(S.add(C.id),y.push(C),c?.onLog?.(C));if(R=(await B(o,e,h)).status??null,c?.onStatus?.(R),R==="failed")return{deploymentId:h,status:R,logs:y};if(R==="running"||R==="deployed")return{deploymentId:h,status:R,logs:y};await new Promise(C=>setTimeout(C,g))}return{deploymentId:h,status:"timeout",logs:y}},"watch")},template:{status:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return M(o,e,u.id)},"status"),branches:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return _(o,e,u.id)},"branches"),update:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.environment==="preview"?"preview":"production";return H(o,e,u.id,{environment:h})},"update")},opentool:{recipesList:s(async(n={})=>F(o,e,n),"recipesList"),recipesSearch:s(async n=>G(o,e,n),"recipesSearch"),recipeGet:s(async n=>j(o,e,n),"recipeGet"),rulesGet:s(async n=>W(o,e,n),"rulesGet")},apps:{list:s(async n=>{let c=await Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh});return n?.handle?c.filter(u=>u.handle===n.handle):c},"list"),tools:s(async n=>we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh}),"tools"),performance:s(async n=>ne(o,e,{appId:n?.appId}),"performance"),summary:s(async n=>oe(o,e,n.appId),"summary"),schedules:s(async n=>K(o,e,n.appId),"schedules"),schedulesStart:s(async n=>{let{appId:c,...u}=n;return z(o,e,c,u)},"schedulesStart"),schedulesStop:s(async n=>J(o,e,n.appId),"schedulesStop"),schedulesStopCurrent:s(async()=>$(o,e),"schedulesStopCurrent"),scheduleRunNow:s(async n=>V(o,e,n),"scheduleRunNow"),scheduleDelete:s(async n=>Y(o,e,n.appId,n.scheduleId),"scheduleDelete"),scheduleExecutionLogs:s(async n=>Q(o,e,n.scheduleId,{limit:n.limit}),"scheduleExecutionLogs"),scheduleExecutionLog:s(async n=>Z(o,e,n.runId),"scheduleExecutionLog"),deploymentScheduleExecutionLogs:s(async n=>X(o,e,n.deploymentId,{limit:n.limit}),"deploymentScheduleExecutionLogs"),executionTimeline:s(async n=>ee(o,e,n.appId,{limit:n.limit}),"executionTimeline"),assistantRun:s(async n=>ae(o,e,n),"assistantRun"),agentCreate:s(async(n,c)=>{let{refreshCache:u,...h}=n,g={...h,streamDeployLogs:h.streamDeployLogs??!0},f=await te(o,e,g);if(!f.ok){let S=await f.text().catch(()=>"");throw new Error(`agent create failed: ${f.status} ${S}`)}let y=await We(f,c);if(l&&u!==!1)try{await m()}catch{}return y},"agentCreate"),toolsExecute:s(async n=>le(o,e,n),"toolsExecute"),deploy:s(async n=>E(o,e,n.appId,{environment:n.environment,commitSha:n.commitSha,branch:n.branch}),"deploy"),startApp:s(async n=>{let{appId:c,...u}=n;return x(o,e,c,u)},"startApp"),promotePreview:s(async n=>{let{appId:c,...u}=n;return b(o,e,c,u)},"promotePreview"),envGet:s(async n=>q(o,e,n.appId),"envGet"),envSet:s(async n=>N(o,e,n.appId,{envVars:n.envVars}),"envSet")},repo:{create:s(async n=>{let{refreshCache:c,...u}=n,h=await U(o,e,u);if(l&&c!==!1)try{await m()}catch{}return h},"create")},cache:{refresh:m}}}s(Pt,"createClient");export{xe as a,T as b,Le as c,A as d,Be as e,De as f,Ie as g,ve as h,Ue as i,Me as j,We as k,Pt as l};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{A as z,C as R,D as M,a as v,s as E,t as B,z as O}from"./chunk-PJM2G7SG.js";import{m as y}from"./chunk-NNF6KCHD.js";import{b as p}from"./chunk-ES2ISFJC.js";import{a as w}from"./chunk-FTQLQJQV.js";var S=p.number().int().nonnegative().nullable(),U=p.object({requestId:p.string().min(1),startedAt:p.string().datetime(),provider:p.string(),model:p.string(),mode:p.string(),status:p.string(),source:p.string(),projectId:p.string().nullable(),inputTokens:S,cachedInputTokens:S,outputTokens:S,totalTokens:S}).strict();var H=p.number().int().nonnegative(),C=p.object({invocations:H,inputTokens:H,cachedInputTokens:H,outputTokens:H,totalTokens:H,missingInput:H,missingCachedInput:H,missingOutput:H,missingTotal:H,failures:H,unattributed:H}).strict(),K=p.object({total:C,days:p.array(C.extend({key:p.string().regex(/^\d{4}-\d{2}-\d{2}$/)})),modes:p.array(C.extend({key:p.string()})),models:p.array(C.extend({key:p.string()}))}).strict();var $=w(h=>["accepted","rejected","cancelled"].includes(h.status),"closed");function a(h,r=422){throw new v(h,r)}w(a,"fail");function V(h,r,b){try{M(h.form,r,b)}catch(l){a(l instanceof Error?l.message:"human_answer_invalid")}}w(V,"answers");function X(h,r,b=()=>new Date().toISOString()){async function l(i,t){t.scope!==i.scope&&a("human_scope_denied",403),await r.member(i);let e=await r.owner(i,t.projectId),s=e||t.policy.managerIds.includes(i.actorId),n=e||t.assigneeId===i.actorId||t.policy.reviewerIds.includes(i.actorId);return e||s||n||t.policy.teamVisible||a("human_review_not_found",404),await r.evidence(i,t),{owner:e,manager:s,reviewer:n}}w(l,"access");async function A(i,t){let e=z.parse(t);return h.transaction(i.scope,async s=>{await r.member(i);let n=await s.get(e.id),c={owner:!1,manager:!1,reviewer:!1};if(e.action==="create"){let I={projectId:e.projectId,evidence:e.evidence,form:e.form};await r.owner(i,e.projectId)||a("human_assignment_owner_required",403),await r.evidence(i,I);for(let q of new Set([...e.assigneeId?[e.assigneeId]:[],...e.policy.managerIds,...e.policy.reviewerIds]))await r.assignee(i,q,I);e.kind==="grade"&&!e.evidence.attempts.length&&a("human_grade_requires_attempt"),e.kind!=="grade"&&!e.evidence.taskIds?.length&&a("human_task_assignment_requires_tasks"),e.form.mode==="pairwise"!=(e.evidence.attempts.length===2)&&a("human_form_evidence_mode_mismatch")}else n||a("human_review_not_found",404),c=await l(i,n),e.action==="bind_author_publication"&&!c.owner&&a("human_task_publication_owner_required",403),["reassign","cancel","decide"].includes(e.action)&&!c.manager&&a("human_manager_required",403),["save_draft","submit","reserve_execution","bind_execution"].includes(e.action)&&!c.reviewer&&!(e.action==="bind_execution"&&n.status==="cancelled"&&c.manager)&&a("human_assignee_required",403),e.action==="claim"&&(!n.policy.queueClaim||!n.policy.teamVisible||n.policy.reviewerIds.length&&!n.policy.reviewerIds.includes(i.actorId)&&!c.owner)&&a("human_claim_denied",403);let _=y([i.actorId,e.operationId]),d=y(e),k=await s.operation(_);if(k){k.requestHash!==d&&a("human_operation_conflict",409);let I=await s.get(k.reviewId,k.revision);return I||a("human_operation_result_unavailable",409),I}(n?.revision??0)!==e.expectedRevision&&a("human_revision_conflict",409);let o=b();if(e.action==="create")(n||e.expectedRevision!==0)&&a("human_review_exists",409),n=O.parse(R({schemaVersion:"openpond.humanReview.v1",id:e.id,revision:1,scope:i.scope,projectId:e.projectId,createdBy:i.actorId,kind:e.kind,title:e.title,...e.dueAt?{dueAt:e.dueAt}:{},authorPublication:null,evidence:e.evidence,form:e.form,policy:e.policy,status:e.assigneeId?"assigned":"queued",assigneeId:e.assigneeId,generation:1,drafts:[],submissions:[],decisions:[],audit:[],execution:null,createdAt:o,updatedAt:o}));else{n||a("human_review_not_found",404),$(n)&&e.action!=="bind_author_publication"&&!(n.status==="cancelled"&&e.action==="bind_execution")&&a("human_review_closed",409);let{contentHash:I,...q}=n,u={...q,revision:n.revision+1,updatedAt:o};if(e.action==="bind_author_publication")(n.kind!=="author"||n.status!=="accepted"||n.decisions.at(-1)?.taskProposalHash!==e.proposalHash||n.authorPublication)&&a("human_task_publication_stale",409),r.publication||a("human_task_publication_owner_unavailable",422),await r.publication(i,n,e.dataset,e.proposalHash),u.authorPublication={proposalHash:e.proposalHash,dataset:e.dataset,publishedBy:i.actorId,operationId:e.operationId,publishedAt:o};else if(e.action==="claim")(n.assigneeId||n.status!=="queued")&&a("human_already_claimed",409),await r.assignee(i,i.actorId,n),u={...u,assigneeId:i.actorId,status:"assigned",generation:n.generation+1,audit:[...n.audit,{actorId:i.actorId,action:"claim",priorAssigneeId:n.assigneeId,assigneeId:i.actorId,generation:n.generation+1,note:"",occurredAt:o}]};else if(e.action==="reserve_execution"||e.action==="bind_execution")if((n.kind!=="execute"||e.generation!==n.generation)&&a("human_execution_assignment_stale",409),e.action==="reserve_execution")n.execution&&a("human_execution_already_reserved",409),u.execution={executionId:null,operationId:e.runOperationId,boundBy:i.actorId,configurationHash:e.configurationHash,generation:e.generation,result:null},u.status="in_progress";else{let f=n.execution;(!f||f.executionId||f.operationId!==e.runOperationId||f.configurationHash!==e.configurationHash||f.boundBy!==i.actorId&&!(n.status==="cancelled"&&c.manager)||f.generation!==e.generation)&&a("human_execution_binding_conflict",409);let g={...f,executionId:e.executionId};r.execution||a("human_execution_owner_unavailable",422),await r.execution(i,n,g),u.execution=g}else if(e.action==="reassign")n.execution&&!n.execution.result&&a("human_execution_transfer_requires_completion",409),e.assigneeId&&await r.assignee(i,e.assigneeId,n),u={...u,execution:null,assigneeId:e.assigneeId,generation:n.generation+1,status:e.assigneeId?"assigned":"queued",audit:[...n.audit,{actorId:i.actorId,action:"reassign",priorAssigneeId:n.assigneeId,assigneeId:e.assigneeId,generation:n.generation+1,note:e.note,occurredAt:o}]};else if(e.action==="cancel")u.status="cancelled",u.audit=[...n.audit,{actorId:i.actorId,action:"cancel",priorAssigneeId:n.assigneeId,assigneeId:n.assigneeId,generation:n.generation,note:e.note,occurredAt:o}];else if(e.action==="save_draft"||e.action==="submit"){n.kind==="execute"&&!n.execution?.executionId&&a("human_execution_not_bound",409),e.generation!==n.generation&&a("human_assignment_generation_stale",409);let f=n.decisions.at(-1),g=n.submissions.filter(m=>m.actorId===i.actorId&&m.generation===n.generation).at(-1);if(g&&!(f?.outcome==="request_changes"&&f.submissions.some(m=>m.id===g.id))&&a("human_submission_already_sealed",409),e.taskProposal?.tasks.some(m=>m.expectedOutput!==void 0)&&!c.owner&&a("human_reference_edit_owner_required",403),e.taskProposal||e.action==="submit")try{B(n,e.taskProposal)}catch(m){a(m instanceof Error?m.message:"human_task_proposal_invalid")}if(V(n,e.answers,e.action==="submit"),e.action==="save_draft")u.drafts=[...n.drafts.filter(m=>m.actorId!==i.actorId),{actorId:i.actorId,generation:n.generation,...e.taskProposal?{taskProposal:e.taskProposal}:{},answers:e.answers,note:e.note,updatedAt:o}],u.status=n.status==="returned"?"returned":"in_progress";else{n.kind==="execute"&&((!e.executionResult||!r.completeExecution)&&a("human_execution_result_required",409),await r.completeExecution(i,n,e.executionResult),u.execution={...n.execution,result:e.executionResult}),(e.evidenceHash!==y(n.evidence)||e.formHash!==y(n.form))&&a("human_review_snapshot_stale",409);let m=R({...e.taskProposal?{taskProposal:e.taskProposal}:{},id:`submission-${_}`,revision:1,actorId:i.actorId,generation:n.generation,evidenceHash:e.evidenceHash,formHash:e.formHash,answers:e.answers,note:e.note,submittedAt:o,supersedes:g?.id??null});u.submissions=[...n.submissions,m],u.drafts=n.drafts.filter(x=>x.actorId!==i.actorId),u.status=n.policy.approval==="none"?"accepted":"submitted",n.policy.approval==="none"&&(u.decisions=[...n.decisions,R({id:`decision-${_}`,revision:1,actorId:i.actorId,outcome:"accept",...e.taskProposal?{taskProposalHash:e.taskProposal.contentHash}:{},submissions:[{id:m.id,contentHash:m.contentHash}],answers:e.answers,note:"",decidedAt:o})])}}else if(e.action==="decide"){(n.policy.approval!=="manager"||n.status!=="submitted")&&a("human_decision_not_required",409);let f=e.submissions.map(g=>n.submissions.find(m=>m.id===g.id&&m.contentHash===g.contentHash&&m.generation===n.generation&&!n.submissions.some(x=>x.supersedes===m.id))??a("human_submission_revision_stale",409));n.policy.distinctManager&&f.some(g=>g.actorId===i.actorId)&&a("human_distinct_manager_required",403),new Set(f.map(g=>g.id)).size!==f.length&&a("human_duplicate_submission"),e.outcome==="accept"&&new Set(f.map(g=>g.actorId)).size<n.policy.minimumRaters&&a("human_more_raters_required",409),e.outcome!=="accept"&&!e.note.trim()&&a("human_decision_reason_required"),n.kind==="author"&&e.outcome==="accept"&&!f.some(g=>g.taskProposal?.contentHash===e.taskProposalHash)&&a("human_task_proposal_decision_required",409),n.kind!=="author"&&e.taskProposalHash&&a("human_task_proposal_unexpected"),V(n,e.answers,e.outcome==="accept"),u.decisions=[...n.decisions,R({...e.taskProposalHash?{taskProposalHash:e.taskProposalHash}:{},id:`decision-${_}`,revision:1,actorId:i.actorId,outcome:e.outcome,submissions:e.submissions,answers:e.answers,note:e.note,decidedAt:o})],u.status=e.outcome==="accept"?"accepted":e.outcome==="reject"?"rejected":"returned"}n=O.parse(R(u))}return await s.put(n,e.expectedRevision),await s.saveOperation(_,{requestHash:d,reviewId:n.id,revision:n.revision}),n})}w(A,"command");async function T(i,t,e){return h.transaction(i.scope,async s=>{let n=await s.get(t);n||a("human_review_not_found",404),await l(i,n);let c=e===void 0?n:await s.get(t,e);return c||a("human_review_not_found",404),await r.evidence(i,c),c})}w(T,"get");async function P(i,t){return await r.member(i),h.transaction(i.scope,async e=>{let s,n=[],c=new Set,_=!1;do{let k=await e.list({projectId:t.projectId,afterId:s,limit:100});for(let o of k.items){let I;try{I=await l(i,o)}catch(x){if(x instanceof v&&[403,404].includes(x.status))continue;throw x}let q=!$(o),u=o.assigneeId===i.actorId||o.policy.reviewerIds.includes(i.actorId)||I.owner&&o.assigneeId===null&&o.createdBy===i.actorId,f=u&&I.reviewer&&q&&!o.submissions.some(x=>x.actorId===i.actorId&&x.generation===o.generation&&o.status!=="returned"),g=I.manager&&o.policy.approval==="manager"&&o.status==="submitted";I.manager&&o.policy.approval==="manager"&&(_=!0),(f||g)&&c.add(o.id),(t.view==="mine"?u:t.view==="approval"?I.manager&&o.policy.approval==="manager":o.policy.teamVisible||I.manager)&&(t.status==="active"?q:!q)&&(!t.afterId||o.id>t.afterId)&&n.push(o)}s=k.nextCursor??void 0}while(s);let d=n.slice(0,t.limit);return{items:d,nextCursor:n.length>t.limit?d.at(-1).id:null,actionCount:c.size,approvalAvailable:_}})}w(P,"inbox");async function j(i,t){let e=await T(i,t.id),s=await l(i,e),n=s.owner||s.manager,c=!n&&e.form.mode==="pairwise"&&e.policy.blindPair,_=!n&&e.policy.independentRaters;return{...t,evidence:c?null:t.evidence,evidenceHash:y(t.evidence),formHash:y(t.form),drafts:t.drafts.filter(d=>d.actorId===i.actorId).map(d=>({...d,taskProposal:s.owner?d.taskProposal:E(d.taskProposal)})),submissions:(_?t.submissions.filter(d=>d.actorId===i.actorId):t.submissions).map(d=>({...d,taskProposal:s.owner?d.taskProposal:E(d.taskProposal)})),decisions:_&&!$(e)?[]:t.decisions,audit:n?t.audit:[],createdBy:c?"owner":t.createdBy,permissions:{...s,claim:e.status==="queued"&&e.policy.queueClaim&&e.policy.teamVisible&&(!e.policy.reviewerIds.length||e.policy.reviewerIds.includes(i.actorId)||s.owner)}}}return w(j,"view"),{command:A,get:T,inbox:P,view:j}}w(X,"createHumanReviewService");async function ie(h){let{service:r,context:b,request:l}=h,A=await r.get(b,l.id);if(A.kind!=="execute"||A.generation!==l.generation)throw new v("human_execution_assignment_stale",409);let T=A.execution;if(T&&T.boundBy!==b.actorId)throw new v("human_execution_executor_changed",403);let P=T?.operationId??`human-run-${y([b.actorId,l.id,l.operationId])}`,j=h.configuration,i={...j,operationId:P,request:{...j.request,operationId:P}},t=y(i),e=T?A:await r.command(b,{action:"reserve_execution",id:l.id,expectedRevision:l.expectedRevision,operationId:`reserve-${l.operationId}`,generation:l.generation,runOperationId:P,configurationHash:t});if(!e.execution||e.execution.operationId!==P||e.execution.configurationHash!==t)throw new v("human_execution_reservation_conflict",409);let s=await r.get(b,l.id);if(s.execution?.executionId)return s.status==="cancelled"&&await h.cancel(s),s;let n;if(T)n=await h.recover(s);else{if(s.generation!==e.generation||["accepted","rejected","cancelled"].includes(s.status))throw new v("human_execution_assignment_stale",409);try{n=await h.dispatch(i,s)}catch(c){if(n=await h.recover(await r.get(b,l.id)),!n)throw c}}if(!n)throw new v("human_execution_admission_recovery_pending",409,"The original execution admission is unavailable. Recover its retained owner outcome before retrying this assignment.");for(let c=0;c<3;c++){let _=await r.get(b,l.id);if(_.generation!==e.generation||!_.execution||_.execution.operationId!==P)throw new v("human_execution_assignment_stale",409);let d;try{d=_.execution.executionId?_:await r.command(b,{action:"bind_execution",id:l.id,expectedRevision:_.revision,operationId:`bind-${P}`,generation:l.generation,runOperationId:P,configurationHash:t,executionId:n.id})}catch(k){if(k instanceof v&&k.code==="human_revision_conflict")continue;throw k}if(d.execution?.executionId!==n.id)throw new v("human_execution_binding_conflict",409);return d.status==="cancelled"&&await h.cancel(d),d}throw new v("human_execution_binding_recovery_pending",409,"The assignment changed while retaining its execution. Retry the original operation to recover that exact run.")}w(ie,"dispatchAssignedHumanExecution");export{K as a,X as b,ie as c};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as n}from"./chunk-FTQLQJQV.js";var k="https://openpond.ai",U="https://api.openpond.ai",N="https://api.openpond.ai/opchat/v1";function C(o){let e=o.trim().replace(/\/$/,"");if(!e)throw new Error("sandbox API URL must be non-empty");let t=new URL(e),r=t.pathname.replace(/\/$/,"");return r.endsWith("/v1/sandboxes")||r.endsWith("/api/sandboxes")?`${t.origin}${r}`:r.endsWith("/v1")?`${t.origin}${r}/sandboxes`:te(t.hostname)?`${t.origin}${r}/v1/sandboxes`:t.origin===k?`${U}/v1/sandboxes`:`${t.origin}${r}/api/sandboxes`}n(C,"normalizeSandboxApiUrl");function L(o){let e="/sandboxes";if(!o.endsWith(e))throw new Error("sandbox API URL must end with /sandboxes");return o.slice(0,-e.length)}n(L,"apiRootUrlFromSandboxApiUrl");function te(o){return o==="api.openpond.ai"||o==="staging-api.openpond.ai"||o.startsWith("api")&&o.endsWith(".openpond.ai")}n(te,"isOpenPondHostedApiHost");function B(o){return{list:n((e={})=>o.listSandboxRuntimes(e),"list"),create:n(e=>o.createSandboxRuntime(e),"create"),handle:n((e,t=null)=>o.sandboxRuntime(e,t),"handle"),get:n(e=>o.getSandboxRuntime(e),"get"),createSandbox:n((e,t={},r={})=>o.createSandboxRuntimeSandbox(e,t,r),"createSandbox"),updateStatus:n((e,t)=>o.updateSandboxRuntimeStatus(e,t),"updateStatus"),events:n(e=>o.listSandboxRuntimeEvents(e),"events"),event:n((e,t)=>o.emitSandboxRuntimeEvent(e,t),"event"),checkpoint:n((e,t={})=>o.checkpointSandboxRuntime(e,t),"checkpoint"),promote:n((e,t,r={})=>o.promoteSandboxRuntime(e,t,r),"promote"),preserveSource:n((e,t={},r={})=>o.preserveSandboxRuntimeSource(e,t,r),"preserveSource")}}n(B,"createSandboxRuntimeNamespace");function z(o){return{list:n((e={})=>o.list(e),"list"),create:n(e=>o.create(e),"create"),get:n(e=>o.get(e),"get"),pricing:n(()=>o.pricing(),"pricing"),costs:n((e={})=>o.costs(e),"costs")}}n(z,"createSandboxNamespace");function D(o){return{list:n(e=>o.listProjects(e),"list"),upsert:n(e=>o.upsertProject(e),"upsert"),upsertGitRemote:n(e=>o.upsertProjectGitRemote(e),"upsertGitRemote"),get:n((e,t)=>o.getProject(e,t),"get"),update:n((e,t)=>o.updateProject(e,t),"update"),sync:n((e,t)=>o.syncProject(e,t),"sync"),ensureGitRemote:n((e,t)=>o.ensureProjectGitRemote(e,t),"ensureGitRemote"),getGitRemote:n((e,t)=>o.ensureProjectGitRemote(e,t),"getGitRemote"),git:n((e,t)=>o.ensureProjectGitRemote(e,t),"git"),uploadSource:n((e,t)=>o.uploadProjectSource(e,t),"uploadSource"),archive:n((e,t)=>o.archiveProject(e,t),"archive")}}n(D,"createSandboxProjectNamespace");function J(o){return{get:n(e=>o.getHostedProfile(e),"get"),status:n(e=>o.getHostedProfile(e),"status"),ensureHosted:n(e=>o.ensureHostedProfile(e),"ensureHosted"),push:n(e=>o.pushHostedProfile(e),"push")}}n(J,"createSandboxProfileNamespace");function M(o){return{list:n(e=>o.listAgents(e),"list"),upsert:n(e=>o.upsertAgent(e),"upsert"),get:n((e,t)=>o.getAgent(e,t),"get"),update:n((e,t)=>o.updateAgent(e,t),"update"),archive:n((e,t)=>o.archiveAgent(e,t),"archive"),run:n((e,t)=>o.runAgent(e,t),"run"),sourceDeployPlan:n((e,t)=>o.getAgentSourceDeployPlan(e,t),"sourceDeployPlan"),manifestSnapshots:n((e,t)=>o.listAgentManifestSnapshots(e,t),"manifestSnapshots"),requestSourceChecks:n((e,t)=>o.requestAgentSourceChecks(e,t),"requestSourceChecks"),configureSourceSetup:n((e,t)=>o.configureAgentSourceSetup(e,t),"configureSourceSetup"),publishSource:n((e,t)=>o.publishAgentSource(e,t),"publishSource")}}n(M,"createSandboxAgentNamespace");function F(o,e,t=null){let r=n(async(a={},d={})=>{let l=await o.getSandboxRuntime(e);return l.sandboxId?o.get(l.sandboxId):o.createSandboxRuntimeSandbox(e,a,d).then(u=>u.sandbox)},"currentSandbox"),s=n(async(a={},d={})=>{let l=await o.getSandboxRuntime(e);if(!l.sandboxId)return o.createSandboxRuntimeSandbox(e,a,d).then(p=>p.sandbox);let u=await o.get(l.sandboxId);return u.state==="stopped"?o.start(u.id,d).then(p=>p.sandbox):u.state==="archived"?o.restore(u.id).then(p=>p.sandbox):u.state==="deleted"||u.state==="error"?o.createSandboxRuntimeSandbox(e,a,d).then(p=>p.sandbox):u},"resume");return{id:e,initial:t,get:n(()=>o.getSandboxRuntime(e),"get"),sandbox:r,resume:s,createSandbox:n((a={},d={})=>o.createSandboxRuntimeSandbox(e,a,d),"createSandbox"),status:n(async a=>{if(typeof a!="string")return o.updateSandboxRuntimeStatus(e,a);let d=await o.getSandboxRuntime(e);return o.updateSandboxRuntimeStatus(e,{status:a,expectedVersion:d.version})},"status"),events:n(()=>o.listSandboxRuntimeEvents(e),"events"),event:n(a=>o.emitSandboxRuntimeEvent(e,a),"event"),recordCommit:n((a,d={})=>o.emitSandboxRuntimeEvent(e,{...d,type:d.type??"git.commit",commitSha:a}),"recordCommit"),checkpointHint:n((a={})=>o.emitSandboxRuntimeEvent(e,{type:"workflow.checkpoint_hint",summary:a.summary??a.reason??"Workflow checkpoint hint",payload:{...a.payload,reason:a.reason??null},artifactRefs:a.artifactRefs,lifecycleHint:{kind:"checkpoint",reason:a.reason??null}}),"checkpointHint"),waitForUser:n(async(a={})=>{await o.emitSandboxRuntimeEvent(e,{type:"workflow.waiting_for_user",summary:a.summary??a.reason??"Waiting for user",payload:{...a.payload,reason:a.reason??null},lifecycleHint:{kind:"waiting_for_user",reason:a.reason??null}});let d=await o.getSandboxRuntime(e);return d.status==="waiting_for_user"?d:o.updateSandboxRuntimeStatus(e,{status:"waiting_for_user",expectedVersion:d.version,summary:a.summary??a.reason,metadata:{workflowWaitForUserReason:a.reason??null}})},"waitForUser"),keepAlive:n((a={})=>{let d=re(a);return o.emitSandboxRuntimeEvent(e,{type:"workflow.keepalive",summary:a.summary??a.reason??"Workflow keepalive",payload:{...a.payload,reason:a.reason??null,keepaliveUntil:d},lifecycleHint:{kind:"keepalive",reason:a.reason??null,keepaliveUntil:d}})},"keepAlive"),checkpoint:n(a=>o.checkpointSandboxRuntime(e,a),"checkpoint"),files:{write:n(async(a,d)=>o.uploadFile((await s()).id,a,d),"write"),read:n(async a=>o.downloadFile((await s()).id,a),"read"),readResponse:n(async a=>o.downloadFileResponse((await s()).id,a),"readResponse"),list:n(async(a={})=>o.listFiles((await s()).id,a),"list"),delete:n(async(a,d={})=>o.deleteFile((await s()).id,a,d),"delete"),search:n(async a=>o.searchFiles((await s()).id,a),"search"),stat:n(async a=>o.statFile((await s()).id,a),"stat"),mkdir:n(async a=>o.mkdir((await s()).id,a),"mkdir"),move:n(async a=>o.moveFile((await s()).id,a),"move")},commands:{run:n(async a=>o.exec((await s()).id,typeof a=="string"?{command:a}:a),"run")},ports:{expose:n(async a=>o.openPort((await s()).id,typeof a=="number"?{port:a}:a),"expose")},promote:n((a,d={})=>o.promoteSandboxRuntime(e,a,d),"promote"),preserveSource:n((a={},d={})=>o.preserveSandboxRuntimeSource(e,a,d),"preserveSource"),archive:n(async a=>{let d=a??(await o.getSandboxRuntime(e)).version;return o.updateSandboxRuntimeStatus(e,{status:"archived",expectedVersion:d})},"archive")}}n(F,"createSandboxRuntimeHandle");function re(o){if(o?.until instanceof Date)return o.until.toISOString();if(typeof o?.until=="string"&&o.until.trim())return new Date(o.until).toISOString();let e=typeof o?.seconds=="number"&&Number.isFinite(o.seconds)?Math.max(1,Math.trunc(o.seconds)):60;return new Date(Date.now()+e*1e3).toISOString()}n(re,"runtimeKeepaliveUntilIso");async function W(o,e={}){let t=`openpond-code-smoke-${Date.now()}`,r=`openpond-code-exec-ok:${t}`,s=`openpond-code-preview-ok:${t}`,i=`openpond-code-file-ok:${t}`,c=4173,m=null,a=null,d=!1,l=!1;try{let u=await G(o,await o.create({repo:e.repo??"https://github.com/octocat/Hello-World",resources:{cpu:e.cpu??1,memoryGb:e.memoryGb??1,diskGb:e.diskGb??8},budget:{maxUsd:e.budgetUsd??"0.05"},quotas:{maxSpendUsd:e.budgetUsd??"0.05",maxDurationSeconds:600,idleTimeoutSeconds:600,maxOpenPorts:2},metadata:{runId:t,source:"openpond-code-sandbox-smoke"}},{async:!0}));m=u.id;let p=e.expectedMppMode;if(p&&u.reservation.mpp?.mode!==p)throw new Error(`expected ${p} reservation, got ${u.reservation.mpp?.mode??"none"}`);if(!p&&!u.reservation.mpp?.mode)throw new Error("expected sandbox reservation MPP metadata");let y=await o.exec(u.id,{command:[`printf '${r}\\n'`,"test -f README && printf 'repo-clone-ok\\n'","cat > server.cjs <<'EOF'","const { createServer } = require('node:http');",`createServer((_request, response) => response.end('${s}')).listen(${c}, '0.0.0.0');`,"EOF","nohup node server.cjs > server.log 2>&1 & sleep 1"].join(`
|
|
3
|
-
`),timeoutSeconds:120});if(y.command.status!=="succeeded")throw new Error(`expected command success, got ${y.command.status}`);if(!y.command.output.includes(r))throw new Error("expected exec marker");if(await o.uploadFile(u.id,"openpond-code-smoke.txt",i),await o.downloadFile(u.id,"openpond-code-smoke.txt")!==i)throw new Error("expected file roundtrip marker");let S=null;if(e.snapshot||e.fork){let h=await o.createSnapshot(u.id,{async:!0,name:`openpond-code-smoke-${t}`,replay:{entrypoints:[{command:"cat openpond-code-smoke.txt",name:"default"}],retention:{class:"pinned"},safety:{cleanup:"delete",idleTimeoutSeconds:600,internetEgress:"block",maxDurationSeconds:600,maxSpendUsd:e.budgetUsd??"0.05",publicPreview:!1},validation:{commands:[{command:"test -f openpond-code-smoke.txt"}]}}}),f=h.snapshot??(await ne(o,u.id,h.snapshotJob?.snapshotId)).snapshot;if(S=f.id,f.state!=="ready")throw new Error(`expected ready snapshot, got ${f.state}`)}if(e.fork){if(!S)throw new Error("expected snapshot id before fork");let h=await G(o,(await o.forkSnapshot(S,{budget:{maxUsd:e.budgetUsd??"0.05"},metadata:{source:"openpond-code-sandbox-smoke-fork",templateSnapshotId:S}},{async:!0})).sandbox);a=h.id;let f=await o.exec(h.id,{command:"cat openpond-code-smoke.txt",timeoutSeconds:120});if(f.command.status!=="succeeded")throw new Error(`expected fork command success, got ${f.command.status}`);if(!f.command.output.includes(i))throw new Error("expected fork snapshot marker");e.keep||(await v(o,h.id),l=!0)}let I=null;if(e.preview!==!1){let h=await o.openPort(u.id,{label:"openpond-code-smoke",port:c}),f=await fetch(h.preview.url);I=f.status;let ee=await f.text();if(f.status!==200)throw new Error(`expected preview HTTP 200, got ${f.status}`);if(!ee.includes(s))throw new Error("expected preview marker")}let{sandbox:A,receipts:P}=await oe(o,u.id);return e.keep||(await v(o,u.id),d=!0),{deleted:d,execOutput:y.command.output.trim(),fileRoundtrip:!0,forkSandboxId:a,previewStatus:I,receiptRefs:P.map(h=>h.mpp.receiptRef??null),reservationRef:u.reservation.mpp?.reservationRef??null,runId:t,sandboxId:u.id,snapshotId:S,state:A.state}}finally{a&&!e.keep&&!l&&await H(o,a),m&&!e.keep&&!d&&await H(o,m)}}n(W,"runSandboxSmoke");async function oe(o,e){try{await o.stop(e)}catch{await o.stop(e,{async:!0})}let t=await K(o,e,new Set(["stopped","deleted"]),"stop"),r=await se(o,e);if(r.length===0)throw new Error("expected receipt readback");return{sandbox:t,receipts:r}}n(oe,"stopSandboxForSmoke");async function v(o,e){try{let t=await o.delete(e);if(t.state==="deleted")return t;await o.delete(e,{async:!0})}catch{await o.delete(e,{async:!0})}return K(o,e,new Set(["deleted"]),"delete")}n(v,"deleteSandboxForSmoke");async function H(o,e){try{await v(o,e)}catch{await o.delete(e,{async:!0}).catch(()=>{})}}n(H,"cleanupSandboxBestEffort");async function K(o,e,t,r){let c=Date.now()+3e5,m=await o.get(e);for(;Date.now()<c;){if(t.has(m.state))return m;if(m.state==="error")throw new Error(`sandbox ${r} failed: ${e}`);await $(3e3),m=await o.get(e)}throw new Error(`sandbox ${r} did not reach ${[...t].join("/")} before timeout: ${e} (${m.state})`)}n(K,"waitForSandboxState");async function se(o,e){let s=Date.now()+12e4,i=await o.receipts(e);for(;Date.now()<s;){if(i.length>0)return i;await $(3e3),i=await o.receipts(e)}return i}n(se,"waitForReceipts");async function G(o,e){if(e.state==="running"||e.state==="stopped")return e;if(e.state==="error")throw new Error(`sandbox create failed: ${e.id}
|
|
4
|
-
${e.logs.join(`
|
|
5
|
-
`)}`);let t=12*6e4,r=3e3,s=Date.now()+t,i=e;for(;Date.now()<s;){if(await $(r),i=await o.get(e.id),i.state==="running"||i.state==="stopped")return i;if(i.state==="error")throw new Error(`sandbox create failed: ${i.id}
|
|
6
|
-
${i.logs.join(`
|
|
7
|
-
`)}`)}throw new Error(`sandbox create did not reach running state before timeout: ${i.id} (${i.state})`)}n(G,"waitForCreateReady");async function ne(o,e,t){if(!t)throw new Error("snapshot job did not return snapshot id");let r=12*6e4,s=3e3,i=Date.now()+r,c=await o.get(e);for(;Date.now()<i;){let m=c.snapshots?.find(d=>d.id===t);if(m?.state==="ready")return{sandbox:c,snapshot:m};let a=c.snapshotJobs?.find(d=>d.snapshotId===t);if(a?.status==="failed")throw new Error(`snapshot job failed: ${a.error??t}`);await $(s),c=await o.get(e)}throw new Error(`snapshot did not reach ready state before timeout: ${t}`)}n(ne,"waitForSnapshotReady");function $(o){return new Promise(e=>setTimeout(e,o))}n($,"sleep");function R(o={}){return o.async||o.respondAsync?{Prefer:"respond-async"}:void 0}n(R,"asyncRequestHeaders");var q=class extends Error{static{n(this,"ApiTimeoutError")}timeoutMs;requestUrl;code="OPENPOND_API_TIMEOUT";constructor(e,t){super(`API request timed out after ${e}ms: ${t}`),this.timeoutMs=e,this.requestUrl=t,this.name="ApiTimeoutError"}},w=class extends Error{static{n(this,"ApiResponseTooLargeError")}maximumBytes;requestUrl;code="OPENPOND_API_RESPONSE_TOO_LARGE";constructor(e,t){super(`API response exceeded ${e} bytes: ${t}`),this.maximumBytes=e,this.requestUrl=t,this.name="ApiResponseTooLargeError"}},E=class extends Error{static{n(this,"OpenPondApiError")}status;apiMessage;code;constructor(e,t,r,s=null){let i=s||t;super(`${r} failed: ${e}${i?` ${i}`:""}`),this.status=e,this.apiMessage=s,this.name="OpenPondApiError",this.code=t||"OPENPOND_API_ERROR"}};async function x(o,e,t,r={}){let{timeoutMs:s=3e4,maxResponseBytes:i=8388608,explicitBearerAuth:c=!1,...m}=r,a=`${o}${t}`,d=new Headers(m.headers);d.set("Content-Type","application/json");let l=c?void 0:process.env.OPENPOND_API_KEY,u=e?.trim()||"",p=!c&&u.startsWith("opk_"),y=l||(p?u:null);y&&!d.has("openpond-api-key")&&d.set("openpond-api-key",y),e?d.set("Authorization",p?`ApiKey ${u}`:`Bearer ${e}`):l&&!d.has("Authorization")&&d.set("Authorization",`ApiKey ${l}`);let b=new AbortController,S=new q(s,a),I=s>0?setTimeout(()=>b.abort(S),s):null;I?.unref?.();let A=ie(m.signal,b.signal,s),P=n(()=>{I&&clearTimeout(I)},"cleanup");try{let h=await fetch(a,{...m,headers:d,signal:A});return ae(h,{cleanup:P,maximumBytes:i,requestUrl:a,timeoutController:b,timeoutError:S})}catch(h){throw P(),b.signal.aborted?S:h}}n(x,"apiFetch");async function T(o,e){let t;try{let r=await o.text();t=r?JSON.parse(r):{}}catch(r){if(r instanceof q||r instanceof w)throw r;t={}}if(!o.ok){let r=typeof t.error=="string"?t.error:null,s=typeof t.message=="string"?t.message:null;throw new E(o.status,r,e,s)}return t}n(T,"readApiJson");function ae(o,e){if(!o.body)return e.cleanup(),o;let t=Number(o.headers.get("content-length"));if(e.maximumBytes>0&&Number.isFinite(t)&&t>e.maximumBytes)throw e.cleanup(),o.body.cancel(),new w(e.maximumBytes,e.requestUrl);let r=o.body.getReader(),s=0,i=new ReadableStream({async pull(c){try{let m=await r.read();if(m.done){e.cleanup(),c.close();return}if(s+=m.value.byteLength,e.maximumBytes>0&&s>e.maximumBytes){e.cleanup(),await r.cancel(),c.error(new w(e.maximumBytes,e.requestUrl));return}c.enqueue(m.value)}catch(m){e.cleanup(),c.error(e.timeoutController.signal.aborted?e.timeoutError:m)}},async cancel(c){e.cleanup(),await r.cancel(c)}});return new Response(i,{headers:o.headers,status:o.status,statusText:o.statusText})}n(ae,"boundedResponse");function ie(o,e,t){return t<=0?o??void 0:o?AbortSignal.any([o,e]):e}n(ie,"composedSignal");async function _(o){let e=await x(o.sandboxApiUrl,o.apiKey,o.path,{timeoutMs:0,maxResponseBytes:0});if(!e.body)return;let t=e.body.getReader(),r=new TextDecoder,s="";try{for(;;){let{done:i,value:c}=await t.read();if(i)break;s+=r.decode(c,{stream:!0});let m=s.indexOf(`
|
|
8
|
-
|
|
9
|
-
`);for(;m!==-1;){let a=s.slice(0,m);s=s.slice(m+2);let d=de(a);d&&process.stdout.write(d),m=s.indexOf(`
|
|
10
|
-
|
|
11
|
-
`)}}}finally{t.releaseLock()}}n(_,"streamSandboxEventOutput");function Y(o){return typeof o=="string"?{dataBase64:Buffer.from(o,"utf-8").toString("base64")}:o instanceof Uint8Array?{dataBase64:Buffer.from(o).toString("base64")}:o}n(Y,"normalizePtyInput");function de(o){if(!o.includes("event: output"))return null;let e=o.split(/\r?\n/).filter(t=>t.startsWith("data: ")).map(t=>t.slice(6));if(e.length===0)return null;try{let t=JSON.parse(e.join(`
|
|
12
|
-
`));return typeof t.output=="string"?t.output:null}catch{return null}}n(de,"parseProcessOutputEvent");var O=class{static{n(this,"OpenPondSandboxInstanceClient")}apiKey;apiRootUrl;sandboxApiUrl;customEndpoint;constructor(e){this.apiKey=e.apiKey,this.customEndpoint=e.customEndpoint??!1,this.sandboxApiUrl=C(e.sandboxApiUrl??e.baseUrl??U),this.apiRootUrl=L(this.sandboxApiUrl)}create(e,t={}){return this.request("",{method:"POST",...this.customEndpoint?{timeoutMs:18e4}:{},headers:R(t),body:JSON.stringify(e)}).then(r=>r.sandbox)}get(e){return this.request(`/${encodeURIComponent(e)}`).then(t=>t.sandbox)}exec(e,t){return this.request(`/${encodeURIComponent(e)}/exec`,{method:"POST",body:JSON.stringify(t)})}startProcess(e,t){return this.request(`/${encodeURIComponent(e)}/processes`,{method:"POST",body:JSON.stringify(t)})}listProcesses(e){return this.request(`/${encodeURIComponent(e)}/processes`)}getProcess(e,t,r={}){let s=new URLSearchParams;return r.since!==void 0&&s.set("since",String(Math.max(0,r.since))),this.request(`/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}${s.size>0?`?${s.toString()}`:""}`)}stopProcess(e,t){return this.request(`/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}`,{method:"DELETE"})}async streamProcessOutput(e,t,r={}){let s=new URLSearchParams;r.since!==void 0&&s.set("since",String(Math.max(0,r.since))),await _({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/stream${s.size>0?`?${s.toString()}`:""}`})}startPty(e,t={}){return this.request(`/${encodeURIComponent(e)}/pty`,{method:"POST",body:JSON.stringify(t)})}listPtys(e){return this.request(`/${encodeURIComponent(e)}/pty`)}getPty(e,t,r={}){let s=new URLSearchParams;return r.since!==void 0&&s.set("since",String(Math.max(0,r.since))),this.request(`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}${s.size>0?`?${s.toString()}`:""}`)}writePtyInput(e,t,r){return this.request(`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}/input`,{method:"POST",body:JSON.stringify(Y(r))})}stopPty(e,t){return this.request(`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}`,{method:"DELETE"})}async streamPtyOutput(e,t,r={}){let s=new URLSearchParams;r.since!==void 0&&s.set("since",String(Math.max(0,r.since))),await _({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}/stream${s.size>0?`?${s.toString()}`:""}`})}uploadFile(e,t,r){return this.uploadFileBase64(e,t,Buffer.from(r,"utf-8").toString("base64"))}uploadFileBase64(e,t,r){return this.request(`/${encodeURIComponent(e)}/files`,{method:"POST",body:JSON.stringify({path:t,contentsBase64:r})})}async downloadFile(e,t){let r=await this.downloadFileResponse(e,t);return Buffer.from(r.file.contentsBase64,"base64").toString("utf-8")}downloadFileResponse(e,t){let r=typeof t=="string"?{path:t}:t,s=new URLSearchParams({path:r.path});return r.offsetBytes!==void 0&&s.set("offsetBytes",String(r.offsetBytes)),r.maxBytes!==void 0&&s.set("maxBytes",String(r.maxBytes)),this.request(`/${encodeURIComponent(e)}/files?${s.toString()}`)}listFiles(e,t={}){let r=new URLSearchParams({list:"1"});return t.path&&r.set("path",t.path),t.recursive!==void 0&&r.set("recursive",String(t.recursive)),t.maxEntries!==void 0&&r.set("maxEntries",String(t.maxEntries)),this.request(`/${encodeURIComponent(e)}/files?${r.toString()}`)}deleteFile(e,t,r={}){let s=new URLSearchParams({path:t});return r.recursive!==void 0&&s.set("recursive",String(r.recursive)),this.request(`/${encodeURIComponent(e)}/files?${s.toString()}`,{method:"DELETE"})}statFile(e,t){let r=new URLSearchParams({stat:"1",path:t});return this.request(`/${encodeURIComponent(e)}/files?${r.toString()}`)}mkdir(e,t){let r=typeof t=="string"?{path:t}:t,s=new URLSearchParams({path:r.path});return r.recursive!==void 0&&s.set("recursive",String(r.recursive)),this.request(`/${encodeURIComponent(e)}/files?${s.toString()}`,{method:"PUT"})}moveFile(e,t){let r=new URLSearchParams({fromPath:t.fromPath,toPath:t.toPath});return t.overwrite!==void 0&&r.set("overwrite",String(t.overwrite)),this.request(`/${encodeURIComponent(e)}/files?${r.toString()}`,{method:"PATCH"})}searchFiles(e,t){let r=new URLSearchParams({search:"1",query:t.query});return t.path&&r.set("path",t.path),t.maxResults!==void 0&&r.set("maxResults",String(t.maxResults)),this.request(`/${encodeURIComponent(e)}/files?${r.toString()}`)}openPort(e,t){return this.request(`/${encodeURIComponent(e)}/ports`,{method:"POST",body:JSON.stringify(t)})}createSnapshot(e,t){return this.request(`/${encodeURIComponent(e)}/snapshots`,{method:"POST",body:JSON.stringify(t)})}updateSnapshot(e,t,r){return this.request(`/${encodeURIComponent(e)}/snapshots/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(r)})}validateSnapshot(e,t,r={}){return this.request(`/${encodeURIComponent(e)}/snapshots/${encodeURIComponent(t)}/validate`,{method:"POST",body:JSON.stringify(r)})}publishSnapshot(e,t){return this.request(`/${encodeURIComponent(e)}/snapshots/${encodeURIComponent(t)}/publish`,{method:"POST"})}fork(e,t={}){return this.request(`/${encodeURIComponent(e)}/fork`,{method:"POST",body:JSON.stringify(t)})}stop(e,t={}){let r=new URLSearchParams;return t.failOnUnpreservedChanges&&r.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(e)}/stop${r.size>0?`?${r.toString()}`:""}`,{method:"POST",headers:R(t)})}start(e,t={}){return this.request(`/${encodeURIComponent(e)}/start`,{method:"POST",headers:R(t)})}restore(e){return this.request(`/${encodeURIComponent(e)}/restore`,{method:"POST"})}delete(e,t={}){let r=new URLSearchParams;return t.failOnUnpreservedChanges&&r.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`,{method:"DELETE",headers:R(t)}).then(s=>s.sandbox)}receipts(e){return this.request(`/${encodeURIComponent(e)}/receipts`).then(t=>t.receipts)}logs(e){return this.request(`/${encodeURIComponent(e)}/logs`).then(t=>t.logs)}gitStatus(e){return this.request(`/${encodeURIComponent(e)}/git/status`)}gitDiff(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/diff`,{method:"POST",body:JSON.stringify(t)})}gitExportPatch(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/export-patch`,{method:"POST",body:JSON.stringify(t)})}gitBranch(e,t){return this.request(`/${encodeURIComponent(e)}/git/branch`,{method:"POST",body:JSON.stringify(t)})}gitCommit(e,t){return this.request(`/${encodeURIComponent(e)}/git/commit`,{method:"POST",body:JSON.stringify(t)})}gitPull(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/pull`,{method:"POST",body:JSON.stringify(t)})}gitPush(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/push`,{method:"POST",body:JSON.stringify(t)})}billing(e){return this.request(`/${encodeURIComponent(e)}/billing`)}pricing(){return this.request("/pricing")}costs(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),this.request(`/costs${t.size>0?`?${t.toString()}`:""}`)}integrationLeases(e){return this.request(`/${encodeURIComponent(e)}/integrations`)}attachIntegrationConnection(e,t){return this.request(`/${encodeURIComponent(e)}/integrations`,{method:"POST",body:JSON.stringify(t)})}removeIntegrationLease(e,t){return this.request(`/${encodeURIComponent(e)}/integrations`,{method:"DELETE",body:JSON.stringify({leaseId:t})})}async request(e,t={}){let r=await x(this.sandboxApiUrl,this.apiKey,e,this.customEndpoint?{...t,explicitBearerAuth:!0,redirect:"error"}:t);return T(r,"Sandbox request")}async requestApiRoot(e,t={}){let r=await x(this.apiRootUrl,this.apiKey,e,this.customEndpoint?{...t,explicitBearerAuth:!0,redirect:"error"}:t);return T(r,"OpenPond API request")}};var j=class extends O{static{n(this,"OpenPondSandboxClient")}runtimes=B(this);sandboxes=z(this);profile=J(this);projects=D(this);agents=M(this);list(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),this.request(t.size>0?`?${t.toString()}`:"").then(r=>r.sandboxes)}listSecrets(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets${t.size>0?`?${t.toString()}`:""}`).then(r=>r.secrets)}getSecret(e,t={}){let r=new URLSearchParams;return t.teamId&&r.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`).then(s=>s.secret)}createSecret(e){return this.requestApiRoot("/sandbox-secrets",{method:"POST",body:JSON.stringify(e)}).then(t=>t.secret)}rotateSecret(e,t){let r=new URLSearchParams;t.teamId&&r.set("teamId",t.teamId);let{teamId:s,...i}=t;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}/rotate${r.size>0?`?${r.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)}).then(c=>c.secret)}attachSecret(e,t){let r=new URLSearchParams;t.teamId&&r.set("teamId",t.teamId);let{teamId:s,...i}=t;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}/attach${r.size>0?`?${r.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)}).then(c=>c.secret)}revokeSecret(e,t={}){let r=new URLSearchParams;return t.teamId&&r.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}/revoke${r.size>0?`?${r.toString()}`:""}`,{method:"POST"}).then(s=>s.secret)}deleteSecret(e,t={}){let r=new URLSearchParams;return t.teamId&&r.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`,{method:"DELETE"}).then(s=>s.secret)}snapshotCatalog(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),e.q&&t.set("q",e.q),e.kind&&t.set("kind",e.kind),e.replayState&&t.set("replayState",e.replayState),e.visibility&&t.set("visibility",e.visibility),e.tag&&t.set("tag",e.tag),e.useCase&&t.set("useCase",e.useCase),e.limit&&t.set("limit",String(e.limit)),this.request(`/catalog/snapshots${t.size>0?`?${t.toString()}`:""}`)}listSandboxRuntimes(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),this.requestApiRoot(`/runtimes${t.size>0?`?${t.toString()}`:""}`).then(r=>r.runtimes)}listProjects(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects?${t.toString()}`).then(r=>r.projects)}upsertProject(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects?${t.toString()}`,{method:"POST",body:JSON.stringify(e)}).then(r=>r.project)}getHostedProfile(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/profile?${t.toString()}`).then(r=>r.profile)}ensureHostedProfile(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/profile/ensure?${t.toString()}`,{method:"POST"}).then(r=>{if(!r.profile)throw new Error("hosted_profile_missing");return r.profile})}pushHostedProfile(e){let t=new URLSearchParams({teamId:e.teamId}),{teamId:r,...s}=e;return this.requestApiRoot(`/profile/push?${t.toString()}`,{method:"POST",body:JSON.stringify(s)})}async upsertProjectGitRemote(e){let t=await this.upsertProject(e);return this.ensureProjectGitRemote(t.id,{teamId:e.teamId})}getProject(e,t){let r=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}?${r.toString()}`).then(s=>s.project)}syncProject(e,t){let r=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}/sync?${r.toString()}`,{method:"POST"}).then(s=>s.project)}ensureProjectGitRemote(e,t){let r=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}/git?${r.toString()}`,{method:"POST"})}uploadProjectSource(e,t){let r=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/projects/${encodeURIComponent(e)}/source?${r.toString()}`,{method:"POST",body:JSON.stringify(i)}).then(c=>c.project)}updateProject(e,t){let r=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/projects/${encodeURIComponent(e)}?${r.toString()}`,{method:"PATCH",body:JSON.stringify(i)}).then(c=>c.project)}archiveProject(e,t){let r=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}?${r.toString()}`,{method:"DELETE"}).then(s=>s.project)}listAgents(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents?${t.toString()}`).then(r=>r.agents)}upsertAgent(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents?${t.toString()}`,{method:"POST",body:JSON.stringify(e)}).then(r=>r.agent)}getAgent(e,t){let r=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(e)}?${r.toString()}`).then(s=>s.agent)}archiveAgent(e,t){let r=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(e)}?${r.toString()}`,{method:"DELETE"}).then(s=>s.agent)}updateAgent(e,t){let r=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}?${r.toString()}`,{method:"PATCH",body:JSON.stringify(i)}).then(c=>c.agent)}runAgent(e,t){let r=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/run?${r.toString()}`,{method:"POST",headers:{Prefer:"respond-async"},body:JSON.stringify(i)})}getAgentSourceDeployPlan(e,t){let r=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/deploy-plan?${r.toString()}`).then(s=>s.deployPlan)}listAgentManifestSnapshots(e,t){let r=new URLSearchParams({teamId:t.teamId});return t.limit!==void 0&&r.set("limit",String(t.limit)),this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/manifest-snapshots?${r.toString()}`).then(s=>s.manifestSnapshots)}requestAgentSourceChecks(e,t){let r=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/checks?${r.toString()}`,{method:"POST",body:JSON.stringify(i),timeoutMs:900*1e3})}configureAgentSourceSetup(e,t){let r=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/setup?${r.toString()}`,{method:"POST",body:JSON.stringify(i)})}publishAgentSource(e,t){let r=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/publish?${r.toString()}`,{method:"POST",body:JSON.stringify(i)})}getMicrosoftTeamsBotOverview(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/teams/bot/overview?${t.toString()}`)}bindMicrosoftTeamsBotConversation(e){return this.requestApiRoot("/teams/bot/bindings",{method:"POST",body:JSON.stringify(e)})}rebindMicrosoftTeamsBotConversation(e,t){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}unlinkMicrosoftTeamsBotConversation(e){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(e.bindingId)}`,{method:"DELETE",body:JSON.stringify({teamId:e.teamId})})}sendMicrosoftTeamsBotDiagnostic(e){return this.requestApiRoot("/teams/bot/diagnostics",{method:"POST",body:JSON.stringify(e)})}sendMicrosoftTeamsBotDiagnosticRun(e){return this.requestApiRoot("/teams/bot/diagnostics/run",{method:"POST",body:JSON.stringify(e)})}createSandboxRuntime(e){return this.requestApiRoot("/runtimes",{method:"POST",body:JSON.stringify(e)}).then(t=>t.runtime)}sandboxRuntime(e,t=null){return F(this,e,t)}getSandboxRuntime(e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}`).then(t=>t.runtime)}createSandboxRuntimeSandbox(e,t={},r={}){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/sandbox`,{method:"POST",headers:R(r),body:JSON.stringify(t)})}updateSandboxRuntimeStatus(e,t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/status`,{method:"PATCH",body:JSON.stringify(t)}).then(r=>r.runtime)}listSandboxRuntimeEvents(e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/events`)}emitSandboxRuntimeEvent(e,t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/events`,{method:"POST",body:JSON.stringify(t)})}checkpointSandboxRuntime(e,t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/checkpoints`,{method:"POST",body:JSON.stringify(t)}).then(r=>r.runtime)}promoteSandboxRuntime(e,t,r={}){let s=new URLSearchParams;return r.teamId&&s.set("teamId",r.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/promote${s.size>0?`?${s.toString()}`:""}`,{method:"POST",body:JSON.stringify(t)})}preserveSandboxRuntimeSource(e,t={},r={}){let s=new URLSearchParams;return r.teamId&&s.set("teamId",r.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/preserve-source${s.size>0?`?${s.toString()}`:""}`,{method:"POST",body:JSON.stringify(t)})}forkSnapshot(e,t={},r={}){let s=new URLSearchParams;t.teamId&&s.set("teamId",t.teamId),t.projectId&&s.set("projectId",t.projectId),r.async&&s.set("async","1");let{teamId:i,projectId:c,...m}=t;return this.request(`/catalog/snapshots/${encodeURIComponent(e)}/fork${s.size>0?`?${s.toString()}`:""}`,{method:"POST",headers:r.async?{Prefer:"respond-async"}:void 0,body:JSON.stringify({...m,snapshotId:e})})}templates(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.q&&t.set("q",e.q),e.name&&t.set("name",e.name),e.version&&t.set("version",e.version),e.visibility&&t.set("visibility",e.visibility),e.tag&&t.set("tag",e.tag),e.useCase&&t.set("useCase",e.useCase),e.limit&&t.set("limit",String(e.limit)),this.request(`/templates${t.size>0?`?${t.toString()}`:""}`)}publishedSnapshots(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.q&&t.set("q",e.q),e.name&&t.set("name",e.name),e.version&&t.set("version",e.version),e.visibility&&t.set("visibility",e.visibility),e.tag&&t.set("tag",e.tag),e.useCase&&t.set("useCase",e.useCase),e.limit&&t.set("limit",String(e.limit)),this.request(`/published-snapshots${t.size>0?`?${t.toString()}`:""}`).then(r=>{let s=r.publishedSnapshots??r.templates;return{...r,templates:s,publishedSnapshots:s}})}launchTemplate(e){let t=new URLSearchParams;e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId);let{teamId:r,projectId:s,...i}=e;return this.request(`/templates/launch${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)})}runPublishedSnapshot(e){let t=new URLSearchParams;e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId);let{teamId:r,projectId:s,...i}=e;return this.request(`/published-snapshots/launch${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)}).then(c=>{let m=c.publishedSnapshot??c.template;return{...c,template:m,publishedSnapshot:m}})}listSchedules(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.sourceSandboxId&&t.set("sourceSandboxId",e.sourceSandboxId),this.request(`/schedules${t.size>0?`?${t.toString()}`:""}`)}createSchedule(e){let t=new URLSearchParams;e.projectId&&t.set("projectId",e.projectId);let{projectId:r,...s}=e;return this.request(`/schedules${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(s)})}getSchedule(e){return this.request(`/schedules/${encodeURIComponent(e)}`)}updateSchedule(e,t){return this.request(`/schedules/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}deleteSchedule(e){return this.request(`/schedules/${encodeURIComponent(e)}`,{method:"DELETE"})}listScheduleRuns(e,t={}){let r=new URLSearchParams;return t.limit!==void 0&&r.set("limit",String(t.limit)),this.request(`/schedules/${encodeURIComponent(e)}/runs${r.size>0?`?${r.toString()}`:""}`)}runScheduleNow(e,t={}){return this.request(`/schedules/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}listTemplateBuilds(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/sandbox-template-builds?${t.toString()}`).then(r=>r.builds)}createTemplateBuild(e){return this.requestApiRoot("/sandbox-template-builds",{method:"POST",body:JSON.stringify(e)}).then(t=>t.build)}getTemplateBuild(e){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(e)}`).then(t=>t.build)}getTemplateBuildLogs(e){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(e)}/logs`)}cancelTemplateBuild(e){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(e)}/cancel`,{method:"POST"}).then(t=>t.build)}listPublishedSnapshotBuilds(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/published-snapshot-builds?${t.toString()}`).then(r=>r.builds)}createPublishedSnapshotBuild(e){return this.requestApiRoot("/published-snapshot-builds",{method:"POST",body:JSON.stringify(e)}).then(t=>t.build)}getPublishedSnapshotBuild(e){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(e)}`).then(t=>t.build)}getPublishedSnapshotBuildLogs(e){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(e)}/logs`)}cancelPublishedSnapshotBuild(e){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(e)}/cancel`,{method:"POST"}).then(t=>t.build)}listOrganizations(){return this.requestApiRoot("/organizations").then(e=>e.organizations??e.teams??[])}createOrganization(e){return this.requestApiRoot("/organizations",{method:"POST",body:JSON.stringify(e)}).then(t=>t.organization)}getOrganization(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}`).then(t=>t.organization)}updateOrganization(e,t){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)}).then(r=>r.organization)}listOrganizationMembers(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/members`).then(t=>t.members)}upsertOrganizationMember(e,t){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(t)}).then(r=>r.member)}getOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server`).then(t=>t.mcpServer)}generateOrganizationMcpServer(e,t={}){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server`,{method:"POST",body:JSON.stringify(t)}).then(r=>r.mcpServer)}rotateOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server/rotate`,{method:"POST"}).then(t=>t.mcpServer)}disableOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server/disable`,{method:"POST"}).then(t=>t.mcpServer)}enableOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server/enable`,{method:"POST"}).then(t=>t.mcpServer)}startReplay(e){let t=new URLSearchParams;e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId);let{teamId:r,projectId:s,...i}=e;return this.requestApiRoot(`/sandbox-replays${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)})}listReplays(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays${t.size>0?`?${t.toString()}`:""}`)}getReplay(e,t={}){let r=new URLSearchParams;return t.teamId&&r.set("teamId",t.teamId),t.projectId&&r.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`)}getReplayLogs(e,t={}){let r=new URLSearchParams;return t.teamId&&r.set("teamId",t.teamId),t.projectId&&r.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}/logs${r.size>0?`?${r.toString()}`:""}`)}getReplayArtifacts(e,t={}){let r=new URLSearchParams;return t.teamId&&r.set("teamId",t.teamId),t.projectId&&r.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}/artifacts${r.size>0?`?${r.toString()}`:""}`)}cancelReplay(e,t={}){let r=new URLSearchParams;return t.teamId&&r.set("teamId",t.teamId),t.projectId&&r.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}/cancel${r.size>0?`?${r.toString()}`:""}`,{method:"POST"})}integrationConnections(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),e.status&&t.set("status",e.status),this.requestApiRoot(`/integrations/connections${t.size>0?`?${t.toString()}`:""}`)}mcpServerConfig(){return{name:"openpond-sandboxes",transport:"streamable-http",url:`${this.sandboxApiUrl}/mcp`,headers:{"openpond-api-key":this.apiKey}}}smoke(e={}){return W(this,e)}};function De(o){return new j(o)}n(De,"createOpenPondSandboxClient");import{randomUUID as ce}from"node:crypto";function X(o){let e=g(o);if(!e)throw new Error("apiBaseUrl is required");return e}n(X,"normalizeApiBaseUrl");function V(o){return o.replace(/\/+$/,"")}n(V,"trimTrailingSlashes");function g(o){let e=V(o?.trim()??"");return e?(e=e.replace(/\/chat\/completions$/i,"").replace(/\/models(?:\/[^/]+)?$/i,""),e.endsWith("/opchat/v1")?e:e.endsWith("/opchat")?`${e}/v1`:(e.endsWith("/v1")&&(e=e.slice(0,-3)),`${V(e)}/opchat/v1`)):null}n(g,"normalizeOptionalOpChatApiBaseUrl");function We(o={}){let e=o.env??(typeof process<"u"?process.env:{}),t=g(o.opChatApiBaseUrl)??g(e.OPENPOND_OPCHAT_API_URL);if(t)return t;let r=g(o.chatApiBaseUrl)??g(e.OPENPOND_CHAT_API_URL)??g(e.OPENPOND_GATEWAY_URL);return r||(g(o.apiBaseUrl)??g(e.OPENPOND_API_URL)??N)}n(We,"resolveOpChatApiBaseUrl");function me(o){let e=o.trim();if(!e)throw new Error("OpenPond API key is required");return e}n(me,"requireToken");function Q(o,e,t){let r=new Headers;return r.set("Authorization",`Bearer ${me(o)}`),r.set("Content-Type","application/json"),r.set("Accept",e),r.set("x-openpond-client","openpond-code"),r.set("x-openpond-request-id",t||ce()),r}n(Q,"hostedHeaders");async function Z(o){let e=await o.text().catch(()=>"");if(!e)return o.statusText||`HTTP ${o.status}`;try{let t=JSON.parse(e),r=typeof t.error=="string"||t.error&&typeof t.error=="object"&&!Array.isArray(t.error)?t.error:null,s=typeof t.code=="string"?t.code:r&&typeof r!="string"&&typeof r.code=="string"?r.code:null,i=typeof t.message=="string"?t.message:r&&typeof r!="string"&&typeof r.message=="string"?r.message:null,c=typeof r=="string"?r:r&&typeof r.type=="string"?r.type:null;return[s,c,i].filter(Boolean).join(": ")||e}catch{return e}}n(Z,"readError");function ue(o,e){let t={model:o.model,messages:o.messages,stream:e};typeof o.temperature=="number"&&(t.temperature=o.temperature),typeof o.maxTokens=="number"&&(t.max_tokens=o.maxTokens),o.reasoningEffort==="off"?t.thinking={type:"disabled"}:o.reasoningEffort&&(t.reasoning_effort=o.reasoningEffort),o.tools&&(t.tools=o.tools);let r=o.toolChoice??o.tool_choice;return r!==void 0&&(t.tool_choice=r),o.metadata&&(t.metadata=o.metadata),t}n(ue,"buildHostedChatBody");async function Ke(o){let t=`${X(o.apiBaseUrl)}/models`,r=await fetch(t,{method:"GET",headers:Q(o.token,"application/json"),signal:o.signal});if(!r.ok)throw new Error(`Hosted model list failed: ${r.status} ${await Z(r)}`);return await r.json()}n(Ke,"listOpChatModels");async function Ye(o){let t=`${X(o.apiBaseUrl)}/chat/completions`,r=await fetch(t,{method:"POST",headers:Q(o.token,"application/json",o.requestId),body:JSON.stringify(ue(o,!1)),signal:o.signal});if(!r.ok)throw new Error(`Hosted chat failed: ${r.status} ${await Z(r)}`);return await r.json()}n(Ye,"sendHostedChatTurn");export{E as a,x as b,T as c,k as d,U as e,C as f,j as g,De as h,We as i,Ke as j,Ye as k};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{i as a,j as b,k as c}from"./chunk-6JAN4RMN.js";import"./chunk-PQHTZ5CP.js";import"./chunk-GCOUYYHG.js";import"./chunk-FPUUZQUP.js";import"./chunk-T5LE6R5S.js";import"./chunk-USKE34VR.js";import"./chunk-7ZG3IT7C.js";import"./chunk-4TZHH5FC.js";import"./chunk-4SHKI3BH.js";import"./chunk-5CMKGD43.js";import"./chunk-HA7EFTPF.js";import"./chunk-L3KS6MOV.js";import"./chunk-7QEE4PBI.js";import"./chunk-2JO2KWT3.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as resolveWebLaunchMessages,c as runOpenPondAppServerCli,b as runOpenPondServerCli};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as w,b as u}from"./chunk-UJ5EFSEC.js";import"./chunk-NPOHW5OU.js";import"./chunk-N3DEA6PG.js";import"./chunk-PA7XP42P.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-YJ4PNAST.js";import"./chunk-AH22RHPS.js";import{c as o}from"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import{q as m}from"./chunk-2SPZYBDN.js";import"./chunk-QXVIIM4T.js";import"./chunk-R3XFY7VL.js";import"./chunk-GLUWATL5.js";import"./chunk-YL6VFJ4P.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import{b as l}from"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";async function y(i,p){let[n,c]=p;if(!n||p.length>2)throw new Error("usage: connected-evidence <list|collection|recorded-list|recorded|import-receipt|summary|case|unmapped|capture|selection|publish|prepare-recorded|upload-part|preview|commit|set-collection> [id] --team <id> [--input-file <path>]");if(o(i,"project")&&!["list","recorded-list"].includes(n))throw new Error("--project filters list commands; other operations retain their exact Project in --input-file.");if(i.local===!0||i.local==="true")throw new Error("Connected evidence is retained by its hosted source owner; select --api-base-url for that owner.");if(c&&!["recorded","import-receipt"].includes(n))throw new Error("This operation does not accept a resource id.");let a=new m(await u(i)),t=AbortSignal.timeout(6e4),d={...o(i,"project")?{projectId:o(i,"project")}:{},...o(i,"cursor")?{cursor:o(i,"cursor")}:{},limit:Number(o(i,"limit")||20)},r=s(async()=>w(i),"input"),e;switch(n){case"list":e=await a.list(d,t);break;case"recorded-list":e=await a.listRecordedExecutions(d,t);break;case"collection":e=await a.collection(t);break;case"recorded":if(!c)throw new Error("Select a recorded execution id.");e=await a.recordedExecution(c,t);break;case"import-receipt":if(!c)throw new Error("Select the original import operation id.");e=await a.readImport(c,t);break;case"summary":e=await a.homeSummary(await r(),t);break;case"case":e=await a.read(await r(),t);break;case"unmapped":e=await a.unmappedEvents(await r(),t);break;case"capture":e=await a.capture(await r(),t);break;case"selection":e=await a.createSelection(await r(),t);break;case"publish":e=await a.publishDataset(await r(),t);break;case"prepare-recorded":e=await a.prepareRecorded(await r(),t);break;case"upload-part":e=await a.uploadPart(await r(),t);break;case"preview":e=await a.preview(await r(),t);break;case"commit":e=await a.commit(await r(),t);break;case"set-collection":e=await a.setCollection(l.object({paused:l.boolean()}).strict().parse(await r()).paused,t);break;default:throw new Error("Unknown connected evidence operation.")}console.log(JSON.stringify(e,null,2))}s(y,"runConnectedEvidenceCommand");export{y as runConnectedEvidenceCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"./chunk-GXSTZBM6.js";import"./chunk-N3DEA6PG.js";import"./chunk-PA7XP42P.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-YJ4PNAST.js";import"./chunk-AH22RHPS.js";import"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import"./chunk-2SPZYBDN.js";import"./chunk-QXVIIM4T.js";import"./chunk-R3XFY7VL.js";import"./chunk-GLUWATL5.js";import"./chunk-YL6VFJ4P.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{m as resolveGitBranch,f as runAccount,j as runBacktestRun,p as runCheckUpdate,k as runDeployWatch,g as runHealth,d as runLogin,o as runOpentool,e as runProfiles,l as runRepoCreate,n as runRepoPush,b as runTemplateBranches,a as runTemplateStatus,c as runTemplateUpdate,h as runToolList,i as runToolRun};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{d as N}from"./chunk-7QEE4PBI.js";import"./chunk-2JO2KWT3.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-N3DEA6PG.js";import{c as K}from"./chunk-PA7XP42P.js";import{c as L,f as B}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-YJ4PNAST.js";import"./chunk-AH22RHPS.js";import{c as u,f as E}from"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import{a as I,b as S,c as q,g as U,h as $,i as W,j as g,k as A,l as T,m as O,n as j,o as C}from"./chunk-2SPZYBDN.js";import"./chunk-QXVIIM4T.js";import{d as z}from"./chunk-R3XFY7VL.js";import"./chunk-GLUWATL5.js";import"./chunk-YL6VFJ4P.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import{Q as x,U as H}from"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import{b as i}from"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as w}from"./chunk-FTQLQJQV.js";var D=i.enum(["create","save","publish","begin_version"]),V=i.object({operationId:i.string().trim().min(1).max(240),kind:D,requestHash:i.string().regex(/^[a-f0-9]{64}$/),receipt:g,base:g.nullable()}).strict().superRefine((n,a)=>{let{receipt:e,base:t,kind:r}=n;(t&&(t.teamId!==e.teamId||t.datasetId!==e.datasetId||t.revision+1!==e.revision)||!t&&e.revision!==1)&&a.addIssue({code:"custom",message:"Operation recovery history identity/revision mismatch."}),t&&((t.ownerScope??"workspace")!==(e.ownerScope??"workspace")||t.originProjectId!==e.originProjectId||t.workspace.draft.createdAt!==e.workspace.draft.createdAt)&&a.addIssue({code:"custom",message:"Operation recovery cannot change Dataset ownership or origin."});let s=t?e.workspace.draft.status==="published"?"publish":t.workspace.draft.status==="published"?"begin_version":"save":"create";r!==s&&a.addIssue({code:"custom",message:"Operation recovery kind differs from its retained lifecycle."})});var k=class{constructor(a){this.options=a;let e=new URL(a.baseUrl);if(!["http:","https:"].includes(e.protocol)||e.username||e.password||e.search||e.hash||!a.apiKey.trim()||!a.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=e.toString().replace(/\/+$/,"")}options;static{w(this,"OpenPondDatasetWorkspaceClient")}baseUrl;async list(a={}){let{signal:e,...t}=a,r=$.parse(t),s=new URLSearchParams(Object.entries(r).filter(([,c])=>c!==void 0).map(([c,p])=>[c,String(p)])),o=j.parse(await this.request(`?${s}`,"GET",void 0,e));if(o.teamId!==this.options.teamId||o.datasets.length>r.limit||new Set(o.datasets.map(c=>c.id)).size!==o.datasets.length)throw new Error("Dataset list workspace/page mismatch.");return o}async get(a,e){return this.readback(await this.request(`/${encodeURIComponent(a)}`,"GET",void 0,e),a)}async operationResult(a,e){let t=D.parse(e.kind),r=new URLSearchParams({kind:t,...e.datasetId?{datasetId:e.datasetId}:{}}),s=await this.request(`/operations/${encodeURIComponent(a)}?${r}`,"GET",void 0,e.signal,132*1024*1024);if(s===null)return null;let o=V.parse(s);if(this.readback(o.receipt,o.receipt.datasetId),o.base&&this.readback(o.base,o.receipt.datasetId),o.operationId!==a||o.kind!==t||e.datasetId&&o.receipt.datasetId!==e.datasetId||e.requestHash&&o.requestHash!==e.requestHash)throw new Error("Dataset operation recovery identity/request mismatch.");return o}async beginVersion(a,e,t){let r=T.parse(e),s=this.readback(await this.request(`/${encodeURIComponent(a)}/begin-version`,"POST",r,t),a);if(s.revision!==r.expectedRevision+1||s.workspace.draft.status!=="draft"||!s.publication||!s.workspace.draft.publishedTasksetRef)throw new Error("Editable version receipt mismatch.");return s}async versions(a,e={}){let t=new URLSearchParams(e.beforeRevision===void 0?{}:{beforeRevision:String(e.beforeRevision)}),r=O.parse(await this.request(`/${encodeURIComponent(a)}/versions?${t}`,"GET",void 0,e.signal));if(r.teamId!==this.options.teamId||r.datasetId!==a||r.items.some((s,o)=>o>0&&s.workspaceRevision>=r.items[o-1].workspaceRevision||e.beforeRevision!==void 0&&s.workspaceRevision>=e.beforeRevision))throw new Error("Dataset version history scope/order mismatch.");return r}async version(a,e,t){let r=this.readback(await this.request(`/${encodeURIComponent(a)}/versions/${e}`,"GET",void 0,t),a);if(r.revision!==e||r.workspace.draft.status!=="published")throw new Error("Dataset immutable version mismatch.");return r}async save(a,e){let t=W.parse(a),r=I(t.workspace);if(r.draft.profileId!==this.options.teamId||r.draft.revision!==t.expectedRevision+1)throw new Error("Dataset write scope or revision mismatch.");let s=this.readback(await this.request(`/${encodeURIComponent(r.draft.id)}`,"PUT",t,e),r.draft.id);if(t.originProjectId&&s.originProjectId!==t.originProjectId)throw new Error("Dataset origin Project mismatch.");if(t.ownerScope&&s.ownerScope!==t.ownerScope)throw new Error("Dataset owner scope mismatch.");if(s.workspace.contentHash!==r.contentHash)throw new Error("Dataset write receipt differs from the saved bytes.");return s}async validate(a,e,t){let r=C.parse(await this.request(`/${encodeURIComponent(a)}/validate`,"POST",{expectedRevision:e},t));if(r.teamId!==this.options.teamId||r.datasetId!==a||r.revision!==e)throw new Error("Dataset validation receipt mismatch.");return r}async publish(a,e,t){let r=A.parse(e),s=this.readback(await this.request(`/${encodeURIComponent(a)}/publish`,"POST",r,t),a);if(s.revision!==r.expectedRevision+1||s.workspace.draft.status!=="published"||s.publication?.packageHash!==r.packageHash)throw new Error("Dataset publication receipt mismatch.");return s}readback(a,e){let t=g.parse(a);if(I(t.workspace),t.datasetId!==e||t.teamId!==this.options.teamId)throw new Error("Dataset identity mismatch.");return t}async request(a,e,t,r,s){let o=await(this.options.fetch??fetch)(`${this.baseUrl}/v1/dataset-workspaces${a}`,{method:e,signal:r,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,"Content-Type":"application/json"},...t===void 0?{}:{body:JSON.stringify(t)}});if(!o.ok)throw new Error(`Dataset request failed (${o.status}).`);if(s!==void 0){if(!o.body)throw new Error("Dataset response is empty.");let c=o.body.getReader(),p=[],h=0;try{for(;;){let d=await c.read();if(d.done)break;if(h+=d.value.byteLength,h>s)throw new Error("Dataset recovery exceeds its bounded response.");p.push(d.value)}}finally{await c.cancel()}let l=new Uint8Array(h),m=0;for(let d of p)l.set(d,m),m+=d.length;return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(l))}return o.json()}};var y=i.string().trim().min(1).max(500),_=i.string().regex(/^[a-f0-9]{64}$/),J=i.object({release:S,afterId:y.optional(),limit:i.number().int().min(1).max(1e4).default(100),view:i.enum(["ids","policy"]).default("ids")}).strict().superRefine((n,a)=>{n.view==="policy"&&n.limit>100&&a.addIssue({code:"custom",path:["limit"],message:"Policy previews are bounded to 100 tasks."})}),G=i.object({id:H.shape.id,split:x}).strict(),Q=G.extend({input:i.record(i.string(),i.unknown()),policyVisibleContext:i.record(i.string(),i.unknown()),artifacts:i.array(i.object({id:y,path:i.string(),mediaType:i.string(),sizeBytes:i.number().int().nonnegative()}).strict()).max(1e3)}).strict(),de=i.object({schemaVersion:i.literal("openpond.datasetPopulationPage.v1"),teamId:y,release:S,view:J.shape.view,taskCount:i.number().int().nonnegative(),items:i.array(i.union([G,Q])).max(1e4),graders:i.array(q).max(1e3),nextCursor:y.nullable(),contentHash:_}).strict().superRefine((n,a)=>{n.view==="policy"&&n.items.length>100&&a.addIssue({code:"custom",message:"Policy preview exceeded its task bound."}),n.items.some(e=>"input"in e!=(n.view==="policy"))&&a.addIssue({code:"custom",message:"Dataset task view differs from the requested projection."})});async function ye(n,a){let[e,t]=a,r=u(n,"team"),s=L(n);if(!r||!s||!e||a.length>2||!["upload","read","list","validate","publish"].includes(e))throw new Error("usage: datasets <upload|read|list|validate|publish> [folder|id] --team <id> --api-base-url <origin> [--operation-id <id>] [--expected-revision <n>] [--publish] [--project <id>]");let o=await z(),c=new k({teamId:r,baseUrl:s,apiKey:await K(o,B(o))}),p=u(n,"operationId"),h;if(e==="list"){if(t)throw new Error("List does not accept a dataset id.");h=await c.list({cursor:u(n,"cursor")||void 0})}else{if(!t)throw new Error(`${e} requires a ${e==="upload"?"folder":"dataset id"}.`);if(e==="read")h=await c.get(t);else if(e==="upload"){if(!p||p.length>220)throw new Error("Upload requires a stable --operation-id of at most 220 characters. Reuse it after an uncertain response.");let l=u(n,"expectedRevision"),m=l?Number(l):0;if(!Number.isSafeInteger(m)||m<0)throw new Error("Expected revision must be a nonnegative integer.");let d=await N({directory:t,teamId:r,expectedRevision:m,datasetId:u(n,"datasetId")||void 0}),b=U({workspace:d.workspace,preparation:null,adapterId:"openpond-hosted-taskset-authoring-v1",now:d.workspace.draft.updatedAt}),f=await c.save({operationId:`${p}:save`,expectedRevision:m,workspace:d.workspace,...u(n,"project")?{originProjectId:u(n,"project")}:{}}),R=await c.get(f.datasetId);if(R.workspace.draft.status==="draft"){let P=await c.validate(f.datasetId,f.revision);if(P.workspaceHash!==d.workspace.contentHash||P.packageHash!==b.contentHash)throw new Error("Hosted validation differs from the captured folder bytes.")}else if(R.publication?.packageHash!==b.contentHash)throw new Error("This dataset was changed after the upload receipt. Read the current version before continuing.");let v=E(n.publish)?await c.publish(f.datasetId,{operationId:`${p}:publish`,expectedRevision:f.revision,workspaceHash:f.workspace.contentHash,packageHash:b.contentHash}):f;h={teamId:r,datasetId:v.datasetId,revision:v.revision,status:v.workspace.draft.status,operationId:p,capturedBytes:d.capturedBytes,sourceHash:d.sourceHash,sourceFiles:d.sourceFiles,workspaceHash:f.workspace.contentHash,packageHash:b.contentHash,publication:v.publication}}else{let l=Number(u(n,"expectedRevision"));if(!Number.isSafeInteger(l)||l<=0)throw new Error(`${e} requires --expected-revision with the retained dataset revision.`);if(e==="validate")h=await c.validate(t,l);else{if(!p)throw new Error("Publish requires a stable --operation-id.");let m=u(n,"workspaceHash"),d=u(n,"packageHash");if(!m||!d)throw new Error("Publish requires --workspace-hash and --package-hash from the retained validation receipt. Keep these pins and the operation id unchanged on retry.");h=await c.publish(t,{operationId:p,expectedRevision:l,workspaceHash:m,packageHash:d})}}}console.log(JSON.stringify(h,null,2))}w(ye,"runDatasetsCommand");export{ye as runDatasetsCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{u as f}from"./chunk-N3DEA6PG.js";import"./chunk-PA7XP42P.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as c}from"./chunk-YJ4PNAST.js";import"./chunk-AH22RHPS.js";import{c as p,f as u}from"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import"./chunk-2SPZYBDN.js";import"./chunk-QXVIIM4T.js";import"./chunk-R3XFY7VL.js";import"./chunk-GLUWATL5.js";import"./chunk-YL6VFJ4P.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as r}from"./chunk-FTQLQJQV.js";import d from"node:path";import{access as v}from"node:fs/promises";import{constants as C}from"node:fs";import{createRequire as P}from"node:module";var l=d.join("scripts","desktop-harness.ts");async function $(n,t){let o=await j({options:n,rest:t}),e=await f(o.command,o.args,{cwd:o.cwd,inherit:!0,timeoutMs:0});if(e.code!==0)throw new m(e.code)}r($,"runDesktopTestCommand");async function j(n){let t=n.options,o=n.rest,e=o[0];if(e!=="run"&&e!=="attach")throw new c(D());let a=o.slice(1);if(a.length===0)throw new c("usage: openpond desktop-test run <scenario...> [options]");let g=p(t,"cwd")||n.cwd||process.cwd(),w=await O(g),k=(n.env??process.env).OPENPOND_NODE_BINARY?.trim()||process.execPath,s=[P(import.meta.url).resolve("tsx/cli"),l,"run",...a],h=x(t,e);return h&&s.push(`--${h}`),i(s,"--app",t,"app"),i(s,"--server",t,"server"),i(s,"--token",t,"token"),i(s,"--token-file",t,"tokenFile"),i(s,"--devtools-port",t,"devtoolsPort"),i(s,"--artifacts-dir",t,"artifactsDir"),H(s,t),i(s,"--grep",t,"grep"),i(s,"--timeout-ms",t,"timeoutMs"),u(t.keepHome)&&s.push("--keep-home"),{command:k,args:s,cwd:w}}r(j,"buildDesktopHarnessInvocation");async function O(n){let t=d.resolve(n);for(;;){let o=d.join(t,l);if(await R(o))return t;let e=d.dirname(t);if(e===t)throw new c(`Could not find ${l}. Run this command from the OpenPond source checkout or pass --cwd <repo>.`);t=e}}r(O,"resolveDesktopHarnessRepoRoot");function x(n,t){let o=t==="attach"?"attach":null;for(let e of["isolated","attach","packaged","none"])if(u(n[e])){if(o&&o!==e)throw new c("Choose only one desktop harness launch mode: --isolated, --attach, --packaged, or --none.");o=e}return o}r(x,"resolveLaunchMode");function i(n,t,o,e){let a=p(o,e);a&&n.push(t,a)}r(i,"appendStringFlag");function H(n,t){let o=p(t,"json"),e=p(t,"jsonPath");if(o&&y(o))throw new c("harness --json requires a report path. Use --json <path> or --json-path <path>.");if(o&&e&&o!==e)throw new c("Use only one JSON report path: --json <path> or --json-path <path>.");let a=o||e;a&&n.push("--json",a)}r(H,"appendJsonFlag");function y(n){return/^(true|false|1|0|yes|no)$/i.test(n)}r(y,"isBooleanLiteral");async function R(n){try{return await v(n,C.R_OK),!0}catch{return!1}}r(R,"fileExists");function D(){return["usage: openpond desktop-test run <scenario...> [options]"," openpond desktop-test attach <scenario...> [options]","","Options include --isolated, --attach, --packaged, --none, --app <path>,","--server <url>, --token <token>, --token-file <path>, --devtools-port <port>, --artifacts-dir <path>,","--json <path>, --json-path <path>, --grep <pattern>, --timeout-ms <ms>,","--keep-home, and --cwd <repo>."].join(`
|
|
3
|
-
`)}r(D,"desktopHarnessCliUsage");var m=class extends Error{static{r(this,"HarnessCommandFailedError")}exitCode;constructor(t){let o=typeof t=="number"&&t>0?t:1;super(`desktop harness failed with exit code ${o}`),this.name="HarnessCommandFailedError",this.exitCode=o}};export{j as buildDesktopHarnessInvocation,O as resolveDesktopHarnessRepoRoot,$ as runDesktopTestCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{A as D,B as E,C as F,D as G,E as H,F as I,G as J,H as K,I as L,J as M,K as N,L as O,M as P,N as Q,O as R,P as S,Q as T,R as U,S as V,T as W,U as X,V as Y,W as Z,X as _,Y as $,Z as aa,a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v,t as w,u as x,v as y,w as z,x as A,y as B,z as C}from"./chunk-7ZG3IT7C.js";import{Aa as c,ya as a,za as b}from"./chunk-SDEDAHV6.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-FTQLQJQV.js";export{l as AGENT_PROTOCOL_VERSION,m as AGENT_RPC_METHODS,$ as AcpClient,_ as AcpRpcError,Q as AgentCheckpointSchema,P as AgentEffectiveSurfaceSchema,i as AgentEventNameSchema,M as AgentHostStorageClient,t as AgentJsonRpcDispatcher,r as AgentProtocolEnvelopeSchema,u as AgentRpcClient,j as CanonicalAgentEventSchema,aa as ClaudeCliClient,v as ExperimentEnvironmentParamsSchema,I as HOST_STORAGE_CONTRACT_VERSION,y as HarnessReviewStorageParamsSchema,L as HostStorageCapabilitySchema,K as HostStorageRequestSchema,J as HostStorageScopeSchema,A as HostedOutputBeginParamsSchema,B as HostedOutputChunkParamsSchema,C as HostedOutputCompleteParamsSchema,z as HostedOutputIdentitySchema,E as HostedOutputSaveSandboxFileParamsSchema,F as HostedSandboxActionSchema,D as HostedSandboxOutputIdentitySchema,G as HostedSandboxRequestParamsSchema,H as HostedToolAuthorizationParamsSchema,s as InitializeParamsSchema,q as JsonRpcErrorSchema,o as JsonRpcNotificationSchema,n as JsonRpcRequestSchema,p as JsonRpcSuccessSchema,x as RefinerStorageActionSchema,w as TaskInboxStorageParamsSchema,Z as TaskSerialExecutor,Y as TaskSignals,f as agentCompactionDecision,k as canonicalEventHash,e as canonicalHash,d as canonicalJson,S as checkpointHash,O as createAgentRuntimeService,U as createAgentToolCatalog,W as createAgentToolCatalogProjection,R as effectiveSurfaceHash,V as executeAgentTool,X as executeProjectedAgentTool,T as materializeAgentPrompt,a as providerRoundSequence,g as runAgentCompaction,h as runAgentCompactionProgram,N as runAgentJsonlServer,c as runProviderRound,b as runProviderRoundLoop};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as p,b as v}from"./chunk-UJ5EFSEC.js";import"./chunk-NPOHW5OU.js";import"./chunk-N3DEA6PG.js";import"./chunk-PA7XP42P.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-YJ4PNAST.js";import"./chunk-AH22RHPS.js";import{c as r}from"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import{A as h,B as w,y as d,z as s}from"./chunk-2SPZYBDN.js";import"./chunk-QXVIIM4T.js";import"./chunk-R3XFY7VL.js";import"./chunk-GLUWATL5.js";import"./chunk-YL6VFJ4P.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as m}from"./chunk-FTQLQJQV.js";async function b(t,e,n){let[a,o]=n,i=r(e,"actor");if(!i||!a||n.length>2)throw new Error("Select --actor, --team and an evaluation command.");if(e.local!==!0&&e.local!=="true")throw new Error("These evaluation owners currently run through the authenticated native bridge. Select --local --server-url with its loopback origin.");let c={...await v(e),actorId:i,projectId:r(e,"project")||null},l=a==="request"?await p(e):a==="list"?t==="schedule"?{operation:a,...r(e,"cursor")?{cursor:r(e,"cursor")}:{},limit:Number(r(e,"limit")||50)}:{operation:a}:{operation:a,id:o};if((a==="request"||a==="list")&&o)throw new Error("This operation does not accept an additional resource id.");let u=AbortSignal.timeout(6e4),f=t==="schedule"?await new s(c).command(d.parse(l),u):await new w(c).command(h.parse(l),u);console.log(JSON.stringify(f,null,2))}m(b,"runEvaluationCoordinationCommand");export{b as runEvaluationCoordinationCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as s,b as l}from"./chunk-UJ5EFSEC.js";import"./chunk-NPOHW5OU.js";import"./chunk-N3DEA6PG.js";import"./chunk-PA7XP42P.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-YJ4PNAST.js";import"./chunk-AH22RHPS.js";import{c as e}from"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import{v as m,w as c}from"./chunk-2SPZYBDN.js";import"./chunk-QXVIIM4T.js";import"./chunk-R3XFY7VL.js";import"./chunk-GLUWATL5.js";import"./chunk-YL6VFJ4P.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a}from"./chunk-FTQLQJQV.js";async function f(t,i){let[r,o]=i,n=e(t,"actor");if(!n||!r||i.length>2)throw new Error("usage: improve <list|read|instructions|request> [id] --team <id> --actor <owner-id> [--input-file <path>] [--local --server-url <loopback-origin>]");let u=m.parse(r==="request"?await s(t):r==="list"?{operation:r,limit:Number(e(t,"limit")||30),...e(t,"cursor")?{cursor:e(t,"cursor")}:{}}:{operation:r,id:o});if(r==="request"&&o||r==="list"&&o)throw new Error("This operation does not accept a candidate id.");let d=new c({...await l(t),actorId:n});console.log(JSON.stringify(await d.command(u,AbortSignal.timeout(6e4)),null,2))}a(f,"runExperimentImprovementsCommand");export{f as runExperimentImprovementsCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as C,c as F}from"./chunk-GS2NKNKG.js";import{a as A,c as U}from"./chunk-NPOHW5OU.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-N3DEA6PG.js";import{c as _}from"./chunk-PA7XP42P.js";import{c as O,f as k}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-YJ4PNAST.js";import"./chunk-AH22RHPS.js";import{c as t}from"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import{d as S,e as R,f as x,s as N,t as y,x as H}from"./chunk-2SPZYBDN.js";import"./chunk-QXVIIM4T.js";import{d as v}from"./chunk-R3XFY7VL.js";import{b as P}from"./chunk-GLUWATL5.js";import"./chunk-YL6VFJ4P.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import{Na as q}from"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as m}from"./chunk-FTQLQJQV.js";import{readFile as I,stat as L}from"node:fs/promises";import{readFile as j,stat as B}from"node:fs/promises";async function J(e,f){let[r,i,h]=f,w=t(e,"team");if(e.revision!==void 0)throw new Error("A local Experiment is one immutable run; read it by id rather than a saved configuration revision.");if(r!=="read"&&e.contentHash!==void 0)throw new Error("An exact configuration hash requires the local read action.");if(!w||!r||f.length>(r==="compare"?3:2))throw new Error("Local Experiments require an action and --team; use --server-url for an existing local server.");let g=t(e,"serverUrl")||process.env.OPENPOND_LOCAL_API_URL||A,n=new URL(g);if(n.protocol!=="http:"||!["localhost","127.0.0.1"].includes(n.hostname)||n.username||n.password||n.search||n.hash||n.pathname!=="/")throw new Error("Local Experiments require an HTTP loopback server origin.");let o=await U(n.origin);async function a(l,d){let s=await o(new URL("/v1/local-experiments",n),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:w,action:l,payload:d})}),c=await s.json();if(!s.ok)throw new Error(typeof c.error=="string"?c.error:`Local Experiment request failed (${s.status}).`);return c}m(a,"command");async function p(){let l=t(e,"inputFile");if(!l||(await B(l)).size>67108864)throw new Error("Provide a bounded --input-file with exact local configuration and retained package bytes.");return JSON.parse(await j(l,"utf8"))}m(p,"input");let u;if(r==="prepare-harness"){if(i)throw new Error("Local Profile preparation accepts --input-file rather than an id.");u=await a("prepareHarness",await p())}else if(r==="run"){if(i)throw new Error("Local Run accepts reviewed configuration through --input-file rather than an id.");let l=await p();u=await a(l.package?"run":"runFromRelease",l)}else if(r==="list"){if(i)throw new Error("Local List does not accept an id.");let l=t(e,"status"),d=t(e,"limit"),s=t(e,"project"),c=t(e,"afterId"),E=t(e,"datasetHash"),b=t(e,"search");u=await a("list",{...l?{status:l}:{},...s?{projectId:s}:{},...E?{datasetHash:E}:{},...b?{search:b}:{},...c?{afterId:c}:{},...d?{limit:Number(d)}:{}})}else{if(!i)throw new Error(`${r} requires a local Experiment or scoring pass id.`);let l=t(e,"afterId"),d=t(e,"limit");if(r==="duplicate"){let s=t(e,"operationId");if(!s)throw new Error("Duplicate requires --operation-id for safe replay.");let c=C.parse(await a("read",{id:i})),E=x.parse({...c.configuration,operationId:s,request:{...c.configuration.request,operationId:s},sourceExperimentId:c.id});u=await a("runFromRelease",{configuration:E,expectedPackageHash:c.packageHash})}else if(r==="passes")u=await a("passes",{executionId:i,...l?{afterId:l}:{},...d?{limit:Number(d)}:{}});else if(r==="case"){let s=t(e,"receiptId"),c=t(e,"afterSequence");if(!s)throw new Error("Local case inspection requires --receipt-id from the retained execution.");u=await a("case",{id:i,receiptId:s,...c?{afterSequence:Number(c)}:{},...d?{limit:Number(d)}:{}})}else if(r==="score"){let s=await p();if(s.execution?.id!==i)throw new Error("Local scoring input belongs to a different retained execution.");u=await a("score",s)}else if(r==="compare"){if(!h)throw new Error("Local Compare requires baseline and candidate execution ids.");let s=F.parse(await a("compare",{baselineId:i,candidateId:h}));u={...s,comparison:q(s.baseline,s.candidate)}}else if(r==="read"){let s=t(e,"contentHash");u=await a("read",{id:i,...s?{configurationHash:s}:{}})}else if(["status","cancel","result","pass"].includes(r))u=await a(r,{id:i});else if(r==="cancel-pass")u=await a("cancel",{id:i});else if(r==="pass-result")u=await a("result",{id:i});else throw new Error(`Local Experiment action is unavailable: ${r}`)}console.log(JSON.stringify(u,null,2))}m(J,"runLocalExperimentsCommand");async function re(e,f){if(e.local===!0||e.local==="true")return J(e,f);if(e.revision!==void 0||e.contentHash!==void 0)throw new Error("Experiments retain their immutable configuration on the run; definition revisions are not selectable.");let[r,i]=f,h=t(e,"team");if(!h||!r||f.length>(r==="compare"?3:2))throw new Error("usage: experiments <prepare-harness|run|read|list|status|cancel|duplicate|score|passes|pass|cancel-pass|pass-result|result|compare|case> [id] [candidate-id] --team <id> [--input-file <path>] [--operation-id <id>]");let w=await v(),g={teamId:h,apiKey:await _(w,k(w)),baseUrl:O(e)??w.apiBaseUrl??P},n=new y(g),o;if(r==="prepare-harness"){let a=t(e,"inputFile");if(!a||i||(await L(a)).size>1048576)throw new Error("Harness preparation requires a bounded --input-file with its released target, model and ceiling.");o=await n.prepareHarness(R.parse(JSON.parse(await I(a,"utf8"))))}else if(r==="run"){let a=t(e,"inputFile");if(!a||i)throw new Error("Run requires --input-file with the reviewed configuration and stable operationId.");if((await L(a)).size>1048576)throw new Error("Experiment input exceeds one MiB.");o=await n.run(x.parse(JSON.parse(await I(a,"utf8"))))}else if(r==="list"){if(i)throw new Error("List does not accept an Experiment id.");let a=t(e,"limit");o=await n.list(S.parse({projectId:t(e,"project")||void 0,datasetHash:t(e,"datasetHash")||void 0,search:t(e,"search")||void 0,status:t(e,"status")||void 0,afterId:t(e,"afterId")||void 0,...a?{limit:Number(a)}:{}}))}else{if(!i)throw new Error(`${r} requires an id.`);if(r==="read")o=await n.get(i);else if(r==="status")o=await n.get(i);else if(r==="cancel")o=await n.cancel(i);else if(r==="duplicate"){let a=t(e,"operationId");if(!a)throw new Error("Duplicate requires a stable --operation-id for the new Experiment.");o=await n.duplicate(i,a)}else if(r==="score"){let a=t(e,"inputFile");if(!a||(await L(a)).size>1048576)throw new Error("Score requires --input-file containing an exact execution reference, grader releases and explicit ceiling, within one MiB.");let p=N.parse(JSON.parse(await I(a,"utf8")));if(p.execution.id!==i)throw new Error("Scoring input belongs to a different execution.");o=await n.score(p)}else if(r==="passes")o=await n.scoringPasses(i,{afterId:t(e,"afterId")||void 0});else if(r==="pass")o=await n.scoringPass(i);else if(r==="cancel-pass")o=await n.cancelScoringPass(i);else if(r==="pass-result")o=await n.scoringResult(i);else if(r==="result")o=await n.result(i);else if(r==="case"){let a=t(e,"receiptId");if(!a)throw new Error("Case inspection requires --receipt-id from the retained Experiment.");let p=await n.get(i);o=await new H(g).case(i,a,{manifestHash:p.manifest.contentHash,afterId:t(e,"afterId")||void 0})}else if(r==="compare"){if(!f[2])throw new Error("Compare requires a baseline and candidate execution id.");o=await n.compare(i,f[2])}else throw new Error(`Unknown Experiment action: ${r}`)}console.log(JSON.stringify(o,null,2))}m(re,"runExperimentsCommand");export{re as runExperimentsCommand};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import"./chunk-BX4J2VDU.js";import{a as se}from"./chunk-GS2NKNKG.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-YIB3J4RC.js";import"./chunk-JEVA7YQL.js";import"./chunk-22UARBPW.js";import{a as T,x as D}from"./chunk-N5QNXMIS.js";import"./chunk-JDLAHVAJ.js";import"./chunk-EAPFMACH.js";import"./chunk-6FA3GG5B.js";import{f as G}from"./chunk-3M53YXEI.js";import"./chunk-QXVIIM4T.js";import"./chunk-R3XFY7VL.js";import"./chunk-GLUWATL5.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import{f as N}from"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import{f as ne,h as z,p as B,r as oe}from"./chunk-H7IWJN7L.js";import{a as r}from"./chunk-FTQLQJQV.js";var u=class extends Error{static{r(this,"GithubExtensionError")}code;status;constructor(t,o){super(t),this.name="GithubExtensionError",this.code=o.code,this.status=o.status??400}};import{createHash as ce}from"node:crypto";import J from"node:path";var ie="HEAD",ae=64,de=512,le=20*1024*1024,K=5*1024*1024,me=8,Ue=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,pe=/^[A-Za-z0-9_.-]+$/,ue=new Set(["agents","assets","references","scripts"]);function Se(e={}){let t=e.fetch??fetch,o=e.githubToken?.trim()||process.env.GITHUB_TOKEN?.trim()||process.env.GH_TOKEN?.trim()||null;return{async resolve(n){let s=await qe(n,t,o);return{preview:await Te(s,t,o),files:ge(s)}},async download(n,s){await _e({resolution:n,fetchImpl:t,githubToken:o,writeFile:s})}}}r(Se,"createGithubSourceClient");function I(e){let t=e.trim(),o="",n="";if(/^(?:https?:\/\/)?github\.com\//i.test(t)){let d=new URL(t.startsWith("http")?t:`https://${t}`);if(d.hostname.toLowerCase()!=="github.com")throw j(e);let a=d.pathname.replace(/^\/+|\/+$/g,"").split("/");if(a.length!==2)throw j(e);[o="",n=""]=a}else{let a=t.replace(/^github:/i,"").replace(/^\/+|\/+$/g,"").split("/");if(a.length!==2)throw j(e);[o="",n=""]=a}if(n=n.replace(/\.git$/i,""),!pe.test(o)||!pe.test(n))throw j(e);let s=o.toLowerCase(),i=n.toLowerCase();return{id:`github:${s}/${i}`,owner:s,repo:i,repositoryUrl:`https://github.com/${s}/${i}`}}r(I,"parseGithubExtensionSource");async function qe(e,t,o){let n=I(e.source),s=e.ref?.trim()||ie,i=await H(t,o,`/repos/${n.owner}/${n.repo}`),d=s===ie?i.default_branch?.trim()||"main":s,a=await H(t,o,`/repos/${n.owner}/${n.repo}/commits/${encodeURIComponent(d)}`),b=a.sha?.trim(),f=a.commit?.tree?.sha?.trim();if(!b||!f)throw new u("GitHub returned an incomplete commit response.",{code:"github_invalid_commit",status:502});let y=await H(t,o,`/repos/${n.owner}/${n.repo}/git/trees/${f}?recursive=1`);if(y.truncated)throw new u("The GitHub repository tree is too large to install safely.",{code:"github_tree_truncated"});let w=(y.tree??[]).filter(ze),x=Le(w);if(x.length===0)throw new u("No skills found. Add SKILL.md at the repository root or use a standard agent skills directory.",{code:"extension_no_skills"});if(x.length>ae)throw new u(`Extension contains more than ${ae} skills.`,{code:"extension_too_many_skills"});Ge(x);let A=w.find(m=>m.type==="blob"&&/^readme(?:\.[^/]+)?$/i.test(m.path))??null;return{identity:n,requestedRef:s,resolvedCommit:b,tree:w,skillPackages:x,readme:A}}r(qe,"resolveSource");async function Te(e,t,o){let n=await xe(e.skillPackages,me,async a=>{let b=await Fe(e,a.entry,t,o);return je(a,b)}),s=De(n.map(a=>a.name));for(let a of n)s.has(a.name)&&(a.validationStatus="error",a.validationMessages=[...a.validationMessages,`Duplicate skill name: ${a.name}`]);let i=n.flatMap(a=>a.validationMessages.map(b=>`${a.relativePath}: ${b}`)),d=ge(e);return{...e.identity,source:"github",requestedRef:e.requestedRef,resolvedCommit:e.resolvedCommit,sourcePath:null,readmePath:e.readme?.path??null,packageHash:Ne(d),skills:n.sort((a,b)=>a.name.localeCompare(b.name)),validationStatus:i.length===0?"valid":"error",validationMessages:i}}r(Te,"buildPreview");function je(e,t){let o=T(t),n=e.root==="."?null:J.posix.basename(e.root),s=o.name??n??"invalid-skill",i=[...o.messages];Ue.test(s)||i.push("Skill name must be lowercase kebab-case."),n&&s!==n&&i.push(`Skill name must match its directory name (${n}).`);let d=e.files.filter(a=>a.path!==e.entry.path).map(a=>Be(e.root,a.path)).sort();return{name:s,description:o.description??"",relativePath:e.root==="."?"SKILL.md":`${e.root}/SKILL.md`,sourcePath:"",charCount:t.length,sourceHash:ce("sha256").update(t).digest("hex"),resourceFiles:d,validationStatus:i.length===0?"valid":"error",validationMessages:[...new Set(i)]}}r(je,"previewSkill");function Le(e){let t=[],o=e.find(a=>a.type==="blob"&&a.path==="SKILL.md");o&&t.push({root:".",entry:o});let n=e.filter(a=>a.type==="blob"&&a.path.endsWith("/SKILL.md")),s=n.filter(a=>Me(a.path)),i=s.length>0?s:n,d=new Set(i.map(a=>J.posix.dirname(a.path)));for(let a of i){let b=J.posix.dirname(a.path);[...d].some(f=>f!==b&&b.startsWith(`${f}/`))||t.push({root:b,entry:a})}return t.map(({root:a,entry:b})=>{let f=e.filter(x=>{if(x.type!=="blob")return!1;if(a!==".")return x.path.startsWith(`${a}/`);if(x.path==="SKILL.md")return!0;let A=x.path.split("/",1)[0]??"";return ue.has(A)}),y=e.find(x=>x.type!=="blob"&&x.type!=="tree"&&(a==="."?x.path==="SKILL.md"||ue.has(x.path.split("/",1)[0]??""):x.path.startsWith(`${a}/`))),w=f.find(x=>x.mode==="120000");if(y||w)throw new u(`Skill package ${a} contains a symlink or submodule.`,{code:"extension_unsafe_entry"});return{root:a,entry:b,files:f}})}r(Le,"discoverSkillPackages");function Me(e){let t=e.split("/");if(t.at(-1)!=="SKILL.md")return!1;let o=t.slice(0,-1);if(o.length<2)return!1;let n=o.lastIndexOf("skills");if(n<0||n>2)return!1;let s=o.slice(0,n),i=o.slice(n+1);if(i.length<1||i.length>2)return!1;if(n===0)return!0;let d=s[0]??"";return d.startsWith(".")||d==="agent"||d==="data"}r(Me,"isStandardAgentSkillsPath");function ge(e){let t=new Map;e.readme&&t.set(e.readme.path,e.readme);for(let o of e.skillPackages)for(let n of o.files)t.set(n.path,n);return[...t.values()].sort((o,n)=>o.path.localeCompare(n.path))}r(ge,"filesToDownload");async function _e(e){let t=0;await xe(e.resolution.files,me,async o=>{let n=await be({owner:e.resolution.preview.owner,repo:e.resolution.preview.repo,commit:e.resolution.preview.resolvedCommit,file:o,fetchImpl:e.fetchImpl,githubToken:e.githubToken});if(t+=n.byteLength,t>le)throw new u("Extension download exceeds the maximum allowed size.",{code:"extension_too_large"});await e.writeFile(o.path,n,o.mode==="100755")})}r(_e,"downloadFiles");async function Fe(e,t,o,n){let s=await be({owner:e.identity.owner,repo:e.identity.repo,commit:e.resolvedCommit,file:t,fetchImpl:o,githubToken:n});return new TextDecoder("utf-8",{fatal:!0}).decode(s)}r(Fe,"downloadText");async function be(e){let t=e.file.path.split("/").map(encodeURIComponent).join("/"),o=`https://raw.githubusercontent.com/${e.owner}/${e.repo}/${e.commit}/${t}`,n=await e.fetchImpl(o,{headers:he(e.githubToken,"application/vnd.github.raw"),redirect:"follow"});if(!n.ok)throw new u(`GitHub file download failed (${n.status}): ${e.file.path}`,{code:"github_download_failed",status:n.status});let s=Number(n.headers.get("content-length"));if(Number.isFinite(s)&&s>K)throw new u(`Extension file is too large: ${e.file.path}`,{code:"extension_file_too_large"});let i=new Uint8Array(await n.arrayBuffer());if(i.byteLength>K)throw new u(`Extension file is too large: ${e.file.path}`,{code:"extension_file_too_large"});return i}r(be,"downloadBytes");async function H(e,t,o){let n=await e(`https://api.github.com${o}`,{headers:he(t,"application/vnd.github+json")});if(!n.ok){let s=await n.json().catch(()=>null),i=typeof s?.message=="string"?`: ${s.message}`:"";throw new u(`GitHub request failed (${n.status})${i}`,{code:n.status===404?"github_repository_not_found":"github_request_failed",status:n.status})}return await n.json()}r(H,"githubJson");function he(e,t){let o=new Headers({Accept:t,"User-Agent":"openpond-extension-installer","X-GitHub-Api-Version":"2022-11-28"});return e&&o.set("Authorization",`Bearer ${e}`),o}r(he,"githubHeaders");function Ge(e){let t=new Map;for(let n of e)for(let s of n.files)t.set(s.path,s);if(t.size>de)throw new u(`Extension contains more than ${de} skill files.`,{code:"extension_too_many_files"});let o=0;for(let n of t.values()){if((n.size??0)>K)throw new u(`Extension file is too large: ${n.path}`,{code:"extension_file_too_large"});o+=n.size??0}if(o>le)throw new u("Extension exceeds the maximum allowed size.",{code:"extension_too_large"})}r(Ge,"validateDownloadLimits");function ze(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.path=="string"&&!t.path.startsWith("/")&&!t.path.split("/").includes("..")&&typeof t.mode=="string"&&(t.type==="blob"||t.type==="tree"||t.type==="commit")&&typeof t.sha=="string"}r(ze,"validTreeEntry");function Ne(e){let t=ce("sha256");for(let o of e)t.update(`${o.path}\0${o.sha}\0${o.size??""}
|
|
3
|
-
`);return t.digest("hex")}r(Ne,"hashTree");function Be(e,t){return e==="."?t:t.slice(e.length+1)}r(Be,"relativeSkillPath");function De(e){let t=new Set,o=new Set;for(let n of e)t.has(n)&&o.add(n),t.add(n);return o}r(De,"duplicateValues");async function xe(e,t,o){let n=new Array(e.length),s=0;async function i(){for(;s<e.length;){let d=s;s+=1,n[d]=await o(e[d])}}return r(i,"worker"),await Promise.all(Array.from({length:Math.min(t,e.length)},i)),n}r(xe,"mapConcurrent");function j(e){return new u(`Invalid GitHub extension source: ${e}. Use owner/repo or https://github.com/owner/repo.`,{code:"github_invalid_source"})}r(j,"invalidSource");import{createHash as He,randomUUID as we}from"node:crypto";import{existsSync as v}from"node:fs";import{mkdir as W,readFile as Je,rename as k,rm as E,stat as Ke,writeFile as Re}from"node:fs/promises";import g from"node:path";var M=1,We=15e3;function Oe(e={}){let t=g.resolve(e.home??e.rootPath??ne()),o=g.resolve(e.rootPath??g.join(t,"library","extensions")),n=z(t).database,s=Se({fetch:e.fetch,githubToken:e.githubToken}),i=e.now??(()=>new Date);async function d(){try{let m=await O(t),p=await Promise.all(m.extensions.map(S=>V(o,S)));return Ze(p,await C(e.reservedSkillNames)),{rootPath:o,registryPath:n,extensions:p.sort(Q),error:null}}catch(m){return{rootPath:o,registryPath:n,extensions:[],error:m instanceof Error?m.message:String(m)}}}r(d,"list");async function a(m){let p=await s.resolve(m),S=await O(t),c=S.extensions.find(l=>l.id===p.preview.id)??null;return U(p.preview,S.extensions.filter(l=>l.id!==c?.id),await C(e.reservedSkillNames)),p.preview}r(a,"preview");async function b(m){let p=I(m.source);return Y(o,p.id,async()=>{let S=await O(t);if(S.extensions.some(h=>h.id===p.id))throw new u(`${p.owner}/${p.repo} is already installed.`,{code:"extension_already_installed",status:409});let c=await s.resolve(m);Ie(c.preview),U(c.preview,S.extensions,await C(e.reservedSkillNames));let l=i().toISOString(),R=await fe({rootPath:o,resolution:c,installedAt:l,updatedAt:l,github:s});try{let h=await C(e.reservedSkillNames);return await X(t,i,P=>({...P,extensions:Xe(P,R,h)})),await Pe(o,R.id),R}catch(h){throw await ye(o,R.id),h}})}r(b,"add");async function f(m){let p=I(m.source);return Y(o,p.id,async()=>{let S=await O(t),c=L(S,p.id),l=await s.resolve({source:c.repositoryUrl,ref:m.ref?.trim()||c.requestedRef});if(Ie(l.preview),U(l.preview,S.extensions.filter(h=>h.id!==c.id),await C(e.reservedSkillNames)),c.resolvedCommit===l.preview.resolvedCommit&&c.packageHash===l.preview.packageHash&&c.requestedRef===l.preview.requestedRef)return V(o,c);let R=await fe({rootPath:o,resolution:l,installedAt:c.installedAt,updatedAt:i().toISOString(),github:s});try{let h=await C(e.reservedSkillNames);return await X(t,i,P=>({...P,extensions:Ye(P,R,h)})),await Pe(o,R.id),R}catch(h){throw await ye(o,R.id),h}})}r(f,"update");async function y(){let m=await d();if(m.error)throw new u(m.error,{code:"extension_registry_error"});let p={updated:[],unchanged:[],failed:[]};for(let S of m.extensions)try{let c=await f({source:S.repositoryUrl,ref:S.requestedRef});c.resolvedCommit===S.resolvedCommit&&c.packageHash===S.packageHash?p.unchanged.push(c):p.updated.push(c)}catch(c){p.failed.push({id:S.id,error:c instanceof Error?c.message:String(c)})}return p}r(y,"updateAll");async function w(m){let p=I(m),S=await O(t);return V(o,L(S,p.id))}r(w,"inspect");async function x(m){let p=I(m);return Y(o,p.id,async()=>{let S=await O(t),c=L(S,p.id),l=q(o,p.owner,p.repo),R=`${l}.${we()}.remove`;v(l)&&await k(l,R);try{return await X(t,i,h=>({...h,extensions:h.extensions.filter(P=>P.id!==c.id)})),await E(R,{recursive:!0,force:!0}),c}catch(h){throw v(R)&&!v(l)&&await k(R,l),h}})}r(x,"remove");async function A(m){let p=m.trim();if(!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(p))throw new u("Extension skill name must be lowercase kebab-case.",{code:"extension_skill_invalid_name"});let S=await d();if(S.error)throw new u(S.error,{code:"extension_registry_error"});let c=S.extensions.flatMap(te=>te.skills.filter(F=>F.name===p).map(F=>({extension:te,skill:F})));if(c.length===0)throw new u(`Extension skill not found: ${p}`,{code:"extension_skill_not_found",status:404});if(c.length>1)throw new u(`Extension skill name is ambiguous: ${p}`,{code:"extension_skill_conflict",status:409});let l=c[0];if(l.extension.validationStatus!=="valid"||l.skill.validationStatus!=="valid")throw new u(`Extension skill ${p} is not valid.`,{code:"extension_skill_invalid"});let R=$e(l.extension.sourcePath,l.skill.relativePath),h=await Je(R,"utf8"),P=He("sha256").update(h).digest("hex");if(P!==l.skill.sourceHash)throw new u(`Extension skill ${p} changed on disk. Update or reinstall its extension before using it.`,{code:"extension_skill_modified"});let $=T(h);if($.messages.length>0||$.name!==p||!$.description)throw new u(`Extension skill ${p} is not valid. ${$.messages.join(" ")}`.trim(),{code:"extension_skill_invalid"});return{name:p,description:$.description,body:$.body,path:l.skill.relativePath,sourcePath:l.extension.sourcePath,sourceHash:P,charCount:h.length,packagePath:g.dirname(R),resourceFiles:l.skill.resourceFiles}}return r(A,"readSkill"),{rootPath:o,registryPath:n,list:d,preview:a,add:b,update:f,updateAll:y,inspect:w,remove:x,readSkill:A}}r(Oe,"createGithubExtensionManager");async function fe(e){let t=e.resolution.preview,o=q(e.rootPath,t.owner,t.repo),n=`${o}.${we()}.install`,s=Z(e.rootPath,t.id),i=g.join(n,"current");await E(n,{recursive:!0,force:!0}),await E(s,{recursive:!0,force:!0}),await W(i,{recursive:!0,mode:448});try{await e.github.download(e.resolution,async(a,b,f)=>{let y=$e(i,a);await W(g.dirname(y),{recursive:!0,mode:448}),await Re(y,b,{mode:f?448:384})});let d=Ve(t,o,e.installedAt,e.updatedAt);return await Re(g.join(n,"extension.json"),`${JSON.stringify(d,null,2)}
|
|
4
|
-
`,{mode:384}),await W(g.dirname(o),{recursive:!0,mode:448}),v(o)&&await k(o,s),await k(n,o),d}catch(d){throw await E(n,{recursive:!0,force:!0}),v(s)&&!v(o)&&await k(s,o),d}}r(fe,"materializeExtension");function Ve(e,t,o,n){let s=g.join(t,"current");return{...e,sourcePath:s,readmePath:e.readmePath?g.join(s,e.readmePath):null,installedAt:o,updatedAt:n,skills:e.skills.map(i=>({...i,sourcePath:g.join(s,i.relativePath)}))}}r(Ve,"installedExtension");async function Pe(e,t){await E(Z(e,t),{recursive:!0,force:!0})}r(Pe,"finalizeMaterialization");async function ye(e,t){let o=I(t.replace(/^github:/,"")),n=q(e,o.owner,o.repo),s=Z(e,t);await E(n,{recursive:!0,force:!0}),v(s)&&await k(s,n)}r(ye,"rollbackMaterialization");async function V(e,t){let o=q(e,t.owner,t.repo),n=g.join(o,"current"),s=(await Ke(g.join(o,"extension.json")).catch(()=>null))?.isFile()??!1,i=t.validationMessages.filter(d=>d!=="Installed files are missing.");return s||i.push("Installed files are missing."),{...t,sourcePath:n,readmePath:t.readmePath?g.join(n,g.basename(t.readmePath)):null,skills:t.skills.map(d=>({...d,sourcePath:g.join(n,d.relativePath)})),validationStatus:i.length===0?"valid":"error",validationMessages:i}}r(V,"hydrateExtension");function Ie(e){if(e.validationStatus!=="valid")throw new u(`Extension contains invalid skills: ${e.validationMessages.join(" ")}`,{code:"extension_invalid"})}r(Ie,"assertInstallable");function U(e,t,o){let n=new Map;for(let i of o)n.set(i,"a shipped OpenPond skill");for(let i of t)for(let d of i.skills)n.set(d.name,i.id);let s=e.skills.map(i=>({name:i.name,owner:n.get(i.name)})).filter(i=>!!i.owner);if(s.length!==0)throw new u(`Skill name conflict: ${s.map(i=>`${i.name} (${i.owner})`).join(", ")}.`,{code:"extension_skill_conflict",status:409})}r(U,"assertSkillNamesAvailable");function Xe(e,t,o){if(e.extensions.some(n=>n.id===t.id))throw new u(`${t.owner}/${t.repo} is already installed.`,{code:"extension_already_installed",status:409});return U(t,e.extensions,o),[...e.extensions,t].sort(Q)}r(Xe,"appendInstalledExtension");function Ye(e,t,o){return L(e,t.id),U(t,e.extensions.filter(n=>n.id!==t.id),o),e.extensions.map(n=>n.id===t.id?t:n).sort(Q)}r(Ye,"replaceInstalledExtension");function Ze(e,t){let o=new Map;for(let n of t)o.set(n,"built-in");for(let n of e)for(let s of n.skills){let i=o.get(s.name);if(!i){o.set(s.name,n.id);continue}let d=`Skill name conflicts with ${i}: ${s.name}`;s.validationStatus="error",s.validationMessages=[...new Set([...s.validationMessages,d])],n.validationStatus="error",n.validationMessages=[...new Set([...n.validationMessages,d])]}}r(Ze,"markInstalledSkillConflicts");async function C(e){let t=typeof e=="function"?await e():e??[];return[...new Set(t.map(o=>o.trim()).filter(Boolean))]}r(C,"reservedSkillNames");function L(e,t){let o=e.extensions.find(n=>n.id===t);if(o)return o;throw new u(`${t.replace(/^github:/,"")} is not installed.`,{code:"extension_not_installed",status:404})}r(L,"requireInstalled");async function O(e){let t=B(e,"extension_installations","registry")?.value;if(!t)return et();if(t.schemaVersion!==M||!Array.isArray(t.extensions)||!t.extensions.every(ve))throw new Error("Extension registry has an unsupported format.");return Qe(t)}r(O,"readRegistry");async function X(e,t,o){await N(g.join(z(e).runtime,"extension-registry"),async()=>{let n=B(e,"extension_installations","registry"),s=o(await O(e));oe(e,"extension_installations","registry",{...s,schemaVersion:M,updatedAt:t().toISOString()},n?.revision??null)})}r(X,"writeRegistry");function Qe(e){return{schemaVersion:M,updatedAt:typeof e?.updatedAt=="string"?e.updatedAt:null,extensions:Array.isArray(e?.extensions)?e.extensions.filter(ve):[]}}r(Qe,"normalizeRegistry");function et(){return{schemaVersion:M,updatedAt:null,extensions:[]}}r(et,"emptyRegistry");function ve(e){if(!e||typeof e!="object")return!1;let t=e;return t.source==="github"&&typeof t.id=="string"&&typeof t.owner=="string"&&typeof t.repo=="string"&&typeof t.repositoryUrl=="string"&&typeof t.requestedRef=="string"&&typeof t.resolvedCommit=="string"&&Array.isArray(t.skills)}r(ve,"isStoredExtension");function $e(e,t){if(g.isAbsolute(t)||t.split(/[\\/]/).includes(".."))throw new u(`Unsafe extension path: ${t}`,{code:"extension_unsafe_path"});let o=g.resolve(e,...t.split("/")),n=`${g.resolve(e)}${g.sep}`;if(!o.startsWith(n))throw new u(`Unsafe extension path: ${t}`,{code:"extension_unsafe_path"});return o}r($e,"safeDestination");function q(e,t,o){return g.join(e,"github",t,o)}r(q,"extensionDirectory");function Z(e,t){let o=I(t.replace(/^github:/,""));return`${q(e,o.owner,o.repo)}.previous`}r(Z,"backupDirectory");async function Y(e,t,o){let n=t.replace(/[^a-z0-9.-]+/gi,"-");return N(g.join(e,".locks",n),o,We)}r(Y,"withExtensionLock");function Q(e,t){return e.id.localeCompare(t.id)}r(Q,"extensionSort");async function Ln(e,t,o=Oe({reservedSkillNames:r(async()=>{let n=await D();return[...se,...n.skills.map(s=>s.name)]},"reservedSkillNames")})){let n=t[0]?.toLowerCase()||"list",s=G(e.json);if(n==="list"){let i=await o.list();if(i.error)throw new Error(i.error);tt(i.extensions,s);return}if(n==="add"||n==="preview"){let d={source:_(t[1],n),ref:Ce(e.ref)},a=n==="preview"?await o.preview(d):await o.add(d);ee(a,s,n==="preview"?"Preview":"Installed");return}if(n==="inspect"){ee(await o.inspect(_(t[1],n)),s,"Installed");return}if(n==="update"){if(G(e.all)){let a=await o.updateAll();if(s)console.log(JSON.stringify(a,null,2));else{console.log(`Updated ${a.updated.length}; unchanged ${a.unchanged.length}; failed ${a.failed.length}.`);for(let b of a.failed)console.log(`- ${b.id}: ${b.error}`)}a.failed.length>0&&(process.exitCode=1);return}let i=_(t[1],n),d=await o.update({source:i,ref:Ce(e.ref)});ee(d,s,"Updated");return}if(n==="remove"){let i=await o.remove(_(t[1],n));console.log(s?JSON.stringify({removed:i},null,2):`Removed ${i.owner}/${i.repo} and ${i.skills.length} skill(s).`);return}throw new Error("usage: openpond extension <add|preview|list|inspect|update|remove> [owner/repo] [--ref <ref>] [--all] [--json]")}r(Ln,"runOpenPondExtensionCommand");function ee(e,t,o){if(t){console.log(JSON.stringify(e,null,2));return}console.log(`${o} ${e.owner}/${e.repo}@${e.resolvedCommit.slice(0,12)} (${e.requestedRef}).`);for(let n of e.skills){let s=n.resourceFiles.length>0?`, ${n.resourceFiles.length} resource(s)`:"";console.log(`- ${n.name}${s}: ${n.description}`)}}r(ee,"printExtension");function tt(e,t){if(t){console.log(JSON.stringify({extensions:e},null,2));return}if(e.length===0){console.log("No third-party extensions installed.");return}console.log(`Third-party extensions (${e.length}):`);for(let o of e)console.log(`- ${o.owner}/${o.repo}@${o.resolvedCommit.slice(0,12)} \xB7 ${o.skills.length} skill(s) \xB7 ${o.validationStatus}`)}r(tt,"printExtensionList");function _(e,t){let o=e?.trim();if(o)return o;throw new Error(`usage: openpond extension ${t} <owner/repo>`)}r(_,"requiredSource");function Ce(e){return typeof e=="string"&&e.trim()?e.trim():void 0}r(Ce,"optionText");export{Ln as runOpenPondExtensionCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as Ie,b as ye,c as Re,d as He,e as Ee,f as Pe,h as B,i as Ae,j as je}from"./chunk-YD55Z5H3.js";import{e as Ce,f as U}from"./chunk-H2VT22JK.js";import{V as be,Va as Se,W as ke,hb as xe,jb as Te,n as we,nb as G,o as ve,ob as De,pb as ze}from"./chunk-NHFGEVVH.js";import"./chunk-EMKZVP7Z.js";import"./chunk-FPUUZQUP.js";import{k as ge}from"./chunk-6VF3Q6QJ.js";import{a as z}from"./chunk-T5LE6R5S.js";import"./chunk-USKE34VR.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{h as me,ma as fe,qa as D,ra as he}from"./chunk-4TZHH5FC.js";import"./chunk-4SHKI3BH.js";import"./chunk-USMZT5FZ.js";import"./chunk-5CMKGD43.js";import{M as W}from"./chunk-HA7EFTPF.js";import"./chunk-L3KS6MOV.js";import"./chunk-7QEE4PBI.js";import{Da as de,Ea as ce,M as C,N as $,a as se,lc as pe}from"./chunk-2JO2KWT3.js";import{aa as le,ga as V,ia as ue}from"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import{Ca as ie,za as ae}from"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z3D4C7BG.js";import{B as re,C as oe,E as ne}from"./chunk-WV2APYWG.js";import{Ma as M}from"./chunk-PJM2G7SG.js";import{L as Y,P as ee,sa as te}from"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import{l as J,m as R,r as X}from"./chunk-NNF6KCHD.js";import{b as e}from"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as i}from"./chunk-FTQLQJQV.js";import{promises as $e}from"node:fs";import Ue from"node:path";import Le from"node:http";var Q=e.object({socketPath:e.string().min(1).max(1e3),capability:e.string().regex(/^[a-f0-9]{64}$/),jobId:e.string().min(1),pinHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),Ne=e.object({jobId:e.string().min(1),pinHash:e.string().regex(/^[a-f0-9]{64}$/),requestId:e.string().min(1).max(500),model:X,reasoningEffort:e.enum(["off","low","medium","high","xhigh","max","none"]).nullable(),messages:e.array(e.unknown()).min(1).max(1e3),tools:e.array(e.unknown()).max(100),toolChoice:e.unknown(),maxOutputTokens:e.number().int().positive().max(131072),temperature:e.number().finite().optional(),topP:e.number().finite().optional(),seed:e.number().int().optional()}).strict(),Je=e.discriminatedUnion("kind",[e.object({kind:e.literal("chat_completions_reasoning"),reasoningContent:e.string()}).strict(),e.object({kind:e.literal("responses_reasoning_items"),items:e.array(e.record(e.string(),e.unknown()))}).strict()]),Ve=e.object({id:e.string().optional(),type:e.string(),function:e.object({name:e.string().optional(),arguments:e.string().optional()}).passthrough().optional()}).passthrough(),Ge=e.object({text:e.string().optional(),usage:e.unknown().optional(),costUsd:e.number().finite().nonnegative().optional(),continuation:Je.optional(),toolCalls:e.array(Ve).optional()}).strict();function qe(s,r){let t=Q.parse(s);async function n(u,v,I=r){I.throwIfAborted();let x=Buffer.from(JSON.stringify({action:u,jobId:t.jobId,pinHash:t.pinHash,value:v}));if(x.length>8*1024*1024)throw new Error("Hosted advanced request exceeds its private byte limit.");return new Promise((y,h)=>{let l=Le.request({socketPath:t.socketPath,path:"/",method:"POST",headers:{authorization:`Bearer ${t.capability}`,"content-type":"application/json","content-length":x.length},signal:I},H=>{let E=[],P=0;H.on("data",w=>{if(P+=w.length,P>8388608){H.destroy(new Error("Hosted advanced response exceeds its private byte limit."));return}E.push(w)}),H.on("error",h),H.on("end",()=>{try{let w=JSON.parse(Buffer.concat(E).toString("utf8"));if(H.statusCode!==200)throw new Error(typeof w?.error=="string"?w.error:"The actual hosted advanced owner refused this operation.");y(w)}catch(w){h(w)}})});l.on("error",h),l.end(x)})}i(n,"call");let d=i(async function*(u){let v=Ne.parse({jobId:t.jobId,pinHash:t.pinHash,requestId:u.requestId,model:u.model,reasoningEffort:u.reasoningEffort,messages:u.messages,tools:u.tools,toolChoice:u.toolChoice,maxOutputTokens:u.maxOutputTokens??4096,...u.temperature===void 0?{}:{temperature:u.temperature},...u.topP===void 0?{}:{topP:u.topP},...u.seed===void 0?{}:{seed:u.seed}}),I=e.object({deltas:e.array(Ge).max(1e5)}).strict().parse(await n("model",v,AbortSignal.any([r,u.signal])));for(let x of I.deltas)yield x},"stream");return{stream:d,text:i(async u=>{let v="";for await(let I of d({...u,reasoningEffort:u.reasoningEffort??null,tools:[],toolChoice:"none"}))I.text&&(v+=I.text),I.usage!==void 0&&u.onUsage?.(I.usage,I.costUsd);return v},"text"),authorize:i(async()=>{await n("authorize",{})},"authorize"),ceiling:i(async(u,v,I)=>e.object({configurationHash:e.string().regex(/^[a-f0-9]{64}$/),maximumChargeUsd:e.number().finite().positive()}).strict().parse(await n("ceiling",{modelId:u,pricing:v,maximumOutputTokens:I})),"ceiling"),compute:i((u,v=!1)=>n("compute",u,v?AbortSignal.timeout(6e4):r),"compute"),checkpoint:i(u=>n("checkpoint",u),"checkpoint")}}i(qe,"createHostedAdvancedModelBridge");import Qe from"node:path";var Me=e.string().regex(/^[a-f0-9]{64}$/),Ke=e.object({taskId:e.string().min(1),caseHash:Me,session:C,turn:$,events:e.array(se).max(1e4),traceHash:Me,output:e.string().nullable()}).strict(),K=e.object({packageValue:ae,contexts:e.array(Ke).max(1e4)}).strict();async function _e(s){let r=V(s.pin),t=K.parse(s.privateSource),n=ie(t.packageValue),d=M(e.object({manifest:e.unknown(),result:e.unknown()}).parse(s.evidence));async function m(){if(await s.authorize(),r.actorId!==s.actor.actorId||r.teamId!==s.actor.teamId||r.profileRef.source!=="openpond_git"||r.profileRef.repositoryId!==s.source.repositoryId||r.profileRef.profileId!==s.source.profileId||r.sourceRevision!==s.source.sourceRevision)throw new Error("The actual hosted advanced source owner changed.")}if(i(m,"authorize"),await m(),d.manifest.teamId!==r.teamId||d.result.status!=="completed"||d.manifest.id!==r.evidence.id||d.result.contentHash!==r.evidence.contentHash||R(d.manifest.dataset)!==R(r.externalDatasetBinding.dataset))throw new Error("The exact completed hosted advanced evidence changed.");if(n.contentHash!==r.externalDatasetBinding.packageHash||n.contentHash!==r.adaptationDatasetBinding.packageHash||n.environment.contentHash!==r.environmentPolicy.environmentHash||n.environment.contract.networkPolicy!=="none")throw new Error("The hosted advanced environment/package is not the exact reviewed closed-network release.");if(n.taskset.tools.some(l=>l.name==="web_search"||l.name==="web_fetch"))throw new Error("Live external tools require their own qualified frozen-observation and budget owner.");if(n.verifierSet.graders.some(l=>l.kind==="human"||l.kind==="model_judge"&&l.calibrationStatus!=="passed"))throw new Error("Advanced hosted evaluation needs executable, qualified independent graders.");let u=r.adaptationTaskIds.map(l=>n.taskset.tasks.find(H=>H.id===l)),v=r.holdoutTaskIds.map(l=>n.taskset.tasks.find(H=>H.id===l)),I=new Set(u.map(l=>l?.clusterKey));if(u.some(l=>!l||l.split!==r.adaptationSplit)||v.some(l=>!l||l.split!==r.holdoutSplit||I.has(l.clusterKey)))throw new Error("Hosted adaptation/holdout membership or independent families changed.");let x=await s.store.getHarnessReleaseRecord(r.baselineRelease.contentHash);if(!x||x.harnessRelease.id!==r.baselineRelease.id||s.workspace.currentChannel.release?.contentHash!==r.baselineRelease.contentHash)throw new Error("The exact hosted source baseline is unavailable.");let y=await D({workspaceId:typeof x.agentSnapshot.metadata.workspaceId=="string"?x.agentSnapshot.metadata.workspaceId:x.workspaceId,sourceDir:Qe.join(x.bundlePath,"source")});if(z(y).protectedClosureHash!==r.privateClosureHash)throw new Error("The protected hosted Profile closure changed.");let h={packageValue:n,authorize:m};return{read:i(async l=>{if(V(l).contentHash!==r.contentHash)throw new Error("The actual hosted advanced admission changed.");return await m(),h},"read"),evidence:i(async()=>(await m(),d),"evidence"),authorize:i(async()=>m(),"authorize"),reviewContext:i(async(l,H)=>{await m();let E=t.contexts.filter(p=>p.taskId===H),P=d.result.cases.find(p=>p.identity.caseId===H);if(E.length!==1||!P||P.status!=="completed")throw new Error("The actual retained hosted review case is unavailable.");let w=E[0];if(w.caseHash!==R(P)||w.session.cloudTeamId!==r.teamId||w.turn.sessionId!==w.session.id||w.turn.status==="in_progress"||w.events.some(p=>p.sessionId!==w.session.id||p.turnId!==w.turn.id))throw new Error("The actual hosted review session/turn/trace binding changed.");return await m(),{...w,case:{output:w.output}}},"reviewContext")}}i(_e,"createHostedAdvancedRefinerSource");import{randomUUID as Ze}from"node:crypto";function Oe(s){async function r(n){let d=await s.store.getSession(n);if(!d||d.cloudTeamId!==s.teamId||d.metadata?.hostedAdvancedTurnId!==s.hostedTurnId||d.metadata?.parentModelRunId!==s.modelRunId)throw new Error("The actual hosted advanced case owner changed.");return d}i(r,"read");async function t(n,d,m){let u=await r(n),v=e.object({action:e.string()}).passthrough().parse(d).action;return ce.parse(await s.bridge.compute({session:u,payload:d,turnId:m??null},v==="sandbox_stop"||v==="sandbox_receipts"))}return i(t,"tool"),{createSession:i(async n=>{await s.bridge.authorize();let d=C.partial().parse(n),m=new Date().toISOString();if(d.metadata?.parentModelRunId!==s.modelRunId)throw new Error("The foreground case belongs to another actual advanced Run.");let u=C.parse({...d,id:`hosted-advanced-case-${Ze()}`,provider:"openpond",currentProfile:s.profileRef,cloudTeamId:s.teamId,cwd:null,codexThreadId:null,appId:null,appName:null,createdAt:m,updatedAt:m,status:"active",pinned:!1,archived:!1,order:0,hiddenFromDefaultSidebar:!0,title:d.title??"Advanced hosted evaluation case",metadata:{...d.metadata,source:"hosted-advanced-evaluation",hostedAdvancedTurnId:s.hostedTurnId,actorId:s.actorId,workspaceTarget:"hosted",benchmarkRuntime:"hosted_managed_work"}});return await s.store.insertSessionAtFront(u),await s.bridge.authorize(),u},"createSession"),getSession:r,runtimeEventsForSession:i(n=>s.store.runtimeEventsForSession(n),"runtimeEventsForSession"),executeWorkspaceTool:i((n,d,m)=>t(n,d,m?.turnId),"executeWorkspaceTool"),settleCostEvidence:i((n,d)=>t(n,{action:"sandbox_receipts",args:{}},d?.turnId),"settleCostEvidence")}}i(Oe,"createHostedAdvancedWorkRuntime");var Xe=e.string().regex(/^[a-f0-9]{64}$/),Be=e.object({version:e.string().min(1),source:e.string().min(1),effectiveAt:e.string().min(1),inputUsdPerMillionTokens:e.number().finite().nonnegative(),cachedInputUsdPerMillionTokens:e.number().finite().nonnegative(),outputUsdPerMillionTokens:e.number().finite().nonnegative()}).strict(),Z=e.object({operation:e.enum(["prepare_run","start","read","resume","cancel"]),request:ue,configuration:e.object({id:e.string().min(1),profileId:e.string().min(1),etag:Xe}).strict(),refinerRelease:Y,privateSource:K,upstream:e.object({modelId:e.string().min(1),revision:e.string().min(1),pricing:Be}).strict(),judgeModels:e.array(e.object({modelId:e.string().min(1),revision:e.string().min(1),pricing:Be}).strict()).max(50),bridge:Q.optional(),hostedTurnId:e.string().min(1).optional()}).strict();async function Fe(s){let r=Z.parse(s.request),t=r.request.pin;if(r.request.model.providerId!=="openpond"||r.request.model.modelId!==r.upstream.modelId||r.configuration.id!==r.request.modelId||r.configuration.profileId!==t.profileRef.profileId||r.request.profileId!==t.profileRef.profileId||r.refinerRelease.id!==t.refinerRelease.id||r.refinerRelease.contentHash!==t.refinerRelease.contentHash)throw new Error("The actual hosted advanced configuration/model/Refiner admission changed.");let n=`advanced-refiner-${R([t.actorId,t.teamId,t.operationId,t.contentHash,r.request.model,[r.request.seed],1]).slice(0,40)}`;if((r.operation==="start"||r.operation==="resume")&&(!r.bridge||!r.hostedTurnId))throw new Error("The actual hosted advanced execution grant is unavailable.");let m=r.bridge?qe(r.bridge,s.signal):null;if(r.bridge&&(r.bridge.jobId!==n||r.bridge.pinHash!==t.contentHash))throw new Error("The hosted model bridge belongs to another actual Run.");let u=i(async()=>{s.signal.throwIfAborted(),await s.authorize(),m&&await m.authorize()},"authorize"),v=await _e({...s,pin:t,privateSource:r.privateSource,authorize:u}),I=we(ve(s.storeDir));await I.persistRelease(r.refinerRelease),await I.writeSource(ee(r.refinerRelease.profile)),I.binding()?.release.contentHash!==t.refinerRelease.contentHash&&await I.transition(r.refinerRelease,{operation:"activate",bindingChanged:!0,actor:s.actor.actorId,reason:"Pin the actual hosted evaluation fork to its admitted immutable Refiner release.",authoringSkillHash:null});let y=ke({storeDir:s.storeDir,authorize:i(async()=>u(),"authorize"),packageForPin:i(async()=>r.privateSource.packageValue,"packageForPin"),prepareModel:i(async(c,f,k)=>{if(!m)throw new Error("The actual hosted model ceiling owner is unavailable.");return m.ceiling(c,k,f)},"prepareModel")}),h=i(async function*(c){let f=be(),k=[r.upstream,...r.judgeModels].find(q=>q.modelId===c.model.modelId);if(!m||!f||!k)throw new Error("The actual hosted model and durable shared budget are unavailable.");let{signal:T,...j}=c,O=c.maxOutputTokens??4096,L=await f.call(c.requestId,j,k.pricing,O,async()=>{let q=[],F=null;for await(let N of m.stream({...c,signal:AbortSignal.any([T,f.signal])}))q.push(N),N.costUsd!==void 0&&(F=(F??0)+N.costUsd);return{value:q,costUsd:F}});for(let q of L)yield q},"stream"),l=i(async c=>{let f="";for await(let k of h({...c,reasoningEffort:c.reasoningEffort??null,tools:[],toolChoice:"none"}))k.text&&(f+=k.text),k.usage!==void 0&&c.onUsage?.(k.usage,k.costUsd);return f},"text"),H=Ie({store:s.store,storeDir:s.storeDir}),E=await H.projectSelected({profileId:t.profileRef.profileId,package:r.privateSource.packageValue,adaptationSplit:t.adaptationSplit,holdoutSplit:t.holdoutSplit}),P=i(async c=>{let f=C.partial().parse(c),k=new Date().toISOString(),T=C.parse({...f,id:`hosted-review-${R([n,f.metadata]).slice(0,40)}`,cloudTeamId:t.teamId,currentProfile:t.profileRef,appId:null,appName:null,cwd:null,codexThreadId:null,title:f.title??"Hosted Refiner review",provider:"openpond",createdAt:k,updatedAt:k,status:"active",pinned:!1,archived:!1,order:0,metadata:{...f.metadata,hostedAdvancedTurnId:r.hostedTurnId??null,actorId:t.actorId,source:"hosted-advanced-evaluation"}});return await s.store.insertSessionAtFront(T),T},"createSession"),w=m&&r.hostedTurnId?Oe({store:s.store,bridge:m,teamId:t.teamId,actorId:t.actorId,hostedTurnId:r.hostedTurnId,modelRunId:n,profileRef:t.profileRef}):void 0,p=Se({store:s.store,storeDir:s.storeDir,modelJudge:ye({store:s.store,modelText:l}),modelText:l,modelStream:h,workRuntime:w,resolveTasksetRelease:i(c=>H.releaseForTaskset(c),"resolveTasksetRelease")}),a={store:s.store,storeDir:s.storeDir,evaluation:p,benchmarkTasksets:H,loadProfileState:i(async()=>s.profile,"loadProfileState"),resolveEvaluationProject:i(async(c,f)=>{if(await u(),c!==r.configuration.id||f!==r.configuration.profileId)throw new Error("The actual hosted evaluation configuration changed.");return{id:c,profileId:f}},"resolveEvaluationProject"),resolveUpstreamModel:i(async()=>({providerId:"openpond",modelId:r.upstream.modelId,revision:r.upstream.revision,pricing:r.upstream.pricing}),"resolveUpstreamModel"),advancedBoundary:y,refinerStream:i(async function*(c){if(!c.requestId)throw new Error("A hosted Refiner call needs its actual retained ID.");yield*h({model:c.model,reasoningEffort:"low",messages:c.messages,tools:[],toolChoice:"none",requestId:c.requestId,maxOutputTokens:4096,signal:c.signal,hostedTokenPricing:c.pricing})},"refinerStream")},o=Re({...a,reviewQuality:He({source:v,boundary:y,benchmark:a,createSession:P})}),g={advancedEvaluation:t,selectedTaskset:{id:E.id,revision:E.revision,contentHash:E.contentHash},modelId:r.request.modelId,profileId:r.request.profileId,model:r.request.model,reasoningEffort:r.request.reasoningEffort,seeds:[r.request.seed],repetitions:1,maximumSpendUsd:t.maximumCostUsd},b,S=i(()=>{o.cancel(n)},"stop");s.signal.addEventListener("abort",S,{once:!0});try{if(r.operation==="prepare_run")return o.prepare(g);let c=await s.store.getModelRun(n);if(!c||c.evaluation?.benchmarkId!=="harness-refiner"||c.evaluation.advancedEvaluation?.contentHash!==t.contentHash)throw new Error("The original hosted advanced Run is unavailable.");if(r.operation==="read")return c;if(r.operation==="cancel")return o.cancel(n);if(m){let T=!1;b=setInterval(()=>{T||(T=!0,s.store.getModelRun(n).then(j=>j?m.checkpoint(j):void 0).catch(()=>S()).finally(()=>{T=!1}))},2e3)}r.operation==="start"?await o.start(g):await o.resume(n);let f=await o.wait(n);if(!f)throw new Error("The actual hosted advanced engine did not retain its Run.");let k=pe.parse(f);return m&&await m.checkpoint(k),k}finally{b&&clearInterval(b),s.signal.removeEventListener("abort",S),await o.close(),await y.close()}}i(Fe,"runHostedAdvancedRefinerOwner");import{promises as _}from"node:fs";import A from"node:path";var Ye=e.object({actor:e.object({actorId:e.string().min(1),teamId:e.string().min(1)}).strict(),storeDir:e.string().min(1),source:e.object({repoPath:e.string().min(1),repositoryId:e.string().min(1),profileId:e.string().min(1),sourceRevision:e.string().regex(/^[a-f0-9]{40,64}$/),filesHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),evidence:e.object({manifest:e.unknown(),result:e.unknown()}).strict(),operation:e.enum(["advanced","describe","command","queue","cancelQueued","bind","finish","beginTesting","cancelTesting","failTesting","comparison","beginAdoption","export","source","tool","toolCatalog"]),advanced:Z.optional(),command:le.optional(),candidateId:e.string().optional(),revision:e.number().int().positive().optional(),actualSession:C.optional(),actualTurn:$.optional(),recipe:e.unknown().optional(),baseline:e.object({manifest:e.unknown(),result:e.unknown()}).strict().optional(),candidate:e.object({manifest:e.unknown(),result:e.unknown()}).strict().optional(),humanProjection:oe.optional(),humanSelections:re.optional(),adoptionReadback:e.unknown().optional(),failure:e.object({message:e.string().max(2e3),cancelled:e.boolean()}).strict().optional(),tool:e.object({name:e.string(),args:e.record(e.string(),e.unknown()),callId:e.string()}).strict().optional(),agentRuntime:e.object({source:e.string(),cliRelativePath:e.string()}).strict().optional(),queued:e.object({sessionId:e.string(),turnId:e.string(),createdAt:e.string().datetime()}).strict().optional()}).strict();async function We(s,r=new AbortController().signal){r.throwIfAborted();let t=Ye.parse(s),{actor:n,source:d}=t;if(!A.isAbsolute(t.storeDir)||!A.isAbsolute(d.repoPath))throw new Error("Hosted candidate owner requires contained absolute private paths.");let m=M(t.evidence),u=[t.baseline,t.candidate].filter(l=>l!==void 0).map(l=>M(l));if(m.manifest.teamId!==n.teamId)throw new Error("Hosted candidate evidence belongs to another team.");if(await B(d.repoPath)!==d.filesHash)throw new Error("The admitted hosted Profile source bytes changed.");let v=`hosted-improve-source-${R([n,d.repositoryId,d.profileId,d.sourceRevision]).slice(0,40)}`,I=A.join(t.storeDir,"library","profile-experiment-origins",v);if(await _.mkdir(A.dirname(I),{recursive:!0,mode:448}),await _.stat(I).catch(()=>null)||await _.cp(d.repoPath,I,{recursive:!0,errorOnExist:!0,force:!1}),await B(I)!==d.filesHash)throw new Error("The private accepted Profile cache changed.");let x=await W(I,d.profileId);if(x.error||!x.sourcePath)throw new Error("The accepted hosted Profile does not compile.");let y=new xe(t.storeDir),h;try{let l=await y.getHarnessWorkspace(v);l||(l=(await fe({store:y,storeDir:t.storeDir,id:v,ownerId:n.actorId,name:d.profileId,profile:x,sourceRevision:d.sourceRevision,repositoryId:d.repositoryId,selectionEligible:!1,originMetadata:{profileExperimentOrigin:{schemaVersion:"openpond.profileExperimentOrigin.v1",...n,sourceRevision:d.sourceRevision,sourcePath:I,sourceFilesHash:d.filesHash},hostedImprovementOwner:!0}})).workspace);let H={source:"openpond_git",repositoryId:d.repositoryId,profileId:d.profileId},E=i(async()=>{if(r.throwIfAborted(),await B(I)!==d.filesHash||await B(d.repoPath)!==d.filesHash)throw new Error("Accepted source changed during private candidate I/O.")},"authorizer");if(t.operation==="advanced"){if(!t.advanced)throw new Error("Missing actual hosted advanced owner command.");return Fe({store:y,storeDir:t.storeDir,actor:n,profile:x,workspace:l,source:d,evidence:m,request:t.advanced,authorize:E,signal:r})}let P=i(()=>{if(!t.adoptionReadback)throw new Error("Actual hosted Git owner has not returned its sealed adoption receipt.");return e.object({receipt:e.object({id:e.string(),contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),activeRelease:e.object({id:e.string(),contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),testedCandidateRelease:e.object({id:e.string(),contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),executableSourceHash:e.string().regex(/^[a-f0-9]{64}$/),protectedClosureHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict().parse(t.adoptionReadback)},"readback");h=Ee({store:y,storeDir:t.storeDir,projectHumanComparison:i(async()=>{if(await E(),!t.humanProjection)throw new Error("The current private Human comparison owner is unavailable.");return ne(t.humanProjection)},"projectHumanComparison"),authorizeOwner:i(async(a,o,g,b,S)=>{if(R(a)!==R(n)||R(g)!==R(H)||o.id!==v)throw new Error("Hosted candidate source owner changed.");if(S.requireCurrentBase&&(o.currentChannel.release?.contentHash!==l.currentChannel.release?.contentHash||d.sourceRevision!==o.metadata.profileExperimentOrigin.sourceRevision))throw new Error("Hosted candidate accepted revision changed.");await E()},"authorizeOwner"),loadEvidence:i(async(a,o)=>{if(R(a)!==R(n))throw new Error("Hosted candidate evidence actor changed.");let g=[m,...u].find(b=>b.manifest.id===o.id&&b.result.contentHash===o.contentHash&&b.manifest.teamId===n.teamId);if(!g)throw new Error("Hosted candidate exact retained evidence changed.");return await E(),g},"loadEvidence"),freezeProfile:i(async(a,o,g)=>{let b=await y.getHarnessReleaseRecord(o.baseRelease.contentHash);if(!b)throw new Error("Hosted source baseline is missing.");let S=await D({workspaceId:typeof b.agentSnapshot.metadata.workspaceId=="string"?b.agentSnapshot.metadata.workspaceId:b.workspaceId,sourceDir:A.join(b.bundlePath,"source")}),c=await D({workspaceId:typeof g.release.agentSnapshot.metadata.workspaceId=="string"?g.release.agentSnapshot.metadata.workspaceId:g.release.workspaceId,sourceDir:A.join(g.release.bundlePath,"source")});return Ae({store:y,storeDir:t.storeDir,state:o},async f=>{await Ce({...f,state:o,base:S,candidate:c});let k=await W(f.root,o.profileRef.profileId),T=await U({storeDir:t.storeDir,state:o,profile:k,sourceRevision:g.profileSourceRevision,base:S}),j=z(T);if(j.protectedClosureHash!==z(S).protectedClosureHash)throw new Error("Hosted source candidate changed protected evaluation closure.");let O=A.join(t.storeDir,"library","profile-candidate-archives",o.id,j.contentHash);await _.mkdir(A.dirname(O),{recursive:!0,mode:448}),await _.stat(O).catch(()=>null)||await _.cp(f.root,O,{recursive:!0,errorOnExist:!0,force:!1});let L=await W(O,o.profileRef.profileId);if((await U({storeDir:t.storeDir,state:o,profile:L,sourceRevision:g.profileSourceRevision,base:S})).harnessRelease.contentHash!==T.harnessRelease.contentHash)throw new Error("Hosted frozen Profile archive readback differs.");let F=await he({storeDir:t.storeDir,workspaceId:g.release.workspaceId,compiled:T,createdAt:g.release.createdAt});return await E(),{...g,release:F,executableIdentity:j}})},"freezeProfile"),adopt:i(async()=>P(),"adopt"),readAdoption:i(async()=>t.adoptionReadback?P():null,"readAdoption"),rollback:i(async()=>P(),"rollback")});let w=Pe({store:y,improvements:h,actorId:i(async()=>n.actorId,"actorId"),teamId:i(async()=>n.teamId,"teamId"),loadProfile:i(async a=>{if(R(a)!==R(H))throw new Error("Candidate requested another source owner.");return x},"loadProfile"),agentRuntime:t.agentRuntime,operationSignal:r,loadAgentRuntime:De({storeDir:t.storeDir,loadArchive:ze({storeDir:t.storeDir})})});if(t.operation==="describe"){await E();let a=l.currentChannel.release,o=a?await y.getHarnessReleaseRecord(a.contentHash):null;if(!a||!o||o.workspaceId!==l.id||o.harnessRelease.id!==a.id||o.harnessRelease.contentHash!==a.contentHash||l.ownerScope.kind!=="personal"||l.ownerScope.id!==n.actorId)throw new Error("Hosted source release is unavailable to its admitted owner.");let g=await D({workspaceId:typeof o.agentSnapshot.metadata.workspaceId=="string"?o.agentSnapshot.metadata.workspaceId:v,sourceDir:A.join(o.bundlePath,"source")});if(g.harnessRelease.contentHash!==o.harnessRelease.contentHash)throw new Error("Hosted source compiler readback changed.");let b=await ge({runtime:{release:o},ref:H,sourceRevision:d.sourceRevision,harnessRelease:a}),S=i(c=>{let f=g.sourceFiles.find(k=>k.path===c)?.bytes;return f?JSON.parse(Buffer.from(f).toString("utf8")):null},"readJson");return await E(),{workspaceId:v,ownerRevision:l.revision,profileRef:H,baseRelease:l.currentChannel.release,profileSourceRevision:d.sourceRevision,manifest:g.manifest,executable:z(g),catalogHash:b.catalogHash,workflows:S("workflows/catalog.json"),actions:S("workflows/actions.json")}}if(t.operation==="command"){let a=t.command;if(!a)throw new Error("Missing canonical Improve command.");if(a.operation==="start")return h.start(n,a.request);if(a.operation==="list")return h.list(n,a.limit,a.cursor);if(!("id"in a))throw new Error("Discover exact hosted source choices through the authenticated host.");let o=await h.read(n,a.id);if(a.operation==="read")return o;if(a.operation==="instructions"){let g=await h.partition(n,o.id),b=await me(g.sourceRoot,o.component.path),S=await _.readFile(b);if(S.length>25e4)throw new Error("Instruction editor size limit exceeded.");let c=S.toString("utf8");if(o.component.kind==="workflow"){let f=JSON.parse(c).workflows?.find(k=>k.id===o.component.workflowId);if(f?.invocation?.kind!=="instructions")throw new Error("Use Work to author this executable Workflow.");c=f.invocation.instructions}return{candidateId:o.id,candidateRevision:o.revision,path:o.component.path,text:c,textHash:J(c),contentHash:J(S)}}if(a.operation==="humanComparisonOptions")throw new Error("Read the actual paired sources through their current hosted Experiment owner.");if(!("revision"in a)||o.revision!==a.revision)throw new Error("Candidate revision changed.");if(a.operation==="edit")return h.edit(n,o.id,o.revision,a.expectedFileHash,a.text);if(a.operation==="mode")return h.setMode(n,o.id,o.revision,a.mode);if(a.operation==="freeze")return h.freeze(n,o.id,o.revision);if(a.operation==="useCandidate")return h.useCandidate(n,o.id,o.revision);if(a.operation==="rollback")return h.rollback(n,o.id,o.revision);if(a.operation==="discard")return h.discard(n,o.id,o.revision);throw new Error("Hosted Work/test lifecycle requires the actual host turn/run admission.")}if(!t.candidateId)throw new Error("Missing actual hosted candidate ID.");let p=await h.read(n,t.candidateId);if(t.operation==="beginAdoption")return h.beginAdoption(n,p.id,t.revision);if(t.operation==="export")return je(y,p,"hosted_execution");if(t.operation==="source"){if(!p.frozen||p.status!=="frozen"&&p.status!=="testing"&&p.status!=="ready_for_review"&&p.status!=="adopting")throw new Error("Only the exact frozen source can enter hosted preparation.");let a=await y.getHarnessReleaseRecord(p.frozen.release.contentHash);if(!a||a.harnessRelease.id!==p.frozen.release.id)throw new Error("Frozen hosted source is unavailable.");let o=await D({workspaceId:typeof a.agentSnapshot.metadata.workspaceId=="string"?a.agentSnapshot.metadata.workspaceId:a.workspaceId,sourceDir:A.join(a.bundlePath,"source")}),g=z(o);if(o.harnessRelease.contentHash!==p.frozen.release.contentHash||g.contentHash!==p.frozen.executableSourceHash||g.protectedClosureHash!==p.frozen.protectedClosureHash)throw new Error("Frozen hosted executable changed.");let b=A.join(t.storeDir,"library","profile-candidate-archives",p.id,g.contentHash),S=await W(b,p.profileRef.profileId);if(S.error||!S.sourcePath)throw new Error("Frozen actual Profile archive is unavailable.");let c=await y.getHarnessReleaseRecord(p.baseRelease.contentHash);if(!c)throw new Error("Frozen baseline is unavailable.");let f=await D({workspaceId:typeof c.agentSnapshot.metadata.workspaceId=="string"?c.agentSnapshot.metadata.workspaceId:c.workspaceId,sourceDir:A.join(c.bundlePath,"source")}),k=await U({storeDir:t.storeDir,state:p,profile:S,sourceRevision:p.frozen.profileSourceRevision,base:f});if(k.harnessRelease.contentHash!==p.frozen.release.contentHash||z(k).contentHash!==g.contentHash)throw new Error("Actual frozen Profile archive differs from its compiled release.");return{state:p,profileSource:{repoPath:b,profileId:p.profileRef.profileId,sourceRevision:p.frozen.profileSourceRevision,repositoryId:p.profileRef.repositoryId,filesHash:await B(b)},sourcePackage:te({agentSnapshot:o.agentSnapshot,harnessRelease:o.harnessRelease,files:new Map(o.sourceFiles.map(T=>[T.path,T.bytes]))})}}if(t.operation==="comparison"){if(!t.baseline||!t.candidate)throw new Error("Missing actual hosted paired evidence.");return h.completeComparison(n,p.id,t.revision,M(t.baseline),M(t.candidate),t.humanSelections)}if(t.operation==="beginTesting")return h.beginTesting(n,p.id,t.revision,t.recipe);if(t.operation==="failTesting"){if(!t.failure)throw new Error("Missing actual hosted test failure.");return h.failTesting(n,p.id,t.revision,t.failure.message,t.failure.cancelled)}if(t.operation==="cancelTesting")return h.cancelTesting(n,p.id,t.revision);if(t.operation==="queue"){if(!t.queued)throw new Error("Missing actual hosted queue admission.");return h.queueAuthoringTurn(n,p.id,t.revision,t.queued.sessionId,t.queued.turnId,t.queued.createdAt)}if(t.operation==="cancelQueued")return h.cancelQueuedAuthoring(n,p.id,t.revision);if(t.operation==="bind"||t.operation==="finish"||t.operation==="tool"||t.operation==="toolCatalog"){if(!t.actualSession||!t.actualTurn||t.actualTurn.sessionId!==t.actualSession.id||t.actualSession.cloudTeamId!==n.teamId||R(t.actualSession.currentProfile)!==R(H))throw new Error("Actual hosted candidate Work binding changed.");let a=t.actualSession,o=t.actualTurn,g=await y.getSession(a.id);if(!g)await y.insertSessionAtFront(a);else if(R({...g,updatedAt:a.updatedAt,status:a.status})!==R(a))throw new Error("Retained hosted candidate session changed.");let b=await y.getTurn(o.id);if(!b)await y.insertTurn(o);else{if(b.sessionId!==o.sessionId||R(b.metadata.refinementCandidate)!==R(o.metadata.refinementCandidate)||b.prompt!==o.prompt)throw new Error("Actual hosted candidate turn identity changed.");await y.updateTurn(o.id,()=>o)}if(t.operation==="bind")return h.bindAuthoringTurn(n,p.id,t.revision,a.id,o.id);if(t.operation==="finish")return h.finishAuthoring(n,p.id,t.revision);if(t.operation==="toolCatalog")return await w.candidateAuthoringForTurn(a.id,o.id),[...G({loadProfileState:i(async()=>x,"loadProfileState"),resolveCandidateProfile:w.resolveCandidateProfile,executeCandidateAgentCommand:w.executeCandidateAgentCommand}),...Te(async()=>{throw new Error("Hosted file tools require a bound private call.")}),{name:"exec_command",description:"Run a bounded command confined to the selected public candidate component.",parameters:{type:"object",additionalProperties:!1,properties:{command:{type:"string",minLength:1,maxLength:2e4},cwd:{type:"string"}},required:["command"]}},{name:"view_image",description:"Inspect an image inside the candidate public source tree.",parameters:{type:"object",additionalProperties:!1,properties:{path:{type:"string"}},required:["path"]}}].map(({name:c,description:f,parameters:k})=>({name:c,description:f,parameters:k}));if(!t.tool)throw new Error("Missing candidate tool call.");await w.authorizeCandidateTool({sessionId:a.id,turnId:o.id,name:t.tool.name});let S={session:a,turnId:o.id,args:t.tool.args,callId:t.tool.callId,signal:r,workspaceDiffBaseline:null,turnPermissions:{approvalPolicy:"never",sandbox:"workspace-write",codexPermissionMode:"default"},provider:a.provider,model:o.modelRef?.modelId??a.modelRef?.modelId??"",mentionedApps:[],userPrompt:o.prompt,turnMetadata:o.metadata};if(t.tool.name==="get_profile"||t.tool.name.startsWith("agent_")||t.tool.name==="ask_user"){let c=G({loadProfileState:i(async()=>x,"loadProfileState"),resolveCandidateProfile:w.resolveCandidateProfile,executeCandidateAgentCommand:w.executeCandidateAgentCommand}).find(f=>f.name===t.tool.name);if(!c)throw new Error("Candidate authoring tool is unavailable.");return c.execute(S)}if(t.tool.name==="view_image")return w.executeCandidateImage(S);if(t.tool.name==="exec_command")return w.executeCandidateCommand(S,{session:a,turnId:o.id,command:e.string().min(1).max(2e4).parse(t.tool.args.command),cwd:typeof t.tool.args.cwd=="string"?t.tool.args.cwd:null,signal:S.signal,source:"model_tool"});if(["list_files","read_files","search_files","workspace_status","write_file","write_files","edit_file","delete_file"].includes(t.tool.name))return w.executeCandidateWorkspaceTool({session:a,turnId:o.id,request:de.parse({action:t.tool.name,args:t.tool.args,source:"chat_action"})});throw new Error("This hosted tool has no confined candidate transport.")}throw new Error("Unknown private hosted Improve operation.")}finally{await h?.close(),await y.close()}}i(We,"runHostedExperimentImprovementOwner");async function wr(s){if(s.length!==1||s[0].length>16e3||!/^[A-Za-z0-9_-]+$/.test(s[0]))throw new Error("Hosted Improve IPC argument is invalid.");let r=e.object({directory:e.string(),file:e.string().regex(/^[A-Za-z0-9_-]+\.json$/)}).strict().parse(JSON.parse(Buffer.from(s[0],"base64url").toString("utf8")));if(!Ue.isAbsolute(r.directory))throw new Error("Hosted Improve IPC requires an absolute private directory.");let t=Ue.join(r.directory,r.file),n=await $e.lstat(t);if(!n.isFile()||n.isSymbolicLink()||n.size>32*1024*1024)throw new Error("Hosted Improve private request exceeds its byte/type limit.");let d=new AbortController,m=i(()=>d.abort(new Error("The actual hosted owner stopped this private operation.")),"stop");process.once("SIGTERM",m),process.once("SIGINT",m);try{let u=await We(JSON.parse(await $e.readFile(t,"utf8")),d.signal),v=Buffer.from(JSON.stringify(u));if(v.length>32*1024*1024)throw new Error("Hosted Improve private response exceeds its byte limit.");process.stdout.write(`${v.toString("utf8")}
|
|
3
|
-
`)}finally{process.removeListener("SIGTERM",m),process.removeListener("SIGINT",m)}}i(wr,"runHostedExperimentImprovementCli");export{wr as runHostedExperimentImprovementCli};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as a,c as b}from"./chunk-GCOUYYHG.js";import"./chunk-USKE34VR.js";import"./chunk-7ZG3IT7C.js";import"./chunk-4TZHH5FC.js";import"./chunk-4SHKI3BH.js";import"./chunk-5CMKGD43.js";import"./chunk-HA7EFTPF.js";import"./chunk-L3KS6MOV.js";import"./chunk-7QEE4PBI.js";import"./chunk-2JO2KWT3.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as loadHostedHarnessRuntime,b as loadHostedHarnessRuntimeForSession};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a,e as F}from"./chunk-H2VT22JK.js";import{a as O}from"./chunk-EMKZVP7Z.js";import{a as h}from"./chunk-T5LE6R5S.js";import{na as I,qa as D,ra as M}from"./chunk-4TZHH5FC.js";import"./chunk-4SHKI3BH.js";import"./chunk-5CMKGD43.js";import{N as w}from"./chunk-HA7EFTPF.js";import"./chunk-L3KS6MOV.js";import"./chunk-7QEE4PBI.js";import{od as A}from"./chunk-2JO2KWT3.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import{ua as R}from"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import{k as C,l as v}from"./chunk-NNF6KCHD.js";import{b as c}from"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as f}from"./chunk-FTQLQJQV.js";import{promises as m}from"node:fs";import n from"node:path";var $=c.object({action:c.enum(["stage","readback","rollback"]),repoPath:c.string(),outputDir:c.string(),exportFile:c.string(),commit:c.string().regex(/^[a-f0-9]{40}$/).optional(),expectedExecutableSourceHash:c.string().regex(/^[a-f0-9]{64}$/).optional()}).strict();async function z(l){let e=$.parse(l);if(!n.isAbsolute(e.repoPath)||!n.isAbsolute(e.outputDir)||!/^[a-zA-Z0-9_-]+\.json$/.test(e.exportFile))throw new Error("Hosted candidate private IPC is not contained.");let g=n.join(e.outputDir,e.exportFile),H=await m.lstat(g);if(!H.isFile()||H.isSymbolicLink()||H.size>8*1024*1024)throw new Error("Hosted candidate export exceeds its private IPC bound.");let t=O(JSON.parse(await m.readFile(g,"utf8"))),u=await w({repoPath:e.repoPath,profileId:t.profileRef.profileId});if(u.error||!u.sourcePath)throw new Error("Actual hosted Profile source is unavailable.");if(e.action!=="readback"){let o=!1;try{await a(e.repoPath,["symbolic-ref","-q","HEAD"]),o=!0}catch{}if(o||await a(e.repoPath,["rev-parse","HEAD"])!==(e.action==="rollback"?e.commit:t.expectedCommit)||await a(e.repoPath,["status","--porcelain","--untracked-files=all"]))throw new Error("Candidate staging requires a clean detached exact original source worktree.")}let x=f(async o=>I({storeDir:e.outputDir,workspaceId:t.compiler.workspaceId,name:t.compiler.name,profile:await w({repoPath:e.repoPath,profileId:t.profileRef.profileId}),sourceRevision:o,repositoryId:t.compiler.repositoryId}),"compile");if(e.action==="readback"){if(!e.commit||await a(e.repoPath,["rev-parse","HEAD"])!==e.commit)throw new Error("Hosted Profile readback is not the committed source.");let o=await x(e.commit),i=h(o);if(i.profileGitHead!==e.commit||i.contentHash!==(e.expectedExecutableSourceHash??t.executableSourceHash)||i.protectedClosureHash!==t.protectedClosureHash)throw new Error("Hosted active executable differs from the actual tested candidate.");let s=await M({storeDir:e.outputDir,workspaceId:t.compiler.workspaceId,compiled:o,createdAt:t.createdAt});return{commit:e.commit,activeRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},executableSourceHash:i.contentHash,protectedClosureHash:i.protectedClosureHash}}if(e.action==="rollback"){if(!e.commit)throw new Error("Rollback requires the exact accepted commit.");await a(e.repoPath,["-c","core.hooksPath=/dev/null","revert","--no-commit",e.commit])}let p=await x(t.expectedCommit);if(p.harnessRelease.contentHash!==t.baseRelease.contentHash||p.harnessRelease.id!==t.baseRelease.id)throw new Error("Hosted original source differs from the owner-attested baseline release.");if(e.action==="stage"){let o=Buffer.from(t.sourceManifest.base64,"base64");if(o.toString("base64")!==t.sourceManifest.base64||o.length!==t.sourceManifest.sizeBytes||v(o)!==t.sourceManifest.contentHash)throw new Error("Candidate source manifest byte identity differs.");let i=A.parse(JSON.parse(o.toString("utf8"))),s=n.join(e.outputDir,"candidate-source");await m.mkdir(s,{recursive:!0}),await m.writeFile(n.join(s,"harness.json"),C(i));let _=R(t.policySource),j=new Map(p.sourceFiles.filter(r=>r.asset.visibility!=="policy").map(r=>[r.path,r]));for(let r of i.files){let k=r.visibility==="policy"?_.get(r.path):j.get(r.path)?.bytes;if(!k)throw new Error("The hosted source cannot hydrate the exact protected candidate closure.");let y=n.join(s,r.path);if(n.relative(s,y).startsWith(".."))throw new Error("Candidate release path escapes private staging.");await m.mkdir(n.dirname(y),{recursive:!0}),await m.writeFile(y,k)}let P=await D({workspaceId:t.compiler.workspaceId,sourceDir:s}),S=h(P);if(P.harnessRelease.contentHash!==t.policySource.harnessRelease.contentHash||S.contentHash!==t.executableSourceHash||S.protectedClosureHash!==t.protectedClosureHash)throw new Error("Owner-attested candidate differs from independently compiled hosted source.");await F({source:u.sourcePath,state:{component:t.component},base:p,candidate:P,profile:u})}await a(e.repoPath,["add","--all"]),await a(e.repoPath,["-c","core.hooksPath=/dev/null","-c","commit.gpgSign=false","commit","-m",`${e.action==="rollback"?"Roll back":"Adopt"} owner-tested candidate ${t.candidateId}`],{GIT_AUTHOR_NAME:"OpenPond",GIT_AUTHOR_EMAIL:"profile-candidate@openpond.local",GIT_COMMITTER_NAME:"OpenPond",GIT_COMMITTER_EMAIL:"profile-candidate@openpond.local"});let E=await a(e.repoPath,["rev-parse","HEAD"]),T=await w({repoPath:e.repoPath,profileId:t.profileRef.profileId}),b=await I({storeDir:e.outputDir,workspaceId:t.compiler.workspaceId,name:t.compiler.name,profile:T,sourceRevision:E,repositoryId:t.compiler.repositoryId}),d=h(b);if(e.action==="stage"&&(d.contentHash!==t.executableSourceHash||d.protectedClosureHash!==t.protectedClosureHash)||e.action==="rollback"&&(d.contentHash!==h(p).contentHash||d.protectedClosureHash!==h(p).protectedClosureHash))throw new Error("Staged actual source differs from its exact tested executable graph.");return{commit:E,activeRelease:{id:b.harnessRelease.id,contentHash:b.harnessRelease.contentHash},executableSourceHash:d.contentHash,protectedClosureHash:d.protectedClosureHash}}f(z,"hostedProfileCandidate");async function Q(l){if(l.length!==1||l[0].length>16e3||!/^[a-zA-Z0-9_-]+$/.test(l[0]))throw new Error("Hosted candidate IPC argument is invalid.");process.stdout.write(`${JSON.stringify(await z(JSON.parse(Buffer.from(l[0],"base64url").toString("utf8"))))}
|
|
3
|
-
`)}f(Q,"runHostedProfileCandidateCli");export{z as hostedProfileCandidate,Q as runHostedProfileCandidateCli};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"./chunk-3LX6RU3C.js";import"./chunk-4TZHH5FC.js";import"./chunk-4SHKI3BH.js";import"./chunk-5CMKGD43.js";import"./chunk-HA7EFTPF.js";import"./chunk-L3KS6MOV.js";import"./chunk-7QEE4PBI.js";import"./chunk-2JO2KWT3.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as compileHostedProfileRelease,b as runHostedProfileCompilerCli,c as runHostedProfileEvaluationCli,d as runHostedProfileInspectionCli};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as m,b as c}from"./chunk-XM26DGML.js";import{a as l}from"./chunk-4SHKI3BH.js";import{L as f}from"./chunk-2JO2KWT3.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import{ja as s,oa as u}from"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-TGIB24K4.js";import{n as t}from"./chunk-NNF6KCHD.js";import{b as n}from"./chunk-ES2ISFJC.js";import{a as i}from"./chunk-FTQLQJQV.js";var v=n.object({profileRef:f,sourceRevision:n.string().min(1),action:n.enum(["compare","report"]),request:n.unknown(),runs:n.array(l).max(1e4),comparisons:n.array(s).max(1e4),suiteRuns:n.array(u).max(1e4)}).strict();async function h(p){let o=v.parse(p);for(let e of[...o.runs,...o.comparisons,...o.suiteRuns])t(e,"Hosted evaluation evidence");let a={getProfileEvaluationRun:i(async e=>o.runs.find(r=>r.manifest.id===e)??null,"getProfileEvaluationRun"),getProfileEvaluationComparison:i(async e=>o.comparisons.find(r=>r.id===e)??null,"getProfileEvaluationComparison"),getProfileEvaluationSuiteRun:i(async e=>o.suiteRuns.find(r=>r.id===e)??null,"getProfileEvaluationSuiteRun"),saveProfileEvaluationComparison:i(async(e,r)=>r,"saveProfileEvaluationComparison")};return o.action==="compare"?m({store:a,selectedProfile:i(async()=>({ref:o.profileRef,sourceRevision:o.sourceRevision}),"selectedProfile")})(o.request):c({store:a,profileRef:o.profileRef,request:o.request})}i(h,"controlHostedProfileEvaluation");export{h as controlHostedProfileEvaluation};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{c as R,d as P}from"./chunk-AFUDIT36.js";import{a as E}from"./chunk-4SHKI3BH.js";import{L as v,M as S,N as w,Y as y,a as h}from"./chunk-2JO2KWT3.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import{k as g}from"./chunk-WV2APYWG.js";import{h as m}from"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import{b as s}from"./chunk-ES2ISFJC.js";import{a as n}from"./chunk-FTQLQJQV.js";var I=s.object({profileRef:v,inspection:R,run:E.nullable(),receipts:s.array(g).max(1e4),grades:s.array(m).max(1e4),sessions:s.array(S).max(1e4),turns:s.array(w).max(1e4),events:s.array(h).max(1e4),usage:s.array(y).max(1e4)}).strict();async function x(c){let t=I.parse(c),o=n((e,i)=>{let f=new Map;for(let p of e){let d=i(p);if(f.has(d))throw new Error("Hosted evaluation inspection has duplicate evidence identities.");f.set(d,p)}return f},"map"),r=o(t.receipts,e=>e.id),u=o(t.grades,e=>e.contentHash),l=o(t.sessions,e=>e.id),a=o(t.turns,e=>e.id);return P({profileRef:t.profileRef,...t.inspection,store:{getProfileEvaluationRun:n(async e=>t.run?.manifest.id===e?t.run:null,"getProfileEvaluationRun"),getProfileEvaluationReceipt:n(async e=>r.get(e)??null,"getProfileEvaluationReceipt"),getProfileEvaluationGrade:n(async e=>u.get(e)??null,"getProfileEvaluationGrade"),getSession:n(async e=>l.get(e)??null,"getSession"),getTurn:n(async e=>a.get(e)??null,"getTurn"),runtimeEventsForTurn:n(async e=>t.events.filter(i=>i.turnId===e),"runtimeEventsForTurn"),listModelUsageRecords:n(async e=>t.usage.filter(i=>(!e?.sessionId||i.sessionId===e.sessionId)&&(!e?.turnId||i.turnId===e.turnId)),"listModelUsageRecords")}})}n(x,"inspectHostedProfileEvaluation");async function B(c){if(c.length!==0)throw new Error("Hosted evaluation inspection uses bounded standard input.");let t=[],o=0;for await(let l of process.stdin){let a=Buffer.from(l);if(o+=a.length,o>32*1024*1024)throw new Error("Hosted evaluation inspection input is too large.");t.push(a)}let r=JSON.parse(Buffer.concat(t).toString("utf8")),u=r.action==="compare"||r.action==="report"?await(await import("./hosted-profile-evaluation-control-RJ6XJZCS.js")).controlHostedProfileEvaluation(r):await x(r);process.stdout.write(`${JSON.stringify(u)}
|
|
3
|
-
`)}n(B,"runHostedProfileInspectionCli");export{x as inspectHostedProfileEvaluation,B as runHostedProfileInspectionCli};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as V}from"./chunk-3LX6RU3C.js";import{c as I,f as j,h as D}from"./chunk-5TNDPNS3.js";import{k as x}from"./chunk-6VF3Q6QJ.js";import{a as E}from"./chunk-T5LE6R5S.js";import"./chunk-USKE34VR.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import"./chunk-7ZG3IT7C.js";import{ha as b,qa as C}from"./chunk-4TZHH5FC.js";import"./chunk-4SHKI3BH.js";import"./chunk-5CMKGD43.js";import"./chunk-HA7EFTPF.js";import"./chunk-L3KS6MOV.js";import"./chunk-7QEE4PBI.js";import"./chunk-2JO2KWT3.js";import{ta as m}from"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import{Ca as S}from"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import{ma as H}from"./chunk-PJM2G7SG.js";import{Ga as y,j as P,m as R}from"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import{m as d}from"./chunk-NNF6KCHD.js";import{b as e}from"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import{readFile as h,realpath as z,lstat as T}from"node:fs/promises";import l from"node:path";var B=e.object({compile:e.object({repoPath:e.string(),profileId:e.string(),repositoryId:e.string(),sourceRevision:e.string(),workspaceId:e.string(),outputDir:e.string()}).strict(),externalDatasetPackage:e.string().regex(/^external-dataset-[a-f0-9-]+\.json$/).optional(),sourceCandidate:H.optional(),action:e.enum(["catalog","prepare"]),request:e.unknown().optional()}).strict();async function G(t){let o=await V(t.compile);if(t.sourceCandidate){let a=await C({workspaceId:typeof o.agentSnapshot.metadata.workspaceId=="string"?o.agentSnapshot.metadata.workspaceId:o.workspaceId,sourceDir:l.join(o.bundlePath,"source")});if(d(t.sourceCandidate.harnessRelease)!==d({id:o.harnessRelease.id,contentHash:o.harnessRelease.contentHash})||E(a).protectedClosureHash!==t.sourceCandidate.protectedClosureHash)throw new Error("Private candidate source differs from its actual frozen compiled release.")}let g={release:b.parse({schemaVersion:"openpond.localHarnessReleaseRecord.v1",workspaceId:o.workspaceId,sourceRevision:o.sourceRevision,agentSnapshot:P.parse(o.agentSnapshot),harnessRelease:R.parse(o.harnessRelease),bundlePath:o.bundlePath,createdAt:new Date().toISOString()})},p={source:"openpond_git",profileId:t.compile.profileId,repositoryId:t.compile.repositoryId},f=t.compile.sourceRevision,c={id:o.harnessRelease.id,contentHash:o.harnessRelease.contentHash},w=s(async a=>x({...a,runtime:g}),"loadCatalog"),q=await w({ref:p,sourceRevision:f,harnessRelease:c}),k=l.join(o.bundlePath,"source"),v=o.harnessRelease.files.some(a=>a.path==="workflows/catalog.json")?await(async()=>{let a=y({agentSnapshot:o.agentSnapshot,harnessRelease:o.harnessRelease,catalogBytes:await h(l.join(k,"workflows/catalog.json")),actionBytes:await h(l.join(k,"workflows/actions.json"))});return a.catalog.workflows.map(r=>({workflow:r,binding:{schemaVersion:"openpond.profileWorkflowBinding.v1",profileId:p.profileId,sourceRevision:f,harnessRelease:c,catalogHash:a.catalogHash,workflowId:r.id}}))})():[],A={profileRef:p,sourceRevision:f,harnessRelease:c,workflows:v};if(t.action==="catalog")return{...q,workflows:v};let u=t.externalDatasetPackage?await(async()=>{let a=await z(t.compile.outputDir),r=l.join(a,t.externalDatasetPackage),i=await T(r);if(!i.isFile()||i.isSymbolicLink()||i.size>32*1024*1024||await z(r)!==r)throw new Error("External Dataset cache is outside its bounded verifier storage.");let n=e.object({packageValue:e.unknown(),graders:e.array(e.object({id:e.string(),version:e.string(),contentHash:e.string(),feedbackKey:e.string(),release:e.object({id:e.string(),revision:e.union([e.string(),e.number()]),contentHash:e.string()}).strict().nullable()}).strict()).max(100)}).strict().parse(JSON.parse(await h(r,"utf8")));return{packageValue:S(n.packageValue),graders:n.graders}})():null;return D({privateGradingPreflight:s(a=>I(a,!1),"privateGradingPreflight"),sourceCandidate:t.sourceCandidate,resolveExternalDataset:u?async a=>{let r=m({binding:a,...u}),i=d(o.harnessRelease.files.filter(n=>n.visibility!=="policy").map(n=>({path:n.path,asset:n})));if(a.protectedProfileClosureHash!==i)throw new Error("The selected Profile's protected evaluator closure changed.");return{binding:a,packageValue:r,authorize:s(async()=>{m({binding:a,...u})},"authorize")}}:void 0,loadCatalog:w,selectedWorkflows:s(async()=>A,"selectedWorkflows"),placement:"remote",boundedWorkComputeAvailable:!0,loadTasksetPackage:s(async a=>{let r=await j({runtime:g,definition:a,harnessRelease:c});if(!r)throw new Error("Hosted evaluation Taskset is absent from its published Profile release.");return r},"loadTasksetPackage"),modelConfigurationHash:s(async(a,r)=>{if(a.providerId!=="openpond"||!r.hostModelConfigurationHash)throw new Error("Hosted evaluation preparation requires a trusted model configuration receipt.");return r.hostModelConfigurationHash},"modelConfigurationHash")})(t.request)}s(G,"prepareHostedProfileEvaluation");async function ae(t){if(t.length!==1||t[0].length>48e3||!/^[A-Za-z0-9_-]+$/.test(t[0]))throw new Error("Hosted Profile evaluation preparation argument is invalid.");let o=B.parse(JSON.parse(Buffer.from(t[0],"base64url").toString("utf8")));process.stdout.write(`${JSON.stringify(await G(o))}
|
|
3
|
-
`)}s(ae,"runHostedProfileEvaluationCli");export{G as prepareHostedProfileEvaluation,ae as runHostedProfileEvaluationCli};
|