openpond 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/actions-command-QP3NMDK4.js +2 -0
- package/dist/chunks/app-layer-N7VFRVJ2.js +3 -0
- package/dist/chunks/app-server-runtime-OCLPUI7F.js +2 -0
- package/dist/chunks/apps-AMG75TI4.js +2 -0
- package/dist/chunks/chunk-22UARBPW.js +3 -0
- package/dist/chunks/chunk-3A7HZJNE.js +1 -0
- package/dist/chunks/chunk-3M53YXEI.js +2 -0
- package/dist/chunks/chunk-3NDRIQTI.js +2 -0
- package/dist/chunks/chunk-5BBVEWG3.js +2 -0
- package/dist/chunks/chunk-5O7ZVCMV.js +6 -0
- package/dist/chunks/chunk-6FA3GG5B.js +33 -0
- package/dist/chunks/chunk-6MI4KKWF.js +2 -0
- package/dist/chunks/chunk-BBG546O6.js +6 -0
- package/dist/chunks/chunk-BX4J2VDU.js +2 -0
- package/dist/chunks/chunk-BZMVB3GS.js +2 -0
- package/dist/chunks/chunk-C5LOZSVS.js +2 -0
- package/dist/chunks/chunk-CWQWV2T3.js +2 -0
- package/dist/chunks/chunk-DUA3QP6Y.js +19 -0
- package/dist/chunks/chunk-EAPFMACH.js +10 -0
- package/dist/chunks/chunk-ES2ISFJC.js +66 -0
- package/dist/chunks/chunk-F65NIZLM.js +2199 -0
- package/dist/chunks/chunk-FGJ5LFPL.js +5 -0
- package/dist/chunks/chunk-FTQLQJQV.js +2 -0
- package/dist/chunks/chunk-FY7OQ5RK.js +24 -0
- package/dist/chunks/chunk-FYCJSUFV.js +53 -0
- package/dist/chunks/chunk-GLUWATL5.js +2 -0
- package/dist/chunks/chunk-H7IWJN7L.js +17 -0
- package/dist/chunks/chunk-HZP5U2AA.js +3 -0
- package/dist/chunks/chunk-I5K74TOH.js +3 -0
- package/dist/chunks/chunk-IR3YJWPW.js +7 -0
- package/dist/chunks/chunk-KU7QOHFT.js +2872 -0
- package/dist/chunks/chunk-KV553EWX.js +16 -0
- package/dist/chunks/chunk-MGN6GLNZ.js +2 -0
- package/dist/chunks/chunk-OG5Q6NXK.js +28 -0
- package/dist/chunks/chunk-OGPHXXCD.js +1 -0
- package/dist/chunks/chunk-PI36UHRA.js +18 -0
- package/dist/chunks/chunk-RWSAGQTP.js +2 -0
- package/dist/chunks/chunk-SAE4OIPC.js +2 -0
- package/dist/chunks/chunk-SDO4FC4Q.js +2 -0
- package/dist/chunks/chunk-UKUVMXOW.js +12 -0
- package/dist/chunks/chunk-VCLCFK3O.js +36 -0
- package/dist/chunks/chunk-VYUMTRB3.js +5 -0
- package/dist/chunks/chunk-X37KMV27.js +1 -0
- package/dist/chunks/chunk-XDHAGACI.js +3 -0
- package/dist/chunks/chunk-XEOEKFG6.js +71 -0
- package/dist/chunks/chunk-ZF7TEGY5.js +5 -0
- package/dist/chunks/chunk-ZVOO7FKM.js +2 -0
- package/dist/chunks/cli-M2FG7SSI.js +2 -0
- package/dist/chunks/configuration-command-XBKBIZBO.js +2 -0
- package/dist/chunks/continual-D75WA7E7.js +7 -0
- package/dist/chunks/core-commands-LUZVWXQR.js +2 -0
- package/dist/chunks/database-X2CUV732.js +2 -0
- package/dist/chunks/desktop-test-KGC4JVJ7.js +3 -0
- package/dist/chunks/dist-NKLXFA37.js +2 -0
- package/dist/chunks/extension-NQ7N5LEY.js +5 -0
- package/dist/chunks/help-MWK66XZK.js +8 -0
- package/dist/chunks/module-ES6BEMUI-ZVL3F6NW.js +2 -0
- package/dist/chunks/module-asyncify-2EFITU5U-R7TVXNAE.js +2 -0
- package/dist/chunks/opchat-XJZA3QKZ.js +3 -0
- package/dist/chunks/organizations-UECDFEYE.js +2 -0
- package/dist/chunks/profile-KUMIZURM.js +3 -0
- package/dist/chunks/project-agent-NILMJHLV.js +2 -0
- package/dist/chunks/sandbox-command-QHH65OSE.js +2 -0
- package/dist/chunks/sandbox-template-N7I63PNU.js +10 -0
- package/dist/chunks/src-724HF43W.js +82 -0
- package/dist/chunks/src-VTKTTKQO.js +319 -0
- package/dist/chunks/taskset-PISBOILQ.js +2 -0
- package/dist/chunks/teams-bot-UV4RU53M.js +3 -0
- package/dist/chunks/training-2NDOWH5S.js +2 -0
- package/dist/chunks/workspaces-XXT4KUD3.js +2 -0
- package/dist/cli.js +3 -109
- package/dist/index.js +1 -31230
- package/dist/sandbox-template/manifest.js +1 -18380
- package/dist/web/assets/App-DxecRQUL.js +176 -0
- package/dist/web/assets/AppDialog-B65Eo3gp.js +1 -0
- package/dist/web/assets/AppTerminalPanel-B2EKQM7W.js +2 -0
- package/dist/web/assets/{AppsView-B1NUuAIf.js → AppsView-BBoVe7s2.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-DOvYxXeP.js → BrowserSidebar-CSM1atSJ.js} +1 -1
- package/dist/web/assets/{CartesianChart-pOrYpzBr.js → CartesianChart-CJKfXiEG.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-CgbR-MBJ.js → CollaborationTabs-BMZamWFC.js} +1 -1
- package/dist/web/assets/{CommandMenu-CrIr4qUX.js → CommandMenu-B3U1z2eo.js} +1 -1
- package/dist/web/assets/{CommunityView-CvAVQ_HZ.js → CommunityView-CTyRUcfy.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-DybcKwwd.js → ComposerCreateImproveStrip-D7usvRtK.js} +1 -1
- package/dist/web/assets/GetStartedView-Ibu7oKWJ.js +1 -0
- package/dist/web/assets/HostedModelLearningReview-qnzIkT70.js +1 -0
- package/dist/web/assets/HostedModelLearningSettings--PKjpYsy.js +1 -0
- package/dist/web/assets/LabModelVersionDetailPage-s9uUN6fV.js +1 -0
- package/dist/web/assets/{LabSkillSidebar-CuaYrtiu.js → LabSkillSidebar-BKYseMiJ.js} +1 -1
- package/dist/web/assets/LabsRoute-C1FWCoYb.css +1 -0
- package/dist/web/assets/LabsRoute-DoRs0K6v.js +32 -0
- package/dist/web/assets/MainChatThread-DvuyMcMB.js +2 -0
- package/dist/web/assets/MainPane-BWwcxgHD.js +8 -0
- package/dist/web/assets/{MarkdownText-DOlVQR8a.js → MarkdownText-D8XC5UT_.js} +1 -1
- package/dist/web/assets/{Messages-DMubppta.js → Messages-e4A8JUjD.js} +6 -6
- package/dist/web/assets/{NativeSkillSidebar-DSFwZ-od.js → NativeSkillSidebar-D2Joh8XB.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-Dj0ePIJ-.js → NewExperienceSwitcher-CzGebt2E.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-B8NQV-Ji.js → NewProjectDialog-CdMTSxUE.js} +1 -1
- package/dist/web/assets/{OutputsPage-D_LDYTgV.js → OutputsPage-m7cSb8dW.js} +1 -1
- package/dist/web/assets/{ProjectsPage-xjDYPc_W.js → ProjectsPage-C9mz8W1g.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-B4LEqKEj.js +1 -0
- package/dist/web/assets/{RightSidebarHomePanel-j0VckZUu.js → RightSidebarHomePanel-DOeUsH7h.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-1aT4bBY-.js → ScheduledWorkPage-UXZSSWgA.js} +1 -1
- package/dist/web/assets/{SettingsView-BSpuMDpv.js → SettingsView-CQm1ai73.js} +7 -7
- package/dist/web/assets/TeamChatView-C4haojB7.js +3 -0
- package/dist/web/assets/{TerminalOverlay-CrSwUk2d.js → TerminalOverlay-p2GZsuyQ.js} +3 -3
- package/dist/web/assets/{TrainingCreationPanel-B4HMRwUg.js → TrainingCreationPanel-BYJSlO8X.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-D4r1tN3I.js → TrainingDraftPanel-DR5KlayH.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-2aymqwIM.js → UsageSettingsSection-BQToNXE4.js} +5 -5
- package/dist/web/assets/{WorkSidebarPanel-B0X0OiR6.js → WorkSidebarPanel--EeytWeg.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-BrovSYhn.js +14 -0
- package/dist/web/assets/{WorkspaceEnvironmentMenu-OAfMEt7L.js → WorkspaceEnvironmentMenu-l-keRgvj.js} +3 -3
- package/dist/web/assets/{WorkspaceGitDialogs-YxcPH2Rq.js → WorkspaceGitDialogs-aicWzaZu.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-COKTiQZl.js → WorkspaceMonacoEditor-CO_E74jM.js} +36 -36
- package/dist/web/assets/{arrow-up-right-_TX-awvK.js → arrow-up-right-rwPXNfVn.js} +1 -1
- package/dist/web/assets/chat-file-links-B3jDstSC.js +1 -0
- package/dist/web/assets/chevron-up-D089nvYQ.js +1 -0
- package/dist/web/assets/{clipboard-CyRSS8Sy.js → clipboard-DwEExyU4.js} +1 -1
- package/dist/web/assets/{cloud-upload-uBJBUYTy.js → cloud-upload-D2he0-vQ.js} +1 -1
- package/dist/web/assets/{cssMode-BrXSsZYs.js → cssMode-DS4k0NcI.js} +1 -1
- package/dist/web/assets/{folder-open-DktdZNW7.js → folder-open-CAOLduKD.js} +1 -1
- package/dist/web/assets/{folder-plus-DO06i9Vo.js → folder-plus-D56MrxVT.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-zFSIkPs7.js → git-commit-horizontal-CeNM0oKJ.js} +1 -1
- package/dist/web/assets/{htmlMode-X9UMFkjt.js → htmlMode-Xkni5erh.js} +1 -1
- package/dist/web/assets/{index-ByQIHpc9.css → index-BGMzUaup.css} +1 -1
- package/dist/web/assets/{index-UOGdfLzi.js → index-KwyAyscP.js} +1 -1
- package/dist/web/assets/{info-BEJXUqCD.js → info-CcrBaEE_.js} +1 -1
- package/dist/web/assets/{jsonMode-DIsB-j2E.js → jsonMode-C4YPbQB7.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-CmZ17KpA.js → lspLanguageFeatures-CF5oMTz6.js} +1 -1
- package/dist/web/assets/{minimize-2-DumTpFtE.js → minimize-2-DzHQnInk.js} +1 -1
- package/dist/web/assets/{monaco.contribution-DJ_NmcHu.js → monaco.contribution-0EN4mGCC.js} +2 -2
- package/dist/web/assets/{monaco.contribution-YVDfJcG4.js → monaco.contribution-B4qcTP0w.js} +2 -2
- package/dist/web/assets/{monaco.contribution-LZEujgny.js → monaco.contribution-CJK_NrBm.js} +2 -2
- package/dist/web/assets/{monaco.contribution-D6w5PJji.js → monaco.contribution-CkPGKNd-.js} +2 -2
- package/dist/web/assets/{play-CLFeH7CU.js → play-p3-AMTPL.js} +1 -1
- package/dist/web/assets/{python-Djbda_qZ.js → python-B0kpTxAZ.js} +1 -1
- package/dist/web/assets/{refresh-cw-B4IpQ_7Q.js → refresh-cw-_jbTIzzr.js} +1 -1
- package/dist/web/assets/{save-BbTHztnA.js → save-Cy6hEotx.js} +1 -1
- package/dist/web/assets/{square-BJrVbmz6.js → square-DKQkcrOH.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-BopU5W9S.js → toggleHighContrast-Bnk1VVVq.js} +1 -1
- package/dist/web/assets/{tsMode-CH_0_YDX.js → tsMode-BDrSVy7V.js} +1 -1
- package/dist/web/assets/{upload-UumVeufu.js → upload-COn0my_O.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-BRa23U7O.js → useLocalAgentSchedules-iZNB4Oee.js} +1 -1
- package/dist/web/assets/{wifi-off-BWJWivn6.js → wifi-off-Cqt-ZLXY.js} +1 -1
- package/dist/web/assets/{workers-pTe8RvSI.js → workers-hu0Ym93h.js} +1 -1
- package/dist/web/assets/{yaml-DNLASORn.js → yaml-D-JLDGL6.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +4 -3
- package/dist/chunks/actions-command-6N5XWMR6.js +0 -185
- package/dist/chunks/app-layer-F3CGXB33.js +0 -216
- package/dist/chunks/app-server-runtime-RHO5TFUC.js +0 -23
- package/dist/chunks/apps-L5XCL7QY.js +0 -429
- package/dist/chunks/chunk-26AMV5ZI.js +0 -634
- package/dist/chunks/chunk-3EB7I67T.js +0 -630
- package/dist/chunks/chunk-3ELF4FXY.js +0 -96
- package/dist/chunks/chunk-3VEYNDHN.js +0 -669
- package/dist/chunks/chunk-4KA25HUP.js +0 -5648
- package/dist/chunks/chunk-4L3ZJS2T.js +0 -1207
- package/dist/chunks/chunk-6SMNG6YA.js +0 -1303
- package/dist/chunks/chunk-7RIGZB7N.js +0 -1148
- package/dist/chunks/chunk-A6G3PFA5.js +0 -2164
- package/dist/chunks/chunk-BVY5JYM6.js +0 -512
- package/dist/chunks/chunk-DLQQIWN2.js +0 -648
- package/dist/chunks/chunk-FJ2JGB2N.js +0 -1373
- package/dist/chunks/chunk-FQS2QL5F.js +0 -14522
- package/dist/chunks/chunk-G65WAOJV.js +0 -1643
- package/dist/chunks/chunk-JTHL5XJ2.js +0 -1838
- package/dist/chunks/chunk-K4TZEHAW.js +0 -602
- package/dist/chunks/chunk-KCRCIQPD.js +0 -66
- package/dist/chunks/chunk-KSRWKXRB.js +0 -12
- package/dist/chunks/chunk-MUMPWI4O.js +0 -92
- package/dist/chunks/chunk-NTK22KJD.js +0 -10707
- package/dist/chunks/chunk-OCBRPU2K.js +0 -629
- package/dist/chunks/chunk-PS37DB5F.js +0 -183
- package/dist/chunks/chunk-R3C3MNSI.js +0 -140
- package/dist/chunks/chunk-SMNFI2FU.js +0 -113
- package/dist/chunks/chunk-UACZUFIA.js +0 -47
- package/dist/chunks/chunk-UZMVNKXM.js +0 -1275
- package/dist/chunks/chunk-VT6BLHMB.js +0 -67198
- package/dist/chunks/chunk-W5GKHH77.js +0 -168
- package/dist/chunks/chunk-X6F4LBTQ.js +0 -832
- package/dist/chunks/chunk-X7ZG4TSW.js +0 -3063
- package/dist/chunks/chunk-XA4KBDMY.js +0 -13723
- package/dist/chunks/chunk-YVCYVDNP.js +0 -746
- package/dist/chunks/chunk-ZNQEROWP.js +0 -254
- package/dist/chunks/cli-D2MUUBEX.js +0 -23
- package/dist/chunks/configuration-command-NR6JYIUD.js +0 -187
- package/dist/chunks/continual-37CE4LLJ.js +0 -803
- package/dist/chunks/core-commands-SWGIOZLW.js +0 -50
- package/dist/chunks/database-DEYUZDIM.js +0 -20
- package/dist/chunks/desktop-test-QOS7G5NE.js +0 -148
- package/dist/chunks/dist-AKYCQNNF.js +0 -187
- package/dist/chunks/extension-HJUJBQAD.js +0 -9378
- package/dist/chunks/help-J6PZ23IC.js +0 -67
- package/dist/chunks/opchat-ABX5YBAT.js +0 -169
- package/dist/chunks/organizations-CPNC47DO.js +0 -806
- package/dist/chunks/profile-Q3HB5MIO.js +0 -1136
- package/dist/chunks/project-agent-YHUBX4OR.js +0 -516
- package/dist/chunks/sandbox-command-YFL5QTWX.js +0 -1661
- package/dist/chunks/sandbox-template-Z6P7NTNF.js +0 -1655
- package/dist/chunks/src-7XEENEBI.js +0 -3628
- package/dist/chunks/src-KBBIV4NT.js +0 -56125
- package/dist/chunks/taskset-2TRZBRRT.js +0 -66
- package/dist/chunks/teams-bot-WD33NLH5.js +0 -146
- package/dist/chunks/training-4XH37UZB.js +0 -17
- package/dist/chunks/workspaces-WG2MH2WE.js +0 -99
- package/dist/web/assets/App-C9aGkxVg.js +0 -173
- package/dist/web/assets/AppDialog-CK6_lg8c.js +0 -1
- package/dist/web/assets/AppTerminalPanel-BKqgX4sd.js +0 -2
- package/dist/web/assets/GetStartedView-DVInkexN.js +0 -1
- package/dist/web/assets/LabModelVersionDetailPage-NaaPElmM.js +0 -1
- package/dist/web/assets/LabsRoute-BRR6x3SX.js +0 -2
- package/dist/web/assets/LabsRoute-CGFgymTX.css +0 -1
- package/dist/web/assets/MainChatThread-BfkjCZB9.js +0 -2
- package/dist/web/assets/MainPane-Gw-YK38n.js +0 -8
- package/dist/web/assets/RightChatPanelStack-BktRQ9wg.js +0 -1
- package/dist/web/assets/TeamChatView-BPWJbDf1.js +0 -3
- package/dist/web/assets/WorkspaceDiffPanel-Pg7GL0br.js +0 -14
- package/dist/web/assets/chat-file-links-CWLsRYvW.js +0 -1
- package/dist/web/assets/chevron-up--mNnEqha.js +0 -1
- package/dist/web/assets/index-BEPmTPIA.js +0 -1
|
@@ -1,1373 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
DEFAULT_OPENPOND_API_BASE_URL,
|
|
4
|
-
DEFAULT_OPENPOND_WEB_BASE_URL
|
|
5
|
-
} from "./chunk-KSRWKXRB.js";
|
|
6
|
-
import {
|
|
7
|
-
initializeHome,
|
|
8
|
-
readAccountConfiguration,
|
|
9
|
-
readCache,
|
|
10
|
-
updateAccountConfiguration,
|
|
11
|
-
writeCache
|
|
12
|
-
} from "./chunk-4KA25HUP.js";
|
|
13
|
-
import {
|
|
14
|
-
resolveOpenPondHome
|
|
15
|
-
} from "./chunk-ZNQEROWP.js";
|
|
16
|
-
|
|
17
|
-
// ../../packages/cloud/src/api/core.ts
|
|
18
|
-
var DEFAULT_API_TIMEOUT_MS = 3e4;
|
|
19
|
-
var DEFAULT_API_RESPONSE_BYTES = 8 * 1024 * 1024;
|
|
20
|
-
var LONG_STREAM_API_OPTIONS = { timeoutMs: 15 * 60 * 1e3, maxResponseBytes: 64 * 1024 * 1024 };
|
|
21
|
-
var ApiTimeoutError = class extends Error {
|
|
22
|
-
constructor(timeoutMs, requestUrl) {
|
|
23
|
-
super(`API request timed out after ${timeoutMs}ms: ${requestUrl}`);
|
|
24
|
-
this.timeoutMs = timeoutMs;
|
|
25
|
-
this.requestUrl = requestUrl;
|
|
26
|
-
this.name = "ApiTimeoutError";
|
|
27
|
-
}
|
|
28
|
-
timeoutMs;
|
|
29
|
-
requestUrl;
|
|
30
|
-
code = "OPENPOND_API_TIMEOUT";
|
|
31
|
-
};
|
|
32
|
-
var ApiResponseTooLargeError = class extends Error {
|
|
33
|
-
constructor(maximumBytes, requestUrl) {
|
|
34
|
-
super(`API response exceeded ${maximumBytes} bytes: ${requestUrl}`);
|
|
35
|
-
this.maximumBytes = maximumBytes;
|
|
36
|
-
this.requestUrl = requestUrl;
|
|
37
|
-
this.name = "ApiResponseTooLargeError";
|
|
38
|
-
}
|
|
39
|
-
maximumBytes;
|
|
40
|
-
requestUrl;
|
|
41
|
-
code = "OPENPOND_API_RESPONSE_TOO_LARGE";
|
|
42
|
-
};
|
|
43
|
-
async function apiFetch(baseUrl, token, requestPath, options = {}) {
|
|
44
|
-
const { timeoutMs = DEFAULT_API_TIMEOUT_MS, maxResponseBytes = DEFAULT_API_RESPONSE_BYTES, ...init } = options;
|
|
45
|
-
const requestUrl = `${baseUrl}${requestPath}`;
|
|
46
|
-
const headers = new Headers(init.headers);
|
|
47
|
-
headers.set("Content-Type", "application/json");
|
|
48
|
-
const apiKey = process.env.OPENPOND_API_KEY;
|
|
49
|
-
const trimmedToken = token?.trim() || "";
|
|
50
|
-
const tokenIsApiKey = trimmedToken.startsWith("opk_");
|
|
51
|
-
const effectiveApiKey = apiKey || (tokenIsApiKey ? trimmedToken : null);
|
|
52
|
-
if (effectiveApiKey && !headers.has("openpond-api-key")) headers.set("openpond-api-key", effectiveApiKey);
|
|
53
|
-
if (token) {
|
|
54
|
-
headers.set("Authorization", tokenIsApiKey ? `ApiKey ${trimmedToken}` : `Bearer ${token}`);
|
|
55
|
-
} else if (apiKey && !headers.has("Authorization")) {
|
|
56
|
-
headers.set("Authorization", `ApiKey ${apiKey}`);
|
|
57
|
-
}
|
|
58
|
-
const timeoutController = new AbortController();
|
|
59
|
-
const timeoutError = new ApiTimeoutError(timeoutMs, requestUrl);
|
|
60
|
-
const timer = timeoutMs > 0 ? setTimeout(() => timeoutController.abort(timeoutError), timeoutMs) : null;
|
|
61
|
-
timer?.unref?.();
|
|
62
|
-
const signal = composedSignal(init.signal, timeoutController.signal, timeoutMs);
|
|
63
|
-
const cleanup = () => {
|
|
64
|
-
if (timer) clearTimeout(timer);
|
|
65
|
-
};
|
|
66
|
-
try {
|
|
67
|
-
const response = await fetch(requestUrl, { ...init, headers, signal });
|
|
68
|
-
return boundedResponse(response, {
|
|
69
|
-
cleanup,
|
|
70
|
-
maximumBytes: maxResponseBytes,
|
|
71
|
-
requestUrl,
|
|
72
|
-
timeoutController,
|
|
73
|
-
timeoutError
|
|
74
|
-
});
|
|
75
|
-
} catch (error) {
|
|
76
|
-
cleanup();
|
|
77
|
-
if (timeoutController.signal.aborted) throw timeoutError;
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function boundedResponse(response, input) {
|
|
82
|
-
if (!response.body) {
|
|
83
|
-
input.cleanup();
|
|
84
|
-
return response;
|
|
85
|
-
}
|
|
86
|
-
const contentLength = Number(response.headers.get("content-length"));
|
|
87
|
-
if (input.maximumBytes > 0 && Number.isFinite(contentLength) && contentLength > input.maximumBytes) {
|
|
88
|
-
input.cleanup();
|
|
89
|
-
void response.body.cancel();
|
|
90
|
-
throw new ApiResponseTooLargeError(input.maximumBytes, input.requestUrl);
|
|
91
|
-
}
|
|
92
|
-
const reader = response.body.getReader();
|
|
93
|
-
let receivedBytes = 0;
|
|
94
|
-
const body = new ReadableStream({
|
|
95
|
-
async pull(controller) {
|
|
96
|
-
try {
|
|
97
|
-
const result = await reader.read();
|
|
98
|
-
if (result.done) {
|
|
99
|
-
input.cleanup();
|
|
100
|
-
controller.close();
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
receivedBytes += result.value.byteLength;
|
|
104
|
-
if (input.maximumBytes > 0 && receivedBytes > input.maximumBytes) {
|
|
105
|
-
input.cleanup();
|
|
106
|
-
await reader.cancel();
|
|
107
|
-
controller.error(new ApiResponseTooLargeError(input.maximumBytes, input.requestUrl));
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
controller.enqueue(result.value);
|
|
111
|
-
} catch (error) {
|
|
112
|
-
input.cleanup();
|
|
113
|
-
controller.error(input.timeoutController.signal.aborted ? input.timeoutError : error);
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
async cancel(reason) {
|
|
117
|
-
input.cleanup();
|
|
118
|
-
await reader.cancel(reason);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
return new Response(body, {
|
|
122
|
-
headers: response.headers,
|
|
123
|
-
status: response.status,
|
|
124
|
-
statusText: response.statusText
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
function composedSignal(callerSignal, timeoutSignal, timeoutMs) {
|
|
128
|
-
if (timeoutMs <= 0) return callerSignal ?? void 0;
|
|
129
|
-
return callerSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : timeoutSignal;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// ../../packages/cloud/src/api/deployments.ts
|
|
133
|
-
async function deployApp(baseUrl, token, appId, input) {
|
|
134
|
-
const environment = input?.environment ?? "production";
|
|
135
|
-
const response = await apiFetch(
|
|
136
|
-
baseUrl,
|
|
137
|
-
token,
|
|
138
|
-
`/v4/apps/${appId}/deployments`,
|
|
139
|
-
{
|
|
140
|
-
method: "POST",
|
|
141
|
-
body: JSON.stringify({
|
|
142
|
-
environment,
|
|
143
|
-
...input?.commitSha ? { commitSha: input.commitSha } : {},
|
|
144
|
-
...input?.branch ? { branch: input.branch } : {}
|
|
145
|
-
})
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
if (!response.ok) {
|
|
149
|
-
const text = await response.text().catch(() => "");
|
|
150
|
-
throw new Error(`Deploy failed: ${response.status} ${text}`);
|
|
151
|
-
}
|
|
152
|
-
return await response.json();
|
|
153
|
-
}
|
|
154
|
-
async function getDeploymentLogs(apiBase, token, deploymentId) {
|
|
155
|
-
const response = await apiFetch(
|
|
156
|
-
apiBase,
|
|
157
|
-
token,
|
|
158
|
-
`/apps/deployments/${deploymentId}/logs`,
|
|
159
|
-
{ method: "GET" }
|
|
160
|
-
);
|
|
161
|
-
if (!response.ok) {
|
|
162
|
-
const text = await response.text().catch(() => "");
|
|
163
|
-
throw new Error(`Deployment logs failed: ${response.status} ${text}`);
|
|
164
|
-
}
|
|
165
|
-
const payload = await response.json().catch(() => ({}));
|
|
166
|
-
const logs = Array.isArray(payload.logs) ? payload.logs : [];
|
|
167
|
-
return logs.map((log) => {
|
|
168
|
-
const createdAt = typeof log.createdAt === "string" ? log.createdAt : log.createdAt instanceof Date ? log.createdAt.toISOString() : (/* @__PURE__ */ new Date()).toISOString();
|
|
169
|
-
return {
|
|
170
|
-
id: typeof log.id === "string" ? log.id : `${Math.random()}`,
|
|
171
|
-
type: typeof log.type === "string" ? log.type : void 0,
|
|
172
|
-
message: typeof log.message === "string" ? log.message : "",
|
|
173
|
-
createdAt
|
|
174
|
-
};
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
async function getDeploymentStatus(apiBase, token, deploymentId) {
|
|
178
|
-
const response = await apiFetch(
|
|
179
|
-
apiBase,
|
|
180
|
-
token,
|
|
181
|
-
`/apps/deployments/${deploymentId}/status`,
|
|
182
|
-
{ method: "GET" }
|
|
183
|
-
);
|
|
184
|
-
if (!response.ok) {
|
|
185
|
-
const text = await response.text().catch(() => "");
|
|
186
|
-
throw new Error(`Deployment status failed: ${response.status} ${text}`);
|
|
187
|
-
}
|
|
188
|
-
const payload = await response.json().catch(() => ({}));
|
|
189
|
-
return { status: payload.deployment?.status };
|
|
190
|
-
}
|
|
191
|
-
async function getLatestDeploymentForApp(apiBase, token, appId, options) {
|
|
192
|
-
const params = new URLSearchParams();
|
|
193
|
-
if (options?.status && options.status.length > 0) {
|
|
194
|
-
params.set("status", options.status.join(","));
|
|
195
|
-
}
|
|
196
|
-
if (options?.createdAfter) {
|
|
197
|
-
params.set("createdAfter", options.createdAfter);
|
|
198
|
-
}
|
|
199
|
-
if (options?.branch) {
|
|
200
|
-
params.set("branch", options.branch);
|
|
201
|
-
}
|
|
202
|
-
const query = params.toString();
|
|
203
|
-
const response = await apiFetch(
|
|
204
|
-
apiBase,
|
|
205
|
-
token,
|
|
206
|
-
`/apps/${appId}/deployments/latest${query ? `?${query}` : ""}`,
|
|
207
|
-
{ method: "GET" }
|
|
208
|
-
);
|
|
209
|
-
if (!response.ok) {
|
|
210
|
-
const text = await response.text().catch(() => "");
|
|
211
|
-
throw new Error(
|
|
212
|
-
`Latest deployment lookup failed: ${response.status} ${text}`
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
const payload = await response.json().catch(() => ({}));
|
|
216
|
-
if (!payload.deployment) return null;
|
|
217
|
-
return {
|
|
218
|
-
id: payload.deployment.id,
|
|
219
|
-
status: payload.deployment.status
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
async function getDeploymentDetail(apiBase, token, deploymentId) {
|
|
223
|
-
const response = await apiFetch(
|
|
224
|
-
apiBase,
|
|
225
|
-
token,
|
|
226
|
-
`/apps/deployments/${deploymentId}`,
|
|
227
|
-
{ method: "GET" }
|
|
228
|
-
);
|
|
229
|
-
if (!response.ok) {
|
|
230
|
-
const text = await response.text().catch(() => "");
|
|
231
|
-
throw new Error(`Deployment fetch failed: ${response.status} ${text}`);
|
|
232
|
-
}
|
|
233
|
-
const payload = await response.json().catch(() => ({}));
|
|
234
|
-
return payload.deployment ?? null;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// ../../packages/cloud/src/api.ts
|
|
238
|
-
var DEFAULT_OPENPOND_API_HOST = new URL(DEFAULT_OPENPOND_API_BASE_URL).hostname;
|
|
239
|
-
var DEFAULT_OPENPOND_WEB_HOST = new URL(DEFAULT_OPENPOND_WEB_BASE_URL).hostname;
|
|
240
|
-
async function listApps(apiBase, token, options) {
|
|
241
|
-
const params = new URLSearchParams();
|
|
242
|
-
if (options?.handle) {
|
|
243
|
-
params.set("handle", options.handle);
|
|
244
|
-
}
|
|
245
|
-
if (typeof options?.limit === "number" && Number.isFinite(options.limit)) {
|
|
246
|
-
params.set("limit", String(Math.max(1, Math.floor(options.limit))));
|
|
247
|
-
}
|
|
248
|
-
if (typeof options?.offset === "number" && Number.isFinite(options.offset)) {
|
|
249
|
-
params.set("offset", String(Math.max(0, Math.floor(options.offset))));
|
|
250
|
-
}
|
|
251
|
-
if (typeof options?.includeScheduled === "boolean") {
|
|
252
|
-
params.set("includeScheduled", options.includeScheduled ? "true" : "false");
|
|
253
|
-
}
|
|
254
|
-
const query = params.toString();
|
|
255
|
-
const response = await apiFetch(
|
|
256
|
-
apiBase,
|
|
257
|
-
token,
|
|
258
|
-
`/apps/list${query ? `?${query}` : ""}`,
|
|
259
|
-
{ method: "GET" }
|
|
260
|
-
);
|
|
261
|
-
if (!response.ok) {
|
|
262
|
-
const text = await response.text().catch(() => "");
|
|
263
|
-
throw new Error(`Apps list failed: ${response.status} ${text}`);
|
|
264
|
-
}
|
|
265
|
-
const payload = await response.json().catch(() => ({}));
|
|
266
|
-
return Array.isArray(payload.apps) ? payload.apps : [];
|
|
267
|
-
}
|
|
268
|
-
async function createRepo(apiBase, apiKey, input) {
|
|
269
|
-
const response = await apiFetch(apiBase, apiKey, "/apps/repo/create", {
|
|
270
|
-
method: "POST",
|
|
271
|
-
body: JSON.stringify(input)
|
|
272
|
-
});
|
|
273
|
-
if (!response.ok) {
|
|
274
|
-
const text = await response.text().catch(() => "");
|
|
275
|
-
throw new Error(`Repo create failed: ${response.status} ${text}`);
|
|
276
|
-
}
|
|
277
|
-
return await response.json();
|
|
278
|
-
}
|
|
279
|
-
async function updateAppCodeVisibility(apiBase, apiKey, appId, codeVisibility) {
|
|
280
|
-
const response = await apiFetch(
|
|
281
|
-
apiBase,
|
|
282
|
-
apiKey,
|
|
283
|
-
`/apps/${encodeURIComponent(appId)}/code-visibility`,
|
|
284
|
-
{
|
|
285
|
-
method: "PATCH",
|
|
286
|
-
body: JSON.stringify({ codeVisibility })
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
if (!response.ok) {
|
|
290
|
-
const text = await response.text().catch(() => "");
|
|
291
|
-
throw new Error(
|
|
292
|
-
`Code visibility update failed: ${response.status} ${text}`
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
return await response.json();
|
|
296
|
-
}
|
|
297
|
-
async function createHeadlessApps(baseUrl, token, items, teamId) {
|
|
298
|
-
const response = await apiFetch(baseUrl, token, "/v4/apps/headless", {
|
|
299
|
-
method: "POST",
|
|
300
|
-
body: JSON.stringify({ items, ...teamId ? { teamId } : {} })
|
|
301
|
-
});
|
|
302
|
-
if (!response.ok) {
|
|
303
|
-
const text = await response.text().catch(() => "");
|
|
304
|
-
throw new Error(`Headless create failed: ${response.status} ${text}`);
|
|
305
|
-
}
|
|
306
|
-
return await response.json();
|
|
307
|
-
}
|
|
308
|
-
async function getTemplateStatus(apiBase, token, appId) {
|
|
309
|
-
const response = await apiFetch(
|
|
310
|
-
apiBase,
|
|
311
|
-
token,
|
|
312
|
-
`/v4/apps/${appId}/template/status`,
|
|
313
|
-
{ method: "GET" }
|
|
314
|
-
);
|
|
315
|
-
if (!response.ok) {
|
|
316
|
-
const text = await response.text().catch(() => "");
|
|
317
|
-
throw new Error(`Template status failed: ${response.status} ${text}`);
|
|
318
|
-
}
|
|
319
|
-
return await response.json();
|
|
320
|
-
}
|
|
321
|
-
async function listTemplateBranches(apiBase, token, appId) {
|
|
322
|
-
const response = await apiFetch(
|
|
323
|
-
apiBase,
|
|
324
|
-
token,
|
|
325
|
-
`/v4/apps/${appId}/template/branches`,
|
|
326
|
-
{ method: "GET" }
|
|
327
|
-
);
|
|
328
|
-
if (!response.ok) {
|
|
329
|
-
const text = await response.text().catch(() => "");
|
|
330
|
-
throw new Error(`Template branches failed: ${response.status} ${text}`);
|
|
331
|
-
}
|
|
332
|
-
return await response.json();
|
|
333
|
-
}
|
|
334
|
-
async function deployLatestTemplate(apiBase, token, appId, input) {
|
|
335
|
-
const response = await apiFetch(
|
|
336
|
-
apiBase,
|
|
337
|
-
token,
|
|
338
|
-
`/v4/apps/${appId}/template/deploy-latest`,
|
|
339
|
-
{
|
|
340
|
-
method: "POST",
|
|
341
|
-
body: JSON.stringify(input)
|
|
342
|
-
}
|
|
343
|
-
);
|
|
344
|
-
if (!response.ok) {
|
|
345
|
-
const text = await response.text().catch(() => "");
|
|
346
|
-
throw new Error(`Template deploy failed: ${response.status} ${text}`);
|
|
347
|
-
}
|
|
348
|
-
return await response.json();
|
|
349
|
-
}
|
|
350
|
-
async function updateAppEnvironment(apiBase, token, appId, input) {
|
|
351
|
-
const response = await apiFetch(
|
|
352
|
-
apiBase,
|
|
353
|
-
token,
|
|
354
|
-
`/v4/apps/${appId}/environment`,
|
|
355
|
-
{
|
|
356
|
-
method: "POST",
|
|
357
|
-
body: JSON.stringify(input)
|
|
358
|
-
}
|
|
359
|
-
);
|
|
360
|
-
if (!response.ok) {
|
|
361
|
-
const text = await response.text().catch(() => "");
|
|
362
|
-
throw new Error(`Environment update failed: ${response.status} ${text}`);
|
|
363
|
-
}
|
|
364
|
-
return await response.json();
|
|
365
|
-
}
|
|
366
|
-
async function getAppEnvironment(apiBase, token, appId) {
|
|
367
|
-
const response = await apiFetch(
|
|
368
|
-
apiBase,
|
|
369
|
-
token,
|
|
370
|
-
`/v4/apps/${appId}/environment`,
|
|
371
|
-
{
|
|
372
|
-
method: "GET"
|
|
373
|
-
}
|
|
374
|
-
);
|
|
375
|
-
if (!response.ok) {
|
|
376
|
-
const text = await response.text().catch(() => "");
|
|
377
|
-
throw new Error(`Environment get failed: ${response.status} ${text}`);
|
|
378
|
-
}
|
|
379
|
-
return await response.json();
|
|
380
|
-
}
|
|
381
|
-
async function listUserTools(baseUrl, token) {
|
|
382
|
-
const response = await apiFetch(baseUrl, token, "/apps/tools", {
|
|
383
|
-
method: "GET"
|
|
384
|
-
});
|
|
385
|
-
if (!response.ok) {
|
|
386
|
-
const text = await response.text().catch(() => "");
|
|
387
|
-
throw new Error(`Tools lookup failed: ${response.status} ${text}`);
|
|
388
|
-
}
|
|
389
|
-
return await response.json();
|
|
390
|
-
}
|
|
391
|
-
async function createAgentFromPrompt(baseUrl, token, payload) {
|
|
392
|
-
return apiFetch(baseUrl, token, "/apps/agent/create", {
|
|
393
|
-
method: "POST",
|
|
394
|
-
body: JSON.stringify(payload)
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
async function getUserPerformance(baseUrl, token, options) {
|
|
398
|
-
const params = new URLSearchParams();
|
|
399
|
-
if (options?.appId) {
|
|
400
|
-
params.set("appId", options.appId);
|
|
401
|
-
}
|
|
402
|
-
const qs = params.toString();
|
|
403
|
-
const response = await apiFetch(
|
|
404
|
-
baseUrl,
|
|
405
|
-
token,
|
|
406
|
-
`/apps/performance${qs ? `?${qs}` : ""}`,
|
|
407
|
-
{
|
|
408
|
-
method: "GET"
|
|
409
|
-
}
|
|
410
|
-
);
|
|
411
|
-
if (!response.ok) {
|
|
412
|
-
const text = await response.text().catch(() => "");
|
|
413
|
-
throw new Error(`Performance lookup failed: ${response.status} ${text}`);
|
|
414
|
-
}
|
|
415
|
-
return await response.json();
|
|
416
|
-
}
|
|
417
|
-
async function getAppRuntimeSummary(baseUrl, token, appId) {
|
|
418
|
-
const params = new URLSearchParams({ appId });
|
|
419
|
-
const response = await apiFetch(
|
|
420
|
-
baseUrl,
|
|
421
|
-
token,
|
|
422
|
-
`/apps/summary?${params.toString()}`,
|
|
423
|
-
{
|
|
424
|
-
method: "GET"
|
|
425
|
-
}
|
|
426
|
-
);
|
|
427
|
-
if (!response.ok) {
|
|
428
|
-
const text = await response.text().catch(() => "");
|
|
429
|
-
throw new Error(`Summary lookup failed: ${response.status} ${text}`);
|
|
430
|
-
}
|
|
431
|
-
return await response.json();
|
|
432
|
-
}
|
|
433
|
-
async function getOpenPondAccount(baseUrl, token) {
|
|
434
|
-
const response = await apiFetch(baseUrl, token, "/v1/account", {
|
|
435
|
-
method: "GET"
|
|
436
|
-
});
|
|
437
|
-
if (!response.ok) {
|
|
438
|
-
const text = await response.text().catch(() => "");
|
|
439
|
-
throw new Error(`Account lookup failed: ${response.status} ${text}`);
|
|
440
|
-
}
|
|
441
|
-
return await response.json();
|
|
442
|
-
}
|
|
443
|
-
async function checkOpenPondApiHealth(baseUrl, token) {
|
|
444
|
-
const checkedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
445
|
-
const started = Date.now();
|
|
446
|
-
const normalizedBase = baseUrl.replace(/\/$/, "");
|
|
447
|
-
try {
|
|
448
|
-
const response = await apiFetch(normalizedBase, null, "/health", {
|
|
449
|
-
method: "GET",
|
|
450
|
-
headers: { Accept: "application/json" }
|
|
451
|
-
});
|
|
452
|
-
const latencyMs = Date.now() - started;
|
|
453
|
-
const payload = await response.json().catch(() => ({}));
|
|
454
|
-
let authenticated = null;
|
|
455
|
-
let account = null;
|
|
456
|
-
if (token?.trim()) {
|
|
457
|
-
try {
|
|
458
|
-
const accountPayload = await getOpenPondAccount(normalizedBase, token);
|
|
459
|
-
authenticated = true;
|
|
460
|
-
account = accountPayload.account;
|
|
461
|
-
} catch {
|
|
462
|
-
authenticated = false;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
return {
|
|
466
|
-
reachable: response.ok,
|
|
467
|
-
authenticated,
|
|
468
|
-
apiBase: normalizedBase,
|
|
469
|
-
latencyMs,
|
|
470
|
-
status: response.status,
|
|
471
|
-
service: typeof payload.service === "string" ? payload.service : null,
|
|
472
|
-
checkedAt,
|
|
473
|
-
account,
|
|
474
|
-
...response.ok ? {} : { error: response.statusText || `HTTP ${response.status}` }
|
|
475
|
-
};
|
|
476
|
-
} catch (error) {
|
|
477
|
-
return {
|
|
478
|
-
reachable: false,
|
|
479
|
-
authenticated: token?.trim() ? false : null,
|
|
480
|
-
apiBase: normalizedBase,
|
|
481
|
-
latencyMs: Date.now() - started,
|
|
482
|
-
status: null,
|
|
483
|
-
service: null,
|
|
484
|
-
checkedAt,
|
|
485
|
-
error: error instanceof Error ? error.message : String(error)
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
async function runAssistantMode(baseUrl, token, payload) {
|
|
490
|
-
const response = await apiFetch(baseUrl, token, "/apps/assistant/run", {
|
|
491
|
-
method: "POST",
|
|
492
|
-
body: JSON.stringify(payload)
|
|
493
|
-
});
|
|
494
|
-
if (!response.ok) {
|
|
495
|
-
const text = await response.text().catch(() => "");
|
|
496
|
-
throw new Error(`Assistant run failed: ${response.status} ${text}`);
|
|
497
|
-
}
|
|
498
|
-
return await response.json();
|
|
499
|
-
}
|
|
500
|
-
async function executeUserTool(baseUrl, token, body) {
|
|
501
|
-
const response = await apiFetch(baseUrl, token, "/apps/tools/execute", {
|
|
502
|
-
method: "POST",
|
|
503
|
-
body: JSON.stringify(body)
|
|
504
|
-
});
|
|
505
|
-
const text = await response.text().catch(() => "");
|
|
506
|
-
let payload = null;
|
|
507
|
-
try {
|
|
508
|
-
payload = text ? JSON.parse(text) : null;
|
|
509
|
-
} catch {
|
|
510
|
-
payload = text;
|
|
511
|
-
}
|
|
512
|
-
if (!response.ok) {
|
|
513
|
-
return {
|
|
514
|
-
ok: false,
|
|
515
|
-
status: response.status,
|
|
516
|
-
error: payload && typeof payload === "object" && "error" in payload ? String(payload.error) : text || response.statusText
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
return {
|
|
520
|
-
ok: true,
|
|
521
|
-
status: response.status,
|
|
522
|
-
data: payload
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
async function submitBacktestRun(baseUrl, token, body) {
|
|
526
|
-
const response = await apiFetch(baseUrl, token, "/apps/backtests/run", {
|
|
527
|
-
method: "POST",
|
|
528
|
-
body: JSON.stringify(body)
|
|
529
|
-
});
|
|
530
|
-
if (!response.ok) {
|
|
531
|
-
const text = await response.text().catch(() => "");
|
|
532
|
-
throw new Error(`Backtest run failed: ${response.status} ${text}`);
|
|
533
|
-
}
|
|
534
|
-
return await response.json();
|
|
535
|
-
}
|
|
536
|
-
async function submitBacktestTx(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/backtests/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(`Backtests request failed: ${response.status} ${text}`);
|
|
545
|
-
}
|
|
546
|
-
return await response.json();
|
|
547
|
-
}
|
|
548
|
-
async function submitBacktestDetail(baseUrl, token, query) {
|
|
549
|
-
const qs = new URLSearchParams(query).toString();
|
|
550
|
-
const response = await apiFetch(
|
|
551
|
-
baseUrl,
|
|
552
|
-
token,
|
|
553
|
-
`/apps/backtests/detail?${qs}`,
|
|
554
|
-
{
|
|
555
|
-
method: "GET"
|
|
556
|
-
}
|
|
557
|
-
);
|
|
558
|
-
if (!response.ok) {
|
|
559
|
-
const text = await response.text().catch(() => "");
|
|
560
|
-
throw new Error(`Backtest detail failed: ${response.status} ${text}`);
|
|
561
|
-
}
|
|
562
|
-
return await response.json();
|
|
563
|
-
}
|
|
564
|
-
function normalizeToolPathSegment(toolName) {
|
|
565
|
-
const trimmed = toolName.trim().replace(/^\/+/, "");
|
|
566
|
-
return encodeURIComponent(trimmed || "tool");
|
|
567
|
-
}
|
|
568
|
-
function resolveWorkerBaseUrl(baseUrl) {
|
|
569
|
-
const trimmed = baseUrl.replace(/\/$/, "");
|
|
570
|
-
const workerEnv = process.env.OPENPOND_TOOL_URL;
|
|
571
|
-
if (workerEnv) {
|
|
572
|
-
return workerEnv.replace(/\/$/, "");
|
|
573
|
-
}
|
|
574
|
-
try {
|
|
575
|
-
const url = new URL(trimmed);
|
|
576
|
-
const host = url.hostname.toLowerCase();
|
|
577
|
-
const mappedHost = (() => {
|
|
578
|
-
if (host === "apps.openpond.live") {
|
|
579
|
-
return null;
|
|
580
|
-
}
|
|
581
|
-
if (host === DEFAULT_OPENPOND_API_HOST || host === DEFAULT_OPENPOND_WEB_HOST || host === "openpond.live" || host === "www.openpond.live") {
|
|
582
|
-
return "https://apps.openpond.live";
|
|
583
|
-
}
|
|
584
|
-
return null;
|
|
585
|
-
})();
|
|
586
|
-
if (mappedHost) {
|
|
587
|
-
return mappedHost;
|
|
588
|
-
}
|
|
589
|
-
const isLocal = host === "localhost" || host === "127.0.0.1";
|
|
590
|
-
const port = url.port || (url.protocol === "https:" ? "443" : "80");
|
|
591
|
-
if (isLocal && port === "3000") {
|
|
592
|
-
return trimmed;
|
|
593
|
-
}
|
|
594
|
-
} catch {
|
|
595
|
-
}
|
|
596
|
-
return trimmed;
|
|
597
|
-
}
|
|
598
|
-
async function executeHostedTool(baseUrl, token, payload) {
|
|
599
|
-
const workerBase = resolveWorkerBaseUrl(baseUrl);
|
|
600
|
-
const toolPath = normalizeToolPathSegment(payload.toolName);
|
|
601
|
-
const deploymentPrefix = payload.deploymentId ? `/${payload.appId}/deployments/${payload.deploymentId}` : `/${payload.appId}`;
|
|
602
|
-
const requestPath = `${deploymentPrefix}/${toolPath}`;
|
|
603
|
-
const headers = new Headers(payload.headers || {});
|
|
604
|
-
const method = payload.method ?? "POST";
|
|
605
|
-
const body = payload.body === void 0 || method === "GET" ? void 0 : JSON.stringify(payload.body);
|
|
606
|
-
const response = await apiFetch(workerBase, token, requestPath, {
|
|
607
|
-
method,
|
|
608
|
-
body,
|
|
609
|
-
headers
|
|
610
|
-
});
|
|
611
|
-
const text = await response.text().catch(() => "");
|
|
612
|
-
let data = null;
|
|
613
|
-
try {
|
|
614
|
-
data = text ? JSON.parse(text) : null;
|
|
615
|
-
} catch {
|
|
616
|
-
data = text;
|
|
617
|
-
}
|
|
618
|
-
const dataOk = data && typeof data === "object" && "ok" in data ? Boolean(data.ok) : true;
|
|
619
|
-
const ok = response.ok && dataOk;
|
|
620
|
-
const status = data && typeof data === "object" && "status" in data ? Number(data.status) || response.status : response.status;
|
|
621
|
-
const error = data && typeof data === "object" && "error" in data ? String(data.error) : response.ok ? void 0 : text || response.statusText;
|
|
622
|
-
const payloadData = data && typeof data === "object" && "data" in data ? data.data : data;
|
|
623
|
-
return { ok, status, data: payloadData, error };
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
// ../../packages/cloud/src/config.ts
|
|
627
|
-
import path from "node:path";
|
|
628
|
-
var DEFAULT_ACCOUNT_HANDLE = "default";
|
|
629
|
-
var ACCOUNT_SCOPED_KEYS = [
|
|
630
|
-
"apiKey",
|
|
631
|
-
"baseUrl",
|
|
632
|
-
"apiBaseUrl",
|
|
633
|
-
"chatApiBaseUrl",
|
|
634
|
-
"token",
|
|
635
|
-
"appId",
|
|
636
|
-
"conversationId"
|
|
637
|
-
];
|
|
638
|
-
function hasOwn(value, key) {
|
|
639
|
-
return Object.prototype.hasOwnProperty.call(value, key);
|
|
640
|
-
}
|
|
641
|
-
function normalizeHandle(value) {
|
|
642
|
-
if (typeof value !== "string") return null;
|
|
643
|
-
const trimmed = value.trim();
|
|
644
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
645
|
-
}
|
|
646
|
-
function normalizeBaseUrl(value) {
|
|
647
|
-
if (typeof value !== "string") return null;
|
|
648
|
-
const trimmed = value.trim();
|
|
649
|
-
if (!trimmed) return null;
|
|
650
|
-
return trimmed.replace(/\/$/, "");
|
|
651
|
-
}
|
|
652
|
-
function requireHandle(value) {
|
|
653
|
-
const handle = normalizeHandle(value);
|
|
654
|
-
if (!handle) {
|
|
655
|
-
throw new Error("profile handle must be non-empty");
|
|
656
|
-
}
|
|
657
|
-
return handle;
|
|
658
|
-
}
|
|
659
|
-
function requireApiKey(value) {
|
|
660
|
-
if (typeof value !== "string") {
|
|
661
|
-
throw new Error("apiKey must be a non-empty string");
|
|
662
|
-
}
|
|
663
|
-
const trimmed = value.trim();
|
|
664
|
-
if (!trimmed) {
|
|
665
|
-
throw new Error("apiKey must be a non-empty string");
|
|
666
|
-
}
|
|
667
|
-
return trimmed;
|
|
668
|
-
}
|
|
669
|
-
function handleEquals(left, right) {
|
|
670
|
-
const normalizedLeft = normalizeHandle(left);
|
|
671
|
-
const normalizedRight = normalizeHandle(right);
|
|
672
|
-
return Boolean(
|
|
673
|
-
normalizedLeft && normalizedRight && normalizedLeft.toLowerCase() === normalizedRight.toLowerCase()
|
|
674
|
-
);
|
|
675
|
-
}
|
|
676
|
-
function findAccountIndex(accounts, handle, baseUrl) {
|
|
677
|
-
const normalizedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
678
|
-
return accounts.findIndex((candidate) => {
|
|
679
|
-
if (!handleEquals(candidate.handle, handle)) return false;
|
|
680
|
-
if (!normalizedBaseUrl) return true;
|
|
681
|
-
return normalizeBaseUrl(candidate.baseUrl) === normalizedBaseUrl;
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
function selectorFromAccount(account) {
|
|
685
|
-
const handle = normalizeHandle(account.handle) ?? DEFAULT_ACCOUNT_HANDLE;
|
|
686
|
-
const baseUrl = normalizeBaseUrl(account.baseUrl);
|
|
687
|
-
return baseUrl ? { handle, baseUrl } : { handle };
|
|
688
|
-
}
|
|
689
|
-
function sanitizeActiveProfile(value) {
|
|
690
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
691
|
-
const input = value;
|
|
692
|
-
const handle = normalizeHandle(
|
|
693
|
-
typeof input.handle === "string" ? input.handle : void 0
|
|
694
|
-
);
|
|
695
|
-
if (!handle) return null;
|
|
696
|
-
const baseUrl = normalizeBaseUrl(
|
|
697
|
-
typeof input.baseUrl === "string" ? input.baseUrl : void 0
|
|
698
|
-
);
|
|
699
|
-
return baseUrl ? { handle, baseUrl } : { handle };
|
|
700
|
-
}
|
|
701
|
-
function sanitizeLocalOpenPondProfile(value) {
|
|
702
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
703
|
-
return void 0;
|
|
704
|
-
}
|
|
705
|
-
const input = value;
|
|
706
|
-
const repoPath = typeof input.repoPath === "string" ? input.repoPath.trim() : "";
|
|
707
|
-
const profile = typeof input.profile === "string" && input.profile.trim() ? input.profile.trim() : "default";
|
|
708
|
-
if (!repoPath) return void 0;
|
|
709
|
-
const out = {
|
|
710
|
-
repoPath,
|
|
711
|
-
profile,
|
|
712
|
-
mode: "local"
|
|
713
|
-
};
|
|
714
|
-
if (input.lastCheck && typeof input.lastCheck === "object" && !Array.isArray(input.lastCheck)) {
|
|
715
|
-
const check = input.lastCheck;
|
|
716
|
-
const command = check.command;
|
|
717
|
-
const status = check.status;
|
|
718
|
-
const checkedAt = check.checkedAt;
|
|
719
|
-
if ((command === "inspect" || command === "build" || command === "validate" || command === "eval" || command === "run") && (status === "passed" || status === "failed") && typeof checkedAt === "string") {
|
|
720
|
-
out.lastCheck = {
|
|
721
|
-
command,
|
|
722
|
-
status,
|
|
723
|
-
checkedAt,
|
|
724
|
-
...typeof check.exitCode === "number" || check.exitCode === null ? { exitCode: check.exitCode } : {},
|
|
725
|
-
...typeof check.sourceHead === "string" || check.sourceHead === null ? { sourceHead: check.sourceHead } : {}
|
|
726
|
-
};
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
if (input.lastPush && typeof input.lastPush === "object" && !Array.isArray(input.lastPush)) {
|
|
730
|
-
const push = input.lastPush;
|
|
731
|
-
const status = push.status;
|
|
732
|
-
const pushedAt = push.pushedAt;
|
|
733
|
-
if ((status === "pushed" || status === "failed") && typeof pushedAt === "string") {
|
|
734
|
-
out.lastPush = {
|
|
735
|
-
status,
|
|
736
|
-
pushedAt,
|
|
737
|
-
...typeof push.teamId === "string" || push.teamId === null ? { teamId: push.teamId } : {},
|
|
738
|
-
...typeof push.projectId === "string" || push.projectId === null ? { projectId: push.projectId } : {},
|
|
739
|
-
...typeof push.localHead === "string" || push.localHead === null ? { localHead: push.localHead } : {},
|
|
740
|
-
...typeof push.hostedHead === "string" || push.hostedHead === null ? { hostedHead: push.hostedHead } : {},
|
|
741
|
-
...typeof push.sourceRef === "string" || push.sourceRef === null ? { sourceRef: push.sourceRef } : {},
|
|
742
|
-
...push.promotionStatus === "uploaded" || push.promotionStatus === "hosted_source_materialized" || push.promotionStatus === "hosted_source_materialize_failed" || push.promotionStatus === "hosted_source_check_pending" || push.promotionStatus === "hosted_source_check_failed" || push.promotionStatus === "hosted_source_published" || push.promotionStatus === "hosted_source_publish_failed" || push.promotionStatus === "hosted_run_pending" || push.promotionStatus === "hosted_run_passed" || push.promotionStatus === "hosted_run_failed" || push.promotionStatus === null ? { promotionStatus: push.promotionStatus } : {},
|
|
743
|
-
...push.hostedRunStatus === "not_started" || push.hostedRunStatus === "running" || push.hostedRunStatus === "passed" || push.hostedRunStatus === "failed" || push.hostedRunStatus === null ? { hostedRunStatus: push.hostedRunStatus } : {},
|
|
744
|
-
...typeof push.hostedRunAgentId === "string" || push.hostedRunAgentId === null ? { hostedRunAgentId: push.hostedRunAgentId } : {},
|
|
745
|
-
...typeof push.hostedRunId === "string" || push.hostedRunId === null ? { hostedRunId: push.hostedRunId } : {},
|
|
746
|
-
...typeof push.hostedRunAt === "string" || push.hostedRunAt === null ? { hostedRunAt: push.hostedRunAt } : {},
|
|
747
|
-
...sanitizeHostedMaterializationStatus(push.hostedSourceMaterialization) ? { hostedSourceMaterialization: sanitizeHostedMaterializationStatus(push.hostedSourceMaterialization) } : {},
|
|
748
|
-
...sanitizeHostedSourceCheckStatus(push.hostedSourceCheck) ? { hostedSourceCheck: sanitizeHostedSourceCheckStatus(push.hostedSourceCheck) } : {},
|
|
749
|
-
...sanitizeHostedPublishStatus(push.hostedPublish) ? { hostedPublish: sanitizeHostedPublishStatus(push.hostedPublish) } : {},
|
|
750
|
-
...sanitizeHostedRunSummary(push.hostedRun) ? { hostedRun: sanitizeHostedRunSummary(push.hostedRun) } : {},
|
|
751
|
-
...typeof push.error === "string" || push.error === null ? { error: push.error } : {}
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
if (Array.isArray(input.profiles)) {
|
|
756
|
-
const profiles = input.profiles.flatMap((value2) => {
|
|
757
|
-
const entry = sanitizeLocalOpenPondProfile(value2);
|
|
758
|
-
if (!entry) return [];
|
|
759
|
-
const rawEntry = value2;
|
|
760
|
-
const source = rawEntry.source === "github" || rawEntry.source === "openpond_git" ? rawEntry.source : "local";
|
|
761
|
-
const repositoryId = typeof rawEntry.repositoryId === "string" && rawEntry.repositoryId.trim() ? rawEntry.repositoryId.trim() : path.resolve(entry.repoPath);
|
|
762
|
-
return [{
|
|
763
|
-
source,
|
|
764
|
-
repositoryId,
|
|
765
|
-
repoPath: entry.repoPath,
|
|
766
|
-
profile: entry.profile,
|
|
767
|
-
...entry.lastCheck ? { lastCheck: entry.lastCheck } : {},
|
|
768
|
-
...entry.lastPush ? { lastPush: entry.lastPush } : {}
|
|
769
|
-
}];
|
|
770
|
-
});
|
|
771
|
-
if (profiles.length > 0) out.profiles = profiles;
|
|
772
|
-
}
|
|
773
|
-
return out;
|
|
774
|
-
}
|
|
775
|
-
function sanitizeHostedMaterializationStatus(value) {
|
|
776
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
777
|
-
const input = value;
|
|
778
|
-
const status = stringField(input.status);
|
|
779
|
-
if (!status) return null;
|
|
780
|
-
return {
|
|
781
|
-
status,
|
|
782
|
-
...nullableStringProp(input, "agentId"),
|
|
783
|
-
...nullableStringProp(input, "runtimeAgentId"),
|
|
784
|
-
...nullableStringProp(input, "projectId"),
|
|
785
|
-
...nullableStringProp(input, "sourceRoot"),
|
|
786
|
-
...nullableStringProp(input, "sourceRef"),
|
|
787
|
-
...nullableStringProp(input, "sourceCommitSha"),
|
|
788
|
-
...nullableStringProp(input, "manifestHash"),
|
|
789
|
-
...nullableStringProp(input, "manifestPath"),
|
|
790
|
-
...nullableStringProp(input, "manifestSyncedAt"),
|
|
791
|
-
...nullableNumberProp(input, "fileCount"),
|
|
792
|
-
...nullableNumberProp(input, "totalBytes"),
|
|
793
|
-
...nullableStringProp(input, "generatedManifestPath"),
|
|
794
|
-
...nullableBooleanProp(input, "synthesizedOpenPondYaml"),
|
|
795
|
-
...nullableStringProp(input, "uploadMetadataPath"),
|
|
796
|
-
...stringArrayProp(input, "setupCommands"),
|
|
797
|
-
...stringArrayProp(input, "validationCommands"),
|
|
798
|
-
...nullableStringProp(input, "materializedAt"),
|
|
799
|
-
...nullableStringProp(input, "error")
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
function sanitizeHostedSourceCheckStatus(value) {
|
|
803
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
804
|
-
const input = value;
|
|
805
|
-
const status = stringField(input.status);
|
|
806
|
-
if (!status) return null;
|
|
807
|
-
return {
|
|
808
|
-
status,
|
|
809
|
-
...nullableStringProp(input, "agentId"),
|
|
810
|
-
...nullableStringProp(input, "deployPlanStatus"),
|
|
811
|
-
...nullableBooleanProp(input, "canRun"),
|
|
812
|
-
...nullableBooleanProp(input, "canDeploy"),
|
|
813
|
-
...nullableStringProp(input, "sourceRef"),
|
|
814
|
-
...nullableStringProp(input, "sourceCommitSha"),
|
|
815
|
-
...nullableStringProp(input, "manifestHash"),
|
|
816
|
-
...nullableStringProp(input, "manifestPath"),
|
|
817
|
-
...stringArrayProp(input, "setupCommands"),
|
|
818
|
-
...stringArrayProp(input, "validationCommands"),
|
|
819
|
-
...stringArrayProp(input, "requiredChecks"),
|
|
820
|
-
...stringArrayProp(input, "evalNames"),
|
|
821
|
-
...stringArrayProp(input, "blockedReasons"),
|
|
822
|
-
...stringArrayProp(input, "staleReasons"),
|
|
823
|
-
...nullableStringProp(input, "runtimeId"),
|
|
824
|
-
...nullableStringProp(input, "sandboxId"),
|
|
825
|
-
...stringArrayProp(input, "traceArtifactRefs"),
|
|
826
|
-
...stringArrayProp(input, "evalResultArtifactRefs"),
|
|
827
|
-
...stringArrayProp(input, "validatorArtifactRefs"),
|
|
828
|
-
...nullableStringProp(input, "checkedAt"),
|
|
829
|
-
...nullableStringProp(input, "error")
|
|
830
|
-
};
|
|
831
|
-
}
|
|
832
|
-
function sanitizeHostedPublishStatus(value) {
|
|
833
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
834
|
-
const input = value;
|
|
835
|
-
const status = stringField(input.status);
|
|
836
|
-
if (!status) return null;
|
|
837
|
-
return {
|
|
838
|
-
status,
|
|
839
|
-
...nullableStringProp(input, "agentId"),
|
|
840
|
-
...nullableStringProp(input, "snapshotId"),
|
|
841
|
-
...nullableStringProp(input, "sourceRef"),
|
|
842
|
-
...nullableStringProp(input, "sourceCommitSha"),
|
|
843
|
-
...nullableStringProp(input, "manifestHash"),
|
|
844
|
-
...nullableStringProp(input, "manifestPath"),
|
|
845
|
-
...nullableStringProp(input, "buildStatus"),
|
|
846
|
-
...nullableStringProp(input, "validationStatus"),
|
|
847
|
-
...nullableStringProp(input, "evalStatus"),
|
|
848
|
-
...nullableStringProp(input, "publishedAt"),
|
|
849
|
-
...nullableStringProp(input, "error")
|
|
850
|
-
};
|
|
851
|
-
}
|
|
852
|
-
function sanitizeHostedRunSummary(value) {
|
|
853
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
854
|
-
const input = value;
|
|
855
|
-
const status = stringField(input.status);
|
|
856
|
-
if (!status) return null;
|
|
857
|
-
return {
|
|
858
|
-
status,
|
|
859
|
-
...nullableStringProp(input, "agentId"),
|
|
860
|
-
...nullableStringProp(input, "runId"),
|
|
861
|
-
...nullableStringProp(input, "runtimeId"),
|
|
862
|
-
...nullableStringProp(input, "sandboxId"),
|
|
863
|
-
...nullableStringProp(input, "sourceRef"),
|
|
864
|
-
...nullableStringProp(input, "sourceCommitSha"),
|
|
865
|
-
...nullableStringProp(input, "manifestHash"),
|
|
866
|
-
...nullableStringProp(input, "setupGateStatus"),
|
|
867
|
-
...stringArrayProp(input, "setupRequirementRefs"),
|
|
868
|
-
...stringArrayProp(input, "artifactRefs"),
|
|
869
|
-
...stringArrayProp(input, "traceArtifactRefs"),
|
|
870
|
-
...stringArrayProp(input, "evalArtifactRefs"),
|
|
871
|
-
...nullableStringProp(input, "startedAt"),
|
|
872
|
-
...nullableStringProp(input, "completedAt"),
|
|
873
|
-
...nullableStringProp(input, "error")
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
function nullableStringProp(input, key) {
|
|
877
|
-
const value = input[key];
|
|
878
|
-
return typeof value === "string" || value === null ? { [key]: value } : {};
|
|
879
|
-
}
|
|
880
|
-
function nullableBooleanProp(input, key) {
|
|
881
|
-
const value = input[key];
|
|
882
|
-
return typeof value === "boolean" || value === null ? { [key]: value } : {};
|
|
883
|
-
}
|
|
884
|
-
function nullableNumberProp(input, key) {
|
|
885
|
-
const value = input[key];
|
|
886
|
-
return typeof value === "number" || value === null ? { [key]: value } : {};
|
|
887
|
-
}
|
|
888
|
-
function stringArrayProp(input, key) {
|
|
889
|
-
const value = input[key];
|
|
890
|
-
if (!Array.isArray(value)) return {};
|
|
891
|
-
const strings = value.filter((item) => typeof item === "string");
|
|
892
|
-
return { [key]: strings };
|
|
893
|
-
}
|
|
894
|
-
function stringField(value) {
|
|
895
|
-
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
896
|
-
}
|
|
897
|
-
function accountMatchesSelector(account, selector) {
|
|
898
|
-
if (!handleEquals(account.handle, selector.handle)) return false;
|
|
899
|
-
const selectorBaseUrl = normalizeBaseUrl(selector.baseUrl);
|
|
900
|
-
if (selectorBaseUrl) {
|
|
901
|
-
return normalizeBaseUrl(account.baseUrl) === selectorBaseUrl;
|
|
902
|
-
}
|
|
903
|
-
return !normalizeBaseUrl(account.baseUrl);
|
|
904
|
-
}
|
|
905
|
-
function findAccountIndexForSelector(accounts, selector, options = {}) {
|
|
906
|
-
const normalizedBaseUrl = normalizeBaseUrl(selector.baseUrl);
|
|
907
|
-
if (normalizedBaseUrl) {
|
|
908
|
-
return findAccountIndex(accounts, selector.handle, normalizedBaseUrl);
|
|
909
|
-
}
|
|
910
|
-
const noBaseIdx = accounts.findIndex(
|
|
911
|
-
(account) => accountMatchesSelector(account, selector)
|
|
912
|
-
);
|
|
913
|
-
if (noBaseIdx !== -1) return noBaseIdx;
|
|
914
|
-
const matches = accounts.map((account, index) => ({ account, index })).filter(({ account }) => handleEquals(account.handle, selector.handle));
|
|
915
|
-
if (matches.length > 1 && options.requireUnambiguous) {
|
|
916
|
-
throw new Error(
|
|
917
|
-
`multiple profiles found for ${selector.handle}; pass --base-url to select one`
|
|
918
|
-
);
|
|
919
|
-
}
|
|
920
|
-
return matches[0]?.index ?? -1;
|
|
921
|
-
}
|
|
922
|
-
function sanitizeSession(value) {
|
|
923
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
924
|
-
return void 0;
|
|
925
|
-
}
|
|
926
|
-
const input = value;
|
|
927
|
-
const out = {};
|
|
928
|
-
if (typeof input.token === "string") out.token = input.token;
|
|
929
|
-
if (typeof input.appId === "string" || input.appId === null) {
|
|
930
|
-
out.appId = input.appId;
|
|
931
|
-
}
|
|
932
|
-
if (typeof input.conversationId === "string" || input.conversationId === null) {
|
|
933
|
-
out.conversationId = input.conversationId;
|
|
934
|
-
}
|
|
935
|
-
return Object.keys(out).length > 0 ? out : void 0;
|
|
936
|
-
}
|
|
937
|
-
function sanitizeAccount(value) {
|
|
938
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
939
|
-
const input = value;
|
|
940
|
-
const handle = normalizeHandle(
|
|
941
|
-
typeof input.handle === "string" ? input.handle : void 0
|
|
942
|
-
);
|
|
943
|
-
if (!handle) return null;
|
|
944
|
-
const out = { handle };
|
|
945
|
-
if (typeof input.apiKey === "string") out.apiKey = input.apiKey;
|
|
946
|
-
if (typeof input.baseUrl === "string") out.baseUrl = input.baseUrl;
|
|
947
|
-
if (typeof input.apiBaseUrl === "string") out.apiBaseUrl = input.apiBaseUrl;
|
|
948
|
-
if (typeof input.chatApiBaseUrl === "string") out.chatApiBaseUrl = input.chatApiBaseUrl;
|
|
949
|
-
if (typeof input.environment === "string")
|
|
950
|
-
out.environment = input.environment;
|
|
951
|
-
const session = sanitizeSession(input.session);
|
|
952
|
-
if (session) out.session = session;
|
|
953
|
-
return out;
|
|
954
|
-
}
|
|
955
|
-
function extractLegacySession(raw) {
|
|
956
|
-
const session = {};
|
|
957
|
-
if (typeof raw.token === "string") session.token = raw.token;
|
|
958
|
-
if (typeof raw.appId === "string" || raw.appId === null) {
|
|
959
|
-
session.appId = raw.appId;
|
|
960
|
-
}
|
|
961
|
-
if (typeof raw.conversationId === "string" || raw.conversationId === null) {
|
|
962
|
-
session.conversationId = raw.conversationId;
|
|
963
|
-
}
|
|
964
|
-
return Object.keys(session).length > 0 ? session : void 0;
|
|
965
|
-
}
|
|
966
|
-
function extractLegacyAccount(raw, handle) {
|
|
967
|
-
const out = { handle };
|
|
968
|
-
if (typeof raw.apiKey === "string") out.apiKey = raw.apiKey;
|
|
969
|
-
if (typeof raw.baseUrl === "string") out.baseUrl = raw.baseUrl;
|
|
970
|
-
if (typeof raw.apiBaseUrl === "string") out.apiBaseUrl = raw.apiBaseUrl;
|
|
971
|
-
if (typeof raw.chatApiBaseUrl === "string") out.chatApiBaseUrl = raw.chatApiBaseUrl;
|
|
972
|
-
const session = extractLegacySession(raw);
|
|
973
|
-
if (session) out.session = session;
|
|
974
|
-
return out;
|
|
975
|
-
}
|
|
976
|
-
function normalizeGlobalConfig(raw) {
|
|
977
|
-
const normalized = {};
|
|
978
|
-
if (typeof raw.lspEnabled === "boolean")
|
|
979
|
-
normalized.lspEnabled = raw.lspEnabled;
|
|
980
|
-
if (raw.executionMode === "local" || raw.executionMode === "hosted") {
|
|
981
|
-
normalized.executionMode = raw.executionMode;
|
|
982
|
-
}
|
|
983
|
-
if (raw.mode === "general" || raw.mode === "builder") {
|
|
984
|
-
normalized.mode = raw.mode;
|
|
985
|
-
}
|
|
986
|
-
const openpondProfile = sanitizeLocalOpenPondProfile(raw.openpondProfile);
|
|
987
|
-
if (openpondProfile) {
|
|
988
|
-
normalized.openpondProfile = openpondProfile;
|
|
989
|
-
}
|
|
990
|
-
const accounts = [];
|
|
991
|
-
const sourceAccounts = Array.isArray(raw.accounts) ? raw.accounts : [];
|
|
992
|
-
for (const candidate of sourceAccounts) {
|
|
993
|
-
const account = sanitizeAccount(candidate);
|
|
994
|
-
if (!account) continue;
|
|
995
|
-
if (findAccountIndex(accounts, account.handle, account.baseUrl) !== -1)
|
|
996
|
-
continue;
|
|
997
|
-
accounts.push(account);
|
|
998
|
-
}
|
|
999
|
-
if (accounts.length === 0) {
|
|
1000
|
-
const legacyHandle = sanitizeActiveProfile(raw.activeProfile)?.handle || DEFAULT_ACCOUNT_HANDLE;
|
|
1001
|
-
accounts.push(extractLegacyAccount(raw, legacyHandle));
|
|
1002
|
-
}
|
|
1003
|
-
const requested = sanitizeActiveProfile(raw.activeProfile);
|
|
1004
|
-
const activeIdx = requested ? findAccountIndexForSelector(accounts, requested) : -1;
|
|
1005
|
-
const activeAccount = accounts[activeIdx === -1 ? 0 : activeIdx];
|
|
1006
|
-
normalized.accounts = accounts;
|
|
1007
|
-
normalized.activeProfile = selectorFromAccount(activeAccount);
|
|
1008
|
-
return normalized;
|
|
1009
|
-
}
|
|
1010
|
-
function resolveRequestedProfile(global, explicitAccount, explicitBaseUrl) {
|
|
1011
|
-
const accounts = global.accounts ?? [];
|
|
1012
|
-
const requestedBaseUrl = normalizeBaseUrl(
|
|
1013
|
-
explicitBaseUrl ?? process.env.OPENPOND_BASE_URL
|
|
1014
|
-
);
|
|
1015
|
-
const explicit = normalizeHandle(explicitAccount);
|
|
1016
|
-
if (explicit) {
|
|
1017
|
-
return requestedBaseUrl ? { handle: explicit, baseUrl: requestedBaseUrl } : { handle: explicit };
|
|
1018
|
-
}
|
|
1019
|
-
const envAccount = normalizeHandle(process.env.OPENPOND_ACCOUNT);
|
|
1020
|
-
if (envAccount) {
|
|
1021
|
-
return requestedBaseUrl ? { handle: envAccount, baseUrl: requestedBaseUrl } : { handle: envAccount };
|
|
1022
|
-
}
|
|
1023
|
-
const activeProfile = sanitizeActiveProfile(global.activeProfile);
|
|
1024
|
-
if (activeProfile) {
|
|
1025
|
-
return requestedBaseUrl ? { handle: activeProfile.handle, baseUrl: requestedBaseUrl } : activeProfile;
|
|
1026
|
-
}
|
|
1027
|
-
return accounts[0] ? selectorFromAccount(accounts[0]) : { handle: DEFAULT_ACCOUNT_HANDLE };
|
|
1028
|
-
}
|
|
1029
|
-
function ensureAccount(accounts, handle, baseUrl) {
|
|
1030
|
-
const normalizedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
1031
|
-
if (normalizedBaseUrl) {
|
|
1032
|
-
const idx = findAccountIndex(accounts, handle, normalizedBaseUrl);
|
|
1033
|
-
if (idx !== -1) {
|
|
1034
|
-
return accounts[idx];
|
|
1035
|
-
}
|
|
1036
|
-
} else {
|
|
1037
|
-
const matches = accounts.filter(
|
|
1038
|
-
(account) => handleEquals(account.handle, handle)
|
|
1039
|
-
);
|
|
1040
|
-
if (matches.length > 1) {
|
|
1041
|
-
throw new Error(
|
|
1042
|
-
`multiple profiles found for ${handle}; pass --base-url to select one`
|
|
1043
|
-
);
|
|
1044
|
-
}
|
|
1045
|
-
if (matches.length === 1) {
|
|
1046
|
-
return matches[0];
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
const next = { handle };
|
|
1050
|
-
if (normalizedBaseUrl) {
|
|
1051
|
-
next.baseUrl = normalizedBaseUrl;
|
|
1052
|
-
}
|
|
1053
|
-
accounts.push(next);
|
|
1054
|
-
return next;
|
|
1055
|
-
}
|
|
1056
|
-
function cleanupAccount(account) {
|
|
1057
|
-
if (account.session && Object.keys(account.session).length === 0) {
|
|
1058
|
-
delete account.session;
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
function applyScopedKey(account, key, value, options) {
|
|
1062
|
-
const shouldDelete = value === null || value === void 0 && options.undefinedDeletes;
|
|
1063
|
-
switch (key) {
|
|
1064
|
-
case "apiKey": {
|
|
1065
|
-
if (shouldDelete) {
|
|
1066
|
-
delete account.apiKey;
|
|
1067
|
-
return;
|
|
1068
|
-
}
|
|
1069
|
-
if (typeof value === "string") {
|
|
1070
|
-
account.apiKey = value;
|
|
1071
|
-
}
|
|
1072
|
-
return;
|
|
1073
|
-
}
|
|
1074
|
-
case "baseUrl": {
|
|
1075
|
-
if (shouldDelete) {
|
|
1076
|
-
delete account.baseUrl;
|
|
1077
|
-
return;
|
|
1078
|
-
}
|
|
1079
|
-
if (typeof value === "string") {
|
|
1080
|
-
account.baseUrl = value;
|
|
1081
|
-
}
|
|
1082
|
-
return;
|
|
1083
|
-
}
|
|
1084
|
-
case "apiBaseUrl": {
|
|
1085
|
-
if (shouldDelete) {
|
|
1086
|
-
delete account.apiBaseUrl;
|
|
1087
|
-
return;
|
|
1088
|
-
}
|
|
1089
|
-
if (typeof value === "string") {
|
|
1090
|
-
account.apiBaseUrl = value;
|
|
1091
|
-
}
|
|
1092
|
-
return;
|
|
1093
|
-
}
|
|
1094
|
-
case "chatApiBaseUrl": {
|
|
1095
|
-
if (shouldDelete) {
|
|
1096
|
-
delete account.chatApiBaseUrl;
|
|
1097
|
-
return;
|
|
1098
|
-
}
|
|
1099
|
-
if (typeof value === "string") {
|
|
1100
|
-
account.chatApiBaseUrl = value;
|
|
1101
|
-
}
|
|
1102
|
-
return;
|
|
1103
|
-
}
|
|
1104
|
-
case "token":
|
|
1105
|
-
case "appId":
|
|
1106
|
-
case "conversationId": {
|
|
1107
|
-
if (!account.session) account.session = {};
|
|
1108
|
-
if (shouldDelete) {
|
|
1109
|
-
delete account.session[key];
|
|
1110
|
-
cleanupAccount(account);
|
|
1111
|
-
return;
|
|
1112
|
-
}
|
|
1113
|
-
if (typeof value === "string" || value === null) {
|
|
1114
|
-
account.session[key] = value;
|
|
1115
|
-
}
|
|
1116
|
-
cleanupAccount(account);
|
|
1117
|
-
return;
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
function applyAccountPatch(global, source, options) {
|
|
1122
|
-
const hasScopedPatch = ACCOUNT_SCOPED_KEYS.some((key) => hasOwn(source, key));
|
|
1123
|
-
if (!hasScopedPatch) return false;
|
|
1124
|
-
const accounts = global.accounts ?? [];
|
|
1125
|
-
const selector = sanitizeActiveProfile(source.activeProfile) ?? resolveRequestedProfile(global);
|
|
1126
|
-
const requestedBaseUrl = normalizeBaseUrl(
|
|
1127
|
-
hasOwn(source, "baseUrl") ? source.baseUrl ?? null : selector.baseUrl ?? process.env.OPENPOND_BASE_URL
|
|
1128
|
-
);
|
|
1129
|
-
const account = ensureAccount(accounts, selector.handle, requestedBaseUrl);
|
|
1130
|
-
for (const key of ACCOUNT_SCOPED_KEYS) {
|
|
1131
|
-
if (!hasOwn(source, key)) continue;
|
|
1132
|
-
applyScopedKey(
|
|
1133
|
-
account,
|
|
1134
|
-
key,
|
|
1135
|
-
source[key],
|
|
1136
|
-
options
|
|
1137
|
-
);
|
|
1138
|
-
}
|
|
1139
|
-
global.accounts = accounts;
|
|
1140
|
-
global.activeProfile = selectorFromAccount(account);
|
|
1141
|
-
return true;
|
|
1142
|
-
}
|
|
1143
|
-
function applyTopLevelPatch(global, source) {
|
|
1144
|
-
if (hasOwn(source, "lspEnabled")) {
|
|
1145
|
-
if (typeof source.lspEnabled === "boolean") {
|
|
1146
|
-
global.lspEnabled = source.lspEnabled;
|
|
1147
|
-
} else if (source.lspEnabled === null) {
|
|
1148
|
-
delete global.lspEnabled;
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
if (hasOwn(source, "executionMode")) {
|
|
1152
|
-
if (source.executionMode === "local" || source.executionMode === "hosted") {
|
|
1153
|
-
global.executionMode = source.executionMode;
|
|
1154
|
-
} else if (source.executionMode === null) {
|
|
1155
|
-
delete global.executionMode;
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
if (hasOwn(source, "mode")) {
|
|
1159
|
-
if (source.mode === "general" || source.mode === "builder") {
|
|
1160
|
-
global.mode = source.mode;
|
|
1161
|
-
} else if (source.mode === null) {
|
|
1162
|
-
delete global.mode;
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
if (hasOwn(source, "activeProfile")) {
|
|
1166
|
-
const selector = sanitizeActiveProfile(source.activeProfile);
|
|
1167
|
-
if (selector) {
|
|
1168
|
-
const idx = findAccountIndexForSelector(global.accounts ?? [], selector);
|
|
1169
|
-
global.activeProfile = idx === -1 ? selector : selectorFromAccount((global.accounts ?? [])[idx]);
|
|
1170
|
-
} else if (source.activeProfile === null) {
|
|
1171
|
-
delete global.activeProfile;
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
if (hasOwn(source, "openpondProfile")) {
|
|
1175
|
-
const profile = sanitizeLocalOpenPondProfile(source.openpondProfile);
|
|
1176
|
-
if (profile) {
|
|
1177
|
-
global.openpondProfile = profile;
|
|
1178
|
-
} else if (source.openpondProfile === null) {
|
|
1179
|
-
delete global.openpondProfile;
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
async function updateGlobalConfig(update) {
|
|
1184
|
-
const home = resolveOpenPondHome();
|
|
1185
|
-
await initializeHome(home);
|
|
1186
|
-
return await updateAccountConfiguration(home, (raw) => {
|
|
1187
|
-
const current = normalizeGlobalConfig(raw);
|
|
1188
|
-
update(current);
|
|
1189
|
-
return current;
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
async function loadGlobalConfig() {
|
|
1193
|
-
const home = resolveOpenPondHome();
|
|
1194
|
-
await initializeHome(home);
|
|
1195
|
-
return normalizeGlobalConfig(await readAccountConfiguration(home));
|
|
1196
|
-
}
|
|
1197
|
-
async function loadConfig(options = {}) {
|
|
1198
|
-
const global = await loadGlobalConfig();
|
|
1199
|
-
const accounts = global.accounts ?? [];
|
|
1200
|
-
const requested = resolveRequestedProfile(
|
|
1201
|
-
global,
|
|
1202
|
-
options.account,
|
|
1203
|
-
options.baseUrl
|
|
1204
|
-
);
|
|
1205
|
-
const idx = findAccountIndexForSelector(accounts, requested, {
|
|
1206
|
-
requireUnambiguous: true
|
|
1207
|
-
});
|
|
1208
|
-
const account = idx === -1 ? null : accounts[idx];
|
|
1209
|
-
const session = account?.session;
|
|
1210
|
-
return {
|
|
1211
|
-
...global,
|
|
1212
|
-
activeProfile: account ? selectorFromAccount(account) : requested,
|
|
1213
|
-
apiKey: account?.apiKey,
|
|
1214
|
-
baseUrl: account?.baseUrl,
|
|
1215
|
-
apiBaseUrl: account?.apiBaseUrl,
|
|
1216
|
-
chatApiBaseUrl: account?.chatApiBaseUrl,
|
|
1217
|
-
token: session?.token,
|
|
1218
|
-
appId: session?.appId,
|
|
1219
|
-
conversationId: session?.conversationId
|
|
1220
|
-
};
|
|
1221
|
-
}
|
|
1222
|
-
async function listConfiguredProfiles() {
|
|
1223
|
-
const global = await loadGlobalConfig();
|
|
1224
|
-
const activeProfile = sanitizeActiveProfile(global.activeProfile);
|
|
1225
|
-
return (global.accounts ?? []).map((account) => {
|
|
1226
|
-
const handle = normalizeHandle(account.handle) ?? DEFAULT_ACCOUNT_HANDLE;
|
|
1227
|
-
return {
|
|
1228
|
-
handle,
|
|
1229
|
-
baseUrl: normalizeBaseUrl(account.baseUrl),
|
|
1230
|
-
apiBaseUrl: normalizeBaseUrl(account.apiBaseUrl),
|
|
1231
|
-
chatApiBaseUrl: normalizeBaseUrl(account.chatApiBaseUrl),
|
|
1232
|
-
environment: account.environment?.trim() || null,
|
|
1233
|
-
isActive: Boolean(
|
|
1234
|
-
activeProfile && accountMatchesSelector({ ...account, handle }, activeProfile)
|
|
1235
|
-
),
|
|
1236
|
-
hasApiKey: Boolean(account.apiKey?.trim()),
|
|
1237
|
-
hasSessionToken: Boolean(account.session?.token?.trim()),
|
|
1238
|
-
sessionAppId: account.session?.appId ?? null,
|
|
1239
|
-
sessionConversationId: account.session?.conversationId ?? null
|
|
1240
|
-
};
|
|
1241
|
-
});
|
|
1242
|
-
}
|
|
1243
|
-
async function setActiveProfile(handle, options = {}) {
|
|
1244
|
-
const requestedHandle = requireHandle(handle);
|
|
1245
|
-
const requestedBaseUrl = normalizeBaseUrl(options.baseUrl);
|
|
1246
|
-
let selectedIndex = -1;
|
|
1247
|
-
await updateGlobalConfig((global) => {
|
|
1248
|
-
const accounts = global.accounts ?? [];
|
|
1249
|
-
selectedIndex = findAccountIndexForSelector(
|
|
1250
|
-
accounts,
|
|
1251
|
-
requestedBaseUrl ? { handle: requestedHandle, baseUrl: requestedBaseUrl } : { handle: requestedHandle },
|
|
1252
|
-
{ requireUnambiguous: true }
|
|
1253
|
-
);
|
|
1254
|
-
if (selectedIndex === -1) throw new Error(`profile not found: ${requestedHandle}`);
|
|
1255
|
-
global.activeProfile = selectorFromAccount(accounts[selectedIndex]);
|
|
1256
|
-
});
|
|
1257
|
-
const profiles = await listConfiguredProfiles();
|
|
1258
|
-
return profiles.find((profile) => profile.isActive) ?? profiles[selectedIndex];
|
|
1259
|
-
}
|
|
1260
|
-
async function saveProfileApiKey(input) {
|
|
1261
|
-
const handle = requireHandle(input.handle);
|
|
1262
|
-
const apiKey = requireApiKey(input.apiKey);
|
|
1263
|
-
const baseUrl = normalizeBaseUrl(input.baseUrl);
|
|
1264
|
-
const apiBaseUrl = normalizeBaseUrl(input.apiBaseUrl);
|
|
1265
|
-
const chatApiBaseUrl = normalizeBaseUrl(input.chatApiBaseUrl);
|
|
1266
|
-
let savedSelector = { handle };
|
|
1267
|
-
await updateGlobalConfig((global) => {
|
|
1268
|
-
const accounts = global.accounts ?? [];
|
|
1269
|
-
const account = ensureAccount(accounts, handle, baseUrl);
|
|
1270
|
-
account.apiKey = apiKey;
|
|
1271
|
-
if (baseUrl) account.baseUrl = baseUrl;
|
|
1272
|
-
if (apiBaseUrl) account.apiBaseUrl = apiBaseUrl;
|
|
1273
|
-
else if (input.apiBaseUrl === null) delete account.apiBaseUrl;
|
|
1274
|
-
if (chatApiBaseUrl) account.chatApiBaseUrl = chatApiBaseUrl;
|
|
1275
|
-
else if (input.chatApiBaseUrl === null) delete account.chatApiBaseUrl;
|
|
1276
|
-
if (input.environment === null) delete account.environment;
|
|
1277
|
-
else if (typeof input.environment === "string" && input.environment.trim()) {
|
|
1278
|
-
account.environment = input.environment.trim();
|
|
1279
|
-
}
|
|
1280
|
-
global.accounts = accounts;
|
|
1281
|
-
savedSelector = selectorFromAccount(account);
|
|
1282
|
-
if (input.setActive !== false) global.activeProfile = savedSelector;
|
|
1283
|
-
});
|
|
1284
|
-
const profiles = await listConfiguredProfiles();
|
|
1285
|
-
const saved = profiles.find((profile) => {
|
|
1286
|
-
if (!handleEquals(profile.handle, savedSelector.handle)) return false;
|
|
1287
|
-
if (!baseUrl) return true;
|
|
1288
|
-
return normalizeBaseUrl(profile.baseUrl) === baseUrl;
|
|
1289
|
-
});
|
|
1290
|
-
if (!saved) {
|
|
1291
|
-
throw new Error(`failed to save profile: ${handle}`);
|
|
1292
|
-
}
|
|
1293
|
-
return saved;
|
|
1294
|
-
}
|
|
1295
|
-
async function saveGlobalConfig(next) {
|
|
1296
|
-
await updateGlobalConfig((current) => {
|
|
1297
|
-
applyTopLevelPatch(current, next);
|
|
1298
|
-
applyAccountPatch(current, next, { undefinedDeletes: false });
|
|
1299
|
-
});
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
// ../../packages/cloud/src/cache.ts
|
|
1303
|
-
import { createHash } from "node:crypto";
|
|
1304
|
-
var DEFAULT_CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
1305
|
-
function buildCacheKey(scope) {
|
|
1306
|
-
return createHash("sha256").update(JSON.stringify([scope.apiBase.replace(/\/$/, ""), scope.apiKey.trim()])).digest("hex");
|
|
1307
|
-
}
|
|
1308
|
-
async function cached(namespace, params) {
|
|
1309
|
-
const entry = await readCache(resolveOpenPondHome(), namespace, buildCacheKey(params), { allowStale: true });
|
|
1310
|
-
if (!entry || Date.now() - Date.parse(entry.updatedAt) >= (params.ttlMs ?? DEFAULT_CACHE_TTL_MS)) return null;
|
|
1311
|
-
return entry.payload;
|
|
1312
|
-
}
|
|
1313
|
-
async function getCachedApps(params) {
|
|
1314
|
-
return cached("cloud.apps", params);
|
|
1315
|
-
}
|
|
1316
|
-
async function setCachedApps(params) {
|
|
1317
|
-
await writeCache(resolveOpenPondHome(), "cloud.apps", buildCacheKey(params), params.apps);
|
|
1318
|
-
}
|
|
1319
|
-
async function getCachedTools(params) {
|
|
1320
|
-
return cached("cloud.tools", params);
|
|
1321
|
-
}
|
|
1322
|
-
async function setCachedTools(params) {
|
|
1323
|
-
await writeCache(resolveOpenPondHome(), "cloud.tools", buildCacheKey(params), params.tools);
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
// ../../packages/cloud/src/sandbox/types/runtime-profiles.ts
|
|
1327
|
-
var SANDBOX_RUNTIME_PROFILE_IDS = [
|
|
1328
|
-
"openpond-generic-v1",
|
|
1329
|
-
"openpond-work-v1",
|
|
1330
|
-
"openpond-coding-core-v1",
|
|
1331
|
-
"openpond-agent-harness-v1"
|
|
1332
|
-
];
|
|
1333
|
-
|
|
1334
|
-
export {
|
|
1335
|
-
deployApp,
|
|
1336
|
-
getDeploymentLogs,
|
|
1337
|
-
getDeploymentStatus,
|
|
1338
|
-
getLatestDeploymentForApp,
|
|
1339
|
-
getDeploymentDetail,
|
|
1340
|
-
listApps,
|
|
1341
|
-
createRepo,
|
|
1342
|
-
updateAppCodeVisibility,
|
|
1343
|
-
createHeadlessApps,
|
|
1344
|
-
getTemplateStatus,
|
|
1345
|
-
listTemplateBranches,
|
|
1346
|
-
deployLatestTemplate,
|
|
1347
|
-
updateAppEnvironment,
|
|
1348
|
-
getAppEnvironment,
|
|
1349
|
-
listUserTools,
|
|
1350
|
-
createAgentFromPrompt,
|
|
1351
|
-
getUserPerformance,
|
|
1352
|
-
getAppRuntimeSummary,
|
|
1353
|
-
getOpenPondAccount,
|
|
1354
|
-
checkOpenPondApiHealth,
|
|
1355
|
-
runAssistantMode,
|
|
1356
|
-
executeUserTool,
|
|
1357
|
-
submitBacktestRun,
|
|
1358
|
-
submitBacktestTx,
|
|
1359
|
-
submitBacktestDetail,
|
|
1360
|
-
executeHostedTool,
|
|
1361
|
-
loadGlobalConfig,
|
|
1362
|
-
loadConfig,
|
|
1363
|
-
listConfiguredProfiles,
|
|
1364
|
-
setActiveProfile,
|
|
1365
|
-
saveProfileApiKey,
|
|
1366
|
-
saveGlobalConfig,
|
|
1367
|
-
DEFAULT_CACHE_TTL_MS,
|
|
1368
|
-
getCachedApps,
|
|
1369
|
-
setCachedApps,
|
|
1370
|
-
getCachedTools,
|
|
1371
|
-
setCachedTools,
|
|
1372
|
-
SANDBOX_RUNTIME_PROFILE_IDS
|
|
1373
|
-
};
|