openpond 0.2.43 → 0.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-server.d.ts +4452 -652
- package/dist/app-server.js +1 -1
- package/dist/chunks/actions-command-5IEZEP6W.js +2 -0
- package/dist/chunks/{app-layer-OV7RVSQW.js → app-layer-7SPLENWD.js} +1 -1
- package/dist/chunks/app-server-runtime-NQ2BYPGK.js +2 -0
- package/dist/chunks/apps-XQ7PHJTD.js +2 -0
- package/dist/chunks/{chunk-LLNCHGE4.js → chunk-2CXJK2M3.js} +1 -1
- package/dist/chunks/{chunk-MDE3HHLH.js → chunk-36RCXSEJ.js} +1 -1
- package/dist/chunks/chunk-3QC2DDQ5.js +2 -0
- package/dist/chunks/chunk-3XDFNA7W.js +2 -0
- package/dist/chunks/chunk-4S4WH65X.js +3 -0
- package/dist/chunks/chunk-4TMC5F2P.js +5 -0
- package/dist/chunks/{chunk-ROJX6IYW.js → chunk-65QCNUGE.js} +281 -200
- package/dist/chunks/{chunk-O277DPTX.js → chunk-ANVOHBUV.js} +1 -1
- package/dist/chunks/chunk-ARJUNUH6.js +5 -0
- package/dist/chunks/{chunk-V44RF57H.js → chunk-CEEZ7Y2J.js} +1 -1
- package/dist/chunks/{chunk-ZG7QX66E.js → chunk-CR6CDOKS.js} +8 -8
- package/dist/chunks/{chunk-W3NG7YLC.js → chunk-DZVVGU6K.js} +1 -1
- package/dist/chunks/chunk-HY2Q7EDK.js +4 -0
- package/dist/chunks/chunk-IT4AT6LB.js +42 -0
- package/dist/chunks/{chunk-7KC5LWCU.js → chunk-L6HCBIAU.js} +1 -1
- package/dist/chunks/chunk-LNEOLOK2.js +13 -0
- package/dist/chunks/chunk-NM2GYDPA.js +19 -0
- package/dist/chunks/{chunk-6UPCR6EL.js → chunk-OI2N2636.js} +1 -1
- package/dist/chunks/{chunk-VG7XO6PR.js → chunk-OMM4ZO7E.js} +7 -7
- package/dist/chunks/{chunk-KDOS6YMH.js → chunk-OQPFFKU6.js} +1 -1
- package/dist/chunks/{chunk-7EDOA6KD.js → chunk-PEYA2Q7Q.js} +1 -1
- package/dist/chunks/{chunk-EWQZASG4.js → chunk-QID62K65.js} +5 -5
- package/dist/chunks/{chunk-G2WJC6DE.js → chunk-RAWEO7SJ.js} +2 -2
- package/dist/chunks/{chunk-HI7W3IVO.js → chunk-W5NQ2DI7.js} +12 -12
- package/dist/chunks/{chunk-IE2WZ3I3.js → chunk-X2B4MN6W.js} +1 -1
- package/dist/chunks/{chunk-T7MJBBHE.js → chunk-YF6IDYTS.js} +1 -1
- package/dist/chunks/{chunk-E6WT4HWF.js → chunk-YOOPTMQK.js} +1 -1
- package/dist/chunks/{chunk-QUNRWDVO.js → chunk-Z6ZR5O3J.js} +3 -3
- package/dist/chunks/{chunk-T5QA4W2H.js → chunk-ZEVARU6J.js} +5 -5
- package/dist/chunks/cli-OJU6NQSA.js +2 -0
- package/dist/chunks/{configuration-command-ANYM5UYG.js → configuration-command-LDPUCHVH.js} +1 -1
- package/dist/chunks/core-commands-UZL5RF2M.js +2 -0
- package/dist/chunks/{datasets-FM3UBK4R.js → datasets-42AZHVSV.js} +3 -3
- package/dist/chunks/desktop-test-DI76HKS7.js +3 -0
- package/dist/chunks/{dist-GC7DXKTI.js → dist-6YP37XI5.js} +1 -1
- package/dist/chunks/experiments-Z3S35BYN.js +2 -0
- package/dist/chunks/{extension-5LQRULQP.js → extension-JEUZZJ5X.js} +1 -1
- package/dist/chunks/{help-NTSTG6RR.js → help-4F4QGL4C.js} +1 -1
- package/dist/chunks/hosted-harness-runtime-VZNYNQ6T.js +2 -0
- package/dist/chunks/hosted-profile-compiler-JXLPR7SX.js +2 -0
- package/dist/chunks/{hosted-profile-evaluation-control-IK4Y2EQZ.js → hosted-profile-evaluation-control-Q54YXXIM.js} +1 -1
- package/dist/chunks/{hosted-profile-evaluation-inspection-YWKUB7RT.js → hosted-profile-evaluation-inspection-7WESM3ZH.js} +1 -1
- package/dist/chunks/hosted-profile-evaluation-preparation-QP24PYBL.js +3 -0
- package/dist/chunks/opchat-UFWWVJL6.js +3 -0
- package/dist/chunks/organizations-SBBIOF6O.js +2 -0
- package/dist/chunks/{profile-HVLH672B.js → profile-ESULTWDN.js} +1 -1
- package/dist/chunks/project-agent-IBHUQ3JX.js +2 -0
- package/dist/chunks/sandbox-command-PAJAIMWM.js +2 -0
- package/dist/chunks/{sandbox-template-QMB6DSTS.js → sandbox-template-7WHGNVM6.js} +1 -1
- package/dist/chunks/src-5MJSO3UD.js +326 -0
- package/dist/chunks/{src-N447LUPO.js → src-A3OVZOSV.js} +1 -1
- package/dist/chunks/{teams-bot-RNHQMPQA.js → teams-bot-YMCDLBGT.js} +1 -1
- package/dist/chunks/{workspaces-V5YTXJLV.js → workspaces-ZZ7R5BUL.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/profile/local-profile.d.ts +2 -0
- package/dist/web/assets/App-6AQXN2SM.js +226 -0
- package/dist/web/assets/{AppDialog-v-BfV1lA.js → AppDialog-CV3ddujB.js} +1 -1
- package/dist/web/assets/AppTerminalPanel-dhbGOO_K.js +2 -0
- package/dist/web/assets/{AppsView-Dl-37F0w.js → AppsView-Bxa-9BF2.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-DltF217k.js → BrowserSidebar-BLwL2FOG.js} +1 -1
- package/dist/web/assets/{CartesianChart-gK-Ll3kX.js → CartesianChart-BOxN-Su1.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-BuWquQYn.js → CollaborationTabs-DTmJvNJx.js} +1 -1
- package/dist/web/assets/{CommandMenu-Cs5S8t-Q.js → CommandMenu-DggN2ygj.js} +1 -1
- package/dist/web/assets/{CommunityView-BJBkQEMV.js → CommunityView-CuDrYOIf.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-C36fKc-v.js → ComposerCreateImproveStrip-BrduENlL.js} +1 -1
- package/dist/web/assets/{GetStartedView-9A49MgYA.js → GetStartedView-Db1IEWzv.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-kofNdPAe.js +1 -0
- package/dist/web/assets/{HostedModelLearningSettings-CH7CsAhw.js → HostedModelLearningSettings-6ij3nwWD.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-N2qcy1Yv.js → LabModelVersionDetailPage-C7Maqcit.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-BAKym5GY.js → LabSkillSidebar-Bz0U-Nmw.js} +1 -1
- package/dist/web/assets/LabsRoute-Ch1N-e2S.js +52 -0
- package/dist/web/assets/LabsRoute-Dw6-12kt.css +1 -0
- package/dist/web/assets/MainChatThread-BJbhZOvs.js +2 -0
- package/dist/web/assets/{MainPane-gPkr0OWu.js → MainPane-Cs2Kng_k.js} +4 -4
- package/dist/web/assets/{MarkdownText-B-au2zEv.js → MarkdownText-BhzHRq1J.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-DHFKZ7P1.js → NativeSkillSidebar-LU-PhEhW.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-Dhbf5KJT.js → NewExperienceSwitcher-Bi_gpHLG.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-hlAzFK2Y.js → NewProjectDialog-B8pWvSkq.js} +1 -1
- package/dist/web/assets/{OutputsPage-C0N2rOxE.js → OutputsPage-BkGI0kHp.js} +1 -1
- package/dist/web/assets/{ProjectsPage-CkHBgLPx.js → ProjectsPage-Ca8_iEWu.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-BiW6ZzPN.js → RightChatPanelStack-DjEdxsq8.js} +1 -1
- package/dist/web/assets/{RightSidebarHomePanel-BS9YSdYB.js → RightSidebarHomePanel-6pygznxX.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-819sQcDR.js → ScheduledWorkPage-BSiOxxAH.js} +1 -1
- package/dist/web/assets/{SettingsView-BZrOUPZb.js → SettingsView-1XN7KLBl.js} +3 -3
- package/dist/web/assets/{TeamChatView-CUNcbSa7.js → TeamChatView-BGLCPTen.js} +2 -2
- package/dist/web/assets/{TerminalOverlay-MIlGPpXe.js → TerminalOverlay-DHkS2cVJ.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-BNcyNoa8.js → TrainingCreationPanel-Dneamjzh.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-CKV16LNC.js → TrainingDraftPanel-Cfh59jLZ.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-SVgUHnUL.js → UsageSettingsSection-C9l1KY-O.js} +1 -1
- package/dist/web/assets/{WorkSidebarPanel-CfkaaFHA.js → WorkSidebarPanel-CEnO-Txp.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-CQhqlqg5.js → WorkspaceDiffPanel-BiuQBflC.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-CJB-z2tS.js → WorkspaceEnvironmentMenu-Dr-E0c1j.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-B3xtasTt.js → WorkspaceGitDialogs-mE3Og6Zo.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-DVfyICNZ.js → WorkspaceMonacoEditor-DPZ0n0G9.js} +60 -60
- package/dist/web/assets/{arrow-up-right-CYG4Vm07.js → arrow-up-right-DU2KsZD-.js} +1 -1
- package/dist/web/assets/{clipboard-DGSnfljX.js → clipboard-g2b4_k81.js} +1 -1
- package/dist/web/assets/{cloud-upload-Bw_zrS2y.js → cloud-upload-P2bDOPsQ.js} +1 -1
- package/dist/web/assets/cssMode-CPbPVAUt.js +1 -0
- package/dist/web/assets/{folder-open-CcGOldH7.js → folder-open-BmsONNsr.js} +1 -1
- package/dist/web/assets/{folder-plus-DEIDaX2B.js → folder-plus-B18NgUxy.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-B-Ao6y--.js → git-commit-horizontal-enxGCV_e.js} +1 -1
- package/dist/web/assets/htmlMode-DiV88uQv.js +1 -0
- package/dist/web/assets/index-B9VSiz_z.css +1 -0
- package/dist/web/assets/{index-C8_8-lW7.js → index-vfpCN9zy.js} +6 -6
- package/dist/web/assets/{info-DwOXHkN_.js → info-DmuSBIYe.js} +1 -1
- package/dist/web/assets/{jsonMode-txmGM7K6.js → jsonMode-BaeOjuKU.js} +4 -4
- package/dist/web/assets/{lspLanguageFeatures-D59Drc_9.js → lspLanguageFeatures-D8To0CQA.js} +1 -1
- package/dist/web/assets/{minimize-2-C5UCV16_.js → minimize-2-C2xnEzCe.js} +1 -1
- package/dist/web/assets/monaco.contribution-DbrACt99.js +2 -0
- package/dist/web/assets/{monaco.contribution-5HcktwaM.js → monaco.contribution-DgTFvG2Q.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BOmcYK8k.js → monaco.contribution-JW3MxX6k.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CbK7796k.js → monaco.contribution-bytkwn0O.js} +2 -2
- package/dist/web/assets/{monitor-D4hpNTai.js → monitor-mtHVW7gU.js} +1 -1
- package/dist/web/assets/{python-Cie4Ghu8.js → python-DAPe0Urm.js} +1 -1
- package/dist/web/assets/{refresh-cw-CIOzrJnj.js → refresh-cw-Dvm_Pq3U.js} +1 -1
- package/dist/web/assets/{save-D7EtdMHG.js → save-B2eVAjW6.js} +1 -1
- package/dist/web/assets/{square-JpDfrqp_.js → square-16bX2k2i.js} +1 -1
- package/dist/web/assets/toggleHighContrast-BgpFWRpS.css +1 -0
- package/dist/web/assets/{toggleHighContrast-DdGkc-Be.js → toggleHighContrast-Ce0YhEQg.js} +1 -1
- package/dist/web/assets/{tsMode-DwgEL7oI.js → tsMode-CnvMmHz6.js} +1 -1
- package/dist/web/assets/{upload-BkwOzqS-.js → upload-COPbAaD-.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-bO0Qycih.js → useLocalAgentSchedules-C-Wjm5HK.js} +1 -1
- package/dist/web/assets/{useSessionTurnCache-DxUh5scW.js → useSessionTurnCache-BfVbncMB.js} +1 -1
- package/dist/web/assets/{wifi-off-D6Keejtn.js → wifi-off-C9iLbCC-.js} +1 -1
- package/dist/web/assets/{workers-BgG66q0n.js → workers-BXh_u8Fr.js} +1 -1
- package/dist/web/assets/{yaml-COMRGPWg.js → yaml-CRSr9x6_.js} +1 -1
- package/dist/web/index.html +5 -5
- package/docs/command-reference.md +8 -1
- package/package.json +4 -2
- package/dist/chunks/actions-command-DWQ3VGGP.js +0 -2
- package/dist/chunks/app-server-runtime-JVLXE5LF.js +0 -2
- package/dist/chunks/apps-5DQAYDNI.js +0 -2
- package/dist/chunks/chunk-3D4QN4NM.js +0 -19
- package/dist/chunks/chunk-45UOD2DA.js +0 -2
- package/dist/chunks/chunk-5IN3HQJU.js +0 -2
- package/dist/chunks/chunk-6KKQXETR.js +0 -5
- package/dist/chunks/chunk-7R7O2XXP.js +0 -2
- package/dist/chunks/chunk-DGD52VZC.js +0 -13
- package/dist/chunks/chunk-IFI24VF6.js +0 -5
- package/dist/chunks/chunk-P45OSKQL.js +0 -4
- package/dist/chunks/chunk-SXN3QOW4.js +0 -3
- package/dist/chunks/chunk-VJJ3UXOI.js +0 -42
- package/dist/chunks/chunk-XMKAMR7M.js +0 -2
- package/dist/chunks/cli-7D7CYCIY.js +0 -2
- package/dist/chunks/core-commands-TYWE3TNW.js +0 -2
- package/dist/chunks/desktop-test-Z5IKJU3P.js +0 -3
- package/dist/chunks/experiments-IWBRIDQE.js +0 -2
- package/dist/chunks/hosted-harness-runtime-S75BLD57.js +0 -2
- package/dist/chunks/hosted-profile-compiler-JNNYWLC7.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-preparation-JXOF73BB.js +0 -3
- package/dist/chunks/opchat-77PRAQ5W.js +0 -3
- package/dist/chunks/organizations-2KWTYIPU.js +0 -2
- package/dist/chunks/project-agent-7NLKJMAM.js +0 -2
- package/dist/chunks/sandbox-command-FNS4JBVC.js +0 -2
- package/dist/chunks/src-TZBL6NA7.js +0 -325
- package/dist/web/assets/App-BEQmrTGQ.js +0 -226
- package/dist/web/assets/AppTerminalPanel-CnKcllS2.js +0 -2
- package/dist/web/assets/HostedModelLearningReview-JgxDUDio.js +0 -1
- package/dist/web/assets/LabsRoute-DooCmsN8.css +0 -1
- package/dist/web/assets/LabsRoute-Y992kQoQ.js +0 -52
- package/dist/web/assets/MainChatThread-CPhREQso.js +0 -2
- package/dist/web/assets/cssMode-CSpYOKj-.js +0 -1
- package/dist/web/assets/htmlMode-DstkgJXG.js +0 -1
- package/dist/web/assets/index-DUIWDN8o.css +0 -1
- package/dist/web/assets/monaco.contribution-BomZ1gys.js +0 -2
- package/dist/web/assets/toggleHighContrast-B7NOMXDY.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as Ee,o as Re}from"./chunk-KPDWQCF6.js";import{m as he}from"./chunk-IE2WZ3I3.js";import{a as ie,b as de,d as ce,e as le,k as me,m as N,n as fe,o as be,r as xe,v as g,w as ge,x as Se}from"./chunk-B3O2GAQH.js";import{c as oe}from"./chunk-65BW2QXY.js";import{f as ue,h as pe}from"./chunk-BSHAIAXY.js";import"./chunk-6UPCR6EL.js";import"./chunk-SXN3QOW4.js";import"./chunk-XWPC3AN4.js";import{a as M,f as h,h as R}from"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import"./chunk-IFI24VF6.js";import{l as se}from"./chunk-Z2BYC6TP.js";import{d as ae}from"./chunk-DXAZUJPA.js";import"./chunk-GLUWATL5.js";import"./chunk-5IN3HQJU.js";import"./chunk-7R7O2XXP.js";import"./chunk-Z3D4C7BG.js";import"./chunk-DGD52VZC.js";import"./chunk-QUNRWDVO.js";import"./chunk-3A7HZJNE.js";import{c as f,d as we,e as Te,h as O,k as C,q as v,r as ye,s as U,t as Pe,u as ve}from"./chunk-EAPFMACH.js";import"./chunk-6FA3GG5B.js";import"./chunk-ALZRXBEC.js";import"./chunk-MTJNKRXL.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as i}from"./chunk-FTQLQJQV.js";import{promises as P,existsSync as kt}from"node:fs";import b from"node:path";import{Buffer as ht}from"node:buffer";import{promises as y}from"node:fs";import w from"node:path";import{Buffer as Ve}from"node:buffer";import{promises as j}from"node:fs";import S from"node:path";async function q(e,t,n,r){let a=Ie(n,r);if(!a)return[];let o=Oe(n,r),s=typeof r.projectId=="string"&&r.projectId.trim()?r.projectId.trim():typeof r.runtimeProjectId=="string"?r.runtimeProjectId.trim():"",d=typeof r.teamId=="string"?r.teamId.trim():"",c=[];for(let l of a.schedules){let u=Ce({manifest:n,schedule:l,override:o.get(l.name),mode:a.mode,sourceSandboxId:t,teamId:d,projectId:s}),m=await e.createSchedule(u);c.push({id:m.schedule.id,name:m.schedule.name,enabled:m.schedule.enabled,scheduleType:m.schedule.scheduleType,scheduleExpression:m.schedule.scheduleExpression,syncStatus:m.schedule.syncStatus,awsScheduleArn:m.schedule.awsScheduleArn??null,target:m.schedule.target})}return c}i(q,"createSandboxTemplateStartSchedules");function Ie(e,t){let n=t.enableSchedules??t.enableSchedule,r=t.disableSchedules??t.disableSchedule;if(n!==void 0&&r!==void 0)throw new Error("pass only one of --enable-schedules or --disable-schedules");let a=null,o;if(n!==void 0)a="enabled",o=n;else if(r!==void 0)a="disabled",o=r;else if(t.schedules!==void 0){o=t.schedules;let c=typeof t.scheduleMode=="string"?t.scheduleMode.trim().toLowerCase():"disabled";if(c==="none")return null;if(c!=="enabled"&&c!=="disabled")throw new Error("--schedule-mode must be enabled, disabled, or none");a=c}if(!a)return null;if(e.schedules.length===0)return{mode:a,schedules:[]};let s=ke(o,e),d=s===null?e.schedules:e.schedules.filter(c=>s.has(c.name));return{mode:a,schedules:d}}i(Ie,"resolveSandboxTemplateStartScheduleSelection");function ke(e,t){if(e===void 0||e===!0)return null;let n=String(e).trim();if(!n||n==="true"||n.toLowerCase()==="all")return null;if(n.toLowerCase()==="none")return new Set;let r=new Set(t.schedules.map(o=>o.name)),a=new Set(n.split(",").map(o=>o.trim()).filter(Boolean));for(let o of a)if(!r.has(o))throw new Error(`manifest schedule not found: ${o}`);return a}i(ke,"parseSandboxTemplateScheduleNameSelection");function Oe(e,t){let n=typeof t.scheduleOverrides=="string"?t.scheduleOverrides:typeof t.scheduleOverride=="string"?t.scheduleOverride:"";if(!n.trim())return new Map;let r=M(n,"schedule-overrides");if(!r||typeof r!="object"||Array.isArray(r))throw new Error("schedule-overrides must be a JSON object keyed by schedule name");let a=new Set(e.schedules.map(s=>s.name)),o=new Map;for(let[s,d]of Object.entries(r)){if(!a.has(s))throw new Error(`schedule override target does not exist: ${s}`);if(!d||typeof d!="object"||Array.isArray(d))throw new Error(`schedule override for ${s} must be an object`);o.set(s,d)}return o}i(Oe,"parseSandboxTemplateScheduleOverrides");function Ce(e){let t=Me(e.schedule,e.override),n=Ne(t);return{sourceSandboxId:e.sourceSandboxId,...e.teamId?{teamId:e.teamId}:{},...e.projectId?{projectId:e.projectId}:{},name:t.name,...t.description?{description:t.description}:{},...n,...t.timezone?{timezone:t.timezone}:{},enabled:typeof e.override?.enabled=="boolean"?e.override.enabled:e.mode==="enabled",...t.startAt?{startAt:t.startAt}:{},...t.endAt?{endAt:t.endAt}:{},...t.maxRuns!==void 0?{maxRuns:t.maxRuns}:{},runtimePolicy:t.runtimePolicy,target:Ae(e.manifest,t),...t.budget?{budget:t.budget}:{},...t.resources?{resources:t.resources}:{},...t.quotas?{quotas:t.quotas}:{},...t.lifecycle?{lifecycle:t.lifecycle}:{},...t.retentionPolicy?{retentionPolicy:t.retentionPolicy}:{},...t.env?{env:t.env}:{},...t.integrationLeases?{integrationLeases:t.integrationLeases}:{},metadata:{...t.metadata??{},manifestScheduleName:t.name,source:"openpond-code-sandbox-template-start"},managementSource:"openpond.yaml",manifestPath:f}}i(Ce,"buildSandboxTemplateStartScheduleInput");function Me(e,t){return t?{...e,...t,target:e.target||t.target?{...e.target??{},...t.target??{}}:void 0,metadata:e.metadata||t.metadata?{...e.metadata??{},...t.metadata??{}}:void 0}:e}i(Me,"mergeSandboxTemplateScheduleOverride");function Ne(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}i(Ne,"sandboxTemplateScheduleExpression");function Ae(e,t){let n=t.command??t.target?.command??null;if(n)return{kind:"command",command:n,requiresStart:t.requiresStart??t.target?.requiresStart??!1};let r=t.target?.kind??"action";if(r==="start")return{kind:"command",command:e.start.command,requiresStart:t.requiresStart??t.target?.requiresStart??e.start.requiresStart??!1};if(r==="service"){let s=t.target?.name??"",d=e.services.find(c=>c.name===s);if(!d)throw new Error(`schedule service target does not exist: ${s}`);return{kind:"command",command:d.command,requiresStart:t.requiresStart??t.target?.requiresStart??d.requiresStart??!1}}let a=t.actionName??t.action??t.target?.actionName??(t.target?.kind==="action"?t.target?.name:void 0),o=e.actions.find(s=>s.name===a);if(!o)throw new Error(`schedule action target does not exist: ${a??""}`);return{kind:"command",command:o.command,requiresStart:t.requiresStart??t.target?.requiresStart??o.requiresStart??!1}}i(Ae,"sandboxTemplateScheduleCommandTarget");import{existsSync as Ge}from"node:fs";import We from"node:path";import{stdin as Ke}from"node:process";async function D(e,t,n){let r=typeof t.repo=="string"?t.repo.trim():"";if(r)return A(r);await $e(n);let a=await ae(),o=ue(a),s=pe(a),d=await oe(a,o),c=await Se(n,"origin");if(!c){let l=typeof t.teamId=="string"?t.teamId.trim():"",u=await se(s,d,{name:e.name,description:e.description,repoInit:"empty",...l?{teamId:l}:{}});c=ie(u);let m=await g("git",["remote","add","origin",c],{cwd:n});if(m.code!==0)throw new Error(`git remote add failed: ${m.stderr.trim()||m.stdout.trim()||"unknown error"}`)}if(le(c),await Fe(n,t),!h(t.noPush)){let l=await je(n,t);await Be(n,c,l,d,t)}return A(c)}i(D,"resolveSandboxTemplateStartRepo");async function $e(e){let t=We.join(e,".git");if(Ge(t))return;let n=await g("git",["init"],{cwd:e});if(n.code!==0)throw new Error(`git init failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`)}i($e,"ensureGitRepository");async function Fe(e,t){let n=await g("git",["status","--porcelain"],{cwd:e});if(n.code!==0)throw new Error(`git status failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`);let a=(await g("git",["rev-parse","--verify","HEAD"],{cwd:e})).code===0,o=n.stdout.trim().length>0;if(!o&&a)return;if(!(h(t.commit)||h(t.yes)||(Ke.isTTY?await me(a?"Commit local changes before starting the sandbox?":"Create the initial git commit before starting the sandbox?",!a):!1))){if(!a)throw new Error("local repository has no commits; pass --commit or commit before starting");o&&console.warn("warning: uncommitted local changes will not be included in the sandbox");return}let d=await g("git",["add","-A"],{cwd:e});if(d.code!==0)throw new Error(`git add failed: ${d.stderr.trim()||d.stdout.trim()||"unknown error"}`);let c=typeof t.commitMessage=="string"&&t.commitMessage.trim()?t.commitMessage.trim():`start ${f} sandbox`,l=await g("git",["commit","-m",c],{cwd:e});if(l.code!==0){let u=l.stderr.trim()||l.stdout.trim();if(u.includes("nothing to commit")&&a)return;throw new Error(`git commit failed: ${u||"unknown error"}`)}}i(Fe,"ensureGitCommitForSandboxTemplateStart");async function je(e,t){let r=(typeof t.branch=="string"?t.branch.trim():"")||await he(e);if(!r)throw new Error("unable to resolve git branch; pass --branch");return r}i(je,"resolveSandboxTemplateStartBranch");async function Be(e,t,n,r,a){let o;try{o=de(t,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let s=h(a.keepTokenRemote)||h(a.token)||h(a.setRemoteToken),d=t.includes("x-access-token:"),c=!s&&!d?t:null,l=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!d){let m=await g("git",["remote","set-url","origin",o],{cwd:e});if(m.code!==0)throw new Error(`git remote set-url failed: ${ce(m.stderr.trim()||m.stdout.trim()||"unknown error")}`)}if((await g("git",["push","-u","origin",n],{cwd:e,inherit:!0})).code!==0)throw new Error("git push failed")}finally{c&&await g("git",["remote","set-url","origin",c],{cwd:e}).catch(()=>null),l===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=l}}i(Be,"pushGitBranchForSandboxTemplateStart");function $(e){return A(e).replace(/\.git$/,"")}i($,"normalizeSandboxTemplateRepoIdentity");function A(e){let t=new URL(e);t.username="",t.password="";let n=t.toString();return n.endsWith(".git")?n:`${n.replace(/\/$/,"")}.git`}i(A,"normalizeSandboxTemplateRepoUrl");async function _e(e){let t=L(e),n=S.dirname(t),r=await j.readFile(t,"utf8"),a=O(r);if(!a.ok){console.error(C(a.diagnostics)),process.exitCode=1;return}let o=a.manifest,s=G(o,e),d=await B(o,e,n),c=await D(o,e,n),l=await N(e),u=Ye(o,e,c),m=await Qe(l,u,c);await tt(l,m.id);let p=await ut(l,m.id,o,e),x=await V(l,m.id,d.uploadRequests),T={...d.scalars,..._(x,d.uploadRequests)},I=await X(l,m.id,s,T,bt(m)),k=await St(l,m.id,s.ports),E=await q(l,m.id,o,e);console.log(JSON.stringify({ok:!0,file:t,repo:c,executable:{kind:s.kind,name:s.name,command:s.command},sandbox:Re(m),setupCommands:p,uploadedFiles:x,input:T,execution:I,previews:k,schedules:E,expectedArtifacts:s.artifactPaths},null,2))}i(_e,"runSandboxTemplateStart");function G(e,t){let n=v(e),r=typeof t.action=="string"?t.action.trim():"",a=typeof t.service=="string"?t.service.trim():"",o=typeof t.target=="string"?t.target.trim():"",s=typeof t.entrypoint=="string"?t.entrypoint.trim():"",d=r||a||o||s||"start",c=r?"action":a?"service":"",l=n.find(u=>u.name===d&&(!c||u.kind===c));if(!l)throw new Error(`manifest executable not found: ${d}. Available: ${n.map(u=>`${u.kind}:${u.name}`).join(", ")}`);return l}i(G,"resolveSandboxTemplateStartExecutable");function Ye(e,t,n){let r=typeof t.budgetUsd=="string"&&t.budgetUsd.trim()?t.budgetUsd.trim():typeof t.budget=="string"&&t.budget.trim()?t.budget.trim():"0.05",a=R(t.maxDurationSeconds,"max-duration-seconds"),o=R(t.idleTimeoutSeconds,"idle-timeout-seconds"),s=typeof t.teamId=="string"?t.teamId.trim():"",d=typeof t.projectId=="string"?t.projectId.trim():"",c=typeof t.runtimeProjectId=="string"?t.runtimeProjectId.trim():"";if(d&&c&&d!==c)throw new Error("project-id and runtime-project-id must match when both are set");let l=d||c,u=typeof t.agentId=="string"?t.agentId.trim():"",m=typeof t.runtimeAgentId=="string"?t.runtimeAgentId.trim():"";if(u&&m&&u!==m)throw new Error("agent-id and runtime-agent-id must match when both are set");let p=u||m,x=fe(t.workflowMode),T=be(t.runtimePromotionPolicy),I=typeof t.runtimeBaseBranch=="string"&&t.runtimeBaseBranch.trim()?t.runtimeBaseBranch.trim():"",k=typeof t.runtimeBaseSha=="string"&&t.runtimeBaseSha.trim()?t.runtimeBaseSha.trim():"",E=typeof t.runtimeId=="string"&&t.runtimeId.trim()?t.runtimeId.trim():"",te=!!(x||T||I||k||E||c||m),ne=xe(e,t),re=Xe(e);return{sandbox:{repo:n,...s?{teamId:s}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},resources:e.resources??{},networkPolicy:{internetEgress:He(e.network.egress)},budget:{maxUsd:r},quotas:{maxSpendUsd:r,...a!==void 0?{maxDurationSeconds:a}:{},...o!==void 0?{idleTimeoutSeconds:o}:{}},...ne.length>0?{env:ne}:{},...re?{workloadSource:re}:{},volumes:e.volumes,metadata:{source:"openpond-code-sandbox-template-start",manifestFile:f,template:{name:e.name,version:e.version,useCase:e.useCase}}},...te&&E?{runtimeId:E}:{},...te&&!E?{sandboxRuntime:{...s?{teamId:s}:{},...x?{workflowMode:x}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},baseBranch:I||"master",...k?{baseSha:k}:{},...T?{promotionPolicy:T}:{}}}:{}}}i(Ye,"buildSandboxTemplateStartCreateInput");function Xe(e){if(e.runtime.image)return{image:e.runtime.image};if(e.runtime.dockerfile)return{dockerfile:e.runtime.dockerfile}}i(Xe,"sandboxWorkloadSourceFromManifest");function He(e){return e==="allow"?"allow":"block"}i(He,"sandboxTemplateInternetEgressPolicy");async function Qe(e,t,n){let r=Date.now();try{return(await Ee(e,t)).sandbox}catch(a){if(!Ze(a))throw a;return console.warn("warning: sandbox create timed out; checking for the created sandbox record"),et(e,t.sandbox,n,r)}}i(Qe,"createSandboxTemplateStartSandbox");function Ze(e){return e instanceof Error&&/\b(504|timed out|timeout)\b/i.test(e.message)}i(Ze,"isLikelySandboxCreateTimeout");async function et(e,t,n,r){let s=Date.now()+72e4,d=$(n),c=t.metadata??{};for(;Date.now()<s;){let u=(await e.list({...t.teamId?{teamId:t.teamId}:{},...t.projectId?{projectId:t.projectId}:{},...t.agentId?{agentId:t.agentId}:{}})).filter(m=>{if(!m.repo||$(m.repo)!==d)return!1;let p=Date.parse(m.createdAt);return!(Number.isFinite(p)&&p<r-3e4||c.source&&m.metadata?.source!==c.source)}).sort((m,p)=>Date.parse(p.createdAt)-Date.parse(m.createdAt))[0];if(u?.state==="running"||u?.state==="stopped")return u;if(u?.state==="error")throw new Error(`sandbox create failed after timeout: ${u.id}
|
|
2
|
+
import{a as Ee,o as Re}from"./chunk-KPDWQCF6.js";import{m as he}from"./chunk-X2B4MN6W.js";import{a as ie,b as de,d as ce,e as le,k as me,m as N,n as fe,o as be,r as xe,v as g,w as ge,x as Se}from"./chunk-B3O2GAQH.js";import{c as oe}from"./chunk-65BW2QXY.js";import{f as ue,h as pe}from"./chunk-BSHAIAXY.js";import"./chunk-OI2N2636.js";import"./chunk-4S4WH65X.js";import"./chunk-XWPC3AN4.js";import{a as M,f as h,h as R}from"./chunk-3M53YXEI.js";import"./chunk-OGPHXXCD.js";import{l as se}from"./chunk-Z2BYC6TP.js";import"./chunk-ARJUNUH6.js";import{d as ae}from"./chunk-DXAZUJPA.js";import"./chunk-GLUWATL5.js";import"./chunk-3QC2DDQ5.js";import"./chunk-Z3D4C7BG.js";import"./chunk-LNEOLOK2.js";import"./chunk-Z6ZR5O3J.js";import"./chunk-3A7HZJNE.js";import{c as f,d as we,e as Te,h as O,k as C,q as v,r as ye,s as U,t as Pe,u as ve}from"./chunk-EAPFMACH.js";import"./chunk-6FA3GG5B.js";import"./chunk-ALZRXBEC.js";import"./chunk-MTJNKRXL.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as i}from"./chunk-FTQLQJQV.js";import{promises as P,existsSync as kt}from"node:fs";import b from"node:path";import{Buffer as ht}from"node:buffer";import{promises as y}from"node:fs";import w from"node:path";import{Buffer as Ve}from"node:buffer";import{promises as j}from"node:fs";import S from"node:path";async function q(e,t,n,r){let a=Ie(n,r);if(!a)return[];let o=Oe(n,r),s=typeof r.projectId=="string"&&r.projectId.trim()?r.projectId.trim():typeof r.runtimeProjectId=="string"?r.runtimeProjectId.trim():"",d=typeof r.teamId=="string"?r.teamId.trim():"",c=[];for(let l of a.schedules){let u=Ce({manifest:n,schedule:l,override:o.get(l.name),mode:a.mode,sourceSandboxId:t,teamId:d,projectId:s}),m=await e.createSchedule(u);c.push({id:m.schedule.id,name:m.schedule.name,enabled:m.schedule.enabled,scheduleType:m.schedule.scheduleType,scheduleExpression:m.schedule.scheduleExpression,syncStatus:m.schedule.syncStatus,awsScheduleArn:m.schedule.awsScheduleArn??null,target:m.schedule.target})}return c}i(q,"createSandboxTemplateStartSchedules");function Ie(e,t){let n=t.enableSchedules??t.enableSchedule,r=t.disableSchedules??t.disableSchedule;if(n!==void 0&&r!==void 0)throw new Error("pass only one of --enable-schedules or --disable-schedules");let a=null,o;if(n!==void 0)a="enabled",o=n;else if(r!==void 0)a="disabled",o=r;else if(t.schedules!==void 0){o=t.schedules;let c=typeof t.scheduleMode=="string"?t.scheduleMode.trim().toLowerCase():"disabled";if(c==="none")return null;if(c!=="enabled"&&c!=="disabled")throw new Error("--schedule-mode must be enabled, disabled, or none");a=c}if(!a)return null;if(e.schedules.length===0)return{mode:a,schedules:[]};let s=ke(o,e),d=s===null?e.schedules:e.schedules.filter(c=>s.has(c.name));return{mode:a,schedules:d}}i(Ie,"resolveSandboxTemplateStartScheduleSelection");function ke(e,t){if(e===void 0||e===!0)return null;let n=String(e).trim();if(!n||n==="true"||n.toLowerCase()==="all")return null;if(n.toLowerCase()==="none")return new Set;let r=new Set(t.schedules.map(o=>o.name)),a=new Set(n.split(",").map(o=>o.trim()).filter(Boolean));for(let o of a)if(!r.has(o))throw new Error(`manifest schedule not found: ${o}`);return a}i(ke,"parseSandboxTemplateScheduleNameSelection");function Oe(e,t){let n=typeof t.scheduleOverrides=="string"?t.scheduleOverrides:typeof t.scheduleOverride=="string"?t.scheduleOverride:"";if(!n.trim())return new Map;let r=M(n,"schedule-overrides");if(!r||typeof r!="object"||Array.isArray(r))throw new Error("schedule-overrides must be a JSON object keyed by schedule name");let a=new Set(e.schedules.map(s=>s.name)),o=new Map;for(let[s,d]of Object.entries(r)){if(!a.has(s))throw new Error(`schedule override target does not exist: ${s}`);if(!d||typeof d!="object"||Array.isArray(d))throw new Error(`schedule override for ${s} must be an object`);o.set(s,d)}return o}i(Oe,"parseSandboxTemplateScheduleOverrides");function Ce(e){let t=Me(e.schedule,e.override),n=Ne(t);return{sourceSandboxId:e.sourceSandboxId,...e.teamId?{teamId:e.teamId}:{},...e.projectId?{projectId:e.projectId}:{},name:t.name,...t.description?{description:t.description}:{},...n,...t.timezone?{timezone:t.timezone}:{},enabled:typeof e.override?.enabled=="boolean"?e.override.enabled:e.mode==="enabled",...t.startAt?{startAt:t.startAt}:{},...t.endAt?{endAt:t.endAt}:{},...t.maxRuns!==void 0?{maxRuns:t.maxRuns}:{},runtimePolicy:t.runtimePolicy,target:Ae(e.manifest,t),...t.budget?{budget:t.budget}:{},...t.resources?{resources:t.resources}:{},...t.quotas?{quotas:t.quotas}:{},...t.lifecycle?{lifecycle:t.lifecycle}:{},...t.retentionPolicy?{retentionPolicy:t.retentionPolicy}:{},...t.env?{env:t.env}:{},...t.integrationLeases?{integrationLeases:t.integrationLeases}:{},metadata:{...t.metadata??{},manifestScheduleName:t.name,source:"openpond-code-sandbox-template-start"},managementSource:"openpond.yaml",manifestPath:f}}i(Ce,"buildSandboxTemplateStartScheduleInput");function Me(e,t){return t?{...e,...t,target:e.target||t.target?{...e.target??{},...t.target??{}}:void 0,metadata:e.metadata||t.metadata?{...e.metadata??{},...t.metadata??{}}:void 0}:e}i(Me,"mergeSandboxTemplateScheduleOverride");function Ne(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}i(Ne,"sandboxTemplateScheduleExpression");function Ae(e,t){let n=t.command??t.target?.command??null;if(n)return{kind:"command",command:n,requiresStart:t.requiresStart??t.target?.requiresStart??!1};let r=t.target?.kind??"action";if(r==="start")return{kind:"command",command:e.start.command,requiresStart:t.requiresStart??t.target?.requiresStart??e.start.requiresStart??!1};if(r==="service"){let s=t.target?.name??"",d=e.services.find(c=>c.name===s);if(!d)throw new Error(`schedule service target does not exist: ${s}`);return{kind:"command",command:d.command,requiresStart:t.requiresStart??t.target?.requiresStart??d.requiresStart??!1}}let a=t.actionName??t.action??t.target?.actionName??(t.target?.kind==="action"?t.target?.name:void 0),o=e.actions.find(s=>s.name===a);if(!o)throw new Error(`schedule action target does not exist: ${a??""}`);return{kind:"command",command:o.command,requiresStart:t.requiresStart??t.target?.requiresStart??o.requiresStart??!1}}i(Ae,"sandboxTemplateScheduleCommandTarget");import{existsSync as Ge}from"node:fs";import We from"node:path";import{stdin as Ke}from"node:process";async function D(e,t,n){let r=typeof t.repo=="string"?t.repo.trim():"";if(r)return A(r);await $e(n);let a=await ae(),o=ue(a),s=pe(a),d=await oe(a,o),c=await Se(n,"origin");if(!c){let l=typeof t.teamId=="string"?t.teamId.trim():"",u=await se(s,d,{name:e.name,description:e.description,repoInit:"empty",...l?{teamId:l}:{}});c=ie(u);let m=await g("git",["remote","add","origin",c],{cwd:n});if(m.code!==0)throw new Error(`git remote add failed: ${m.stderr.trim()||m.stdout.trim()||"unknown error"}`)}if(le(c),await Fe(n,t),!h(t.noPush)){let l=await je(n,t);await Be(n,c,l,d,t)}return A(c)}i(D,"resolveSandboxTemplateStartRepo");async function $e(e){let t=We.join(e,".git");if(Ge(t))return;let n=await g("git",["init"],{cwd:e});if(n.code!==0)throw new Error(`git init failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`)}i($e,"ensureGitRepository");async function Fe(e,t){let n=await g("git",["status","--porcelain"],{cwd:e});if(n.code!==0)throw new Error(`git status failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`);let a=(await g("git",["rev-parse","--verify","HEAD"],{cwd:e})).code===0,o=n.stdout.trim().length>0;if(!o&&a)return;if(!(h(t.commit)||h(t.yes)||(Ke.isTTY?await me(a?"Commit local changes before starting the sandbox?":"Create the initial git commit before starting the sandbox?",!a):!1))){if(!a)throw new Error("local repository has no commits; pass --commit or commit before starting");o&&console.warn("warning: uncommitted local changes will not be included in the sandbox");return}let d=await g("git",["add","-A"],{cwd:e});if(d.code!==0)throw new Error(`git add failed: ${d.stderr.trim()||d.stdout.trim()||"unknown error"}`);let c=typeof t.commitMessage=="string"&&t.commitMessage.trim()?t.commitMessage.trim():`start ${f} sandbox`,l=await g("git",["commit","-m",c],{cwd:e});if(l.code!==0){let u=l.stderr.trim()||l.stdout.trim();if(u.includes("nothing to commit")&&a)return;throw new Error(`git commit failed: ${u||"unknown error"}`)}}i(Fe,"ensureGitCommitForSandboxTemplateStart");async function je(e,t){let r=(typeof t.branch=="string"?t.branch.trim():"")||await he(e);if(!r)throw new Error("unable to resolve git branch; pass --branch");return r}i(je,"resolveSandboxTemplateStartBranch");async function Be(e,t,n,r,a){let o;try{o=de(t,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let s=h(a.keepTokenRemote)||h(a.token)||h(a.setRemoteToken),d=t.includes("x-access-token:"),c=!s&&!d?t:null,l=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!d){let m=await g("git",["remote","set-url","origin",o],{cwd:e});if(m.code!==0)throw new Error(`git remote set-url failed: ${ce(m.stderr.trim()||m.stdout.trim()||"unknown error")}`)}if((await g("git",["push","-u","origin",n],{cwd:e,inherit:!0})).code!==0)throw new Error("git push failed")}finally{c&&await g("git",["remote","set-url","origin",c],{cwd:e}).catch(()=>null),l===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=l}}i(Be,"pushGitBranchForSandboxTemplateStart");function $(e){return A(e).replace(/\.git$/,"")}i($,"normalizeSandboxTemplateRepoIdentity");function A(e){let t=new URL(e);t.username="",t.password="";let n=t.toString();return n.endsWith(".git")?n:`${n.replace(/\/$/,"")}.git`}i(A,"normalizeSandboxTemplateRepoUrl");async function _e(e){let t=L(e),n=S.dirname(t),r=await j.readFile(t,"utf8"),a=O(r);if(!a.ok){console.error(C(a.diagnostics)),process.exitCode=1;return}let o=a.manifest,s=G(o,e),d=await B(o,e,n),c=await D(o,e,n),l=await N(e),u=Ye(o,e,c),m=await Qe(l,u,c);await tt(l,m.id);let p=await ut(l,m.id,o,e),x=await V(l,m.id,d.uploadRequests),T={...d.scalars,..._(x,d.uploadRequests)},I=await X(l,m.id,s,T,bt(m)),k=await St(l,m.id,s.ports),E=await q(l,m.id,o,e);console.log(JSON.stringify({ok:!0,file:t,repo:c,executable:{kind:s.kind,name:s.name,command:s.command},sandbox:Re(m),setupCommands:p,uploadedFiles:x,input:T,execution:I,previews:k,schedules:E,expectedArtifacts:s.artifactPaths},null,2))}i(_e,"runSandboxTemplateStart");function G(e,t){let n=v(e),r=typeof t.action=="string"?t.action.trim():"",a=typeof t.service=="string"?t.service.trim():"",o=typeof t.target=="string"?t.target.trim():"",s=typeof t.entrypoint=="string"?t.entrypoint.trim():"",d=r||a||o||s||"start",c=r?"action":a?"service":"",l=n.find(u=>u.name===d&&(!c||u.kind===c));if(!l)throw new Error(`manifest executable not found: ${d}. Available: ${n.map(u=>`${u.kind}:${u.name}`).join(", ")}`);return l}i(G,"resolveSandboxTemplateStartExecutable");function Ye(e,t,n){let r=typeof t.budgetUsd=="string"&&t.budgetUsd.trim()?t.budgetUsd.trim():typeof t.budget=="string"&&t.budget.trim()?t.budget.trim():"0.05",a=R(t.maxDurationSeconds,"max-duration-seconds"),o=R(t.idleTimeoutSeconds,"idle-timeout-seconds"),s=typeof t.teamId=="string"?t.teamId.trim():"",d=typeof t.projectId=="string"?t.projectId.trim():"",c=typeof t.runtimeProjectId=="string"?t.runtimeProjectId.trim():"";if(d&&c&&d!==c)throw new Error("project-id and runtime-project-id must match when both are set");let l=d||c,u=typeof t.agentId=="string"?t.agentId.trim():"",m=typeof t.runtimeAgentId=="string"?t.runtimeAgentId.trim():"";if(u&&m&&u!==m)throw new Error("agent-id and runtime-agent-id must match when both are set");let p=u||m,x=fe(t.workflowMode),T=be(t.runtimePromotionPolicy),I=typeof t.runtimeBaseBranch=="string"&&t.runtimeBaseBranch.trim()?t.runtimeBaseBranch.trim():"",k=typeof t.runtimeBaseSha=="string"&&t.runtimeBaseSha.trim()?t.runtimeBaseSha.trim():"",E=typeof t.runtimeId=="string"&&t.runtimeId.trim()?t.runtimeId.trim():"",te=!!(x||T||I||k||E||c||m),ne=xe(e,t),re=Xe(e);return{sandbox:{repo:n,...s?{teamId:s}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},resources:e.resources??{},networkPolicy:{internetEgress:He(e.network.egress)},budget:{maxUsd:r},quotas:{maxSpendUsd:r,...a!==void 0?{maxDurationSeconds:a}:{},...o!==void 0?{idleTimeoutSeconds:o}:{}},...ne.length>0?{env:ne}:{},...re?{workloadSource:re}:{},volumes:e.volumes,metadata:{source:"openpond-code-sandbox-template-start",manifestFile:f,template:{name:e.name,version:e.version,useCase:e.useCase}}},...te&&E?{runtimeId:E}:{},...te&&!E?{sandboxRuntime:{...s?{teamId:s}:{},...x?{workflowMode:x}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},baseBranch:I||"master",...k?{baseSha:k}:{},...T?{promotionPolicy:T}:{}}}:{}}}i(Ye,"buildSandboxTemplateStartCreateInput");function Xe(e){if(e.runtime.image)return{image:e.runtime.image};if(e.runtime.dockerfile)return{dockerfile:e.runtime.dockerfile}}i(Xe,"sandboxWorkloadSourceFromManifest");function He(e){return e==="allow"?"allow":"block"}i(He,"sandboxTemplateInternetEgressPolicy");async function Qe(e,t,n){let r=Date.now();try{return(await Ee(e,t)).sandbox}catch(a){if(!Ze(a))throw a;return console.warn("warning: sandbox create timed out; checking for the created sandbox record"),et(e,t.sandbox,n,r)}}i(Qe,"createSandboxTemplateStartSandbox");function Ze(e){return e instanceof Error&&/\b(504|timed out|timeout)\b/i.test(e.message)}i(Ze,"isLikelySandboxCreateTimeout");async function et(e,t,n,r){let s=Date.now()+72e4,d=$(n),c=t.metadata??{};for(;Date.now()<s;){let u=(await e.list({...t.teamId?{teamId:t.teamId}:{},...t.projectId?{projectId:t.projectId}:{},...t.agentId?{agentId:t.agentId}:{}})).filter(m=>{if(!m.repo||$(m.repo)!==d)return!1;let p=Date.parse(m.createdAt);return!(Number.isFinite(p)&&p<r-3e4||c.source&&m.metadata?.source!==c.source)}).sort((m,p)=>Date.parse(p.createdAt)-Date.parse(m.createdAt))[0];if(u?.state==="running"||u?.state==="stopped")return u;if(u?.state==="error")throw new Error(`sandbox create failed after timeout: ${u.id}
|
|
3
3
|
${u.logs.join(`
|
|
4
4
|
`)}`);await W(3e3)}throw new Error("sandbox create timed out and no matching created sandbox reached running state")}i(et,"recoverTimedOutSandboxCreate");async function tt(e,t){let a=Date.now()+12e4,o=null;for(;Date.now()<a;){try{let s=await e.exec(t,{command:"true",timeoutSeconds:30});if(s.command.status==="succeeded"&&s.command.exitCode===0)return;o=new Error(`readiness command ${s.command.status} with exit code ${String(s.command.exitCode)}`)}catch(s){if(o=s,!nt(s))throw s}await W(3e3)}throw new Error(`sandbox runner was not ready after create: ${rt(o)}`)}i(tt,"waitForSandboxTemplateRunnerReady");function nt(e){return e instanceof Error&&/\b(502|503|504|timed out|timeout|sandbox_not_found|sandbox_not_ready|sandbox_runner_failed)\b/i.test(e.message)}i(nt,"isRetryableSandboxRunnerReadyError");function rt(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown error"}i(rt,"formatUnknownError");function W(e){return new Promise(t=>setTimeout(t,e))}i(W,"sleep");async function B(e,t,n){let r=at(t),a=st(e),o=[],s=ot(t);for(let[c,l]of Object.entries(s)){let u=a.get(c);if(!u)throw new Error(`${c} is not declared as a file upload input in ${f}`);let m=await dt(l,n);if(!u.multiple&&m.length>1)throw new Error(`${c} accepts one file, got ${m.length}`);o.push({inputName:c,localPaths:m,spec:u})}let d=Array.isArray(e.inputs.schema.required)?e.inputs.schema.required.filter(c=>typeof c=="string"):[];for(let c of d)if(a.has(c)&&!o.some(l=>l.inputName===c))throw new Error(`${c} is required; pass --input-file ${c}=<path> or --input-files ${c}=<glob>`);return{scalars:r,uploadRequests:o}}i(B,"resolveSandboxTemplateStartInput");function at(e){let t=typeof e.inputs=="string"?e.inputs:typeof e.inputJson=="string"?e.inputJson:typeof e.params=="string"?e.params:"",n=t?M(t,"inputs"):{};if(!n||typeof n!="object"||Array.isArray(n))throw new Error("inputs must be a JSON object");let r=typeof e.input=="string"?e.input.trim():"";if(r){let[a,o]=J(r,"input");n[a]=o}return n}i(at,"parseSandboxTemplateScalarInputs");function ot(e){let t={},n=typeof e.inputFile=="string"?e.inputFile.trim():"";if(n){let[a,o]=J(n,"input-file");t[a]=o}let r=typeof e.inputFiles=="string"?e.inputFiles.trim():"";if(r){let[a,o]=J(r,"input-files");t[a]=o}return t}i(ot,"parseSandboxTemplateFileInputOptions");function J(e,t){let n=e.indexOf("=");if(n<=0)throw new Error(`${t} must be formatted as name=value`);let r=e.slice(0,n).trim(),a=e.slice(n+1).trim();if(!r||!a)throw new Error(`${t} must be formatted as name=value`);return[r,a]}i(J,"parseKeyValueOption");function st(e){let t=F(e.inputs.schema.properties)??{},n=new Map;for(let[r,a]of Object.entries(t)){let o=F(a);if(!o)continue;let s=F(o["x-openpond-upload"]??o.xOpenPondUpload);if(!s)continue;let d=typeof s.targetPath=="string"&&s.targetPath.trim()?it(s.targetPath):"";if(!d)throw new Error(`${r} upload metadata is missing targetPath`);let c=s.multiple===!0||o.type==="array"||F(o.items)?.format==="file";n.set(r,{inputName:r,multiple:c,targetPath:d})}return n}i(st,"collectSandboxTemplateUploadSpecs");function F(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}i(F,"asPlainRecord");function it(e){let t=e.trim().replace(/\\/g,"/").replace(/^\/workspace\//,"").replace(/^\.\//,"").replace(/^\/+/,"");if(!t||t.split("/").some(n=>n===".."||n===""))throw new Error(`invalid upload target path: ${e}`);if(t.split("/").some(K))throw new Error("sandbox template uploads cannot target .env* files; create sandbox secrets and pass refs with --env-ref");return t}i(it,"normalizeSandboxUploadTargetPath");async function dt(e,t){let n=e.split(",").map(a=>a.trim()).filter(Boolean),r=(await Promise.all(n.map(a=>ct(a,t)))).flat();if(r.length===0)throw new Error(`no files matched ${e}`);return r}i(dt,"expandSandboxTemplateUploadPaths");async function ct(e,t){let n=S.resolve(t,e);if(!e.includes("*")){if(lt(n),!(await j.stat(n)).isFile())throw new Error(`upload path is not a file: ${n}`);return[n]}let r=S.dirname(n),a=S.basename(n),o=mt(a),d=(await j.readdir(r,{withFileTypes:!0})).filter(l=>l.isFile()&&o.test(l.name)).sort((l,u)=>l.name.localeCompare(u.name));if(d.find(l=>K(l.name)))throw new Error("sandbox template uploads cannot include .env* files; create sandbox secrets and pass refs with --env-ref");return d.map(l=>S.join(r,l.name)).sort((l,u)=>l.localeCompare(u))}i(ct,"expandSandboxTemplateUploadPath");function lt(e){if(K(S.basename(e)))throw new Error("sandbox template uploads cannot include .env* files; create sandbox secrets and pass refs with --env-ref")}i(lt,"assertSandboxTemplateUploadPathAllowed");function K(e){return e===".env"||e.startsWith(".env.")}i(K,"isSandboxEnvFileName");function mt(e){let t=e.split("*").map(n=>n.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${t}$`)}i(mt,"globBasenameToRegExp");async function ut(e,t,n,r){let a=R(r.setupTimeoutSeconds,"setup-timeout-seconds")??900,o=[];for(let s of n.setup.commands){let d=await pt(e,t,s,a);if(o.push({command:s,status:d.status,exitCode:d.exitCode}),d.status!=="succeeded"||d.exitCode!==0)throw new Error(`setup command failed: ${s}
|
|
5
5
|
${d.output}`)}return o}i(ut,"runSandboxTemplateSetupCommands");async function V(e,t,n){let r=[];for(let a of n)for(let o of a.localPaths){let s=await j.readFile(o),d=Y(a.spec.targetPath,S.basename(o));await e.uploadFileBase64(t,d,s.toString("base64")),r.push({inputName:a.inputName,localPath:o,sandboxPath:d,sizeBytes:s.byteLength})}return r}i(V,"uploadSandboxTemplateStartFiles");function Y(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}i(Y,"joinSandboxUploadPath");function _(e,t){let n={};for(let r of t){let a=e.filter(o=>o.inputName===r.inputName).map(o=>o.sandboxPath);n[r.inputName]=r.spec.multiple?a:a[0]??""}return n}i(_,"formatUploadedFileParams");async function X(e,t,n,r,a={}){await ft(e,t,r);let o=xt(n,a),s=n.timeoutSeconds;if(n.kind==="service")return{kind:"service",process:(await e.startProcess(t,{command:o,...s!==void 0?{timeoutSeconds:s}:{}})).process};let d=await Le(e,t,o,s??900);if(d.status!=="succeeded"||d.exitCode!==0)throw new Error(`template command failed: ${n.name}
|