openpond 0.0.38 → 0.0.39
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/README.md +3 -4
- package/dist/api/core.d.ts +6 -0
- package/dist/api/vercel-protection.d.ts +1 -0
- package/dist/chunks/{app-layer-DPUJRNO2.js → app-layer-LTBWNA2F.js} +32 -10
- package/dist/chunks/app-server-runtime-VYYJ2AWX.js +18 -0
- package/dist/chunks/{apps-AKBI6AS7.js → apps-CZAJBGE3.js} +6 -4
- package/dist/chunks/{chunk-LZZM3IHS.js → chunk-2SF6HLT7.js} +5899 -5939
- package/dist/chunks/{chunk-XCATKTK3.js → chunk-3CDPPVLE.js} +108 -66
- package/dist/chunks/{chunk-JWF37O5E.js → chunk-3HW6OSHP.js} +1 -3
- package/dist/chunks/{chunk-43YI36NA.js → chunk-3KLQ52B2.js} +228 -5
- package/dist/chunks/chunk-4HIWFIMN.js +37172 -0
- package/dist/chunks/{chunk-AHPQTEIJ.js → chunk-4N6E3OVF.js} +4 -4
- package/dist/chunks/{chunk-YTJL6XPU.js → chunk-6V7MJVRO.js} +56 -11
- package/dist/chunks/{chunk-QRM7XMAO.js → chunk-BQQZNGI6.js} +152 -161
- package/dist/chunks/chunk-DBHSOTYZ.js +1552 -0
- package/dist/chunks/{chunk-275WCETC.js → chunk-FCVVOMIP.js} +145 -5
- package/dist/chunks/{chunk-GB6VUZUA.js → chunk-JIEUB6OS.js} +1 -1
- package/dist/chunks/{chunk-HS2AGRDV.js → chunk-JJPAMKXZ.js} +1 -1
- package/dist/chunks/{chunk-GDZYDLEL.js → chunk-JRROTGQT.js} +1 -110
- package/dist/chunks/chunk-KHNHUA2H.js +1737 -0
- package/dist/chunks/{chunk-AHNFNWUN.js → chunk-L6XH4ZGZ.js} +1 -1
- package/dist/chunks/chunk-M2NXTLH2.js +4054 -0
- package/dist/chunks/{chunk-SLMP353Q.js → chunk-MIZHCABO.js} +2 -195
- package/dist/chunks/chunk-SMNFI2FU.js +113 -0
- package/dist/chunks/chunk-VCVQLECH.js +675 -0
- package/dist/chunks/{chunk-V35STJF4.js → chunk-ZJBJQCQZ.js} +179 -52
- package/dist/chunks/{cli-7BKDWFNU.js → cli-JS76LCW2.js} +9 -5
- package/dist/chunks/{core-commands-YN4RMWA3.js → core-commands-4MRJQZJV.js} +7 -5
- package/dist/chunks/{harness-BHQRMXJR.js → desktop-test-RNMWLOVU.js} +15 -14
- package/dist/chunks/{chunk-XERQHYBO.js → extension-GDRW22N3.js} +5868 -3580
- package/dist/chunks/{help-VREQNA4I.js → help-LWNREJ7U.js} +1 -1
- package/dist/chunks/{opchat-D63YTNSX.js → opchat-2K2JIGK3.js} +9 -10
- package/dist/chunks/{organizations-I46KG7TC.js → organizations-Z5HVD2E7.js} +11 -9
- package/dist/chunks/{profile-WKZJHEPG.js → profile-QNECVVGN.js} +12 -38
- package/dist/chunks/{project-agent-ZUC3YMCT.js → project-agent-W3V75WBR.js} +9 -411
- package/dist/chunks/{sandbox-command-AAOPFTI5.js → sandbox-command-X3FO74NX.js} +7 -5
- package/dist/chunks/{sandbox-template-GKNVR4C5.js → sandbox-template-5B4T4BGU.js} +8 -6
- package/dist/chunks/{src-RPW5TOPI.js → src-ESAILPUH.js} +32 -30
- package/dist/chunks/src-IC5RX4L6.js +63517 -0
- package/dist/chunks/{teams-bot-PSL3ZO6Z.js → teams-bot-NTQ6VFFL.js} +6 -4
- package/dist/chunks/training-BR5A7SPU.js +320 -0
- package/dist/chunks/{workspaces-BPXC2DHT.js → workspaces-XC3QBD2Y.js} +2 -2
- package/dist/cli.js +24 -12
- package/dist/config.d.ts +9 -3
- package/dist/index.js +1300 -1045
- package/dist/profile/local-profile-types.d.ts +16 -0
- package/dist/profile/local-profile.d.ts +50 -4
- package/dist/sandbox/client-handles.d.ts +33 -46
- package/dist/sandbox/client.d.ts +4 -26
- package/dist/sandbox/sandbox-instance-client.d.ts +5 -5
- package/dist/sandbox/types/client.d.ts +1 -2
- package/dist/sandbox/types/core.d.ts +0 -1
- package/dist/sandbox/types/org-project-agent.d.ts +3 -89
- package/dist/sandbox/types/record.d.ts +1 -2
- package/dist/sandbox/types/runtime-profiles.d.ts +2 -2
- package/dist/sandbox-template/manifest.d.ts +1 -1
- package/dist/skills/openpond-agent-authoring/SKILL.md +40 -0
- package/dist/skills/openpond-agent-authoring/references/action-and-chat-design.md +13 -0
- package/dist/skills/openpond-agent-authoring/references/integrations-and-setup.md +13 -0
- package/dist/skills/openpond-agent-authoring/references/profile-layout.md +29 -0
- package/dist/skills/openpond-agent-authoring/references/validation-and-repair.md +14 -0
- package/dist/skills/openpond-desktop-harness/SKILL.md +1 -1
- package/dist/skills/openpond-skill-authoring/SKILL.md +44 -0
- package/dist/skills/openpond-skill-authoring/references/copying-and-adaptation.md +16 -0
- package/dist/skills/openpond-skill-authoring/references/skill-package-layout.md +38 -0
- package/dist/skills/openpond-skill-authoring/references/validation-and-repair.md +24 -0
- package/dist/skills/openpond-skill-authoring/scripts/validate-skill.mjs +102 -0
- package/dist/skills/openpond-taskset-authoring/SKILL.md +64 -22
- package/dist/skills/openpond-taskset-authoring/artifact.json +39 -0
- package/dist/skills/openpond-taskset-authoring/references/graders-and-rewards.md +3 -0
- package/dist/skills/openpond-taskset-authoring/references/method-selection.md +1 -1
- package/dist/skills/openpond-taskset-authoring/references/privacy-and-provenance.md +2 -0
- package/dist/skills/openpond-taskset-authoring/references/task-design.md +32 -0
- package/dist/web/assets/{AppDialog-DrwJb_wG.js → AppDialog-Bua3f-6v.js} +1 -1
- package/dist/web/assets/{AppsView-DPagLMsc.js → AppsView-DrJkHeSO.js} +1 -1
- package/dist/web/assets/BrowserSidebar-Bf-4Vozm.js +1 -0
- package/dist/web/assets/CommandMenu-DDZlGQiB.js +1 -0
- package/dist/web/assets/CommunityView-BtcCrba7.js +1 -0
- package/dist/web/assets/ComposerCreateImproveStrip-DOe5Otg6.js +1 -0
- package/dist/web/assets/GetStartedView-CG4z0Dtw.js +1 -0
- package/dist/web/assets/GetStartedView-yVmnGZPw.css +1 -0
- package/dist/web/assets/LabModelVersionDetailPage-BEkmSKuv.js +1 -0
- package/dist/web/assets/LabSkillSidebar-BIotN_RB.js +1 -0
- package/dist/web/assets/LabsRoute-CfOe0Zt5.js +3 -0
- package/dist/web/assets/LabsRoute-CoSPO4HR.css +1 -0
- package/dist/web/assets/MainChatThread-C0-l1mHt.js +2 -0
- package/dist/web/assets/MainPane-Bky_Rqcx.css +1 -0
- package/dist/web/assets/MainPane-aOVlVyRK.js +6 -0
- package/dist/web/assets/MarkdownText-D7DT1k1k.js +9 -0
- package/dist/web/assets/Messages-CBIXruA9.js +9 -0
- package/dist/web/assets/NativeSkillSidebar-C4t69Y7B.js +1 -0
- package/dist/web/assets/NewProjectDialog-Bat65tYD.js +1 -0
- package/dist/web/assets/OutputsPage-C58n39Db.js +1 -0
- package/dist/web/assets/RightChatPanelStack-Bp7nZxQ0.js +1 -0
- package/dist/web/assets/ScheduledWorkPage-BXP0j_c_.js +1 -0
- package/dist/web/assets/SettingsView-CtWK_aQ0.css +1 -0
- package/dist/web/assets/SettingsView-DOOfhO9a.js +6 -0
- package/dist/web/assets/TeamChatView-Cgxm-pKA.css +1 -0
- package/dist/web/assets/TeamChatView-De2wdqyY.js +3 -0
- package/dist/web/assets/{TerminalOverlay-BKl0p8pa.js → TerminalOverlay-BsuCH3NX.js} +1 -1
- package/dist/web/assets/TrainingCreationPanel-D2OFWyQ-.js +1 -0
- package/dist/web/assets/TrainingDraftPanel-DBpulXTz.js +1 -0
- package/dist/web/assets/{UsageSettingsSection-zDAwzTGl.js → UsageSettingsSection-DzMLUXAO.js} +37 -37
- package/dist/web/assets/WorkspaceDiffPanel-B7yIhjNF.js +14 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-B6jXM9xG.js +32 -0
- package/dist/web/assets/WorkspaceGitDialogs-CQ0fl9Qk.js +1 -0
- package/dist/web/assets/{WorkspaceMonacoEditor-DPGcG8fy.js → WorkspaceMonacoEditor-C2ctzITz.js} +3 -3
- package/dist/web/assets/arrow-up-right-ecwcx3xt.js +1 -0
- package/dist/web/assets/chevron-up-DP8PPfWd.js +1 -0
- package/dist/web/assets/circle-alert-envg1D6O.js +1 -0
- package/dist/web/assets/cloud-upload-5MGPLnaA.js +1 -0
- package/dist/web/assets/{cssMode-CKN9CcfG.js → cssMode-CFifcEfw.js} +1 -1
- package/dist/web/assets/folder-open-Dq3ZjeEP.js +1 -0
- package/dist/web/assets/folder-plus-EiZ5wbv_.js +1 -0
- package/dist/web/assets/git-branch-w29jmQ-X.js +1 -0
- package/dist/web/assets/{git-commit-horizontal-Bxi8YPep.js → git-commit-horizontal-CGZM0PZo.js} +1 -1
- package/dist/web/assets/{htmlMode-CeUcNhBZ.js → htmlMode-Ct1P-_lf.js} +1 -1
- package/dist/web/assets/index-ByIQyiUl.js +178 -0
- package/dist/web/assets/index-D4uCeiep.js +1 -0
- package/dist/web/assets/index-D9jTe16Q.css +1 -0
- package/dist/web/assets/info-Cd2HkIeb.js +1 -0
- package/dist/web/assets/{jsonMode-97z0Yz9u.js → jsonMode-BAUNCNAX.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-D4Tp-JmI.js → lspLanguageFeatures-fucFYI1A.js} +1 -1
- package/dist/web/assets/monaco.contribution-Ce4v5kei.js +2 -0
- package/dist/web/assets/monaco.contribution-DLLMi4cB.js +2 -0
- package/dist/web/assets/monaco.contribution-g9QiIm1d.js +2 -0
- package/dist/web/assets/monaco.contribution-nG-5Cyjz.js +2 -0
- package/dist/web/assets/monitor-DgHCnCKl.js +1 -0
- package/dist/web/assets/{play-C-37dnR1.js → play-Be0XDHBu.js} +1 -1
- package/dist/web/assets/{python-CGpDXY7_.js → python-CEhEiPo7.js} +1 -1
- package/dist/web/assets/{refresh-cw-BAaaPCXl.js → refresh-cw-DH0KLbdD.js} +1 -1
- package/dist/web/assets/reply-D1TK2yV8.js +1 -0
- package/dist/web/assets/{save-Cvxs3XyC.js → save-C1MSeBnQ.js} +1 -1
- package/dist/web/assets/square-CemI-0g5.js +1 -0
- package/dist/web/assets/square-pen-CqfsvR_n.js +1 -0
- package/dist/web/assets/{toggleHighContrast-CD42jH4g.js → toggleHighContrast-DrdQN3Rl.js} +1 -1
- package/dist/web/assets/training-BQVNUTZA.css +1 -0
- package/dist/web/assets/training-model-data-B7-1Bxil.js +1 -0
- package/dist/web/assets/{tsMode-ZROIxEjv.js → tsMode-CKB5oOUU.js} +1 -1
- package/dist/web/assets/{upload-DvCSGERK.js → upload-t751LLqP.js} +1 -1
- package/dist/web/assets/useLocalAgentSchedules-CzC3wfIP.js +1 -0
- package/dist/web/assets/{wifi-off-BIb94PkS.js → wifi-off-CxTHH3JU.js} +1 -1
- package/dist/web/assets/{workers-oYqbrVYG.js → workers-CqYddzCd.js} +1 -1
- package/dist/web/assets/{yaml-WqBjNgOO.js → yaml-e5wBkc-C.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/command-reference.md +75 -40
- package/package.json +3 -1
- package/dist/chunks/chunk-FWLOFUPU.js +0 -864
- package/dist/chunks/chunk-HLCTINEP.js +0 -224
- package/dist/chunks/chunk-MPGSHXGF.js +0 -3896
- package/dist/chunks/chunk-T4QXKU5Y.js +0 -1
- package/dist/chunks/chunk-XEJ7XXUQ.js +0 -1301
- package/dist/chunks/chunk-ZI4GDAUB.js +0 -3522
- package/dist/chunks/cli-2KBVNDRY.js +0 -23
- package/dist/chunks/extend-REGNTBK3.js +0 -89
- package/dist/chunks/extension-7K77DAVL.js +0 -121
- package/dist/chunks/fileFromPath-DHCRY3BD.js +0 -2151
- package/dist/chunks/src-MWDIK56B.js +0 -105881
- package/dist/web/assets/BrowserSidebar-DMn2V8RV.js +0 -1
- package/dist/web/assets/CloudWorkView-Cl_7mM3c.js +0 -1
- package/dist/web/assets/CloudWorkView-DNoPIlMj.css +0 -1
- package/dist/web/assets/CommandMenu-CHMQLez_.js +0 -1
- package/dist/web/assets/CommunityView-DcHVDUk0.js +0 -1
- package/dist/web/assets/ComposerCreateImproveStrip-BZ3Dgzmo.js +0 -1
- package/dist/web/assets/GetStartedView-DBLdduwr.css +0 -1
- package/dist/web/assets/GetStartedView-DTRotFqz.js +0 -1
- package/dist/web/assets/LabSkillSidebar-D-PqFe1T.js +0 -1
- package/dist/web/assets/LabsRoute-BrJkBNig.css +0 -1
- package/dist/web/assets/LabsRoute-Dew1BwK5.js +0 -3
- package/dist/web/assets/MainChatThread-BaPxxzrw.js +0 -2
- package/dist/web/assets/MakeAgentTutorialLearningPanel-CBsfnONQ.js +0 -2
- package/dist/web/assets/MarkdownText-DGLfAM_Z.js +0 -7
- package/dist/web/assets/Messages-CIX9uTjX.js +0 -10
- package/dist/web/assets/NativeSkillSidebar-AP_uHn6g.js +0 -1
- package/dist/web/assets/NewProjectDialog-C6lHkafU.js +0 -1
- package/dist/web/assets/PostTrainingLearningPanel-CZEgPc8O.js +0 -2
- package/dist/web/assets/PostTrainingStatusPill-CeEpwUDB.js +0 -1
- package/dist/web/assets/ProfileSettingsSection-Cg4tKO-C.css +0 -1
- package/dist/web/assets/ProfileSettingsSection-EumMLlEp.js +0 -1
- package/dist/web/assets/RightChatPanelStack-MXBcx3zO.js +0 -1
- package/dist/web/assets/SettingsView-Caljbns2.css +0 -1
- package/dist/web/assets/SettingsView-DyURG_Uh.js +0 -6
- package/dist/web/assets/TeamChatView-Bx44q3WV.css +0 -1
- package/dist/web/assets/TeamChatView-D3v6aqJ3.js +0 -3
- package/dist/web/assets/TrainingCreationPanel-CfZQTuT5.js +0 -1
- package/dist/web/assets/TrainingDraftPanel-DslRPSDW.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-C_MZPPlL.js +0 -14
- package/dist/web/assets/WorkspaceEnvironmentMenu-BUAnn80j.js +0 -32
- package/dist/web/assets/WorkspaceGitDialogs-Drbf4ujA.js +0 -1
- package/dist/web/assets/activity-Dnr3jqb3.js +0 -1
- package/dist/web/assets/boxes-BinC8UPn.js +0 -1
- package/dist/web/assets/chevron-up-Bjp_-_Cb.js +0 -1
- package/dist/web/assets/circle-x-ubnvEYuE.js +0 -1
- package/dist/web/assets/copy-B_ZCCUMz.js +0 -1
- package/dist/web/assets/create-pipeline-request-D6uLUxe9.js +0 -4
- package/dist/web/assets/file-8HAMlTmQ.js +0 -1
- package/dist/web/assets/git-branch-l2Zih3Bv.js +0 -1
- package/dist/web/assets/index-BMFyOFRU.css +0 -1
- package/dist/web/assets/index-BzwcDzbT.js +0 -1
- package/dist/web/assets/index-KoQSSt_f.js +0 -177
- package/dist/web/assets/info-JTbDQxHx.js +0 -1
- package/dist/web/assets/make-agent-tutorial-D6nBCgv-.js +0 -2
- package/dist/web/assets/monaco.contribution-B3j6oown.js +0 -2
- package/dist/web/assets/monaco.contribution-BXHxPPWL.js +0 -2
- package/dist/web/assets/monaco.contribution-C2P5zIzh.js +0 -2
- package/dist/web/assets/monaco.contribution-C8c6OtGi.js +0 -2
- package/dist/web/assets/monitor-kzHtxHnA.js +0 -1
- package/dist/web/assets/reply-9rehU13k.js +0 -1
- package/dist/web/assets/rotate-cw-C1Z_Xs23.js +0 -1
- package/dist/web/assets/training-BN8CALIc.css +0 -1
- package/dist/web/assets/training-model-data-BXUCzS0p.js +0 -1
- package/docs/agent-edit-check-status-json.md +0 -132
|
@@ -0,0 +1,1737 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// ../../packages/cloud/dist/api/vercel-protection.js
|
|
4
|
+
var VERCEL_PROTECTION_BYPASS_HEADER = "x-vercel-protection-bypass";
|
|
5
|
+
function withVercelProtectionBypass(requestUrl, inputHeaders, env = typeof process === "undefined" ? {} : process.env) {
|
|
6
|
+
const headers = new Headers(inputHeaders);
|
|
7
|
+
const secret = env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();
|
|
8
|
+
if (!secret || !isOpenPondStagingUrl(requestUrl))
|
|
9
|
+
return headers;
|
|
10
|
+
headers.set(VERCEL_PROTECTION_BYPASS_HEADER, secret);
|
|
11
|
+
return headers;
|
|
12
|
+
}
|
|
13
|
+
function isOpenPondStagingUrl(requestUrl) {
|
|
14
|
+
try {
|
|
15
|
+
const hostname = new URL(requestUrl).hostname.toLowerCase();
|
|
16
|
+
return hostname === "staging.openpond.ai" || hostname === "staging-api.openpond.ai" || hostname.endsWith(".staging-api.openpond.ai");
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ../../packages/cloud/dist/api/core.js
|
|
23
|
+
var DEFAULT_API_TIMEOUT_MS = 3e4;
|
|
24
|
+
var DEFAULT_API_RESPONSE_BYTES = 8 * 1024 * 1024;
|
|
25
|
+
var LONG_STREAM_API_OPTIONS = { timeoutMs: 15 * 60 * 1e3, maxResponseBytes: 64 * 1024 * 1024 };
|
|
26
|
+
var ApiTimeoutError = class extends Error {
|
|
27
|
+
timeoutMs;
|
|
28
|
+
requestUrl;
|
|
29
|
+
code = "OPENPOND_API_TIMEOUT";
|
|
30
|
+
constructor(timeoutMs, requestUrl) {
|
|
31
|
+
super(`API request timed out after ${timeoutMs}ms: ${requestUrl}`);
|
|
32
|
+
this.timeoutMs = timeoutMs;
|
|
33
|
+
this.requestUrl = requestUrl;
|
|
34
|
+
this.name = "ApiTimeoutError";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var ApiResponseTooLargeError = class extends Error {
|
|
38
|
+
maximumBytes;
|
|
39
|
+
requestUrl;
|
|
40
|
+
code = "OPENPOND_API_RESPONSE_TOO_LARGE";
|
|
41
|
+
constructor(maximumBytes, requestUrl) {
|
|
42
|
+
super(`API response exceeded ${maximumBytes} bytes: ${requestUrl}`);
|
|
43
|
+
this.maximumBytes = maximumBytes;
|
|
44
|
+
this.requestUrl = requestUrl;
|
|
45
|
+
this.name = "ApiResponseTooLargeError";
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var OpenPondApiError = class extends Error {
|
|
49
|
+
status;
|
|
50
|
+
apiMessage;
|
|
51
|
+
code;
|
|
52
|
+
constructor(status, errorCode, label, apiMessage = null) {
|
|
53
|
+
const detail = apiMessage || errorCode;
|
|
54
|
+
super(`${label} failed: ${status}${detail ? ` ${detail}` : ""}`);
|
|
55
|
+
this.status = status;
|
|
56
|
+
this.apiMessage = apiMessage;
|
|
57
|
+
this.name = "OpenPondApiError";
|
|
58
|
+
this.code = errorCode || "OPENPOND_API_ERROR";
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
async function apiFetch(baseUrl, token, requestPath, options = {}) {
|
|
62
|
+
const { timeoutMs = DEFAULT_API_TIMEOUT_MS, maxResponseBytes = DEFAULT_API_RESPONSE_BYTES, ...init } = options;
|
|
63
|
+
const requestUrl = `${baseUrl}${requestPath}`;
|
|
64
|
+
const headers = withVercelProtectionBypass(requestUrl, init.headers);
|
|
65
|
+
headers.set("Content-Type", "application/json");
|
|
66
|
+
const apiKey = process.env.OPENPOND_API_KEY;
|
|
67
|
+
const trimmedToken = token?.trim() || "";
|
|
68
|
+
const tokenIsApiKey = trimmedToken.startsWith("opk_");
|
|
69
|
+
const effectiveApiKey = apiKey || (tokenIsApiKey ? trimmedToken : null);
|
|
70
|
+
if (effectiveApiKey && !headers.has("openpond-api-key"))
|
|
71
|
+
headers.set("openpond-api-key", effectiveApiKey);
|
|
72
|
+
if (token) {
|
|
73
|
+
headers.set("Authorization", tokenIsApiKey ? `ApiKey ${trimmedToken}` : `Bearer ${token}`);
|
|
74
|
+
} else if (apiKey && !headers.has("Authorization")) {
|
|
75
|
+
headers.set("Authorization", `ApiKey ${apiKey}`);
|
|
76
|
+
}
|
|
77
|
+
const timeoutController = new AbortController();
|
|
78
|
+
const timeoutError = new ApiTimeoutError(timeoutMs, requestUrl);
|
|
79
|
+
const timer = timeoutMs > 0 ? setTimeout(() => timeoutController.abort(timeoutError), timeoutMs) : null;
|
|
80
|
+
timer?.unref?.();
|
|
81
|
+
const signal = composedSignal(init.signal, timeoutController.signal, timeoutMs);
|
|
82
|
+
const cleanup = () => {
|
|
83
|
+
if (timer)
|
|
84
|
+
clearTimeout(timer);
|
|
85
|
+
};
|
|
86
|
+
try {
|
|
87
|
+
const response = await fetch(requestUrl, { ...init, headers, signal });
|
|
88
|
+
return boundedResponse(response, {
|
|
89
|
+
cleanup,
|
|
90
|
+
maximumBytes: maxResponseBytes,
|
|
91
|
+
requestUrl,
|
|
92
|
+
timeoutController,
|
|
93
|
+
timeoutError
|
|
94
|
+
});
|
|
95
|
+
} catch (error) {
|
|
96
|
+
cleanup();
|
|
97
|
+
if (timeoutController.signal.aborted)
|
|
98
|
+
throw timeoutError;
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async function readApiJson(response, label) {
|
|
103
|
+
let payload;
|
|
104
|
+
try {
|
|
105
|
+
const text = await response.text();
|
|
106
|
+
payload = text ? JSON.parse(text) : {};
|
|
107
|
+
} catch (error) {
|
|
108
|
+
if (error instanceof ApiTimeoutError || error instanceof ApiResponseTooLargeError)
|
|
109
|
+
throw error;
|
|
110
|
+
payload = {};
|
|
111
|
+
}
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
const errorCode = typeof payload.error === "string" ? payload.error : null;
|
|
114
|
+
const apiMessage = typeof payload.message === "string" ? payload.message : null;
|
|
115
|
+
throw new OpenPondApiError(response.status, errorCode, label, apiMessage);
|
|
116
|
+
}
|
|
117
|
+
return payload;
|
|
118
|
+
}
|
|
119
|
+
function boundedResponse(response, input) {
|
|
120
|
+
if (!response.body) {
|
|
121
|
+
input.cleanup();
|
|
122
|
+
return response;
|
|
123
|
+
}
|
|
124
|
+
const contentLength = Number(response.headers.get("content-length"));
|
|
125
|
+
if (input.maximumBytes > 0 && Number.isFinite(contentLength) && contentLength > input.maximumBytes) {
|
|
126
|
+
input.cleanup();
|
|
127
|
+
void response.body.cancel();
|
|
128
|
+
throw new ApiResponseTooLargeError(input.maximumBytes, input.requestUrl);
|
|
129
|
+
}
|
|
130
|
+
const reader = response.body.getReader();
|
|
131
|
+
let receivedBytes = 0;
|
|
132
|
+
const body = new ReadableStream({
|
|
133
|
+
async pull(controller) {
|
|
134
|
+
try {
|
|
135
|
+
const result = await reader.read();
|
|
136
|
+
if (result.done) {
|
|
137
|
+
input.cleanup();
|
|
138
|
+
controller.close();
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
receivedBytes += result.value.byteLength;
|
|
142
|
+
if (input.maximumBytes > 0 && receivedBytes > input.maximumBytes) {
|
|
143
|
+
input.cleanup();
|
|
144
|
+
await reader.cancel();
|
|
145
|
+
controller.error(new ApiResponseTooLargeError(input.maximumBytes, input.requestUrl));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
controller.enqueue(result.value);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
input.cleanup();
|
|
151
|
+
controller.error(input.timeoutController.signal.aborted ? input.timeoutError : error);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
async cancel(reason) {
|
|
155
|
+
input.cleanup();
|
|
156
|
+
await reader.cancel(reason);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
return new Response(body, {
|
|
160
|
+
headers: response.headers,
|
|
161
|
+
status: response.status,
|
|
162
|
+
statusText: response.statusText
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function composedSignal(callerSignal, timeoutSignal, timeoutMs) {
|
|
166
|
+
if (timeoutMs <= 0)
|
|
167
|
+
return callerSignal ?? void 0;
|
|
168
|
+
return callerSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : timeoutSignal;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// ../../packages/cloud/dist/urls.js
|
|
172
|
+
var DEFAULT_OPENPOND_WEB_BASE_URL = "https://openpond.ai";
|
|
173
|
+
var DEFAULT_OPENPOND_API_BASE_URL = "https://api.openpond.ai";
|
|
174
|
+
|
|
175
|
+
// ../../packages/cloud/dist/sandbox/url.js
|
|
176
|
+
function normalizeSandboxApiUrl(baseUrlOrApiUrl) {
|
|
177
|
+
const trimmed = baseUrlOrApiUrl.trim().replace(/\/$/, "");
|
|
178
|
+
if (!trimmed) {
|
|
179
|
+
throw new Error("sandbox API URL must be non-empty");
|
|
180
|
+
}
|
|
181
|
+
const url = new URL(trimmed);
|
|
182
|
+
const normalizedPath = url.pathname.replace(/\/$/, "");
|
|
183
|
+
if (normalizedPath.endsWith("/v1/sandboxes") || normalizedPath.endsWith("/api/sandboxes")) {
|
|
184
|
+
return `${url.origin}${normalizedPath}`;
|
|
185
|
+
}
|
|
186
|
+
if (normalizedPath.endsWith("/v1")) {
|
|
187
|
+
return `${url.origin}${normalizedPath}/sandboxes`;
|
|
188
|
+
}
|
|
189
|
+
if (isOpenPondHostedApiHost(url.hostname)) {
|
|
190
|
+
return `${url.origin}${normalizedPath}/v1/sandboxes`;
|
|
191
|
+
}
|
|
192
|
+
if (url.origin === DEFAULT_OPENPOND_WEB_BASE_URL) {
|
|
193
|
+
return `${DEFAULT_OPENPOND_API_BASE_URL}/v1/sandboxes`;
|
|
194
|
+
}
|
|
195
|
+
return `${url.origin}${normalizedPath}/api/sandboxes`;
|
|
196
|
+
}
|
|
197
|
+
function apiRootUrlFromSandboxApiUrl(sandboxApiUrl) {
|
|
198
|
+
const suffix = "/sandboxes";
|
|
199
|
+
if (!sandboxApiUrl.endsWith(suffix)) {
|
|
200
|
+
throw new Error("sandbox API URL must end with /sandboxes");
|
|
201
|
+
}
|
|
202
|
+
return sandboxApiUrl.slice(0, -suffix.length);
|
|
203
|
+
}
|
|
204
|
+
function isOpenPondHostedApiHost(hostname) {
|
|
205
|
+
return hostname === "api.openpond.ai" || hostname === "staging-api.openpond.ai" || hostname.startsWith("api") && hostname.endsWith(".openpond.ai");
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// ../../packages/cloud/dist/sandbox/client-handles.js
|
|
209
|
+
function createSandboxRuntimeNamespace(client) {
|
|
210
|
+
return {
|
|
211
|
+
list: (input = {}) => client.listSandboxRuntimes(input),
|
|
212
|
+
create: (input) => client.createSandboxRuntime(input),
|
|
213
|
+
handle: (runtimeId, initial = null) => client.sandboxRuntime(runtimeId, initial),
|
|
214
|
+
get: (runtimeId) => client.getSandboxRuntime(runtimeId),
|
|
215
|
+
createSandbox: (runtimeId, input = {}, options = {}) => client.createSandboxRuntimeSandbox(runtimeId, input, options),
|
|
216
|
+
updateStatus: (runtimeId, input) => client.updateSandboxRuntimeStatus(runtimeId, input),
|
|
217
|
+
events: (runtimeId) => client.listSandboxRuntimeEvents(runtimeId),
|
|
218
|
+
event: (runtimeId, input) => client.emitSandboxRuntimeEvent(runtimeId, input),
|
|
219
|
+
checkpoint: (runtimeId, input = {}) => client.checkpointSandboxRuntime(runtimeId, input),
|
|
220
|
+
promote: (runtimeId, input, options = {}) => client.promoteSandboxRuntime(runtimeId, input, options),
|
|
221
|
+
preserveSource: (runtimeId, input = {}, options = {}) => client.preserveSandboxRuntimeSource(runtimeId, input, options)
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function createSandboxNamespace(client) {
|
|
225
|
+
return {
|
|
226
|
+
list: (input = {}) => client.list(input),
|
|
227
|
+
create: (input) => client.create(input),
|
|
228
|
+
get: (sandboxId) => client.get(sandboxId),
|
|
229
|
+
pricing: () => client.pricing(),
|
|
230
|
+
costs: (input = {}) => client.costs(input)
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function createSandboxProjectNamespace(client) {
|
|
234
|
+
return {
|
|
235
|
+
list: (input) => client.listProjects(input),
|
|
236
|
+
upsert: (input) => client.upsertProject(input),
|
|
237
|
+
upsertGitRemote: (input) => client.upsertProjectGitRemote(input),
|
|
238
|
+
get: (projectId, input) => client.getProject(projectId, input),
|
|
239
|
+
update: (projectId, input) => client.updateProject(projectId, input),
|
|
240
|
+
sync: (projectId, input) => client.syncProject(projectId, input),
|
|
241
|
+
ensureGitRemote: (projectId, input) => client.ensureProjectGitRemote(projectId, input),
|
|
242
|
+
getGitRemote: (projectId, input) => client.ensureProjectGitRemote(projectId, input),
|
|
243
|
+
git: (projectId, input) => client.ensureProjectGitRemote(projectId, input),
|
|
244
|
+
uploadSource: (projectId, input) => client.uploadProjectSource(projectId, input),
|
|
245
|
+
archive: (projectId, input) => client.archiveProject(projectId, input)
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function createSandboxProfileNamespace(client) {
|
|
249
|
+
return {
|
|
250
|
+
get: (input) => client.getHostedProfile(input),
|
|
251
|
+
status: (input) => client.getHostedProfile(input),
|
|
252
|
+
ensureHosted: (input) => client.ensureHostedProfile(input),
|
|
253
|
+
push: (input) => client.pushHostedProfile(input)
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function createSandboxAgentNamespace(client) {
|
|
257
|
+
return {
|
|
258
|
+
list: (input) => client.listAgents(input),
|
|
259
|
+
upsert: (input) => client.upsertAgent(input),
|
|
260
|
+
get: (agentId, input) => client.getAgent(agentId, input),
|
|
261
|
+
update: (agentId, input) => client.updateAgent(agentId, input),
|
|
262
|
+
archive: (agentId, input) => client.archiveAgent(agentId, input),
|
|
263
|
+
run: (agentId, input) => client.runAgent(agentId, input),
|
|
264
|
+
sourceDeployPlan: (agentId, input) => client.getAgentSourceDeployPlan(agentId, input),
|
|
265
|
+
manifestSnapshots: (agentId, input) => client.listAgentManifestSnapshots(agentId, input),
|
|
266
|
+
requestSourceChecks: (agentId, input) => client.requestAgentSourceChecks(agentId, input),
|
|
267
|
+
publishSource: (agentId, input) => client.publishAgentSource(agentId, input)
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ../../packages/cloud/dist/sandbox/runtime-handle.js
|
|
272
|
+
function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
|
|
273
|
+
const currentSandbox = async (input = {}, options = {}) => {
|
|
274
|
+
const runtime = await client.getSandboxRuntime(runtimeId);
|
|
275
|
+
if (runtime.sandboxId) {
|
|
276
|
+
return client.get(runtime.sandboxId);
|
|
277
|
+
}
|
|
278
|
+
return client.createSandboxRuntimeSandbox(runtimeId, input, options).then((payload) => payload.sandbox);
|
|
279
|
+
};
|
|
280
|
+
const resume = async (input = {}, options = {}) => {
|
|
281
|
+
const runtime = await client.getSandboxRuntime(runtimeId);
|
|
282
|
+
if (!runtime.sandboxId) {
|
|
283
|
+
return client.createSandboxRuntimeSandbox(runtimeId, input, options).then((payload) => payload.sandbox);
|
|
284
|
+
}
|
|
285
|
+
const sandbox = await client.get(runtime.sandboxId);
|
|
286
|
+
if (sandbox.state === "stopped") {
|
|
287
|
+
return client.start(sandbox.id, options).then((payload) => payload.sandbox);
|
|
288
|
+
}
|
|
289
|
+
if (sandbox.state === "archived") {
|
|
290
|
+
return client.restore(sandbox.id).then((payload) => payload.sandbox);
|
|
291
|
+
}
|
|
292
|
+
if (sandbox.state === "deleted" || sandbox.state === "error") {
|
|
293
|
+
return client.createSandboxRuntimeSandbox(runtimeId, input, options).then((payload) => payload.sandbox);
|
|
294
|
+
}
|
|
295
|
+
return sandbox;
|
|
296
|
+
};
|
|
297
|
+
const checkpointHint = (input = {}) => client.emitSandboxRuntimeEvent(runtimeId, {
|
|
298
|
+
type: "workflow.checkpoint_hint",
|
|
299
|
+
summary: input.summary ?? input.reason ?? "Workflow checkpoint hint",
|
|
300
|
+
payload: {
|
|
301
|
+
...input.payload,
|
|
302
|
+
reason: input.reason ?? null
|
|
303
|
+
},
|
|
304
|
+
artifactRefs: input.artifactRefs,
|
|
305
|
+
lifecycleHint: {
|
|
306
|
+
kind: "checkpoint",
|
|
307
|
+
reason: input.reason ?? null
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
const waitForUser = async (input = {}) => {
|
|
311
|
+
await client.emitSandboxRuntimeEvent(runtimeId, {
|
|
312
|
+
type: "workflow.waiting_for_user",
|
|
313
|
+
summary: input.summary ?? input.reason ?? "Waiting for user",
|
|
314
|
+
payload: {
|
|
315
|
+
...input.payload,
|
|
316
|
+
reason: input.reason ?? null
|
|
317
|
+
},
|
|
318
|
+
lifecycleHint: {
|
|
319
|
+
kind: "waiting_for_user",
|
|
320
|
+
reason: input.reason ?? null
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
const current = await client.getSandboxRuntime(runtimeId);
|
|
324
|
+
if (current.status === "waiting_for_user")
|
|
325
|
+
return current;
|
|
326
|
+
return client.updateSandboxRuntimeStatus(runtimeId, {
|
|
327
|
+
status: "waiting_for_user",
|
|
328
|
+
expectedVersion: current.version,
|
|
329
|
+
summary: input.summary ?? input.reason,
|
|
330
|
+
metadata: {
|
|
331
|
+
workflowWaitForUserReason: input.reason ?? null
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
const keepAlive = (input = {}) => {
|
|
336
|
+
const keepaliveUntil = runtimeKeepaliveUntilIso(input);
|
|
337
|
+
return client.emitSandboxRuntimeEvent(runtimeId, {
|
|
338
|
+
type: "workflow.keepalive",
|
|
339
|
+
summary: input.summary ?? input.reason ?? "Workflow keepalive",
|
|
340
|
+
payload: {
|
|
341
|
+
...input.payload,
|
|
342
|
+
reason: input.reason ?? null,
|
|
343
|
+
keepaliveUntil
|
|
344
|
+
},
|
|
345
|
+
lifecycleHint: {
|
|
346
|
+
kind: "keepalive",
|
|
347
|
+
reason: input.reason ?? null,
|
|
348
|
+
keepaliveUntil
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
return {
|
|
353
|
+
id: runtimeId,
|
|
354
|
+
initial,
|
|
355
|
+
get: () => client.getSandboxRuntime(runtimeId),
|
|
356
|
+
sandbox: currentSandbox,
|
|
357
|
+
resume,
|
|
358
|
+
createSandbox: (input = {}, options = {}) => client.createSandboxRuntimeSandbox(runtimeId, input, options),
|
|
359
|
+
status: async (input) => {
|
|
360
|
+
if (typeof input !== "string") {
|
|
361
|
+
return client.updateSandboxRuntimeStatus(runtimeId, input);
|
|
362
|
+
}
|
|
363
|
+
const current = await client.getSandboxRuntime(runtimeId);
|
|
364
|
+
return client.updateSandboxRuntimeStatus(runtimeId, {
|
|
365
|
+
status: input,
|
|
366
|
+
expectedVersion: current.version
|
|
367
|
+
});
|
|
368
|
+
},
|
|
369
|
+
events: () => client.listSandboxRuntimeEvents(runtimeId),
|
|
370
|
+
event: (input) => client.emitSandboxRuntimeEvent(runtimeId, input),
|
|
371
|
+
recordCommit: (commitSha, input = {}) => client.emitSandboxRuntimeEvent(runtimeId, {
|
|
372
|
+
...input,
|
|
373
|
+
type: input.type ?? "git.commit",
|
|
374
|
+
commitSha
|
|
375
|
+
}),
|
|
376
|
+
checkpointHint,
|
|
377
|
+
waitForUser,
|
|
378
|
+
keepAlive,
|
|
379
|
+
checkpoint: (input) => client.checkpointSandboxRuntime(runtimeId, input),
|
|
380
|
+
files: {
|
|
381
|
+
write: async (path, contents) => client.uploadFile((await resume()).id, path, contents),
|
|
382
|
+
read: async (path) => client.downloadFile((await resume()).id, path),
|
|
383
|
+
readResponse: async (input) => client.downloadFileResponse((await resume()).id, input),
|
|
384
|
+
list: async (input = {}) => client.listFiles((await resume()).id, input),
|
|
385
|
+
delete: async (path, input = {}) => client.deleteFile((await resume()).id, path, input),
|
|
386
|
+
search: async (input) => client.searchFiles((await resume()).id, input),
|
|
387
|
+
stat: async (path) => client.statFile((await resume()).id, path),
|
|
388
|
+
mkdir: async (input) => client.mkdir((await resume()).id, input),
|
|
389
|
+
move: async (input) => client.moveFile((await resume()).id, input)
|
|
390
|
+
},
|
|
391
|
+
commands: {
|
|
392
|
+
run: async (command) => client.exec((await resume()).id, typeof command === "string" ? { command } : command)
|
|
393
|
+
},
|
|
394
|
+
ports: {
|
|
395
|
+
expose: async (port) => client.openPort((await resume()).id, typeof port === "number" ? { port } : port)
|
|
396
|
+
},
|
|
397
|
+
promote: (input, options = {}) => client.promoteSandboxRuntime(runtimeId, input, options),
|
|
398
|
+
preserveSource: (input = {}, options = {}) => client.preserveSandboxRuntimeSource(runtimeId, input, options),
|
|
399
|
+
archive: async (expectedVersion) => {
|
|
400
|
+
const version = expectedVersion ?? (await client.getSandboxRuntime(runtimeId)).version;
|
|
401
|
+
return client.updateSandboxRuntimeStatus(runtimeId, {
|
|
402
|
+
status: "archived",
|
|
403
|
+
expectedVersion: version
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
function runtimeKeepaliveUntilIso(input) {
|
|
409
|
+
if (input?.until instanceof Date) {
|
|
410
|
+
return input.until.toISOString();
|
|
411
|
+
}
|
|
412
|
+
if (typeof input?.until === "string" && input.until.trim()) {
|
|
413
|
+
return new Date(input.until).toISOString();
|
|
414
|
+
}
|
|
415
|
+
const seconds = typeof input?.seconds === "number" && Number.isFinite(input.seconds) ? Math.max(1, Math.trunc(input.seconds)) : 60;
|
|
416
|
+
return new Date(Date.now() + seconds * 1e3).toISOString();
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// ../../packages/cloud/dist/sandbox/smoke.js
|
|
420
|
+
async function runSandboxSmoke(client, options = {}) {
|
|
421
|
+
const runId = `openpond-code-smoke-${Date.now()}`;
|
|
422
|
+
const expectedExec = `openpond-code-exec-ok:${runId}`;
|
|
423
|
+
const expectedPreview = `openpond-code-preview-ok:${runId}`;
|
|
424
|
+
const expectedFile = `openpond-code-file-ok:${runId}`;
|
|
425
|
+
const previewPort = 4173;
|
|
426
|
+
let sandboxId = null;
|
|
427
|
+
let forkSandboxId = null;
|
|
428
|
+
let deleted = false;
|
|
429
|
+
let forkDeleted = false;
|
|
430
|
+
try {
|
|
431
|
+
const sandbox = await waitForCreateReady(client, await client.create({
|
|
432
|
+
repo: options.repo ?? "https://github.com/octocat/Hello-World",
|
|
433
|
+
resources: {
|
|
434
|
+
cpu: options.cpu ?? 1,
|
|
435
|
+
memoryGb: options.memoryGb ?? 1,
|
|
436
|
+
diskGb: options.diskGb ?? 8
|
|
437
|
+
},
|
|
438
|
+
budget: { maxUsd: options.budgetUsd ?? "0.05" },
|
|
439
|
+
quotas: {
|
|
440
|
+
maxSpendUsd: options.budgetUsd ?? "0.05",
|
|
441
|
+
maxDurationSeconds: 600,
|
|
442
|
+
idleTimeoutSeconds: 600,
|
|
443
|
+
maxOpenPorts: 2
|
|
444
|
+
},
|
|
445
|
+
metadata: {
|
|
446
|
+
runId,
|
|
447
|
+
source: "openpond-code-sandbox-smoke"
|
|
448
|
+
}
|
|
449
|
+
}, { async: true }));
|
|
450
|
+
sandboxId = sandbox.id;
|
|
451
|
+
const expectedMppMode = options.expectedMppMode;
|
|
452
|
+
if (expectedMppMode && sandbox.reservation.mpp?.mode !== expectedMppMode) {
|
|
453
|
+
throw new Error(`expected ${expectedMppMode} reservation, got ${sandbox.reservation.mpp?.mode ?? "none"}`);
|
|
454
|
+
}
|
|
455
|
+
if (!expectedMppMode && !sandbox.reservation.mpp?.mode) {
|
|
456
|
+
throw new Error("expected sandbox reservation MPP metadata");
|
|
457
|
+
}
|
|
458
|
+
const exec = await client.exec(sandbox.id, {
|
|
459
|
+
command: [
|
|
460
|
+
`printf '${expectedExec}\\n'`,
|
|
461
|
+
"test -f README && printf 'repo-clone-ok\\n'",
|
|
462
|
+
"cat > server.cjs <<'EOF'",
|
|
463
|
+
"const { createServer } = require('node:http');",
|
|
464
|
+
`createServer((_request, response) => response.end('${expectedPreview}')).listen(${previewPort}, '0.0.0.0');`,
|
|
465
|
+
"EOF",
|
|
466
|
+
"nohup node server.cjs > server.log 2>&1 & sleep 1"
|
|
467
|
+
].join("\n"),
|
|
468
|
+
timeoutSeconds: 120
|
|
469
|
+
});
|
|
470
|
+
if (exec.command.status !== "succeeded") {
|
|
471
|
+
throw new Error(`expected command success, got ${exec.command.status}`);
|
|
472
|
+
}
|
|
473
|
+
if (!exec.command.output.includes(expectedExec)) {
|
|
474
|
+
throw new Error("expected exec marker");
|
|
475
|
+
}
|
|
476
|
+
await client.uploadFile(sandbox.id, "openpond-code-smoke.txt", expectedFile);
|
|
477
|
+
const downloaded = await client.downloadFile(sandbox.id, "openpond-code-smoke.txt");
|
|
478
|
+
if (downloaded !== expectedFile) {
|
|
479
|
+
throw new Error("expected file roundtrip marker");
|
|
480
|
+
}
|
|
481
|
+
let snapshotId = null;
|
|
482
|
+
if (options.snapshot || options.fork) {
|
|
483
|
+
const snapshotResponse = await client.createSnapshot(sandbox.id, {
|
|
484
|
+
async: true,
|
|
485
|
+
name: `openpond-code-smoke-${runId}`,
|
|
486
|
+
replay: {
|
|
487
|
+
entrypoints: [
|
|
488
|
+
{
|
|
489
|
+
command: "cat openpond-code-smoke.txt",
|
|
490
|
+
name: "default"
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
retention: {
|
|
494
|
+
class: "pinned"
|
|
495
|
+
},
|
|
496
|
+
safety: {
|
|
497
|
+
cleanup: "delete",
|
|
498
|
+
idleTimeoutSeconds: 600,
|
|
499
|
+
internetEgress: "block",
|
|
500
|
+
maxDurationSeconds: 600,
|
|
501
|
+
maxSpendUsd: options.budgetUsd ?? "0.05",
|
|
502
|
+
publicPreview: false
|
|
503
|
+
},
|
|
504
|
+
validation: {
|
|
505
|
+
commands: [
|
|
506
|
+
{
|
|
507
|
+
command: "test -f openpond-code-smoke.txt"
|
|
508
|
+
}
|
|
509
|
+
]
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
const snapshot = snapshotResponse.snapshot ?? (await waitForSnapshotReady(client, sandbox.id, snapshotResponse.snapshotJob?.snapshotId)).snapshot;
|
|
514
|
+
snapshotId = snapshot.id;
|
|
515
|
+
if (snapshot.state !== "ready") {
|
|
516
|
+
throw new Error(`expected ready snapshot, got ${snapshot.state}`);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
if (options.fork) {
|
|
520
|
+
if (!snapshotId) {
|
|
521
|
+
throw new Error("expected snapshot id before fork");
|
|
522
|
+
}
|
|
523
|
+
const forked = await waitForCreateReady(client, (await client.forkSnapshot(snapshotId, {
|
|
524
|
+
budget: { maxUsd: options.budgetUsd ?? "0.05" },
|
|
525
|
+
metadata: {
|
|
526
|
+
source: "openpond-code-sandbox-smoke-fork",
|
|
527
|
+
templateSnapshotId: snapshotId
|
|
528
|
+
}
|
|
529
|
+
}, { async: true })).sandbox);
|
|
530
|
+
forkSandboxId = forked.id;
|
|
531
|
+
const forkExec = await client.exec(forked.id, {
|
|
532
|
+
command: "cat openpond-code-smoke.txt",
|
|
533
|
+
timeoutSeconds: 120
|
|
534
|
+
});
|
|
535
|
+
if (forkExec.command.status !== "succeeded") {
|
|
536
|
+
throw new Error(`expected fork command success, got ${forkExec.command.status}`);
|
|
537
|
+
}
|
|
538
|
+
if (!forkExec.command.output.includes(expectedFile)) {
|
|
539
|
+
throw new Error("expected fork snapshot marker");
|
|
540
|
+
}
|
|
541
|
+
if (!options.keep) {
|
|
542
|
+
await deleteSandboxForSmoke(client, forked.id);
|
|
543
|
+
forkDeleted = true;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
let previewStatus = null;
|
|
547
|
+
if (options.preview !== false) {
|
|
548
|
+
const opened = await client.openPort(sandbox.id, {
|
|
549
|
+
label: "openpond-code-smoke",
|
|
550
|
+
port: previewPort
|
|
551
|
+
});
|
|
552
|
+
const preview = await fetch(opened.preview.url);
|
|
553
|
+
previewStatus = preview.status;
|
|
554
|
+
const body = await preview.text();
|
|
555
|
+
if (preview.status !== 200) {
|
|
556
|
+
throw new Error(`expected preview HTTP 200, got ${preview.status}`);
|
|
557
|
+
}
|
|
558
|
+
if (!body.includes(expectedPreview)) {
|
|
559
|
+
throw new Error("expected preview marker");
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
const { sandbox: readback, receipts } = await stopSandboxForSmoke(client, sandbox.id);
|
|
563
|
+
if (!options.keep) {
|
|
564
|
+
await deleteSandboxForSmoke(client, sandbox.id);
|
|
565
|
+
deleted = true;
|
|
566
|
+
}
|
|
567
|
+
return {
|
|
568
|
+
deleted,
|
|
569
|
+
execOutput: exec.command.output.trim(),
|
|
570
|
+
fileRoundtrip: true,
|
|
571
|
+
forkSandboxId,
|
|
572
|
+
previewStatus,
|
|
573
|
+
receiptRefs: receipts.map((receipt) => receipt.mpp.receiptRef ?? null),
|
|
574
|
+
reservationRef: sandbox.reservation.mpp?.reservationRef ?? null,
|
|
575
|
+
runId,
|
|
576
|
+
sandboxId: sandbox.id,
|
|
577
|
+
snapshotId,
|
|
578
|
+
state: readback.state
|
|
579
|
+
};
|
|
580
|
+
} finally {
|
|
581
|
+
if (forkSandboxId && !options.keep && !forkDeleted) {
|
|
582
|
+
await cleanupSandboxBestEffort(client, forkSandboxId);
|
|
583
|
+
}
|
|
584
|
+
if (sandboxId && !options.keep && !deleted) {
|
|
585
|
+
await cleanupSandboxBestEffort(client, sandboxId);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
async function stopSandboxForSmoke(client, sandboxId) {
|
|
590
|
+
try {
|
|
591
|
+
await client.stop(sandboxId);
|
|
592
|
+
} catch {
|
|
593
|
+
await client.stop(sandboxId, { async: true });
|
|
594
|
+
}
|
|
595
|
+
const sandbox = await waitForSandboxState(client, sandboxId, /* @__PURE__ */ new Set(["stopped", "deleted"]), "stop");
|
|
596
|
+
const receipts = await waitForReceipts(client, sandboxId);
|
|
597
|
+
if (receipts.length === 0) {
|
|
598
|
+
throw new Error("expected receipt readback");
|
|
599
|
+
}
|
|
600
|
+
return { sandbox, receipts };
|
|
601
|
+
}
|
|
602
|
+
async function deleteSandboxForSmoke(client, sandboxId) {
|
|
603
|
+
try {
|
|
604
|
+
const deleted = await client.delete(sandboxId);
|
|
605
|
+
if (deleted.state === "deleted") {
|
|
606
|
+
return deleted;
|
|
607
|
+
}
|
|
608
|
+
await client.delete(sandboxId, { async: true });
|
|
609
|
+
} catch {
|
|
610
|
+
await client.delete(sandboxId, { async: true });
|
|
611
|
+
}
|
|
612
|
+
return waitForSandboxState(client, sandboxId, /* @__PURE__ */ new Set(["deleted"]), "delete");
|
|
613
|
+
}
|
|
614
|
+
async function cleanupSandboxBestEffort(client, sandboxId) {
|
|
615
|
+
try {
|
|
616
|
+
await deleteSandboxForSmoke(client, sandboxId);
|
|
617
|
+
} catch {
|
|
618
|
+
await client.delete(sandboxId, { async: true }).catch(() => void 0);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
async function waitForSandboxState(client, sandboxId, targetStates, operation) {
|
|
622
|
+
const timeoutMs = 5 * 6e4;
|
|
623
|
+
const pollMs = 3e3;
|
|
624
|
+
const deadline = Date.now() + timeoutMs;
|
|
625
|
+
let latest = await client.get(sandboxId);
|
|
626
|
+
while (Date.now() < deadline) {
|
|
627
|
+
if (targetStates.has(latest.state)) {
|
|
628
|
+
return latest;
|
|
629
|
+
}
|
|
630
|
+
if (latest.state === "error") {
|
|
631
|
+
throw new Error(`sandbox ${operation} failed: ${sandboxId}`);
|
|
632
|
+
}
|
|
633
|
+
await sleep(pollMs);
|
|
634
|
+
latest = await client.get(sandboxId);
|
|
635
|
+
}
|
|
636
|
+
throw new Error(`sandbox ${operation} did not reach ${[...targetStates].join("/")} before timeout: ${sandboxId} (${latest.state})`);
|
|
637
|
+
}
|
|
638
|
+
async function waitForReceipts(client, sandboxId) {
|
|
639
|
+
const timeoutMs = 2 * 6e4;
|
|
640
|
+
const pollMs = 3e3;
|
|
641
|
+
const deadline = Date.now() + timeoutMs;
|
|
642
|
+
let receipts = await client.receipts(sandboxId);
|
|
643
|
+
while (Date.now() < deadline) {
|
|
644
|
+
if (receipts.length > 0) {
|
|
645
|
+
return receipts;
|
|
646
|
+
}
|
|
647
|
+
await sleep(pollMs);
|
|
648
|
+
receipts = await client.receipts(sandboxId);
|
|
649
|
+
}
|
|
650
|
+
return receipts;
|
|
651
|
+
}
|
|
652
|
+
async function waitForCreateReady(client, sandbox) {
|
|
653
|
+
if (sandbox.state === "running" || sandbox.state === "stopped") {
|
|
654
|
+
return sandbox;
|
|
655
|
+
}
|
|
656
|
+
if (sandbox.state === "error") {
|
|
657
|
+
throw new Error(`sandbox create failed: ${sandbox.id}
|
|
658
|
+
${sandbox.logs.join("\n")}`);
|
|
659
|
+
}
|
|
660
|
+
const timeoutMs = 12 * 6e4;
|
|
661
|
+
const pollMs = 3e3;
|
|
662
|
+
const deadline = Date.now() + timeoutMs;
|
|
663
|
+
let latest = sandbox;
|
|
664
|
+
while (Date.now() < deadline) {
|
|
665
|
+
await sleep(pollMs);
|
|
666
|
+
latest = await client.get(sandbox.id);
|
|
667
|
+
if (latest.state === "running" || latest.state === "stopped") {
|
|
668
|
+
return latest;
|
|
669
|
+
}
|
|
670
|
+
if (latest.state === "error") {
|
|
671
|
+
throw new Error(`sandbox create failed: ${latest.id}
|
|
672
|
+
${latest.logs.join("\n")}`);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
throw new Error(`sandbox create did not reach running state before timeout: ${latest.id} (${latest.state})`);
|
|
676
|
+
}
|
|
677
|
+
async function waitForSnapshotReady(client, sandboxId, snapshotId) {
|
|
678
|
+
if (!snapshotId) {
|
|
679
|
+
throw new Error("snapshot job did not return snapshot id");
|
|
680
|
+
}
|
|
681
|
+
const timeoutMs = 12 * 6e4;
|
|
682
|
+
const pollMs = 3e3;
|
|
683
|
+
const deadline = Date.now() + timeoutMs;
|
|
684
|
+
let latest = await client.get(sandboxId);
|
|
685
|
+
while (Date.now() < deadline) {
|
|
686
|
+
const snapshot = latest.snapshots?.find((item) => item.id === snapshotId);
|
|
687
|
+
if (snapshot?.state === "ready") {
|
|
688
|
+
return { sandbox: latest, snapshot };
|
|
689
|
+
}
|
|
690
|
+
const job = latest.snapshotJobs?.find((item) => item.snapshotId === snapshotId);
|
|
691
|
+
if (job?.status === "failed") {
|
|
692
|
+
throw new Error(`snapshot job failed: ${job.error ?? snapshotId}`);
|
|
693
|
+
}
|
|
694
|
+
await sleep(pollMs);
|
|
695
|
+
latest = await client.get(sandboxId);
|
|
696
|
+
}
|
|
697
|
+
throw new Error(`snapshot did not reach ready state before timeout: ${snapshotId}`);
|
|
698
|
+
}
|
|
699
|
+
function sleep(ms) {
|
|
700
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// ../../packages/cloud/dist/sandbox/async-request-options.js
|
|
704
|
+
function asyncRequestHeaders(options = {}) {
|
|
705
|
+
return options.async || options.respondAsync ? { Prefer: "respond-async" } : void 0;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// ../../packages/cloud/dist/sandbox/stream.js
|
|
709
|
+
async function streamSandboxEventOutput(params) {
|
|
710
|
+
const response = await apiFetch(params.sandboxApiUrl, params.apiKey, params.path, { timeoutMs: 0, maxResponseBytes: 0 });
|
|
711
|
+
if (!response.body) {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
const reader = response.body.getReader();
|
|
715
|
+
const decoder = new TextDecoder();
|
|
716
|
+
let buffered = "";
|
|
717
|
+
try {
|
|
718
|
+
while (true) {
|
|
719
|
+
const { done, value } = await reader.read();
|
|
720
|
+
if (done)
|
|
721
|
+
break;
|
|
722
|
+
buffered += decoder.decode(value, { stream: true });
|
|
723
|
+
let separatorIndex = buffered.indexOf("\n\n");
|
|
724
|
+
while (separatorIndex !== -1) {
|
|
725
|
+
const event = buffered.slice(0, separatorIndex);
|
|
726
|
+
buffered = buffered.slice(separatorIndex + 2);
|
|
727
|
+
const output = parseProcessOutputEvent(event);
|
|
728
|
+
if (output)
|
|
729
|
+
process.stdout.write(output);
|
|
730
|
+
separatorIndex = buffered.indexOf("\n\n");
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
} finally {
|
|
734
|
+
reader.releaseLock();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
function normalizePtyInput(input) {
|
|
738
|
+
if (typeof input === "string") {
|
|
739
|
+
return { dataBase64: Buffer.from(input, "utf-8").toString("base64") };
|
|
740
|
+
}
|
|
741
|
+
if (input instanceof Uint8Array) {
|
|
742
|
+
return { dataBase64: Buffer.from(input).toString("base64") };
|
|
743
|
+
}
|
|
744
|
+
return input;
|
|
745
|
+
}
|
|
746
|
+
function parseProcessOutputEvent(event) {
|
|
747
|
+
if (!event.includes("event: output")) {
|
|
748
|
+
return null;
|
|
749
|
+
}
|
|
750
|
+
const dataLines = event.split(/\r?\n/).filter((line) => line.startsWith("data: ")).map((line) => line.slice("data: ".length));
|
|
751
|
+
if (dataLines.length === 0) {
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
try {
|
|
755
|
+
const parsed = JSON.parse(dataLines.join("\n"));
|
|
756
|
+
return typeof parsed.output === "string" ? parsed.output : null;
|
|
757
|
+
} catch {
|
|
758
|
+
return null;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// ../../packages/cloud/dist/sandbox/sandbox-instance-client.js
|
|
763
|
+
var OpenPondSandboxInstanceClient = class {
|
|
764
|
+
apiKey;
|
|
765
|
+
apiRootUrl;
|
|
766
|
+
sandboxApiUrl;
|
|
767
|
+
constructor(options) {
|
|
768
|
+
this.apiKey = options.apiKey;
|
|
769
|
+
this.sandboxApiUrl = normalizeSandboxApiUrl(options.sandboxApiUrl ?? options.baseUrl ?? DEFAULT_OPENPOND_API_BASE_URL);
|
|
770
|
+
this.apiRootUrl = apiRootUrlFromSandboxApiUrl(this.sandboxApiUrl);
|
|
771
|
+
}
|
|
772
|
+
create(input, options = {}) {
|
|
773
|
+
return this.request("", {
|
|
774
|
+
method: "POST",
|
|
775
|
+
headers: asyncRequestHeaders(options),
|
|
776
|
+
body: JSON.stringify(input)
|
|
777
|
+
}).then((payload) => payload.sandbox);
|
|
778
|
+
}
|
|
779
|
+
get(sandboxId) {
|
|
780
|
+
return this.request(`/${encodeURIComponent(sandboxId)}`).then((payload) => payload.sandbox);
|
|
781
|
+
}
|
|
782
|
+
exec(sandboxId, input) {
|
|
783
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/exec`, {
|
|
784
|
+
method: "POST",
|
|
785
|
+
body: JSON.stringify(input)
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
startProcess(sandboxId, input) {
|
|
789
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/processes`, {
|
|
790
|
+
method: "POST",
|
|
791
|
+
body: JSON.stringify(input)
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
listProcesses(sandboxId) {
|
|
795
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/processes`);
|
|
796
|
+
}
|
|
797
|
+
getProcess(sandboxId, processId, input = {}) {
|
|
798
|
+
const query = new URLSearchParams();
|
|
799
|
+
if (input.since !== void 0)
|
|
800
|
+
query.set("since", String(Math.max(0, input.since)));
|
|
801
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(processId)}${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
802
|
+
}
|
|
803
|
+
stopProcess(sandboxId, processId) {
|
|
804
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(processId)}`, {
|
|
805
|
+
method: "DELETE"
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
async streamProcessOutput(sandboxId, processId, input = {}) {
|
|
809
|
+
const query = new URLSearchParams();
|
|
810
|
+
if (input.since !== void 0)
|
|
811
|
+
query.set("since", String(Math.max(0, input.since)));
|
|
812
|
+
await streamSandboxEventOutput({
|
|
813
|
+
sandboxApiUrl: this.sandboxApiUrl,
|
|
814
|
+
apiKey: this.apiKey,
|
|
815
|
+
path: `/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(processId)}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
startPty(sandboxId, input = {}) {
|
|
819
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/pty`, {
|
|
820
|
+
method: "POST",
|
|
821
|
+
body: JSON.stringify(input)
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
listPtys(sandboxId) {
|
|
825
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/pty`);
|
|
826
|
+
}
|
|
827
|
+
getPty(sandboxId, ptyId, input = {}) {
|
|
828
|
+
const query = new URLSearchParams();
|
|
829
|
+
if (input.since !== void 0)
|
|
830
|
+
query.set("since", String(Math.max(0, input.since)));
|
|
831
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
832
|
+
}
|
|
833
|
+
writePtyInput(sandboxId, ptyId, input) {
|
|
834
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}/input`, {
|
|
835
|
+
method: "POST",
|
|
836
|
+
body: JSON.stringify(normalizePtyInput(input))
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
stopPty(sandboxId, ptyId) {
|
|
840
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}`, {
|
|
841
|
+
method: "DELETE"
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
async streamPtyOutput(sandboxId, ptyId, input = {}) {
|
|
845
|
+
const query = new URLSearchParams();
|
|
846
|
+
if (input.since !== void 0)
|
|
847
|
+
query.set("since", String(Math.max(0, input.since)));
|
|
848
|
+
await streamSandboxEventOutput({
|
|
849
|
+
sandboxApiUrl: this.sandboxApiUrl,
|
|
850
|
+
apiKey: this.apiKey,
|
|
851
|
+
path: `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
uploadFile(sandboxId, path, contents) {
|
|
855
|
+
return this.uploadFileBase64(sandboxId, path, Buffer.from(contents, "utf-8").toString("base64"));
|
|
856
|
+
}
|
|
857
|
+
uploadFileBase64(sandboxId, path, contentsBase64) {
|
|
858
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/files`, {
|
|
859
|
+
method: "POST",
|
|
860
|
+
body: JSON.stringify({
|
|
861
|
+
path,
|
|
862
|
+
contentsBase64
|
|
863
|
+
})
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
async downloadFile(sandboxId, path) {
|
|
867
|
+
const payload = await this.downloadFileResponse(sandboxId, path);
|
|
868
|
+
return Buffer.from(payload.file.contentsBase64, "base64").toString("utf-8");
|
|
869
|
+
}
|
|
870
|
+
downloadFileResponse(sandboxId, input) {
|
|
871
|
+
const normalized = typeof input === "string" ? { path: input } : input;
|
|
872
|
+
const query = new URLSearchParams({ path: normalized.path });
|
|
873
|
+
if (normalized.offsetBytes !== void 0) {
|
|
874
|
+
query.set("offsetBytes", String(normalized.offsetBytes));
|
|
875
|
+
}
|
|
876
|
+
if (normalized.maxBytes !== void 0) {
|
|
877
|
+
query.set("maxBytes", String(normalized.maxBytes));
|
|
878
|
+
}
|
|
879
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
|
|
880
|
+
}
|
|
881
|
+
listFiles(sandboxId, input = {}) {
|
|
882
|
+
const query = new URLSearchParams({ list: "1" });
|
|
883
|
+
if (input.path)
|
|
884
|
+
query.set("path", input.path);
|
|
885
|
+
if (input.recursive !== void 0)
|
|
886
|
+
query.set("recursive", String(input.recursive));
|
|
887
|
+
if (input.maxEntries !== void 0)
|
|
888
|
+
query.set("maxEntries", String(input.maxEntries));
|
|
889
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
|
|
890
|
+
}
|
|
891
|
+
deleteFile(sandboxId, path, input = {}) {
|
|
892
|
+
const query = new URLSearchParams({ path });
|
|
893
|
+
if (input.recursive !== void 0)
|
|
894
|
+
query.set("recursive", String(input.recursive));
|
|
895
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`, {
|
|
896
|
+
method: "DELETE"
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
statFile(sandboxId, path) {
|
|
900
|
+
const query = new URLSearchParams({ stat: "1", path });
|
|
901
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
|
|
902
|
+
}
|
|
903
|
+
mkdir(sandboxId, input) {
|
|
904
|
+
const normalized = typeof input === "string" ? { path: input } : input;
|
|
905
|
+
const query = new URLSearchParams({ path: normalized.path });
|
|
906
|
+
if (normalized.recursive !== void 0)
|
|
907
|
+
query.set("recursive", String(normalized.recursive));
|
|
908
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`, {
|
|
909
|
+
method: "PUT"
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
moveFile(sandboxId, input) {
|
|
913
|
+
const query = new URLSearchParams({
|
|
914
|
+
fromPath: input.fromPath,
|
|
915
|
+
toPath: input.toPath
|
|
916
|
+
});
|
|
917
|
+
if (input.overwrite !== void 0)
|
|
918
|
+
query.set("overwrite", String(input.overwrite));
|
|
919
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`, {
|
|
920
|
+
method: "PATCH"
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
searchFiles(sandboxId, input) {
|
|
924
|
+
const query = new URLSearchParams({
|
|
925
|
+
search: "1",
|
|
926
|
+
query: input.query
|
|
927
|
+
});
|
|
928
|
+
if (input.path)
|
|
929
|
+
query.set("path", input.path);
|
|
930
|
+
if (input.maxResults !== void 0)
|
|
931
|
+
query.set("maxResults", String(input.maxResults));
|
|
932
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
|
|
933
|
+
}
|
|
934
|
+
openPort(sandboxId, input) {
|
|
935
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/ports`, {
|
|
936
|
+
method: "POST",
|
|
937
|
+
body: JSON.stringify(input)
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
createSnapshot(sandboxId, input) {
|
|
941
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/snapshots`, {
|
|
942
|
+
method: "POST",
|
|
943
|
+
body: JSON.stringify(input)
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
updateSnapshot(sandboxId, snapshotId, input) {
|
|
947
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(snapshotId)}`, {
|
|
948
|
+
method: "PATCH",
|
|
949
|
+
body: JSON.stringify(input)
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
validateSnapshot(sandboxId, snapshotId, input = {}) {
|
|
953
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(snapshotId)}/validate`, {
|
|
954
|
+
method: "POST",
|
|
955
|
+
body: JSON.stringify(input)
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
publishSnapshot(sandboxId, snapshotId) {
|
|
959
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(snapshotId)}/publish`, {
|
|
960
|
+
method: "POST"
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
fork(sandboxId, input = {}) {
|
|
964
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/fork`, {
|
|
965
|
+
method: "POST",
|
|
966
|
+
body: JSON.stringify(input)
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
stop(sandboxId, options = {}) {
|
|
970
|
+
const query = new URLSearchParams();
|
|
971
|
+
if (options.failOnUnpreservedChanges) {
|
|
972
|
+
query.set("failOnUnpreservedChanges", "true");
|
|
973
|
+
}
|
|
974
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/stop${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
975
|
+
method: "POST",
|
|
976
|
+
headers: asyncRequestHeaders(options)
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
start(sandboxId, options = {}) {
|
|
980
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/start`, {
|
|
981
|
+
method: "POST",
|
|
982
|
+
headers: asyncRequestHeaders(options)
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
restore(sandboxId) {
|
|
986
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/restore`, {
|
|
987
|
+
method: "POST"
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
delete(sandboxId, options = {}) {
|
|
991
|
+
const query = new URLSearchParams();
|
|
992
|
+
if (options.failOnUnpreservedChanges) {
|
|
993
|
+
query.set("failOnUnpreservedChanges", "true");
|
|
994
|
+
}
|
|
995
|
+
return this.request(`/${encodeURIComponent(sandboxId)}${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
996
|
+
method: "DELETE",
|
|
997
|
+
headers: asyncRequestHeaders(options)
|
|
998
|
+
}).then((payload) => payload.sandbox);
|
|
999
|
+
}
|
|
1000
|
+
receipts(sandboxId) {
|
|
1001
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/receipts`).then((payload) => payload.receipts);
|
|
1002
|
+
}
|
|
1003
|
+
logs(sandboxId) {
|
|
1004
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/logs`).then((payload) => payload.logs);
|
|
1005
|
+
}
|
|
1006
|
+
gitStatus(sandboxId) {
|
|
1007
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/git/status`);
|
|
1008
|
+
}
|
|
1009
|
+
gitDiff(sandboxId, input = {}) {
|
|
1010
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/git/diff`, {
|
|
1011
|
+
method: "POST",
|
|
1012
|
+
body: JSON.stringify(input)
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
gitExportPatch(sandboxId, input = {}) {
|
|
1016
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/git/export-patch`, {
|
|
1017
|
+
method: "POST",
|
|
1018
|
+
body: JSON.stringify(input)
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
gitBranch(sandboxId, input) {
|
|
1022
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/git/branch`, {
|
|
1023
|
+
method: "POST",
|
|
1024
|
+
body: JSON.stringify(input)
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
gitCommit(sandboxId, input) {
|
|
1028
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/git/commit`, {
|
|
1029
|
+
method: "POST",
|
|
1030
|
+
body: JSON.stringify(input)
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
gitPull(sandboxId, input = {}) {
|
|
1034
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/git/pull`, {
|
|
1035
|
+
method: "POST",
|
|
1036
|
+
body: JSON.stringify(input)
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
gitPush(sandboxId, input = {}) {
|
|
1040
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/git/push`, {
|
|
1041
|
+
method: "POST",
|
|
1042
|
+
body: JSON.stringify(input)
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
billing(sandboxId) {
|
|
1046
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/billing`);
|
|
1047
|
+
}
|
|
1048
|
+
pricing() {
|
|
1049
|
+
return this.request("/pricing");
|
|
1050
|
+
}
|
|
1051
|
+
costs(input = {}) {
|
|
1052
|
+
const query = new URLSearchParams();
|
|
1053
|
+
if (input.teamId)
|
|
1054
|
+
query.set("teamId", input.teamId);
|
|
1055
|
+
if (input.projectId)
|
|
1056
|
+
query.set("projectId", input.projectId);
|
|
1057
|
+
if (input.agentId)
|
|
1058
|
+
query.set("agentId", input.agentId);
|
|
1059
|
+
return this.request(`/costs${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1060
|
+
}
|
|
1061
|
+
integrationLeases(sandboxId) {
|
|
1062
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/integrations`);
|
|
1063
|
+
}
|
|
1064
|
+
attachIntegrationConnection(sandboxId, input) {
|
|
1065
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/integrations`, {
|
|
1066
|
+
method: "POST",
|
|
1067
|
+
body: JSON.stringify(input)
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
removeIntegrationLease(sandboxId, leaseId) {
|
|
1071
|
+
return this.request(`/${encodeURIComponent(sandboxId)}/integrations`, {
|
|
1072
|
+
method: "DELETE",
|
|
1073
|
+
body: JSON.stringify({ leaseId })
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
async request(path, init = {}) {
|
|
1077
|
+
const response = await apiFetch(this.sandboxApiUrl, this.apiKey, path, init);
|
|
1078
|
+
return readApiJson(response, "Sandbox request");
|
|
1079
|
+
}
|
|
1080
|
+
async requestApiRoot(path, init = {}) {
|
|
1081
|
+
const response = await apiFetch(this.apiRootUrl, this.apiKey, path, init);
|
|
1082
|
+
return readApiJson(response, "OpenPond API request");
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
|
|
1086
|
+
// ../../packages/cloud/dist/sandbox/client.js
|
|
1087
|
+
var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
1088
|
+
runtimes = createSandboxRuntimeNamespace(this);
|
|
1089
|
+
sandboxes = createSandboxNamespace(this);
|
|
1090
|
+
profile = createSandboxProfileNamespace(this);
|
|
1091
|
+
projects = createSandboxProjectNamespace(this);
|
|
1092
|
+
agents = createSandboxAgentNamespace(this);
|
|
1093
|
+
list(input = {}) {
|
|
1094
|
+
const query = new URLSearchParams();
|
|
1095
|
+
if (input.teamId)
|
|
1096
|
+
query.set("teamId", input.teamId);
|
|
1097
|
+
if (input.projectId)
|
|
1098
|
+
query.set("projectId", input.projectId);
|
|
1099
|
+
if (input.agentId)
|
|
1100
|
+
query.set("agentId", input.agentId);
|
|
1101
|
+
return this.request(query.size > 0 ? `?${query.toString()}` : "").then((payload) => payload.sandboxes);
|
|
1102
|
+
}
|
|
1103
|
+
listSecrets(input = {}) {
|
|
1104
|
+
const query = new URLSearchParams();
|
|
1105
|
+
if (input.teamId)
|
|
1106
|
+
query.set("teamId", input.teamId);
|
|
1107
|
+
return this.requestApiRoot(`/sandbox-secrets${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => payload.secrets);
|
|
1108
|
+
}
|
|
1109
|
+
getSecret(secretId, input = {}) {
|
|
1110
|
+
const query = new URLSearchParams();
|
|
1111
|
+
if (input.teamId)
|
|
1112
|
+
query.set("teamId", input.teamId);
|
|
1113
|
+
return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => payload.secret);
|
|
1114
|
+
}
|
|
1115
|
+
createSecret(input) {
|
|
1116
|
+
return this.requestApiRoot("/sandbox-secrets", {
|
|
1117
|
+
method: "POST",
|
|
1118
|
+
body: JSON.stringify(input)
|
|
1119
|
+
}).then((payload) => payload.secret);
|
|
1120
|
+
}
|
|
1121
|
+
rotateSecret(secretId, input) {
|
|
1122
|
+
const query = new URLSearchParams();
|
|
1123
|
+
if (input.teamId)
|
|
1124
|
+
query.set("teamId", input.teamId);
|
|
1125
|
+
const { teamId: _teamId, ...body } = input;
|
|
1126
|
+
return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}/rotate${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1127
|
+
method: "POST",
|
|
1128
|
+
body: JSON.stringify(body)
|
|
1129
|
+
}).then((payload) => payload.secret);
|
|
1130
|
+
}
|
|
1131
|
+
attachSecret(secretId, input) {
|
|
1132
|
+
const query = new URLSearchParams();
|
|
1133
|
+
if (input.teamId)
|
|
1134
|
+
query.set("teamId", input.teamId);
|
|
1135
|
+
const { teamId: _teamId, ...body } = input;
|
|
1136
|
+
return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}/attach${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1137
|
+
method: "POST",
|
|
1138
|
+
body: JSON.stringify(body)
|
|
1139
|
+
}).then((payload) => payload.secret);
|
|
1140
|
+
}
|
|
1141
|
+
revokeSecret(secretId, input = {}) {
|
|
1142
|
+
const query = new URLSearchParams();
|
|
1143
|
+
if (input.teamId)
|
|
1144
|
+
query.set("teamId", input.teamId);
|
|
1145
|
+
return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}/revoke${query.size > 0 ? `?${query.toString()}` : ""}`, { method: "POST" }).then((payload) => payload.secret);
|
|
1146
|
+
}
|
|
1147
|
+
deleteSecret(secretId, input = {}) {
|
|
1148
|
+
const query = new URLSearchParams();
|
|
1149
|
+
if (input.teamId)
|
|
1150
|
+
query.set("teamId", input.teamId);
|
|
1151
|
+
return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`, { method: "DELETE" }).then((payload) => payload.secret);
|
|
1152
|
+
}
|
|
1153
|
+
snapshotCatalog(input = {}) {
|
|
1154
|
+
const query = new URLSearchParams();
|
|
1155
|
+
if (input.teamId)
|
|
1156
|
+
query.set("teamId", input.teamId);
|
|
1157
|
+
if (input.projectId)
|
|
1158
|
+
query.set("projectId", input.projectId);
|
|
1159
|
+
if (input.agentId)
|
|
1160
|
+
query.set("agentId", input.agentId);
|
|
1161
|
+
if (input.q)
|
|
1162
|
+
query.set("q", input.q);
|
|
1163
|
+
if (input.kind)
|
|
1164
|
+
query.set("kind", input.kind);
|
|
1165
|
+
if (input.replayState)
|
|
1166
|
+
query.set("replayState", input.replayState);
|
|
1167
|
+
if (input.visibility)
|
|
1168
|
+
query.set("visibility", input.visibility);
|
|
1169
|
+
if (input.tag)
|
|
1170
|
+
query.set("tag", input.tag);
|
|
1171
|
+
if (input.useCase)
|
|
1172
|
+
query.set("useCase", input.useCase);
|
|
1173
|
+
if (input.limit)
|
|
1174
|
+
query.set("limit", String(input.limit));
|
|
1175
|
+
return this.request(`/catalog/snapshots${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1176
|
+
}
|
|
1177
|
+
listSandboxRuntimes(input = {}) {
|
|
1178
|
+
const query = new URLSearchParams();
|
|
1179
|
+
if (input.teamId)
|
|
1180
|
+
query.set("teamId", input.teamId);
|
|
1181
|
+
if (input.projectId)
|
|
1182
|
+
query.set("projectId", input.projectId);
|
|
1183
|
+
if (input.agentId)
|
|
1184
|
+
query.set("agentId", input.agentId);
|
|
1185
|
+
return this.requestApiRoot(`/runtimes${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => payload.runtimes);
|
|
1186
|
+
}
|
|
1187
|
+
listProjects(input) {
|
|
1188
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1189
|
+
return this.requestApiRoot(`/projects?${query.toString()}`).then((payload) => payload.projects);
|
|
1190
|
+
}
|
|
1191
|
+
upsertProject(input) {
|
|
1192
|
+
return this.requestApiRoot("/projects", {
|
|
1193
|
+
method: "POST",
|
|
1194
|
+
body: JSON.stringify(input)
|
|
1195
|
+
}).then((payload) => payload.project);
|
|
1196
|
+
}
|
|
1197
|
+
getHostedProfile(input) {
|
|
1198
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1199
|
+
return this.requestApiRoot(`/profile?${query.toString()}`).then((payload) => payload.profile);
|
|
1200
|
+
}
|
|
1201
|
+
ensureHostedProfile(input) {
|
|
1202
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1203
|
+
return this.requestApiRoot(`/profile/ensure?${query.toString()}`, { method: "POST" }).then((payload) => {
|
|
1204
|
+
if (!payload.profile) {
|
|
1205
|
+
throw new Error("hosted_profile_missing");
|
|
1206
|
+
}
|
|
1207
|
+
return payload.profile;
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
pushHostedProfile(input) {
|
|
1211
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1212
|
+
const { teamId: _teamId, ...body } = input;
|
|
1213
|
+
return this.requestApiRoot(`/profile/push?${query.toString()}`, {
|
|
1214
|
+
method: "POST",
|
|
1215
|
+
body: JSON.stringify(body)
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
async upsertProjectGitRemote(input) {
|
|
1219
|
+
const project = await this.upsertProject(input);
|
|
1220
|
+
return this.ensureProjectGitRemote(project.id, { teamId: input.teamId });
|
|
1221
|
+
}
|
|
1222
|
+
getProject(projectId, input) {
|
|
1223
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1224
|
+
return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}?${query.toString()}`).then((payload) => payload.project);
|
|
1225
|
+
}
|
|
1226
|
+
syncProject(projectId, input) {
|
|
1227
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1228
|
+
return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}/sync?${query.toString()}`, { method: "POST" }).then((payload) => payload.project);
|
|
1229
|
+
}
|
|
1230
|
+
ensureProjectGitRemote(projectId, input) {
|
|
1231
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1232
|
+
return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}/git?${query.toString()}`, { method: "POST" });
|
|
1233
|
+
}
|
|
1234
|
+
uploadProjectSource(projectId, input) {
|
|
1235
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1236
|
+
const { teamId: _teamId, ...body } = input;
|
|
1237
|
+
return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}/source?${query.toString()}`, {
|
|
1238
|
+
method: "POST",
|
|
1239
|
+
body: JSON.stringify(body)
|
|
1240
|
+
}).then((payload) => payload.project);
|
|
1241
|
+
}
|
|
1242
|
+
updateProject(projectId, input) {
|
|
1243
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1244
|
+
const { teamId: _teamId, ...body } = input;
|
|
1245
|
+
return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}?${query.toString()}`, {
|
|
1246
|
+
method: "PATCH",
|
|
1247
|
+
body: JSON.stringify(body)
|
|
1248
|
+
}).then((payload) => payload.project);
|
|
1249
|
+
}
|
|
1250
|
+
archiveProject(projectId, input) {
|
|
1251
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1252
|
+
return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}?${query.toString()}`, { method: "DELETE" }).then((payload) => payload.project);
|
|
1253
|
+
}
|
|
1254
|
+
listAgents(input) {
|
|
1255
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1256
|
+
return this.requestApiRoot(`/agents?${query.toString()}`).then((payload) => payload.agents);
|
|
1257
|
+
}
|
|
1258
|
+
upsertAgent(input) {
|
|
1259
|
+
return this.requestApiRoot("/agents", {
|
|
1260
|
+
method: "POST",
|
|
1261
|
+
body: JSON.stringify(input)
|
|
1262
|
+
}).then((payload) => payload.agent);
|
|
1263
|
+
}
|
|
1264
|
+
getAgent(agentId, input) {
|
|
1265
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1266
|
+
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}?${query.toString()}`).then((payload) => payload.agent);
|
|
1267
|
+
}
|
|
1268
|
+
archiveAgent(agentId, input) {
|
|
1269
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1270
|
+
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}?${query.toString()}`, { method: "DELETE" }).then((payload) => payload.agent);
|
|
1271
|
+
}
|
|
1272
|
+
updateAgent(agentId, input) {
|
|
1273
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1274
|
+
const { teamId: _teamId, ...body } = input;
|
|
1275
|
+
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}?${query.toString()}`, {
|
|
1276
|
+
method: "PATCH",
|
|
1277
|
+
body: JSON.stringify(body)
|
|
1278
|
+
}).then((payload) => payload.agent);
|
|
1279
|
+
}
|
|
1280
|
+
runAgent(agentId, input) {
|
|
1281
|
+
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/run`, {
|
|
1282
|
+
method: "POST",
|
|
1283
|
+
headers: {
|
|
1284
|
+
Prefer: "respond-async"
|
|
1285
|
+
},
|
|
1286
|
+
body: JSON.stringify(input)
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
getAgentSourceDeployPlan(agentId, input) {
|
|
1290
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1291
|
+
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/deploy-plan?${query.toString()}`).then((payload) => payload.deployPlan);
|
|
1292
|
+
}
|
|
1293
|
+
listAgentManifestSnapshots(agentId, input) {
|
|
1294
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1295
|
+
if (input.limit !== void 0)
|
|
1296
|
+
query.set("limit", String(input.limit));
|
|
1297
|
+
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/manifest-snapshots?${query.toString()}`).then((payload) => payload.manifestSnapshots);
|
|
1298
|
+
}
|
|
1299
|
+
requestAgentSourceChecks(agentId, input) {
|
|
1300
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1301
|
+
const { teamId: _teamId, ...body } = input;
|
|
1302
|
+
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/checks?${query.toString()}`, {
|
|
1303
|
+
method: "POST",
|
|
1304
|
+
body: JSON.stringify(body)
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
publishAgentSource(agentId, input) {
|
|
1308
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1309
|
+
const { teamId: _teamId, ...body } = input;
|
|
1310
|
+
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/publish?${query.toString()}`, {
|
|
1311
|
+
method: "POST",
|
|
1312
|
+
body: JSON.stringify(body)
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
getMicrosoftTeamsBotOverview(input) {
|
|
1316
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1317
|
+
return this.requestApiRoot(`/teams/bot/overview?${query.toString()}`);
|
|
1318
|
+
}
|
|
1319
|
+
bindMicrosoftTeamsBotConversation(input) {
|
|
1320
|
+
return this.requestApiRoot("/teams/bot/bindings", {
|
|
1321
|
+
method: "POST",
|
|
1322
|
+
body: JSON.stringify(input)
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
rebindMicrosoftTeamsBotConversation(bindingId, input) {
|
|
1326
|
+
return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(bindingId)}`, {
|
|
1327
|
+
method: "PATCH",
|
|
1328
|
+
body: JSON.stringify(input)
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
unlinkMicrosoftTeamsBotConversation(input) {
|
|
1332
|
+
return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(input.bindingId)}`, {
|
|
1333
|
+
method: "DELETE",
|
|
1334
|
+
body: JSON.stringify({ teamId: input.teamId })
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
sendMicrosoftTeamsBotDiagnostic(input) {
|
|
1338
|
+
return this.requestApiRoot("/teams/bot/diagnostics", {
|
|
1339
|
+
method: "POST",
|
|
1340
|
+
body: JSON.stringify(input)
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
sendMicrosoftTeamsBotDiagnosticRun(input) {
|
|
1344
|
+
return this.requestApiRoot("/teams/bot/diagnostics/run", {
|
|
1345
|
+
method: "POST",
|
|
1346
|
+
body: JSON.stringify(input)
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
createSandboxRuntime(input) {
|
|
1350
|
+
return this.requestApiRoot("/runtimes", {
|
|
1351
|
+
method: "POST",
|
|
1352
|
+
body: JSON.stringify(input)
|
|
1353
|
+
}).then((payload) => payload.runtime);
|
|
1354
|
+
}
|
|
1355
|
+
sandboxRuntime(runtimeId, initial = null) {
|
|
1356
|
+
return createSandboxRuntimeHandle(this, runtimeId, initial);
|
|
1357
|
+
}
|
|
1358
|
+
getSandboxRuntime(runtimeId) {
|
|
1359
|
+
return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}`).then((payload) => payload.runtime);
|
|
1360
|
+
}
|
|
1361
|
+
createSandboxRuntimeSandbox(runtimeId, input = {}, options = {}) {
|
|
1362
|
+
return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/sandbox`, {
|
|
1363
|
+
method: "POST",
|
|
1364
|
+
headers: asyncRequestHeaders(options),
|
|
1365
|
+
body: JSON.stringify(input)
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
updateSandboxRuntimeStatus(runtimeId, input) {
|
|
1369
|
+
return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/status`, {
|
|
1370
|
+
method: "PATCH",
|
|
1371
|
+
body: JSON.stringify(input)
|
|
1372
|
+
}).then((payload) => payload.runtime);
|
|
1373
|
+
}
|
|
1374
|
+
listSandboxRuntimeEvents(runtimeId) {
|
|
1375
|
+
return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/events`);
|
|
1376
|
+
}
|
|
1377
|
+
emitSandboxRuntimeEvent(runtimeId, input) {
|
|
1378
|
+
return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/events`, {
|
|
1379
|
+
method: "POST",
|
|
1380
|
+
body: JSON.stringify(input)
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
checkpointSandboxRuntime(runtimeId, input) {
|
|
1384
|
+
return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/checkpoints`, {
|
|
1385
|
+
method: "POST",
|
|
1386
|
+
body: JSON.stringify(input)
|
|
1387
|
+
}).then((payload) => payload.runtime);
|
|
1388
|
+
}
|
|
1389
|
+
promoteSandboxRuntime(runtimeId, input, options = {}) {
|
|
1390
|
+
const query = new URLSearchParams();
|
|
1391
|
+
if (options.teamId)
|
|
1392
|
+
query.set("teamId", options.teamId);
|
|
1393
|
+
return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/promote${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1394
|
+
method: "POST",
|
|
1395
|
+
body: JSON.stringify(input)
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
preserveSandboxRuntimeSource(runtimeId, input = {}, options = {}) {
|
|
1399
|
+
const query = new URLSearchParams();
|
|
1400
|
+
if (options.teamId)
|
|
1401
|
+
query.set("teamId", options.teamId);
|
|
1402
|
+
return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/preserve-source${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1403
|
+
method: "POST",
|
|
1404
|
+
body: JSON.stringify(input)
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
forkSnapshot(snapshotId, input = {}, options = {}) {
|
|
1408
|
+
const query = new URLSearchParams();
|
|
1409
|
+
if (input.teamId)
|
|
1410
|
+
query.set("teamId", input.teamId);
|
|
1411
|
+
if (input.projectId)
|
|
1412
|
+
query.set("projectId", input.projectId);
|
|
1413
|
+
if (options.async)
|
|
1414
|
+
query.set("async", "1");
|
|
1415
|
+
const { teamId: _teamId, projectId: _projectId, ...body } = input;
|
|
1416
|
+
return this.request(`/catalog/snapshots/${encodeURIComponent(snapshotId)}/fork${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1417
|
+
method: "POST",
|
|
1418
|
+
headers: options.async ? { Prefer: "respond-async" } : void 0,
|
|
1419
|
+
body: JSON.stringify({
|
|
1420
|
+
...body,
|
|
1421
|
+
snapshotId
|
|
1422
|
+
})
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
templates(input = {}) {
|
|
1426
|
+
const query = new URLSearchParams();
|
|
1427
|
+
if (input.teamId)
|
|
1428
|
+
query.set("teamId", input.teamId);
|
|
1429
|
+
if (input.projectId)
|
|
1430
|
+
query.set("projectId", input.projectId);
|
|
1431
|
+
if (input.q)
|
|
1432
|
+
query.set("q", input.q);
|
|
1433
|
+
if (input.name)
|
|
1434
|
+
query.set("name", input.name);
|
|
1435
|
+
if (input.version)
|
|
1436
|
+
query.set("version", input.version);
|
|
1437
|
+
if (input.visibility)
|
|
1438
|
+
query.set("visibility", input.visibility);
|
|
1439
|
+
if (input.tag)
|
|
1440
|
+
query.set("tag", input.tag);
|
|
1441
|
+
if (input.useCase)
|
|
1442
|
+
query.set("useCase", input.useCase);
|
|
1443
|
+
if (input.limit)
|
|
1444
|
+
query.set("limit", String(input.limit));
|
|
1445
|
+
return this.request(`/templates${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1446
|
+
}
|
|
1447
|
+
publishedSnapshots(input = {}) {
|
|
1448
|
+
const query = new URLSearchParams();
|
|
1449
|
+
if (input.teamId)
|
|
1450
|
+
query.set("teamId", input.teamId);
|
|
1451
|
+
if (input.projectId)
|
|
1452
|
+
query.set("projectId", input.projectId);
|
|
1453
|
+
if (input.q)
|
|
1454
|
+
query.set("q", input.q);
|
|
1455
|
+
if (input.name)
|
|
1456
|
+
query.set("name", input.name);
|
|
1457
|
+
if (input.version)
|
|
1458
|
+
query.set("version", input.version);
|
|
1459
|
+
if (input.visibility)
|
|
1460
|
+
query.set("visibility", input.visibility);
|
|
1461
|
+
if (input.tag)
|
|
1462
|
+
query.set("tag", input.tag);
|
|
1463
|
+
if (input.useCase)
|
|
1464
|
+
query.set("useCase", input.useCase);
|
|
1465
|
+
if (input.limit)
|
|
1466
|
+
query.set("limit", String(input.limit));
|
|
1467
|
+
return this.request(`/published-snapshots${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => {
|
|
1468
|
+
const publishedSnapshots = payload.publishedSnapshots ?? payload.templates;
|
|
1469
|
+
return {
|
|
1470
|
+
...payload,
|
|
1471
|
+
templates: publishedSnapshots,
|
|
1472
|
+
publishedSnapshots
|
|
1473
|
+
};
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
launchTemplate(input) {
|
|
1477
|
+
const query = new URLSearchParams();
|
|
1478
|
+
if (input.teamId)
|
|
1479
|
+
query.set("teamId", input.teamId);
|
|
1480
|
+
if (input.projectId)
|
|
1481
|
+
query.set("projectId", input.projectId);
|
|
1482
|
+
const { teamId: _teamId, projectId: _projectId, ...body } = input;
|
|
1483
|
+
return this.request(`/templates/launch${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1484
|
+
method: "POST",
|
|
1485
|
+
body: JSON.stringify(body)
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
runPublishedSnapshot(input) {
|
|
1489
|
+
const query = new URLSearchParams();
|
|
1490
|
+
if (input.teamId)
|
|
1491
|
+
query.set("teamId", input.teamId);
|
|
1492
|
+
if (input.projectId)
|
|
1493
|
+
query.set("projectId", input.projectId);
|
|
1494
|
+
const { teamId: _teamId, projectId: _projectId, ...body } = input;
|
|
1495
|
+
return this.request(`/published-snapshots/launch${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1496
|
+
method: "POST",
|
|
1497
|
+
body: JSON.stringify(body)
|
|
1498
|
+
}).then((payload) => {
|
|
1499
|
+
const publishedSnapshot = payload.publishedSnapshot ?? payload.template;
|
|
1500
|
+
return {
|
|
1501
|
+
...payload,
|
|
1502
|
+
template: publishedSnapshot,
|
|
1503
|
+
publishedSnapshot
|
|
1504
|
+
};
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
listSchedules(input = {}) {
|
|
1508
|
+
const query = new URLSearchParams();
|
|
1509
|
+
if (input.teamId)
|
|
1510
|
+
query.set("teamId", input.teamId);
|
|
1511
|
+
if (input.projectId)
|
|
1512
|
+
query.set("projectId", input.projectId);
|
|
1513
|
+
if (input.sourceSandboxId)
|
|
1514
|
+
query.set("sourceSandboxId", input.sourceSandboxId);
|
|
1515
|
+
return this.request(`/schedules${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1516
|
+
}
|
|
1517
|
+
createSchedule(input) {
|
|
1518
|
+
const query = new URLSearchParams();
|
|
1519
|
+
if (input.projectId)
|
|
1520
|
+
query.set("projectId", input.projectId);
|
|
1521
|
+
const { projectId: _projectId, ...body } = input;
|
|
1522
|
+
return this.request(`/schedules${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1523
|
+
method: "POST",
|
|
1524
|
+
body: JSON.stringify(body)
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
getSchedule(scheduleId) {
|
|
1528
|
+
return this.request(`/schedules/${encodeURIComponent(scheduleId)}`);
|
|
1529
|
+
}
|
|
1530
|
+
updateSchedule(scheduleId, input) {
|
|
1531
|
+
return this.request(`/schedules/${encodeURIComponent(scheduleId)}`, {
|
|
1532
|
+
method: "PATCH",
|
|
1533
|
+
body: JSON.stringify(input)
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
deleteSchedule(scheduleId) {
|
|
1537
|
+
return this.request(`/schedules/${encodeURIComponent(scheduleId)}`, {
|
|
1538
|
+
method: "DELETE"
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
listScheduleRuns(scheduleId, input = {}) {
|
|
1542
|
+
const query = new URLSearchParams();
|
|
1543
|
+
if (input.limit !== void 0)
|
|
1544
|
+
query.set("limit", String(input.limit));
|
|
1545
|
+
return this.request(`/schedules/${encodeURIComponent(scheduleId)}/runs${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1546
|
+
}
|
|
1547
|
+
runScheduleNow(scheduleId, input = {}) {
|
|
1548
|
+
return this.request(`/schedules/${encodeURIComponent(scheduleId)}/run`, {
|
|
1549
|
+
method: "POST",
|
|
1550
|
+
body: JSON.stringify(input)
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
listTemplateBuilds(input) {
|
|
1554
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1555
|
+
return this.requestApiRoot(`/sandbox-template-builds?${query.toString()}`).then((payload) => payload.builds);
|
|
1556
|
+
}
|
|
1557
|
+
createTemplateBuild(input) {
|
|
1558
|
+
return this.requestApiRoot("/sandbox-template-builds", {
|
|
1559
|
+
method: "POST",
|
|
1560
|
+
body: JSON.stringify(input)
|
|
1561
|
+
}).then((payload) => payload.build);
|
|
1562
|
+
}
|
|
1563
|
+
getTemplateBuild(buildId) {
|
|
1564
|
+
return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(buildId)}`).then((payload) => payload.build);
|
|
1565
|
+
}
|
|
1566
|
+
getTemplateBuildLogs(buildId) {
|
|
1567
|
+
return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(buildId)}/logs`);
|
|
1568
|
+
}
|
|
1569
|
+
cancelTemplateBuild(buildId) {
|
|
1570
|
+
return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(buildId)}/cancel`, {
|
|
1571
|
+
method: "POST"
|
|
1572
|
+
}).then((payload) => payload.build);
|
|
1573
|
+
}
|
|
1574
|
+
listPublishedSnapshotBuilds(input) {
|
|
1575
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1576
|
+
return this.requestApiRoot(`/published-snapshot-builds?${query.toString()}`).then((payload) => payload.builds);
|
|
1577
|
+
}
|
|
1578
|
+
createPublishedSnapshotBuild(input) {
|
|
1579
|
+
return this.requestApiRoot("/published-snapshot-builds", {
|
|
1580
|
+
method: "POST",
|
|
1581
|
+
body: JSON.stringify(input)
|
|
1582
|
+
}).then((payload) => payload.build);
|
|
1583
|
+
}
|
|
1584
|
+
getPublishedSnapshotBuild(buildId) {
|
|
1585
|
+
return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(buildId)}`).then((payload) => payload.build);
|
|
1586
|
+
}
|
|
1587
|
+
getPublishedSnapshotBuildLogs(buildId) {
|
|
1588
|
+
return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(buildId)}/logs`);
|
|
1589
|
+
}
|
|
1590
|
+
cancelPublishedSnapshotBuild(buildId) {
|
|
1591
|
+
return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(buildId)}/cancel`, {
|
|
1592
|
+
method: "POST"
|
|
1593
|
+
}).then((payload) => payload.build);
|
|
1594
|
+
}
|
|
1595
|
+
listOrganizations() {
|
|
1596
|
+
return this.requestApiRoot("/organizations").then((payload) => payload.organizations ?? payload.teams ?? []);
|
|
1597
|
+
}
|
|
1598
|
+
createOrganization(input) {
|
|
1599
|
+
return this.requestApiRoot("/organizations", {
|
|
1600
|
+
method: "POST",
|
|
1601
|
+
body: JSON.stringify(input)
|
|
1602
|
+
}).then((payload) => payload.organization);
|
|
1603
|
+
}
|
|
1604
|
+
getOrganization(slug) {
|
|
1605
|
+
return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}`).then((payload) => payload.organization);
|
|
1606
|
+
}
|
|
1607
|
+
updateOrganization(slug, input) {
|
|
1608
|
+
return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}`, {
|
|
1609
|
+
method: "PATCH",
|
|
1610
|
+
body: JSON.stringify(input)
|
|
1611
|
+
}).then((payload) => payload.organization);
|
|
1612
|
+
}
|
|
1613
|
+
listOrganizationMembers(slug) {
|
|
1614
|
+
return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/members`).then((payload) => payload.members);
|
|
1615
|
+
}
|
|
1616
|
+
upsertOrganizationMember(slug, input) {
|
|
1617
|
+
return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/members`, {
|
|
1618
|
+
method: "POST",
|
|
1619
|
+
body: JSON.stringify(input)
|
|
1620
|
+
}).then((payload) => payload.member);
|
|
1621
|
+
}
|
|
1622
|
+
getOrganizationMcpServer(slug) {
|
|
1623
|
+
return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server`).then((payload) => payload.mcpServer);
|
|
1624
|
+
}
|
|
1625
|
+
generateOrganizationMcpServer(slug, input = {}) {
|
|
1626
|
+
return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server`, {
|
|
1627
|
+
method: "POST",
|
|
1628
|
+
body: JSON.stringify(input)
|
|
1629
|
+
}).then((payload) => payload.mcpServer);
|
|
1630
|
+
}
|
|
1631
|
+
rotateOrganizationMcpServer(slug) {
|
|
1632
|
+
return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server/rotate`, {
|
|
1633
|
+
method: "POST"
|
|
1634
|
+
}).then((payload) => payload.mcpServer);
|
|
1635
|
+
}
|
|
1636
|
+
disableOrganizationMcpServer(slug) {
|
|
1637
|
+
return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server/disable`, {
|
|
1638
|
+
method: "POST"
|
|
1639
|
+
}).then((payload) => payload.mcpServer);
|
|
1640
|
+
}
|
|
1641
|
+
enableOrganizationMcpServer(slug) {
|
|
1642
|
+
return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server/enable`, {
|
|
1643
|
+
method: "POST"
|
|
1644
|
+
}).then((payload) => payload.mcpServer);
|
|
1645
|
+
}
|
|
1646
|
+
startReplay(input) {
|
|
1647
|
+
const query = new URLSearchParams();
|
|
1648
|
+
if (input.teamId)
|
|
1649
|
+
query.set("teamId", input.teamId);
|
|
1650
|
+
if (input.projectId)
|
|
1651
|
+
query.set("projectId", input.projectId);
|
|
1652
|
+
const { teamId: _teamId, projectId: _projectId, ...body } = input;
|
|
1653
|
+
return this.requestApiRoot(`/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1654
|
+
method: "POST",
|
|
1655
|
+
body: JSON.stringify(body)
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
listReplays(input = {}) {
|
|
1659
|
+
const query = new URLSearchParams();
|
|
1660
|
+
if (input.teamId)
|
|
1661
|
+
query.set("teamId", input.teamId);
|
|
1662
|
+
if (input.projectId)
|
|
1663
|
+
query.set("projectId", input.projectId);
|
|
1664
|
+
return this.requestApiRoot(`/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1665
|
+
}
|
|
1666
|
+
getReplay(replayId, input = {}) {
|
|
1667
|
+
const query = new URLSearchParams();
|
|
1668
|
+
if (input.teamId)
|
|
1669
|
+
query.set("teamId", input.teamId);
|
|
1670
|
+
if (input.projectId)
|
|
1671
|
+
query.set("projectId", input.projectId);
|
|
1672
|
+
return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1673
|
+
}
|
|
1674
|
+
getReplayLogs(replayId, input = {}) {
|
|
1675
|
+
const query = new URLSearchParams();
|
|
1676
|
+
if (input.teamId)
|
|
1677
|
+
query.set("teamId", input.teamId);
|
|
1678
|
+
if (input.projectId)
|
|
1679
|
+
query.set("projectId", input.projectId);
|
|
1680
|
+
return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}/logs${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1681
|
+
}
|
|
1682
|
+
getReplayArtifacts(replayId, input = {}) {
|
|
1683
|
+
const query = new URLSearchParams();
|
|
1684
|
+
if (input.teamId)
|
|
1685
|
+
query.set("teamId", input.teamId);
|
|
1686
|
+
if (input.projectId)
|
|
1687
|
+
query.set("projectId", input.projectId);
|
|
1688
|
+
return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}/artifacts${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1689
|
+
}
|
|
1690
|
+
cancelReplay(replayId, input = {}) {
|
|
1691
|
+
const query = new URLSearchParams();
|
|
1692
|
+
if (input.teamId)
|
|
1693
|
+
query.set("teamId", input.teamId);
|
|
1694
|
+
if (input.projectId)
|
|
1695
|
+
query.set("projectId", input.projectId);
|
|
1696
|
+
return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}/cancel${query.size > 0 ? `?${query.toString()}` : ""}`, {
|
|
1697
|
+
method: "POST"
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
integrationConnections(input = {}) {
|
|
1701
|
+
const query = new URLSearchParams();
|
|
1702
|
+
if (input.teamId)
|
|
1703
|
+
query.set("teamId", input.teamId);
|
|
1704
|
+
if (input.projectId)
|
|
1705
|
+
query.set("projectId", input.projectId);
|
|
1706
|
+
if (input.agentId)
|
|
1707
|
+
query.set("agentId", input.agentId);
|
|
1708
|
+
if (input.status)
|
|
1709
|
+
query.set("status", input.status);
|
|
1710
|
+
return this.requestApiRoot(`/integrations/connections${query.size > 0 ? `?${query.toString()}` : ""}`);
|
|
1711
|
+
}
|
|
1712
|
+
mcpServerConfig() {
|
|
1713
|
+
return {
|
|
1714
|
+
name: "openpond-sandboxes",
|
|
1715
|
+
transport: "streamable-http",
|
|
1716
|
+
url: `${this.sandboxApiUrl}/mcp`,
|
|
1717
|
+
headers: {
|
|
1718
|
+
"openpond-api-key": this.apiKey
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
smoke(options = {}) {
|
|
1723
|
+
return runSandboxSmoke(this, options);
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1726
|
+
function createOpenPondSandboxClient(options) {
|
|
1727
|
+
return new OpenPondSandboxClient(options);
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
export {
|
|
1731
|
+
withVercelProtectionBypass,
|
|
1732
|
+
apiFetch,
|
|
1733
|
+
DEFAULT_OPENPOND_WEB_BASE_URL,
|
|
1734
|
+
DEFAULT_OPENPOND_API_BASE_URL,
|
|
1735
|
+
normalizeSandboxApiUrl,
|
|
1736
|
+
createOpenPondSandboxClient
|
|
1737
|
+
};
|