openpond 0.0.38 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/dist/api/core.d.ts +6 -0
- package/dist/api/vercel-protection.d.ts +1 -0
- package/dist/chunks/{app-layer-DPUJRNO2.js → app-layer-LTBWNA2F.js} +32 -10
- package/dist/chunks/app-server-runtime-VYYJ2AWX.js +18 -0
- package/dist/chunks/{apps-AKBI6AS7.js → apps-CZAJBGE3.js} +6 -4
- package/dist/chunks/{chunk-LZZM3IHS.js → chunk-2SF6HLT7.js} +5899 -5939
- package/dist/chunks/{chunk-XCATKTK3.js → chunk-3CDPPVLE.js} +108 -66
- package/dist/chunks/{chunk-JWF37O5E.js → chunk-3HW6OSHP.js} +1 -3
- package/dist/chunks/{chunk-43YI36NA.js → chunk-3KLQ52B2.js} +228 -5
- package/dist/chunks/chunk-4HIWFIMN.js +37172 -0
- package/dist/chunks/{chunk-AHPQTEIJ.js → chunk-4N6E3OVF.js} +4 -4
- package/dist/chunks/{chunk-YTJL6XPU.js → chunk-6V7MJVRO.js} +56 -11
- package/dist/chunks/{chunk-QRM7XMAO.js → chunk-BQQZNGI6.js} +152 -161
- package/dist/chunks/chunk-DBHSOTYZ.js +1552 -0
- package/dist/chunks/{chunk-275WCETC.js → chunk-FCVVOMIP.js} +145 -5
- package/dist/chunks/{chunk-GB6VUZUA.js → chunk-JIEUB6OS.js} +1 -1
- package/dist/chunks/{chunk-HS2AGRDV.js → chunk-JJPAMKXZ.js} +1 -1
- package/dist/chunks/{chunk-GDZYDLEL.js → chunk-JRROTGQT.js} +1 -110
- package/dist/chunks/chunk-KHNHUA2H.js +1737 -0
- package/dist/chunks/{chunk-AHNFNWUN.js → chunk-L6XH4ZGZ.js} +1 -1
- package/dist/chunks/chunk-M2NXTLH2.js +4054 -0
- package/dist/chunks/{chunk-SLMP353Q.js → chunk-MIZHCABO.js} +2 -195
- package/dist/chunks/chunk-SMNFI2FU.js +113 -0
- package/dist/chunks/chunk-VCVQLECH.js +675 -0
- package/dist/chunks/{chunk-V35STJF4.js → chunk-ZJBJQCQZ.js} +179 -52
- package/dist/chunks/{cli-7BKDWFNU.js → cli-JS76LCW2.js} +9 -5
- package/dist/chunks/{core-commands-YN4RMWA3.js → core-commands-4MRJQZJV.js} +7 -5
- package/dist/chunks/{harness-BHQRMXJR.js → desktop-test-RNMWLOVU.js} +15 -14
- package/dist/chunks/{chunk-XERQHYBO.js → extension-GDRW22N3.js} +5868 -3580
- package/dist/chunks/{help-VREQNA4I.js → help-LWNREJ7U.js} +1 -1
- package/dist/chunks/{opchat-D63YTNSX.js → opchat-2K2JIGK3.js} +9 -10
- package/dist/chunks/{organizations-I46KG7TC.js → organizations-Z5HVD2E7.js} +11 -9
- package/dist/chunks/{profile-WKZJHEPG.js → profile-QNECVVGN.js} +12 -38
- package/dist/chunks/{project-agent-ZUC3YMCT.js → project-agent-W3V75WBR.js} +9 -411
- package/dist/chunks/{sandbox-command-AAOPFTI5.js → sandbox-command-X3FO74NX.js} +7 -5
- package/dist/chunks/{sandbox-template-GKNVR4C5.js → sandbox-template-5B4T4BGU.js} +8 -6
- package/dist/chunks/{src-RPW5TOPI.js → src-ESAILPUH.js} +32 -30
- package/dist/chunks/src-IC5RX4L6.js +63517 -0
- package/dist/chunks/{teams-bot-PSL3ZO6Z.js → teams-bot-NTQ6VFFL.js} +6 -4
- package/dist/chunks/training-BR5A7SPU.js +320 -0
- package/dist/chunks/{workspaces-BPXC2DHT.js → workspaces-XC3QBD2Y.js} +2 -2
- package/dist/cli.js +24 -12
- package/dist/config.d.ts +9 -3
- package/dist/index.js +1300 -1045
- package/dist/profile/local-profile-types.d.ts +16 -0
- package/dist/profile/local-profile.d.ts +50 -4
- package/dist/sandbox/client-handles.d.ts +33 -46
- package/dist/sandbox/client.d.ts +4 -26
- package/dist/sandbox/sandbox-instance-client.d.ts +5 -5
- package/dist/sandbox/types/client.d.ts +1 -2
- package/dist/sandbox/types/core.d.ts +0 -1
- package/dist/sandbox/types/org-project-agent.d.ts +3 -89
- package/dist/sandbox/types/record.d.ts +1 -2
- package/dist/sandbox/types/runtime-profiles.d.ts +2 -2
- package/dist/sandbox-template/manifest.d.ts +1 -1
- package/dist/skills/openpond-agent-authoring/SKILL.md +40 -0
- package/dist/skills/openpond-agent-authoring/references/action-and-chat-design.md +13 -0
- package/dist/skills/openpond-agent-authoring/references/integrations-and-setup.md +13 -0
- package/dist/skills/openpond-agent-authoring/references/profile-layout.md +29 -0
- package/dist/skills/openpond-agent-authoring/references/validation-and-repair.md +14 -0
- package/dist/skills/openpond-desktop-harness/SKILL.md +1 -1
- package/dist/skills/openpond-skill-authoring/SKILL.md +44 -0
- package/dist/skills/openpond-skill-authoring/references/copying-and-adaptation.md +16 -0
- package/dist/skills/openpond-skill-authoring/references/skill-package-layout.md +38 -0
- package/dist/skills/openpond-skill-authoring/references/validation-and-repair.md +24 -0
- package/dist/skills/openpond-skill-authoring/scripts/validate-skill.mjs +102 -0
- package/dist/skills/openpond-taskset-authoring/SKILL.md +64 -22
- package/dist/skills/openpond-taskset-authoring/artifact.json +39 -0
- package/dist/skills/openpond-taskset-authoring/references/graders-and-rewards.md +3 -0
- package/dist/skills/openpond-taskset-authoring/references/method-selection.md +1 -1
- package/dist/skills/openpond-taskset-authoring/references/privacy-and-provenance.md +2 -0
- package/dist/skills/openpond-taskset-authoring/references/task-design.md +32 -0
- package/dist/web/assets/{AppDialog-DrwJb_wG.js → AppDialog-Bua3f-6v.js} +1 -1
- package/dist/web/assets/{AppsView-DPagLMsc.js → AppsView-DrJkHeSO.js} +1 -1
- package/dist/web/assets/BrowserSidebar-Bf-4Vozm.js +1 -0
- package/dist/web/assets/CommandMenu-DDZlGQiB.js +1 -0
- package/dist/web/assets/CommunityView-BtcCrba7.js +1 -0
- package/dist/web/assets/ComposerCreateImproveStrip-DOe5Otg6.js +1 -0
- package/dist/web/assets/GetStartedView-CG4z0Dtw.js +1 -0
- package/dist/web/assets/GetStartedView-yVmnGZPw.css +1 -0
- package/dist/web/assets/LabModelVersionDetailPage-BEkmSKuv.js +1 -0
- package/dist/web/assets/LabSkillSidebar-BIotN_RB.js +1 -0
- package/dist/web/assets/LabsRoute-CfOe0Zt5.js +3 -0
- package/dist/web/assets/LabsRoute-CoSPO4HR.css +1 -0
- package/dist/web/assets/MainChatThread-C0-l1mHt.js +2 -0
- package/dist/web/assets/MainPane-Bky_Rqcx.css +1 -0
- package/dist/web/assets/MainPane-aOVlVyRK.js +6 -0
- package/dist/web/assets/MarkdownText-D7DT1k1k.js +9 -0
- package/dist/web/assets/Messages-CBIXruA9.js +9 -0
- package/dist/web/assets/NativeSkillSidebar-C4t69Y7B.js +1 -0
- package/dist/web/assets/NewProjectDialog-Bat65tYD.js +1 -0
- package/dist/web/assets/OutputsPage-C58n39Db.js +1 -0
- package/dist/web/assets/RightChatPanelStack-Bp7nZxQ0.js +1 -0
- package/dist/web/assets/ScheduledWorkPage-BXP0j_c_.js +1 -0
- package/dist/web/assets/SettingsView-CtWK_aQ0.css +1 -0
- package/dist/web/assets/SettingsView-DOOfhO9a.js +6 -0
- package/dist/web/assets/TeamChatView-Cgxm-pKA.css +1 -0
- package/dist/web/assets/TeamChatView-De2wdqyY.js +3 -0
- package/dist/web/assets/{TerminalOverlay-BKl0p8pa.js → TerminalOverlay-BsuCH3NX.js} +1 -1
- package/dist/web/assets/TrainingCreationPanel-D2OFWyQ-.js +1 -0
- package/dist/web/assets/TrainingDraftPanel-DBpulXTz.js +1 -0
- package/dist/web/assets/{UsageSettingsSection-zDAwzTGl.js → UsageSettingsSection-DzMLUXAO.js} +37 -37
- package/dist/web/assets/WorkspaceDiffPanel-B7yIhjNF.js +14 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-B6jXM9xG.js +32 -0
- package/dist/web/assets/WorkspaceGitDialogs-CQ0fl9Qk.js +1 -0
- package/dist/web/assets/{WorkspaceMonacoEditor-DPGcG8fy.js → WorkspaceMonacoEditor-C2ctzITz.js} +3 -3
- package/dist/web/assets/arrow-up-right-ecwcx3xt.js +1 -0
- package/dist/web/assets/chevron-up-DP8PPfWd.js +1 -0
- package/dist/web/assets/circle-alert-envg1D6O.js +1 -0
- package/dist/web/assets/cloud-upload-5MGPLnaA.js +1 -0
- package/dist/web/assets/{cssMode-CKN9CcfG.js → cssMode-CFifcEfw.js} +1 -1
- package/dist/web/assets/folder-open-Dq3ZjeEP.js +1 -0
- package/dist/web/assets/folder-plus-EiZ5wbv_.js +1 -0
- package/dist/web/assets/git-branch-w29jmQ-X.js +1 -0
- package/dist/web/assets/{git-commit-horizontal-Bxi8YPep.js → git-commit-horizontal-CGZM0PZo.js} +1 -1
- package/dist/web/assets/{htmlMode-CeUcNhBZ.js → htmlMode-Ct1P-_lf.js} +1 -1
- package/dist/web/assets/index-ByIQyiUl.js +178 -0
- package/dist/web/assets/index-D4uCeiep.js +1 -0
- package/dist/web/assets/index-D9jTe16Q.css +1 -0
- package/dist/web/assets/info-Cd2HkIeb.js +1 -0
- package/dist/web/assets/{jsonMode-97z0Yz9u.js → jsonMode-BAUNCNAX.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-D4Tp-JmI.js → lspLanguageFeatures-fucFYI1A.js} +1 -1
- package/dist/web/assets/monaco.contribution-Ce4v5kei.js +2 -0
- package/dist/web/assets/monaco.contribution-DLLMi4cB.js +2 -0
- package/dist/web/assets/monaco.contribution-g9QiIm1d.js +2 -0
- package/dist/web/assets/monaco.contribution-nG-5Cyjz.js +2 -0
- package/dist/web/assets/monitor-DgHCnCKl.js +1 -0
- package/dist/web/assets/{play-C-37dnR1.js → play-Be0XDHBu.js} +1 -1
- package/dist/web/assets/{python-CGpDXY7_.js → python-CEhEiPo7.js} +1 -1
- package/dist/web/assets/{refresh-cw-BAaaPCXl.js → refresh-cw-DH0KLbdD.js} +1 -1
- package/dist/web/assets/reply-D1TK2yV8.js +1 -0
- package/dist/web/assets/{save-Cvxs3XyC.js → save-C1MSeBnQ.js} +1 -1
- package/dist/web/assets/square-CemI-0g5.js +1 -0
- package/dist/web/assets/square-pen-CqfsvR_n.js +1 -0
- package/dist/web/assets/{toggleHighContrast-CD42jH4g.js → toggleHighContrast-DrdQN3Rl.js} +1 -1
- package/dist/web/assets/training-BQVNUTZA.css +1 -0
- package/dist/web/assets/training-model-data-B7-1Bxil.js +1 -0
- package/dist/web/assets/{tsMode-ZROIxEjv.js → tsMode-CKB5oOUU.js} +1 -1
- package/dist/web/assets/{upload-DvCSGERK.js → upload-t751LLqP.js} +1 -1
- package/dist/web/assets/useLocalAgentSchedules-CzC3wfIP.js +1 -0
- package/dist/web/assets/{wifi-off-BIb94PkS.js → wifi-off-CxTHH3JU.js} +1 -1
- package/dist/web/assets/{workers-oYqbrVYG.js → workers-CqYddzCd.js} +1 -1
- package/dist/web/assets/{yaml-WqBjNgOO.js → yaml-e5wBkc-C.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/command-reference.md +75 -40
- package/package.json +3 -1
- package/dist/chunks/chunk-FWLOFUPU.js +0 -864
- package/dist/chunks/chunk-HLCTINEP.js +0 -224
- package/dist/chunks/chunk-MPGSHXGF.js +0 -3896
- package/dist/chunks/chunk-T4QXKU5Y.js +0 -1
- package/dist/chunks/chunk-XEJ7XXUQ.js +0 -1301
- package/dist/chunks/chunk-ZI4GDAUB.js +0 -3522
- package/dist/chunks/cli-2KBVNDRY.js +0 -23
- package/dist/chunks/extend-REGNTBK3.js +0 -89
- package/dist/chunks/extension-7K77DAVL.js +0 -121
- package/dist/chunks/fileFromPath-DHCRY3BD.js +0 -2151
- package/dist/chunks/src-MWDIK56B.js +0 -105881
- package/dist/web/assets/BrowserSidebar-DMn2V8RV.js +0 -1
- package/dist/web/assets/CloudWorkView-Cl_7mM3c.js +0 -1
- package/dist/web/assets/CloudWorkView-DNoPIlMj.css +0 -1
- package/dist/web/assets/CommandMenu-CHMQLez_.js +0 -1
- package/dist/web/assets/CommunityView-DcHVDUk0.js +0 -1
- package/dist/web/assets/ComposerCreateImproveStrip-BZ3Dgzmo.js +0 -1
- package/dist/web/assets/GetStartedView-DBLdduwr.css +0 -1
- package/dist/web/assets/GetStartedView-DTRotFqz.js +0 -1
- package/dist/web/assets/LabSkillSidebar-D-PqFe1T.js +0 -1
- package/dist/web/assets/LabsRoute-BrJkBNig.css +0 -1
- package/dist/web/assets/LabsRoute-Dew1BwK5.js +0 -3
- package/dist/web/assets/MainChatThread-BaPxxzrw.js +0 -2
- package/dist/web/assets/MakeAgentTutorialLearningPanel-CBsfnONQ.js +0 -2
- package/dist/web/assets/MarkdownText-DGLfAM_Z.js +0 -7
- package/dist/web/assets/Messages-CIX9uTjX.js +0 -10
- package/dist/web/assets/NativeSkillSidebar-AP_uHn6g.js +0 -1
- package/dist/web/assets/NewProjectDialog-C6lHkafU.js +0 -1
- package/dist/web/assets/PostTrainingLearningPanel-CZEgPc8O.js +0 -2
- package/dist/web/assets/PostTrainingStatusPill-CeEpwUDB.js +0 -1
- package/dist/web/assets/ProfileSettingsSection-Cg4tKO-C.css +0 -1
- package/dist/web/assets/ProfileSettingsSection-EumMLlEp.js +0 -1
- package/dist/web/assets/RightChatPanelStack-MXBcx3zO.js +0 -1
- package/dist/web/assets/SettingsView-Caljbns2.css +0 -1
- package/dist/web/assets/SettingsView-DyURG_Uh.js +0 -6
- package/dist/web/assets/TeamChatView-Bx44q3WV.css +0 -1
- package/dist/web/assets/TeamChatView-D3v6aqJ3.js +0 -3
- package/dist/web/assets/TrainingCreationPanel-CfZQTuT5.js +0 -1
- package/dist/web/assets/TrainingDraftPanel-DslRPSDW.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-C_MZPPlL.js +0 -14
- package/dist/web/assets/WorkspaceEnvironmentMenu-BUAnn80j.js +0 -32
- package/dist/web/assets/WorkspaceGitDialogs-Drbf4ujA.js +0 -1
- package/dist/web/assets/activity-Dnr3jqb3.js +0 -1
- package/dist/web/assets/boxes-BinC8UPn.js +0 -1
- package/dist/web/assets/chevron-up-Bjp_-_Cb.js +0 -1
- package/dist/web/assets/circle-x-ubnvEYuE.js +0 -1
- package/dist/web/assets/copy-B_ZCCUMz.js +0 -1
- package/dist/web/assets/create-pipeline-request-D6uLUxe9.js +0 -4
- package/dist/web/assets/file-8HAMlTmQ.js +0 -1
- package/dist/web/assets/git-branch-l2Zih3Bv.js +0 -1
- package/dist/web/assets/index-BMFyOFRU.css +0 -1
- package/dist/web/assets/index-BzwcDzbT.js +0 -1
- package/dist/web/assets/index-KoQSSt_f.js +0 -177
- package/dist/web/assets/info-JTbDQxHx.js +0 -1
- package/dist/web/assets/make-agent-tutorial-D6nBCgv-.js +0 -2
- package/dist/web/assets/monaco.contribution-B3j6oown.js +0 -2
- package/dist/web/assets/monaco.contribution-BXHxPPWL.js +0 -2
- package/dist/web/assets/monaco.contribution-C2P5zIzh.js +0 -2
- package/dist/web/assets/monaco.contribution-C8c6OtGi.js +0 -2
- package/dist/web/assets/monitor-kzHtxHnA.js +0 -1
- package/dist/web/assets/reply-9rehU13k.js +0 -1
- package/dist/web/assets/rotate-cw-C1Z_Xs23.js +0 -1
- package/dist/web/assets/training-BN8CALIc.css +0 -1
- package/dist/web/assets/training-model-data-BXUCzS0p.js +0 -1
- package/docs/agent-edit-check-status-json.md +0 -132
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
resolveRepoUrl,
|
|
16
16
|
runCommand,
|
|
17
17
|
warnOnRepoHostMismatch
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FCVVOMIP.js";
|
|
19
19
|
import {
|
|
20
20
|
normalizeTemplateRepoUrl,
|
|
21
21
|
resolveApiBaseUrlOption,
|
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
resolveBaseUrlOption,
|
|
24
24
|
resolveChatApiBaseUrlOption,
|
|
25
25
|
resolvePublicApiBaseUrl
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SMNFI2FU.js";
|
|
27
27
|
import {
|
|
28
28
|
compareSemver,
|
|
29
29
|
fetchLatestNpmVersion,
|
|
30
30
|
getInstalledCliVersion
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-3CDPPVLE.js";
|
|
32
32
|
import {
|
|
33
33
|
checkOpenPondApiHealth,
|
|
34
34
|
createHeadlessApps,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
saveProfileApiKey,
|
|
46
46
|
setActiveProfile,
|
|
47
47
|
submitBacktestRun
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-DBHSOTYZ.js";
|
|
49
49
|
import {
|
|
50
50
|
parseBooleanOption,
|
|
51
51
|
parseJsonOption,
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
parseListen
|
|
6
|
-
} from "./chunk-HS2AGRDV.js";
|
|
3
|
+
runAppServerJsonl
|
|
4
|
+
} from "./chunk-VCVQLECH.js";
|
|
7
5
|
import {
|
|
8
6
|
getBundledRuntimeVersion,
|
|
9
7
|
openUrlWithSystemBrowser
|
|
10
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BQQZNGI6.js";
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_HOST,
|
|
11
|
+
DEFAULT_PORT,
|
|
12
|
+
parseListen
|
|
13
|
+
} from "./chunk-JJPAMKXZ.js";
|
|
11
14
|
|
|
12
15
|
// ../server/src/cli.ts
|
|
13
16
|
import { existsSync } from "node:fs";
|
|
@@ -31,20 +34,22 @@ function parseCliArgs(args) {
|
|
|
31
34
|
let webRoot = null;
|
|
32
35
|
let openBrowser = false;
|
|
33
36
|
let printAccessUrl = false;
|
|
37
|
+
let storeDir = null;
|
|
34
38
|
let index = 0;
|
|
35
39
|
const command = args[0];
|
|
36
40
|
if (command && !command.startsWith("-")) {
|
|
37
41
|
if (command === "serve" || command === "server") mode = "serve";
|
|
42
|
+
else if (command === "app-server") mode = "app-server";
|
|
38
43
|
else if (command === "web") mode = "web";
|
|
39
44
|
else if (command === "help") {
|
|
40
|
-
return { mode, host, port, webRoot, openBrowser, printAccessUrl, help: true };
|
|
45
|
+
return { mode, host, port, webRoot, openBrowser, printAccessUrl, storeDir, help: true };
|
|
41
46
|
} else throw new Error(`Unknown command: ${command}`);
|
|
42
47
|
index = 1;
|
|
43
48
|
}
|
|
44
49
|
for (let i = index; i < args.length; i += 1) {
|
|
45
50
|
const arg = args[i];
|
|
46
51
|
if (arg === "--help" || arg === "-h") {
|
|
47
|
-
return { mode, host, port, webRoot, openBrowser, printAccessUrl, help: true };
|
|
52
|
+
return { mode, host, port, webRoot, openBrowser, printAccessUrl, storeDir, help: true };
|
|
48
53
|
}
|
|
49
54
|
if (arg === "--listen") {
|
|
50
55
|
const listen = parseListen(requireValue(args, i, arg));
|
|
@@ -60,6 +65,9 @@ function parseCliArgs(args) {
|
|
|
60
65
|
} else if (arg === "--web-root") {
|
|
61
66
|
webRoot = path.resolve(requireValue(args, i, arg));
|
|
62
67
|
i += 1;
|
|
68
|
+
} else if (arg === "--store-dir") {
|
|
69
|
+
storeDir = path.resolve(requireValue(args, i, arg));
|
|
70
|
+
i += 1;
|
|
63
71
|
} else if (arg === "--open-browser") {
|
|
64
72
|
openBrowser = true;
|
|
65
73
|
} else if (arg === "--print-access-url") {
|
|
@@ -74,7 +82,7 @@ function parseCliArgs(args) {
|
|
|
74
82
|
if (mode !== "web" && (openBrowser || printAccessUrl)) {
|
|
75
83
|
throw new Error("Browser options are only available in web mode.");
|
|
76
84
|
}
|
|
77
|
-
return { mode, host, port, webRoot, openBrowser, printAccessUrl, help: false };
|
|
85
|
+
return { mode, host, port, webRoot, openBrowser, printAccessUrl, storeDir, help: false };
|
|
78
86
|
}
|
|
79
87
|
function defaultWebRootCandidates() {
|
|
80
88
|
return [
|
|
@@ -128,6 +136,7 @@ async function resolveWebLaunchMessages(input, handOffToBrowser = openUrlWithSys
|
|
|
128
136
|
function printHelp() {
|
|
129
137
|
console.log(`Usage:
|
|
130
138
|
openpond-app-server serve [--hostname HOST] [--port PORT]
|
|
139
|
+
openpond-app-server app-server [--store-dir DIR]
|
|
131
140
|
openpond-app-server web [--hostname HOST] [--port PORT] [--web-root DIR]
|
|
132
141
|
|
|
133
142
|
Options:
|
|
@@ -135,11 +144,12 @@ Options:
|
|
|
135
144
|
--hostname HOST Bind host (default ${DEFAULT_HOST})
|
|
136
145
|
--port PORT Bind port, or 0 for any free port (default ${DEFAULT_PORT})
|
|
137
146
|
--web-root DIR Directory containing the built web UI for web mode
|
|
147
|
+
--store-dir DIR Local app-server state directory
|
|
138
148
|
--open-browser Open the authenticated web URL in the system browser
|
|
139
149
|
--print-access-url Print the authenticated URL instead of opening it
|
|
140
150
|
`);
|
|
141
151
|
}
|
|
142
|
-
async function runOpenPondServerCli(
|
|
152
|
+
async function runOpenPondServerCli(factories) {
|
|
143
153
|
const args = parseCliArgs(process.argv.slice(2));
|
|
144
154
|
if (args.help) {
|
|
145
155
|
printHelp();
|
|
@@ -149,7 +159,17 @@ async function runOpenPondServerCli(createOpenPondServer) {
|
|
|
149
159
|
if (args.mode === "web" && !webRoot) {
|
|
150
160
|
throw new Error("Could not find a built OpenPond web UI. Run `pnpm build:web` or pass --web-root.");
|
|
151
161
|
}
|
|
152
|
-
|
|
162
|
+
if (args.mode === "app-server") {
|
|
163
|
+
await runAgentServer(factories.createOpenPondAppServer, args.storeDir);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const instance = await factories.createOpenPondServer({
|
|
167
|
+
host: args.host,
|
|
168
|
+
port: args.port,
|
|
169
|
+
webRoot,
|
|
170
|
+
...args.storeDir ? { storeDir: args.storeDir } : {},
|
|
171
|
+
httpEnabled: true
|
|
172
|
+
});
|
|
153
173
|
const webBaseUrl = args.mode === "web" ? browserBaseUrl(instance) : null;
|
|
154
174
|
console.log(
|
|
155
175
|
`OPENPOND_APP_SERVER_READY ${JSON.stringify({
|
|
@@ -186,8 +206,33 @@ async function runOpenPondServerCli(createOpenPondServer) {
|
|
|
186
206
|
await new Promise(() => {
|
|
187
207
|
});
|
|
188
208
|
}
|
|
209
|
+
async function runOpenPondAppServerCli(createOpenPondAppServer) {
|
|
210
|
+
const rawArgs = process.argv.slice(2);
|
|
211
|
+
const args = parseCliArgs(
|
|
212
|
+
!rawArgs[0] || rawArgs[0].startsWith("-") ? ["app-server", ...rawArgs] : rawArgs
|
|
213
|
+
);
|
|
214
|
+
if (args.help) {
|
|
215
|
+
printHelp();
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (args.mode !== "app-server") {
|
|
219
|
+
throw new Error("The app-server entrypoint only accepts the app-server command.");
|
|
220
|
+
}
|
|
221
|
+
await runAgentServer(createOpenPondAppServer, args.storeDir);
|
|
222
|
+
}
|
|
223
|
+
async function runAgentServer(createOpenPondAppServer, storeDir) {
|
|
224
|
+
const appServer = await createOpenPondAppServer({
|
|
225
|
+
...storeDir ? { storeDir } : {}
|
|
226
|
+
});
|
|
227
|
+
await runAppServerJsonl({
|
|
228
|
+
appServer,
|
|
229
|
+
readable: process.stdin,
|
|
230
|
+
writable: process.stdout
|
|
231
|
+
});
|
|
232
|
+
}
|
|
189
233
|
|
|
190
234
|
export {
|
|
191
235
|
resolveWebLaunchMessages,
|
|
192
|
-
runOpenPondServerCli
|
|
236
|
+
runOpenPondServerCli,
|
|
237
|
+
runOpenPondAppServerCli
|
|
193
238
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
DEFAULT_OPENPOND_API_BASE_URL,
|
|
4
3
|
DEFAULT_OPENPOND_CHAT_MODEL,
|
|
5
|
-
DEFAULT_OPENPOND_WEB_BASE_URL,
|
|
6
4
|
ProviderCatalogSchema,
|
|
7
5
|
SandboxAppActionRegistrySchema,
|
|
8
|
-
checkOpenPondApiHealth,
|
|
9
6
|
createRepo,
|
|
10
7
|
getAppEnvironment,
|
|
11
8
|
getOpenPondAccount,
|
|
@@ -15,7 +12,12 @@ import {
|
|
|
15
12
|
saveConfig,
|
|
16
13
|
saveProfileApiKey,
|
|
17
14
|
setActiveProfile
|
|
18
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2SF6HLT7.js";
|
|
16
|
+
import {
|
|
17
|
+
DEFAULT_OPENPOND_API_BASE_URL,
|
|
18
|
+
DEFAULT_OPENPOND_WEB_BASE_URL,
|
|
19
|
+
withVercelProtectionBypass
|
|
20
|
+
} from "./chunk-KHNHUA2H.js";
|
|
19
21
|
|
|
20
22
|
// ../../packages/runtime/dist/chat.js
|
|
21
23
|
import { randomUUID } from "node:crypto";
|
|
@@ -78,6 +80,9 @@ function normalizeOpChatApiBaseUrl(value) {
|
|
|
78
80
|
return null;
|
|
79
81
|
try {
|
|
80
82
|
const url = new URL(normalized);
|
|
83
|
+
if (url.hostname.toLowerCase() === "api-new.staging-api.openpond.ai") {
|
|
84
|
+
url.hostname = "staging-api.openpond.ai";
|
|
85
|
+
}
|
|
81
86
|
const segments = url.pathname.split("/").filter(Boolean);
|
|
82
87
|
const opChatIndex = segments.findIndex((segment) => segment.toLowerCase() === "opchat");
|
|
83
88
|
if (opChatIndex >= 0) {
|
|
@@ -406,7 +411,7 @@ function errorMessage(error) {
|
|
|
406
411
|
}
|
|
407
412
|
|
|
408
413
|
// ../../packages/runtime/dist/chat.js
|
|
409
|
-
var PROVIDER_CATALOG_FETCH_TIMEOUT_MS =
|
|
414
|
+
var PROVIDER_CATALOG_FETCH_TIMEOUT_MS = 15e3;
|
|
410
415
|
async function loadOpenPondProviderCatalog() {
|
|
411
416
|
const context = await loadOpenPondAccountContext();
|
|
412
417
|
if (!context.token) {
|
|
@@ -451,13 +456,16 @@ async function* streamOpenPondHostedChatTurn(input) {
|
|
|
451
456
|
tools: input.tools,
|
|
452
457
|
toolChoice: input.toolChoice,
|
|
453
458
|
requestId: input.requestId,
|
|
459
|
+
reasoningEffort: input.reasoningEffort,
|
|
460
|
+
maxTokens: input.maxTokens,
|
|
454
461
|
signal: input.signal
|
|
455
462
|
});
|
|
456
463
|
}
|
|
457
464
|
async function listOpChatProviderCatalog(options) {
|
|
458
|
-
const
|
|
465
|
+
const requestUrl = opChatEndpointUrl(options.apiBaseUrl, "provider-catalog");
|
|
466
|
+
const response = await fetch(requestUrl, {
|
|
459
467
|
method: "GET",
|
|
460
|
-
headers: opChatHeaders(options.token, "application/json"),
|
|
468
|
+
headers: opChatHeaders(requestUrl, options.token, "application/json"),
|
|
461
469
|
signal: options.signal
|
|
462
470
|
});
|
|
463
471
|
if (!response.ok) {
|
|
@@ -466,56 +474,61 @@ async function listOpChatProviderCatalog(options) {
|
|
|
466
474
|
return ProviderCatalogSchema.parse(await response.json());
|
|
467
475
|
}
|
|
468
476
|
async function* streamOpChatChatCompletion(options) {
|
|
469
|
-
const
|
|
477
|
+
const requestUrl = opChatEndpointUrl(options.apiBaseUrl, "chat/completions");
|
|
478
|
+
const response = await fetch(requestUrl, {
|
|
470
479
|
method: "POST",
|
|
471
|
-
headers: opChatHeaders(options.token, "
|
|
472
|
-
|
|
480
|
+
headers: opChatHeaders(requestUrl, options.token, "application/json", options.requestId),
|
|
481
|
+
// Hosted turns are published only after the provider finishes. Requesting
|
|
482
|
+
// the complete response also preserves whitespace that some upstream
|
|
483
|
+
// token streams omit at chunk boundaries.
|
|
484
|
+
body: JSON.stringify(buildOpChatBody(options, false)),
|
|
473
485
|
signal: options.signal
|
|
474
486
|
});
|
|
475
|
-
if (!response.ok
|
|
476
|
-
throw new Error(`OpenPond OpChat
|
|
487
|
+
if (!response.ok) {
|
|
488
|
+
throw new Error(`OpenPond OpChat request failed: ${response.status} ${await readOpChatError(response)}`);
|
|
477
489
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
pendingFinish = delta;
|
|
497
|
-
else
|
|
498
|
-
yield delta;
|
|
499
|
-
}
|
|
490
|
+
const raw = await response.json();
|
|
491
|
+
if (raw && typeof raw === "object" && "error" in raw) {
|
|
492
|
+
throw new Error(`OpenPond OpChat request failed: ${errorMessageFromPayload(raw)}`);
|
|
493
|
+
}
|
|
494
|
+
const record = raw && typeof raw === "object" ? raw : {};
|
|
495
|
+
const choices = Array.isArray(record.choices) ? record.choices : [];
|
|
496
|
+
const choice = choices[0] && typeof choices[0] === "object" ? choices[0] : {};
|
|
497
|
+
const message = choice.message && typeof choice.message === "object" ? choice.message : {};
|
|
498
|
+
const reasoningText = streamTextValue(message.reasoning_content);
|
|
499
|
+
const content = streamTextValue(message.content);
|
|
500
|
+
const toolCalls = parseToolCalls(message.tool_calls);
|
|
501
|
+
const usage = parseUsage(raw);
|
|
502
|
+
if (reasoningText)
|
|
503
|
+
yield { type: "reasoning_delta", text: reasoningText, raw };
|
|
504
|
+
if (content)
|
|
505
|
+
yield { type: "text_delta", text: content, raw };
|
|
506
|
+
if (toolCalls.length > 0) {
|
|
507
|
+
yield { type: "tool_call_delta", toolCalls, raw };
|
|
500
508
|
}
|
|
501
|
-
if (
|
|
509
|
+
if (toolCalls.length > 0 && reasoningText) {
|
|
502
510
|
yield {
|
|
503
511
|
type: "continuation",
|
|
504
512
|
continuation: {
|
|
505
513
|
kind: "chat_completions_reasoning",
|
|
506
514
|
reasoningContent: reasoningText
|
|
507
515
|
},
|
|
508
|
-
raw
|
|
516
|
+
raw
|
|
509
517
|
};
|
|
510
518
|
}
|
|
511
|
-
if (
|
|
512
|
-
yield
|
|
519
|
+
if (usage)
|
|
520
|
+
yield { type: "usage", usage, raw };
|
|
521
|
+
yield {
|
|
522
|
+
type: "finish",
|
|
523
|
+
finishReason: stringValue(choice.finish_reason),
|
|
524
|
+
raw
|
|
525
|
+
};
|
|
513
526
|
}
|
|
514
|
-
function buildOpChatBody(options) {
|
|
527
|
+
function buildOpChatBody(options, stream) {
|
|
515
528
|
const body = {
|
|
516
529
|
model: options.model,
|
|
517
530
|
messages: options.messages.map(opChatMessage),
|
|
518
|
-
stream
|
|
531
|
+
stream
|
|
519
532
|
};
|
|
520
533
|
if (options.tools) {
|
|
521
534
|
body.tools = options.tools;
|
|
@@ -523,8 +536,23 @@ function buildOpChatBody(options) {
|
|
|
523
536
|
if (options.toolChoice !== void 0) {
|
|
524
537
|
body.tool_choice = options.toolChoice;
|
|
525
538
|
}
|
|
539
|
+
if (typeof options.maxTokens === "number") {
|
|
540
|
+
body.max_tokens = options.maxTokens;
|
|
541
|
+
}
|
|
542
|
+
Object.assign(body, opChatReasoningFields(options.reasoningEffort));
|
|
526
543
|
return body;
|
|
527
544
|
}
|
|
545
|
+
function opChatReasoningFields(effort) {
|
|
546
|
+
if (!effort)
|
|
547
|
+
return {};
|
|
548
|
+
if (effort === "low") {
|
|
549
|
+
return { thinking: { type: "disabled" } };
|
|
550
|
+
}
|
|
551
|
+
return {
|
|
552
|
+
thinking: { type: "enabled" },
|
|
553
|
+
reasoning_effort: effort === "xhigh" ? "max" : "high"
|
|
554
|
+
};
|
|
555
|
+
}
|
|
528
556
|
function opChatMessage(message) {
|
|
529
557
|
const { continuation, ...projected } = message;
|
|
530
558
|
if (message.role === "assistant" && continuation?.kind === "chat_completions_reasoning") {
|
|
@@ -541,7 +569,7 @@ function opChatEndpointUrl(apiBaseUrl, path) {
|
|
|
541
569
|
throw new Error("OpenPond OpChat API base URL is required.");
|
|
542
570
|
return `${normalized}/${path}`;
|
|
543
571
|
}
|
|
544
|
-
function opChatHeaders(token, accept, requestId) {
|
|
572
|
+
function opChatHeaders(requestUrl, token, accept, requestId) {
|
|
545
573
|
const trimmed = token.trim();
|
|
546
574
|
if (!trimmed)
|
|
547
575
|
throw new Error("OpenPond API key is required for OpChat.");
|
|
@@ -551,7 +579,7 @@ function opChatHeaders(token, accept, requestId) {
|
|
|
551
579
|
headers.set("Accept", accept);
|
|
552
580
|
headers.set("x-openpond-client", "openpond-app");
|
|
553
581
|
headers.set("x-openpond-request-id", requestId || randomUUID());
|
|
554
|
-
return headers;
|
|
582
|
+
return withVercelProtectionBypass(requestUrl, headers);
|
|
555
583
|
}
|
|
556
584
|
async function readOpChatError(response) {
|
|
557
585
|
const text = await response.text().catch(() => "");
|
|
@@ -578,72 +606,6 @@ function errorMessageFromPayload(payload) {
|
|
|
578
606
|
}
|
|
579
607
|
return [stringValue(record.error), stringValue(record.message)].filter(Boolean).join(": ") || JSON.stringify(payload);
|
|
580
608
|
}
|
|
581
|
-
async function* parseOpChatSse(stream, signal) {
|
|
582
|
-
const reader = stream.getReader();
|
|
583
|
-
const decoder = new TextDecoder();
|
|
584
|
-
let buffer = "";
|
|
585
|
-
const abortError = () => signal?.reason instanceof Error ? signal.reason : new Error("openpond_opchat_aborted");
|
|
586
|
-
try {
|
|
587
|
-
while (true) {
|
|
588
|
-
if (signal?.aborted)
|
|
589
|
-
throw abortError();
|
|
590
|
-
const result = await reader.read();
|
|
591
|
-
if (result.done)
|
|
592
|
-
break;
|
|
593
|
-
buffer += decoder.decode(result.value, { stream: true });
|
|
594
|
-
const blocks = buffer.split(/\r?\n\r?\n/);
|
|
595
|
-
buffer = blocks.pop() ?? "";
|
|
596
|
-
for (const block of blocks) {
|
|
597
|
-
for (const payload of parseSseBlock(block))
|
|
598
|
-
yield payload;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
} finally {
|
|
602
|
-
reader.releaseLock();
|
|
603
|
-
}
|
|
604
|
-
buffer += decoder.decode();
|
|
605
|
-
if (buffer.trim()) {
|
|
606
|
-
for (const payload of parseSseBlock(buffer))
|
|
607
|
-
yield payload;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
function parseSseBlock(block) {
|
|
611
|
-
const data = block.split(/\r?\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trim()).join("\n").trim();
|
|
612
|
-
if (!data || data === "[DONE]")
|
|
613
|
-
return [];
|
|
614
|
-
return [JSON.parse(data)];
|
|
615
|
-
}
|
|
616
|
-
function streamDeltasFromChunk(raw) {
|
|
617
|
-
if (!raw || typeof raw !== "object")
|
|
618
|
-
return [];
|
|
619
|
-
const record = raw;
|
|
620
|
-
const choices = Array.isArray(record.choices) ? record.choices : [];
|
|
621
|
-
const deltas = [];
|
|
622
|
-
for (const choice of choices) {
|
|
623
|
-
if (!choice || typeof choice !== "object")
|
|
624
|
-
continue;
|
|
625
|
-
const choiceRecord = choice;
|
|
626
|
-
const delta = choiceRecord.delta && typeof choiceRecord.delta === "object" ? choiceRecord.delta : {};
|
|
627
|
-
for (const key of ["content", "reasoning_content"]) {
|
|
628
|
-
const value = stringValue(delta[key]);
|
|
629
|
-
if (!value)
|
|
630
|
-
continue;
|
|
631
|
-
deltas.push({
|
|
632
|
-
type: key === "content" ? "text_delta" : "reasoning_delta",
|
|
633
|
-
text: value,
|
|
634
|
-
raw
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
const toolCalls = parseToolCalls(delta.tool_calls);
|
|
638
|
-
if (toolCalls.length > 0) {
|
|
639
|
-
deltas.push({ type: "tool_call_delta", toolCalls, raw });
|
|
640
|
-
}
|
|
641
|
-
const finishReason = stringValue(choiceRecord.finish_reason);
|
|
642
|
-
if (finishReason)
|
|
643
|
-
deltas.push({ type: "finish", finishReason, raw });
|
|
644
|
-
}
|
|
645
|
-
return deltas;
|
|
646
|
-
}
|
|
647
609
|
function parseToolCalls(value) {
|
|
648
610
|
return Array.isArray(value) ? value.filter((item) => Boolean(item) && typeof item === "object") : [];
|
|
649
611
|
}
|
|
@@ -658,6 +620,9 @@ function parseUsage(raw) {
|
|
|
658
620
|
function stringValue(value) {
|
|
659
621
|
return typeof value === "string" && value.trim() ? value : null;
|
|
660
622
|
}
|
|
623
|
+
function streamTextValue(value) {
|
|
624
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
625
|
+
}
|
|
661
626
|
|
|
662
627
|
// ../../packages/runtime/dist/version.js
|
|
663
628
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -837,71 +802,76 @@ async function loadAccountProfileLookups(context) {
|
|
|
837
802
|
const key = profileKey(account.handle, account.baseUrl);
|
|
838
803
|
const token = accountToken(account);
|
|
839
804
|
if (!token) {
|
|
840
|
-
return [
|
|
805
|
+
return [
|
|
806
|
+
key,
|
|
807
|
+
{ response: null, authFailed: false, error: null }
|
|
808
|
+
];
|
|
841
809
|
}
|
|
842
810
|
try {
|
|
843
811
|
return [
|
|
844
812
|
key,
|
|
845
813
|
{
|
|
846
814
|
response: await getOpenPondAccount(resolvePublicApiBaseUrl(account, context.config), token),
|
|
847
|
-
authFailed: false
|
|
815
|
+
authFailed: false,
|
|
816
|
+
error: null
|
|
817
|
+
}
|
|
818
|
+
];
|
|
819
|
+
} catch (error) {
|
|
820
|
+
return [
|
|
821
|
+
key,
|
|
822
|
+
{
|
|
823
|
+
response: null,
|
|
824
|
+
authFailed: true,
|
|
825
|
+
error: errorMessage(error)
|
|
848
826
|
}
|
|
849
827
|
];
|
|
850
|
-
} catch {
|
|
851
|
-
return [key, { response: null, authFailed: true }];
|
|
852
828
|
}
|
|
853
829
|
}));
|
|
854
830
|
return Object.fromEntries(entries);
|
|
855
831
|
}
|
|
832
|
+
async function loadOpenPondAccountStateForContext(context) {
|
|
833
|
+
const accountProfiles = await loadAccountProfileLookups(context);
|
|
834
|
+
const activeLookup = context.account ? accountProfiles[profileKey(context.account.handle, context.account.baseUrl)] ?? null : null;
|
|
835
|
+
const accountResponse = activeLookup?.response ?? null;
|
|
836
|
+
const authError = context.token && activeLookup?.authFailed ? activeLookup.error || "OpenPond account authentication failed." : null;
|
|
837
|
+
return {
|
|
838
|
+
account: toAccountState({
|
|
839
|
+
...context,
|
|
840
|
+
accountResponse,
|
|
841
|
+
accountProfiles,
|
|
842
|
+
authFailed: Boolean(authError),
|
|
843
|
+
error: authError
|
|
844
|
+
})
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
async function loadOpenPondAccountState() {
|
|
848
|
+
return loadOpenPondAccountStateForContext(await loadOpenPondAccountContext());
|
|
849
|
+
}
|
|
856
850
|
async function loadOpenPondApps(options = {}) {
|
|
857
851
|
const context = await loadOpenPondAccountContext();
|
|
852
|
+
const accountPromise = loadOpenPondAccountStateForContext(context);
|
|
858
853
|
if (!context.token) {
|
|
859
|
-
const accountProfiles2 = await loadAccountProfileLookups(context);
|
|
860
854
|
return {
|
|
861
|
-
|
|
855
|
+
...await accountPromise,
|
|
862
856
|
apps: [],
|
|
863
857
|
error: "No OpenPond API key or session token is configured."
|
|
864
858
|
};
|
|
865
859
|
}
|
|
866
|
-
const [
|
|
867
|
-
|
|
868
|
-
getOpenPondAccount(context.apiBaseUrl, context.token),
|
|
860
|
+
const [accountResult, appsResult] = await Promise.allSettled([
|
|
861
|
+
accountPromise,
|
|
869
862
|
listApps(context.apiBaseUrl, context.token, {
|
|
870
863
|
handle: context.account?.handle,
|
|
871
864
|
limit: options.limit ?? 20,
|
|
872
865
|
offset: options.offset ?? 0,
|
|
873
866
|
includeScheduled: options.includeScheduled ?? true
|
|
874
|
-
})
|
|
875
|
-
loadAccountProfileLookups(context)
|
|
867
|
+
})
|
|
876
868
|
]);
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
const accountProfiles = accountProfilesResult.status === "fulfilled" ? accountProfilesResult.value : {};
|
|
880
|
-
if (accountResult.status === "fulfilled" && context.account) {
|
|
881
|
-
accountProfiles[profileKey(context.account.handle, context.account.baseUrl)] = {
|
|
882
|
-
response: accountResult.value,
|
|
883
|
-
authFailed: false
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
const appsSucceeded = appsResult.status === "fulfilled";
|
|
887
|
-
const accountSucceeded = accountResult.status === "fulfilled";
|
|
888
|
-
const anyAuthenticatedCallSucceeded = appsSucceeded || accountSucceeded || health?.authenticated === true;
|
|
889
|
-
const allAuthenticatedCallsFailed = !appsSucceeded && !accountSucceeded && health?.authenticated !== true;
|
|
890
|
-
const authError = health?.authenticated === false && !anyAuthenticatedCallSucceeded ? health.error || "OpenPond account authentication failed." : allAuthenticatedCallsFailed ? appsResult.status === "rejected" ? errorMessage(appsResult.reason) : accountResult.status === "rejected" ? errorMessage(accountResult.reason) : null : null;
|
|
891
|
-
const profileError = accountResult.status === "rejected" && anyAuthenticatedCallSucceeded ? `Profile unavailable: ${errorMessage(accountResult.reason)}` : null;
|
|
892
|
-
const appsError = appsResult.status === "rejected" ? errorMessage(appsResult.reason) : null;
|
|
893
|
-
const effectiveHealth = health && anyAuthenticatedCallSucceeded ? { ...health, authenticated: true, error: void 0 } : health;
|
|
869
|
+
if (accountResult.status === "rejected")
|
|
870
|
+
throw accountResult.reason;
|
|
894
871
|
return {
|
|
895
|
-
account:
|
|
896
|
-
...context,
|
|
897
|
-
accountResponse,
|
|
898
|
-
accountProfiles,
|
|
899
|
-
health: effectiveHealth,
|
|
900
|
-
authFailed: Boolean(authError),
|
|
901
|
-
error: authError ?? profileError
|
|
902
|
-
}),
|
|
872
|
+
account: accountResult.value.account,
|
|
903
873
|
apps: appsResult.status === "fulfilled" ? appsResult.value.map(normalizeApp).filter((value) => Boolean(value)) : [],
|
|
904
|
-
error:
|
|
874
|
+
error: appsResult.status === "rejected" ? errorMessage(appsResult.reason) : null
|
|
905
875
|
};
|
|
906
876
|
}
|
|
907
877
|
async function createOpenPondRepoApp(input) {
|
|
@@ -939,20 +909,6 @@ async function deriveHandleForApiKey(input, apiBaseUrl) {
|
|
|
939
909
|
return fromProfile;
|
|
940
910
|
} catch {
|
|
941
911
|
}
|
|
942
|
-
try {
|
|
943
|
-
const apps = await listApps(apiBaseUrl, input.apiKey);
|
|
944
|
-
const counts = /* @__PURE__ */ new Map();
|
|
945
|
-
for (const app of apps) {
|
|
946
|
-
const handle2 = normalizeDerivedHandle(app.handle);
|
|
947
|
-
if (!handle2)
|
|
948
|
-
continue;
|
|
949
|
-
counts.set(handle2, (counts.get(handle2) ?? 0) + 1);
|
|
950
|
-
}
|
|
951
|
-
const [handle] = Array.from(counts.entries()).sort((left, right) => right[1] - left[1])[0] ?? [];
|
|
952
|
-
if (handle)
|
|
953
|
-
return handle;
|
|
954
|
-
} catch {
|
|
955
|
-
}
|
|
956
912
|
return fallbackHandleForApiKey(input.apiKey);
|
|
957
913
|
}
|
|
958
914
|
async function saveOpenPondAccount(input) {
|
|
@@ -972,8 +928,41 @@ async function saveOpenPondAccount(input) {
|
|
|
972
928
|
return loadOpenPondAccountContext(handle, baseUrl);
|
|
973
929
|
}
|
|
974
930
|
|
|
931
|
+
// ../../packages/runtime/dist/remove-account.js
|
|
932
|
+
function findAccountIndex(accounts, handle, baseUrl) {
|
|
933
|
+
const normalizedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
934
|
+
const exactIndex = accounts.findIndex((account) => handleEquals(account.handle, handle) && baseUrlEquals(account.baseUrl, normalizedBaseUrl));
|
|
935
|
+
if (exactIndex !== -1)
|
|
936
|
+
return exactIndex;
|
|
937
|
+
const matchingIndexes = accounts.map((account, index) => ({ account, index })).filter(({ account }) => handleEquals(account.handle, handle));
|
|
938
|
+
if (matchingIndexes.length === 1)
|
|
939
|
+
return matchingIndexes[0].index;
|
|
940
|
+
if (matchingIndexes.length > 1) {
|
|
941
|
+
throw new Error(`Multiple OpenPond accounts match ${handle}; select one with its base URL.`);
|
|
942
|
+
}
|
|
943
|
+
return -1;
|
|
944
|
+
}
|
|
945
|
+
async function removeOpenPondAccount(input) {
|
|
946
|
+
const handle = input.handle.trim();
|
|
947
|
+
if (!handle)
|
|
948
|
+
throw new Error("OpenPond account handle is required.");
|
|
949
|
+
const config = await loadGlobalConfig();
|
|
950
|
+
const accounts = (config.accounts ?? []).map((account2) => ({ ...account2 }));
|
|
951
|
+
const index = findAccountIndex(accounts, handle, input.baseUrl);
|
|
952
|
+
if (index === -1)
|
|
953
|
+
throw new Error(`OpenPond account not found: ${handle}`);
|
|
954
|
+
const account = accounts[index];
|
|
955
|
+
const activeProfile = normalizeActiveProfile(config.activeProfile);
|
|
956
|
+
if (activeProfile && accountMatchesSelector(account, activeProfile)) {
|
|
957
|
+
throw new Error("Switch to another OpenPond account before removing the active account.");
|
|
958
|
+
}
|
|
959
|
+
accounts.splice(index, 1);
|
|
960
|
+
await saveConfig({ ...config, accounts });
|
|
961
|
+
return loadOpenPondAccountContext();
|
|
962
|
+
}
|
|
963
|
+
|
|
975
964
|
// ../../packages/runtime/dist/update-account-config.js
|
|
976
|
-
function
|
|
965
|
+
function findAccountIndex2(accounts, handle, currentBaseUrl) {
|
|
977
966
|
const normalizedCurrentBaseUrl = normalizeBaseUrl(currentBaseUrl);
|
|
978
967
|
const exactIndex = accounts.findIndex((account) => handleEquals(account.handle, handle) && baseUrlEquals(account.baseUrl, normalizedCurrentBaseUrl));
|
|
979
968
|
if (exactIndex !== -1)
|
|
@@ -1003,7 +992,7 @@ async function updateOpenPondAccountConfig(input) {
|
|
|
1003
992
|
throw new Error("OpenPond account handle is required.");
|
|
1004
993
|
const config = await loadGlobalConfig();
|
|
1005
994
|
const accounts = (config.accounts ?? []).map((account) => ({ ...account }));
|
|
1006
|
-
const index =
|
|
995
|
+
const index = findAccountIndex2(accounts, handle, input.currentBaseUrl);
|
|
1007
996
|
if (index === -1)
|
|
1008
997
|
throw new Error(`OpenPond account not found: ${handle}`);
|
|
1009
998
|
const previousAccount = accounts[index];
|
|
@@ -1082,11 +1071,13 @@ function nextLineEnd(value) {
|
|
|
1082
1071
|
export {
|
|
1083
1072
|
loadOpenPondAccountContext,
|
|
1084
1073
|
switchOpenPondAccount,
|
|
1074
|
+
loadOpenPondAccountState,
|
|
1085
1075
|
loadOpenPondApps,
|
|
1086
1076
|
createOpenPondRepoApp,
|
|
1087
1077
|
loadOpenPondProviderCatalog,
|
|
1088
1078
|
streamOpenPondHostedChatTurn,
|
|
1089
1079
|
saveOpenPondAccount,
|
|
1080
|
+
removeOpenPondAccount,
|
|
1090
1081
|
updateOpenPondAccountConfig,
|
|
1091
1082
|
getOpenPondAppEnvironment,
|
|
1092
1083
|
getBundledRuntimeVersion,
|