openpond 0.0.56 → 0.0.58
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 -0
- package/dist/chunks/actions-command-BNVIILSL.js +184 -0
- package/dist/chunks/{app-layer-T26MAAGI.js → app-layer-RNQXXM6L.js} +5 -4
- package/dist/chunks/{app-server-runtime-64AV5AXJ.js → app-server-runtime-WYIRC5LV.js} +7 -7
- package/dist/chunks/{apps-7KLTYKHN.js → apps-LV3CSMLT.js} +5 -4
- package/dist/chunks/{chunk-M2OSF2YN.js → chunk-2J3LG4U7.js} +2 -2
- package/dist/chunks/{chunk-3HW6OSHP.js → chunk-63N6442Q.js} +1 -1
- package/dist/chunks/{chunk-6QWTEC2D.js → chunk-7QLVLGDM.js} +1 -1
- package/dist/chunks/{chunk-Q4YKGVNG.js → chunk-AD6KZWHL.js} +519 -131
- package/dist/chunks/{chunk-H44J7BB4.js → chunk-BFR6VZ2A.js} +1 -1
- package/dist/chunks/{chunk-KHNHUA2H.js → chunk-DXSHQ6TO.js} +111 -1
- package/dist/chunks/{chunk-FCVVOMIP.js → chunk-FHP7OMEI.js} +3 -31
- package/dist/chunks/{chunk-MIZHCABO.js → chunk-I23UKEYS.js} +1 -1
- package/dist/chunks/{chunk-EIRW6Z6S.js → chunk-LMQ4MPQI.js} +2 -2
- package/dist/chunks/{chunk-OSLQMUIB.js → chunk-OI65U2B5.js} +1 -1
- package/dist/chunks/{chunk-55KT7K5P.js → chunk-PVGJXCAK.js} +3 -2
- package/dist/chunks/chunk-QETF6ILG.js +15004 -0
- package/dist/chunks/{chunk-CW6FAJEF.js → chunk-QIB27QOT.js} +5 -5
- package/dist/chunks/{chunk-JSRCXDIL.js → chunk-RC3N77IV.js} +52 -32
- package/dist/chunks/chunk-SKUS4NPW.js +633 -0
- package/dist/chunks/{chunk-US7DOPAH.js → chunk-VG4H4TQG.js} +65 -58
- package/dist/chunks/{cli-J7EKEJZV.js → cli-EPVMUYQT.js} +6 -6
- package/dist/chunks/{core-commands-SND555SC.js → core-commands-H2UC3LHG.js} +6 -5
- package/dist/chunks/{desktop-test-WSWXNSFS.js → desktop-test-TV64EY5A.js} +5 -4
- package/dist/chunks/{extension-3IKF6YQE.js → extension-XMWCG6YG.js} +9 -9
- package/dist/chunks/{help-DHGNXUA4.js → help-NEYFMHWQ.js} +1 -1
- package/dist/chunks/{opchat-XYKT5KKO.js → opchat-ZL5JJQ5L.js} +5 -4
- package/dist/chunks/{organizations-HKVC4CSA.js → organizations-4IEC35QB.js} +8 -7
- package/dist/chunks/{profile-PLWXQHKF.js → profile-EVASCDIN.js} +6 -5
- package/dist/chunks/{project-agent-JNSP56KG.js → project-agent-DMN64RZJ.js} +6 -5
- package/dist/chunks/{sandbox-command-Z6LNNSSL.js → sandbox-command-WKGVO32R.js} +6 -5
- package/dist/chunks/{sandbox-template-FVW2UTI4.js → sandbox-template-BJUS4KJM.js} +7 -6
- package/dist/chunks/{src-6UCIW76H.js → src-NJYDLJ2M.js} +727 -521
- package/dist/chunks/{src-2TP42H76.js → src-SR3UHNV4.js} +4 -4
- package/dist/chunks/{teams-bot-FNPT4Q2B.js → teams-bot-HUXYJ6XA.js} +5 -4
- package/dist/chunks/{workspaces-4A2OR2OP.js → workspaces-N2WWI77O.js} +2 -2
- package/dist/cli.js +13 -13
- package/dist/web/assets/{AppDialog-BEKS_Ixr.js → AppDialog-CxLYXiI1.js} +1 -1
- package/dist/web/assets/{AppsView-CbuT2sT2.js → AppsView-CVTUkahv.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-DgqVeW5u.js → BrowserSidebar-oHniLA05.js} +1 -1
- package/dist/web/assets/{CommandMenu-CQcaEB76.js → CommandMenu-Db_5OiKs.js} +1 -1
- package/dist/web/assets/{CommunityView-CYX6iFcg.js → CommunityView-HTwMEO-T.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-DY4SQbL4.js → ComposerCreateImproveStrip-ER26yFe-.js} +1 -1
- package/dist/web/assets/{GetStartedView-DnxeZaBB.js → GetStartedView-l9MUYMYH.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-DYTfYGWv.js → LabModelVersionDetailPage-Dgf-DlJi.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-BpD-kjP_.js → LabSkillSidebar-CyX8sVm1.js} +1 -1
- package/dist/web/assets/{LabsRoute-DVC7eZCs.js → LabsRoute-BC1ST9qT.js} +3 -3
- package/dist/web/assets/{MainChatThread-DTiX_8MC.js → MainChatThread-BfW92Rv1.js} +2 -2
- package/dist/web/assets/{MainPane-CNoHJkXy.js → MainPane-DlciH8yR.js} +3 -3
- package/dist/web/assets/{MarkdownText-_JhfBcQL.js → MarkdownText-CyOeCVjf.js} +1 -1
- package/dist/web/assets/{Messages-Bo0-Uvcz.js → Messages-BDtEbIKv.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-CHQ87FW2.js → NativeSkillSidebar-D0BlvEtE.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-B-1KuU5u.js → NewProjectDialog-CiGPfI5s.js} +1 -1
- package/dist/web/assets/{OutputsPage-BSimpEpA.js → OutputsPage-DNU2yD7q.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-B8ZOyuFO.js → RightChatPanelStack-Cs63fQwk.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-Blwy1G8r.js → ScheduledWorkPage-DMKHFbeE.js} +1 -1
- package/dist/web/assets/{SettingsView-CTLTakyn.js → SettingsView-L0g-g2fL.js} +3 -3
- package/dist/web/assets/{TeamChatView-dN3fUCbZ.js → TeamChatView-CSVMTUAE.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-CPVGeO7U.js → TerminalOverlay-Bb0RJR04.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-ettNNJBP.js → TrainingCreationPanel-VIWlpVV2.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-DUJBuII1.js → TrainingDraftPanel-MTYsR-Ry.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-BOZR3JE_.js → UsageSettingsSection-Cdc_jGFX.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-99MjzMkW.js → WorkspaceDiffPanel-BgIbxMMu.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-C3s3mTyu.js → WorkspaceEnvironmentMenu-C97GqYn9.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-BvurXjNP.js → WorkspaceGitDialogs-CK6ahRty.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-BCXg9mBQ.js → WorkspaceMonacoEditor-BQoN7jWa.js} +3 -3
- package/dist/web/assets/{arrow-up-right-DRIT5z3q.js → arrow-up-right-CzBZuWNj.js} +1 -1
- package/dist/web/assets/{chevron-up-Hglu-Zx3.js → chevron-up-DW-qEVSP.js} +1 -1
- package/dist/web/assets/{circle-alert-Crh3Zr2m.js → circle-alert-B_xROoPY.js} +1 -1
- package/dist/web/assets/{cloud-upload-mSm9KIL4.js → cloud-upload-CjLR-8-r.js} +1 -1
- package/dist/web/assets/{cssMode-CkQ4x6JA.js → cssMode-CQQJhS7v.js} +1 -1
- package/dist/web/assets/{folder-git-2-B8TV5i0V.js → folder-git-2-ktXin28y.js} +1 -1
- package/dist/web/assets/{folder-open-DXaun_C3.js → folder-open-BpUcIJHn.js} +1 -1
- package/dist/web/assets/{folder-plus-CUbTwu82.js → folder-plus-8NHsIAxQ.js} +1 -1
- package/dist/web/assets/{folder-DMeODEQJ.js → folder-tLv6TMN2.js} +1 -1
- package/dist/web/assets/{git-branch-CUlgF0kK.js → git-branch-DO3iP_fL.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-DAQfyhbS.js → git-commit-horizontal-BSWa2I3g.js} +1 -1
- package/dist/web/assets/{htmlMode-BfyAplZo.js → htmlMode-DaAKO9wk.js} +1 -1
- package/dist/web/assets/index-BtiK52K1.js +1 -0
- package/dist/web/assets/index-DHxBMQIJ.js +174 -0
- package/dist/web/assets/{info-Ll3PkeGE.js → info-DiEvrUda.js} +1 -1
- package/dist/web/assets/{jsonMode-C9Vibh0P.js → jsonMode-Biu1ZTZ7.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-CFoA9--Z.js → lspLanguageFeatures-lwoDxGgl.js} +1 -1
- package/dist/web/assets/{monaco.contribution-C2q-tDuk.js → monaco.contribution-BqQSY5-t.js} +2 -2
- package/dist/web/assets/{monaco.contribution-C8tRjUqy.js → monaco.contribution-Ce2MS2Nv.js} +2 -2
- package/dist/web/assets/{monaco.contribution-vWDjhuCI.js → monaco.contribution-DzHhgeLy.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Co4ZPnCC.js → monaco.contribution-Ic8LKME8.js} +2 -2
- package/dist/web/assets/{play-lC5KpmRD.js → play-D9F3t5Cx.js} +1 -1
- package/dist/web/assets/{python-I5xkyvMs.js → python-BhVCwr-K.js} +1 -1
- package/dist/web/assets/{refresh-cw-8a_wz4tX.js → refresh-cw-DRN17xPU.js} +1 -1
- package/dist/web/assets/{save-Dj9ex3Ce.js → save-CDZwpzlG.js} +1 -1
- package/dist/web/assets/{square-DfEM9XgY.js → square-Cf_AXs4a.js} +1 -1
- package/dist/web/assets/{square-pen-CgX3HoJ6.js → square-pen-ChJgNiDm.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-BkNzz1Bg.js → toggleHighContrast-Bb_m9pXM.js} +1 -1
- package/dist/web/assets/{tsMode-CNwaV0ZJ.js → tsMode-BaWkaSHN.js} +1 -1
- package/dist/web/assets/{upload-Co5zYY9Z.js → upload-Cef29aCP.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-QY4_XS2F.js → useLocalAgentSchedules-CAAqoZ0V.js} +1 -1
- package/dist/web/assets/{wifi-off-CFzyn7Tf.js → wifi-off-C8cC22F6.js} +1 -1
- package/dist/web/assets/{workers-DqFxl1zu.js → workers-GOdHtcZt.js} +1 -1
- package/dist/web/assets/{yaml-Bbm66uDK.js → yaml-jBIxwMeR.js} +1 -1
- package/dist/web/index.html +1 -1
- package/docs/command-reference.md +21 -0
- package/package.json +2 -1
- package/dist/web/assets/index-Blindd8c.js +0 -1
- package/dist/web/assets/index-CDJX5ZxL.js +0 -174
|
@@ -117,28 +117,7 @@ import {
|
|
|
117
117
|
workspaceHasHead,
|
|
118
118
|
workspaceToolExperienceBlocker,
|
|
119
119
|
writeWorkspaceFile
|
|
120
|
-
} from "./chunk-
|
|
121
|
-
import {
|
|
122
|
-
runOpenPondServerCli
|
|
123
|
-
} from "./chunk-CW6FAJEF.js";
|
|
124
|
-
import {
|
|
125
|
-
createAppServer,
|
|
126
|
-
runAgentCompaction
|
|
127
|
-
} from "./chunk-NFNEENNR.js";
|
|
128
|
-
import {
|
|
129
|
-
createOpenPondRepoApp,
|
|
130
|
-
getBundledRuntimeVersion,
|
|
131
|
-
getOpenPondAppEnvironment,
|
|
132
|
-
loadOpenPondAccountContext,
|
|
133
|
-
loadOpenPondAccountState,
|
|
134
|
-
loadOpenPondApps,
|
|
135
|
-
loadOpenPondProviderCatalog,
|
|
136
|
-
removeOpenPondAccount,
|
|
137
|
-
saveOpenPondAccount,
|
|
138
|
-
streamOpenPondHostedChatTurn,
|
|
139
|
-
switchOpenPondAccount,
|
|
140
|
-
updateOpenPondAccountConfig
|
|
141
|
-
} from "./chunk-EIRW6Z6S.js";
|
|
120
|
+
} from "./chunk-AD6KZWHL.js";
|
|
142
121
|
import {
|
|
143
122
|
appWorkspacePaths,
|
|
144
123
|
checkWorkspaceGitAvailability,
|
|
@@ -166,7 +145,14 @@ import {
|
|
|
166
145
|
runCommand,
|
|
167
146
|
startMacOSCommandLineToolsInstall,
|
|
168
147
|
workspaceImageContentType
|
|
169
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-BFR6VZ2A.js";
|
|
149
|
+
import {
|
|
150
|
+
runOpenPondServerCli
|
|
151
|
+
} from "./chunk-QIB27QOT.js";
|
|
152
|
+
import {
|
|
153
|
+
createAppServer,
|
|
154
|
+
runAgentCompaction
|
|
155
|
+
} from "./chunk-NFNEENNR.js";
|
|
170
156
|
import {
|
|
171
157
|
APP_PREFERENCES_CACHE_KEY,
|
|
172
158
|
APP_PREFERENCES_CACHE_TYPE,
|
|
@@ -178,7 +164,21 @@ import {
|
|
|
178
164
|
isCliEntrypoint,
|
|
179
165
|
now,
|
|
180
166
|
textFromUnknown
|
|
181
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-OI65U2B5.js";
|
|
168
|
+
import {
|
|
169
|
+
createOpenPondRepoApp,
|
|
170
|
+
getBundledRuntimeVersion,
|
|
171
|
+
getOpenPondAppEnvironment,
|
|
172
|
+
loadOpenPondAccountContext,
|
|
173
|
+
loadOpenPondAccountState,
|
|
174
|
+
loadOpenPondApps,
|
|
175
|
+
loadOpenPondProviderCatalog,
|
|
176
|
+
removeOpenPondAccount,
|
|
177
|
+
saveOpenPondAccount,
|
|
178
|
+
streamOpenPondHostedChatTurn,
|
|
179
|
+
switchOpenPondAccount,
|
|
180
|
+
updateOpenPondAccountConfig
|
|
181
|
+
} from "./chunk-LMQ4MPQI.js";
|
|
182
182
|
import {
|
|
183
183
|
AccountStateSchema,
|
|
184
184
|
AdapterValidationReceiptSchema,
|
|
@@ -249,6 +249,7 @@ import {
|
|
|
249
249
|
ModelRunSchema,
|
|
250
250
|
ModelUsageRecordSchema,
|
|
251
251
|
ModelVersionSchema,
|
|
252
|
+
OpenPondActionCatalogEntrySchema,
|
|
252
253
|
OpenPondAppSchema,
|
|
253
254
|
OpenPondExtensionSourceRequestSchema,
|
|
254
255
|
OpenPondProfilePublicationPreviewRequestSchema,
|
|
@@ -411,7 +412,12 @@ import {
|
|
|
411
412
|
workFormatCapabilityForContentType,
|
|
412
413
|
workspacePathFromLocalPathWorkspaceId,
|
|
413
414
|
writeSourceUploadCache
|
|
414
|
-
} from "./chunk-
|
|
415
|
+
} from "./chunk-PVGJXCAK.js";
|
|
416
|
+
import {
|
|
417
|
+
PROJECT_ACTION_CONFIG_PATH,
|
|
418
|
+
createLocalActionRunner,
|
|
419
|
+
loadProjectActionConfiguration
|
|
420
|
+
} from "./chunk-QETF6ILG.js";
|
|
415
421
|
import {
|
|
416
422
|
AttemptReceiptContentSchema,
|
|
417
423
|
AttemptReceiptSchema,
|
|
@@ -451,15 +457,16 @@ import {
|
|
|
451
457
|
workEvidenceReceiptRef,
|
|
452
458
|
workSourceOpaqueRef,
|
|
453
459
|
workWorkspaceOpaqueRef
|
|
454
|
-
} from "./chunk-
|
|
460
|
+
} from "./chunk-VG4H4TQG.js";
|
|
455
461
|
import {
|
|
456
462
|
external_exports,
|
|
457
463
|
yaml
|
|
458
464
|
} from "./chunk-WYDVQOBL.js";
|
|
459
465
|
import {
|
|
460
466
|
apiFetch,
|
|
467
|
+
readApiJson,
|
|
461
468
|
withVercelProtectionBypass
|
|
462
|
-
} from "./chunk-
|
|
469
|
+
} from "./chunk-DXSHQ6TO.js";
|
|
463
470
|
import {
|
|
464
471
|
__commonJS,
|
|
465
472
|
__require,
|
|
@@ -13312,9 +13319,9 @@ var require_dist = __commonJS({
|
|
|
13312
13319
|
});
|
|
13313
13320
|
|
|
13314
13321
|
// ../server/src/index.ts
|
|
13315
|
-
import
|
|
13322
|
+
import path63 from "node:path";
|
|
13316
13323
|
import { randomUUID as randomUUID25 } from "node:crypto";
|
|
13317
|
-
import { promises as
|
|
13324
|
+
import { promises as fs27 } from "node:fs";
|
|
13318
13325
|
|
|
13319
13326
|
// ../../packages/codex-provider/dist/client.js
|
|
13320
13327
|
import { spawn } from "node:child_process";
|
|
@@ -14877,7 +14884,7 @@ function createCodexRuntimeManager({
|
|
|
14877
14884
|
|
|
14878
14885
|
// ../server/src/api/server-payloads.ts
|
|
14879
14886
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
14880
|
-
import
|
|
14887
|
+
import path22 from "node:path";
|
|
14881
14888
|
|
|
14882
14889
|
// ../server/src/codex-personal-skills.ts
|
|
14883
14890
|
import { createHash } from "node:crypto";
|
|
@@ -20699,8 +20706,8 @@ async function organizationRequestPayload(action) {
|
|
|
20699
20706
|
}
|
|
20700
20707
|
throw new Error(`Unsupported organization action: ${action.type}`);
|
|
20701
20708
|
}
|
|
20702
|
-
async function openPondApiRequest(apiBaseUrl, token,
|
|
20703
|
-
const response = await apiFetch(apiBaseUrl, token,
|
|
20709
|
+
async function openPondApiRequest(apiBaseUrl, token, path64, init = {}) {
|
|
20710
|
+
const response = await apiFetch(apiBaseUrl, token, path64, init);
|
|
20704
20711
|
const payload = await response.json().catch(() => ({}));
|
|
20705
20712
|
if (!response.ok) {
|
|
20706
20713
|
const message2 = typeof payload.message === "string" ? payload.message : typeof payload.error === "string" ? payload.error : response.statusText;
|
|
@@ -23605,6 +23612,53 @@ function createProfilePayloads(deps) {
|
|
|
23605
23612
|
};
|
|
23606
23613
|
}
|
|
23607
23614
|
|
|
23615
|
+
// ../server/src/project-actions/local-project-actions.ts
|
|
23616
|
+
import path21 from "node:path";
|
|
23617
|
+
import { promises as fs13 } from "node:fs";
|
|
23618
|
+
async function localProjectActionCatalog(project) {
|
|
23619
|
+
const sourceDirectory = await projectActionSourceDirectory(project.workspacePath);
|
|
23620
|
+
const sourceStats = await fs13.stat(sourceDirectory).catch(() => null);
|
|
23621
|
+
if (!sourceStats?.isDirectory()) return [];
|
|
23622
|
+
const runner = createLocalActionRunner({
|
|
23623
|
+
projectRoot: project.workspacePath,
|
|
23624
|
+
build: "always"
|
|
23625
|
+
});
|
|
23626
|
+
const registry = await runner.catalog();
|
|
23627
|
+
return registry.actions.map(
|
|
23628
|
+
(action) => OpenPondActionCatalogEntrySchema.parse({
|
|
23629
|
+
...action,
|
|
23630
|
+
sourcePath: project.workspacePath,
|
|
23631
|
+
implementation: {
|
|
23632
|
+
...action.implementation,
|
|
23633
|
+
projectId: project.id,
|
|
23634
|
+
projectRoot: path21.resolve(project.workspacePath)
|
|
23635
|
+
}
|
|
23636
|
+
})
|
|
23637
|
+
);
|
|
23638
|
+
}
|
|
23639
|
+
async function runLocalProjectAction(input) {
|
|
23640
|
+
return createLocalActionRunner({
|
|
23641
|
+
projectRoot: input.projectRoot,
|
|
23642
|
+
build: "always"
|
|
23643
|
+
}).run({
|
|
23644
|
+
actionId: input.actionId,
|
|
23645
|
+
input: input.value,
|
|
23646
|
+
runId: input.runId,
|
|
23647
|
+
idempotencyKey: input.idempotencyKey,
|
|
23648
|
+
signal: input.signal
|
|
23649
|
+
});
|
|
23650
|
+
}
|
|
23651
|
+
async function projectActionSourceDirectory(projectRoot) {
|
|
23652
|
+
try {
|
|
23653
|
+
const configuration = await loadProjectActionConfiguration(projectRoot);
|
|
23654
|
+
return path21.resolve(projectRoot, configuration.sourceDirectory ?? "openpond/actions");
|
|
23655
|
+
} catch (error) {
|
|
23656
|
+
throw new Error(
|
|
23657
|
+
`Cannot load ${PROJECT_ACTION_CONFIG_PATH}: ${error instanceof Error ? error.message : String(error)}`
|
|
23658
|
+
);
|
|
23659
|
+
}
|
|
23660
|
+
}
|
|
23661
|
+
|
|
23608
23662
|
// ../server/src/training/managed-adapter-models.ts
|
|
23609
23663
|
async function listManagedAdapterProviderModels(store) {
|
|
23610
23664
|
const [lineages, bindings, modelProjects] = await Promise.all([
|
|
@@ -23687,7 +23741,7 @@ function createServerPayloads(deps) {
|
|
|
23687
23741
|
appendRuntimeEvent,
|
|
23688
23742
|
isClosing
|
|
23689
23743
|
} = deps;
|
|
23690
|
-
const attachmentRootDir = deps.attachmentRootDir ??
|
|
23744
|
+
const attachmentRootDir = deps.attachmentRootDir ?? path22.join(storeDir, "attachments");
|
|
23691
23745
|
const {
|
|
23692
23746
|
appendAppPage,
|
|
23693
23747
|
loadOpenPondData,
|
|
@@ -24166,11 +24220,11 @@ function createServerPayloads(deps) {
|
|
|
24166
24220
|
(candidate2) => candidate2.name === skillName
|
|
24167
24221
|
);
|
|
24168
24222
|
if (!skill) throw new Error(`Profile skill not found: ${skillName}`);
|
|
24169
|
-
const absoluteSkillPath =
|
|
24223
|
+
const absoluteSkillPath = path22.resolve(skill.sourcePath, skill.path);
|
|
24170
24224
|
return readSkillSourceFile({
|
|
24171
24225
|
skillName,
|
|
24172
24226
|
scope,
|
|
24173
|
-
packageRoot:
|
|
24227
|
+
packageRoot: path22.dirname(absoluteSkillPath),
|
|
24174
24228
|
relativeFilePath: filePath
|
|
24175
24229
|
});
|
|
24176
24230
|
}
|
|
@@ -24466,6 +24520,14 @@ Uploaded from OpenPond Desktop.
|
|
|
24466
24520
|
}
|
|
24467
24521
|
};
|
|
24468
24522
|
}
|
|
24523
|
+
async function localProjectActionCatalogPayload(projectId) {
|
|
24524
|
+
const localProject = await findLocalProject(store, projectId);
|
|
24525
|
+
if (!localProject) throw new Error("Project workspace not found");
|
|
24526
|
+
return {
|
|
24527
|
+
projectId: localProject.id,
|
|
24528
|
+
actions: await localProjectActionCatalog(localProject)
|
|
24529
|
+
};
|
|
24530
|
+
}
|
|
24469
24531
|
async function uploadLocalProjectCloudSourcePayload(projectId, payload) {
|
|
24470
24532
|
const input = UploadLocalProjectCloudSourceRequestSchema.parse(payload);
|
|
24471
24533
|
const localProject = await findLocalProject(store, projectId);
|
|
@@ -25002,6 +25064,7 @@ Uploaded from OpenPond Desktop.
|
|
|
25002
25064
|
...workspacePayloads,
|
|
25003
25065
|
previewLocalProjectCloudSourcePayload,
|
|
25004
25066
|
uploadLocalProjectCloudSourcePayload,
|
|
25067
|
+
localProjectActionCatalogPayload,
|
|
25005
25068
|
patchSidebarAppPreference,
|
|
25006
25069
|
listSidebarFileBookmarksPayload,
|
|
25007
25070
|
patchSidebarFileBookmarkPayload,
|
|
@@ -25017,6 +25080,180 @@ Uploaded from OpenPond Desktop.
|
|
|
25017
25080
|
};
|
|
25018
25081
|
}
|
|
25019
25082
|
|
|
25083
|
+
// ../server/src/openpond/hosted-api-access.ts
|
|
25084
|
+
var DEFAULT_OPENPOND_API_BASE_URL2 = "https://api.openpond.ai";
|
|
25085
|
+
async function resolveHostedApiAccess(dependencies = {}) {
|
|
25086
|
+
const context = await (dependencies.loadAccountContext ?? loadOpenPondAccountContext)();
|
|
25087
|
+
const token = context.token?.trim();
|
|
25088
|
+
if (!token) throw new Error("OpenPond account API key is required.");
|
|
25089
|
+
return { apiBaseUrl: resolveApiBaseUrl2(context), token };
|
|
25090
|
+
}
|
|
25091
|
+
async function resolveManagedAdapterUserAccess(dependencies = {}) {
|
|
25092
|
+
const access5 = await resolveHostedApiAccess(dependencies);
|
|
25093
|
+
return { ...access5, teamId: managedAdapterTeamId(dependencies.teamId) };
|
|
25094
|
+
}
|
|
25095
|
+
function hostedApiAuthHeaders(token) {
|
|
25096
|
+
const headers = new Headers();
|
|
25097
|
+
if (token.startsWith("opk_")) {
|
|
25098
|
+
headers.set("Authorization", `ApiKey ${token}`);
|
|
25099
|
+
headers.set("openpond-api-key", token);
|
|
25100
|
+
} else {
|
|
25101
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
25102
|
+
}
|
|
25103
|
+
return headers;
|
|
25104
|
+
}
|
|
25105
|
+
function resolveApiBaseUrl2(context) {
|
|
25106
|
+
return normalizeOptionalUrl2(context.apiBaseUrl) ?? normalizeOptionalUrl2(context.account?.apiBaseUrl) ?? normalizeOptionalUrl2(context.config.apiBaseUrl) ?? normalizeOpenPondWebBaseAsApi2(context.account?.baseUrl) ?? normalizeOpenPondWebBaseAsApi2(context.config.baseUrl) ?? DEFAULT_OPENPOND_API_BASE_URL2;
|
|
25107
|
+
}
|
|
25108
|
+
function managedAdapterTeamId(explicitTeamId) {
|
|
25109
|
+
const teamId = explicitTeamId?.trim();
|
|
25110
|
+
if (!teamId || !/^[A-Za-z0-9_-]{3,191}$/.test(teamId)) {
|
|
25111
|
+
throw new Error("Select an OpenPond workspace before using OpenPond Managed RL.");
|
|
25112
|
+
}
|
|
25113
|
+
return teamId;
|
|
25114
|
+
}
|
|
25115
|
+
function normalizeOpenPondWebBaseAsApi2(value) {
|
|
25116
|
+
const normalized = normalizeOptionalUrl2(value);
|
|
25117
|
+
if (!normalized) return null;
|
|
25118
|
+
try {
|
|
25119
|
+
const url = new URL(normalized);
|
|
25120
|
+
if (url.hostname === "openpond.ai") return "https://api.openpond.ai";
|
|
25121
|
+
if (!url.hostname.startsWith("api.") && url.hostname.endsWith(".openpond.ai")) {
|
|
25122
|
+
url.hostname = `api.${url.hostname}`;
|
|
25123
|
+
return url.origin;
|
|
25124
|
+
}
|
|
25125
|
+
} catch {
|
|
25126
|
+
return normalized;
|
|
25127
|
+
}
|
|
25128
|
+
return normalized;
|
|
25129
|
+
}
|
|
25130
|
+
function normalizeOptionalUrl2(value) {
|
|
25131
|
+
const trimmed = value?.trim();
|
|
25132
|
+
return trimmed ? trimmed.replace(/\/$/, "") : null;
|
|
25133
|
+
}
|
|
25134
|
+
|
|
25135
|
+
// ../server/src/project-actions/hosted-project-actions.ts
|
|
25136
|
+
async function runHostedProjectAction(input, dependencies = {}) {
|
|
25137
|
+
const access5 = await (dependencies.resolveAccess ?? resolveHostedApiAccess)();
|
|
25138
|
+
const response = await (dependencies.fetch ?? apiFetch)(
|
|
25139
|
+
access5.apiBaseUrl,
|
|
25140
|
+
access5.token,
|
|
25141
|
+
`/v1/project-actions/${encodeURIComponent(input.projectId)}/actions/${encodeURIComponent(input.actionId)}?teamId=${encodeURIComponent(input.teamId)}`,
|
|
25142
|
+
{
|
|
25143
|
+
method: "POST",
|
|
25144
|
+
body: JSON.stringify({
|
|
25145
|
+
input: input.value,
|
|
25146
|
+
releaseId: input.releaseId,
|
|
25147
|
+
idempotencyKey: input.idempotencyKey,
|
|
25148
|
+
callerType: "work",
|
|
25149
|
+
callerId: input.callerId
|
|
25150
|
+
}),
|
|
25151
|
+
signal: input.signal,
|
|
25152
|
+
timeoutMs: 15 * 60 * 1e3
|
|
25153
|
+
}
|
|
25154
|
+
);
|
|
25155
|
+
const payload = await readApiJson(
|
|
25156
|
+
response,
|
|
25157
|
+
"Run hosted Project Action"
|
|
25158
|
+
);
|
|
25159
|
+
if (payload.invocation.status === "failed") {
|
|
25160
|
+
throw new Error(
|
|
25161
|
+
payload.invocation.failureMessage || payload.invocation.failureCode || "Hosted Project Action failed."
|
|
25162
|
+
);
|
|
25163
|
+
}
|
|
25164
|
+
return payload.invocation;
|
|
25165
|
+
}
|
|
25166
|
+
|
|
25167
|
+
// ../server/src/project-actions/project-action-payload.ts
|
|
25168
|
+
function createProjectActionRunPayload(deps) {
|
|
25169
|
+
return async function projectActionRunPayload(payload) {
|
|
25170
|
+
const input = asRecord5(payload);
|
|
25171
|
+
const action = stringValue5(input.action) ?? stringValue5(input.actionName);
|
|
25172
|
+
if (!action) throw new Error("Project Action name is required.");
|
|
25173
|
+
const metadata = asRecord5(input.metadata);
|
|
25174
|
+
if (stringValue5(metadata.execution) === "hosted") {
|
|
25175
|
+
const result2 = await runHostedProjectAction({
|
|
25176
|
+
projectId: requiredMetadata(metadata, "projectId"),
|
|
25177
|
+
teamId: requiredMetadata(metadata, "teamId"),
|
|
25178
|
+
releaseId: requiredMetadata(metadata, "releaseId"),
|
|
25179
|
+
actionId: action,
|
|
25180
|
+
value: input.input ?? {},
|
|
25181
|
+
idempotencyKey: stringValue5(metadata.toolCallId) ? `${requiredMetadata(metadata, "turnId")}:${requiredMetadata(metadata, "toolCallId")}` : void 0,
|
|
25182
|
+
callerId: stringValue5(metadata.turnId) ?? void 0
|
|
25183
|
+
});
|
|
25184
|
+
const sessionId2 = stringValue5(metadata.sessionId);
|
|
25185
|
+
if (sessionId2) {
|
|
25186
|
+
await deps.appendRuntimeEvent(event({
|
|
25187
|
+
name: "workspace_action_result",
|
|
25188
|
+
sessionId: sessionId2,
|
|
25189
|
+
turnId: requiredMetadata(metadata, "turnId"),
|
|
25190
|
+
source: "chat_action",
|
|
25191
|
+
action: "project_action_run",
|
|
25192
|
+
appId: null,
|
|
25193
|
+
status: "completed",
|
|
25194
|
+
output: JSON.stringify(result2.resultJson),
|
|
25195
|
+
data: {
|
|
25196
|
+
openPondHostedProjectActionRun: true,
|
|
25197
|
+
action: {
|
|
25198
|
+
name: action,
|
|
25199
|
+
label: stringValue5(metadata.selectedActionLabel) ?? action
|
|
25200
|
+
},
|
|
25201
|
+
releaseId: result2.releaseId,
|
|
25202
|
+
invocationId: result2.id,
|
|
25203
|
+
traces: result2.traceJson,
|
|
25204
|
+
outputs: result2.outputJson
|
|
25205
|
+
}
|
|
25206
|
+
}));
|
|
25207
|
+
}
|
|
25208
|
+
return result2;
|
|
25209
|
+
}
|
|
25210
|
+
const projectId = stringValue5(metadata.projectId);
|
|
25211
|
+
if (!projectId) throw new Error("Project Action Project id is required.");
|
|
25212
|
+
const projectRoot = await deps.resolveProjectRoot(projectId);
|
|
25213
|
+
if (!projectRoot) throw new Error("Project Action Project is not registered locally.");
|
|
25214
|
+
const sessionId = stringValue5(metadata.sessionId);
|
|
25215
|
+
const turnId = stringValue5(metadata.turnId) ?? `openpond_project_action_${Date.now()}`;
|
|
25216
|
+
const toolCallId = stringValue5(metadata.toolCallId);
|
|
25217
|
+
const result = await runLocalProjectAction({
|
|
25218
|
+
projectRoot,
|
|
25219
|
+
actionId: action,
|
|
25220
|
+
value: input.input ?? {},
|
|
25221
|
+
runId: toolCallId ?? void 0,
|
|
25222
|
+
idempotencyKey: toolCallId ? `${turnId}:${toolCallId}` : null
|
|
25223
|
+
});
|
|
25224
|
+
if (sessionId) {
|
|
25225
|
+
await deps.appendRuntimeEvent(event({
|
|
25226
|
+
name: "workspace_action_result",
|
|
25227
|
+
sessionId,
|
|
25228
|
+
turnId,
|
|
25229
|
+
source: "chat_action",
|
|
25230
|
+
action: "project_action_run",
|
|
25231
|
+
appId: null,
|
|
25232
|
+
status: "completed",
|
|
25233
|
+
output: JSON.stringify(result.output),
|
|
25234
|
+
data: {
|
|
25235
|
+
openPondProjectActionRun: true,
|
|
25236
|
+
action: {
|
|
25237
|
+
name: action,
|
|
25238
|
+
label: stringValue5(metadata.selectedActionLabel) ?? action
|
|
25239
|
+
},
|
|
25240
|
+
runId: result.runId,
|
|
25241
|
+
traces: result.traces,
|
|
25242
|
+
outputs: result.outputs,
|
|
25243
|
+
outputDirectory: result.outputDirectory,
|
|
25244
|
+
durationMs: result.durationMs
|
|
25245
|
+
}
|
|
25246
|
+
}));
|
|
25247
|
+
}
|
|
25248
|
+
return result;
|
|
25249
|
+
};
|
|
25250
|
+
}
|
|
25251
|
+
function requiredMetadata(metadata, name) {
|
|
25252
|
+
const value = stringValue5(metadata[name]);
|
|
25253
|
+
if (!value) throw new Error(`Hosted Project Action ${name} is required.`);
|
|
25254
|
+
return value;
|
|
25255
|
+
}
|
|
25256
|
+
|
|
25020
25257
|
// ../server/src/api/event-page.ts
|
|
25021
25258
|
var DEFAULT_EVENT_PAGE_LIMIT = 100;
|
|
25022
25259
|
var MAX_EVENT_PAGE_LIMIT = 500;
|
|
@@ -26113,58 +26350,6 @@ async function handleCreateImproveRoutes({
|
|
|
26113
26350
|
return false;
|
|
26114
26351
|
}
|
|
26115
26352
|
|
|
26116
|
-
// ../server/src/openpond/hosted-api-access.ts
|
|
26117
|
-
var DEFAULT_OPENPOND_API_BASE_URL2 = "https://api.openpond.ai";
|
|
26118
|
-
async function resolveHostedApiAccess(dependencies = {}) {
|
|
26119
|
-
const context = await (dependencies.loadAccountContext ?? loadOpenPondAccountContext)();
|
|
26120
|
-
const token = context.token?.trim();
|
|
26121
|
-
if (!token) throw new Error("OpenPond account API key is required.");
|
|
26122
|
-
return { apiBaseUrl: resolveApiBaseUrl2(context), token };
|
|
26123
|
-
}
|
|
26124
|
-
async function resolveManagedAdapterUserAccess(dependencies = {}) {
|
|
26125
|
-
const access5 = await resolveHostedApiAccess(dependencies);
|
|
26126
|
-
return { ...access5, teamId: managedAdapterTeamId(dependencies.teamId) };
|
|
26127
|
-
}
|
|
26128
|
-
function hostedApiAuthHeaders(token) {
|
|
26129
|
-
const headers = new Headers();
|
|
26130
|
-
if (token.startsWith("opk_")) {
|
|
26131
|
-
headers.set("Authorization", `ApiKey ${token}`);
|
|
26132
|
-
headers.set("openpond-api-key", token);
|
|
26133
|
-
} else {
|
|
26134
|
-
headers.set("Authorization", `Bearer ${token}`);
|
|
26135
|
-
}
|
|
26136
|
-
return headers;
|
|
26137
|
-
}
|
|
26138
|
-
function resolveApiBaseUrl2(context) {
|
|
26139
|
-
return normalizeOptionalUrl2(context.apiBaseUrl) ?? normalizeOptionalUrl2(context.account?.apiBaseUrl) ?? normalizeOptionalUrl2(context.config.apiBaseUrl) ?? normalizeOpenPondWebBaseAsApi2(context.account?.baseUrl) ?? normalizeOpenPondWebBaseAsApi2(context.config.baseUrl) ?? DEFAULT_OPENPOND_API_BASE_URL2;
|
|
26140
|
-
}
|
|
26141
|
-
function managedAdapterTeamId(explicitTeamId) {
|
|
26142
|
-
const teamId = explicitTeamId?.trim();
|
|
26143
|
-
if (!teamId || !/^[A-Za-z0-9_-]{3,191}$/.test(teamId)) {
|
|
26144
|
-
throw new Error("Select an OpenPond workspace before using OpenPond Managed RL.");
|
|
26145
|
-
}
|
|
26146
|
-
return teamId;
|
|
26147
|
-
}
|
|
26148
|
-
function normalizeOpenPondWebBaseAsApi2(value) {
|
|
26149
|
-
const normalized = normalizeOptionalUrl2(value);
|
|
26150
|
-
if (!normalized) return null;
|
|
26151
|
-
try {
|
|
26152
|
-
const url = new URL(normalized);
|
|
26153
|
-
if (url.hostname === "openpond.ai") return "https://api.openpond.ai";
|
|
26154
|
-
if (!url.hostname.startsWith("api.") && url.hostname.endsWith(".openpond.ai")) {
|
|
26155
|
-
url.hostname = `api.${url.hostname}`;
|
|
26156
|
-
return url.origin;
|
|
26157
|
-
}
|
|
26158
|
-
} catch {
|
|
26159
|
-
return normalized;
|
|
26160
|
-
}
|
|
26161
|
-
return normalized;
|
|
26162
|
-
}
|
|
26163
|
-
function normalizeOptionalUrl2(value) {
|
|
26164
|
-
const trimmed = value?.trim();
|
|
26165
|
-
return trimmed ? trimmed.replace(/\/$/, "") : null;
|
|
26166
|
-
}
|
|
26167
|
-
|
|
26168
26353
|
// ../server/src/openpond/community-client.ts
|
|
26169
26354
|
var CommunityApiError = class extends Error {
|
|
26170
26355
|
constructor(code, status, details = null) {
|
|
@@ -26187,11 +26372,11 @@ async function communityRequestPayload(action, dependencies = {}) {
|
|
|
26187
26372
|
const payload = await requestCommunityApi(request.path, request.init, dependencies);
|
|
26188
26373
|
return schemaForAction(action).parse(payload);
|
|
26189
26374
|
}
|
|
26190
|
-
async function requestCommunityApi(
|
|
26375
|
+
async function requestCommunityApi(path64, init = {}, dependencies = {}) {
|
|
26191
26376
|
const access5 = await resolveHostedApiAccess(dependencies);
|
|
26192
26377
|
const headers = hostedApiAuthHeaders(access5.token);
|
|
26193
26378
|
headers.set("Content-Type", "application/json");
|
|
26194
|
-
const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${
|
|
26379
|
+
const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${path64}`, {
|
|
26195
26380
|
...init,
|
|
26196
26381
|
headers
|
|
26197
26382
|
});
|
|
@@ -26360,11 +26545,11 @@ async function uploadCommunityAttachment(action, dependencies) {
|
|
|
26360
26545
|
)
|
|
26361
26546
|
);
|
|
26362
26547
|
}
|
|
26363
|
-
function post(
|
|
26364
|
-
return jsonRequest(
|
|
26548
|
+
function post(path64, body) {
|
|
26549
|
+
return jsonRequest(path64, "POST", body);
|
|
26365
26550
|
}
|
|
26366
|
-
function jsonRequest(
|
|
26367
|
-
return { path:
|
|
26551
|
+
function jsonRequest(path64, method, body) {
|
|
26552
|
+
return { path: path64, init: { method, body: JSON.stringify(body) } };
|
|
26368
26553
|
}
|
|
26369
26554
|
|
|
26370
26555
|
// ../server/src/api/routes/community-routes.ts
|
|
@@ -26664,7 +26849,7 @@ async function handleDesktopBrowserRoutes({
|
|
|
26664
26849
|
// ../server/src/api/signed-workspace-image.ts
|
|
26665
26850
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
26666
26851
|
import { Buffer as Buffer6 } from "node:buffer";
|
|
26667
|
-
import
|
|
26852
|
+
import path23 from "node:path";
|
|
26668
26853
|
var SIGNED_WORKSPACE_IMAGE_TTL_MS = 5 * 60 * 1e3;
|
|
26669
26854
|
var CHAT_ATTACHMENT_IMAGE_CONTENT_TYPES = /* @__PURE__ */ new Set(["image/gif", "image/jpeg", "image/png", "image/webp"]);
|
|
26670
26855
|
function signedWorkspaceImageUrlPayload(input, requestUrl, token) {
|
|
@@ -26736,13 +26921,13 @@ function verifySignedWorkspaceImageRequest(requestUrl, token) {
|
|
|
26736
26921
|
if (!appId || !rawPath || !expiresRaw || !signature) {
|
|
26737
26922
|
return { ok: false, status: 401, error: "Signed asset URL is missing required claims." };
|
|
26738
26923
|
}
|
|
26739
|
-
const
|
|
26924
|
+
const path64 = normalizeSignedWorkspaceImagePath(rawPath);
|
|
26740
26925
|
const expiresAt = Number(expiresRaw);
|
|
26741
|
-
if (!
|
|
26926
|
+
if (!path64 || !Number.isInteger(expiresAt)) {
|
|
26742
26927
|
return { ok: false, status: 401, error: "Signed asset URL is invalid." };
|
|
26743
26928
|
}
|
|
26744
26929
|
if (expiresAt < Date.now()) return { ok: false, status: 401, error: "Signed asset URL expired." };
|
|
26745
|
-
const claims = { appId: appId.trim(), path:
|
|
26930
|
+
const claims = { appId: appId.trim(), path: path64, expiresAt };
|
|
26746
26931
|
if (!safeSignatureEqual(signature, signWorkspaceImageClaims(claims, token))) {
|
|
26747
26932
|
return { ok: false, status: 401, error: "Signed asset URL signature is invalid." };
|
|
26748
26933
|
}
|
|
@@ -26836,9 +27021,9 @@ function requiredSearchParam(requestUrl, name) {
|
|
|
26836
27021
|
}
|
|
26837
27022
|
function normalizeSignedWorkspaceImagePath(value) {
|
|
26838
27023
|
if (/^file:\/\//i.test(value) || /^\//.test(value) || /^[A-Za-z]:[\\/]/.test(value)) return null;
|
|
26839
|
-
const
|
|
26840
|
-
if (!
|
|
26841
|
-
return
|
|
27024
|
+
const path64 = normalizeWorkspaceFilePath(value);
|
|
27025
|
+
if (!path64 || !workspaceImageContentType(path64)) return null;
|
|
27026
|
+
return path64;
|
|
26842
27027
|
}
|
|
26843
27028
|
function normalizeSignedLocalImagePath(value) {
|
|
26844
27029
|
const cleaned = normalizeSignedLocalAssetPath(value);
|
|
@@ -26860,8 +27045,8 @@ function normalizeSignedLocalAssetPath(value) {
|
|
|
26860
27045
|
cleaned = cleaned.replace(/^file:\/\//, "");
|
|
26861
27046
|
}
|
|
26862
27047
|
}
|
|
26863
|
-
if (!
|
|
26864
|
-
return
|
|
27048
|
+
if (!path23.isAbsolute(cleaned)) return null;
|
|
27049
|
+
return path23.resolve(cleaned);
|
|
26865
27050
|
}
|
|
26866
27051
|
function normalizeSignedChatAttachmentStorageName(value) {
|
|
26867
27052
|
const trimmed = value.trim();
|
|
@@ -27260,9 +27445,23 @@ async function handleProjectCloudRoutes({ deps, request, requestUrl, response })
|
|
|
27260
27445
|
createLocalProjectPayload,
|
|
27261
27446
|
previewLocalProjectCloudSourcePayload,
|
|
27262
27447
|
uploadLocalProjectCloudSourcePayload,
|
|
27448
|
+
localProjectActionCatalogPayload,
|
|
27263
27449
|
updateLocalProjectAgentSetupPayload,
|
|
27264
27450
|
deleteLocalProjectPayload
|
|
27265
27451
|
} = deps;
|
|
27452
|
+
const localProjectActionsMatch = /^\/v1\/projects\/([^/]+)\/actions$/.exec(
|
|
27453
|
+
requestUrl.pathname
|
|
27454
|
+
);
|
|
27455
|
+
if (request.method === "GET" && localProjectActionsMatch) {
|
|
27456
|
+
sendJson(
|
|
27457
|
+
response,
|
|
27458
|
+
200,
|
|
27459
|
+
await localProjectActionCatalogPayload(
|
|
27460
|
+
decodeURIComponent(localProjectActionsMatch[1])
|
|
27461
|
+
)
|
|
27462
|
+
);
|
|
27463
|
+
return true;
|
|
27464
|
+
}
|
|
27266
27465
|
if (request.method === "POST" && requestUrl.pathname === "/v1/projects") {
|
|
27267
27466
|
sendJson(response, 201, await createLocalProjectPayload(await readJson(request)));
|
|
27268
27467
|
return true;
|
|
@@ -28424,13 +28623,13 @@ function decode2(value) {
|
|
|
28424
28623
|
// ../server/src/api/routes/training-routes.ts
|
|
28425
28624
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
28426
28625
|
import { stat as stat3 } from "node:fs/promises";
|
|
28427
|
-
import
|
|
28626
|
+
import path25 from "node:path";
|
|
28428
28627
|
|
|
28429
28628
|
// ../server/src/training/training-artifact-package.ts
|
|
28430
28629
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
28431
28630
|
import { once } from "node:events";
|
|
28432
28631
|
import { stat as stat2 } from "node:fs/promises";
|
|
28433
|
-
import
|
|
28632
|
+
import path24 from "node:path";
|
|
28434
28633
|
var TAR_BLOCK_BYTES = 512;
|
|
28435
28634
|
var PORTABLE_MODEL_FILENAMES = /* @__PURE__ */ new Set([
|
|
28436
28635
|
"adapter_model.safetensors",
|
|
@@ -28448,7 +28647,7 @@ function selectPortableModelArtifacts(artifacts) {
|
|
|
28448
28647
|
continue;
|
|
28449
28648
|
}
|
|
28450
28649
|
const normalized = providerFilename.replaceAll("\\", "/");
|
|
28451
|
-
const name =
|
|
28650
|
+
const name = path24.posix.basename(normalized);
|
|
28452
28651
|
if (!PORTABLE_MODEL_FILENAMES.has(name) && !SHARDED_ADAPTER_WEIGHTS_PATTERN.test(name)) continue;
|
|
28453
28652
|
const candidate2 = { artifact, name, providerFilename };
|
|
28454
28653
|
const current = selected.get(name);
|
|
@@ -28581,7 +28780,7 @@ async function handleTrainingRoutes({ deps, request, requestUrl, response }) {
|
|
|
28581
28780
|
const result = await deps.trainingPayload("artifact_download", { artifactId: decodeURIComponent(downloadMatch[1]) }, requestUrl);
|
|
28582
28781
|
const info = await stat3(result.path);
|
|
28583
28782
|
if (!info.isFile() || info.size !== result.artifact.sizeBytes) throw new Error("Training artifact changed before download.");
|
|
28584
|
-
response.writeHead(200, { "Content-Type": "application/octet-stream", "Content-Length": String(info.size), "Content-Disposition": `attachment; filename="${
|
|
28783
|
+
response.writeHead(200, { "Content-Type": "application/octet-stream", "Content-Length": String(info.size), "Content-Disposition": `attachment; filename="${path25.basename(result.path).replaceAll('"', "")}"`, "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff" });
|
|
28585
28784
|
createReadStream3(result.path).pipe(response);
|
|
28586
28785
|
return true;
|
|
28587
28786
|
}
|
|
@@ -29211,8 +29410,8 @@ function normalizeRoutePath(pathValue) {
|
|
|
29211
29410
|
|
|
29212
29411
|
// ../server/src/api/static-web.ts
|
|
29213
29412
|
import { createReadStream as createReadStream5 } from "node:fs";
|
|
29214
|
-
import { promises as
|
|
29215
|
-
import
|
|
29413
|
+
import { promises as fs14 } from "node:fs";
|
|
29414
|
+
import path26 from "node:path";
|
|
29216
29415
|
var API_PATH_PREFIXES = ["/v1/"];
|
|
29217
29416
|
var API_PATHS = /* @__PURE__ */ new Set(["/health"]);
|
|
29218
29417
|
var ONE_YEAR_SECONDS = 31536e3;
|
|
@@ -29239,7 +29438,7 @@ function shouldPassToApi(request, pathname) {
|
|
|
29239
29438
|
return request.method !== "GET" && request.method !== "HEAD";
|
|
29240
29439
|
}
|
|
29241
29440
|
function contentType(filePath) {
|
|
29242
|
-
return MIME_TYPES[
|
|
29441
|
+
return MIME_TYPES[path26.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
29243
29442
|
}
|
|
29244
29443
|
function safeResolve(root, pathname) {
|
|
29245
29444
|
let decoded;
|
|
@@ -29249,23 +29448,23 @@ function safeResolve(root, pathname) {
|
|
|
29249
29448
|
return null;
|
|
29250
29449
|
}
|
|
29251
29450
|
const relative2 = decoded.replace(/^\/+/, "") || "index.html";
|
|
29252
|
-
const resolved =
|
|
29253
|
-
const relativeToRoot =
|
|
29254
|
-
if (relativeToRoot === "" || !relativeToRoot.startsWith("..") && !
|
|
29451
|
+
const resolved = path26.resolve(root, relative2);
|
|
29452
|
+
const relativeToRoot = path26.relative(root, resolved);
|
|
29453
|
+
if (relativeToRoot === "" || !relativeToRoot.startsWith("..") && !path26.isAbsolute(relativeToRoot)) {
|
|
29255
29454
|
return resolved;
|
|
29256
29455
|
}
|
|
29257
29456
|
return null;
|
|
29258
29457
|
}
|
|
29259
29458
|
async function fileStat(filePath) {
|
|
29260
29459
|
try {
|
|
29261
|
-
const stat7 = await
|
|
29460
|
+
const stat7 = await fs14.stat(filePath);
|
|
29262
29461
|
return stat7.isFile() ? stat7 : null;
|
|
29263
29462
|
} catch {
|
|
29264
29463
|
return null;
|
|
29265
29464
|
}
|
|
29266
29465
|
}
|
|
29267
29466
|
function cacheControl(filePath) {
|
|
29268
|
-
const normalized = filePath.split(
|
|
29467
|
+
const normalized = filePath.split(path26.sep).join("/");
|
|
29269
29468
|
return normalized.includes("/assets/") ? `public, max-age=${ONE_YEAR_SECONDS}, immutable` : "no-cache";
|
|
29270
29469
|
}
|
|
29271
29470
|
function sendFile(request, response, filePath, stat7) {
|
|
@@ -29293,7 +29492,7 @@ async function sendIndex({
|
|
|
29293
29492
|
indexPath,
|
|
29294
29493
|
token
|
|
29295
29494
|
}) {
|
|
29296
|
-
let html = await
|
|
29495
|
+
let html = await fs14.readFile(indexPath, "utf8");
|
|
29297
29496
|
if (isLoopbackHost(requestUrl.hostname)) {
|
|
29298
29497
|
const connectionScript = `<script>window.__OPENPOND_WEB_CONNECTION__=${escapeScriptJson(
|
|
29299
29498
|
JSON.stringify({
|
|
@@ -29329,8 +29528,8 @@ function createStaticWebHandler({
|
|
|
29329
29528
|
token,
|
|
29330
29529
|
webRoot
|
|
29331
29530
|
}) {
|
|
29332
|
-
const root =
|
|
29333
|
-
const indexPath =
|
|
29531
|
+
const root = path26.resolve(webRoot);
|
|
29532
|
+
const indexPath = path26.join(root, "index.html");
|
|
29334
29533
|
return (request, response, next) => {
|
|
29335
29534
|
void (async () => {
|
|
29336
29535
|
const requestUrl = new URL(request.url ?? "/", `http://${request.headers.host ?? "127.0.0.1"}`);
|
|
@@ -29352,7 +29551,7 @@ function createStaticWebHandler({
|
|
|
29352
29551
|
sendFile(request, response, resolved, directStat);
|
|
29353
29552
|
return;
|
|
29354
29553
|
}
|
|
29355
|
-
if (
|
|
29554
|
+
if (path26.extname(requestUrl.pathname)) {
|
|
29356
29555
|
sendNotFound(response);
|
|
29357
29556
|
return;
|
|
29358
29557
|
}
|
|
@@ -29375,7 +29574,7 @@ function createStaticWebHandler({
|
|
|
29375
29574
|
import { Buffer as Buffer8 } from "node:buffer";
|
|
29376
29575
|
import { existsSync as existsSync10, mkdtempSync, rmSync, statSync as statSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
29377
29576
|
import os7 from "node:os";
|
|
29378
|
-
import
|
|
29577
|
+
import path27 from "node:path";
|
|
29379
29578
|
import { spawn as spawnPty } from "node-pty";
|
|
29380
29579
|
|
|
29381
29580
|
// ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/wrapper.mjs
|
|
@@ -29434,25 +29633,25 @@ function send(socket, payload) {
|
|
|
29434
29633
|
function defaultShell() {
|
|
29435
29634
|
if (process.env.OPENPOND_TERMINAL_SHELL) {
|
|
29436
29635
|
const command2 = process.env.OPENPOND_TERMINAL_SHELL;
|
|
29437
|
-
return shellLaunch(command2, interactiveShellArgs(command2),
|
|
29636
|
+
return shellLaunch(command2, interactiveShellArgs(command2), path27.basename(command2));
|
|
29438
29637
|
}
|
|
29439
29638
|
if (process.platform === "win32") {
|
|
29440
29639
|
return { command: "powershell.exe", args: ["-NoLogo"], label: "PowerShell" };
|
|
29441
29640
|
}
|
|
29442
29641
|
const command = process.platform === "darwin" && existsSync10("/bin/zsh") ? "/bin/zsh" : "/bin/bash";
|
|
29443
|
-
return shellLaunch(command, ["-i"],
|
|
29642
|
+
return shellLaunch(command, ["-i"], path27.basename(command) || "bash");
|
|
29444
29643
|
}
|
|
29445
29644
|
function terminalPath() {
|
|
29446
29645
|
return executableSearchPath();
|
|
29447
29646
|
}
|
|
29448
29647
|
function interactiveShellArgs(command) {
|
|
29449
29648
|
if (process.platform === "win32") return [];
|
|
29450
|
-
const name =
|
|
29649
|
+
const name = path27.basename(command);
|
|
29451
29650
|
return name === "bash" || name === "zsh" || name === "fish" ? ["-i"] : [];
|
|
29452
29651
|
}
|
|
29453
29652
|
function safeCwd(input, fallback) {
|
|
29454
29653
|
if (typeof input !== "string" || !input.trim()) return fallback;
|
|
29455
|
-
const resolved =
|
|
29654
|
+
const resolved = path27.resolve(input);
|
|
29456
29655
|
try {
|
|
29457
29656
|
return statSync4(resolved).isDirectory() ? resolved : fallback;
|
|
29458
29657
|
} catch {
|
|
@@ -29470,14 +29669,14 @@ function terminalScopeLogValue(scope) {
|
|
|
29470
29669
|
}
|
|
29471
29670
|
function shellLaunch(command, fallbackArgs, label) {
|
|
29472
29671
|
if (process.platform === "win32") return { command, args: fallbackArgs, label, integrationDir: null };
|
|
29473
|
-
const name =
|
|
29672
|
+
const name = path27.basename(command);
|
|
29474
29673
|
if (name === "bash") return bashShellLaunch(command, label);
|
|
29475
29674
|
if (name === "zsh") return zshShellLaunch(command, label);
|
|
29476
29675
|
if (name === "fish") return fishShellLaunch(command, label);
|
|
29477
29676
|
return { command, args: fallbackArgs, label, integrationDir: null };
|
|
29478
29677
|
}
|
|
29479
29678
|
function createShellIntegrationDir() {
|
|
29480
|
-
return mkdtempSync(
|
|
29679
|
+
return mkdtempSync(path27.join(os7.tmpdir(), "openpond-terminal-"));
|
|
29481
29680
|
}
|
|
29482
29681
|
function removeShellIntegrationDir(dir) {
|
|
29483
29682
|
if (!dir) return;
|
|
@@ -29488,22 +29687,22 @@ function removeShellIntegrationDir(dir) {
|
|
|
29488
29687
|
}
|
|
29489
29688
|
function bashShellLaunch(command, label) {
|
|
29490
29689
|
const integrationDir = createShellIntegrationDir();
|
|
29491
|
-
const rcFile =
|
|
29690
|
+
const rcFile = path27.join(integrationDir, "openpond.bashrc");
|
|
29492
29691
|
writeFileSync3(rcFile, bashIntegrationScript(), "utf8");
|
|
29493
29692
|
return {
|
|
29494
29693
|
command,
|
|
29495
29694
|
args: ["--rcfile", rcFile, "-i"],
|
|
29496
29695
|
label,
|
|
29497
29696
|
env: {
|
|
29498
|
-
OPENPOND_ORIGINAL_BASHRC:
|
|
29697
|
+
OPENPOND_ORIGINAL_BASHRC: path27.join(process.env.HOME ?? "", ".bashrc")
|
|
29499
29698
|
},
|
|
29500
29699
|
integrationDir
|
|
29501
29700
|
};
|
|
29502
29701
|
}
|
|
29503
29702
|
function zshShellLaunch(command, label) {
|
|
29504
29703
|
const integrationDir = createShellIntegrationDir();
|
|
29505
|
-
writeFileSync3(
|
|
29506
|
-
writeFileSync3(
|
|
29704
|
+
writeFileSync3(path27.join(integrationDir, ".zshenv"), zshEnvScript(), "utf8");
|
|
29705
|
+
writeFileSync3(path27.join(integrationDir, ".zshrc"), zshIntegrationScript(), "utf8");
|
|
29507
29706
|
return {
|
|
29508
29707
|
command,
|
|
29509
29708
|
args: ["-i"],
|
|
@@ -29517,7 +29716,7 @@ function zshShellLaunch(command, label) {
|
|
|
29517
29716
|
}
|
|
29518
29717
|
function fishShellLaunch(command, label) {
|
|
29519
29718
|
const integrationDir = createShellIntegrationDir();
|
|
29520
|
-
const scriptPath =
|
|
29719
|
+
const scriptPath = path27.join(integrationDir, "openpond.fish");
|
|
29521
29720
|
writeFileSync3(scriptPath, fishIntegrationScript(), "utf8");
|
|
29522
29721
|
return {
|
|
29523
29722
|
command,
|
|
@@ -30150,12 +30349,12 @@ import { randomUUID as randomUUID8 } from "node:crypto";
|
|
|
30150
30349
|
import { Buffer as Buffer9 } from "node:buffer";
|
|
30151
30350
|
import { spawn as spawn4 } from "node:child_process";
|
|
30152
30351
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
30153
|
-
import { promises as
|
|
30154
|
-
import
|
|
30352
|
+
import { promises as fs16 } from "node:fs";
|
|
30353
|
+
import path29 from "node:path";
|
|
30155
30354
|
|
|
30156
30355
|
// ../server/src/scaffold/sandbox-template-scaffold.ts
|
|
30157
|
-
import { promises as
|
|
30158
|
-
import
|
|
30356
|
+
import { promises as fs15 } from "node:fs";
|
|
30357
|
+
import path28 from "node:path";
|
|
30159
30358
|
async function writeSandboxTemplateScaffold(repoPath, input) {
|
|
30160
30359
|
const manifestPath = normalizeManifestPath(input.manifestPath);
|
|
30161
30360
|
const files = sandboxTemplateScaffoldFiles({ name: input.projectName });
|
|
@@ -30174,20 +30373,20 @@ async function writeSandboxTemplateScaffold(repoPath, input) {
|
|
|
30174
30373
|
if (relativePath !== manifestPath) delete files[relativePath];
|
|
30175
30374
|
}
|
|
30176
30375
|
}
|
|
30177
|
-
const existingManifest =
|
|
30376
|
+
const existingManifest = path28.join(repoPath, manifestPath);
|
|
30178
30377
|
if (await fileExists3(existingManifest)) {
|
|
30179
30378
|
throw new Error(`${manifestPath} already exists in this project.`);
|
|
30180
30379
|
}
|
|
30181
30380
|
for (const [relativePath, contents] of Object.entries(files)) {
|
|
30182
|
-
const filePath =
|
|
30183
|
-
await
|
|
30184
|
-
await
|
|
30381
|
+
const filePath = path28.join(repoPath, relativePath);
|
|
30382
|
+
await fs15.mkdir(path28.dirname(filePath), { recursive: true });
|
|
30383
|
+
await fs15.writeFile(filePath, contents, "utf8");
|
|
30185
30384
|
}
|
|
30186
30385
|
return { files: Object.keys(files).sort((left, right) => left.localeCompare(right)) };
|
|
30187
30386
|
}
|
|
30188
30387
|
function normalizeManifestPath(value) {
|
|
30189
30388
|
const trimmed = value?.trim() || OPENPOND_MANIFEST_FILE_NAME;
|
|
30190
|
-
const normalized =
|
|
30389
|
+
const normalized = path28.posix.normalize(trimmed.replace(/\\/g, "/")).replace(/^\/+/, "");
|
|
30191
30390
|
if (!normalized || normalized === "." || normalized.startsWith("../") || normalized.includes("/../")) {
|
|
30192
30391
|
throw new Error("Manifest path must stay inside the project.");
|
|
30193
30392
|
}
|
|
@@ -30195,7 +30394,7 @@ function normalizeManifestPath(value) {
|
|
|
30195
30394
|
}
|
|
30196
30395
|
async function fileExists3(filePath) {
|
|
30197
30396
|
try {
|
|
30198
|
-
const stat7 = await
|
|
30397
|
+
const stat7 = await fs15.stat(filePath);
|
|
30199
30398
|
return stat7.isFile();
|
|
30200
30399
|
} catch {
|
|
30201
30400
|
return false;
|
|
@@ -30258,14 +30457,14 @@ ${diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).j
|
|
|
30258
30457
|
const template = await readSandboxTemplateFromDisk(project);
|
|
30259
30458
|
const manifest = validSandboxTemplateManifest(template);
|
|
30260
30459
|
const rootPath = localProjectSandboxTemplateRootPath(project);
|
|
30261
|
-
const outputPath =
|
|
30460
|
+
const outputPath = path29.join(rootPath, "dist", SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME);
|
|
30262
30461
|
const plan = sandboxTemplateBuildPlan({
|
|
30263
30462
|
manifest,
|
|
30264
|
-
manifestFile:
|
|
30265
|
-
projectRoot:
|
|
30463
|
+
manifestFile: path29.relative(rootPath, template.manifestPath) || OPENPOND_MANIFEST_FILE_NAME,
|
|
30464
|
+
projectRoot: path29.relative(path29.dirname(outputPath), rootPath) || "."
|
|
30266
30465
|
});
|
|
30267
|
-
await
|
|
30268
|
-
await
|
|
30466
|
+
await fs16.mkdir(path29.dirname(outputPath), { recursive: true });
|
|
30467
|
+
await fs16.writeFile(outputPath, `${JSON.stringify(plan, null, 2)}
|
|
30269
30468
|
`, "utf8");
|
|
30270
30469
|
return {
|
|
30271
30470
|
session,
|
|
@@ -30273,7 +30472,7 @@ ${diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).j
|
|
|
30273
30472
|
ok: true,
|
|
30274
30473
|
action: input.action,
|
|
30275
30474
|
appId: session.appId,
|
|
30276
|
-
output: `Built sandbox template ${manifest.name} to ${
|
|
30475
|
+
output: `Built sandbox template ${manifest.name} to ${path29.relative(rootPath, outputPath)}.`,
|
|
30277
30476
|
data: {
|
|
30278
30477
|
projectId: project.id,
|
|
30279
30478
|
manifestPath: template.manifestPath,
|
|
@@ -30501,7 +30700,7 @@ ${run.execution.output}`,
|
|
|
30501
30700
|
async function readSandboxTemplateFromDisk(project) {
|
|
30502
30701
|
const template = project.sandboxTemplate;
|
|
30503
30702
|
if (!template?.detected) throw new Error("This project does not contain openpond.yaml.");
|
|
30504
|
-
const validation = validateSandboxTemplateYaml(await
|
|
30703
|
+
const validation = validateSandboxTemplateYaml(await fs16.readFile(template.manifestPath, "utf8"));
|
|
30505
30704
|
return {
|
|
30506
30705
|
rootPath: template.rootPath,
|
|
30507
30706
|
manifestPath: template.manifestPath,
|
|
@@ -31056,7 +31255,7 @@ async function uploadFilesToSandbox(sandboxId2, uploads, reportProgress) {
|
|
|
31056
31255
|
return uploaded;
|
|
31057
31256
|
}
|
|
31058
31257
|
async function uploadLargeFileToSandbox(sandboxId2, uploadPath, contentsBase64, sizeBytes, reportProgress) {
|
|
31059
|
-
const uploadDir =
|
|
31258
|
+
const uploadDir = path29.posix.dirname(uploadPath);
|
|
31060
31259
|
const uploadId = randomUUID6();
|
|
31061
31260
|
const chunkDir = `.openpond-upload/${uploadId}`;
|
|
31062
31261
|
await reportSandboxTemplateProgress(
|
|
@@ -31270,11 +31469,11 @@ ${result.output}`);
|
|
|
31270
31469
|
uploadedFiles.length ? `Prepared ${uploadedFiles.length} local input file${uploadedFiles.length === 1 ? "" : "s"}.` : "No local input files to prepare.",
|
|
31271
31470
|
{ phase: "local_upload", files: uploadedFiles }
|
|
31272
31471
|
);
|
|
31273
|
-
const replayParamsPath =
|
|
31472
|
+
const replayParamsPath = path29.join(input.rootPath, "openpond-replay-params.json");
|
|
31274
31473
|
const replayJson = `${JSON.stringify({ input: input.params }, null, 2)}
|
|
31275
31474
|
`;
|
|
31276
|
-
await
|
|
31277
|
-
await reportSandboxTemplateProgress(input.reportProgress, `Wrote replay parameters to ${
|
|
31475
|
+
await fs16.writeFile(replayParamsPath, replayJson, "utf8");
|
|
31476
|
+
await reportSandboxTemplateProgress(input.reportProgress, `Wrote replay parameters to ${path29.relative(input.rootPath, replayParamsPath)}.`, {
|
|
31278
31477
|
phase: "local_params",
|
|
31279
31478
|
path: replayParamsPath
|
|
31280
31479
|
});
|
|
@@ -31285,7 +31484,7 @@ ${result.output}`);
|
|
|
31285
31484
|
});
|
|
31286
31485
|
const execution = await runLocalShellCommand(
|
|
31287
31486
|
input.executable.command,
|
|
31288
|
-
input.executable.cwd ?
|
|
31487
|
+
input.executable.cwd ? path29.resolve(input.rootPath, input.executable.cwd) : input.rootPath,
|
|
31289
31488
|
{
|
|
31290
31489
|
timeoutSeconds: input.executable.timeoutSeconds ?? 900,
|
|
31291
31490
|
env: {
|
|
@@ -31318,10 +31517,10 @@ async function writeLocalSandboxTemplateUploads(rootPath, uploads) {
|
|
|
31318
31517
|
const written = [];
|
|
31319
31518
|
for (const upload of uploads) {
|
|
31320
31519
|
const relativePath = normalizeLocalWorkspacePath(upload.path);
|
|
31321
|
-
const targetPath =
|
|
31322
|
-
await
|
|
31520
|
+
const targetPath = path29.resolve(rootPath, relativePath);
|
|
31521
|
+
await fs16.mkdir(path29.dirname(targetPath), { recursive: true });
|
|
31323
31522
|
const contents = Buffer9.from(upload.contentsBase64, "base64");
|
|
31324
|
-
await
|
|
31523
|
+
await fs16.writeFile(targetPath, contents);
|
|
31325
31524
|
written.push({ path: relativePath, sizeBytes: contents.length });
|
|
31326
31525
|
}
|
|
31327
31526
|
return written;
|
|
@@ -31330,15 +31529,15 @@ async function prepareLocalSandboxTemplateVolumes(rootPath, manifest) {
|
|
|
31330
31529
|
for (const volume of manifest.volumes) {
|
|
31331
31530
|
const mountPath = typeof volume.mountPath === "string" && volume.mountPath.trim() ? volume.mountPath.trim() : volume.name ? `/workspace/volumes/${volume.name}` : "";
|
|
31332
31531
|
if (!mountPath) continue;
|
|
31333
|
-
await
|
|
31532
|
+
await fs16.mkdir(path29.resolve(rootPath, normalizeLocalWorkspacePath(mountPath)), { recursive: true });
|
|
31334
31533
|
}
|
|
31335
31534
|
}
|
|
31336
31535
|
async function collectLocalSandboxTemplateArtifacts(rootPath, artifactPaths) {
|
|
31337
31536
|
const artifacts = [];
|
|
31338
31537
|
for (const artifactPath2 of artifactPaths) {
|
|
31339
|
-
const localPath2 =
|
|
31538
|
+
const localPath2 = path29.resolve(rootPath, normalizeLocalWorkspacePath(artifactPath2));
|
|
31340
31539
|
try {
|
|
31341
|
-
const stat7 = await
|
|
31540
|
+
const stat7 = await fs16.stat(localPath2);
|
|
31342
31541
|
artifacts.push({ path: artifactPath2, exists: stat7.isFile(), sizeBytes: stat7.size });
|
|
31343
31542
|
} catch {
|
|
31344
31543
|
artifacts.push({ path: artifactPath2, exists: false, sizeBytes: null });
|
|
@@ -32362,7 +32561,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
|
|
|
32362
32561
|
0,
|
|
32363
32562
|
patchPaths.length - SANDBOX_SOURCE_READBACK_MAX_FILES
|
|
32364
32563
|
);
|
|
32365
|
-
for (const
|
|
32564
|
+
for (const path64 of patchPaths.slice(0, SANDBOX_SOURCE_READBACK_MAX_FILES)) {
|
|
32366
32565
|
const remainingBytes = SANDBOX_SOURCE_READBACK_MAX_TOTAL_BYTES - totalReturnedBytes;
|
|
32367
32566
|
if (remainingBytes <= 0) {
|
|
32368
32567
|
skippedFiles += 1;
|
|
@@ -32377,7 +32576,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
|
|
|
32377
32576
|
await sandboxRequestPayload({
|
|
32378
32577
|
type: "download_file",
|
|
32379
32578
|
sandboxId: input.sandboxId,
|
|
32380
|
-
payload: { path:
|
|
32579
|
+
payload: { path: path64, maxBytes }
|
|
32381
32580
|
})
|
|
32382
32581
|
);
|
|
32383
32582
|
const file = asRecord9(downloadPayload.file);
|
|
@@ -32385,7 +32584,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
|
|
|
32385
32584
|
const returnedBytes = numberValue3(file.returnedBytes);
|
|
32386
32585
|
const sizeBytes = numberValue3(file.totalSizeBytes) ?? numberValue3(file.sizeBytes);
|
|
32387
32586
|
const entry = {
|
|
32388
|
-
path:
|
|
32587
|
+
path: path64,
|
|
32389
32588
|
sizeBytes,
|
|
32390
32589
|
returnedBytes,
|
|
32391
32590
|
isBinary,
|
|
@@ -32404,7 +32603,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
|
|
|
32404
32603
|
files.push(entry);
|
|
32405
32604
|
} catch (error) {
|
|
32406
32605
|
files.push({
|
|
32407
|
-
path:
|
|
32606
|
+
path: path64,
|
|
32408
32607
|
sizeBytes: null,
|
|
32409
32608
|
returnedBytes: null,
|
|
32410
32609
|
isBinary: false,
|
|
@@ -32606,10 +32805,10 @@ ${message2}` : message2;
|
|
|
32606
32805
|
const file = asRecord9(payload.file);
|
|
32607
32806
|
const contentsBase64 = typeof file.contentsBase64 === "string" ? file.contentsBase64 : "";
|
|
32608
32807
|
const text3 = contentsBase64 ? Buffer11.from(contentsBase64, "base64").toString("utf8") : "";
|
|
32609
|
-
const
|
|
32610
|
-
return text3 ? `${
|
|
32808
|
+
const path64 = typeof file.path === "string" ? file.path : "file";
|
|
32809
|
+
return text3 ? `${path64}
|
|
32611
32810
|
|
|
32612
|
-
${text3}` : `Read ${
|
|
32811
|
+
${text3}` : `Read ${path64}`;
|
|
32613
32812
|
}
|
|
32614
32813
|
if (action === "sandbox_exec") {
|
|
32615
32814
|
const command = asRecord9(payload.command);
|
|
@@ -32646,31 +32845,31 @@ ${output}` : `Action ${actionName} ${status}`;
|
|
|
32646
32845
|
}
|
|
32647
32846
|
if (action === "sandbox_upload_file") {
|
|
32648
32847
|
const file = asRecord9(payload.file);
|
|
32649
|
-
const
|
|
32650
|
-
return appendPreservation(`Uploaded ${
|
|
32848
|
+
const path64 = typeof file.path === "string" ? file.path : "file";
|
|
32849
|
+
return appendPreservation(`Uploaded ${path64}.`);
|
|
32651
32850
|
}
|
|
32652
32851
|
if (action === "sandbox_write_file") {
|
|
32653
32852
|
const file = asRecord9(payload.file);
|
|
32654
|
-
const
|
|
32655
|
-
return appendPreservation(`Wrote ${
|
|
32853
|
+
const path64 = typeof file.path === "string" ? file.path : "file";
|
|
32854
|
+
return appendPreservation(`Wrote ${path64}.`);
|
|
32656
32855
|
}
|
|
32657
32856
|
if (action === "sandbox_edit_file") {
|
|
32658
32857
|
const edit = asRecord9(payload.edit);
|
|
32659
|
-
const
|
|
32858
|
+
const path64 = typeof edit.path === "string" ? edit.path : "file";
|
|
32660
32859
|
const replacements = typeof edit.replacements === "number" ? edit.replacements : 0;
|
|
32661
32860
|
return appendPreservation(
|
|
32662
|
-
`Edited ${
|
|
32861
|
+
`Edited ${path64} with ${replacements} replacement${replacements === 1 ? "" : "s"}.`
|
|
32663
32862
|
);
|
|
32664
32863
|
}
|
|
32665
32864
|
if (action === "sandbox_delete_file") {
|
|
32666
32865
|
const deleted = asRecord9(payload.deleted);
|
|
32667
|
-
const
|
|
32668
|
-
return appendPreservation(`Deleted ${
|
|
32866
|
+
const path64 = typeof deleted.path === "string" ? deleted.path : "file";
|
|
32867
|
+
return appendPreservation(`Deleted ${path64}.`);
|
|
32669
32868
|
}
|
|
32670
32869
|
if (action === "sandbox_mkdir") {
|
|
32671
32870
|
const directory = asRecord9(payload.directory);
|
|
32672
|
-
const
|
|
32673
|
-
return appendPreservation(`Created directory ${
|
|
32871
|
+
const path64 = typeof directory.path === "string" ? directory.path : "directory";
|
|
32872
|
+
return appendPreservation(`Created directory ${path64}.`);
|
|
32674
32873
|
}
|
|
32675
32874
|
if (action === "sandbox_move_file") {
|
|
32676
32875
|
const moved = asRecord9(payload.moved);
|
|
@@ -33686,10 +33885,10 @@ function createWorkspaceToolExecutor(deps) {
|
|
|
33686
33885
|
|
|
33687
33886
|
// ../server/src/work/work-output-service.ts
|
|
33688
33887
|
import { createHash as createHash7, randomUUID as randomUUID9 } from "node:crypto";
|
|
33689
|
-
import { promises as
|
|
33690
|
-
import
|
|
33888
|
+
import { promises as fs17 } from "node:fs";
|
|
33889
|
+
import path30 from "node:path";
|
|
33691
33890
|
function createWorkOutputService(input) {
|
|
33692
|
-
const outputRoot =
|
|
33891
|
+
const outputRoot = path30.join(input.storeDir, "work", "outputs");
|
|
33693
33892
|
const sandboxRequest = input.sandboxRequest ?? sandboxRequestPayload;
|
|
33694
33893
|
async function saveWorkOutput(request) {
|
|
33695
33894
|
if (request.session.experience !== "work") {
|
|
@@ -33700,7 +33899,7 @@ function createWorkOutputService(input) {
|
|
|
33700
33899
|
}
|
|
33701
33900
|
const sandboxPath = normalizeOutputCandidatePath(request.sandboxPath);
|
|
33702
33901
|
const title = safeOutputName(
|
|
33703
|
-
request.suggestedName ||
|
|
33902
|
+
request.suggestedName || path30.posix.basename(sandboxPath)
|
|
33704
33903
|
);
|
|
33705
33904
|
const payload = asRecord10(
|
|
33706
33905
|
await sandboxRequest({
|
|
@@ -33732,7 +33931,7 @@ function createWorkOutputService(input) {
|
|
|
33732
33931
|
if (reportedSize !== null && bytes2.byteLength !== reportedSize) {
|
|
33733
33932
|
throw new Error("Sandbox output download was incomplete.");
|
|
33734
33933
|
}
|
|
33735
|
-
const contentType2 = WORK_OUTPUT_CONTENT_TYPES[
|
|
33934
|
+
const contentType2 = WORK_OUTPUT_CONTENT_TYPES[path30.extname(title).toLowerCase()];
|
|
33736
33935
|
if (!contentType2) {
|
|
33737
33936
|
throw new Error(
|
|
33738
33937
|
`${title} is not an advertised Work output format. Save it as a supported file type or keep it in scratch space.`
|
|
@@ -33752,26 +33951,26 @@ function createWorkOutputService(input) {
|
|
|
33752
33951
|
});
|
|
33753
33952
|
const outputId = identity.id;
|
|
33754
33953
|
const revision = identity.revision;
|
|
33755
|
-
const taskDirectory =
|
|
33954
|
+
const taskDirectory = path30.join(
|
|
33756
33955
|
outputRoot,
|
|
33757
33956
|
safePathSegment(request.session.id)
|
|
33758
33957
|
);
|
|
33759
|
-
await
|
|
33760
|
-
const destination =
|
|
33958
|
+
await fs17.mkdir(taskDirectory, { recursive: true, mode: 448 });
|
|
33959
|
+
const destination = path30.join(
|
|
33761
33960
|
taskDirectory,
|
|
33762
33961
|
`${String(revision).padStart(3, "0")}-${safePathSegment(
|
|
33763
33962
|
outputId
|
|
33764
33963
|
)}-${title}`
|
|
33765
33964
|
);
|
|
33766
|
-
const temporary =
|
|
33965
|
+
const temporary = path30.join(
|
|
33767
33966
|
taskDirectory,
|
|
33768
|
-
`.${
|
|
33967
|
+
`.${path30.basename(destination)}.${randomUUID9()}.tmp`
|
|
33769
33968
|
);
|
|
33770
|
-
await
|
|
33969
|
+
await fs17.writeFile(temporary, bytes2, { mode: 384, flag: "wx" });
|
|
33771
33970
|
try {
|
|
33772
|
-
await
|
|
33971
|
+
await fs17.rename(temporary, destination);
|
|
33773
33972
|
} catch (error) {
|
|
33774
|
-
await
|
|
33973
|
+
await fs17.rm(temporary, { force: true });
|
|
33775
33974
|
throw error;
|
|
33776
33975
|
}
|
|
33777
33976
|
const outputRef = FileOutputRefSchema.parse({
|
|
@@ -33828,7 +34027,7 @@ function createWorkOutputService(input) {
|
|
|
33828
34027
|
const file = asRecord10(value);
|
|
33829
34028
|
if (file.type !== "file" || typeof file.path !== "string") continue;
|
|
33830
34029
|
const sandboxPath = file.path.replace(/^\/workspace\//, "");
|
|
33831
|
-
const title = safeOutputName(
|
|
34030
|
+
const title = safeOutputName(path30.posix.basename(sandboxPath));
|
|
33832
34031
|
if (alreadySaved.has(title)) continue;
|
|
33833
34032
|
saved.push(
|
|
33834
34033
|
await saveWorkOutput({
|
|
@@ -33887,19 +34086,19 @@ function createWorkOutputService(input) {
|
|
|
33887
34086
|
if (outputRef.location.kind !== "local") {
|
|
33888
34087
|
throw new Error("This Work output is not stored on this device.");
|
|
33889
34088
|
}
|
|
33890
|
-
const taskDirectory =
|
|
34089
|
+
const taskDirectory = path30.resolve(
|
|
33891
34090
|
outputRoot,
|
|
33892
34091
|
safePathSegment(request.session.id)
|
|
33893
34092
|
);
|
|
33894
|
-
const target =
|
|
33895
|
-
if (target === taskDirectory || !target.startsWith(`${taskDirectory}${
|
|
34093
|
+
const target = path30.resolve(outputRef.location.path);
|
|
34094
|
+
if (target === taskDirectory || !target.startsWith(`${taskDirectory}${path30.sep}`)) {
|
|
33896
34095
|
throw new Error("Work output path is outside managed local storage.");
|
|
33897
34096
|
}
|
|
33898
34097
|
return { outputRef, target };
|
|
33899
34098
|
}
|
|
33900
34099
|
async function deleteWorkOutput(request) {
|
|
33901
34100
|
const { outputRef, target } = await resolveLocalOutput(request);
|
|
33902
|
-
const deleted = await
|
|
34101
|
+
const deleted = await fs17.rm(target).then(() => true).catch((error) => {
|
|
33903
34102
|
if (error.code === "ENOENT") return false;
|
|
33904
34103
|
throw error;
|
|
33905
34104
|
});
|
|
@@ -33907,7 +34106,7 @@ function createWorkOutputService(input) {
|
|
|
33907
34106
|
}
|
|
33908
34107
|
async function readWorkOutput(request) {
|
|
33909
34108
|
const { outputRef, target } = await resolveLocalOutput(request);
|
|
33910
|
-
const bytes2 = await
|
|
34109
|
+
const bytes2 = await fs17.readFile(target);
|
|
33911
34110
|
if (bytes2.byteLength > WORK_OUTPUT_MAX_BYTES) {
|
|
33912
34111
|
throw new Error(
|
|
33913
34112
|
`Work output exceeds the ${WORK_OUTPUT_MAX_BYTES.toLocaleString()} byte limit.`
|
|
@@ -34091,7 +34290,7 @@ function normalizeOutputCandidatePath(value) {
|
|
|
34091
34290
|
if (!normalized || normalized.startsWith("/")) {
|
|
34092
34291
|
throw new Error("Work output path must be relative to /workspace.");
|
|
34093
34292
|
}
|
|
34094
|
-
const clean =
|
|
34293
|
+
const clean = path30.posix.normalize(normalized);
|
|
34095
34294
|
if (clean === "." || clean === ".." || clean.startsWith("../") || !clean.startsWith("outputs/") || clean === "outputs/") {
|
|
34096
34295
|
throw new Error(
|
|
34097
34296
|
"Completed Work outputs must be inside /workspace/outputs."
|
|
@@ -34157,7 +34356,7 @@ function findOutputRefById(value, outputId, revision, depth = 0) {
|
|
|
34157
34356
|
return latest;
|
|
34158
34357
|
}
|
|
34159
34358
|
function safeOutputName(value) {
|
|
34160
|
-
const base =
|
|
34359
|
+
const base = path30.basename(value.trim()).replace(/[^a-zA-Z0-9._ -]+/g, "-");
|
|
34161
34360
|
const normalized = base.replace(/\s+/g, " ").trim().slice(0, 180);
|
|
34162
34361
|
if (!normalized || normalized === "." || normalized === "..") {
|
|
34163
34362
|
throw new Error("A valid output file name is required.");
|
|
@@ -34176,10 +34375,10 @@ function numberValue4(value) {
|
|
|
34176
34375
|
|
|
34177
34376
|
// ../server/src/work/work-sandbox-lifecycle-service.ts
|
|
34178
34377
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
34179
|
-
import { promises as
|
|
34180
|
-
import
|
|
34378
|
+
import { promises as fs18 } from "node:fs";
|
|
34379
|
+
import path31 from "node:path";
|
|
34181
34380
|
function createWorkSandboxLifecycleService(input) {
|
|
34182
|
-
const outboxPath =
|
|
34381
|
+
const outboxPath = path31.join(
|
|
34183
34382
|
input.storeDir,
|
|
34184
34383
|
"work",
|
|
34185
34384
|
"sandbox-cleanup-outbox.json"
|
|
@@ -34346,7 +34545,7 @@ function createWorkSandboxLifecycleService(input) {
|
|
|
34346
34545
|
}
|
|
34347
34546
|
async function readOutbox() {
|
|
34348
34547
|
try {
|
|
34349
|
-
const parsed = JSON.parse(await
|
|
34548
|
+
const parsed = JSON.parse(await fs18.readFile(outboxPath, "utf8"));
|
|
34350
34549
|
if (!Array.isArray(parsed)) return [];
|
|
34351
34550
|
return parsed.filter(isCleanupEntry);
|
|
34352
34551
|
} catch (error) {
|
|
@@ -34355,13 +34554,13 @@ function createWorkSandboxLifecycleService(input) {
|
|
|
34355
34554
|
}
|
|
34356
34555
|
}
|
|
34357
34556
|
async function writeOutbox(entries) {
|
|
34358
|
-
await
|
|
34557
|
+
await fs18.mkdir(path31.dirname(outboxPath), { recursive: true, mode: 448 });
|
|
34359
34558
|
const temporary = `${outboxPath}.${randomUUID10()}.tmp`;
|
|
34360
|
-
await
|
|
34559
|
+
await fs18.writeFile(temporary, JSON.stringify(entries, null, 2), {
|
|
34361
34560
|
mode: 384,
|
|
34362
34561
|
flag: "wx"
|
|
34363
34562
|
});
|
|
34364
|
-
await
|
|
34563
|
+
await fs18.rename(temporary, outboxPath);
|
|
34365
34564
|
}
|
|
34366
34565
|
return { close, finalizeTurn, retryPending, start };
|
|
34367
34566
|
}
|
|
@@ -35064,14 +35263,14 @@ function processErrorClass(failure) {
|
|
|
35064
35263
|
|
|
35065
35264
|
// ../server/src/work/work-evidence-service.ts
|
|
35066
35265
|
import { readFile as readFile4, stat as stat4 } from "node:fs/promises";
|
|
35067
|
-
import
|
|
35266
|
+
import path33 from "node:path";
|
|
35068
35267
|
|
|
35069
35268
|
// ../server/src/work/work-evidence-artifact-store.ts
|
|
35070
35269
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
35071
35270
|
import { link, mkdir as mkdir2, readFile as readFile3, rm, writeFile } from "node:fs/promises";
|
|
35072
|
-
import
|
|
35271
|
+
import path32 from "node:path";
|
|
35073
35272
|
function createWorkEvidenceArtifactStore(storeDir) {
|
|
35074
|
-
const root =
|
|
35273
|
+
const root = path32.join(storeDir, "work", "evidence");
|
|
35075
35274
|
async function persistPortableJson(input) {
|
|
35076
35275
|
const bytes2 = Buffer.from(canonicalJson(input.value), "utf8");
|
|
35077
35276
|
const hash3 = input.semanticHash ?? contentHash(input.value);
|
|
@@ -35141,10 +35340,10 @@ function createWorkEvidenceArtifactStore(storeDir) {
|
|
|
35141
35340
|
};
|
|
35142
35341
|
}
|
|
35143
35342
|
function artifactPath(root, visibility, hash3, extension2) {
|
|
35144
|
-
return
|
|
35343
|
+
return path32.join(root, visibility, hash3.slice(0, 2), `${hash3}.${extension2}`);
|
|
35145
35344
|
}
|
|
35146
35345
|
async function writeImmutable(target, bytes2) {
|
|
35147
|
-
await mkdir2(
|
|
35346
|
+
await mkdir2(path32.dirname(target), { recursive: true, mode: 448 });
|
|
35148
35347
|
const temporary = `${target}.${randomUUID11()}.tmp`;
|
|
35149
35348
|
await writeFile(temporary, bytes2, { flag: "wx", mode: 384 });
|
|
35150
35349
|
try {
|
|
@@ -35153,7 +35352,7 @@ async function writeImmutable(target, bytes2) {
|
|
|
35153
35352
|
if (error.code !== "EEXIST") throw error;
|
|
35154
35353
|
const existing = await readFile3(target);
|
|
35155
35354
|
if (!existing.equals(bytes2)) {
|
|
35156
|
-
throw new Error(`Immutable Work evidence artifact ${
|
|
35355
|
+
throw new Error(`Immutable Work evidence artifact ${path32.basename(target)} changed content.`);
|
|
35157
35356
|
}
|
|
35158
35357
|
} finally {
|
|
35159
35358
|
await rm(temporary, { force: true });
|
|
@@ -35306,9 +35505,9 @@ async function recordDesktopWorkFeedback(input) {
|
|
|
35306
35505
|
});
|
|
35307
35506
|
}
|
|
35308
35507
|
async function verifyManagedOutput(input) {
|
|
35309
|
-
const outputRoot =
|
|
35310
|
-
const target =
|
|
35311
|
-
if (!target.startsWith(`${outputRoot}${
|
|
35508
|
+
const outputRoot = path33.resolve(input.storeDir, "work", "outputs");
|
|
35509
|
+
const target = path33.resolve(input.path);
|
|
35510
|
+
if (!target.startsWith(`${outputRoot}${path33.sep}`)) {
|
|
35312
35511
|
throw new Error("Work evidence output is outside managed local output storage.");
|
|
35313
35512
|
}
|
|
35314
35513
|
const info = await stat4(target);
|
|
@@ -35427,8 +35626,8 @@ function publicFeedback(stored) {
|
|
|
35427
35626
|
|
|
35428
35627
|
// ../server/src/work/work-agent-package-service.ts
|
|
35429
35628
|
import { createHash as createHash8, randomUUID as randomUUID12 } from "node:crypto";
|
|
35430
|
-
import { promises as
|
|
35431
|
-
import
|
|
35629
|
+
import { promises as fs19 } from "node:fs";
|
|
35630
|
+
import path34 from "node:path";
|
|
35432
35631
|
var AGENT_PACKAGE_SCHEMA = "openpond.agent-package.v1";
|
|
35433
35632
|
var MAX_SOURCE_FILES = 1e3;
|
|
35434
35633
|
var REQUIRED_ARTIFACTS = [
|
|
@@ -35438,7 +35637,7 @@ var REQUIRED_ARTIFACTS = [
|
|
|
35438
35637
|
".openpond/validator-report.md"
|
|
35439
35638
|
];
|
|
35440
35639
|
function createWorkAgentPackageService(input) {
|
|
35441
|
-
const packageRoot =
|
|
35640
|
+
const packageRoot = path34.join(input.storeDir, "work", "agent-packages");
|
|
35442
35641
|
const sandboxRequest = input.sandboxRequest ?? sandboxRequestPayload;
|
|
35443
35642
|
async function prepareWorkAgent(request) {
|
|
35444
35643
|
const sandboxId2 = requireWorkSandbox(request.session);
|
|
@@ -35565,9 +35764,9 @@ function createWorkAgentPackageService(input) {
|
|
|
35565
35764
|
`,
|
|
35566
35765
|
"utf8"
|
|
35567
35766
|
);
|
|
35568
|
-
const packageDirectory =
|
|
35569
|
-
const destination =
|
|
35570
|
-
await
|
|
35767
|
+
const packageDirectory = path34.join(packageRoot, digest);
|
|
35768
|
+
const destination = path34.join(packageDirectory, "agent-package.json");
|
|
35769
|
+
await fs19.mkdir(packageDirectory, { recursive: true, mode: 448 });
|
|
35571
35770
|
await writeImmutablePackage(destination, packageBytes);
|
|
35572
35771
|
const identity = await nextPackageOutputIdentity({
|
|
35573
35772
|
runtimeEventsForSession: input.runtimeEventsForSession,
|
|
@@ -35643,12 +35842,12 @@ function createWorkAgentPackageService(input) {
|
|
|
35643
35842
|
if (outputRef.location.kind !== "local") {
|
|
35644
35843
|
throw new Error("This Agent package is not stored on this device.");
|
|
35645
35844
|
}
|
|
35646
|
-
const resolvedPackageRoot =
|
|
35647
|
-
const target =
|
|
35648
|
-
if (!target.startsWith(`${resolvedPackageRoot}${
|
|
35845
|
+
const resolvedPackageRoot = path34.resolve(packageRoot);
|
|
35846
|
+
const target = path34.resolve(outputRef.location.path);
|
|
35847
|
+
if (!target.startsWith(`${resolvedPackageRoot}${path34.sep}`)) {
|
|
35649
35848
|
throw new Error("Agent package path is outside managed local storage.");
|
|
35650
35849
|
}
|
|
35651
|
-
const bytes2 = await
|
|
35850
|
+
const bytes2 = await fs19.readFile(target);
|
|
35652
35851
|
const agentPackage = AgentPackageSchema.parse(
|
|
35653
35852
|
JSON.parse(bytes2.toString("utf8"))
|
|
35654
35853
|
);
|
|
@@ -35822,7 +36021,7 @@ function normalizeAgentPackageJson(bytes2) {
|
|
|
35822
36021
|
}
|
|
35823
36022
|
function normalizeAgentDirectory(value) {
|
|
35824
36023
|
const normalized = value.trim().replaceAll("\\", "/");
|
|
35825
|
-
const clean =
|
|
36024
|
+
const clean = path34.posix.normalize(normalized);
|
|
35826
36025
|
if (!clean || clean === "." || clean === ".." || clean.startsWith("/") || clean.startsWith("../") || clean.split("/").some((part) => part === "..") || !/^[a-zA-Z0-9._/-]+$/.test(clean)) {
|
|
35827
36026
|
throw new Error("Agent directory must stay inside Work scratch space.");
|
|
35828
36027
|
}
|
|
@@ -35832,7 +36031,7 @@ function relativeAgentFilePath(value, root) {
|
|
|
35832
36031
|
if (typeof value !== "string") return null;
|
|
35833
36032
|
const normalized = value.trim().replaceAll("\\", "/");
|
|
35834
36033
|
const workspaceRelative = normalized.startsWith("/workspace/") ? normalized.slice("/workspace/".length) : normalized.replace(/^\/+/, "");
|
|
35835
|
-
const clean =
|
|
36034
|
+
const clean = path34.posix.normalize(workspaceRelative);
|
|
35836
36035
|
if (clean === root) return null;
|
|
35837
36036
|
if (!clean.startsWith(`${root}/`)) {
|
|
35838
36037
|
throw new Error("Sandbox returned a file outside the Agent source root.");
|
|
@@ -35869,7 +36068,7 @@ function assertSandboxCommandPassed(value, label) {
|
|
|
35869
36068
|
}
|
|
35870
36069
|
}
|
|
35871
36070
|
async function writeImmutablePackage(destination, bytes2) {
|
|
35872
|
-
const existing = await
|
|
36071
|
+
const existing = await fs19.readFile(destination).catch(() => null);
|
|
35873
36072
|
if (existing) {
|
|
35874
36073
|
if (!existing.equals(bytes2)) {
|
|
35875
36074
|
throw new Error(
|
|
@@ -35879,12 +36078,12 @@ async function writeImmutablePackage(destination, bytes2) {
|
|
|
35879
36078
|
return;
|
|
35880
36079
|
}
|
|
35881
36080
|
const temporary = `${destination}.${randomUUID12()}.tmp`;
|
|
35882
|
-
await
|
|
36081
|
+
await fs19.writeFile(temporary, bytes2, { mode: 384, flag: "wx" });
|
|
35883
36082
|
try {
|
|
35884
|
-
await
|
|
36083
|
+
await fs19.rename(temporary, destination);
|
|
35885
36084
|
} catch (error) {
|
|
35886
|
-
await
|
|
35887
|
-
const winner = await
|
|
36085
|
+
await fs19.rm(temporary, { force: true });
|
|
36086
|
+
const winner = await fs19.readFile(destination).catch(() => null);
|
|
35888
36087
|
if (!winner?.equals(bytes2)) throw error;
|
|
35889
36088
|
}
|
|
35890
36089
|
}
|
|
@@ -35976,8 +36175,8 @@ function numberValue5(value) {
|
|
|
35976
36175
|
|
|
35977
36176
|
// ../server/src/work/work-agent-sdk-archive.ts
|
|
35978
36177
|
import { execFile as execFile4 } from "node:child_process";
|
|
35979
|
-
import { promises as
|
|
35980
|
-
import
|
|
36178
|
+
import { promises as fs20 } from "node:fs";
|
|
36179
|
+
import path35 from "node:path";
|
|
35981
36180
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
35982
36181
|
import { promisify as promisify3 } from "node:util";
|
|
35983
36182
|
var execFileAsync3 = promisify3(execFile4);
|
|
@@ -35995,15 +36194,15 @@ function createWorkAgentSdkArchiveLoader(input) {
|
|
|
35995
36194
|
};
|
|
35996
36195
|
}
|
|
35997
36196
|
async function loadWorkAgentSdkArchive(input) {
|
|
35998
|
-
const stagedPath = input.packagePath?.trim() || process.env.OPENPOND_AGENT_SDK_PACKAGE?.trim() ||
|
|
35999
|
-
|
|
36197
|
+
const stagedPath = input.packagePath?.trim() || process.env.OPENPOND_AGENT_SDK_PACKAGE?.trim() || path35.join(
|
|
36198
|
+
path35.dirname(fileURLToPath2(import.meta.url)),
|
|
36000
36199
|
"work-assets",
|
|
36001
36200
|
"openpond-agent-sdk.tgz"
|
|
36002
36201
|
);
|
|
36003
36202
|
const staged = await readBoundedArchive(stagedPath);
|
|
36004
36203
|
if (staged) return staged;
|
|
36005
36204
|
const sourceRoot = await resolveAgentSdkSourceRoot(input.sourceRoot);
|
|
36006
|
-
const distCli =
|
|
36205
|
+
const distCli = path35.join(sourceRoot, "dist", "cli.js");
|
|
36007
36206
|
if (!await isFile(distCli)) {
|
|
36008
36207
|
await execFileAsync3(packageManagerCommand("pnpm"), [
|
|
36009
36208
|
"--dir",
|
|
@@ -36015,9 +36214,9 @@ async function loadWorkAgentSdkArchive(input) {
|
|
|
36015
36214
|
if (!await isFile(distCli)) {
|
|
36016
36215
|
throw new Error("OpenPond Agent SDK build did not produce dist/cli.js.");
|
|
36017
36216
|
}
|
|
36018
|
-
const cacheRoot =
|
|
36019
|
-
await
|
|
36020
|
-
const packRoot = await
|
|
36217
|
+
const cacheRoot = path35.join(input.storeDir, "work", "assets");
|
|
36218
|
+
await fs20.mkdir(cacheRoot, { recursive: true, mode: 448 });
|
|
36219
|
+
const packRoot = await fs20.mkdtemp(path35.join(cacheRoot, "agent-sdk-pack-"));
|
|
36021
36220
|
try {
|
|
36022
36221
|
const { stdout } = await execFileAsync3(packageManagerCommand("npm"), [
|
|
36023
36222
|
"pack",
|
|
@@ -36029,26 +36228,26 @@ async function loadWorkAgentSdkArchive(input) {
|
|
|
36029
36228
|
const packed = JSON.parse(stdout);
|
|
36030
36229
|
const filename = packed[0]?.filename;
|
|
36031
36230
|
if (!filename) throw new Error("npm pack did not return an SDK archive.");
|
|
36032
|
-
const bytes2 = await readBoundedArchive(
|
|
36231
|
+
const bytes2 = await readBoundedArchive(path35.join(packRoot, filename));
|
|
36033
36232
|
if (!bytes2) throw new Error("Packed OpenPond Agent SDK archive is empty.");
|
|
36034
36233
|
return bytes2;
|
|
36035
36234
|
} finally {
|
|
36036
|
-
await
|
|
36235
|
+
await fs20.rm(packRoot, { recursive: true, force: true });
|
|
36037
36236
|
}
|
|
36038
36237
|
}
|
|
36039
36238
|
async function resolveAgentSdkSourceRoot(override) {
|
|
36040
36239
|
const candidates = [
|
|
36041
36240
|
override?.trim(),
|
|
36042
36241
|
process.env.OPENPOND_AGENT_SDK_ROOT?.trim(),
|
|
36043
|
-
|
|
36044
|
-
|
|
36045
|
-
|
|
36242
|
+
path35.join(process.cwd(), "packages", "agent-sdk"),
|
|
36243
|
+
path35.resolve(
|
|
36244
|
+
path35.dirname(fileURLToPath2(import.meta.url)),
|
|
36046
36245
|
"../../../../packages/agent-sdk"
|
|
36047
36246
|
)
|
|
36048
36247
|
].filter((candidate2) => Boolean(candidate2));
|
|
36049
36248
|
for (const candidate2 of candidates) {
|
|
36050
|
-
if (await isFile(
|
|
36051
|
-
return
|
|
36249
|
+
if (await isFile(path35.join(candidate2, "package.json"))) {
|
|
36250
|
+
return path35.resolve(candidate2);
|
|
36052
36251
|
}
|
|
36053
36252
|
}
|
|
36054
36253
|
throw new Error(
|
|
@@ -36056,23 +36255,23 @@ async function resolveAgentSdkSourceRoot(override) {
|
|
|
36056
36255
|
);
|
|
36057
36256
|
}
|
|
36058
36257
|
async function readBoundedArchive(filePath) {
|
|
36059
|
-
const stat7 = await
|
|
36258
|
+
const stat7 = await fs20.stat(filePath).catch(() => null);
|
|
36060
36259
|
if (!stat7?.isFile()) return null;
|
|
36061
36260
|
if (stat7.size <= 0 || stat7.size > MAX_AGENT_SDK_ARCHIVE_BYTES) {
|
|
36062
36261
|
throw new Error("OpenPond Agent SDK archive has an invalid size.");
|
|
36063
36262
|
}
|
|
36064
|
-
return
|
|
36263
|
+
return fs20.readFile(filePath);
|
|
36065
36264
|
}
|
|
36066
36265
|
async function isFile(filePath) {
|
|
36067
|
-
return
|
|
36266
|
+
return fs20.stat(filePath).then((stat7) => stat7.isFile()).catch(() => false);
|
|
36068
36267
|
}
|
|
36069
36268
|
function packageManagerCommand(name) {
|
|
36070
36269
|
return process.platform === "win32" ? `${name}.cmd` : name;
|
|
36071
36270
|
}
|
|
36072
36271
|
|
|
36073
36272
|
// ../server/src/workspace/server-workspace-managed-workflows.ts
|
|
36074
|
-
import { promises as
|
|
36075
|
-
import
|
|
36273
|
+
import { promises as fs21 } from "node:fs";
|
|
36274
|
+
import path36 from "node:path";
|
|
36076
36275
|
function createWorkspaceManagedWorkflows(deps) {
|
|
36077
36276
|
const { appendRuntimeEvent } = deps;
|
|
36078
36277
|
async function runSandboxTemplateCheckActionEvent(session, turnId, source, action, repoPath) {
|
|
@@ -36136,16 +36335,16 @@ function createWorkspaceManagedWorkflows(deps) {
|
|
|
36136
36335
|
}
|
|
36137
36336
|
async function hasSandboxTemplateManifest(repoPath) {
|
|
36138
36337
|
try {
|
|
36139
|
-
await
|
|
36338
|
+
await fs21.access(path36.join(repoPath, OPENPOND_MANIFEST_FILE_NAME));
|
|
36140
36339
|
return true;
|
|
36141
36340
|
} catch {
|
|
36142
36341
|
return false;
|
|
36143
36342
|
}
|
|
36144
36343
|
}
|
|
36145
36344
|
async function runSandboxTemplateCheck(repoPath, action) {
|
|
36146
|
-
const manifestPath =
|
|
36345
|
+
const manifestPath = path36.join(repoPath, OPENPOND_MANIFEST_FILE_NAME);
|
|
36147
36346
|
try {
|
|
36148
|
-
const source = await
|
|
36347
|
+
const source = await fs21.readFile(manifestPath, "utf8");
|
|
36149
36348
|
const result = validateSandboxTemplateYaml(source);
|
|
36150
36349
|
if (!result.ok) {
|
|
36151
36350
|
return {
|
|
@@ -36165,20 +36364,20 @@ async function runSandboxTemplateCheck(repoPath, action) {
|
|
|
36165
36364
|
stderr: ""
|
|
36166
36365
|
};
|
|
36167
36366
|
}
|
|
36168
|
-
const outputPath =
|
|
36367
|
+
const outputPath = path36.join(repoPath, "dist", SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME);
|
|
36169
36368
|
const plan = sandboxTemplateBuildPlan({
|
|
36170
36369
|
manifest: result.manifest,
|
|
36171
36370
|
manifestFile: OPENPOND_MANIFEST_FILE_NAME,
|
|
36172
|
-
projectRoot:
|
|
36371
|
+
projectRoot: path36.relative(path36.dirname(outputPath), repoPath) || "."
|
|
36173
36372
|
});
|
|
36174
|
-
await
|
|
36175
|
-
await
|
|
36373
|
+
await fs21.mkdir(path36.dirname(outputPath), { recursive: true });
|
|
36374
|
+
await fs21.writeFile(outputPath, `${JSON.stringify(plan, null, 2)}
|
|
36176
36375
|
`, "utf8");
|
|
36177
36376
|
return {
|
|
36178
36377
|
ok: true,
|
|
36179
36378
|
command: action,
|
|
36180
36379
|
code: 0,
|
|
36181
|
-
stdout: `Built sandbox template ${result.manifest.name} to ${
|
|
36380
|
+
stdout: `Built sandbox template ${result.manifest.name} to ${path36.relative(repoPath, outputPath)}.`,
|
|
36182
36381
|
stderr: ""
|
|
36183
36382
|
};
|
|
36184
36383
|
} catch (error) {
|
|
@@ -36193,7 +36392,7 @@ async function runSandboxTemplateCheck(repoPath, action) {
|
|
|
36193
36392
|
}
|
|
36194
36393
|
|
|
36195
36394
|
// ../server/src/workspace/server-workspace-session-workflows.ts
|
|
36196
|
-
import
|
|
36395
|
+
import path37 from "node:path";
|
|
36197
36396
|
function createWorkspaceSessionWorkflows(deps) {
|
|
36198
36397
|
const {
|
|
36199
36398
|
appendRuntimeEvent,
|
|
@@ -36208,7 +36407,7 @@ function createWorkspaceSessionWorkflows(deps) {
|
|
|
36208
36407
|
if (subagentRepoPath) {
|
|
36209
36408
|
const app2 = {
|
|
36210
36409
|
id: localPathWorkspaceId(subagentRepoPath),
|
|
36211
|
-
name:
|
|
36410
|
+
name: path37.basename(subagentRepoPath) || "Subagent workspace",
|
|
36212
36411
|
description: null,
|
|
36213
36412
|
visibility: "private",
|
|
36214
36413
|
gitOwner: null,
|
|
@@ -36252,7 +36451,7 @@ function createWorkspaceSessionWorkflows(deps) {
|
|
|
36252
36451
|
const workspacePath = session.cwd;
|
|
36253
36452
|
const app2 = {
|
|
36254
36453
|
id: localPathWorkspaceId(workspacePath),
|
|
36255
|
-
name:
|
|
36454
|
+
name: path37.basename(workspacePath) || workspacePath,
|
|
36256
36455
|
description: null,
|
|
36257
36456
|
visibility: "private",
|
|
36258
36457
|
gitOwner: null,
|
|
@@ -36881,9 +37080,9 @@ async function openTailscaleApp() {
|
|
|
36881
37080
|
// ../server/src/voice-transcription.ts
|
|
36882
37081
|
import { Buffer as Buffer12 } from "node:buffer";
|
|
36883
37082
|
import { spawn as spawn5 } from "node:child_process";
|
|
36884
|
-
import { constants as fsConstants, promises as
|
|
37083
|
+
import { constants as fsConstants, promises as fs22 } from "node:fs";
|
|
36885
37084
|
import os8 from "node:os";
|
|
36886
|
-
import
|
|
37085
|
+
import path38 from "node:path";
|
|
36887
37086
|
import { randomUUID as randomUUID13 } from "node:crypto";
|
|
36888
37087
|
var DEFAULT_MODEL_NAME = "base.en";
|
|
36889
37088
|
var MAX_AUDIO_BYTES = 32 * 1024 * 1024;
|
|
@@ -36893,7 +37092,7 @@ var MODEL_MAX_BYTES = 2 * 1024 * 1024 * 1024;
|
|
|
36893
37092
|
var PROCESS_OUTPUT_MAX_CHARS = 64 * 1024;
|
|
36894
37093
|
function createVoiceTranscriptionService(input) {
|
|
36895
37094
|
const modelName = normalizedModelName(process.env.OPENPOND_WHISPER_MODEL_NAME);
|
|
36896
|
-
const modelPath = process.env.OPENPOND_WHISPER_MODEL?.trim() ||
|
|
37095
|
+
const modelPath = process.env.OPENPOND_WHISPER_MODEL?.trim() || path38.join(input.storeDir, "voice-models", `ggml-${modelName}.bin`);
|
|
36897
37096
|
let modelDownload = null;
|
|
36898
37097
|
const closeController = new AbortController();
|
|
36899
37098
|
const activeProcesses = /* @__PURE__ */ new Set();
|
|
@@ -36950,13 +37149,13 @@ function createVoiceTranscriptionService(input) {
|
|
|
36950
37149
|
throw new Error("Voice recording is too large. Keep dictation under two minutes.");
|
|
36951
37150
|
}
|
|
36952
37151
|
const selectedModelPath = await ensureModel();
|
|
36953
|
-
const workDir =
|
|
36954
|
-
await
|
|
37152
|
+
const workDir = path38.join(input.storeDir, "tmp", "voice");
|
|
37153
|
+
await fs22.mkdir(workDir, { recursive: true });
|
|
36955
37154
|
const id = randomUUID13();
|
|
36956
|
-
const audioPath =
|
|
36957
|
-
const outputPrefix =
|
|
37155
|
+
const audioPath = path38.join(workDir, `${id}.wav`);
|
|
37156
|
+
const outputPrefix = path38.join(workDir, id);
|
|
36958
37157
|
const outputTextPath = `${outputPrefix}.txt`;
|
|
36959
|
-
await
|
|
37158
|
+
await fs22.writeFile(audioPath, audio, { mode: 384 });
|
|
36960
37159
|
try {
|
|
36961
37160
|
await runWhisper({
|
|
36962
37161
|
audioPath,
|
|
@@ -36967,7 +37166,7 @@ function createVoiceTranscriptionService(input) {
|
|
|
36967
37166
|
signal: closeController.signal,
|
|
36968
37167
|
activeProcesses
|
|
36969
37168
|
});
|
|
36970
|
-
const outputFileText = await
|
|
37169
|
+
const outputFileText = await fs22.readFile(outputTextPath, "utf8").catch(() => "");
|
|
36971
37170
|
const text3 = cleanWhisperText(outputFileText);
|
|
36972
37171
|
if (!text3) throw new Error("No speech was detected.");
|
|
36973
37172
|
return {
|
|
@@ -36979,8 +37178,8 @@ function createVoiceTranscriptionService(input) {
|
|
|
36979
37178
|
};
|
|
36980
37179
|
} finally {
|
|
36981
37180
|
await Promise.all([
|
|
36982
|
-
|
|
36983
|
-
|
|
37181
|
+
fs22.rm(audioPath, { force: true }),
|
|
37182
|
+
fs22.rm(outputTextPath, { force: true })
|
|
36984
37183
|
]);
|
|
36985
37184
|
}
|
|
36986
37185
|
}
|
|
@@ -37106,7 +37305,7 @@ function canDownloadDefaultModel() {
|
|
|
37106
37305
|
}
|
|
37107
37306
|
async function downloadDefaultModel(targetPath, modelName, logger, signal) {
|
|
37108
37307
|
const url = `https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-${modelName}.bin`;
|
|
37109
|
-
await
|
|
37308
|
+
await fs22.mkdir(path38.dirname(targetPath), { recursive: true });
|
|
37110
37309
|
const tempPath = `${targetPath}.${process.pid}.${Date.now()}.tmp`;
|
|
37111
37310
|
logger.info("downloading whisper model", { modelName, targetPath });
|
|
37112
37311
|
const response = await fetch(url, { signal });
|
|
@@ -37120,8 +37319,8 @@ async function downloadDefaultModel(targetPath, modelName, logger, signal) {
|
|
|
37120
37319
|
minBytes: MODEL_MIN_BYTES,
|
|
37121
37320
|
maxBytes: MODEL_MAX_BYTES
|
|
37122
37321
|
});
|
|
37123
|
-
await
|
|
37124
|
-
await
|
|
37322
|
+
await fs22.rename(tempPath, targetPath);
|
|
37323
|
+
await fs22.chmod(targetPath, 384).catch(() => void 0);
|
|
37125
37324
|
logger.info("whisper model downloaded", { modelName, targetPath, sizeBytes });
|
|
37126
37325
|
return targetPath;
|
|
37127
37326
|
}
|
|
@@ -37132,7 +37331,7 @@ async function streamVoiceModelResponseToFile(input) {
|
|
|
37132
37331
|
}
|
|
37133
37332
|
const reader = input.response.body?.getReader();
|
|
37134
37333
|
if (!reader) throw new Error("Whisper model download did not return a response body.");
|
|
37135
|
-
const file = await
|
|
37334
|
+
const file = await fs22.open(input.targetPath, "wx", 384);
|
|
37136
37335
|
let sizeBytes = 0;
|
|
37137
37336
|
try {
|
|
37138
37337
|
try {
|
|
@@ -37153,14 +37352,14 @@ async function streamVoiceModelResponseToFile(input) {
|
|
|
37153
37352
|
await file.close();
|
|
37154
37353
|
}
|
|
37155
37354
|
} catch (error) {
|
|
37156
|
-
await
|
|
37355
|
+
await fs22.rm(input.targetPath, { force: true });
|
|
37157
37356
|
throw error;
|
|
37158
37357
|
}
|
|
37159
37358
|
if (sizeBytes < input.minBytes) {
|
|
37160
|
-
await
|
|
37359
|
+
await fs22.rm(input.targetPath, { force: true });
|
|
37161
37360
|
throw new Error("Downloaded Whisper model is incomplete.");
|
|
37162
37361
|
}
|
|
37163
|
-
await
|
|
37362
|
+
await fs22.chmod(input.targetPath, 384).catch(() => void 0);
|
|
37164
37363
|
return sizeBytes;
|
|
37165
37364
|
}
|
|
37166
37365
|
async function resolveWhisperBinary() {
|
|
@@ -37177,22 +37376,22 @@ async function resolveWhisperBinary() {
|
|
|
37177
37376
|
"/usr/bin/whisper-cpp"
|
|
37178
37377
|
];
|
|
37179
37378
|
for (const candidate2 of candidates) {
|
|
37180
|
-
const resolved = candidate2.includes(
|
|
37379
|
+
const resolved = candidate2.includes(path38.sep) ? candidate2 : await findExecutableOnPath(candidate2);
|
|
37181
37380
|
if (resolved && await executableExists2(resolved)) return resolved;
|
|
37182
37381
|
}
|
|
37183
37382
|
return null;
|
|
37184
37383
|
}
|
|
37185
37384
|
async function findExecutableOnPath(command) {
|
|
37186
|
-
const paths = (process.env.PATH ?? "").split(
|
|
37385
|
+
const paths = (process.env.PATH ?? "").split(path38.delimiter).filter(Boolean);
|
|
37187
37386
|
for (const directory of paths) {
|
|
37188
|
-
const candidate2 =
|
|
37387
|
+
const candidate2 = path38.join(directory, command);
|
|
37189
37388
|
if (await executableExists2(candidate2)) return candidate2;
|
|
37190
37389
|
}
|
|
37191
37390
|
return null;
|
|
37192
37391
|
}
|
|
37193
37392
|
async function executableExists2(filePath) {
|
|
37194
37393
|
try {
|
|
37195
|
-
await
|
|
37394
|
+
await fs22.access(filePath, fsConstants.X_OK);
|
|
37196
37395
|
return true;
|
|
37197
37396
|
} catch {
|
|
37198
37397
|
return false;
|
|
@@ -37200,7 +37399,7 @@ async function executableExists2(filePath) {
|
|
|
37200
37399
|
}
|
|
37201
37400
|
async function fileExists4(filePath) {
|
|
37202
37401
|
try {
|
|
37203
|
-
await
|
|
37402
|
+
await fs22.access(filePath);
|
|
37204
37403
|
return true;
|
|
37205
37404
|
} catch {
|
|
37206
37405
|
return false;
|
|
@@ -37467,8 +37666,8 @@ function headerValue2(value) {
|
|
|
37467
37666
|
var import_cron_parser = __toESM(require_dist(), 1);
|
|
37468
37667
|
import { execFile as execFile6 } from "node:child_process";
|
|
37469
37668
|
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
37470
|
-
import { promises as
|
|
37471
|
-
import
|
|
37669
|
+
import { promises as fs23 } from "node:fs";
|
|
37670
|
+
import path39 from "node:path";
|
|
37472
37671
|
import { promisify as promisify4 } from "node:util";
|
|
37473
37672
|
|
|
37474
37673
|
// ../server/src/agents/local-agent-scheduler-values.ts
|
|
@@ -37925,7 +38124,7 @@ function profileScheduleSourceId(profile, agentId) {
|
|
|
37925
38124
|
}).slice(0, 20)}`;
|
|
37926
38125
|
}
|
|
37927
38126
|
function profileAgentRootPath(profileSourcePath, agent) {
|
|
37928
|
-
return agent.id === "default" ? profileSourcePath :
|
|
38127
|
+
return agent.id === "default" ? profileSourcePath : path39.resolve(profileSourcePath, agent.path);
|
|
37929
38128
|
}
|
|
37930
38129
|
async function pauseSchedulesForMissingSources(store, installedSourceIds) {
|
|
37931
38130
|
const schedules = await store.listLocalAgentSchedules();
|
|
@@ -37958,7 +38157,7 @@ async function inspectAgentProject(agentRootPath) {
|
|
|
37958
38157
|
agentRootPath,
|
|
37959
38158
|
manifestHash ?? stableHash(manifest)
|
|
37960
38159
|
);
|
|
37961
|
-
const projectName = stringValue10(readPath(manifest, ["project", "name"])) ??
|
|
38160
|
+
const projectName = stringValue10(readPath(manifest, ["project", "name"])) ?? path39.basename(agentRootPath) ?? "local-agent";
|
|
37962
38161
|
return {
|
|
37963
38162
|
projectName,
|
|
37964
38163
|
manifestHash,
|
|
@@ -38000,13 +38199,13 @@ async function runAgentAction(schedule, run, inputOverride) {
|
|
|
38000
38199
|
const current = await inspectAgentProject(schedule.agentRootPath);
|
|
38001
38200
|
assertLocalAgentScheduleVersion(schedule, current);
|
|
38002
38201
|
const cli = await resolveOpenPondAgentCli(schedule.agentRootPath);
|
|
38003
|
-
const runDir =
|
|
38202
|
+
const runDir = path39.join(
|
|
38004
38203
|
schedule.agentRootPath,
|
|
38005
38204
|
".openpond",
|
|
38006
38205
|
"local-scheduler"
|
|
38007
38206
|
);
|
|
38008
|
-
await
|
|
38009
|
-
const inputPath =
|
|
38207
|
+
await fs23.mkdir(runDir, { recursive: true });
|
|
38208
|
+
const inputPath = path39.join(runDir, `${run.id}.input.json`);
|
|
38010
38209
|
const input = {
|
|
38011
38210
|
channel: "schedule",
|
|
38012
38211
|
...schedule.input,
|
|
@@ -38020,9 +38219,9 @@ async function runAgentAction(schedule, run, inputOverride) {
|
|
|
38020
38219
|
trigger: run.trigger
|
|
38021
38220
|
}
|
|
38022
38221
|
};
|
|
38023
|
-
await
|
|
38222
|
+
await fs23.writeFile(inputPath, `${JSON.stringify(input, null, 2)}
|
|
38024
38223
|
`, "utf8");
|
|
38025
|
-
const relativeInputPath =
|
|
38224
|
+
const relativeInputPath = path39.relative(schedule.agentRootPath, inputPath);
|
|
38026
38225
|
const executed = await runAgentCli(
|
|
38027
38226
|
cli,
|
|
38028
38227
|
[
|
|
@@ -38032,7 +38231,7 @@ async function runAgentAction(schedule, run, inputOverride) {
|
|
|
38032
38231
|
"--cwd",
|
|
38033
38232
|
schedule.agentRootPath,
|
|
38034
38233
|
"--out-dir",
|
|
38035
|
-
|
|
38234
|
+
path39.join(".openpond", "local-scheduler", "artifacts"),
|
|
38036
38235
|
"--input-file",
|
|
38037
38236
|
relativeInputPath
|
|
38038
38237
|
],
|
|
@@ -38064,7 +38263,7 @@ function assertLocalAgentScheduleVersion(schedule, current) {
|
|
|
38064
38263
|
async function runAgentCli(cliPath, args, cwd, timeoutMs) {
|
|
38065
38264
|
const env = {
|
|
38066
38265
|
...process.env,
|
|
38067
|
-
PATH: `${
|
|
38266
|
+
PATH: `${path39.dirname(cliPath)}${path39.delimiter}${process.env.PATH ?? ""}`
|
|
38068
38267
|
};
|
|
38069
38268
|
try {
|
|
38070
38269
|
const result = await execFileAsync4(cliPath, args, {
|
|
@@ -38089,16 +38288,16 @@ async function runAgentCli(cliPath, args, cwd, timeoutMs) {
|
|
|
38089
38288
|
}
|
|
38090
38289
|
async function resolveOpenPondAgentCli(agentRootPath) {
|
|
38091
38290
|
const override = process.env.OPENPOND_AGENT_CLI?.trim();
|
|
38092
|
-
if (override) return
|
|
38291
|
+
if (override) return path39.resolve(override);
|
|
38093
38292
|
const candidates = [];
|
|
38094
38293
|
for (const basePath of ancestorPaths(agentRootPath)) {
|
|
38095
38294
|
candidates.push(
|
|
38096
|
-
|
|
38295
|
+
path39.join(basePath, "node_modules", ".bin", "openpond-agent")
|
|
38097
38296
|
);
|
|
38098
38297
|
}
|
|
38099
38298
|
for (const basePath of ancestorPaths(process.cwd())) {
|
|
38100
38299
|
candidates.push(
|
|
38101
|
-
|
|
38300
|
+
path39.join(basePath, "node_modules", ".bin", "openpond-agent")
|
|
38102
38301
|
);
|
|
38103
38302
|
}
|
|
38104
38303
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -38111,17 +38310,17 @@ async function resolveOpenPondAgentCli(agentRootPath) {
|
|
|
38111
38310
|
}
|
|
38112
38311
|
function ancestorPaths(startPath) {
|
|
38113
38312
|
const paths = [];
|
|
38114
|
-
let current =
|
|
38313
|
+
let current = path39.resolve(startPath);
|
|
38115
38314
|
while (true) {
|
|
38116
38315
|
paths.push(current);
|
|
38117
|
-
const parent =
|
|
38316
|
+
const parent = path39.dirname(current);
|
|
38118
38317
|
if (parent === current) return paths;
|
|
38119
38318
|
current = parent;
|
|
38120
38319
|
}
|
|
38121
38320
|
}
|
|
38122
38321
|
async function fileExists5(filePath) {
|
|
38123
38322
|
try {
|
|
38124
|
-
const stat7 = await
|
|
38323
|
+
const stat7 = await fs23.stat(filePath);
|
|
38125
38324
|
return stat7.isFile() || stat7.isSymbolicLink();
|
|
38126
38325
|
} catch {
|
|
38127
38326
|
return false;
|
|
@@ -38290,11 +38489,11 @@ async function teamChatRequestPayload(action, dependencies = {}) {
|
|
|
38290
38489
|
const payload = await requestTeamChatApi(request.path, request.init, dependencies);
|
|
38291
38490
|
return schemaForAction2(action).parse(payload);
|
|
38292
38491
|
}
|
|
38293
|
-
async function requestTeamChatApi(
|
|
38492
|
+
async function requestTeamChatApi(path64, init = {}, dependencies = {}) {
|
|
38294
38493
|
const access5 = await resolveHostedApiAccess(dependencies);
|
|
38295
38494
|
const headers = hostedApiAuthHeaders(access5.token);
|
|
38296
38495
|
headers.set("Content-Type", "application/json");
|
|
38297
|
-
const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${
|
|
38496
|
+
const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${path64}`, {
|
|
38298
38497
|
...init,
|
|
38299
38498
|
headers
|
|
38300
38499
|
});
|
|
@@ -38526,11 +38725,11 @@ async function uploadTeamChatAttachment(action, dependencies) {
|
|
|
38526
38725
|
)
|
|
38527
38726
|
);
|
|
38528
38727
|
}
|
|
38529
|
-
function post2(
|
|
38530
|
-
return jsonRequest2(
|
|
38728
|
+
function post2(path64, body) {
|
|
38729
|
+
return jsonRequest2(path64, "POST", body);
|
|
38531
38730
|
}
|
|
38532
|
-
function jsonRequest2(
|
|
38533
|
-
return { path:
|
|
38731
|
+
function jsonRequest2(path64, method, body) {
|
|
38732
|
+
return { path: path64, init: { method, body: JSON.stringify(body) } };
|
|
38534
38733
|
}
|
|
38535
38734
|
|
|
38536
38735
|
// ../server/src/openpond/team-chat-executor.ts
|
|
@@ -39309,13 +39508,13 @@ function createTaskMinerBackgroundLoop(input) {
|
|
|
39309
39508
|
|
|
39310
39509
|
// ../server/src/training/training-service.ts
|
|
39311
39510
|
import { access as access2, cp, mkdir as mkdir8, rename as rename2, rm as rm3 } from "node:fs/promises";
|
|
39312
|
-
import
|
|
39511
|
+
import path54 from "node:path";
|
|
39313
39512
|
|
|
39314
39513
|
// ../../packages/training-sdk/dist/bundle.js
|
|
39315
39514
|
import { createHash as createHash10 } from "node:crypto";
|
|
39316
39515
|
import { createReadStream as createReadStream6 } from "node:fs";
|
|
39317
39516
|
import { copyFile, mkdir as mkdir3, readFile as readFile5, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
|
|
39318
|
-
import
|
|
39517
|
+
import path40 from "node:path";
|
|
39319
39518
|
async function buildTrainingBundle(input) {
|
|
39320
39519
|
if (!input.plan.compatibility.compatible)
|
|
39321
39520
|
throw new Error("Training Plan is incompatible and cannot be bundled.");
|
|
@@ -39359,8 +39558,8 @@ async function buildTrainingBundle(input) {
|
|
|
39359
39558
|
sizeBytes: taskData.sizeBytes,
|
|
39360
39559
|
role: "task_data"
|
|
39361
39560
|
}];
|
|
39362
|
-
const taskDataDestination =
|
|
39363
|
-
await mkdir3(
|
|
39561
|
+
const taskDataDestination = path40.join(input.directory, "data/train.jsonl");
|
|
39562
|
+
await mkdir3(path40.dirname(taskDataDestination), { recursive: true });
|
|
39364
39563
|
if ("sourcePath" in taskData) {
|
|
39365
39564
|
await copyFile(taskData.sourcePath, taskDataDestination);
|
|
39366
39565
|
} else {
|
|
@@ -39374,8 +39573,8 @@ async function buildTrainingBundle(input) {
|
|
|
39374
39573
|
throw new Error("Projected training data changed while the Bundle was created.");
|
|
39375
39574
|
}
|
|
39376
39575
|
for (const asset of assets) {
|
|
39377
|
-
const destination =
|
|
39378
|
-
await mkdir3(
|
|
39576
|
+
const destination = path40.join(input.directory, asset.path);
|
|
39577
|
+
await mkdir3(path40.dirname(destination), { recursive: true });
|
|
39379
39578
|
await writeFile2(destination, asset.content, "utf8");
|
|
39380
39579
|
files.push({ path: asset.path, sha256: sha256(asset.content), sizeBytes: Buffer.byteLength(asset.content), role: asset.role });
|
|
39381
39580
|
}
|
|
@@ -39384,7 +39583,7 @@ async function buildTrainingBundle(input) {
|
|
|
39384
39583
|
const provisional = TrainingBundleManifestSchema.parse(base);
|
|
39385
39584
|
const manifestHash = contentHash({ ...provisional, contentHash: "", files: provisional.files.map((file) => file.path === "manifest.json" ? { ...file, sha256: "", sizeBytes: 0 } : file) });
|
|
39386
39585
|
const manifest = TrainingBundleManifestSchema.parse({ ...provisional, contentHash: manifestHash, files: provisional.files.map((file) => file.path === "manifest.json" ? { ...file, sha256: manifestHash, sizeBytes: 0 } : file) });
|
|
39387
|
-
await writeFile2(
|
|
39586
|
+
await writeFile2(path40.join(input.directory, "manifest.json"), canonicalJson(manifest), "utf8");
|
|
39388
39587
|
return manifest;
|
|
39389
39588
|
}
|
|
39390
39589
|
function inlineTrainingData(taskset, plan, approvedSources) {
|
|
@@ -39458,7 +39657,7 @@ async function fileIdentity(filePath) {
|
|
|
39458
39657
|
};
|
|
39459
39658
|
}
|
|
39460
39659
|
async function inspectTrainingBundle(directory) {
|
|
39461
|
-
return TrainingBundleManifestSchema.parse(JSON.parse(await readFile5(
|
|
39660
|
+
return TrainingBundleManifestSchema.parse(JSON.parse(await readFile5(path40.join(directory, "manifest.json"), "utf8")));
|
|
39462
39661
|
}
|
|
39463
39662
|
async function validateTrainingBundle(directory) {
|
|
39464
39663
|
const manifest = await inspectTrainingBundle(directory);
|
|
@@ -39467,7 +39666,7 @@ async function validateTrainingBundle(directory) {
|
|
|
39467
39666
|
if (file.path === "manifest.json")
|
|
39468
39667
|
continue;
|
|
39469
39668
|
try {
|
|
39470
|
-
const bytes2 = await readFile5(
|
|
39669
|
+
const bytes2 = await readFile5(path40.join(directory, file.path));
|
|
39471
39670
|
if (sha256(bytes2) !== file.sha256)
|
|
39472
39671
|
issues.push(`${file.path}: hash mismatch`);
|
|
39473
39672
|
if (bytes2.byteLength !== file.sizeBytes)
|
|
@@ -39483,7 +39682,7 @@ async function validateTrainingBundle(directory) {
|
|
|
39483
39682
|
|
|
39484
39683
|
// ../../packages/training-sdk/dist/bundle-export.js
|
|
39485
39684
|
import { mkdir as mkdir4, readFile as readFile6, writeFile as writeFile3 } from "node:fs/promises";
|
|
39486
|
-
import
|
|
39685
|
+
import path41 from "node:path";
|
|
39487
39686
|
async function createTrainingBundleExport(directory) {
|
|
39488
39687
|
const validation = await validateTrainingBundle(directory);
|
|
39489
39688
|
if (!validation.valid)
|
|
@@ -39492,7 +39691,7 @@ async function createTrainingBundleExport(directory) {
|
|
|
39492
39691
|
const files = [];
|
|
39493
39692
|
for (const item of manifest.files) {
|
|
39494
39693
|
const relative2 = safeRelativePath(item.path);
|
|
39495
|
-
const bytes2 = await readFile6(
|
|
39694
|
+
const bytes2 = await readFile6(path41.join(directory, relative2));
|
|
39496
39695
|
files.push({ path: relative2, sha256: sha256(bytes2), sizeBytes: bytes2.byteLength, encoding: "base64", content: bytes2.toString("base64") });
|
|
39497
39696
|
}
|
|
39498
39697
|
const base = { schemaVersion: "openpond.trainingBundleExport.v1", manifest, files, contentHash: "00000000" };
|
|
@@ -39500,7 +39699,7 @@ async function createTrainingBundleExport(directory) {
|
|
|
39500
39699
|
}
|
|
39501
39700
|
function safeRelativePath(value) {
|
|
39502
39701
|
const normalized = value.replaceAll("\\", "/");
|
|
39503
|
-
if (
|
|
39702
|
+
if (path41.posix.isAbsolute(normalized) || normalized.split("/").includes(".."))
|
|
39504
39703
|
throw new Error(`Unsafe Training Bundle path: ${value}.`);
|
|
39505
39704
|
return normalized;
|
|
39506
39705
|
}
|
|
@@ -39903,7 +40102,7 @@ function prepareTrainingSelection(input) {
|
|
|
39903
40102
|
import { constants as constants2 } from "node:fs";
|
|
39904
40103
|
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
39905
40104
|
import { access, lstat, mkdir as mkdir5, readFile as readFile7, readdir as readdir2, rename, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
|
|
39906
|
-
import
|
|
40105
|
+
import path42 from "node:path";
|
|
39907
40106
|
function buildTasksetTrainingBundle(input) {
|
|
39908
40107
|
const { taskset, modelRun, harnessRelease, tasksetRelease } = input;
|
|
39909
40108
|
const releasedHarness2 = ImmutableReleaseRefSchema2.parse(harnessRelease);
|
|
@@ -40041,13 +40240,13 @@ function buildTasksetTrainingBundle(input) {
|
|
|
40041
40240
|
async function materializeResolvedTrainingBundle(input) {
|
|
40042
40241
|
const manifest = ResolvedTrainingBundleManifestSchema.parse(input.manifest);
|
|
40043
40242
|
validateBundleManifest(manifest);
|
|
40044
|
-
const directory =
|
|
40045
|
-
if (await exists(
|
|
40243
|
+
const directory = path42.join(input.cacheRoot, manifest.contentHash);
|
|
40244
|
+
if (await exists(path42.join(directory, "bundle-manifest.json"))) {
|
|
40046
40245
|
await verifyResolvedTrainingBundle(directory, manifest);
|
|
40047
40246
|
return { directory, manifest, cacheHit: true };
|
|
40048
40247
|
}
|
|
40049
40248
|
await mkdir5(input.cacheRoot, { recursive: true });
|
|
40050
|
-
const temporary =
|
|
40249
|
+
const temporary = path42.join(input.cacheRoot, `.materializing-${manifest.contentHash}-${process.pid}-${randomUUID17()}`);
|
|
40051
40250
|
await mkdir5(temporary, { recursive: true, mode: 448 });
|
|
40052
40251
|
try {
|
|
40053
40252
|
for (const file of manifest.files) {
|
|
@@ -40056,10 +40255,10 @@ async function materializeResolvedTrainingBundle(input) {
|
|
|
40056
40255
|
throw new Error(`Resolved Training Bundle asset ${file.path} failed verification.`);
|
|
40057
40256
|
}
|
|
40058
40257
|
const target = bundleAssetPath(temporary, file.path);
|
|
40059
|
-
await mkdir5(
|
|
40258
|
+
await mkdir5(path42.dirname(target), { recursive: true });
|
|
40060
40259
|
await writeFile4(target, value, { mode: 384 });
|
|
40061
40260
|
}
|
|
40062
|
-
await writeFile4(
|
|
40261
|
+
await writeFile4(path42.join(temporary, "bundle-manifest.json"), canonicalJson(manifest), { mode: 384 });
|
|
40063
40262
|
await rename(temporary, directory).catch(async (error) => {
|
|
40064
40263
|
if (!await exists(directory))
|
|
40065
40264
|
throw error;
|
|
@@ -40071,7 +40270,7 @@ async function materializeResolvedTrainingBundle(input) {
|
|
|
40071
40270
|
}
|
|
40072
40271
|
}
|
|
40073
40272
|
async function verifyResolvedTrainingBundle(directory, expected) {
|
|
40074
|
-
const manifest = ResolvedTrainingBundleManifestSchema.parse(JSON.parse(await readFile7(
|
|
40273
|
+
const manifest = ResolvedTrainingBundleManifestSchema.parse(JSON.parse(await readFile7(path42.join(directory, "bundle-manifest.json"), "utf8")));
|
|
40075
40274
|
const { contentHash: suppliedHash, ...content } = manifest;
|
|
40076
40275
|
if (contentHash(content) !== suppliedHash) {
|
|
40077
40276
|
throw new Error("Resolved Training Bundle manifest hash mismatch.");
|
|
@@ -40113,13 +40312,13 @@ function validateBundleManifest(manifest) {
|
|
|
40113
40312
|
}
|
|
40114
40313
|
}
|
|
40115
40314
|
function bundleAssetPath(root, assetPath) {
|
|
40116
|
-
if (assetPath.includes("\\") || assetPath.includes("\0") ||
|
|
40315
|
+
if (assetPath.includes("\\") || assetPath.includes("\0") || path42.posix.isAbsolute(assetPath) || path42.posix.normalize(assetPath) !== assetPath) {
|
|
40117
40316
|
throw new Error(`Resolved Training Bundle asset ${assetPath} has an invalid path.`);
|
|
40118
40317
|
}
|
|
40119
|
-
const resolvedRoot =
|
|
40120
|
-
const target =
|
|
40121
|
-
const relative2 =
|
|
40122
|
-
if (relative2.startsWith("..") ||
|
|
40318
|
+
const resolvedRoot = path42.resolve(root);
|
|
40319
|
+
const target = path42.resolve(root, ...assetPath.split("/"));
|
|
40320
|
+
const relative2 = path42.relative(resolvedRoot, target);
|
|
40321
|
+
if (relative2.startsWith("..") || path42.isAbsolute(relative2) || relative2 === "") {
|
|
40123
40322
|
throw new Error(`Resolved Training Bundle asset ${assetPath} escapes its root.`);
|
|
40124
40323
|
}
|
|
40125
40324
|
return target;
|
|
@@ -40132,8 +40331,8 @@ async function assertExactInventory(directory, expected) {
|
|
|
40132
40331
|
const actual = /* @__PURE__ */ new Set();
|
|
40133
40332
|
const visit = async (current) => {
|
|
40134
40333
|
for (const entry of await readdir2(current, { withFileTypes: true })) {
|
|
40135
|
-
const target =
|
|
40136
|
-
const relative2 =
|
|
40334
|
+
const target = path42.join(current, entry.name);
|
|
40335
|
+
const relative2 = path42.relative(directory, target).split(path42.sep).join("/");
|
|
40137
40336
|
if (entry.isSymbolicLink()) {
|
|
40138
40337
|
throw new Error(`Resolved Training Bundle contains a symbolic link at ${relative2}.`);
|
|
40139
40338
|
}
|
|
@@ -40333,7 +40532,7 @@ function modelLabel(modelId) {
|
|
|
40333
40532
|
}
|
|
40334
40533
|
|
|
40335
40534
|
// ../server/src/training/training-dataset-selection.ts
|
|
40336
|
-
import
|
|
40535
|
+
import path43 from "node:path";
|
|
40337
40536
|
function toProjectedTrainingData(projection) {
|
|
40338
40537
|
return projection ? {
|
|
40339
40538
|
path: projection.outputPath,
|
|
@@ -40368,7 +40567,7 @@ function createTrainingDatasetSelection(input) {
|
|
|
40368
40567
|
seed,
|
|
40369
40568
|
selectionStrategy: plan.recipe.method === "grpo" ? plan.recipe.dataset.selectionStrategy : "stable_hash_top_n",
|
|
40370
40569
|
approvedSourceIds: plan.dataPolicy.approvedSourceIds,
|
|
40371
|
-
outputPath:
|
|
40570
|
+
outputPath: path43.join(
|
|
40372
40571
|
input.storeDir,
|
|
40373
40572
|
"training",
|
|
40374
40573
|
"projections",
|
|
@@ -40382,7 +40581,7 @@ function createTrainingDatasetSelection(input) {
|
|
|
40382
40581
|
|
|
40383
40582
|
// ../server/src/training/training-service-helpers.ts
|
|
40384
40583
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
40385
|
-
import
|
|
40584
|
+
import path44 from "node:path";
|
|
40386
40585
|
function withAuthoritativeRecipeHashes(taskset, recipe) {
|
|
40387
40586
|
if (!recipe || typeof recipe !== "object" || Array.isArray(recipe)) {
|
|
40388
40587
|
return recipe;
|
|
@@ -40530,8 +40729,8 @@ function positiveInteger(value, fallback) {
|
|
|
40530
40729
|
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : fallback;
|
|
40531
40730
|
}
|
|
40532
40731
|
function isInside(root, target) {
|
|
40533
|
-
const relative2 =
|
|
40534
|
-
return relative2 !== "" && !relative2.startsWith("..") && !
|
|
40732
|
+
const relative2 = path44.relative(root, target);
|
|
40733
|
+
return relative2 !== "" && !relative2.startsWith("..") && !path44.isAbsolute(relative2);
|
|
40535
40734
|
}
|
|
40536
40735
|
async function assertArtifactIntegrity(artifactPath2, expectedHash, expectedSize) {
|
|
40537
40736
|
const bytes2 = await readFile8(artifactPath2);
|
|
@@ -40544,14 +40743,14 @@ async function assertArtifactIntegrity(artifactPath2, expectedHash, expectedSize
|
|
|
40544
40743
|
|
|
40545
40744
|
// ../server/src/training/openpond-managed-training-adapter.ts
|
|
40546
40745
|
import { readFile as readFile10 } from "node:fs/promises";
|
|
40547
|
-
import
|
|
40746
|
+
import path48 from "node:path";
|
|
40548
40747
|
|
|
40549
40748
|
// ../server/src/training/managed-rl-local-rollout-executor.ts
|
|
40550
40749
|
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
40551
40750
|
|
|
40552
40751
|
// ../server/src/training/marketing-portfolio-managed-rl-adapter.ts
|
|
40553
40752
|
import { createHash as createHash12 } from "node:crypto";
|
|
40554
|
-
import
|
|
40753
|
+
import path47 from "node:path";
|
|
40555
40754
|
|
|
40556
40755
|
// ../server/src/training/marketing-portfolio-constraint-repair.ts
|
|
40557
40756
|
var CHANNEL_IDS = [
|
|
@@ -40994,7 +41193,7 @@ function declaredEnvironmentId(taskset) {
|
|
|
40994
41193
|
|
|
40995
41194
|
// ../server/src/training/marketing-portfolio-runtime-verifier.ts
|
|
40996
41195
|
import { readFile as readFile9, readdir as readdir3 } from "node:fs/promises";
|
|
40997
|
-
import
|
|
41196
|
+
import path45 from "node:path";
|
|
40998
41197
|
var AGENT_ID = "marketing-portfolio-manager";
|
|
40999
41198
|
var ACTION_IDS = [
|
|
41000
41199
|
"get-portfolio-snapshot",
|
|
@@ -41013,13 +41212,13 @@ async function verifyMarketingPortfolioRuntime(input) {
|
|
|
41013
41212
|
scorer.profileRelativeAgentPath,
|
|
41014
41213
|
"marketing Harness Agent path"
|
|
41015
41214
|
);
|
|
41016
|
-
const profileRoot =
|
|
41017
|
-
const agentRoot =
|
|
41018
|
-
const relative2 =
|
|
41019
|
-
if (relative2.startsWith("..") ||
|
|
41215
|
+
const profileRoot = path45.resolve(input.harnessRoot);
|
|
41216
|
+
const agentRoot = path45.resolve(profileRoot, relativeAgentPath);
|
|
41217
|
+
const relative2 = path45.relative(profileRoot, agentRoot);
|
|
41218
|
+
if (relative2.startsWith("..") || path45.isAbsolute(relative2)) {
|
|
41020
41219
|
throw new Error("Pinned marketing Agent source escapes the Harness bundle.");
|
|
41021
41220
|
}
|
|
41022
|
-
const manifestPath =
|
|
41221
|
+
const manifestPath = path45.join(agentRoot, ".openpond", "agent-manifest.json");
|
|
41023
41222
|
const manifestBytes = await readFile9(manifestPath);
|
|
41024
41223
|
const manifest = object2(
|
|
41025
41224
|
JSON.parse(manifestBytes.toString("utf8")),
|
|
@@ -41070,9 +41269,9 @@ async function verifyMarketingPortfolioRuntime(input) {
|
|
|
41070
41269
|
}
|
|
41071
41270
|
}
|
|
41072
41271
|
const scorerModule = requiredString4(scorer.module, "marketing scorer module");
|
|
41073
|
-
const scorerModulePath =
|
|
41074
|
-
const relativeScorer =
|
|
41075
|
-
if (relativeScorer.startsWith("..") ||
|
|
41272
|
+
const scorerModulePath = path45.resolve(agentRoot, scorerModule);
|
|
41273
|
+
const relativeScorer = path45.relative(agentRoot, scorerModulePath);
|
|
41274
|
+
if (relativeScorer.startsWith("..") || path45.isAbsolute(relativeScorer)) {
|
|
41076
41275
|
throw new Error("Pinned marketing scorer escapes the Agent release.");
|
|
41077
41276
|
}
|
|
41078
41277
|
const scorerImplementationHash = sha256(await readFile9(scorerModulePath));
|
|
@@ -41098,7 +41297,7 @@ function withoutEpisodeSelector(schema, selector) {
|
|
|
41098
41297
|
async function agentReleaseInventory(root) {
|
|
41099
41298
|
const inventory = [];
|
|
41100
41299
|
for (const file of await regularFiles(root)) {
|
|
41101
|
-
const relative2 =
|
|
41300
|
+
const relative2 = path45.relative(root, file).split(path45.sep).join("/");
|
|
41102
41301
|
if (relative2.startsWith("node_modules/") || relative2.startsWith(".openpond/traces/") || relative2 === ".openpond/eval-results.json") {
|
|
41103
41302
|
continue;
|
|
41104
41303
|
}
|
|
@@ -41117,7 +41316,7 @@ async function regularFiles(root) {
|
|
|
41117
41316
|
if (entry.isSymbolicLink()) {
|
|
41118
41317
|
throw new Error("Harness Agent releases cannot contain symlinks.");
|
|
41119
41318
|
}
|
|
41120
|
-
const target =
|
|
41319
|
+
const target = path45.join(root, entry.name);
|
|
41121
41320
|
if (entry.isDirectory()) {
|
|
41122
41321
|
if (entry.name !== "node_modules") files.push(...await regularFiles(target));
|
|
41123
41322
|
} else if (entry.isFile()) {
|
|
@@ -41146,14 +41345,14 @@ function requiredString4(value, label) {
|
|
|
41146
41345
|
// ../server/src/training/profile-agent-harness-runtime.ts
|
|
41147
41346
|
import { spawn as spawn6 } from "node:child_process";
|
|
41148
41347
|
import { mkdir as mkdir6 } from "node:fs/promises";
|
|
41149
|
-
import
|
|
41348
|
+
import path46 from "node:path";
|
|
41150
41349
|
var MAX_PROCESS_OUTPUT_BYTES = 4 * 1024 * 1024;
|
|
41151
41350
|
var SCORER_SCRIPT = "const moduleValue=await import(process.argv[1]);const decision=JSON.parse(Buffer.from(process.argv[2],'base64url').toString('utf8'));const score=moduleValue.scoreBudgetDecision(decision);process.stdout.write(JSON.stringify(score));";
|
|
41152
41351
|
function createProfileAgentHarnessRuntime(input) {
|
|
41153
41352
|
const nodePath2 = input.nodePath ?? process.execPath;
|
|
41154
|
-
const agentCliPath = input.agentCliPath ??
|
|
41353
|
+
const agentCliPath = input.agentCliPath ?? path46.resolve(process.cwd(), "node_modules", ".bin", "openpond-agent");
|
|
41155
41354
|
async function executeAction2(action) {
|
|
41156
|
-
const actionArtifactRoot =
|
|
41355
|
+
const actionArtifactRoot = path46.join(
|
|
41157
41356
|
input.artifactRoot,
|
|
41158
41357
|
"agent-actions",
|
|
41159
41358
|
`${action.binding.actionId}-${contentHash(action.arguments).slice(0, 16)}`
|
|
@@ -41240,7 +41439,7 @@ async function runBoundedProcess(input) {
|
|
|
41240
41439
|
size += chunk.byteLength;
|
|
41241
41440
|
if (size > MAX_PROCESS_OUTPUT_BYTES) {
|
|
41242
41441
|
child.kill("SIGKILL");
|
|
41243
|
-
fail2(new Error(`${
|
|
41442
|
+
fail2(new Error(`${path46.basename(input.command)} output exceeded its limit.`));
|
|
41244
41443
|
} else {
|
|
41245
41444
|
target.push(chunk);
|
|
41246
41445
|
}
|
|
@@ -41255,7 +41454,7 @@ async function runBoundedProcess(input) {
|
|
|
41255
41454
|
if (code !== 0) {
|
|
41256
41455
|
fail2(
|
|
41257
41456
|
new Error(
|
|
41258
|
-
`${
|
|
41457
|
+
`${path46.basename(input.command)} failed ${signal ? `with ${signal}` : `with exit code ${code}`}: ${err.slice(0, 2e3)}`
|
|
41259
41458
|
)
|
|
41260
41459
|
);
|
|
41261
41460
|
} else {
|
|
@@ -41310,7 +41509,7 @@ async function executeMarketingPortfolioManagedRl(input) {
|
|
|
41310
41509
|
const runtime = createProfileAgentHarnessRuntime({
|
|
41311
41510
|
agentRoot: verified.agentRoot,
|
|
41312
41511
|
scorerModulePath: verified.scorerModulePath,
|
|
41313
|
-
artifactRoot:
|
|
41512
|
+
artifactRoot: path47.join(input.storeDir, "training", "managed-rl-local", input.claim.jobId, input.claim.executionId)
|
|
41314
41513
|
});
|
|
41315
41514
|
const baseSeed = typeof input.claim.request.seed === "number" && Number.isInteger(input.claim.request.seed) ? input.claim.request.seed : 0;
|
|
41316
41515
|
const startedAt = (input.timestamp ?? (() => (/* @__PURE__ */ new Date()).toISOString()))();
|
|
@@ -41599,25 +41798,25 @@ var ManagedRlLocalRolloutExecutor = class {
|
|
|
41599
41798
|
}
|
|
41600
41799
|
throw lastError;
|
|
41601
41800
|
}
|
|
41602
|
-
async userRequest(
|
|
41801
|
+
async userRequest(path64, init) {
|
|
41603
41802
|
const headers = hostedApiAuthHeaders(this.input.access.token);
|
|
41604
41803
|
headers.set("accept", "application/json");
|
|
41605
41804
|
headers.set("content-type", "application/json");
|
|
41606
41805
|
headers.set("x-openpond-team-id", this.input.access.teamId);
|
|
41607
|
-
const requestUrl = `${this.input.access.apiBaseUrl}${
|
|
41806
|
+
const requestUrl = `${this.input.access.apiBaseUrl}${path64}`;
|
|
41608
41807
|
return requestJson(this.input.fetchImpl ?? fetch, requestUrl, {
|
|
41609
41808
|
...init,
|
|
41610
41809
|
headers: withVercelProtectionBypass(requestUrl, headers, this.input.env),
|
|
41611
41810
|
signal: this.abortController.signal
|
|
41612
41811
|
});
|
|
41613
41812
|
}
|
|
41614
|
-
policyRequest(
|
|
41813
|
+
policyRequest(path64, token, request, signal = this.abortController.signal) {
|
|
41615
41814
|
const headers = new Headers({
|
|
41616
41815
|
accept: "application/json",
|
|
41617
41816
|
authorization: `Bearer ${token}`,
|
|
41618
41817
|
"content-type": "application/json"
|
|
41619
41818
|
});
|
|
41620
|
-
const requestUrl = `${this.input.access.apiBaseUrl}${
|
|
41819
|
+
const requestUrl = `${this.input.access.apiBaseUrl}${path64}`;
|
|
41621
41820
|
return requestJson(
|
|
41622
41821
|
this.input.fetchImpl ?? fetch,
|
|
41623
41822
|
requestUrl,
|
|
@@ -42210,7 +42409,7 @@ var OpenPondManagedTrainingAdapter = class {
|
|
|
42210
42409
|
if (validationTasks.length === 0) {
|
|
42211
42410
|
throw new Error("OpenPond Managed requires at least one private validation task.");
|
|
42212
42411
|
}
|
|
42213
|
-
const bundleDirectory =
|
|
42412
|
+
const bundleDirectory = path48.join(
|
|
42214
42413
|
this.dependencies.storeDir,
|
|
42215
42414
|
"training",
|
|
42216
42415
|
"portable-releases",
|
|
@@ -42218,14 +42417,14 @@ var OpenPondManagedTrainingAdapter = class {
|
|
|
42218
42417
|
plan.manifest.resolvedBundleHash
|
|
42219
42418
|
);
|
|
42220
42419
|
const bundleManifest = JSON.parse(
|
|
42221
|
-
await this.readFileImpl(
|
|
42420
|
+
await this.readFileImpl(path48.join(bundleDirectory, "bundle-manifest.json"), "utf8")
|
|
42222
42421
|
);
|
|
42223
42422
|
if (bundleManifest.contentHash !== plan.manifest.resolvedBundleHash) {
|
|
42224
42423
|
throw new Error("The managed resolved bundle changed before upload.");
|
|
42225
42424
|
}
|
|
42226
42425
|
const files = await Promise.all(
|
|
42227
42426
|
bundleManifest.files.map(async (file) => {
|
|
42228
|
-
const value = await this.readFileImpl(
|
|
42427
|
+
const value = await this.readFileImpl(path48.join(bundleDirectory, file.path));
|
|
42229
42428
|
if (value.byteLength !== file.sizeBytes || sha256(value) !== file.sha256) {
|
|
42230
42429
|
throw new Error(`Managed training bundle file ${file.path} changed before upload.`);
|
|
42231
42430
|
}
|
|
@@ -42427,7 +42626,7 @@ var OpenPondManagedTrainingAdapter = class {
|
|
|
42427
42626
|
env: this.dependencies.env,
|
|
42428
42627
|
store: this.dependencies.store,
|
|
42429
42628
|
storeDir: this.dependencies.storeDir,
|
|
42430
|
-
harnessRoot:
|
|
42629
|
+
harnessRoot: path48.join(
|
|
42431
42630
|
this.dependencies.storeDir,
|
|
42432
42631
|
"training",
|
|
42433
42632
|
"harnesses",
|
|
@@ -42501,11 +42700,11 @@ function createDestinationTrainingEngineRegistry(input) {
|
|
|
42501
42700
|
|
|
42502
42701
|
// ../server/src/training/portable-model-run-service.ts
|
|
42503
42702
|
import { mkdir as mkdir7, readFile as readFile12, writeFile as writeFile5 } from "node:fs/promises";
|
|
42504
|
-
import
|
|
42703
|
+
import path51 from "node:path";
|
|
42505
42704
|
|
|
42506
42705
|
// ../server/src/training/portable-model-run-artifacts.ts
|
|
42507
42706
|
import { readFile as readFile11, stat as stat6 } from "node:fs/promises";
|
|
42508
|
-
import
|
|
42707
|
+
import path49 from "node:path";
|
|
42509
42708
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
42510
42709
|
async function importPortableModelRunArtifacts(input) {
|
|
42511
42710
|
assertArtifacts(input.portable, input.executionRef, input.job);
|
|
@@ -42549,7 +42748,7 @@ async function importPortableModelRunArtifacts(input) {
|
|
|
42549
42748
|
};
|
|
42550
42749
|
}
|
|
42551
42750
|
async function readRecoveredPortableArtifacts(input) {
|
|
42552
|
-
const receipt =
|
|
42751
|
+
const receipt = path49.join(
|
|
42553
42752
|
input.storeDir,
|
|
42554
42753
|
"training",
|
|
42555
42754
|
"connected-artifacts",
|
|
@@ -42654,7 +42853,7 @@ function localArtifactPath(objectRef) {
|
|
|
42654
42853
|
if (/^[a-z][a-z0-9+.-]*:/i.test(objectRef)) {
|
|
42655
42854
|
throw new Error(`Portable artifact ${objectRef} was not materialized locally.`);
|
|
42656
42855
|
}
|
|
42657
|
-
return
|
|
42856
|
+
return path49.resolve(objectRef);
|
|
42658
42857
|
}
|
|
42659
42858
|
function managedRlCandidateRef(objectRef, expectedJobId) {
|
|
42660
42859
|
const match = objectRef.match(/^sandbox-managed-rl:\/\/([^/]+)\/([^/?#]+)$/);
|
|
@@ -42688,15 +42887,15 @@ function portableFilenameFromRef(objectRef) {
|
|
|
42688
42887
|
return basename.match(/^\d+-[a-f0-9]{12}-(.+)$/)?.[1] ?? basename;
|
|
42689
42888
|
}
|
|
42690
42889
|
function portableFilename(value) {
|
|
42691
|
-
return typeof value === "string" && value.trim() ?
|
|
42890
|
+
return typeof value === "string" && value.trim() ? path49.basename(value.replaceAll("\\", "/")) : null;
|
|
42692
42891
|
}
|
|
42693
42892
|
function isAdapterWeights(name) {
|
|
42694
|
-
const filename =
|
|
42893
|
+
const filename = path49.basename(name.replaceAll("\\", "/"));
|
|
42695
42894
|
return filename === "adapter_model.safetensors" || /^adapter_model-\d{5}-of-\d{5}\.safetensors$/.test(filename);
|
|
42696
42895
|
}
|
|
42697
42896
|
function trainingArtifactKind(kind, filename) {
|
|
42698
42897
|
if (isAdapterWeights(filename)) return "adapter";
|
|
42699
|
-
if (
|
|
42898
|
+
if (path49.basename(filename) === "adapter_config.json") {
|
|
42700
42899
|
return "manifest";
|
|
42701
42900
|
}
|
|
42702
42901
|
if (kind === "trace") return "log";
|
|
@@ -42714,7 +42913,7 @@ function objectValue(value) {
|
|
|
42714
42913
|
}
|
|
42715
42914
|
|
|
42716
42915
|
// ../server/src/training/portable-model-run-lifecycle.ts
|
|
42717
|
-
import
|
|
42916
|
+
import path50 from "node:path";
|
|
42718
42917
|
async function preparePortableModelRunLifecycle(input) {
|
|
42719
42918
|
const baseModel = input.draft.baseModel;
|
|
42720
42919
|
const method = input.draft.method;
|
|
@@ -43109,9 +43308,9 @@ function jobStatus(state) {
|
|
|
43109
43308
|
return state;
|
|
43110
43309
|
}
|
|
43111
43310
|
function artifactReceiptPath(storeDir, artifactPath2) {
|
|
43112
|
-
const relative2 =
|
|
43113
|
-
if (relative2 && relative2 !== ".." && !relative2.startsWith(`..${
|
|
43114
|
-
return relative2.split(
|
|
43311
|
+
const relative2 = path50.relative(storeDir, artifactPath2);
|
|
43312
|
+
if (relative2 && relative2 !== ".." && !relative2.startsWith(`..${path50.sep}`) && !path50.isAbsolute(relative2)) {
|
|
43313
|
+
return relative2.split(path50.sep).join("/");
|
|
43115
43314
|
}
|
|
43116
43315
|
return artifactPath2;
|
|
43117
43316
|
}
|
|
@@ -43882,9 +44081,9 @@ function assertSubmittedManifest(input, expected) {
|
|
|
43882
44081
|
}
|
|
43883
44082
|
}
|
|
43884
44083
|
async function publishRunGraph(input) {
|
|
43885
|
-
const manifestDirectory =
|
|
44084
|
+
const manifestDirectory = path51.join(input.storeDir, "training", "portable-releases", "manifests");
|
|
43886
44085
|
await mkdir7(manifestDirectory, { recursive: true });
|
|
43887
|
-
const manifestPath =
|
|
44086
|
+
const manifestPath = path51.join(manifestDirectory, `${input.graph.manifest.contentHash}.json`);
|
|
43888
44087
|
const serialized = `${JSON.stringify(input.graph.manifest, null, 2)}
|
|
43889
44088
|
`;
|
|
43890
44089
|
await writeFile5(manifestPath, serialized, {
|
|
@@ -43899,7 +44098,7 @@ async function publishRunGraph(input) {
|
|
|
43899
44098
|
const resolvedBundle = await materializeResolvedTrainingBundle({
|
|
43900
44099
|
manifest: input.graph.resolvedBundleManifest,
|
|
43901
44100
|
assets: input.graph.assets,
|
|
43902
|
-
cacheRoot:
|
|
44101
|
+
cacheRoot: path51.join(input.storeDir, "training", "portable-releases", "resolved-bundles")
|
|
43903
44102
|
});
|
|
43904
44103
|
if (resolvedBundle.manifest.contentHash !== input.graph.manifest.resolvedBundleHash) {
|
|
43905
44104
|
throw new Error("Resolved Training Bundle does not match the Harness Run Manifest.");
|
|
@@ -43988,12 +44187,12 @@ function createPortableTrainingServiceSupport(input) {
|
|
|
43988
44187
|
|
|
43989
44188
|
// ../server/src/training/training-artifact-export-service.ts
|
|
43990
44189
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
43991
|
-
import
|
|
44190
|
+
import path52 from "node:path";
|
|
43992
44191
|
function createTrainingArtifactExportService(deps) {
|
|
43993
44192
|
async function exportBundle(bundleId) {
|
|
43994
44193
|
const bundle = await deps.store.getTrainingBundle(bundleId);
|
|
43995
44194
|
if (!bundle) throw new Error("Training Bundle not found.");
|
|
43996
|
-
const directory =
|
|
44195
|
+
const directory = path52.join(
|
|
43997
44196
|
deps.storeDir,
|
|
43998
44197
|
"training",
|
|
43999
44198
|
"bundles",
|
|
@@ -44484,7 +44683,7 @@ function createTrainingModelBindingService(deps) {
|
|
|
44484
44683
|
}
|
|
44485
44684
|
|
|
44486
44685
|
// ../server/src/training/training-plan-lifecycle-service.ts
|
|
44487
|
-
import
|
|
44686
|
+
import path53 from "node:path";
|
|
44488
44687
|
function createTrainingPlanLifecycleService(deps) {
|
|
44489
44688
|
async function createPlan(input) {
|
|
44490
44689
|
const taskset = await deps.store.getTaskset(input.tasksetId);
|
|
@@ -44542,7 +44741,7 @@ function createTrainingPlanLifecycleService(deps) {
|
|
|
44542
44741
|
if (!plan) throw new Error("Training Plan not found.");
|
|
44543
44742
|
const taskset = await deps.store.getTaskset(plan.tasksetId);
|
|
44544
44743
|
if (!taskset) throw new Error("Taskset not found.");
|
|
44545
|
-
const directory =
|
|
44744
|
+
const directory = path53.join(
|
|
44546
44745
|
deps.storeDir,
|
|
44547
44746
|
"training",
|
|
44548
44747
|
"bundles",
|
|
@@ -44832,13 +45031,13 @@ function createTrainingService(deps) {
|
|
|
44832
45031
|
const activeJob = relatedJobs.find((job) => ["queued", "starting", "running", "cancelling", "reconciling"].includes(job.status));
|
|
44833
45032
|
if (activeJob) throw new Error("Cancel the active training job before deleting this model.");
|
|
44834
45033
|
const jobIds = new Set(relatedJobs.map((job) => job.id));
|
|
44835
|
-
const managedTrainingRoot =
|
|
45034
|
+
const managedTrainingRoot = path54.resolve(deps.storeDir, "training");
|
|
44836
45035
|
for (const artifact of artifacts.filter((artifact2) => jobIds.has(artifact2.jobId))) {
|
|
44837
|
-
const artifactPath2 =
|
|
45036
|
+
const artifactPath2 = path54.resolve(artifact.path);
|
|
44838
45037
|
if (isInside(managedTrainingRoot, artifactPath2)) await rm3(artifactPath2, { force: true, recursive: true });
|
|
44839
45038
|
}
|
|
44840
|
-
for (const planId of planIds) await rm3(
|
|
44841
|
-
await rm3(
|
|
45039
|
+
for (const planId of planIds) await rm3(path54.join(managedTrainingRoot, "bundles", planId), { force: true, recursive: true });
|
|
45040
|
+
await rm3(path54.join(managedTrainingRoot, "tasksets", taskset.id), { force: true, recursive: true });
|
|
44842
45041
|
await deps.store.deleteTasksetData(tasksetId);
|
|
44843
45042
|
return { deleted: true, tasksetId };
|
|
44844
45043
|
}
|
|
@@ -44982,7 +45181,7 @@ function createTrainingService(deps) {
|
|
|
44982
45181
|
};
|
|
44983
45182
|
}
|
|
44984
45183
|
async function materializeHarnessSource(input) {
|
|
44985
|
-
const root =
|
|
45184
|
+
const root = path54.join(
|
|
44986
45185
|
input.storeDir,
|
|
44987
45186
|
"training",
|
|
44988
45187
|
"harnesses",
|
|
@@ -44994,11 +45193,11 @@ async function materializeHarnessSource(input) {
|
|
|
44994
45193
|
return;
|
|
44995
45194
|
} catch {
|
|
44996
45195
|
}
|
|
44997
|
-
await mkdir8(
|
|
45196
|
+
await mkdir8(path54.dirname(root), { recursive: true });
|
|
44998
45197
|
const temporary = `${root}.materializing-${process.pid}`;
|
|
44999
45198
|
await rm3(temporary, { recursive: true, force: true });
|
|
45000
45199
|
try {
|
|
45001
|
-
await cp(
|
|
45200
|
+
await cp(path54.resolve(input.sourcePath), temporary, {
|
|
45002
45201
|
recursive: true,
|
|
45003
45202
|
force: false,
|
|
45004
45203
|
errorOnExist: true
|
|
@@ -47083,7 +47282,7 @@ function yieldToRuntime() {
|
|
|
47083
47282
|
// ../server/src/training/dataset-artifact-service.ts
|
|
47084
47283
|
import { spawn as spawn7 } from "node:child_process";
|
|
47085
47284
|
import { access as access3 } from "node:fs/promises";
|
|
47086
|
-
import
|
|
47285
|
+
import path55 from "node:path";
|
|
47087
47286
|
var MAX_WORKER_OUTPUT_BYTES = 12 * 1024 * 1024;
|
|
47088
47287
|
function createDatasetArtifactService(deps) {
|
|
47089
47288
|
async function summaries(profileId) {
|
|
@@ -47192,7 +47391,7 @@ function createDatasetArtifactService(deps) {
|
|
|
47192
47391
|
entry.relativeManifestPath
|
|
47193
47392
|
);
|
|
47194
47393
|
await access3(manifestPath);
|
|
47195
|
-
const outputPath =
|
|
47394
|
+
const outputPath = path55.resolve(input.outputPath);
|
|
47196
47395
|
const output = await runDatasetWorker(deps.workerProjectDir, [
|
|
47197
47396
|
"project",
|
|
47198
47397
|
"--manifest",
|
|
@@ -47283,9 +47482,9 @@ async function summary(entry) {
|
|
|
47283
47482
|
});
|
|
47284
47483
|
}
|
|
47285
47484
|
function safeArtifactPath(rootValue, relativeValue) {
|
|
47286
|
-
const root =
|
|
47287
|
-
const candidate2 =
|
|
47288
|
-
if (candidate2 !== root && !candidate2.startsWith(`${root}${
|
|
47485
|
+
const root = path55.resolve(rootValue);
|
|
47486
|
+
const candidate2 = path55.resolve(root, relativeValue);
|
|
47487
|
+
if (candidate2 !== root && !candidate2.startsWith(`${root}${path55.sep}`)) {
|
|
47289
47488
|
throw new Error("Dataset artifact path escapes its registered storage root.");
|
|
47290
47489
|
}
|
|
47291
47490
|
return candidate2;
|
|
@@ -47362,7 +47561,7 @@ import {
|
|
|
47362
47561
|
rm as rm5,
|
|
47363
47562
|
writeFile as writeFile6
|
|
47364
47563
|
} from "node:fs/promises";
|
|
47365
|
-
import
|
|
47564
|
+
import path56 from "node:path";
|
|
47366
47565
|
|
|
47367
47566
|
// ../server/src/training/dataset-imports/hugging-face.ts
|
|
47368
47567
|
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
@@ -47500,8 +47699,8 @@ ${split.split}`) ?? {
|
|
|
47500
47699
|
inspectedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
47501
47700
|
metadata: {
|
|
47502
47701
|
sourceSchemaHash: contentHash(
|
|
47503
|
-
columns.map(({ path:
|
|
47504
|
-
path:
|
|
47702
|
+
columns.map(({ path: path64, logicalType: logicalType2, nullable }) => ({
|
|
47703
|
+
path: path64,
|
|
47505
47704
|
logicalType: logicalType2,
|
|
47506
47705
|
nullable
|
|
47507
47706
|
}))
|
|
@@ -47550,10 +47749,10 @@ function parquetSourceFile(value, repositoryId, revision) {
|
|
|
47550
47749
|
if (item?.dataset !== repositoryId || typeof item.config !== "string" || typeof item.split !== "string" || typeof item.filename !== "string" || !item.filename.toLowerCase().endsWith(".parquet")) {
|
|
47551
47750
|
return [];
|
|
47552
47751
|
}
|
|
47553
|
-
const
|
|
47554
|
-
if (!
|
|
47752
|
+
const path64 = [item.config, item.split, item.filename].flatMap((segment) => segment.split("/")).map((segment) => segment.trim()).filter(Boolean).join("/");
|
|
47753
|
+
if (!path64 || path64.split("/").includes("..")) return [];
|
|
47555
47754
|
return [{
|
|
47556
|
-
path:
|
|
47755
|
+
path: path64,
|
|
47557
47756
|
configuration: item.config,
|
|
47558
47757
|
split: item.split,
|
|
47559
47758
|
revision,
|
|
@@ -47626,8 +47825,8 @@ function sourceColumns(features, rows) {
|
|
|
47626
47825
|
});
|
|
47627
47826
|
}
|
|
47628
47827
|
}
|
|
47629
|
-
return [...paths.entries()].map(([
|
|
47630
|
-
path:
|
|
47828
|
+
return [...paths.entries()].map(([path64, value]) => ({
|
|
47829
|
+
path: path64,
|
|
47631
47830
|
logicalType: value.type,
|
|
47632
47831
|
nullable: value.nullable,
|
|
47633
47832
|
sampleValues: value.values.slice(0, 5)
|
|
@@ -47645,21 +47844,21 @@ function flattenRecord(value, prefix, paths, rows) {
|
|
|
47645
47844
|
return;
|
|
47646
47845
|
}
|
|
47647
47846
|
for (const [key, child] of Object.entries(value)) {
|
|
47648
|
-
const
|
|
47847
|
+
const path64 = prefix ? `${prefix}.${key}` : key;
|
|
47649
47848
|
if (child && typeof child === "object" && !Array.isArray(child)) {
|
|
47650
|
-
flattenRecord(child,
|
|
47849
|
+
flattenRecord(child, path64, paths, rows);
|
|
47651
47850
|
} else {
|
|
47652
|
-
paths.set(
|
|
47851
|
+
paths.set(path64, {
|
|
47653
47852
|
type: logicalType(child),
|
|
47654
|
-
nullable: rows.some((row) => nestedValue(row,
|
|
47655
|
-
values: rows.map((row) => nestedValue(row,
|
|
47853
|
+
nullable: rows.some((row) => nestedValue(row, path64) == null),
|
|
47854
|
+
values: rows.map((row) => nestedValue(row, path64)).filter((item) => item != null)
|
|
47656
47855
|
});
|
|
47657
47856
|
}
|
|
47658
47857
|
}
|
|
47659
47858
|
}
|
|
47660
|
-
function nestedValue(value,
|
|
47859
|
+
function nestedValue(value, path64) {
|
|
47661
47860
|
let current = value;
|
|
47662
|
-
for (const segment of
|
|
47861
|
+
for (const segment of path64.split(".")) {
|
|
47663
47862
|
const record11 = asRecord15(current);
|
|
47664
47863
|
if (!record11) return null;
|
|
47665
47864
|
current = record11[segment];
|
|
@@ -48346,7 +48545,7 @@ function createDatasetImportService(deps) {
|
|
|
48346
48545
|
...current,
|
|
48347
48546
|
status: "materializing",
|
|
48348
48547
|
mapping,
|
|
48349
|
-
targetStorageRoot:
|
|
48548
|
+
targetStorageRoot: path56.resolve(targetStorageRoot),
|
|
48350
48549
|
tasksetId: current.tasksetId ?? safeTasksetId(input.name, current.id),
|
|
48351
48550
|
tasksetRevision: current.status === "ready" ? (existingTaskset?.revision ?? current.tasksetRevision ?? 0) + 1 : current.tasksetRevision ?? 1,
|
|
48352
48551
|
error: null,
|
|
@@ -48405,11 +48604,11 @@ function createDatasetImportService(deps) {
|
|
|
48405
48604
|
let job = initial;
|
|
48406
48605
|
const inspection = job.inspection;
|
|
48407
48606
|
const mapping = job.mapping;
|
|
48408
|
-
const configuredRoot =
|
|
48409
|
-
const stagingRoot =
|
|
48410
|
-
const sourceStaging =
|
|
48411
|
-
const materializedStaging =
|
|
48412
|
-
const finalRoot =
|
|
48607
|
+
const configuredRoot = path56.resolve(job.targetStorageRoot);
|
|
48608
|
+
const stagingRoot = path56.join(configuredRoot, "staging", job.id);
|
|
48609
|
+
const sourceStaging = path56.join(stagingRoot, "source");
|
|
48610
|
+
const materializedStaging = path56.join(stagingRoot, "materialized");
|
|
48611
|
+
const finalRoot = path56.join(
|
|
48413
48612
|
configuredRoot,
|
|
48414
48613
|
"tasksets",
|
|
48415
48614
|
job.tasksetId,
|
|
@@ -48461,7 +48660,7 @@ function createDatasetImportService(deps) {
|
|
|
48461
48660
|
});
|
|
48462
48661
|
continue;
|
|
48463
48662
|
}
|
|
48464
|
-
const temporary =
|
|
48663
|
+
const temporary = path56.join(sourceStaging, `${index}.parquet.partial`);
|
|
48465
48664
|
const result2 = await downloadDatasetFile({
|
|
48466
48665
|
request,
|
|
48467
48666
|
url: huggingFaceResolveUrl(
|
|
@@ -48484,14 +48683,14 @@ function createDatasetImportService(deps) {
|
|
|
48484
48683
|
});
|
|
48485
48684
|
}
|
|
48486
48685
|
});
|
|
48487
|
-
const relativeBlob =
|
|
48686
|
+
const relativeBlob = path56.join(
|
|
48488
48687
|
"blobs",
|
|
48489
48688
|
"sha256",
|
|
48490
48689
|
result2.contentHash.slice(0, 2),
|
|
48491
48690
|
result2.contentHash
|
|
48492
48691
|
);
|
|
48493
|
-
const blobPath =
|
|
48494
|
-
await mkdir10(
|
|
48692
|
+
const blobPath = path56.join(configuredRoot, relativeBlob);
|
|
48693
|
+
await mkdir10(path56.dirname(blobPath), { recursive: true });
|
|
48495
48694
|
await installVerifiedDatasetBlob({
|
|
48496
48695
|
temporaryPath: temporary,
|
|
48497
48696
|
blobPath,
|
|
@@ -48529,8 +48728,8 @@ function createDatasetImportService(deps) {
|
|
|
48529
48728
|
});
|
|
48530
48729
|
const sourceId = `dataset_source_${sourceHash.slice(0, 24)}`;
|
|
48531
48730
|
await mkdir10(materializedStaging, { recursive: true });
|
|
48532
|
-
const controlPath =
|
|
48533
|
-
const resultPath =
|
|
48731
|
+
const controlPath = path56.join(stagingRoot, "materialize-control.json");
|
|
48732
|
+
const resultPath = path56.join(stagingRoot, "materialize-result.json");
|
|
48534
48733
|
await writeFile6(
|
|
48535
48734
|
controlPath,
|
|
48536
48735
|
canonicalJson({
|
|
@@ -48674,31 +48873,31 @@ function createDatasetImportService(deps) {
|
|
|
48674
48873
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
48675
48874
|
};
|
|
48676
48875
|
await writeFile6(
|
|
48677
|
-
|
|
48876
|
+
path56.join(materializedStaging, "dataset-manifest.json"),
|
|
48678
48877
|
canonicalJson(manifest),
|
|
48679
48878
|
"utf8"
|
|
48680
48879
|
);
|
|
48681
48880
|
await writeFile6(
|
|
48682
|
-
|
|
48881
|
+
path56.join(materializedStaging, "taskset.json"),
|
|
48683
48882
|
canonicalJson(taskset),
|
|
48684
48883
|
"utf8"
|
|
48685
48884
|
);
|
|
48686
48885
|
await writeFile6(
|
|
48687
|
-
|
|
48886
|
+
path56.join(materializedStaging, "receipt.json"),
|
|
48688
48887
|
canonicalJson(receipt),
|
|
48689
48888
|
"utf8"
|
|
48690
48889
|
);
|
|
48691
48890
|
await writeFile6(
|
|
48692
|
-
|
|
48891
|
+
path56.join(materializedStaging, "mapping.json"),
|
|
48693
48892
|
canonicalJson(mapping),
|
|
48694
48893
|
"utf8"
|
|
48695
48894
|
);
|
|
48696
48895
|
await writeFile6(
|
|
48697
|
-
|
|
48896
|
+
path56.join(materializedStaging, "quality-report.json"),
|
|
48698
48897
|
canonicalJson(result.qualityReport),
|
|
48699
48898
|
"utf8"
|
|
48700
48899
|
);
|
|
48701
|
-
await mkdir10(
|
|
48900
|
+
await mkdir10(path56.dirname(finalRoot), { recursive: true });
|
|
48702
48901
|
await rm5(finalRoot, { recursive: true, force: true });
|
|
48703
48902
|
await rename4(materializedStaging, finalRoot);
|
|
48704
48903
|
await deps.store.upsertExternalDatasetSource(source);
|
|
@@ -48775,7 +48974,7 @@ function reusableSourceFiles(taskset, configuredRoot) {
|
|
|
48775
48974
|
if (typeof file.sourcePath !== "string" || typeof file.configuration !== "string" || typeof file.upstreamSplit !== "string" || typeof file.revision !== "string" || typeof file.contentHash !== "string" || !Number.isSafeInteger(file.sizeBytes)) {
|
|
48776
48975
|
continue;
|
|
48777
48976
|
}
|
|
48778
|
-
const blobPath =
|
|
48977
|
+
const blobPath = path56.join(
|
|
48779
48978
|
configuredRoot,
|
|
48780
48979
|
"blobs",
|
|
48781
48980
|
"sha256",
|
|
@@ -49029,8 +49228,8 @@ function planItem(stage, split, taskIds, multiplier) {
|
|
|
49029
49228
|
}
|
|
49030
49229
|
|
|
49031
49230
|
// ../server/src/training/harness-refiner-benchmark-result-persistence.ts
|
|
49032
|
-
import { promises as
|
|
49033
|
-
import
|
|
49231
|
+
import { promises as fs24 } from "node:fs";
|
|
49232
|
+
import path57 from "node:path";
|
|
49034
49233
|
function createResultManifest(input) {
|
|
49035
49234
|
const core = {
|
|
49036
49235
|
schemaVersion: "openpond.harnessRefinerBenchmarkResult.v2",
|
|
@@ -49065,25 +49264,25 @@ function createResultManifest(input) {
|
|
|
49065
49264
|
return { ...core, contentHash: contentHash(core) };
|
|
49066
49265
|
}
|
|
49067
49266
|
async function writeManagedResult(storeDir, modelRunId, manifest) {
|
|
49068
|
-
const root =
|
|
49069
|
-
await
|
|
49070
|
-
const filePath =
|
|
49071
|
-
await
|
|
49267
|
+
const root = path57.join(storeDir, "training", "model-runs", modelRunId, "benchmark");
|
|
49268
|
+
await fs24.mkdir(root, { recursive: true });
|
|
49269
|
+
const filePath = path57.join(root, `${manifest.contentHash}.json`);
|
|
49270
|
+
await fs24.writeFile(filePath, `${JSON.stringify(manifest, null, 2)}
|
|
49072
49271
|
`, "utf8");
|
|
49073
|
-
return
|
|
49272
|
+
return path57.relative(storeDir, filePath).replaceAll(path57.sep, "/");
|
|
49074
49273
|
}
|
|
49075
49274
|
async function loadLatestManagedResult(storeDir, modelRunId) {
|
|
49076
|
-
const root =
|
|
49275
|
+
const root = path57.join(storeDir, "training", "model-runs", modelRunId, "benchmark");
|
|
49077
49276
|
let entries;
|
|
49078
49277
|
try {
|
|
49079
|
-
entries = (await
|
|
49278
|
+
entries = (await fs24.readdir(root)).filter((entry) => entry.endsWith(".json"));
|
|
49080
49279
|
} catch (error) {
|
|
49081
49280
|
if (error.code === "ENOENT") return null;
|
|
49082
49281
|
throw error;
|
|
49083
49282
|
}
|
|
49084
49283
|
const manifests = await Promise.all(entries.map(async (entry) => {
|
|
49085
49284
|
const value = JSON.parse(
|
|
49086
|
-
await
|
|
49285
|
+
await fs24.readFile(path57.join(root, entry), "utf8")
|
|
49087
49286
|
);
|
|
49088
49287
|
return value.schemaVersion === "openpond.harnessRefinerBenchmarkResult.v2" && value.modelRunId === modelRunId ? value : null;
|
|
49089
49288
|
}));
|
|
@@ -49110,14 +49309,14 @@ async function preserveProfileResult(input) {
|
|
|
49110
49309
|
},
|
|
49111
49310
|
...await Promise.all(sourceFiles.map(async (relativePath) => ({
|
|
49112
49311
|
path: `${prefix}/candidate-harness/${relativePath}`,
|
|
49113
|
-
contents: await
|
|
49312
|
+
contents: await fs24.readFile(path57.join(sourceRoot, ...relativePath.split("/")))
|
|
49114
49313
|
})))
|
|
49115
49314
|
]
|
|
49116
49315
|
});
|
|
49117
49316
|
}
|
|
49118
49317
|
async function listFiles(root, relative2 = "") {
|
|
49119
|
-
const directory =
|
|
49120
|
-
const entries = await
|
|
49318
|
+
const directory = path57.join(root, ...relative2.split("/").filter(Boolean));
|
|
49319
|
+
const entries = await fs24.readdir(directory, { withFileTypes: true });
|
|
49121
49320
|
const files = [];
|
|
49122
49321
|
for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
49123
49322
|
const next = relative2 ? `${relative2}/${entry.name}` : entry.name;
|
|
@@ -49184,8 +49383,8 @@ async function ensureBaseVersion(input) {
|
|
|
49184
49383
|
}
|
|
49185
49384
|
|
|
49186
49385
|
// ../server/src/training/harness-refiner-benchmark-service-support.ts
|
|
49187
|
-
import { promises as
|
|
49188
|
-
import
|
|
49386
|
+
import { promises as fs25 } from "node:fs";
|
|
49387
|
+
import path58 from "node:path";
|
|
49189
49388
|
function completedStage(input) {
|
|
49190
49389
|
return {
|
|
49191
49390
|
run: input.run,
|
|
@@ -49471,15 +49670,15 @@ async function checkpointRefinerUsage(store, modelRunId, usage, observedSpendUsd
|
|
|
49471
49670
|
});
|
|
49472
49671
|
}
|
|
49473
49672
|
async function checkpointEvidenceSnapshot(store, storeDir, modelRunId, snapshot) {
|
|
49474
|
-
const directory =
|
|
49673
|
+
const directory = path58.join(
|
|
49475
49674
|
storeDir,
|
|
49476
49675
|
"training",
|
|
49477
49676
|
"harness-refiner-benchmarks",
|
|
49478
49677
|
modelRunId
|
|
49479
49678
|
);
|
|
49480
|
-
await
|
|
49481
|
-
const artifactPath2 =
|
|
49482
|
-
await
|
|
49679
|
+
await fs25.mkdir(directory, { recursive: true });
|
|
49680
|
+
const artifactPath2 = path58.join(directory, "evidence-snapshot.json");
|
|
49681
|
+
await fs25.writeFile(artifactPath2, `${JSON.stringify(snapshot, null, 2)}
|
|
49483
49682
|
`, "utf8");
|
|
49484
49683
|
const run = await store.getModelRun(modelRunId);
|
|
49485
49684
|
if (!run || run.status !== "running" || !run.evaluationProgress) return run;
|
|
@@ -49500,7 +49699,7 @@ async function loadOrReconstructEvidenceSnapshot(input) {
|
|
|
49500
49699
|
const ref = input.modelRun.evaluationProgress?.evidenceSnapshot;
|
|
49501
49700
|
if (ref) {
|
|
49502
49701
|
const manifest = parseEvidenceSnapshotManifest(
|
|
49503
|
-
JSON.parse(await
|
|
49702
|
+
JSON.parse(await fs25.readFile(ref.artifactPath, "utf8"))
|
|
49504
49703
|
);
|
|
49505
49704
|
if (manifest.id !== ref.id || manifest.contentHash !== ref.contentHash) {
|
|
49506
49705
|
throw new Error("Durable benchmark evidence snapshot does not match its admitted ref.");
|
|
@@ -51228,7 +51427,7 @@ function usageCost(usage, pricing) {
|
|
|
51228
51427
|
// ../server/src/training/benchmark-tasksets.ts
|
|
51229
51428
|
import { createHash as createHash15 } from "node:crypto";
|
|
51230
51429
|
import { mkdir as mkdir11, readFile as readFile16, writeFile as writeFile7 } from "node:fs/promises";
|
|
51231
|
-
import
|
|
51430
|
+
import path59 from "node:path";
|
|
51232
51431
|
var BUILTIN_DEFINITION_ID = "harness-refiner";
|
|
51233
51432
|
function createBenchmarkTasksetService(input) {
|
|
51234
51433
|
const now2 = input.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
@@ -51238,7 +51437,7 @@ function createBenchmarkTasksetService(input) {
|
|
|
51238
51437
|
if (existing?.benchmark?.releaseId === harnessRefinerBenchmarkRelease.id && existing.benchmark.releaseHash === harnessRefinerBenchmarkRelease.contentHash) {
|
|
51239
51438
|
return existing;
|
|
51240
51439
|
}
|
|
51241
|
-
const tasksetRoot =
|
|
51440
|
+
const tasksetRoot = path59.join(
|
|
51242
51441
|
input.storeDir,
|
|
51243
51442
|
"training",
|
|
51244
51443
|
"tasksets",
|
|
@@ -51258,7 +51457,7 @@ function createBenchmarkTasksetService(input) {
|
|
|
51258
51457
|
}
|
|
51259
51458
|
async function releaseForTaskset(taskset) {
|
|
51260
51459
|
if (taskset.purpose !== "benchmark" || !taskset.benchmark) return null;
|
|
51261
|
-
const releasePath =
|
|
51460
|
+
const releasePath = path59.resolve(
|
|
51262
51461
|
input.storeDir,
|
|
51263
51462
|
"training",
|
|
51264
51463
|
"tasksets",
|
|
@@ -51301,12 +51500,12 @@ async function projectRelease(input) {
|
|
|
51301
51500
|
input.release.tasks.flatMap((task) => task.artifactRefs)
|
|
51302
51501
|
);
|
|
51303
51502
|
const managedAssetById = /* @__PURE__ */ new Map();
|
|
51304
|
-
await mkdir11(
|
|
51305
|
-
await mkdir11(
|
|
51306
|
-
await mkdir11(
|
|
51307
|
-
await mkdir11(
|
|
51503
|
+
await mkdir11(path59.join(input.tasksetRoot, "assets"), { recursive: true });
|
|
51504
|
+
await mkdir11(path59.join(input.tasksetRoot, "benchmark"), { recursive: true });
|
|
51505
|
+
await mkdir11(path59.join(input.tasksetRoot, "rubrics"), { recursive: true });
|
|
51506
|
+
await mkdir11(path59.join(input.tasksetRoot, "verifiers"), { recursive: true });
|
|
51308
51507
|
await writeFile7(
|
|
51309
|
-
|
|
51508
|
+
path59.join(input.tasksetRoot, "benchmark", "taskset.release.json"),
|
|
51310
51509
|
JSON.stringify(input.release),
|
|
51311
51510
|
"utf8"
|
|
51312
51511
|
);
|
|
@@ -51315,9 +51514,9 @@ async function projectRelease(input) {
|
|
|
51315
51514
|
if (contentHash(contents) !== asset.contentHash) {
|
|
51316
51515
|
throw new Error(`Benchmark asset ${asset.path} failed its content hash.`);
|
|
51317
51516
|
}
|
|
51318
|
-
const fileName = `${asset.id}-${
|
|
51319
|
-
const artifactRef =
|
|
51320
|
-
await writeFile7(
|
|
51517
|
+
const fileName = `${asset.id}-${path59.basename(asset.path)}`;
|
|
51518
|
+
const artifactRef = path59.posix.join("assets", fileName);
|
|
51519
|
+
await writeFile7(path59.join(input.tasksetRoot, artifactRef), contents, "utf8");
|
|
51321
51520
|
managedAssetById.set(asset.id, {
|
|
51322
51521
|
artifactRef,
|
|
51323
51522
|
fileName,
|
|
@@ -51544,7 +51743,7 @@ async function copyVerifierAsset(assets, tasksetRoot, asset) {
|
|
|
51544
51743
|
if (contentHash(contents) !== asset.contentHash) {
|
|
51545
51744
|
throw new Error(`Benchmark verifier asset ${asset.path} failed its content hash.`);
|
|
51546
51745
|
}
|
|
51547
|
-
await writeFile7(
|
|
51746
|
+
await writeFile7(path59.join(tasksetRoot, asset.path), contents, "utf8");
|
|
51548
51747
|
return contents;
|
|
51549
51748
|
}
|
|
51550
51749
|
function builtinAsset(assets, assetPath) {
|
|
@@ -51615,9 +51814,9 @@ function stringValue11(value) {
|
|
|
51615
51814
|
// ../server/src/training/local-taskset-work-runtime.ts
|
|
51616
51815
|
import { execFile as execFile8 } from "node:child_process";
|
|
51617
51816
|
import { createHash as createHash16, randomUUID as randomUUID24 } from "node:crypto";
|
|
51618
|
-
import { existsSync as existsSync12, promises as
|
|
51817
|
+
import { existsSync as existsSync12, promises as fs26 } from "node:fs";
|
|
51619
51818
|
import os9 from "node:os";
|
|
51620
|
-
import
|
|
51819
|
+
import path60 from "node:path";
|
|
51621
51820
|
function createLocalTasksetWorkRuntime(deps) {
|
|
51622
51821
|
return {
|
|
51623
51822
|
createSession: async (payload) => {
|
|
@@ -51671,7 +51870,7 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
51671
51870
|
const request = record10(input.payload);
|
|
51672
51871
|
const action = string2(request.action);
|
|
51673
51872
|
const args = record10(request.args);
|
|
51674
|
-
const root =
|
|
51873
|
+
const root = path60.resolve(input.session.cwd);
|
|
51675
51874
|
await ensureLayout(root);
|
|
51676
51875
|
try {
|
|
51677
51876
|
if (action === "sandbox_create" || action === "sandbox_start") {
|
|
@@ -51698,8 +51897,8 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
51698
51897
|
if (action === "sandbox_upload_file") {
|
|
51699
51898
|
const target = localPath(root, string2(args.path));
|
|
51700
51899
|
const bytes2 = Buffer.from(string2(args.contentsBase64), "base64");
|
|
51701
|
-
await
|
|
51702
|
-
await
|
|
51900
|
+
await fs26.mkdir(path60.dirname(target), { recursive: true, mode: 448 });
|
|
51901
|
+
await fs26.writeFile(target, bytes2, { mode: 384 });
|
|
51703
51902
|
return ok(action, `Uploaded ${relative(root, target)}.`, fileData(target, bytes2));
|
|
51704
51903
|
}
|
|
51705
51904
|
if (action === "sandbox_list_files") {
|
|
@@ -51710,7 +51909,7 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
51710
51909
|
if (action === "sandbox_read_file") {
|
|
51711
51910
|
const target = localPath(root, string2(args.path));
|
|
51712
51911
|
const maxBytes = integer(args.maxBytes, 512e3, 1, 1e6);
|
|
51713
|
-
const bytes2 = await
|
|
51912
|
+
const bytes2 = await fs26.readFile(target);
|
|
51714
51913
|
const bounded = bytes2.subarray(0, maxBytes);
|
|
51715
51914
|
return ok(action, bounded.toString("utf8"), {
|
|
51716
51915
|
path: relative(root, target),
|
|
@@ -51722,24 +51921,24 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
51722
51921
|
if (action === "sandbox_write_file") {
|
|
51723
51922
|
const target = localPath(root, string2(args.path));
|
|
51724
51923
|
const contents = string2(args.content, true);
|
|
51725
|
-
await
|
|
51726
|
-
await
|
|
51924
|
+
await fs26.mkdir(path60.dirname(target), { recursive: true, mode: 448 });
|
|
51925
|
+
await fs26.writeFile(target, contents, { encoding: "utf8", mode: 384 });
|
|
51727
51926
|
return ok(action, `Wrote ${relative(root, target)}.`, fileData(target, Buffer.from(contents)));
|
|
51728
51927
|
}
|
|
51729
51928
|
if (action === "sandbox_edit_file") {
|
|
51730
51929
|
const target = localPath(root, string2(args.path));
|
|
51731
|
-
const contents = await
|
|
51930
|
+
const contents = await fs26.readFile(target, "utf8");
|
|
51732
51931
|
const oldText = string2(args.oldText);
|
|
51733
51932
|
if (!contents.includes(oldText)) {
|
|
51734
51933
|
return fail(action, "The exact text to replace was not found.");
|
|
51735
51934
|
}
|
|
51736
51935
|
const next = args.replaceAll === true ? contents.replaceAll(oldText, string2(args.newText, true)) : contents.replace(oldText, string2(args.newText, true));
|
|
51737
|
-
await
|
|
51936
|
+
await fs26.writeFile(target, next, { encoding: "utf8", mode: 384 });
|
|
51738
51937
|
return ok(action, `Edited ${relative(root, target)}.`, fileData(target, Buffer.from(next)));
|
|
51739
51938
|
}
|
|
51740
51939
|
if (action === "sandbox_delete_file") {
|
|
51741
51940
|
const target = localPath(root, string2(args.path));
|
|
51742
|
-
await
|
|
51941
|
+
await fs26.rm(target, { recursive: args.recursive === true, force: true });
|
|
51743
51942
|
return ok(action, `Deleted ${relative(root, target)}.`, { path: relative(root, target) });
|
|
51744
51943
|
}
|
|
51745
51944
|
if (action === "sandbox_exec") {
|
|
@@ -51752,7 +51951,7 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
51752
51951
|
output: [result.stdout, result.stderr].filter(Boolean).join("\n").trim(),
|
|
51753
51952
|
data: {
|
|
51754
51953
|
command,
|
|
51755
|
-
cwd:
|
|
51954
|
+
cwd: path60.join(root, "work"),
|
|
51756
51955
|
exitCode: result.code,
|
|
51757
51956
|
stdout: result.stdout,
|
|
51758
51957
|
stderr: result.stderr
|
|
@@ -51761,24 +51960,24 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
51761
51960
|
}
|
|
51762
51961
|
if (action === "sandbox_save_output") {
|
|
51763
51962
|
const source = localPath(root, string2(args.path));
|
|
51764
|
-
const bytes2 = await
|
|
51963
|
+
const bytes2 = await fs26.readFile(source);
|
|
51765
51964
|
if (bytes2.byteLength > WORK_OUTPUT_MAX_BYTES) {
|
|
51766
51965
|
return fail(action, `Work output exceeds ${WORK_OUTPUT_MAX_BYTES.toLocaleString()} bytes.`);
|
|
51767
51966
|
}
|
|
51768
51967
|
const title = safeName2(
|
|
51769
|
-
typeof args.suggestedName === "string" && args.suggestedName.trim() ? args.suggestedName :
|
|
51968
|
+
typeof args.suggestedName === "string" && args.suggestedName.trim() ? args.suggestedName : path60.basename(source)
|
|
51770
51969
|
);
|
|
51771
|
-
const contentType2 = WORK_OUTPUT_CONTENT_TYPES[
|
|
51970
|
+
const contentType2 = WORK_OUTPUT_CONTENT_TYPES[path60.extname(title).toLowerCase()];
|
|
51772
51971
|
if (!contentType2) return fail(action, `${title} is not a supported Work output format.`);
|
|
51773
|
-
const outputDir =
|
|
51972
|
+
const outputDir = path60.join(
|
|
51774
51973
|
input.deps.storeDir,
|
|
51775
51974
|
"work",
|
|
51776
51975
|
"outputs",
|
|
51777
51976
|
safeName2(input.session.id)
|
|
51778
51977
|
);
|
|
51779
|
-
await
|
|
51780
|
-
const destination =
|
|
51781
|
-
await
|
|
51978
|
+
await fs26.mkdir(outputDir, { recursive: true, mode: 448 });
|
|
51979
|
+
const destination = path60.join(outputDir, `001-${randomUUID24()}-${title}`);
|
|
51980
|
+
await fs26.writeFile(destination, bytes2, { mode: 384 });
|
|
51782
51981
|
const outputRef = FileOutputRefSchema.parse({
|
|
51783
51982
|
kind: "file",
|
|
51784
51983
|
id: `output-${createHash16("sha256").update(destination).digest("hex").slice(0, 24)}`,
|
|
@@ -51815,25 +52014,25 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
51815
52014
|
}
|
|
51816
52015
|
async function ensureLayout(root) {
|
|
51817
52016
|
await Promise.all(["inputs", "work", "outputs"].map(
|
|
51818
|
-
(area) =>
|
|
52017
|
+
(area) => fs26.mkdir(path60.join(root, area), { recursive: true, mode: 448 })
|
|
51819
52018
|
));
|
|
51820
52019
|
}
|
|
51821
52020
|
function localPath(root, value) {
|
|
51822
52021
|
const normalized = value.replaceAll("\\", "/").replace(/^\/+/, "").replace(/^workspace(?:\/|$)/, "");
|
|
51823
|
-
const target =
|
|
51824
|
-
if (target !== root && !target.startsWith(`${root}${
|
|
52022
|
+
const target = path60.resolve(root, normalized);
|
|
52023
|
+
if (target !== root && !target.startsWith(`${root}${path60.sep}`)) {
|
|
51825
52024
|
throw new Error("Local Work path escaped its isolated workspace.");
|
|
51826
52025
|
}
|
|
51827
52026
|
return target;
|
|
51828
52027
|
}
|
|
51829
52028
|
async function listFiles2(root, target, recursive) {
|
|
51830
|
-
const stat7 = await
|
|
52029
|
+
const stat7 = await fs26.stat(target).catch(() => null);
|
|
51831
52030
|
if (!stat7) return [];
|
|
51832
52031
|
if (!stat7.isDirectory()) return [relative(root, target)];
|
|
51833
|
-
const entries = await
|
|
52032
|
+
const entries = await fs26.readdir(target, { withFileTypes: true });
|
|
51834
52033
|
const files = [];
|
|
51835
52034
|
for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
51836
|
-
const item =
|
|
52035
|
+
const item = path60.join(target, entry.name);
|
|
51837
52036
|
files.push(relative(root, item));
|
|
51838
52037
|
if (recursive && entry.isDirectory()) files.push(...await listFiles2(root, item, true));
|
|
51839
52038
|
if (files.length >= 1e3) break;
|
|
@@ -51842,8 +52041,8 @@ async function listFiles2(root, target, recursive) {
|
|
|
51842
52041
|
}
|
|
51843
52042
|
function runCommand5(command, cwd, timeoutMs) {
|
|
51844
52043
|
return new Promise((resolve) => {
|
|
51845
|
-
const nodeRuntimeRoot =
|
|
51846
|
-
const localPythonRoot =
|
|
52044
|
+
const nodeRuntimeRoot = path60.dirname(path60.dirname(process.execPath));
|
|
52045
|
+
const localPythonRoot = path60.join(os9.homedir(), ".local", "lib");
|
|
51847
52046
|
const sandboxArgs = [
|
|
51848
52047
|
"--tmpfs",
|
|
51849
52048
|
"/",
|
|
@@ -51962,7 +52161,7 @@ function integer(value, fallback, minimum, maximum) {
|
|
|
51962
52161
|
return typeof value === "number" && Number.isInteger(value) ? Math.min(maximum, Math.max(minimum, value)) : fallback;
|
|
51963
52162
|
}
|
|
51964
52163
|
function relative(root, target) {
|
|
51965
|
-
return
|
|
52164
|
+
return path60.relative(root, target).replaceAll(path60.sep, "/");
|
|
51966
52165
|
}
|
|
51967
52166
|
function safeName2(value) {
|
|
51968
52167
|
return value.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "output";
|
|
@@ -52017,12 +52216,12 @@ function createBenchmarkRuntimeComposition(input) {
|
|
|
52017
52216
|
// ../server/src/training/dataset-storage-service.ts
|
|
52018
52217
|
import { constants as constants3 } from "node:fs";
|
|
52019
52218
|
import { access as access4, mkdir as mkdir12, readFile as readFile18, rename as rename5, statfs as statfs2, writeFile as writeFile8 } from "node:fs/promises";
|
|
52020
|
-
import
|
|
52219
|
+
import path62 from "node:path";
|
|
52021
52220
|
|
|
52022
52221
|
// ../server/src/training/dataset-storage-discovery.ts
|
|
52023
52222
|
import { readdir as readdir4, readFile as readFile17 } from "node:fs/promises";
|
|
52024
52223
|
import os10 from "node:os";
|
|
52025
|
-
import
|
|
52224
|
+
import path61 from "node:path";
|
|
52026
52225
|
var NETWORK_FILE_SYSTEMS = /* @__PURE__ */ new Set([
|
|
52027
52226
|
"9p",
|
|
52028
52227
|
"afpfs",
|
|
@@ -52108,7 +52307,7 @@ function parseLinuxMountInfo(value, storeDir) {
|
|
|
52108
52307
|
candidates.push({
|
|
52109
52308
|
kind,
|
|
52110
52309
|
label: driveLabel(mountPath, source, kind),
|
|
52111
|
-
datasetStorePath: mountPath === "/" ?
|
|
52310
|
+
datasetStorePath: mountPath === "/" ? path61.join(storeDir, "datasets") : path61.join(mountPath, "OpenPond", "datasets"),
|
|
52112
52311
|
path: mountPath
|
|
52113
52312
|
});
|
|
52114
52313
|
}
|
|
@@ -52127,7 +52326,7 @@ function parseMacMountOutput(value, storeDir) {
|
|
|
52127
52326
|
candidates.push({
|
|
52128
52327
|
kind,
|
|
52129
52328
|
label: driveLabel(mountPath, source, kind),
|
|
52130
|
-
datasetStorePath: mountPath === "/" ?
|
|
52329
|
+
datasetStorePath: mountPath === "/" ? path61.join(storeDir, "datasets") : path61.join(mountPath, "OpenPond", "datasets"),
|
|
52131
52330
|
path: mountPath
|
|
52132
52331
|
});
|
|
52133
52332
|
}
|
|
@@ -52150,11 +52349,11 @@ function parseWindowsLogicalDisks(value, storeDir) {
|
|
|
52150
52349
|
const root = `${deviceId}\\`;
|
|
52151
52350
|
const volumeName = typeof record11.VolumeName === "string" ? record11.VolumeName.trim() : "";
|
|
52152
52351
|
const kind = driveType === 4 ? "network" : driveType === 2 ? "removable" : "local";
|
|
52153
|
-
const storeRoot =
|
|
52352
|
+
const storeRoot = path61.win32.parse(path61.win32.resolve(storeDir)).root.toLowerCase();
|
|
52154
52353
|
return [{
|
|
52155
52354
|
kind,
|
|
52156
52355
|
label: volumeName || (root.toLowerCase() === storeRoot ? "System disk" : deviceId.toUpperCase()),
|
|
52157
|
-
datasetStorePath: root.toLowerCase() === storeRoot ?
|
|
52356
|
+
datasetStorePath: root.toLowerCase() === storeRoot ? path61.win32.join(storeDir, "datasets") : path61.win32.join(root, "OpenPond", "datasets"),
|
|
52158
52357
|
path: root
|
|
52159
52358
|
}];
|
|
52160
52359
|
});
|
|
@@ -52168,25 +52367,25 @@ function storageKindForPath(value) {
|
|
|
52168
52367
|
}
|
|
52169
52368
|
async function discoverGvfsCandidates() {
|
|
52170
52369
|
const uid = typeof process.getuid === "function" ? process.getuid() : os10.userInfo().uid;
|
|
52171
|
-
const gvfsRoot =
|
|
52370
|
+
const gvfsRoot = path61.join("/run/user", String(uid), "gvfs");
|
|
52172
52371
|
const entries = await readdir4(gvfsRoot, { withFileTypes: true }).catch(() => []);
|
|
52173
52372
|
return entries.flatMap((entry) => {
|
|
52174
52373
|
if (!entry.isDirectory()) return [];
|
|
52175
|
-
const mountedPath =
|
|
52374
|
+
const mountedPath = path61.join(gvfsRoot, entry.name);
|
|
52176
52375
|
return [{
|
|
52177
52376
|
kind: "network",
|
|
52178
52377
|
label: labelForGvfsMount(entry.name),
|
|
52179
|
-
datasetStorePath:
|
|
52378
|
+
datasetStorePath: path61.join(mountedPath, "OpenPond", "datasets"),
|
|
52180
52379
|
path: mountedPath
|
|
52181
52380
|
}];
|
|
52182
52381
|
});
|
|
52183
52382
|
}
|
|
52184
52383
|
function systemStorageCandidate(storeDir, platform) {
|
|
52185
|
-
const root =
|
|
52384
|
+
const root = path61.parse(path61.resolve(storeDir)).root;
|
|
52186
52385
|
return {
|
|
52187
52386
|
kind: "local",
|
|
52188
52387
|
label: "System disk",
|
|
52189
|
-
datasetStorePath:
|
|
52388
|
+
datasetStorePath: path61.join(storeDir, "datasets"),
|
|
52190
52389
|
path: platform === "win32" ? root : root || "/"
|
|
52191
52390
|
};
|
|
52192
52391
|
}
|
|
@@ -52205,12 +52404,12 @@ function storageKind(input) {
|
|
|
52205
52404
|
}
|
|
52206
52405
|
function driveLabel(mountPath, source, kind) {
|
|
52207
52406
|
if (mountPath === "/") return "System disk";
|
|
52208
|
-
const mountName =
|
|
52407
|
+
const mountName = path61.basename(mountPath);
|
|
52209
52408
|
if (kind === "network") {
|
|
52210
52409
|
const sourceName = source.replace(/\/+$/, "").split("/").pop();
|
|
52211
52410
|
return decodeSafely(sourceName || mountName || source);
|
|
52212
52411
|
}
|
|
52213
|
-
return decodeSafely(mountName ||
|
|
52412
|
+
return decodeSafely(mountName || path61.basename(source) || source);
|
|
52214
52413
|
}
|
|
52215
52414
|
function labelForGvfsMount(name) {
|
|
52216
52415
|
const separator = name.indexOf(":");
|
|
@@ -52244,7 +52443,7 @@ function uniqueCandidates2(candidates) {
|
|
|
52244
52443
|
return [...unique2.values()];
|
|
52245
52444
|
}
|
|
52246
52445
|
function normalizedPath(value) {
|
|
52247
|
-
const normalized =
|
|
52446
|
+
const normalized = path61.normalize(value);
|
|
52248
52447
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
52249
52448
|
}
|
|
52250
52449
|
|
|
@@ -52305,15 +52504,15 @@ var runCommandProbe = async (executable, args, options = {}) => {
|
|
|
52305
52504
|
|
|
52306
52505
|
// ../server/src/training/dataset-storage-service.ts
|
|
52307
52506
|
function createDatasetStorageService(input) {
|
|
52308
|
-
const directory =
|
|
52309
|
-
const settingsPath =
|
|
52507
|
+
const directory = path62.join(input.storeDir, "datasets");
|
|
52508
|
+
const settingsPath = path62.join(directory, "settings.json");
|
|
52310
52509
|
async function settings() {
|
|
52311
52510
|
try {
|
|
52312
52511
|
return DatasetStorageSettingsSchema.parse(JSON.parse(await readFile18(settingsPath, "utf8")));
|
|
52313
52512
|
} catch {
|
|
52314
52513
|
return DatasetStorageSettingsSchema.parse({
|
|
52315
52514
|
schemaVersion: "openpond.datasetStorageSettings.v1",
|
|
52316
|
-
datasetStorePath:
|
|
52515
|
+
datasetStorePath: path62.join(input.storeDir, "datasets"),
|
|
52317
52516
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
52318
52517
|
});
|
|
52319
52518
|
}
|
|
@@ -52325,7 +52524,7 @@ function createDatasetStorageService(input) {
|
|
|
52325
52524
|
platform: process.platform,
|
|
52326
52525
|
storeDir: input.storeDir
|
|
52327
52526
|
});
|
|
52328
|
-
if (!candidates.some((candidate2) =>
|
|
52527
|
+
if (!candidates.some((candidate2) => path62.resolve(candidate2.datasetStorePath) === path62.resolve(current.datasetStorePath))) {
|
|
52329
52528
|
candidates.push({
|
|
52330
52529
|
datasetStorePath: current.datasetStorePath,
|
|
52331
52530
|
kind: storageKindForPath(current.datasetStorePath),
|
|
@@ -52339,7 +52538,7 @@ function createDatasetStorageService(input) {
|
|
|
52339
52538
|
return {
|
|
52340
52539
|
...candidate2,
|
|
52341
52540
|
id: `dataset-storage-${Buffer.from(candidate2.path).toString("base64url").slice(0, 120)}`,
|
|
52342
|
-
configured:
|
|
52541
|
+
configured: path62.resolve(candidate2.datasetStorePath) === path62.resolve(current.datasetStorePath),
|
|
52343
52542
|
mounted: stats !== null,
|
|
52344
52543
|
freeBytes: stats ? Number(stats.bavail) * Number(stats.bsize) : null,
|
|
52345
52544
|
totalBytes: stats ? Number(stats.blocks) * Number(stats.bsize) : null,
|
|
@@ -52356,7 +52555,7 @@ function createDatasetStorageService(input) {
|
|
|
52356
52555
|
const request = UpdateDatasetStorageSettingsRequestSchema.parse(value);
|
|
52357
52556
|
const updated = DatasetStorageSettingsSchema.parse({
|
|
52358
52557
|
schemaVersion: "openpond.datasetStorageSettings.v1",
|
|
52359
|
-
datasetStorePath:
|
|
52558
|
+
datasetStorePath: path62.resolve(request.datasetStorePath),
|
|
52360
52559
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
52361
52560
|
});
|
|
52362
52561
|
if (!await ensureWritable(updated.datasetStorePath)) {
|
|
@@ -52512,10 +52711,10 @@ function createManagedAdapterRegistryClient(dependencies = {}) {
|
|
|
52512
52711
|
const fetchImpl = dependencies.fetchImpl ?? fetch;
|
|
52513
52712
|
const resolveRegistryAccess = dependencies.resolveRegistryAccess ?? ((teamId) => resolveManagedAdapterUserAccess({ teamId }));
|
|
52514
52713
|
const resolveInferenceAccess = dependencies.resolveInferenceAccess ?? ((teamId) => resolveManagedAdapterUserAccess({ teamId }));
|
|
52515
|
-
async function requestJson2(resolveAccess, teamId,
|
|
52714
|
+
async function requestJson2(resolveAccess, teamId, path64, init = {}) {
|
|
52516
52715
|
const access5 = await resolveAccess(teamId);
|
|
52517
52716
|
assertResolvedTeam(access5.teamId, teamId);
|
|
52518
|
-
const requestUrl = `${access5.apiBaseUrl}${
|
|
52717
|
+
const requestUrl = `${access5.apiBaseUrl}${path64}`;
|
|
52519
52718
|
const headers = withVercelProtectionBypass(
|
|
52520
52719
|
requestUrl,
|
|
52521
52720
|
hostedApiAuthHeaders(access5.token),
|
|
@@ -53145,10 +53344,10 @@ async function createOpenPondServer(options = {}) {
|
|
|
53145
53344
|
const harnessEvaluationReviewStream = createLocalHarnessEvaluationReviewModelStream(streamOpenPondHostedChatTurn2);
|
|
53146
53345
|
const executeWebSearch = createWebSearchExecutorFromEnv();
|
|
53147
53346
|
const executeConnectedAppTool = createCloudConnectedAppToolExecutor();
|
|
53148
|
-
const attachmentRootDir =
|
|
53347
|
+
const attachmentRootDir = path63.join(storeDir, "attachments");
|
|
53149
53348
|
const logger = createLogger({
|
|
53150
53349
|
channel: "server",
|
|
53151
|
-
logDir:
|
|
53350
|
+
logDir: path63.join(storeDir, "logs"),
|
|
53152
53351
|
metadata: {
|
|
53153
53352
|
version,
|
|
53154
53353
|
runtimeVersion
|
|
@@ -53270,6 +53469,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
53270
53469
|
updateLocalProjectAgentSetupPayload,
|
|
53271
53470
|
previewLocalProjectCloudSourcePayload,
|
|
53272
53471
|
uploadLocalProjectCloudSourcePayload,
|
|
53472
|
+
localProjectActionCatalogPayload,
|
|
53273
53473
|
patchSidebarAppPreference,
|
|
53274
53474
|
listSidebarFileBookmarksPayload,
|
|
53275
53475
|
patchSidebarFileBookmarkPayload,
|
|
@@ -53321,6 +53521,10 @@ async function createOpenPondServer(options = {}) {
|
|
|
53321
53521
|
appendRuntimeEvent,
|
|
53322
53522
|
isClosing: () => closing
|
|
53323
53523
|
});
|
|
53524
|
+
const projectActionRunPayload = createProjectActionRunPayload({
|
|
53525
|
+
appendRuntimeEvent,
|
|
53526
|
+
resolveProjectRoot: async (projectId) => (await findLocalProject(store, projectId))?.workspacePath ?? null
|
|
53527
|
+
});
|
|
53324
53528
|
const {
|
|
53325
53529
|
createSession,
|
|
53326
53530
|
patchSession,
|
|
@@ -53333,8 +53537,8 @@ async function createOpenPondServer(options = {}) {
|
|
|
53333
53537
|
store,
|
|
53334
53538
|
defaultSessionCwd,
|
|
53335
53539
|
createManagedLocalWorkCwd: async (sessionId) => {
|
|
53336
|
-
const workspacePath =
|
|
53337
|
-
await
|
|
53540
|
+
const workspacePath = path63.join(storeDir, "work", "tasks", sessionId);
|
|
53541
|
+
await fs27.mkdir(workspacePath, { recursive: true, mode: 448 });
|
|
53338
53542
|
return workspacePath;
|
|
53339
53543
|
},
|
|
53340
53544
|
loadAppPreferences,
|
|
@@ -53437,7 +53641,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
53437
53641
|
const tasksetAuthoringSkillText = tasksetAuthoringSkillArtifact.bundle;
|
|
53438
53642
|
const taskCreatorService = createTaskCreatorService({
|
|
53439
53643
|
store,
|
|
53440
|
-
tasksetRootDir:
|
|
53644
|
+
tasksetRootDir: path63.join(storeDir, "training", "tasksets"),
|
|
53441
53645
|
authoringSkillHash: contentHash(tasksetAuthoringSkillText),
|
|
53442
53646
|
loadCodexHistoryThread: (sessionId) => readCodexHistoryThreadPayload(sessionId, {
|
|
53443
53647
|
attachmentRootDir,
|
|
@@ -53466,7 +53670,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
53466
53670
|
});
|
|
53467
53671
|
const datasetArtifactService = createDatasetArtifactService({
|
|
53468
53672
|
store,
|
|
53469
|
-
workerProjectDir:
|
|
53673
|
+
workerProjectDir: path63.resolve(process.cwd(), "python", "openpond-datasets")
|
|
53470
53674
|
});
|
|
53471
53675
|
const {
|
|
53472
53676
|
benchmarkTasksets,
|
|
@@ -53570,7 +53774,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
53570
53774
|
const trainingChatSearchService = createTrainingChatSearchService({ store });
|
|
53571
53775
|
const datasetImportService = createDatasetImportService({
|
|
53572
53776
|
store,
|
|
53573
|
-
workerProjectDir:
|
|
53777
|
+
workerProjectDir: path63.resolve(
|
|
53574
53778
|
process.cwd(),
|
|
53575
53779
|
"python",
|
|
53576
53780
|
"openpond-datasets"
|
|
@@ -53670,6 +53874,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
53670
53874
|
workInputsForSession: workOutputService.workInputsForSession,
|
|
53671
53875
|
executeOpenPondCommand: openPondCommandAccess.executeCommand,
|
|
53672
53876
|
executeProfileAction: profileRunPayload,
|
|
53877
|
+
executeProjectAction: projectActionRunPayload,
|
|
53673
53878
|
executeDatasetBuilderAction: async ({
|
|
53674
53879
|
session,
|
|
53675
53880
|
provider,
|
|
@@ -53793,7 +53998,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
53793
53998
|
nextStep: response2.items.length === 0 ? "There are no pinned or saved files." : `Listed ${response2.items.length} sidebar file${response2.items.length === 1 ? "" : "s"}.`
|
|
53794
53999
|
};
|
|
53795
54000
|
}
|
|
53796
|
-
const
|
|
54001
|
+
const path64 = normalizeSidebarFilePath(requestedPath ?? "");
|
|
53797
54002
|
const workspaceId = session.workspaceId ?? session.localProjectId ?? session.appId;
|
|
53798
54003
|
if (!workspaceId) {
|
|
53799
54004
|
throw new Error(
|
|
@@ -53806,18 +54011,18 @@ async function createOpenPondServer(options = {}) {
|
|
|
53806
54011
|
workspaceKind,
|
|
53807
54012
|
workspaceId,
|
|
53808
54013
|
workspaceName,
|
|
53809
|
-
path:
|
|
54014
|
+
path: path64,
|
|
53810
54015
|
status: action === "pin" ? "pinned" : action === "save_for_later" ? "saved_for_later" : "none",
|
|
53811
54016
|
sourceSessionId: session.id
|
|
53812
54017
|
});
|
|
53813
54018
|
const changed = response.items.find(
|
|
53814
|
-
(item) => item.workspaceKind === workspaceKind && item.workspaceId === workspaceId && item.path ===
|
|
54019
|
+
(item) => item.workspaceKind === workspaceKind && item.workspaceId === workspaceId && item.path === path64
|
|
53815
54020
|
) ?? null;
|
|
53816
54021
|
const verb = action === "pin" ? "Pinned" : action === "save_for_later" ? "Saved" : "Removed";
|
|
53817
54022
|
return {
|
|
53818
54023
|
...response,
|
|
53819
54024
|
changed,
|
|
53820
|
-
nextStep: `${verb} ${
|
|
54025
|
+
nextStep: `${verb} ${path64}${action === "save_for_later" ? " for later" : ""}.`
|
|
53821
54026
|
};
|
|
53822
54027
|
},
|
|
53823
54028
|
listIntegrationConnections: listSandboxIntegrationConnections,
|
|
@@ -54410,6 +54615,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
54410
54615
|
openEventSubscriber,
|
|
54411
54616
|
refreshCodexStatus,
|
|
54412
54617
|
bootstrapPayload,
|
|
54618
|
+
localProjectActionCatalogPayload,
|
|
54413
54619
|
skillSourceFilePayload,
|
|
54414
54620
|
extensionCatalogPayload,
|
|
54415
54621
|
extensionPreviewPayload,
|