openpond 0.2.68 → 0.2.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client-context.d.ts +4 -0
- package/dist/app-server.js +1 -1
- package/dist/chunks/account-context-LEZDNYMR.js +12 -0
- package/dist/chunks/{acp-2OIXATRY.js → acp-QTA6IU6W.js} +1 -1
- package/dist/chunks/{acp-agent-PAGX2B47.js → acp-agent-N77HPAYQ.js} +1 -1
- package/dist/chunks/{actions-command-2VE6YI4W.js → actions-command-BZQCUDMD.js} +1 -1
- package/dist/chunks/{app-layer-YNEUEOEP.js → app-layer-YQQNLIXA.js} +1 -1
- package/dist/chunks/{app-server-connected-apps-TZOAUOYR.js → app-server-connected-apps-NH4667QJ.js} +1 -1
- package/dist/chunks/{app-server-runtime-GBX65JJ7.js → app-server-runtime-B7AMBGQZ.js} +1 -1
- package/dist/chunks/apps-WG7WY5CB.js +2 -0
- package/dist/chunks/{chunk-RY46UPBO.js → chunk-2ACX7IW5.js} +1 -1
- package/dist/chunks/{chunk-FKUWCJ73.js → chunk-54755JYM.js} +2 -2
- package/dist/chunks/{chunk-HKVFU3B3.js → chunk-5FSPDSAO.js} +1 -1
- package/dist/chunks/{chunk-R4EEGWXB.js → chunk-67U7PAMU.js} +1 -1
- package/dist/chunks/{chunk-2TGHZXJE.js → chunk-6C6ZCYTL.js} +1 -1
- package/dist/chunks/{chunk-7RSQOC5M.js → chunk-7TM25J6S.js} +1 -1
- package/dist/chunks/chunk-BGMAWETL.js +12 -0
- package/dist/chunks/chunk-BLNEHU62.js +12 -0
- package/dist/chunks/{chunk-RBTDSI4L.js → chunk-CUB6PWAJ.js} +6 -6
- package/dist/chunks/chunk-DFZTRMTL.js +2 -0
- package/dist/chunks/{chunk-4N4EH3RJ.js → chunk-EJOV6Z6F.js} +1 -1
- package/dist/chunks/{chunk-MEJLWNRS.js → chunk-EWH64WRR.js} +1 -1
- package/dist/chunks/{chunk-WNXUSELC.js → chunk-EXAJ2B4I.js} +1 -1
- package/dist/chunks/{chunk-BHKXPWFB.js → chunk-FHDH4OUA.js} +1 -1
- package/dist/chunks/chunk-HES4VP3D.js +2 -0
- package/dist/chunks/{chunk-AYOMVI7J.js → chunk-HIMG7S5E.js} +1 -1
- package/dist/chunks/{chunk-2LJCJOJ7.js → chunk-HLJJAOI2.js} +1 -1
- package/dist/chunks/{chunk-JPUSTFZC.js → chunk-HYUTDZ3N.js} +1 -1
- package/dist/chunks/chunk-J7X72QUY.js +2 -0
- package/dist/chunks/chunk-JF7WWLNW.js +2 -0
- package/dist/chunks/{chunk-4KNPCJR4.js → chunk-JVNKSU27.js} +1 -1
- package/dist/chunks/{chunk-XT4CSKHM.js → chunk-JZKTBYNB.js} +1 -1
- package/dist/chunks/{chunk-JEMECEQH.js → chunk-KHDCMVEJ.js} +1 -1
- package/dist/chunks/chunk-KURL76NW.js +6 -0
- package/dist/chunks/chunk-MZKCW6CB.js +2 -0
- package/dist/chunks/{chunk-UMAVVMXL.js → chunk-OL3L3U36.js} +1 -1
- package/dist/chunks/{chunk-IIT66347.js → chunk-OXQ2WFIH.js} +1 -1
- package/dist/chunks/{chunk-73TW6BKK.js → chunk-PPF6EBTQ.js} +1 -1
- package/dist/chunks/{chunk-V24VHT76.js → chunk-REGKOCDO.js} +1 -1
- package/dist/chunks/{chunk-PSY6IRJE.js → chunk-TAXCMCYZ.js} +1 -1
- package/dist/chunks/{chunk-OIH2LPIT.js → chunk-TCTBCAI6.js} +1 -1
- package/dist/chunks/{chunk-GEYZVOGD.js → chunk-UZNRH6I3.js} +1 -1
- package/dist/chunks/{chunk-DWM5G7BU.js → chunk-Y4E5AAI7.js} +1 -1
- package/dist/chunks/chunk-YAA7F5LI.js +2 -0
- package/dist/chunks/{chunk-XQAUHXL4.js → chunk-ZK3ET5EP.js} +2 -2
- package/dist/chunks/{cli-R7TAP6Z2.js → cli-ALEEFAJ7.js} +1 -1
- package/dist/chunks/{command-LNOVZQSK.js → command-5AXJMFYC.js} +11 -11
- package/dist/chunks/{configuration-command-CNITTZRP.js → configuration-command-5LUNWPOL.js} +1 -1
- package/dist/chunks/{connected-app-executor-FGWCLOJO.js → connected-app-executor-DHXZE4X3.js} +1 -1
- package/dist/chunks/connected-evidence-NWMPICKJ.js +2 -0
- package/dist/chunks/{connected-starting-assets-KWOFEIE4.js → connected-starting-assets-NRVXIKQ2.js} +1 -1
- package/dist/chunks/{continual-FVOLGGOE.js → continual-UCKQ2QLH.js} +1 -1
- package/dist/chunks/core-commands-ZPBX35M2.js +2 -0
- package/dist/chunks/datasets-6K3ZANIV.js +2 -0
- package/dist/chunks/desktop-test-57INNJ76.js +3 -0
- package/dist/chunks/evaluation-coordination-B7CN4R2D.js +2 -0
- package/dist/chunks/experiment-improvements-G357VLDB.js +2 -0
- package/dist/chunks/experiments-BHQO26LJ.js +2 -0
- package/dist/chunks/experiments-signal-BI6NKETB.js +2 -0
- package/dist/chunks/{help-K6YLZ3KL.js → help-UQN5RUPA.js} +1 -1
- package/dist/chunks/{hosted-app-server-composition-LA3BZ4SE.js → hosted-app-server-composition-WDDO6F23.js} +1 -1
- package/dist/chunks/{hosted-experiment-improvement-VG2WE7XZ.js → hosted-experiment-improvement-VVYXQ65K.js} +1 -1
- package/dist/chunks/{hosted-tasksets-NXVF4AQA.js → hosted-tasksets-KCLNMPG5.js} +1 -1
- package/dist/chunks/human-review-PX6DBIFT.js +2 -0
- package/dist/chunks/{import-YHYKZ6JN.js → import-2HEYPHPW.js} +1 -1
- package/dist/chunks/learning-LSXBL5DB.js +2 -0
- package/dist/chunks/{local-harness-taskset-review-XQHQ6JCR.js → local-harness-taskset-review-E5GN5LTR.js} +1 -1
- package/dist/chunks/opchat-66BCRKEZ.js +3 -0
- package/dist/chunks/opchat-bounded-chat-KQWXZVFN.js +2 -0
- package/dist/chunks/organizations-IOYWDOCC.js +2 -0
- package/dist/chunks/{profile-P2SJPBOJ.js → profile-YH6G3ZTD.js} +1 -1
- package/dist/chunks/{project-action-payload-LTIQBX77.js → project-action-payload-53OH6WDH.js} +1 -1
- package/dist/chunks/project-agent-RYVMKW2F.js +2 -0
- package/dist/chunks/{runtime-Q7JUJO4D.js → runtime-ISLJIGWC.js} +1 -1
- package/dist/chunks/sandbox-command-DI45NRTV.js +2 -0
- package/dist/chunks/{sandbox-template-U536EEWY.js → sandbox-template-T42MDUSR.js} +1 -1
- package/dist/chunks/{saved-work-KSIQPXC2.js → saved-work-54I5ZJTC.js} +1 -1
- package/dist/chunks/setup-D6TY2GWV.js +2 -0
- package/dist/chunks/{src-SGQYVBNQ.js → src-7RN7BF4W.js} +1 -1
- package/dist/chunks/{src-C3ZUESMK.js → src-LF5X4RNQ.js} +1 -1
- package/dist/chunks/{store-model-configuration-6L3OYXF4.js → store-model-configuration-AYFGMC5D.js} +1 -1
- package/dist/chunks/{store-model-project-preparation-AAEKCF6V.js → store-model-project-preparation-5DEIS7TB.js} +1 -1
- package/dist/chunks/{store-taskset-drafts-FRFL6ITK.js → store-taskset-drafts-EAOOY6CR.js} +1 -1
- package/dist/chunks/{taskset-UDDLFYKV.js → taskset-HNDIGYQG.js} +1 -1
- package/dist/chunks/{teams-bot-MPWL2PP4.js → teams-bot-Z5CZLWE4.js} +1 -1
- package/dist/chunks/{training-5UMT45UL.js → training-JTYQA7GA.js} +1 -1
- package/dist/chunks/training-hardware-MR4FUC4U.js +3 -0
- package/dist/chunks/training-hosted-36SZFS4U.js +2 -0
- package/dist/chunks/{web-search-ZEKJHZW4.js → web-search-FTVNZ7PH.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/index.js +1 -1
- package/dist/sandbox/runtime-handle.d.ts +3 -5
- package/dist/sandbox/sandbox-instance-client.d.ts +11 -5
- package/dist/sandbox/types/billing.d.ts +53 -0
- package/dist/sandbox/types/responses.d.ts +11 -1
- package/dist/sandbox/types/snapshots.d.ts +52 -3
- package/dist/skills/manifest.json +1 -1
- package/dist/web/assets/{App-CCuh99JW.js → App-CXhxya9x.js} +4 -4
- package/dist/web/assets/{AppDialog-CxjDHVk9.js → AppDialog-x1HU1uLv.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-CKJIVpKa.js → AppTerminalPanel-CNIKmqKc.js} +2 -2
- package/dist/web/assets/{AppToastContext-EpiT1dHs.js → AppToastContext-DNWd43HS.js} +1 -1
- package/dist/web/assets/{AppsView-BsMyPX_3.js → AppsView-BvOD83Z1.js} +1 -1
- package/dist/web/assets/{AttachmentTypeIcon-BXvZy5gB.js → AttachmentTypeIcon-BLdDr3JZ.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-BIIV4aq4.js → BrowserSidebar-Ar0FlFKg.js} +1 -1
- package/dist/web/assets/{CartesianChart-brqLBqnF.js → CartesianChart-tS7f1HZv.js} +1 -1
- package/dist/web/assets/{ChatTimelineEntry-CwZbn16X.js → ChatTimelineEntry-z7_kur3h.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-BU4uc4tZ.js → CollaborationTabs-CaiFEKrv.js} +1 -1
- package/dist/web/assets/{CommandMenu-DkWpXR55.js → CommandMenu-BpubEqaA.js} +1 -1
- package/dist/web/assets/{CommunityView-CsSxJZGn.js → CommunityView-TGR4s99l.js} +1 -1
- package/dist/web/assets/{ComposerAttachments-BdJGCYzI.js → ComposerAttachments-DPWCjKXz.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-CWy0j1vv.js → ComposerCreateImproveStrip-Drji01_6.js} +1 -1
- package/dist/web/assets/{ConversationImportsSettings-DCmiakbZ.js → ConversationImportsSettings-B_oW0cz7.js} +1 -1
- package/dist/web/assets/{DatasetReviewImport-DEnF_pGu.js → DatasetReviewImport-Dr3unJSY.js} +1 -1
- package/dist/web/assets/{ExperimentTrainingDataWorkspace-WhwQ0QBi.js → ExperimentTrainingDataWorkspace-DObvpJAw.js} +2 -2
- package/dist/web/assets/{FilePagePreview-BRhhz99q.js → FilePagePreview-9kkXbARN.js} +2 -2
- package/dist/web/assets/{GetStartedView-CLVD-qEi.js → GetStartedView-Dv2b_SlH.js} +1 -1
- package/dist/web/assets/{GettingStartedDialog-CMxaAMg-.js → GettingStartedDialog-sPaPMc61.js} +1 -1
- package/dist/web/assets/{HostedModelLearningReview-Cn-j-rDo.js → HostedModelLearningReview-BlwhGxS6.js} +1 -1
- package/dist/web/assets/HostedModelLearningSettings-B5ahk3je.js +1 -0
- package/dist/web/assets/{HtmlVisual-D5y2WG9L.js → HtmlVisual-rGsClq0p.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-BxRmYD6h.js → LabModelVersionDetailPage-Da7AwZWV.js} +1 -1
- package/dist/web/assets/{LabModelWorkspace-u2Ulm_z4.js → LabModelWorkspace-DTeYViWH.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-C7IceJTJ.js → LabSkillSidebar-BieHbNl6.js} +1 -1
- package/dist/web/assets/{LabsRoute-CbztQaEf.js → LabsRoute-D3XqPB0-.js} +4 -4
- package/dist/web/assets/{LearningBatchesPage-CJqgZNvM.js → LearningBatchesPage-CCBuf2u4.js} +1 -1
- package/dist/web/assets/{MainChatThread-DNMfrrRq.js → MainChatThread-B6BQJfcq.js} +2 -2
- package/dist/web/assets/{MainPane-CQQxSDPS.js → MainPane-D3fQou29.js} +6 -6
- package/dist/web/assets/{ModelProjectPageHeader-Dge19aE1.js → ModelProjectPageHeader-BZn9Lu_J.js} +1 -1
- package/dist/web/assets/{NativeSetupTerminal-D4JnbpyD.js → NativeSetupTerminal-Bglqab_g.js} +2 -2
- package/dist/web/assets/{NativeSkillSidebar-Jzx1BeKV.js → NativeSkillSidebar-pUGRdnV_.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-DcnGzEd9.js → NewProjectDialog-BpHN38MA.js} +1 -1
- package/dist/web/assets/{OutputsPage-Cmk15Vt_.js → OutputsPage-LunDCQ6w.js} +1 -1
- package/dist/web/assets/{PageChrome-Cz_fCqtn.js → PageChrome-DThEcWAx.js} +1 -1
- package/dist/web/assets/{ProjectsPage-BZ3Eo3Mz.js → ProjectsPage-vct_TQgL.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-C6H2vU9N.js → RightChatPanelStack-CgFK7DY0.js} +1 -1
- package/dist/web/assets/RightSidebarHomePanel-BJmzUcmy.js +1 -0
- package/dist/web/assets/{ScheduledWorkPage-CAkSwM0T.js → ScheduledWorkPage-mmaZfybl.js} +1 -1
- package/dist/web/assets/{SettingsView-DvQXGw3_.js → SettingsView-CJfeRsWR.js} +3 -3
- package/dist/web/assets/{TasksetDraftEditorPrimitives-JuU1k8vr.js → TasksetDraftEditorPrimitives-CuimAfkv.js} +1 -1
- package/dist/web/assets/{TeamChatView-DmHjr8W9.js → TeamChatView-BcK0lF1b.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-DlaM9d8F.js → TerminalOverlay-0pzEvy-C.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-ClpylNsr.js → TrainingCreationPanel-CcyzFz7l.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-6tH2xSDj.js → TrainingDraftPanel-DSLZXdLz.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CzDqxOYM.js → UsageSettingsSection-BT9pcnCn.js} +1 -1
- package/dist/web/assets/WorkSidebarPanel-CP-nHAsJ.js +1 -0
- package/dist/web/assets/{WorkspaceDiffPanel-B4e0lyF7.js → WorkspaceDiffPanel-Bbz5qrVA.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-D01ZkZZF.js → WorkspaceEnvironmentMenu-6hXpvMTl.js} +1 -1
- package/dist/web/assets/{WorkspaceFileLocation-C5s_njZb.js → WorkspaceFileLocation-BijVemBl.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-DjPZ6KIh.js → WorkspaceGitDialogs-BOO0E5i9.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-CC4sfOiU.js → WorkspaceMonacoEditor-B_YzK7Do.js} +3 -3
- package/dist/web/assets/{WorkspacePdfPreview-vszQqFa4.js → WorkspacePdfPreview-CFti1fvu.js} +2 -2
- package/dist/web/assets/{WorkspacePresentationPreview-DQTvhaRD.js → WorkspacePresentationPreview-DPAhNaV6.js} +1 -1
- package/dist/web/assets/{bot-Doyx3T4j.js → bot-BE2rL_qv.js} +1 -1
- package/dist/web/assets/chevron-down-Bn8yph2O.js +1 -0
- package/dist/web/assets/chevron-right-BU-jUmb2.js +1 -0
- package/dist/web/assets/chevron-up-DacwuDJZ.js +1 -0
- package/dist/web/assets/{chunk-C3TS766N-ppRhs95p.js → chunk-C3TS766N-j1MK0e3c.js} +1 -1
- package/dist/web/assets/{client-DwZ92xtu.js → client-BnJhN-14.js} +1 -1
- package/dist/web/assets/{client-choice-storage-DitqKiIT.js → client-choice-storage-CQ0CNkzG.js} +1 -1
- package/dist/web/assets/{cloud-upload-HdzNTgr2.js → cloud-upload-DFjZE4O4.js} +1 -1
- package/dist/web/assets/{copy-DTQhoBNg.js → copy-CGrLUtw5.js} +1 -1
- package/dist/web/assets/{cssMode-BRTtfXxU.js → cssMode-DvRw2fUx.js} +1 -1
- package/dist/web/assets/{external-link-H1629UU6.js → external-link-3ZnEFUXd.js} +1 -1
- package/dist/web/assets/{folder-open-CAGdWOrr.js → folder-open-i9n8450i.js} +1 -1
- package/dist/web/assets/{folder-plus-C14cs2mE.js → folder-plus-cu8Md_ej.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-DFUfuVvF.js → git-commit-horizontal-CwckmC09.js} +1 -1
- package/dist/web/assets/{htmlMode-BVaCcL76.js → htmlMode-8VF4Ovtw.js} +1 -1
- package/dist/web/assets/{icons-Bk2b68aC.js → icons-4yRSxBZj.js} +1 -1
- package/dist/web/assets/{image-0DPVY6Ev.js → image-D-umhyyK.js} +1 -1
- package/dist/web/assets/{index-B6XX_0h3.js → index-DiVhx1GM.js} +2 -2
- package/dist/web/assets/{info-C8b_tafZ.js → info-Dq2RsPDJ.js} +1 -1
- package/dist/web/assets/{jsonMode-BCKKQmmV.js → jsonMode-CvCYQHkB.js} +1 -1
- package/dist/web/assets/loader-circle-DBl6qqtR.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-DozmNUOx.js → lspLanguageFeatures-CjufNNFF.js} +1 -1
- package/dist/web/assets/{maximize-2-CByk9-zN.js → maximize-2-CKY8dua6.js} +1 -1
- package/dist/web/assets/{message-square-C889vRqm.js → message-square-CVDgKlKX.js} +1 -1
- package/dist/web/assets/{monaco.contribution-BITdsRbn.js → monaco.contribution-BYAgjZbj.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DxAV1oS5.js → monaco.contribution-BYY3-y9l.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BqA-XZ44.js → monaco.contribution-Bh0CKj9i.js} +2 -2
- package/dist/web/assets/{monaco.contribution-B9q6qbbo.js → monaco.contribution-PjJ1258q.js} +2 -2
- package/dist/web/assets/{monitor-BtxlcLuI.js → monitor-UYe42gew.js} +1 -1
- package/dist/web/assets/{paperclip-BeIdaspf.js → paperclip-DrlSVUoz.js} +1 -1
- package/dist/web/assets/{pdf-perlzwEB.js → pdf-BMhday2W.js} +1 -1
- package/dist/web/assets/play-DIqZnaNf.js +1 -0
- package/dist/web/assets/plus-CFNxAPMK.js +1 -0
- package/dist/web/assets/{presentation-0bzvu6_u.js → presentation-DcZKqH7w.js} +1 -1
- package/dist/web/assets/{python-B9hOnkOI.js → python-CiA01i07.js} +1 -1
- package/dist/web/assets/{refresh-cw-D61-Ozk3.js → refresh-cw-00D-GDnF.js} +1 -1
- package/dist/web/assets/{save-iEMNZoPe.js → save-CXe7bqR7.js} +1 -1
- package/dist/web/assets/{settings-lists-C84qxFmP.js → settings-lists-B5J40WM6.js} +1 -1
- package/dist/web/assets/square-DJEaBefe.js +1 -0
- package/dist/web/assets/{square-terminal-Djpzo2Qs.js → square-terminal-DxC7TTds.js} +1 -1
- package/dist/web/assets/{submit-issue-command-HfKzyxg5.js → submit-issue-command-Dq3TqJLV.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-ClsXu39R.js → toggleHighContrast-BH3Jckfo.js} +1 -1
- package/dist/web/assets/{training-model-data-CIysl8wH.js → training-model-data-B6IZ3x-t.js} +1 -1
- package/dist/web/assets/{tsMode-nbmaMc-D.js → tsMode-DXkj4bqC.js} +1 -1
- package/dist/web/assets/{upload-C6ug8RD-.js → upload-B3KRHVHl.js} +1 -1
- package/dist/web/assets/{useAccountSettings-Dr9h4Qz_.js → useAccountSettings-BGRkTRrp.js} +1 -1
- package/dist/web/assets/{useAgentInventory-ByCk2JAv.js → useAgentInventory-D_1AlAZJ.js} +1 -1
- package/dist/web/assets/{useChatContextSelection-C0eMm2g6.js → useChatContextSelection-hoMSuUSE.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-Do0y_leJ.js → useLocalAgentSchedules-DxTER7Ow.js} +1 -1
- package/dist/web/assets/{useQuery-D2MQ7e5U.js → useQuery-DkPec_9x.js} +1 -1
- package/dist/web/assets/{wifi-off-Dr-CapyW.js → wifi-off-CMzpvbWl.js} +1 -1
- package/dist/web/assets/{workers-DKvM2NdM.js → workers-ziY_bTv2.js} +1 -1
- package/dist/web/assets/x-omjwMPbJ.js +1 -0
- package/dist/web/assets/{yaml-C02vq4ar.js → yaml-mSvqVSko.js} +1 -1
- package/dist/web/index.html +1 -1
- package/docs/command-reference.md +11 -0
- package/package.json +1 -1
- package/dist/chunks/account-context-MWB6HN6I.js +0 -12
- package/dist/chunks/apps-RSFEJOQN.js +0 -2
- package/dist/chunks/chunk-27JGS3KB.js +0 -12
- package/dist/chunks/chunk-APKXXAUF.js +0 -2
- package/dist/chunks/chunk-DRTHKWHK.js +0 -6
- package/dist/chunks/chunk-JCLTFDVW.js +0 -2
- package/dist/chunks/chunk-KOC3YJEU.js +0 -12
- package/dist/chunks/chunk-KTIBXRWQ.js +0 -2
- package/dist/chunks/chunk-YDZBX4XQ.js +0 -2
- package/dist/chunks/connected-evidence-5VZBYNWN.js +0 -2
- package/dist/chunks/core-commands-BPYXVT7O.js +0 -2
- package/dist/chunks/datasets-E5TXSVIY.js +0 -2
- package/dist/chunks/desktop-test-FX7DTY4N.js +0 -3
- package/dist/chunks/evaluation-coordination-KUTZEEPB.js +0 -2
- package/dist/chunks/experiment-improvements-PQNR5YHN.js +0 -2
- package/dist/chunks/experiments-Z4BJWT3Y.js +0 -2
- package/dist/chunks/experiments-signal-3GCLKUWZ.js +0 -2
- package/dist/chunks/human-review-2ZOB7CJZ.js +0 -2
- package/dist/chunks/learning-LAXMGWSQ.js +0 -2
- package/dist/chunks/opchat-XXI2ZM53.js +0 -3
- package/dist/chunks/opchat-bounded-chat-3MZGCRLY.js +0 -2
- package/dist/chunks/organizations-W7HI2JA4.js +0 -2
- package/dist/chunks/project-agent-XRIXMXQK.js +0 -2
- package/dist/chunks/sandbox-command-HVA5FJU4.js +0 -2
- package/dist/chunks/setup-RMZ2BHLM.js +0 -2
- package/dist/chunks/training-hardware-UWQCRDMV.js +0 -3
- package/dist/chunks/training-hosted-CKSDRVL6.js +0 -2
- package/dist/web/assets/HostedModelLearningSettings-VNBvf38S.js +0 -1
- package/dist/web/assets/RightSidebarHomePanel-BfMMVkM1.js +0 -1
- package/dist/web/assets/WorkSidebarPanel-CY-AHZ4-.js +0 -1
- package/dist/web/assets/chevron-down-DX1hzujj.js +0 -1
- package/dist/web/assets/chevron-right-DHN0y3KC.js +0 -1
- package/dist/web/assets/chevron-up-_QrW88NF.js +0 -1
- package/dist/web/assets/loader-circle-y-SSPwpk.js +0 -1
- package/dist/web/assets/play-CHXXdkuO.js +0 -1
- package/dist/web/assets/plus-DFFWjhPw.js +0 -1
- package/dist/web/assets/square-BE_4JMR3.js +0 -1
- package/dist/web/assets/x-Jx2jlP9u.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{f as $,g as J,h as L,i as v,j as q}from"./chunk-JPUSTFZC.js";import{c as y}from"./chunk-RFQD6B44.js";import"./chunk-DWM5G7BU.js";import"./chunk-RBTDSI4L.js";import"./chunk-XRKFTPHD.js";import{b as H,c as Q}from"./chunk-22UARBPW.js";import{I as C,J as G,K as k,N as W,P as M,R as z,S as F,b as D,l as K,q as V,r as _}from"./chunk-JEMECEQH.js";import"./chunk-73TW6BKK.js";import"./chunk-27JGS3KB.js";import"./chunk-BT5YNE5U.js";import{d as m}from"./chunk-RPM4FDRX.js";import"./chunk-KTIBXRWQ.js";import"./chunk-KP2MYTP5.js";import"./chunk-PNPV2LDE.js";import"./chunk-4G3GTEVS.js";import"./chunk-KU4TPDPH.js";import"./chunk-55YD4UTW.js";import"./chunk-AFYYIJ6K.js";import"./chunk-J256AEEE.js";import"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import{f,h as g}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as S,f as w,j as T,k as j}from"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-JCLTFDVW.js";import"./chunk-SV7ZBEK2.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-UGOK7VTC.js";import"./chunk-TBODQT4W.js";import"./chunk-5HPZGLOL.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as p}from"./chunk-FTQLQJQV.js";async function ie(){let e=await m(),s=f(e),t=await y(e,s),n=g(e),r=await L({apiBase:n,apiKey:t});console.log(JSON.stringify(r,null,2))}p(ie,"runAppsTools");async function se(e){let s=await m(),t=f(s),n=g(s),r=await y(s,t),i=typeof e.handle=="string"?String(e.handle):void 0,o=i?$(i):null,c=e.refresh!==void 0?w(e.refresh):void 0,l=await J({apiBase:n,apiKey:r,forceRefresh:c}),u=o?l.filter(a=>$(a.handle||a.gitOwner)===o):l;if(u.length===0){console.log("no apps found");return}if(w(e.json)){console.log(JSON.stringify({apps:u},null,2));return}for(let a of u){let d=a.handle||a.gitOwner||"unknown",h=a.repo||a.gitRepo||a.id,B=a.latestDeployment?.status||"no-deploy",R=a.latestDeployment?.gitBranch||a.defaultBranch||"-",I=a.codeVisibility||"unknown",E=a.sandbox?"yes":"no";console.log(`${d}/${h} ${B} ${R} code=${I} sandbox=${E} ${a.id}`)}}p(se,"runAppsList");async function oe(e,s){let t=typeof e.visibility=="string"?e.visibility.trim():typeof e.codeVisibility=="string"?e.codeVisibility.trim():"";if(t!=="public"&&t!=="private")throw new Error("usage: apps code-visibility <handle>/<repo> --visibility public|private");let n=await m(),r=f(n),i=g(n),o=await y(n,r),{app:c,handle:l,repo:u}=await v(i,o,s),a=await K(i,o,c.id,t);console.log(`${l}/${u} code_visibility=${a.app?.codeVisibility??t} app_id=${c.id}`)}p(oe,"runAppsCodeVisibility");async function ae(e){let s=await m(),t=f(s),n=await y(s,t),r=g(s),i=typeof e.appId=="string"?String(e.appId):void 0,o=await G(r,n,{appId:i});console.log(JSON.stringify(o,null,2))}p(ae,"runAppsPerformance");async function ce(e,s){let t=await m(),n=f(t),r=g(t),i=await y(t,n),{app:o}=await v(r,i,s),c=await k(r,i,o.id);console.log(JSON.stringify(c,null,2))}p(ce,"runAppsSummary");async function le(e,s,t,n){let r=(typeof e.prompt=="string"?e.prompt:null)||n.join(" ");if(!r.trim())throw new Error("usage: apps assistant <plan|performance> <handle>/<repo> --prompt <text>");let i=await m(),o=f(i),c=g(i),l=await y(i,o),{app:u}=await v(c,l,t),a=await W(c,l,{appId:u.id,mode:s,prompt:r.trim()});console.log(JSON.stringify(a,null,2))}p(le,"runAppsAssistant");async function de(e,s){let t=await m(),n=f(t),r=await y(t,n),i=g(t),o=(typeof e.prompt=="string"?e.prompt:null)||s.join(" ");if(!o.trim())throw new Error("usage: apps agent create --prompt <text> [--team-id <id>]");let c=typeof e.templateRepoUrl=="string"?e.templateRepoUrl:void 0,l=typeof e.templateBranch=="string"?e.templateBranch:void 0,u=typeof e.templateLocalPath=="string"?e.templateLocalPath:void 0,a=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0;if(u&&String(u).trim().length>0)throw new Error("templateLocalPath is not supported; use templateRepoUrl");let d=typeof e.env=="string"?S(e.env,"env"):void 0;if(d){if(typeof d!="object"||Array.isArray(d))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(d))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}let h=c||l||d?{templateRepoUrl:c,templateBranch:l,envVars:d}:void 0,B=typeof e.deployEnvironment=="string"?e.deployEnvironment==="preview"?"preview":"production":void 0,R=e.deployDisabled!==void 0?w(e.deployDisabled):void 0,I=e.streamDeployLogs!==void 0?w(e.streamDeployLogs):!0,E=await C(i,r,{prompt:o.trim(),...a?{teamId:a}:{},...h?{template:h}:{},...B?{deployEnvironment:B}:{},...R!==void 0?{deployDisabled:R}:{},streamDeployLogs:I});if(!E.ok){let b=await E.text().catch(()=>"");throw new Error(`agent create failed: ${E.status} ${b}`)}let N=null,O=null,P=null;await H(E,{onConversationId:p(b=>{N=b},"onConversationId"),onItems:p(b=>{for(let A of b){let U=Q(A);U&&console.log(U);let x=A;!O&&typeof x.appId=="string"&&(O=x.appId),!P&&typeof x.deploymentId=="string"&&(P=x.deploymentId)}},"onItems")}),N&&console.log(`conversation_id: ${N}`),O&&console.log(`app_id: ${O}`),P&&console.log(`deployment_id: ${P}`);try{await J({apiBase:i,apiKey:r,forceRefresh:!0}),await L({apiBase:i,apiKey:r,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}p(de,"runAppsAgentCreate");async function pe(e,s,t,n){let r=await m(),i=f(r),o=await y(r,i),c=g(r),l=typeof e.method=="string"?String(e.method).toUpperCase():void 0,u=l&&["GET","POST","PUT","DELETE"].includes(l)?l:void 0;if(l&&!u)throw new Error("method must be GET, POST, PUT, or DELETE");let a=typeof e.body=="string"?S(String(e.body),"body"):void 0,d=typeof e.headers=="string"?S(String(e.headers),"headers"):void 0,h=typeof e.scheduleId=="string"?String(e.scheduleId):void 0,B=w(e.notifyEmail),R=w(e.summary)||w(e.withSummary),I=await M(c,o,{appId:s,deploymentId:t,toolName:n,scheduleId:h,method:u,body:a,headers:d,notifyEmail:B||void 0});if(console.log(JSON.stringify(I,null,2)),R&&I.ok){let E=await k(c,o,s);console.log(JSON.stringify({summary:E},null,2))}}p(pe,"runAppsToolsExecute");async function ue(e,s){let t=typeof e.env=="string"?e.env:typeof e.vars=="string"?e.vars:typeof e.envVars=="string"?e.envVars:null;if(!t)throw new Error("usage: apps env set <handle>/<repo> --env <json>");let n=S(t,"env");if(!n||typeof n!="object"||Array.isArray(n))throw new Error("env must be a JSON object");let r={};for(let[d,h]of Object.entries(n)){if(typeof h!="string")throw new Error(`env value for ${d} must be a string`);if(!d.startsWith("OPENTOOL_PUBLIC_"))throw new Error("only OPENTOOL_PUBLIC_ env vars can be set");r[d]=h}let i=await m(),o=f(i),c=g(i),l=await y(i,o),{app:u}=await v(c,l,s),a=await V(c,l,u.id,{envVars:r});console.log(JSON.stringify(a,null,2))}p(ue,"runAppsEnvSet");async function fe(e,s){let t=await m(),n=f(t),r=g(t),i=await y(t,n),{app:o}=await v(r,i,s),c=await _(r,i,o.id);console.log(JSON.stringify(c,null,2))}p(fe,"runAppsEnvGet");async function ge(e,s){let t=await m(),n=f(t),r=g(t),i=await y(t,n),{app:o,handle:c,repo:l}=await v(r,i,s),u=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,a=j(u),d=await D(r,i,o.id,{environment:a});console.log(JSON.stringify(d,null,2)),(w(e.watch)||w(e.wait)||w(e.follow))&&await q({baseUrl:r,apiKey:i,deploymentId:d.deploymentId,prefix:`[${c}/${l}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}p(ge,"runAppsDeploy");function X(e){let s={};if(typeof e.params=="string"){let n=S(String(e.params),"params");if(!n||typeof n!="object"||Array.isArray(n))throw new Error("params must be a JSON object");for(let[r,i]of Object.entries(n))i!==void 0&&(s[r]=typeof i=="string"?i:JSON.stringify(i))}let t=p((n,r)=>{r===void 0||r===""||(s[n]=r)},"addParam");if(t("source",typeof e.source=="string"?e.source.trim():void 0),t("symbol",typeof e.symbol=="string"?e.symbol.trim():void 0),t("cursor",typeof e.cursor=="string"?e.cursor.trim():void 0),t("status",typeof e.status=="string"?e.status.trim():void 0),t("backtestRunId",typeof e.runId=="string"?e.runId.trim():typeof e.backtestRunId=="string"?e.backtestRunId.trim():void 0),t("since",T(e.since,"since")),t("until",T(e.until,"until")),typeof e.limit=="string"&&e.limit.trim().length>0){let n=Number.parseInt(e.limit,10);if(!Number.isFinite(n))throw new Error("limit must be a number");t("limit",String(n))}return Object.keys(s).length?s:void 0}p(X,"resolveBacktestEventsParams");async function me(e,s){let t=await m(),n=f(t),r=await y(t,n),i=g(t),{app:o}=await v(i,r,s),c={...X(e)??{},appId:o.id},l=await z(i,r,{method:"GET",query:c});console.log(JSON.stringify(l,null,2))}p(me,"runBacktestEvents");async function ye(e,s){let t=typeof e.runId=="string"?e.runId.trim():typeof e.backtestRunId=="string"?e.backtestRunId.trim():"";if(!t)throw new Error("usage: backtest get <handle>/<repo> --run-id <id>");let n=await m(),r=f(n),i=await y(n,r),o=g(n),{app:c}=await v(o,i,s),l=await F(o,i,{appId:c.id,runId:t});console.log(JSON.stringify(l,null,2))}p(ye,"runBacktestGet");export{X as resolveBacktestEventsParams,de as runAppsAgentCreate,le as runAppsAssistant,oe as runAppsCodeVisibility,ge as runAppsDeploy,fe as runAppsEnvGet,ue as runAppsEnvSet,se as runAppsList,ae as runAppsPerformance,ce as runAppsSummary,ie as runAppsTools,pe as runAppsToolsExecute,me as runBacktestEvents,ye as runBacktestGet};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as $,b as C}from"./chunk-2LJCJOJ7.js";import{b as y,c as w,e as O}from"./chunk-JCLTFDVW.js";import{a as n}from"./chunk-FTQLQJQV.js";function v(r){return{list:n((e={})=>r.listSandboxRuntimes(e),"list"),create:n(e=>r.createSandboxRuntime(e),"create"),handle:n((e,t=null)=>r.sandboxRuntime(e,t),"handle"),get:n(e=>r.getSandboxRuntime(e),"get"),createSandbox:n((e,t={},o={})=>r.createSandboxRuntimeSandbox(e,t,o),"createSandbox"),updateStatus:n((e,t)=>r.updateSandboxRuntimeStatus(e,t),"updateStatus"),events:n(e=>r.listSandboxRuntimeEvents(e),"events"),event:n((e,t)=>r.emitSandboxRuntimeEvent(e,t),"event"),checkpoint:n((e,t={})=>r.checkpointSandboxRuntime(e,t),"checkpoint"),promote:n((e,t,o={})=>r.promoteSandboxRuntime(e,t,o),"promote"),preserveSource:n((e,t={},o={})=>r.preserveSandboxRuntimeSource(e,t,o),"preserveSource")}}n(v,"createSandboxRuntimeNamespace");function A(r){return{list:n((e={})=>r.list(e),"list"),create:n(e=>r.create(e),"create"),get:n(e=>r.get(e),"get"),pricing:n(()=>r.pricing(),"pricing"),costs:n((e={})=>r.costs(e),"costs")}}n(A,"createSandboxNamespace");function j(r){return{list:n(e=>r.listProjects(e),"list"),upsert:n(e=>r.upsertProject(e),"upsert"),upsertGitRemote:n(e=>r.upsertProjectGitRemote(e),"upsertGitRemote"),get:n((e,t)=>r.getProject(e,t),"get"),update:n((e,t)=>r.updateProject(e,t),"update"),sync:n((e,t)=>r.syncProject(e,t),"sync"),ensureGitRemote:n((e,t)=>r.ensureProjectGitRemote(e,t),"ensureGitRemote"),getGitRemote:n((e,t)=>r.ensureProjectGitRemote(e,t),"getGitRemote"),git:n((e,t)=>r.ensureProjectGitRemote(e,t),"git"),uploadSource:n((e,t)=>r.uploadProjectSource(e,t),"uploadSource"),archive:n((e,t)=>r.archiveProject(e,t),"archive")}}n(j,"createSandboxProjectNamespace");function T(r){return{get:n(e=>r.getHostedProfile(e),"get"),status:n(e=>r.getHostedProfile(e),"status"),ensureHosted:n(e=>r.ensureHostedProfile(e),"ensureHosted"),push:n(e=>r.pushHostedProfile(e),"push")}}n(T,"createSandboxProfileNamespace");function k(r){return{list:n(e=>r.listAgents(e),"list"),upsert:n(e=>r.upsertAgent(e),"upsert"),get:n((e,t)=>r.getAgent(e,t),"get"),update:n((e,t)=>r.updateAgent(e,t),"update"),archive:n((e,t)=>r.archiveAgent(e,t),"archive"),run:n((e,t)=>r.runAgent(e,t),"run"),sourceDeployPlan:n((e,t)=>r.getAgentSourceDeployPlan(e,t),"sourceDeployPlan"),manifestSnapshots:n((e,t)=>r.listAgentManifestSnapshots(e,t),"manifestSnapshots"),requestSourceChecks:n((e,t)=>r.requestAgentSourceChecks(e,t),"requestSourceChecks"),configureSourceSetup:n((e,t)=>r.configureAgentSourceSetup(e,t),"configureSourceSetup"),publishSource:n((e,t)=>r.publishAgentSource(e,t),"publishSource")}}n(k,"createSandboxAgentNamespace");function E(r,e,t=null){let o=n(async(a={},d={})=>{let f=await r.getSandboxRuntime(e);return f.sandboxId?r.get(f.sandboxId):r.createSandboxRuntimeSandbox(e,a,d).then(m=>m.sandbox)},"currentSandbox"),s=n(async(a={},d={})=>{let f=await r.getSandboxRuntime(e);if(!f.sandboxId)return r.createSandboxRuntimeSandbox(e,a,d).then(h=>h.sandbox);let m=await r.get(f.sandboxId);return m.state==="stopped"?r.start(m.id,d).then(h=>h.sandbox):m.state==="archived"?r.restore(m.id).then(h=>h.sandbox):m.state==="deleted"||m.state==="error"?r.createSandboxRuntimeSandbox(e,a,d).then(h=>h.sandbox):m},"resume");return{id:e,initial:t,get:n(()=>r.getSandboxRuntime(e),"get"),sandbox:o,resume:s,createSandbox:n((a={},d={})=>r.createSandboxRuntimeSandbox(e,a,d),"createSandbox"),status:n(async a=>{if(typeof a!="string")return r.updateSandboxRuntimeStatus(e,a);let d=await r.getSandboxRuntime(e);return r.updateSandboxRuntimeStatus(e,{status:a,expectedVersion:d.version})},"status"),events:n(()=>r.listSandboxRuntimeEvents(e),"events"),event:n(a=>r.emitSandboxRuntimeEvent(e,a),"event"),recordCommit:n((a,d={})=>r.emitSandboxRuntimeEvent(e,{...d,type:d.type??"git.commit",commitSha:a}),"recordCommit"),checkpointHint:n((a={})=>r.emitSandboxRuntimeEvent(e,{type:"workflow.checkpoint_hint",summary:a.summary??a.reason??"Workflow checkpoint hint",payload:{...a.payload,reason:a.reason??null},artifactRefs:a.artifactRefs,lifecycleHint:{kind:"checkpoint",reason:a.reason??null}}),"checkpointHint"),waitForUser:n(async(a={})=>{await r.emitSandboxRuntimeEvent(e,{type:"workflow.waiting_for_user",summary:a.summary??a.reason??"Waiting for user",payload:{...a.payload,reason:a.reason??null},lifecycleHint:{kind:"waiting_for_user",reason:a.reason??null}});let d=await r.getSandboxRuntime(e);return d.status==="waiting_for_user"?d:r.updateSandboxRuntimeStatus(e,{status:"waiting_for_user",expectedVersion:d.version,summary:a.summary??a.reason,metadata:{workflowWaitForUserReason:a.reason??null}})},"waitForUser"),keepAlive:n((a={})=>{let d=D(a);return r.emitSandboxRuntimeEvent(e,{type:"workflow.keepalive",summary:a.summary??a.reason??"Workflow keepalive",payload:{...a.payload,reason:a.reason??null,keepaliveUntil:d},lifecycleHint:{kind:"keepalive",reason:a.reason??null,keepaliveUntil:d}})},"keepAlive"),checkpoint:n(a=>r.checkpointSandboxRuntime(e,a),"checkpoint"),files:{write:n(async(a,d)=>r.uploadFile((await s()).id,a,d),"write"),read:n(async a=>r.downloadFile((await s()).id,a),"read"),readResponse:n(async a=>r.downloadFileResponse((await s()).id,a),"readResponse"),list:n(async(a={})=>r.listFiles((await s()).id,a),"list"),delete:n(async(a,d={})=>r.deleteFile((await s()).id,a,d),"delete"),search:n(async a=>r.searchFiles((await s()).id,a),"search"),stat:n(async a=>r.statFile((await s()).id,a),"stat"),mkdir:n(async a=>r.mkdir((await s()).id,a),"mkdir"),move:n(async a=>r.moveFile((await s()).id,a),"move")},commands:{run:n(async a=>r.exec((await s()).id,typeof a=="string"?{command:a}:a),"run")},ports:{expose:n(async a=>r.openPort((await s()).id,typeof a=="number"?{port:a}:a),"expose")},promote:n((a,d={})=>r.promoteSandboxRuntime(e,a,d),"promote"),preserveSource:n((a={},d={})=>r.preserveSandboxRuntimeSource(e,a,d),"preserveSource"),archive:n(async a=>{let d=a??(await r.getSandboxRuntime(e)).version;return r.updateSandboxRuntimeStatus(e,{status:"archived",expectedVersion:d})},"archive")}}n(E,"createSandboxRuntimeHandle");function D(r){if(r?.until instanceof Date)return r.until.toISOString();if(typeof r?.until=="string"&&r.until.trim())return new Date(r.until).toISOString();let e=typeof r?.seconds=="number"&&Number.isFinite(r.seconds)?Math.max(1,Math.trunc(r.seconds)):60;return new Date(Date.now()+e*1e3).toISOString()}n(D,"runtimeKeepaliveUntilIso");async function z(r,e={}){let t=`openpond-code-smoke-${Date.now()}`,o=`openpond-code-exec-ok:${t}`,s=`openpond-code-preview-ok:${t}`,i=`openpond-code-file-ok:${t}`,c=4173,u=null,a=null,d=!1,f=!1;try{let m=await N(r,await r.create({repo:e.repo??"https://github.com/octocat/Hello-World",resources:{cpu:e.cpu??1,memoryGb:e.memoryGb??1,diskGb:e.diskGb??8},budget:{maxUsd:e.budgetUsd??"0.05"},quotas:{maxSpendUsd:e.budgetUsd??"0.05",maxDurationSeconds:600,idleTimeoutSeconds:600,maxOpenPorts:2},metadata:{runId:t,source:"openpond-code-sandbox-smoke"}},{async:!0}));u=m.id;let h=e.expectedMppMode;if(h&&m.reservation.mpp?.mode!==h)throw new Error(`expected ${h} reservation, got ${m.reservation.mpp?.mode??"none"}`);if(!h&&!m.reservation.mpp?.mode)throw new Error("expected sandbox reservation MPP metadata");let R=await r.exec(m.id,{command:[`printf '${o}\\n'`,"test -f README && printf 'repo-clone-ok\\n'","cat > server.cjs <<'EOF'","const { createServer } = require('node:http');",`createServer((_request, response) => response.end('${s}')).listen(${c}, '0.0.0.0');`,"EOF","nohup node server.cjs > server.log 2>&1 & sleep 1"].join(`
|
|
3
|
-
`),timeoutSeconds:120});if(R.command.status!=="succeeded")throw new Error(`expected command success, got ${R.command.status}`);if(!R.command.output.includes(o))throw new Error("expected exec marker");if(await r.uploadFile(m.id,"openpond-code-smoke.txt",i),await r.downloadFile(m.id,"openpond-code-smoke.txt")!==i)throw new Error("expected file roundtrip marker");let g=null;if(e.snapshot||e.fork){let S=await r.createSnapshot(m.id,{async:!0,name:`openpond-code-smoke-${t}`,replay:{entrypoints:[{command:"cat openpond-code-smoke.txt",name:"default"}],retention:{class:"pinned"},safety:{cleanup:"delete",idleTimeoutSeconds:600,internetEgress:"block",maxDurationSeconds:600,maxSpendUsd:e.budgetUsd??"0.05",publicPreview:!1},validation:{commands:[{command:"test -f openpond-code-smoke.txt"}]}}}),p=S.snapshot??(await K(r,m.id,S.snapshotJob?.snapshotId)).snapshot;if(g=p.id,p.state!=="ready")throw new Error(`expected ready snapshot, got ${p.state}`)}if(e.fork){if(!g)throw new Error("expected snapshot id before fork");let S=await N(r,(await r.forkSnapshot(g,{budget:{maxUsd:e.budgetUsd??"0.05"},metadata:{source:"openpond-code-sandbox-smoke-fork",templateSnapshotId:g}},{async:!0})).sandbox);a=S.id;let p=await r.exec(S.id,{command:"cat openpond-code-smoke.txt",timeoutSeconds:120});if(p.command.status!=="succeeded")throw new Error(`expected fork command success, got ${p.command.status}`);if(!p.command.output.includes(i))throw new Error("expected fork snapshot marker");e.keep||(await q(r,S.id),f=!0)}let x=null;if(e.preview!==!1){let S=await r.openPort(m.id,{label:"openpond-code-smoke",port:c}),p=await fetch(S.preview.url);x=p.status;let F=await p.text();if(p.status!==200)throw new Error(`expected preview HTTP 200, got ${p.status}`);if(!F.includes(s))throw new Error("expected preview marker")}let{sandbox:M,receipts:B}=await H(r,m.id);return e.keep||(await q(r,m.id),d=!0),{deleted:d,execOutput:R.command.output.trim(),fileRoundtrip:!0,forkSandboxId:a,previewStatus:x,receiptRefs:B.map(S=>S.mpp.receiptRef??null),reservationRef:m.reservation.mpp?.reservationRef??null,runId:t,sandboxId:m.id,snapshotId:g,state:M.state}}finally{a&&!e.keep&&!f&&await L(r,a),u&&!e.keep&&!d&&await L(r,u)}}n(z,"runSandboxSmoke");async function H(r,e){try{await r.stop(e)}catch{await r.stop(e,{async:!0})}let t=await J(r,e,new Set(["stopped","deleted"]),"stop"),o=await G(r,e);if(o.length===0)throw new Error("expected receipt readback");return{sandbox:t,receipts:o}}n(H,"stopSandboxForSmoke");async function q(r,e){try{let t=await r.delete(e);if(t.state==="deleted")return t;await r.delete(e,{async:!0})}catch{await r.delete(e,{async:!0})}return J(r,e,new Set(["deleted"]),"delete")}n(q,"deleteSandboxForSmoke");async function L(r,e){try{await q(r,e)}catch{await r.delete(e,{async:!0}).catch(()=>{})}}n(L,"cleanupSandboxBestEffort");async function J(r,e,t,o){let c=Date.now()+3e5,u=await r.get(e);for(;Date.now()<c;){if(t.has(u.state))return u;if(u.state==="error")throw new Error(`sandbox ${o} failed: ${e}`);await I(3e3),u=await r.get(e)}throw new Error(`sandbox ${o} did not reach ${[...t].join("/")} before timeout: ${e} (${u.state})`)}n(J,"waitForSandboxState");async function G(r,e){let s=Date.now()+12e4,i=await r.receipts(e);for(;Date.now()<s;){if(i.length>0)return i;await I(3e3),i=await r.receipts(e)}return i}n(G,"waitForReceipts");async function N(r,e){if(e.state==="running"||e.state==="stopped")return e;if(e.state==="error")throw new Error(`sandbox create failed: ${e.id}
|
|
4
|
-
${e.logs.join(`
|
|
5
|
-
`)}`);let t=12*6e4,o=3e3,s=Date.now()+t,i=e;for(;Date.now()<s;){if(await I(o),i=await r.get(e.id),i.state==="running"||i.state==="stopped")return i;if(i.state==="error")throw new Error(`sandbox create failed: ${i.id}
|
|
6
|
-
${i.logs.join(`
|
|
7
|
-
`)}`)}throw new Error(`sandbox create did not reach running state before timeout: ${i.id} (${i.state})`)}n(N,"waitForCreateReady");async function K(r,e,t){if(!t)throw new Error("snapshot job did not return snapshot id");let o=12*6e4,s=3e3,i=Date.now()+o,c=await r.get(e);for(;Date.now()<i;){let u=c.snapshots?.find(d=>d.id===t);if(u?.state==="ready")return{sandbox:c,snapshot:u};let a=c.snapshotJobs?.find(d=>d.snapshotId===t);if(a?.status==="failed")throw new Error(`snapshot job failed: ${a.error??t}`);await I(s),c=await r.get(e)}throw new Error(`snapshot did not reach ready state before timeout: ${t}`)}n(K,"waitForSnapshotReady");function I(r){return new Promise(e=>setTimeout(e,r))}n(I,"sleep");function l(r={}){return r.async||r.respondAsync?{Prefer:"respond-async"}:void 0}n(l,"asyncRequestHeaders");async function P(r){let e=await y(r.sandboxApiUrl,r.apiKey,r.path,{timeoutMs:0,maxResponseBytes:0});if(!e.body)return;let t=e.body.getReader(),o=new TextDecoder,s="";try{for(;;){let{done:i,value:c}=await t.read();if(i)break;s+=o.decode(c,{stream:!0});let u=s.indexOf(`
|
|
8
|
-
|
|
9
|
-
`);for(;u!==-1;){let a=s.slice(0,u);s=s.slice(u+2);let d=W(a);d&&process.stdout.write(d),u=s.indexOf(`
|
|
10
|
-
|
|
11
|
-
`)}}}finally{t.releaseLock()}}n(P,"streamSandboxEventOutput");function _(r){return typeof r=="string"?{dataBase64:Buffer.from(r,"utf-8").toString("base64")}:r instanceof Uint8Array?{dataBase64:Buffer.from(r).toString("base64")}:r}n(_,"normalizePtyInput");function W(r){if(!r.includes("event: output"))return null;let e=r.split(/\r?\n/).filter(t=>t.startsWith("data: ")).map(t=>t.slice(6));if(e.length===0)return null;try{let t=JSON.parse(e.join(`
|
|
12
|
-
`));return typeof t.output=="string"?t.output:null}catch{return null}}n(W,"parseProcessOutputEvent");var b=class{static{n(this,"OpenPondSandboxInstanceClient")}apiKey;apiRootUrl;sandboxApiUrl;customEndpoint;constructor(e){this.apiKey=e.apiKey,this.customEndpoint=e.customEndpoint??!1;let t=e.sandboxApiUrl??e.baseUrl??O;this.sandboxApiUrl=$(t,{apiBaseUrl:this.customEndpoint?void 0:t}),this.apiRootUrl=C(this.sandboxApiUrl)}create(e,t={}){return this.request("",{method:"POST",...this.customEndpoint?{timeoutMs:18e4}:{},headers:l(t),body:JSON.stringify(e)}).then(o=>o.sandbox)}get(e){return this.request(`/${encodeURIComponent(e)}`).then(t=>t.sandbox)}exec(e,t){return this.request(`/${encodeURIComponent(e)}/exec`,{method:"POST",body:JSON.stringify(t)})}startProcess(e,t){return this.request(`/${encodeURIComponent(e)}/processes`,{method:"POST",body:JSON.stringify(t)})}listProcesses(e){return this.request(`/${encodeURIComponent(e)}/processes`)}getProcess(e,t,o={}){let s=new URLSearchParams;return o.since!==void 0&&s.set("since",String(Math.max(0,o.since))),this.request(`/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}${s.size>0?`?${s.toString()}`:""}`)}stopProcess(e,t){return this.request(`/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}`,{method:"DELETE"})}async streamProcessOutput(e,t,o={}){let s=new URLSearchParams;o.since!==void 0&&s.set("since",String(Math.max(0,o.since))),await P({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/stream${s.size>0?`?${s.toString()}`:""}`})}startPty(e,t={}){return this.request(`/${encodeURIComponent(e)}/pty`,{method:"POST",body:JSON.stringify(t)})}listPtys(e){return this.request(`/${encodeURIComponent(e)}/pty`)}getPty(e,t,o={}){let s=new URLSearchParams;return o.since!==void 0&&s.set("since",String(Math.max(0,o.since))),this.request(`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}${s.size>0?`?${s.toString()}`:""}`)}writePtyInput(e,t,o){return this.request(`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}/input`,{method:"POST",body:JSON.stringify(_(o))})}stopPty(e,t){return this.request(`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}`,{method:"DELETE"})}async streamPtyOutput(e,t,o={}){let s=new URLSearchParams;o.since!==void 0&&s.set("since",String(Math.max(0,o.since))),await P({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}/stream${s.size>0?`?${s.toString()}`:""}`})}uploadFile(e,t,o){return this.uploadFileBase64(e,t,Buffer.from(o,"utf-8").toString("base64"))}uploadFileBase64(e,t,o){return this.request(`/${encodeURIComponent(e)}/files`,{method:"POST",body:JSON.stringify({path:t,contentsBase64:o})})}async downloadFile(e,t){let o=await this.downloadFileResponse(e,t);return Buffer.from(o.file.contentsBase64,"base64").toString("utf-8")}downloadFileResponse(e,t){let o=typeof t=="string"?{path:t}:t,s=new URLSearchParams({path:o.path});return o.offsetBytes!==void 0&&s.set("offsetBytes",String(o.offsetBytes)),o.maxBytes!==void 0&&s.set("maxBytes",String(o.maxBytes)),this.request(`/${encodeURIComponent(e)}/files?${s.toString()}`)}listFiles(e,t={}){let o=new URLSearchParams({list:"1"});return t.path&&o.set("path",t.path),t.recursive!==void 0&&o.set("recursive",String(t.recursive)),t.maxEntries!==void 0&&o.set("maxEntries",String(t.maxEntries)),this.request(`/${encodeURIComponent(e)}/files?${o.toString()}`)}deleteFile(e,t,o={}){let s=new URLSearchParams({path:t});return o.recursive!==void 0&&s.set("recursive",String(o.recursive)),this.request(`/${encodeURIComponent(e)}/files?${s.toString()}`,{method:"DELETE"})}statFile(e,t){let o=new URLSearchParams({stat:"1",path:t});return this.request(`/${encodeURIComponent(e)}/files?${o.toString()}`)}mkdir(e,t){let o=typeof t=="string"?{path:t}:t,s=new URLSearchParams({path:o.path});return o.recursive!==void 0&&s.set("recursive",String(o.recursive)),this.request(`/${encodeURIComponent(e)}/files?${s.toString()}`,{method:"PUT"})}moveFile(e,t){let o=new URLSearchParams({fromPath:t.fromPath,toPath:t.toPath});return t.overwrite!==void 0&&o.set("overwrite",String(t.overwrite)),this.request(`/${encodeURIComponent(e)}/files?${o.toString()}`,{method:"PATCH"})}searchFiles(e,t){let o=new URLSearchParams({search:"1",query:t.query});return t.path&&o.set("path",t.path),t.maxResults!==void 0&&o.set("maxResults",String(t.maxResults)),this.request(`/${encodeURIComponent(e)}/files?${o.toString()}`)}openPort(e,t){return this.request(`/${encodeURIComponent(e)}/ports`,{method:"POST",body:JSON.stringify(t)})}createSnapshot(e,t){return this.request(`/${encodeURIComponent(e)}/snapshots`,{method:"POST",body:JSON.stringify(t)})}updateSnapshot(e,t,o){return this.request(`/${encodeURIComponent(e)}/snapshots/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(o)})}validateSnapshot(e,t,o={}){return this.request(`/${encodeURIComponent(e)}/snapshots/${encodeURIComponent(t)}/validate`,{method:"POST",body:JSON.stringify(o)})}publishSnapshot(e,t){return this.request(`/${encodeURIComponent(e)}/snapshots/${encodeURIComponent(t)}/publish`,{method:"POST"})}fork(e,t={}){return this.request(`/${encodeURIComponent(e)}/fork`,{method:"POST",body:JSON.stringify(t)})}stop(e,t={}){let o=new URLSearchParams;return t.failOnUnpreservedChanges&&o.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(e)}/stop${o.size>0?`?${o.toString()}`:""}`,{method:"POST",headers:l(t)})}start(e,t={}){return this.request(`/${encodeURIComponent(e)}/start`,{method:"POST",headers:l(t)})}restore(e){return this.request(`/${encodeURIComponent(e)}/restore`,{method:"POST"})}delete(e,t={}){let o=new URLSearchParams;return t.failOnUnpreservedChanges&&o.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(e)}${o.size>0?`?${o.toString()}`:""}`,{method:"DELETE",headers:l(t)}).then(s=>s.sandbox)}receipts(e){return this.request(`/${encodeURIComponent(e)}/receipts`).then(t=>t.receipts)}logs(e){return this.request(`/${encodeURIComponent(e)}/logs`).then(t=>t.logs)}gitStatus(e){return this.request(`/${encodeURIComponent(e)}/git/status`)}gitDiff(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/diff`,{method:"POST",body:JSON.stringify(t)})}gitExportPatch(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/export-patch`,{method:"POST",body:JSON.stringify(t)})}gitBranch(e,t){return this.request(`/${encodeURIComponent(e)}/git/branch`,{method:"POST",body:JSON.stringify(t)})}gitCommit(e,t){return this.request(`/${encodeURIComponent(e)}/git/commit`,{method:"POST",body:JSON.stringify(t)})}gitPull(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/pull`,{method:"POST",body:JSON.stringify(t)})}gitPush(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/push`,{method:"POST",body:JSON.stringify(t)})}billing(e){return this.request(`/${encodeURIComponent(e)}/billing`)}pricing(){return this.request("/pricing")}costs(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),this.request(`/costs${t.size>0?`?${t.toString()}`:""}`)}integrationLeases(e){return this.request(`/${encodeURIComponent(e)}/integrations`)}attachIntegrationConnection(e,t){return this.request(`/${encodeURIComponent(e)}/integrations`,{method:"POST",body:JSON.stringify(t)})}removeIntegrationLease(e,t){return this.request(`/${encodeURIComponent(e)}/integrations`,{method:"DELETE",body:JSON.stringify({leaseId:t})})}async request(e,t={}){let o=await y(this.sandboxApiUrl,this.apiKey,e,this.customEndpoint?{...t,explicitBearerAuth:!0,redirect:"error"}:t);return w(o,"Sandbox request")}async requestApiRoot(e,t={}){let o=await y(this.apiRootUrl,this.apiKey,e,this.customEndpoint?{...t,explicitBearerAuth:!0,redirect:"error"}:t);return w(o,"OpenPond API request")}};var U=class extends b{static{n(this,"OpenPondSandboxClient")}runtimes=v(this);sandboxes=A(this);profile=T(this);projects=j(this);agents=k(this);list(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),this.request(t.size>0?`?${t.toString()}`:"").then(o=>o.sandboxes)}listSecrets(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets${t.size>0?`?${t.toString()}`:""}`).then(o=>o.secrets)}getSecret(e,t={}){let o=new URLSearchParams;return t.teamId&&o.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}${o.size>0?`?${o.toString()}`:""}`).then(s=>s.secret)}createSecret(e){return this.requestApiRoot("/sandbox-secrets",{method:"POST",body:JSON.stringify(e)}).then(t=>t.secret)}rotateSecret(e,t){let o=new URLSearchParams;t.teamId&&o.set("teamId",t.teamId);let{teamId:s,...i}=t;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}/rotate${o.size>0?`?${o.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)}).then(c=>c.secret)}attachSecret(e,t){let o=new URLSearchParams;t.teamId&&o.set("teamId",t.teamId);let{teamId:s,...i}=t;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}/attach${o.size>0?`?${o.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)}).then(c=>c.secret)}revokeSecret(e,t={}){let o=new URLSearchParams;return t.teamId&&o.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}/revoke${o.size>0?`?${o.toString()}`:""}`,{method:"POST"}).then(s=>s.secret)}deleteSecret(e,t={}){let o=new URLSearchParams;return t.teamId&&o.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}${o.size>0?`?${o.toString()}`:""}`,{method:"DELETE"}).then(s=>s.secret)}snapshotCatalog(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),e.q&&t.set("q",e.q),e.kind&&t.set("kind",e.kind),e.replayState&&t.set("replayState",e.replayState),e.visibility&&t.set("visibility",e.visibility),e.tag&&t.set("tag",e.tag),e.useCase&&t.set("useCase",e.useCase),e.limit&&t.set("limit",String(e.limit)),this.request(`/catalog/snapshots${t.size>0?`?${t.toString()}`:""}`)}listSandboxRuntimes(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),this.requestApiRoot(`/runtimes${t.size>0?`?${t.toString()}`:""}`).then(o=>o.runtimes)}listProjects(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects?${t.toString()}`).then(o=>o.projects)}upsertProject(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects?${t.toString()}`,{method:"POST",body:JSON.stringify(e)}).then(o=>o.project)}getHostedProfile(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/profile?${t.toString()}`).then(o=>o.profile)}ensureHostedProfile(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/profile/ensure?${t.toString()}`,{method:"POST"}).then(o=>{if(!o.profile)throw new Error("hosted_profile_missing");return o.profile})}pushHostedProfile(e){let t=new URLSearchParams({teamId:e.teamId}),{teamId:o,...s}=e;return this.requestApiRoot(`/profile/push?${t.toString()}`,{method:"POST",body:JSON.stringify(s)})}async upsertProjectGitRemote(e){let t=await this.upsertProject(e);return this.ensureProjectGitRemote(t.id,{teamId:e.teamId})}getProject(e,t){let o=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}?${o.toString()}`).then(s=>s.project)}syncProject(e,t){let o=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}/sync?${o.toString()}`,{method:"POST"}).then(s=>s.project)}ensureProjectGitRemote(e,t){let o=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}/git?${o.toString()}`,{method:"POST"})}uploadProjectSource(e,t){let o=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/projects/${encodeURIComponent(e)}/source?${o.toString()}`,{method:"POST",body:JSON.stringify(i)}).then(c=>c.project)}updateProject(e,t){let o=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/projects/${encodeURIComponent(e)}?${o.toString()}`,{method:"PATCH",body:JSON.stringify(i)}).then(c=>c.project)}archiveProject(e,t){let o=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}?${o.toString()}`,{method:"DELETE"}).then(s=>s.project)}listAgents(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents?${t.toString()}`).then(o=>o.agents)}upsertAgent(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents?${t.toString()}`,{method:"POST",body:JSON.stringify(e)}).then(o=>o.agent)}getAgent(e,t){let o=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(e)}?${o.toString()}`).then(s=>s.agent)}archiveAgent(e,t){let o=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(e)}?${o.toString()}`,{method:"DELETE"}).then(s=>s.agent)}updateAgent(e,t){let o=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}?${o.toString()}`,{method:"PATCH",body:JSON.stringify(i)}).then(c=>c.agent)}runAgent(e,t){let o=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/run?${o.toString()}`,{method:"POST",headers:{Prefer:"respond-async"},body:JSON.stringify(i)})}getAgentSourceDeployPlan(e,t){let o=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/deploy-plan?${o.toString()}`).then(s=>s.deployPlan)}listAgentManifestSnapshots(e,t){let o=new URLSearchParams({teamId:t.teamId});return t.limit!==void 0&&o.set("limit",String(t.limit)),this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/manifest-snapshots?${o.toString()}`).then(s=>s.manifestSnapshots)}requestAgentSourceChecks(e,t){let o=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/checks?${o.toString()}`,{method:"POST",body:JSON.stringify(i),timeoutMs:900*1e3})}configureAgentSourceSetup(e,t){let o=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/setup?${o.toString()}`,{method:"POST",body:JSON.stringify(i)})}publishAgentSource(e,t){let o=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/publish?${o.toString()}`,{method:"POST",body:JSON.stringify(i)})}getMicrosoftTeamsBotOverview(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/teams/bot/overview?${t.toString()}`)}bindMicrosoftTeamsBotConversation(e){return this.requestApiRoot("/teams/bot/bindings",{method:"POST",body:JSON.stringify(e)})}rebindMicrosoftTeamsBotConversation(e,t){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}unlinkMicrosoftTeamsBotConversation(e){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(e.bindingId)}`,{method:"DELETE",body:JSON.stringify({teamId:e.teamId})})}sendMicrosoftTeamsBotDiagnostic(e){return this.requestApiRoot("/teams/bot/diagnostics",{method:"POST",body:JSON.stringify(e)})}sendMicrosoftTeamsBotDiagnosticRun(e){return this.requestApiRoot("/teams/bot/diagnostics/run",{method:"POST",body:JSON.stringify(e)})}createSandboxRuntime(e){return this.requestApiRoot("/runtimes",{method:"POST",body:JSON.stringify(e)}).then(t=>t.runtime)}sandboxRuntime(e,t=null){return E(this,e,t)}getSandboxRuntime(e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}`).then(t=>t.runtime)}createSandboxRuntimeSandbox(e,t={},o={}){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/sandbox`,{method:"POST",headers:l(o),body:JSON.stringify(t)})}updateSandboxRuntimeStatus(e,t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/status`,{method:"PATCH",body:JSON.stringify(t)}).then(o=>o.runtime)}listSandboxRuntimeEvents(e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/events`)}emitSandboxRuntimeEvent(e,t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/events`,{method:"POST",body:JSON.stringify(t)})}checkpointSandboxRuntime(e,t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/checkpoints`,{method:"POST",body:JSON.stringify(t)}).then(o=>o.runtime)}promoteSandboxRuntime(e,t,o={}){let s=new URLSearchParams;return o.teamId&&s.set("teamId",o.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/promote${s.size>0?`?${s.toString()}`:""}`,{method:"POST",body:JSON.stringify(t)})}preserveSandboxRuntimeSource(e,t={},o={}){let s=new URLSearchParams;return o.teamId&&s.set("teamId",o.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/preserve-source${s.size>0?`?${s.toString()}`:""}`,{method:"POST",body:JSON.stringify(t)})}forkSnapshot(e,t={},o={}){let s=new URLSearchParams;t.teamId&&s.set("teamId",t.teamId),t.projectId&&s.set("projectId",t.projectId),o.async&&s.set("async","1");let{teamId:i,projectId:c,...u}=t;return this.request(`/catalog/snapshots/${encodeURIComponent(e)}/fork${s.size>0?`?${s.toString()}`:""}`,{method:"POST",headers:o.async?{Prefer:"respond-async"}:void 0,body:JSON.stringify({...u,snapshotId:e})})}templates(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.q&&t.set("q",e.q),e.name&&t.set("name",e.name),e.version&&t.set("version",e.version),e.visibility&&t.set("visibility",e.visibility),e.tag&&t.set("tag",e.tag),e.useCase&&t.set("useCase",e.useCase),e.limit&&t.set("limit",String(e.limit)),this.request(`/templates${t.size>0?`?${t.toString()}`:""}`)}publishedSnapshots(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.q&&t.set("q",e.q),e.name&&t.set("name",e.name),e.version&&t.set("version",e.version),e.visibility&&t.set("visibility",e.visibility),e.tag&&t.set("tag",e.tag),e.useCase&&t.set("useCase",e.useCase),e.limit&&t.set("limit",String(e.limit)),this.request(`/published-snapshots${t.size>0?`?${t.toString()}`:""}`).then(o=>{let s=o.publishedSnapshots??o.templates;return{...o,templates:s,publishedSnapshots:s}})}launchTemplate(e){let t=new URLSearchParams;e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId);let{teamId:o,projectId:s,...i}=e;return this.request(`/templates/launch${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)})}runPublishedSnapshot(e){let t=new URLSearchParams;e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId);let{teamId:o,projectId:s,...i}=e;return this.request(`/published-snapshots/launch${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)}).then(c=>{let u=c.publishedSnapshot??c.template;return{...c,template:u,publishedSnapshot:u}})}listSchedules(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.sourceSandboxId&&t.set("sourceSandboxId",e.sourceSandboxId),this.request(`/schedules${t.size>0?`?${t.toString()}`:""}`)}createSchedule(e){let t=new URLSearchParams;e.projectId&&t.set("projectId",e.projectId);let{projectId:o,...s}=e;return this.request(`/schedules${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(s)})}getSchedule(e){return this.request(`/schedules/${encodeURIComponent(e)}`)}updateSchedule(e,t){return this.request(`/schedules/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}deleteSchedule(e){return this.request(`/schedules/${encodeURIComponent(e)}`,{method:"DELETE"})}listScheduleRuns(e,t={}){let o=new URLSearchParams;return t.limit!==void 0&&o.set("limit",String(t.limit)),this.request(`/schedules/${encodeURIComponent(e)}/runs${o.size>0?`?${o.toString()}`:""}`)}runScheduleNow(e,t={}){return this.request(`/schedules/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}listTemplateBuilds(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/sandbox-template-builds?${t.toString()}`).then(o=>o.builds)}createTemplateBuild(e){return this.requestApiRoot("/sandbox-template-builds",{method:"POST",body:JSON.stringify(e)}).then(t=>t.build)}getTemplateBuild(e){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(e)}`).then(t=>t.build)}getTemplateBuildLogs(e){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(e)}/logs`)}cancelTemplateBuild(e){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(e)}/cancel`,{method:"POST"}).then(t=>t.build)}listPublishedSnapshotBuilds(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/published-snapshot-builds?${t.toString()}`).then(o=>o.builds)}createPublishedSnapshotBuild(e){return this.requestApiRoot("/published-snapshot-builds",{method:"POST",body:JSON.stringify(e)}).then(t=>t.build)}getPublishedSnapshotBuild(e){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(e)}`).then(t=>t.build)}getPublishedSnapshotBuildLogs(e){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(e)}/logs`)}cancelPublishedSnapshotBuild(e){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(e)}/cancel`,{method:"POST"}).then(t=>t.build)}listOrganizations(){return this.requestApiRoot("/organizations").then(e=>e.organizations??e.teams??[])}createOrganization(e){return this.requestApiRoot("/organizations",{method:"POST",body:JSON.stringify(e)}).then(t=>t.organization)}getOrganization(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}`).then(t=>t.organization)}updateOrganization(e,t){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)}).then(o=>o.organization)}listOrganizationMembers(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/members`).then(t=>t.members)}upsertOrganizationMember(e,t){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(t)}).then(o=>o.member)}getOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server`).then(t=>t.mcpServer)}generateOrganizationMcpServer(e,t={}){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server`,{method:"POST",body:JSON.stringify(t)}).then(o=>o.mcpServer)}rotateOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server/rotate`,{method:"POST"}).then(t=>t.mcpServer)}disableOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server/disable`,{method:"POST"}).then(t=>t.mcpServer)}enableOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server/enable`,{method:"POST"}).then(t=>t.mcpServer)}startReplay(e){let t=new URLSearchParams;e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId);let{teamId:o,projectId:s,...i}=e;return this.requestApiRoot(`/sandbox-replays${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)})}listReplays(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays${t.size>0?`?${t.toString()}`:""}`)}getReplay(e,t={}){let o=new URLSearchParams;return t.teamId&&o.set("teamId",t.teamId),t.projectId&&o.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}${o.size>0?`?${o.toString()}`:""}`)}getReplayLogs(e,t={}){let o=new URLSearchParams;return t.teamId&&o.set("teamId",t.teamId),t.projectId&&o.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}/logs${o.size>0?`?${o.toString()}`:""}`)}getReplayArtifacts(e,t={}){let o=new URLSearchParams;return t.teamId&&o.set("teamId",t.teamId),t.projectId&&o.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}/artifacts${o.size>0?`?${o.toString()}`:""}`)}cancelReplay(e,t={}){let o=new URLSearchParams;return t.teamId&&o.set("teamId",t.teamId),t.projectId&&o.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}/cancel${o.size>0?`?${o.toString()}`:""}`,{method:"POST"})}integrationConnections(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),e.status&&t.set("status",e.status),this.requestApiRoot(`/integrations/connections${t.size>0?`?${t.toString()}`:""}`)}mcpServerConfig(){return{name:"openpond-sandboxes",transport:"streamable-http",url:`${this.sandboxApiUrl}/mcp`,headers:{"openpond-api-key":this.apiKey}}}smoke(e={}){return z(this,e)}};function Re(r){return new U(r)}n(Re,"createOpenPondSandboxClient");export{U as a,Re as b};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as p,b as s,c as P,d as f,e as $,f as _,h as E,i as V,j as M,k as N,l as v,m as J,n as O,o as F,p as U,q as Q,r as q}from"./chunk-4BUM6JEC.js";import{b as x,h as G}from"./chunk-PNPV2LDE.js";import{l as b}from"./chunk-4PUOWSDE.js";import{v as D}from"./chunk-ZY32SZ2P.js";import{a as B}from"./chunk-AYOMVI7J.js";import{c as I}from"./chunk-3M53YXEI.js";import{n as m}from"./chunk-RCT3O3HQ.js";import{m as z}from"./chunk-5HPZGLOL.js";import{A as t}from"./chunk-X2J2P5ZT.js";import{a as d}from"./chunk-FTQLQJQV.js";var L=t.object({state:t.enum(["incomplete","ambiguous","awaiting_owner_review"]),issues:t.array(t.enum(["missing_attempt","missing_observation","completion_not_observed","conflicting_observations","reference_mismatch","lineage_mismatch","mixed_scope","conflicting_event"])).max(8),groups:t.array(t.object({key:P,application:t.string().min(1).max(200),applicationVersion:t.string().min(1).max(200),tool:t.object({name:t.string().min(1).max(200),version:t.string().max(200).nullable(),server:t.string().max(200).nullable()}).strict(),environmentFingerprints:t.array(P).max(p.eventsPerEpisode),attempts:t.array(f).max(p.eventsPerEpisode)}).strict()).max(p.eventsPerEpisode)}).strict();function X(c){let n=t.array(E).max(p.eventsPerEpisode).parse(c),i=new Set,e=new Set,o=new Map,a=n[0];for(let r of n){a&&(r.installationId!==a.installationId||r.episodeId!==a.episodeId)&&e.add("mixed_scope"),r.parentSessionId===r.sessionId&&e.add("lineage_mismatch");let l=o.get(r.eventId);l&&l.contentHash!==r.contentHash?e.add("conflicting_event"):o.set(r.eventId,r)}let g=[...o.values()].filter(r=>r.eventKind==="attempt"),u=new Map,y=new Map;g.length||i.add("missing_attempt");for(let r of o.values()){if(r.eventKind!=="observation")continue;let l=o.get(r.payload.attempt.id);l?l.eventKind!=="attempt"||l.contentHash!==r.payload.attempt.contentHash||l.payload.actionHash!==r.payload.actionHash?e.add("reference_mismatch"):(l.sessionId!==r.sessionId||l.callId!==r.callId||l.parentSessionId&&r.parentSessionId&&l.parentSessionId!==r.parentSessionId||l.turnId&&r.turnId&&l.turnId!==r.turnId)&&e.add("lineage_mismatch"):i.add("missing_attempt");let h=u.get(r.payload.attempt.id)??[];h.push(r),u.set(r.payload.attempt.id,h)}let j=new Map;for(let r of g){let l=JSON.stringify([r.sessionId,r.callId]),h=y.get(l);h&&h!==r.contentHash&&e.add("lineage_mismatch"),y.set(l,r.contentHash);let S=u.get(r.eventId)??[];if(!S.length)i.add("missing_observation");else{let k=S.filter(A=>A.payload.outcome!=="incomplete");k.length||i.add("completion_not_observed"),new Set(k.map(A=>m(A.payload))).size>1&&e.add("conflicting_observations")}let{environment:T,tool:w}=r.payload,K=m([T.application,T.version,w.name,w.version,w.server]),C=j.get(K)??{application:T.application,applicationVersion:T.version,tool:w,fingerprints:new Set,attempts:[]};C.fingerprints.add(T.fingerprint),C.attempts.push({id:r.eventId,contentHash:r.contentHash}),j.set(K,C)}return L.parse({state:e.size?"ambiguous":i.size?"incomplete":"awaiting_owner_review",issues:[...new Set([...e,...i])].sort(),groups:[...j].sort(([r],[l])=>r.localeCompare(l)).map(([r,l])=>({key:r,application:l.application,applicationVersion:l.applicationVersion,tool:l.tool,environmentFingerprints:[...l.fingerprints].sort(),attempts:l.attempts.sort((h,S)=>h.id.localeCompare(S.id))}))})}d(X,"assembleToolLearningEpisode");var W=t.object({installation:v,apiKey:x}).strict(),Y=t.object({items:t.array(v).max(30),nextCursor:s.nullable()}).strict(),Z=t.object({installationId:s,scope:$,items:t.array(t.object({episodeId:s,eventCount:t.number().int().positive(),lastReceivedAt:t.iso.datetime()}).strict()).max(30),nextCursor:s.nullable(),learningEnrollment:t.literal(!1)}).strict(),ee=t.object({installationId:s,episodeId:s,scope:$,events:t.array(E).max(p.eventsPerEpisode),state:L.shape.state,assembly:L,verificationAuthority:t.literal("not_granted"),learningEnrollment:t.literal(!1)}).strict(),te=t.object({operationId:s,expectedRevision:t.number().int().positive()}).strict(),ne=t.object({installationId:s,operationId:s,purgedEvents:t.number().int().nonnegative(),learningEnrollment:t.literal(!1)}).strict();var oe=_(t.object({registration:N,credential:t.object({apiKey:x,expiresAt:t.iso.datetime()}).strict()}).strict(),p.eventBytes),re=_(t.object({operationId:s,expectedRevision:t.number().int().positive(),episodeId:s,failure:f,recovery:f,taskDefinition:b,familyKey:s,split:t.literal("train"),proposedTarget:Q,saveToPrivateDataset:t.literal(!0),targetApproval:t.literal("pending_owner_review")}).strict(),p.eventBytes),se=_(t.object({installationId:s,projectId:s,operationId:s,source:b,evidence:b,originHash:t.string().regex(/^[a-f0-9]{64}$/),requestHash:t.string().regex(/^[a-f0-9]{64}$/),projectedAt:t.iso.datetime(),targetApproval:t.literal("pending_owner_review"),learningEnrollment:t.literal(!1)}).strict(),p.eventBytes),ie=_(t.object({operationId:s,expectedRevision:t.number().int().nonnegative(),state:t.enum(["enabled","disabled"]),modelId:s,qualification:t.discriminatedUnion("kind",[t.object({kind:t.literal("integration"),evaluationRunId:s}).strict(),t.object({kind:t.literal("learned"),evaluationRunId:s,baselineRunId:s,trainingRunId:s}).strict()]),capabilities:t.array(O.omit({qualification:!0})).min(1).max(16),limits:t.object({maxOutputTokens:t.number().int().min(128).max(2048),maximumCallUsd:t.number().positive().max(1),maximumDayUsd:t.number().positive().max(10),maximumSessionCalls:t.number().int().min(1).max(20),maximumDayCalls:t.number().int().min(1).max(200)}).strict()}).strict(),p.eventBytes),le=_(t.object({installationId:s,scope:t.object({teamId:s,projectId:s}).strict(),revision:t.number().int().positive(),operationId:s,requestHash:t.string().regex(/^[a-f0-9]{64}$/),configuration:ie,modelRelease:f,policySystemPrompt:t.string().min(1).max(16384),capabilities:t.array(O).max(16),updatedAt:t.iso.datetime()}).strict(),p.eventBytes);function Ce(c,n){let i=G({sourceId:c.installationId,name:"Tool learning installation",expiresAt:n});return oe.parse({registration:c,credential:{apiKey:i.apiKey,expiresAt:n}})}d(Ce,"prepareToolLearningRegistration");var H=class extends Error{constructor(i,e){super(`Tool learning request failed (${i}): ${e}`);this.status=i;this.code=e;this.name="OpenPondToolLearningError"}status;code;static{d(this,"OpenPondToolLearningError")}},R=class{static{d(this,"OpenPondToolLearningClient")}#o;#e;constructor(n){this.#e={...n};let i=new URL(n.baseUrl);if(!["https:","http:"].includes(i.protocol)||i.username||i.password||i.search||i.hash||!n.apiKey.trim()||!n.teamId.trim()||!n.projectId.trim())throw new Error("tool_learning_client_scope_required");this.#o=i.toString().replace(/\/+$/,"")}async register(n,i){let e=oe.parse(n);if(e.registration.projectId!==this.#e.projectId)throw new Error("tool_learning_project_mismatch");let o=W.parse(await this.#t("installations","POST",e,i));if(this.#n(o.installation,e.registration.installationId),o.apiKey!==e.credential.apiKey)throw new Error("tool_learning_credential_mismatch");let a=o.installation;if(a.client!==e.registration.client||a.clientVersion!==e.registration.clientVersion||a.machineSourceId!==e.registration.machineSourceId||m(a.adapterRelease)!==m(e.registration.adapterRelease)||m(a.collectionPolicy)!==m(e.registration.collectionPolicy)||a.collectionPolicyHash!==m(e.registration.collectionPolicy)||a.credential?.expiresAt!==e.credential.expiresAt)throw new Error("tool_learning_registration_receipt_mismatch");return o}async installation(n,i){let e=v.parse(await this.#t(`installations/${encodeURIComponent(n)}`,"GET",void 0,i));return this.#n(e,n),e}async installations(n,i){let e=Y.parse(await this.#t(`installations?projectId=${encodeURIComponent(this.#e.projectId)}${n?`&after=${encodeURIComponent(n)}`:""}`,"GET",void 0,i));for(let o of e.items)this.#n(o,o.id);if(e.nextCursor!==null&&e.nextCursor!==e.items.at(-1)?.id)throw new Error("tool_learning_installation_cursor_mismatch");return e}async episodes(n,i,e){let o=Z.parse(await this.#t(`installations/${encodeURIComponent(n)}/episodes${i?`?after=${encodeURIComponent(i)}`:""}`,"GET",void 0,e));if(o.installationId!==n||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId||o.nextCursor!==null&&o.nextCursor!==o.items.at(-1)?.episodeId)throw new Error("tool_learning_episode_page_mismatch");return o}async episode(n,i,e){let o=ee.parse(await this.#t(`installations/${encodeURIComponent(n)}/episodes/${encodeURIComponent(i)}`,"GET",void 0,e));if(o.installationId!==n||o.episodeId!==i||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId||o.events.some(a=>a.installationId!==n||a.episodeId!==i))throw new Error("tool_learning_episode_scope_mismatch");if(o.state!==o.assembly.state||m(X(o.events))!==m(o.assembly))throw new Error("tool_learning_episode_assembly_mismatch");return o}async purge(n,i,e){let o=te.parse(i),a=ne.parse(await this.#t(`installations/${encodeURIComponent(n)}/purge`,"POST",o,e));if(a.installationId!==n||a.operationId!==o.operationId)throw new Error("tool_learning_purge_scope_mismatch");return a}async project(n,i,e){let o=re.parse(i),a=se.parse(await this.#t(`installations/${encodeURIComponent(n)}/project`,"POST",o,e));if(a.installationId!==n||a.projectId!==this.#e.projectId||a.operationId!==o.operationId||a.requestHash!==m(o))throw new Error("tool_learning_projection_scope_mismatch");return a}async setState(n,i,e){let o=J.parse(i),a=v.parse(await this.#t(`installations/${encodeURIComponent(n)}`,"PATCH",o,e));if(this.#n(a,n),a.state!==o.state)throw new Error("tool_learning_state_mismatch");return a}async append(n,i){let e=V.parse(n),o=M.parse(await this.#t("episodes","POST",e,i));if(o.operationId!==e.operationId||o.installationId!==e.installationId||o.teamId!==this.#e.teamId||o.projectId!==this.#e.projectId||o.requestHash!==m(e)||o.events.length!==e.events.length||new Set(o.events.map(a=>a.eventId)).size!==o.events.length)throw new Error("tool_learning_append_receipt_mismatch");for(let a of o.events){let g=e.events.find(u=>u.eventId===a.eventId);if(!g||g.contentHash!==a.contentHash)throw new Error("tool_learning_append_event_mismatch")}return o}async routing(n,i){return this.#i(n,await this.#t(`installations/${encodeURIComponent(n)}/routing`,"GET",void 0,i))}async configureRouting(n,i,e){let o=ie.parse(i),a=this.#i(n,await this.#t(`installations/${encodeURIComponent(n)}/routing`,"POST",o,e));if(a.operationId!==o.operationId||a.requestHash!==m(o)||m(a.configuration)!==m(o))throw new Error("tool_learning_routing_receipt_mismatch");return a}#i(n,i){let e=le.parse(i);if(e.installationId!==n||e.scope.teamId!==this.#e.teamId||e.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_routing_scope_mismatch");return e}async manifest(n,i){let e=F.parse(await this.#t(`installations/${encodeURIComponent(n)}/manifest`,"GET",void 0,i));if(e.installationId!==n||e.scope.teamId!==this.#e.teamId||e.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_manifest_scope_mismatch");if(Date.parse(e.expiresAt)<=Date.now()||Date.parse(e.issuedAt)>Date.now()+3e4)throw new Error("tool_learning_manifest_expired");return e}async consult(n,i){let e=U.parse(n);if(e.scope.teamId!==this.#e.teamId||e.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return q(e,await this.#t("consultations","POST",e,i))}async consultation(n,i){let e=U.parse(n);if(e.scope.teamId!==this.#e.teamId||e.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return q(e,await this.#t(`installations/${encodeURIComponent(e.installationId)}/consultations/${encodeURIComponent(e.operationId)}`,"GET",void 0,i))}#n(n,i){if(n.id!==i||n.scope.teamId!==this.#e.teamId||n.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_installation_scope_mismatch")}async#t(n,i,e,o){e!==void 0&&D(e,p.eventBytes*p.eventsPerAppend);let a=AbortSignal.timeout(3e4),g=await(this.#e.fetch??globalThis.fetch)(`${this.#o}/v1/tool-learning/${n}`,{method:i,redirect:"error",signal:o?AbortSignal.any([o,a]):a,headers:{Authorization:`Bearer ${this.#e.apiKey}`,"X-OpenPond-Team-Id":this.#e.teamId,Accept:"application/json",...e===void 0?{}:{"Content-Type":"application/json"}},...e===void 0?{}:{body:JSON.stringify(e)}}),u=await z(g,p.eventBytes*p.eventsPerAppend,"Tool learning response");if(!g.ok){let y=t.object({code:t.string().regex(/^[a-z0-9_]+$/).max(200)}).passthrough().safeParse(u);throw new H(g.status,y.success?y.data.code:"tool_learning_request_failed")}return u}};async function qe(c,n){if(I(c,"teamId")&&I(c,"teamId")!==n.teamId)throw new Error("The selected workspace differs from this installation.");if(I(c,"projectId")&&I(c,"projectId")!==n.projectId)throw new Error("The selected Model Project differs from this installation.");let{context:i,baseUrl:e}=await B({...c,teamId:n.teamId,apiBaseUrl:n.apiOrigin,account:I(c,"account")||n.ownerAccount||""});return new R({baseUrl:e,apiKey:i.token,teamId:n.teamId,projectId:n.projectId})}d(qe,"toolLearningOwner");import{execFile as ce}from"node:child_process";import{promisify as pe}from"node:util";var ae={codex:"0.153.4",opencode:"1.14.48"};async function De(c){let{stdout:n}=await pe(ce)(c,["--version"],{timeout:1e4,maxBuffer:65536}),i=c==="codex"?n.trim().replace(/^codex-cli\s+/,""):n.trim();if(i!==ae[c])throw new Error(`This capture adapter supports ${c} ${ae[c]}. Qualify the installed hook protocol before connecting another version.`);return i}d(De,"externalCaptureVersion");export{ie as a,Ce as b,R as c,qe as d,De as e};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{n as z,o as V,p as G,q}from"./chunk-JPUSTFZC.js";import{a as A,f as v,g as k,h as p,i as f}from"./chunk-3M53YXEI.js";import{a}from"./chunk-FTQLQJQV.js";import{Buffer as Y}from"node:buffer";import{readdirSync as H,readFileSync as Q,statSync as F}from"node:fs";import b from"node:path";var K=500,Z=8*1024*1024,W=8*1024*1024;async function me(e,t){if(!t.sandboxRuntime&&!t.runtimeId)return{sandbox:await X(e,await e.create(t.sandbox,{async:!0}))};let n=t.runtimeId?void 0:await e.createSandboxRuntime(t.sandboxRuntime),r=t.runtimeId??n.id,o=await e.createSandboxRuntimeSandbox(r,t.sandbox);return{sandbox:await X(e,o.sandbox),runtime:o.runtime??n}}a(me,"createSandboxFromPlan");async function X(e,t){if(t.state==="running"||t.state==="stopped")return t;if(t.state==="error")throw new Error(`sandbox create failed: ${t.id}
|
|
3
|
-
${t.logs.join(`
|
|
4
|
-
`)}`);let n=12*6e4,r=3e3,o=Date.now()+n,i=t;for(;Date.now()<o;){if(await new Promise(s=>setTimeout(s,r)),i=await e.get(t.id),i.state==="running"||i.state==="stopped")return i;if(i.state==="error")throw new Error(`sandbox create failed: ${i.id}
|
|
5
|
-
${i.logs.join(`
|
|
6
|
-
`)}`)}throw new Error(`sandbox create did not reach running state before timeout: ${i.id} (${i.state})`)}a(X,"waitForSandboxCreateReady");function le(e){let t=e.reservation.mpp?.mode??"no-mpp",n=e.reservation.capturedUsd,r=e.budget.maxUsd,o=e.repo??"-";return[e.id,e.state,`spent=${n}/${r}`,t,o].join(" ")}a(le,"formatSandboxLine");function ge(e){let t=e.template?`${e.template.name}@${e.template.version}`:"-",n=e.replay?.retention?.class??e.storageCost?.retentionClass??"-",r=e.replay?.state??"-",o=e.storageCost?.estimatedMonthlyUsd??"-";return[e.id,e.kind,e.name,e.sandboxId,`storage=${e.storage??"-"}`,`sizeGb=${e.sizeGb??"-"}`,`publishedSnapshot=${t}`,`replay=${r}`,`retention=${n}`,`monthlyUsd=${o}`,e.createdAt].join(" ")}a(ge,"formatSnapshotCatalogLine");function fe(e){let t=e.tags&&e.tags.length>0?e.tags.join(","):"-",n=e.replay?.retention?.class??e.storageCost?.retentionClass??"-",r=e.replay?.state??"-",o=e.storageCost?.estimatedMonthlyUsd??"-";return[e.name,`version=${e.version}`,`snapshot=${e.snapshotId}`,`sandbox=${e.sandboxId}`,`visibility=${e.visibility}`,`useCase=${e.useCase??"-"}`,`tags=${t}`,`replay=${r}`,`retention=${n}`,`monthlyUsd=${o}`,e.createdAt].join(" ")}a(fe,"formatSandboxTemplateLine");function be(e){return[e.id,`team=${e.teamId}`,`status=${e.status}`,`publish=${e.publishStatus??"-"}`,`source=${e.sourceRepoUrl}`,`branch=${e.sourceBranch}`,`snapshot=${e.snapshotId??"-"}`,`error=${e.error??"-"}`,e.createdAt??"-"].join(" ")}a(be,"formatTemplateBuildLine");function pe(e){return[e.id,`team=${e.teamId}`,`state=${e.state}`,`snapshot=${e.snapshotId}`,`sandbox=${e.sandboxId??"-"}`,`command=${e.commandId??"-"}`,`exit=${e.exitCode??"-"}`,`cleanup=${e.cleanup.action}:${e.cleanup.status}`,`error=${e.error??"-"}`,e.createdAt].join(" ")}a(pe,"formatReplayLine");function ye(e){return{path:e.path,status:e.status,sizeBytes:e.sizeBytes,error:e.error,...e.contentsBase64?{contentsBase64:e.contentsBase64}:{}}}a(ye,"summarizeReplayArtifact");function he(e){if(typeof e!="string")return;let t=e.trim();if(t==="delete"||t==="stop"||t==="archive")return t;throw new Error("snapshot-validate --cleanup must be delete, stop, or archive")}a(he,"normalizeSnapshotValidationCleanup");function ee(e){if(typeof e!="string")return;let t=e.trim();if(t==="delete"||t==="stop"||t==="archive")return t;throw new Error("replay cleanup must be delete, stop, or archive")}a(ee,"normalizeReplayCleanup");function xe(e){let t=typeof e.snapshotId=="string"&&e.snapshotId.trim()?e.snapshotId.trim():typeof e.snapshot=="string"&&e.snapshot.trim()?e.snapshot.trim():"";if(!t)throw new Error("replay-start requires --snapshot-id <id>");let n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",o=typeof e.sourceSandboxId=="string"&&e.sourceSandboxId.trim()?e.sourceSandboxId.trim():"",i=typeof e.entrypoint=="string"&&e.entrypoint.trim()?e.entrypoint.trim():"",s=typeof e.params=="string"&&e.params.trim()?A(e.params,"params"):{};if(!s||typeof s!="object"||Array.isArray(s))throw new Error("params must be a JSON object");let l=typeof e.budgetUsd=="string"&&e.budgetUsd.trim()?e.budgetUsd.trim():typeof e.budget=="string"&&e.budget.trim()?e.budget.trim():"",d=p(e.maxDurationSeconds,"max-duration-seconds"),c=p(e.idleTimeoutSeconds,"idle-timeout-seconds"),u=f(e.artifactPaths),g=typeof e.idempotencyKey=="string"&&e.idempotencyKey.trim()?e.idempotencyKey.trim():"",y=ee(e.cleanup);return{snapshotId:t,...n?{teamId:n}:{},...r?{projectId:r}:{},...o?{sourceSandboxId:o}:{},...i?{entrypoint:i}:{},params:s,...l?{budget:{maxUsd:l}}:{},...d!==void 0?{maxDurationSeconds:d}:{},...c!==void 0?{idleTimeoutSeconds:c}:{},...u.length>0?{artifactPaths:u}:{},...g?{idempotencyKey:g}:{},...y?{cleanup:y}:{}}}a(xe,"buildSandboxReplayInput");function Se(e){let t=typeof e.repo=="string"?e.repo.trim():"",n=typeof e.command=="string"&&e.command.trim()?e.command.trim():void 0,r=typeof e.budgetUsd=="string"&&e.budgetUsd.trim()?e.budgetUsd.trim():typeof e.budget=="string"&&e.budget.trim()?e.budget.trim():"0.05",o=k(e.cpu,"cpu"),i=k(e.memoryGb,"memory-gb"),s=k(e.diskGb,"disk-gb"),l=p(e.maxDurationSeconds,"max-duration-seconds"),d=p(e.idleTimeoutSeconds,"idle-timeout-seconds"),c=typeof e.volumeName=="string"&&e.volumeName.trim()?e.volumeName.trim():"",u=typeof e.volumeMountPath=="string"&&e.volumeMountPath.trim()?e.volumeMountPath.trim():"",g=p(e.volumeStorageGb,"volume-storage-gb"),y=e.volumeDeleteOnSandboxDelete!==void 0?v(e.volumeDeleteOnSandboxDelete):void 0,$=typeof e.integrationConnection=="string"?e.integrationConnection.trim():"",U=f(e.integrationCapabilities),O=f(e.integrationScopes),x=typeof e.teamId=="string"?e.teamId.trim():"",P=typeof e.projectId=="string"?e.projectId.trim():"",S=typeof e.runtimeProjectId=="string"?e.runtimeProjectId.trim():"";if(P&&S&&P!==S)throw new Error("project-id and runtime-project-id must match when both are set");let I=P||S,E=typeof e.agentId=="string"?e.agentId.trim():"",w=typeof e.runtimeAgentId=="string"?e.runtimeAgentId.trim():"";if(E&&w&&E!==w)throw new Error("agent-id and runtime-agent-id must match when both are set");let R=E||w,B=z(e.workflowMode),D=V(e.runtimePromotionPolicy),T=oe(e),M=re(e),h=G(e.runtimeProfileId),_=typeof e.runtimeBaseBranch=="string"&&e.runtimeBaseBranch.trim()?e.runtimeBaseBranch.trim():"",j=typeof e.runtimeBaseSha=="string"&&e.runtimeBaseSha.trim()?e.runtimeBaseSha.trim():"",C=typeof e.runtimeId=="string"&&e.runtimeId.trim()?e.runtimeId.trim():"",L=!!(B||D||_||j||h||C||S||w),N=q(e);if($&&U.length===0)throw new Error("integration-capabilities is required with integration-connection");return{sandbox:{...t?{repo:t}:{},...x?{teamId:x}:{},...I?{projectId:I}:{},...R?{agentId:R}:{},...h?{runtimeProfileId:h}:{},...n?{command:n}:{},...T?{workloadSource:T}:{},...M?{sourceArchive:M}:{},resources:{...o!==void 0?{cpu:o}:{},...i!==void 0?{memoryGb:i}:{},...s!==void 0?{diskGb:s}:{}},budget:{maxUsd:r},quotas:{maxSpendUsd:r,...l!==void 0?{maxDurationSeconds:l}:{},...d!==void 0?{idleTimeoutSeconds:d}:{}},...N.length>0?{env:N}:{},...c||u||g!==void 0?{volumes:[{...c?{name:c}:{},...u?{mountPath:u}:{},...g!==void 0?{storageGb:g}:{},...y!==void 0?{deleteOnSandboxDelete:y}:{}}]}:{},...$?{integrationConnectionLeases:[{connectionId:$,...O.length>0?{scopes:O}:{},capabilities:U,ttlSeconds:3600}]}:{},metadata:{source:"openpond-code"}},...L&&C?{runtimeId:C}:{},...L&&!C?{sandboxRuntime:{...x?{teamId:x}:{},...B?{workflowMode:B}:{},...I?{projectId:I}:{},...R?{agentId:R}:{},baseBranch:_||"master",...j?{baseSha:j}:{},...D?{promotionPolicy:D}:{},...h?{runtimeProfileId:h}:{}}}:{}}}a(Se,"buildSandboxCreateInput");function te(e){return e.length>0&&!e.includes("\0")&&!b.isAbsolute(e)&&!e.split(/[\\/]+/).some(t=>!t||t==="."||t==="..")}a(te,"isSafeDockerContextPath");function ne(e){return e.split(/[\\/]+/).some(t=>{let n=t.toLowerCase();return n===".git"||n==="node_modules"||n===".next"||n===".turbo"||n.startsWith(".env")})}a(ne,"shouldSkipDockerContextPath");function J(e){let t=e.baseDir??e.contextRoot,n=H(t,{withFileTypes:!0}),r=[];for(let o of n){let i=b.join(t,o.name),s=b.relative(e.contextRoot,i).replace(/\\/g,"/");if(!(!s||!te(s)||ne(s))){if(o.isDirectory()){r.push(...J({contextRoot:e.contextRoot,baseDir:i}));continue}o.isFile()&&r.push(s)}}return r}a(J,"collectDockerContextFiles");function re(e){if(!m(e.dockerfile))return;let n=m(e.dockerfileContext)||".",r=b.resolve(process.cwd(),n);if(!F(r).isDirectory())throw new Error(`dockerfile context must be a directory: ${n}`);let i=J({contextRoot:r}).sort();if(i.length===0)throw new Error(`dockerfile context has no files: ${n}`);if(i.length>K)throw new Error(`dockerfile context has too many files: ${i.length} > ${K}`);let s=0,l=i.map(d=>{let c=b.resolve(r,d),u=b.relative(r,c);if(u.startsWith("..")||b.isAbsolute(u))throw new Error(`dockerfile context path escapes context: ${d}`);let g=F(c);if(g.size>Z)throw new Error(`dockerfile context file is too large: ${d} (${g.size} bytes)`);if(s+=g.size,s>W)throw new Error(`dockerfile context is too large: ${s} > ${W}`);return{path:d,type:"file",contentsBase64:Y.from(Q(c)).toString("base64")}});return{source:"client_upload",ref:"client-upload",archive:{version:1,createdAt:new Date().toISOString(),entries:l}}}a(re,"buildDockerfileSourceArchiveInput");function oe(e){let t=m(e.image),n=m(e.dockerfile);if(t&&n)throw new Error("sandbox create accepts only one of --image or --dockerfile");let r=m(e.runtimeWorkspaceRoot);if(t)return{image:{ref:t,...m(e.imageDigest)?{digest:m(e.imageDigest)}:{},...m(e.registrySecretRef)?{registrySecretRef:m(e.registrySecretRef)}:{},...r?{workspaceRoot:r}:{},platform:"linux/amd64"}};if(n){let o=ie(e.dockerBuildArgs),i=f(e.dockerRegistrySecretRefs);return{dockerfile:{path:n,context:m(e.dockerfileContext)||".",...m(e.dockerfileTarget)?{target:m(e.dockerfileTarget)}:{},...Object.keys(o).length>0?{buildArgs:o}:{},...i.length>0?{registrySecretRefs:i}:{},...r?{workspaceRoot:r}:{},platform:"linux/amd64"}}}}a(oe,"buildSandboxWorkloadSourceInput");function ie(e){if(typeof e!="string"||!e.trim())return{};let t=A(e,"docker-build-args");if(!t||typeof t!="object"||Array.isArray(t))throw new Error("docker-build-args must be a JSON object");let n={};for(let[r,o]of Object.entries(t)){if(typeof o!="string")throw new Error("docker-build-args values must be strings");n[r]=o}return n}a(ie,"parseDockerBuildArgs");function m(e){return typeof e=="string"?e.trim():""}a(m,"stringOption");function Ie(e){let t=typeof e.integrationConnection=="string"?e.integrationConnection.trim():"",n=f(e.integrationCapabilities),r=f(e.integrationScopes);if(!t||n.length===0)throw new Error("usage: sandbox integration-attach <sandboxId> --integration-connection <id> --integration-capabilities <csv>");return{connectionId:t,...r.length>0?{scopes:r}:{},capabilities:n,ttlSeconds:3600}}a(Ie,"buildSandboxIntegrationAttachInput");function we(e){let t=typeof e.teamId=="string"?e.teamId.trim():"",n=typeof e.sourceRepoUrl=="string"?e.sourceRepoUrl.trim():"",r=typeof e.sourceProjectId=="string"?e.sourceProjectId.trim():"",o=typeof e.branch=="string"?e.branch.trim():"",i=typeof e.manifestPath=="string"?e.manifestPath.trim():"";if(!t)throw new Error("published-snapshot-build-create requires --team-id <id>");if(!n&&!r)throw new Error("published-snapshot-build-create requires --source-repo-url <url> or --source-project-id <id>");return{teamId:t,...n?{sourceRepoUrl:n}:{},...r?{sourceProjectId:r}:{},...o?{branch:o}:{},...i?{manifestPath:i}:{},publish:v(e.publish)}}a(we,"buildTemplateBuildCreateInput");function Re(e){let t=typeof e.name=="string"?e.name.trim():"";if(!t)throw new Error("snapshot-create requires --name <name>");let n=typeof e.templateName=="string"?e.templateName.trim():"",r=typeof e.templateVersion=="string"&&e.templateVersion.trim()?e.templateVersion.trim():"0.1.0",o=typeof e.templateVisibility=="string"&&e.templateVisibility.trim()?e.templateVisibility.trim():"private";if(o!=="private"&&o!=="team")throw new Error("template-visibility must be private or team");let i=typeof e.validationCommand=="string"&&e.validationCommand.trim()?e.validationCommand.trim():"test -d .",s=typeof e.entrypointCommand=="string"&&e.entrypointCommand.trim()?e.entrypointCommand.trim():"true",l=typeof e.useCase=="string"&&e.useCase.trim()?e.useCase.trim():void 0,d=typeof e.description=="string"&&e.description.trim()?e.description.trim():void 0,c=f(e.tags),u={...v(e.async)?{async:!0}:{},name:t,replay:{entrypoints:[{command:s,name:"default"}],retention:{class:"pinned"},safety:{cleanup:"delete",idleTimeoutSeconds:600,internetEgress:"block",maxDurationSeconds:600,maxSpendUsd:"0.05",publicPreview:!1},validation:{commands:[{command:i}]}}};return n&&(u.template={name:n,version:r,...d?{description:d}:{},...c.length>0?{tags:c}:{},visibility:o,...l?{useCase:l}:{}}),u}a(Re,"buildSnapshotCreateInput");function Ce(e){return{id:e.id,state:e.state,repo:e.repo,runtimeId:e.runtimeId??null,repoRef:e.repoRef??null,sourceCommitSha:e.sourceCommitSha??null,budgetUsd:e.budget.maxUsd,capturedUsd:e.reservation.capturedUsd,reservationRef:e.reservation.mpp?.reservationRef??null,mppMode:e.reservation.mpp?.mode??null,integrationLeases:e.integrationLeases?.map(t=>({leaseId:t.leaseId,provider:t.provider,capabilities:t.capabilities}))??[],previewPorts:e.previewPorts.map(t=>({port:t.port,label:t.label,url:t.url,customDomain:t.customDomain??null})),latestReceipt:e.receipts.at(-1)?.mpp.receiptRef??null}}a(Ce,"summarizeSandbox");export{me as a,X as b,le as c,ge as d,fe as e,be as f,pe as g,ye as h,he as i,xe as j,Se as k,Ie as l,we as m,Re as n,Ce as o};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as o}from"./chunk-FTQLQJQV.js";var p=class extends Error{static{o(this,"ApiTimeoutError")}timeoutMs;requestUrl;code="OPENPOND_API_TIMEOUT";constructor(t,r){super(`API request timed out after ${t}ms: ${r}`),this.timeoutMs=t,this.requestUrl=r,this.name="ApiTimeoutError"}},u=class extends Error{static{o(this,"ApiResponseTooLargeError")}maximumBytes;requestUrl;code="OPENPOND_API_RESPONSE_TOO_LARGE";constructor(t,r){super(`API response exceeded ${t} bytes: ${r}`),this.maximumBytes=t,this.requestUrl=r,this.name="ApiResponseTooLargeError"}},w=class extends Error{static{o(this,"OpenPondApiError")}status;apiMessage;code;constructor(t,r,a,s=null){let n=s||r;super(`${a} failed: ${t}${n?` ${n}`:""}`),this.status=t,this.apiMessage=s,this.name="OpenPondApiError",this.code=r||"OPENPOND_API_ERROR"}};async function v(e,t,r,a={}){let{timeoutMs:s=3e4,maxResponseBytes:n=8388608,explicitBearerAuth:i=!1,...c}=a,m=`${e}${r}`,d=new Headers(c.headers);d.set("Content-Type","application/json");let h=i?void 0:process.env.OPENPOND_API_KEY,y=t?.trim()||"",A=!i&&y.startsWith("opk_"),U=h||(A?y:null);U&&!d.has("openpond-api-key")&&d.set("openpond-api-key",U),t?d.set("Authorization",A?`ApiKey ${y}`:`Bearer ${t}`):h&&!d.has("Authorization")&&d.set("Authorization",`ApiKey ${h}`);let f=new AbortController,_=new p(s,m),E=s>0?setTimeout(()=>f.abort(_),s):null;E?.unref?.();let $=I(c.signal,f.signal,s),O=o(()=>{E&&clearTimeout(E)},"cleanup");try{let g=await fetch(m,{...c,headers:d,signal:$});return b(g,{cleanup:O,maximumBytes:n,requestUrl:m,timeoutController:f,timeoutError:_})}catch(g){throw O(),f.signal.aborted?_:g}}o(v,"apiFetch");async function L(e,t){let r;try{let a=await e.text();r=a?JSON.parse(a):{}}catch(a){if(a instanceof p||a instanceof u)throw a;r={}}if(!e.ok){let a=typeof r.error=="string"?r.error:null,s=typeof r.message=="string"?r.message:null;throw new w(e.status,a,t,s)}return r}o(L,"readApiJson");function b(e,t){if(!e.body)return t.cleanup(),e;let r=Number(e.headers.get("content-length"));if(t.maximumBytes>0&&Number.isFinite(r)&&r>t.maximumBytes)throw t.cleanup(),e.body.cancel(),new u(t.maximumBytes,t.requestUrl);let a=e.body.getReader(),s=0,n=new ReadableStream({async pull(i){try{let c=await a.read();if(c.done){t.cleanup(),i.close();return}if(s+=c.value.byteLength,t.maximumBytes>0&&s>t.maximumBytes){t.cleanup(),await a.cancel(),i.error(new u(t.maximumBytes,t.requestUrl));return}i.enqueue(c.value)}catch(c){t.cleanup(),i.error(t.timeoutController.signal.aborted?t.timeoutError:c)}},async cancel(i){t.cleanup(),await a.cancel(i)}});return new Response(n,{headers:e.headers,status:e.status,statusText:e.statusText})}o(b,"boundedResponse");function I(e,t,r){return r<=0?e??void 0:e?AbortSignal.any([e,t]):t}o(I,"composedSignal");var H="https://openpond.ai",q="https://api.openpond.ai",P="https://api.openpond.ai/opchat/v1";import{randomUUID as C}from"node:crypto";function B(e){let t=l(e);if(!t)throw new Error("apiBaseUrl is required");return t}o(B,"normalizeApiBaseUrl");function x(e){return e.replace(/\/+$/,"")}o(x,"trimTrailingSlashes");function l(e){let t=x(e?.trim()??"");return t?(t=t.replace(/\/chat\/completions$/i,"").replace(/\/models(?:\/[^/]+)?$/i,""),t.endsWith("/opchat/v1")?t:t.endsWith("/opchat")?`${t}/v1`:(t.endsWith("/v1")&&(t=t.slice(0,-3)),`${x(t)}/opchat/v1`)):null}o(l,"normalizeOptionalOpChatApiBaseUrl");function W(e={}){let t=e.env??(typeof process<"u"?process.env:{}),r=l(e.opChatApiBaseUrl)??l(t.OPENPOND_OPCHAT_API_URL);if(r)return r;let a=l(e.chatApiBaseUrl)??l(t.OPENPOND_CHAT_API_URL)??l(t.OPENPOND_GATEWAY_URL);return a||(l(e.apiBaseUrl)??l(t.OPENPOND_API_URL)??P)}o(W,"resolveOpChatApiBaseUrl");function D(e){let t=e.trim();if(!t)throw new Error("OpenPond API key is required");return t}o(D,"requireToken");function T(e,t,r,a){let s=new Headers;s.set("Authorization",`Bearer ${D(e)}`),s.set("Content-Type","application/json"),s.set("Accept",t),s.set("x-openpond-client","openpond-code");let n=r||C();return s.set("x-openpond-request-id",n),s.set("x-request-id",n),a&&s.set("x-openpond-team-id",a),s}o(T,"hostedHeaders");async function N(e){let t=await e.text().catch(()=>"");if(!t)return e.statusText||`HTTP ${e.status}`;try{let r=JSON.parse(t),a=typeof r.error=="string"||r.error&&typeof r.error=="object"&&!Array.isArray(r.error)?r.error:null,s=typeof r.code=="string"?r.code:a&&typeof a!="string"&&typeof a.code=="string"?a.code:null,n=typeof r.message=="string"?r.message:a&&typeof a!="string"&&typeof a.message=="string"?a.message:null,i=typeof a=="string"?a:a&&typeof a.type=="string"?a.type:null;return[s,i,n].filter(Boolean).join(": ")||t}catch{return t}}o(N,"readError");function S(e,t){let r={model:e.model,messages:e.messages,stream:t};typeof e.temperature=="number"&&(r.temperature=e.temperature),typeof e.maxTokens=="number"&&(r.max_tokens=e.maxTokens),e.reasoningEffort==="off"?r.thinking={type:"disabled"}:e.reasoningEffort&&(r.reasoning_effort=e.reasoningEffort),e.tools&&(r.tools=e.tools);let a=e.toolChoice??e.tool_choice;return a!==void 0&&(r.tool_choice=a),e.metadata&&(r.metadata=e.metadata),r}o(S,"buildHostedChatBody");async function G(e){let r=`${B(e.apiBaseUrl)}/models`,a=await fetch(r,{method:"GET",redirect:"error",headers:T(e.token,"application/json",void 0,e.teamId),signal:e.signal});if(!a.ok)throw new Error(`Hosted model list failed: ${a.status} ${await N(a)}`);return await a.json()}o(G,"listOpChatModels");async function z(e){let r=`${B(e.apiBaseUrl)}/chat/completions`,a=await fetch(r,{method:"POST",redirect:"error",headers:T(e.token,"application/json",e.requestId,e.teamId),body:JSON.stringify(S(e,!1)),signal:e.signal});if(!a.ok)throw new Error(`Hosted chat failed: ${a.status} ${await N(a)}`);return await a.json()}o(z,"sendHostedChatTurn");export{w as a,v as b,L as c,H as d,q as e,W as f,G as g,z as h};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as Ne}from"./chunk-SYUKES6H.js";import{a as B,b as W,c as ze,d as Le,e as q,f as ie,i as de,o as Be,q as ce}from"./chunk-U7X5ZLAL.js";import{a as ue}from"./chunk-RY46UPBO.js";import{k as ae,m as se,n as Pe}from"./chunk-OQPJ7FJF.js";import{c as Te}from"./chunk-Y4I6CFZJ.js";import{E as L}from"./chunk-WGQ3FMRF.js";import{f as G,m as f,n as _e}from"./chunk-HIQPGYVH.js";import{a as Ce}from"./chunk-2LJCJOJ7.js";import{a as Oe,c as $e,d as je}from"./chunk-AMC4Z7G4.js";import{l as K,m as qe}from"./chunk-I6VMRQF4.js";import{h as Ue}from"./chunk-4PUOWSDE.js";import{Sa as Ae,ea as Ee,wb as ke}from"./chunk-ZY32SZ2P.js";import{a as re,b as oe}from"./chunk-KUE46HTH.js";import{b as z}from"./chunk-JCLTFDVW.js";import{A as a}from"./chunk-X2J2P5ZT.js";import{a as d}from"./chunk-FTQLQJQV.js";function jt(t,e){let n=t.token?.trim();if(!n||t.accountState.state!=="signed_in"||!t.accountState.activeProfile)throw new Error("A signed-in OpenPond account is required.");let r=Ce(t.apiBaseUrl,{apiBaseUrl:t.apiBaseUrl}),o=/\/api\/sandboxes\/?$/.test(r)?r.replace(/\/api\/sandboxes\/?$/,"/v1"):r.replace(/\/sandboxes\/?$/,"");return{audience:new URL(o).origin,async request(s){let i=n.startsWith("opk_"),u=await z(o,n,s.path,{method:s.method??"GET",signal:s.signal,explicitBearerAuth:!i,headers:{...i?{"openpond-api-key":n}:{},...s.idempotencyKey?{"idempotency-key":s.idempotencyKey}:{},...e?{"X-OpenPond-Team-Id":e}:{}},...s.body?{body:JSON.stringify(s.body)}:{},...s.timeoutMs!==void 0?{timeoutMs:s.timeoutMs}:{}}),c=await u.json().catch(()=>({}));if(!u.ok)throw new Error(typeof c.error=="string"?c.error:`OpenPond API request failed with status ${u.status}`);return c}}}d(jt,"createCapturedOpenPondPublicApiClient");var _t=3e4,Tt=8*1024*1024,Mn={timeoutMs:900*1e3,maxResponseBytes:64*1024*1024},Fe=class extends Error{static{d(this,"ApiTimeoutError")}timeoutMs;requestUrl;code="OPENPOND_API_TIMEOUT";constructor(t,e){super(`API request timed out after ${t}ms: ${e}`),this.timeoutMs=t,this.requestUrl=e,this.name="ApiTimeoutError"}},pe=class extends Error{static{d(this,"ApiResponseTooLargeError")}maximumBytes;requestUrl;code="OPENPOND_API_RESPONSE_TOO_LARGE";constructor(t,e){super(`API response exceeded ${t} bytes: ${e}`),this.maximumBytes=t,this.requestUrl=e,this.name="ApiResponseTooLargeError"}},He=class extends Error{static{d(this,"OpenPondApiError")}status;apiMessage;code;constructor(t,e,n,r=null){let o=r||e;super(`${n} failed: ${t}${o?` ${o}`:""}`),this.status=t,this.apiMessage=r,this.name="OpenPondApiError",this.code=e||"OPENPOND_API_ERROR"}};async function X(t,e,n,r={}){let{timeoutMs:o=_t,maxResponseBytes:s=Tt,explicitBearerAuth:i=!1,...u}=r,c=`${t}${n}`,p=new Headers(u.headers);p.set("Content-Type","application/json");let b=i?void 0:process.env.OPENPOND_API_KEY,l=e?.trim()||"",g=!i&&l.startsWith("opk_"),P=b||(g?l:null);P&&!p.has("openpond-api-key")&&p.set("openpond-api-key",P),e?p.set("Authorization",g?`ApiKey ${l}`:`Bearer ${e}`):b&&!p.has("Authorization")&&p.set("Authorization",`ApiKey ${b}`);let T=new AbortController,U=new Fe(o,c),j=o>0?setTimeout(()=>T.abort(U),o):null;j?.unref?.();let ne=Lt(u.signal,T.signal,o),J=d(()=>{j&&clearTimeout(j)},"cleanup");try{let R=await fetch(c,{...u,headers:p,signal:ne});return zt(R,{cleanup:J,maximumBytes:s,requestUrl:c,timeoutController:T,timeoutError:U})}catch(R){throw J(),T.signal.aborted?U:R}}d(X,"apiFetch");async function me(t,e){let n;try{let r=await t.text();n=r?JSON.parse(r):{}}catch(r){if(r instanceof Fe||r instanceof pe)throw r;n={}}if(!t.ok){let r=typeof n.error=="string"?n.error:null,o=typeof n.message=="string"?n.message:null;throw new He(t.status,r,e,o)}return n}d(me,"readApiJson");function zt(t,e){if(!t.body)return e.cleanup(),t;let n=Number(t.headers.get("content-length"));if(e.maximumBytes>0&&Number.isFinite(n)&&n>e.maximumBytes)throw e.cleanup(),t.body.cancel(),new pe(e.maximumBytes,e.requestUrl);let r=t.body.getReader(),o=0,s=new ReadableStream({async pull(i){try{let u=await r.read();if(u.done){e.cleanup(),i.close();return}if(o+=u.value.byteLength,e.maximumBytes>0&&o>e.maximumBytes){e.cleanup(),await r.cancel(),i.error(new pe(e.maximumBytes,e.requestUrl));return}i.enqueue(u.value)}catch(u){e.cleanup(),i.error(e.timeoutController.signal.aborted?e.timeoutError:u)}},async cancel(i){e.cleanup(),await r.cancel(i)}});return new Response(s,{headers:t.headers,status:t.status,statusText:t.statusText})}d(zt,"boundedResponse");function Lt(t,e,n){return n<=0?t??void 0:t?AbortSignal.any([t,e]):e}d(Lt,"composedSignal");var C=a.string().min(1).max(200),_=a.string().regex(/^[a-f0-9]{64}$/),le=a.object({operationId:C,name:a.string().trim().min(1).max(500),projectId:C,dataset:G.extend({revision:a.number().int().positive()}).strict(),caseIds:a.array(C).min(1).max(1e4)}).strict().superRefine((t,e)=>{new Set(t.caseIds).size!==t.caseIds.length&&e.addIssue({code:"custom",message:"Select each case once."})}),Bt=B.extend({inputHash:_,outputHash:_.nullable(),task:Ee,taskHash:_}).strict(),Nt=a.object({schemaVersion:a.literal("openpond.connectedRecordedExecution.v1"),id:C,teamId:C,ownerUserId:C,request:le,manifest:ke,sources:a.array(Bt).min(1).max(1e4),contentHash:_}).strict();function Me(t){let e=Nt.parse(t),{contentHash:n,...r}=e,{contentHash:o,...s}=e.manifest;if(f(r)!==n||f(s)!==o||e.manifest.teamId!==e.teamId||e.manifest.id!==e.id||e.manifest.operationId!==e.request.operationId||f(e.manifest.dataset)!==f(e.request.dataset)||e.sources.length!==e.request.caseIds.length||e.sources.length!==e.manifest.population.length||e.sources.some((i,u)=>i.taskHash!==f(i.task)||i.task.id!==e.request.caseIds[u]||i.boundaryId!==i.task.id||e.manifest.population[u]?.caseId!==i.boundaryId))throw new Error("Recorded execution identity or population integrity failed.");return e}d(Me,"verifyConnectedRecordedExecution");var Ft=a.object({projectId:C.optional(),cursor:C.optional(),limit:a.number().int().min(1).max(50).default(20)}).strict(),Ht=a.object({id:C,teamId:C,ownerUserId:C,projectId:C,name:a.string().min(1).max(500),dataset:le.shape.dataset,manifestHash:_,contentHash:_,caseCount:a.number().int().min(1).max(1e4),createdAt:a.string().datetime()}).strict(),Mt=a.object({teamId:C,items:a.array(Ht).max(50),nextCursor:C.nullable()}).strict(),Dt=a.object({datasetId:a.string().trim().min(1).max(240),expectedRevision:a.number().int().positive(),operationId:a.string().trim().min(1).max(240),graders:a.array(Ae).min(1).max(100).optional()}).strict().superRefine((t,e)=>{t.graders&&new Set(t.graders.map(n=>n.id)).size!==t.graders.length&&e.addIssue({code:"custom",path:["graders"],message:"Choose one exact revision of each grader."})}),N=a.string().min(1).max(500),k=a.number().int().nonnegative(),Jt=a.object({teamId:N,ownerUserId:N,projectId:N.nullable(),status:a.enum(["active","paused","archived"]),revision:k,state:a.enum(["collecting","pending","attention","paused","archived"]),lastReconciledAt:a.string().datetime().nullable(),lastCapturedAt:a.string().datetime().nullable(),historyDays:a.number().int().positive(),sources:k,tasks:k,datasets:a.array(a.object({datasetId:N,projection:a.enum(["turn","conversation"]),revision:k}).strict()).max(2),latestBatch:a.object({operationId:N,updatedAt:a.string().datetime(),scanned:k,captured:k,unchanged:k,pending:k,failed:k,excluded:k,paused:k,hasMore:a.boolean()}).strict().nullable()}).strict(),h=a.string().min(1).max(500),E=a.string().regex(/^[a-f0-9]{64}$/),De=a.object({teamId:h,projectId:h.nullable(),status:a.enum(["active","paused","archived"]),revision:a.number().int().nonnegative()}).strict(),Kt=a.object({teamId:h,operationId:h,projectId:h.nullable(),outcomes:a.array(a.object({conversationId:h,state:a.enum(["captured","unchanged","pending","paused","excluded","failed"]),sourceId:h.optional(),snapshotHash:E.optional(),reason:a.string().optional()}).strict()).max(50),nextCursor:h.nullable()}).strict(),Gt=a.object({teamId:h,ref:B,origin:W.shape.source,sessionId:h,projectId:h,capturedAt:a.string().datetime(),unmappedEvidence:a.object({count:a.number().int().nonnegative().max(1e5),contentHash:E}).strict(),evidence:a.object({input:a.array(K),observed:a.array(K),answer:a.json(),boundary:qe}).strict()}).strict(),Wt=a.object({teamId:h,sourceId:h,snapshotHash:E,contentHash:E,count:a.number().int().nonnegative(),offset:a.number().int().nonnegative(),events:a.array(K).max(50),nextOffset:a.number().int().nonnegative().nullable()}).strict(),Xt=a.object({teamId:h,source:q.shape.source,sourceHash:E,previewHash:E,destination:q.shape.destination,issues:a.array(a.object({file:a.string(),message:a.string()}).strict()).max(100),sessions:a.array(a.object({sessionHash:E,sessionId:h,origin:W.shape.source,exporterVersion:a.string().nullable(),eventCount:a.number().int().nonnegative(),boundaries:a.array(a.object({id:h,projection:a.enum(["turn","conversation"]),answer:a.boolean(),process:a.enum(["retained","partial","absent"]),terminal:a.enum(["completed","failed","cancelled","unknown"])}).strict()).max(5001),warnings:a.array(a.string()).max(100),sample:a.array(a.object({role:a.enum(["user","assistant","system","tool"]).nullable(),text:a.string().max(4e3)}).strict()).max(3)}).strict()).max(1e3)}).strict(),Je=a.object({teamId:h,operationId:h,requestHash:E,previewHash:E,projectId:h.optional(),state:a.enum(["admitting","publishing","completed","failed"]),outcomes:a.array(a.object({sessionHash:E,sourceId:h,status:a.enum(["imported","already_present"]),datasets:a.array(a.object({datasetId:h,revision:a.number().int().positive(),changed:a.boolean()}).strict()).max(2)}).strict()).max(1e3),error:a.string().optional()}).strict(),Ke=class extends Error{static{d(this,"ConnectedEvidenceError")}constructor(t,e,n){super(n),this.status=t,this.code=e,this.name="ConnectedEvidenceError"}status;code},ir=class{static{d(this,"ConnectedEvidenceClient")}constructor(t){this.options=t;let e=new URL(t.baseUrl);if(!["http:","https:"].includes(e.protocol)||e.username||e.password||e.search||e.hash||!t.apiKey.trim()||!t.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=e.toString().replace(/\/+$/,"")}options;baseUrl;async capture(t,e){let n=ze.parse(t),r=Kt.parse(await this.request("/capture","POST",n,e));if(this.scope(r.teamId),r.operationId!==n.operationId||r.outcomes.length>n.limit||n.conversationId&&r.outcomes.some(o=>o.conversationId!==n.conversationId))throw new Error("Capture receipt differs from its requested source or operation.");return r}async retainStartingAssets(t,e){let n=Be.parse(t),r=ce(await this.request("/starting-assets","POST",n,e));if(this.scope(r.teamId),r.operationId!==n.operationId||r.requestHash!==f(n)||f(r.source)!==f(n.source)||r.assets.length!==n.proofs.length||r.assets.some((o,s)=>o.path!==n.proofs[s].path))throw new Error("Starting assets differ from the exact source, operation or selected paths.");return r}async startingAssets(t,e){let n=ce(await this.request(`/starting-assets/${encodeURIComponent(h.parse(t))}`,"GET",void 0,e));if(this.scope(n.teamId),n.id!==t)throw new Error("Starting assets identity mismatch.");return n}async list(t={},e){let n=a.object({projectId:h.optional(),cursor:h.optional(),limit:a.number().int().min(1).max(50).default(20)}).strict().parse(t),r=new URLSearchParams(Object.entries(n).filter(([,s])=>s!==void 0).map(([s,i])=>[s,String(i)])),o=a.object({teamId:h,items:a.array(W).max(50),nextCursor:h.nullable()}).strict().parse(await this.request(`?${r}`,"GET",void 0,e));if(this.scope(o.teamId),o.items.length>n.limit||new Set(o.items.map(s=>s.sourceId)).size!==o.items.length||o.nextCursor!==null&&o.nextCursor===n.cursor||n.projectId&&o.items.some(s=>s.projectId!==n.projectId))throw new Error("Connected source page differs from its requested scope.");return o}async read(t,e){let n=B.parse(t),r=Gt.parse(await this.request(`/${encodeURIComponent(n.id)}/cases/${encodeURIComponent(n.boundaryId)}?snapshotHash=${n.snapshotHash}&revisionHash=${n.boundaryRevisionHash}`,"GET",void 0,e));if(this.scope(r.teamId),f(r.ref)!==f(n)||r.evidence.boundary.id!==n.boundaryId||r.evidence.boundary.revisionHash!==n.boundaryRevisionHash||f(r.evidence.input)!==r.evidence.boundary.inputHash||f(r.evidence.observed)!==n.boundaryRevisionHash||r.evidence.boundary.outputHash!==null&&f(r.evidence.answer)!==r.evidence.boundary.outputHash)throw new Error("Connected case readback differs from its exact snapshot or cutoff.");return r}async setCollection(t,e){let n=De.parse(await this.request("/collection","PUT",a.object({paused:a.boolean()}).strict().parse({paused:t}),e));return this.scope(n.teamId),n}async collection(t){let e=De.parse(await this.request("/collection","GET",void 0,t));return this.scope(e.teamId),e}async collectionStatus(t){let e=Jt.parse(await this.request("/collection/status","GET",void 0,t));return this.scope(e.teamId),e}async unmappedEvents(t,e){let n=a.object({id:h,snapshotHash:E,contentHash:E,offset:a.number().int().nonnegative().default(0),limit:a.number().int().min(1).max(50).default(20)}).strict().parse(t),r=Wt.parse(await this.request(`/${encodeURIComponent(n.id)}/unmapped-events?snapshotHash=${n.snapshotHash}&offset=${n.offset}&limit=${n.limit}`,"GET",void 0,e));if(this.scope(r.teamId),r.sourceId!==n.id||r.snapshotHash!==n.snapshotHash||r.contentHash!==n.contentHash||r.offset!==n.offset||r.events.length>n.limit||r.events.some((o,s)=>o.sequence!==n.offset+s)||r.nextOffset!==null&&r.nextOffset!==n.offset+r.events.length)throw new Error("Unmapped source event page differs from its pinned snapshot.");return r}async homeSummary(t,e){let n=a.object({from:a.string().datetime(),to:a.string().datetime(),projectId:h.optional()}).strict(),r=n.parse(t),o=new URLSearchParams(Object.entries(r)),s=a.object({teamId:h,range:n,activity:a.object({conversations:a.number().int().nonnegative(),turns:a.number().int().nonnegative(),chatTurns:a.number().int().nonnegative(),workTurns:a.number().int().nonnegative()}).strict(),accounting:a.object({contextSnapshots:a.number().int().nonnegative()}).strict(),usage:Oe}).strict().parse(await this.request(`/summary?${o}`,"GET",void 0,e));if(this.scope(s.teamId),f(s.range)!==f(r)||s.activity.chatTurns+s.activity.workTurns!==s.activity.turns)throw new Error("Activity summary differs from its requested range.");for(let i of[s.usage.days,s.usage.modes,s.usage.models]){if(new Set(i.map(u=>u.key)).size!==i.length)throw new Error("Duplicate usage summary group.");for(let u of Object.keys(s.usage.total))if(i.reduce((c,p)=>c+p[u],0)!==s.usage.total[u])throw new Error("Usage totals differ from their displayed groups.")}return s}async uploadPart(t,e){let n=Le.parse(t),r=a.object({teamId:h,hash:E,parts:a.number().int(),index:a.number().int()}).strict().parse(await this.request("/imports/upload","POST",n,e));if(this.scope(r.teamId),r.hash!==n.hash||r.parts!==n.parts||r.index!==n.index)throw new Error("Upload receipt differs from its part identity.");return r}async preview(t,e){let n=q.parse(t),r=Xt.parse(await this.request("/imports/preview","POST",n,e));if(this.scope(r.teamId),r.source!==n.source||f(r.destination)!==f(n.destination)||r.sessions.some(o=>o.origin!==n.source)||new Set(r.sessions.map(o=>o.sessionHash)).size!==r.sessions.length)throw new Error("Import preview differs from its source or destination.");return r}async commit(t,e){let n=ie.parse(t),r=Je.parse(await this.request("/imports/commit","POST",n,e));if(this.scope(r.teamId),r.operationId!==n.operationId||r.previewHash!==n.previewHash||r.requestHash!==f(n)||r.outcomes.some(o=>!n.selection.some(s=>s.sessionHash===o.sessionHash))||r.state==="completed"&&r.outcomes.length!==n.selection.length)throw new Error("Import receipt differs from its exact selection or operation.");return r}async readImport(t,e){let n=h.parse(t),r=Je.parse(await this.request(`/imports/${encodeURIComponent(n)}`,"GET",void 0,e));if(this.scope(r.teamId),r.operationId!==n)throw new Error("Import identity mismatch.");return r}async prepareRecorded(t,e){let n=le.parse(t),r=Me(await this.request("/recorded-executions","POST",n,e));if(this.scope(r.teamId),f(r.request)!==f(n))throw new Error("Recorded admission differs from its selected Dataset/cases.");return r}async listRecordedExecutions(t={},e){let n=Ft.parse(t),r=new URLSearchParams(Object.entries(n).filter(([,s])=>s!==void 0).map(([s,i])=>[s,String(i)])),o=Mt.parse(await this.request(`/recorded-executions?${r}`,"GET",void 0,e));if(this.scope(o.teamId),o.items.length>n.limit||o.items.some((s,i)=>s.teamId!==o.teamId||n.projectId&&s.projectId!==n.projectId||n.cursor&&s.id<=n.cursor||i>0&&s.id<=o.items[i-1].id)||o.items.some(s=>s.ownerUserId!==o.items[0]?.ownerUserId)||o.nextCursor!==null&&(n.cursor!==void 0&&o.nextCursor<=n.cursor||o.items.length>0&&o.nextCursor<o.items.at(-1).id))throw new Error("Recorded execution page differs from its requested scope or cursor.");return o}async recordedExecution(t,e){let n=Me(await this.request(`/recorded-executions/${encodeURIComponent(h.parse(t))}`,"GET",void 0,e));if(this.scope(n.teamId),n.id!==t)throw new Error("Recorded execution identity mismatch.");return n}async publishDataset(t,e){let n=Dt.parse(t),r=de.parse(await this.request("/datasets/publish","POST",n,e));this.scope(r.teamId);let o=r.workspace.draft.metadata.connectedPublication;if(r.datasetId!==n.datasetId||!r.publication||!o||typeof o!="object"||!("requestHash"in o)||o.requestHash!==f(n))throw new Error("Published Dataset identity or original selection mismatch.");return r}async createSelection(t,e){let n=a.object({operationId:h.max(240),projectId:h.max(240),name:a.string().trim().min(1).max(200),cases:a.array(B).min(1).max(500)}).strict().parse(t),r=de.parse(await this.request("/datasets/selection","POST",n,e));if(this.scope(r.teamId),r.originProjectId!==n.projectId||r.workspace.draft.tasks.length!==n.cases.length||r.workspace.draft.tasks.some((o,s)=>f(o.input&&typeof o.input=="object"&&!Array.isArray(o.input)?o.input.connectedEvidenceRef:null)!==f(n.cases[s])))throw new Error("Selected Dataset differs from its exact source population.");return r}scope(t){if(t!==this.options.teamId)throw new Error("Connected evidence workspace mismatch.")}async request(t,e,n,r){let{response:o,value:s}=await Te(this.options.fetch??fetch,`${this.baseUrl}/v1/connected-evidence${t}`,{method:e,signal:r,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,"Content-Type":"application/json",Accept:"application/json"},...n===void 0?{}:{body:JSON.stringify(n)}},(i,u,c)=>new Ke(i,u,c));if(!o.ok){let i=a.object({code:a.string(),message:a.string()}).safeParse(s);throw new Ke(o.status,i.success?i.data.code:"connected_request_failed",i.success?i.data.message:"Connected evidence request failed.")}return s}},I=a.string().trim().min(1).max(240),ur=a.object({id:I,expectedRevision:a.number().int().positive(),manifest:$e}).strict().refine(t=>t.id===t.manifest.connectionId&&t.expectedRevision===t.manifest.connectionRevision,"Collector coverage scope differs from its connection."),pr=a.object({id:I,cutoff:a.iso.datetime().optional()}).strict(),mr=a.object({schemaVersion:a.literal("openpond.connectedSyncCoverageReceipt.v1"),id:I,teamId:I,ownerUserId:I,connectionId:I,connectionRevision:a.number().int().positive(),receivedAt:a.iso.datetime(),summary:je}).strict(),lr=a.object({id:I,source:q.shape.source,machineId:I,sourceInstanceId:I,sourceLabel:a.string().trim().min(1).max(200),sourceRoot:a.string().min(1).max(2e3),destination:q.shape.destination,since:a.string().datetime().nullable(),keepSyncing:a.boolean(),expectedRevision:a.number().int().nonnegative()}).strict(),hr=a.object({id:I,expectedRevision:a.number().int().positive(),action:a.enum(["pause","resume","disconnect"])}).strict(),fr=a.object({id:I,operationId:I,expectedRevision:a.number().int().positive()}).strict(),yr=a.object({id:I,expectedRevision:a.number().int().positive(),pendingOperations:a.number().int().min(0).max(1e4),error:a.string().max(500).nullable(),completedSyncRevision:a.number().int().nonnegative().default(0)}).strict(),gr=a.object({teamId:I,id:I,revision:a.number().int().positive(),source:q.shape.source,sourceLabel:a.string(),sourceRoot:a.string(),taskDatasetId:I.nullable(),conversationDatasetId:I.nullable(),machineId:I,sourceInstanceId:I,projectId:I,datasetIds:a.array(I).max(2),since:a.string().datetime().nullable(),keepSyncing:a.boolean(),state:a.enum(["active","paused","disconnected"]),health:a.enum(["online","offline"]),lastHeartbeatAt:a.string().datetime().nullable(),lastAdmissionAt:a.string().datetime().nullable(),pendingOperations:a.number().int().nonnegative(),admittedTasks:a.number().int().nonnegative(),error:a.string().nullable(),requestedSyncRevision:a.number().int().nonnegative().default(0),completedSyncRevision:a.number().int().nonnegative().default(0),syncRequestedAt:a.string().datetime().nullable().default(null),syncCompletedAt:a.string().datetime().nullable().default(null)}).strict().refine(t=>t.completedSyncRevision<=t.requestedSyncRevision&&t.requestedSyncRevision<=t.revision,"Invalid sync acknowledgement generation."),br=a.object({connectionId:I,expectedRevision:a.number().int().positive(),request:ie}).strict();function Pr(t){let e=d(r=>`/v1/training/candidate-evaluations/${encodeURIComponent(r)}`,"path");function n(r,o,s){let i=Zt.parse(r);if(i.teamId!==o||s&&i.id!==s)throw new Error("The preparation belongs to another workspace or candidate operation.");return i}return d(n,"read"),{async options(r,o={}){let s=new URLSearchParams({teamId:r,...o}),i=Yt.parse(await t(`/v1/training/candidates?${s}`));if(i.teamId!==r)throw new Error("The candidate catalog belongs to another workspace.");return i},async save(r){let o=We.parse(r),s=n(await t(`/v1/training/candidate-evaluations?teamId=${encodeURIComponent(o.teamId)}`,{method:"POST",body:JSON.stringify(o)}),o.teamId);if(s.requestHash!==f(o))throw new Error("The saved preparation differs from the selected candidate or frozen evaluation.");return s},async get(r,o){return n(await t(`${e(o)}?teamId=${encodeURIComponent(r)}`),r,o)},async control(r,o,s,i){let u=Qt.parse(i),c=n(await t(`${e(o)}/${s}?teamId=${encodeURIComponent(r)}`,{method:"POST",body:JSON.stringify(u)}),r,o);if(c.requestHash!==u.requestHash)throw new Error("The command returned a different frozen evaluation.");return c}}}d(Pr,"createCandidateEvaluationClient");var S=a.string().trim().min(1).max(200),he=a.string().regex(/^[a-f0-9]{64}$/),Ge=a.object({id:S,contentHash:he}).strict(),Vt=a.object({artifact:Ge,trainingJobId:S,configurationId:S,baseProfileId:S,ready:a.boolean(),reason:a.string().max(1e3).nullable()}).strict(),Yt=a.object({teamId:S,ownerUserId:S,items:a.array(Vt).max(100),nextCursor:S.nullable()}).strict(),We=a.object({teamId:S,operationId:S,artifact:Ge,configuration:L}).strict().superRefine((t,e)=>{(t.configuration.request.teamId!==t.teamId||t.configuration.request.policy.kind==="fixture"||t.configuration.request.policy.candidate)&&e.addIssue({code:"custom",message:"Choose one exact model-backed evaluation before preparing the trained version."})}),Zt=a.object({schemaVersion:a.literal("openpond.candidateEvaluationPreparation.v1"),teamId:S,ownerUserId:S,id:S,revision:a.number().int().positive(),requestHash:he,request:We,trainingJobId:S,dispatchId:S,lastOperationId:S.nullable(),runtime:a.object({poolId:S,endpointId:S.nullable(),baseProfileId:S,workerImageDigest:a.string().regex(/^sha256:[a-f0-9]{64}$/),modelId:S.nullable()}).strict().nullable(),state:a.enum(["configured","preparing","ready","dispatching","submitted","cleaning","completed","failed","cancelled"]),experimentId:S.nullable(),authorizedAt:a.iso.datetime().nullable(),cancelledAt:a.iso.datetime().nullable(),reason:a.string().max(1e3).nullable(),createdAt:a.iso.datetime(),updatedAt:a.iso.datetime()}).strict().superRefine((t,e)=>{(t.requestHash!==f(t.request)||!t.runtime&&["ready","dispatching","submitted","completed"].includes(t.state))&&e.addIssue({code:"custom",message:"The exact candidate preparation request or runtime changed."})}),Qt=a.object({operationId:S,expectedRevision:a.number().int().positive(),requestHash:he}).strict();var x=a.string().trim().min(1).max(200),F=a.string().regex(/^[a-f0-9]{64}$/),H=a.string().datetime(),Xe=a.object({operationId:x,id:x.optional(),expectedRevision:a.number().int().nonnegative(),teamId:x,projectId:x.nullable(),enabled:a.boolean(),configuration:L,cadence:a.discriminatedUnion("kind",[a.object({kind:a.literal("interval"),seconds:a.number().int().min(60).max(31536e3)}).strict(),a.object({kind:a.literal("nightly"),calendar:Ue}).strict()]),maximumTotalSpendUsd:a.number().finite().positive().max(1e4),maximumAttempts:a.number().int().min(1).max(20)}).strict().superRefine((t,e)=>{(t.configuration.request.teamId!==t.teamId||(t.configuration.request.project?.id??null)!==t.projectId)&&e.addIssue({code:"custom",message:"The scheduled Experiment must retain its actual workspace and Project."}),t.configuration.maximumCostUsd>t.maximumTotalSpendUsd&&e.addIssue({code:"custom",message:"The run ceiling exceeds the approved cumulative schedule ceiling."})}),en=a.object({id:x,scheduledAt:H,coalescedThroughAt:H,coalescedCount:a.number().int().nonnegative(),configurationHash:F,operationId:x,state:a.enum(["reserved","dispatching","running","cleaning","completed","failed","cancelled","uncertain"]),executionId:x.nullable(),attempt:a.number().int().positive(),maximumCostUsd:a.number().finite().positive(),actualSpendUsd:a.number().finite().nonnegative().nullable(),cleanupComplete:a.boolean(),error:a.string().max(4e3).nullable()}).strict(),tn=a.object({schemaVersion:a.literal("openpond.experimentEvaluationSchedule.v1"),id:x,revision:a.number().int().positive(),actorId:x,teamId:x,projectId:x.nullable(),operationId:x,requestHash:F,configuration:L,configurationHash:F,cadence:Xe.shape.cadence,state:a.enum(["scheduled","disabled","blocked"]),nextRunAt:H.nullable(),maximumTotalSpendUsd:a.number().finite().positive(),maximumAttempts:a.number().int().positive(),lastEvaluatedConfigurationHash:F.nullable(),newerUnevaluatedRelease:G.nullable(),fires:a.array(en).max(1e4),reason:a.string().max(4e3).nullable(),createdAt:H,updatedAt:H,contentHash:F}).strict();function nn(t){let{operationId:e,request:n,...r}=t,{operationId:o,...s}=n;return f({...r,request:s})}d(nn,"scheduledExperimentHash");function rn(t){let e=tn.parse(t);if(_e(e,"Scheduled Experiment"),e.configurationHash!==nn(e.configuration)||e.configuration.request.teamId!==e.teamId||(e.configuration.request.project?.id??null)!==e.projectId)throw new Error("Scheduled Experiment immutable authority differs from its recipe.");return e}d(rn,"verifyExperimentEvaluationSchedule");function $r(t){return rn({...t,contentHash:f(t)})}d($r,"sealExperimentEvaluationSchedule");var on=a.object({teamId:x,id:x,operationId:x,expectedRevision:a.number().int().positive(),action:a.enum(["cancel_active","retry_active","pause"])}).strict(),jr=a.discriminatedUnion("operation",[a.object({operation:a.literal("publish"),request:Xe}).strict(),a.object({operation:a.literal("control"),request:on}).strict(),a.object({operation:a.literal("read"),id:x}).strict(),a.object({operation:a.literal("list"),cursor:x.optional(),limit:a.number().int().min(1).max(100).default(50)}).strict()]);function an(t){return{list:d((e={})=>t.listSandboxRuntimes(e),"list"),create:d(e=>t.createSandboxRuntime(e),"create"),handle:d((e,n=null)=>t.sandboxRuntime(e,n),"handle"),get:d(e=>t.getSandboxRuntime(e),"get"),createSandbox:d((e,n={},r={})=>t.createSandboxRuntimeSandbox(e,n,r),"createSandbox"),updateStatus:d((e,n)=>t.updateSandboxRuntimeStatus(e,n),"updateStatus"),events:d(e=>t.listSandboxRuntimeEvents(e),"events"),event:d((e,n)=>t.emitSandboxRuntimeEvent(e,n),"event"),checkpoint:d((e,n={})=>t.checkpointSandboxRuntime(e,n),"checkpoint"),promote:d((e,n,r={})=>t.promoteSandboxRuntime(e,n,r),"promote"),preserveSource:d((e,n={},r={})=>t.preserveSandboxRuntimeSource(e,n,r),"preserveSource")}}d(an,"createSandboxRuntimeNamespace");function sn(t){return{list:d((e={})=>t.list(e),"list"),create:d(e=>t.create(e),"create"),get:d(e=>t.get(e),"get"),pricing:d(()=>t.pricing(),"pricing"),costs:d((e={})=>t.costs(e),"costs")}}d(sn,"createSandboxNamespace");function dn(t){return{list:d(e=>t.listProjects(e),"list"),upsert:d(e=>t.upsertProject(e),"upsert"),upsertGitRemote:d(e=>t.upsertProjectGitRemote(e),"upsertGitRemote"),get:d((e,n)=>t.getProject(e,n),"get"),update:d((e,n)=>t.updateProject(e,n),"update"),sync:d((e,n)=>t.syncProject(e,n),"sync"),ensureGitRemote:d((e,n)=>t.ensureProjectGitRemote(e,n),"ensureGitRemote"),getGitRemote:d((e,n)=>t.ensureProjectGitRemote(e,n),"getGitRemote"),git:d((e,n)=>t.ensureProjectGitRemote(e,n),"git"),uploadSource:d((e,n)=>t.uploadProjectSource(e,n),"uploadSource"),archive:d((e,n)=>t.archiveProject(e,n),"archive")}}d(dn,"createSandboxProjectNamespace");function cn(t){return{get:d(e=>t.getHostedProfile(e),"get"),status:d(e=>t.getHostedProfile(e),"status"),ensureHosted:d(e=>t.ensureHostedProfile(e),"ensureHosted"),push:d(e=>t.pushHostedProfile(e),"push")}}d(cn,"createSandboxProfileNamespace");function un(t){return{list:d(e=>t.listAgents(e),"list"),upsert:d(e=>t.upsertAgent(e),"upsert"),get:d((e,n)=>t.getAgent(e,n),"get"),update:d((e,n)=>t.updateAgent(e,n),"update"),archive:d((e,n)=>t.archiveAgent(e,n),"archive"),run:d((e,n)=>t.runAgent(e,n),"run"),sourceDeployPlan:d((e,n)=>t.getAgentSourceDeployPlan(e,n),"sourceDeployPlan"),manifestSnapshots:d((e,n)=>t.listAgentManifestSnapshots(e,n),"manifestSnapshots"),requestSourceChecks:d((e,n)=>t.requestAgentSourceChecks(e,n),"requestSourceChecks"),configureSourceSetup:d((e,n)=>t.configureAgentSourceSetup(e,n),"configureSourceSetup"),publishSource:d((e,n)=>t.publishAgentSource(e,n),"publishSource")}}d(un,"createSandboxAgentNamespace");function pn(t,e,n=null){let r=d(async(c={},p={})=>{let b=await t.getSandboxRuntime(e);return b.sandboxId?t.get(b.sandboxId):t.createSandboxRuntimeSandbox(e,c,p).then(l=>l.sandbox)},"currentSandbox"),o=d(async(c={},p={})=>{let b=await t.getSandboxRuntime(e);if(!b.sandboxId)return t.createSandboxRuntimeSandbox(e,c,p).then(g=>g.sandbox);let l=await t.get(b.sandboxId);return l.state==="stopped"?t.start(l.id,p).then(g=>g.sandbox):l.state==="archived"?t.restore(l.id).then(g=>g.sandbox):l.state==="deleted"||l.state==="error"?t.createSandboxRuntimeSandbox(e,c,p).then(g=>g.sandbox):l},"resume");return{id:e,initial:n,get:d(()=>t.getSandboxRuntime(e),"get"),sandbox:r,resume:o,createSandbox:d((c={},p={})=>t.createSandboxRuntimeSandbox(e,c,p),"createSandbox"),status:d(async c=>{if(typeof c!="string")return t.updateSandboxRuntimeStatus(e,c);let p=await t.getSandboxRuntime(e);return t.updateSandboxRuntimeStatus(e,{status:c,expectedVersion:p.version})},"status"),events:d(()=>t.listSandboxRuntimeEvents(e),"events"),event:d(c=>t.emitSandboxRuntimeEvent(e,c),"event"),recordCommit:d((c,p={})=>t.emitSandboxRuntimeEvent(e,{...p,type:p.type??"git.commit",commitSha:c}),"recordCommit"),checkpointHint:d((c={})=>t.emitSandboxRuntimeEvent(e,{type:"workflow.checkpoint_hint",summary:c.summary??c.reason??"Workflow checkpoint hint",payload:{...c.payload,reason:c.reason??null},artifactRefs:c.artifactRefs,lifecycleHint:{kind:"checkpoint",reason:c.reason??null}}),"checkpointHint"),waitForUser:d(async(c={})=>{await t.emitSandboxRuntimeEvent(e,{type:"workflow.waiting_for_user",summary:c.summary??c.reason??"Waiting for user",payload:{...c.payload,reason:c.reason??null},lifecycleHint:{kind:"waiting_for_user",reason:c.reason??null}});let p=await t.getSandboxRuntime(e);return p.status==="waiting_for_user"?p:t.updateSandboxRuntimeStatus(e,{status:"waiting_for_user",expectedVersion:p.version,summary:c.summary??c.reason,metadata:{workflowWaitForUserReason:c.reason??null}})},"waitForUser"),keepAlive:d((c={})=>{let p=mn(c);return t.emitSandboxRuntimeEvent(e,{type:"workflow.keepalive",summary:c.summary??c.reason??"Workflow keepalive",payload:{...c.payload,reason:c.reason??null,keepaliveUntil:p},lifecycleHint:{kind:"keepalive",reason:c.reason??null,keepaliveUntil:p}})},"keepAlive"),checkpoint:d(c=>t.checkpointSandboxRuntime(e,c),"checkpoint"),files:{write:d(async(c,p)=>t.uploadFile((await o()).id,c,p),"write"),read:d(async c=>t.downloadFile((await o()).id,c),"read"),readResponse:d(async c=>t.downloadFileResponse((await o()).id,c),"readResponse"),list:d(async(c={})=>t.listFiles((await o()).id,c),"list"),delete:d(async(c,p={})=>t.deleteFile((await o()).id,c,p),"delete"),search:d(async c=>t.searchFiles((await o()).id,c),"search"),stat:d(async c=>t.statFile((await o()).id,c),"stat"),mkdir:d(async c=>t.mkdir((await o()).id,c),"mkdir"),move:d(async c=>t.moveFile((await o()).id,c),"move")},commands:{run:d(async c=>t.exec((await o()).id,typeof c=="string"?{command:c}:c),"run")},ports:{expose:d(async c=>t.openPort((await o()).id,typeof c=="number"?{port:c}:c),"expose")},promote:d((c,p={})=>t.promoteSandboxRuntime(e,c,p),"promote"),preserveSource:d((c={},p={})=>t.preserveSandboxRuntimeSource(e,c,p),"preserveSource"),archive:d(async c=>{let p=c??(await t.getSandboxRuntime(e)).version;return t.updateSandboxRuntimeStatus(e,{status:"archived",expectedVersion:p})},"archive")}}d(pn,"createSandboxRuntimeHandle");function mn(t){if(t?.until instanceof Date)return t.until.toISOString();if(typeof t?.until=="string"&&t.until.trim())return new Date(t.until).toISOString();let e=typeof t?.seconds=="number"&&Number.isFinite(t.seconds)?Math.max(1,Math.trunc(t.seconds)):60;return new Date(Date.now()+e*1e3).toISOString()}d(mn,"runtimeKeepaliveUntilIso");async function ln(t,e={}){let n=`openpond-code-smoke-${Date.now()}`,r=`openpond-code-exec-ok:${n}`,o=`openpond-code-preview-ok:${n}`,s=`openpond-code-file-ok:${n}`,i=4173,u=null,c=null,p=!1,b=!1;try{let l=await Ye(t,await t.create({repo:e.repo??"https://github.com/octocat/Hello-World",resources:{cpu:e.cpu??1,memoryGb:e.memoryGb??1,diskGb:e.diskGb??8},budget:{maxUsd:e.budgetUsd??"0.05"},quotas:{maxSpendUsd:e.budgetUsd??"0.05",maxDurationSeconds:600,idleTimeoutSeconds:600,maxOpenPorts:2},metadata:{runId:n,source:"openpond-code-sandbox-smoke"}},{async:!0}));u=l.id;let g=e.expectedMppMode;if(g&&l.reservation.mpp?.mode!==g)throw new Error(`expected ${g} reservation, got ${l.reservation.mpp?.mode??"none"}`);if(!g&&!l.reservation.mpp?.mode)throw new Error("expected sandbox reservation MPP metadata");let P=await t.exec(l.id,{command:[`printf '${r}\\n'`,"test -f README && printf 'repo-clone-ok\\n'","cat > server.cjs <<'EOF'","const { createServer } = require('node:http');",`createServer((_request, response) => response.end('${o}')).listen(${i}, '0.0.0.0');`,"EOF","nohup node server.cjs > server.log 2>&1 & sleep 1"].join(`
|
|
3
|
-
`),timeoutSeconds:120});if(P.command.status!=="succeeded")throw new Error(`expected command success, got ${P.command.status}`);if(!P.command.output.includes(r))throw new Error("expected exec marker");if(await t.uploadFile(l.id,"openpond-code-smoke.txt",s),await t.downloadFile(l.id,"openpond-code-smoke.txt")!==s)throw new Error("expected file roundtrip marker");let U=null;if(e.snapshot||e.fork){let R=await t.createSnapshot(l.id,{async:!0,name:`openpond-code-smoke-${n}`,replay:{entrypoints:[{command:"cat openpond-code-smoke.txt",name:"default"}],retention:{class:"pinned"},safety:{cleanup:"delete",idleTimeoutSeconds:600,internetEgress:"block",maxDurationSeconds:600,maxSpendUsd:e.budgetUsd??"0.05",publicPreview:!1},validation:{commands:[{command:"test -f openpond-code-smoke.txt"}]}}}),A=R.snapshot??(await yn(t,l.id,R.snapshotJob?.snapshotId)).snapshot;if(U=A.id,A.state!=="ready")throw new Error(`expected ready snapshot, got ${A.state}`)}if(e.fork){if(!U)throw new Error("expected snapshot id before fork");let R=await Ye(t,(await t.forkSnapshot(U,{budget:{maxUsd:e.budgetUsd??"0.05"},metadata:{source:"openpond-code-sandbox-smoke-fork",templateSnapshotId:U}},{async:!0})).sandbox);c=R.id;let A=await t.exec(R.id,{command:"cat openpond-code-smoke.txt",timeoutSeconds:120});if(A.command.status!=="succeeded")throw new Error(`expected fork command success, got ${A.command.status}`);if(!A.command.output.includes(s))throw new Error("expected fork snapshot marker");e.keep||(await fe(t,R.id),b=!0)}let j=null;if(e.preview!==!1){let R=await t.openPort(l.id,{label:"openpond-code-smoke",port:i}),A=await fetch(R.preview.url);j=A.status;let $t=await A.text();if(A.status!==200)throw new Error(`expected preview HTTP 200, got ${A.status}`);if(!$t.includes(o))throw new Error("expected preview marker")}let{sandbox:ne,receipts:J}=await hn(t,l.id);return e.keep||(await fe(t,l.id),p=!0),{deleted:p,execOutput:P.command.output.trim(),fileRoundtrip:!0,forkSandboxId:c,previewStatus:j,receiptRefs:J.map(R=>R.mpp.receiptRef??null),reservationRef:l.reservation.mpp?.reservationRef??null,runId:n,sandboxId:l.id,snapshotId:U,state:ne.state}}finally{c&&!e.keep&&!b&&await Ve(t,c),u&&!e.keep&&!p&&await Ve(t,u)}}d(ln,"runSandboxSmoke");async function hn(t,e){try{await t.stop(e)}catch{await t.stop(e,{async:!0})}let n=await Qe(t,e,new Set(["stopped","deleted"]),"stop"),r=await fn(t,e);if(r.length===0)throw new Error("expected receipt readback");return{sandbox:n,receipts:r}}d(hn,"stopSandboxForSmoke");async function fe(t,e){try{let n=await t.delete(e);if(n.state==="deleted")return n;await t.delete(e,{async:!0})}catch{await t.delete(e,{async:!0})}return Qe(t,e,new Set(["deleted"]),"delete")}d(fe,"deleteSandboxForSmoke");async function Ve(t,e){try{await fe(t,e)}catch{await t.delete(e,{async:!0}).catch(()=>{})}}d(Ve,"cleanupSandboxBestEffort");async function Qe(t,e,n,r){let i=Date.now()+3e5,u=await t.get(e);for(;Date.now()<i;){if(n.has(u.state))return u;if(u.state==="error")throw new Error(`sandbox ${r} failed: ${e}`);await V(3e3),u=await t.get(e)}throw new Error(`sandbox ${r} did not reach ${[...n].join("/")} before timeout: ${e} (${u.state})`)}d(Qe,"waitForSandboxState");async function fn(t,e){let o=Date.now()+12e4,s=await t.receipts(e);for(;Date.now()<o;){if(s.length>0)return s;await V(3e3),s=await t.receipts(e)}return s}d(fn,"waitForReceipts");async function Ye(t,e){if(e.state==="running"||e.state==="stopped")return e;if(e.state==="error")throw new Error(`sandbox create failed: ${e.id}
|
|
4
|
-
${e.logs.join(`
|
|
5
|
-
`)}`);let n=12*6e4,r=3e3,o=Date.now()+n,s=e;for(;Date.now()<o;){if(await V(r),s=await t.get(e.id),s.state==="running"||s.state==="stopped")return s;if(s.state==="error")throw new Error(`sandbox create failed: ${s.id}
|
|
6
|
-
${s.logs.join(`
|
|
7
|
-
`)}`)}throw new Error(`sandbox create did not reach running state before timeout: ${s.id} (${s.state})`)}d(Ye,"waitForCreateReady");async function yn(t,e,n){if(!n)throw new Error("snapshot job did not return snapshot id");let r=12*6e4,o=3e3,s=Date.now()+r,i=await t.get(e);for(;Date.now()<s;){let u=i.snapshots?.find(p=>p.id===n);if(u?.state==="ready")return{sandbox:i,snapshot:u};let c=i.snapshotJobs?.find(p=>p.snapshotId===n);if(c?.status==="failed")throw new Error(`snapshot job failed: ${c.error??n}`);await V(o),i=await t.get(e)}throw new Error(`snapshot did not reach ready state before timeout: ${n}`)}d(yn,"waitForSnapshotReady");function V(t){return new Promise(e=>setTimeout(e,t))}d(V,"sleep");function M(t={}){return t.async||t.respondAsync?{Prefer:"respond-async"}:void 0}d(M,"asyncRequestHeaders");var gn="https://openpond.ai",ye="https://api.openpond.ai";async function Ze(t){let e=await X(t.sandboxApiUrl,t.apiKey,t.path,{timeoutMs:0,maxResponseBytes:0});if(!e.body)return;let n=e.body.getReader(),r=new TextDecoder,o="";try{for(;;){let{done:s,value:i}=await n.read();if(s)break;o+=r.decode(i,{stream:!0});let u=o.indexOf(`
|
|
8
|
-
|
|
9
|
-
`);for(;u!==-1;){let c=o.slice(0,u);o=o.slice(u+2);let p=In(c);p&&process.stdout.write(p),u=o.indexOf(`
|
|
10
|
-
|
|
11
|
-
`)}}}finally{n.releaseLock()}}d(Ze,"streamSandboxEventOutput");function bn(t){return typeof t=="string"?{dataBase64:Buffer.from(t,"utf-8").toString("base64")}:t instanceof Uint8Array?{dataBase64:Buffer.from(t).toString("base64")}:t}d(bn,"normalizePtyInput");function In(t){if(!t.includes("event: output"))return null;let e=t.split(/\r?\n/).filter(n=>n.startsWith("data: ")).map(n=>n.slice(6));if(e.length===0)return null;try{let n=JSON.parse(e.join(`
|
|
12
|
-
`));return typeof n.output=="string"?n.output:null}catch{return null}}d(In,"parseProcessOutputEvent");function O(t,e={}){let n=t.trim().replace(/\/$/,"");if(!n)throw new Error("sandbox API URL must be non-empty");let r=new URL(n),o=r.pathname.replace(/\/$/,"");if(o.endsWith("/v1/sandboxes")||o.endsWith("/api/sandboxes"))return`${r.origin}${o}`;if(o.endsWith("/v1"))return`${r.origin}${o}/sandboxes`;if(r.origin===gn)return`${ye}/v1/sandboxes`;let s=e.apiBaseUrl?new URL(e.apiBaseUrl).origin:ye;return r.origin===s?`${r.origin}${o}/v1/sandboxes`:`${r.origin}${o}/api/sandboxes`}d(O,"normalizeSandboxApiUrl");function Sn(t){let e="/sandboxes";if(!t.endsWith(e))throw new Error("sandbox API URL must end with /sandboxes");return t.slice(0,-e.length)}d(Sn,"apiRootUrlFromSandboxApiUrl");var wn=class{static{d(this,"OpenPondSandboxInstanceClient")}apiKey;apiRootUrl;sandboxApiUrl;customEndpoint;constructor(t){this.apiKey=t.apiKey,this.customEndpoint=t.customEndpoint??!1;let e=t.sandboxApiUrl??t.baseUrl??ye;this.sandboxApiUrl=O(e,{apiBaseUrl:this.customEndpoint?void 0:e}),this.apiRootUrl=Sn(this.sandboxApiUrl)}create(t,e={}){return this.request("",{method:"POST",...this.customEndpoint?{timeoutMs:18e4}:{},headers:M(e),body:JSON.stringify(t)}).then(n=>n.sandbox)}get(t){return this.request(`/${encodeURIComponent(t)}`).then(e=>e.sandbox)}exec(t,e){return this.request(`/${encodeURIComponent(t)}/exec`,{method:"POST",body:JSON.stringify(e)})}startProcess(t,e){return this.request(`/${encodeURIComponent(t)}/processes`,{method:"POST",body:JSON.stringify(e)})}listProcesses(t){return this.request(`/${encodeURIComponent(t)}/processes`)}getProcess(t,e,n={}){let r=new URLSearchParams;return n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),this.request(`/${encodeURIComponent(t)}/processes/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`)}stopProcess(t,e){return this.request(`/${encodeURIComponent(t)}/processes/${encodeURIComponent(e)}`,{method:"DELETE"})}async streamProcessOutput(t,e,n={}){let r=new URLSearchParams;n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),await Ze({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(t)}/processes/${encodeURIComponent(e)}/stream${r.size>0?`?${r.toString()}`:""}`})}startPty(t,e={}){return this.request(`/${encodeURIComponent(t)}/pty`,{method:"POST",body:JSON.stringify(e)})}listPtys(t){return this.request(`/${encodeURIComponent(t)}/pty`)}getPty(t,e,n={}){let r=new URLSearchParams;return n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),this.request(`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}${r.size>0?`?${r.toString()}`:""}`)}writePtyInput(t,e,n){return this.request(`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}/input`,{method:"POST",body:JSON.stringify(bn(n))})}stopPty(t,e){return this.request(`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}`,{method:"DELETE"})}async streamPtyOutput(t,e,n={}){let r=new URLSearchParams;n.since!==void 0&&r.set("since",String(Math.max(0,n.since))),await Ze({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(t)}/pty/${encodeURIComponent(e)}/stream${r.size>0?`?${r.toString()}`:""}`})}uploadFile(t,e,n){return this.uploadFileBase64(t,e,Buffer.from(n,"utf-8").toString("base64"))}uploadFileBase64(t,e,n){return this.request(`/${encodeURIComponent(t)}/files`,{method:"POST",body:JSON.stringify({path:e,contentsBase64:n})})}async downloadFile(t,e){let n=await this.downloadFileResponse(t,e);return Buffer.from(n.file.contentsBase64,"base64").toString("utf-8")}downloadFileResponse(t,e){let n=typeof e=="string"?{path:e}:e,r=new URLSearchParams({path:n.path});return n.offsetBytes!==void 0&&r.set("offsetBytes",String(n.offsetBytes)),n.maxBytes!==void 0&&r.set("maxBytes",String(n.maxBytes)),this.request(`/${encodeURIComponent(t)}/files?${r.toString()}`)}listFiles(t,e={}){let n=new URLSearchParams({list:"1"});return e.path&&n.set("path",e.path),e.recursive!==void 0&&n.set("recursive",String(e.recursive)),e.maxEntries!==void 0&&n.set("maxEntries",String(e.maxEntries)),this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`)}deleteFile(t,e,n={}){let r=new URLSearchParams({path:e});return n.recursive!==void 0&&r.set("recursive",String(n.recursive)),this.request(`/${encodeURIComponent(t)}/files?${r.toString()}`,{method:"DELETE"})}statFile(t,e){let n=new URLSearchParams({stat:"1",path:e});return this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`)}mkdir(t,e){let n=typeof e=="string"?{path:e}:e,r=new URLSearchParams({path:n.path});return n.recursive!==void 0&&r.set("recursive",String(n.recursive)),this.request(`/${encodeURIComponent(t)}/files?${r.toString()}`,{method:"PUT"})}moveFile(t,e){let n=new URLSearchParams({fromPath:e.fromPath,toPath:e.toPath});return e.overwrite!==void 0&&n.set("overwrite",String(e.overwrite)),this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`,{method:"PATCH"})}searchFiles(t,e){let n=new URLSearchParams({search:"1",query:e.query});return e.path&&n.set("path",e.path),e.maxResults!==void 0&&n.set("maxResults",String(e.maxResults)),this.request(`/${encodeURIComponent(t)}/files?${n.toString()}`)}openPort(t,e){return this.request(`/${encodeURIComponent(t)}/ports`,{method:"POST",body:JSON.stringify(e)})}createSnapshot(t,e){return this.request(`/${encodeURIComponent(t)}/snapshots`,{method:"POST",body:JSON.stringify(e)})}updateSnapshot(t,e,n){return this.request(`/${encodeURIComponent(t)}/snapshots/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)})}validateSnapshot(t,e,n={}){return this.request(`/${encodeURIComponent(t)}/snapshots/${encodeURIComponent(e)}/validate`,{method:"POST",body:JSON.stringify(n)})}publishSnapshot(t,e){return this.request(`/${encodeURIComponent(t)}/snapshots/${encodeURIComponent(e)}/publish`,{method:"POST"})}fork(t,e={}){return this.request(`/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify(e)})}stop(t,e={}){let n=new URLSearchParams;return e.failOnUnpreservedChanges&&n.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(t)}/stop${n.size>0?`?${n.toString()}`:""}`,{method:"POST",headers:M(e)})}start(t,e={}){return this.request(`/${encodeURIComponent(t)}/start`,{method:"POST",headers:M(e)})}restore(t){return this.request(`/${encodeURIComponent(t)}/restore`,{method:"POST"})}delete(t,e={}){let n=new URLSearchParams;return e.failOnUnpreservedChanges&&n.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`,{method:"DELETE",headers:M(e)}).then(r=>r.sandbox)}receipts(t){return this.request(`/${encodeURIComponent(t)}/receipts`).then(e=>e.receipts)}logs(t){return this.request(`/${encodeURIComponent(t)}/logs`).then(e=>e.logs)}gitStatus(t){return this.request(`/${encodeURIComponent(t)}/git/status`)}gitDiff(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/diff`,{method:"POST",body:JSON.stringify(e)})}gitExportPatch(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/export-patch`,{method:"POST",body:JSON.stringify(e)})}gitBranch(t,e){return this.request(`/${encodeURIComponent(t)}/git/branch`,{method:"POST",body:JSON.stringify(e)})}gitCommit(t,e){return this.request(`/${encodeURIComponent(t)}/git/commit`,{method:"POST",body:JSON.stringify(e)})}gitPull(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/pull`,{method:"POST",body:JSON.stringify(e)})}gitPush(t,e={}){return this.request(`/${encodeURIComponent(t)}/git/push`,{method:"POST",body:JSON.stringify(e)})}billing(t){return this.request(`/${encodeURIComponent(t)}/billing`)}pricing(){return this.request("/pricing")}costs(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),this.request(`/costs${e.size>0?`?${e.toString()}`:""}`)}integrationLeases(t){return this.request(`/${encodeURIComponent(t)}/integrations`)}attachIntegrationConnection(t,e){return this.request(`/${encodeURIComponent(t)}/integrations`,{method:"POST",body:JSON.stringify(e)})}removeIntegrationLease(t,e){return this.request(`/${encodeURIComponent(t)}/integrations`,{method:"DELETE",body:JSON.stringify({leaseId:e})})}async request(t,e={}){let n=await X(this.sandboxApiUrl,this.apiKey,t,this.customEndpoint?{...e,explicitBearerAuth:!0,redirect:"error"}:e);return me(n,"Sandbox request")}async requestApiRoot(t,e={}){let n=await X(this.apiRootUrl,this.apiKey,t,this.customEndpoint?{...e,explicitBearerAuth:!0,redirect:"error"}:e);return me(n,"OpenPond API request")}},xn=class extends wn{static{d(this,"OpenPondSandboxClient")}runtimes=an(this);sandboxes=sn(this);profile=cn(this);projects=dn(this);agents=un(this);list(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),this.request(e.size>0?`?${e.toString()}`:"").then(n=>n.sandboxes)}listSecrets(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets${e.size>0?`?${e.toString()}`:""}`).then(n=>n.secrets)}getSecret(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`).then(r=>r.secret)}createSecret(t){return this.requestApiRoot("/sandbox-secrets",{method:"POST",body:JSON.stringify(t)}).then(e=>e.secret)}rotateSecret(t,e){let n=new URLSearchParams;e.teamId&&n.set("teamId",e.teamId);let{teamId:r,...o}=e;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}/rotate${n.size>0?`?${n.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)}).then(s=>s.secret)}attachSecret(t,e){let n=new URLSearchParams;e.teamId&&n.set("teamId",e.teamId);let{teamId:r,...o}=e;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}/attach${n.size>0?`?${n.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)}).then(s=>s.secret)}revokeSecret(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}/revoke${n.size>0?`?${n.toString()}`:""}`,{method:"POST"}).then(r=>r.secret)}deleteSecret(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`,{method:"DELETE"}).then(r=>r.secret)}snapshotCatalog(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),t.q&&e.set("q",t.q),t.kind&&e.set("kind",t.kind),t.replayState&&e.set("replayState",t.replayState),t.visibility&&e.set("visibility",t.visibility),t.tag&&e.set("tag",t.tag),t.useCase&&e.set("useCase",t.useCase),t.limit&&e.set("limit",String(t.limit)),this.request(`/catalog/snapshots${e.size>0?`?${e.toString()}`:""}`)}listSandboxRuntimes(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),this.requestApiRoot(`/runtimes${e.size>0?`?${e.toString()}`:""}`).then(n=>n.runtimes)}listProjects(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects?${e.toString()}`).then(n=>n.projects)}upsertProject(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects?${e.toString()}`,{method:"POST",body:JSON.stringify(t)}).then(n=>n.project)}getHostedProfile(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/profile?${e.toString()}`).then(n=>n.profile)}ensureHostedProfile(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/profile/ensure?${e.toString()}`,{method:"POST"}).then(n=>{if(!n.profile)throw new Error("hosted_profile_missing");return n.profile})}pushHostedProfile(t){let e=new URLSearchParams({teamId:t.teamId}),{teamId:n,...r}=t;return this.requestApiRoot(`/profile/push?${e.toString()}`,{method:"POST",body:JSON.stringify(r)})}async upsertProjectGitRemote(t){let e=await this.upsertProject(t);return this.ensureProjectGitRemote(e.id,{teamId:t.teamId})}getProject(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}?${n.toString()}`).then(r=>r.project)}syncProject(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}/sync?${n.toString()}`,{method:"POST"}).then(r=>r.project)}ensureProjectGitRemote(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}/git?${n.toString()}`,{method:"POST"})}uploadProjectSource(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/projects/${encodeURIComponent(t)}/source?${n.toString()}`,{method:"POST",body:JSON.stringify(o)}).then(s=>s.project)}updateProject(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/projects/${encodeURIComponent(t)}?${n.toString()}`,{method:"PATCH",body:JSON.stringify(o)}).then(s=>s.project)}archiveProject(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(t)}?${n.toString()}`,{method:"DELETE"}).then(r=>r.project)}listAgents(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents?${e.toString()}`).then(n=>n.agents)}upsertAgent(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents?${e.toString()}`,{method:"POST",body:JSON.stringify(t)}).then(n=>n.agent)}getAgent(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(t)}?${n.toString()}`).then(r=>r.agent)}archiveAgent(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(t)}?${n.toString()}`,{method:"DELETE"}).then(r=>r.agent)}updateAgent(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}?${n.toString()}`,{method:"PATCH",body:JSON.stringify(o)}).then(s=>s.agent)}runAgent(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/run?${n.toString()}`,{method:"POST",headers:{Prefer:"respond-async"},body:JSON.stringify(o)})}getAgentSourceDeployPlan(t,e){let n=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/deploy-plan?${n.toString()}`).then(r=>r.deployPlan)}listAgentManifestSnapshots(t,e){let n=new URLSearchParams({teamId:e.teamId});return e.limit!==void 0&&n.set("limit",String(e.limit)),this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/manifest-snapshots?${n.toString()}`).then(r=>r.manifestSnapshots)}requestAgentSourceChecks(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/checks?${n.toString()}`,{method:"POST",body:JSON.stringify(o),timeoutMs:900*1e3})}configureAgentSourceSetup(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/setup?${n.toString()}`,{method:"POST",body:JSON.stringify(o)})}publishAgentSource(t,e){let n=new URLSearchParams({teamId:e.teamId}),{teamId:r,...o}=e;return this.requestApiRoot(`/agents/${encodeURIComponent(t)}/source/publish?${n.toString()}`,{method:"POST",body:JSON.stringify(o)})}getMicrosoftTeamsBotOverview(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/teams/bot/overview?${e.toString()}`)}bindMicrosoftTeamsBotConversation(t){return this.requestApiRoot("/teams/bot/bindings",{method:"POST",body:JSON.stringify(t)})}rebindMicrosoftTeamsBotConversation(t,e){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)})}unlinkMicrosoftTeamsBotConversation(t){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(t.bindingId)}`,{method:"DELETE",body:JSON.stringify({teamId:t.teamId})})}sendMicrosoftTeamsBotDiagnostic(t){return this.requestApiRoot("/teams/bot/diagnostics",{method:"POST",body:JSON.stringify(t)})}sendMicrosoftTeamsBotDiagnosticRun(t){return this.requestApiRoot("/teams/bot/diagnostics/run",{method:"POST",body:JSON.stringify(t)})}createSandboxRuntime(t){return this.requestApiRoot("/runtimes",{method:"POST",body:JSON.stringify(t)}).then(e=>e.runtime)}sandboxRuntime(t,e=null){return pn(this,t,e)}getSandboxRuntime(t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}`).then(e=>e.runtime)}createSandboxRuntimeSandbox(t,e={},n={}){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/sandbox`,{method:"POST",headers:M(n),body:JSON.stringify(e)})}updateSandboxRuntimeStatus(t,e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/status`,{method:"PATCH",body:JSON.stringify(e)}).then(n=>n.runtime)}listSandboxRuntimeEvents(t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/events`)}emitSandboxRuntimeEvent(t,e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/events`,{method:"POST",body:JSON.stringify(e)})}checkpointSandboxRuntime(t,e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/checkpoints`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.runtime)}promoteSandboxRuntime(t,e,n={}){let r=new URLSearchParams;return n.teamId&&r.set("teamId",n.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/promote${r.size>0?`?${r.toString()}`:""}`,{method:"POST",body:JSON.stringify(e)})}preserveSandboxRuntimeSource(t,e={},n={}){let r=new URLSearchParams;return n.teamId&&r.set("teamId",n.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(t)}/preserve-source${r.size>0?`?${r.toString()}`:""}`,{method:"POST",body:JSON.stringify(e)})}forkSnapshot(t,e={},n={}){let r=new URLSearchParams;e.teamId&&r.set("teamId",e.teamId),e.projectId&&r.set("projectId",e.projectId),n.async&&r.set("async","1");let{teamId:o,projectId:s,...i}=e;return this.request(`/catalog/snapshots/${encodeURIComponent(t)}/fork${r.size>0?`?${r.toString()}`:""}`,{method:"POST",headers:n.async?{Prefer:"respond-async"}:void 0,body:JSON.stringify({...i,snapshotId:t})})}templates(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.q&&e.set("q",t.q),t.name&&e.set("name",t.name),t.version&&e.set("version",t.version),t.visibility&&e.set("visibility",t.visibility),t.tag&&e.set("tag",t.tag),t.useCase&&e.set("useCase",t.useCase),t.limit&&e.set("limit",String(t.limit)),this.request(`/templates${e.size>0?`?${e.toString()}`:""}`)}publishedSnapshots(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.q&&e.set("q",t.q),t.name&&e.set("name",t.name),t.version&&e.set("version",t.version),t.visibility&&e.set("visibility",t.visibility),t.tag&&e.set("tag",t.tag),t.useCase&&e.set("useCase",t.useCase),t.limit&&e.set("limit",String(t.limit)),this.request(`/published-snapshots${e.size>0?`?${e.toString()}`:""}`).then(n=>{let r=n.publishedSnapshots??n.templates;return{...n,templates:r,publishedSnapshots:r}})}launchTemplate(t){let e=new URLSearchParams;t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId);let{teamId:n,projectId:r,...o}=t;return this.request(`/templates/launch${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)})}runPublishedSnapshot(t){let e=new URLSearchParams;t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId);let{teamId:n,projectId:r,...o}=t;return this.request(`/published-snapshots/launch${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)}).then(s=>{let i=s.publishedSnapshot??s.template;return{...s,template:i,publishedSnapshot:i}})}listSchedules(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.sourceSandboxId&&e.set("sourceSandboxId",t.sourceSandboxId),this.request(`/schedules${e.size>0?`?${e.toString()}`:""}`)}createSchedule(t){let e=new URLSearchParams;t.projectId&&e.set("projectId",t.projectId);let{projectId:n,...r}=t;return this.request(`/schedules${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(r)})}getSchedule(t){return this.request(`/schedules/${encodeURIComponent(t)}`)}updateSchedule(t,e){return this.request(`/schedules/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)})}deleteSchedule(t){return this.request(`/schedules/${encodeURIComponent(t)}`,{method:"DELETE"})}listScheduleRuns(t,e={}){let n=new URLSearchParams;return e.limit!==void 0&&n.set("limit",String(e.limit)),this.request(`/schedules/${encodeURIComponent(t)}/runs${n.size>0?`?${n.toString()}`:""}`)}runScheduleNow(t,e={}){return this.request(`/schedules/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(e)})}listTemplateBuilds(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/sandbox-template-builds?${e.toString()}`).then(n=>n.builds)}createTemplateBuild(t){return this.requestApiRoot("/sandbox-template-builds",{method:"POST",body:JSON.stringify(t)}).then(e=>e.build)}getTemplateBuild(t){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(t)}`).then(e=>e.build)}getTemplateBuildLogs(t){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(t)}/logs`)}cancelTemplateBuild(t){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(t)}/cancel`,{method:"POST"}).then(e=>e.build)}listPublishedSnapshotBuilds(t){let e=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/published-snapshot-builds?${e.toString()}`).then(n=>n.builds)}createPublishedSnapshotBuild(t){return this.requestApiRoot("/published-snapshot-builds",{method:"POST",body:JSON.stringify(t)}).then(e=>e.build)}getPublishedSnapshotBuild(t){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(t)}`).then(e=>e.build)}getPublishedSnapshotBuildLogs(t){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(t)}/logs`)}cancelPublishedSnapshotBuild(t){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(t)}/cancel`,{method:"POST"}).then(e=>e.build)}listOrganizations(){return this.requestApiRoot("/organizations").then(t=>t.organizations??t.teams??[])}createOrganization(t){return this.requestApiRoot("/organizations",{method:"POST",body:JSON.stringify(t)}).then(e=>e.organization)}getOrganization(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}`).then(e=>e.organization)}updateOrganization(t,e){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)}).then(n=>n.organization)}listOrganizationMembers(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/members`).then(e=>e.members)}upsertOrganizationMember(t,e){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/members`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.member)}getOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server`).then(e=>e.mcpServer)}generateOrganizationMcpServer(t,e={}){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.mcpServer)}rotateOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server/rotate`,{method:"POST"}).then(e=>e.mcpServer)}disableOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server/disable`,{method:"POST"}).then(e=>e.mcpServer)}enableOrganizationMcpServer(t){return this.requestApiRoot(`/organizations/${encodeURIComponent(t)}/mcp-server/enable`,{method:"POST"}).then(e=>e.mcpServer)}startReplay(t){let e=new URLSearchParams;t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId);let{teamId:n,projectId:r,...o}=t;return this.requestApiRoot(`/sandbox-replays${e.size>0?`?${e.toString()}`:""}`,{method:"POST",body:JSON.stringify(o)})}listReplays(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays${e.size>0?`?${e.toString()}`:""}`)}getReplay(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}${n.size>0?`?${n.toString()}`:""}`)}getReplayLogs(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}/logs${n.size>0?`?${n.toString()}`:""}`)}getReplayArtifacts(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}/artifacts${n.size>0?`?${n.toString()}`:""}`)}cancelReplay(t,e={}){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(t)}/cancel${n.size>0?`?${n.toString()}`:""}`,{method:"POST"})}integrationConnections(t={}){let e=new URLSearchParams;return t.teamId&&e.set("teamId",t.teamId),t.projectId&&e.set("projectId",t.projectId),t.agentId&&e.set("agentId",t.agentId),t.status&&e.set("status",t.status),this.requestApiRoot(`/integrations/connections${e.size>0?`?${e.toString()}`:""}`)}mcpServerConfig(){return{name:"openpond-sandboxes",transport:"streamable-http",url:`${this.sandboxApiUrl}/mcp`,headers:{"openpond-api-key":this.apiKey}}}smoke(t={}){return ln(this,t)}};function Y(t){return new xn(t)}d(Y,"createOpenPondSandboxClient");var Br=a.object({choices:a.array(a.object({message:a.object({content:a.string().nullable().optional(),tool_calls:a.array(a.object({id:a.string().min(1),type:a.literal("function"),function:a.object({name:a.string().min(1),arguments:a.string()})})).optional()})})).min(1)});var Nr=100*1024*1024;var Fr=Object.freeze({".avif":"image/avif",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".gif":"image/gif",".html":"text/html",".jpeg":"image/jpeg",".jpg":"image/jpeg",".json":"application/json",".m4a":"audio/mp4",".md":"text/markdown",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".pdf":"application/pdf",".png":"image/png",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".svg":"image/svg+xml",".tsv":"text/tab-separated-values",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".webp":"image/webp",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});function $(t){let e=t?.trim();return e?e.replace(/\/$/,""):null}d($,"normalizeOptionalUrl");function m(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}d(m,"asRecord");var et=["workspacePurpose","purpose"];function tt(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e={...t};for(let n of et)delete e[n];return e}d(tt,"sanitizeCreateMetadata");function vn(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e={...t};for(let r of et)delete e[r];let n=tt(e.metadata);return n?e.metadata=n:delete e.metadata,e}d(vn,"sanitizeSandboxRuntimeInput");function Z(t){let e=m(t);if(e.sandboxRuntime)throw new Error("Sandbox runtime settings must use /v1/runtimes before materializing a sandbox.");let n={};typeof e.repo=="string"&&e.repo.trim()&&(n.repo=e.repo.trim()),typeof e.teamId=="string"&&e.teamId.trim()&&(n.teamId=e.teamId.trim()),typeof e.projectId=="string"&&e.projectId.trim()&&(n.projectId=e.projectId.trim()),typeof e.agentId=="string"&&e.agentId.trim()&&(n.agentId=e.agentId.trim()),typeof e.command=="string"&&e.command.trim()&&(n.command=e.command.trim()),typeof e.runtimeProfileId=="string"&&e.runtimeProfileId.trim()&&(n.runtimeProfileId=e.runtimeProfileId.trim()),e.workloadSource&&typeof e.workloadSource=="object"&&!Array.isArray(e.workloadSource)&&(n.workloadSource=e.workloadSource),e.sourceArchive&&typeof e.sourceArchive=="object"&&!Array.isArray(e.sourceArchive)&&(n.sourceArchive=e.sourceArchive),(e.visibility==="private"||e.visibility==="team")&&(n.visibility=e.visibility),e.resources&&typeof e.resources=="object"&&!Array.isArray(e.resources)&&(n.resources=e.resources),e.budget&&typeof e.budget=="object"&&!Array.isArray(e.budget)&&(n.budget=e.budget),"env"in e&&(n.env=ve(e.env)),e.networkPolicy&&typeof e.networkPolicy=="object"&&!Array.isArray(e.networkPolicy)&&(n.networkPolicy=e.networkPolicy),e.quotas&&typeof e.quotas=="object"&&!Array.isArray(e.quotas)&&(n.quotas=e.quotas),Array.isArray(e.volumes)&&(n.volumes=e.volumes),"integrationLeases"in e&&(n.integrationLeases=ot(e.integrationLeases)),Array.isArray(e.integrationConnectionLeases)&&(n.integrationConnectionLeases=e.integrationConnectionLeases);let r=tt(e.metadata);return r&&(n.metadata=r),n}d(Z,"normalizeCreateInput");function be(t){let e=m(t),n=vn(e)??{},r={};return typeof n.teamId=="string"&&n.teamId.trim()&&(r.teamId=n.teamId.trim()),typeof n.projectId=="string"&&n.projectId.trim()&&(r.projectId=n.projectId.trim()),typeof n.agentId=="string"&&n.agentId.trim()&&(r.agentId=n.agentId.trim()),typeof n.workflowMode=="string"&&n.workflowMode.trim()?r.workflowMode=n.workflowMode.trim():typeof n.mode=="string"&&n.mode.trim()&&(r.workflowMode=n.mode.trim()),typeof n.baseBranch=="string"&&n.baseBranch.trim()&&(r.baseBranch=n.baseBranch.trim()),typeof n.baseSha=="string"&&n.baseSha.trim()&&(r.baseSha=n.baseSha.trim()),typeof n.sandboxId=="string"&&n.sandboxId.trim()&&(r.sandboxId=n.sandboxId.trim()),typeof n.rootfsSnapshotId=="string"&&n.rootfsSnapshotId.trim()&&(r.rootfsSnapshotId=n.rootfsSnapshotId.trim()),typeof n.dependencySnapshotId=="string"&&n.dependencySnapshotId.trim()&&(r.dependencySnapshotId=n.dependencySnapshotId.trim()),typeof n.runtimeProfileId=="string"&&n.runtimeProfileId.trim()&&(r.runtimeProfileId=n.runtimeProfileId.trim()),typeof n.promotionPolicy=="string"&&n.promotionPolicy.trim()&&(r.promotionPolicy=n.promotionPolicy.trim()),n.metadata&&typeof n.metadata=="object"&&!Array.isArray(n.metadata)&&(r.metadata=n.metadata),r}d(be,"normalizeSandboxRuntimeCreateInput");function Q(t){return Z(t)}d(Q,"normalizeSandboxRuntimeSandboxCreateInput");function nt(t){return m(t)}d(nt,"normalizeSnapshotCreateInput");function y(t){let e=m(t),n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",o=typeof e.agentId=="string"?e.agentId.trim():"";return{...n?{teamId:n}:{},...r?{projectId:r}:{},...o?{agentId:o}:{}}}d(y,"normalizeSandboxListInput");function rt(t){let e=m(t),n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",{teamId:o,projectId:s,appId:i,...u}=e,c=u;return n&&(c.teamId=n),r&&(c.projectId=r),c}d(rt,"normalizeReplayStartInput");function Ie(t){if(t==="active"||t==="revoked"||t==="error"||t==="all")return t}d(Ie,"normalizeIntegrationStatusFilter");function Se(t){let e=m(t),n=typeof e.connectionId=="string"?e.connectionId.trim():"";if(!n)throw new Error("Sandbox integration connection is required.");let r=st(e.capabilities);if(r.length===0)throw new Error("Sandbox integration capabilities are required.");at(e.provider,r);let o=it(e.scopes,"Sandbox integration scopes"),s=dt(e.expiresAt),i=En(e.ttlSeconds),u=ct(e.resourcePolicy);return{connectionId:n,capabilities:r,...o.length>0?{scopes:o}:{},...u?{resourcePolicy:u}:{},...s?{expiresAt:s}:{},...i!==void 0?{ttlSeconds:i}:{},...typeof e.required=="boolean"?{required:e.required}:{}}}d(Se,"normalizeIntegrationAttachInput");function ot(t){if(t==null)return[];if(!Array.isArray(t))throw new Error("Sandbox integration leases must be an array.");return t.map(e=>Rn(e))}d(ot,"normalizeIntegrationLeaseRefsForRuntime");function Rn(t){let e=m(t),n=typeof e.leaseId=="string"?e.leaseId.trim():"";if(!n)throw new Error("Sandbox integration leaseId is required.");if("connectionId"in e)throw new Error("Sandbox integration leases must use leaseId/proxy refs, not connection ids.");Pn(e);let r=Cn(e.provider),o=st(e.capabilities);if(o.length===0)throw new Error("Sandbox integration lease capabilities are required.");at(r,o);let s=it(e.scopes,"Sandbox integration lease scopes"),i=ct(e.resourcePolicy),u=dt(e.expiresAt),c=typeof e.proxyUrl=="string"?e.proxyUrl.trim():"";return{leaseId:n,provider:r,capabilities:o,...s.length>0?{scopes:s}:{},...i?{resourcePolicy:i}:{},...u?{expiresAt:u}:{},...c?{proxyUrl:c}:{},...typeof e.required=="boolean"?{required:e.required}:{}}}d(Rn,"normalizeIntegrationLeaseRefForRuntime");function Cn(t){if(typeof t!="string")throw new Error("Sandbox integration lease provider is required.");let e=se(t);if(!e)throw new Error(`Sandbox integration provider is not supported: ${t}`);if(!ae(e)?.leasePolicy.leaseable)throw new Error(`Sandbox integration provider is not leaseable: ${e}`);return e}d(Cn,"normalizeLeaseableIntegrationProvider");function Pn(t){for(let e of Object.keys(t))if(ut(e))throw new Error("Sandbox integration leases must not include secrets or credentials.")}d(Pn,"assertNoSensitiveIntegrationLeaseKeys");function at(t,e){if(t==null||t==="")return;if(typeof t!="string")throw new Error("Sandbox integration provider must be a string.");let n=se(t);if(!n)throw new Error(`Sandbox integration provider is not supported: ${t}`);let r=ae(n);if(!r?.leasePolicy.leaseable)throw new Error(`Sandbox integration provider is not leaseable: ${n}`);let o=new Set(r.leasePolicy.allowedCapabilityIds),s=e.filter(i=>!o.has(i));if(s.length>0)throw new Error(`Sandbox integration capabilities are not allowed for ${n}: ${s.join(", ")}`)}d(at,"validateIntegrationCapabilitiesForProvider");function we(t){let e=m(t),n=typeof e.leaseId=="string"?e.leaseId.trim():"";if(!n)throw new Error("Sandbox integration lease is required.");return n}d(we,"normalizeIntegrationLeaseId");function st(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e.trim():"").filter(Boolean):[]}d(st,"normalizeStringArray");function it(t,e){if(t==null)return[];if(!Array.isArray(t))throw new Error(`${e} must be an array of strings.`);return t.map(n=>{if(typeof n!="string")throw new Error(`${e} must contain only strings.`);let r=n.trim();if(!r)throw new Error(`${e} must not contain empty values.`);return r})}d(it,"normalizeOptionalStringArray");function En(t){if(t==null||t==="")return;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw new Error("Sandbox integration ttlSeconds must be a positive number.");return Math.max(1,Math.floor(e))}d(En,"normalizeIntegrationTtlSeconds");function dt(t){if(t==null||t==="")return;if(typeof t!="string")throw new Error("Sandbox integration expiresAt must be an ISO timestamp string.");let e=t.trim();if(!e)return;let n=Date.parse(e);if(!Number.isFinite(n))throw new Error("Sandbox integration expiresAt must be a valid ISO timestamp.");return e}d(dt,"normalizeIntegrationExpiresAt");function ct(t){if(t==null)return;if(typeof t!="object"||Array.isArray(t))throw new Error("Sandbox integration resourcePolicy must be an object.");if(ge(t,[]),JSON.stringify(t).length>16*1024)throw new Error("Sandbox integration resourcePolicy is too large.");return t}d(ct,"normalizeIntegrationResourcePolicy");function ge(t,e){if(!(!t||typeof t!="object")){if(e.length>8)throw new Error("Sandbox integration resourcePolicy is too deeply nested.");if(Array.isArray(t)){for(let n of t)ge(n,e);return}for(let[n,r]of Object.entries(t)){if(ut(n))throw new Error("Sandbox integration resourcePolicy must not include secrets or credentials.");ge(r,[...e,n])}}}d(ge,"assertNoSensitiveResourcePolicyKeys");function ut(t){let e=t.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("accesstoken")||e.includes("refreshtoken")||e.includes("idtoken")||e.includes("oauth")||e.includes("bearer")||e.includes("authorization")||e.includes("cookie")||e.includes("secret")||e.includes("password")||e.includes("credential")}d(ut,"isSensitivePolicyKey");function pt(t){let e=m(t),n=typeof e.command=="string"?e.command.trim():"";if(!n)throw new Error("Sandbox command is required.");let r=typeof e.timeoutSeconds=="number"&&Number.isFinite(e.timeoutSeconds)?Math.max(1,Math.floor(e.timeoutSeconds)):void 0,o=Ne(n);return r?{command:o,timeoutSeconds:r}:{command:o}}d(pt,"normalizeExecInput");function mt(t){let e=m(t),n=typeof e.command=="string"?e.command.trim():"";if(!n)throw new Error("Sandbox process command is required.");let r=typeof e.timeoutSeconds=="number"&&Number.isFinite(e.timeoutSeconds)?Math.max(1,Math.floor(e.timeoutSeconds)):void 0;return r?{command:n,timeoutSeconds:r}:{command:n}}d(mt,"normalizeProcessStartInput");function lt(t){let e=m(t),n=Number(e.since);return Number.isFinite(n)?{since:Math.max(0,Math.floor(n))}:{}}d(lt,"normalizeProcessCursorInput");function ht(t){let e=m(t),n=typeof e.port=="number"?e.port:Number(e.port);if(!Number.isInteger(n)||n<re||n>oe)throw new Error(`Sandbox preview port must be between ${re} and ${oe}.`);let r=typeof e.label=="string"&&e.label.trim()?e.label.trim():void 0,o=e.access==="public"||e.access==="private"?e.access:void 0,s=e.autoStart===!0,i=typeof e.customDomain=="string"&&e.customDomain.trim()?e.customDomain.trim():void 0,u={port:n,...r?{label:r}:{},...o?{access:o}:{},...s?{autoStart:s}:{},...i?{customDomain:i}:{}};return e.cors&&typeof e.cors=="object"&&!Array.isArray(e.cors)&&(u.cors=e.cors),e.headerPolicy&&typeof e.headerPolicy=="object"&&!Array.isArray(e.headerPolicy)&&(u.headerPolicy=e.headerPolicy),e.authPolicy&&typeof e.authPolicy=="object"&&!Array.isArray(e.authPolicy)&&(u.authPolicy=e.authPolicy),u}d(ht,"normalizeOpenPortInput");function ft(t){let e=m(t),n={};if(e.template&&typeof e.template=="object"&&!Array.isArray(e.template)){let r=m(e.template),o={};typeof r.description=="string"?o.description=r.description.trim():r.description===null&&(o.description=null),Array.isArray(r.tags)&&(o.tags=r.tags.map(s=>typeof s=="string"?s.trim():"").filter(Boolean).slice(0,20)),(r.visibility==="private"||r.visibility==="team")&&(o.visibility=r.visibility),typeof r.useCase=="string"?o.useCase=r.useCase.trim():r.useCase===null&&(o.useCase=null),Object.keys(o).length>0&&(n.template=o)}if(e.retention&&typeof e.retention=="object"&&!Array.isArray(e.retention)){let r=m(e.retention),o={};(r.class==="ephemeral"||r.class==="cached"||r.class==="pinned")&&(o.class=r.class),r.ttlSeconds===null?o.ttlSeconds=null:typeof r.ttlSeconds=="number"&&Number.isFinite(r.ttlSeconds)&&(o.ttlSeconds=Math.max(1,Math.floor(r.ttlSeconds))),Object.keys(o).length>0&&(n.retention=o)}if(!n.template&&!n.retention)throw new Error("Snapshot update requires template or retention changes.");return n}d(ft,"normalizeSnapshotUpdateInput");function yt(t){let e=m(t),n=typeof e.cleanup=="string"?e.cleanup.trim():"";return n==="delete"||n==="stop"||n==="archive"?{cleanup:n}:{}}d(yt,"normalizeSnapshotValidateInput");function xe(t){let e=m(t),n={};return typeof e.snapshotId=="string"&&e.snapshotId.trim()&&(n.snapshotId=e.snapshotId.trim()),(e.visibility==="private"||e.visibility==="team")&&(n.visibility=e.visibility),e.resources&&typeof e.resources=="object"&&!Array.isArray(e.resources)&&(n.resources=e.resources),e.budget&&typeof e.budget=="object"&&!Array.isArray(e.budget)&&(n.budget=e.budget),e.networkPolicy&&typeof e.networkPolicy=="object"&&!Array.isArray(e.networkPolicy)&&(n.networkPolicy=e.networkPolicy),e.quotas&&typeof e.quotas=="object"&&!Array.isArray(e.quotas)&&(n.quotas=e.quotas),Array.isArray(e.volumes)&&(n.volumes=e.volumes),"integrationLeases"in e&&(n.integrationLeases=ot(e.integrationLeases)),"env"in e&&(n.env=ve(e.env)),e.metadata&&typeof e.metadata=="object"&&!Array.isArray(e.metadata)&&(n.metadata=e.metadata),n}d(xe,"normalizeForkInput");function ve(t){if(t==null)return[];if(!Array.isArray(t))throw new Error("Sandbox env must be an array.");return t.map(e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Sandbox env entries must be objects.");let n=e;if("value"in n)throw new Error("Sandbox env entries must use secretRef, not inline values.");let r=typeof n.name=="string"?n.name.trim():"",o=typeof n.secretRef=="string"?n.secretRef.trim():"";if(!r||!o)throw new Error("Sandbox env entries require name and secretRef.");return{name:r,secretRef:o}})}d(ve,"normalizeSandboxEnvRefsForApp");function gt(t){let e=m(t),n=typeof e.teamId=="string"?e.teamId.trim():"",r=typeof e.projectId=="string"?e.projectId.trim():"",o=typeof e.snapshotId=="string"?e.snapshotId.trim():"",s=typeof e.templateName=="string"?e.templateName.trim():"",i=typeof e.version=="string"?e.version.trim():"",u=typeof e.useCase=="string"?e.useCase.trim():"";if(!o&&!s&&!u)throw new Error("Sandbox template launch requires snapshotId, templateName, or useCase.");return{...xe(t),...n?{teamId:n}:{},...r?{projectId:r}:{},...o?{snapshotId:o}:{},...s?{templateName:s}:{},...i?{version:i}:{},...u?{useCase:u}:{}}}d(gt,"normalizeTemplateLaunchInput");function bt(t){let e=m(t),n=typeof e.path=="string"?e.path.trim():"",r=Number(e.maxEntries);return{...n?{path:n}:{},...typeof e.recursive=="boolean"?{recursive:e.recursive}:{},...Number.isFinite(r)?{maxEntries:r}:{}}}d(bt,"normalizeListFilesInput");function It(t){let e=m(t),n=typeof e.query=="string"?e.query.trim():"";if(!n)throw new Error("Sandbox file search query is required.");let r=typeof e.path=="string"?e.path.trim():"",o=Number(e.maxResults);return{query:n,...r?{path:r}:{},...Number.isFinite(o)?{maxResults:o}:{}}}d(It,"normalizeSearchFilesInput");function D(t){let e=m(t),n=typeof e.path=="string"?e.path.trim():"";if(!n)throw new Error("Sandbox file path is required.");return{path:n,recursive:typeof e.recursive=="boolean"?e.recursive:void 0}}d(D,"normalizeDeleteFileInput");function St(t){let e=D(t),n=m(t),r=Number(n.offsetBytes),o=Number(n.maxBytes);return{path:e.path,...Number.isFinite(r)?{offsetBytes:r}:{},...Number.isFinite(o)?{maxBytes:o}:{}}}d(St,"normalizeDownloadFileInput");function wt(t){let e=m(t),n=typeof e.path=="string"?e.path.trim():"",r=typeof e.contents=="string"?e.contents:"",o=typeof e.contentsBase64=="string"?e.contentsBase64.trim():"";if(!n)throw new Error("Sandbox file path is required.");if(!r&&!o)throw new Error("Sandbox file contents are required.");return{path:n,contents:r,contentsBase64:o}}d(wt,"normalizeUploadFileInput");function xt(t){let e=m(t),n=typeof e.fromPath=="string"?e.fromPath.trim():"",r=typeof e.toPath=="string"?e.toPath.trim():"";if(!n||!r)throw new Error("Sandbox file source and target paths are required.");return{fromPath:n,toPath:r,overwrite:typeof e.overwrite=="boolean"?e.overwrite:void 0}}d(xt,"normalizeMoveFileInput");function vt(t){let e=m(t),n=typeof e.branch=="string"?e.branch.trim():"",r=typeof e.startPoint=="string"?e.startPoint.trim():"";if(!n)throw new Error("Sandbox git branch name is required.");return{branch:n,create:e.create===!0,...r?{startPoint:r}:{}}}d(vt,"normalizeGitBranchInput");function Rt(t){let e=m(t),n=typeof e.message=="string"?e.message.trim():"",r=e.all===!0,o=Array.isArray(e.paths)?e.paths.filter(s=>typeof s=="string"&&s.trim()!==""):[];if(!n)throw new Error("Sandbox git commit message is required.");if(!r&&o.length===0)throw new Error("Sandbox git commit requires all=true or at least one path.");return{message:n,...r?{all:!0}:{paths:o.map(s=>s.trim())}}}d(Rt,"normalizeGitCommitInput");function Ct(t){let e=m(t),n=typeof e.remote=="string"?e.remote.trim():"",r=typeof e.branch=="string"?e.branch.trim():"",o=e.rebase===!0,s=typeof e.ffOnly=="boolean"?e.ffOnly:void 0;if(o&&s)throw new Error("Sandbox git pull cannot use rebase and ff-only together.");return{...n?{remote:n}:{},...r?{branch:r}:{},...o?{rebase:o}:{},...typeof s=="boolean"?{ffOnly:s}:{}}}d(Ct,"normalizeGitPullInput");function Pt(t){let e=m(t),n=typeof e.remote=="string"?e.remote.trim():"",r=typeof e.branch=="string"?e.branch.trim():"";return{...n?{remote:n}:{},...r?{branch:r}:{},...e.setUpstream===!0?{setUpstream:!0}:{},...e.forceWithLease===!0?{forceWithLease:!0}:{}}}d(Pt,"normalizeGitPushInput");async function ro(){return(await te()).client}d(ro,"resolveOpenPondSandboxClient");var An="https://api.openpond.ai";async function oo(t){let{client:e,context:n,apiKey:r,sandboxApiUrl:o}=await te(),s=zn(n,o);if(t.type==="list")return{sandboxes:await e.list(y(t.payload)),account:s};if(t.type==="snapshot_catalog"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.agentId=="string"?i.agentId.trim():"",b=typeof i.q=="string"?i.q.trim():"",l=typeof i.tag=="string"?i.tag.trim():"",g=typeof i.useCase=="string"?i.useCase.trim():"",P=i.replayState==="draft"||i.replayState==="validated"||i.replayState==="published"?i.replayState:void 0;return{...await e.snapshotCatalog({...u?{teamId:u}:{},...c?{projectId:c}:{},...p?{agentId:p}:{},...b?{q:b}:{},...l?{tag:l}:{},...g?{useCase:g}:{},...P?{replayState:P}:{}}),account:s}}if(t.type==="snapshot_create")return{...await e.createSnapshot(t.sandboxId,nt(t.payload)),account:s};if(t.type==="template_catalog"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.q=="string"?i.q.trim():"",b=typeof i.name=="string"?i.name.trim():"",l=typeof i.version=="string"?i.version.trim():"",g=typeof i.tag=="string"?i.tag.trim():"",P=typeof i.useCase=="string"?i.useCase.trim():"";return{...await e.templates({...u?{teamId:u}:{},...c?{projectId:c}:{},...p?{q:p}:{},...b?{name:b}:{},...l?{version:l}:{},...g?{tag:g}:{},...P?{useCase:P}:{}}),account:s}}if(t.type==="integration_connections"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.agentId=="string"?i.agentId.trim():"",b=Ie(i.status),l={...c?{projectId:c}:{},...p?{agentId:p}:{},status:b??"all"};return{...u?await e.integrationConnections({teamId:u,...l}):await Re(e,l),account:s}}if(t.type==="connected_app_status"){let i=m(t.payload),u=typeof i.teamId=="string"?i.teamId.trim():"",c=typeof i.projectId=="string"?i.projectId.trim():"",p=typeof i.agentId=="string"?i.agentId.trim():"",b=Ie(i.status)??"all",l={...c?{projectId:c}:{},...p?{agentId:p}:{},status:b},g=u?await e.integrationConnections({teamId:u,...l}):await Re(e,l);return{teamId:g.teamId,apps:Pe({connections:g.connections}),account:s}}if(t.type==="sandbox_runtime_list")return{runtimes:await e.listSandboxRuntimes(y(t.payload)),account:s};if(t.type==="sandbox_runtime_get")return{runtime:await e.getSandboxRuntime(t.runtimeId),account:s};if(t.type==="sandbox_runtime_create")return{runtime:await e.createSandboxRuntime(be(t.payload)),account:s};if(t.type==="sandbox_runtime_sandbox_create")return{...await e.createSandboxRuntimeSandbox(t.runtimeId,Q(t.payload),{respondAsync:!0}),account:s};if(t.type==="sandbox_runtime_resume"){let i=await e.sandboxRuntime(t.runtimeId).resume(Q(t.payload),{respondAsync:!0});return{runtime:await e.getSandboxRuntime(t.runtimeId),sandbox:i,account:s}}if(t.type==="sandbox_runtime_preserve_source"){let i=m(t.payload);return{...await e.preserveSandboxRuntimeSource(t.runtimeId,{...typeof i.sandboxId=="string"&&i.sandboxId.trim()?{sandboxId:i.sandboxId.trim()}:{},...typeof i.message=="string"&&i.message.trim()?{message:i.message.trim()}:{},...i.source==="profile"?{source:"profile"}:{}},y(t.payload)),account:s}}if(t.type==="sandbox_runtime_promote"){let i=m(t.payload);return{...await e.promoteSandboxRuntime(t.runtimeId,{expectedTargetSha:typeof i.expectedTargetSha=="string"?i.expectedTargetSha.trim():"",...i.validationState==="pending"||i.validationState==="passed"?{validationState:i.validationState}:{},...typeof i.summary=="string"&&i.summary.trim()?{summary:i.summary.trim()}:{}},y(t.payload)),account:s}}if(t.type==="project_list")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/projects",y(t.payload))}),account:s};if(t.type==="profile_get")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/profile",y(t.payload))}),account:s};if(t.type==="profile_ensure")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/profile/ensure",y(t.payload)),method:"POST"}),account:s};if(t.type==="profile_push"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/profile/push",y(i)),method:"POST",body:c}),account:s}}if(t.type==="project_upsert")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/projects",y(t.payload)),method:"POST",body:m(t.payload)}),account:s};if(t.type==="project_get")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}`,y(t.payload))}),account:s};if(t.type==="project_workspace")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/workspace`,y(t.payload))}),account:s};if(t.type==="project_git")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/git`,y(t.payload)),method:"POST"}),account:s};if(t.type==="project_sync")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/sync`,y(t.payload)),method:"POST"}),account:s};if(t.type==="project_source_upload"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}/source`,y(i)),method:"POST",body:c}),account:s}}if(t.type==="project_archive")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/projects/${encodeURIComponent(t.projectId)}`,y(t.payload)),method:"DELETE"}),account:s};if(t.type==="agent_list")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/agents",y(t.payload))}),account:s};if(t.type==="agent_upsert")return{...await w({apiKey:r,sandboxApiUrl:o,path:v("/agents",y(t.payload)),method:"POST",body:m(t.payload)}),account:s};if(t.type==="agent_run")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/run`,y(t.payload)),method:"POST",body:m(t.payload)}),account:s};if(t.type==="agent_source_deploy_plan")return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/source/deploy-plan`,y(t.payload))}),account:s};if(t.type==="agent_source_checks"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/source/checks`,y(i)),method:"POST",body:c,timeoutMs:900*1e3}),account:s}}if(t.type==="agent_source_publish"){let i=m(t.payload),{teamId:u,...c}=i;return{...await w({apiKey:r,sandboxApiUrl:o,path:v(`/agents/${encodeURIComponent(t.agentId)}/source/publish`,y(i)),method:"POST",body:c}),account:s}}if(t.type==="create")return{sandbox:await e.create(Z(t.payload)),account:s};if(t.type==="get")return{sandbox:await e.get(t.sandboxId),account:s};if(t.type==="start")return{...await e.start(t.sandboxId,{respondAsync:!0}),account:s};if(t.type==="delete"){let i=await Et(e,t.sandboxId,{failOnUnpreservedChanges:t.failOnUnpreservedChanges}),u=await e.delete(t.sandboxId,i).catch(c=>kt("delete",e,t.sandboxId,c));return At("delete",u),{sandbox:u,account:s}}if(t.type==="exec")return{...await e.exec(t.sandboxId,pt(t.payload)),account:s};if(t.type==="action_run")return{...await Tn({apiKey:r,sandboxApiUrl:o,path:`/sandboxes/${encodeURIComponent(t.sandboxId)}/actions/${encodeURIComponent(t.actionName)}/run`,method:"POST",body:m(t.payload)}),account:s};if(t.type==="open_port")return{...await e.openPort(t.sandboxId,ht(t.payload)),account:s};if(t.type==="snapshot_update")return{...await e.updateSnapshot(t.sandboxId,t.snapshotId,ft(t.payload)),account:s};if(t.type==="snapshot_validate")return{...await e.validateSnapshot(t.sandboxId,t.snapshotId,yt(t.payload)),account:s};if(t.type==="snapshot_publish")return{...await e.publishSnapshot(t.sandboxId,t.snapshotId),account:s};if(t.type==="replays")return{...await e.listReplays(y(t.payload)),account:s};if(t.type==="replay_start")return{...await e.startReplay(rt(t.payload)),account:s};if(t.type==="replay_get")return{...await e.getReplay(t.replayId,y(t.payload)),account:s};if(t.type==="replay_logs")return{...await e.getReplayLogs(t.replayId,y(t.payload)),account:s};if(t.type==="replay_artifacts")return{...await e.getReplayArtifacts(t.replayId,y(t.payload)),account:s};if(t.type==="replay_cancel")return{...await e.cancelReplay(t.replayId,y(t.payload)),account:s};if(t.type==="schedule_create")return{...await e.createSchedule(m(t.payload)),account:s};if(t.type==="template_launch")return{...await e.launchTemplate(gt(t.payload)),account:s};if(t.type==="fork")return{...await e.fork(t.sandboxId,xe(t.payload)),account:s};if(t.type==="stop"){let i=await Et(e,t.sandboxId,{failOnUnpreservedChanges:t.failOnUnpreservedChanges}),u=await e.stop(t.sandboxId,i).catch(c=>kt("stop",e,t.sandboxId,c));return At("stop",u.sandbox),{...u,account:s}}if(t.type==="receipts")return{receipts:await e.receipts(t.sandboxId),account:s};if(t.type==="logs")return{logs:await e.logs(t.sandboxId),account:s};if(t.type==="integration_leases")return{...await e.integrationLeases(t.sandboxId),account:s};if(t.type==="integration_attach")return{...await e.attachIntegrationConnection(t.sandboxId,Se(t.payload)),account:s};if(t.type==="integration_remove")return{...await e.removeIntegrationLease(t.sandboxId,we(t.payload)),account:s};if(t.type==="process_start")return{...await e.startProcess(t.sandboxId,mt(t.payload)),account:s};if(t.type==="process_get")return{...await e.getProcess(t.sandboxId,t.processId,lt(t.payload)),account:s};if(t.type==="upload_file"){let i=wt(t.payload);return{...i.contentsBase64?await e.uploadFileBase64(t.sandboxId,i.path,i.contentsBase64):await e.uploadFile(t.sandboxId,i.path,i.contents),account:s}}if(t.type==="download_file"){let i=St(t.payload);return{...await e.downloadFileResponse(t.sandboxId,i),account:s}}if(t.type==="list_files")return{...await e.listFiles(t.sandboxId,bt(t.payload)),account:s};if(t.type==="search_files")return{...await e.searchFiles(t.sandboxId,It(t.payload)),account:s};if(t.type==="delete_file"){let i=D(t.payload);return{...await e.deleteFile(t.sandboxId,i.path,{recursive:i.recursive}),account:s}}if(t.type==="stat_file"){let i=D(t.payload);return{...await e.statFile(t.sandboxId,i.path),account:s}}if(t.type==="mkdir"){let i=D(t.payload);return{...await e.mkdir(t.sandboxId,{path:i.path,recursive:i.recursive}),account:s}}if(t.type==="move_file"){let i=xt(t.payload);return{...await e.moveFile(t.sandboxId,i),account:s}}if(t.type==="git_status")return{...await e.gitStatus(t.sandboxId),account:s};if(t.type==="git_diff"){let i=m(t.payload),u=typeof i.baseRef=="string"?i.baseRef.trim():"";return{...await e.gitDiff(t.sandboxId,{...u?{baseRef:u}:{}}),account:s}}if(t.type==="git_export_patch"){let i=m(t.payload),u=typeof i.baseRef=="string"?i.baseRef.trim():"";return{...await e.gitExportPatch(t.sandboxId,{...u?{baseRef:u}:{}}),account:s}}if(t.type==="git_branch")return{...await e.gitBranch(t.sandboxId,vt(t.payload)),account:s};if(t.type==="git_commit")return{...await e.gitCommit(t.sandboxId,Rt(t.payload)),account:s};if(t.type==="git_pull")return{...await e.gitPull(t.sandboxId,Ct(t.payload)),account:s};if(t.type==="git_push")return{...await e.gitPush(t.sandboxId,Pt(t.payload)),account:s};throw new Error(`Unsupported sandbox action: ${t.type}`)}d(oo,"sandboxRequestPayload");async function ao(t={}){let{client:e}=await te();return t.teamId?e.integrationConnections(t):Re(e,{...t.projectId?{projectId:t.projectId}:{},...t.agentId?{agentId:t.agentId}:{},status:t.status??"all"})}d(ao,"listSandboxIntegrationConnections");async function Et(t,e,n={}){let r=await t.get(e).then(o=>!Ut(o)).catch(()=>!0);return{failOnUnpreservedChanges:n.failOnUnpreservedChanges,...r?{respondAsync:!0}:{}}}d(Et,"sandboxLifecycleRequestOptions");function Ut(t){return t.reservation.status==="reserved"&&(t.state==="creating"||qt.has(t.state))}d(Ut,"sandboxLifecycleRequiresSynchronousAccounting");function At(t,e){if(qt.has(e.state)&&e.reservation.status==="reserved")throw new Error(`Sandbox ${t} reached ${e.state}, but reservation ${e.reservation.id} is still reserved. Cleanup accounting has not settled; retry status before treating cleanup as complete.`)}d(At,"assertTerminalSandboxLifecycleSettled");async function kt(t,e,n,r){let o=await e.get(n).catch(()=>null);if(o&&Ut(o)){let s=r instanceof Error?r.message:String(r);throw new Error(`Sandbox ${t} failed while sandbox ${n} is still creating with active reservation ${o.reservation.id}. Cleanup accounting has not settled; retry status before treating cleanup as complete. Original error: ${s}`)}throw r instanceof Error?r:new Error(String(r))}d(kt,"throwSandboxLifecycleRequestFailure");var qt=new Set(["stopped","archived","deleted","error"]);async function Re(t,e){let n=await t.listOrganizations().catch(()=>{throw new Error("Connected app status is unavailable because organizations could not be loaded.")}),r=$n(n),o=On(n)||null;if(r.length===0)return{teamId:o,connections:[]};let s=await Promise.all(r.map(u=>t.integrationConnections({teamId:u,...e.projectId?{projectId:e.projectId}:{},...e.agentId?{agentId:e.agentId}:{},status:e.status}).catch(()=>null))),i=qn(s);return{teamId:kn(i)??o??i.find(u=>u.teamId.trim())?.teamId.trim()??null,connections:Un(i)}}d(Re,"resolveImplicitConnectedAppStatusConnections");function kn(t){for(let e of t){if((e.connections?.length??0)===0)continue;let n=e.teamId?.trim();if(n)return n}return null}d(kn,"connectedAppStatusTeamIdWithConnections");function Un(t){let e=[],n=new Set;for(let r of t)for(let o of r.connections??[]){let s=o.id.trim()||[o.teamId,o.provider,o.providerAccountId].join(":");n.has(s)||(n.add(s),e.push(o))}return e}d(Un,"mergeConnectedAppStatusConnectionResults");function qn(t){let e=t.filter(o=>o!==null),n=t.length-e.length,r=e.reduce((o,s)=>o+(s.connections?.length??0),0);if(n>0&&r===0)throw new Error("Connected app status is unavailable because one or more team integration connection lookups could not be loaded.");return e}d(qn,"successfulConnectedAppStatusConnectionResults");function On(t){let e=t.filter(n=>Ot(n)==="active");return ee(e.find(n=>n.role==="owner"))??ee(e.find(n=>n.role==="admin"))??ee(e[0])??""}d(On,"selectImplicitConnectedAppStatusTeamId");function $n(t){let e=[],n=new Set;for(let r of t){if(Ot(r)!=="active")continue;let o=ee(r);!o||n.has(o)||(n.add(o),e.push(o))}return e}d($n,"implicitConnectedAppStatusTeamIds");function ee(t){if(!t)return null;let e=t.id;return(typeof t.teamId=="string"?t.teamId:typeof e=="string"?e:"").trim()||null}d(ee,"organizationTeamId");function Ot(t){return typeof t.status=="string"?t.status:"active"}d(Ot,"organizationStatus");async function te(){let t=$(process.env.OPENPOND_SANDBOX_API_URL),e=process.env.OPENPOND_SANDBOX_API_KEY?.trim();if(e&&t)return{client:Y({apiKey:e,sandboxApiUrl:t}),context:await ue().catch(()=>null),apiKey:e,sandboxApiUrl:O(t,{apiBaseUrl:t})};let n=await ue(),r=n.token?.trim();if(!r)throw new Error("OpenPond account API key is required to manage sandboxes.");if(t)return{client:Y({apiKey:r,sandboxApiUrl:t}),context:n,apiKey:r,sandboxApiUrl:O(t,{apiBaseUrl:t})};let o=Ln(n);return{client:Y({apiKey:r,baseUrl:o}),context:n,apiKey:r,sandboxApiUrl:O(o,{apiBaseUrl:o})}}d(te,"resolveSandboxClient");function jn(t){return O(t,{apiBaseUrl:t}).replace(/\/sandboxes\/?$/,"")}d(jn,"sandboxApiRootUrl");function _n(t){let e=O(t,{apiBaseUrl:t});return/\/api\/sandboxes\/?$/.test(e)?e.replace(/\/api\/sandboxes\/?$/,"/v1"):e.replace(/\/sandboxes\/?$/,"")}d(_n,"sandboxPublicApiRootUrl");function v(t,e){let n=new URLSearchParams;return e.teamId&&n.set("teamId",e.teamId),e.projectId&&n.set("projectId",e.projectId),e.agentId&&n.set("agentId",e.agentId),`${t}${n.size>0?`?${n.toString()}`:""}`}d(v,"sandboxScopedCollectionPath");async function Tn(t){let e=await z(jn(t.sandboxApiUrl),t.apiKey,t.path,{method:t.method??"GET",...t.body?{body:JSON.stringify(t.body)}:{}}),n=await e.json().catch(()=>({}));if(!e.ok){let r=typeof n.error=="string"?n.error:`Sandbox API request failed with status ${e.status}`;throw new Error(r)}return n}d(Tn,"requestSandboxApiRoot");async function w(t){let e=await z(_n(t.sandboxApiUrl),t.apiKey,t.path,{method:t.method??"GET",signal:t.signal,headers:{...t.idempotencyKey?{"idempotency-key":t.idempotencyKey}:{},...t.teamId?{"X-OpenPond-Team-Id":t.teamId}:{}},...t.body?{body:JSON.stringify(t.body)}:{},...t.timeoutMs!==void 0?{timeoutMs:t.timeoutMs}:{}}),n=await e.json().catch(()=>({}));if(!e.ok){let r=typeof n.error=="string"?n.error:`Sandbox API request failed with status ${e.status}`;throw new Error(r)}return n}d(w,"requestSandboxPublicApiRoot");async function so(t){let{apiKey:e,sandboxApiUrl:n}=await te();return w({apiKey:e,sandboxApiUrl:n,...t})}d(so,"requestOpenPondPublicApi");function zn(t,e){if(!t)return{label:"Sandbox API",handle:null,baseUrl:null,sandboxApiUrl:e,state:"signed_out"};let n=t.accountState;return{label:n.label,handle:n.activeProfile?.handle??t.account?.handle??null,baseUrl:n.baseUrl??t.account?.baseUrl??null,sandboxApiUrl:e,state:n.state}}d(zn,"sandboxAccountSummary");function Ln(t){return $(process.env.OPENPOND_SANDBOX_BASE_URL)??$(process.env.OPENPOND_API_URL)??$(t.apiBaseUrl)??$(t.account?.baseUrl)??$(t.config.baseUrl)??An}d(Ln,"resolveSandboxBaseUrl");export{ir as a,Pr as b,Xe as c,nn as d,rn as e,$r as f,on as g,jr as h,jt as i,ro as j,oo as k,ao as l,so as m};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as i}from"./chunk-FTQLQJQV.js";var d=class extends Error{constructor(n,r){super(`API request timed out after ${n}ms: ${r}`);this.timeoutMs=n;this.requestUrl=r;this.name="ApiTimeoutError"}timeoutMs;requestUrl;static{i(this,"ApiTimeoutError")}code="OPENPOND_API_TIMEOUT"},l=class extends Error{constructor(n,r){super(`API response exceeded ${n} bytes: ${r}`);this.maximumBytes=n;this.requestUrl=r;this.name="ApiResponseTooLargeError"}maximumBytes;requestUrl;static{i(this,"ApiResponseTooLargeError")}code="OPENPOND_API_RESPONSE_TOO_LARGE"},E=class extends Error{constructor(n,r,o,c=null){let s=c||r;super(`${o} failed: ${n}${s?` ${s}`:""}`);this.status=n;this.apiMessage=c;this.name="OpenPondApiError",this.code=r||"OPENPOND_API_ERROR"}status;apiMessage;static{i(this,"OpenPondApiError")}code};async function O(t,e,n,r={}){let{timeoutMs:o=3e4,maxResponseBytes:c=8388608,explicitBearerAuth:s=!1,...a}=r,y=`${t}${n}`,u=new Headers(a.headers);u.set("Content-Type","application/json");let p=s?void 0:process.env.OPENPOND_API_KEY,A=e?.trim()||"",x=!s&&A.startsWith("opk_"),T=p||(x?A:null);T&&!u.has("openpond-api-key")&&u.set("openpond-api-key",T),e?u.set("Authorization",x?`ApiKey ${A}`:`Bearer ${e}`):p&&!u.has("Authorization")&&u.set("Authorization",`ApiKey ${p}`);let m=new AbortController,h=new d(o,y),f=o>0?setTimeout(()=>m.abort(h),o):null;f?.unref?.();let _=w(a.signal,m.signal,o),b=i(()=>{f&&clearTimeout(f)},"cleanup");try{let g=await fetch(y,{...a,headers:u,signal:_});return P(g,{cleanup:b,maximumBytes:c,requestUrl:y,timeoutController:m,timeoutError:h})}catch(g){throw b(),m.signal.aborted?h:g}}i(O,"apiFetch");async function R(t,e){let n;try{let r=await t.text();n=r?JSON.parse(r):{}}catch(r){if(r instanceof d||r instanceof l)throw r;n={}}if(!t.ok){let r=typeof n.error=="string"?n.error:null,o=typeof n.message=="string"?n.message:null;throw new E(t.status,r,e,o)}return n}i(R,"readApiJson");function P(t,e){if(!t.body)return e.cleanup(),t;let n=Number(t.headers.get("content-length"));if(e.maximumBytes>0&&Number.isFinite(n)&&n>e.maximumBytes)throw e.cleanup(),t.body.cancel(),new l(e.maximumBytes,e.requestUrl);let r=t.body.getReader(),o=0,c=new ReadableStream({async pull(s){try{let a=await r.read();if(a.done){e.cleanup(),s.close();return}if(o+=a.value.byteLength,e.maximumBytes>0&&o>e.maximumBytes){e.cleanup(),await r.cancel(),s.error(new l(e.maximumBytes,e.requestUrl));return}s.enqueue(a.value)}catch(a){e.cleanup(),s.error(e.timeoutController.signal.aborted?e.timeoutError:a)}},async cancel(s){e.cleanup(),await r.cancel(s)}});return new Response(c,{headers:t.headers,status:t.status,statusText:t.statusText})}i(P,"boundedResponse");function w(t,e,n){return n<=0?t??void 0:t?AbortSignal.any([t,e]):e}i(w,"composedSignal");export{O as a,R as b};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as U}from"./chunk-2PXKSAG6.js";import{L as q,Q as Z,W as $,ja as ee}from"./chunk-BU6MW65V.js";import{m as D}from"./chunk-HIQPGYVH.js";import{A as Y,D as x,x as X,y as V,z as I}from"./chunk-DXJC3QW7.js";import{a as W}from"./chunk-P4QM63L3.js";import{L as A,M as C,N as g,Q,o as K}from"./chunk-4PUOWSDE.js";import{Ra as N,Wa as J,bb as _,ga as O,ia as F,v as P,x as B}from"./chunk-ZY32SZ2P.js";import{A as n}from"./chunk-X2J2P5ZT.js";import{a as h}from"./chunk-FTQLQJQV.js";var j=h(t=>t&&typeof t=="object"&&!Array.isArray(t)?t:{},"fields");function te(t){let e=t?.method==="sft"?t:void 0;return{schemaVersion:"openpond.sftRecipe.v1",method:"sft",parameterization:"lora",...e?.baseModel?{baseModel:e.baseModel}:{},dataset:{completionOnly:!0,maxSequenceLength:8192,selectionStrategy:"stable_hash_top_n",selectionSeed:17,...j(e?.dataset)},lora:{rank:16,alpha:32,dropout:0,targetModules:["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"],...j(e?.lora)},optimizer:{learningRate:1e-4,epochs:3,maxSteps:30,batchSize:1,gradientAccumulationSteps:1,seed:17,...j(e?.optimizer)},resourceLimits:{cpuThreads:4,memoryBytes:48*1024**3,wallTimeMs:3600*1e3,...j(e?.resourceLimits)}}}h(te,"createSupervisedTrainingRecipeDefaults");function S(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}h(S,"fields2");function re(t,e=t?.method==="sft"?"sft":"grpo"){if(e==="sft")return te(t);let r=t?.method==="grpo"?t:void 0,a={schemaVersion:"openpond.rftRecipe.v1",method:"grpo",parameterization:"lora",lora:{rank:2},rollout:{groupSize:8,concurrency:4,maxOutputTokens:1024,temperature:.8,topP:.95,seed:17},optimizer:{learningRate:1e-4,maxSteps:8,clipRange:.2,iterations:2,microbatchSize:1,gradientAccumulationSteps:8,advantageEpsilon:1e-8,adamw:{name:"adamw",weightDecay:0,beta1:.9,beta2:.999,epsilon:1e-8}},loss:{method:"grpo",klBeta:.01},resourceLimits:{wallTimeMs:3960*1e3,maxRollouts:64,maxPayloadBytes:1e6},policyOptimization:null};return{...a,...r,lora:{...a.lora,...S(r?.lora)},rollout:{...a.rollout,...S(r?.rollout)},optimizer:{...a.optimizer,...S(r?.optimizer),adamw:{...a.optimizer.adamw,...S(S(r?.optimizer).adamw)}},loss:{...a.loss,...S(r?.loss)},resourceLimits:{...a.resourceLimits,...S(r?.resourceLimits)}}}h(re,"createModelTrainingRecipeDefaults");function pe(t){let e=x.parse(t.setup),r=typeof t.package=="object"&&t.package!==null&&"schemaVersion"in t.package&&t.package.schemaVersion==="openpond.tasksetPackage.v1"?ee(t.package):null,a=r?null:$(t.package),s=r??a,l=e.tasksetRef;if(!(l&&l.revision===s.taskset.revision&&(r?l.id===r.taskset.id&&l.contentHash===r.taskset.contentHash||l.id===r.taskset.metadata.sourceTasksetId&&l.contentHash===r.taskset.metadata.sourceTasksetHash:l.id===s.taskset.id)))return e;!e.evaluationTasksetRef&&s.taskset.tasks.some(p=>p.split==="frozen_eval"||p.split==="validation")&&(e.evaluationTasksetRef=e.tasksetRef);let o=e.baseModel;if(e.method==="sft"){if(e.recipe&&e.recipe.method!=="sft"||!o?.revision||!o.tokenizerRevision||!o.chatTemplateHash)return e;let p=s.taskset.tasks.filter(b=>b.split==="train");if(!p.length)return e;let E=te(e.recipe),k=S(E.dataset),H=e.evaluationTasksetRef?.id===e.tasksetRef?.id&&e.evaluationTasksetRef?.contentHash===e.tasksetRef?.contentHash;if(!k.validationSplit&&!H)throw new Error("Choose the optimizer validation split from the selected evaluation dataset.");return x.parse({...e,recipe:U.parse({...E,baseModel:{id:o.modelId,revision:o.revision,tokenizerRevision:o.tokenizerRevision,chatTemplateHash:o.chatTemplateHash},dataset:{...k,trainSplit:"train",validationSplit:k.validationSplit??(s.taskset.tasks.some(b=>b.split==="frozen_eval")?"frozen_eval":"validation"),maxExamples:typeof k.maxExamples=="number"?Math.min(k.maxExamples,p.length):Math.min(1e3,p.length)}})})}if(e.method!=="grpo"||e.recipe&&e.recipe.method!=="grpo"||!o?.revision||!o.tokenizerRevision||!o.chatTemplateHash||e.recipe?.baseModel&&e.recipe.reward&&e.recipe.dataset)return e;let m=s.taskset.tasks.filter(p=>p.split==="train"),R=r?r.taskset.graders:_(a.rewardBinding,a.rewards),f=R.find(p=>p.rewardEligible&&p.weight>0),y=r?.environment??a?.executionResources?.environment??a?.execution?.environment;if(!m.length||!f||!y)return e;let M=re(e.recipe);return x.parse({...e,recipe:{...M,baseModel:{id:o.modelId,revision:o.revision,tokenizerRevision:o.tokenizerRevision,chatTemplateHash:o.chatTemplateHash},dataset:{trainSplit:"train",validationSplit:s.taskset.tasks.some(p=>p.split==="frozen_eval")?"frozen_eval":"validation",maxPromptTokens:4096,maxExamples:Math.min(1e3,m.length),selectionStrategy:"stable_hash_top_n",...S(M.dataset)},rollout:{maxTurns:s.taskset.environment.kind==="text"?1:15,...S(M.rollout)},reward:{graderId:f.id,graderHash:D(R),environmentId:y.id,environmentVersion:String(y.revision),toolContractHash:D(s.taskset.tools),learnedPreference:S(M.reward).learnedPreference??null}}})}h(pe,"prepareModelTrainingDefaults");var T=n.string().trim().min(1).max(500),v=X,ae=n.object({schemaVersion:n.literal("openpond.modelStarter.v1"),id:T,revision:n.number().int().positive(),name:n.string().trim().min(1).max(200),description:n.string().trim().min(1).max(2e3),category:n.enum(["extraction","support","operations","knowledge","coding","writing","classification"]),taskset:v,taskDefinition:v,rewardBinding:v,rewards:n.array(v).min(1).max(100),assets:n.array(v).max(1e3),previewTaskIds:n.array(T).min(1).max(8),startingModel:V,supportedMethods:n.array(I).min(1).max(8),defaultMethod:I,provenance:n.object({author:n.string().min(1).max(200),license:n.string().min(1).max(200),sourceDescription:n.string().min(1).max(2e3)}).strict(),evidence:n.object({verifierFixtures:v.nullable(),baseline:v.nullable(),training:v.nullable(),evaluation:v.nullable()}).strict()}).strict().superRefine((t,e)=>{t.supportedMethods.includes(t.defaultMethod)||e.addIssue({code:"custom",path:["defaultMethod"],message:"The default method must be supported by the package."});for(let r of["rewards","assets"])new Set(t[r].map(a=>a.id)).size!==t[r].length&&e.addIssue({code:"custom",path:[r],message:"Dependency identities must be unique."});new Set(t.previewTaskIds).size!==t.previewTaskIds.length&&e.addIssue({code:"custom",path:["previewTaskIds"],message:"Preview tasks must be unique."})}),ie=ae.safeExtend({contentHash:n.string().regex(/^[a-f0-9]{64}$/)}),oe=n.object({starter:ie,taskset:O,taskDefinition:K,rewardBinding:J,rewards:n.array(N).min(1).max(100),assets:n.array(Q).max(1e3),execution:q.optional()}).strict(),ne=n.object({schemaVersion:n.literal("openpond.modelStarterPrivacyReview.v1"),disposition:n.literal("synthetic_only"),reviewedBy:n.string().trim().min(1).max(500),reviewedAt:n.iso.datetime(),reviewedContentHash:n.string().regex(/^[a-f0-9]{64}$/),note:n.string().trim().min(1).max(2e3)}).strict();function se(t){let{contentHash:e,...r}=t.starter,{contentHash:a,...s}=t.taskset,{contentHash:l,...c}=r.taskset,o={...s.metadata},m=o.starterAuthoring;if(m&&typeof m=="object"&&!Array.isArray(m)){let{privacyReview:R,...f}=m;o.starterAuthoring=f}return g({...t,starter:{...r,taskset:c},taskset:{...s,metadata:o}}).contentHash}h(se,"modelStarterPrivacyContentHash");var de=n.object({profileId:T,modelId:T,name:n.string().trim().min(1).max(200),starter:v,startingModel:V,method:I,rewardBindingRef:v.nullable().optional(),recipe:Y.nullable().optional(),managedGpuSelection:x.shape.managedGpuSelection,continuationAdapterMode:x.shape.continuationAdapterMode,learning:W.optional()}).strict(),ce=de.extend({schemaVersion:n.literal("openpond.modelStarterCreation.v1"),operationId:T}).strict();function le(t){return P(t,64*1024),ce.parse(t)}h(le,"parseModelStarterCreationRequest");function ue(t,e){let r=le(t),a=L(e);if(!C(r.starter,A(a.starter)))throw new Error("Starter creation references a different package revision.");if(!a.starter.supportedMethods.includes(r.method))throw new Error("The selected training method is not supported by this starter.");return{request:r,resolved:a}}h(ue,"validateModelStarterCreation");function he(t){let{starter:e,taskset:r,taskDefinition:a,rewardBinding:s,rewards:l}=L(t);return{starter:e,inputSchema:a.inputSchema,outputSchema:a.outputSchema,reward:{name:s.name,description:s.description,checks:s.sources.map(c=>{let o=l.find(m=>C(c.reward,A(m)));return{name:o.name,description:o.description,kind:o.implementation.kind,role:c.role,weight:c.weight,required:c.required,hardGate:c.hardGate}})},tasks:e.previewTaskIds.map(c=>{let o=r.tasks.find(m=>m.id===c);return{id:o.id,input:o.input,policyVisibleContext:o.policyVisibleContext}}),counts:{train:r.tasks.filter(c=>c.split==="train").length,validation:r.tasks.filter(c=>c.split==="validation").length,frozenEvaluation:r.tasks.filter(c=>c.split==="frozen_eval").length}}}h(he,"previewModelStarter");function L(t){P(t,16*1024*1024);let e=oe.parse(t),{starter:r,taskset:a,taskDefinition:s,rewardBinding:l,rewards:c,assets:o}=e,m=a.metadata.starterAuthoring;if(m&&typeof m=="object"&&!Array.isArray(m)&&"privacyReview"in m&&ne.parse(m.privacyReview).reviewedContentHash!==se(e))throw new Error("Starter privacy review differs from the published contents.");let R=[r,a,s,l,...c,...o];for(let i of R){let{contentHash:d,...u}=i;if(g(u).contentHash!==d)throw new Error(`Starter resource integrity failed: ${i.id}.`)}F(a),Z(e.execution,a,o);function f(i,d){if(!C(i,A(d)))throw new Error(`Starter dependency mismatch: ${i.id}.`)}if(h(f,"exact"),f(r.taskset,a),f(r.taskDefinition,s),f(r.rewardBinding,l),f(s.rewardBinding,l),l.recipeRef)throw new Error("Starter binding recipes must be resolved into a standalone binding before publication.");let{policy:y,environment:M,environmentRelease:p,tools:E,capabilities:k,verifierSetRelease:H}=a,b={policy:y,environment:M,...p?{environmentRelease:p}:{},tools:E,capabilities:k,...H?{verifierSetRelease:H}:{}};if(g(b).contentHash!==g(s.execution).contentHash)throw new Error("Starter execution context differs from its task format.");if(g({graders:a.graders}).contentHash!==g({graders:_(l,c)}).contentHash)throw new Error("Starter executable graders differ from its Reward binding.");for(let[i,d]of[[r.rewards,c],[r.assets,o]]){if(i.length!==d.length||new Set(d.map(u=>u.id)).size!==d.length)throw new Error("Starter dependency inventory mismatch.");for(let u of i){let w=d.find(z=>z.id===u.id);if(!w)throw new Error(`Starter dependency is missing: ${u.id}.`);f(u,w)}}for(let i of l.sources){let d=c.find(u=>u.id===i.reward.id);if(!d)throw new Error(`Starter Reward is missing: ${i.reward.id}.`);f(i.reward,d)}for(let i of c){let d=i.implementation,u=[...i.assets,..."verifierRef"in d?[d.verifierRef]:[],..."rubricRef"in d?[d.rubricRef]:[],..."inputContract"in d?[d.inputContract]:[]];for(let w of u){let z=o.find(me=>me.id===w.id);if(!z||g(z.asset).contentHash!==g(w).contentHash)throw new Error(`Starter Reward source is missing or changed: ${w.id}.`);if(w.visibility==="policy")throw new Error(`Starter Reward source must remain private to its evaluator: ${w.id}.`)}}if(new Set(a.tasks.map(i=>i.id)).size!==a.tasks.length)throw new Error("Starter task identities must be unique.");let G=new Map;for(let i of a.tasks){if(i.policyVisibleContext.instructions!==s.instructions)throw new Error(`Starter task does not carry its declared model instructions: ${i.id}.`);let d=g({input:i.input,context:i.policyVisibleContext}).contentHash,u=G.get(d);if(u&&u!==i.split)throw new Error("Starter policy input appears in multiple splits.");if(G.set(d,i.split),!B(s.inputSchema,i.input).valid)throw new Error(`Starter task input does not match its format: ${i.id}.`);if(i.expectedOutput!==null&&!B(s.outputSchema,i.expectedOutput).valid)throw new Error(`Starter expected output does not match its format: ${i.id}.`)}for(let i of r.previewTaskIds){let d=a.tasks.find(u=>u.id===i);if(!d||d.split==="frozen_eval")throw new Error(`Starter preview task is unavailable: ${i}.`)}return e}h(L,"validateResolvedModelStarter");export{pe as a,ie as b,ne as c,le as d,ue as e,he as f,L as g};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as p,b as u}from"./chunk-XT4CSKHM.js";import"./chunk-JPUSTFZC.js";import"./chunk-RFQD6B44.js";import"./chunk-R4EEGWXB.js";import"./chunk-DWM5G7BU.js";import"./chunk-RBTDSI4L.js";import"./chunk-XRKFTPHD.js";import"./chunk-JEMECEQH.js";import{l as w}from"./chunk-73TW6BKK.js";import"./chunk-27JGS3KB.js";import"./chunk-BT5YNE5U.js";import"./chunk-RPM4FDRX.js";import"./chunk-KTIBXRWQ.js";import"./chunk-KP2MYTP5.js";import"./chunk-PNPV2LDE.js";import"./chunk-4G3GTEVS.js";import"./chunk-KU4TPDPH.js";import"./chunk-55YD4UTW.js";import"./chunk-AFYYIJ6K.js";import"./chunk-J256AEEE.js";import"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c}from"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-JCLTFDVW.js";import"./chunk-SV7ZBEK2.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-UGOK7VTC.js";import"./chunk-TBODQT4W.js";import"./chunk-5HPZGLOL.js";import"./chunk-ZFJWA4JK.js";import{A as l}from"./chunk-X2J2P5ZT.js";import{a as n}from"./chunk-FTQLQJQV.js";async function g(r,d){let[o,s]=d;if(!o||d.length>2)throw new Error("usage: connected-evidence <list|collection|recorded-list|recorded|import-receipt|capture-assets|retain-assets|starting-assets|summary|case|unmapped|capture|selection|publish|prepare-recorded|upload-part|preview|commit|set-collection> [id] --team <id> [--input-file <path>]");if(c(r,"project")&&!["list","recorded-list"].includes(o))throw new Error("--project filters list commands; other operations retain their exact Project in --input-file.");if(r.local===!0||r.local==="true")throw new Error("Connected evidence is retained by its hosted source owner; select --api-base-url for that owner.");if(s&&!["recorded","import-receipt","starting-assets"].includes(o))throw new Error("This operation does not accept a resource id.");let a=new w(await u(r)),t=AbortSignal.timeout(6e4),m={...c(r,"project")?{projectId:c(r,"project")}:{},...c(r,"cursor")?{cursor:c(r,"cursor")}:{},limit:Number(c(r,"limit")||20)},i=n(async()=>p(r),"input"),e;switch(o){case"list":e=await a.list(m,t);break;case"recorded-list":e=await a.listRecordedExecutions(m,t);break;case"collection":e=await a.collection(t);break;case"recorded":if(!s)throw new Error("Select a recorded execution id.");e=await a.recordedExecution(s,t);break;case"import-receipt":if(!s)throw new Error("Select the original import operation id.");e=await a.readImport(s,t);break;case"retain-assets":e=await a.retainStartingAssets(await p(r,15*1024*1024),t);break;case"capture-assets":e=await(await import("./connected-starting-assets-KWOFEIE4.js")).captureConnectedStartingAssets(r,a,t);break;case"starting-assets":if(!s)throw new Error("Select a retained starting assets id.");e=await a.startingAssets(s,t);break;case"summary":e=await a.homeSummary(await i(),t);break;case"case":e=await a.read(await i(),t);break;case"unmapped":e=await a.unmappedEvents(await i(),t);break;case"capture":e=await a.capture(await i(),t);break;case"selection":e=await a.createSelection(await i(),t);break;case"publish":e=await a.publishDataset(await i(),t);break;case"prepare-recorded":e=await a.prepareRecorded(await i(),t);break;case"upload-part":e=await a.uploadPart(await i(),t);break;case"preview":e=await a.preview(await i(),t);break;case"commit":e=await a.commit(await i(),t);break;case"set-collection":e=await a.setCollection(l.object({paused:l.boolean()}).strict().parse(await i()).paused,t);break;default:throw new Error("Unknown connected evidence operation.")}console.log(JSON.stringify(e,null,2))}n(g,"runConnectedEvidenceCommand");export{g as runConnectedEvidenceCommand};
|