openpond 0.0.36 → 0.0.38
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 +4 -3
- package/dist/api/types.d.ts +0 -50
- package/dist/api.d.ts +2 -8
- package/dist/chunks/{app-layer-4AA4YYGK.js → app-layer-DPUJRNO2.js} +6 -3
- package/dist/chunks/{apps-V2JTB5MD.js → apps-AKBI6AS7.js} +16 -132
- package/dist/chunks/chunk-275WCETC.js +668 -0
- package/dist/chunks/{chunk-3DOOLZZM.js → chunk-43YI36NA.js} +1 -1
- package/dist/chunks/{chunk-NWQTF6O4.js → chunk-AHNFNWUN.js} +28 -3
- package/dist/chunks/{chunk-3JJBNVNX.js → chunk-AHPQTEIJ.js} +23 -19
- package/dist/chunks/chunk-FWLOFUPU.js +864 -0
- package/dist/chunks/{chunk-JAS6QZ2W.js → chunk-GB6VUZUA.js} +1 -1
- package/dist/chunks/{chunk-NVTC3XOA.js → chunk-GDZYDLEL.js} +8 -10
- package/dist/chunks/{chunk-G6WW2656.js → chunk-HLCTINEP.js} +1 -1
- package/dist/chunks/{chunk-MJT7EW5Q.js → chunk-HS2AGRDV.js} +1 -1
- package/dist/chunks/{chunk-CJSD5ADV.js → chunk-JWF37O5E.js} +2 -2
- package/dist/chunks/chunk-KSRWKXRB.js +12 -0
- package/dist/chunks/{chunk-7IPF4X3K.js → chunk-LZZM3IHS.js} +1004 -89
- package/dist/chunks/{chunk-TYYR7KWY.js → chunk-MPGSHXGF.js} +7 -5
- package/dist/chunks/chunk-MUMPWI4O.js +92 -0
- package/dist/chunks/{chunk-MSX2J653.js → chunk-QRM7XMAO.js} +5 -36
- package/dist/chunks/{chunk-65BVQIHR.js → chunk-SLMP353Q.js} +6 -6
- package/dist/chunks/chunk-T4QXKU5Y.js +1 -0
- package/dist/chunks/{chunk-GALAW74P.js → chunk-V35STJF4.js} +30 -11
- package/dist/chunks/{chunk-YLULZMWE.js → chunk-XCATKTK3.js} +51 -139
- package/dist/chunks/{chunk-LHYK6QO2.js → chunk-XEJ7XXUQ.js} +1 -0
- package/dist/chunks/{chunk-YRFQKUZD.js → chunk-XERQHYBO.js} +89 -27
- package/dist/chunks/{chunk-6L5WJF7T.js → chunk-YTJL6XPU.js} +2 -2
- package/dist/chunks/{chunk-NWVIUBJ3.js → chunk-ZI4GDAUB.js} +573 -1217
- package/dist/chunks/cli-2KBVNDRY.js +23 -0
- package/dist/chunks/{cli-RJHEE4FA.js → cli-7BKDWFNU.js} +5 -5
- package/dist/chunks/{core-commands-CQSPCVC4.js → core-commands-YN4RMWA3.js} +7 -4
- package/dist/chunks/{extend-4MZ75SHV.js → extend-REGNTBK3.js} +18 -13
- package/dist/chunks/extension-7K77DAVL.js +121 -0
- package/dist/chunks/{harness-YVZU42S7.js → harness-BHQRMXJR.js} +6 -3
- package/dist/chunks/{help-6SULYXVS.js → help-VREQNA4I.js} +2 -1
- package/dist/chunks/{opchat-XGS4AXHA.js → opchat-D63YTNSX.js} +12 -7
- package/dist/chunks/{organizations-4GFQ3NT2.js → organizations-I46KG7TC.js} +8 -5
- package/dist/chunks/{profile-VWMBIHIE.js → profile-WKZJHEPG.js} +11 -8
- package/dist/chunks/{project-agent-SQ6ODALG.js → project-agent-ZUC3YMCT.js} +10 -7
- package/dist/chunks/{sandbox-command-34S2V7BN.js → sandbox-command-AAOPFTI5.js} +7 -4
- package/dist/chunks/{sandbox-template-VP5HMGQI.js → sandbox-template-GKNVR4C5.js} +11 -7
- package/dist/chunks/{src-X3R3XIJT.js → src-MWDIK56B.js} +1997 -1247
- package/dist/chunks/{src-YHUMH6W6.js → src-RPW5TOPI.js} +3 -3
- package/dist/chunks/{teams-bot-EIVRNO5S.js → teams-bot-PSL3ZO6Z.js} +6 -3
- package/dist/chunks/{workspaces-2N52V3BI.js → workspaces-BPXC2DHT.js} +6 -2
- package/dist/cli.js +14 -11
- package/dist/client-types.d.ts +1 -9
- package/dist/client.d.ts +3 -3
- package/dist/index.js +27 -55
- package/dist/profile/local-profile-types.d.ts +1 -0
- package/dist/profile/profile-skills.d.ts +2 -0
- package/dist/web/assets/{AppDialog-j4N-gIi3.js → AppDialog-DrwJb_wG.js} +1 -1
- package/dist/web/assets/{AppsView-YiK3pqNb.js → AppsView-DPagLMsc.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-BWFLEQ8j.js → BrowserSidebar-DMn2V8RV.js} +1 -1
- package/dist/web/assets/{CloudWorkView-3sS_1bhN.js → CloudWorkView-Cl_7mM3c.js} +1 -1
- package/dist/web/assets/{CommandMenu-B11OrTCq.js → CommandMenu-CHMQLez_.js} +1 -1
- package/dist/web/assets/{CommunityView-DXyXTWhP.js → CommunityView-DcHVDUk0.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-3NoRiJJq.js → ComposerCreateImproveStrip-BZ3Dgzmo.js} +1 -1
- package/dist/web/assets/{GetStartedView-CPV5lgVH.js → GetStartedView-DTRotFqz.js} +1 -1
- package/dist/web/assets/LabSkillSidebar-CVxtS9pd.css +1 -0
- package/dist/web/assets/LabSkillSidebar-D-PqFe1T.js +1 -0
- package/dist/web/assets/LabsRoute-BrJkBNig.css +1 -0
- package/dist/web/assets/LabsRoute-Dew1BwK5.js +3 -0
- package/dist/web/assets/MainChatThread-BaPxxzrw.js +2 -0
- package/dist/web/assets/{MakeAgentTutorialLearningPanel-C6F-kJQd.js → MakeAgentTutorialLearningPanel-CBsfnONQ.js} +2 -2
- package/dist/web/assets/{MarkdownText-CkVkr3P1.js → MarkdownText-DGLfAM_Z.js} +4 -4
- package/dist/web/assets/Messages-CIX9uTjX.js +10 -0
- package/dist/web/assets/NativeSkillSidebar-AP_uHn6g.js +1 -0
- package/dist/web/assets/{NewProjectDialog-DBMhkTvD.js → NewProjectDialog-C6lHkafU.js} +1 -1
- package/dist/web/assets/{PostTrainingLearningPanel-B1Rp7iIL.js → PostTrainingLearningPanel-CZEgPc8O.js} +2 -2
- package/dist/web/assets/{PostTrainingStatusPill-BGZ9h5eW.js → PostTrainingStatusPill-CeEpwUDB.js} +1 -1
- package/dist/web/assets/{ProfileSettingsSection-2NOHEz2b.js → ProfileSettingsSection-EumMLlEp.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-MXBcx3zO.js +1 -0
- package/dist/web/assets/{SettingsView-uHhQnazW.css → SettingsView-Caljbns2.css} +1 -1
- package/dist/web/assets/SettingsView-DyURG_Uh.js +6 -0
- package/dist/web/assets/{TeamChatView-qVscSedQ.js → TeamChatView-D3v6aqJ3.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-Bkw7XqMy.js → TerminalOverlay-BKl0p8pa.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-COg1wvw8.js → TrainingCreationPanel-CfZQTuT5.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-BNK2znmI.js → TrainingDraftPanel-DslRPSDW.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CUxBaohC.js → UsageSettingsSection-zDAwzTGl.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-C_MZPPlL.js +14 -0
- package/dist/web/assets/{WorkspaceEnvironmentMenu-C0-mH7oF.js → WorkspaceEnvironmentMenu-BUAnn80j.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-VvC2px0X.js → WorkspaceGitDialogs-Drbf4ujA.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-CUIwoHv1.js → WorkspaceMonacoEditor-DPGcG8fy.js} +3 -3
- package/dist/web/assets/{activity-BhqHgkfJ.js → activity-Dnr3jqb3.js} +1 -1
- package/dist/web/assets/{boxes-BpqUKFIm.js → boxes-BinC8UPn.js} +1 -1
- package/dist/web/assets/{chevron-up-BTn9DVRP.js → chevron-up-Bjp_-_Cb.js} +1 -1
- package/dist/web/assets/{circle-x-B9Qa8o5a.js → circle-x-ubnvEYuE.js} +1 -1
- package/dist/web/assets/{copy-BsYs6wBI.js → copy-B_ZCCUMz.js} +1 -1
- package/dist/web/assets/{create-pipeline-request-vxgKoAvv.js → create-pipeline-request-D6uLUxe9.js} +3 -3
- package/dist/web/assets/{cssMode-mw8RI2fR.js → cssMode-CKN9CcfG.js} +1 -1
- package/dist/web/assets/file-8HAMlTmQ.js +1 -0
- package/dist/web/assets/{git-branch-C7qQYFIs.js → git-branch-l2Zih3Bv.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-CbX4pTOA.js → git-commit-horizontal-Bxi8YPep.js} +1 -1
- package/dist/web/assets/{htmlMode-Cc4Czh_M.js → htmlMode-CeUcNhBZ.js} +1 -1
- package/dist/web/assets/index-BMFyOFRU.css +1 -0
- package/dist/web/assets/index-BzwcDzbT.js +1 -0
- package/dist/web/assets/index-KoQSSt_f.js +177 -0
- package/dist/web/assets/{info-BNGbwgtq.js → info-JTbDQxHx.js} +1 -1
- package/dist/web/assets/{jsonMode-CbqbqGVz.js → jsonMode-97z0Yz9u.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-DKiKr5tH.js → lspLanguageFeatures-D4Tp-JmI.js} +1 -1
- package/dist/web/assets/{make-agent-tutorial-KKauJpB9.js → make-agent-tutorial-D6nBCgv-.js} +1 -1
- package/dist/web/assets/{monaco.contribution-Dxc4IxFM.js → monaco.contribution-B3j6oown.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CNgwz_pw.js → monaco.contribution-BXHxPPWL.js} +2 -2
- package/dist/web/assets/{monaco.contribution-D_-wu578.js → monaco.contribution-C2P5zIzh.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CdUAX47Q.js → monaco.contribution-C8c6OtGi.js} +2 -2
- package/dist/web/assets/{monitor-CNdx_GTg.js → monitor-kzHtxHnA.js} +1 -1
- package/dist/web/assets/{play-BLRANWaV.js → play-C-37dnR1.js} +1 -1
- package/dist/web/assets/{python-DYgDMu2R.js → python-CGpDXY7_.js} +1 -1
- package/dist/web/assets/{refresh-cw-BFjjwYNf.js → refresh-cw-BAaaPCXl.js} +1 -1
- package/dist/web/assets/{reply-D012cuZl.js → reply-9rehU13k.js} +1 -1
- package/dist/web/assets/{rotate-cw-CTfjlR4G.js → rotate-cw-C1Z_Xs23.js} +1 -1
- package/dist/web/assets/{save-B1zYlRyN.js → save-Cvxs3XyC.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-D9XFH7EA.js → toggleHighContrast-CD42jH4g.js} +1 -1
- package/dist/web/assets/{tsMode-BU-tuKsY.js → tsMode-ZROIxEjv.js} +1 -1
- package/dist/web/assets/{upload-DU_81jvL.js → upload-DvCSGERK.js} +1 -1
- package/dist/web/assets/{wifi-off-TPsBnbGW.js → wifi-off-BIb94PkS.js} +1 -1
- package/dist/web/assets/{workers-NhWySRdT.js → workers-oYqbrVYG.js} +1 -1
- package/dist/web/assets/{yaml-DWXa_3ZL.js → yaml-WqBjNgOO.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/command-reference.md +16 -1
- package/package.json +1 -1
- package/dist/chunks/cli-4JA3SIDE.js +0 -19
- package/dist/web/assets/LabsRoute-B_nsEZXy.js +0 -3
- package/dist/web/assets/LabsRoute-dNN-odU0.css +0 -1
- package/dist/web/assets/MainChatThread-Dg7p3R2O.js +0 -2
- package/dist/web/assets/Messages-C7uHGoFw.js +0 -10
- package/dist/web/assets/NativeSkillSidebar-BPpoHjEW.js +0 -1
- package/dist/web/assets/RightChatPanelStack-CLK7_zKe.js +0 -1
- package/dist/web/assets/SettingsView-BAqea_KX.js +0 -6
- package/dist/web/assets/WorkspaceDiffPanel-qfFj8IRq.js +0 -14
- package/dist/web/assets/credit-card-BCePAwMI.js +0 -1
- package/dist/web/assets/index-9tbdqUau.css +0 -1
- package/dist/web/assets/index-B_3z_lxq.js +0 -1
- package/dist/web/assets/index-Cr_RZ7GD.js +0 -177
- package/dist/web/tokens/eth.svg +0 -1
- package/dist/web/tokens/usdc.svg +0 -1
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_OPENPOND_API_BASE_URL,
|
|
4
|
-
DEFAULT_OPENPOND_WEB_BASE_URL
|
|
5
|
-
|
|
6
|
-
resolveBaseUrl,
|
|
7
|
-
resolveSandboxApiUrlOption
|
|
8
|
-
} from "./chunk-NVTC3XOA.js";
|
|
9
|
-
import {
|
|
10
|
-
parseBooleanOption
|
|
11
|
-
} from "./chunk-YLULZMWE.js";
|
|
4
|
+
DEFAULT_OPENPOND_WEB_BASE_URL
|
|
5
|
+
} from "./chunk-KSRWKXRB.js";
|
|
12
6
|
|
|
13
7
|
// ../../packages/cloud/src/api/core.ts
|
|
14
8
|
var DEFAULT_API_TIMEOUT_MS = 3e4;
|
|
@@ -89,16 +83,16 @@ async function readApiJson(response, label) {
|
|
|
89
83
|
}
|
|
90
84
|
return payload;
|
|
91
85
|
}
|
|
92
|
-
function boundedResponse(response,
|
|
86
|
+
function boundedResponse(response, input) {
|
|
93
87
|
if (!response.body) {
|
|
94
|
-
|
|
88
|
+
input.cleanup();
|
|
95
89
|
return response;
|
|
96
90
|
}
|
|
97
91
|
const contentLength = Number(response.headers.get("content-length"));
|
|
98
|
-
if (
|
|
99
|
-
|
|
92
|
+
if (input.maximumBytes > 0 && Number.isFinite(contentLength) && contentLength > input.maximumBytes) {
|
|
93
|
+
input.cleanup();
|
|
100
94
|
void response.body.cancel();
|
|
101
|
-
throw new ApiResponseTooLargeError(
|
|
95
|
+
throw new ApiResponseTooLargeError(input.maximumBytes, input.requestUrl);
|
|
102
96
|
}
|
|
103
97
|
const reader = response.body.getReader();
|
|
104
98
|
let receivedBytes = 0;
|
|
@@ -107,25 +101,25 @@ function boundedResponse(response, input3) {
|
|
|
107
101
|
try {
|
|
108
102
|
const result = await reader.read();
|
|
109
103
|
if (result.done) {
|
|
110
|
-
|
|
104
|
+
input.cleanup();
|
|
111
105
|
controller.close();
|
|
112
106
|
return;
|
|
113
107
|
}
|
|
114
108
|
receivedBytes += result.value.byteLength;
|
|
115
|
-
if (
|
|
116
|
-
|
|
109
|
+
if (input.maximumBytes > 0 && receivedBytes > input.maximumBytes) {
|
|
110
|
+
input.cleanup();
|
|
117
111
|
await reader.cancel();
|
|
118
|
-
controller.error(new ApiResponseTooLargeError(
|
|
112
|
+
controller.error(new ApiResponseTooLargeError(input.maximumBytes, input.requestUrl));
|
|
119
113
|
return;
|
|
120
114
|
}
|
|
121
115
|
controller.enqueue(result.value);
|
|
122
116
|
} catch (error) {
|
|
123
|
-
|
|
124
|
-
controller.error(
|
|
117
|
+
input.cleanup();
|
|
118
|
+
controller.error(input.timeoutController.signal.aborted ? input.timeoutError : error);
|
|
125
119
|
}
|
|
126
120
|
},
|
|
127
121
|
async cancel(reason) {
|
|
128
|
-
|
|
122
|
+
input.cleanup();
|
|
129
123
|
await reader.cancel(reason);
|
|
130
124
|
}
|
|
131
125
|
});
|
|
@@ -141,8 +135,8 @@ function composedSignal(callerSignal, timeoutSignal, timeoutMs) {
|
|
|
141
135
|
}
|
|
142
136
|
|
|
143
137
|
// ../../packages/cloud/src/api/deployments.ts
|
|
144
|
-
async function deployApp(baseUrl, token, appId,
|
|
145
|
-
const environment =
|
|
138
|
+
async function deployApp(baseUrl, token, appId, input) {
|
|
139
|
+
const environment = input?.environment ?? "production";
|
|
146
140
|
const response = await apiFetch(
|
|
147
141
|
baseUrl,
|
|
148
142
|
token,
|
|
@@ -151,8 +145,8 @@ async function deployApp(baseUrl, token, appId, input3) {
|
|
|
151
145
|
method: "POST",
|
|
152
146
|
body: JSON.stringify({
|
|
153
147
|
environment,
|
|
154
|
-
...
|
|
155
|
-
...
|
|
148
|
+
...input?.commitSha ? { commitSha: input.commitSha } : {},
|
|
149
|
+
...input?.branch ? { branch: input.branch } : {}
|
|
156
150
|
})
|
|
157
151
|
}
|
|
158
152
|
);
|
|
@@ -276,10 +270,10 @@ async function listApps(apiBase, token, options) {
|
|
|
276
270
|
const payload = await response.json().catch(() => ({}));
|
|
277
271
|
return Array.isArray(payload.apps) ? payload.apps : [];
|
|
278
272
|
}
|
|
279
|
-
async function createRepo(apiBase, apiKey,
|
|
273
|
+
async function createRepo(apiBase, apiKey, input) {
|
|
280
274
|
const response = await apiFetch(apiBase, apiKey, "/apps/repo/create", {
|
|
281
275
|
method: "POST",
|
|
282
|
-
body: JSON.stringify(
|
|
276
|
+
body: JSON.stringify(input)
|
|
283
277
|
});
|
|
284
278
|
if (!response.ok) {
|
|
285
279
|
const text = await response.text().catch(() => "");
|
|
@@ -342,14 +336,14 @@ async function listTemplateBranches(apiBase, token, appId) {
|
|
|
342
336
|
}
|
|
343
337
|
return await response.json();
|
|
344
338
|
}
|
|
345
|
-
async function deployLatestTemplate(apiBase, token, appId,
|
|
339
|
+
async function deployLatestTemplate(apiBase, token, appId, input) {
|
|
346
340
|
const response = await apiFetch(
|
|
347
341
|
apiBase,
|
|
348
342
|
token,
|
|
349
343
|
`/v4/apps/${appId}/template/deploy-latest`,
|
|
350
344
|
{
|
|
351
345
|
method: "POST",
|
|
352
|
-
body: JSON.stringify(
|
|
346
|
+
body: JSON.stringify(input)
|
|
353
347
|
}
|
|
354
348
|
);
|
|
355
349
|
if (!response.ok) {
|
|
@@ -358,14 +352,14 @@ async function deployLatestTemplate(apiBase, token, appId, input3) {
|
|
|
358
352
|
}
|
|
359
353
|
return await response.json();
|
|
360
354
|
}
|
|
361
|
-
async function updateAppEnvironment(apiBase, token, appId,
|
|
355
|
+
async function updateAppEnvironment(apiBase, token, appId, input) {
|
|
362
356
|
const response = await apiFetch(
|
|
363
357
|
apiBase,
|
|
364
358
|
token,
|
|
365
359
|
`/v4/apps/${appId}/environment`,
|
|
366
360
|
{
|
|
367
361
|
method: "POST",
|
|
368
|
-
body: JSON.stringify(
|
|
362
|
+
body: JSON.stringify(input)
|
|
369
363
|
}
|
|
370
364
|
);
|
|
371
365
|
if (!response.ok) {
|
|
@@ -533,18 +527,6 @@ async function executeUserTool(baseUrl, token, body) {
|
|
|
533
527
|
data: payload
|
|
534
528
|
};
|
|
535
529
|
}
|
|
536
|
-
async function submitPositionsTx(baseUrl, token, params) {
|
|
537
|
-
const qs = params.query && Object.keys(params.query).length > 0 ? `?${new URLSearchParams(params.query).toString()}` : "";
|
|
538
|
-
const response = await apiFetch(baseUrl, token, `/apps/positions/tx${qs}`, {
|
|
539
|
-
method: params.method,
|
|
540
|
-
body: params.method === "POST" && params.body !== void 0 ? JSON.stringify(params.body) : void 0
|
|
541
|
-
});
|
|
542
|
-
if (!response.ok) {
|
|
543
|
-
const text = await response.text().catch(() => "");
|
|
544
|
-
throw new Error(`Positions request failed: ${response.status} ${text}`);
|
|
545
|
-
}
|
|
546
|
-
return await response.json();
|
|
547
|
-
}
|
|
548
530
|
async function submitBacktestRun(baseUrl, token, body) {
|
|
549
531
|
const response = await apiFetch(baseUrl, token, "/apps/backtests/run", {
|
|
550
532
|
method: "POST",
|
|
@@ -806,13 +788,13 @@ function selectorFromAccount(account) {
|
|
|
806
788
|
}
|
|
807
789
|
function sanitizeActiveProfile(value) {
|
|
808
790
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
809
|
-
const
|
|
791
|
+
const input = value;
|
|
810
792
|
const handle = normalizeHandle(
|
|
811
|
-
typeof
|
|
793
|
+
typeof input.handle === "string" ? input.handle : void 0
|
|
812
794
|
);
|
|
813
795
|
if (!handle) return null;
|
|
814
796
|
const baseUrl = normalizeBaseUrl(
|
|
815
|
-
typeof
|
|
797
|
+
typeof input.baseUrl === "string" ? input.baseUrl : void 0
|
|
816
798
|
);
|
|
817
799
|
return baseUrl ? { handle, baseUrl } : { handle };
|
|
818
800
|
}
|
|
@@ -820,17 +802,17 @@ function sanitizeLocalOpenPondProfile(value) {
|
|
|
820
802
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
821
803
|
return void 0;
|
|
822
804
|
}
|
|
823
|
-
const
|
|
824
|
-
const repoPath = typeof
|
|
825
|
-
const profile = typeof
|
|
805
|
+
const input = value;
|
|
806
|
+
const repoPath = typeof input.repoPath === "string" ? input.repoPath.trim() : "";
|
|
807
|
+
const profile = typeof input.profile === "string" && input.profile.trim() ? input.profile.trim() : "default";
|
|
826
808
|
if (!repoPath) return void 0;
|
|
827
809
|
const out = {
|
|
828
810
|
repoPath,
|
|
829
811
|
profile,
|
|
830
812
|
mode: "local"
|
|
831
813
|
};
|
|
832
|
-
if (
|
|
833
|
-
const check =
|
|
814
|
+
if (input.lastCheck && typeof input.lastCheck === "object" && !Array.isArray(input.lastCheck)) {
|
|
815
|
+
const check = input.lastCheck;
|
|
834
816
|
const command = check.command;
|
|
835
817
|
const status = check.status;
|
|
836
818
|
const checkedAt = check.checkedAt;
|
|
@@ -844,8 +826,8 @@ function sanitizeLocalOpenPondProfile(value) {
|
|
|
844
826
|
};
|
|
845
827
|
}
|
|
846
828
|
}
|
|
847
|
-
if (
|
|
848
|
-
const push =
|
|
829
|
+
if (input.lastPush && typeof input.lastPush === "object" && !Array.isArray(input.lastPush)) {
|
|
830
|
+
const push = input.lastPush;
|
|
849
831
|
const status = push.status;
|
|
850
832
|
const pushedAt = push.pushedAt;
|
|
851
833
|
if ((status === "pushed" || status === "failed") && typeof pushedAt === "string") {
|
|
@@ -874,120 +856,120 @@ function sanitizeLocalOpenPondProfile(value) {
|
|
|
874
856
|
}
|
|
875
857
|
function sanitizeHostedMaterializationStatus(value) {
|
|
876
858
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
877
|
-
const
|
|
878
|
-
const status = stringField(
|
|
859
|
+
const input = value;
|
|
860
|
+
const status = stringField(input.status);
|
|
879
861
|
if (!status) return null;
|
|
880
862
|
return {
|
|
881
863
|
status,
|
|
882
|
-
...nullableStringProp(
|
|
883
|
-
...nullableStringProp(
|
|
884
|
-
...nullableStringProp(
|
|
885
|
-
...nullableStringProp(
|
|
886
|
-
...nullableStringProp(
|
|
887
|
-
...nullableStringProp(
|
|
888
|
-
...nullableStringProp(
|
|
889
|
-
...nullableStringProp(
|
|
890
|
-
...nullableStringProp(
|
|
891
|
-
...nullableNumberProp(
|
|
892
|
-
...nullableNumberProp(
|
|
893
|
-
...nullableStringProp(
|
|
894
|
-
...nullableBooleanProp(
|
|
895
|
-
...nullableStringProp(
|
|
896
|
-
...stringArrayProp(
|
|
897
|
-
...stringArrayProp(
|
|
898
|
-
...nullableStringProp(
|
|
899
|
-
...nullableStringProp(
|
|
864
|
+
...nullableStringProp(input, "agentId"),
|
|
865
|
+
...nullableStringProp(input, "runtimeAgentId"),
|
|
866
|
+
...nullableStringProp(input, "projectId"),
|
|
867
|
+
...nullableStringProp(input, "sourceRoot"),
|
|
868
|
+
...nullableStringProp(input, "sourceRef"),
|
|
869
|
+
...nullableStringProp(input, "sourceCommitSha"),
|
|
870
|
+
...nullableStringProp(input, "manifestHash"),
|
|
871
|
+
...nullableStringProp(input, "manifestPath"),
|
|
872
|
+
...nullableStringProp(input, "manifestSyncedAt"),
|
|
873
|
+
...nullableNumberProp(input, "fileCount"),
|
|
874
|
+
...nullableNumberProp(input, "totalBytes"),
|
|
875
|
+
...nullableStringProp(input, "generatedManifestPath"),
|
|
876
|
+
...nullableBooleanProp(input, "synthesizedOpenPondYaml"),
|
|
877
|
+
...nullableStringProp(input, "uploadMetadataPath"),
|
|
878
|
+
...stringArrayProp(input, "setupCommands"),
|
|
879
|
+
...stringArrayProp(input, "validationCommands"),
|
|
880
|
+
...nullableStringProp(input, "materializedAt"),
|
|
881
|
+
...nullableStringProp(input, "error")
|
|
900
882
|
};
|
|
901
883
|
}
|
|
902
884
|
function sanitizeHostedSourceCheckStatus(value) {
|
|
903
885
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
904
|
-
const
|
|
905
|
-
const status = stringField(
|
|
886
|
+
const input = value;
|
|
887
|
+
const status = stringField(input.status);
|
|
906
888
|
if (!status) return null;
|
|
907
889
|
return {
|
|
908
890
|
status,
|
|
909
|
-
...nullableStringProp(
|
|
910
|
-
...nullableStringProp(
|
|
911
|
-
...nullableStringProp(
|
|
912
|
-
...nullableBooleanProp(
|
|
913
|
-
...nullableBooleanProp(
|
|
914
|
-
...nullableStringProp(
|
|
915
|
-
...nullableStringProp(
|
|
916
|
-
...nullableStringProp(
|
|
917
|
-
...nullableStringProp(
|
|
918
|
-
...stringArrayProp(
|
|
919
|
-
...stringArrayProp(
|
|
920
|
-
...stringArrayProp(
|
|
921
|
-
...stringArrayProp(
|
|
922
|
-
...stringArrayProp(
|
|
923
|
-
...stringArrayProp(
|
|
924
|
-
...nullableStringProp(
|
|
925
|
-
...nullableStringProp(
|
|
926
|
-
...stringArrayProp(
|
|
927
|
-
...stringArrayProp(
|
|
928
|
-
...stringArrayProp(
|
|
929
|
-
...nullableStringProp(
|
|
930
|
-
...nullableStringProp(
|
|
891
|
+
...nullableStringProp(input, "agentId"),
|
|
892
|
+
...nullableStringProp(input, "workItemId"),
|
|
893
|
+
...nullableStringProp(input, "deployPlanStatus"),
|
|
894
|
+
...nullableBooleanProp(input, "canRun"),
|
|
895
|
+
...nullableBooleanProp(input, "canDeploy"),
|
|
896
|
+
...nullableStringProp(input, "sourceRef"),
|
|
897
|
+
...nullableStringProp(input, "sourceCommitSha"),
|
|
898
|
+
...nullableStringProp(input, "manifestHash"),
|
|
899
|
+
...nullableStringProp(input, "manifestPath"),
|
|
900
|
+
...stringArrayProp(input, "setupCommands"),
|
|
901
|
+
...stringArrayProp(input, "validationCommands"),
|
|
902
|
+
...stringArrayProp(input, "requiredChecks"),
|
|
903
|
+
...stringArrayProp(input, "evalNames"),
|
|
904
|
+
...stringArrayProp(input, "blockedReasons"),
|
|
905
|
+
...stringArrayProp(input, "staleReasons"),
|
|
906
|
+
...nullableStringProp(input, "runtimeId"),
|
|
907
|
+
...nullableStringProp(input, "sandboxId"),
|
|
908
|
+
...stringArrayProp(input, "traceArtifactRefs"),
|
|
909
|
+
...stringArrayProp(input, "evalResultArtifactRefs"),
|
|
910
|
+
...stringArrayProp(input, "validatorArtifactRefs"),
|
|
911
|
+
...nullableStringProp(input, "checkedAt"),
|
|
912
|
+
...nullableStringProp(input, "error")
|
|
931
913
|
};
|
|
932
914
|
}
|
|
933
915
|
function sanitizeHostedPublishStatus(value) {
|
|
934
916
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
935
|
-
const
|
|
936
|
-
const status = stringField(
|
|
917
|
+
const input = value;
|
|
918
|
+
const status = stringField(input.status);
|
|
937
919
|
if (!status) return null;
|
|
938
920
|
return {
|
|
939
921
|
status,
|
|
940
|
-
...nullableStringProp(
|
|
941
|
-
...nullableStringProp(
|
|
942
|
-
...nullableStringProp(
|
|
943
|
-
...nullableStringProp(
|
|
944
|
-
...nullableStringProp(
|
|
945
|
-
...nullableStringProp(
|
|
946
|
-
...nullableStringProp(
|
|
947
|
-
...nullableStringProp(
|
|
948
|
-
...nullableStringProp(
|
|
949
|
-
...nullableStringProp(
|
|
950
|
-
...nullableStringProp(
|
|
922
|
+
...nullableStringProp(input, "agentId"),
|
|
923
|
+
...nullableStringProp(input, "snapshotId"),
|
|
924
|
+
...nullableStringProp(input, "sourceRef"),
|
|
925
|
+
...nullableStringProp(input, "sourceCommitSha"),
|
|
926
|
+
...nullableStringProp(input, "manifestHash"),
|
|
927
|
+
...nullableStringProp(input, "manifestPath"),
|
|
928
|
+
...nullableStringProp(input, "buildStatus"),
|
|
929
|
+
...nullableStringProp(input, "validationStatus"),
|
|
930
|
+
...nullableStringProp(input, "evalStatus"),
|
|
931
|
+
...nullableStringProp(input, "publishedAt"),
|
|
932
|
+
...nullableStringProp(input, "error")
|
|
951
933
|
};
|
|
952
934
|
}
|
|
953
935
|
function sanitizeHostedRunSummary(value) {
|
|
954
936
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
955
|
-
const
|
|
956
|
-
const status = stringField(
|
|
937
|
+
const input = value;
|
|
938
|
+
const status = stringField(input.status);
|
|
957
939
|
if (!status) return null;
|
|
958
940
|
return {
|
|
959
941
|
status,
|
|
960
|
-
...nullableStringProp(
|
|
961
|
-
...nullableStringProp(
|
|
962
|
-
...nullableStringProp(
|
|
963
|
-
...nullableStringProp(
|
|
964
|
-
...nullableStringProp(
|
|
965
|
-
...nullableStringProp(
|
|
966
|
-
...nullableStringProp(
|
|
967
|
-
...nullableStringProp(
|
|
968
|
-
...stringArrayProp(
|
|
969
|
-
...stringArrayProp(
|
|
970
|
-
...stringArrayProp(
|
|
971
|
-
...stringArrayProp(
|
|
972
|
-
...nullableStringProp(
|
|
973
|
-
...nullableStringProp(
|
|
974
|
-
...nullableStringProp(
|
|
942
|
+
...nullableStringProp(input, "agentId"),
|
|
943
|
+
...nullableStringProp(input, "runId"),
|
|
944
|
+
...nullableStringProp(input, "runtimeId"),
|
|
945
|
+
...nullableStringProp(input, "sandboxId"),
|
|
946
|
+
...nullableStringProp(input, "sourceRef"),
|
|
947
|
+
...nullableStringProp(input, "sourceCommitSha"),
|
|
948
|
+
...nullableStringProp(input, "manifestHash"),
|
|
949
|
+
...nullableStringProp(input, "setupGateStatus"),
|
|
950
|
+
...stringArrayProp(input, "setupRequirementRefs"),
|
|
951
|
+
...stringArrayProp(input, "artifactRefs"),
|
|
952
|
+
...stringArrayProp(input, "traceArtifactRefs"),
|
|
953
|
+
...stringArrayProp(input, "evalArtifactRefs"),
|
|
954
|
+
...nullableStringProp(input, "startedAt"),
|
|
955
|
+
...nullableStringProp(input, "completedAt"),
|
|
956
|
+
...nullableStringProp(input, "error")
|
|
975
957
|
};
|
|
976
958
|
}
|
|
977
|
-
function nullableStringProp(
|
|
978
|
-
const value =
|
|
959
|
+
function nullableStringProp(input, key) {
|
|
960
|
+
const value = input[key];
|
|
979
961
|
return typeof value === "string" || value === null ? { [key]: value } : {};
|
|
980
962
|
}
|
|
981
|
-
function nullableBooleanProp(
|
|
982
|
-
const value =
|
|
963
|
+
function nullableBooleanProp(input, key) {
|
|
964
|
+
const value = input[key];
|
|
983
965
|
return typeof value === "boolean" || value === null ? { [key]: value } : {};
|
|
984
966
|
}
|
|
985
|
-
function nullableNumberProp(
|
|
986
|
-
const value =
|
|
967
|
+
function nullableNumberProp(input, key) {
|
|
968
|
+
const value = input[key];
|
|
987
969
|
return typeof value === "number" || value === null ? { [key]: value } : {};
|
|
988
970
|
}
|
|
989
|
-
function stringArrayProp(
|
|
990
|
-
const value =
|
|
971
|
+
function stringArrayProp(input, key) {
|
|
972
|
+
const value = input[key];
|
|
991
973
|
if (!Array.isArray(value)) return {};
|
|
992
974
|
const strings = value.filter((item) => typeof item === "string");
|
|
993
975
|
return { [key]: strings };
|
|
@@ -1024,33 +1006,33 @@ function sanitizeSession(value) {
|
|
|
1024
1006
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1025
1007
|
return void 0;
|
|
1026
1008
|
}
|
|
1027
|
-
const
|
|
1009
|
+
const input = value;
|
|
1028
1010
|
const out = {};
|
|
1029
|
-
if (typeof
|
|
1030
|
-
if (typeof
|
|
1031
|
-
out.appId =
|
|
1011
|
+
if (typeof input.token === "string") out.token = input.token;
|
|
1012
|
+
if (typeof input.appId === "string" || input.appId === null) {
|
|
1013
|
+
out.appId = input.appId;
|
|
1032
1014
|
}
|
|
1033
|
-
if (typeof
|
|
1034
|
-
out.conversationId =
|
|
1015
|
+
if (typeof input.conversationId === "string" || input.conversationId === null) {
|
|
1016
|
+
out.conversationId = input.conversationId;
|
|
1035
1017
|
}
|
|
1036
1018
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
1037
1019
|
}
|
|
1038
1020
|
function sanitizeAccount(value) {
|
|
1039
1021
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1040
|
-
const
|
|
1022
|
+
const input = value;
|
|
1041
1023
|
const handle = normalizeHandle(
|
|
1042
|
-
typeof
|
|
1024
|
+
typeof input.handle === "string" ? input.handle : void 0
|
|
1043
1025
|
);
|
|
1044
1026
|
if (!handle) return null;
|
|
1045
1027
|
const out = { handle };
|
|
1046
|
-
if (typeof
|
|
1047
|
-
if (typeof
|
|
1048
|
-
if (typeof
|
|
1049
|
-
if (typeof
|
|
1050
|
-
out.chatApiBaseUrl =
|
|
1051
|
-
if (typeof
|
|
1052
|
-
out.environment =
|
|
1053
|
-
const session = sanitizeSession(
|
|
1028
|
+
if (typeof input.apiKey === "string") out.apiKey = input.apiKey;
|
|
1029
|
+
if (typeof input.baseUrl === "string") out.baseUrl = input.baseUrl;
|
|
1030
|
+
if (typeof input.apiBaseUrl === "string") out.apiBaseUrl = input.apiBaseUrl;
|
|
1031
|
+
if (typeof input.chatApiBaseUrl === "string")
|
|
1032
|
+
out.chatApiBaseUrl = input.chatApiBaseUrl;
|
|
1033
|
+
if (typeof input.environment === "string")
|
|
1034
|
+
out.environment = input.environment;
|
|
1035
|
+
const session = sanitizeSession(input.session);
|
|
1054
1036
|
if (session) out.session = session;
|
|
1055
1037
|
return out;
|
|
1056
1038
|
}
|
|
@@ -1374,12 +1356,12 @@ async function setActiveProfile(handle, options = {}) {
|
|
|
1374
1356
|
const profiles = await listConfiguredProfiles();
|
|
1375
1357
|
return profiles.find((profile) => profile.isActive) ?? profiles[selectedIndex];
|
|
1376
1358
|
}
|
|
1377
|
-
async function saveProfileApiKey(
|
|
1378
|
-
const handle = requireHandle(
|
|
1379
|
-
const apiKey = requireApiKey(
|
|
1380
|
-
const baseUrl = normalizeBaseUrl(
|
|
1381
|
-
const apiBaseUrl = normalizeBaseUrl(
|
|
1382
|
-
const chatApiBaseUrl = normalizeBaseUrl(
|
|
1359
|
+
async function saveProfileApiKey(input) {
|
|
1360
|
+
const handle = requireHandle(input.handle);
|
|
1361
|
+
const apiKey = requireApiKey(input.apiKey);
|
|
1362
|
+
const baseUrl = normalizeBaseUrl(input.baseUrl);
|
|
1363
|
+
const apiBaseUrl = normalizeBaseUrl(input.apiBaseUrl);
|
|
1364
|
+
const chatApiBaseUrl = normalizeBaseUrl(input.chatApiBaseUrl);
|
|
1383
1365
|
let savedSelector = { handle };
|
|
1384
1366
|
await updateGlobalConfig((global) => {
|
|
1385
1367
|
const accounts = global.accounts ?? [];
|
|
@@ -1387,16 +1369,16 @@ async function saveProfileApiKey(input3) {
|
|
|
1387
1369
|
account.apiKey = apiKey;
|
|
1388
1370
|
if (baseUrl) account.baseUrl = baseUrl;
|
|
1389
1371
|
if (apiBaseUrl) account.apiBaseUrl = apiBaseUrl;
|
|
1390
|
-
else if (
|
|
1372
|
+
else if (input.apiBaseUrl === null) delete account.apiBaseUrl;
|
|
1391
1373
|
if (chatApiBaseUrl) account.chatApiBaseUrl = chatApiBaseUrl;
|
|
1392
|
-
else if (
|
|
1393
|
-
if (
|
|
1394
|
-
else if (typeof
|
|
1395
|
-
account.environment =
|
|
1374
|
+
else if (input.chatApiBaseUrl === null) delete account.chatApiBaseUrl;
|
|
1375
|
+
if (input.environment === null) delete account.environment;
|
|
1376
|
+
else if (typeof input.environment === "string" && input.environment.trim()) {
|
|
1377
|
+
account.environment = input.environment.trim();
|
|
1396
1378
|
}
|
|
1397
1379
|
global.accounts = accounts;
|
|
1398
1380
|
savedSelector = selectorFromAccount(account);
|
|
1399
|
-
if (
|
|
1381
|
+
if (input.setActive !== false) global.activeProfile = savedSelector;
|
|
1400
1382
|
});
|
|
1401
1383
|
const profiles = await listConfiguredProfiles();
|
|
1402
1384
|
const saved = profiles.find((profile) => {
|
|
@@ -1416,102 +1398,6 @@ async function saveGlobalConfig(next) {
|
|
|
1416
1398
|
});
|
|
1417
1399
|
}
|
|
1418
1400
|
|
|
1419
|
-
// src/cli/common/auth.ts
|
|
1420
|
-
import { stdin as input, stdout as output } from "node:process";
|
|
1421
|
-
import { createInterface } from "node:readline/promises";
|
|
1422
|
-
var UI_API_KEY_URL = `${DEFAULT_OPENPOND_WEB_BASE_URL}/settings/api-keys`;
|
|
1423
|
-
function resolveApiKey(config) {
|
|
1424
|
-
const envKey = process.env.OPENPOND_API_KEY?.trim();
|
|
1425
|
-
if (envKey) return envKey;
|
|
1426
|
-
const stored = config.apiKey?.trim();
|
|
1427
|
-
if (stored) return stored;
|
|
1428
|
-
const legacy = config.token?.trim();
|
|
1429
|
-
if (legacy && legacy.startsWith("opk_")) return legacy;
|
|
1430
|
-
return null;
|
|
1431
|
-
}
|
|
1432
|
-
async function promptForApiKey() {
|
|
1433
|
-
if (!input.isTTY || !output.isTTY) {
|
|
1434
|
-
throw new Error(
|
|
1435
|
-
"OpenPond API key is required in non-interactive mode. Set OPENPOND_API_KEY or run `openpond login` in a terminal."
|
|
1436
|
-
);
|
|
1437
|
-
}
|
|
1438
|
-
console.log("Open the OpenPond UI to create an API key:");
|
|
1439
|
-
console.log(UI_API_KEY_URL);
|
|
1440
|
-
const rl = createInterface({ input, output });
|
|
1441
|
-
try {
|
|
1442
|
-
const value = (await rl.question("Paste your OpenPond API key: ")).trim();
|
|
1443
|
-
if (!value) {
|
|
1444
|
-
throw new Error("API key is required");
|
|
1445
|
-
}
|
|
1446
|
-
if (!value.startsWith("opk_")) {
|
|
1447
|
-
console.log("warning: API keys usually start with opk_.");
|
|
1448
|
-
}
|
|
1449
|
-
return value;
|
|
1450
|
-
} finally {
|
|
1451
|
-
rl.close();
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
async function ensureApiKey(config, baseUrl) {
|
|
1455
|
-
const existing = resolveApiKey(config);
|
|
1456
|
-
if (existing) return existing;
|
|
1457
|
-
const apiKey = await promptForApiKey();
|
|
1458
|
-
await saveGlobalConfig({
|
|
1459
|
-
apiKey,
|
|
1460
|
-
baseUrl,
|
|
1461
|
-
activeProfile: config.activeProfile
|
|
1462
|
-
});
|
|
1463
|
-
console.log("saved api key to ~/.openpond/config.json");
|
|
1464
|
-
return apiKey;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
// src/cli/common/repo-format.ts
|
|
1468
|
-
function resolveRepoUrl(response) {
|
|
1469
|
-
if (response.repoUrl) return response.repoUrl;
|
|
1470
|
-
if (response.gitHost && response.gitOwner && response.gitRepo) {
|
|
1471
|
-
return `https://${response.gitHost}/${response.gitOwner}/${response.gitRepo}.git`;
|
|
1472
|
-
}
|
|
1473
|
-
throw new Error("repoUrl missing from API response");
|
|
1474
|
-
}
|
|
1475
|
-
function formatTokenizedRepoUrl(repoUrl, token) {
|
|
1476
|
-
const url = new URL(repoUrl);
|
|
1477
|
-
const encodedToken = encodeURIComponent(token);
|
|
1478
|
-
return `${url.protocol}//x-access-token:${encodedToken}@${url.host}${url.pathname}`;
|
|
1479
|
-
}
|
|
1480
|
-
function formatTokenizedRepoUrlForPrint(repoUrl) {
|
|
1481
|
-
const url = new URL(repoUrl);
|
|
1482
|
-
return `${url.protocol}//x-access-token:$OPENPOND_API_KEY@${url.host}${url.pathname}`;
|
|
1483
|
-
}
|
|
1484
|
-
function redactToken(value) {
|
|
1485
|
-
return value.replace(/x-access-token:[^@]+@/g, "x-access-token:***@");
|
|
1486
|
-
}
|
|
1487
|
-
function warnOnRepoHostMismatch(repoUrl) {
|
|
1488
|
-
const envBase = process.env.OPENPOND_BASE_URL;
|
|
1489
|
-
if (!envBase) return;
|
|
1490
|
-
try {
|
|
1491
|
-
const baseHost = new URL(envBase).hostname;
|
|
1492
|
-
const repoHost = new URL(repoUrl).hostname;
|
|
1493
|
-
if (baseHost && repoHost && baseHost !== repoHost) {
|
|
1494
|
-
console.warn(
|
|
1495
|
-
`warning: repo host (${repoHost}) does not match OPENPOND_BASE_URL (${baseHost})`
|
|
1496
|
-
);
|
|
1497
|
-
console.warn(
|
|
1498
|
-
"warning: verify your git host configuration matches OPENPOND_BASE_URL."
|
|
1499
|
-
);
|
|
1500
|
-
}
|
|
1501
|
-
} catch {
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
function parseHandleRepo(value) {
|
|
1505
|
-
const parts = value.split("/").filter(Boolean);
|
|
1506
|
-
if (parts.length !== 2) {
|
|
1507
|
-
throw new Error("expected <handle>/<repo>");
|
|
1508
|
-
}
|
|
1509
|
-
return { handle: parts[0], repo: parts[1] };
|
|
1510
|
-
}
|
|
1511
|
-
function normalizeRepoName(value) {
|
|
1512
|
-
return (value || "").trim().toLowerCase();
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
1401
|
// ../../packages/cloud/src/cache.ts
|
|
1516
1402
|
import { promises as fs3 } from "node:fs";
|
|
1517
1403
|
import { createHash } from "node:crypto";
|
|
@@ -1602,260 +1488,128 @@ async function mutateCache(mutate) {
|
|
|
1602
1488
|
});
|
|
1603
1489
|
}
|
|
1604
1490
|
|
|
1605
|
-
// src/
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
apiKey: params.apiKey,
|
|
1611
|
-
ttlMs: DEFAULT_CACHE_TTL_MS
|
|
1612
|
-
});
|
|
1613
|
-
if (cached) {
|
|
1614
|
-
return cached;
|
|
1615
|
-
}
|
|
1491
|
+
// ../../packages/cloud/src/sandbox/url.ts
|
|
1492
|
+
function normalizeSandboxApiUrl(baseUrlOrApiUrl) {
|
|
1493
|
+
const trimmed = baseUrlOrApiUrl.trim().replace(/\/$/, "");
|
|
1494
|
+
if (!trimmed) {
|
|
1495
|
+
throw new Error("sandbox API URL must be non-empty");
|
|
1616
1496
|
}
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
apps
|
|
1622
|
-
});
|
|
1623
|
-
return apps;
|
|
1624
|
-
}
|
|
1625
|
-
async function fetchToolsWithCache(params) {
|
|
1626
|
-
if (!params.forceRefresh) {
|
|
1627
|
-
const cached = await getCachedTools({
|
|
1628
|
-
apiBase: params.apiBase,
|
|
1629
|
-
apiKey: params.apiKey,
|
|
1630
|
-
ttlMs: DEFAULT_CACHE_TTL_MS
|
|
1631
|
-
});
|
|
1632
|
-
if (cached) {
|
|
1633
|
-
return cached;
|
|
1634
|
-
}
|
|
1497
|
+
const url = new URL(trimmed);
|
|
1498
|
+
const normalizedPath = url.pathname.replace(/\/$/, "");
|
|
1499
|
+
if (normalizedPath.endsWith("/v1/sandboxes") || normalizedPath.endsWith("/api/sandboxes")) {
|
|
1500
|
+
return `${url.origin}${normalizedPath}`;
|
|
1635
1501
|
}
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
await setCachedTools({
|
|
1639
|
-
apiBase: params.apiBase,
|
|
1640
|
-
apiKey: params.apiKey,
|
|
1641
|
-
tools
|
|
1642
|
-
});
|
|
1643
|
-
return tools;
|
|
1644
|
-
}
|
|
1645
|
-
async function resolveAppTarget(apiBase, apiKey, target) {
|
|
1646
|
-
const { handle, repo } = parseHandleRepo(target);
|
|
1647
|
-
const apps = await fetchAppsWithCache({ apiBase, apiKey });
|
|
1648
|
-
const normalizedRepo = normalizeRepoName(repo);
|
|
1649
|
-
const match = apps.find((app) => {
|
|
1650
|
-
if (app.handle && app.handle !== handle) {
|
|
1651
|
-
return false;
|
|
1652
|
-
}
|
|
1653
|
-
const candidates = [app.repo, app.gitRepo, app.id].map(normalizeRepoName);
|
|
1654
|
-
return candidates.includes(normalizedRepo);
|
|
1655
|
-
});
|
|
1656
|
-
if (!match) {
|
|
1657
|
-
throw new Error(`app not found for ${handle}/${repo}`);
|
|
1502
|
+
if (normalizedPath.endsWith("/v1")) {
|
|
1503
|
+
return `${url.origin}${normalizedPath}/sandboxes`;
|
|
1658
1504
|
}
|
|
1659
|
-
|
|
1660
|
-
}
|
|
1661
|
-
async function pollDeploymentLogs(params) {
|
|
1662
|
-
const intervalMs = params.intervalMs ?? 5e3;
|
|
1663
|
-
const timeoutMs = params.timeoutMs ?? 4 * 60 * 1e3;
|
|
1664
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1665
|
-
const startedAt = Date.now();
|
|
1666
|
-
while (Date.now() - startedAt < timeoutMs) {
|
|
1667
|
-
const logs = await getDeploymentLogs(
|
|
1668
|
-
params.baseUrl,
|
|
1669
|
-
params.apiKey,
|
|
1670
|
-
params.deploymentId
|
|
1671
|
-
);
|
|
1672
|
-
const newLogs = logs.filter((log) => !seen.has(log.id));
|
|
1673
|
-
for (const log of newLogs) {
|
|
1674
|
-
seen.add(log.id);
|
|
1675
|
-
}
|
|
1676
|
-
for (const log of newLogs) {
|
|
1677
|
-
console.log(`${params.prefix}${log.message}`);
|
|
1678
|
-
}
|
|
1679
|
-
const status = await getDeploymentStatus(
|
|
1680
|
-
params.baseUrl,
|
|
1681
|
-
params.apiKey,
|
|
1682
|
-
params.deploymentId
|
|
1683
|
-
);
|
|
1684
|
-
if (status.status === "failed") {
|
|
1685
|
-
console.log(`${params.prefix}deployment failed`);
|
|
1686
|
-
return;
|
|
1687
|
-
}
|
|
1688
|
-
if (status.status === "running" || status.status === "deployed") {
|
|
1689
|
-
console.log(`${params.prefix}deployment complete`);
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
1505
|
+
if (isOpenPondHostedApiHost(url.hostname)) {
|
|
1506
|
+
return `${url.origin}${normalizedPath}/v1/sandboxes`;
|
|
1693
1507
|
}
|
|
1694
|
-
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
// src/cli/common/prompts.ts
|
|
1698
|
-
import { stdin as input2, stdout as output2 } from "node:process";
|
|
1699
|
-
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
1700
|
-
async function readAllStdin() {
|
|
1701
|
-
const chunks = [];
|
|
1702
|
-
for await (const chunk of process.stdin) {
|
|
1703
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
|
|
1704
|
-
}
|
|
1705
|
-
return Buffer.concat(chunks).toString("utf8").replace(/\r?\n$/, "");
|
|
1706
|
-
}
|
|
1707
|
-
function readMaskedLine(prompt) {
|
|
1708
|
-
return new Promise((resolve, reject) => {
|
|
1709
|
-
const stdin = process.stdin;
|
|
1710
|
-
const stderr = process.stderr;
|
|
1711
|
-
let value = "";
|
|
1712
|
-
const wasRaw = stdin.isRaw;
|
|
1713
|
-
function cleanup() {
|
|
1714
|
-
stdin.off("data", onData);
|
|
1715
|
-
if (stdin.setRawMode) stdin.setRawMode(wasRaw);
|
|
1716
|
-
stdin.pause();
|
|
1717
|
-
stderr.write("\n");
|
|
1718
|
-
}
|
|
1719
|
-
function onData(chunk) {
|
|
1720
|
-
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
1721
|
-
for (const byte of buffer) {
|
|
1722
|
-
if (byte === 3) {
|
|
1723
|
-
cleanup();
|
|
1724
|
-
reject(new Error("secret prompt cancelled"));
|
|
1725
|
-
return;
|
|
1726
|
-
}
|
|
1727
|
-
if (byte === 13 || byte === 10) {
|
|
1728
|
-
cleanup();
|
|
1729
|
-
resolve(value);
|
|
1730
|
-
return;
|
|
1731
|
-
}
|
|
1732
|
-
if (byte === 127 || byte === 8) {
|
|
1733
|
-
if (value.length > 0) {
|
|
1734
|
-
value = value.slice(0, -1);
|
|
1735
|
-
stderr.write("\b \b");
|
|
1736
|
-
}
|
|
1737
|
-
continue;
|
|
1738
|
-
}
|
|
1739
|
-
value += Buffer.from([byte]).toString("utf8");
|
|
1740
|
-
stderr.write("*");
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
stderr.write(prompt);
|
|
1744
|
-
stdin.resume();
|
|
1745
|
-
if (stdin.setRawMode) stdin.setRawMode(true);
|
|
1746
|
-
stdin.on("data", onData);
|
|
1747
|
-
});
|
|
1748
|
-
}
|
|
1749
|
-
async function promptConfirm(question, defaultValue = false) {
|
|
1750
|
-
const rl = createInterface2({ input: input2, output: output2 });
|
|
1751
|
-
try {
|
|
1752
|
-
const suffix = defaultValue ? "[Y/n]" : "[y/N]";
|
|
1753
|
-
const answer = (await rl.question(`${question} ${suffix} `)).trim().toLowerCase();
|
|
1754
|
-
if (!answer) return defaultValue;
|
|
1755
|
-
return answer === "y" || answer === "yes";
|
|
1756
|
-
} finally {
|
|
1757
|
-
rl.close();
|
|
1508
|
+
if (url.origin === DEFAULT_OPENPOND_WEB_BASE_URL) {
|
|
1509
|
+
return `${DEFAULT_OPENPOND_API_BASE_URL}/v1/sandboxes`;
|
|
1758
1510
|
}
|
|
1511
|
+
return `${url.origin}${normalizedPath}/api/sandboxes`;
|
|
1759
1512
|
}
|
|
1760
|
-
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
return answer || defaultPath;
|
|
1765
|
-
} finally {
|
|
1766
|
-
rl.close();
|
|
1513
|
+
function apiRootUrlFromSandboxApiUrl(sandboxApiUrl) {
|
|
1514
|
+
const suffix = "/sandboxes";
|
|
1515
|
+
if (!sandboxApiUrl.endsWith(suffix)) {
|
|
1516
|
+
throw new Error("sandbox API URL must end with /sandboxes");
|
|
1767
1517
|
}
|
|
1518
|
+
return sandboxApiUrl.slice(0, -suffix.length);
|
|
1519
|
+
}
|
|
1520
|
+
function isOpenPondHostedApiHost(hostname) {
|
|
1521
|
+
return hostname === "api.openpond.ai" || hostname.startsWith("api") && hostname.endsWith(".openpond.ai");
|
|
1768
1522
|
}
|
|
1769
1523
|
|
|
1770
1524
|
// ../../packages/cloud/src/sandbox/client-handles.ts
|
|
1771
1525
|
function createSandboxRuntimeNamespace(client) {
|
|
1772
1526
|
return {
|
|
1773
|
-
list: (
|
|
1774
|
-
create: (
|
|
1527
|
+
list: (input = {}) => client.listSandboxRuntimes(input),
|
|
1528
|
+
create: (input) => client.createSandboxRuntime(input),
|
|
1775
1529
|
handle: (runtimeId, initial = null) => client.sandboxRuntime(runtimeId, initial),
|
|
1776
1530
|
get: (runtimeId) => client.getSandboxRuntime(runtimeId),
|
|
1777
|
-
createSandbox: (runtimeId,
|
|
1778
|
-
updateStatus: (runtimeId,
|
|
1531
|
+
createSandbox: (runtimeId, input = {}, options = {}) => client.createSandboxRuntimeSandbox(runtimeId, input, options),
|
|
1532
|
+
updateStatus: (runtimeId, input) => client.updateSandboxRuntimeStatus(runtimeId, input),
|
|
1779
1533
|
events: (runtimeId) => client.listSandboxRuntimeEvents(runtimeId),
|
|
1780
|
-
event: (runtimeId,
|
|
1781
|
-
checkpoint: (runtimeId,
|
|
1782
|
-
promote: (runtimeId,
|
|
1783
|
-
preserveSource: (runtimeId,
|
|
1534
|
+
event: (runtimeId, input) => client.emitSandboxRuntimeEvent(runtimeId, input),
|
|
1535
|
+
checkpoint: (runtimeId, input = {}) => client.checkpointSandboxRuntime(runtimeId, input),
|
|
1536
|
+
promote: (runtimeId, input, options = {}) => client.promoteSandboxRuntime(runtimeId, input, options),
|
|
1537
|
+
preserveSource: (runtimeId, input = {}, options = {}) => client.preserveSandboxRuntimeSource(runtimeId, input, options)
|
|
1784
1538
|
};
|
|
1785
1539
|
}
|
|
1786
1540
|
function createSandboxNamespace(client) {
|
|
1787
1541
|
return {
|
|
1788
|
-
list: (
|
|
1789
|
-
create: (
|
|
1542
|
+
list: (input = {}) => client.list(input),
|
|
1543
|
+
create: (input) => client.create(input),
|
|
1790
1544
|
get: (sandboxId) => client.get(sandboxId),
|
|
1791
1545
|
pricing: () => client.pricing(),
|
|
1792
|
-
costs: (
|
|
1546
|
+
costs: (input = {}) => client.costs(input)
|
|
1793
1547
|
};
|
|
1794
1548
|
}
|
|
1795
1549
|
function createSandboxProjectNamespace(client) {
|
|
1796
1550
|
return {
|
|
1797
|
-
list: (
|
|
1798
|
-
upsert: (
|
|
1799
|
-
upsertGitRemote: (
|
|
1800
|
-
get: (projectId,
|
|
1801
|
-
update: (projectId,
|
|
1802
|
-
sync: (projectId,
|
|
1803
|
-
ensureGitRemote: (projectId,
|
|
1804
|
-
getGitRemote: (projectId,
|
|
1805
|
-
git: (projectId,
|
|
1806
|
-
uploadSource: (projectId,
|
|
1807
|
-
archive: (projectId,
|
|
1551
|
+
list: (input) => client.listProjects(input),
|
|
1552
|
+
upsert: (input) => client.upsertProject(input),
|
|
1553
|
+
upsertGitRemote: (input) => client.upsertProjectGitRemote(input),
|
|
1554
|
+
get: (projectId, input) => client.getProject(projectId, input),
|
|
1555
|
+
update: (projectId, input) => client.updateProject(projectId, input),
|
|
1556
|
+
sync: (projectId, input) => client.syncProject(projectId, input),
|
|
1557
|
+
ensureGitRemote: (projectId, input) => client.ensureProjectGitRemote(projectId, input),
|
|
1558
|
+
getGitRemote: (projectId, input) => client.ensureProjectGitRemote(projectId, input),
|
|
1559
|
+
git: (projectId, input) => client.ensureProjectGitRemote(projectId, input),
|
|
1560
|
+
uploadSource: (projectId, input) => client.uploadProjectSource(projectId, input),
|
|
1561
|
+
archive: (projectId, input) => client.archiveProject(projectId, input)
|
|
1808
1562
|
};
|
|
1809
1563
|
}
|
|
1810
1564
|
function createSandboxProfileNamespace(client) {
|
|
1811
1565
|
return {
|
|
1812
|
-
get: (
|
|
1813
|
-
status: (
|
|
1814
|
-
ensureHosted: (
|
|
1815
|
-
push: (
|
|
1566
|
+
get: (input) => client.getHostedProfile(input),
|
|
1567
|
+
status: (input) => client.getHostedProfile(input),
|
|
1568
|
+
ensureHosted: (input) => client.ensureHostedProfile(input),
|
|
1569
|
+
push: (input) => client.pushHostedProfile(input)
|
|
1816
1570
|
};
|
|
1817
1571
|
}
|
|
1818
1572
|
function createSandboxAgentNamespace(client) {
|
|
1819
1573
|
return {
|
|
1820
|
-
list: (
|
|
1821
|
-
upsert: (
|
|
1822
|
-
get: (agentId,
|
|
1823
|
-
update: (agentId,
|
|
1824
|
-
archive: (agentId,
|
|
1825
|
-
run: (agentId,
|
|
1826
|
-
sourceDeployPlan: (agentId,
|
|
1827
|
-
manifestSnapshots: (agentId,
|
|
1828
|
-
requestSourceChecks: (agentId,
|
|
1829
|
-
publishSource: (agentId,
|
|
1830
|
-
openEditWorkItem: (agentId,
|
|
1574
|
+
list: (input) => client.listAgents(input),
|
|
1575
|
+
upsert: (input) => client.upsertAgent(input),
|
|
1576
|
+
get: (agentId, input) => client.getAgent(agentId, input),
|
|
1577
|
+
update: (agentId, input) => client.updateAgent(agentId, input),
|
|
1578
|
+
archive: (agentId, input) => client.archiveAgent(agentId, input),
|
|
1579
|
+
run: (agentId, input) => client.runAgent(agentId, input),
|
|
1580
|
+
sourceDeployPlan: (agentId, input) => client.getAgentSourceDeployPlan(agentId, input),
|
|
1581
|
+
manifestSnapshots: (agentId, input) => client.listAgentManifestSnapshots(agentId, input),
|
|
1582
|
+
requestSourceChecks: (agentId, input) => client.requestAgentSourceChecks(agentId, input),
|
|
1583
|
+
publishSource: (agentId, input) => client.publishAgentSource(agentId, input),
|
|
1584
|
+
openEditWorkItem: (agentId, input) => client.openAgentEditWorkItem(agentId, input)
|
|
1831
1585
|
};
|
|
1832
1586
|
}
|
|
1833
1587
|
function createSandboxWorkItemNamespace(client) {
|
|
1834
1588
|
return {
|
|
1835
|
-
get: (workItemId,
|
|
1836
|
-
chat: (workItemId,
|
|
1837
|
-
activity: (workItemId,
|
|
1838
|
-
status: (workItemId,
|
|
1839
|
-
handleBackground: (workItemId,
|
|
1840
|
-
promoteCheckpoint: (workItemId,
|
|
1841
|
-
promoteCommit: (workItemId,
|
|
1842
|
-
promotePullRequest: (workItemId,
|
|
1589
|
+
get: (workItemId, input) => client.getCodingWorkItem(workItemId, input),
|
|
1590
|
+
chat: (workItemId, input) => client.sendCodingWorkItemChat(workItemId, input),
|
|
1591
|
+
activity: (workItemId, input) => client.listCodingWorkItemActivity(workItemId, input),
|
|
1592
|
+
status: (workItemId, input) => client.getCodingWorkItemStatus(workItemId, input),
|
|
1593
|
+
handleBackground: (workItemId, input) => client.handleCodingWorkItemInBackground(workItemId, input),
|
|
1594
|
+
promoteCheckpoint: (workItemId, input) => client.promoteCodingWorkItemResult(workItemId, "checkpoint", input),
|
|
1595
|
+
promoteCommit: (workItemId, input) => client.promoteCodingWorkItemResult(workItemId, "commit", input),
|
|
1596
|
+
promotePullRequest: (workItemId, input) => client.promoteCodingWorkItemResult(workItemId, "pr", input)
|
|
1843
1597
|
};
|
|
1844
1598
|
}
|
|
1845
1599
|
|
|
1846
1600
|
// ../../packages/cloud/src/sandbox/runtime-handle.ts
|
|
1847
1601
|
function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
|
|
1848
|
-
const currentSandbox = async (
|
|
1602
|
+
const currentSandbox = async (input = {}, options = {}) => {
|
|
1849
1603
|
const runtime = await client.getSandboxRuntime(runtimeId);
|
|
1850
1604
|
if (runtime.sandboxId) {
|
|
1851
1605
|
return client.get(runtime.sandboxId);
|
|
1852
1606
|
}
|
|
1853
|
-
return client.createSandboxRuntimeSandbox(runtimeId,
|
|
1607
|
+
return client.createSandboxRuntimeSandbox(runtimeId, input, options).then((payload) => payload.sandbox);
|
|
1854
1608
|
};
|
|
1855
|
-
const resume = async (
|
|
1609
|
+
const resume = async (input = {}, options = {}) => {
|
|
1856
1610
|
const runtime = await client.getSandboxRuntime(runtimeId);
|
|
1857
1611
|
if (!runtime.sandboxId) {
|
|
1858
|
-
return client.createSandboxRuntimeSandbox(runtimeId,
|
|
1612
|
+
return client.createSandboxRuntimeSandbox(runtimeId, input, options).then((payload) => payload.sandbox);
|
|
1859
1613
|
}
|
|
1860
1614
|
const sandbox = await client.get(runtime.sandboxId);
|
|
1861
1615
|
if (sandbox.state === "stopped") {
|
|
@@ -1865,34 +1619,34 @@ function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
|
|
|
1865
1619
|
return client.restore(sandbox.id).then((payload) => payload.sandbox);
|
|
1866
1620
|
}
|
|
1867
1621
|
if (sandbox.state === "deleted" || sandbox.state === "error") {
|
|
1868
|
-
return client.createSandboxRuntimeSandbox(runtimeId,
|
|
1622
|
+
return client.createSandboxRuntimeSandbox(runtimeId, input, options).then((payload) => payload.sandbox);
|
|
1869
1623
|
}
|
|
1870
1624
|
return sandbox;
|
|
1871
1625
|
};
|
|
1872
|
-
const checkpointHint = (
|
|
1626
|
+
const checkpointHint = (input = {}) => client.emitSandboxRuntimeEvent(runtimeId, {
|
|
1873
1627
|
type: "workflow.checkpoint_hint",
|
|
1874
|
-
summary:
|
|
1628
|
+
summary: input.summary ?? input.reason ?? "Workflow checkpoint hint",
|
|
1875
1629
|
payload: {
|
|
1876
|
-
...
|
|
1877
|
-
reason:
|
|
1630
|
+
...input.payload,
|
|
1631
|
+
reason: input.reason ?? null
|
|
1878
1632
|
},
|
|
1879
|
-
artifactRefs:
|
|
1633
|
+
artifactRefs: input.artifactRefs,
|
|
1880
1634
|
lifecycleHint: {
|
|
1881
1635
|
kind: "checkpoint",
|
|
1882
|
-
reason:
|
|
1636
|
+
reason: input.reason ?? null
|
|
1883
1637
|
}
|
|
1884
1638
|
});
|
|
1885
|
-
const waitForUser = async (
|
|
1639
|
+
const waitForUser = async (input = {}) => {
|
|
1886
1640
|
await client.emitSandboxRuntimeEvent(runtimeId, {
|
|
1887
1641
|
type: "workflow.waiting_for_user",
|
|
1888
|
-
summary:
|
|
1642
|
+
summary: input.summary ?? input.reason ?? "Waiting for user",
|
|
1889
1643
|
payload: {
|
|
1890
|
-
...
|
|
1891
|
-
reason:
|
|
1644
|
+
...input.payload,
|
|
1645
|
+
reason: input.reason ?? null
|
|
1892
1646
|
},
|
|
1893
1647
|
lifecycleHint: {
|
|
1894
1648
|
kind: "waiting_for_user",
|
|
1895
|
-
reason:
|
|
1649
|
+
reason: input.reason ?? null
|
|
1896
1650
|
}
|
|
1897
1651
|
});
|
|
1898
1652
|
const current = await client.getSandboxRuntime(runtimeId);
|
|
@@ -1900,25 +1654,25 @@ function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
|
|
|
1900
1654
|
return client.updateSandboxRuntimeStatus(runtimeId, {
|
|
1901
1655
|
status: "waiting_for_user",
|
|
1902
1656
|
expectedVersion: current.version,
|
|
1903
|
-
summary:
|
|
1657
|
+
summary: input.summary ?? input.reason,
|
|
1904
1658
|
metadata: {
|
|
1905
|
-
workflowWaitForUserReason:
|
|
1659
|
+
workflowWaitForUserReason: input.reason ?? null
|
|
1906
1660
|
}
|
|
1907
1661
|
});
|
|
1908
1662
|
};
|
|
1909
|
-
const keepAlive = (
|
|
1910
|
-
const keepaliveUntil = runtimeKeepaliveUntilIso(
|
|
1663
|
+
const keepAlive = (input = {}) => {
|
|
1664
|
+
const keepaliveUntil = runtimeKeepaliveUntilIso(input);
|
|
1911
1665
|
return client.emitSandboxRuntimeEvent(runtimeId, {
|
|
1912
1666
|
type: "workflow.keepalive",
|
|
1913
|
-
summary:
|
|
1667
|
+
summary: input.summary ?? input.reason ?? "Workflow keepalive",
|
|
1914
1668
|
payload: {
|
|
1915
|
-
...
|
|
1916
|
-
reason:
|
|
1669
|
+
...input.payload,
|
|
1670
|
+
reason: input.reason ?? null,
|
|
1917
1671
|
keepaliveUntil
|
|
1918
1672
|
},
|
|
1919
1673
|
lifecycleHint: {
|
|
1920
1674
|
kind: "keepalive",
|
|
1921
|
-
reason:
|
|
1675
|
+
reason: input.reason ?? null,
|
|
1922
1676
|
keepaliveUntil
|
|
1923
1677
|
}
|
|
1924
1678
|
});
|
|
@@ -1929,38 +1683,38 @@ function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
|
|
|
1929
1683
|
get: () => client.getSandboxRuntime(runtimeId),
|
|
1930
1684
|
sandbox: currentSandbox,
|
|
1931
1685
|
resume,
|
|
1932
|
-
createSandbox: (
|
|
1933
|
-
status: async (
|
|
1934
|
-
if (typeof
|
|
1935
|
-
return client.updateSandboxRuntimeStatus(runtimeId,
|
|
1686
|
+
createSandbox: (input = {}, options = {}) => client.createSandboxRuntimeSandbox(runtimeId, input, options),
|
|
1687
|
+
status: async (input) => {
|
|
1688
|
+
if (typeof input !== "string") {
|
|
1689
|
+
return client.updateSandboxRuntimeStatus(runtimeId, input);
|
|
1936
1690
|
}
|
|
1937
1691
|
const current = await client.getSandboxRuntime(runtimeId);
|
|
1938
1692
|
return client.updateSandboxRuntimeStatus(runtimeId, {
|
|
1939
|
-
status:
|
|
1693
|
+
status: input,
|
|
1940
1694
|
expectedVersion: current.version
|
|
1941
1695
|
});
|
|
1942
1696
|
},
|
|
1943
1697
|
events: () => client.listSandboxRuntimeEvents(runtimeId),
|
|
1944
|
-
event: (
|
|
1945
|
-
recordCommit: (commitSha,
|
|
1946
|
-
...
|
|
1947
|
-
type:
|
|
1698
|
+
event: (input) => client.emitSandboxRuntimeEvent(runtimeId, input),
|
|
1699
|
+
recordCommit: (commitSha, input = {}) => client.emitSandboxRuntimeEvent(runtimeId, {
|
|
1700
|
+
...input,
|
|
1701
|
+
type: input.type ?? "git.commit",
|
|
1948
1702
|
commitSha
|
|
1949
1703
|
}),
|
|
1950
1704
|
checkpointHint,
|
|
1951
1705
|
waitForUser,
|
|
1952
1706
|
keepAlive,
|
|
1953
|
-
checkpoint: (
|
|
1707
|
+
checkpoint: (input) => client.checkpointSandboxRuntime(runtimeId, input),
|
|
1954
1708
|
files: {
|
|
1955
1709
|
write: async (path4, contents) => client.uploadFile((await resume()).id, path4, contents),
|
|
1956
1710
|
read: async (path4) => client.downloadFile((await resume()).id, path4),
|
|
1957
|
-
readResponse: async (
|
|
1958
|
-
list: async (
|
|
1959
|
-
delete: async (path4,
|
|
1960
|
-
search: async (
|
|
1711
|
+
readResponse: async (input) => client.downloadFileResponse((await resume()).id, input),
|
|
1712
|
+
list: async (input = {}) => client.listFiles((await resume()).id, input),
|
|
1713
|
+
delete: async (path4, input = {}) => client.deleteFile((await resume()).id, path4, input),
|
|
1714
|
+
search: async (input) => client.searchFiles((await resume()).id, input),
|
|
1961
1715
|
stat: async (path4) => client.statFile((await resume()).id, path4),
|
|
1962
|
-
mkdir: async (
|
|
1963
|
-
move: async (
|
|
1716
|
+
mkdir: async (input) => client.mkdir((await resume()).id, input),
|
|
1717
|
+
move: async (input) => client.moveFile((await resume()).id, input)
|
|
1964
1718
|
},
|
|
1965
1719
|
commands: {
|
|
1966
1720
|
run: async (command) => client.exec(
|
|
@@ -1974,8 +1728,8 @@ function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
|
|
|
1974
1728
|
typeof port === "number" ? { port } : port
|
|
1975
1729
|
)
|
|
1976
1730
|
},
|
|
1977
|
-
promote: (
|
|
1978
|
-
preserveSource: (
|
|
1731
|
+
promote: (input, options = {}) => client.promoteSandboxRuntime(runtimeId, input, options),
|
|
1732
|
+
preserveSource: (input = {}, options = {}) => client.preserveSandboxRuntimeSource(runtimeId, input, options),
|
|
1979
1733
|
archive: async (expectedVersion) => {
|
|
1980
1734
|
const version = expectedVersion ?? (await client.getSandboxRuntime(runtimeId)).version;
|
|
1981
1735
|
return client.updateSandboxRuntimeStatus(runtimeId, {
|
|
@@ -1985,14 +1739,14 @@ function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
|
|
|
1985
1739
|
}
|
|
1986
1740
|
};
|
|
1987
1741
|
}
|
|
1988
|
-
function runtimeKeepaliveUntilIso(
|
|
1989
|
-
if (
|
|
1990
|
-
return
|
|
1742
|
+
function runtimeKeepaliveUntilIso(input) {
|
|
1743
|
+
if (input?.until instanceof Date) {
|
|
1744
|
+
return input.until.toISOString();
|
|
1991
1745
|
}
|
|
1992
|
-
if (typeof
|
|
1993
|
-
return new Date(
|
|
1746
|
+
if (typeof input?.until === "string" && input.until.trim()) {
|
|
1747
|
+
return new Date(input.until).toISOString();
|
|
1994
1748
|
}
|
|
1995
|
-
const seconds = typeof
|
|
1749
|
+
const seconds = typeof input?.seconds === "number" && Number.isFinite(input.seconds) ? Math.max(1, Math.trunc(input.seconds)) : 60;
|
|
1996
1750
|
return new Date(Date.now() + seconds * 1e3).toISOString();
|
|
1997
1751
|
}
|
|
1998
1752
|
|
|
@@ -2369,8 +2123,8 @@ async function streamSandboxEventOutput(params) {
|
|
|
2369
2123
|
while (separatorIndex !== -1) {
|
|
2370
2124
|
const event = buffered.slice(0, separatorIndex);
|
|
2371
2125
|
buffered = buffered.slice(separatorIndex + 2);
|
|
2372
|
-
const
|
|
2373
|
-
if (
|
|
2126
|
+
const output = parseProcessOutputEvent(event);
|
|
2127
|
+
if (output) process.stdout.write(output);
|
|
2374
2128
|
separatorIndex = buffered.indexOf("\n\n");
|
|
2375
2129
|
}
|
|
2376
2130
|
}
|
|
@@ -2378,14 +2132,14 @@ async function streamSandboxEventOutput(params) {
|
|
|
2378
2132
|
reader.releaseLock();
|
|
2379
2133
|
}
|
|
2380
2134
|
}
|
|
2381
|
-
function normalizePtyInput(
|
|
2382
|
-
if (typeof
|
|
2383
|
-
return { dataBase64: Buffer.from(
|
|
2135
|
+
function normalizePtyInput(input) {
|
|
2136
|
+
if (typeof input === "string") {
|
|
2137
|
+
return { dataBase64: Buffer.from(input, "utf-8").toString("base64") };
|
|
2384
2138
|
}
|
|
2385
|
-
if (
|
|
2386
|
-
return { dataBase64: Buffer.from(
|
|
2139
|
+
if (input instanceof Uint8Array) {
|
|
2140
|
+
return { dataBase64: Buffer.from(input).toString("base64") };
|
|
2387
2141
|
}
|
|
2388
|
-
return
|
|
2142
|
+
return input;
|
|
2389
2143
|
}
|
|
2390
2144
|
function parseProcessOutputEvent(event) {
|
|
2391
2145
|
if (!event.includes("event: output")) {
|
|
@@ -2403,39 +2157,6 @@ function parseProcessOutputEvent(event) {
|
|
|
2403
2157
|
}
|
|
2404
2158
|
}
|
|
2405
2159
|
|
|
2406
|
-
// ../../packages/cloud/src/sandbox/url.ts
|
|
2407
|
-
function normalizeSandboxApiUrl(baseUrlOrApiUrl) {
|
|
2408
|
-
const trimmed = baseUrlOrApiUrl.trim().replace(/\/$/, "");
|
|
2409
|
-
if (!trimmed) {
|
|
2410
|
-
throw new Error("sandbox API URL must be non-empty");
|
|
2411
|
-
}
|
|
2412
|
-
const url = new URL(trimmed);
|
|
2413
|
-
const normalizedPath = url.pathname.replace(/\/$/, "");
|
|
2414
|
-
if (normalizedPath.endsWith("/v1/sandboxes") || normalizedPath.endsWith("/api/sandboxes")) {
|
|
2415
|
-
return `${url.origin}${normalizedPath}`;
|
|
2416
|
-
}
|
|
2417
|
-
if (normalizedPath.endsWith("/v1")) {
|
|
2418
|
-
return `${url.origin}${normalizedPath}/sandboxes`;
|
|
2419
|
-
}
|
|
2420
|
-
if (isOpenPondHostedApiHost(url.hostname)) {
|
|
2421
|
-
return `${url.origin}${normalizedPath}/v1/sandboxes`;
|
|
2422
|
-
}
|
|
2423
|
-
if (url.origin === DEFAULT_OPENPOND_WEB_BASE_URL) {
|
|
2424
|
-
return `${DEFAULT_OPENPOND_API_BASE_URL}/v1/sandboxes`;
|
|
2425
|
-
}
|
|
2426
|
-
return `${url.origin}${normalizedPath}/api/sandboxes`;
|
|
2427
|
-
}
|
|
2428
|
-
function apiRootUrlFromSandboxApiUrl(sandboxApiUrl) {
|
|
2429
|
-
const suffix = "/sandboxes";
|
|
2430
|
-
if (!sandboxApiUrl.endsWith(suffix)) {
|
|
2431
|
-
throw new Error("sandbox API URL must end with /sandboxes");
|
|
2432
|
-
}
|
|
2433
|
-
return sandboxApiUrl.slice(0, -suffix.length);
|
|
2434
|
-
}
|
|
2435
|
-
function isOpenPondHostedApiHost(hostname) {
|
|
2436
|
-
return hostname === "api.openpond.ai" || hostname.startsWith("api") && hostname.endsWith(".openpond.ai");
|
|
2437
|
-
}
|
|
2438
|
-
|
|
2439
2160
|
// ../../packages/cloud/src/sandbox/sandbox-instance-client.ts
|
|
2440
2161
|
var OpenPondSandboxInstanceClient = class {
|
|
2441
2162
|
apiKey;
|
|
@@ -2448,11 +2169,11 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2448
2169
|
);
|
|
2449
2170
|
this.apiRootUrl = apiRootUrlFromSandboxApiUrl(this.sandboxApiUrl);
|
|
2450
2171
|
}
|
|
2451
|
-
create(
|
|
2172
|
+
create(input, options = {}) {
|
|
2452
2173
|
return this.request("", {
|
|
2453
2174
|
method: "POST",
|
|
2454
2175
|
headers: asyncRequestHeaders(options),
|
|
2455
|
-
body: JSON.stringify(
|
|
2176
|
+
body: JSON.stringify(input)
|
|
2456
2177
|
}).then((payload) => payload.sandbox);
|
|
2457
2178
|
}
|
|
2458
2179
|
get(sandboxId) {
|
|
@@ -2460,21 +2181,21 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2460
2181
|
`/${encodeURIComponent(sandboxId)}`
|
|
2461
2182
|
).then((payload) => payload.sandbox);
|
|
2462
2183
|
}
|
|
2463
|
-
exec(sandboxId,
|
|
2184
|
+
exec(sandboxId, input) {
|
|
2464
2185
|
return this.request(
|
|
2465
2186
|
`/${encodeURIComponent(sandboxId)}/exec`,
|
|
2466
2187
|
{
|
|
2467
2188
|
method: "POST",
|
|
2468
|
-
body: JSON.stringify(
|
|
2189
|
+
body: JSON.stringify(input)
|
|
2469
2190
|
}
|
|
2470
2191
|
);
|
|
2471
2192
|
}
|
|
2472
|
-
startProcess(sandboxId,
|
|
2193
|
+
startProcess(sandboxId, input) {
|
|
2473
2194
|
return this.request(
|
|
2474
2195
|
`/${encodeURIComponent(sandboxId)}/processes`,
|
|
2475
2196
|
{
|
|
2476
2197
|
method: "POST",
|
|
2477
|
-
body: JSON.stringify(
|
|
2198
|
+
body: JSON.stringify(input)
|
|
2478
2199
|
}
|
|
2479
2200
|
);
|
|
2480
2201
|
}
|
|
@@ -2483,10 +2204,10 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2483
2204
|
`/${encodeURIComponent(sandboxId)}/processes`
|
|
2484
2205
|
);
|
|
2485
2206
|
}
|
|
2486
|
-
getProcess(sandboxId, processId,
|
|
2207
|
+
getProcess(sandboxId, processId, input = {}) {
|
|
2487
2208
|
const query = new URLSearchParams();
|
|
2488
|
-
if (
|
|
2489
|
-
query.set("since", String(Math.max(0,
|
|
2209
|
+
if (input.since !== void 0)
|
|
2210
|
+
query.set("since", String(Math.max(0, input.since)));
|
|
2490
2211
|
return this.request(
|
|
2491
2212
|
`/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(
|
|
2492
2213
|
processId
|
|
@@ -2503,10 +2224,10 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2503
2224
|
}
|
|
2504
2225
|
);
|
|
2505
2226
|
}
|
|
2506
|
-
async streamProcessOutput(sandboxId, processId,
|
|
2227
|
+
async streamProcessOutput(sandboxId, processId, input = {}) {
|
|
2507
2228
|
const query = new URLSearchParams();
|
|
2508
|
-
if (
|
|
2509
|
-
query.set("since", String(Math.max(0,
|
|
2229
|
+
if (input.since !== void 0)
|
|
2230
|
+
query.set("since", String(Math.max(0, input.since)));
|
|
2510
2231
|
await streamSandboxEventOutput({
|
|
2511
2232
|
sandboxApiUrl: this.sandboxApiUrl,
|
|
2512
2233
|
apiKey: this.apiKey,
|
|
@@ -2515,12 +2236,12 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2515
2236
|
)}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
2516
2237
|
});
|
|
2517
2238
|
}
|
|
2518
|
-
startPty(sandboxId,
|
|
2239
|
+
startPty(sandboxId, input = {}) {
|
|
2519
2240
|
return this.request(
|
|
2520
2241
|
`/${encodeURIComponent(sandboxId)}/pty`,
|
|
2521
2242
|
{
|
|
2522
2243
|
method: "POST",
|
|
2523
|
-
body: JSON.stringify(
|
|
2244
|
+
body: JSON.stringify(input)
|
|
2524
2245
|
}
|
|
2525
2246
|
);
|
|
2526
2247
|
}
|
|
@@ -2529,22 +2250,22 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2529
2250
|
`/${encodeURIComponent(sandboxId)}/pty`
|
|
2530
2251
|
);
|
|
2531
2252
|
}
|
|
2532
|
-
getPty(sandboxId, ptyId,
|
|
2253
|
+
getPty(sandboxId, ptyId, input = {}) {
|
|
2533
2254
|
const query = new URLSearchParams();
|
|
2534
|
-
if (
|
|
2535
|
-
query.set("since", String(Math.max(0,
|
|
2255
|
+
if (input.since !== void 0)
|
|
2256
|
+
query.set("since", String(Math.max(0, input.since)));
|
|
2536
2257
|
return this.request(
|
|
2537
2258
|
`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
2538
2259
|
);
|
|
2539
2260
|
}
|
|
2540
|
-
writePtyInput(sandboxId, ptyId,
|
|
2261
|
+
writePtyInput(sandboxId, ptyId, input) {
|
|
2541
2262
|
return this.request(
|
|
2542
2263
|
`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(
|
|
2543
2264
|
ptyId
|
|
2544
2265
|
)}/input`,
|
|
2545
2266
|
{
|
|
2546
2267
|
method: "POST",
|
|
2547
|
-
body: JSON.stringify(normalizePtyInput(
|
|
2268
|
+
body: JSON.stringify(normalizePtyInput(input))
|
|
2548
2269
|
}
|
|
2549
2270
|
);
|
|
2550
2271
|
}
|
|
@@ -2556,10 +2277,10 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2556
2277
|
}
|
|
2557
2278
|
);
|
|
2558
2279
|
}
|
|
2559
|
-
async streamPtyOutput(sandboxId, ptyId,
|
|
2280
|
+
async streamPtyOutput(sandboxId, ptyId, input = {}) {
|
|
2560
2281
|
const query = new URLSearchParams();
|
|
2561
|
-
if (
|
|
2562
|
-
query.set("since", String(Math.max(0,
|
|
2282
|
+
if (input.since !== void 0)
|
|
2283
|
+
query.set("since", String(Math.max(0, input.since)));
|
|
2563
2284
|
await streamSandboxEventOutput({
|
|
2564
2285
|
sandboxApiUrl: this.sandboxApiUrl,
|
|
2565
2286
|
apiKey: this.apiKey,
|
|
@@ -2591,8 +2312,8 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2591
2312
|
const payload = await this.downloadFileResponse(sandboxId, path4);
|
|
2592
2313
|
return Buffer.from(payload.file.contentsBase64, "base64").toString("utf-8");
|
|
2593
2314
|
}
|
|
2594
|
-
downloadFileResponse(sandboxId,
|
|
2595
|
-
const normalized = typeof
|
|
2315
|
+
downloadFileResponse(sandboxId, input) {
|
|
2316
|
+
const normalized = typeof input === "string" ? { path: input } : input;
|
|
2596
2317
|
const query = new URLSearchParams({ path: normalized.path });
|
|
2597
2318
|
if (normalized.offsetBytes !== void 0) {
|
|
2598
2319
|
query.set("offsetBytes", String(normalized.offsetBytes));
|
|
@@ -2604,21 +2325,21 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2604
2325
|
`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
|
|
2605
2326
|
);
|
|
2606
2327
|
}
|
|
2607
|
-
listFiles(sandboxId,
|
|
2328
|
+
listFiles(sandboxId, input = {}) {
|
|
2608
2329
|
const query = new URLSearchParams({ list: "1" });
|
|
2609
|
-
if (
|
|
2610
|
-
if (
|
|
2611
|
-
query.set("recursive", String(
|
|
2612
|
-
if (
|
|
2613
|
-
query.set("maxEntries", String(
|
|
2330
|
+
if (input.path) query.set("path", input.path);
|
|
2331
|
+
if (input.recursive !== void 0)
|
|
2332
|
+
query.set("recursive", String(input.recursive));
|
|
2333
|
+
if (input.maxEntries !== void 0)
|
|
2334
|
+
query.set("maxEntries", String(input.maxEntries));
|
|
2614
2335
|
return this.request(
|
|
2615
2336
|
`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
|
|
2616
2337
|
);
|
|
2617
2338
|
}
|
|
2618
|
-
deleteFile(sandboxId, path4,
|
|
2339
|
+
deleteFile(sandboxId, path4, input = {}) {
|
|
2619
2340
|
const query = new URLSearchParams({ path: path4 });
|
|
2620
|
-
if (
|
|
2621
|
-
query.set("recursive", String(
|
|
2341
|
+
if (input.recursive !== void 0)
|
|
2342
|
+
query.set("recursive", String(input.recursive));
|
|
2622
2343
|
return this.request(
|
|
2623
2344
|
`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`,
|
|
2624
2345
|
{
|
|
@@ -2632,8 +2353,8 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2632
2353
|
`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
|
|
2633
2354
|
);
|
|
2634
2355
|
}
|
|
2635
|
-
mkdir(sandboxId,
|
|
2636
|
-
const normalized = typeof
|
|
2356
|
+
mkdir(sandboxId, input) {
|
|
2357
|
+
const normalized = typeof input === "string" ? { path: input } : input;
|
|
2637
2358
|
const query = new URLSearchParams({ path: normalized.path });
|
|
2638
2359
|
if (normalized.recursive !== void 0)
|
|
2639
2360
|
query.set("recursive", String(normalized.recursive));
|
|
@@ -2644,13 +2365,13 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2644
2365
|
}
|
|
2645
2366
|
);
|
|
2646
2367
|
}
|
|
2647
|
-
moveFile(sandboxId,
|
|
2368
|
+
moveFile(sandboxId, input) {
|
|
2648
2369
|
const query = new URLSearchParams({
|
|
2649
|
-
fromPath:
|
|
2650
|
-
toPath:
|
|
2370
|
+
fromPath: input.fromPath,
|
|
2371
|
+
toPath: input.toPath
|
|
2651
2372
|
});
|
|
2652
|
-
if (
|
|
2653
|
-
query.set("overwrite", String(
|
|
2373
|
+
if (input.overwrite !== void 0)
|
|
2374
|
+
query.set("overwrite", String(input.overwrite));
|
|
2654
2375
|
return this.request(
|
|
2655
2376
|
`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`,
|
|
2656
2377
|
{
|
|
@@ -2658,55 +2379,55 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2658
2379
|
}
|
|
2659
2380
|
);
|
|
2660
2381
|
}
|
|
2661
|
-
searchFiles(sandboxId,
|
|
2382
|
+
searchFiles(sandboxId, input) {
|
|
2662
2383
|
const query = new URLSearchParams({
|
|
2663
2384
|
search: "1",
|
|
2664
|
-
query:
|
|
2385
|
+
query: input.query
|
|
2665
2386
|
});
|
|
2666
|
-
if (
|
|
2667
|
-
if (
|
|
2668
|
-
query.set("maxResults", String(
|
|
2387
|
+
if (input.path) query.set("path", input.path);
|
|
2388
|
+
if (input.maxResults !== void 0)
|
|
2389
|
+
query.set("maxResults", String(input.maxResults));
|
|
2669
2390
|
return this.request(
|
|
2670
2391
|
`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
|
|
2671
2392
|
);
|
|
2672
2393
|
}
|
|
2673
|
-
openPort(sandboxId,
|
|
2394
|
+
openPort(sandboxId, input) {
|
|
2674
2395
|
return this.request(
|
|
2675
2396
|
`/${encodeURIComponent(sandboxId)}/ports`,
|
|
2676
2397
|
{
|
|
2677
2398
|
method: "POST",
|
|
2678
|
-
body: JSON.stringify(
|
|
2399
|
+
body: JSON.stringify(input)
|
|
2679
2400
|
}
|
|
2680
2401
|
);
|
|
2681
2402
|
}
|
|
2682
|
-
createSnapshot(sandboxId,
|
|
2403
|
+
createSnapshot(sandboxId, input) {
|
|
2683
2404
|
return this.request(
|
|
2684
2405
|
`/${encodeURIComponent(sandboxId)}/snapshots`,
|
|
2685
2406
|
{
|
|
2686
2407
|
method: "POST",
|
|
2687
|
-
body: JSON.stringify(
|
|
2408
|
+
body: JSON.stringify(input)
|
|
2688
2409
|
}
|
|
2689
2410
|
);
|
|
2690
2411
|
}
|
|
2691
|
-
updateSnapshot(sandboxId, snapshotId,
|
|
2412
|
+
updateSnapshot(sandboxId, snapshotId, input) {
|
|
2692
2413
|
return this.request(
|
|
2693
2414
|
`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(
|
|
2694
2415
|
snapshotId
|
|
2695
2416
|
)}`,
|
|
2696
2417
|
{
|
|
2697
2418
|
method: "PATCH",
|
|
2698
|
-
body: JSON.stringify(
|
|
2419
|
+
body: JSON.stringify(input)
|
|
2699
2420
|
}
|
|
2700
2421
|
);
|
|
2701
2422
|
}
|
|
2702
|
-
validateSnapshot(sandboxId, snapshotId,
|
|
2423
|
+
validateSnapshot(sandboxId, snapshotId, input = {}) {
|
|
2703
2424
|
return this.request(
|
|
2704
2425
|
`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(
|
|
2705
2426
|
snapshotId
|
|
2706
2427
|
)}/validate`,
|
|
2707
2428
|
{
|
|
2708
2429
|
method: "POST",
|
|
2709
|
-
body: JSON.stringify(
|
|
2430
|
+
body: JSON.stringify(input)
|
|
2710
2431
|
}
|
|
2711
2432
|
);
|
|
2712
2433
|
}
|
|
@@ -2720,12 +2441,12 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2720
2441
|
}
|
|
2721
2442
|
);
|
|
2722
2443
|
}
|
|
2723
|
-
fork(sandboxId,
|
|
2444
|
+
fork(sandboxId, input = {}) {
|
|
2724
2445
|
return this.request(
|
|
2725
2446
|
`/${encodeURIComponent(sandboxId)}/fork`,
|
|
2726
2447
|
{
|
|
2727
2448
|
method: "POST",
|
|
2728
|
-
body: JSON.stringify(
|
|
2449
|
+
body: JSON.stringify(input)
|
|
2729
2450
|
}
|
|
2730
2451
|
);
|
|
2731
2452
|
}
|
|
@@ -2787,57 +2508,57 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2787
2508
|
`/${encodeURIComponent(sandboxId)}/git/status`
|
|
2788
2509
|
);
|
|
2789
2510
|
}
|
|
2790
|
-
gitDiff(sandboxId,
|
|
2511
|
+
gitDiff(sandboxId, input = {}) {
|
|
2791
2512
|
return this.request(
|
|
2792
2513
|
`/${encodeURIComponent(sandboxId)}/git/diff`,
|
|
2793
2514
|
{
|
|
2794
2515
|
method: "POST",
|
|
2795
|
-
body: JSON.stringify(
|
|
2516
|
+
body: JSON.stringify(input)
|
|
2796
2517
|
}
|
|
2797
2518
|
);
|
|
2798
2519
|
}
|
|
2799
|
-
gitExportPatch(sandboxId,
|
|
2520
|
+
gitExportPatch(sandboxId, input = {}) {
|
|
2800
2521
|
return this.request(
|
|
2801
2522
|
`/${encodeURIComponent(sandboxId)}/git/export-patch`,
|
|
2802
2523
|
{
|
|
2803
2524
|
method: "POST",
|
|
2804
|
-
body: JSON.stringify(
|
|
2525
|
+
body: JSON.stringify(input)
|
|
2805
2526
|
}
|
|
2806
2527
|
);
|
|
2807
2528
|
}
|
|
2808
|
-
gitBranch(sandboxId,
|
|
2529
|
+
gitBranch(sandboxId, input) {
|
|
2809
2530
|
return this.request(
|
|
2810
2531
|
`/${encodeURIComponent(sandboxId)}/git/branch`,
|
|
2811
2532
|
{
|
|
2812
2533
|
method: "POST",
|
|
2813
|
-
body: JSON.stringify(
|
|
2534
|
+
body: JSON.stringify(input)
|
|
2814
2535
|
}
|
|
2815
2536
|
);
|
|
2816
2537
|
}
|
|
2817
|
-
gitCommit(sandboxId,
|
|
2538
|
+
gitCommit(sandboxId, input) {
|
|
2818
2539
|
return this.request(
|
|
2819
2540
|
`/${encodeURIComponent(sandboxId)}/git/commit`,
|
|
2820
2541
|
{
|
|
2821
2542
|
method: "POST",
|
|
2822
|
-
body: JSON.stringify(
|
|
2543
|
+
body: JSON.stringify(input)
|
|
2823
2544
|
}
|
|
2824
2545
|
);
|
|
2825
2546
|
}
|
|
2826
|
-
gitPull(sandboxId,
|
|
2547
|
+
gitPull(sandboxId, input = {}) {
|
|
2827
2548
|
return this.request(
|
|
2828
2549
|
`/${encodeURIComponent(sandboxId)}/git/pull`,
|
|
2829
2550
|
{
|
|
2830
2551
|
method: "POST",
|
|
2831
|
-
body: JSON.stringify(
|
|
2552
|
+
body: JSON.stringify(input)
|
|
2832
2553
|
}
|
|
2833
2554
|
);
|
|
2834
2555
|
}
|
|
2835
|
-
gitPush(sandboxId,
|
|
2556
|
+
gitPush(sandboxId, input = {}) {
|
|
2836
2557
|
return this.request(
|
|
2837
2558
|
`/${encodeURIComponent(sandboxId)}/git/push`,
|
|
2838
2559
|
{
|
|
2839
2560
|
method: "POST",
|
|
2840
|
-
body: JSON.stringify(
|
|
2561
|
+
body: JSON.stringify(input)
|
|
2841
2562
|
}
|
|
2842
2563
|
);
|
|
2843
2564
|
}
|
|
@@ -2849,11 +2570,11 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2849
2570
|
pricing() {
|
|
2850
2571
|
return this.request("/pricing");
|
|
2851
2572
|
}
|
|
2852
|
-
costs(
|
|
2573
|
+
costs(input = {}) {
|
|
2853
2574
|
const query = new URLSearchParams();
|
|
2854
|
-
if (
|
|
2855
|
-
if (
|
|
2856
|
-
if (
|
|
2575
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2576
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
2577
|
+
if (input.agentId) query.set("agentId", input.agentId);
|
|
2857
2578
|
return this.request(
|
|
2858
2579
|
`/costs${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
2859
2580
|
);
|
|
@@ -2863,12 +2584,12 @@ var OpenPondSandboxInstanceClient = class {
|
|
|
2863
2584
|
`/${encodeURIComponent(sandboxId)}/integrations`
|
|
2864
2585
|
);
|
|
2865
2586
|
}
|
|
2866
|
-
attachIntegrationConnection(sandboxId,
|
|
2587
|
+
attachIntegrationConnection(sandboxId, input) {
|
|
2867
2588
|
return this.request(
|
|
2868
2589
|
`/${encodeURIComponent(sandboxId)}/integrations`,
|
|
2869
2590
|
{
|
|
2870
2591
|
method: "POST",
|
|
2871
|
-
body: JSON.stringify(
|
|
2592
|
+
body: JSON.stringify(input)
|
|
2872
2593
|
}
|
|
2873
2594
|
);
|
|
2874
2595
|
}
|
|
@@ -2904,39 +2625,39 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
2904
2625
|
projects = createSandboxProjectNamespace(this);
|
|
2905
2626
|
agents = createSandboxAgentNamespace(this);
|
|
2906
2627
|
workItems = createSandboxWorkItemNamespace(this);
|
|
2907
|
-
list(
|
|
2628
|
+
list(input = {}) {
|
|
2908
2629
|
const query = new URLSearchParams();
|
|
2909
|
-
if (
|
|
2910
|
-
if (
|
|
2911
|
-
if (
|
|
2630
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2631
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
2632
|
+
if (input.agentId) query.set("agentId", input.agentId);
|
|
2912
2633
|
return this.request(
|
|
2913
2634
|
query.size > 0 ? `?${query.toString()}` : ""
|
|
2914
2635
|
).then((payload) => payload.sandboxes);
|
|
2915
2636
|
}
|
|
2916
|
-
listSecrets(
|
|
2637
|
+
listSecrets(input = {}) {
|
|
2917
2638
|
const query = new URLSearchParams();
|
|
2918
|
-
if (
|
|
2639
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2919
2640
|
return this.requestApiRoot(
|
|
2920
2641
|
`/sandbox-secrets${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
2921
2642
|
).then((payload) => payload.secrets);
|
|
2922
2643
|
}
|
|
2923
|
-
getSecret(secretId,
|
|
2644
|
+
getSecret(secretId, input = {}) {
|
|
2924
2645
|
const query = new URLSearchParams();
|
|
2925
|
-
if (
|
|
2646
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2926
2647
|
return this.requestApiRoot(
|
|
2927
2648
|
`/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
2928
2649
|
).then((payload) => payload.secret);
|
|
2929
2650
|
}
|
|
2930
|
-
createSecret(
|
|
2651
|
+
createSecret(input) {
|
|
2931
2652
|
return this.requestApiRoot("/sandbox-secrets", {
|
|
2932
2653
|
method: "POST",
|
|
2933
|
-
body: JSON.stringify(
|
|
2654
|
+
body: JSON.stringify(input)
|
|
2934
2655
|
}).then((payload) => payload.secret);
|
|
2935
2656
|
}
|
|
2936
|
-
rotateSecret(secretId,
|
|
2657
|
+
rotateSecret(secretId, input) {
|
|
2937
2658
|
const query = new URLSearchParams();
|
|
2938
|
-
if (
|
|
2939
|
-
const { teamId: _teamId, ...body } =
|
|
2659
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2660
|
+
const { teamId: _teamId, ...body } = input;
|
|
2940
2661
|
return this.requestApiRoot(
|
|
2941
2662
|
`/sandbox-secrets/${encodeURIComponent(secretId)}/rotate${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
2942
2663
|
{
|
|
@@ -2945,10 +2666,10 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
2945
2666
|
}
|
|
2946
2667
|
).then((payload) => payload.secret);
|
|
2947
2668
|
}
|
|
2948
|
-
attachSecret(secretId,
|
|
2669
|
+
attachSecret(secretId, input) {
|
|
2949
2670
|
const query = new URLSearchParams();
|
|
2950
|
-
if (
|
|
2951
|
-
const { teamId: _teamId, ...body } =
|
|
2671
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2672
|
+
const { teamId: _teamId, ...body } = input;
|
|
2952
2673
|
return this.requestApiRoot(
|
|
2953
2674
|
`/sandbox-secrets/${encodeURIComponent(secretId)}/attach${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
2954
2675
|
{
|
|
@@ -2957,67 +2678,67 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
2957
2678
|
}
|
|
2958
2679
|
).then((payload) => payload.secret);
|
|
2959
2680
|
}
|
|
2960
|
-
revokeSecret(secretId,
|
|
2681
|
+
revokeSecret(secretId, input = {}) {
|
|
2961
2682
|
const query = new URLSearchParams();
|
|
2962
|
-
if (
|
|
2683
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2963
2684
|
return this.requestApiRoot(
|
|
2964
2685
|
`/sandbox-secrets/${encodeURIComponent(secretId)}/revoke${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
2965
2686
|
{ method: "POST" }
|
|
2966
2687
|
).then((payload) => payload.secret);
|
|
2967
2688
|
}
|
|
2968
|
-
deleteSecret(secretId,
|
|
2689
|
+
deleteSecret(secretId, input = {}) {
|
|
2969
2690
|
const query = new URLSearchParams();
|
|
2970
|
-
if (
|
|
2691
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2971
2692
|
return this.requestApiRoot(
|
|
2972
2693
|
`/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
2973
2694
|
{ method: "DELETE" }
|
|
2974
2695
|
).then((payload) => payload.secret);
|
|
2975
2696
|
}
|
|
2976
|
-
snapshotCatalog(
|
|
2697
|
+
snapshotCatalog(input = {}) {
|
|
2977
2698
|
const query = new URLSearchParams();
|
|
2978
|
-
if (
|
|
2979
|
-
if (
|
|
2980
|
-
if (
|
|
2981
|
-
if (
|
|
2982
|
-
if (
|
|
2983
|
-
if (
|
|
2984
|
-
if (
|
|
2985
|
-
if (
|
|
2986
|
-
if (
|
|
2987
|
-
if (
|
|
2699
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2700
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
2701
|
+
if (input.agentId) query.set("agentId", input.agentId);
|
|
2702
|
+
if (input.q) query.set("q", input.q);
|
|
2703
|
+
if (input.kind) query.set("kind", input.kind);
|
|
2704
|
+
if (input.replayState) query.set("replayState", input.replayState);
|
|
2705
|
+
if (input.visibility) query.set("visibility", input.visibility);
|
|
2706
|
+
if (input.tag) query.set("tag", input.tag);
|
|
2707
|
+
if (input.useCase) query.set("useCase", input.useCase);
|
|
2708
|
+
if (input.limit) query.set("limit", String(input.limit));
|
|
2988
2709
|
return this.request(
|
|
2989
2710
|
`/catalog/snapshots${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
2990
2711
|
);
|
|
2991
2712
|
}
|
|
2992
|
-
listSandboxRuntimes(
|
|
2713
|
+
listSandboxRuntimes(input = {}) {
|
|
2993
2714
|
const query = new URLSearchParams();
|
|
2994
|
-
if (
|
|
2995
|
-
if (
|
|
2996
|
-
if (
|
|
2715
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
2716
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
2717
|
+
if (input.agentId) query.set("agentId", input.agentId);
|
|
2997
2718
|
return this.requestApiRoot(
|
|
2998
2719
|
`/runtimes${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
2999
2720
|
).then((payload) => payload.runtimes);
|
|
3000
2721
|
}
|
|
3001
|
-
listProjects(
|
|
3002
|
-
const query = new URLSearchParams({ teamId:
|
|
2722
|
+
listProjects(input) {
|
|
2723
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3003
2724
|
return this.requestApiRoot(
|
|
3004
2725
|
`/projects?${query.toString()}`
|
|
3005
2726
|
).then((payload) => payload.projects);
|
|
3006
2727
|
}
|
|
3007
|
-
upsertProject(
|
|
2728
|
+
upsertProject(input) {
|
|
3008
2729
|
return this.requestApiRoot("/projects", {
|
|
3009
2730
|
method: "POST",
|
|
3010
|
-
body: JSON.stringify(
|
|
2731
|
+
body: JSON.stringify(input)
|
|
3011
2732
|
}).then((payload) => payload.project);
|
|
3012
2733
|
}
|
|
3013
|
-
getHostedProfile(
|
|
3014
|
-
const query = new URLSearchParams({ teamId:
|
|
2734
|
+
getHostedProfile(input) {
|
|
2735
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3015
2736
|
return this.requestApiRoot(
|
|
3016
2737
|
`/profile?${query.toString()}`
|
|
3017
2738
|
).then((payload) => payload.profile);
|
|
3018
2739
|
}
|
|
3019
|
-
ensureHostedProfile(
|
|
3020
|
-
const query = new URLSearchParams({ teamId:
|
|
2740
|
+
ensureHostedProfile(input) {
|
|
2741
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3021
2742
|
return this.requestApiRoot(
|
|
3022
2743
|
`/profile/ensure?${query.toString()}`,
|
|
3023
2744
|
{ method: "POST" }
|
|
@@ -3028,9 +2749,9 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3028
2749
|
return payload.profile;
|
|
3029
2750
|
});
|
|
3030
2751
|
}
|
|
3031
|
-
pushHostedProfile(
|
|
3032
|
-
const query = new URLSearchParams({ teamId:
|
|
3033
|
-
const { teamId: _teamId, ...body } =
|
|
2752
|
+
pushHostedProfile(input) {
|
|
2753
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2754
|
+
const { teamId: _teamId, ...body } = input;
|
|
3034
2755
|
return this.requestApiRoot(
|
|
3035
2756
|
`/profile/push?${query.toString()}`,
|
|
3036
2757
|
{
|
|
@@ -3039,33 +2760,33 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3039
2760
|
}
|
|
3040
2761
|
);
|
|
3041
2762
|
}
|
|
3042
|
-
async upsertProjectGitRemote(
|
|
3043
|
-
const project = await this.upsertProject(
|
|
3044
|
-
return this.ensureProjectGitRemote(project.id, { teamId:
|
|
2763
|
+
async upsertProjectGitRemote(input) {
|
|
2764
|
+
const project = await this.upsertProject(input);
|
|
2765
|
+
return this.ensureProjectGitRemote(project.id, { teamId: input.teamId });
|
|
3045
2766
|
}
|
|
3046
|
-
getProject(projectId,
|
|
3047
|
-
const query = new URLSearchParams({ teamId:
|
|
2767
|
+
getProject(projectId, input) {
|
|
2768
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3048
2769
|
return this.requestApiRoot(
|
|
3049
2770
|
`/projects/${encodeURIComponent(projectId)}?${query.toString()}`
|
|
3050
2771
|
).then((payload) => payload.project);
|
|
3051
2772
|
}
|
|
3052
|
-
syncProject(projectId,
|
|
3053
|
-
const query = new URLSearchParams({ teamId:
|
|
2773
|
+
syncProject(projectId, input) {
|
|
2774
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3054
2775
|
return this.requestApiRoot(
|
|
3055
2776
|
`/projects/${encodeURIComponent(projectId)}/sync?${query.toString()}`,
|
|
3056
2777
|
{ method: "POST" }
|
|
3057
2778
|
).then((payload) => payload.project);
|
|
3058
2779
|
}
|
|
3059
|
-
ensureProjectGitRemote(projectId,
|
|
3060
|
-
const query = new URLSearchParams({ teamId:
|
|
2780
|
+
ensureProjectGitRemote(projectId, input) {
|
|
2781
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3061
2782
|
return this.requestApiRoot(
|
|
3062
2783
|
`/projects/${encodeURIComponent(projectId)}/git?${query.toString()}`,
|
|
3063
2784
|
{ method: "POST" }
|
|
3064
2785
|
);
|
|
3065
2786
|
}
|
|
3066
|
-
uploadProjectSource(projectId,
|
|
3067
|
-
const query = new URLSearchParams({ teamId:
|
|
3068
|
-
const { teamId: _teamId, ...body } =
|
|
2787
|
+
uploadProjectSource(projectId, input) {
|
|
2788
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2789
|
+
const { teamId: _teamId, ...body } = input;
|
|
3069
2790
|
return this.requestApiRoot(
|
|
3070
2791
|
`/projects/${encodeURIComponent(projectId)}/source?${query.toString()}`,
|
|
3071
2792
|
{
|
|
@@ -3074,9 +2795,9 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3074
2795
|
}
|
|
3075
2796
|
).then((payload) => payload.project);
|
|
3076
2797
|
}
|
|
3077
|
-
updateProject(projectId,
|
|
3078
|
-
const query = new URLSearchParams({ teamId:
|
|
3079
|
-
const { teamId: _teamId, ...body } =
|
|
2798
|
+
updateProject(projectId, input) {
|
|
2799
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2800
|
+
const { teamId: _teamId, ...body } = input;
|
|
3080
2801
|
return this.requestApiRoot(
|
|
3081
2802
|
`/projects/${encodeURIComponent(projectId)}?${query.toString()}`,
|
|
3082
2803
|
{
|
|
@@ -3085,41 +2806,41 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3085
2806
|
}
|
|
3086
2807
|
).then((payload) => payload.project);
|
|
3087
2808
|
}
|
|
3088
|
-
archiveProject(projectId,
|
|
3089
|
-
const query = new URLSearchParams({ teamId:
|
|
2809
|
+
archiveProject(projectId, input) {
|
|
2810
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3090
2811
|
return this.requestApiRoot(
|
|
3091
2812
|
`/projects/${encodeURIComponent(projectId)}?${query.toString()}`,
|
|
3092
2813
|
{ method: "DELETE" }
|
|
3093
2814
|
).then((payload) => payload.project);
|
|
3094
2815
|
}
|
|
3095
|
-
listAgents(
|
|
3096
|
-
const query = new URLSearchParams({ teamId:
|
|
2816
|
+
listAgents(input) {
|
|
2817
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3097
2818
|
return this.requestApiRoot(
|
|
3098
2819
|
`/agents?${query.toString()}`
|
|
3099
2820
|
).then((payload) => payload.agents);
|
|
3100
2821
|
}
|
|
3101
|
-
upsertAgent(
|
|
2822
|
+
upsertAgent(input) {
|
|
3102
2823
|
return this.requestApiRoot("/agents", {
|
|
3103
2824
|
method: "POST",
|
|
3104
|
-
body: JSON.stringify(
|
|
2825
|
+
body: JSON.stringify(input)
|
|
3105
2826
|
}).then((payload) => payload.agent);
|
|
3106
2827
|
}
|
|
3107
|
-
getAgent(agentId,
|
|
3108
|
-
const query = new URLSearchParams({ teamId:
|
|
2828
|
+
getAgent(agentId, input) {
|
|
2829
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3109
2830
|
return this.requestApiRoot(
|
|
3110
2831
|
`/agents/${encodeURIComponent(agentId)}?${query.toString()}`
|
|
3111
2832
|
).then((payload) => payload.agent);
|
|
3112
2833
|
}
|
|
3113
|
-
archiveAgent(agentId,
|
|
3114
|
-
const query = new URLSearchParams({ teamId:
|
|
2834
|
+
archiveAgent(agentId, input) {
|
|
2835
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3115
2836
|
return this.requestApiRoot(
|
|
3116
2837
|
`/agents/${encodeURIComponent(agentId)}?${query.toString()}`,
|
|
3117
2838
|
{ method: "DELETE" }
|
|
3118
2839
|
).then((payload) => payload.agent);
|
|
3119
2840
|
}
|
|
3120
|
-
updateAgent(agentId,
|
|
3121
|
-
const query = new URLSearchParams({ teamId:
|
|
3122
|
-
const { teamId: _teamId, ...body } =
|
|
2841
|
+
updateAgent(agentId, input) {
|
|
2842
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2843
|
+
const { teamId: _teamId, ...body } = input;
|
|
3123
2844
|
return this.requestApiRoot(
|
|
3124
2845
|
`/agents/${encodeURIComponent(agentId)}?${query.toString()}`,
|
|
3125
2846
|
{
|
|
@@ -3128,7 +2849,7 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3128
2849
|
}
|
|
3129
2850
|
).then((payload) => payload.agent);
|
|
3130
2851
|
}
|
|
3131
|
-
runAgent(agentId,
|
|
2852
|
+
runAgent(agentId, input) {
|
|
3132
2853
|
return this.requestApiRoot(
|
|
3133
2854
|
`/agents/${encodeURIComponent(agentId)}/run`,
|
|
3134
2855
|
{
|
|
@@ -3136,30 +2857,30 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3136
2857
|
headers: {
|
|
3137
2858
|
Prefer: "respond-async"
|
|
3138
2859
|
},
|
|
3139
|
-
body: JSON.stringify(
|
|
2860
|
+
body: JSON.stringify(input)
|
|
3140
2861
|
}
|
|
3141
2862
|
);
|
|
3142
2863
|
}
|
|
3143
|
-
getAgentSourceDeployPlan(agentId,
|
|
3144
|
-
const query = new URLSearchParams({ teamId:
|
|
2864
|
+
getAgentSourceDeployPlan(agentId, input) {
|
|
2865
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3145
2866
|
return this.requestApiRoot(
|
|
3146
2867
|
`/agents/${encodeURIComponent(
|
|
3147
2868
|
agentId
|
|
3148
2869
|
)}/source/deploy-plan?${query.toString()}`
|
|
3149
2870
|
).then((payload) => payload.deployPlan);
|
|
3150
2871
|
}
|
|
3151
|
-
listAgentManifestSnapshots(agentId,
|
|
3152
|
-
const query = new URLSearchParams({ teamId:
|
|
3153
|
-
if (
|
|
2872
|
+
listAgentManifestSnapshots(agentId, input) {
|
|
2873
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2874
|
+
if (input.limit !== void 0) query.set("limit", String(input.limit));
|
|
3154
2875
|
return this.requestApiRoot(
|
|
3155
2876
|
`/agents/${encodeURIComponent(
|
|
3156
2877
|
agentId
|
|
3157
2878
|
)}/source/manifest-snapshots?${query.toString()}`
|
|
3158
2879
|
).then((payload) => payload.manifestSnapshots);
|
|
3159
2880
|
}
|
|
3160
|
-
requestAgentSourceChecks(agentId,
|
|
3161
|
-
const query = new URLSearchParams({ teamId:
|
|
3162
|
-
const { teamId: _teamId, ...body } =
|
|
2881
|
+
requestAgentSourceChecks(agentId, input) {
|
|
2882
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2883
|
+
const { teamId: _teamId, ...body } = input;
|
|
3163
2884
|
return this.requestApiRoot(
|
|
3164
2885
|
`/agents/${encodeURIComponent(
|
|
3165
2886
|
agentId
|
|
@@ -3170,9 +2891,9 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3170
2891
|
}
|
|
3171
2892
|
);
|
|
3172
2893
|
}
|
|
3173
|
-
publishAgentSource(agentId,
|
|
3174
|
-
const query = new URLSearchParams({ teamId:
|
|
3175
|
-
const { teamId: _teamId, ...body } =
|
|
2894
|
+
publishAgentSource(agentId, input) {
|
|
2895
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2896
|
+
const { teamId: _teamId, ...body } = input;
|
|
3176
2897
|
return this.requestApiRoot(
|
|
3177
2898
|
`/agents/${encodeURIComponent(
|
|
3178
2899
|
agentId
|
|
@@ -3183,9 +2904,9 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3183
2904
|
}
|
|
3184
2905
|
);
|
|
3185
2906
|
}
|
|
3186
|
-
openAgentEditWorkItem(agentId,
|
|
3187
|
-
const query = new URLSearchParams({ teamId:
|
|
3188
|
-
const { teamId: _teamId, ...body } =
|
|
2907
|
+
openAgentEditWorkItem(agentId, input) {
|
|
2908
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2909
|
+
const { teamId: _teamId, ...body } = input;
|
|
3189
2910
|
return this.requestApiRoot(
|
|
3190
2911
|
`/agents/${encodeURIComponent(
|
|
3191
2912
|
agentId
|
|
@@ -3196,109 +2917,109 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3196
2917
|
}
|
|
3197
2918
|
);
|
|
3198
2919
|
}
|
|
3199
|
-
getCodingWorkItem(workItemId,
|
|
3200
|
-
const query = new URLSearchParams({ teamId:
|
|
3201
|
-
if (
|
|
2920
|
+
getCodingWorkItem(workItemId, input) {
|
|
2921
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2922
|
+
if (input.includeArchived) query.set("includeArchived", "true");
|
|
3202
2923
|
return this.requestApiRoot(
|
|
3203
2924
|
`/work-items/${encodeURIComponent(workItemId)}?${query.toString()}`
|
|
3204
2925
|
).then((payload) => payload.workItem);
|
|
3205
2926
|
}
|
|
3206
|
-
sendCodingWorkItemChat(workItemId,
|
|
2927
|
+
sendCodingWorkItemChat(workItemId, input) {
|
|
3207
2928
|
return this.requestApiRoot(
|
|
3208
2929
|
`/work-items/${encodeURIComponent(workItemId)}/chat`,
|
|
3209
2930
|
{
|
|
3210
2931
|
method: "POST",
|
|
3211
|
-
body: JSON.stringify(
|
|
2932
|
+
body: JSON.stringify(input)
|
|
3212
2933
|
}
|
|
3213
2934
|
);
|
|
3214
2935
|
}
|
|
3215
|
-
listCodingWorkItemActivity(workItemId,
|
|
3216
|
-
const query = new URLSearchParams({ teamId:
|
|
3217
|
-
if (
|
|
2936
|
+
listCodingWorkItemActivity(workItemId, input) {
|
|
2937
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2938
|
+
if (input.limit !== void 0) query.set("limit", String(input.limit));
|
|
3218
2939
|
return this.requestApiRoot(
|
|
3219
2940
|
`/work-items/${encodeURIComponent(
|
|
3220
2941
|
workItemId
|
|
3221
2942
|
)}/activity?${query.toString()}`
|
|
3222
2943
|
).then((payload) => payload.activity);
|
|
3223
2944
|
}
|
|
3224
|
-
getCodingWorkItemStatus(workItemId,
|
|
3225
|
-
const query = new URLSearchParams({ teamId:
|
|
3226
|
-
if (
|
|
3227
|
-
if (
|
|
2945
|
+
getCodingWorkItemStatus(workItemId, input) {
|
|
2946
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
2947
|
+
if (input.limit !== void 0) query.set("limit", String(input.limit));
|
|
2948
|
+
if (input.includeArchived) query.set("includeArchived", "true");
|
|
3228
2949
|
return this.requestApiRoot(
|
|
3229
2950
|
`/work-items/${encodeURIComponent(workItemId)}/status?${query.toString()}`
|
|
3230
2951
|
);
|
|
3231
2952
|
}
|
|
3232
|
-
handleCodingWorkItemInBackground(workItemId,
|
|
2953
|
+
handleCodingWorkItemInBackground(workItemId, input) {
|
|
3233
2954
|
return this.requestApiRoot(
|
|
3234
2955
|
`/work-items/${encodeURIComponent(workItemId)}/handle-background`,
|
|
3235
2956
|
{
|
|
3236
2957
|
method: "POST",
|
|
3237
|
-
body: JSON.stringify(
|
|
2958
|
+
body: JSON.stringify(input)
|
|
3238
2959
|
}
|
|
3239
2960
|
);
|
|
3240
2961
|
}
|
|
3241
|
-
promoteCodingWorkItemResult(workItemId, action,
|
|
2962
|
+
promoteCodingWorkItemResult(workItemId, action, input) {
|
|
3242
2963
|
return this.requestApiRoot(
|
|
3243
2964
|
`/work-items/${encodeURIComponent(workItemId)}/result/${action}`,
|
|
3244
2965
|
{
|
|
3245
2966
|
method: "POST",
|
|
3246
|
-
body: JSON.stringify(
|
|
2967
|
+
body: JSON.stringify(input)
|
|
3247
2968
|
}
|
|
3248
2969
|
).then((payload) => payload.artifact);
|
|
3249
2970
|
}
|
|
3250
|
-
getMicrosoftTeamsBotOverview(
|
|
3251
|
-
const query = new URLSearchParams({ teamId:
|
|
2971
|
+
getMicrosoftTeamsBotOverview(input) {
|
|
2972
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3252
2973
|
return this.requestApiRoot(
|
|
3253
2974
|
`/teams/bot/overview?${query.toString()}`
|
|
3254
2975
|
);
|
|
3255
2976
|
}
|
|
3256
|
-
bindMicrosoftTeamsBotConversation(
|
|
2977
|
+
bindMicrosoftTeamsBotConversation(input) {
|
|
3257
2978
|
return this.requestApiRoot(
|
|
3258
2979
|
"/teams/bot/bindings",
|
|
3259
2980
|
{
|
|
3260
2981
|
method: "POST",
|
|
3261
|
-
body: JSON.stringify(
|
|
2982
|
+
body: JSON.stringify(input)
|
|
3262
2983
|
}
|
|
3263
2984
|
);
|
|
3264
2985
|
}
|
|
3265
|
-
rebindMicrosoftTeamsBotConversation(bindingId,
|
|
2986
|
+
rebindMicrosoftTeamsBotConversation(bindingId, input) {
|
|
3266
2987
|
return this.requestApiRoot(
|
|
3267
2988
|
`/teams/bot/bindings/${encodeURIComponent(bindingId)}`,
|
|
3268
2989
|
{
|
|
3269
2990
|
method: "PATCH",
|
|
3270
|
-
body: JSON.stringify(
|
|
2991
|
+
body: JSON.stringify(input)
|
|
3271
2992
|
}
|
|
3272
2993
|
);
|
|
3273
2994
|
}
|
|
3274
|
-
unlinkMicrosoftTeamsBotConversation(
|
|
2995
|
+
unlinkMicrosoftTeamsBotConversation(input) {
|
|
3275
2996
|
return this.requestApiRoot(
|
|
3276
|
-
`/teams/bot/bindings/${encodeURIComponent(
|
|
2997
|
+
`/teams/bot/bindings/${encodeURIComponent(input.bindingId)}`,
|
|
3277
2998
|
{
|
|
3278
2999
|
method: "DELETE",
|
|
3279
|
-
body: JSON.stringify({ teamId:
|
|
3000
|
+
body: JSON.stringify({ teamId: input.teamId })
|
|
3280
3001
|
}
|
|
3281
3002
|
);
|
|
3282
3003
|
}
|
|
3283
|
-
sendMicrosoftTeamsBotDiagnostic(
|
|
3004
|
+
sendMicrosoftTeamsBotDiagnostic(input) {
|
|
3284
3005
|
return this.requestApiRoot("/teams/bot/diagnostics", {
|
|
3285
3006
|
method: "POST",
|
|
3286
|
-
body: JSON.stringify(
|
|
3007
|
+
body: JSON.stringify(input)
|
|
3287
3008
|
});
|
|
3288
3009
|
}
|
|
3289
|
-
sendMicrosoftTeamsBotDiagnosticRun(
|
|
3010
|
+
sendMicrosoftTeamsBotDiagnosticRun(input) {
|
|
3290
3011
|
return this.requestApiRoot(
|
|
3291
3012
|
"/teams/bot/diagnostics/run",
|
|
3292
3013
|
{
|
|
3293
3014
|
method: "POST",
|
|
3294
|
-
body: JSON.stringify(
|
|
3015
|
+
body: JSON.stringify(input)
|
|
3295
3016
|
}
|
|
3296
3017
|
);
|
|
3297
3018
|
}
|
|
3298
|
-
createSandboxRuntime(
|
|
3019
|
+
createSandboxRuntime(input) {
|
|
3299
3020
|
return this.requestApiRoot("/runtimes", {
|
|
3300
3021
|
method: "POST",
|
|
3301
|
-
body: JSON.stringify(
|
|
3022
|
+
body: JSON.stringify(input)
|
|
3302
3023
|
}).then((payload) => payload.runtime);
|
|
3303
3024
|
}
|
|
3304
3025
|
sandboxRuntime(runtimeId, initial = null) {
|
|
@@ -3309,22 +3030,22 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3309
3030
|
`/runtimes/${encodeURIComponent(runtimeId)}`
|
|
3310
3031
|
).then((payload) => payload.runtime);
|
|
3311
3032
|
}
|
|
3312
|
-
createSandboxRuntimeSandbox(runtimeId,
|
|
3033
|
+
createSandboxRuntimeSandbox(runtimeId, input = {}, options = {}) {
|
|
3313
3034
|
return this.requestApiRoot(
|
|
3314
3035
|
`/runtimes/${encodeURIComponent(runtimeId)}/sandbox`,
|
|
3315
3036
|
{
|
|
3316
3037
|
method: "POST",
|
|
3317
3038
|
headers: asyncRequestHeaders(options),
|
|
3318
|
-
body: JSON.stringify(
|
|
3039
|
+
body: JSON.stringify(input)
|
|
3319
3040
|
}
|
|
3320
3041
|
);
|
|
3321
3042
|
}
|
|
3322
|
-
updateSandboxRuntimeStatus(runtimeId,
|
|
3043
|
+
updateSandboxRuntimeStatus(runtimeId, input) {
|
|
3323
3044
|
return this.requestApiRoot(
|
|
3324
3045
|
`/runtimes/${encodeURIComponent(runtimeId)}/status`,
|
|
3325
3046
|
{
|
|
3326
3047
|
method: "PATCH",
|
|
3327
|
-
body: JSON.stringify(
|
|
3048
|
+
body: JSON.stringify(input)
|
|
3328
3049
|
}
|
|
3329
3050
|
).then((payload) => payload.runtime);
|
|
3330
3051
|
}
|
|
@@ -3333,52 +3054,52 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3333
3054
|
`/runtimes/${encodeURIComponent(runtimeId)}/events`
|
|
3334
3055
|
);
|
|
3335
3056
|
}
|
|
3336
|
-
emitSandboxRuntimeEvent(runtimeId,
|
|
3057
|
+
emitSandboxRuntimeEvent(runtimeId, input) {
|
|
3337
3058
|
return this.requestApiRoot(
|
|
3338
3059
|
`/runtimes/${encodeURIComponent(runtimeId)}/events`,
|
|
3339
3060
|
{
|
|
3340
3061
|
method: "POST",
|
|
3341
|
-
body: JSON.stringify(
|
|
3062
|
+
body: JSON.stringify(input)
|
|
3342
3063
|
}
|
|
3343
3064
|
);
|
|
3344
3065
|
}
|
|
3345
|
-
checkpointSandboxRuntime(runtimeId,
|
|
3066
|
+
checkpointSandboxRuntime(runtimeId, input) {
|
|
3346
3067
|
return this.requestApiRoot(
|
|
3347
3068
|
`/runtimes/${encodeURIComponent(runtimeId)}/checkpoints`,
|
|
3348
3069
|
{
|
|
3349
3070
|
method: "POST",
|
|
3350
|
-
body: JSON.stringify(
|
|
3071
|
+
body: JSON.stringify(input)
|
|
3351
3072
|
}
|
|
3352
3073
|
).then((payload) => payload.runtime);
|
|
3353
3074
|
}
|
|
3354
|
-
promoteSandboxRuntime(runtimeId,
|
|
3075
|
+
promoteSandboxRuntime(runtimeId, input, options = {}) {
|
|
3355
3076
|
const query = new URLSearchParams();
|
|
3356
3077
|
if (options.teamId) query.set("teamId", options.teamId);
|
|
3357
3078
|
return this.requestApiRoot(
|
|
3358
3079
|
`/runtimes/${encodeURIComponent(runtimeId)}/promote${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
3359
3080
|
{
|
|
3360
3081
|
method: "POST",
|
|
3361
|
-
body: JSON.stringify(
|
|
3082
|
+
body: JSON.stringify(input)
|
|
3362
3083
|
}
|
|
3363
3084
|
);
|
|
3364
3085
|
}
|
|
3365
|
-
preserveSandboxRuntimeSource(runtimeId,
|
|
3086
|
+
preserveSandboxRuntimeSource(runtimeId, input = {}, options = {}) {
|
|
3366
3087
|
const query = new URLSearchParams();
|
|
3367
3088
|
if (options.teamId) query.set("teamId", options.teamId);
|
|
3368
3089
|
return this.requestApiRoot(
|
|
3369
3090
|
`/runtimes/${encodeURIComponent(runtimeId)}/preserve-source${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
3370
3091
|
{
|
|
3371
3092
|
method: "POST",
|
|
3372
|
-
body: JSON.stringify(
|
|
3093
|
+
body: JSON.stringify(input)
|
|
3373
3094
|
}
|
|
3374
3095
|
);
|
|
3375
3096
|
}
|
|
3376
|
-
forkSnapshot(snapshotId,
|
|
3097
|
+
forkSnapshot(snapshotId, input = {}, options = {}) {
|
|
3377
3098
|
const query = new URLSearchParams();
|
|
3378
|
-
if (
|
|
3379
|
-
if (
|
|
3099
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3100
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3380
3101
|
if (options.async) query.set("async", "1");
|
|
3381
|
-
const { teamId: _teamId, projectId: _projectId, ...body } =
|
|
3102
|
+
const { teamId: _teamId, projectId: _projectId, ...body } = input;
|
|
3382
3103
|
return this.request(
|
|
3383
3104
|
`/catalog/snapshots/${encodeURIComponent(snapshotId)}/fork${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
3384
3105
|
{
|
|
@@ -3391,32 +3112,32 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3391
3112
|
}
|
|
3392
3113
|
);
|
|
3393
3114
|
}
|
|
3394
|
-
templates(
|
|
3115
|
+
templates(input = {}) {
|
|
3395
3116
|
const query = new URLSearchParams();
|
|
3396
|
-
if (
|
|
3397
|
-
if (
|
|
3398
|
-
if (
|
|
3399
|
-
if (
|
|
3400
|
-
if (
|
|
3401
|
-
if (
|
|
3402
|
-
if (
|
|
3403
|
-
if (
|
|
3404
|
-
if (
|
|
3117
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3118
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3119
|
+
if (input.q) query.set("q", input.q);
|
|
3120
|
+
if (input.name) query.set("name", input.name);
|
|
3121
|
+
if (input.version) query.set("version", input.version);
|
|
3122
|
+
if (input.visibility) query.set("visibility", input.visibility);
|
|
3123
|
+
if (input.tag) query.set("tag", input.tag);
|
|
3124
|
+
if (input.useCase) query.set("useCase", input.useCase);
|
|
3125
|
+
if (input.limit) query.set("limit", String(input.limit));
|
|
3405
3126
|
return this.request(
|
|
3406
3127
|
`/templates${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
3407
3128
|
);
|
|
3408
3129
|
}
|
|
3409
|
-
publishedSnapshots(
|
|
3130
|
+
publishedSnapshots(input = {}) {
|
|
3410
3131
|
const query = new URLSearchParams();
|
|
3411
|
-
if (
|
|
3412
|
-
if (
|
|
3413
|
-
if (
|
|
3414
|
-
if (
|
|
3415
|
-
if (
|
|
3416
|
-
if (
|
|
3417
|
-
if (
|
|
3418
|
-
if (
|
|
3419
|
-
if (
|
|
3132
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3133
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3134
|
+
if (input.q) query.set("q", input.q);
|
|
3135
|
+
if (input.name) query.set("name", input.name);
|
|
3136
|
+
if (input.version) query.set("version", input.version);
|
|
3137
|
+
if (input.visibility) query.set("visibility", input.visibility);
|
|
3138
|
+
if (input.tag) query.set("tag", input.tag);
|
|
3139
|
+
if (input.useCase) query.set("useCase", input.useCase);
|
|
3140
|
+
if (input.limit) query.set("limit", String(input.limit));
|
|
3420
3141
|
return this.request(
|
|
3421
3142
|
`/published-snapshots${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
3422
3143
|
).then((payload) => {
|
|
@@ -3428,11 +3149,11 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3428
3149
|
};
|
|
3429
3150
|
});
|
|
3430
3151
|
}
|
|
3431
|
-
launchTemplate(
|
|
3152
|
+
launchTemplate(input) {
|
|
3432
3153
|
const query = new URLSearchParams();
|
|
3433
|
-
if (
|
|
3434
|
-
if (
|
|
3435
|
-
const { teamId: _teamId, projectId: _projectId, ...body } =
|
|
3154
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3155
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3156
|
+
const { teamId: _teamId, projectId: _projectId, ...body } = input;
|
|
3436
3157
|
return this.request(
|
|
3437
3158
|
`/templates/launch${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
3438
3159
|
{
|
|
@@ -3441,11 +3162,11 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3441
3162
|
}
|
|
3442
3163
|
);
|
|
3443
3164
|
}
|
|
3444
|
-
runPublishedSnapshot(
|
|
3165
|
+
runPublishedSnapshot(input) {
|
|
3445
3166
|
const query = new URLSearchParams();
|
|
3446
|
-
if (
|
|
3447
|
-
if (
|
|
3448
|
-
const { teamId: _teamId, projectId: _projectId, ...body } =
|
|
3167
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3168
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3169
|
+
const { teamId: _teamId, projectId: _projectId, ...body } = input;
|
|
3449
3170
|
return this.request(
|
|
3450
3171
|
`/published-snapshots/launch${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
3451
3172
|
{
|
|
@@ -3461,20 +3182,20 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3461
3182
|
};
|
|
3462
3183
|
});
|
|
3463
3184
|
}
|
|
3464
|
-
listSchedules(
|
|
3185
|
+
listSchedules(input = {}) {
|
|
3465
3186
|
const query = new URLSearchParams();
|
|
3466
|
-
if (
|
|
3467
|
-
if (
|
|
3468
|
-
if (
|
|
3469
|
-
query.set("sourceSandboxId",
|
|
3187
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3188
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3189
|
+
if (input.sourceSandboxId)
|
|
3190
|
+
query.set("sourceSandboxId", input.sourceSandboxId);
|
|
3470
3191
|
return this.request(
|
|
3471
3192
|
`/schedules${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
3472
3193
|
);
|
|
3473
3194
|
}
|
|
3474
|
-
createSchedule(
|
|
3195
|
+
createSchedule(input) {
|
|
3475
3196
|
const query = new URLSearchParams();
|
|
3476
|
-
if (
|
|
3477
|
-
const { projectId: _projectId, ...body } =
|
|
3197
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3198
|
+
const { projectId: _projectId, ...body } = input;
|
|
3478
3199
|
return this.request(
|
|
3479
3200
|
`/schedules${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
3480
3201
|
{
|
|
@@ -3488,12 +3209,12 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3488
3209
|
`/schedules/${encodeURIComponent(scheduleId)}`
|
|
3489
3210
|
);
|
|
3490
3211
|
}
|
|
3491
|
-
updateSchedule(scheduleId,
|
|
3212
|
+
updateSchedule(scheduleId, input) {
|
|
3492
3213
|
return this.request(
|
|
3493
3214
|
`/schedules/${encodeURIComponent(scheduleId)}`,
|
|
3494
3215
|
{
|
|
3495
3216
|
method: "PATCH",
|
|
3496
|
-
body: JSON.stringify(
|
|
3217
|
+
body: JSON.stringify(input)
|
|
3497
3218
|
}
|
|
3498
3219
|
);
|
|
3499
3220
|
}
|
|
@@ -3505,34 +3226,34 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3505
3226
|
}
|
|
3506
3227
|
);
|
|
3507
3228
|
}
|
|
3508
|
-
listScheduleRuns(scheduleId,
|
|
3229
|
+
listScheduleRuns(scheduleId, input = {}) {
|
|
3509
3230
|
const query = new URLSearchParams();
|
|
3510
|
-
if (
|
|
3231
|
+
if (input.limit !== void 0) query.set("limit", String(input.limit));
|
|
3511
3232
|
return this.request(
|
|
3512
3233
|
`/schedules/${encodeURIComponent(scheduleId)}/runs${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
3513
3234
|
);
|
|
3514
3235
|
}
|
|
3515
|
-
runScheduleNow(scheduleId,
|
|
3236
|
+
runScheduleNow(scheduleId, input = {}) {
|
|
3516
3237
|
return this.request(
|
|
3517
3238
|
`/schedules/${encodeURIComponent(scheduleId)}/run`,
|
|
3518
3239
|
{
|
|
3519
3240
|
method: "POST",
|
|
3520
|
-
body: JSON.stringify(
|
|
3241
|
+
body: JSON.stringify(input)
|
|
3521
3242
|
}
|
|
3522
3243
|
);
|
|
3523
3244
|
}
|
|
3524
|
-
listTemplateBuilds(
|
|
3525
|
-
const query = new URLSearchParams({ teamId:
|
|
3245
|
+
listTemplateBuilds(input) {
|
|
3246
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3526
3247
|
return this.requestApiRoot(
|
|
3527
3248
|
`/sandbox-template-builds?${query.toString()}`
|
|
3528
3249
|
).then((payload) => payload.builds);
|
|
3529
3250
|
}
|
|
3530
|
-
createTemplateBuild(
|
|
3251
|
+
createTemplateBuild(input) {
|
|
3531
3252
|
return this.requestApiRoot(
|
|
3532
3253
|
"/sandbox-template-builds",
|
|
3533
3254
|
{
|
|
3534
3255
|
method: "POST",
|
|
3535
|
-
body: JSON.stringify(
|
|
3256
|
+
body: JSON.stringify(input)
|
|
3536
3257
|
}
|
|
3537
3258
|
).then((payload) => payload.build);
|
|
3538
3259
|
}
|
|
@@ -3554,18 +3275,18 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3554
3275
|
}
|
|
3555
3276
|
).then((payload) => payload.build);
|
|
3556
3277
|
}
|
|
3557
|
-
listPublishedSnapshotBuilds(
|
|
3558
|
-
const query = new URLSearchParams({ teamId:
|
|
3278
|
+
listPublishedSnapshotBuilds(input) {
|
|
3279
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
3559
3280
|
return this.requestApiRoot(
|
|
3560
3281
|
`/published-snapshot-builds?${query.toString()}`
|
|
3561
3282
|
).then((payload) => payload.builds);
|
|
3562
3283
|
}
|
|
3563
|
-
createPublishedSnapshotBuild(
|
|
3284
|
+
createPublishedSnapshotBuild(input) {
|
|
3564
3285
|
return this.requestApiRoot(
|
|
3565
3286
|
"/published-snapshot-builds",
|
|
3566
3287
|
{
|
|
3567
3288
|
method: "POST",
|
|
3568
|
-
body: JSON.stringify(
|
|
3289
|
+
body: JSON.stringify(input)
|
|
3569
3290
|
}
|
|
3570
3291
|
).then((payload) => payload.build);
|
|
3571
3292
|
}
|
|
@@ -3592,10 +3313,10 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3592
3313
|
"/organizations"
|
|
3593
3314
|
).then((payload) => payload.organizations ?? payload.teams ?? []);
|
|
3594
3315
|
}
|
|
3595
|
-
createOrganization(
|
|
3316
|
+
createOrganization(input) {
|
|
3596
3317
|
return this.requestApiRoot("/organizations", {
|
|
3597
3318
|
method: "POST",
|
|
3598
|
-
body: JSON.stringify(
|
|
3319
|
+
body: JSON.stringify(input)
|
|
3599
3320
|
}).then((payload) => payload.organization);
|
|
3600
3321
|
}
|
|
3601
3322
|
getOrganization(slug) {
|
|
@@ -3603,12 +3324,12 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3603
3324
|
`/organizations/${encodeURIComponent(slug)}`
|
|
3604
3325
|
).then((payload) => payload.organization);
|
|
3605
3326
|
}
|
|
3606
|
-
updateOrganization(slug,
|
|
3327
|
+
updateOrganization(slug, input) {
|
|
3607
3328
|
return this.requestApiRoot(
|
|
3608
3329
|
`/organizations/${encodeURIComponent(slug)}`,
|
|
3609
3330
|
{
|
|
3610
3331
|
method: "PATCH",
|
|
3611
|
-
body: JSON.stringify(
|
|
3332
|
+
body: JSON.stringify(input)
|
|
3612
3333
|
}
|
|
3613
3334
|
).then((payload) => payload.organization);
|
|
3614
3335
|
}
|
|
@@ -3617,12 +3338,12 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3617
3338
|
`/organizations/${encodeURIComponent(slug)}/members`
|
|
3618
3339
|
).then((payload) => payload.members);
|
|
3619
3340
|
}
|
|
3620
|
-
upsertOrganizationMember(slug,
|
|
3341
|
+
upsertOrganizationMember(slug, input) {
|
|
3621
3342
|
return this.requestApiRoot(
|
|
3622
3343
|
`/organizations/${encodeURIComponent(slug)}/members`,
|
|
3623
3344
|
{
|
|
3624
3345
|
method: "POST",
|
|
3625
|
-
body: JSON.stringify(
|
|
3346
|
+
body: JSON.stringify(input)
|
|
3626
3347
|
}
|
|
3627
3348
|
).then((payload) => payload.member);
|
|
3628
3349
|
}
|
|
@@ -3631,12 +3352,12 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3631
3352
|
`/organizations/${encodeURIComponent(slug)}/mcp-server`
|
|
3632
3353
|
).then((payload) => payload.mcpServer);
|
|
3633
3354
|
}
|
|
3634
|
-
generateOrganizationMcpServer(slug,
|
|
3355
|
+
generateOrganizationMcpServer(slug, input = {}) {
|
|
3635
3356
|
return this.requestApiRoot(
|
|
3636
3357
|
`/organizations/${encodeURIComponent(slug)}/mcp-server`,
|
|
3637
3358
|
{
|
|
3638
3359
|
method: "POST",
|
|
3639
|
-
body: JSON.stringify(
|
|
3360
|
+
body: JSON.stringify(input)
|
|
3640
3361
|
}
|
|
3641
3362
|
).then((payload) => payload.mcpServer);
|
|
3642
3363
|
}
|
|
@@ -3664,11 +3385,11 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3664
3385
|
}
|
|
3665
3386
|
).then((payload) => payload.mcpServer);
|
|
3666
3387
|
}
|
|
3667
|
-
startReplay(
|
|
3388
|
+
startReplay(input) {
|
|
3668
3389
|
const query = new URLSearchParams();
|
|
3669
|
-
if (
|
|
3670
|
-
if (
|
|
3671
|
-
const { teamId: _teamId, projectId: _projectId, ...body } =
|
|
3390
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3391
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3392
|
+
const { teamId: _teamId, projectId: _projectId, ...body } = input;
|
|
3672
3393
|
return this.requestApiRoot(
|
|
3673
3394
|
`/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
3674
3395
|
{
|
|
@@ -3677,42 +3398,42 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3677
3398
|
}
|
|
3678
3399
|
);
|
|
3679
3400
|
}
|
|
3680
|
-
listReplays(
|
|
3401
|
+
listReplays(input = {}) {
|
|
3681
3402
|
const query = new URLSearchParams();
|
|
3682
|
-
if (
|
|
3683
|
-
if (
|
|
3403
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3404
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3684
3405
|
return this.requestApiRoot(
|
|
3685
3406
|
`/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
3686
3407
|
);
|
|
3687
3408
|
}
|
|
3688
|
-
getReplay(replayId,
|
|
3409
|
+
getReplay(replayId, input = {}) {
|
|
3689
3410
|
const query = new URLSearchParams();
|
|
3690
|
-
if (
|
|
3691
|
-
if (
|
|
3411
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3412
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3692
3413
|
return this.requestApiRoot(
|
|
3693
3414
|
`/sandbox-replays/${encodeURIComponent(replayId)}${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
3694
3415
|
);
|
|
3695
3416
|
}
|
|
3696
|
-
getReplayLogs(replayId,
|
|
3417
|
+
getReplayLogs(replayId, input = {}) {
|
|
3697
3418
|
const query = new URLSearchParams();
|
|
3698
|
-
if (
|
|
3699
|
-
if (
|
|
3419
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3420
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3700
3421
|
return this.requestApiRoot(
|
|
3701
3422
|
`/sandbox-replays/${encodeURIComponent(replayId)}/logs${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
3702
3423
|
);
|
|
3703
3424
|
}
|
|
3704
|
-
getReplayArtifacts(replayId,
|
|
3425
|
+
getReplayArtifacts(replayId, input = {}) {
|
|
3705
3426
|
const query = new URLSearchParams();
|
|
3706
|
-
if (
|
|
3707
|
-
if (
|
|
3427
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3428
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3708
3429
|
return this.requestApiRoot(
|
|
3709
3430
|
`/sandbox-replays/${encodeURIComponent(replayId)}/artifacts${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
3710
3431
|
);
|
|
3711
3432
|
}
|
|
3712
|
-
cancelReplay(replayId,
|
|
3433
|
+
cancelReplay(replayId, input = {}) {
|
|
3713
3434
|
const query = new URLSearchParams();
|
|
3714
|
-
if (
|
|
3715
|
-
if (
|
|
3435
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3436
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3716
3437
|
return this.requestApiRoot(
|
|
3717
3438
|
`/sandbox-replays/${encodeURIComponent(replayId)}/cancel${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
3718
3439
|
{
|
|
@@ -3720,12 +3441,12 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
3720
3441
|
}
|
|
3721
3442
|
);
|
|
3722
3443
|
}
|
|
3723
|
-
integrationConnections(
|
|
3444
|
+
integrationConnections(input = {}) {
|
|
3724
3445
|
const query = new URLSearchParams();
|
|
3725
|
-
if (
|
|
3726
|
-
if (
|
|
3727
|
-
if (
|
|
3728
|
-
if (
|
|
3446
|
+
if (input.teamId) query.set("teamId", input.teamId);
|
|
3447
|
+
if (input.projectId) query.set("projectId", input.projectId);
|
|
3448
|
+
if (input.agentId) query.set("agentId", input.agentId);
|
|
3449
|
+
if (input.status) query.set("status", input.status);
|
|
3729
3450
|
return this.requestApiRoot(
|
|
3730
3451
|
`/integrations/connections${query.size > 0 ? `?${query.toString()}` : ""}`
|
|
3731
3452
|
);
|
|
@@ -3753,361 +3474,15 @@ var SANDBOX_RUNTIME_PROFILE_IDS = [
|
|
|
3753
3474
|
"openpond-coding-core-v1"
|
|
3754
3475
|
];
|
|
3755
3476
|
|
|
3756
|
-
// src/cli/common/sandbox-options.ts
|
|
3757
|
-
var SANDBOX_WORKFLOW_MODES = [
|
|
3758
|
-
"readonly",
|
|
3759
|
-
"attempt",
|
|
3760
|
-
"feature",
|
|
3761
|
-
"rollout",
|
|
3762
|
-
"replay",
|
|
3763
|
-
"template_build",
|
|
3764
|
-
"scheduled_run",
|
|
3765
|
-
"patch_only",
|
|
3766
|
-
"hotfix",
|
|
3767
|
-
"multi_feature_batch"
|
|
3768
|
-
];
|
|
3769
|
-
var SANDBOX_RUNTIME_PROMOTION_POLICIES = ["none", "manual", "auto_after_checks"];
|
|
3770
|
-
var SANDBOX_RUNTIME_PROFILES = [
|
|
3771
|
-
...SANDBOX_RUNTIME_PROFILE_IDS
|
|
3772
|
-
];
|
|
3773
|
-
function resolveSandboxBaseUrl(config, options) {
|
|
3774
|
-
const envName = typeof options.env === "string" ? options.env.trim().toLowerCase() : typeof options.environment === "string" ? options.environment.trim().toLowerCase() : "";
|
|
3775
|
-
if (envName === "staging") {
|
|
3776
|
-
return "https://api-new.staging-api.openpond.ai";
|
|
3777
|
-
}
|
|
3778
|
-
if (envName && envName !== "production") {
|
|
3779
|
-
throw new Error("sandbox env must be staging or production");
|
|
3780
|
-
}
|
|
3781
|
-
const base = process.env.OPENPOND_SANDBOX_BASE_URL || process.env.OPENPOND_API_URL || config.apiBaseUrl || mapUiBaseToApiBase(process.env.OPENPOND_BASE_URL || config.baseUrl) || DEFAULT_OPENPOND_API_BASE_URL;
|
|
3782
|
-
return base.replace(/\/$/, "");
|
|
3783
|
-
}
|
|
3784
|
-
async function resolveSandboxClient(options) {
|
|
3785
|
-
const config = await loadConfig();
|
|
3786
|
-
const uiBase = resolveBaseUrl(config);
|
|
3787
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
3788
|
-
const sandboxApiUrl = resolveSandboxApiUrlOption(options) || process.env.OPENPOND_SANDBOX_API_URL?.trim() || null;
|
|
3789
|
-
return createOpenPondSandboxClient(
|
|
3790
|
-
sandboxApiUrl ? { apiKey, sandboxApiUrl } : { apiKey, baseUrl: resolveSandboxBaseUrl(config, options) }
|
|
3791
|
-
);
|
|
3792
|
-
}
|
|
3793
|
-
function parseSandboxWorkflowModeOption(value) {
|
|
3794
|
-
if (value === void 0) return void 0;
|
|
3795
|
-
if (typeof value !== "string" || !value.trim()) {
|
|
3796
|
-
throw new Error("workflow-mode must be a non-empty value");
|
|
3797
|
-
}
|
|
3798
|
-
const mode = value.trim();
|
|
3799
|
-
if (!SANDBOX_WORKFLOW_MODES.includes(mode)) {
|
|
3800
|
-
throw new Error(
|
|
3801
|
-
`workflow-mode must be one of ${SANDBOX_WORKFLOW_MODES.join(", ")}`
|
|
3802
|
-
);
|
|
3803
|
-
}
|
|
3804
|
-
return mode;
|
|
3805
|
-
}
|
|
3806
|
-
function parseSandboxRuntimePromotionPolicyOption(value) {
|
|
3807
|
-
if (value === void 0) return void 0;
|
|
3808
|
-
if (typeof value !== "string" || !value.trim()) {
|
|
3809
|
-
throw new Error("runtime-promotion-policy must be a non-empty value");
|
|
3810
|
-
}
|
|
3811
|
-
const policy = value.trim();
|
|
3812
|
-
if (!SANDBOX_RUNTIME_PROMOTION_POLICIES.includes(policy)) {
|
|
3813
|
-
throw new Error(
|
|
3814
|
-
`runtime-promotion-policy must be one of ${SANDBOX_RUNTIME_PROMOTION_POLICIES.join(
|
|
3815
|
-
", "
|
|
3816
|
-
)}`
|
|
3817
|
-
);
|
|
3818
|
-
}
|
|
3819
|
-
return policy;
|
|
3820
|
-
}
|
|
3821
|
-
function parseSandboxRuntimeProfileIdOption(value) {
|
|
3822
|
-
if (typeof value !== "string" || !value.trim()) return void 0;
|
|
3823
|
-
const runtimeProfileId = value.trim();
|
|
3824
|
-
if (!SANDBOX_RUNTIME_PROFILES.includes(runtimeProfileId)) {
|
|
3825
|
-
throw new Error(
|
|
3826
|
-
`runtime-profile-id must be one of ${SANDBOX_RUNTIME_PROFILES.join(
|
|
3827
|
-
", "
|
|
3828
|
-
)}`
|
|
3829
|
-
);
|
|
3830
|
-
}
|
|
3831
|
-
return runtimeProfileId;
|
|
3832
|
-
}
|
|
3833
|
-
function parseSandboxEnvOptions(options) {
|
|
3834
|
-
const refs = parseSandboxEnvAssignments(options.envRef, "env-ref").map(
|
|
3835
|
-
({ name, value }) => ({ name, secretRef: value })
|
|
3836
|
-
);
|
|
3837
|
-
const literals = parseSandboxEnvAssignments(
|
|
3838
|
-
options.envLiteral,
|
|
3839
|
-
"env-literal"
|
|
3840
|
-
).map(({ name, value }) => {
|
|
3841
|
-
if (isSecretLikeEnvName(name) && !parseBooleanOption(options.allowPlainSecretEnv)) {
|
|
3842
|
-
throw new Error(
|
|
3843
|
-
`refusing plaintext value for secret-like env ${name}; create a sandbox secret and pass --env-ref ${name}=openpond://secret/...`
|
|
3844
|
-
);
|
|
3845
|
-
}
|
|
3846
|
-
return { name, value };
|
|
3847
|
-
});
|
|
3848
|
-
const env = [...refs, ...literals];
|
|
3849
|
-
const names = /* @__PURE__ */ new Set();
|
|
3850
|
-
for (const item of env) {
|
|
3851
|
-
if (names.has(item.name)) {
|
|
3852
|
-
throw new Error(`duplicate sandbox env var: ${item.name}`);
|
|
3853
|
-
}
|
|
3854
|
-
names.add(item.name);
|
|
3855
|
-
}
|
|
3856
|
-
return env;
|
|
3857
|
-
}
|
|
3858
|
-
function parseSandboxTemplateEnvOptions(manifest, options) {
|
|
3859
|
-
const env = parseSandboxEnvOptions(options);
|
|
3860
|
-
const provided = new Set(env.map((item) => item.name));
|
|
3861
|
-
const providedByName = new Map(env.map((item) => [item.name, item]));
|
|
3862
|
-
for (const requirement of manifest.inputs.env) {
|
|
3863
|
-
const value = providedByName.get(requirement.name);
|
|
3864
|
-
if (value?.value !== void 0 && requirement.secret !== false) {
|
|
3865
|
-
throw new Error(
|
|
3866
|
-
`sandbox template env ${requirement.name} requires a secret ref. Pass --env-ref ${requirement.name}=openpond://secret/...`
|
|
3867
|
-
);
|
|
3868
|
-
}
|
|
3869
|
-
}
|
|
3870
|
-
const missing = manifest.inputs.env.filter((item) => item.required && !provided.has(item.name)).map((item) => item.name);
|
|
3871
|
-
if (missing.length > 0) {
|
|
3872
|
-
throw new Error(
|
|
3873
|
-
`missing required sandbox template env refs: ${missing.join(
|
|
3874
|
-
", "
|
|
3875
|
-
)}. Pass --env-ref NAME=openpond://secret/...`
|
|
3876
|
-
);
|
|
3877
|
-
}
|
|
3878
|
-
return env;
|
|
3879
|
-
}
|
|
3880
|
-
function parseSandboxEnvAssignments(value, label) {
|
|
3881
|
-
if (typeof value !== "string") return [];
|
|
3882
|
-
return value.split(",").map((item) => item.trim()).filter(Boolean).map((item) => {
|
|
3883
|
-
const separator = item.indexOf("=");
|
|
3884
|
-
if (separator <= 0) {
|
|
3885
|
-
throw new Error(`${label} entries must use NAME=value`);
|
|
3886
|
-
}
|
|
3887
|
-
const name = item.slice(0, separator).trim();
|
|
3888
|
-
const entryValue = item.slice(separator + 1).trim();
|
|
3889
|
-
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
|
|
3890
|
-
throw new Error(`${label} has invalid env name: ${name}`);
|
|
3891
|
-
}
|
|
3892
|
-
if (!entryValue) {
|
|
3893
|
-
throw new Error(`${label} value is required for ${name}`);
|
|
3894
|
-
}
|
|
3895
|
-
return { name, value: entryValue };
|
|
3896
|
-
});
|
|
3897
|
-
}
|
|
3898
|
-
function isSecretLikeEnvName(name) {
|
|
3899
|
-
return /(?:SECRET|TOKEN|KEY|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|DATABASE_URL|DSN)/i.test(
|
|
3900
|
-
name
|
|
3901
|
-
);
|
|
3902
|
-
}
|
|
3903
|
-
async function readSandboxSecretValue(options, label) {
|
|
3904
|
-
if (typeof options.value === "string" || typeof options.secretValue === "string") {
|
|
3905
|
-
throw new Error(
|
|
3906
|
-
"sandbox secret values must be provided with --stdin or the masked prompt"
|
|
3907
|
-
);
|
|
3908
|
-
}
|
|
3909
|
-
const useStdin = parseBooleanOption(options.stdin);
|
|
3910
|
-
if (useStdin) {
|
|
3911
|
-
const value2 = await readAllStdin();
|
|
3912
|
-
if (!value2) throw new Error(`${label} read no secret value from stdin`);
|
|
3913
|
-
return value2;
|
|
3914
|
-
}
|
|
3915
|
-
if (!process.stdin.isTTY) {
|
|
3916
|
-
throw new Error(`${label} requires --stdin when not running in a TTY`);
|
|
3917
|
-
}
|
|
3918
|
-
const value = await readMaskedLine(`${label}: `);
|
|
3919
|
-
if (!value) throw new Error(`${label} cannot be empty`);
|
|
3920
|
-
return value;
|
|
3921
|
-
}
|
|
3922
|
-
function summarizeSandboxSecret(secret) {
|
|
3923
|
-
return {
|
|
3924
|
-
id: secret.id,
|
|
3925
|
-
teamId: secret.teamId,
|
|
3926
|
-
name: secret.name,
|
|
3927
|
-
scope: secret.scope,
|
|
3928
|
-
status: secret.status,
|
|
3929
|
-
secretRef: secret.secretRef,
|
|
3930
|
-
currentVersion: secret.currentVersion,
|
|
3931
|
-
updatedAt: secret.updatedAt,
|
|
3932
|
-
lastUsedAt: secret.lastUsedAt,
|
|
3933
|
-
attachedDestinations: secret.attachments?.length ?? 0
|
|
3934
|
-
};
|
|
3935
|
-
}
|
|
3936
|
-
|
|
3937
|
-
// ../../packages/cloud/src/process-runner.ts
|
|
3938
|
-
import { Buffer as Buffer2 } from "node:buffer";
|
|
3939
|
-
import { spawn } from "node:child_process";
|
|
3940
|
-
var DEFAULT_PROCESS_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
3941
|
-
var DEFAULT_PROCESS_MAX_OUTPUT_BYTES = 2 * 1024 * 1024;
|
|
3942
|
-
function runProcessCommand(command, args = [], options = {}) {
|
|
3943
|
-
if (options.inherit && options.terminateWhenStdoutIncludes !== void 0) {
|
|
3944
|
-
return Promise.reject(new Error("terminateWhenStdoutIncludes requires captured stdout"));
|
|
3945
|
-
}
|
|
3946
|
-
if (options.terminateWhenStdoutIncludes === "") {
|
|
3947
|
-
return Promise.reject(new Error("terminateWhenStdoutIncludes must not be empty"));
|
|
3948
|
-
}
|
|
3949
|
-
return new Promise((resolve, reject) => {
|
|
3950
|
-
const proc = spawn(command, args, {
|
|
3951
|
-
cwd: options.cwd,
|
|
3952
|
-
env: options.env ? { ...process.env, ...options.env } : void 0,
|
|
3953
|
-
shell: options.shell,
|
|
3954
|
-
detached: options.detached ?? process.platform !== "win32",
|
|
3955
|
-
stdio: options.inherit ? "inherit" : [options.stdin === void 0 ? "ignore" : "pipe", "pipe", "pipe"]
|
|
3956
|
-
});
|
|
3957
|
-
const stdout = new BoundedOutput(maxOutputBytes(options));
|
|
3958
|
-
const stderr = new BoundedOutput(maxOutputBytes(options));
|
|
3959
|
-
let timedOut = false;
|
|
3960
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_PROCESS_TIMEOUT_MS;
|
|
3961
|
-
let timeout;
|
|
3962
|
-
let forceKill;
|
|
3963
|
-
let requestedTermination = null;
|
|
3964
|
-
let settled = false;
|
|
3965
|
-
const clearTimers = () => {
|
|
3966
|
-
if (timeout) clearTimeout(timeout);
|
|
3967
|
-
if (forceKill) clearTimeout(forceKill);
|
|
3968
|
-
};
|
|
3969
|
-
const requestTermination = (reason) => {
|
|
3970
|
-
if (requestedTermination !== null || settled) return;
|
|
3971
|
-
requestedTermination = reason;
|
|
3972
|
-
timedOut = reason === "timeout";
|
|
3973
|
-
if (timeout) {
|
|
3974
|
-
clearTimeout(timeout);
|
|
3975
|
-
timeout = void 0;
|
|
3976
|
-
}
|
|
3977
|
-
terminateProcessTree(proc.pid, "SIGTERM");
|
|
3978
|
-
forceKill = setTimeout(() => {
|
|
3979
|
-
if (proc.exitCode === null && proc.signalCode === null) terminateProcessTree(proc.pid, "SIGKILL");
|
|
3980
|
-
}, 5e3);
|
|
3981
|
-
};
|
|
3982
|
-
if (timeoutMs > 0) {
|
|
3983
|
-
timeout = setTimeout(() => {
|
|
3984
|
-
requestTermination("timeout");
|
|
3985
|
-
}, timeoutMs);
|
|
3986
|
-
}
|
|
3987
|
-
if (!options.inherit) {
|
|
3988
|
-
proc.stdout?.on("data", (chunk) => {
|
|
3989
|
-
stdout.append(chunk);
|
|
3990
|
-
const marker = options.terminateWhenStdoutIncludes;
|
|
3991
|
-
if (marker !== void 0 && stdout.text().includes(marker)) {
|
|
3992
|
-
requestTermination("output");
|
|
3993
|
-
}
|
|
3994
|
-
});
|
|
3995
|
-
proc.stderr?.on("data", (chunk) => {
|
|
3996
|
-
stderr.append(chunk);
|
|
3997
|
-
});
|
|
3998
|
-
}
|
|
3999
|
-
proc.on("error", (error) => {
|
|
4000
|
-
clearTimers();
|
|
4001
|
-
settled = true;
|
|
4002
|
-
reject(error);
|
|
4003
|
-
});
|
|
4004
|
-
proc.on("close", (code, signal) => {
|
|
4005
|
-
if (settled) return;
|
|
4006
|
-
settled = true;
|
|
4007
|
-
clearTimers();
|
|
4008
|
-
resolve({
|
|
4009
|
-
code,
|
|
4010
|
-
signal,
|
|
4011
|
-
terminationReason: requestedTermination ?? (signal ? "signal" : "exit"),
|
|
4012
|
-
stdout: stdout.text(),
|
|
4013
|
-
stderr: stderr.text(),
|
|
4014
|
-
timedOut,
|
|
4015
|
-
stdoutTruncated: stdout.truncated,
|
|
4016
|
-
stderrTruncated: stderr.truncated
|
|
4017
|
-
});
|
|
4018
|
-
});
|
|
4019
|
-
if (options.stdin !== void 0) {
|
|
4020
|
-
proc.stdin?.end(options.stdin);
|
|
4021
|
-
}
|
|
4022
|
-
});
|
|
4023
|
-
}
|
|
4024
|
-
var BoundedOutput = class {
|
|
4025
|
-
#chunks = [];
|
|
4026
|
-
#maxBytes;
|
|
4027
|
-
#bytes = 0;
|
|
4028
|
-
truncated = false;
|
|
4029
|
-
constructor(maxBytes) {
|
|
4030
|
-
this.#maxBytes = maxBytes;
|
|
4031
|
-
}
|
|
4032
|
-
append(value) {
|
|
4033
|
-
const chunk = Buffer2.isBuffer(value) ? value : Buffer2.from(value);
|
|
4034
|
-
const remaining = this.#maxBytes - this.#bytes;
|
|
4035
|
-
if (remaining <= 0) {
|
|
4036
|
-
if (chunk.byteLength > 0) this.truncated = true;
|
|
4037
|
-
return;
|
|
4038
|
-
}
|
|
4039
|
-
if (chunk.byteLength <= remaining) {
|
|
4040
|
-
this.#chunks.push(chunk);
|
|
4041
|
-
this.#bytes += chunk.byteLength;
|
|
4042
|
-
return;
|
|
4043
|
-
}
|
|
4044
|
-
this.#chunks.push(chunk.subarray(0, remaining));
|
|
4045
|
-
this.#bytes += remaining;
|
|
4046
|
-
this.truncated = true;
|
|
4047
|
-
}
|
|
4048
|
-
text() {
|
|
4049
|
-
const value = Buffer2.concat(this.#chunks, this.#bytes).toString("utf8");
|
|
4050
|
-
return this.truncated ? `${value}
|
|
4051
|
-
[truncated after ${this.#maxBytes} bytes]
|
|
4052
|
-
` : value;
|
|
4053
|
-
}
|
|
4054
|
-
};
|
|
4055
|
-
function maxOutputBytes(options) {
|
|
4056
|
-
const value = options.maxOutputBytes ?? DEFAULT_PROCESS_MAX_OUTPUT_BYTES;
|
|
4057
|
-
return Math.max(0, Math.floor(value));
|
|
4058
|
-
}
|
|
4059
|
-
function terminateProcessTree(pid, signal) {
|
|
4060
|
-
if (!pid) return;
|
|
4061
|
-
if (process.platform === "win32") {
|
|
4062
|
-
const args = ["/PID", String(pid), "/T"];
|
|
4063
|
-
if (signal === "SIGKILL") args.push("/F");
|
|
4064
|
-
const killer = spawn("taskkill", args, { stdio: "ignore", windowsHide: true });
|
|
4065
|
-
killer.unref();
|
|
4066
|
-
return;
|
|
4067
|
-
}
|
|
4068
|
-
try {
|
|
4069
|
-
process.kill(-pid, signal);
|
|
4070
|
-
} catch (error) {
|
|
4071
|
-
if (error.code !== "ESRCH") throw error;
|
|
4072
|
-
}
|
|
4073
|
-
}
|
|
4074
|
-
|
|
4075
|
-
// src/cli/common/shell.ts
|
|
4076
|
-
async function runCommand(command, args, options = {}) {
|
|
4077
|
-
return runProcessCommand(command, args, {
|
|
4078
|
-
cwd: options.cwd,
|
|
4079
|
-
inherit: options.inherit,
|
|
4080
|
-
timeoutMs: options.timeoutMs,
|
|
4081
|
-
maxOutputBytes: options.maxOutputBytes,
|
|
4082
|
-
terminateWhenStdoutIncludes: options.terminateWhenStdoutIncludes
|
|
4083
|
-
});
|
|
4084
|
-
}
|
|
4085
|
-
async function runShellCommand(command, options = {}) {
|
|
4086
|
-
const timeoutMs = options.timeoutSeconds === void 0 ? void 0 : options.timeoutSeconds * 1e3;
|
|
4087
|
-
return runProcessCommand(command, [], {
|
|
4088
|
-
cwd: options.cwd,
|
|
4089
|
-
env: options.env,
|
|
4090
|
-
shell: true,
|
|
4091
|
-
inherit: options.inherit,
|
|
4092
|
-
timeoutMs,
|
|
4093
|
-
maxOutputBytes: options.maxOutputBytes
|
|
4094
|
-
});
|
|
4095
|
-
}
|
|
4096
|
-
async function getGitRemoteUrl(cwd, remoteName) {
|
|
4097
|
-
const result = await runCommand("git", ["remote", "get-url", remoteName], {
|
|
4098
|
-
cwd
|
|
4099
|
-
});
|
|
4100
|
-
if (result.code !== 0) return null;
|
|
4101
|
-
const url = result.stdout.trim();
|
|
4102
|
-
return url.length > 0 ? url : null;
|
|
4103
|
-
}
|
|
4104
|
-
|
|
4105
3477
|
export {
|
|
4106
3478
|
apiFetch,
|
|
4107
3479
|
readApiJson,
|
|
4108
3480
|
deployApp,
|
|
3481
|
+
getDeploymentLogs,
|
|
3482
|
+
getDeploymentStatus,
|
|
4109
3483
|
getLatestDeploymentForApp,
|
|
4110
3484
|
getDeploymentDetail,
|
|
3485
|
+
listApps,
|
|
4111
3486
|
createRepo,
|
|
4112
3487
|
updateAppCodeVisibility,
|
|
4113
3488
|
createHeadlessApps,
|
|
@@ -4116,6 +3491,7 @@ export {
|
|
|
4116
3491
|
deployLatestTemplate,
|
|
4117
3492
|
updateAppEnvironment,
|
|
4118
3493
|
getAppEnvironment,
|
|
3494
|
+
listUserTools,
|
|
4119
3495
|
createAgentFromPrompt,
|
|
4120
3496
|
getUserPerformance,
|
|
4121
3497
|
getAppRuntimeSummary,
|
|
@@ -4123,44 +3499,24 @@ export {
|
|
|
4123
3499
|
checkOpenPondApiHealth,
|
|
4124
3500
|
runAssistantMode,
|
|
4125
3501
|
executeUserTool,
|
|
4126
|
-
submitPositionsTx,
|
|
4127
3502
|
submitBacktestRun,
|
|
4128
3503
|
submitBacktestTx,
|
|
4129
3504
|
submitBacktestDetail,
|
|
4130
3505
|
executeHostedTool,
|
|
4131
3506
|
openPondConfigDirectory,
|
|
4132
3507
|
writePrivateJsonFile,
|
|
3508
|
+
updatePrivateJsonFile,
|
|
4133
3509
|
loadGlobalConfig,
|
|
4134
3510
|
loadConfig,
|
|
4135
3511
|
listConfiguredProfiles,
|
|
4136
3512
|
setActiveProfile,
|
|
4137
3513
|
saveProfileApiKey,
|
|
4138
3514
|
saveGlobalConfig,
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
warnOnRepoHostMismatch,
|
|
4147
|
-
normalizeRepoName,
|
|
4148
|
-
fetchAppsWithCache,
|
|
4149
|
-
fetchToolsWithCache,
|
|
4150
|
-
resolveAppTarget,
|
|
4151
|
-
pollDeploymentLogs,
|
|
4152
|
-
promptConfirm,
|
|
4153
|
-
promptForPath,
|
|
4154
|
-
resolveSandboxClient,
|
|
4155
|
-
parseSandboxWorkflowModeOption,
|
|
4156
|
-
parseSandboxRuntimePromotionPolicyOption,
|
|
4157
|
-
parseSandboxRuntimeProfileIdOption,
|
|
4158
|
-
parseSandboxEnvOptions,
|
|
4159
|
-
parseSandboxTemplateEnvOptions,
|
|
4160
|
-
readSandboxSecretValue,
|
|
4161
|
-
summarizeSandboxSecret,
|
|
4162
|
-
runProcessCommand,
|
|
4163
|
-
runCommand,
|
|
4164
|
-
runShellCommand,
|
|
4165
|
-
getGitRemoteUrl
|
|
3515
|
+
DEFAULT_CACHE_TTL_MS,
|
|
3516
|
+
getCachedApps,
|
|
3517
|
+
setCachedApps,
|
|
3518
|
+
getCachedTools,
|
|
3519
|
+
setCachedTools,
|
|
3520
|
+
createOpenPondSandboxClient,
|
|
3521
|
+
SANDBOX_RUNTIME_PROFILE_IDS
|
|
4166
3522
|
};
|