openpond 0.0.38 → 0.0.40
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-UPNMLDO5.js} +37 -11
- package/dist/chunks/app-server-runtime-2WTZXXOF.js +18 -0
- package/dist/chunks/{apps-AKBI6AS7.js → apps-XLPSFCW4.js} +6 -4
- package/dist/chunks/{chunk-LZZM3IHS.js → chunk-2SF6HLT7.js} +5899 -5939
- package/dist/chunks/chunk-34U5C7ZD.js +37172 -0
- 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-YTJL6XPU.js → chunk-75ZLFVFZ.js} +56 -11
- package/dist/chunks/{chunk-HS2AGRDV.js → chunk-CZG4XKVF.js} +1 -1
- package/dist/chunks/chunk-DBHSOTYZ.js +1552 -0
- package/dist/chunks/{chunk-275WCETC.js → chunk-FCVVOMIP.js} +145 -5
- package/dist/chunks/{chunk-AHNFNWUN.js → chunk-HHALVXPK.js} +1 -1
- package/dist/chunks/{chunk-GB6VUZUA.js → chunk-JIEUB6OS.js} +1 -1
- package/dist/chunks/chunk-KHNHUA2H.js +1737 -0
- package/dist/chunks/{chunk-GDZYDLEL.js → chunk-KSOI7GFA.js} +1 -110
- package/dist/chunks/chunk-M2NXTLH2.js +4054 -0
- package/dist/chunks/{chunk-AHPQTEIJ.js → chunk-MCBAI5M5.js} +4 -4
- package/dist/chunks/{chunk-SLMP353Q.js → chunk-MIZHCABO.js} +2 -195
- package/dist/chunks/{chunk-XCATKTK3.js → chunk-QHUJ2XVJ.js} +108 -66
- 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/{chunk-QRM7XMAO.js → chunk-ZTE6A2VE.js} +155 -163
- package/dist/chunks/{cli-7BKDWFNU.js → cli-ZIY4LAYZ.js} +9 -5
- package/dist/chunks/{core-commands-YN4RMWA3.js → core-commands-D66KZEHU.js} +7 -5
- package/dist/chunks/{harness-BHQRMXJR.js → desktop-test-FDA6MV77.js} +15 -14
- package/dist/chunks/{chunk-XERQHYBO.js → extension-GDRW22N3.js} +5868 -3580
- package/dist/chunks/{help-VREQNA4I.js → help-7QG4UITV.js} +1 -1
- package/dist/chunks/{opchat-D63YTNSX.js → opchat-I2WGEFGU.js} +9 -10
- package/dist/chunks/{organizations-I46KG7TC.js → organizations-MADRLI2I.js} +11 -9
- package/dist/chunks/{profile-WKZJHEPG.js → profile-B4A3GT3U.js} +12 -38
- package/dist/chunks/{project-agent-ZUC3YMCT.js → project-agent-PCO42FZJ.js} +9 -411
- package/dist/chunks/{sandbox-command-AAOPFTI5.js → sandbox-command-LBKSIR7P.js} +7 -5
- package/dist/chunks/{sandbox-template-GKNVR4C5.js → sandbox-template-YJXGG4H3.js} +8 -6
- package/dist/chunks/src-23HDSVNH.js +63517 -0
- package/dist/chunks/{src-RPW5TOPI.js → src-35JYS27L.js} +32 -30
- package/dist/chunks/{teams-bot-PSL3ZO6Z.js → teams-bot-L4SR2SWM.js} +6 -4
- package/dist/chunks/training-BR5A7SPU.js +320 -0
- package/dist/chunks/{workspaces-BPXC2DHT.js → workspaces-NGDIBOKQ.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
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
parseSandboxRuntimeProfileIdOption,
|
|
5
5
|
parseSandboxRuntimePromotionPolicyOption,
|
|
6
6
|
parseSandboxWorkflowModeOption
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FCVVOMIP.js";
|
|
8
8
|
import {
|
|
9
9
|
parseBooleanOption,
|
|
10
10
|
parseCsvOption,
|
|
@@ -79,7 +79,6 @@ function formatSandboxLine(sandbox) {
|
|
|
79
79
|
return [
|
|
80
80
|
sandbox.id,
|
|
81
81
|
sandbox.state,
|
|
82
|
-
sandbox.runtimeDriver,
|
|
83
82
|
`spent=${captured}/${budget}`,
|
|
84
83
|
mppMode,
|
|
85
84
|
repo
|
|
@@ -589,7 +588,6 @@ function summarizeSandbox(sandbox) {
|
|
|
589
588
|
return {
|
|
590
589
|
id: sandbox.id,
|
|
591
590
|
state: sandbox.state,
|
|
592
|
-
runtimeDriver: sandbox.runtimeDriver,
|
|
593
591
|
repo: sandbox.repo,
|
|
594
592
|
runtimeId: sandbox.runtimeId ?? null,
|
|
595
593
|
repoRef: sandbox.repoRef ?? null,
|
|
@@ -1,10 +1,228 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
3
|
+
withVercelProtectionBypass
|
|
4
|
+
} from "./chunk-DBHSOTYZ.js";
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_OPENPOND_OPCHAT_API_BASE_URL
|
|
7
|
+
} from "./chunk-KSRWKXRB.js";
|
|
8
|
+
|
|
9
|
+
// ../../packages/cloud/src/hosted-chat.ts
|
|
10
|
+
import { randomUUID } from "node:crypto";
|
|
11
|
+
function normalizeApiBaseUrl(value) {
|
|
12
|
+
const trimmed = normalizeOptionalOpChatApiBaseUrl(value);
|
|
13
|
+
if (!trimmed) throw new Error("apiBaseUrl is required");
|
|
14
|
+
return trimmed;
|
|
15
|
+
}
|
|
16
|
+
function trimTrailingSlashes(value) {
|
|
17
|
+
return value.replace(/\/+$/, "");
|
|
18
|
+
}
|
|
19
|
+
function normalizeOptionalOpChatApiBaseUrl(value) {
|
|
20
|
+
let trimmed = trimTrailingSlashes(value?.trim() ?? "");
|
|
21
|
+
if (!trimmed) return null;
|
|
22
|
+
trimmed = trimmed.replace(/\/chat\/completions$/i, "").replace(/\/models(?:\/[^/]+)?$/i, "");
|
|
23
|
+
if (trimmed.endsWith("/opchat/v1")) return trimmed;
|
|
24
|
+
if (trimmed.endsWith("/opchat")) return `${trimmed}/v1`;
|
|
25
|
+
if (trimmed.endsWith("/v1")) {
|
|
26
|
+
trimmed = trimmed.slice(0, -"/v1".length);
|
|
27
|
+
}
|
|
28
|
+
return `${trimTrailingSlashes(trimmed)}/opchat/v1`;
|
|
29
|
+
}
|
|
30
|
+
function resolveOpChatApiBaseUrl(options = {}) {
|
|
31
|
+
const runtimeEnv = options.env ?? (typeof process !== "undefined" ? process.env : {});
|
|
32
|
+
const explicit = normalizeOptionalOpChatApiBaseUrl(options.opChatApiBaseUrl) ?? normalizeOptionalOpChatApiBaseUrl(runtimeEnv.OPENPOND_OPCHAT_API_URL);
|
|
33
|
+
if (explicit) return explicit;
|
|
34
|
+
const migrationInput = normalizeOptionalOpChatApiBaseUrl(options.chatApiBaseUrl) ?? normalizeOptionalOpChatApiBaseUrl(runtimeEnv.OPENPOND_CHAT_API_URL) ?? normalizeOptionalOpChatApiBaseUrl(runtimeEnv.OPENPOND_GATEWAY_URL);
|
|
35
|
+
if (migrationInput) return migrationInput;
|
|
36
|
+
const apiBase = normalizeOptionalOpChatApiBaseUrl(options.apiBaseUrl) ?? normalizeOptionalOpChatApiBaseUrl(runtimeEnv.OPENPOND_API_URL);
|
|
37
|
+
return apiBase ?? DEFAULT_OPENPOND_OPCHAT_API_BASE_URL;
|
|
38
|
+
}
|
|
39
|
+
function requireToken(value) {
|
|
40
|
+
const trimmed = value.trim();
|
|
41
|
+
if (!trimmed) throw new Error("OpenPond API key is required");
|
|
42
|
+
return trimmed;
|
|
43
|
+
}
|
|
44
|
+
function hostedHeaders(requestUrl, token, accept, requestId) {
|
|
45
|
+
const headers = new Headers();
|
|
46
|
+
headers.set("Authorization", `Bearer ${requireToken(token)}`);
|
|
47
|
+
headers.set("Content-Type", "application/json");
|
|
48
|
+
headers.set("Accept", accept);
|
|
49
|
+
headers.set("x-openpond-client", "openpond-code");
|
|
50
|
+
headers.set("x-openpond-request-id", requestId || randomUUID());
|
|
51
|
+
return withVercelProtectionBypass(requestUrl, headers);
|
|
52
|
+
}
|
|
53
|
+
async function readError(response) {
|
|
54
|
+
const text = await response.text().catch(() => "");
|
|
55
|
+
if (!text) return response.statusText || `HTTP ${response.status}`;
|
|
56
|
+
try {
|
|
57
|
+
const payload = JSON.parse(text);
|
|
58
|
+
const error = typeof payload.error === "string" ? payload.error : payload.error && typeof payload.error === "object" && !Array.isArray(payload.error) ? payload.error : null;
|
|
59
|
+
const code = typeof payload.code === "string" ? payload.code : error && typeof error !== "string" && typeof error.code === "string" ? error.code : null;
|
|
60
|
+
const message = typeof payload.message === "string" ? payload.message : error && typeof error !== "string" && typeof error.message === "string" ? error.message : null;
|
|
61
|
+
const label = typeof error === "string" ? error : error && typeof error.type === "string" ? error.type : null;
|
|
62
|
+
return [code, label, message].filter(Boolean).join(": ") || text;
|
|
63
|
+
} catch {
|
|
64
|
+
return text;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function buildHostedChatBody(options, stream) {
|
|
68
|
+
const body = {
|
|
69
|
+
model: options.model,
|
|
70
|
+
messages: options.messages,
|
|
71
|
+
stream
|
|
72
|
+
};
|
|
73
|
+
if (typeof options.temperature === "number") {
|
|
74
|
+
body.temperature = options.temperature;
|
|
75
|
+
}
|
|
76
|
+
if (typeof options.maxTokens === "number") {
|
|
77
|
+
body.max_tokens = options.maxTokens;
|
|
78
|
+
}
|
|
79
|
+
if (options.tools) {
|
|
80
|
+
body.tools = options.tools;
|
|
81
|
+
}
|
|
82
|
+
const toolChoice = options.toolChoice ?? options.tool_choice;
|
|
83
|
+
if (toolChoice !== void 0) {
|
|
84
|
+
body.tool_choice = toolChoice;
|
|
85
|
+
}
|
|
86
|
+
if (options.metadata) {
|
|
87
|
+
body.metadata = options.metadata;
|
|
88
|
+
}
|
|
89
|
+
return body;
|
|
90
|
+
}
|
|
91
|
+
async function listOpChatModels(options) {
|
|
92
|
+
const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
|
|
93
|
+
const requestUrl = `${apiBaseUrl}/models`;
|
|
94
|
+
const response = await fetch(requestUrl, {
|
|
95
|
+
method: "GET",
|
|
96
|
+
headers: hostedHeaders(requestUrl, options.token, "application/json"),
|
|
97
|
+
signal: options.signal
|
|
98
|
+
});
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
throw new Error(
|
|
101
|
+
`Hosted model list failed: ${response.status} ${await readError(
|
|
102
|
+
response
|
|
103
|
+
)}`
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
return await response.json();
|
|
107
|
+
}
|
|
108
|
+
async function getOpChatModel(options) {
|
|
109
|
+
const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
|
|
110
|
+
const requestUrl = `${apiBaseUrl}/models/${encodeURIComponent(options.model)}`;
|
|
111
|
+
const response = await fetch(
|
|
112
|
+
requestUrl,
|
|
113
|
+
{
|
|
114
|
+
method: "GET",
|
|
115
|
+
headers: hostedHeaders(requestUrl, options.token, "application/json"),
|
|
116
|
+
signal: options.signal
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
if (!response.ok) {
|
|
120
|
+
throw new Error(
|
|
121
|
+
`Hosted model lookup failed: ${response.status} ${await readError(
|
|
122
|
+
response
|
|
123
|
+
)}`
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
return await response.json();
|
|
127
|
+
}
|
|
128
|
+
async function sendHostedChatTurn(options) {
|
|
129
|
+
const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
|
|
130
|
+
const requestUrl = `${apiBaseUrl}/chat/completions`;
|
|
131
|
+
const response = await fetch(requestUrl, {
|
|
132
|
+
method: "POST",
|
|
133
|
+
headers: hostedHeaders(
|
|
134
|
+
requestUrl,
|
|
135
|
+
options.token,
|
|
136
|
+
"application/json",
|
|
137
|
+
options.requestId
|
|
138
|
+
),
|
|
139
|
+
body: JSON.stringify(buildHostedChatBody(options, false)),
|
|
140
|
+
signal: options.signal
|
|
141
|
+
});
|
|
142
|
+
if (!response.ok) {
|
|
143
|
+
throw new Error(
|
|
144
|
+
`Hosted chat failed: ${response.status} ${await readError(response)}`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
return await response.json();
|
|
148
|
+
}
|
|
149
|
+
async function* parseOpenAISSE(stream, signal) {
|
|
150
|
+
const reader = stream.getReader();
|
|
151
|
+
const decoder = new TextDecoder();
|
|
152
|
+
let buffer = "";
|
|
153
|
+
const readAbortError = () => signal?.reason instanceof Error ? signal.reason : new Error("hosted_chat_aborted");
|
|
154
|
+
try {
|
|
155
|
+
while (true) {
|
|
156
|
+
if (signal?.aborted) throw readAbortError();
|
|
157
|
+
const result = await reader.read();
|
|
158
|
+
if (result.done) break;
|
|
159
|
+
buffer += decoder.decode(result.value, { stream: true });
|
|
160
|
+
const lines = buffer.split("\n");
|
|
161
|
+
buffer = lines.pop() || "";
|
|
162
|
+
for (const line of lines) {
|
|
163
|
+
const trimmed = line.trim();
|
|
164
|
+
if (!trimmed.startsWith("data:")) continue;
|
|
165
|
+
const data = trimmed.slice(5).trim();
|
|
166
|
+
if (!data) continue;
|
|
167
|
+
if (data === "[DONE]") return;
|
|
168
|
+
yield JSON.parse(data);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
} finally {
|
|
172
|
+
try {
|
|
173
|
+
reader.releaseLock();
|
|
174
|
+
} catch {
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async function* streamHostedChatTurn(options) {
|
|
179
|
+
const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
|
|
180
|
+
const requestUrl = `${apiBaseUrl}/chat/completions`;
|
|
181
|
+
const response = await fetch(requestUrl, {
|
|
182
|
+
method: "POST",
|
|
183
|
+
headers: hostedHeaders(
|
|
184
|
+
requestUrl,
|
|
185
|
+
options.token,
|
|
186
|
+
"text/event-stream",
|
|
187
|
+
options.requestId
|
|
188
|
+
),
|
|
189
|
+
body: JSON.stringify(buildHostedChatBody(options, true)),
|
|
190
|
+
signal: options.signal
|
|
191
|
+
});
|
|
192
|
+
if (!response.ok || !response.body) {
|
|
193
|
+
throw new Error(
|
|
194
|
+
`Hosted chat stream failed: ${response.status} ${await readError(
|
|
195
|
+
response
|
|
196
|
+
)}`
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
for await (const raw of parseOpenAISSE(response.body, options.signal)) {
|
|
200
|
+
const chunk = raw;
|
|
201
|
+
if (chunk.error) {
|
|
202
|
+
throw new Error(chunk.error.message || "Hosted chat stream error");
|
|
203
|
+
}
|
|
204
|
+
if (chunk.usage) {
|
|
205
|
+
yield { type: "usage", usage: chunk.usage, raw };
|
|
206
|
+
}
|
|
207
|
+
const choice = chunk.choices?.[0];
|
|
208
|
+
if (!choice) continue;
|
|
209
|
+
const content = choice.delta?.content;
|
|
210
|
+
if (content) {
|
|
211
|
+
yield { type: "text_delta", text: content, raw };
|
|
212
|
+
}
|
|
213
|
+
const reasoning = choice.delta?.reasoning_content;
|
|
214
|
+
if (reasoning) {
|
|
215
|
+
yield { type: "reasoning_delta", text: reasoning, raw };
|
|
216
|
+
}
|
|
217
|
+
const toolCalls = choice.delta?.tool_calls;
|
|
218
|
+
if (Array.isArray(toolCalls) && toolCalls.length > 0) {
|
|
219
|
+
yield { type: "tool_call_delta", toolCalls, raw };
|
|
220
|
+
}
|
|
221
|
+
if (choice.finish_reason !== void 0 && choice.finish_reason !== null) {
|
|
222
|
+
yield { type: "finish", finishReason: choice.finish_reason, raw };
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
8
226
|
|
|
9
227
|
// ../../packages/cloud/src/opchat-smoke.ts
|
|
10
228
|
var DEFAULT_MODEL = "openpond-chat";
|
|
@@ -290,5 +508,10 @@ function formatUsage(usage) {
|
|
|
290
508
|
}
|
|
291
509
|
|
|
292
510
|
export {
|
|
511
|
+
resolveOpChatApiBaseUrl,
|
|
512
|
+
listOpChatModels,
|
|
513
|
+
getOpChatModel,
|
|
514
|
+
sendHostedChatTurn,
|
|
515
|
+
streamHostedChatTurn,
|
|
293
516
|
runOpChatSmoke
|
|
294
517
|
};
|
|
@@ -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-ZTE6A2VE.js";
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_HOST,
|
|
11
|
+
DEFAULT_PORT,
|
|
12
|
+
parseListen
|
|
13
|
+
} from "./chunk-CZG4XKVF.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
|
};
|
|
@@ -3,7 +3,7 @@ import { createRequire as __openpondCreateRequire } from "node:module"; var requ
|
|
|
3
3
|
// ../server/src/constants.ts
|
|
4
4
|
var DEFAULT_HOST = "127.0.0.1";
|
|
5
5
|
var DEFAULT_PORT = 17874;
|
|
6
|
-
var VERSION = "0.0.
|
|
6
|
+
var VERSION = "0.0.40";
|
|
7
7
|
var HOSTED_CHAT_SYSTEM_PROMPT = "You are OpenPond Chat. Respond in the user's language. If the user's latest message is language-neutral, ambiguous, or only a short test, respond in English. Be concise and directly answer the latest request. Do not use emojis. Use Markdown when it improves scanability. If you emit reasoning or thinking content, keep it sparse and user-readable: at most one short sentence for major progress, decisions, or blockers. Omit reasoning for routine searches, reads, tool calls, and obvious next steps. Do not restate the user request, narrate every action, or include code blocks, code excerpts, diffs, raw tool payloads, or markdown examples in reasoning. Put necessary code or exact snippets only in the final assistant answer. When the user asks to show or preview an image that is available as a workspace path or signed image URL, use Markdown image syntax like  instead of a bare path or raw HTML. For workspace-backed answers, use a Codex-style shape: brief outcome first, then Changed Files if files changed, then Verification if checks ran. End with a concise final answer that summarizes the result and verification when relevant. Do not mention raw tool JSON, internal repo paths, or origin/remote URLs unless the user explicitly asks for them or they are necessary to explain a git/deploy failure.";
|
|
8
8
|
var APP_PREFERENCES_CACHE_TYPE = "app_preferences";
|
|
9
9
|
var APP_PREFERENCES_CACHE_KEY = "global";
|