openpond 0.2.44 → 0.2.46
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/RELEASE.md +16 -13
- package/dist/app-server.d.ts +20954 -11829
- package/dist/app-server.js +1 -1
- package/dist/chunks/actions-command-I3NI75P2.js +2 -0
- package/dist/chunks/{app-layer-7SPLENWD.js → app-layer-B3SMVO4B.js} +1 -1
- package/dist/chunks/app-server-runtime-FL2CHQU2.js +2 -0
- package/dist/chunks/apps-OA2VX34V.js +2 -0
- package/dist/chunks/{chunk-PEYA2Q7Q.js → chunk-33AO3P6X.js} +3 -3
- package/dist/chunks/chunk-4UTIEH5H.js +16 -0
- package/dist/chunks/chunk-4VKNBADF.js +2 -0
- package/dist/chunks/{chunk-ANVOHBUV.js → chunk-5OGRWWEH.js} +1 -1
- package/dist/chunks/chunk-5ZZM3TUN.js +24 -0
- package/dist/chunks/chunk-6JBWHR6T.js +5 -0
- package/dist/chunks/{chunk-DXAZUJPA.js → chunk-6SJZXZNA.js} +1 -1
- package/dist/chunks/chunk-6WLJWRMF.js +2 -0
- package/dist/chunks/chunk-BKMGBIBT.js +2 -0
- package/dist/chunks/chunk-BQNK2NMB.js +21 -0
- package/dist/chunks/chunk-BUFQKDAW.js +2 -0
- package/dist/chunks/chunk-D6E7JBBQ.js +19 -0
- package/dist/chunks/chunk-D6MQTNJ3.js +9 -0
- package/dist/chunks/chunk-DNXKIIV7.js +3 -0
- package/dist/chunks/{chunk-OI2N2636.js → chunk-EWS7MXTM.js} +1 -1
- package/dist/chunks/chunk-F2AG46CV.js +2 -0
- package/dist/chunks/{chunk-CR6CDOKS.js → chunk-F5DUN73H.js} +2 -2
- package/dist/chunks/chunk-FKCWOASO.js +49 -0
- package/dist/chunks/chunk-FOEUDMME.js +2678 -0
- package/dist/chunks/chunk-H6W55CQG.js +2 -0
- package/dist/chunks/chunk-HK3WGUKK.js +17 -0
- package/dist/chunks/{chunk-ZEVARU6J.js → chunk-HO5L2FUU.js} +1 -1
- package/dist/chunks/chunk-HP2D3W2B.js +42 -0
- package/dist/chunks/chunk-ICZEOMPO.js +2 -0
- package/dist/chunks/{chunk-X2B4MN6W.js → chunk-IV7F74JJ.js} +1 -1
- package/dist/chunks/chunk-JBHAU7PH.js +2409 -0
- package/dist/chunks/chunk-JO7GRBOG.js +2 -0
- package/dist/chunks/{chunk-KPDWQCF6.js → chunk-KE5RH6JA.js} +1 -1
- package/dist/chunks/chunk-KUKOZJIR.js +2 -0
- package/dist/chunks/chunk-L4BYPZ4U.js +22 -0
- package/dist/chunks/{chunk-2CXJK2M3.js → chunk-LL4QP2IM.js} +1 -1
- package/dist/chunks/{chunk-Z2BYC6TP.js → chunk-LZSY5IM3.js} +1 -1
- package/dist/chunks/chunk-M7PBDRKC.js +2 -0
- package/dist/chunks/{chunk-OJVIH7J6.js → chunk-MCRA6ZGJ.js} +1 -1
- package/dist/chunks/chunk-NPOHW5OU.js +2 -0
- package/dist/chunks/{chunk-KIGN4FI6.js → chunk-OGXSE57Z.js} +1 -1
- package/dist/chunks/{chunk-HZP5U2AA.js → chunk-P653BXMY.js} +1 -1
- package/dist/chunks/{chunk-YF6IDYTS.js → chunk-PGKEDR3S.js} +1 -1
- package/dist/chunks/chunk-PMZH2TKS.js +4 -0
- package/dist/chunks/chunk-TYWBEJOA.js +3 -0
- package/dist/chunks/chunk-USWZ3KUC.js +2 -0
- package/dist/chunks/chunk-UWO34HP6.js +33 -0
- package/dist/chunks/{chunk-Z6ZR5O3J.js → chunk-VW7D3DRM.js} +2 -2
- package/dist/chunks/chunk-W4IL6TWB.js +186 -0
- package/dist/chunks/chunk-WVNN3RB2.js +2 -0
- package/dist/chunks/{chunk-RAWEO7SJ.js → chunk-WWABOVRW.js} +2 -2
- package/dist/chunks/{chunk-B3O2GAQH.js → chunk-XLDW5NN3.js} +1 -1
- package/dist/chunks/chunk-YSYXIJ46.js +8 -0
- package/dist/chunks/{chunk-V62BHD5G.js → chunk-ZC57DX6D.js} +1 -1
- package/dist/chunks/{chunk-W5NQ2DI7.js → chunk-ZJY2L43W.js} +3 -3
- package/dist/chunks/cli-5QR7QNQJ.js +2 -0
- package/dist/chunks/{configuration-command-LDPUCHVH.js → configuration-command-MVZS625X.js} +1 -1
- package/dist/chunks/connected-evidence-7LHUZ2UI.js +2 -0
- package/dist/chunks/{continual-MHMPLLUZ.js → continual-K5JNHNQH.js} +3 -3
- package/dist/chunks/core-commands-J2SJM5I5.js +2 -0
- package/dist/chunks/datasets-KDN2EXHE.js +2 -0
- package/dist/chunks/desktop-test-WIOEKMPR.js +3 -0
- package/dist/chunks/dist-3MTJ7VM6.js +2 -0
- package/dist/chunks/{dist-ELWB75PL.js → dist-JBE7DPFZ.js} +1 -1
- package/dist/chunks/evaluation-coordination-NGYHL7HG.js +2 -0
- package/dist/chunks/experiment-improvements-2M7GRGWS.js +2 -0
- package/dist/chunks/experiments-B6CRZ3GI.js +2 -0
- package/dist/chunks/{extension-JEUZZJ5X.js → extension-RZTMK3ON.js} +1 -1
- package/dist/chunks/{help-4F4QGL4C.js → help-EISFHH2F.js} +1 -1
- package/dist/chunks/hosted-experiment-improvement-6CHH65DX.js +3 -0
- package/dist/chunks/hosted-harness-runtime-PAYMAXH7.js +2 -0
- package/dist/chunks/hosted-profile-candidate-HYEISIAC.js +3 -0
- package/dist/chunks/hosted-profile-compiler-KQREWJA5.js +2 -0
- package/dist/chunks/hosted-profile-evaluation-control-LV6YXOG7.js +2 -0
- package/dist/chunks/hosted-profile-evaluation-inspection-A62UYFEP.js +3 -0
- package/dist/chunks/hosted-profile-evaluation-preparation-OR4OLYEX.js +3 -0
- package/dist/chunks/human-review-J6JGNRBR.js +2 -0
- package/dist/chunks/import-YHSX6SBZ.js +4 -0
- package/dist/chunks/learning-REL6GGNA.js +2 -0
- package/dist/chunks/opchat-CUZUU2WM.js +3 -0
- package/dist/chunks/organizations-VT27V4B2.js +2 -0
- package/dist/chunks/{profile-ESULTWDN.js → profile-N2E5ASHQ.js} +1 -1
- package/dist/chunks/project-agent-XMXOBJSC.js +2 -0
- package/dist/chunks/sandbox-command-NC665ZZ5.js +2 -0
- package/dist/chunks/{sandbox-template-7WHGNVM6.js → sandbox-template-OTP6S3RU.js} +1 -1
- package/dist/chunks/src-TNWF3IC5.js +329 -0
- package/dist/chunks/{src-A3OVZOSV.js → src-WM35IF4W.js} +5 -5
- package/dist/chunks/taskset-COAPMTT3.js +2 -0
- package/dist/chunks/{teams-bot-YMCDLBGT.js → teams-bot-ACWJ7PJP.js} +1 -1
- package/dist/chunks/training-4JUK7YQV.js +2 -0
- package/dist/chunks/{workspaces-ZZ7R5BUL.js → workspaces-WTPFRJMS.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/web/assets/App-CdDQ-lXE.css +1 -0
- package/dist/web/assets/App-D2f8_mGk.js +235 -0
- package/dist/web/assets/{AppDialog-CV3ddujB.js → AppDialog-CaxeNfsu.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-dhbGOO_K.js → AppTerminalPanel-dtK0ZPer.js} +2 -2
- package/dist/web/assets/{AppsView-Bxa-9BF2.js → AppsView-DwK1UBJP.js} +1 -1
- package/dist/web/assets/BrowserSidebar-Cj9VnkgU.js +1 -0
- package/dist/web/assets/{CartesianChart-BOxN-Su1.js → CartesianChart-Drfk6jTn.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-DTmJvNJx.js → CollaborationTabs-Czh2noeb.js} +1 -1
- package/dist/web/assets/{CommandMenu-DggN2ygj.js → CommandMenu-D-M-xomh.js} +1 -1
- package/dist/web/assets/CommunityView-BrdxUI5Z.js +1 -0
- package/dist/web/assets/ComposerCreateImproveStrip-CJ8nkYJf.js +1 -0
- package/dist/web/assets/GetStartedView-u7Jw7YA1.js +1 -0
- package/dist/web/assets/HostedModelLearningReview-D0a2nwse.js +1 -0
- package/dist/web/assets/HostedModelLearningSettings-CQQGyjxi.js +1 -0
- package/dist/web/assets/LabModelVersionDetailPage-Cxlc4sSC.js +1 -0
- package/dist/web/assets/LabSkillSidebar-BnJkDb0c.js +1 -0
- package/dist/web/assets/LabsRoute-ACN76d2j.css +1 -0
- package/dist/web/assets/LabsRoute-hHwZNbqN.js +99 -0
- package/dist/web/assets/MainChatThread-r_TYiTnW.js +2 -0
- package/dist/web/assets/MainPane-DJcd4tPk.js +19 -0
- package/dist/web/assets/MainPane-DOWsSew1.css +1 -0
- package/dist/web/assets/{MarkdownText-BhzHRq1J.js → MarkdownText-BxPHz4je.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-LU-PhEhW.js → NativeSkillSidebar-CCHK6kMG.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-Bi_gpHLG.js → NewExperienceSwitcher-CuKWTDZj.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-B8pWvSkq.js → NewProjectDialog-CS6sw2oD.js} +1 -1
- package/dist/web/assets/OutputsPage-JDM5bfLJ.js +1 -0
- package/dist/web/assets/{ProjectsPage-Ca8_iEWu.js → ProjectsPage-B3zTBHOA.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-L8S3yj1u.js +1 -0
- package/dist/web/assets/{RightSidebarHomePanel-6pygznxX.js → RightSidebarHomePanel-BWJQKFUp.js} +1 -1
- package/dist/web/assets/ScheduledWorkPage-qX12p4B0.js +1 -0
- package/dist/web/assets/SettingsView-0KMs-r2I.js +9 -0
- package/dist/web/assets/SettingsView-CVsuQeCZ.css +1 -0
- package/dist/web/assets/{TeamChatView-BGLCPTen.js → TeamChatView-DakXCNQE.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-DHkS2cVJ.js → TerminalOverlay-DaonK5C0.js} +12 -12
- package/dist/web/assets/{TrainingCreationPanel-Dneamjzh.js → TrainingCreationPanel-CUvSsSwp.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-Cfh59jLZ.js → TrainingDraftPanel-DNivtVwd.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-C9l1KY-O.js → UsageSettingsSection-rbmuoPoE.js} +1 -1
- package/dist/web/assets/WorkSidebarPanel-DrYt9xzv.js +1 -0
- package/dist/web/assets/WorkspaceDiffPanel-CThoTqe4.js +14 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-DeODKxvW.js +32 -0
- package/dist/web/assets/{WorkspaceGitDialogs-mE3Og6Zo.js → WorkspaceGitDialogs-CBarJYF-.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-DPZ0n0G9.js → WorkspaceMonacoEditor-Hmu5m_sO.js} +3 -3
- package/dist/web/assets/{arrow-up-right-DU2KsZD-.js → arrow-up-right-BV2IHfb9.js} +1 -1
- package/dist/web/assets/chunk-YTGRET2L-PKzEfYnf.js +1 -0
- package/dist/web/assets/{clipboard-g2b4_k81.js → clipboard-DDIvAWKp.js} +1 -1
- package/dist/web/assets/{cloud-upload-P2bDOPsQ.js → cloud-upload-Dv6kFnfC.js} +1 -1
- package/dist/web/assets/{cssMode-CPbPVAUt.js → cssMode-BK0jFqWW.js} +1 -1
- package/dist/web/assets/{folder-open-BmsONNsr.js → folder-open-B9ixJQJX.js} +1 -1
- package/dist/web/assets/{folder-plus-B18NgUxy.js → folder-plus-DqSKvtNB.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-enxGCV_e.js → git-commit-horizontal-C1lQvfxe.js} +1 -1
- package/dist/web/assets/{htmlMode-DiV88uQv.js → htmlMode-CCV301b6.js} +1 -1
- package/dist/web/assets/index-1cMIFBxZ.css +1 -0
- package/dist/web/assets/{index-vfpCN9zy.js → index-DIaKfM8a.js} +2 -2
- package/dist/web/assets/{info-DmuSBIYe.js → info-BEvaynAD.js} +1 -1
- package/dist/web/assets/{jsonMode-BaeOjuKU.js → jsonMode-Co4pyN4F.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-D8To0CQA.js → lspLanguageFeatures-CSU0G5da.js} +1 -1
- package/dist/web/assets/{minimize-2-C2xnEzCe.js → minimize-2-DT8t8wwP.js} +1 -1
- package/dist/web/assets/{monaco.contribution-JW3MxX6k.js → monaco.contribution-CBwGIQY1.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DgTFvG2Q.js → monaco.contribution-Cr0AaHCD.js} +2 -2
- package/dist/web/assets/{monaco.contribution-bytkwn0O.js → monaco.contribution-DSBAb_PC.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DbrACt99.js → monaco.contribution-DUZrs1D-.js} +2 -2
- package/dist/web/assets/{monitor-mtHVW7gU.js → monitor-DGqnfsK9.js} +1 -1
- package/dist/web/assets/play-C1XWyKh6.js +1 -0
- package/dist/web/assets/{python-DAPe0Urm.js → python-Z1foxLdf.js} +1 -1
- package/dist/web/assets/{save-B2eVAjW6.js → save-CX2kF74j.js} +1 -1
- package/dist/web/assets/{square-16bX2k2i.js → square-DMkXeYeV.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-Ce0YhEQg.js → toggleHighContrast-CRMVp779.js} +1 -1
- package/dist/web/assets/{tsMode-CnvMmHz6.js → tsMode-Czu8YAqh.js} +1 -1
- package/dist/web/assets/{upload-COPbAaD-.js → upload-giKOPnl1.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-C-Wjm5HK.js → useLocalAgentSchedules-BHxWmOeC.js} +1 -1
- package/dist/web/assets/{useSessionTurnCache-BfVbncMB.js → useSessionTurnCache-CUYFsu_W.js} +1 -1
- package/dist/web/assets/{wifi-off-C9iLbCC-.js → wifi-off-DbDXaV1N.js} +1 -1
- package/dist/web/assets/{workers-BXh_u8Fr.js → workers-Cno4XklJ.js} +1 -1
- package/dist/web/assets/{yaml-CRSr9x6_.js → yaml-C28t_C6h.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/command-reference.md +99 -0
- package/package.json +4 -3
- package/dist/chunks/actions-command-5IEZEP6W.js +0 -2
- package/dist/chunks/app-server-runtime-NQ2BYPGK.js +0 -2
- package/dist/chunks/apps-XQ7PHJTD.js +0 -2
- package/dist/chunks/chunk-36RCXSEJ.js +0 -2
- package/dist/chunks/chunk-3QC2DDQ5.js +0 -2
- package/dist/chunks/chunk-3XDFNA7W.js +0 -2
- package/dist/chunks/chunk-4S4WH65X.js +0 -3
- package/dist/chunks/chunk-4TMC5F2P.js +0 -5
- package/dist/chunks/chunk-65BW2QXY.js +0 -2
- package/dist/chunks/chunk-65QCNUGE.js +0 -659
- package/dist/chunks/chunk-6XF4GI35.js +0 -2
- package/dist/chunks/chunk-ALZRXBEC.js +0 -33
- package/dist/chunks/chunk-ARJUNUH6.js +0 -5
- package/dist/chunks/chunk-CEEZ7Y2J.js +0 -2
- package/dist/chunks/chunk-DZVVGU6K.js +0 -8
- package/dist/chunks/chunk-HY2Q7EDK.js +0 -4
- package/dist/chunks/chunk-IT4AT6LB.js +0 -42
- package/dist/chunks/chunk-KRC2S5QF.js +0 -5
- package/dist/chunks/chunk-L6HCBIAU.js +0 -2
- package/dist/chunks/chunk-LNEOLOK2.js +0 -13
- package/dist/chunks/chunk-MTJNKRXL.js +0 -22
- package/dist/chunks/chunk-NM2GYDPA.js +0 -19
- package/dist/chunks/chunk-OMM4ZO7E.js +0 -2182
- package/dist/chunks/chunk-OQPFFKU6.js +0 -2
- package/dist/chunks/chunk-QID62K65.js +0 -2400
- package/dist/chunks/chunk-YOOPTMQK.js +0 -3
- package/dist/chunks/cli-OJU6NQSA.js +0 -2
- package/dist/chunks/core-commands-UZL5RF2M.js +0 -2
- package/dist/chunks/datasets-42AZHVSV.js +0 -13
- package/dist/chunks/desktop-test-DI76HKS7.js +0 -3
- package/dist/chunks/dist-6YP37XI5.js +0 -2
- package/dist/chunks/experiments-Z3S35BYN.js +0 -2
- package/dist/chunks/hosted-harness-runtime-VZNYNQ6T.js +0 -2
- package/dist/chunks/hosted-profile-compiler-JXLPR7SX.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-control-Q54YXXIM.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-inspection-7WESM3ZH.js +0 -3
- package/dist/chunks/hosted-profile-evaluation-preparation-QP24PYBL.js +0 -3
- package/dist/chunks/opchat-UFWWVJL6.js +0 -3
- package/dist/chunks/organizations-SBBIOF6O.js +0 -2
- package/dist/chunks/project-agent-IBHUQ3JX.js +0 -2
- package/dist/chunks/sandbox-command-PAJAIMWM.js +0 -2
- package/dist/chunks/src-5MJSO3UD.js +0 -326
- package/dist/chunks/taskset-BZYQT65N.js +0 -2
- package/dist/chunks/training-7PST5HZU.js +0 -2
- package/dist/web/assets/App-6AQXN2SM.js +0 -226
- package/dist/web/assets/App-7h_oHCFd.css +0 -1
- package/dist/web/assets/BrowserSidebar-BLwL2FOG.js +0 -1
- package/dist/web/assets/CommunityView-CuDrYOIf.js +0 -1
- package/dist/web/assets/ComposerCreateImproveStrip-BrduENlL.js +0 -1
- package/dist/web/assets/GetStartedView-Db1IEWzv.js +0 -1
- package/dist/web/assets/HostedModelLearningReview-kofNdPAe.js +0 -1
- package/dist/web/assets/HostedModelLearningSettings-6ij3nwWD.js +0 -1
- package/dist/web/assets/LabModelVersionDetailPage-C7Maqcit.js +0 -1
- package/dist/web/assets/LabSkillSidebar-Bz0U-Nmw.js +0 -1
- package/dist/web/assets/LabsRoute-Ch1N-e2S.js +0 -52
- package/dist/web/assets/LabsRoute-Dw6-12kt.css +0 -1
- package/dist/web/assets/MainChatThread-BJbhZOvs.js +0 -2
- package/dist/web/assets/MainPane-Cs2Kng_k.js +0 -19
- package/dist/web/assets/OutputsPage-BkGI0kHp.js +0 -1
- package/dist/web/assets/RightChatPanelStack-DjEdxsq8.js +0 -1
- package/dist/web/assets/ScheduledWorkPage-BSiOxxAH.js +0 -1
- package/dist/web/assets/SettingsView-1XN7KLBl.js +0 -9
- package/dist/web/assets/SettingsView-C7av3zwv.css +0 -1
- package/dist/web/assets/WorkSidebarPanel-CEnO-Txp.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-BiuQBflC.js +0 -14
- package/dist/web/assets/WorkspaceEnvironmentMenu-Dr-E0c1j.js +0 -32
- package/dist/web/assets/index-B9VSiz_z.css +0 -1
- package/dist/web/assets/refresh-cw-Dvm_Pq3U.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{n as b,o as E,r as x,u as T,w as C,x as _}from"./chunk-JO7GRBOG.js";import{Y as M,h as S,i as A}from"./chunk-BQNK2NMB.js";import{h as k,l as m,m as y}from"./chunk-P653BXMY.js";import{b as p}from"./chunk-ES2ISFJC.js";import{a as g}from"./chunk-FTQLQJQV.js";var w=p.object({sessionId:p.string().trim().min(1).max(500),turnId:p.string().trim().min(1).max(500)}).strict();async function $(e){T(e.manifest,e.taskset,e.catalog),_(e.taskset,e.metricSource);let o=e.manifest.profileEvaluation,t=e.catalog.definitions.find(r=>r.id===o.definitionId),d=new Map(e.taskset.tasks.map(r=>[r.id,r])),u=[],s=[];for(let r of e.manifest.population){e.signal?.throwIfAborted();let l=d.get(r.taskId),a=await e.loadCompletedMember?.(r)??null;if(a){let{receipt:f,grade:I}=a,{contentHash:P,...U}=S.parse(I);if(!E(f)||P!==m(U)||f.id!==r.receiptId||f.runManifest.id!==e.manifest.id||f.runManifest.contentHash!==e.manifest.contentHash||f.taskId!==r.taskId||f.seed!==r.seed||f.graderEvidenceRefs.length!==1||f.graderEvidenceRefs[0]?.contentHash!==P||I.taskHash!==m(l)||I.graderSetHash!==m(e.taskset.graders)||f.metadata.score!==I.score||f.metadata.passed!==I.passed)throw new Error(`Retained Profile evaluation member ${r.receiptId} differs from its admitted evidence.`);s.push(I),u.push(f);continue}let i=await e.execute({task:M(l),seed:r.seed,source:o,...e.signal?{signal:e.signal}:{}});e.signal?.throwIfAborted();let c=await A({task:l,evidence:i.evidence,graders:e.taskset.graders,...e.modelJudge?{modelJudge:e.modelJudge}:{},...e.customVerifier?{customVerifier:e.customVerifier}:{},...e.signal?{signal:e.signal}:{}}),v=k.parse(await e.saveGrade(c));if(v.contentHash!==c.contentHash)throw new Error("Stored Profile evaluation grade differs from its graded evidence.");let H=i.failureClass??c.failureClass,R=b({schemaVersion:"openpond.attemptReceipt.v1",id:r.receiptId,runManifest:{id:e.manifest.id,contentHash:e.manifest.contentHash},taskId:r.taskId,seed:r.seed,terminal:i.terminal,failureClass:H,outputHash:i.evidence.infrastructureError?null:m(i.evidence.output),traceHash:i.traceHash,artifactRefs:i.artifactRefs,graderEvidenceRefs:[v],startedAt:i.startedAt,completedAt:i.completedAt,latencyMs:i.latencyMs,costUsd:i.costUsd,metadata:{gradingRole:"evaluation",score:c.score,passed:c.passed,rewardEligible:c.rewardEligible,sourceRevision:o.sourceRevision,definitionHash:o.definitionHash,environmentHash:o.environmentHash,...i.retainedEvidenceRef?{retainedEvidenceRef:w.parse(i.retainedEvidenceRef)}:{}}});await e.saveReceipt(R),s.push(c),u.push(R)}let n=await C({manifest:e.manifest,taskset:e.taskset,receipts:u,...e.metricSource!==void 0?{source:e.metricSource}:{},...e.signal?{signal:e.signal}:{}},e.metricExecutor),h=s.filter(r=>r.passed).length/s.length;return{receipts:u,grades:s,metric:n,passRate:h,passed:h>=t.criterion.minimumPassRate&&(!t.criterion.requireComplete||u.every(r=>r.terminal))}}g($,"executeProfileEvaluationRun");function V(e,o){if(o==="agent_action"){let t=e.find(d=>d.name==="workspace_action_result"&&d.action==="profile_workflow_action")?.output;if(typeof t!="string")throw new Error("Profile Agent action evaluation did not produce a released action result.");return t}return e.filter(t=>t.name==="assistant.delta"&&typeof t.output=="string").map(t=>t.output??"").join("")}g(V,"profileEvaluationOutput");async function L(e){let{store:o,manifest:t,receipt:d}=e;if(!d.metadata.retainedEvidenceRef)return null;let u=w.parse(d.metadata.retainedEvidenceRef),[s,n]=await Promise.all([o.getSession(u.sessionId),o.getTurn(u.turnId)]),h=s?.metadata?.profileEvaluationRun,r=t.profileEvaluation;if(!s||!n||n.sessionId!==s.id||!r||!s.currentProfile||m(s.currentProfile)!==m(e.profileRef)||m(h)!==m({id:t.id,contentHash:t.contentHash})||s.metadata?.taskId!==d.taskId||s.metadata?.seed!==d.seed||!n.completedAt||n.completedAt!==d.completedAt||n.startedAt!==d.startedAt||!n.harnessSnapshot||n.harnessSnapshot.harnessRelease.id!==r.harnessRelease.id||n.harnessSnapshot.harnessRelease.contentHash!==r.harnessRelease.contentHash||t.policy.kind!=="model"||!n.modelRef||n.modelRef.providerId!==t.policy.model.provider||n.modelRef.modelId!==t.policy.model.model)throw new Error("Retained Profile policy turn differs from its admitted case.");let l=await o.runtimeEventsForTurn(n.id);if(l.some(f=>f.turnId!==n.id)||m(l)!==d.traceHash)throw new Error("Retained Profile policy trace differs from its immutable receipt.");let a=V(l,r.target.kind);if(d.outputHash!==null&&m({text:a})!==d.outputHash)throw new Error("Retained Profile output differs from its immutable receipt.");let i=await o.listModelUsageRecords({sessionId:s.id,turnId:n.id,limit:1e4}),c=e.eventAfterId?l.findIndex(f=>f.id===e.eventAfterId):-1;if(e.eventAfterId&&c<0)throw new Error("Profile trace cursor is unavailable in this case.");let v=c+1,H=Math.max(1,Math.min(250,e.eventLimit??100)),R=l.slice(v,v+H);return{ref:u,prompt:n.prompt,output:d.outputHash===null?null:{text:a},partialOutput:d.outputHash===null&&a?{text:a}:null,error:n.error,events:R,eventCount:l.length,nextEventCursor:v+R.length<l.length?R.at(-1).id:null,usage:i,usageCoverage:i.length===1e4?"partial":"complete"}}g(L,"readProfileEvaluationPolicyEvidence");var te=p.object({runId:p.string().trim().min(1).max(240),receiptId:p.string().trim().min(1).max(500).optional(),eventAfterId:p.string().trim().min(1).max(500).optional(),eventLimit:p.number().int().min(1).max(250).optional(),manifest:x.optional()}).strict().refine(e=>e.receiptId||!e.eventAfterId&&!e.eventLimit,"Select a case before requesting its trace page.").refine(e=>!e.manifest||e.receiptId,"Interrupted-run inspection requires one exact case.");async function re(e){let o=await e.store.getProfileEvaluationRun(e.runId);if(o&&m(o.profileRef)!==m(e.profileRef))throw new Error("Profile evaluation run is unavailable in the selected Profile.");let t=o?.manifest??e.manifest;if(!t||!o&&!e.receiptId)throw new Error("Profile evaluation run is unavailable in the selected Profile.");if(o){if(e.manifest&&e.manifest.contentHash!==o.manifest.contentHash)throw new Error("Profile evaluation run differs from its pinned manifest.")}else if(y(t,"Interrupted Profile evaluation manifest"),t.id!==e.runId||t.profileEvaluation?.profileId!==e.profileRef.profileId||e.profileRef.source==="openpond_git"&&t.metadata.profileRepositoryId!==e.profileRef.repositoryId)throw new Error("Profile evaluation run is unavailable in the selected Profile.");let d=t.population.map((s,n)=>({member:s,index:n})).filter(({member:s})=>!e.receiptId||s.receiptId===e.receiptId);if(e.receiptId&&d.length!==1)throw new Error("Profile evaluation case is unavailable in the selected run.");let u=await Promise.all(d.map(async({member:s,index:n})=>{let h=o?null:await e.store.getProfileEvaluationReceipt(s.receiptId),r=o?.receiptRefs[n]??(h?{id:h.id,contentHash:h.contentHash}:null),l=o?.gradeRefs[n]??h?.graderEvidenceRefs[0];if(!r||!l)throw new Error("Profile evaluation run has incomplete case evidence.");let[a,i]=await Promise.all([e.store.getProfileEvaluationReceipt(r.id),e.store.getProfileEvaluationGrade(l.contentHash)]);if(!a||!o&&!E(a)||a.contentHash!==r.contentHash||a.id!==s.receiptId||a.taskId!==s.taskId||a.seed!==s.seed||a.runManifest.id!==t.id||a.runManifest.contentHash!==t.contentHash||!i||i.contentHash!==l.contentHash||!a.graderEvidenceRefs.some(c=>c.id===l.id&&c.contentHash===l.contentHash))throw new Error("Profile evaluation case evidence differs from its retained run.");return{taskId:s.taskId,seed:s.seed,receiptId:a.id,receiptHash:a.contentHash,traceHash:a.traceHash,outputHash:a.outputHash,score:i.score,passed:i.passed,gradingStatus:i.gradingStatus,failureClass:i.failureClass,artifactCount:a.artifactRefs.length,latencyMs:a.latencyMs,costUsd:a.costUsd,terminal:a.terminal,feedback:i.components.map(c=>({graderId:c.graderId,graderVersion:c.graderVersion,score:c.score,passed:c.passed,feedback:c.feedback})),...e.receiptId?{receipt:a,evidence:await L({store:e.store,profileRef:e.profileRef,manifest:t,receipt:a,eventAfterId:e.eventAfterId,eventLimit:e.eventLimit})}:{}}}));return{runId:t.id,sourceRevision:t.profileEvaluation?.sourceRevision??null,cases:u}}g(re,"inspectProfileEvaluationRun");export{$ as a,V as b,te as c,re as d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{
|
|
3
|
-
`)}t(H,"runHostedProfileCompilerCli");async function y(e){await(await import("./hosted-profile-evaluation-preparation-
|
|
2
|
+
import{la as l,pa as c}from"./chunk-JBHAU7PH.js";import{N as n}from"./chunk-ZJY2L43W.js";import{a as t}from"./chunk-FTQLQJQV.js";import{mkdir as f}from"node:fs/promises";import p from"node:path";import a from"node:path";function d(e,o){let i=a.resolve(e),r=a.resolve(o);return r===i||r.startsWith(`${i}${a.sep}`)}t(d,"isHostedProfileSourceWithinRepo");async function u(e){if(!p.isAbsolute(e.repoPath)||!p.isAbsolute(e.outputDir)||!/^[a-f0-9]{40,64}$/.test(e.sourceRevision)||!e.workspaceId.trim()||!e.repositoryId.trim()||!e.profileId.trim())throw new Error("Hosted Profile compile request is invalid.");let o=await n({repoPath:e.repoPath,profileId:e.profileId});if(o.error||o.mode!=="local"||o.activeProfile!==e.profileId||!o.sourcePath||!d(e.repoPath,o.sourcePath))throw new Error("Hosted Profile source is unavailable.");await f(e.outputDir,{recursive:!0});let i=await l({storeDir:e.outputDir,workspaceId:e.workspaceId,name:e.profileId,profile:o,sourceRevision:e.sourceRevision,repositoryId:e.repositoryId}),r=i.harnessRelease.metadata.profile;if(!r||typeof r!="object"||r.id!==e.profileId||r.sourceRevision!==e.sourceRevision||r.repositoryId!==e.repositoryId)throw new Error("Hosted Profile release provenance is invalid.");let s=await c({storeDir:e.outputDir,workspaceId:e.workspaceId,compiled:i,createdAt:new Date().toISOString()});return{workspaceId:e.workspaceId,sourceRevision:s.sourceRevision,harnessRelease:s.harnessRelease,agentSnapshot:s.agentSnapshot,bundlePath:s.bundlePath}}t(u,"compileHostedProfileRelease");async function H(e){if(e.length!==1||e[0].length>16e3||!/^[A-Za-z0-9_-]+$/.test(e[0]))throw new Error("Hosted Profile compile argument is invalid.");let o=JSON.parse(Buffer.from(e[0],"base64url").toString("utf8")),i=await u(o);process.stdout.write(`${JSON.stringify(i)}
|
|
3
|
+
`)}t(H,"runHostedProfileCompilerCli");async function y(e){await(await import("./hosted-profile-evaluation-preparation-OR4OLYEX.js")).runHostedProfileEvaluationCli(e)}t(y,"runHostedProfileEvaluationCli");async function k(e){await(await import("./hosted-profile-evaluation-inspection-A62UYFEP.js")).runHostedProfileInspectionCli(e)}t(k,"runHostedProfileInspectionCli");export{u as a,H as b,y as c,k as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{c as B}from"./chunk-
|
|
2
|
+
import{c as B}from"./chunk-USWZ3KUC.js";import{e as D,f as k,g as K}from"./chunk-BSHAIAXY.js";import{f as w}from"./chunk-3M53YXEI.js";import{$ as N,W as y,X as L,Y as U,Z as M,_ as $,f as T,g as A,j as I,u as _}from"./chunk-LZSY5IM3.js";import{d as O}from"./chunk-6SJZXZNA.js";import{b as v}from"./chunk-GLUWATL5.js";import{h as C}from"./chunk-Z3D4C7BG.js";import{a as o}from"./chunk-FTQLQJQV.js";function ce(e){if(e.repoUrl)return e.repoUrl;if(e.gitHost&&e.gitOwner&&e.gitRepo)return`https://${e.gitHost}/${e.gitOwner}/${e.gitRepo}.git`;throw new Error("repoUrl missing from API response")}o(ce,"resolveRepoUrl");function le(e,t){let n=new URL(e),r=encodeURIComponent(t);return`${n.protocol}//x-access-token:${r}@${n.host}${n.pathname}`}o(le,"formatTokenizedRepoUrl");function fe(e){let t=new URL(e);return`${t.protocol}//x-access-token:$OPENPOND_API_KEY@${t.host}${t.pathname}`}o(fe,"formatTokenizedRepoUrlForPrint");function me(e){return e.replace(/x-access-token:[^@]+@/g,"x-access-token:***@")}o(me,"redactToken");function pe(e){let t=process.env.OPENPOND_BASE_URL;if(t)try{let n=new URL(t).hostname,r=new URL(e).hostname;n&&r&&n!==r&&(console.warn(`warning: repo host (${r}) does not match OPENPOND_BASE_URL (${n})`),console.warn("warning: verify your git host configuration matches OPENPOND_BASE_URL."))}catch{}}o(pe,"warnOnRepoHostMismatch");function W(e){let t=e.split("/").filter(Boolean);if(t.length!==2)throw new Error("expected <handle>/<repo>");return{handle:t[0],repo:t[1]}}o(W,"parseHandleRepo");function S(e){return(e||"").trim().toLowerCase()}o(S,"normalizeRepoName");async function ee(e){if(!e.forceRefresh){let n=await L({apiBase:e.apiBase,apiKey:e.apiKey,ttlMs:y});if(n)return n}let t=await I(e.apiBase,e.apiKey);return await U({apiBase:e.apiBase,apiKey:e.apiKey,apps:t}),t}o(ee,"fetchAppsWithCache");async function Re(e){if(!e.forceRefresh){let r=await M({apiBase:e.apiBase,apiKey:e.apiKey,ttlMs:y});if(r)return r}let t=await _(e.apiBase,e.apiKey),n=Array.isArray(t.tools)?t.tools:[];return await $({apiBase:e.apiBase,apiKey:e.apiKey,tools:n}),n}o(Re,"fetchToolsWithCache");async function Pe(e,t,n){let{handle:r,repo:s}=W(n),i=await ee({apiBase:e,apiKey:t}),a=S(s),d=i.find(u=>u.handle&&u.handle!==r?!1:[u.repo,u.gitRepo,u.id].map(S).includes(a));if(!d)throw new Error(`app not found for ${r}/${s}`);return{app:d,handle:r,repo:s}}o(Pe,"resolveAppTarget");async function Ee(e){let t=e.intervalMs??5e3,n=e.timeoutMs??240*1e3,r=new Set,s=Date.now();for(;Date.now()-s<n;){let a=(await T(e.baseUrl,e.apiKey,e.deploymentId)).filter(u=>!r.has(u.id));for(let u of a)r.add(u.id);for(let u of a)console.log(`${e.prefix}${u.message}`);let d=await A(e.baseUrl,e.apiKey,e.deploymentId);if(d.status==="failed"){console.log(`${e.prefix}deployment failed`);return}if(d.status==="running"||d.status==="deployed"){console.log(`${e.prefix}deployment complete`);return}await new Promise(u=>setTimeout(u,t))}console.log(`${e.prefix}deployment still in progress`)}o(Ee,"pollDeploymentLogs");import{stdin as q,stdout as H}from"node:process";import{createInterface as F}from"node:readline/promises";async function z(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(String(t)));return Buffer.concat(e).toString("utf8").replace(/\r?\n$/,"")}o(z,"readAllStdin");function V(e){return new Promise((t,n)=>{let r=process.stdin,s=process.stderr,i="",a=r.isRaw;function d(){r.off("data",u),r.setRawMode&&r.setRawMode(a),r.pause(),s.write(`
|
|
3
3
|
`)}o(d,"cleanup");function u(m){let f=Buffer.isBuffer(m)?m:Buffer.from(m);for(let c of f){if(c===3){d(),n(new Error("secret prompt cancelled"));return}if(c===13||c===10){d(),t(i);return}if(c===127||c===8){i.length>0&&(i=i.slice(0,-1),s.write("\b \b"));continue}i+=Buffer.from([c]).toString("utf8"),s.write("*")}}o(u,"onData"),s.write(e),r.resume(),r.setRawMode&&r.setRawMode(!0),r.on("data",u)})}o(V,"readMaskedLine");async function Ae(e,t=!1){let n=F({input:q,output:H});try{let r=t?"[Y/n]":"[y/N]",s=(await n.question(`${e} ${r} `)).trim().toLowerCase();return s?s==="y"||s==="yes":t}finally{n.close()}}o(Ae,"promptConfirm");async function Ie(e){let t=F({input:q,output:H});try{return(await t.question(`Local path (default: ${e}): `)).trim()||e}finally{t.close()}}o(Ie,"promptForPath");var X=["readonly","attempt","feature","rollout","replay","template_build","scheduled_run","patch_only","hotfix","multi_feature_batch"],j=["none","manual","auto_after_checks"],G=[...N];function te(e,t){return(process.env.OPENPOND_SANDBOX_BASE_URL||process.env.OPENPOND_API_URL||e.apiBaseUrl||K(process.env.OPENPOND_BASE_URL||e.baseUrl)||v).replace(/\/$/,"")}o(te,"resolveSandboxBaseUrl");async function We(e){let t=await ne(e),n=k(t),r=await B(t,n),s=D(e)||process.env.OPENPOND_SANDBOX_API_URL?.trim()||null,i=te(t,e);return C(s?{apiKey:r,sandboxApiUrl:s}:{apiKey:r,baseUrl:i})}o(We,"resolveSandboxClient");async function ne(e){return O()}o(ne,"loadSandboxConfig");function qe(e){if(e===void 0)return;if(typeof e!="string"||!e.trim())throw new Error("workflow-mode must be a non-empty value");let t=e.trim();if(!X.includes(t))throw new Error(`workflow-mode must be one of ${X.join(", ")}`);return t}o(qe,"parseSandboxWorkflowModeOption");function He(e){if(e===void 0)return;if(typeof e!="string"||!e.trim())throw new Error("runtime-promotion-policy must be a non-empty value");let t=e.trim();if(!j.includes(t))throw new Error(`runtime-promotion-policy must be one of ${j.join(", ")}`);return t}o(He,"parseSandboxRuntimePromotionPolicyOption");function Fe(e){if(typeof e!="string"||!e.trim())return;let t=e.trim();if(!G.includes(t))throw new Error(`runtime-profile-id must be one of ${G.join(", ")}`);return t}o(Fe,"parseSandboxRuntimeProfileIdOption");function re(e){let t=Y(e.envRef,"env-ref").map(({name:i,value:a})=>({name:i,secretRef:a})),n=Y(e.envLiteral,"env-literal").map(({name:i,value:a})=>{if(oe(i)&&!w(e.allowPlainSecretEnv))throw new Error(`refusing plaintext value for secret-like env ${i}; create a sandbox secret and pass --env-ref ${i}=openpond://secret/...`);return{name:i,value:a}}),r=[...t,...n],s=new Set;for(let i of r){if(s.has(i.name))throw new Error(`duplicate sandbox env var: ${i.name}`);s.add(i.name)}return r}o(re,"parseSandboxEnvOptions");function ze(e,t){let n=re(t),r=new Set(n.map(a=>a.name)),s=new Map(n.map(a=>[a.name,a]));for(let a of e.inputs.env)if(s.get(a.name)?.value!==void 0&&a.secret!==!1)throw new Error(`sandbox template env ${a.name} requires a secret ref. Pass --env-ref ${a.name}=openpond://secret/...`);let i=e.inputs.env.filter(a=>a.required&&!r.has(a.name)).map(a=>a.name);if(i.length>0)throw new Error(`missing required sandbox template env refs: ${i.join(", ")}. Pass --env-ref NAME=openpond://secret/...`);return n}o(ze,"parseSandboxTemplateEnvOptions");function Y(e,t){return typeof e!="string"?[]:e.split(",").map(n=>n.trim()).filter(Boolean).map(n=>{let r=n.indexOf("=");if(r<=0)throw new Error(`${t} entries must use NAME=value`);let s=n.slice(0,r).trim(),i=n.slice(r+1).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(s))throw new Error(`${t} has invalid env name: ${s}`);if(!i)throw new Error(`${t} value is required for ${s}`);return{name:s,value:i}})}o(Y,"parseSandboxEnvAssignments");function oe(e){return/(?:SECRET|TOKEN|KEY|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|DATABASE_URL|DSN)/i.test(e)}o(oe,"isSecretLikeEnvName");async function Ve(e,t){if(typeof e.value=="string"||typeof e.secretValue=="string")throw new Error("sandbox secret values must be provided with --stdin or the masked prompt");if(w(e.stdin)){let s=await z();if(!s)throw new Error(`${t} read no secret value from stdin`);return s}if(!process.stdin.isTTY)throw new Error(`${t} requires --stdin when not running in a TTY`);let r=await V(`${t}: `);if(!r)throw new Error(`${t} cannot be empty`);return r}o(Ve,"readSandboxSecretValue");function Xe(e){return{id:e.id,teamId:e.teamId,name:e.name,scope:e.scope,status:e.status,secretRef:e.secretRef,currentVersion:e.currentVersion,updatedAt:e.updatedAt,lastUsedAt:e.lastUsedAt,attachedDestinations:e.attachments?.length??0}}o(Xe,"summarizeSandboxSecret");import{Buffer as b}from"node:buffer";import{spawn as Q}from"node:child_process";var ie=600*1e3,se=2*1024*1024;function R(e,t=[],n={}){return n.inherit&&n.terminateWhenStdoutIncludes!==void 0?Promise.reject(new Error("terminateWhenStdoutIncludes requires captured stdout")):n.terminateWhenStdoutIncludes===""?Promise.reject(new Error("terminateWhenStdoutIncludes must not be empty")):new Promise((r,s)=>{let i=Q(e,t,{cwd:n.cwd,env:n.env?{...process.env,...n.env}:void 0,shell:n.shell,detached:n.detached??process.platform!=="win32",stdio:n.inherit?"inherit":[n.stdin===void 0?"ignore":"pipe","pipe","pipe"]}),a=new h(J(n)),d=new h(J(n)),u=!1,m=n.timeoutMs??ie,f,c,x=null,g=!1,P=o(()=>{f&&clearTimeout(f),c&&clearTimeout(c)},"clearTimers"),E=o(l=>{x!==null||g||(x=l,u=l==="timeout",f&&(clearTimeout(f),f=void 0),Z(i.pid,"SIGTERM"),c=setTimeout(()=>{i.exitCode===null&&i.signalCode===null&&Z(i.pid,"SIGKILL")},5e3))},"requestTermination");m>0&&(f=setTimeout(()=>{E("timeout")},m)),n.inherit||(i.stdout?.on("data",l=>{a.append(l);let p=n.terminateWhenStdoutIncludes;p!==void 0&&a.text().includes(p)&&E("output")}),i.stderr?.on("data",l=>{d.append(l)})),i.on("error",l=>{P(),g=!0,s(l)}),i.on("close",(l,p)=>{g||(g=!0,P(),r({code:l,signal:p,terminationReason:x??(p?"signal":"exit"),stdout:a.text(),stderr:d.text(),timedOut:u,stdoutTruncated:a.truncated,stderrTruncated:d.truncated}))}),n.stdin!==void 0&&i.stdin?.end(n.stdin)})}o(R,"runProcessCommand");var h=class{static{o(this,"BoundedOutput")}#t=[];#n;#e=0;truncated=!1;constructor(t){this.#n=t}append(t){let n=b.isBuffer(t)?t:b.from(t),r=this.#n-this.#e;if(r<=0){n.byteLength>0&&(this.truncated=!0);return}if(n.byteLength<=r){this.#t.push(n),this.#e+=n.byteLength;return}this.#t.push(n.subarray(0,r)),this.#e+=r,this.truncated=!0}text(){let t=b.concat(this.#t,this.#e).toString("utf8");return this.truncated?`${t}
|
|
4
4
|
[truncated after ${this.#n} bytes]
|
|
5
5
|
`:t}};function J(e){let t=e.maxOutputBytes??se;return Math.max(0,Math.floor(t))}o(J,"maxOutputBytes");function Z(e,t){if(e){if(process.platform==="win32"){let n=["/PID",String(e),"/T"];t==="SIGKILL"&&n.push("/F"),Q("taskkill",n,{stdio:"ignore",windowsHide:!0}).unref();return}try{process.kill(-e,t)}catch(n){if(n.code!=="ESRCH")throw n}}}o(Z,"terminateProcessTree");async function ae(e,t,n={}){return R(e,t,{cwd:n.cwd,inherit:n.inherit,timeoutMs:n.timeoutMs,maxOutputBytes:n.maxOutputBytes,terminateWhenStdoutIncludes:n.terminateWhenStdoutIncludes})}o(ae,"runCommand");async function rt(e,t={}){let n=t.timeoutSeconds===void 0?void 0:t.timeoutSeconds*1e3;return R(e,[],{cwd:t.cwd,env:t.env,shell:!0,inherit:t.inherit,timeoutMs:n,maxOutputBytes:t.maxOutputBytes})}o(rt,"runShellCommand");async function ot(e,t){let n=await ae("git",["remote","get-url",t],{cwd:e});if(n.code!==0)return null;let r=n.stdout.trim();return r.length>0?r:null}o(ot,"getGitRemoteUrl");export{ce as a,le as b,fe as c,me as d,pe as e,S as f,ee as g,Re as h,Pe as i,Ee as j,Ae as k,Ie as l,We as m,qe as n,He as o,Fe as p,re as q,ze as r,Ve as s,Xe as t,R as u,ae as v,rt as w,ot as x};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{$a as N,Qa as z,Sa as P,Va as x,Ya as G,ab as J,bb as U,db as W,kb as $}from"./chunk-5ZZM3TUN.js";import{U as V,e as C,f as O,fa as M,g as F,ha as B,vb as L}from"./chunk-BQNK2NMB.js";import{j as E,k as H,l as h}from"./chunk-P653BXMY.js";import{a as l}from"./chunk-FTQLQJQV.js";import{constants as Q}from"node:fs";import{lstat as ie,open as ce,readdir as le}from"node:fs/promises";import A from"node:path";import{createHash as q}from"node:crypto";import{mkdir as K,readdir as ae,readFile as I,writeFile as X}from"node:fs/promises";import d from"node:path";async function je(e,t){let a=x.parse(e),r=["tasks","assets","environment","graders","rubrics","comparisons","metrics","fixtures"];await Promise.all(r.map(g=>K(d.join(t,g),{recursive:!0})));let o=await re(a,t);if(a.metrics.customAggregator){let g=d.join(t,a.metrics.customAggregator.module),k=q("sha256").update(await I(g)).digest("hex");a=x.parse({...a,metrics:{...a.metrics,customAggregator:{...a.metrics.customAggregator,contentHash:k}}})}let n=d.join(t,"taskset.json"),s=d.join(t,"tasks","tasks.jsonl"),f=d.join(t,"graders","graders.json"),i=d.join(t,"fixtures","grader-fixtures.json"),u=d.join(t,"metrics","policy.json"),c=d.join(t,"assets","manifest.json"),m=d.join(t,"environment","contract.json"),w=d.join(t,"rubrics","preference-review.md"),v=d.join(t,"comparisons","policy.json");return await Promise.all([...J(a)].map(([g,k])=>X(d.join(t,g),k,"utf8"))),{directory:t,files:[n,s,c,m,f,w,v,u,i,...o],draft:a}}l(je,"writeTasksetDraftPackage");async function Re(e){let t=await se(e),a=q("sha256");for(let r of t)a.update(d.relative(e,r).replaceAll(d.sep,"/")),a.update("\0"),a.update(await I(r)),a.update("\0");return a.digest("hex")}l(Re,"hashTasksetDraftPackage");async function Y(e,t){let a=d.basename(e)==="taskset.json"?e:d.join(e,"taskset.json"),r=d.dirname(a),o=l(async f=>{if(!t)return I(f,"utf8");let i=t.get(d.relative(r,f).replaceAll(d.sep,"/"));if(!i)throw Object.assign(new Error("Authored file is absent."),{code:"ENOENT"});return new TextDecoder("utf-8",{fatal:!0}).decode(i)},"read"),n=JSON.parse(await o(a)),s=x.safeParse(n);if(s.success){let[f,i,u,c,m,w]=await Promise.all([ne(d.join(r,"tasks","tasks.jsonl"),o),S(d.join(r,"graders","graders.json"),o),S(d.join(r,"fixtures","grader-fixtures.json"),o),S(d.join(r,"metrics","policy.json"),o),S(d.join(r,"environment","contract.json"),o),S(d.join(r,"comparisons","policy.json"),o)]);return x.parse({...s.data,...f===null?{}:{tasks:f},...i===null?{}:{graders:i},...u===null?{}:{graderFixtures:u},...c===null?{}:{metrics:c},...m===null?{}:{environment:m},...w===null?{}:{review:w}})}return $(n)}l(Y,"readTasksetDraftPackage");async function re(e,t){let a=N(e),r=[];for(let o of a){let n=d.join(t,o.relativePath);await K(d.dirname(n),{recursive:!0});try{await X(n,o.source,{encoding:"utf8",flag:"wx"})}catch(s){if(!oe(s))throw s}r.push(n)}return r}l(re,"writeConfiguredStarterCode");async function se(e){let t=[];async function a(r){let o=await ae(r,{withFileTypes:!0});o.sort((n,s)=>n.name.localeCompare(s.name));for(let n of o){let s=d.join(r,n.name);if(n.isSymbolicLink())throw new Error(`Taskset workspaces cannot contain symbolic links: ${s}`);n.isDirectory()?await a(s):n.isFile()&&t.push(s)}}return l(a,"visit"),await a(e),t}l(se,"packageFiles");async function S(e,t=a=>I(a,"utf8")){try{return JSON.parse(await t(e))}catch(a){if(Z(a))return null;throw a}}l(S,"readOptionalJson");async function ne(e,t=a=>I(a,"utf8")){try{return(await t(e)).split(/\r?\n/).map(r=>r.trim()).filter(Boolean).map(r=>JSON.parse(r))}catch(a){if(Z(a))return null;throw a}}l(ne,"readOptionalJsonLines");function Z(e){return e instanceof Error&&"code"in e&&e.code==="ENOENT"}l(Z,"isMissingFile");function oe(e){return e instanceof Error&&"code"in e&&e.code==="EEXIST"}l(oe,"isFileExists");async function Oe(e){let t=A.resolve(e.directory);if(!(await ie(t)).isDirectory())throw new Error("Dataset upload requires a regular authored folder.");let a=new Map,r=0;async function o(c,m){if(m>30)throw new Error("Dataset folder nesting exceeds 30 levels.");for(let w of(await le(c,{withFileTypes:!0})).sort((v,g)=>v.name<g.name?-1:v.name>g.name?1:0)){if(w.name.startsWith("."))throw new Error("Dataset folders cannot include hidden files or directories.");if(w.isSymbolicLink()||!w.isDirectory()&&!w.isFile())throw new Error("Dataset folders can contain only regular files and directories.");let v=A.join(c,w.name);if(w.isDirectory()){await o(v,m+1);continue}if(a.size>=1e4)throw new Error("Dataset folder exceeds 10,000 files.");let g=await ce(v,Q.O_RDONLY|Q.O_NOFOLLOW);try{let k=await g.stat();if(!k.isFile()||k.size>U-r)throw new Error("Dataset folder exceeds the 64 MiB capture limit.");let j=new Uint8Array(k.size),R=0;for(;R<j.length;){let D=await g.read(j,R,j.length-R,R);if(!D.bytesRead)throw new Error("Dataset file changed during capture.");R+=D.bytesRead}let _=await g.stat();if(_.size!==k.size||_.mtimeMs!==k.mtimeMs||_.ctimeMs!==k.ctimeMs)throw new Error("Dataset file changed during capture.");r+=j.length,a.set(A.relative(t,v).replaceAll(A.sep,"/"),j)}finally{await g.close()}}}l(o,"visit"),await o(t,0);let n=await Y(t,a),s=[...a].map(([c,m])=>({path:c,contentHash:H(m),sizeBytes:m.byteLength})),f=h(s),i=x.parse({...n,id:e.datasetId??n.id,profileId:e.teamId,revision:e.expectedRevision+1,modelScope:null,status:"draft",publishedTasksetRef:null,metadata:{...n.metadata,importedTasksetPackage:{packageHash:f}}});return{workspace:W({schemaVersion:"openpond.tasksetDraftWorkspace.v1",draft:i,files:[...a].filter(([c])=>!G(c)).map(([c,m])=>({path:c,base64:Buffer.from(m).toString("base64"),contentHash:H(m),sizeBytes:m.byteLength}))}),sourceHash:f,sourceFiles:s,capturedBytes:r}}l(Oe,"captureTasksetDraftWorkspace");async function ee(e){let{binding:t,rewards:a}=e.learning,r=M(t,a);if(e.graders.length!==r.length||r.some(({source:i,reward:u})=>!e.graders.some(c=>c.id===i.graderId&&c.version===String(u.revision)&&h(c.metadata.rewardBinding)===h(L(t)))))throw new Error("Prepared Taskset graders do not match their immutable Reward binding.");let o=V.parse({id:e.task.id,clusterKey:e.task.clusterKey,split:e.task.split,input:e.task.input,expectedOutput:e.task.expectedOutput,policyVisibleContext:e.task.policyVisibleContext,privilegedContextRef:e.task.privilegedContextRef,artifactRefs:[],tags:e.task.tags}),n=await B({binding:t,rewards:a,task:o,signal:e.signal,evidence:{output:e.attempt.output,artifactRefs:e.attempt.artifactRefs,runtimeEventRefs:e.attempt.runtimeEventRefs,infrastructureError:e.attempt.infrastructureError},customVerifier:e.customVerifier?async({grader:i})=>{let u=e.graders.find(m=>m.id===i.id);if(u?.kind!=="custom_verifier")throw new Error("Bound verifier projection is missing.");let c=await e.customVerifier({grader:u,task:e.task,attempt:e.attempt,signal:e.signal});return{score:c.score,passed:c.passed,rewardEligible:i.rewardEligible,failureClass:null,feedback:[c.feedback],visibleEvidenceRefs:[],privilegedEvidenceRefs:c.evidenceRefs??[]}}:void 0,modelJudge:e.modelJudge?async({grader:i})=>{let u=e.graders.find(m=>m.id===i.id);if(u?.kind!=="model_judge")throw new Error("Bound judge projection is missing.");let c=await e.modelJudge({grader:u,task:e.task,attempt:e.attempt});return{score:c.score,passed:c.passed,rewardEligible:i.rewardEligible,failureClass:null,feedback:[c.feedback],visibleEvidenceRefs:[],privilegedEvidenceRefs:c.evidenceRefs??[]}}:void 0}),s=n.training.status==="not_configured"?n.evaluation:n.training,f=h(e.graders);return{schemaVersion:"openpond.gradeResult.v1",id:`grade_${h([e.attempt.id,n.contentHash]).slice(0,24)}`,attemptId:e.attempt.id,graderSetHash:f,score:s.score,passed:s.passed===!0,components:n.results.map(i=>{let u=t.sources.find(m=>m.graderId===i.graderId),c=e.graders.find(m=>m.id===i.graderId);return{graderId:i.graderId,graderVersion:c.version,score:i.normalizedScore,passed:i.passed===!0,hardGate:u.hardGate,rewardEligible:u.role==="training"&&i.status==="scored",feedback:i.message?.trim()||null,evidenceRefs:i.evidenceHashes,judge:c.kind==="model_judge"?c.judge:null,calibrationStatus:c.kind==="model_judge"?c.calibrationStatus:"not_applicable"}}),failureClass:e.attempt.infrastructureError?"infrastructure_failure":s.status!=="scored"?"grader_failure":s.passed?null:"policy_failure",feedback:n.results.flatMap(i=>i.message?.trim()?[i.message.trim()]:[]),rewardEligible:n.training.status==="scored",rewardComposition:n,createdAt:e.now?.()??new Date().toISOString()}}l(ee,"gradeLearningBatchAttempt");async function at(e){if(e.learning)return ee({...e,learning:e.learning});if(e.graders.some(o=>o.metadata.rewardBinding!==void 0))throw new Error("This Taskset requires its immutable public Reward binding to grade an attempt.");let t=h(e.graders),a=[];for(let o of e.graders)e.signal?.throwIfAborted(),a.push(e.attempt.infrastructureError?b(o,null,!1,"Infrastructure failure; no reward was produced.",[],!1):await me(o,e.task,e.attempt,e.modelJudge,e.customVerifier,e.signal));let r=F({graders:e.graders,infrastructureError:e.attempt.infrastructureError,components:a.map(o=>({...o,failureClass:o.score===null?"grader_failure":o.passed?null:"policy_failure"}))});return{schemaVersion:"openpond.gradeResult.v1",id:`grade_${h([e.attempt.id,t,a]).slice(0,24)}`,attemptId:e.attempt.id,graderSetHash:t,score:r.score,passed:r.passed,components:a,failureClass:r.failureClass,feedback:e.attempt.infrastructureError?[e.attempt.infrastructureError]:a.flatMap(o=>o.feedback?[o.feedback]:[]),rewardEligible:r.rewardEligible,createdAt:e.now?.()??new Date().toISOString()}}l(at,"gradeAttempt");async function me(e,t,a,r,o,n){if(e.kind==="model_judge"){if(!r)return b(e,null,!1,"Model judge runner is unavailable.",[],!1);if(e.calibrationStatus!=="passed")return b(e,null,!1,"Model judge calibration has not passed.",[],!1);let f=await r({grader:e,task:t,attempt:a});return b(e,f.score,f.passed,f.feedback,f.evidenceRefs??[])}if(e.kind==="human")return b(e,null,!1,"Human review is pending.",[],!1);if(e.kind==="custom_verifier"){if(!o)return b(e,null,!1,"Sandboxed verifier runner is unavailable.",[],!1);let f=await o({grader:e,task:t,attempt:a,signal:n});return b(e,f.score,f.passed,f.feedback,f.evidenceRefs??[])}let s=C({grader:O(e),task:t,evidence:a});return b(e,s.score,s.passed,s.feedback,[...a.artifactRefs,...a.runtimeEventRefs])}l(me,"runGrader");function b(e,t,a,r,o,n=e.rewardEligible){let s=t!==null&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null;return{graderId:e.id,graderVersion:e.version,score:s,passed:s!==null&&a,hardGate:e.hardGate,rewardEligible:s!==null&&n,feedback:r,evidenceRefs:o,judge:e.kind==="model_judge"?e.judge:null,calibrationStatus:e.kind==="model_judge"?e.calibrationStatus:"not_applicable"}}l(b,"component");import{access as ue,mkdir as T,readFile as Vt,writeFile as y}from"node:fs/promises";import p from"node:path";async function Gt(e,t,a={}){let r=z.parse(e),o=P(r);if(!o.valid)throw new Error(o.issues.map(s=>`${s.code}: ${s.message}`).join(`
|
|
3
|
+
`));await T(p.join(t,"data"),{recursive:!0}),await T(p.join(t,"graders"),{recursive:!0}),await T(p.join(t,"environment"),{recursive:!0}),await T(p.join(t,"fixtures"),{recursive:!0});let n=[p.join(t,"taskset.json"),p.join(t,"capabilities.json"),p.join(t,"data","tasks.jsonl"),p.join(t,"graders","graders.json"),p.join(t,"fixtures","grader-fixtures.json"),p.join(t,"environment","taskset.ts")];await y(n[0],E(r),"utf8"),await y(n[1],E(r.capabilities),"utf8"),await y(n[2],r.tasks.map(s=>JSON.stringify(s)).join(`
|
|
4
|
+
`)+`
|
|
5
|
+
`,"utf8"),await y(n[3],E(r.graders),"utf8"),await y(n[4],E(r.graderFixtures),"utf8"),await y(n[5],pe(r),"utf8");for(let s of a.generatedFiles??[]){let f=te(s.path,s.role),i=p.join(t,f);await T(p.dirname(i),{recursive:!0}),await y(i,s.content,"utf8"),n.push(i)}for(let s of r.graders){if(s.kind!=="custom_verifier")continue;let f=te(s.module,"verifier");try{await ue(p.join(t,f))}catch{throw new Error(`Custom verifier ${s.id} is missing generated source ${f}.`)}}return{directory:t,files:n,taskset:r}}l(Gt,"buildTaskset");function te(e,t){let a=e.replaceAll("\\","/");if(p.posix.isAbsolute(a)||a.split("/").includes(".."))throw new Error(`Generated ${t} path must stay inside the Taskset: ${e}.`);let r=t==="verifier"?"graders/":t==="environment"?"environment/":"fixtures/";if(!a.startsWith(r))throw new Error(`Generated ${t} path must start with ${r}.`);return a}l(te,"safeGeneratedPath");function pe(e){return`// Generated by @openpond/taskset-sdk.
|
|
6
|
+
export const environment = ${JSON.stringify(e.environment,null,2)} as const;
|
|
7
|
+
export const tasks = ${JSON.stringify(e.tasks.map(t=>({id:t.id,input:t.input,split:t.split})),null,2)} as const;
|
|
8
|
+
`}l(pe,"generatedEnvironmentSource");export{je as a,Re as b,Y as c,Oe as d,at as e,Gt as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{E as u,F as h}from"./chunk-
|
|
2
|
+
import{E as u,F as h}from"./chunk-UWO34HP6.js";import{f as c}from"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import{createHash as i}from"node:crypto";import{readFile as m}from"node:fs/promises";import y from"node:path";var U=".openpond/source-upload-cache.json",d="openpond.source-upload-cache.v1";async function E(e){try{let a=(await u(c(),"source-upload.v1",l(e)))?.payload;if(!a)return new Map;if(a.schema!==d||!a.entries)return new Map;let t=new Map;for(let[o,n]of Object.entries(a.entries))!f(n)||o!==p(n)||t.set(o,n);return t}catch{return new Map}}s(E,"readSourceUploadCache");async function b(e,r){let a=await m(e.absolutePath),t=i("sha256").update(a).digest("hex"),o=p({...e,sha256:t}),n=r.get(o);return n&&n.sha256===t&&i("sha256").update(Buffer.from(n.contentsBase64,"base64")).digest("hex")===t?{file:e,entry:{path:e.path,type:"file",contentsBase64:n.contentsBase64},sha256:n.sha256}:{file:e,entry:{path:e.path,type:"file",contentsBase64:a.toString("base64")},sha256:t}}s(b,"materializeSourceUploadFile");async function A(e,r){let a={};for(let t of r){let o={path:t.file.path,size:t.file.size,mtimeMs:t.file.mtimeMs,ctimeMs:t.file.ctimeMs,sha256:t.sha256,contentsBase64:t.entry.contentsBase64};a[p(o)]=o}await h(c(),"source-upload.v1",l(e),{schema:d,generatedAt:new Date().toISOString(),entries:a})}s(A,"writeSourceUploadCache");function p(e){return`${e.path}\0${e.sha256}`}s(p,"cacheKeyForFile");function f(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let r=e;return typeof r.path=="string"&&typeof r.size=="number"&&typeof r.mtimeMs=="number"&&typeof r.ctimeMs=="number"&&typeof r.sha256=="string"&&typeof r.contentsBase64=="string"}s(f,"isCacheEntry");function l(e){return i("sha256").update(y.resolve(e)).digest("hex")}s(l,"sourceScope");export{U as a,E as b,b as c,A as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{x as bt}from"./chunk-NM2GYDPA.js";import{a as Et,b as Se}from"./chunk-L3KS6MOV.js";import{b as j,d as we,e as Pe}from"./chunk-Z3D4C7BG.js";import{E as Ne,F as je,P as Ct,Q as vt,_ as De,f as ye}from"./chunk-ALZRXBEC.js";import{f as L,h as ge,p as Le,r as It}from"./chunk-H7IWJN7L.js";import{a}from"./chunk-FTQLQJQV.js";import{createRequire as Po}from"node:module";import{createHash as po,randomUUID as ho}from"node:crypto";import{spawn as Pr}from"node:child_process";import{existsSync as U}from"node:fs";import{cp as Sr,mkdir as F,readFile as So,readdir as Ao,rename as at,rm as it,symlink as Ar,writeFile as ie}from"node:fs/promises";import d from"node:path";import Sn from"node:path";var Ae="default",Rt=["apiKey","baseUrl","apiBaseUrl","chatApiBaseUrl","token","appId","conversationId"];function W(e,t){return Object.prototype.hasOwnProperty.call(e,t)}a(W,"hasOwn");function z(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}a(z,"normalizeHandle");function _(e){if(typeof e!="string")return null;let t=e.trim();return t?t.replace(/\/$/,""):null}a(_,"normalizeBaseUrl");function Bt(e){let t=z(e);if(!t)throw new Error("profile handle must be non-empty");return t}a(Bt,"requireHandle");function An(e){if(typeof e!="string")throw new Error("apiKey must be a non-empty string");let t=e.trim();if(!t)throw new Error("apiKey must be a non-empty string");return t}a(An,"requireApiKey");function de(e,t){let o=z(e),n=z(t);return!!(o&&n&&o.toLowerCase()===n.toLowerCase())}a(de,"handleEquals");function qe(e,t,o){let n=_(o);return e.findIndex(r=>de(r.handle,t)?n?_(r.baseUrl)===n:!0:!1)}a(qe,"findAccountIndex");function ne(e){let t=z(e.handle)??Ae,o=_(e.baseUrl);return o?{handle:t,baseUrl:o}:{handle:t}}a(ne,"selectorFromAccount");function oe(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=z(typeof t.handle=="string"?t.handle:void 0);if(!o)return null;let n=_(typeof t.baseUrl=="string"?t.baseUrl:void 0);return n?{handle:o,baseUrl:n}:{handle:o}}a(oe,"sanitizeActiveProfile");function Fe(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,o=typeof t.repoPath=="string"?t.repoPath.trim():"",n=typeof t.profile=="string"&&t.profile.trim()?t.profile.trim():"default";if(!o)return;let r={repoPath:o,profile:n,mode:"local"};if(t.lastCheck&&typeof t.lastCheck=="object"&&!Array.isArray(t.lastCheck)){let s=t.lastCheck,i=s.command,c=s.status,l=s.checkedAt;(i==="inspect"||i==="build"||i==="validate"||i==="eval"||i==="run")&&(c==="passed"||c==="failed")&&typeof l=="string"&&(r.lastCheck={command:i,status:c,checkedAt:l,...typeof s.exitCode=="number"||s.exitCode===null?{exitCode:s.exitCode}:{},...typeof s.sourceHead=="string"||s.sourceHead===null?{sourceHead:s.sourceHead}:{}})}if(t.lastPush&&typeof t.lastPush=="object"&&!Array.isArray(t.lastPush)){let s=t.lastPush,i=s.status,c=s.pushedAt;(i==="pushed"||i==="failed")&&typeof c=="string"&&(r.lastPush={status:i,pushedAt:c,...typeof s.teamId=="string"||s.teamId===null?{teamId:s.teamId}:{},...typeof s.projectId=="string"||s.projectId===null?{projectId:s.projectId}:{},...typeof s.localHead=="string"||s.localHead===null?{localHead:s.localHead}:{},...typeof s.hostedHead=="string"||s.hostedHead===null?{hostedHead:s.hostedHead}:{},...typeof s.sourceRef=="string"||s.sourceRef===null?{sourceRef:s.sourceRef}:{},...s.promotionStatus==="uploaded"||s.promotionStatus==="hosted_source_materialized"||s.promotionStatus==="hosted_source_materialize_failed"||s.promotionStatus==="hosted_source_check_pending"||s.promotionStatus==="hosted_source_check_failed"||s.promotionStatus==="hosted_source_published"||s.promotionStatus==="hosted_source_publish_failed"||s.promotionStatus==="hosted_run_pending"||s.promotionStatus==="hosted_run_passed"||s.promotionStatus==="hosted_run_failed"||s.promotionStatus===null?{promotionStatus:s.promotionStatus}:{},...s.hostedRunStatus==="not_started"||s.hostedRunStatus==="running"||s.hostedRunStatus==="passed"||s.hostedRunStatus==="failed"||s.hostedRunStatus===null?{hostedRunStatus:s.hostedRunStatus}:{},...typeof s.hostedRunAgentId=="string"||s.hostedRunAgentId===null?{hostedRunAgentId:s.hostedRunAgentId}:{},...typeof s.hostedRunId=="string"||s.hostedRunId===null?{hostedRunId:s.hostedRunId}:{},...typeof s.hostedRunAt=="string"||s.hostedRunAt===null?{hostedRunAt:s.hostedRunAt}:{},..._t(s.hostedSourceMaterialization)?{hostedSourceMaterialization:_t(s.hostedSourceMaterialization)}:{},...$t(s.hostedSourceCheck)?{hostedSourceCheck:$t(s.hostedSourceCheck)}:{},...Ot(s.hostedPublish)?{hostedPublish:Ot(s.hostedPublish)}:{},...Tt(s.hostedRun)?{hostedRun:Tt(s.hostedRun)}:{},...typeof s.error=="string"||s.error===null?{error:s.error}:{}})}if(Array.isArray(t.profiles)){let s=t.profiles.flatMap(i=>{let c=Fe(i);if(!c)return[];let l=i,u=l.source==="github"||l.source==="openpond_git"?l.source:"local",p=typeof l.repositoryId=="string"&&l.repositoryId.trim()?l.repositoryId.trim():Sn.resolve(c.repoPath);return[{source:u,repositoryId:p,repoPath:c.repoPath,profile:c.profile,...c.lastCheck?{lastCheck:c.lastCheck}:{},...c.lastPush?{lastPush:c.lastPush}:{}}]});s.length>0&&(r.profiles=s)}return r}a(Fe,"sanitizeLocalOpenPondProfile");function _t(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=xe(t.status);return o?{status:o,...m(t,"agentId"),...m(t,"runtimeAgentId"),...m(t,"projectId"),...m(t,"sourceRoot"),...m(t,"sourceRef"),...m(t,"sourceCommitSha"),...m(t,"manifestHash"),...m(t,"manifestPath"),...m(t,"manifestSyncedAt"),...Ut(t,"fileCount"),...Ut(t,"totalBytes"),...m(t,"generatedManifestPath"),...He(t,"synthesizedOpenPondYaml"),...m(t,"uploadMetadataPath"),...O(t,"setupCommands"),...O(t,"validationCommands"),...m(t,"materializedAt"),...m(t,"error")}:null}a(_t,"sanitizeHostedMaterializationStatus");function $t(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=xe(t.status);return o?{status:o,...m(t,"agentId"),...m(t,"deployPlanStatus"),...He(t,"canRun"),...He(t,"canDeploy"),...m(t,"sourceRef"),...m(t,"sourceCommitSha"),...m(t,"manifestHash"),...m(t,"manifestPath"),...O(t,"setupCommands"),...O(t,"validationCommands"),...O(t,"requiredChecks"),...O(t,"evalNames"),...O(t,"blockedReasons"),...O(t,"staleReasons"),...m(t,"runtimeId"),...m(t,"sandboxId"),...O(t,"traceArtifactRefs"),...O(t,"evalResultArtifactRefs"),...O(t,"validatorArtifactRefs"),...m(t,"checkedAt"),...m(t,"error")}:null}a($t,"sanitizeHostedSourceCheckStatus");function Ot(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=xe(t.status);return o?{status:o,...m(t,"agentId"),...m(t,"snapshotId"),...m(t,"sourceRef"),...m(t,"sourceCommitSha"),...m(t,"manifestHash"),...m(t,"manifestPath"),...m(t,"buildStatus"),...m(t,"validationStatus"),...m(t,"evalStatus"),...m(t,"publishedAt"),...m(t,"error")}:null}a(Ot,"sanitizeHostedPublishStatus");function Tt(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=xe(t.status);return o?{status:o,...m(t,"agentId"),...m(t,"runId"),...m(t,"runtimeId"),...m(t,"sandboxId"),...m(t,"sourceRef"),...m(t,"sourceCommitSha"),...m(t,"manifestHash"),...m(t,"setupGateStatus"),...O(t,"setupRequirementRefs"),...O(t,"artifactRefs"),...O(t,"traceArtifactRefs"),...O(t,"evalArtifactRefs"),...m(t,"startedAt"),...m(t,"completedAt"),...m(t,"error")}:null}a(Tt,"sanitizeHostedRunSummary");function m(e,t){let o=e[t];return typeof o=="string"||o===null?{[t]:o}:{}}a(m,"nullableStringProp");function He(e,t){let o=e[t];return typeof o=="boolean"||o===null?{[t]:o}:{}}a(He,"nullableBooleanProp");function Ut(e,t){let o=e[t];return typeof o=="number"||o===null?{[t]:o}:{}}a(Ut,"nullableNumberProp");function O(e,t){let o=e[t];if(!Array.isArray(o))return{};let n=o.filter(r=>typeof r=="string");return{[t]:n}}a(O,"stringArrayProp");function xe(e){return typeof e=="string"&&e.trim()?e.trim():null}a(xe,"stringField");function Lt(e,t){if(!de(e.handle,t.handle))return!1;let o=_(t.baseUrl);return o?_(e.baseUrl)===o:!_(e.baseUrl)}a(Lt,"accountMatchesSelector");function Ge(e,t,o={}){let n=_(t.baseUrl);if(n)return qe(e,t.handle,n);let r=e.findIndex(i=>Lt(i,t));if(r!==-1)return r;let s=e.map((i,c)=>({account:i,index:c})).filter(({account:i})=>de(i.handle,t.handle));if(s.length>1&&o.requireUnambiguous)throw new Error(`multiple profiles found for ${t.handle}; pass --base-url to select one`);return s[0]?.index??-1}a(Ge,"findAccountIndexForSelector");function xn(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,o={};return typeof t.token=="string"&&(o.token=t.token),(typeof t.appId=="string"||t.appId===null)&&(o.appId=t.appId),(typeof t.conversationId=="string"||t.conversationId===null)&&(o.conversationId=t.conversationId),Object.keys(o).length>0?o:void 0}a(xn,"sanitizeSession");function kn(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=z(typeof t.handle=="string"?t.handle:void 0);if(!o)return null;let n={handle:o};typeof t.apiKey=="string"&&(n.apiKey=t.apiKey),typeof t.baseUrl=="string"&&(n.baseUrl=t.baseUrl),typeof t.apiBaseUrl=="string"&&(n.apiBaseUrl=t.apiBaseUrl),typeof t.chatApiBaseUrl=="string"&&(n.chatApiBaseUrl=t.chatApiBaseUrl),typeof t.environment=="string"&&(n.environment=t.environment);let r=xn(t.session);return r&&(n.session=r),n}a(kn,"sanitizeAccount");function bn(e){let t={};return typeof e.token=="string"&&(t.token=e.token),(typeof e.appId=="string"||e.appId===null)&&(t.appId=e.appId),(typeof e.conversationId=="string"||e.conversationId===null)&&(t.conversationId=e.conversationId),Object.keys(t).length>0?t:void 0}a(bn,"extractLegacySession");function In(e,t){let o={handle:t};typeof e.apiKey=="string"&&(o.apiKey=e.apiKey),typeof e.baseUrl=="string"&&(o.baseUrl=e.baseUrl),typeof e.apiBaseUrl=="string"&&(o.apiBaseUrl=e.apiBaseUrl),typeof e.chatApiBaseUrl=="string"&&(o.chatApiBaseUrl=e.chatApiBaseUrl);let n=bn(e);return n&&(o.session=n),o}a(In,"extractLegacyAccount");function Nt(e){let t={};typeof e.lspEnabled=="boolean"&&(t.lspEnabled=e.lspEnabled),(e.executionMode==="local"||e.executionMode==="hosted")&&(t.executionMode=e.executionMode),(e.mode==="general"||e.mode==="builder")&&(t.mode=e.mode);let o=Fe(e.openpondProfile);o&&(t.openpondProfile=o);let n=[],r=Array.isArray(e.accounts)?e.accounts:[];for(let l of r){let u=kn(l);u&&qe(n,u.handle,u.baseUrl)===-1&&n.push(u)}if(n.length===0){let l=oe(e.activeProfile)?.handle||Ae;n.push(In(e,l))}let s=oe(e.activeProfile),i=s?Ge(n,s):-1,c=n[i===-1?0:i];return t.accounts=n,t.activeProfile=ne(c),t}a(Nt,"normalizeGlobalConfig");function Cn(e,t,o){let n=e.accounts??[],r=_(o??process.env.OPENPOND_BASE_URL),s=z(t);if(s)return r?{handle:s,baseUrl:r}:{handle:s};let i=z(process.env.OPENPOND_ACCOUNT);if(i)return r?{handle:i,baseUrl:r}:{handle:i};let c=oe(e.activeProfile);return c?r?{handle:c.handle,baseUrl:r}:c:n[0]?ne(n[0]):{handle:Ae}}a(Cn,"resolveRequestedProfile");function jt(e,t,o){let n=_(o);if(n){let s=qe(e,t,n);if(s!==-1)return e[s]}else{let s=e.filter(i=>de(i.handle,t));if(s.length>1)throw new Error(`multiple profiles found for ${t}; pass --base-url to select one`);if(s.length===1)return s[0]}let r={handle:t};return n&&(r.baseUrl=n),e.push(r),r}a(jt,"ensureAccount");function Mt(e){e.session&&Object.keys(e.session).length===0&&delete e.session}a(Mt,"cleanupAccount");function vn(e,t,o,n){let r=o===null||o===void 0&&n.undefinedDeletes;switch(t){case"apiKey":{if(r){delete e.apiKey;return}typeof o=="string"&&(e.apiKey=o);return}case"baseUrl":{if(r){delete e.baseUrl;return}typeof o=="string"&&(e.baseUrl=o);return}case"apiBaseUrl":{if(r){delete e.apiBaseUrl;return}typeof o=="string"&&(e.apiBaseUrl=o);return}case"chatApiBaseUrl":{if(r){delete e.chatApiBaseUrl;return}typeof o=="string"&&(e.chatApiBaseUrl=o);return}case"token":case"appId":case"conversationId":{if(e.session||(e.session={}),r){delete e.session[t],Mt(e);return}(typeof o=="string"||o===null)&&(e.session[t]=o),Mt(e);return}}}a(vn,"applyScopedKey");function En(e,t,o){if(!Rt.some(l=>W(t,l)))return!1;let r=e.accounts??[],s=oe(t.activeProfile)??Cn(e),i=_(W(t,"baseUrl")?t.baseUrl??null:s.baseUrl??process.env.OPENPOND_BASE_URL),c=jt(r,s.handle,i);for(let l of Rt)W(t,l)&&vn(c,l,t[l],o);return e.accounts=r,e.activeProfile=ne(c),!0}a(En,"applyAccountPatch");function Rn(e,t){if(W(t,"lspEnabled")&&(typeof t.lspEnabled=="boolean"?e.lspEnabled=t.lspEnabled:t.lspEnabled===null&&delete e.lspEnabled),W(t,"executionMode")&&(t.executionMode==="local"||t.executionMode==="hosted"?e.executionMode=t.executionMode:t.executionMode===null&&delete e.executionMode),W(t,"mode")&&(t.mode==="general"||t.mode==="builder"?e.mode=t.mode:t.mode===null&&delete e.mode),W(t,"activeProfile")){let o=oe(t.activeProfile);if(o){let n=Ge(e.accounts??[],o);e.activeProfile=n===-1?o:ne((e.accounts??[])[n])}else t.activeProfile===null&&delete e.activeProfile}if(W(t,"openpondProfile")){let o=Fe(t.openpondProfile);o?e.openpondProfile=o:t.openpondProfile===null&&delete e.openpondProfile}}a(Rn,"applyTopLevelPatch");async function ke(e){let t=L();return await De(t),await vt(t,o=>{let n=Nt(o);return e(n),n})}a(ke,"updateGlobalConfig");async function T(){let e=L();return await De(e),Nt(await Ct(e))}a(T,"loadGlobalConfig");async function ze(){let e=await T(),t=oe(e.activeProfile);return(e.accounts??[]).map(o=>{let n=z(o.handle)??Ae;return{handle:n,baseUrl:_(o.baseUrl),apiBaseUrl:_(o.apiBaseUrl),chatApiBaseUrl:_(o.chatApiBaseUrl),environment:o.environment?.trim()||null,isActive:!!(t&&Lt({...o,handle:n},t)),hasApiKey:!!o.apiKey?.trim(),hasSessionToken:!!o.session?.token?.trim(),sessionAppId:o.session?.appId??null,sessionConversationId:o.session?.conversationId??null}})}a(ze,"listConfiguredProfiles");async function _n(e,t={}){let o=Bt(e),n=_(t.baseUrl),r=-1;await ke(i=>{let c=i.accounts??[];if(r=Ge(c,n?{handle:o,baseUrl:n}:{handle:o},{requireUnambiguous:!0}),r===-1)throw new Error(`profile not found: ${o}`);i.activeProfile=ne(c[r])});let s=await ze();return s.find(i=>i.isActive)??s[r]}a(_n,"setActiveProfile");async function $n(e){let t=Bt(e.handle),o=An(e.apiKey),n=_(e.baseUrl),r=_(e.apiBaseUrl),s=_(e.chatApiBaseUrl),i={handle:t};await ke(u=>{let p=u.accounts??[],h=jt(p,t,n);h.apiKey=o,n&&(h.baseUrl=n),r?h.apiBaseUrl=r:e.apiBaseUrl===null&&delete h.apiBaseUrl,s?h.chatApiBaseUrl=s:e.chatApiBaseUrl===null&&delete h.chatApiBaseUrl,e.environment===null?delete h.environment:typeof e.environment=="string"&&e.environment.trim()&&(h.environment=e.environment.trim()),u.accounts=p,i=ne(h),e.setActive!==!1&&(u.activeProfile=i)});let l=(await ze()).find(u=>de(u.handle,i.handle)?n?_(u.baseUrl)===n:!0:!1);if(!l)throw new Error(`failed to save profile: ${t}`);return l}a($n,"saveProfileApiKey");async function H(e){await ke(t=>{Rn(t,e),En(t,e,{undefinedDeletes:!1})})}a(H,"saveGlobalConfig");function Je(e=null){return{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!0,error:e}}a(Je,"emptyProfileCatalogState");function Ke(e=null){return{skillCount:0,generatedAt:null,stale:!0,error:e}}a(Ke,"emptyProfileSkillCatalogState");function We(){return{status:"ready",requirementCount:0,blockingCount:0,optionalMissingCount:0,readyCount:0,requirements:[],blockingRequirements:[]}}a(We,"emptyProfileSetupGate");function be(){return{changedAgents:[],newAgents:[],deletedAgents:[],changedSkills:[],changedActions:[],changedExtensions:[],setupChanges:[],envRequirementChanges:[],files:[]}}a(be,"emptyProfileDiffSummary");function Ve(e=null){return{state:e?"error":"none",message:e??"No active OpenPond profile.",agentCount:0,actionCount:0,defaultAction:null,checkFresh:!1,checkStaleReason:e??"No active profile.",localHead:null,hostedHead:null}}a(Ve,"emptyProfileSummary");import{existsSync as re}from"node:fs";import{readFile as On,stat as Tn}from"node:fs/promises";import Ie from"node:path";var Dt=".openpond/agent-manifest.json",Ht=".openpond/action-registry.json",Un=".openpond/source-upload-metadata.json",Mn=".openpond/agent-package-origin.json";async function Gt(e){return Jt({agentId:"default",sourcePath:e,preferred:!0})}a(Gt,"loadProfileActionCatalog");async function zt(e){if(e.length===0)return{catalog:{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!1,error:null},actionCatalog:[],sourceSetupRequirements:[]};let t=[...e.filter(c=>c.preferred),...e.filter(c=>!c.preferred)],o=await Promise.all(t.map(Jt)),n=new Map,r=[];for(let c of o)for(let l of c.actionCatalog){let u=n.has(l.id)?`${l.agentId??"agent"}.${l.sourceActionId??l.id}`:l.id,p=u===l.id?l:{...l,id:u};n.set(u,p),r.push(p)}let s=Ln(o.map(c=>c.catalog.generatedAt)),i=o.map(c=>c.catalog.error).filter(Boolean);return{catalog:{actionCount:r.length,generatedAt:s,manifestPath:o.find(c=>c.catalog.manifestPath)?.catalog.manifestPath??null,registryPath:o.find(c=>c.catalog.registryPath)?.catalog.registryPath??null,stale:o.some(c=>c.catalog.stale),error:i.length>0?i.join("; "):null},actionCatalog:r,sourceSetupRequirements:o.flatMap(c=>c.sourceSetupRequirements)}}a(zt,"loadProfileActionCatalogForSources");async function Jt(e){let t=e.sourcePath,o=Ie.join(t,Dt),n=Ie.join(t,Ht),r=Ie.join(t,Un),s=Ie.join(t,Mn);try{let i=await Ce(o),c=await Ce(n),l=await Ce(r),u=$(await Ce(s)),p=$($(i)?.inputSchemas),h=Ft($(l)?.setupRequirements)??[],k=Nn(h),C=new Map;for(let f of[...Ye($(i)?.actionCatalog),...Ye($(c)?.actions),...Ye($(i)?.actions)]){let y=b(f.id)??b(f.name);if(!y)continue;let x=C.get(y),v=jn({sourceRequirementsByAction:k,actionId:y,actionName:b(f.name)}),B=Dn(Ft(f.setupRequirements)??x?.setupRequirements??[],v),K={id:y,agentId:e.agentId,sourcePath:t,sourceActionId:y,name:b(f.name)??x?.name??y,label:b(f.label)??x?.label??zn(y),description:b(f.description)??x?.description??null,visibility:b(f.visibility)??x?.visibility??"default",inputSchema:Gn(f.inputSchema,p)??x?.inputSchema??null,outputSchema:Kt(f.outputSchema)??x?.outputSchema??null,approvalPolicy:$(f.approvalPolicy)??x?.approvalPolicy??null,artifactPolicy:$(f.artifactPolicy)??x?.artifactPolicy??null,setupRequirements:B,mcp:$(f.mcp)??x?.mcp??null,schedulePolicy:$(f.schedulePolicy)??x?.schedulePolicy??null,trace:Bn($(f.trace)??x?.trace??null,u),implementation:$(f.implementation)??x?.implementation??null,invokesModel:typeof f.invokesModel=="boolean"?f.invokesModel:x?.invokesModel};C.set(y,K)}let P=Array.from(C.values()).filter(f=>f.visibility!=="internal"&&f.visibility!=="debug"),g=[...i?[]:[Dt],...c?[]:[Ht]],S=await Fn([o,n]);return{catalog:{actionCount:P.length,generatedAt:S,manifestPath:re(o)?o:null,registryPath:re(n)?n:null,stale:g.length>0,error:g.length>0?qn(e,g):null},actionCatalog:P,sourceSetupRequirements:h}}catch(i){return{catalog:{actionCount:0,generatedAt:null,manifestPath:re(o)?o:null,registryPath:re(n)?n:null,stale:!0,error:i instanceof Error?i.message:String(i)},actionCatalog:[],sourceSetupRequirements:[]}}}a(Jt,"loadProfileActionCatalogSource");function Bn(e,t){if(!t)return e;let o=b(t.versionId),n=b(t.digest);return!o||!n?e:{...e??{},agentVersionId:o,agentPackageDigest:n,validationReceiptIds:qt(t.validationReceiptIds),evalReceiptIds:qt(t.evalReceiptIds)}}a(Bn,"mergeAgentPackageTrace");function qt(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim().length>0):[]}a(qt,"stringArray");function Ln(e){let t=0;for(let o of e){if(!o)continue;let n=Date.parse(o);Number.isFinite(n)&&(t=Math.max(t,n))}return t>0?new Date(t).toISOString():null}a(Ln,"latestIso");function Nn(e){let t=new Map;for(let o of e){let n=[b(o.actionId),b(o.sourceActionId),b(o.actionName)].filter(r=>!!r);for(let r of n){let s=t.get(r)??[];s.push(o),t.set(r,s)}}return t}a(Nn,"sourceSetupRequirementsByAction");function jn(e){return[...e.sourceRequirementsByAction.get(e.actionId)??[],...e.actionName&&e.actionName!==e.actionId?e.sourceRequirementsByAction.get(e.actionName)??[]:[]].map(o=>({...o,source:"source_upload_metadata"}))}a(jn,"setupRequirementsForActionSource");function Dn(e,t){if(t.length===0)return e;let o=[],n=new Set;for(let r of[...e,...t]){let s=Hn(r);n.has(s)||(n.add(s),o.push(r))}return o}a(Dn,"mergeSetupRequirements");function Hn(e){return[b(e.actionId)??b(e.sourceActionId)??b(e.actionName)??"",b(e.kind)??b(e.type)??"",b(e.name)??b(e.key)??b(e.provider)??b(e.tool)??b(e.command)??b(e.packageName)??b(e.path)??b(e.repo)??b(e.url)??b(e.id)??""].join(":")}a(Hn,"setupRequirementIdentity");function qn(e,t){return[`Profile agent ${e.agentId} at ${e.sourcePath} is missing SDK catalog artifact(s): ${t.join(", ")}.`,"Run `openpond profile check --kind all` after source materialization so each enabled profile agent has inspect/build artifacts."].join(" ")}a(qn,"missingSourceArtifactsMessage");async function Ce(e){return re(e)?JSON.parse(await On(e,"utf8")):null}a(Ce,"readJsonIfExists");async function Fn(e){let t=0;for(let o of e){if(!re(o))continue;let n=await Tn(o);t=Math.max(t,n.mtimeMs)}return t>0?new Date(t).toISOString():null}a(Fn,"latestMtime");function $(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}a($,"asRecord");function Ye(e){return Array.isArray(e)?e.filter(t=>!!$(t)):[]}a(Ye,"records");function Ft(e){return Array.isArray(e)?e.filter(t=>!!$(t)):null}a(Ft,"recordArray");function b(e){return typeof e=="string"&&e.trim()?e.trim():null}a(b,"text");function Kt(e){return b(e)??$(e)}a(Kt,"schemaValue");function Gn(e,t){let o=Kt(e);return typeof o!="string"?o:$(t?.[o])??o}a(Gn,"resolvedSchemaValue");function zn(e){let t=e.replace(/[._-]+/g," ").trim();return t?t.replace(/\b\w/g,o=>o.toUpperCase()):e}a(zn,"titleFromActionId");var ve=class extends Error{static{a(this,"OpenPondProfileSetupRequiredError")}code="agent_source_setup_required";details;constructor(t,o){let n=o.blockingRequirements.map(r=>r.label);super(["agent_source_setup_required",`Profile action ${t} has unresolved required setup.`,n.length?`Missing setup: ${n.join(", ")}`:""].filter(Boolean).join(`
|
|
2
|
+
import{a as Et,b as Se}from"./chunk-L3KS6MOV.js";import{w as vt}from"./chunk-HK3WGUKK.js";import{b as j,d as we,e as Pe}from"./chunk-Z3D4C7BG.js";import{E as Ne,F as je,P as It,Q as Ct,_ as De,f as ye}from"./chunk-UWO34HP6.js";import{f as L,h as ge,p as Le,r as bt}from"./chunk-H7IWJN7L.js";import{a}from"./chunk-FTQLQJQV.js";import{createRequire as Po}from"node:module";import{createHash as po,randomUUID as ho}from"node:crypto";import{spawn as Pr}from"node:child_process";import{existsSync as U}from"node:fs";import{cp as Sr,mkdir as F,readFile as So,readdir as Ao,rename as at,rm as it,symlink as Ar,writeFile as ie}from"node:fs/promises";import d from"node:path";import Sn from"node:path";var Ae="default",Rt=["apiKey","baseUrl","apiBaseUrl","chatApiBaseUrl","token","appId","conversationId"];function W(e,t){return Object.prototype.hasOwnProperty.call(e,t)}a(W,"hasOwn");function z(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}a(z,"normalizeHandle");function _(e){if(typeof e!="string")return null;let t=e.trim();return t?t.replace(/\/$/,""):null}a(_,"normalizeBaseUrl");function Bt(e){let t=z(e);if(!t)throw new Error("profile handle must be non-empty");return t}a(Bt,"requireHandle");function An(e){if(typeof e!="string")throw new Error("apiKey must be a non-empty string");let t=e.trim();if(!t)throw new Error("apiKey must be a non-empty string");return t}a(An,"requireApiKey");function de(e,t){let o=z(e),n=z(t);return!!(o&&n&&o.toLowerCase()===n.toLowerCase())}a(de,"handleEquals");function qe(e,t,o){let n=_(o);return e.findIndex(r=>de(r.handle,t)?n?_(r.baseUrl)===n:!0:!1)}a(qe,"findAccountIndex");function ne(e){let t=z(e.handle)??Ae,o=_(e.baseUrl);return o?{handle:t,baseUrl:o}:{handle:t}}a(ne,"selectorFromAccount");function oe(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=z(typeof t.handle=="string"?t.handle:void 0);if(!o)return null;let n=_(typeof t.baseUrl=="string"?t.baseUrl:void 0);return n?{handle:o,baseUrl:n}:{handle:o}}a(oe,"sanitizeActiveProfile");function Fe(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,o=typeof t.repoPath=="string"?t.repoPath.trim():"",n=typeof t.profile=="string"&&t.profile.trim()?t.profile.trim():"default";if(!o)return;let r={repoPath:o,profile:n,mode:"local"};if(t.lastCheck&&typeof t.lastCheck=="object"&&!Array.isArray(t.lastCheck)){let s=t.lastCheck,i=s.command,c=s.status,l=s.checkedAt;(i==="inspect"||i==="build"||i==="validate"||i==="eval"||i==="run")&&(c==="passed"||c==="failed")&&typeof l=="string"&&(r.lastCheck={command:i,status:c,checkedAt:l,...typeof s.exitCode=="number"||s.exitCode===null?{exitCode:s.exitCode}:{},...typeof s.sourceHead=="string"||s.sourceHead===null?{sourceHead:s.sourceHead}:{}})}if(t.lastPush&&typeof t.lastPush=="object"&&!Array.isArray(t.lastPush)){let s=t.lastPush,i=s.status,c=s.pushedAt;(i==="pushed"||i==="failed")&&typeof c=="string"&&(r.lastPush={status:i,pushedAt:c,...typeof s.teamId=="string"||s.teamId===null?{teamId:s.teamId}:{},...typeof s.projectId=="string"||s.projectId===null?{projectId:s.projectId}:{},...typeof s.localHead=="string"||s.localHead===null?{localHead:s.localHead}:{},...typeof s.hostedHead=="string"||s.hostedHead===null?{hostedHead:s.hostedHead}:{},...typeof s.sourceRef=="string"||s.sourceRef===null?{sourceRef:s.sourceRef}:{},...s.promotionStatus==="uploaded"||s.promotionStatus==="hosted_source_materialized"||s.promotionStatus==="hosted_source_materialize_failed"||s.promotionStatus==="hosted_source_check_pending"||s.promotionStatus==="hosted_source_check_failed"||s.promotionStatus==="hosted_source_published"||s.promotionStatus==="hosted_source_publish_failed"||s.promotionStatus==="hosted_run_pending"||s.promotionStatus==="hosted_run_passed"||s.promotionStatus==="hosted_run_failed"||s.promotionStatus===null?{promotionStatus:s.promotionStatus}:{},...s.hostedRunStatus==="not_started"||s.hostedRunStatus==="running"||s.hostedRunStatus==="passed"||s.hostedRunStatus==="failed"||s.hostedRunStatus===null?{hostedRunStatus:s.hostedRunStatus}:{},...typeof s.hostedRunAgentId=="string"||s.hostedRunAgentId===null?{hostedRunAgentId:s.hostedRunAgentId}:{},...typeof s.hostedRunId=="string"||s.hostedRunId===null?{hostedRunId:s.hostedRunId}:{},...typeof s.hostedRunAt=="string"||s.hostedRunAt===null?{hostedRunAt:s.hostedRunAt}:{},..._t(s.hostedSourceMaterialization)?{hostedSourceMaterialization:_t(s.hostedSourceMaterialization)}:{},...$t(s.hostedSourceCheck)?{hostedSourceCheck:$t(s.hostedSourceCheck)}:{},...Ot(s.hostedPublish)?{hostedPublish:Ot(s.hostedPublish)}:{},...Tt(s.hostedRun)?{hostedRun:Tt(s.hostedRun)}:{},...typeof s.error=="string"||s.error===null?{error:s.error}:{}})}if(Array.isArray(t.profiles)){let s=t.profiles.flatMap(i=>{let c=Fe(i);if(!c)return[];let l=i,u=l.source==="github"||l.source==="openpond_git"?l.source:"local",p=typeof l.repositoryId=="string"&&l.repositoryId.trim()?l.repositoryId.trim():Sn.resolve(c.repoPath);return[{source:u,repositoryId:p,repoPath:c.repoPath,profile:c.profile,...c.lastCheck?{lastCheck:c.lastCheck}:{},...c.lastPush?{lastPush:c.lastPush}:{}}]});s.length>0&&(r.profiles=s)}return r}a(Fe,"sanitizeLocalOpenPondProfile");function _t(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=xe(t.status);return o?{status:o,...m(t,"agentId"),...m(t,"runtimeAgentId"),...m(t,"projectId"),...m(t,"sourceRoot"),...m(t,"sourceRef"),...m(t,"sourceCommitSha"),...m(t,"manifestHash"),...m(t,"manifestPath"),...m(t,"manifestSyncedAt"),...Ut(t,"fileCount"),...Ut(t,"totalBytes"),...m(t,"generatedManifestPath"),...He(t,"synthesizedOpenPondYaml"),...m(t,"uploadMetadataPath"),...O(t,"setupCommands"),...O(t,"validationCommands"),...m(t,"materializedAt"),...m(t,"error")}:null}a(_t,"sanitizeHostedMaterializationStatus");function $t(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=xe(t.status);return o?{status:o,...m(t,"agentId"),...m(t,"deployPlanStatus"),...He(t,"canRun"),...He(t,"canDeploy"),...m(t,"sourceRef"),...m(t,"sourceCommitSha"),...m(t,"manifestHash"),...m(t,"manifestPath"),...O(t,"setupCommands"),...O(t,"validationCommands"),...O(t,"requiredChecks"),...O(t,"evalNames"),...O(t,"blockedReasons"),...O(t,"staleReasons"),...m(t,"runtimeId"),...m(t,"sandboxId"),...O(t,"traceArtifactRefs"),...O(t,"evalResultArtifactRefs"),...O(t,"validatorArtifactRefs"),...m(t,"checkedAt"),...m(t,"error")}:null}a($t,"sanitizeHostedSourceCheckStatus");function Ot(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=xe(t.status);return o?{status:o,...m(t,"agentId"),...m(t,"snapshotId"),...m(t,"sourceRef"),...m(t,"sourceCommitSha"),...m(t,"manifestHash"),...m(t,"manifestPath"),...m(t,"buildStatus"),...m(t,"validationStatus"),...m(t,"evalStatus"),...m(t,"publishedAt"),...m(t,"error")}:null}a(Ot,"sanitizeHostedPublishStatus");function Tt(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=xe(t.status);return o?{status:o,...m(t,"agentId"),...m(t,"runId"),...m(t,"runtimeId"),...m(t,"sandboxId"),...m(t,"sourceRef"),...m(t,"sourceCommitSha"),...m(t,"manifestHash"),...m(t,"setupGateStatus"),...O(t,"setupRequirementRefs"),...O(t,"artifactRefs"),...O(t,"traceArtifactRefs"),...O(t,"evalArtifactRefs"),...m(t,"startedAt"),...m(t,"completedAt"),...m(t,"error")}:null}a(Tt,"sanitizeHostedRunSummary");function m(e,t){let o=e[t];return typeof o=="string"||o===null?{[t]:o}:{}}a(m,"nullableStringProp");function He(e,t){let o=e[t];return typeof o=="boolean"||o===null?{[t]:o}:{}}a(He,"nullableBooleanProp");function Ut(e,t){let o=e[t];return typeof o=="number"||o===null?{[t]:o}:{}}a(Ut,"nullableNumberProp");function O(e,t){let o=e[t];if(!Array.isArray(o))return{};let n=o.filter(r=>typeof r=="string");return{[t]:n}}a(O,"stringArrayProp");function xe(e){return typeof e=="string"&&e.trim()?e.trim():null}a(xe,"stringField");function Lt(e,t){if(!de(e.handle,t.handle))return!1;let o=_(t.baseUrl);return o?_(e.baseUrl)===o:!_(e.baseUrl)}a(Lt,"accountMatchesSelector");function Ge(e,t,o={}){let n=_(t.baseUrl);if(n)return qe(e,t.handle,n);let r=e.findIndex(i=>Lt(i,t));if(r!==-1)return r;let s=e.map((i,c)=>({account:i,index:c})).filter(({account:i})=>de(i.handle,t.handle));if(s.length>1&&o.requireUnambiguous)throw new Error(`multiple profiles found for ${t.handle}; pass --base-url to select one`);return s[0]?.index??-1}a(Ge,"findAccountIndexForSelector");function xn(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,o={};return typeof t.token=="string"&&(o.token=t.token),(typeof t.appId=="string"||t.appId===null)&&(o.appId=t.appId),(typeof t.conversationId=="string"||t.conversationId===null)&&(o.conversationId=t.conversationId),Object.keys(o).length>0?o:void 0}a(xn,"sanitizeSession");function kn(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,o=z(typeof t.handle=="string"?t.handle:void 0);if(!o)return null;let n={handle:o};typeof t.apiKey=="string"&&(n.apiKey=t.apiKey),typeof t.baseUrl=="string"&&(n.baseUrl=t.baseUrl),typeof t.apiBaseUrl=="string"&&(n.apiBaseUrl=t.apiBaseUrl),typeof t.chatApiBaseUrl=="string"&&(n.chatApiBaseUrl=t.chatApiBaseUrl),typeof t.environment=="string"&&(n.environment=t.environment);let r=xn(t.session);return r&&(n.session=r),n}a(kn,"sanitizeAccount");function bn(e){let t={};return typeof e.token=="string"&&(t.token=e.token),(typeof e.appId=="string"||e.appId===null)&&(t.appId=e.appId),(typeof e.conversationId=="string"||e.conversationId===null)&&(t.conversationId=e.conversationId),Object.keys(t).length>0?t:void 0}a(bn,"extractLegacySession");function In(e,t){let o={handle:t};typeof e.apiKey=="string"&&(o.apiKey=e.apiKey),typeof e.baseUrl=="string"&&(o.baseUrl=e.baseUrl),typeof e.apiBaseUrl=="string"&&(o.apiBaseUrl=e.apiBaseUrl),typeof e.chatApiBaseUrl=="string"&&(o.chatApiBaseUrl=e.chatApiBaseUrl);let n=bn(e);return n&&(o.session=n),o}a(In,"extractLegacyAccount");function Nt(e){let t={};typeof e.lspEnabled=="boolean"&&(t.lspEnabled=e.lspEnabled),(e.executionMode==="local"||e.executionMode==="hosted")&&(t.executionMode=e.executionMode),(e.mode==="general"||e.mode==="builder")&&(t.mode=e.mode);let o=Fe(e.openpondProfile);o&&(t.openpondProfile=o);let n=[],r=Array.isArray(e.accounts)?e.accounts:[];for(let l of r){let u=kn(l);u&&qe(n,u.handle,u.baseUrl)===-1&&n.push(u)}if(n.length===0){let l=oe(e.activeProfile)?.handle||Ae;n.push(In(e,l))}let s=oe(e.activeProfile),i=s?Ge(n,s):-1,c=n[i===-1?0:i];return t.accounts=n,t.activeProfile=ne(c),t}a(Nt,"normalizeGlobalConfig");function Cn(e,t,o){let n=e.accounts??[],r=_(o??process.env.OPENPOND_BASE_URL),s=z(t);if(s)return r?{handle:s,baseUrl:r}:{handle:s};let i=z(process.env.OPENPOND_ACCOUNT);if(i)return r?{handle:i,baseUrl:r}:{handle:i};let c=oe(e.activeProfile);return c?r?{handle:c.handle,baseUrl:r}:c:n[0]?ne(n[0]):{handle:Ae}}a(Cn,"resolveRequestedProfile");function jt(e,t,o){let n=_(o);if(n){let s=qe(e,t,n);if(s!==-1)return e[s]}else{let s=e.filter(i=>de(i.handle,t));if(s.length>1)throw new Error(`multiple profiles found for ${t}; pass --base-url to select one`);if(s.length===1)return s[0]}let r={handle:t};return n&&(r.baseUrl=n),e.push(r),r}a(jt,"ensureAccount");function Mt(e){e.session&&Object.keys(e.session).length===0&&delete e.session}a(Mt,"cleanupAccount");function vn(e,t,o,n){let r=o===null||o===void 0&&n.undefinedDeletes;switch(t){case"apiKey":{if(r){delete e.apiKey;return}typeof o=="string"&&(e.apiKey=o);return}case"baseUrl":{if(r){delete e.baseUrl;return}typeof o=="string"&&(e.baseUrl=o);return}case"apiBaseUrl":{if(r){delete e.apiBaseUrl;return}typeof o=="string"&&(e.apiBaseUrl=o);return}case"chatApiBaseUrl":{if(r){delete e.chatApiBaseUrl;return}typeof o=="string"&&(e.chatApiBaseUrl=o);return}case"token":case"appId":case"conversationId":{if(e.session||(e.session={}),r){delete e.session[t],Mt(e);return}(typeof o=="string"||o===null)&&(e.session[t]=o),Mt(e);return}}}a(vn,"applyScopedKey");function En(e,t,o){if(!Rt.some(l=>W(t,l)))return!1;let r=e.accounts??[],s=oe(t.activeProfile)??Cn(e),i=_(W(t,"baseUrl")?t.baseUrl??null:s.baseUrl??process.env.OPENPOND_BASE_URL),c=jt(r,s.handle,i);for(let l of Rt)W(t,l)&&vn(c,l,t[l],o);return e.accounts=r,e.activeProfile=ne(c),!0}a(En,"applyAccountPatch");function Rn(e,t){if(W(t,"lspEnabled")&&(typeof t.lspEnabled=="boolean"?e.lspEnabled=t.lspEnabled:t.lspEnabled===null&&delete e.lspEnabled),W(t,"executionMode")&&(t.executionMode==="local"||t.executionMode==="hosted"?e.executionMode=t.executionMode:t.executionMode===null&&delete e.executionMode),W(t,"mode")&&(t.mode==="general"||t.mode==="builder"?e.mode=t.mode:t.mode===null&&delete e.mode),W(t,"activeProfile")){let o=oe(t.activeProfile);if(o){let n=Ge(e.accounts??[],o);e.activeProfile=n===-1?o:ne((e.accounts??[])[n])}else t.activeProfile===null&&delete e.activeProfile}if(W(t,"openpondProfile")){let o=Fe(t.openpondProfile);o?e.openpondProfile=o:t.openpondProfile===null&&delete e.openpondProfile}}a(Rn,"applyTopLevelPatch");async function ke(e){let t=L();return await De(t),await Ct(t,o=>{let n=Nt(o);return e(n),n})}a(ke,"updateGlobalConfig");async function T(){let e=L();return await De(e),Nt(await It(e))}a(T,"loadGlobalConfig");async function ze(){let e=await T(),t=oe(e.activeProfile);return(e.accounts??[]).map(o=>{let n=z(o.handle)??Ae;return{handle:n,baseUrl:_(o.baseUrl),apiBaseUrl:_(o.apiBaseUrl),chatApiBaseUrl:_(o.chatApiBaseUrl),environment:o.environment?.trim()||null,isActive:!!(t&&Lt({...o,handle:n},t)),hasApiKey:!!o.apiKey?.trim(),hasSessionToken:!!o.session?.token?.trim(),sessionAppId:o.session?.appId??null,sessionConversationId:o.session?.conversationId??null}})}a(ze,"listConfiguredProfiles");async function _n(e,t={}){let o=Bt(e),n=_(t.baseUrl),r=-1;await ke(i=>{let c=i.accounts??[];if(r=Ge(c,n?{handle:o,baseUrl:n}:{handle:o},{requireUnambiguous:!0}),r===-1)throw new Error(`profile not found: ${o}`);i.activeProfile=ne(c[r])});let s=await ze();return s.find(i=>i.isActive)??s[r]}a(_n,"setActiveProfile");async function $n(e){let t=Bt(e.handle),o=An(e.apiKey),n=_(e.baseUrl),r=_(e.apiBaseUrl),s=_(e.chatApiBaseUrl),i={handle:t};await ke(u=>{let p=u.accounts??[],h=jt(p,t,n);h.apiKey=o,n&&(h.baseUrl=n),r?h.apiBaseUrl=r:e.apiBaseUrl===null&&delete h.apiBaseUrl,s?h.chatApiBaseUrl=s:e.chatApiBaseUrl===null&&delete h.chatApiBaseUrl,e.environment===null?delete h.environment:typeof e.environment=="string"&&e.environment.trim()&&(h.environment=e.environment.trim()),u.accounts=p,i=ne(h),e.setActive!==!1&&(u.activeProfile=i)});let l=(await ze()).find(u=>de(u.handle,i.handle)?n?_(u.baseUrl)===n:!0:!1);if(!l)throw new Error(`failed to save profile: ${t}`);return l}a($n,"saveProfileApiKey");async function H(e){await ke(t=>{Rn(t,e),En(t,e,{undefinedDeletes:!1})})}a(H,"saveGlobalConfig");function Je(e=null){return{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!0,error:e}}a(Je,"emptyProfileCatalogState");function Ke(e=null){return{skillCount:0,generatedAt:null,stale:!0,error:e}}a(Ke,"emptyProfileSkillCatalogState");function We(){return{status:"ready",requirementCount:0,blockingCount:0,optionalMissingCount:0,readyCount:0,requirements:[],blockingRequirements:[]}}a(We,"emptyProfileSetupGate");function be(){return{changedAgents:[],newAgents:[],deletedAgents:[],changedSkills:[],changedActions:[],changedExtensions:[],setupChanges:[],envRequirementChanges:[],files:[]}}a(be,"emptyProfileDiffSummary");function Ve(e=null){return{state:e?"error":"none",message:e??"No active OpenPond profile.",agentCount:0,actionCount:0,defaultAction:null,checkFresh:!1,checkStaleReason:e??"No active profile.",localHead:null,hostedHead:null}}a(Ve,"emptyProfileSummary");import{existsSync as re}from"node:fs";import{readFile as On,stat as Tn}from"node:fs/promises";import Ie from"node:path";var Dt=".openpond/agent-manifest.json",Ht=".openpond/action-registry.json",Un=".openpond/source-upload-metadata.json",Mn=".openpond/agent-package-origin.json";async function Gt(e){return Jt({agentId:"default",sourcePath:e,preferred:!0})}a(Gt,"loadProfileActionCatalog");async function zt(e){if(e.length===0)return{catalog:{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!1,error:null},actionCatalog:[],sourceSetupRequirements:[]};let t=[...e.filter(c=>c.preferred),...e.filter(c=>!c.preferred)],o=await Promise.all(t.map(Jt)),n=new Map,r=[];for(let c of o)for(let l of c.actionCatalog){let u=n.has(l.id)?`${l.agentId??"agent"}.${l.sourceActionId??l.id}`:l.id,p=u===l.id?l:{...l,id:u};n.set(u,p),r.push(p)}let s=Ln(o.map(c=>c.catalog.generatedAt)),i=o.map(c=>c.catalog.error).filter(Boolean);return{catalog:{actionCount:r.length,generatedAt:s,manifestPath:o.find(c=>c.catalog.manifestPath)?.catalog.manifestPath??null,registryPath:o.find(c=>c.catalog.registryPath)?.catalog.registryPath??null,stale:o.some(c=>c.catalog.stale),error:i.length>0?i.join("; "):null},actionCatalog:r,sourceSetupRequirements:o.flatMap(c=>c.sourceSetupRequirements)}}a(zt,"loadProfileActionCatalogForSources");async function Jt(e){let t=e.sourcePath,o=Ie.join(t,Dt),n=Ie.join(t,Ht),r=Ie.join(t,Un),s=Ie.join(t,Mn);try{let i=await Ce(o),c=await Ce(n),l=await Ce(r),u=$(await Ce(s)),p=$($(i)?.inputSchemas),h=Ft($(l)?.setupRequirements)??[],k=Nn(h),C=new Map;for(let f of[...Ye($(i)?.actionCatalog),...Ye($(c)?.actions),...Ye($(i)?.actions)]){let y=b(f.id)??b(f.name);if(!y)continue;let x=C.get(y),v=jn({sourceRequirementsByAction:k,actionId:y,actionName:b(f.name)}),B=Dn(Ft(f.setupRequirements)??x?.setupRequirements??[],v),K={id:y,agentId:e.agentId,sourcePath:t,sourceActionId:y,name:b(f.name)??x?.name??y,label:b(f.label)??x?.label??zn(y),description:b(f.description)??x?.description??null,visibility:b(f.visibility)??x?.visibility??"default",inputSchema:Gn(f.inputSchema,p)??x?.inputSchema??null,outputSchema:Kt(f.outputSchema)??x?.outputSchema??null,approvalPolicy:$(f.approvalPolicy)??x?.approvalPolicy??null,artifactPolicy:$(f.artifactPolicy)??x?.artifactPolicy??null,setupRequirements:B,mcp:$(f.mcp)??x?.mcp??null,schedulePolicy:$(f.schedulePolicy)??x?.schedulePolicy??null,trace:Bn($(f.trace)??x?.trace??null,u),implementation:$(f.implementation)??x?.implementation??null,invokesModel:typeof f.invokesModel=="boolean"?f.invokesModel:x?.invokesModel};C.set(y,K)}let P=Array.from(C.values()).filter(f=>f.visibility!=="internal"&&f.visibility!=="debug"),g=[...i?[]:[Dt],...c?[]:[Ht]],S=await Fn([o,n]);return{catalog:{actionCount:P.length,generatedAt:S,manifestPath:re(o)?o:null,registryPath:re(n)?n:null,stale:g.length>0,error:g.length>0?qn(e,g):null},actionCatalog:P,sourceSetupRequirements:h}}catch(i){return{catalog:{actionCount:0,generatedAt:null,manifestPath:re(o)?o:null,registryPath:re(n)?n:null,stale:!0,error:i instanceof Error?i.message:String(i)},actionCatalog:[],sourceSetupRequirements:[]}}}a(Jt,"loadProfileActionCatalogSource");function Bn(e,t){if(!t)return e;let o=b(t.versionId),n=b(t.digest);return!o||!n?e:{...e??{},agentVersionId:o,agentPackageDigest:n,validationReceiptIds:qt(t.validationReceiptIds),evalReceiptIds:qt(t.evalReceiptIds)}}a(Bn,"mergeAgentPackageTrace");function qt(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim().length>0):[]}a(qt,"stringArray");function Ln(e){let t=0;for(let o of e){if(!o)continue;let n=Date.parse(o);Number.isFinite(n)&&(t=Math.max(t,n))}return t>0?new Date(t).toISOString():null}a(Ln,"latestIso");function Nn(e){let t=new Map;for(let o of e){let n=[b(o.actionId),b(o.sourceActionId),b(o.actionName)].filter(r=>!!r);for(let r of n){let s=t.get(r)??[];s.push(o),t.set(r,s)}}return t}a(Nn,"sourceSetupRequirementsByAction");function jn(e){return[...e.sourceRequirementsByAction.get(e.actionId)??[],...e.actionName&&e.actionName!==e.actionId?e.sourceRequirementsByAction.get(e.actionName)??[]:[]].map(o=>({...o,source:"source_upload_metadata"}))}a(jn,"setupRequirementsForActionSource");function Dn(e,t){if(t.length===0)return e;let o=[],n=new Set;for(let r of[...e,...t]){let s=Hn(r);n.has(s)||(n.add(s),o.push(r))}return o}a(Dn,"mergeSetupRequirements");function Hn(e){return[b(e.actionId)??b(e.sourceActionId)??b(e.actionName)??"",b(e.kind)??b(e.type)??"",b(e.name)??b(e.key)??b(e.provider)??b(e.tool)??b(e.command)??b(e.packageName)??b(e.path)??b(e.repo)??b(e.url)??b(e.id)??""].join(":")}a(Hn,"setupRequirementIdentity");function qn(e,t){return[`Profile agent ${e.agentId} at ${e.sourcePath} is missing SDK catalog artifact(s): ${t.join(", ")}.`,"Run `openpond profile check --kind all` after source materialization so each enabled profile agent has inspect/build artifacts."].join(" ")}a(qn,"missingSourceArtifactsMessage");async function Ce(e){return re(e)?JSON.parse(await On(e,"utf8")):null}a(Ce,"readJsonIfExists");async function Fn(e){let t=0;for(let o of e){if(!re(o))continue;let n=await Tn(o);t=Math.max(t,n.mtimeMs)}return t>0?new Date(t).toISOString():null}a(Fn,"latestMtime");function $(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}a($,"asRecord");function Ye(e){return Array.isArray(e)?e.filter(t=>!!$(t)):[]}a(Ye,"records");function Ft(e){return Array.isArray(e)?e.filter(t=>!!$(t)):null}a(Ft,"recordArray");function b(e){return typeof e=="string"&&e.trim()?e.trim():null}a(b,"text");function Kt(e){return b(e)??$(e)}a(Kt,"schemaValue");function Gn(e,t){let o=Kt(e);return typeof o!="string"?o:$(t?.[o])??o}a(Gn,"resolvedSchemaValue");function zn(e){let t=e.replace(/[._-]+/g," ").trim();return t?t.replace(/\b\w/g,o=>o.toUpperCase()):e}a(zn,"titleFromActionId");var ve=class extends Error{static{a(this,"OpenPondProfileSetupRequiredError")}code="agent_source_setup_required";details;constructor(t,o){let n=o.blockingRequirements.map(r=>r.label);super(["agent_source_setup_required",`Profile action ${t} has unresolved required setup.`,n.length?`Missing setup: ${n.join(", ")}`:""].filter(Boolean).join(`
|
|
3
3
|
`)),this.name="OpenPondProfileSetupRequiredError",this.details={error:"agent_source_setup_required",actionId:t,setupGate:o,missing:n,blockingSetupRequirements:o.blockingRequirements,setupRequirements:o.requirements}}};function Ee(e){let t=new Map;for(let i of e.sourceSetupRequirements??[]){let c=Kn(i);if(e.actionId&&c&&c!==e.actionId&&E(i.actionName)!==e.actionId&&E(i.sourceActionId)!==e.actionId)continue;let l=Wt({record:i,source:"source_upload_metadata",actionId:c});l&&t.set(l.ref,l)}for(let i of e.actionCatalog)if(!(e.actionId&&i.id!==e.actionId&&i.name!==e.actionId))for(let c of i.setupRequirements??[]){let l=Wt({record:c,source:"action_catalog",actionId:i.id});l&&t.set(l.ref,l)}let o=Array.from(t.values()),n=o.filter(i=>i.blocking),r=o.filter(i=>!i.required&&!Xe(i.status)).length,s=o.filter(i=>Xe(i.status)).length;return{status:Vn(n),requirementCount:o.length,blockingCount:n.length,optionalMissingCount:r,readyCount:s,requirements:o,blockingRequirements:n}}a(Ee,"buildOpenPondProfileSetupGate");function Ze(e,t){if(t.blockingRequirements.length>0)throw new ve(e,t)}a(Ze,"assertOpenPondProfileActionReady");function Jn(e){let t=e.actionId?`${e.actionId}: `:"",o=e.required?"required":"optional";return`${t}${e.label} (${o}, ${e.status})`}a(Jn,"formatOpenPondProfileSetupRequirement");function Wt(e){let t=e.source==="action_catalog"&&E(e.record.source)==="source_upload_metadata"?"source_upload_metadata":e.source,o=E(e.record.kind)??E(e.record.type),n=E(e.record.label)??E(e.record.name)??E(e.record.key)??E(e.record.provider)??E(e.record.tool)??E(e.record.command)??E(e.record.packageName)??E(e.record.path)??E(e.record.repo)??E(e.record.url)??E(e.record.id)??o??"setup requirement",r=e.record.required!==!1,s=Wn(e.record);return{ref:[t,e.actionId??"source",o??"requirement",n].join(":"),source:t,actionId:e.actionId,kind:o,label:n,status:s,required:r,blocking:r&&!Xe(s)}}a(Wt,"setupRequirementFromRecord");function Kn(e){return E(e.actionId)??E(e.sourceActionId)??E(e.actionName)}a(Kn,"setupRequirementActionId");function Wn(e){let t=E(e.status)??E(e.state);return t?t==="satisfied"||t==="connected"||t==="provided"?"ready":t:typeof e.satisfied=="boolean"?e.satisfied?"ready":"setup_required":typeof e.ready=="boolean"&&e.ready?"ready":"setup_required"}a(Wn,"setupStatus");function Vn(e){return e.length===0?"ready":e.some(t=>["blocked","unsupported","unsupported_dependency","stale"].includes(t.status))?"blocked":"setup_required"}a(Vn,"gateStatus");function Xe(e){return e==="ready"||e==="disabled"}a(Xe,"isReadyStatus");function E(e){return typeof e=="string"&&e.trim()?e.trim():null}a(E,"text");import{spawn as Yn}from"node:child_process";import{randomUUID as Xn}from"node:crypto";import{existsSync as Qe}from"node:fs";import{readFile as Zn,rm as Qn,writeFile as Xt}from"node:fs/promises";import Re from"node:path";var Zt=["**/node_modules/","**/.bun/","**/.env","**/.env.*","**/.openpond/traces/","**/.openpond/vendor/","**/.openpond/eval-results.json","**/.openpond/artifact-index.json","**/.openpond/source-upload-cache.json",""].join(`
|
|
4
4
|
`);async function Qt(e){if(!Qe(Re.join(e,".git"))){let s=await M(e,["init","-b","main"]);if(s.code!==0)throw new Error(Y("git init",s))}let t=Re.join(e,".gitignore");if(Qe(t)?await er(t):await Xt(t,Zt,"utf8"),await or(e))return;let o=await X(e);if(!o.dirty&&o.files.length===0)return;let n=await M(e,["add","-A"]);if(n.code!==0)throw new Error(Y("git add",n));let r=await M(e,["commit","-m","Initialize OpenPond profile"],{env:{...process.env,GIT_AUTHOR_NAME:process.env.GIT_AUTHOR_NAME||"OpenPond",GIT_AUTHOR_EMAIL:process.env.GIT_AUTHOR_EMAIL||"openpond@example.invalid",GIT_COMMITTER_NAME:process.env.GIT_COMMITTER_NAME||"OpenPond",GIT_COMMITTER_EMAIL:process.env.GIT_COMMITTER_EMAIL||"openpond@example.invalid"}});if(r.code!==0&&!/nothing to commit/i.test(r.stdout+r.stderr))throw new Error(Y("git commit",r))}a(Qt,"ensureProfileGitRepo");async function er(e){let t=await Zn(e,"utf8").catch(()=>""),o=Zt.split(/\r?\n/).map(r=>r.trim()).filter(Boolean).filter(r=>!t.split(/\r?\n/).some(s=>s.trim()===r));if(o.length===0)return;let n=t.endsWith(`
|
|
5
5
|
`)||t.length===0?"":`
|
|
@@ -16,8 +16,8 @@ import{x as bt}from"./chunk-NM2GYDPA.js";import{a as Et,b as Se}from"./chunk-L3K
|
|
|
16
16
|
`,{mode:384,flag:"wx"})}a(qr,"materializeAgentPackage");function _o(e){let t=e.trim().replaceAll("\\","/"),o=d.posix.normalize(t);if(!o||o==="."||o===".."||o.startsWith("/")||o.startsWith("../")||o.split("/").some(n=>n===".."))throw new Error(`Agent package contains an invalid source path: ${e}.`);return o}a(_o,"normalizeAgentPackagePath");function Fr(e){return JSON.stringify(lt(e))}a(Fr,"stableAgentPackageJson");function lt(e){return Array.isArray(e)?e.map(lt):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).sort(([t],[o])=>t.localeCompare(o)).map(([t,o])=>[t,lt(o)]))}a(lt,"sortAgentPackageJson");function pe(){let e=br.resolve("openpond-agent-sdk/package.json");return d.dirname(e)}a(pe,"resolveAgentSdkRoot");async function gi(){let e=pe();return await vo(e),e}a(gi,"prepareAgentSdkRuntimePackage");function Gr(){let e=pe(),t=d.join(e,"dist","cli.js");if(U(t))return{command:process.execPath,args:[t]};let o=d.join(e,"src","cli.ts");if(U(o))return{command:process.execPath,args:[$o(e),o]};throw new Error(`openpond-agent CLI was not found under ${e}`)}a(Gr,"resolveAgentSdkCliLaunch");function $o(e){return Po(d.join(e,"package.json")).resolve("tsx/cli")}a($o,"resolveTsxCli");async function Oo(e,t,o={}){return new Promise((n,r)=>{let s=Pr(e,t,{cwd:o.cwd,stdio:o.inherit?"inherit":"pipe"}),i="",c="",l=!1,u=!1,p=!1,h=o.timeoutMs??600*1e3,k=o.maxOutputBytes??2*1024*1024,C=h>0?setTimeout(()=>{p=!0,s.kill("SIGTERM")},h):null,P=h>0?setTimeout(()=>{p&&s.exitCode===null&&s.kill("SIGKILL")},h+5e3):null;o.inherit||(s.stdout?.on("data",S=>{let f=wo(i,String(S),k,l);i=f.text,l=f.truncated}),s.stderr?.on("data",S=>{let f=wo(c,String(S),k,u);c=f.text,u=f.truncated}));let g=a(()=>{C&&clearTimeout(C),P&&clearTimeout(P)},"clearTimers");s.on("error",S=>{g(),r(S)}),s.on("close",S=>{g(),n({code:S,stdout:i,stderr:c,timedOut:p,stdoutTruncated:l,stderrTruncated:u})})})}a(Oo,"spawnCommand");function wo(e,t,o,n){if(n)return{text:e,truncated:!0};let r=`${e}${t}`;return Buffer.byteLength(r,"utf8")<=o?{text:r,truncated:!1}:{text:`${Buffer.from(r).subarray(0,Math.max(0,o)).toString("utf8")}
|
|
17
17
|
[truncated after ${o} bytes]
|
|
18
18
|
`,truncated:!0}}a(wo,"appendBoundedOutput");function To(e,t){let o=e.stderr.trim()||e.stdout.trim(),n=[e.timedOut?`${t} timed out`:"",e.stdoutTruncated?"stdout truncated":"",e.stderrTruncated?"stderr truncated":""].filter(Boolean);return[o,...n].filter(Boolean).join(`
|
|
19
|
-
`)}a(To,"commandFailureDetail");var Ei=new URL(Pe).hostname,Ri=new URL(we).hostname;async function Ho(e,t,o){let n=new URLSearchParams;o?.handle&&n.set("handle",o.handle),typeof o?.limit=="number"&&Number.isFinite(o.limit)&&n.set("limit",String(Math.max(1,Math.floor(o.limit)))),typeof o?.offset=="number"&&Number.isFinite(o.offset)&&n.set("offset",String(Math.max(0,Math.floor(o.offset)))),typeof o?.includeScheduled=="boolean"&&n.set("includeScheduled",o.includeScheduled?"true":"false");let r=n.toString(),s=await j(e,t,`/apps/list${r?`?${r}`:""}`,{method:"GET"});if(!s.ok){let c=await s.text().catch(()=>"");throw new Error(`Apps list failed: ${s.status} ${c}`)}let i=await s.json().catch(()=>({}));return Array.isArray(i.apps)?i.apps:[]}a(Ho,"listApps");async function qo(e,t,o){let n=await j(e,t,"/apps/repo/create",{method:"POST",body:JSON.stringify(o)});if(!n.ok){let r=await n.text().catch(()=>"");throw new Error(`Repo create failed: ${n.status} ${r}`)}return await n.json()}a(qo,"createRepo");async function _i(e,t,o,n){let r=await j(e,t,`/apps/${encodeURIComponent(o)}/code-visibility`,{method:"PATCH",body:JSON.stringify({codeVisibility:n})});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Code visibility update failed: ${r.status} ${s}`)}return await r.json()}a(_i,"updateAppCodeVisibility");async function Fo(e,t,o){let n=await j(e,t,`/v4/apps/${o}/environment`,{method:"GET"});if(!n.ok){let r=await n.text().catch(()=>"");throw new Error(`Environment get failed: ${n.status} ${r}`)}return await n.json()}a(Fo,"getAppEnvironment");async function Go(e,t){let o=await j(e,t,"/v1/account",{method:"GET"});if(!o.ok){let n=await o.text().catch(()=>"");throw new Error(`Account lookup failed: ${o.status} ${n}`)}return await o.json()}a(Go,"getOpenPondAccount");var zo=3600*1e3;async function Mc(e,t,o,n={}){let r=await(n.apiFetch??j)(e,t,n.path??bt,{method:"POST",signal:n.signal,body:JSON.stringify(o)}),s=await r.json().catch(()=>({})),i=r.status!==404&&r.status!==405&&r.status!==501;return r.ok?{ok:typeof s.ok=="boolean"?s.ok:!0,status:r.status,endpointAvailable:i,output:Yo(s),data:Xo(s)}:{ok:!1,status:r.status,endpointAvailable:i,output:Yo(s)??(i?`Connected app tool call failed with status ${r.status}.`:`Connected app tool-call endpoint is not available (${r.status}).`),data:Xo(s)}}a(Mc,"executeConnectedAppToolCall");function Yo(e){return typeof e.output=="string"&&e.output.trim()?e.output.trim():typeof e.message=="string"&&e.message.trim()?e.message.trim():typeof e.error=="string"&&e.error.trim()?e.error.trim():null}a(Yo,"responsePayloadMessage");function Xo(e){return"data"in e?e.data:"result"in e?e.result:null}a(Xo,"responsePayloadData");var A=class extends Error{static{a(this,"GithubExtensionError")}code;status;constructor(t,o){super(t),this.name="GithubExtensionError",this.code=o.code,this.status=o.status??400}};import{createHash as nn}from"node:crypto";import ht from"node:path";var Zo="HEAD",Qo=64,en=512,rn=20*1024*1024,mt=5*1024*1024,sn=8,vs=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,tn=/^[A-Za-z0-9_.-]+$/,on=new Set(["agents","assets","references","scripts"]);function an(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 r=await Es(n,t,o);return{preview:await Rs(r,t,o),files:cn(r)}},async download(n,r){await Ts({resolution:n,fetchImpl:t,githubToken:o,writeFile:r})}}}a(an,"createGithubSourceClient");function V(e){let t=e.trim(),o="",n="";if(/^(?:https?:\/\/)?github\.com\//i.test(t)){let i=new URL(t.startsWith("http")?t:`https://${t}`);if(i.hostname.toLowerCase()!=="github.com")throw Te(e);let c=i.pathname.replace(/^\/+|\/+$/g,"").split("/");if(c.length!==2)throw Te(e);[o="",n=""]=c}else{let c=t.replace(/^github:/i,"").replace(/^\/+|\/+$/g,"").split("/");if(c.length!==2)throw Te(e);[o="",n=""]=c}if(n=n.replace(/\.git$/i,""),!tn.test(o)||!tn.test(n))throw Te(e);let r=o.toLowerCase(),s=n.toLowerCase();return{id:`github:${r}/${s}`,owner:r,repo:s,repositoryUrl:`https://github.com/${r}/${s}`}}a(V,"parseGithubExtensionSource");async function Es(e,t,o){let n=V(e.source),r=e.ref?.trim()||Zo,s=await pt(t,o,`/repos/${n.owner}/${n.repo}`),i=r===Zo?s.default_branch?.trim()||"main":r,c=await pt(t,o,`/repos/${n.owner}/${n.repo}/commits/${encodeURIComponent(i)}`),l=c.sha?.trim(),u=c.commit?.tree?.sha?.trim();if(!l||!u)throw new A("GitHub returned an incomplete commit response.",{code:"github_invalid_commit",status:502});let p=await pt(t,o,`/repos/${n.owner}/${n.repo}/git/trees/${u}?recursive=1`);if(p.truncated)throw new A("The GitHub repository tree is too large to install safely.",{code:"github_tree_truncated"});let h=(p.tree??[]).filter(Bs),k=$s(h);if(k.length===0)throw new A("No skills found. Add SKILL.md at the repository root or use a standard agent skills directory.",{code:"extension_no_skills"});if(k.length>Qo)throw new A(`Extension contains more than ${Qo} skills.`,{code:"extension_too_many_skills"});Ms(k);let C=h.find(P=>P.type==="blob"&&/^readme(?:\.[^/]+)?$/i.test(P.path))??null;return{identity:n,requestedRef:r,resolvedCommit:l,tree:h,skillPackages:k,readme:C}}a(Es,"resolveSource");async function Rs(e,t,o){let n=await dn(e.skillPackages,sn,async c=>{let l=await Us(e,c.entry,t,o);return _s(c,l)}),r=js(n.map(c=>c.name));for(let c of n)r.has(c.name)&&(c.validationStatus="error",c.validationMessages=[...c.validationMessages,`Duplicate skill name: ${c.name}`]);let s=n.flatMap(c=>c.validationMessages.map(l=>`${c.relativePath}: ${l}`)),i=cn(e);return{...e.identity,source:"github",requestedRef:e.requestedRef,resolvedCommit:e.resolvedCommit,sourcePath:null,readmePath:e.readme?.path??null,packageHash:Ls(i),skills:n.sort((c,l)=>c.name.localeCompare(l.name)),validationStatus:s.length===0?"valid":"error",validationMessages:s}}a(Rs,"buildPreview");function _s(e,t){let o=Se(t),n=e.root==="."?null:ht.posix.basename(e.root),r=o.name??n??"invalid-skill",s=[...o.messages];vs.test(r)||s.push("Skill name must be lowercase kebab-case."),n&&r!==n&&s.push(`Skill name must match its directory name (${n}).`);let i=e.files.filter(c=>c.path!==e.entry.path).map(c=>Ns(e.root,c.path)).sort();return{name:r,description:o.description??"",relativePath:e.root==="."?"SKILL.md":`${e.root}/SKILL.md`,sourcePath:"",charCount:t.length,sourceHash:nn("sha256").update(t).digest("hex"),resourceFiles:i,validationStatus:s.length===0?"valid":"error",validationMessages:[...new Set(s)]}}a(_s,"previewSkill");function $s(e){let t=[],o=e.find(c=>c.type==="blob"&&c.path==="SKILL.md");o&&t.push({root:".",entry:o});let n=e.filter(c=>c.type==="blob"&&c.path.endsWith("/SKILL.md")),r=n.filter(c=>Os(c.path)),s=r.length>0?r:n,i=new Set(s.map(c=>ht.posix.dirname(c.path)));for(let c of s){let l=ht.posix.dirname(c.path);[...i].some(u=>u!==l&&l.startsWith(`${u}/`))||t.push({root:l,entry:c})}return t.map(({root:c,entry:l})=>{let u=e.filter(k=>{if(k.type!=="blob")return!1;if(c!==".")return k.path.startsWith(`${c}/`);if(k.path==="SKILL.md")return!0;let C=k.path.split("/",1)[0]??"";return on.has(C)}),p=e.find(k=>k.type!=="blob"&&k.type!=="tree"&&(c==="."?k.path==="SKILL.md"||on.has(k.path.split("/",1)[0]??""):k.path.startsWith(`${c}/`))),h=u.find(k=>k.mode==="120000");if(p||h)throw new A(`Skill package ${c} contains a symlink or submodule.`,{code:"extension_unsafe_entry"});return{root:c,entry:l,files:u}})}a($s,"discoverSkillPackages");function Os(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 r=o.slice(0,n),s=o.slice(n+1);if(s.length<1||s.length>2)return!1;if(n===0)return!0;let i=r[0]??"";return i.startsWith(".")||i==="agent"||i==="data"}a(Os,"isStandardAgentSkillsPath");function cn(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))}a(cn,"filesToDownload");async function Ts(e){let t=0;await dn(e.resolution.files,sn,async o=>{let n=await ln({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>rn)throw new A("Extension download exceeds the maximum allowed size.",{code:"extension_too_large"});await e.writeFile(o.path,n,o.mode==="100755")})}a(Ts,"downloadFiles");async function Us(e,t,o,n){let r=await ln({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(r)}a(Us,"downloadText");async function ln(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:un(e.githubToken,"application/vnd.github.raw"),redirect:"follow"});if(!n.ok)throw new A(`GitHub file download failed (${n.status}): ${e.file.path}`,{code:"github_download_failed",status:n.status});let r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>mt)throw new A(`Extension file is too large: ${e.file.path}`,{code:"extension_file_too_large"});let s=new Uint8Array(await n.arrayBuffer());if(s.byteLength>mt)throw new A(`Extension file is too large: ${e.file.path}`,{code:"extension_file_too_large"});return s}a(ln,"downloadBytes");async function pt(e,t,o){let n=await e(`https://api.github.com${o}`,{headers:un(t,"application/vnd.github+json")});if(!n.ok){let r=await n.json().catch(()=>null),s=typeof r?.message=="string"?`: ${r.message}`:"";throw new A(`GitHub request failed (${n.status})${s}`,{code:n.status===404?"github_repository_not_found":"github_request_failed",status:n.status})}return await n.json()}a(pt,"githubJson");function un(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}a(un,"githubHeaders");function Ms(e){let t=new Map;for(let n of e)for(let r of n.files)t.set(r.path,r);if(t.size>en)throw new A(`Extension contains more than ${en} skill files.`,{code:"extension_too_many_files"});let o=0;for(let n of t.values()){if((n.size??0)>mt)throw new A(`Extension file is too large: ${n.path}`,{code:"extension_file_too_large"});o+=n.size??0}if(o>rn)throw new A("Extension exceeds the maximum allowed size.",{code:"extension_too_large"})}a(Ms,"validateDownloadLimits");function Bs(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"}a(Bs,"validTreeEntry");function Ls(e){let t=nn("sha256");for(let o of e)t.update(`${o.path}\0${o.sha}\0${o.size??""}
|
|
19
|
+
`)}a(To,"commandFailureDetail");var Ei=new URL(Pe).hostname,Ri=new URL(we).hostname;async function Ho(e,t,o){let n=new URLSearchParams;o?.handle&&n.set("handle",o.handle),typeof o?.limit=="number"&&Number.isFinite(o.limit)&&n.set("limit",String(Math.max(1,Math.floor(o.limit)))),typeof o?.offset=="number"&&Number.isFinite(o.offset)&&n.set("offset",String(Math.max(0,Math.floor(o.offset)))),typeof o?.includeScheduled=="boolean"&&n.set("includeScheduled",o.includeScheduled?"true":"false");let r=n.toString(),s=await j(e,t,`/apps/list${r?`?${r}`:""}`,{method:"GET"});if(!s.ok){let c=await s.text().catch(()=>"");throw new Error(`Apps list failed: ${s.status} ${c}`)}let i=await s.json().catch(()=>({}));return Array.isArray(i.apps)?i.apps:[]}a(Ho,"listApps");async function qo(e,t,o){let n=await j(e,t,"/apps/repo/create",{method:"POST",body:JSON.stringify(o)});if(!n.ok){let r=await n.text().catch(()=>"");throw new Error(`Repo create failed: ${n.status} ${r}`)}return await n.json()}a(qo,"createRepo");async function _i(e,t,o,n){let r=await j(e,t,`/apps/${encodeURIComponent(o)}/code-visibility`,{method:"PATCH",body:JSON.stringify({codeVisibility:n})});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Code visibility update failed: ${r.status} ${s}`)}return await r.json()}a(_i,"updateAppCodeVisibility");async function Fo(e,t,o){let n=await j(e,t,`/v4/apps/${o}/environment`,{method:"GET"});if(!n.ok){let r=await n.text().catch(()=>"");throw new Error(`Environment get failed: ${n.status} ${r}`)}return await n.json()}a(Fo,"getAppEnvironment");async function Go(e,t){let o=await j(e,t,"/v1/account",{method:"GET"});if(!o.ok){let n=await o.text().catch(()=>"");throw new Error(`Account lookup failed: ${o.status} ${n}`)}return await o.json()}a(Go,"getOpenPondAccount");var zo=3600*1e3;async function Mc(e,t,o,n={}){let r=await(n.apiFetch??j)(e,t,n.path??vt,{method:"POST",signal:n.signal,body:JSON.stringify(o)}),s=await r.json().catch(()=>({})),i=r.status!==404&&r.status!==405&&r.status!==501;return r.ok?{ok:typeof s.ok=="boolean"?s.ok:!0,status:r.status,endpointAvailable:i,output:Yo(s),data:Xo(s)}:{ok:!1,status:r.status,endpointAvailable:i,output:Yo(s)??(i?`Connected app tool call failed with status ${r.status}.`:`Connected app tool-call endpoint is not available (${r.status}).`),data:Xo(s)}}a(Mc,"executeConnectedAppToolCall");function Yo(e){return typeof e.output=="string"&&e.output.trim()?e.output.trim():typeof e.message=="string"&&e.message.trim()?e.message.trim():typeof e.error=="string"&&e.error.trim()?e.error.trim():null}a(Yo,"responsePayloadMessage");function Xo(e){return"data"in e?e.data:"result"in e?e.result:null}a(Xo,"responsePayloadData");var A=class extends Error{static{a(this,"GithubExtensionError")}code;status;constructor(t,o){super(t),this.name="GithubExtensionError",this.code=o.code,this.status=o.status??400}};import{createHash as nn}from"node:crypto";import ht from"node:path";var Zo="HEAD",Qo=64,en=512,rn=20*1024*1024,mt=5*1024*1024,sn=8,vs=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,tn=/^[A-Za-z0-9_.-]+$/,on=new Set(["agents","assets","references","scripts"]);function an(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 r=await Es(n,t,o);return{preview:await Rs(r,t,o),files:cn(r)}},async download(n,r){await Ts({resolution:n,fetchImpl:t,githubToken:o,writeFile:r})}}}a(an,"createGithubSourceClient");function V(e){let t=e.trim(),o="",n="";if(/^(?:https?:\/\/)?github\.com\//i.test(t)){let i=new URL(t.startsWith("http")?t:`https://${t}`);if(i.hostname.toLowerCase()!=="github.com")throw Te(e);let c=i.pathname.replace(/^\/+|\/+$/g,"").split("/");if(c.length!==2)throw Te(e);[o="",n=""]=c}else{let c=t.replace(/^github:/i,"").replace(/^\/+|\/+$/g,"").split("/");if(c.length!==2)throw Te(e);[o="",n=""]=c}if(n=n.replace(/\.git$/i,""),!tn.test(o)||!tn.test(n))throw Te(e);let r=o.toLowerCase(),s=n.toLowerCase();return{id:`github:${r}/${s}`,owner:r,repo:s,repositoryUrl:`https://github.com/${r}/${s}`}}a(V,"parseGithubExtensionSource");async function Es(e,t,o){let n=V(e.source),r=e.ref?.trim()||Zo,s=await pt(t,o,`/repos/${n.owner}/${n.repo}`),i=r===Zo?s.default_branch?.trim()||"main":r,c=await pt(t,o,`/repos/${n.owner}/${n.repo}/commits/${encodeURIComponent(i)}`),l=c.sha?.trim(),u=c.commit?.tree?.sha?.trim();if(!l||!u)throw new A("GitHub returned an incomplete commit response.",{code:"github_invalid_commit",status:502});let p=await pt(t,o,`/repos/${n.owner}/${n.repo}/git/trees/${u}?recursive=1`);if(p.truncated)throw new A("The GitHub repository tree is too large to install safely.",{code:"github_tree_truncated"});let h=(p.tree??[]).filter(Bs),k=$s(h);if(k.length===0)throw new A("No skills found. Add SKILL.md at the repository root or use a standard agent skills directory.",{code:"extension_no_skills"});if(k.length>Qo)throw new A(`Extension contains more than ${Qo} skills.`,{code:"extension_too_many_skills"});Ms(k);let C=h.find(P=>P.type==="blob"&&/^readme(?:\.[^/]+)?$/i.test(P.path))??null;return{identity:n,requestedRef:r,resolvedCommit:l,tree:h,skillPackages:k,readme:C}}a(Es,"resolveSource");async function Rs(e,t,o){let n=await dn(e.skillPackages,sn,async c=>{let l=await Us(e,c.entry,t,o);return _s(c,l)}),r=js(n.map(c=>c.name));for(let c of n)r.has(c.name)&&(c.validationStatus="error",c.validationMessages=[...c.validationMessages,`Duplicate skill name: ${c.name}`]);let s=n.flatMap(c=>c.validationMessages.map(l=>`${c.relativePath}: ${l}`)),i=cn(e);return{...e.identity,source:"github",requestedRef:e.requestedRef,resolvedCommit:e.resolvedCommit,sourcePath:null,readmePath:e.readme?.path??null,packageHash:Ls(i),skills:n.sort((c,l)=>c.name.localeCompare(l.name)),validationStatus:s.length===0?"valid":"error",validationMessages:s}}a(Rs,"buildPreview");function _s(e,t){let o=Se(t),n=e.root==="."?null:ht.posix.basename(e.root),r=o.name??n??"invalid-skill",s=[...o.messages];vs.test(r)||s.push("Skill name must be lowercase kebab-case."),n&&r!==n&&s.push(`Skill name must match its directory name (${n}).`);let i=e.files.filter(c=>c.path!==e.entry.path).map(c=>Ns(e.root,c.path)).sort();return{name:r,description:o.description??"",relativePath:e.root==="."?"SKILL.md":`${e.root}/SKILL.md`,sourcePath:"",charCount:t.length,sourceHash:nn("sha256").update(t).digest("hex"),resourceFiles:i,validationStatus:s.length===0?"valid":"error",validationMessages:[...new Set(s)]}}a(_s,"previewSkill");function $s(e){let t=[],o=e.find(c=>c.type==="blob"&&c.path==="SKILL.md");o&&t.push({root:".",entry:o});let n=e.filter(c=>c.type==="blob"&&c.path.endsWith("/SKILL.md")),r=n.filter(c=>Os(c.path)),s=r.length>0?r:n,i=new Set(s.map(c=>ht.posix.dirname(c.path)));for(let c of s){let l=ht.posix.dirname(c.path);[...i].some(u=>u!==l&&l.startsWith(`${u}/`))||t.push({root:l,entry:c})}return t.map(({root:c,entry:l})=>{let u=e.filter(k=>{if(k.type!=="blob")return!1;if(c!==".")return k.path.startsWith(`${c}/`);if(k.path==="SKILL.md")return!0;let C=k.path.split("/",1)[0]??"";return on.has(C)}),p=e.find(k=>k.type!=="blob"&&k.type!=="tree"&&(c==="."?k.path==="SKILL.md"||on.has(k.path.split("/",1)[0]??""):k.path.startsWith(`${c}/`))),h=u.find(k=>k.mode==="120000");if(p||h)throw new A(`Skill package ${c} contains a symlink or submodule.`,{code:"extension_unsafe_entry"});return{root:c,entry:l,files:u}})}a($s,"discoverSkillPackages");function Os(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 r=o.slice(0,n),s=o.slice(n+1);if(s.length<1||s.length>2)return!1;if(n===0)return!0;let i=r[0]??"";return i.startsWith(".")||i==="agent"||i==="data"}a(Os,"isStandardAgentSkillsPath");function cn(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))}a(cn,"filesToDownload");async function Ts(e){let t=0;await dn(e.resolution.files,sn,async o=>{let n=await ln({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>rn)throw new A("Extension download exceeds the maximum allowed size.",{code:"extension_too_large"});await e.writeFile(o.path,n,o.mode==="100755")})}a(Ts,"downloadFiles");async function Us(e,t,o,n){let r=await ln({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(r)}a(Us,"downloadText");async function ln(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:un(e.githubToken,"application/vnd.github.raw"),redirect:"follow"});if(!n.ok)throw new A(`GitHub file download failed (${n.status}): ${e.file.path}`,{code:"github_download_failed",status:n.status});let r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>mt)throw new A(`Extension file is too large: ${e.file.path}`,{code:"extension_file_too_large"});let s=new Uint8Array(await n.arrayBuffer());if(s.byteLength>mt)throw new A(`Extension file is too large: ${e.file.path}`,{code:"extension_file_too_large"});return s}a(ln,"downloadBytes");async function pt(e,t,o){let n=await e(`https://api.github.com${o}`,{headers:un(t,"application/vnd.github+json")});if(!n.ok){let r=await n.json().catch(()=>null),s=typeof r?.message=="string"?`: ${r.message}`:"";throw new A(`GitHub request failed (${n.status})${s}`,{code:n.status===404?"github_repository_not_found":"github_request_failed",status:n.status})}return await n.json()}a(pt,"githubJson");function un(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}a(un,"githubHeaders");function Ms(e){let t=new Map;for(let n of e)for(let r of n.files)t.set(r.path,r);if(t.size>en)throw new A(`Extension contains more than ${en} skill files.`,{code:"extension_too_many_files"});let o=0;for(let n of t.values()){if((n.size??0)>mt)throw new A(`Extension file is too large: ${n.path}`,{code:"extension_file_too_large"});o+=n.size??0}if(o>rn)throw new A("Extension exceeds the maximum allowed size.",{code:"extension_too_large"})}a(Ms,"validateDownloadLimits");function Bs(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"}a(Bs,"validTreeEntry");function Ls(e){let t=nn("sha256");for(let o of e)t.update(`${o.path}\0${o.sha}\0${o.size??""}
|
|
20
20
|
`);return t.digest("hex")}a(Ls,"hashTree");function Ns(e,t){return e==="."?t:t.slice(e.length+1)}a(Ns,"relativeSkillPath");function js(e){let t=new Set,o=new Set;for(let n of e)t.has(n)&&o.add(n),t.add(n);return o}a(js,"duplicateValues");async function dn(e,t,o){let n=new Array(e.length),r=0;async function s(){for(;r<e.length;){let i=r;r+=1,n[i]=await o(e[i])}}return a(s,"worker"),await Promise.all(Array.from({length:Math.min(t,e.length)},s)),n}a(dn,"mapConcurrent");function Te(e){return new A(`Invalid GitHub extension source: ${e}. Use owner/repo or https://github.com/owner/repo.`,{code:"github_invalid_source"})}a(Te,"invalidSource");import{createHash as Ds,randomUUID as yn}from"node:crypto";import{existsSync as te}from"node:fs";import{mkdir as gt,readFile as Hs,rename as le,rm as ue,stat as qs,writeFile as fn}from"node:fs/promises";import I from"node:path";var Me=1,Fs=15e3;function tl(e={}){let t=I.resolve(e.home??e.rootPath??L()),o=I.resolve(e.rootPath??I.join(t,"library","extensions")),n=ge(t).database,r=an({fetch:e.fetch,githubToken:e.githubToken}),s=e.now??(()=>new Date);async function i(){try{let P=await ee(t),g=await Promise.all(P.extensions.map(S=>yt(o,S)));return Ks(g,await ce(e.reservedSkillNames)),{rootPath:o,registryPath:n,extensions:g.sort(At),error:null}}catch(P){return{rootPath:o,registryPath:n,extensions:[],error:P instanceof Error?P.message:String(P)}}}a(i,"list");async function c(P){let g=await r.resolve(P),S=await ee(t),f=S.extensions.find(y=>y.id===g.preview.id)??null;return he(g.preview,S.extensions.filter(y=>y.id!==f?.id),await ce(e.reservedSkillNames)),g.preview}a(c,"preview");async function l(P){let g=V(P.source);return Pt(o,g.id,async()=>{let S=await ee(t);if(S.extensions.some(v=>v.id===g.id))throw new A(`${g.owner}/${g.repo} is already installed.`,{code:"extension_already_installed",status:409});let f=await r.resolve(P);gn(f.preview),he(f.preview,S.extensions,await ce(e.reservedSkillNames));let y=s().toISOString(),x=await pn({rootPath:o,resolution:f,installedAt:y,updatedAt:y,github:r});try{let v=await ce(e.reservedSkillNames);return await wt(t,s,B=>({...B,extensions:zs(B,x,v)})),await hn(o,x.id),x}catch(v){throw await mn(o,x.id),v}})}a(l,"add");async function u(P){let g=V(P.source);return Pt(o,g.id,async()=>{let S=await ee(t),f=Ue(S,g.id),y=await r.resolve({source:f.repositoryUrl,ref:P.ref?.trim()||f.requestedRef});if(gn(y.preview),he(y.preview,S.extensions.filter(v=>v.id!==f.id),await ce(e.reservedSkillNames)),f.resolvedCommit===y.preview.resolvedCommit&&f.packageHash===y.preview.packageHash&&f.requestedRef===y.preview.requestedRef)return yt(o,f);let x=await pn({rootPath:o,resolution:y,installedAt:f.installedAt,updatedAt:s().toISOString(),github:r});try{let v=await ce(e.reservedSkillNames);return await wt(t,s,B=>({...B,extensions:Js(B,x,v)})),await hn(o,x.id),x}catch(v){throw await mn(o,x.id),v}})}a(u,"update");async function p(){let P=await i();if(P.error)throw new A(P.error,{code:"extension_registry_error"});let g={updated:[],unchanged:[],failed:[]};for(let S of P.extensions)try{let f=await u({source:S.repositoryUrl,ref:S.requestedRef});f.resolvedCommit===S.resolvedCommit&&f.packageHash===S.packageHash?g.unchanged.push(f):g.updated.push(f)}catch(f){g.failed.push({id:S.id,error:f instanceof Error?f.message:String(f)})}return g}a(p,"updateAll");async function h(P){let g=V(P),S=await ee(t);return yt(o,Ue(S,g.id))}a(h,"inspect");async function k(P){let g=V(P);return Pt(o,g.id,async()=>{let S=await ee(t),f=Ue(S,g.id),y=me(o,g.owner,g.repo),x=`${y}.${yn()}.remove`;te(y)&&await le(y,x);try{return await wt(t,s,v=>({...v,extensions:v.extensions.filter(B=>B.id!==f.id)})),await ue(x,{recursive:!0,force:!0}),f}catch(v){throw te(x)&&!te(y)&&await le(x,y),v}})}a(k,"remove");async function C(P){let g=P.trim();if(!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(g))throw new A("Extension skill name must be lowercase kebab-case.",{code:"extension_skill_invalid_name"});let S=await i();if(S.error)throw new A(S.error,{code:"extension_registry_error"});let f=S.extensions.flatMap(kt=>kt.skills.filter(Be=>Be.name===g).map(Be=>({extension:kt,skill:Be})));if(f.length===0)throw new A(`Extension skill not found: ${g}`,{code:"extension_skill_not_found",status:404});if(f.length>1)throw new A(`Extension skill name is ambiguous: ${g}`,{code:"extension_skill_conflict",status:409});let y=f[0];if(y.extension.validationStatus!=="valid"||y.skill.validationStatus!=="valid")throw new A(`Extension skill ${g} is not valid.`,{code:"extension_skill_invalid"});let x=Pn(y.extension.sourcePath,y.skill.relativePath),v=await Hs(x,"utf8"),B=Ds("sha256").update(v).digest("hex");if(B!==y.skill.sourceHash)throw new A(`Extension skill ${g} changed on disk. Update or reinstall its extension before using it.`,{code:"extension_skill_modified"});let K=Se(v);if(K.messages.length>0||K.name!==g||!K.description)throw new A(`Extension skill ${g} is not valid. ${K.messages.join(" ")}`.trim(),{code:"extension_skill_invalid"});return{name:g,description:K.description,body:K.body,path:y.skill.relativePath,sourcePath:y.extension.sourcePath,sourceHash:B,charCount:v.length,packagePath:I.dirname(x),resourceFiles:y.skill.resourceFiles}}return a(C,"readSkill"),{rootPath:o,registryPath:n,list:i,preview:c,add:l,update:u,updateAll:p,inspect:h,remove:k,readSkill:C}}a(tl,"createGithubExtensionManager");async function pn(e){let t=e.resolution.preview,o=me(e.rootPath,t.owner,t.repo),n=`${o}.${yn()}.install`,r=St(e.rootPath,t.id),s=I.join(n,"current");await ue(n,{recursive:!0,force:!0}),await ue(r,{recursive:!0,force:!0}),await gt(s,{recursive:!0,mode:448});try{await e.github.download(e.resolution,async(c,l,u)=>{let p=Pn(s,c);await gt(I.dirname(p),{recursive:!0,mode:448}),await fn(p,l,{mode:u?448:384})});let i=Gs(t,o,e.installedAt,e.updatedAt);return await fn(I.join(n,"extension.json"),`${JSON.stringify(i,null,2)}
|
|
21
|
-
`,{mode:384}),await gt(I.dirname(o),{recursive:!0,mode:448}),te(o)&&await le(o,r),await le(n,o),i}catch(i){throw await ue(n,{recursive:!0,force:!0}),te(r)&&!te(o)&&await le(r,o),i}}a(pn,"materializeExtension");function Gs(e,t,o,n){let r=I.join(t,"current");return{...e,sourcePath:r,readmePath:e.readmePath?I.join(r,e.readmePath):null,installedAt:o,updatedAt:n,skills:e.skills.map(s=>({...s,sourcePath:I.join(r,s.relativePath)}))}}a(Gs,"installedExtension");async function hn(e,t){await ue(St(e,t),{recursive:!0,force:!0})}a(hn,"finalizeMaterialization");async function mn(e,t){let o=V(t.replace(/^github:/,"")),n=me(e,o.owner,o.repo),r=St(e,t);await ue(n,{recursive:!0,force:!0}),te(r)&&await le(r,n)}a(mn,"rollbackMaterialization");async function yt(e,t){let o=me(e,t.owner,t.repo),n=I.join(o,"current"),r=(await qs(I.join(o,"extension.json")).catch(()=>null))?.isFile()??!1,s=t.validationMessages.filter(i=>i!=="Installed files are missing.");return r||s.push("Installed files are missing."),{...t,sourcePath:n,readmePath:t.readmePath?I.join(n,I.basename(t.readmePath)):null,skills:t.skills.map(i=>({...i,sourcePath:I.join(n,i.relativePath)})),validationStatus:s.length===0?"valid":"error",validationMessages:s}}a(yt,"hydrateExtension");function gn(e){if(e.validationStatus!=="valid")throw new A(`Extension contains invalid skills: ${e.validationMessages.join(" ")}`,{code:"extension_invalid"})}a(gn,"assertInstallable");function he(e,t,o){let n=new Map;for(let s of o)n.set(s,"a shipped OpenPond skill");for(let s of t)for(let i of s.skills)n.set(i.name,s.id);let r=e.skills.map(s=>({name:s.name,owner:n.get(s.name)})).filter(s=>!!s.owner);if(r.length!==0)throw new A(`Skill name conflict: ${r.map(s=>`${s.name} (${s.owner})`).join(", ")}.`,{code:"extension_skill_conflict",status:409})}a(he,"assertSkillNamesAvailable");function zs(e,t,o){if(e.extensions.some(n=>n.id===t.id))throw new A(`${t.owner}/${t.repo} is already installed.`,{code:"extension_already_installed",status:409});return he(t,e.extensions,o),[...e.extensions,t].sort(At)}a(zs,"appendInstalledExtension");function Js(e,t,o){return Ue(e,t.id),he(t,e.extensions.filter(n=>n.id!==t.id),o),e.extensions.map(n=>n.id===t.id?t:n).sort(At)}a(Js,"replaceInstalledExtension");function Ks(e,t){let o=new Map;for(let n of t)o.set(n,"built-in");for(let n of e)for(let r of n.skills){let s=o.get(r.name);if(!s){o.set(r.name,n.id);continue}let i=`Skill name conflicts with ${s}: ${r.name}`;r.validationStatus="error",r.validationMessages=[...new Set([...r.validationMessages,i])],n.validationStatus="error",n.validationMessages=[...new Set([...n.validationMessages,i])]}}a(Ks,"markInstalledSkillConflicts");async function ce(e){let t=typeof e=="function"?await e():e??[];return[...new Set(t.map(o=>o.trim()).filter(Boolean))]}a(ce,"reservedSkillNames");function Ue(e,t){let o=e.extensions.find(n=>n.id===t);if(o)return o;throw new A(`${t.replace(/^github:/,"")} is not installed.`,{code:"extension_not_installed",status:404})}a(Ue,"requireInstalled");async function ee(e){let t=Le(e,"extension_installations","registry")?.value;if(!t)return Vs();if(t.schemaVersion!==Me||!Array.isArray(t.extensions)||!t.extensions.every(wn))throw new Error("Extension registry has an unsupported format.");return Ws(t)}a(ee,"readRegistry");async function wt(e,t,o){await ye(I.join(ge(e).runtime,"extension-registry"),async()=>{let n=Le(e,"extension_installations","registry"),r=o(await ee(e));
|
|
21
|
+
`,{mode:384}),await gt(I.dirname(o),{recursive:!0,mode:448}),te(o)&&await le(o,r),await le(n,o),i}catch(i){throw await ue(n,{recursive:!0,force:!0}),te(r)&&!te(o)&&await le(r,o),i}}a(pn,"materializeExtension");function Gs(e,t,o,n){let r=I.join(t,"current");return{...e,sourcePath:r,readmePath:e.readmePath?I.join(r,e.readmePath):null,installedAt:o,updatedAt:n,skills:e.skills.map(s=>({...s,sourcePath:I.join(r,s.relativePath)}))}}a(Gs,"installedExtension");async function hn(e,t){await ue(St(e,t),{recursive:!0,force:!0})}a(hn,"finalizeMaterialization");async function mn(e,t){let o=V(t.replace(/^github:/,"")),n=me(e,o.owner,o.repo),r=St(e,t);await ue(n,{recursive:!0,force:!0}),te(r)&&await le(r,n)}a(mn,"rollbackMaterialization");async function yt(e,t){let o=me(e,t.owner,t.repo),n=I.join(o,"current"),r=(await qs(I.join(o,"extension.json")).catch(()=>null))?.isFile()??!1,s=t.validationMessages.filter(i=>i!=="Installed files are missing.");return r||s.push("Installed files are missing."),{...t,sourcePath:n,readmePath:t.readmePath?I.join(n,I.basename(t.readmePath)):null,skills:t.skills.map(i=>({...i,sourcePath:I.join(n,i.relativePath)})),validationStatus:s.length===0?"valid":"error",validationMessages:s}}a(yt,"hydrateExtension");function gn(e){if(e.validationStatus!=="valid")throw new A(`Extension contains invalid skills: ${e.validationMessages.join(" ")}`,{code:"extension_invalid"})}a(gn,"assertInstallable");function he(e,t,o){let n=new Map;for(let s of o)n.set(s,"a shipped OpenPond skill");for(let s of t)for(let i of s.skills)n.set(i.name,s.id);let r=e.skills.map(s=>({name:s.name,owner:n.get(s.name)})).filter(s=>!!s.owner);if(r.length!==0)throw new A(`Skill name conflict: ${r.map(s=>`${s.name} (${s.owner})`).join(", ")}.`,{code:"extension_skill_conflict",status:409})}a(he,"assertSkillNamesAvailable");function zs(e,t,o){if(e.extensions.some(n=>n.id===t.id))throw new A(`${t.owner}/${t.repo} is already installed.`,{code:"extension_already_installed",status:409});return he(t,e.extensions,o),[...e.extensions,t].sort(At)}a(zs,"appendInstalledExtension");function Js(e,t,o){return Ue(e,t.id),he(t,e.extensions.filter(n=>n.id!==t.id),o),e.extensions.map(n=>n.id===t.id?t:n).sort(At)}a(Js,"replaceInstalledExtension");function Ks(e,t){let o=new Map;for(let n of t)o.set(n,"built-in");for(let n of e)for(let r of n.skills){let s=o.get(r.name);if(!s){o.set(r.name,n.id);continue}let i=`Skill name conflicts with ${s}: ${r.name}`;r.validationStatus="error",r.validationMessages=[...new Set([...r.validationMessages,i])],n.validationStatus="error",n.validationMessages=[...new Set([...n.validationMessages,i])]}}a(Ks,"markInstalledSkillConflicts");async function ce(e){let t=typeof e=="function"?await e():e??[];return[...new Set(t.map(o=>o.trim()).filter(Boolean))]}a(ce,"reservedSkillNames");function Ue(e,t){let o=e.extensions.find(n=>n.id===t);if(o)return o;throw new A(`${t.replace(/^github:/,"")} is not installed.`,{code:"extension_not_installed",status:404})}a(Ue,"requireInstalled");async function ee(e){let t=Le(e,"extension_installations","registry")?.value;if(!t)return Vs();if(t.schemaVersion!==Me||!Array.isArray(t.extensions)||!t.extensions.every(wn))throw new Error("Extension registry has an unsupported format.");return Ws(t)}a(ee,"readRegistry");async function wt(e,t,o){await ye(I.join(ge(e).runtime,"extension-registry"),async()=>{let n=Le(e,"extension_installations","registry"),r=o(await ee(e));bt(e,"extension_installations","registry",{...r,schemaVersion:Me,updatedAt:t().toISOString()},n?.revision??null)})}a(wt,"writeRegistry");function Ws(e){return{schemaVersion:Me,updatedAt:typeof e?.updatedAt=="string"?e.updatedAt:null,extensions:Array.isArray(e?.extensions)?e.extensions.filter(wn):[]}}a(Ws,"normalizeRegistry");function Vs(){return{schemaVersion:Me,updatedAt:null,extensions:[]}}a(Vs,"emptyRegistry");function wn(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)}a(wn,"isStoredExtension");function Pn(e,t){if(I.isAbsolute(t)||t.split(/[\\/]/).includes(".."))throw new A(`Unsafe extension path: ${t}`,{code:"extension_unsafe_path"});let o=I.resolve(e,...t.split("/")),n=`${I.resolve(e)}${I.sep}`;if(!o.startsWith(n))throw new A(`Unsafe extension path: ${t}`,{code:"extension_unsafe_path"});return o}a(Pn,"safeDestination");function me(e,t,o){return I.join(e,"github",t,o)}a(me,"extensionDirectory");function St(e,t){let o=V(t.replace(/^github:/,""));return`${me(e,o.owner,o.repo)}.previous`}a(St,"backupDirectory");async function Pt(e,t,o){let n=t.replace(/[^a-z0-9.-]+/gi,"-");return ye(I.join(e,".locks",n),o,Fs)}a(Pt,"withExtensionLock");function At(e,t){return e.id.localeCompare(t.id)}a(At,"extensionSort");import{createHash as Ys,randomUUID as Xs}from"node:crypto";function ll(e){let t=e.explicitKey?.trim();if(t)return t;let o=e.sourceHead?.trim()||"unknown-source",n=e.targetProjectId?.trim()||"no-target-project",r=Zs(e.input).slice(0,16),s=`profile-push-run:${e.localHead}:${o}:${e.runtimeAgentId}:${n}:${r}`;return e.retry?`${s}:retry:${(e.randomId??Xs)()}`:s}a(ll,"buildHostedRunIdempotencyKey");function Zs(e){return Ys("sha256").update(xt(e)).digest("hex")}a(Zs,"hashStableJson");function xt(e){return e===void 0?"undefined":e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(t=>xt(t)).join(",")}]`:`{${Object.entries(e).sort(([t],[o])=>t.localeCompare(o)).map(([t,o])=>`${JSON.stringify(t)}:${xt(o)}`).join(",")}}`}a(xt,"stableJsonStringify");async function pl(e,t){let o=Qs(e);if(!o)return null;let n=await t.loadProfileState();return o==="help"?ea(n):ta(n)}a(pl,"runProfileSkillCommand");function Qs(e){let t=/^\/skill(?:\s+([\s\S]*))?$/i.exec(e.trim());if(!t)return null;let o=t[1]?.trim().toLowerCase()??"";return!o||o==="list"?"list":o==="help"?"help":null}a(Qs,"readOnlyProfileSkillAction");function ea(e){return{handled:!0,action:"help",profile:e,message:["Profile skills support:","- /skill list","- /skill create <what the skill should help with>","- /skill create <skill-name>: <what the skill should help with>","- /skill create --name <skill-name> <what the skill should help with>","- /skill edit <skill-name> <change request>","","Create and edit run as normal model turns with the bundled OpenPond Skill Authoring skill. Skills may include SKILL.md plus focused scripts, references, and assets. Use an Agent when the workflow needs code, actions, durable runtime behavior, setup, or Evals."].join(`
|
|
22
22
|
`)}}a(ea,"profileSkillHelp");function ta(e){let t=e.skills.slice().sort((n,r)=>n.name.localeCompare(r.name));return{handled:!0,action:"list",message:t.length===0?"No profile skills found in the active profile.":[`Profile skills (${t.length}):`,...t.map(n=>{let r=n.validationStatus==="valid"?"valid":`invalid: ${n.validationMessages.join("; ")}`;return`- ${n.name} (${r}) ${n.path}`})].join(`
|
|
23
23
|
`),skills:t,profile:e}}a(ta,"listProfileSkills");export{Ho as a,qo as b,_i as c,Fo as d,Go as e,ke as f,T as g,ze as h,_n as i,$n as j,Mc as k,A as l,tl as m,ll as n,Ee as o,Jn as p,Ca as q,ro as r,so as s,ao as t,fr as u,hr as v,mr as w,gr as x,yr as y,Ir as z,ko as A,ni as B,ri as C,si as D,ai as E,ii as F,J as G,ct as H,Cr as I,vr as J,ci as K,li as L,ui as M,di as N,fi as O,Io as P,pi as Q,hi as R,mi as S,gi as T,pl as U};
|
|
@@ -0,0 +1,2 @@
|
|
|
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-HP2D3W2B.js";import"./chunk-KUKOZJIR.js";import"./chunk-5OGRWWEH.js";import"./chunk-D6MQTNJ3.js";import"./chunk-33AO3P6X.js";import"./chunk-BUFQKDAW.js";import"./chunk-HO5L2FUU.js";import"./chunk-JBHAU7PH.js";import"./chunk-F2AG46CV.js";import"./chunk-PGKEDR3S.js";import"./chunk-ZJY2L43W.js";import"./chunk-L3KS6MOV.js";import"./chunk-YSYXIJ46.js";import"./chunk-6JBWHR6T.js";import"./chunk-HK3WGUKK.js";import"./chunk-6MI4KKWF.js";import"./chunk-5ZZM3TUN.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z3D4C7BG.js";import"./chunk-JO7GRBOG.js";import"./chunk-BQNK2NMB.js";import"./chunk-VW7D3DRM.js";import"./chunk-UWO34HP6.js";import"./chunk-L4BYPZ4U.js";import"./chunk-P653BXMY.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 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-
|
|
2
|
+
import{a as f}from"./chunk-EWS7MXTM.js";import"./chunk-TYWBEJOA.js";import"./chunk-3M53YXEI.js";import{H as J,W as N,X as q,_ as k,aa as A,b as d,ba as B,c as w,e as b,ea as H,fa as I,na as E,oa as M,p as C,pa as T,r as m,s as j,t as x,u as F,v,w as P}from"./chunk-UWO34HP6.js";import"./chunk-L4BYPZ4U.js";import"./chunk-P653BXMY.js";import"./chunk-ES2ISFJC.js";import{d as O,f as S,h as g}from"./chunk-H7IWJN7L.js";import{a as l}from"./chunk-FTQLQJQV.js";import R from"node:path";import{readFile as p}from"node:fs/promises";var n=l((t,s)=>typeof t[s]=="string"?t[s]:void 0,"stringOption");function a(t){console.log(JSON.stringify(t,null,2))}l(a,"print");function U(t,s){let i=n(t,"keyPath");if(i){let r=JSON.parse(i);if(Array.isArray(r)&&r.length&&r.every(c=>typeof c=="string"&&c.length))return r;throw new f("--key-path must be a JSON array of key segments.")}if(!s)throw new f("Specify a setting key, or --key-path for keys containing dots.");return s.split(".")}l(U,"keyPath");async function G(t,s){let i=S({home:n(t,"home")}),r=s[0]??"get",c=g(i).config;if(r==="path"){console.log(c);return}if(r==="export"){let e=await T(i),o=n(t,"file");o?(await b(R.resolve(o),JSON.stringify(e,null,2),{privateParent:!1}),a({path:R.resolve(o),requiresRebinding:e.requiresRebinding})):a(e);return}if(r==="backup"||r==="restore"){let e=n(t,"file"),o=n(t,"keyFile");if(!e||!o)throw new f(`config ${r} requires --file <encrypted-backup> and --key-file <separate-32-byte-key-file>.`);let u=await p(o),y=u.length===32?u:Buffer.from(u.toString("utf8").trim(),"base64");try{a(r==="backup"?await E(i,e,y):await M(e,i,y))}finally{y.fill(0),u.fill(0)}return}if(r==="collect-orphans"){a(await N(i));return}if(r==="schema"){a(F());return}if(r==="migrate"){let e=n(t,"resolutionFile"),o=e?q.parse(JSON.parse(await p(e,"utf8"))):void 0;a(await k(i,{resolutions:o,sourceAppHome:n(t,"sourceAppHome"),sourceConfig:n(t,"sourceConfig"),sourceBrowserState:n(t,"sourceBrowserState"),dryRun:t.dryRun===!0||t.dryRun==="true"}));return}if(r==="recover"){let e=n(t,"revision");a(e?await x(i,e,n(t,"expectedRevision")??d(await w(c))):await A(i));return}if(r==="restart-migration"){a(await B(i));return}if(r==="effective"){a(await I(i,{projectRoot:n(t,"projectRoot"),accountId:n(t,"accountId")}));return}if(r==="trust"||r==="untrust"){let e=n(t,"projectRoot")??s[1];if(!e)throw new f("Specify the canonical project root with --project-root.");await H(i,e,n(t,"accountId")??"local",r==="trust"),a({root:e,trusted:r==="trust"});return}if(r==="revisions"){a(await m(i));return}if(r==="validate"){let e=n(t,"file")??c;C(await p(e,"utf8"),e,t.project===!0||t.project==="true"?"project":"user"),a({valid:!0,path:e});return}if(r==="replace"){let e=n(t,"file");if(!e)throw new f("config replace requires --file <validated-toml-file>.");a(await j(i,n(t,"expectedRevision")??d(await w(c)),await p(e,"utf8")));return}if(r==="doctor"){let e=await w(c),o=null;try{await v(i)}catch(u){o=O(u,c)}a({home:i,path:c,rawRevision:d(e),issue:o,recoverableRevisions:await m(i),migration:await w(R.join(g(i).runtime,"migration.json"))!==null}),o&&(process.exitCode=1);return}if(await k(i),r==="clear-cache"){await J(i),a({cleared:!0,path:g(i).cache});return}let h=await v(i);if(r==="get"){if(!s[1]&&!t.keyPath){a(h);return}let e=h.document;for(let o of U(t,s[1]))e=e&&typeof e=="object"?e[o]:void 0;a(e??null);return}if(r==="set"||r==="unset"){let e=U(t,s[1]),o;if(r==="set"){let u=n(t,"value")??s[2];if(u===void 0)throw new f("config set requires a value. Use JSON for arrays, tables, numbers and booleans.");try{o=JSON.parse(u)}catch{o=u}}a(await P(i,n(t,"expectedRevision")??h.rawRevision,[r==="set"?{op:"set",path:e,value:o}:{op:"unset",path:e}]));return}throw new f(`Unknown config command: ${r}`)}l(G,"runConfigurationCommand");export{G as runConfigurationCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as w,b as u}from"./chunk-6WLJWRMF.js";import"./chunk-NPOHW5OU.js";import"./chunk-XLDW5NN3.js";import"./chunk-USWZ3KUC.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-EWS7MXTM.js";import"./chunk-TYWBEJOA.js";import{c as o}from"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import{q as m}from"./chunk-4UTIEH5H.js";import"./chunk-LZSY5IM3.js";import"./chunk-6SJZXZNA.js";import"./chunk-GLUWATL5.js";import"./chunk-H6W55CQG.js";import"./chunk-Z3D4C7BG.js";import"./chunk-JO7GRBOG.js";import"./chunk-BQNK2NMB.js";import"./chunk-VW7D3DRM.js";import"./chunk-UWO34HP6.js";import"./chunk-L4BYPZ4U.js";import"./chunk-P653BXMY.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,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as V,c as D}from"./chunk-
|
|
2
|
+
import{a as V,c as D}from"./chunk-NPOHW5OU.js";import{a as M}from"./chunk-6MI4KKWF.js";import{a as J}from"./chunk-6FA3GG5B.js";import{c as U}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c as k,f as O,g as te,h as q}from"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-UWO34HP6.js";import"./chunk-L4BYPZ4U.js";import"./chunk-P653BXMY.js";import{b as n}from"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as d}from"./chunk-FTQLQJQV.js";import{readFile as ge,writeFile as ye}from"node:fs/promises";import E from"node:path";import{createInterface as Ee}from"node:readline/promises";var Ae=Object.freeze({init:"openpond continual init --from ./tasks.jsonl",validate:"openpond continual validate ./continual-support.yaml",run:"openpond continual run ./continual-support.yaml",report:"openpond continual report <comparison-series-id>"});import{createHash as ke}from"node:crypto";function W(e){return`${JSON.stringify(G(e),null,2)}
|
|
3
3
|
`}d(W,"canonicalJson");function w(e){return ke("sha256").update(W(e)).digest("hex")}d(w,"contentHash");function G(e){return Array.isArray(e)?e.map(G):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([s],[t])=>s.localeCompare(t)).map(([s,t])=>[s,G(t)])):e}d(G,"normalize");function oe(e){let s=e.semanticSimilarityThreshold??.8;if(!(s>0&&s<=1))throw new Error("semanticSimilarityThreshold must be in (0, 1].");let t=new Set((e.allowSharedFamiliesBetween??[]).flatMap(([a,c])=>[`${a}\0${c}`,`${c}\0${a}`])),o=[];for(let a=0;a<e.panels.length;a+=1){let c=e.panels[a];for(let i=a+1;i<e.panels.length;i+=1){let f=e.panels[i];for(let l of c.tasks)for(let m of f.tasks){let g={leftPanel:c.id,rightPanel:f.id,leftTaskId:l.id,rightTaskId:m.id};if(l.id===m.id?o.push({...g,kind:"duplicate_id",similarity:1}):l.contentHash===m.contentHash&&o.push({...g,kind:"duplicate_content",similarity:1}),l.familyId===m.familyId&&!t.has(`${c.id}\0${f.id}`)&&o.push({...g,kind:"family_overlap",similarity:null}),l.prompt&&m.prompt){let u=Ie(l.prompt,m.prompt);u>=s&&o.push({...g,kind:"prompt_overlap",similarity:u})}}}}let r={schemaVersion:"openpond.continualBenchLeakageAudit.v1",threshold:s,findings:o.sort((a,c)=>JSON.stringify(a).localeCompare(JSON.stringify(c)))};return{...r,contentHash:w(r)}}d(oe,"auditContinualBenchLeakage");function Ie(e,s){let t=d(i=>new Set(i.toLowerCase().match(/[a-z0-9]+/g)??[]),"tokens"),o=t(e),r=t(s),a=new Set([...o,...r]);if(!a.size)return 1;let c=0;for(let i of o)r.has(i)&&(c+=1);return c/a.size}d(Ie,"jaccard");var S=n.string().trim().min(1).max(240),j=n.string().regex(/^[a-f0-9]{64}$/),Xe=n.object({id:S,contentHash:j}).strict(),ve=n.object({id:S,familyId:S,contentHash:j,prompt:n.string().max(1e6).optional(),payload:n.record(n.string(),n.unknown()).optional()}).strict(),Se=n.object({id:S,role:M,passLabel:S.nullable(),taskIds:n.array(S).min(1).max(1e6),disclosurePhase:n.enum(["review","evaluation","final"]),optimizerEligible:n.boolean()}).strict().superRefine((e,s)=>{let t=e.role==="correction"||e.role==="training_eligible";e.optimizerEligible!==t&&s.addIssue({code:"custom",path:["optimizerEligible"],message:"Only correction and training-eligible panels may be optimizer eligible."}),e.role==="frozen_final"&&e.disclosurePhase!=="final"&&s.addIssue({code:"custom",path:["disclosurePhase"],message:"The frozen-final panel may only be disclosed in the final phase."}),new Set(e.taskIds).size!==e.taskIds.length&&s.addIssue({code:"custom",path:["taskIds"],message:"Panel task ids must be unique."})}),Pe=n.object({label:S,familyIds:n.array(S).min(1).max(1e5)}).strict(),xe=n.object({adapter:n.literal("openpond"),apiBaseUrl:n.string().url().optional(),series:n.record(n.string(),n.unknown())}).strict(),T=n.object({schemaVersion:n.literal("openpond.continualBenchManifest.v1"),id:S,revision:n.number().int().positive(),name:n.string().trim().min(1).max(500),description:n.string().trim().min(1).max(2e4),license:n.string().trim().min(1).max(100),source:n.object({repository:n.string().trim().min(1).max(2e3).nullable(),commit:n.string().trim().min(1).max(500).nullable(),generatedBy:n.string().trim().min(1).max(2e3)}).strict(),split:n.object({seed:S,correctionCasesPerFamily:n.number().int().positive().max(100),correctionSelection:n.enum(["stable_hash","minimize_prompt_similarity"]),semanticSimilarityThreshold:n.number().gt(0).lte(1)}).strict(),passes:n.array(Pe).min(1).max(1e3),tasks:n.array(ve).min(1).max(1e6),panels:n.array(Se).min(1).max(1e5),grader:n.object({id:S,contentHash:j,outcomeScale:n.object({minimum:n.number().finite(),maximum:n.number().finite()}).strict()}).strict(),evaluation:n.object({seeds:n.array(n.number().int()).min(1).max(100),repetitions:n.number().int().positive().max(100),confidenceLevel:n.number().gt(0).lt(1),pairedBootstrapSamples:n.number().int().min(1e3).max(1e6)}).strict(),execution:xe.optional(),contentHash:j}).strict().superRefine((e,s)=>{let t=e.tasks.map(i=>i.id);new Set(t).size!==t.length&&s.addIssue({code:"custom",path:["tasks"],message:"Manifest task ids must be unique."});let o=new Set(t);for(let[i,f]of e.panels.entries())f.taskIds.some(l=>!o.has(l))&&s.addIssue({code:"custom",path:["panels",i,"taskIds"],message:"Every panel task must exist in the manifest inventory."});let r=e.passes.map(i=>i.label);new Set(r).size!==r.length&&s.addIssue({code:"custom",path:["passes"],message:"Pass labels must be unique."});let a=new Set(e.tasks.map(i=>i.familyId)),c=e.passes.flatMap(i=>i.familyIds);new Set(c).size!==c.length&&s.addIssue({code:"custom",path:["passes"],message:"An issue family may belong to only one pass."}),c.some(i=>!a.has(i))&&s.addIssue({code:"custom",path:["passes"],message:"Every assigned family must exist in the task inventory."})});function se(e){return T.parse({...e,contentHash:w(e)})}d(se,"sealPortableManifest");function ie(e){let s=T.parse(e),{contentHash:t,...o}=s;return t===w(o)}d(ie,"verifyPortableManifest");var L=n.string().trim().min(1).max(240),K=n.string().regex(/^[a-f0-9]{64}$/),Y=n.number().finite().nullable(),Ce=n.object({attemptId:L,seed:n.number().int(),repetition:n.number().int().nonnegative(),score:Y,passed:n.boolean().nullable(),latencyMs:n.number().nonnegative().nullable(),costUsd:n.number().nonnegative().nullable(),transcript:n.object({path:n.string().min(1),contentHash:K}).strict().nullable(),trace:n.object({path:n.string().min(1),contentHash:K}).strict().nullable(),graderOutputHash:K.nullable(),status:n.enum(["completed","failed","cancelled"])}).strict(),re=n.object({targetId:L,panelId:L,panelRole:M,taskId:L,familyId:L,attempts:n.array(Ce).min(1).max(1e4),meanScore:Y,passRate:Y,confidenceInterval:n.tuple([n.number().finite(),n.number().finite()]).nullable()}).strict(),ae=n.object({targetId:L,trainingGpuSeconds:n.number().nonnegative().nullable(),evaluationGpuSeconds:n.number().nonnegative().nullable(),providerSpendUsd:n.number().nonnegative().nullable(),totalSpendUsd:n.number().nonnegative().nullable(),durationSeconds:n.number().nonnegative().nullable(),optimizerGroups:n.number().int().nonnegative().nullable(),trajectories:n.number().int().nonnegative().nullable()}).strict(),le=n.enum(["systems_complete","correction_absorbed","issue_generalized","continually_current","frontier_pareto_result","inconclusive","loss"]);function ce(e){let s=[],t=[...e.families].sort((o,r)=>o.passLabel.localeCompare(r.passLabel));for(let o of t)s.push(F({id:`${o.passLabel.toLowerCase()}-correction`,role:"correction",passLabel:o.passLabel,taskIds:o.correctionTaskIds,familyIds:[o.familyId],optimizerEligible:!0})),s.push(F({id:`${o.passLabel.toLowerCase()}-siblings`,role:"sibling_verification",passLabel:o.passLabel,taskIds:o.siblingTaskIds,familyIds:[o.familyId],optimizerEligible:!1}));for(let o=0;o<t.length;o+=1){let r=t.slice(0,o+1);s.push(F({id:`known-${r[o].passLabel.toLowerCase()}`,role:"cumulative_known",passLabel:r[o].passLabel,taskIds:r.flatMap(a=>[...a.correctionTaskIds,...a.siblingTaskIds]),familyIds:r.map(a=>a.familyId),optimizerEligible:!1}))}return s.push(F({id:"training-eligible",role:"training_eligible",passLabel:null,taskIds:t.flatMap(o=>o.correctionTaskIds),familyIds:t.map(o=>o.familyId),optimizerEligible:!0})),s}d(ce,"createContinualBenchPanelAllocations");function Q(e){let s=new Set(["sibling_verification","development","retained","frozen_final"]),t=new Set(e.panels.filter(a=>s.has(a.role)).flatMap(a=>a.taskIds)),r=e.panels.filter(a=>a.optimizerEligible).flatMap(a=>a.taskIds).filter(a=>t.has(a));if(r.length)throw new Error(`Hidden evaluation tasks are optimizer eligible: ${[...new Set(r)].sort().join(", ")}`)}d(Q,"assertOptimizerIsolation");function F(e){let s={...e,taskIds:[...e.taskIds].sort(),familyIds:[...e.familyIds].sort()};return{...s,contentHash:w(s)}}d(F,"sealPanel");function A(e){let s=T.safeParse(e);if(!s.success)return{valid:!1,manifestHash:null,leakageHash:null,issues:s.error.issues.map(i=>({severity:"error",code:"schema",message:i.message,path:i.path.join(".")}))};let t=s.data,o=[];ie(t)||o.push({severity:"error",code:"content_hash",message:"Manifest contentHash does not match its canonical payload.",path:"contentHash"});let r=new Map(t.tasks.map(i=>[i.id,i])),a=[];for(let i of t.passes){let f=t.panels.find(u=>u.role==="correction"&&u.passLabel===i.label),l=t.panels.find(u=>u.role==="sibling_verification"&&u.passLabel===i.label);if(!f||!l){o.push({severity:"error",code:"missing_holdout",message:`Pass ${i.label} requires both correction and sibling-verification panels.`,path:"panels"});continue}a.push([f.id,l.id]);let m=new Set(f.taskIds.map(u=>r.get(u)?.familyId)),g=new Set(l.taskIds.map(u=>r.get(u)?.familyId));for(let u of i.familyIds)(!m.has(u)||!g.has(u))&&o.push({severity:"error",code:"insufficient_family",message:`Pass ${i.label} family ${u} lacks a correction or sibling case; the holdout was not weakened.`,path:"passes"})}let c=oe({panels:t.panels.filter(i=>i.role!=="cumulative_known"&&i.role!=="training_eligible").map(i=>({id:i.id,tasks:i.taskIds.map(f=>{let l=r.get(f);return{id:l.id,familyId:l.familyId,contentHash:l.contentHash,prompt:l.prompt}})})),allowSharedFamiliesBetween:a,semanticSimilarityThreshold:t.split.semanticSimilarityThreshold});for(let i of c.findings)o.push({severity:"error",code:`leakage_${i.kind}`,message:`${i.leftTaskId} in ${i.leftPanel} overlaps ${i.rightTaskId} in ${i.rightPanel}.`,path:"panels"});return{valid:!o.some(i=>i.severity==="error"),manifestHash:t.contentHash,issues:o,leakageHash:c.contentHash}}d(A,"validateContinualBenchManifest");function de(e){let s=A(e);if(!s.valid)throw new Error(s.issues.map(t=>`${t.code}: ${t.message}`).join(`
|
|
4
4
|
`));return T.parse(e)}d(de,"requireValidContinualBenchManifest");var R=n.string().trim().min(1).max(240),me=n.string().regex(/^[a-f0-9]{64}$/),_e=n.object({id:R,label:n.string().trim().min(1).max(500),kind:n.enum(["candidate","accepted_head","base","master","external_reference"]),ordinal:n.number().int().nonnegative().nullable(),meanScore:n.number().finite().nullable(),confidenceInterval:n.tuple([n.number().finite(),n.number().finite()]).nullable(),taskMetrics:n.array(re).max(1e6),efficiency:ae.nullable(),evidenceUrl:n.string().url().nullable()}).strict(),pe=n.object({schemaVersion:n.literal("openpond.continualBenchReport.v1"),seriesId:R,protocol:n.object({id:R,revision:n.number().int().positive(),contentHash:me}).strict(),generatedAt:n.string().datetime({offset:!0}),status:n.enum(["partial","terminal"]),points:n.array(_e).min(1).max(1e4),outcomes:n.array(le).max(7),audit:n.array(n.object({requirement:R,status:n.enum(["passed","failed","unavailable"]),evidenceRefs:n.array(R).max(1e5)}).strict()).max(1e4),chart:n.object({x:n.literal("ordinal"),y:n.literal("meanScore"),series:n.array(n.object({pointId:R,label:n.string(),ordinal:n.number().nullable(),value:n.number().nullable(),lower:n.number().nullable(),upper:n.number().nullable(),kind:n.string()}).strict())}).strict(),contentHash:me}).strict();function ue(e){let s={x:"ordinal",y:"meanScore",series:e.points.map(o=>({pointId:o.id,label:o.label,ordinal:o.ordinal,value:o.meanScore,lower:o.confidenceInterval?.[0]??null,upper:o.confidenceInterval?.[1]??null,kind:o.kind}))},t={...e,chart:s};return pe.parse({...t,contentHash:w(t)})}d(ue,"createContinualBenchReport");function fe(e){let s=pe.parse(e),{contentHash:t,...o}=s;if(t!==w(o))throw new Error("Continual Support report content hash does not match its payload.");return W(s)}d(fe,"exportContinualBenchReport");function be(e){let s=e.correctionCasesPerFamily??1;if(!Number.isInteger(s)||s<1)throw new Error("correctionCasesPerFamily must be a positive integer.");let t=new Map,o=new Map;for(let l of e.tasks){if(t.has(l.id))throw new Error(`Duplicate task id: ${l.id}`);t.set(l.id,l);let m=o.get(l.familyId)??[];m.push(l),o.set(l.familyId,m)}let r=new Map;for(let l of e.passes){if(!l.label.trim())throw new Error("Pass labels cannot be empty.");for(let m of l.familyIds){if(r.has(m))throw new Error(`Family ${m} is assigned to more than one pass.`);r.set(m,l.label)}}let a=[],c=[],i=[];for(let[l,m]of[...o].sort(([g],[u])=>g.localeCompare(u))){let g=r.get(l);if(!g){i.push({code:"unassigned_family",familyId:l,taskCount:m.length});continue}let u=[...m].sort((y,v)=>{let P=w([e.seed,l,y.id,y.contentHash]),h=w([e.seed,l,v.id,v.contentHash]);return P.localeCompare(h)||y.id.localeCompare(v.id)});if(u.length<=s){i.push({code:"insufficient_siblings",familyId:l,taskCount:u.length});continue}e.correctionSelection==="minimize_prompt_similarity"&&s===1&&u.every(y=>y.prompt)&&(u=[...u].sort((y,v)=>{let P=he(y,u),h=he(v,u);return P-h||y.id.localeCompare(v.id)}));let I=u.slice(0,s),$=u.slice(s);a.push(...I.map(y=>({...y,passLabel:g,panelRole:"correction",optimizerEligible:!0})),...$.map(y=>({...y,passLabel:g,panelRole:"sibling_verification",optimizerEligible:!1}))),c.push({familyId:l,passLabel:g,correctionTaskIds:I.map(y=>y.id),siblingTaskIds:$.map(y=>y.id)})}for(let l of r.keys())if(!o.has(l))throw new Error(`Assigned family ${l} has no source tasks.`);let f={schemaVersion:"openpond.continualBenchSplit.v1",seed:e.seed,allocations:a.sort((l,m)=>l.passLabel.localeCompare(m.passLabel)||l.familyId.localeCompare(m.familyId)||l.id.localeCompare(m.id)),families:c.sort((l,m)=>l.passLabel.localeCompare(m.passLabel)||l.familyId.localeCompare(m.familyId)),advisories:i.sort((l,m)=>l.familyId.localeCompare(m.familyId)||l.code.localeCompare(m.code))};return{...f,contentHash:w(f)}}d(be,"createContinualBenchSplit");function he(e,s){return Math.max(...s.filter(t=>t.id!==e.id).map(t=>$e(e.prompt,t.prompt)))}d(he,"maximumSiblingSimilarity");function $e(e,s){let t=d(i=>new Set(i.toLowerCase().match(/[a-z0-9]+/g)??[]),"tokenize"),o=t(e),r=t(s),a=new Set([...o,...r]);if(!a.size)return 1;let c=0;for(let i of o)r.has(i)&&(c+=1);return c/a.size}d($e,"jaccard");async function et(e,s,t={}){let o=s[0];if(!o||!["init","validate","run","report"].includes(o))throw new Error("usage: openpond continual <init|validate|run|report> [manifest-or-series-id]");let r=t.log??console.log;if(o==="init"){await He(e,s.slice(1),t,r);return}if(o==="report"){await Re(e,s.slice(1),t,r);return}let a=s[1];if(!a||s.length!==2)throw new Error(`usage: openpond continual ${o} <manifest-path>`);let c=await ze(E.resolve(a),t.readFile??ge),i=A(c);if(o==="validate"){if(O(e.json))r(JSON.stringify(i,null,2));else{r(i.valid?`Valid Continual Support manifest ${i.manifestHash}.`:"Continual Support manifest is invalid."),r(`Leakage audit ${i.leakageHash??"unavailable"}; ${i.issues.length} finding(s).`);for(let l of i.issues)r(`${l.severity}: ${l.code} at ${l.path}: ${l.message}`)}if(!i.valid)throw Fe("Continual Support validation failed.",2);return}let f=de(c);Q(f),await Le(f,e,t,r)}d(et,"runContinualCommand");async function He(e,s,t,o){if(s.length)throw new Error("continual init accepts --from and --output options, not positional arguments.");let r=k(e,"from");if(!r)throw new Error("continual init requires --from <tasks.json|tasks.jsonl>.");let a=E.resolve(k(e,"output")||"continual-support.yaml"),c=await Be(E.resolve(r),t.readFile??ge),i=O(e.nonInteractive)||!process.stdin.isTTY,f=t.prompt??Me,l=await Oe(c,i,f),m=l.filter(p=>p.panelRole===null||p.panelRole==="correction"||p.panelRole==="sibling_verification"),g=[...new Map(m.map(p=>[p.passLabel,p])).keys()].sort().map(p=>({label:p,familyIds:[...new Set(m.filter(_=>_.passLabel===p).map(_=>_.familyId))].sort()})),u=l.map(p=>({id:p.id,familyId:p.familyId,contentHash:w(p.payload),...p.prompt?{prompt:p.prompt}:{},payload:p.payload})),I=be({tasks:m.map(p=>({id:p.id,familyId:p.familyId,contentHash:w(p.payload),prompt:p.prompt})),passes:g,seed:k(e,"seed")||"continual-support-v1",correctionCasesPerFamily:q(e.correctionCasesPerFamily,"correction-cases-per-family")??1,correctionSelection:k(e,"correctionSelection")==="stable_hash"?"stable_hash":"minimize_prompt_similarity"});if(I.advisories.length)throw new Error(`The proposed split is incomplete and was not weakened: ${I.advisories.map(p=>`${p.code}:${p.familyId}`).join(", ")}`);let $=ce(I).map(p=>({id:p.id,role:p.role,passLabel:p.passLabel,taskIds:p.taskIds,disclosurePhase:p.role==="sibling_verification"?"evaluation":"review",optimizerEligible:p.optimizerEligible})),y=["development","retained","frozen_final"];for(let p of y){let _=l.filter(x=>x.panelRole===p).map(x=>x.id).sort();_.length&&$.push({id:p.replace("_","-"),role:p,passLabel:null,taskIds:_,disclosurePhase:p==="frozen_final"?"final":"evaluation",optimizerEligible:!1})}let v=k(e,"id")||je(k(e,"name")||E.basename(r,E.extname(r))),P=k(e,"grader")||"user-supplied-grader-v1",h={schemaVersion:"openpond.continualBenchManifest.v1",id:v,revision:1,name:k(e,"name")||v,description:k(e,"description")||"A sealed continual-support workflow converted from an ordinary task set.",license:k(e,"license")||"UNSPECIFIED",source:{repository:k(e,"repository")||null,commit:k(e,"commit")||null,generatedBy:`openpond continual init --from ${r}`},split:{seed:I.seed,correctionCasesPerFamily:q(e.correctionCasesPerFamily,"correction-cases-per-family")??1,correctionSelection:k(e,"correctionSelection")==="stable_hash"?"stable_hash":"minimize_prompt_similarity",semanticSimilarityThreshold:te(e.semanticSimilarityThreshold,"semantic-similarity-threshold")??.8},passes:g,tasks:u,panels:$,grader:{id:P,contentHash:w({id:P}),outcomeScale:{minimum:0,maximum:1}},evaluation:{seeds:[1701,1709,1721],repetitions:3,confidenceLevel:.95,pairedBootstrapSamples:1e4}},H=se(h),ne=a.endsWith(".json")?`${JSON.stringify(H,null,2)}
|
|
5
|
-
`:
|
|
5
|
+
`:J.dump(H,{noRefs:!0,lineWidth:120,sortKeys:!1});await(t.writeFile??ye)(a,ne,"utf8"),o(`Created ${a}.`),o(`Manifest ${H.contentHash}; split ${I.contentHash}.`)}d(He,"initializeManifest");async function Le(e,s,t,o){if(!e.execution)throw new Error("This manifest validates locally but needs an execution.openpond series binding before `continual run`.");let r={...e.execution.series},a=r.benchmarkProtocol,c=C(a?.issueFamilyLedger);if(!a||c.contentHash!==e.contentHash)throw new Error("execution.series.benchmarkProtocol.issueFamilyLedger must bind the exact sealed portable manifest hash.");let i=U(s)??e.execution.apiBaseUrl??process.env.OPENPOND_LOCAL_API_URL?.replace(/\/$/,"")??V,f=t.request??await D(i),l=C(await X(f,`${i}/v1/training/comparison-series`,"POST",{series:r})),m=b(l.id)||b(r.id),g=ee(l.revision);if(!m||!g)throw new Error("OpenPond did not return a Comparison Series identity and revision.");await X(f,`${i}/v1/training/comparison-series/${encodeURIComponent(m)}/seal`,"POST",{expectedRevision:g});let u=`/models/comparisons/${encodeURIComponent(m)}`,I={comparisonSeriesId:m,canonicalUrl:u,protocolHash:e.contentHash};o(O(s.json)?JSON.stringify(I,null,2):`Created and sealed Comparison Series ${m}.
|
|
6
6
|
${u}
|
|
7
|
-
No release was queued or started.`)}d(Le,"submitManifest");async function Re(e,s,t,o){let r=s[0];if(!r||s.length!==1)throw new Error("usage: openpond continual report <comparison-series-id> [--output <path>]");let a=
|
|
7
|
+
No release was queued or started.`)}d(Le,"submitManifest");async function Re(e,s,t,o){let r=s[0];if(!r||s.length!==1)throw new Error("usage: openpond continual report <comparison-series-id> [--output <path>]");let a=U(e)??process.env.OPENPOND_LOCAL_API_URL?.replace(/\/$/,"")??V,c=t.request??await D(a),i=C(await X(c,`${a}/v1/training`,"GET")),f=N(i.comparisonSeries).map(C).find(h=>h.id===r);if(!f)throw new Error(`Comparison Series ${r} was not found.`);let l=C(f.benchmarkProtocol),m=N(i.comparisonSeriesEntries).map(C).filter(h=>h.seriesId===r),g=N(i.modelCurrencySnapshots).map(C).filter(h=>h.seriesId===r),u=new Map(g.map(h=>[b(h.entryId),h])),I=m.filter(h=>b(h.modelVersionId)).map(h=>{let H=u.get(b(h.id)),p=N(H?.panels).map(C).map(B=>z(B.strictSuccess)).filter(B=>B!==null),_=p.length?p.reduce((B,we)=>B+we,0)/p.length:null,x=Z(H?.efficiency);return{id:b(h.id),label:b(h.label),kind:"candidate",ordinal:z(h.ordinal),meanScore:_,confidenceInterval:null,taskMetrics:[],efficiency:x?{targetId:b(h.modelVersionId),trainingGpuSeconds:z(x.gpuSeconds),evaluationGpuSeconds:null,providerSpendUsd:null,totalSpendUsd:z(x.costUsd),durationSeconds:z(x.latencyMs)===null?null:z(x.latencyMs)/1e3,optimizerGroups:null,trajectories:null}:null,evidenceUrl:`${a}/models/comparisons/${encodeURIComponent(r)}`}});if(!I.length)throw new Error(`Comparison Series ${r} has no receipt-derived candidate points to report.`);let $=m.every(h=>["candidate","accepted","rejected","no_signal","failed","cancelled"].includes(b(h.status)||"")),y=ue({schemaVersion:"openpond.continualBenchReport.v1",seriesId:r,protocol:{id:b(l.id),revision:ee(l.revision),contentHash:b(l.contentHash)},generatedAt:new Date().toISOString(),status:$?"terminal":"partial",points:I,outcomes:[],audit:[{requirement:"receipt-derived-points",status:"passed",evidenceRefs:I.map(h=>h.id)}]}),v=fe(y),P=k(e,"output");P?(await(t.writeFile??ye)(E.resolve(P),v,"utf8"),o(`Wrote ${E.resolve(P)} (${y.contentHash}).`)):o(v.trimEnd())}d(Re,"exportReport");async function ze(e,s){let t=await s(e,"utf8");return e.endsWith(".json")?JSON.parse(t):J.load(t)}d(ze,"loadStructuredFile");async function Be(e,s){let t=await s(e,"utf8"),o=e.endsWith(".jsonl")?t.split(/\r?\n/).filter(r=>r.trim()).map((r,a)=>{try{return JSON.parse(r)}catch{throw new Error(`Invalid JSONL at line ${a+1}.`)}}):JSON.parse(t);if(!Array.isArray(o)||!o.length)throw new Error("The source must contain a non-empty JSON array or JSONL sequence.");return o.map((r,a)=>Te(r,a))}d(Be,"readSourceRows");function Te(e,s){let t=C(e),o=b(t.id)||b(t.taskId)||b(t.task_id);if(!o)throw new Error(`Source row ${s+1} is missing id/taskId.`);let r=b(t.familyId)||b(t.family_id)||b(t.clusterKey),a=b(t.passLabel)||b(t.pass_label),c=b(t.panelRole)||b(t.panel_role);if(c&&!new Set(["correction","sibling_verification","cumulative_known","development","retained","frozen_final","training_eligible"]).has(c))throw new Error(`Source row ${o} has unsupported panel role ${c}.`);return{id:o,familyId:r,passLabel:a,panelRole:c,prompt:b(t.prompt)||b(Z(t.input)?.prompt)||void 0,payload:t}}d(Te,"normalizeSourceRow");async function Oe(e,s,t){let o=[],r=new Map;for(let a of e){let c=a.familyId;if(!c){if(s)throw new Error(`Task ${a.id} lacks familyId; non-interactive init never fabricates issue families.`);if(c=(await t(`Issue family for ${a.id}: `)).trim(),!c)throw new Error(`Task ${a.id} requires an issue family.`)}let i=a.passLabel;if(!a.panelRole||a.panelRole==="correction"||a.panelRole==="sibling_verification"){if(i=i||r.get(c)||null,!i){if(s)throw new Error(`Task family ${c} lacks passLabel; provide labels for CI.`);i=(await t(`Pass label for family ${c}: `)).trim()}if(!i)throw new Error(`Family ${c} requires a pass label.`);let f=r.get(c);if(f&&f!==i)throw new Error(`Family ${c} appears in both ${f} and ${i}.`);r.set(c,i)}o.push({...a,familyId:c,passLabel:i})}return o}d(Oe,"completeLabels");async function Me(e){let s=Ee({input:process.stdin,output:process.stdout});try{return await s.question(e)}finally{s.close()}}d(Me,"defaultPrompt");async function X(e,s,t,o){let r=await e(s,{method:t,headers:o===void 0?{Accept:"application/json"}:{Accept:"application/json","Content-Type":"application/json"},body:o===void 0?void 0:JSON.stringify(o)}),a=await r.text(),c=a?JSON.parse(a):null;if(!r.ok)throw new Error(`OpenPond request failed (${r.status}): ${b(Z(c)?.error)||r.statusText}`);return c}d(X,"requestJson");function C(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}d(C,"object");function Z(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}d(Z,"objectOrNull");function N(e){return Array.isArray(e)?e:[]}d(N,"array");function b(e){return typeof e=="string"&&e.trim()?e.trim():null}d(b,"string");function ee(e){return typeof e=="number"&&Number.isFinite(e)?e:null}d(ee,"number");function z(e){return ee(e)}d(z,"numberOrNull");function je(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"continual-support"}d(je,"slug");function Fe(e,s){return Object.assign(new Error(e),{exitCode:s})}d(Fe,"withExitCode");export{et as runContinualCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
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-IV7F74JJ.js";import"./chunk-XLDW5NN3.js";import"./chunk-USWZ3KUC.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-EWS7MXTM.js";import"./chunk-TYWBEJOA.js";import"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import"./chunk-4UTIEH5H.js";import"./chunk-LZSY5IM3.js";import"./chunk-6SJZXZNA.js";import"./chunk-GLUWATL5.js";import"./chunk-H6W55CQG.js";import"./chunk-Z3D4C7BG.js";import"./chunk-JO7GRBOG.js";import"./chunk-BQNK2NMB.js";import"./chunk-VW7D3DRM.js";import"./chunk-UWO34HP6.js";import"./chunk-L4BYPZ4U.js";import"./chunk-P653BXMY.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{d as N}from"./chunk-YSYXIJ46.js";import"./chunk-6JBWHR6T.js";import"./chunk-HK3WGUKK.js";import"./chunk-6MI4KKWF.js";import"./chunk-5ZZM3TUN.js";import"./chunk-6FA3GG5B.js";import"./chunk-XLDW5NN3.js";import{c as K}from"./chunk-USWZ3KUC.js";import{c as L,f as B}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import"./chunk-EWS7MXTM.js";import"./chunk-TYWBEJOA.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-4UTIEH5H.js";import"./chunk-LZSY5IM3.js";import{d as z}from"./chunk-6SJZXZNA.js";import"./chunk-GLUWATL5.js";import"./chunk-H6W55CQG.js";import"./chunk-Z3D4C7BG.js";import"./chunk-JO7GRBOG.js";import{Q as x,U as H}from"./chunk-BQNK2NMB.js";import"./chunk-VW7D3DRM.js";import"./chunk-UWO34HP6.js";import"./chunk-L4BYPZ4U.js";import"./chunk-P653BXMY.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};
|