openpond 0.0.55 → 0.0.57

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.
Files changed (100) hide show
  1. package/README.md +3 -0
  2. package/dist/chunks/actions-command-YY7UH37B.js +145 -0
  3. package/dist/chunks/{app-layer-T26MAAGI.js → app-layer-EZQWXB3S.js} +2 -2
  4. package/dist/chunks/{app-server-runtime-LFOOLDB5.js → app-server-runtime-JMEHVOFO.js} +6 -6
  5. package/dist/chunks/{apps-7KLTYKHN.js → apps-HHQF6TNR.js} +2 -2
  6. package/dist/chunks/{chunk-6QWTEC2D.js → chunk-42GGG3W4.js} +1 -1
  7. package/dist/chunks/{chunk-JSRCXDIL.js → chunk-5QJGC2QI.js} +46 -32
  8. package/dist/chunks/{chunk-CW4QSUDH.js → chunk-5Y7Q6ZSH.js} +1 -1
  9. package/dist/chunks/{chunk-55KT7K5P.js → chunk-5ZLFZZLS.js} +2 -1
  10. package/dist/chunks/{chunk-IPAZ4FVZ.js → chunk-7JUIWABV.js} +5 -5
  11. package/dist/chunks/{chunk-M2OSF2YN.js → chunk-OJ34YA7E.js} +1 -1
  12. package/dist/chunks/chunk-QETF6ILG.js +15004 -0
  13. package/dist/chunks/{chunk-EIRW6Z6S.js → chunk-UBHCG2NE.js} +1 -1
  14. package/dist/chunks/{chunk-US7DOPAH.js → chunk-VG4H4TQG.js} +65 -58
  15. package/dist/chunks/{chunk-LACG7NNI.js → chunk-XHTO6KF2.js} +1 -1
  16. package/dist/chunks/{chunk-OVE6IFEM.js → chunk-XX6KALN2.js} +391 -74
  17. package/dist/chunks/{cli-7SSGEHXC.js → cli-EUZHWEJR.js} +5 -5
  18. package/dist/chunks/{core-commands-SND555SC.js → core-commands-RI4B7TYM.js} +3 -3
  19. package/dist/chunks/{desktop-test-WSWXNSFS.js → desktop-test-DRTCQWDV.js} +2 -2
  20. package/dist/chunks/{extension-3IKF6YQE.js → extension-XMWCG6YG.js} +9 -9
  21. package/dist/chunks/{help-DHGNXUA4.js → help-UILXBPHG.js} +1 -1
  22. package/dist/chunks/{opchat-XYKT5KKO.js → opchat-SSK54JSR.js} +2 -2
  23. package/dist/chunks/{organizations-HKVC4CSA.js → organizations-G5S2HJLT.js} +4 -4
  24. package/dist/chunks/{profile-PLWXQHKF.js → profile-YD7NYL3U.js} +2 -2
  25. package/dist/chunks/{project-agent-JNSP56KG.js → project-agent-75PAFL6B.js} +2 -2
  26. package/dist/chunks/{sandbox-command-Z6LNNSSL.js → sandbox-command-FGUJDDXR.js} +2 -2
  27. package/dist/chunks/{sandbox-template-FVW2UTI4.js → sandbox-template-PBSIPCVO.js} +3 -3
  28. package/dist/chunks/{src-2TP42H76.js → src-FTG6DVBK.js} +3 -3
  29. package/dist/chunks/{src-SRYGTCYI.js → src-P7YLMEEK.js} +613 -471
  30. package/dist/chunks/{teams-bot-FNPT4Q2B.js → teams-bot-NSYWELB6.js} +2 -2
  31. package/dist/chunks/{workspaces-VFM7AUWY.js → workspaces-R3EVRSWA.js} +2 -2
  32. package/dist/cli.js +13 -13
  33. package/dist/web/assets/{AppDialog-BEKS_Ixr.js → AppDialog-CxLYXiI1.js} +1 -1
  34. package/dist/web/assets/{AppsView-CbuT2sT2.js → AppsView-CVTUkahv.js} +1 -1
  35. package/dist/web/assets/{BrowserSidebar-DgqVeW5u.js → BrowserSidebar-oHniLA05.js} +1 -1
  36. package/dist/web/assets/{CommandMenu-CQcaEB76.js → CommandMenu-Db_5OiKs.js} +1 -1
  37. package/dist/web/assets/{CommunityView-CYX6iFcg.js → CommunityView-HTwMEO-T.js} +1 -1
  38. package/dist/web/assets/{ComposerCreateImproveStrip-DY4SQbL4.js → ComposerCreateImproveStrip-ER26yFe-.js} +1 -1
  39. package/dist/web/assets/{GetStartedView-DnxeZaBB.js → GetStartedView-l9MUYMYH.js} +1 -1
  40. package/dist/web/assets/{LabModelVersionDetailPage-DYTfYGWv.js → LabModelVersionDetailPage-Dgf-DlJi.js} +1 -1
  41. package/dist/web/assets/{LabSkillSidebar-BpD-kjP_.js → LabSkillSidebar-CyX8sVm1.js} +1 -1
  42. package/dist/web/assets/{LabsRoute-DVC7eZCs.js → LabsRoute-BC1ST9qT.js} +3 -3
  43. package/dist/web/assets/{MainChatThread-DTiX_8MC.js → MainChatThread-BfW92Rv1.js} +2 -2
  44. package/dist/web/assets/{MainPane-CNoHJkXy.js → MainPane-DlciH8yR.js} +3 -3
  45. package/dist/web/assets/{MarkdownText-_JhfBcQL.js → MarkdownText-CyOeCVjf.js} +1 -1
  46. package/dist/web/assets/{Messages-Bo0-Uvcz.js → Messages-BDtEbIKv.js} +1 -1
  47. package/dist/web/assets/{NativeSkillSidebar-CHQ87FW2.js → NativeSkillSidebar-D0BlvEtE.js} +1 -1
  48. package/dist/web/assets/{NewProjectDialog-B-1KuU5u.js → NewProjectDialog-CiGPfI5s.js} +1 -1
  49. package/dist/web/assets/{OutputsPage-BSimpEpA.js → OutputsPage-DNU2yD7q.js} +1 -1
  50. package/dist/web/assets/{RightChatPanelStack-B8ZOyuFO.js → RightChatPanelStack-Cs63fQwk.js} +1 -1
  51. package/dist/web/assets/{ScheduledWorkPage-Blwy1G8r.js → ScheduledWorkPage-DMKHFbeE.js} +1 -1
  52. package/dist/web/assets/{SettingsView-CTLTakyn.js → SettingsView-L0g-g2fL.js} +3 -3
  53. package/dist/web/assets/{TeamChatView-dN3fUCbZ.js → TeamChatView-CSVMTUAE.js} +1 -1
  54. package/dist/web/assets/{TerminalOverlay-CPVGeO7U.js → TerminalOverlay-Bb0RJR04.js} +1 -1
  55. package/dist/web/assets/{TrainingCreationPanel-ettNNJBP.js → TrainingCreationPanel-VIWlpVV2.js} +1 -1
  56. package/dist/web/assets/{TrainingDraftPanel-DUJBuII1.js → TrainingDraftPanel-MTYsR-Ry.js} +1 -1
  57. package/dist/web/assets/{UsageSettingsSection-BOZR3JE_.js → UsageSettingsSection-Cdc_jGFX.js} +1 -1
  58. package/dist/web/assets/{WorkspaceDiffPanel-99MjzMkW.js → WorkspaceDiffPanel-BgIbxMMu.js} +3 -3
  59. package/dist/web/assets/{WorkspaceEnvironmentMenu-C3s3mTyu.js → WorkspaceEnvironmentMenu-C97GqYn9.js} +1 -1
  60. package/dist/web/assets/{WorkspaceGitDialogs-BvurXjNP.js → WorkspaceGitDialogs-CK6ahRty.js} +1 -1
  61. package/dist/web/assets/{WorkspaceMonacoEditor-BCXg9mBQ.js → WorkspaceMonacoEditor-BQoN7jWa.js} +3 -3
  62. package/dist/web/assets/{arrow-up-right-DRIT5z3q.js → arrow-up-right-CzBZuWNj.js} +1 -1
  63. package/dist/web/assets/{chevron-up-Hglu-Zx3.js → chevron-up-DW-qEVSP.js} +1 -1
  64. package/dist/web/assets/{circle-alert-Crh3Zr2m.js → circle-alert-B_xROoPY.js} +1 -1
  65. package/dist/web/assets/{cloud-upload-mSm9KIL4.js → cloud-upload-CjLR-8-r.js} +1 -1
  66. package/dist/web/assets/{cssMode-CkQ4x6JA.js → cssMode-CQQJhS7v.js} +1 -1
  67. package/dist/web/assets/{folder-git-2-B8TV5i0V.js → folder-git-2-ktXin28y.js} +1 -1
  68. package/dist/web/assets/{folder-open-DXaun_C3.js → folder-open-BpUcIJHn.js} +1 -1
  69. package/dist/web/assets/{folder-plus-CUbTwu82.js → folder-plus-8NHsIAxQ.js} +1 -1
  70. package/dist/web/assets/{folder-DMeODEQJ.js → folder-tLv6TMN2.js} +1 -1
  71. package/dist/web/assets/{git-branch-CUlgF0kK.js → git-branch-DO3iP_fL.js} +1 -1
  72. package/dist/web/assets/{git-commit-horizontal-DAQfyhbS.js → git-commit-horizontal-BSWa2I3g.js} +1 -1
  73. package/dist/web/assets/{htmlMode-BfyAplZo.js → htmlMode-DaAKO9wk.js} +1 -1
  74. package/dist/web/assets/index-BtiK52K1.js +1 -0
  75. package/dist/web/assets/index-DHxBMQIJ.js +174 -0
  76. package/dist/web/assets/{info-Ll3PkeGE.js → info-DiEvrUda.js} +1 -1
  77. package/dist/web/assets/{jsonMode-C9Vibh0P.js → jsonMode-Biu1ZTZ7.js} +1 -1
  78. package/dist/web/assets/{lspLanguageFeatures-CFoA9--Z.js → lspLanguageFeatures-lwoDxGgl.js} +1 -1
  79. package/dist/web/assets/{monaco.contribution-C2q-tDuk.js → monaco.contribution-BqQSY5-t.js} +2 -2
  80. package/dist/web/assets/{monaco.contribution-C8tRjUqy.js → monaco.contribution-Ce2MS2Nv.js} +2 -2
  81. package/dist/web/assets/{monaco.contribution-vWDjhuCI.js → monaco.contribution-DzHhgeLy.js} +2 -2
  82. package/dist/web/assets/{monaco.contribution-Co4ZPnCC.js → monaco.contribution-Ic8LKME8.js} +2 -2
  83. package/dist/web/assets/{play-lC5KpmRD.js → play-D9F3t5Cx.js} +1 -1
  84. package/dist/web/assets/{python-I5xkyvMs.js → python-BhVCwr-K.js} +1 -1
  85. package/dist/web/assets/{refresh-cw-8a_wz4tX.js → refresh-cw-DRN17xPU.js} +1 -1
  86. package/dist/web/assets/{save-Dj9ex3Ce.js → save-CDZwpzlG.js} +1 -1
  87. package/dist/web/assets/{square-DfEM9XgY.js → square-Cf_AXs4a.js} +1 -1
  88. package/dist/web/assets/{square-pen-CgX3HoJ6.js → square-pen-ChJgNiDm.js} +1 -1
  89. package/dist/web/assets/{toggleHighContrast-BkNzz1Bg.js → toggleHighContrast-Bb_m9pXM.js} +1 -1
  90. package/dist/web/assets/{tsMode-CNwaV0ZJ.js → tsMode-BaWkaSHN.js} +1 -1
  91. package/dist/web/assets/{upload-Co5zYY9Z.js → upload-Cef29aCP.js} +1 -1
  92. package/dist/web/assets/{useLocalAgentSchedules-QY4_XS2F.js → useLocalAgentSchedules-CAAqoZ0V.js} +1 -1
  93. package/dist/web/assets/{wifi-off-CFzyn7Tf.js → wifi-off-C8cC22F6.js} +1 -1
  94. package/dist/web/assets/{workers-DqFxl1zu.js → workers-GOdHtcZt.js} +1 -1
  95. package/dist/web/assets/{yaml-Bbm66uDK.js → yaml-jBIxwMeR.js} +1 -1
  96. package/dist/web/index.html +1 -1
  97. package/docs/command-reference.md +15 -0
  98. package/package.json +2 -1
  99. package/dist/web/assets/index-Blindd8c.js +0 -1
  100. 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-OVE6IFEM.js";
121
- import {
122
- runOpenPondServerCli
123
- } from "./chunk-IPAZ4FVZ.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-XX6KALN2.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-CW4QSUDH.js";
148
+ } from "./chunk-5Y7Q6ZSH.js";
149
+ import {
150
+ runOpenPondServerCli
151
+ } from "./chunk-7JUIWABV.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-LACG7NNI.js";
167
+ } from "./chunk-XHTO6KF2.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-UBHCG2NE.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-55KT7K5P.js";
415
+ } from "./chunk-5ZLFZZLS.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,7 +457,7 @@ import {
451
457
  workEvidenceReceiptRef,
452
458
  workSourceOpaqueRef,
453
459
  workWorkspaceOpaqueRef
454
- } from "./chunk-US7DOPAH.js";
460
+ } from "./chunk-VG4H4TQG.js";
455
461
  import {
456
462
  external_exports,
457
463
  yaml
@@ -13312,9 +13318,9 @@ var require_dist = __commonJS({
13312
13318
  });
13313
13319
 
13314
13320
  // ../server/src/index.ts
13315
- import path62 from "node:path";
13321
+ import path63 from "node:path";
13316
13322
  import { randomUUID as randomUUID25 } from "node:crypto";
13317
- import { promises as fs26 } from "node:fs";
13323
+ import { promises as fs27 } from "node:fs";
13318
13324
 
13319
13325
  // ../../packages/codex-provider/dist/client.js
13320
13326
  import { spawn } from "node:child_process";
@@ -14877,7 +14883,7 @@ function createCodexRuntimeManager({
14877
14883
 
14878
14884
  // ../server/src/api/server-payloads.ts
14879
14885
  import { randomUUID as randomUUID3 } from "node:crypto";
14880
- import path21 from "node:path";
14886
+ import path22 from "node:path";
14881
14887
 
14882
14888
  // ../server/src/codex-personal-skills.ts
14883
14889
  import { createHash } from "node:crypto";
@@ -20699,8 +20705,8 @@ async function organizationRequestPayload(action) {
20699
20705
  }
20700
20706
  throw new Error(`Unsupported organization action: ${action.type}`);
20701
20707
  }
20702
- async function openPondApiRequest(apiBaseUrl, token, path63, init = {}) {
20703
- const response = await apiFetch(apiBaseUrl, token, path63, init);
20708
+ async function openPondApiRequest(apiBaseUrl, token, path64, init = {}) {
20709
+ const response = await apiFetch(apiBaseUrl, token, path64, init);
20704
20710
  const payload = await response.json().catch(() => ({}));
20705
20711
  if (!response.ok) {
20706
20712
  const message2 = typeof payload.message === "string" ? payload.message : typeof payload.error === "string" ? payload.error : response.statusText;
@@ -23605,6 +23611,53 @@ function createProfilePayloads(deps) {
23605
23611
  };
23606
23612
  }
23607
23613
 
23614
+ // ../server/src/project-actions/local-project-actions.ts
23615
+ import path21 from "node:path";
23616
+ import { promises as fs13 } from "node:fs";
23617
+ async function localProjectActionCatalog(project) {
23618
+ const sourceDirectory = await projectActionSourceDirectory(project.workspacePath);
23619
+ const sourceStats = await fs13.stat(sourceDirectory).catch(() => null);
23620
+ if (!sourceStats?.isDirectory()) return [];
23621
+ const runner = createLocalActionRunner({
23622
+ projectRoot: project.workspacePath,
23623
+ build: "always"
23624
+ });
23625
+ const registry = await runner.catalog();
23626
+ return registry.actions.map(
23627
+ (action) => OpenPondActionCatalogEntrySchema.parse({
23628
+ ...action,
23629
+ sourcePath: project.workspacePath,
23630
+ implementation: {
23631
+ ...action.implementation,
23632
+ projectId: project.id,
23633
+ projectRoot: path21.resolve(project.workspacePath)
23634
+ }
23635
+ })
23636
+ );
23637
+ }
23638
+ async function runLocalProjectAction(input) {
23639
+ return createLocalActionRunner({
23640
+ projectRoot: input.projectRoot,
23641
+ build: "always"
23642
+ }).run({
23643
+ actionId: input.actionId,
23644
+ input: input.value,
23645
+ runId: input.runId,
23646
+ idempotencyKey: input.idempotencyKey,
23647
+ signal: input.signal
23648
+ });
23649
+ }
23650
+ async function projectActionSourceDirectory(projectRoot) {
23651
+ try {
23652
+ const configuration = await loadProjectActionConfiguration(projectRoot);
23653
+ return path21.resolve(projectRoot, configuration.sourceDirectory ?? "openpond/actions");
23654
+ } catch (error) {
23655
+ throw new Error(
23656
+ `Cannot load ${PROJECT_ACTION_CONFIG_PATH}: ${error instanceof Error ? error.message : String(error)}`
23657
+ );
23658
+ }
23659
+ }
23660
+
23608
23661
  // ../server/src/training/managed-adapter-models.ts
23609
23662
  async function listManagedAdapterProviderModels(store) {
23610
23663
  const [lineages, bindings, modelProjects] = await Promise.all([
@@ -23687,7 +23740,7 @@ function createServerPayloads(deps) {
23687
23740
  appendRuntimeEvent,
23688
23741
  isClosing
23689
23742
  } = deps;
23690
- const attachmentRootDir = deps.attachmentRootDir ?? path21.join(storeDir, "attachments");
23743
+ const attachmentRootDir = deps.attachmentRootDir ?? path22.join(storeDir, "attachments");
23691
23744
  const {
23692
23745
  appendAppPage,
23693
23746
  loadOpenPondData,
@@ -24166,11 +24219,11 @@ function createServerPayloads(deps) {
24166
24219
  (candidate2) => candidate2.name === skillName
24167
24220
  );
24168
24221
  if (!skill) throw new Error(`Profile skill not found: ${skillName}`);
24169
- const absoluteSkillPath = path21.resolve(skill.sourcePath, skill.path);
24222
+ const absoluteSkillPath = path22.resolve(skill.sourcePath, skill.path);
24170
24223
  return readSkillSourceFile({
24171
24224
  skillName,
24172
24225
  scope,
24173
- packageRoot: path21.dirname(absoluteSkillPath),
24226
+ packageRoot: path22.dirname(absoluteSkillPath),
24174
24227
  relativeFilePath: filePath
24175
24228
  });
24176
24229
  }
@@ -24466,6 +24519,14 @@ Uploaded from OpenPond Desktop.
24466
24519
  }
24467
24520
  };
24468
24521
  }
24522
+ async function localProjectActionCatalogPayload(projectId) {
24523
+ const localProject = await findLocalProject(store, projectId);
24524
+ if (!localProject) throw new Error("Project workspace not found");
24525
+ return {
24526
+ projectId: localProject.id,
24527
+ actions: await localProjectActionCatalog(localProject)
24528
+ };
24529
+ }
24469
24530
  async function uploadLocalProjectCloudSourcePayload(projectId, payload) {
24470
24531
  const input = UploadLocalProjectCloudSourceRequestSchema.parse(payload);
24471
24532
  const localProject = await findLocalProject(store, projectId);
@@ -25002,6 +25063,7 @@ Uploaded from OpenPond Desktop.
25002
25063
  ...workspacePayloads,
25003
25064
  previewLocalProjectCloudSourcePayload,
25004
25065
  uploadLocalProjectCloudSourcePayload,
25066
+ localProjectActionCatalogPayload,
25005
25067
  patchSidebarAppPreference,
25006
25068
  listSidebarFileBookmarksPayload,
25007
25069
  patchSidebarFileBookmarkPayload,
@@ -25017,6 +25079,55 @@ Uploaded from OpenPond Desktop.
25017
25079
  };
25018
25080
  }
25019
25081
 
25082
+ // ../server/src/project-actions/project-action-payload.ts
25083
+ function createProjectActionRunPayload(deps) {
25084
+ return async function projectActionRunPayload(payload) {
25085
+ const input = asRecord5(payload);
25086
+ const action = stringValue5(input.action) ?? stringValue5(input.actionName);
25087
+ if (!action) throw new Error("Project Action name is required.");
25088
+ const metadata = asRecord5(input.metadata);
25089
+ const projectId = stringValue5(metadata.projectId);
25090
+ if (!projectId) throw new Error("Project Action Project id is required.");
25091
+ const projectRoot = await deps.resolveProjectRoot(projectId);
25092
+ if (!projectRoot) throw new Error("Project Action Project is not registered locally.");
25093
+ const sessionId = stringValue5(metadata.sessionId);
25094
+ const turnId = stringValue5(metadata.turnId) ?? `openpond_project_action_${Date.now()}`;
25095
+ const toolCallId = stringValue5(metadata.toolCallId);
25096
+ const result = await runLocalProjectAction({
25097
+ projectRoot,
25098
+ actionId: action,
25099
+ value: input.input ?? {},
25100
+ runId: toolCallId ?? void 0,
25101
+ idempotencyKey: toolCallId ? `${turnId}:${toolCallId}` : null
25102
+ });
25103
+ if (sessionId) {
25104
+ await deps.appendRuntimeEvent(event({
25105
+ name: "workspace_action_result",
25106
+ sessionId,
25107
+ turnId,
25108
+ source: "chat_action",
25109
+ action: "project_action_run",
25110
+ appId: null,
25111
+ status: "completed",
25112
+ output: JSON.stringify(result.output),
25113
+ data: {
25114
+ openPondProjectActionRun: true,
25115
+ action: {
25116
+ name: action,
25117
+ label: stringValue5(metadata.selectedActionLabel) ?? action
25118
+ },
25119
+ runId: result.runId,
25120
+ traces: result.traces,
25121
+ outputs: result.outputs,
25122
+ outputDirectory: result.outputDirectory,
25123
+ durationMs: result.durationMs
25124
+ }
25125
+ }));
25126
+ }
25127
+ return result;
25128
+ };
25129
+ }
25130
+
25020
25131
  // ../server/src/api/event-page.ts
25021
25132
  var DEFAULT_EVENT_PAGE_LIMIT = 100;
25022
25133
  var MAX_EVENT_PAGE_LIMIT = 500;
@@ -26187,11 +26298,11 @@ async function communityRequestPayload(action, dependencies = {}) {
26187
26298
  const payload = await requestCommunityApi(request.path, request.init, dependencies);
26188
26299
  return schemaForAction(action).parse(payload);
26189
26300
  }
26190
- async function requestCommunityApi(path63, init = {}, dependencies = {}) {
26301
+ async function requestCommunityApi(path64, init = {}, dependencies = {}) {
26191
26302
  const access5 = await resolveHostedApiAccess(dependencies);
26192
26303
  const headers = hostedApiAuthHeaders(access5.token);
26193
26304
  headers.set("Content-Type", "application/json");
26194
- const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${path63}`, {
26305
+ const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${path64}`, {
26195
26306
  ...init,
26196
26307
  headers
26197
26308
  });
@@ -26360,11 +26471,11 @@ async function uploadCommunityAttachment(action, dependencies) {
26360
26471
  )
26361
26472
  );
26362
26473
  }
26363
- function post(path63, body) {
26364
- return jsonRequest(path63, "POST", body);
26474
+ function post(path64, body) {
26475
+ return jsonRequest(path64, "POST", body);
26365
26476
  }
26366
- function jsonRequest(path63, method, body) {
26367
- return { path: path63, init: { method, body: JSON.stringify(body) } };
26477
+ function jsonRequest(path64, method, body) {
26478
+ return { path: path64, init: { method, body: JSON.stringify(body) } };
26368
26479
  }
26369
26480
 
26370
26481
  // ../server/src/api/routes/community-routes.ts
@@ -26664,7 +26775,7 @@ async function handleDesktopBrowserRoutes({
26664
26775
  // ../server/src/api/signed-workspace-image.ts
26665
26776
  import { createHmac, timingSafeEqual } from "node:crypto";
26666
26777
  import { Buffer as Buffer6 } from "node:buffer";
26667
- import path22 from "node:path";
26778
+ import path23 from "node:path";
26668
26779
  var SIGNED_WORKSPACE_IMAGE_TTL_MS = 5 * 60 * 1e3;
26669
26780
  var CHAT_ATTACHMENT_IMAGE_CONTENT_TYPES = /* @__PURE__ */ new Set(["image/gif", "image/jpeg", "image/png", "image/webp"]);
26670
26781
  function signedWorkspaceImageUrlPayload(input, requestUrl, token) {
@@ -26736,13 +26847,13 @@ function verifySignedWorkspaceImageRequest(requestUrl, token) {
26736
26847
  if (!appId || !rawPath || !expiresRaw || !signature) {
26737
26848
  return { ok: false, status: 401, error: "Signed asset URL is missing required claims." };
26738
26849
  }
26739
- const path63 = normalizeSignedWorkspaceImagePath(rawPath);
26850
+ const path64 = normalizeSignedWorkspaceImagePath(rawPath);
26740
26851
  const expiresAt = Number(expiresRaw);
26741
- if (!path63 || !Number.isInteger(expiresAt)) {
26852
+ if (!path64 || !Number.isInteger(expiresAt)) {
26742
26853
  return { ok: false, status: 401, error: "Signed asset URL is invalid." };
26743
26854
  }
26744
26855
  if (expiresAt < Date.now()) return { ok: false, status: 401, error: "Signed asset URL expired." };
26745
- const claims = { appId: appId.trim(), path: path63, expiresAt };
26856
+ const claims = { appId: appId.trim(), path: path64, expiresAt };
26746
26857
  if (!safeSignatureEqual(signature, signWorkspaceImageClaims(claims, token))) {
26747
26858
  return { ok: false, status: 401, error: "Signed asset URL signature is invalid." };
26748
26859
  }
@@ -26836,9 +26947,9 @@ function requiredSearchParam(requestUrl, name) {
26836
26947
  }
26837
26948
  function normalizeSignedWorkspaceImagePath(value) {
26838
26949
  if (/^file:\/\//i.test(value) || /^\//.test(value) || /^[A-Za-z]:[\\/]/.test(value)) return null;
26839
- const path63 = normalizeWorkspaceFilePath(value);
26840
- if (!path63 || !workspaceImageContentType(path63)) return null;
26841
- return path63;
26950
+ const path64 = normalizeWorkspaceFilePath(value);
26951
+ if (!path64 || !workspaceImageContentType(path64)) return null;
26952
+ return path64;
26842
26953
  }
26843
26954
  function normalizeSignedLocalImagePath(value) {
26844
26955
  const cleaned = normalizeSignedLocalAssetPath(value);
@@ -26860,8 +26971,8 @@ function normalizeSignedLocalAssetPath(value) {
26860
26971
  cleaned = cleaned.replace(/^file:\/\//, "");
26861
26972
  }
26862
26973
  }
26863
- if (!path22.isAbsolute(cleaned)) return null;
26864
- return path22.resolve(cleaned);
26974
+ if (!path23.isAbsolute(cleaned)) return null;
26975
+ return path23.resolve(cleaned);
26865
26976
  }
26866
26977
  function normalizeSignedChatAttachmentStorageName(value) {
26867
26978
  const trimmed = value.trim();
@@ -27260,9 +27371,23 @@ async function handleProjectCloudRoutes({ deps, request, requestUrl, response })
27260
27371
  createLocalProjectPayload,
27261
27372
  previewLocalProjectCloudSourcePayload,
27262
27373
  uploadLocalProjectCloudSourcePayload,
27374
+ localProjectActionCatalogPayload,
27263
27375
  updateLocalProjectAgentSetupPayload,
27264
27376
  deleteLocalProjectPayload
27265
27377
  } = deps;
27378
+ const localProjectActionsMatch = /^\/v1\/projects\/([^/]+)\/actions$/.exec(
27379
+ requestUrl.pathname
27380
+ );
27381
+ if (request.method === "GET" && localProjectActionsMatch) {
27382
+ sendJson(
27383
+ response,
27384
+ 200,
27385
+ await localProjectActionCatalogPayload(
27386
+ decodeURIComponent(localProjectActionsMatch[1])
27387
+ )
27388
+ );
27389
+ return true;
27390
+ }
27266
27391
  if (request.method === "POST" && requestUrl.pathname === "/v1/projects") {
27267
27392
  sendJson(response, 201, await createLocalProjectPayload(await readJson(request)));
27268
27393
  return true;
@@ -28424,13 +28549,13 @@ function decode2(value) {
28424
28549
  // ../server/src/api/routes/training-routes.ts
28425
28550
  import { createReadStream as createReadStream3 } from "node:fs";
28426
28551
  import { stat as stat3 } from "node:fs/promises";
28427
- import path24 from "node:path";
28552
+ import path25 from "node:path";
28428
28553
 
28429
28554
  // ../server/src/training/training-artifact-package.ts
28430
28555
  import { createReadStream as createReadStream2 } from "node:fs";
28431
28556
  import { once } from "node:events";
28432
28557
  import { stat as stat2 } from "node:fs/promises";
28433
- import path23 from "node:path";
28558
+ import path24 from "node:path";
28434
28559
  var TAR_BLOCK_BYTES = 512;
28435
28560
  var PORTABLE_MODEL_FILENAMES = /* @__PURE__ */ new Set([
28436
28561
  "adapter_model.safetensors",
@@ -28448,7 +28573,7 @@ function selectPortableModelArtifacts(artifacts) {
28448
28573
  continue;
28449
28574
  }
28450
28575
  const normalized = providerFilename.replaceAll("\\", "/");
28451
- const name = path23.posix.basename(normalized);
28576
+ const name = path24.posix.basename(normalized);
28452
28577
  if (!PORTABLE_MODEL_FILENAMES.has(name) && !SHARDED_ADAPTER_WEIGHTS_PATTERN.test(name)) continue;
28453
28578
  const candidate2 = { artifact, name, providerFilename };
28454
28579
  const current = selected.get(name);
@@ -28581,7 +28706,7 @@ async function handleTrainingRoutes({ deps, request, requestUrl, response }) {
28581
28706
  const result = await deps.trainingPayload("artifact_download", { artifactId: decodeURIComponent(downloadMatch[1]) }, requestUrl);
28582
28707
  const info = await stat3(result.path);
28583
28708
  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="${path24.basename(result.path).replaceAll('"', "")}"`, "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff" });
28709
+ 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
28710
  createReadStream3(result.path).pipe(response);
28586
28711
  return true;
28587
28712
  }
@@ -29211,8 +29336,8 @@ function normalizeRoutePath(pathValue) {
29211
29336
 
29212
29337
  // ../server/src/api/static-web.ts
29213
29338
  import { createReadStream as createReadStream5 } from "node:fs";
29214
- import { promises as fs13 } from "node:fs";
29215
- import path25 from "node:path";
29339
+ import { promises as fs14 } from "node:fs";
29340
+ import path26 from "node:path";
29216
29341
  var API_PATH_PREFIXES = ["/v1/"];
29217
29342
  var API_PATHS = /* @__PURE__ */ new Set(["/health"]);
29218
29343
  var ONE_YEAR_SECONDS = 31536e3;
@@ -29239,7 +29364,7 @@ function shouldPassToApi(request, pathname) {
29239
29364
  return request.method !== "GET" && request.method !== "HEAD";
29240
29365
  }
29241
29366
  function contentType(filePath) {
29242
- return MIME_TYPES[path25.extname(filePath).toLowerCase()] ?? "application/octet-stream";
29367
+ return MIME_TYPES[path26.extname(filePath).toLowerCase()] ?? "application/octet-stream";
29243
29368
  }
29244
29369
  function safeResolve(root, pathname) {
29245
29370
  let decoded;
@@ -29249,23 +29374,23 @@ function safeResolve(root, pathname) {
29249
29374
  return null;
29250
29375
  }
29251
29376
  const relative2 = decoded.replace(/^\/+/, "") || "index.html";
29252
- const resolved = path25.resolve(root, relative2);
29253
- const relativeToRoot = path25.relative(root, resolved);
29254
- if (relativeToRoot === "" || !relativeToRoot.startsWith("..") && !path25.isAbsolute(relativeToRoot)) {
29377
+ const resolved = path26.resolve(root, relative2);
29378
+ const relativeToRoot = path26.relative(root, resolved);
29379
+ if (relativeToRoot === "" || !relativeToRoot.startsWith("..") && !path26.isAbsolute(relativeToRoot)) {
29255
29380
  return resolved;
29256
29381
  }
29257
29382
  return null;
29258
29383
  }
29259
29384
  async function fileStat(filePath) {
29260
29385
  try {
29261
- const stat7 = await fs13.stat(filePath);
29386
+ const stat7 = await fs14.stat(filePath);
29262
29387
  return stat7.isFile() ? stat7 : null;
29263
29388
  } catch {
29264
29389
  return null;
29265
29390
  }
29266
29391
  }
29267
29392
  function cacheControl(filePath) {
29268
- const normalized = filePath.split(path25.sep).join("/");
29393
+ const normalized = filePath.split(path26.sep).join("/");
29269
29394
  return normalized.includes("/assets/") ? `public, max-age=${ONE_YEAR_SECONDS}, immutable` : "no-cache";
29270
29395
  }
29271
29396
  function sendFile(request, response, filePath, stat7) {
@@ -29293,7 +29418,7 @@ async function sendIndex({
29293
29418
  indexPath,
29294
29419
  token
29295
29420
  }) {
29296
- let html = await fs13.readFile(indexPath, "utf8");
29421
+ let html = await fs14.readFile(indexPath, "utf8");
29297
29422
  if (isLoopbackHost(requestUrl.hostname)) {
29298
29423
  const connectionScript = `<script>window.__OPENPOND_WEB_CONNECTION__=${escapeScriptJson(
29299
29424
  JSON.stringify({
@@ -29329,8 +29454,8 @@ function createStaticWebHandler({
29329
29454
  token,
29330
29455
  webRoot
29331
29456
  }) {
29332
- const root = path25.resolve(webRoot);
29333
- const indexPath = path25.join(root, "index.html");
29457
+ const root = path26.resolve(webRoot);
29458
+ const indexPath = path26.join(root, "index.html");
29334
29459
  return (request, response, next) => {
29335
29460
  void (async () => {
29336
29461
  const requestUrl = new URL(request.url ?? "/", `http://${request.headers.host ?? "127.0.0.1"}`);
@@ -29352,7 +29477,7 @@ function createStaticWebHandler({
29352
29477
  sendFile(request, response, resolved, directStat);
29353
29478
  return;
29354
29479
  }
29355
- if (path25.extname(requestUrl.pathname)) {
29480
+ if (path26.extname(requestUrl.pathname)) {
29356
29481
  sendNotFound(response);
29357
29482
  return;
29358
29483
  }
@@ -29375,7 +29500,7 @@ function createStaticWebHandler({
29375
29500
  import { Buffer as Buffer8 } from "node:buffer";
29376
29501
  import { existsSync as existsSync10, mkdtempSync, rmSync, statSync as statSync4, writeFileSync as writeFileSync3 } from "node:fs";
29377
29502
  import os7 from "node:os";
29378
- import path26 from "node:path";
29503
+ import path27 from "node:path";
29379
29504
  import { spawn as spawnPty } from "node-pty";
29380
29505
 
29381
29506
  // ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/wrapper.mjs
@@ -29434,25 +29559,25 @@ function send(socket, payload) {
29434
29559
  function defaultShell() {
29435
29560
  if (process.env.OPENPOND_TERMINAL_SHELL) {
29436
29561
  const command2 = process.env.OPENPOND_TERMINAL_SHELL;
29437
- return shellLaunch(command2, interactiveShellArgs(command2), path26.basename(command2));
29562
+ return shellLaunch(command2, interactiveShellArgs(command2), path27.basename(command2));
29438
29563
  }
29439
29564
  if (process.platform === "win32") {
29440
29565
  return { command: "powershell.exe", args: ["-NoLogo"], label: "PowerShell" };
29441
29566
  }
29442
29567
  const command = process.platform === "darwin" && existsSync10("/bin/zsh") ? "/bin/zsh" : "/bin/bash";
29443
- return shellLaunch(command, ["-i"], path26.basename(command) || "bash");
29568
+ return shellLaunch(command, ["-i"], path27.basename(command) || "bash");
29444
29569
  }
29445
29570
  function terminalPath() {
29446
29571
  return executableSearchPath();
29447
29572
  }
29448
29573
  function interactiveShellArgs(command) {
29449
29574
  if (process.platform === "win32") return [];
29450
- const name = path26.basename(command);
29575
+ const name = path27.basename(command);
29451
29576
  return name === "bash" || name === "zsh" || name === "fish" ? ["-i"] : [];
29452
29577
  }
29453
29578
  function safeCwd(input, fallback) {
29454
29579
  if (typeof input !== "string" || !input.trim()) return fallback;
29455
- const resolved = path26.resolve(input);
29580
+ const resolved = path27.resolve(input);
29456
29581
  try {
29457
29582
  return statSync4(resolved).isDirectory() ? resolved : fallback;
29458
29583
  } catch {
@@ -29470,14 +29595,14 @@ function terminalScopeLogValue(scope) {
29470
29595
  }
29471
29596
  function shellLaunch(command, fallbackArgs, label) {
29472
29597
  if (process.platform === "win32") return { command, args: fallbackArgs, label, integrationDir: null };
29473
- const name = path26.basename(command);
29598
+ const name = path27.basename(command);
29474
29599
  if (name === "bash") return bashShellLaunch(command, label);
29475
29600
  if (name === "zsh") return zshShellLaunch(command, label);
29476
29601
  if (name === "fish") return fishShellLaunch(command, label);
29477
29602
  return { command, args: fallbackArgs, label, integrationDir: null };
29478
29603
  }
29479
29604
  function createShellIntegrationDir() {
29480
- return mkdtempSync(path26.join(os7.tmpdir(), "openpond-terminal-"));
29605
+ return mkdtempSync(path27.join(os7.tmpdir(), "openpond-terminal-"));
29481
29606
  }
29482
29607
  function removeShellIntegrationDir(dir) {
29483
29608
  if (!dir) return;
@@ -29488,22 +29613,22 @@ function removeShellIntegrationDir(dir) {
29488
29613
  }
29489
29614
  function bashShellLaunch(command, label) {
29490
29615
  const integrationDir = createShellIntegrationDir();
29491
- const rcFile = path26.join(integrationDir, "openpond.bashrc");
29616
+ const rcFile = path27.join(integrationDir, "openpond.bashrc");
29492
29617
  writeFileSync3(rcFile, bashIntegrationScript(), "utf8");
29493
29618
  return {
29494
29619
  command,
29495
29620
  args: ["--rcfile", rcFile, "-i"],
29496
29621
  label,
29497
29622
  env: {
29498
- OPENPOND_ORIGINAL_BASHRC: path26.join(process.env.HOME ?? "", ".bashrc")
29623
+ OPENPOND_ORIGINAL_BASHRC: path27.join(process.env.HOME ?? "", ".bashrc")
29499
29624
  },
29500
29625
  integrationDir
29501
29626
  };
29502
29627
  }
29503
29628
  function zshShellLaunch(command, label) {
29504
29629
  const integrationDir = createShellIntegrationDir();
29505
- writeFileSync3(path26.join(integrationDir, ".zshenv"), zshEnvScript(), "utf8");
29506
- writeFileSync3(path26.join(integrationDir, ".zshrc"), zshIntegrationScript(), "utf8");
29630
+ writeFileSync3(path27.join(integrationDir, ".zshenv"), zshEnvScript(), "utf8");
29631
+ writeFileSync3(path27.join(integrationDir, ".zshrc"), zshIntegrationScript(), "utf8");
29507
29632
  return {
29508
29633
  command,
29509
29634
  args: ["-i"],
@@ -29517,7 +29642,7 @@ function zshShellLaunch(command, label) {
29517
29642
  }
29518
29643
  function fishShellLaunch(command, label) {
29519
29644
  const integrationDir = createShellIntegrationDir();
29520
- const scriptPath = path26.join(integrationDir, "openpond.fish");
29645
+ const scriptPath = path27.join(integrationDir, "openpond.fish");
29521
29646
  writeFileSync3(scriptPath, fishIntegrationScript(), "utf8");
29522
29647
  return {
29523
29648
  command,
@@ -30150,12 +30275,12 @@ import { randomUUID as randomUUID8 } from "node:crypto";
30150
30275
  import { Buffer as Buffer9 } from "node:buffer";
30151
30276
  import { spawn as spawn4 } from "node:child_process";
30152
30277
  import { randomUUID as randomUUID6 } from "node:crypto";
30153
- import { promises as fs15 } from "node:fs";
30154
- import path28 from "node:path";
30278
+ import { promises as fs16 } from "node:fs";
30279
+ import path29 from "node:path";
30155
30280
 
30156
30281
  // ../server/src/scaffold/sandbox-template-scaffold.ts
30157
- import { promises as fs14 } from "node:fs";
30158
- import path27 from "node:path";
30282
+ import { promises as fs15 } from "node:fs";
30283
+ import path28 from "node:path";
30159
30284
  async function writeSandboxTemplateScaffold(repoPath, input) {
30160
30285
  const manifestPath = normalizeManifestPath(input.manifestPath);
30161
30286
  const files = sandboxTemplateScaffoldFiles({ name: input.projectName });
@@ -30174,20 +30299,20 @@ async function writeSandboxTemplateScaffold(repoPath, input) {
30174
30299
  if (relativePath !== manifestPath) delete files[relativePath];
30175
30300
  }
30176
30301
  }
30177
- const existingManifest = path27.join(repoPath, manifestPath);
30302
+ const existingManifest = path28.join(repoPath, manifestPath);
30178
30303
  if (await fileExists3(existingManifest)) {
30179
30304
  throw new Error(`${manifestPath} already exists in this project.`);
30180
30305
  }
30181
30306
  for (const [relativePath, contents] of Object.entries(files)) {
30182
- const filePath = path27.join(repoPath, relativePath);
30183
- await fs14.mkdir(path27.dirname(filePath), { recursive: true });
30184
- await fs14.writeFile(filePath, contents, "utf8");
30307
+ const filePath = path28.join(repoPath, relativePath);
30308
+ await fs15.mkdir(path28.dirname(filePath), { recursive: true });
30309
+ await fs15.writeFile(filePath, contents, "utf8");
30185
30310
  }
30186
30311
  return { files: Object.keys(files).sort((left, right) => left.localeCompare(right)) };
30187
30312
  }
30188
30313
  function normalizeManifestPath(value) {
30189
30314
  const trimmed = value?.trim() || OPENPOND_MANIFEST_FILE_NAME;
30190
- const normalized = path27.posix.normalize(trimmed.replace(/\\/g, "/")).replace(/^\/+/, "");
30315
+ const normalized = path28.posix.normalize(trimmed.replace(/\\/g, "/")).replace(/^\/+/, "");
30191
30316
  if (!normalized || normalized === "." || normalized.startsWith("../") || normalized.includes("/../")) {
30192
30317
  throw new Error("Manifest path must stay inside the project.");
30193
30318
  }
@@ -30195,7 +30320,7 @@ function normalizeManifestPath(value) {
30195
30320
  }
30196
30321
  async function fileExists3(filePath) {
30197
30322
  try {
30198
- const stat7 = await fs14.stat(filePath);
30323
+ const stat7 = await fs15.stat(filePath);
30199
30324
  return stat7.isFile();
30200
30325
  } catch {
30201
30326
  return false;
@@ -30258,14 +30383,14 @@ ${diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).j
30258
30383
  const template = await readSandboxTemplateFromDisk(project);
30259
30384
  const manifest = validSandboxTemplateManifest(template);
30260
30385
  const rootPath = localProjectSandboxTemplateRootPath(project);
30261
- const outputPath = path28.join(rootPath, "dist", SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME);
30386
+ const outputPath = path29.join(rootPath, "dist", SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME);
30262
30387
  const plan = sandboxTemplateBuildPlan({
30263
30388
  manifest,
30264
- manifestFile: path28.relative(rootPath, template.manifestPath) || OPENPOND_MANIFEST_FILE_NAME,
30265
- projectRoot: path28.relative(path28.dirname(outputPath), rootPath) || "."
30389
+ manifestFile: path29.relative(rootPath, template.manifestPath) || OPENPOND_MANIFEST_FILE_NAME,
30390
+ projectRoot: path29.relative(path29.dirname(outputPath), rootPath) || "."
30266
30391
  });
30267
- await fs15.mkdir(path28.dirname(outputPath), { recursive: true });
30268
- await fs15.writeFile(outputPath, `${JSON.stringify(plan, null, 2)}
30392
+ await fs16.mkdir(path29.dirname(outputPath), { recursive: true });
30393
+ await fs16.writeFile(outputPath, `${JSON.stringify(plan, null, 2)}
30269
30394
  `, "utf8");
30270
30395
  return {
30271
30396
  session,
@@ -30273,7 +30398,7 @@ ${diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).j
30273
30398
  ok: true,
30274
30399
  action: input.action,
30275
30400
  appId: session.appId,
30276
- output: `Built sandbox template ${manifest.name} to ${path28.relative(rootPath, outputPath)}.`,
30401
+ output: `Built sandbox template ${manifest.name} to ${path29.relative(rootPath, outputPath)}.`,
30277
30402
  data: {
30278
30403
  projectId: project.id,
30279
30404
  manifestPath: template.manifestPath,
@@ -30501,7 +30626,7 @@ ${run.execution.output}`,
30501
30626
  async function readSandboxTemplateFromDisk(project) {
30502
30627
  const template = project.sandboxTemplate;
30503
30628
  if (!template?.detected) throw new Error("This project does not contain openpond.yaml.");
30504
- const validation = validateSandboxTemplateYaml(await fs15.readFile(template.manifestPath, "utf8"));
30629
+ const validation = validateSandboxTemplateYaml(await fs16.readFile(template.manifestPath, "utf8"));
30505
30630
  return {
30506
30631
  rootPath: template.rootPath,
30507
30632
  manifestPath: template.manifestPath,
@@ -31056,7 +31181,7 @@ async function uploadFilesToSandbox(sandboxId2, uploads, reportProgress) {
31056
31181
  return uploaded;
31057
31182
  }
31058
31183
  async function uploadLargeFileToSandbox(sandboxId2, uploadPath, contentsBase64, sizeBytes, reportProgress) {
31059
- const uploadDir = path28.posix.dirname(uploadPath);
31184
+ const uploadDir = path29.posix.dirname(uploadPath);
31060
31185
  const uploadId = randomUUID6();
31061
31186
  const chunkDir = `.openpond-upload/${uploadId}`;
31062
31187
  await reportSandboxTemplateProgress(
@@ -31270,11 +31395,11 @@ ${result.output}`);
31270
31395
  uploadedFiles.length ? `Prepared ${uploadedFiles.length} local input file${uploadedFiles.length === 1 ? "" : "s"}.` : "No local input files to prepare.",
31271
31396
  { phase: "local_upload", files: uploadedFiles }
31272
31397
  );
31273
- const replayParamsPath = path28.join(input.rootPath, "openpond-replay-params.json");
31398
+ const replayParamsPath = path29.join(input.rootPath, "openpond-replay-params.json");
31274
31399
  const replayJson = `${JSON.stringify({ input: input.params }, null, 2)}
31275
31400
  `;
31276
- await fs15.writeFile(replayParamsPath, replayJson, "utf8");
31277
- await reportSandboxTemplateProgress(input.reportProgress, `Wrote replay parameters to ${path28.relative(input.rootPath, replayParamsPath)}.`, {
31401
+ await fs16.writeFile(replayParamsPath, replayJson, "utf8");
31402
+ await reportSandboxTemplateProgress(input.reportProgress, `Wrote replay parameters to ${path29.relative(input.rootPath, replayParamsPath)}.`, {
31278
31403
  phase: "local_params",
31279
31404
  path: replayParamsPath
31280
31405
  });
@@ -31285,7 +31410,7 @@ ${result.output}`);
31285
31410
  });
31286
31411
  const execution = await runLocalShellCommand(
31287
31412
  input.executable.command,
31288
- input.executable.cwd ? path28.resolve(input.rootPath, input.executable.cwd) : input.rootPath,
31413
+ input.executable.cwd ? path29.resolve(input.rootPath, input.executable.cwd) : input.rootPath,
31289
31414
  {
31290
31415
  timeoutSeconds: input.executable.timeoutSeconds ?? 900,
31291
31416
  env: {
@@ -31318,10 +31443,10 @@ async function writeLocalSandboxTemplateUploads(rootPath, uploads) {
31318
31443
  const written = [];
31319
31444
  for (const upload of uploads) {
31320
31445
  const relativePath = normalizeLocalWorkspacePath(upload.path);
31321
- const targetPath = path28.resolve(rootPath, relativePath);
31322
- await fs15.mkdir(path28.dirname(targetPath), { recursive: true });
31446
+ const targetPath = path29.resolve(rootPath, relativePath);
31447
+ await fs16.mkdir(path29.dirname(targetPath), { recursive: true });
31323
31448
  const contents = Buffer9.from(upload.contentsBase64, "base64");
31324
- await fs15.writeFile(targetPath, contents);
31449
+ await fs16.writeFile(targetPath, contents);
31325
31450
  written.push({ path: relativePath, sizeBytes: contents.length });
31326
31451
  }
31327
31452
  return written;
@@ -31330,15 +31455,15 @@ async function prepareLocalSandboxTemplateVolumes(rootPath, manifest) {
31330
31455
  for (const volume of manifest.volumes) {
31331
31456
  const mountPath = typeof volume.mountPath === "string" && volume.mountPath.trim() ? volume.mountPath.trim() : volume.name ? `/workspace/volumes/${volume.name}` : "";
31332
31457
  if (!mountPath) continue;
31333
- await fs15.mkdir(path28.resolve(rootPath, normalizeLocalWorkspacePath(mountPath)), { recursive: true });
31458
+ await fs16.mkdir(path29.resolve(rootPath, normalizeLocalWorkspacePath(mountPath)), { recursive: true });
31334
31459
  }
31335
31460
  }
31336
31461
  async function collectLocalSandboxTemplateArtifacts(rootPath, artifactPaths) {
31337
31462
  const artifacts = [];
31338
31463
  for (const artifactPath2 of artifactPaths) {
31339
- const localPath2 = path28.resolve(rootPath, normalizeLocalWorkspacePath(artifactPath2));
31464
+ const localPath2 = path29.resolve(rootPath, normalizeLocalWorkspacePath(artifactPath2));
31340
31465
  try {
31341
- const stat7 = await fs15.stat(localPath2);
31466
+ const stat7 = await fs16.stat(localPath2);
31342
31467
  artifacts.push({ path: artifactPath2, exists: stat7.isFile(), sizeBytes: stat7.size });
31343
31468
  } catch {
31344
31469
  artifacts.push({ path: artifactPath2, exists: false, sizeBytes: null });
@@ -32362,7 +32487,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
32362
32487
  0,
32363
32488
  patchPaths.length - SANDBOX_SOURCE_READBACK_MAX_FILES
32364
32489
  );
32365
- for (const path63 of patchPaths.slice(0, SANDBOX_SOURCE_READBACK_MAX_FILES)) {
32490
+ for (const path64 of patchPaths.slice(0, SANDBOX_SOURCE_READBACK_MAX_FILES)) {
32366
32491
  const remainingBytes = SANDBOX_SOURCE_READBACK_MAX_TOTAL_BYTES - totalReturnedBytes;
32367
32492
  if (remainingBytes <= 0) {
32368
32493
  skippedFiles += 1;
@@ -32377,7 +32502,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
32377
32502
  await sandboxRequestPayload({
32378
32503
  type: "download_file",
32379
32504
  sandboxId: input.sandboxId,
32380
- payload: { path: path63, maxBytes }
32505
+ payload: { path: path64, maxBytes }
32381
32506
  })
32382
32507
  );
32383
32508
  const file = asRecord9(downloadPayload.file);
@@ -32385,7 +32510,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
32385
32510
  const returnedBytes = numberValue3(file.returnedBytes);
32386
32511
  const sizeBytes = numberValue3(file.totalSizeBytes) ?? numberValue3(file.sizeBytes);
32387
32512
  const entry = {
32388
- path: path63,
32513
+ path: path64,
32389
32514
  sizeBytes,
32390
32515
  returnedBytes,
32391
32516
  isBinary,
@@ -32404,7 +32529,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
32404
32529
  files.push(entry);
32405
32530
  } catch (error) {
32406
32531
  files.push({
32407
- path: path63,
32532
+ path: path64,
32408
32533
  sizeBytes: null,
32409
32534
  returnedBytes: null,
32410
32535
  isBinary: false,
@@ -32606,10 +32731,10 @@ ${message2}` : message2;
32606
32731
  const file = asRecord9(payload.file);
32607
32732
  const contentsBase64 = typeof file.contentsBase64 === "string" ? file.contentsBase64 : "";
32608
32733
  const text3 = contentsBase64 ? Buffer11.from(contentsBase64, "base64").toString("utf8") : "";
32609
- const path63 = typeof file.path === "string" ? file.path : "file";
32610
- return text3 ? `${path63}
32734
+ const path64 = typeof file.path === "string" ? file.path : "file";
32735
+ return text3 ? `${path64}
32611
32736
 
32612
- ${text3}` : `Read ${path63}`;
32737
+ ${text3}` : `Read ${path64}`;
32613
32738
  }
32614
32739
  if (action === "sandbox_exec") {
32615
32740
  const command = asRecord9(payload.command);
@@ -32646,31 +32771,31 @@ ${output}` : `Action ${actionName} ${status}`;
32646
32771
  }
32647
32772
  if (action === "sandbox_upload_file") {
32648
32773
  const file = asRecord9(payload.file);
32649
- const path63 = typeof file.path === "string" ? file.path : "file";
32650
- return appendPreservation(`Uploaded ${path63}.`);
32774
+ const path64 = typeof file.path === "string" ? file.path : "file";
32775
+ return appendPreservation(`Uploaded ${path64}.`);
32651
32776
  }
32652
32777
  if (action === "sandbox_write_file") {
32653
32778
  const file = asRecord9(payload.file);
32654
- const path63 = typeof file.path === "string" ? file.path : "file";
32655
- return appendPreservation(`Wrote ${path63}.`);
32779
+ const path64 = typeof file.path === "string" ? file.path : "file";
32780
+ return appendPreservation(`Wrote ${path64}.`);
32656
32781
  }
32657
32782
  if (action === "sandbox_edit_file") {
32658
32783
  const edit = asRecord9(payload.edit);
32659
- const path63 = typeof edit.path === "string" ? edit.path : "file";
32784
+ const path64 = typeof edit.path === "string" ? edit.path : "file";
32660
32785
  const replacements = typeof edit.replacements === "number" ? edit.replacements : 0;
32661
32786
  return appendPreservation(
32662
- `Edited ${path63} with ${replacements} replacement${replacements === 1 ? "" : "s"}.`
32787
+ `Edited ${path64} with ${replacements} replacement${replacements === 1 ? "" : "s"}.`
32663
32788
  );
32664
32789
  }
32665
32790
  if (action === "sandbox_delete_file") {
32666
32791
  const deleted = asRecord9(payload.deleted);
32667
- const path63 = typeof deleted.path === "string" ? deleted.path : "file";
32668
- return appendPreservation(`Deleted ${path63}.`);
32792
+ const path64 = typeof deleted.path === "string" ? deleted.path : "file";
32793
+ return appendPreservation(`Deleted ${path64}.`);
32669
32794
  }
32670
32795
  if (action === "sandbox_mkdir") {
32671
32796
  const directory = asRecord9(payload.directory);
32672
- const path63 = typeof directory.path === "string" ? directory.path : "directory";
32673
- return appendPreservation(`Created directory ${path63}.`);
32797
+ const path64 = typeof directory.path === "string" ? directory.path : "directory";
32798
+ return appendPreservation(`Created directory ${path64}.`);
32674
32799
  }
32675
32800
  if (action === "sandbox_move_file") {
32676
32801
  const moved = asRecord9(payload.moved);
@@ -33686,10 +33811,10 @@ function createWorkspaceToolExecutor(deps) {
33686
33811
 
33687
33812
  // ../server/src/work/work-output-service.ts
33688
33813
  import { createHash as createHash7, randomUUID as randomUUID9 } from "node:crypto";
33689
- import { promises as fs16 } from "node:fs";
33690
- import path29 from "node:path";
33814
+ import { promises as fs17 } from "node:fs";
33815
+ import path30 from "node:path";
33691
33816
  function createWorkOutputService(input) {
33692
- const outputRoot = path29.join(input.storeDir, "work", "outputs");
33817
+ const outputRoot = path30.join(input.storeDir, "work", "outputs");
33693
33818
  const sandboxRequest = input.sandboxRequest ?? sandboxRequestPayload;
33694
33819
  async function saveWorkOutput(request) {
33695
33820
  if (request.session.experience !== "work") {
@@ -33700,7 +33825,7 @@ function createWorkOutputService(input) {
33700
33825
  }
33701
33826
  const sandboxPath = normalizeOutputCandidatePath(request.sandboxPath);
33702
33827
  const title = safeOutputName(
33703
- request.suggestedName || path29.posix.basename(sandboxPath)
33828
+ request.suggestedName || path30.posix.basename(sandboxPath)
33704
33829
  );
33705
33830
  const payload = asRecord10(
33706
33831
  await sandboxRequest({
@@ -33732,7 +33857,7 @@ function createWorkOutputService(input) {
33732
33857
  if (reportedSize !== null && bytes2.byteLength !== reportedSize) {
33733
33858
  throw new Error("Sandbox output download was incomplete.");
33734
33859
  }
33735
- const contentType2 = WORK_OUTPUT_CONTENT_TYPES[path29.extname(title).toLowerCase()];
33860
+ const contentType2 = WORK_OUTPUT_CONTENT_TYPES[path30.extname(title).toLowerCase()];
33736
33861
  if (!contentType2) {
33737
33862
  throw new Error(
33738
33863
  `${title} is not an advertised Work output format. Save it as a supported file type or keep it in scratch space.`
@@ -33752,26 +33877,26 @@ function createWorkOutputService(input) {
33752
33877
  });
33753
33878
  const outputId = identity.id;
33754
33879
  const revision = identity.revision;
33755
- const taskDirectory = path29.join(
33880
+ const taskDirectory = path30.join(
33756
33881
  outputRoot,
33757
33882
  safePathSegment(request.session.id)
33758
33883
  );
33759
- await fs16.mkdir(taskDirectory, { recursive: true, mode: 448 });
33760
- const destination = path29.join(
33884
+ await fs17.mkdir(taskDirectory, { recursive: true, mode: 448 });
33885
+ const destination = path30.join(
33761
33886
  taskDirectory,
33762
33887
  `${String(revision).padStart(3, "0")}-${safePathSegment(
33763
33888
  outputId
33764
33889
  )}-${title}`
33765
33890
  );
33766
- const temporary = path29.join(
33891
+ const temporary = path30.join(
33767
33892
  taskDirectory,
33768
- `.${path29.basename(destination)}.${randomUUID9()}.tmp`
33893
+ `.${path30.basename(destination)}.${randomUUID9()}.tmp`
33769
33894
  );
33770
- await fs16.writeFile(temporary, bytes2, { mode: 384, flag: "wx" });
33895
+ await fs17.writeFile(temporary, bytes2, { mode: 384, flag: "wx" });
33771
33896
  try {
33772
- await fs16.rename(temporary, destination);
33897
+ await fs17.rename(temporary, destination);
33773
33898
  } catch (error) {
33774
- await fs16.rm(temporary, { force: true });
33899
+ await fs17.rm(temporary, { force: true });
33775
33900
  throw error;
33776
33901
  }
33777
33902
  const outputRef = FileOutputRefSchema.parse({
@@ -33828,7 +33953,7 @@ function createWorkOutputService(input) {
33828
33953
  const file = asRecord10(value);
33829
33954
  if (file.type !== "file" || typeof file.path !== "string") continue;
33830
33955
  const sandboxPath = file.path.replace(/^\/workspace\//, "");
33831
- const title = safeOutputName(path29.posix.basename(sandboxPath));
33956
+ const title = safeOutputName(path30.posix.basename(sandboxPath));
33832
33957
  if (alreadySaved.has(title)) continue;
33833
33958
  saved.push(
33834
33959
  await saveWorkOutput({
@@ -33887,19 +34012,19 @@ function createWorkOutputService(input) {
33887
34012
  if (outputRef.location.kind !== "local") {
33888
34013
  throw new Error("This Work output is not stored on this device.");
33889
34014
  }
33890
- const taskDirectory = path29.resolve(
34015
+ const taskDirectory = path30.resolve(
33891
34016
  outputRoot,
33892
34017
  safePathSegment(request.session.id)
33893
34018
  );
33894
- const target = path29.resolve(outputRef.location.path);
33895
- if (target === taskDirectory || !target.startsWith(`${taskDirectory}${path29.sep}`)) {
34019
+ const target = path30.resolve(outputRef.location.path);
34020
+ if (target === taskDirectory || !target.startsWith(`${taskDirectory}${path30.sep}`)) {
33896
34021
  throw new Error("Work output path is outside managed local storage.");
33897
34022
  }
33898
34023
  return { outputRef, target };
33899
34024
  }
33900
34025
  async function deleteWorkOutput(request) {
33901
34026
  const { outputRef, target } = await resolveLocalOutput(request);
33902
- const deleted = await fs16.rm(target).then(() => true).catch((error) => {
34027
+ const deleted = await fs17.rm(target).then(() => true).catch((error) => {
33903
34028
  if (error.code === "ENOENT") return false;
33904
34029
  throw error;
33905
34030
  });
@@ -33907,7 +34032,7 @@ function createWorkOutputService(input) {
33907
34032
  }
33908
34033
  async function readWorkOutput(request) {
33909
34034
  const { outputRef, target } = await resolveLocalOutput(request);
33910
- const bytes2 = await fs16.readFile(target);
34035
+ const bytes2 = await fs17.readFile(target);
33911
34036
  if (bytes2.byteLength > WORK_OUTPUT_MAX_BYTES) {
33912
34037
  throw new Error(
33913
34038
  `Work output exceeds the ${WORK_OUTPUT_MAX_BYTES.toLocaleString()} byte limit.`
@@ -34091,7 +34216,7 @@ function normalizeOutputCandidatePath(value) {
34091
34216
  if (!normalized || normalized.startsWith("/")) {
34092
34217
  throw new Error("Work output path must be relative to /workspace.");
34093
34218
  }
34094
- const clean = path29.posix.normalize(normalized);
34219
+ const clean = path30.posix.normalize(normalized);
34095
34220
  if (clean === "." || clean === ".." || clean.startsWith("../") || !clean.startsWith("outputs/") || clean === "outputs/") {
34096
34221
  throw new Error(
34097
34222
  "Completed Work outputs must be inside /workspace/outputs."
@@ -34157,7 +34282,7 @@ function findOutputRefById(value, outputId, revision, depth = 0) {
34157
34282
  return latest;
34158
34283
  }
34159
34284
  function safeOutputName(value) {
34160
- const base = path29.basename(value.trim()).replace(/[^a-zA-Z0-9._ -]+/g, "-");
34285
+ const base = path30.basename(value.trim()).replace(/[^a-zA-Z0-9._ -]+/g, "-");
34161
34286
  const normalized = base.replace(/\s+/g, " ").trim().slice(0, 180);
34162
34287
  if (!normalized || normalized === "." || normalized === "..") {
34163
34288
  throw new Error("A valid output file name is required.");
@@ -34176,10 +34301,10 @@ function numberValue4(value) {
34176
34301
 
34177
34302
  // ../server/src/work/work-sandbox-lifecycle-service.ts
34178
34303
  import { randomUUID as randomUUID10 } from "node:crypto";
34179
- import { promises as fs17 } from "node:fs";
34180
- import path30 from "node:path";
34304
+ import { promises as fs18 } from "node:fs";
34305
+ import path31 from "node:path";
34181
34306
  function createWorkSandboxLifecycleService(input) {
34182
- const outboxPath = path30.join(
34307
+ const outboxPath = path31.join(
34183
34308
  input.storeDir,
34184
34309
  "work",
34185
34310
  "sandbox-cleanup-outbox.json"
@@ -34346,7 +34471,7 @@ function createWorkSandboxLifecycleService(input) {
34346
34471
  }
34347
34472
  async function readOutbox() {
34348
34473
  try {
34349
- const parsed = JSON.parse(await fs17.readFile(outboxPath, "utf8"));
34474
+ const parsed = JSON.parse(await fs18.readFile(outboxPath, "utf8"));
34350
34475
  if (!Array.isArray(parsed)) return [];
34351
34476
  return parsed.filter(isCleanupEntry);
34352
34477
  } catch (error) {
@@ -34355,13 +34480,13 @@ function createWorkSandboxLifecycleService(input) {
34355
34480
  }
34356
34481
  }
34357
34482
  async function writeOutbox(entries) {
34358
- await fs17.mkdir(path30.dirname(outboxPath), { recursive: true, mode: 448 });
34483
+ await fs18.mkdir(path31.dirname(outboxPath), { recursive: true, mode: 448 });
34359
34484
  const temporary = `${outboxPath}.${randomUUID10()}.tmp`;
34360
- await fs17.writeFile(temporary, JSON.stringify(entries, null, 2), {
34485
+ await fs18.writeFile(temporary, JSON.stringify(entries, null, 2), {
34361
34486
  mode: 384,
34362
34487
  flag: "wx"
34363
34488
  });
34364
- await fs17.rename(temporary, outboxPath);
34489
+ await fs18.rename(temporary, outboxPath);
34365
34490
  }
34366
34491
  return { close, finalizeTurn, retryPending, start };
34367
34492
  }
@@ -35064,14 +35189,14 @@ function processErrorClass(failure) {
35064
35189
 
35065
35190
  // ../server/src/work/work-evidence-service.ts
35066
35191
  import { readFile as readFile4, stat as stat4 } from "node:fs/promises";
35067
- import path32 from "node:path";
35192
+ import path33 from "node:path";
35068
35193
 
35069
35194
  // ../server/src/work/work-evidence-artifact-store.ts
35070
35195
  import { randomUUID as randomUUID11 } from "node:crypto";
35071
35196
  import { link, mkdir as mkdir2, readFile as readFile3, rm, writeFile } from "node:fs/promises";
35072
- import path31 from "node:path";
35197
+ import path32 from "node:path";
35073
35198
  function createWorkEvidenceArtifactStore(storeDir) {
35074
- const root = path31.join(storeDir, "work", "evidence");
35199
+ const root = path32.join(storeDir, "work", "evidence");
35075
35200
  async function persistPortableJson(input) {
35076
35201
  const bytes2 = Buffer.from(canonicalJson(input.value), "utf8");
35077
35202
  const hash3 = input.semanticHash ?? contentHash(input.value);
@@ -35141,10 +35266,10 @@ function createWorkEvidenceArtifactStore(storeDir) {
35141
35266
  };
35142
35267
  }
35143
35268
  function artifactPath(root, visibility, hash3, extension2) {
35144
- return path31.join(root, visibility, hash3.slice(0, 2), `${hash3}.${extension2}`);
35269
+ return path32.join(root, visibility, hash3.slice(0, 2), `${hash3}.${extension2}`);
35145
35270
  }
35146
35271
  async function writeImmutable(target, bytes2) {
35147
- await mkdir2(path31.dirname(target), { recursive: true, mode: 448 });
35272
+ await mkdir2(path32.dirname(target), { recursive: true, mode: 448 });
35148
35273
  const temporary = `${target}.${randomUUID11()}.tmp`;
35149
35274
  await writeFile(temporary, bytes2, { flag: "wx", mode: 384 });
35150
35275
  try {
@@ -35153,7 +35278,7 @@ async function writeImmutable(target, bytes2) {
35153
35278
  if (error.code !== "EEXIST") throw error;
35154
35279
  const existing = await readFile3(target);
35155
35280
  if (!existing.equals(bytes2)) {
35156
- throw new Error(`Immutable Work evidence artifact ${path31.basename(target)} changed content.`);
35281
+ throw new Error(`Immutable Work evidence artifact ${path32.basename(target)} changed content.`);
35157
35282
  }
35158
35283
  } finally {
35159
35284
  await rm(temporary, { force: true });
@@ -35306,9 +35431,9 @@ async function recordDesktopWorkFeedback(input) {
35306
35431
  });
35307
35432
  }
35308
35433
  async function verifyManagedOutput(input) {
35309
- const outputRoot = path32.resolve(input.storeDir, "work", "outputs");
35310
- const target = path32.resolve(input.path);
35311
- if (!target.startsWith(`${outputRoot}${path32.sep}`)) {
35434
+ const outputRoot = path33.resolve(input.storeDir, "work", "outputs");
35435
+ const target = path33.resolve(input.path);
35436
+ if (!target.startsWith(`${outputRoot}${path33.sep}`)) {
35312
35437
  throw new Error("Work evidence output is outside managed local output storage.");
35313
35438
  }
35314
35439
  const info = await stat4(target);
@@ -35427,8 +35552,8 @@ function publicFeedback(stored) {
35427
35552
 
35428
35553
  // ../server/src/work/work-agent-package-service.ts
35429
35554
  import { createHash as createHash8, randomUUID as randomUUID12 } from "node:crypto";
35430
- import { promises as fs18 } from "node:fs";
35431
- import path33 from "node:path";
35555
+ import { promises as fs19 } from "node:fs";
35556
+ import path34 from "node:path";
35432
35557
  var AGENT_PACKAGE_SCHEMA = "openpond.agent-package.v1";
35433
35558
  var MAX_SOURCE_FILES = 1e3;
35434
35559
  var REQUIRED_ARTIFACTS = [
@@ -35438,7 +35563,7 @@ var REQUIRED_ARTIFACTS = [
35438
35563
  ".openpond/validator-report.md"
35439
35564
  ];
35440
35565
  function createWorkAgentPackageService(input) {
35441
- const packageRoot = path33.join(input.storeDir, "work", "agent-packages");
35566
+ const packageRoot = path34.join(input.storeDir, "work", "agent-packages");
35442
35567
  const sandboxRequest = input.sandboxRequest ?? sandboxRequestPayload;
35443
35568
  async function prepareWorkAgent(request) {
35444
35569
  const sandboxId2 = requireWorkSandbox(request.session);
@@ -35565,9 +35690,9 @@ function createWorkAgentPackageService(input) {
35565
35690
  `,
35566
35691
  "utf8"
35567
35692
  );
35568
- const packageDirectory = path33.join(packageRoot, digest);
35569
- const destination = path33.join(packageDirectory, "agent-package.json");
35570
- await fs18.mkdir(packageDirectory, { recursive: true, mode: 448 });
35693
+ const packageDirectory = path34.join(packageRoot, digest);
35694
+ const destination = path34.join(packageDirectory, "agent-package.json");
35695
+ await fs19.mkdir(packageDirectory, { recursive: true, mode: 448 });
35571
35696
  await writeImmutablePackage(destination, packageBytes);
35572
35697
  const identity = await nextPackageOutputIdentity({
35573
35698
  runtimeEventsForSession: input.runtimeEventsForSession,
@@ -35643,12 +35768,12 @@ function createWorkAgentPackageService(input) {
35643
35768
  if (outputRef.location.kind !== "local") {
35644
35769
  throw new Error("This Agent package is not stored on this device.");
35645
35770
  }
35646
- const resolvedPackageRoot = path33.resolve(packageRoot);
35647
- const target = path33.resolve(outputRef.location.path);
35648
- if (!target.startsWith(`${resolvedPackageRoot}${path33.sep}`)) {
35771
+ const resolvedPackageRoot = path34.resolve(packageRoot);
35772
+ const target = path34.resolve(outputRef.location.path);
35773
+ if (!target.startsWith(`${resolvedPackageRoot}${path34.sep}`)) {
35649
35774
  throw new Error("Agent package path is outside managed local storage.");
35650
35775
  }
35651
- const bytes2 = await fs18.readFile(target);
35776
+ const bytes2 = await fs19.readFile(target);
35652
35777
  const agentPackage = AgentPackageSchema.parse(
35653
35778
  JSON.parse(bytes2.toString("utf8"))
35654
35779
  );
@@ -35822,7 +35947,7 @@ function normalizeAgentPackageJson(bytes2) {
35822
35947
  }
35823
35948
  function normalizeAgentDirectory(value) {
35824
35949
  const normalized = value.trim().replaceAll("\\", "/");
35825
- const clean = path33.posix.normalize(normalized);
35950
+ const clean = path34.posix.normalize(normalized);
35826
35951
  if (!clean || clean === "." || clean === ".." || clean.startsWith("/") || clean.startsWith("../") || clean.split("/").some((part) => part === "..") || !/^[a-zA-Z0-9._/-]+$/.test(clean)) {
35827
35952
  throw new Error("Agent directory must stay inside Work scratch space.");
35828
35953
  }
@@ -35832,7 +35957,7 @@ function relativeAgentFilePath(value, root) {
35832
35957
  if (typeof value !== "string") return null;
35833
35958
  const normalized = value.trim().replaceAll("\\", "/");
35834
35959
  const workspaceRelative = normalized.startsWith("/workspace/") ? normalized.slice("/workspace/".length) : normalized.replace(/^\/+/, "");
35835
- const clean = path33.posix.normalize(workspaceRelative);
35960
+ const clean = path34.posix.normalize(workspaceRelative);
35836
35961
  if (clean === root) return null;
35837
35962
  if (!clean.startsWith(`${root}/`)) {
35838
35963
  throw new Error("Sandbox returned a file outside the Agent source root.");
@@ -35869,7 +35994,7 @@ function assertSandboxCommandPassed(value, label) {
35869
35994
  }
35870
35995
  }
35871
35996
  async function writeImmutablePackage(destination, bytes2) {
35872
- const existing = await fs18.readFile(destination).catch(() => null);
35997
+ const existing = await fs19.readFile(destination).catch(() => null);
35873
35998
  if (existing) {
35874
35999
  if (!existing.equals(bytes2)) {
35875
36000
  throw new Error(
@@ -35879,12 +36004,12 @@ async function writeImmutablePackage(destination, bytes2) {
35879
36004
  return;
35880
36005
  }
35881
36006
  const temporary = `${destination}.${randomUUID12()}.tmp`;
35882
- await fs18.writeFile(temporary, bytes2, { mode: 384, flag: "wx" });
36007
+ await fs19.writeFile(temporary, bytes2, { mode: 384, flag: "wx" });
35883
36008
  try {
35884
- await fs18.rename(temporary, destination);
36009
+ await fs19.rename(temporary, destination);
35885
36010
  } catch (error) {
35886
- await fs18.rm(temporary, { force: true });
35887
- const winner = await fs18.readFile(destination).catch(() => null);
36011
+ await fs19.rm(temporary, { force: true });
36012
+ const winner = await fs19.readFile(destination).catch(() => null);
35888
36013
  if (!winner?.equals(bytes2)) throw error;
35889
36014
  }
35890
36015
  }
@@ -35976,8 +36101,8 @@ function numberValue5(value) {
35976
36101
 
35977
36102
  // ../server/src/work/work-agent-sdk-archive.ts
35978
36103
  import { execFile as execFile4 } from "node:child_process";
35979
- import { promises as fs19 } from "node:fs";
35980
- import path34 from "node:path";
36104
+ import { promises as fs20 } from "node:fs";
36105
+ import path35 from "node:path";
35981
36106
  import { fileURLToPath as fileURLToPath2 } from "node:url";
35982
36107
  import { promisify as promisify3 } from "node:util";
35983
36108
  var execFileAsync3 = promisify3(execFile4);
@@ -35995,15 +36120,15 @@ function createWorkAgentSdkArchiveLoader(input) {
35995
36120
  };
35996
36121
  }
35997
36122
  async function loadWorkAgentSdkArchive(input) {
35998
- const stagedPath = input.packagePath?.trim() || process.env.OPENPOND_AGENT_SDK_PACKAGE?.trim() || path34.join(
35999
- path34.dirname(fileURLToPath2(import.meta.url)),
36123
+ const stagedPath = input.packagePath?.trim() || process.env.OPENPOND_AGENT_SDK_PACKAGE?.trim() || path35.join(
36124
+ path35.dirname(fileURLToPath2(import.meta.url)),
36000
36125
  "work-assets",
36001
36126
  "openpond-agent-sdk.tgz"
36002
36127
  );
36003
36128
  const staged = await readBoundedArchive(stagedPath);
36004
36129
  if (staged) return staged;
36005
36130
  const sourceRoot = await resolveAgentSdkSourceRoot(input.sourceRoot);
36006
- const distCli = path34.join(sourceRoot, "dist", "cli.js");
36131
+ const distCli = path35.join(sourceRoot, "dist", "cli.js");
36007
36132
  if (!await isFile(distCli)) {
36008
36133
  await execFileAsync3(packageManagerCommand("pnpm"), [
36009
36134
  "--dir",
@@ -36015,9 +36140,9 @@ async function loadWorkAgentSdkArchive(input) {
36015
36140
  if (!await isFile(distCli)) {
36016
36141
  throw new Error("OpenPond Agent SDK build did not produce dist/cli.js.");
36017
36142
  }
36018
- const cacheRoot = path34.join(input.storeDir, "work", "assets");
36019
- await fs19.mkdir(cacheRoot, { recursive: true, mode: 448 });
36020
- const packRoot = await fs19.mkdtemp(path34.join(cacheRoot, "agent-sdk-pack-"));
36143
+ const cacheRoot = path35.join(input.storeDir, "work", "assets");
36144
+ await fs20.mkdir(cacheRoot, { recursive: true, mode: 448 });
36145
+ const packRoot = await fs20.mkdtemp(path35.join(cacheRoot, "agent-sdk-pack-"));
36021
36146
  try {
36022
36147
  const { stdout } = await execFileAsync3(packageManagerCommand("npm"), [
36023
36148
  "pack",
@@ -36029,26 +36154,26 @@ async function loadWorkAgentSdkArchive(input) {
36029
36154
  const packed = JSON.parse(stdout);
36030
36155
  const filename = packed[0]?.filename;
36031
36156
  if (!filename) throw new Error("npm pack did not return an SDK archive.");
36032
- const bytes2 = await readBoundedArchive(path34.join(packRoot, filename));
36157
+ const bytes2 = await readBoundedArchive(path35.join(packRoot, filename));
36033
36158
  if (!bytes2) throw new Error("Packed OpenPond Agent SDK archive is empty.");
36034
36159
  return bytes2;
36035
36160
  } finally {
36036
- await fs19.rm(packRoot, { recursive: true, force: true });
36161
+ await fs20.rm(packRoot, { recursive: true, force: true });
36037
36162
  }
36038
36163
  }
36039
36164
  async function resolveAgentSdkSourceRoot(override) {
36040
36165
  const candidates = [
36041
36166
  override?.trim(),
36042
36167
  process.env.OPENPOND_AGENT_SDK_ROOT?.trim(),
36043
- path34.join(process.cwd(), "packages", "agent-sdk"),
36044
- path34.resolve(
36045
- path34.dirname(fileURLToPath2(import.meta.url)),
36168
+ path35.join(process.cwd(), "packages", "agent-sdk"),
36169
+ path35.resolve(
36170
+ path35.dirname(fileURLToPath2(import.meta.url)),
36046
36171
  "../../../../packages/agent-sdk"
36047
36172
  )
36048
36173
  ].filter((candidate2) => Boolean(candidate2));
36049
36174
  for (const candidate2 of candidates) {
36050
- if (await isFile(path34.join(candidate2, "package.json"))) {
36051
- return path34.resolve(candidate2);
36175
+ if (await isFile(path35.join(candidate2, "package.json"))) {
36176
+ return path35.resolve(candidate2);
36052
36177
  }
36053
36178
  }
36054
36179
  throw new Error(
@@ -36056,23 +36181,23 @@ async function resolveAgentSdkSourceRoot(override) {
36056
36181
  );
36057
36182
  }
36058
36183
  async function readBoundedArchive(filePath) {
36059
- const stat7 = await fs19.stat(filePath).catch(() => null);
36184
+ const stat7 = await fs20.stat(filePath).catch(() => null);
36060
36185
  if (!stat7?.isFile()) return null;
36061
36186
  if (stat7.size <= 0 || stat7.size > MAX_AGENT_SDK_ARCHIVE_BYTES) {
36062
36187
  throw new Error("OpenPond Agent SDK archive has an invalid size.");
36063
36188
  }
36064
- return fs19.readFile(filePath);
36189
+ return fs20.readFile(filePath);
36065
36190
  }
36066
36191
  async function isFile(filePath) {
36067
- return fs19.stat(filePath).then((stat7) => stat7.isFile()).catch(() => false);
36192
+ return fs20.stat(filePath).then((stat7) => stat7.isFile()).catch(() => false);
36068
36193
  }
36069
36194
  function packageManagerCommand(name) {
36070
36195
  return process.platform === "win32" ? `${name}.cmd` : name;
36071
36196
  }
36072
36197
 
36073
36198
  // ../server/src/workspace/server-workspace-managed-workflows.ts
36074
- import { promises as fs20 } from "node:fs";
36075
- import path35 from "node:path";
36199
+ import { promises as fs21 } from "node:fs";
36200
+ import path36 from "node:path";
36076
36201
  function createWorkspaceManagedWorkflows(deps) {
36077
36202
  const { appendRuntimeEvent } = deps;
36078
36203
  async function runSandboxTemplateCheckActionEvent(session, turnId, source, action, repoPath) {
@@ -36136,16 +36261,16 @@ function createWorkspaceManagedWorkflows(deps) {
36136
36261
  }
36137
36262
  async function hasSandboxTemplateManifest(repoPath) {
36138
36263
  try {
36139
- await fs20.access(path35.join(repoPath, OPENPOND_MANIFEST_FILE_NAME));
36264
+ await fs21.access(path36.join(repoPath, OPENPOND_MANIFEST_FILE_NAME));
36140
36265
  return true;
36141
36266
  } catch {
36142
36267
  return false;
36143
36268
  }
36144
36269
  }
36145
36270
  async function runSandboxTemplateCheck(repoPath, action) {
36146
- const manifestPath = path35.join(repoPath, OPENPOND_MANIFEST_FILE_NAME);
36271
+ const manifestPath = path36.join(repoPath, OPENPOND_MANIFEST_FILE_NAME);
36147
36272
  try {
36148
- const source = await fs20.readFile(manifestPath, "utf8");
36273
+ const source = await fs21.readFile(manifestPath, "utf8");
36149
36274
  const result = validateSandboxTemplateYaml(source);
36150
36275
  if (!result.ok) {
36151
36276
  return {
@@ -36165,20 +36290,20 @@ async function runSandboxTemplateCheck(repoPath, action) {
36165
36290
  stderr: ""
36166
36291
  };
36167
36292
  }
36168
- const outputPath = path35.join(repoPath, "dist", SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME);
36293
+ const outputPath = path36.join(repoPath, "dist", SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME);
36169
36294
  const plan = sandboxTemplateBuildPlan({
36170
36295
  manifest: result.manifest,
36171
36296
  manifestFile: OPENPOND_MANIFEST_FILE_NAME,
36172
- projectRoot: path35.relative(path35.dirname(outputPath), repoPath) || "."
36297
+ projectRoot: path36.relative(path36.dirname(outputPath), repoPath) || "."
36173
36298
  });
36174
- await fs20.mkdir(path35.dirname(outputPath), { recursive: true });
36175
- await fs20.writeFile(outputPath, `${JSON.stringify(plan, null, 2)}
36299
+ await fs21.mkdir(path36.dirname(outputPath), { recursive: true });
36300
+ await fs21.writeFile(outputPath, `${JSON.stringify(plan, null, 2)}
36176
36301
  `, "utf8");
36177
36302
  return {
36178
36303
  ok: true,
36179
36304
  command: action,
36180
36305
  code: 0,
36181
- stdout: `Built sandbox template ${result.manifest.name} to ${path35.relative(repoPath, outputPath)}.`,
36306
+ stdout: `Built sandbox template ${result.manifest.name} to ${path36.relative(repoPath, outputPath)}.`,
36182
36307
  stderr: ""
36183
36308
  };
36184
36309
  } catch (error) {
@@ -36193,7 +36318,7 @@ async function runSandboxTemplateCheck(repoPath, action) {
36193
36318
  }
36194
36319
 
36195
36320
  // ../server/src/workspace/server-workspace-session-workflows.ts
36196
- import path36 from "node:path";
36321
+ import path37 from "node:path";
36197
36322
  function createWorkspaceSessionWorkflows(deps) {
36198
36323
  const {
36199
36324
  appendRuntimeEvent,
@@ -36208,7 +36333,7 @@ function createWorkspaceSessionWorkflows(deps) {
36208
36333
  if (subagentRepoPath) {
36209
36334
  const app2 = {
36210
36335
  id: localPathWorkspaceId(subagentRepoPath),
36211
- name: path36.basename(subagentRepoPath) || "Subagent workspace",
36336
+ name: path37.basename(subagentRepoPath) || "Subagent workspace",
36212
36337
  description: null,
36213
36338
  visibility: "private",
36214
36339
  gitOwner: null,
@@ -36252,7 +36377,7 @@ function createWorkspaceSessionWorkflows(deps) {
36252
36377
  const workspacePath = session.cwd;
36253
36378
  const app2 = {
36254
36379
  id: localPathWorkspaceId(workspacePath),
36255
- name: path36.basename(workspacePath) || workspacePath,
36380
+ name: path37.basename(workspacePath) || workspacePath,
36256
36381
  description: null,
36257
36382
  visibility: "private",
36258
36383
  gitOwner: null,
@@ -36881,9 +37006,9 @@ async function openTailscaleApp() {
36881
37006
  // ../server/src/voice-transcription.ts
36882
37007
  import { Buffer as Buffer12 } from "node:buffer";
36883
37008
  import { spawn as spawn5 } from "node:child_process";
36884
- import { constants as fsConstants, promises as fs21 } from "node:fs";
37009
+ import { constants as fsConstants, promises as fs22 } from "node:fs";
36885
37010
  import os8 from "node:os";
36886
- import path37 from "node:path";
37011
+ import path38 from "node:path";
36887
37012
  import { randomUUID as randomUUID13 } from "node:crypto";
36888
37013
  var DEFAULT_MODEL_NAME = "base.en";
36889
37014
  var MAX_AUDIO_BYTES = 32 * 1024 * 1024;
@@ -36893,7 +37018,7 @@ var MODEL_MAX_BYTES = 2 * 1024 * 1024 * 1024;
36893
37018
  var PROCESS_OUTPUT_MAX_CHARS = 64 * 1024;
36894
37019
  function createVoiceTranscriptionService(input) {
36895
37020
  const modelName = normalizedModelName(process.env.OPENPOND_WHISPER_MODEL_NAME);
36896
- const modelPath = process.env.OPENPOND_WHISPER_MODEL?.trim() || path37.join(input.storeDir, "voice-models", `ggml-${modelName}.bin`);
37021
+ const modelPath = process.env.OPENPOND_WHISPER_MODEL?.trim() || path38.join(input.storeDir, "voice-models", `ggml-${modelName}.bin`);
36897
37022
  let modelDownload = null;
36898
37023
  const closeController = new AbortController();
36899
37024
  const activeProcesses = /* @__PURE__ */ new Set();
@@ -36950,13 +37075,13 @@ function createVoiceTranscriptionService(input) {
36950
37075
  throw new Error("Voice recording is too large. Keep dictation under two minutes.");
36951
37076
  }
36952
37077
  const selectedModelPath = await ensureModel();
36953
- const workDir = path37.join(input.storeDir, "tmp", "voice");
36954
- await fs21.mkdir(workDir, { recursive: true });
37078
+ const workDir = path38.join(input.storeDir, "tmp", "voice");
37079
+ await fs22.mkdir(workDir, { recursive: true });
36955
37080
  const id = randomUUID13();
36956
- const audioPath = path37.join(workDir, `${id}.wav`);
36957
- const outputPrefix = path37.join(workDir, id);
37081
+ const audioPath = path38.join(workDir, `${id}.wav`);
37082
+ const outputPrefix = path38.join(workDir, id);
36958
37083
  const outputTextPath = `${outputPrefix}.txt`;
36959
- await fs21.writeFile(audioPath, audio, { mode: 384 });
37084
+ await fs22.writeFile(audioPath, audio, { mode: 384 });
36960
37085
  try {
36961
37086
  await runWhisper({
36962
37087
  audioPath,
@@ -36967,7 +37092,7 @@ function createVoiceTranscriptionService(input) {
36967
37092
  signal: closeController.signal,
36968
37093
  activeProcesses
36969
37094
  });
36970
- const outputFileText = await fs21.readFile(outputTextPath, "utf8").catch(() => "");
37095
+ const outputFileText = await fs22.readFile(outputTextPath, "utf8").catch(() => "");
36971
37096
  const text3 = cleanWhisperText(outputFileText);
36972
37097
  if (!text3) throw new Error("No speech was detected.");
36973
37098
  return {
@@ -36979,8 +37104,8 @@ function createVoiceTranscriptionService(input) {
36979
37104
  };
36980
37105
  } finally {
36981
37106
  await Promise.all([
36982
- fs21.rm(audioPath, { force: true }),
36983
- fs21.rm(outputTextPath, { force: true })
37107
+ fs22.rm(audioPath, { force: true }),
37108
+ fs22.rm(outputTextPath, { force: true })
36984
37109
  ]);
36985
37110
  }
36986
37111
  }
@@ -37106,7 +37231,7 @@ function canDownloadDefaultModel() {
37106
37231
  }
37107
37232
  async function downloadDefaultModel(targetPath, modelName, logger, signal) {
37108
37233
  const url = `https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-${modelName}.bin`;
37109
- await fs21.mkdir(path37.dirname(targetPath), { recursive: true });
37234
+ await fs22.mkdir(path38.dirname(targetPath), { recursive: true });
37110
37235
  const tempPath = `${targetPath}.${process.pid}.${Date.now()}.tmp`;
37111
37236
  logger.info("downloading whisper model", { modelName, targetPath });
37112
37237
  const response = await fetch(url, { signal });
@@ -37120,8 +37245,8 @@ async function downloadDefaultModel(targetPath, modelName, logger, signal) {
37120
37245
  minBytes: MODEL_MIN_BYTES,
37121
37246
  maxBytes: MODEL_MAX_BYTES
37122
37247
  });
37123
- await fs21.rename(tempPath, targetPath);
37124
- await fs21.chmod(targetPath, 384).catch(() => void 0);
37248
+ await fs22.rename(tempPath, targetPath);
37249
+ await fs22.chmod(targetPath, 384).catch(() => void 0);
37125
37250
  logger.info("whisper model downloaded", { modelName, targetPath, sizeBytes });
37126
37251
  return targetPath;
37127
37252
  }
@@ -37132,7 +37257,7 @@ async function streamVoiceModelResponseToFile(input) {
37132
37257
  }
37133
37258
  const reader = input.response.body?.getReader();
37134
37259
  if (!reader) throw new Error("Whisper model download did not return a response body.");
37135
- const file = await fs21.open(input.targetPath, "wx", 384);
37260
+ const file = await fs22.open(input.targetPath, "wx", 384);
37136
37261
  let sizeBytes = 0;
37137
37262
  try {
37138
37263
  try {
@@ -37153,14 +37278,14 @@ async function streamVoiceModelResponseToFile(input) {
37153
37278
  await file.close();
37154
37279
  }
37155
37280
  } catch (error) {
37156
- await fs21.rm(input.targetPath, { force: true });
37281
+ await fs22.rm(input.targetPath, { force: true });
37157
37282
  throw error;
37158
37283
  }
37159
37284
  if (sizeBytes < input.minBytes) {
37160
- await fs21.rm(input.targetPath, { force: true });
37285
+ await fs22.rm(input.targetPath, { force: true });
37161
37286
  throw new Error("Downloaded Whisper model is incomplete.");
37162
37287
  }
37163
- await fs21.chmod(input.targetPath, 384).catch(() => void 0);
37288
+ await fs22.chmod(input.targetPath, 384).catch(() => void 0);
37164
37289
  return sizeBytes;
37165
37290
  }
37166
37291
  async function resolveWhisperBinary() {
@@ -37177,22 +37302,22 @@ async function resolveWhisperBinary() {
37177
37302
  "/usr/bin/whisper-cpp"
37178
37303
  ];
37179
37304
  for (const candidate2 of candidates) {
37180
- const resolved = candidate2.includes(path37.sep) ? candidate2 : await findExecutableOnPath(candidate2);
37305
+ const resolved = candidate2.includes(path38.sep) ? candidate2 : await findExecutableOnPath(candidate2);
37181
37306
  if (resolved && await executableExists2(resolved)) return resolved;
37182
37307
  }
37183
37308
  return null;
37184
37309
  }
37185
37310
  async function findExecutableOnPath(command) {
37186
- const paths = (process.env.PATH ?? "").split(path37.delimiter).filter(Boolean);
37311
+ const paths = (process.env.PATH ?? "").split(path38.delimiter).filter(Boolean);
37187
37312
  for (const directory of paths) {
37188
- const candidate2 = path37.join(directory, command);
37313
+ const candidate2 = path38.join(directory, command);
37189
37314
  if (await executableExists2(candidate2)) return candidate2;
37190
37315
  }
37191
37316
  return null;
37192
37317
  }
37193
37318
  async function executableExists2(filePath) {
37194
37319
  try {
37195
- await fs21.access(filePath, fsConstants.X_OK);
37320
+ await fs22.access(filePath, fsConstants.X_OK);
37196
37321
  return true;
37197
37322
  } catch {
37198
37323
  return false;
@@ -37200,7 +37325,7 @@ async function executableExists2(filePath) {
37200
37325
  }
37201
37326
  async function fileExists4(filePath) {
37202
37327
  try {
37203
- await fs21.access(filePath);
37328
+ await fs22.access(filePath);
37204
37329
  return true;
37205
37330
  } catch {
37206
37331
  return false;
@@ -37467,8 +37592,8 @@ function headerValue2(value) {
37467
37592
  var import_cron_parser = __toESM(require_dist(), 1);
37468
37593
  import { execFile as execFile6 } from "node:child_process";
37469
37594
  import { randomUUID as randomUUID15 } from "node:crypto";
37470
- import { promises as fs22 } from "node:fs";
37471
- import path38 from "node:path";
37595
+ import { promises as fs23 } from "node:fs";
37596
+ import path39 from "node:path";
37472
37597
  import { promisify as promisify4 } from "node:util";
37473
37598
 
37474
37599
  // ../server/src/agents/local-agent-scheduler-values.ts
@@ -37925,7 +38050,7 @@ function profileScheduleSourceId(profile, agentId) {
37925
38050
  }).slice(0, 20)}`;
37926
38051
  }
37927
38052
  function profileAgentRootPath(profileSourcePath, agent) {
37928
- return agent.id === "default" ? profileSourcePath : path38.resolve(profileSourcePath, agent.path);
38053
+ return agent.id === "default" ? profileSourcePath : path39.resolve(profileSourcePath, agent.path);
37929
38054
  }
37930
38055
  async function pauseSchedulesForMissingSources(store, installedSourceIds) {
37931
38056
  const schedules = await store.listLocalAgentSchedules();
@@ -37958,7 +38083,7 @@ async function inspectAgentProject(agentRootPath) {
37958
38083
  agentRootPath,
37959
38084
  manifestHash ?? stableHash(manifest)
37960
38085
  );
37961
- const projectName = stringValue10(readPath(manifest, ["project", "name"])) ?? path38.basename(agentRootPath) ?? "local-agent";
38086
+ const projectName = stringValue10(readPath(manifest, ["project", "name"])) ?? path39.basename(agentRootPath) ?? "local-agent";
37962
38087
  return {
37963
38088
  projectName,
37964
38089
  manifestHash,
@@ -38000,13 +38125,13 @@ async function runAgentAction(schedule, run, inputOverride) {
38000
38125
  const current = await inspectAgentProject(schedule.agentRootPath);
38001
38126
  assertLocalAgentScheduleVersion(schedule, current);
38002
38127
  const cli = await resolveOpenPondAgentCli(schedule.agentRootPath);
38003
- const runDir = path38.join(
38128
+ const runDir = path39.join(
38004
38129
  schedule.agentRootPath,
38005
38130
  ".openpond",
38006
38131
  "local-scheduler"
38007
38132
  );
38008
- await fs22.mkdir(runDir, { recursive: true });
38009
- const inputPath = path38.join(runDir, `${run.id}.input.json`);
38133
+ await fs23.mkdir(runDir, { recursive: true });
38134
+ const inputPath = path39.join(runDir, `${run.id}.input.json`);
38010
38135
  const input = {
38011
38136
  channel: "schedule",
38012
38137
  ...schedule.input,
@@ -38020,9 +38145,9 @@ async function runAgentAction(schedule, run, inputOverride) {
38020
38145
  trigger: run.trigger
38021
38146
  }
38022
38147
  };
38023
- await fs22.writeFile(inputPath, `${JSON.stringify(input, null, 2)}
38148
+ await fs23.writeFile(inputPath, `${JSON.stringify(input, null, 2)}
38024
38149
  `, "utf8");
38025
- const relativeInputPath = path38.relative(schedule.agentRootPath, inputPath);
38150
+ const relativeInputPath = path39.relative(schedule.agentRootPath, inputPath);
38026
38151
  const executed = await runAgentCli(
38027
38152
  cli,
38028
38153
  [
@@ -38032,7 +38157,7 @@ async function runAgentAction(schedule, run, inputOverride) {
38032
38157
  "--cwd",
38033
38158
  schedule.agentRootPath,
38034
38159
  "--out-dir",
38035
- path38.join(".openpond", "local-scheduler", "artifacts"),
38160
+ path39.join(".openpond", "local-scheduler", "artifacts"),
38036
38161
  "--input-file",
38037
38162
  relativeInputPath
38038
38163
  ],
@@ -38064,7 +38189,7 @@ function assertLocalAgentScheduleVersion(schedule, current) {
38064
38189
  async function runAgentCli(cliPath, args, cwd, timeoutMs) {
38065
38190
  const env = {
38066
38191
  ...process.env,
38067
- PATH: `${path38.dirname(cliPath)}${path38.delimiter}${process.env.PATH ?? ""}`
38192
+ PATH: `${path39.dirname(cliPath)}${path39.delimiter}${process.env.PATH ?? ""}`
38068
38193
  };
38069
38194
  try {
38070
38195
  const result = await execFileAsync4(cliPath, args, {
@@ -38089,16 +38214,16 @@ async function runAgentCli(cliPath, args, cwd, timeoutMs) {
38089
38214
  }
38090
38215
  async function resolveOpenPondAgentCli(agentRootPath) {
38091
38216
  const override = process.env.OPENPOND_AGENT_CLI?.trim();
38092
- if (override) return path38.resolve(override);
38217
+ if (override) return path39.resolve(override);
38093
38218
  const candidates = [];
38094
38219
  for (const basePath of ancestorPaths(agentRootPath)) {
38095
38220
  candidates.push(
38096
- path38.join(basePath, "node_modules", ".bin", "openpond-agent")
38221
+ path39.join(basePath, "node_modules", ".bin", "openpond-agent")
38097
38222
  );
38098
38223
  }
38099
38224
  for (const basePath of ancestorPaths(process.cwd())) {
38100
38225
  candidates.push(
38101
- path38.join(basePath, "node_modules", ".bin", "openpond-agent")
38226
+ path39.join(basePath, "node_modules", ".bin", "openpond-agent")
38102
38227
  );
38103
38228
  }
38104
38229
  const seen = /* @__PURE__ */ new Set();
@@ -38111,17 +38236,17 @@ async function resolveOpenPondAgentCli(agentRootPath) {
38111
38236
  }
38112
38237
  function ancestorPaths(startPath) {
38113
38238
  const paths = [];
38114
- let current = path38.resolve(startPath);
38239
+ let current = path39.resolve(startPath);
38115
38240
  while (true) {
38116
38241
  paths.push(current);
38117
- const parent = path38.dirname(current);
38242
+ const parent = path39.dirname(current);
38118
38243
  if (parent === current) return paths;
38119
38244
  current = parent;
38120
38245
  }
38121
38246
  }
38122
38247
  async function fileExists5(filePath) {
38123
38248
  try {
38124
- const stat7 = await fs22.stat(filePath);
38249
+ const stat7 = await fs23.stat(filePath);
38125
38250
  return stat7.isFile() || stat7.isSymbolicLink();
38126
38251
  } catch {
38127
38252
  return false;
@@ -38290,11 +38415,11 @@ async function teamChatRequestPayload(action, dependencies = {}) {
38290
38415
  const payload = await requestTeamChatApi(request.path, request.init, dependencies);
38291
38416
  return schemaForAction2(action).parse(payload);
38292
38417
  }
38293
- async function requestTeamChatApi(path63, init = {}, dependencies = {}) {
38418
+ async function requestTeamChatApi(path64, init = {}, dependencies = {}) {
38294
38419
  const access5 = await resolveHostedApiAccess(dependencies);
38295
38420
  const headers = hostedApiAuthHeaders(access5.token);
38296
38421
  headers.set("Content-Type", "application/json");
38297
- const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${path63}`, {
38422
+ const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${path64}`, {
38298
38423
  ...init,
38299
38424
  headers
38300
38425
  });
@@ -38526,11 +38651,11 @@ async function uploadTeamChatAttachment(action, dependencies) {
38526
38651
  )
38527
38652
  );
38528
38653
  }
38529
- function post2(path63, body) {
38530
- return jsonRequest2(path63, "POST", body);
38654
+ function post2(path64, body) {
38655
+ return jsonRequest2(path64, "POST", body);
38531
38656
  }
38532
- function jsonRequest2(path63, method, body) {
38533
- return { path: path63, init: { method, body: JSON.stringify(body) } };
38657
+ function jsonRequest2(path64, method, body) {
38658
+ return { path: path64, init: { method, body: JSON.stringify(body) } };
38534
38659
  }
38535
38660
 
38536
38661
  // ../server/src/openpond/team-chat-executor.ts
@@ -39309,13 +39434,13 @@ function createTaskMinerBackgroundLoop(input) {
39309
39434
 
39310
39435
  // ../server/src/training/training-service.ts
39311
39436
  import { access as access2, cp, mkdir as mkdir8, rename as rename2, rm as rm3 } from "node:fs/promises";
39312
- import path53 from "node:path";
39437
+ import path54 from "node:path";
39313
39438
 
39314
39439
  // ../../packages/training-sdk/dist/bundle.js
39315
39440
  import { createHash as createHash10 } from "node:crypto";
39316
39441
  import { createReadStream as createReadStream6 } from "node:fs";
39317
39442
  import { copyFile, mkdir as mkdir3, readFile as readFile5, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
39318
- import path39 from "node:path";
39443
+ import path40 from "node:path";
39319
39444
  async function buildTrainingBundle(input) {
39320
39445
  if (!input.plan.compatibility.compatible)
39321
39446
  throw new Error("Training Plan is incompatible and cannot be bundled.");
@@ -39359,8 +39484,8 @@ async function buildTrainingBundle(input) {
39359
39484
  sizeBytes: taskData.sizeBytes,
39360
39485
  role: "task_data"
39361
39486
  }];
39362
- const taskDataDestination = path39.join(input.directory, "data/train.jsonl");
39363
- await mkdir3(path39.dirname(taskDataDestination), { recursive: true });
39487
+ const taskDataDestination = path40.join(input.directory, "data/train.jsonl");
39488
+ await mkdir3(path40.dirname(taskDataDestination), { recursive: true });
39364
39489
  if ("sourcePath" in taskData) {
39365
39490
  await copyFile(taskData.sourcePath, taskDataDestination);
39366
39491
  } else {
@@ -39374,8 +39499,8 @@ async function buildTrainingBundle(input) {
39374
39499
  throw new Error("Projected training data changed while the Bundle was created.");
39375
39500
  }
39376
39501
  for (const asset of assets) {
39377
- const destination = path39.join(input.directory, asset.path);
39378
- await mkdir3(path39.dirname(destination), { recursive: true });
39502
+ const destination = path40.join(input.directory, asset.path);
39503
+ await mkdir3(path40.dirname(destination), { recursive: true });
39379
39504
  await writeFile2(destination, asset.content, "utf8");
39380
39505
  files.push({ path: asset.path, sha256: sha256(asset.content), sizeBytes: Buffer.byteLength(asset.content), role: asset.role });
39381
39506
  }
@@ -39384,7 +39509,7 @@ async function buildTrainingBundle(input) {
39384
39509
  const provisional = TrainingBundleManifestSchema.parse(base);
39385
39510
  const manifestHash = contentHash({ ...provisional, contentHash: "", files: provisional.files.map((file) => file.path === "manifest.json" ? { ...file, sha256: "", sizeBytes: 0 } : file) });
39386
39511
  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(path39.join(input.directory, "manifest.json"), canonicalJson(manifest), "utf8");
39512
+ await writeFile2(path40.join(input.directory, "manifest.json"), canonicalJson(manifest), "utf8");
39388
39513
  return manifest;
39389
39514
  }
39390
39515
  function inlineTrainingData(taskset, plan, approvedSources) {
@@ -39458,7 +39583,7 @@ async function fileIdentity(filePath) {
39458
39583
  };
39459
39584
  }
39460
39585
  async function inspectTrainingBundle(directory) {
39461
- return TrainingBundleManifestSchema.parse(JSON.parse(await readFile5(path39.join(directory, "manifest.json"), "utf8")));
39586
+ return TrainingBundleManifestSchema.parse(JSON.parse(await readFile5(path40.join(directory, "manifest.json"), "utf8")));
39462
39587
  }
39463
39588
  async function validateTrainingBundle(directory) {
39464
39589
  const manifest = await inspectTrainingBundle(directory);
@@ -39467,7 +39592,7 @@ async function validateTrainingBundle(directory) {
39467
39592
  if (file.path === "manifest.json")
39468
39593
  continue;
39469
39594
  try {
39470
- const bytes2 = await readFile5(path39.join(directory, file.path));
39595
+ const bytes2 = await readFile5(path40.join(directory, file.path));
39471
39596
  if (sha256(bytes2) !== file.sha256)
39472
39597
  issues.push(`${file.path}: hash mismatch`);
39473
39598
  if (bytes2.byteLength !== file.sizeBytes)
@@ -39483,7 +39608,7 @@ async function validateTrainingBundle(directory) {
39483
39608
 
39484
39609
  // ../../packages/training-sdk/dist/bundle-export.js
39485
39610
  import { mkdir as mkdir4, readFile as readFile6, writeFile as writeFile3 } from "node:fs/promises";
39486
- import path40 from "node:path";
39611
+ import path41 from "node:path";
39487
39612
  async function createTrainingBundleExport(directory) {
39488
39613
  const validation = await validateTrainingBundle(directory);
39489
39614
  if (!validation.valid)
@@ -39492,7 +39617,7 @@ async function createTrainingBundleExport(directory) {
39492
39617
  const files = [];
39493
39618
  for (const item of manifest.files) {
39494
39619
  const relative2 = safeRelativePath(item.path);
39495
- const bytes2 = await readFile6(path40.join(directory, relative2));
39620
+ const bytes2 = await readFile6(path41.join(directory, relative2));
39496
39621
  files.push({ path: relative2, sha256: sha256(bytes2), sizeBytes: bytes2.byteLength, encoding: "base64", content: bytes2.toString("base64") });
39497
39622
  }
39498
39623
  const base = { schemaVersion: "openpond.trainingBundleExport.v1", manifest, files, contentHash: "00000000" };
@@ -39500,7 +39625,7 @@ async function createTrainingBundleExport(directory) {
39500
39625
  }
39501
39626
  function safeRelativePath(value) {
39502
39627
  const normalized = value.replaceAll("\\", "/");
39503
- if (path40.posix.isAbsolute(normalized) || normalized.split("/").includes(".."))
39628
+ if (path41.posix.isAbsolute(normalized) || normalized.split("/").includes(".."))
39504
39629
  throw new Error(`Unsafe Training Bundle path: ${value}.`);
39505
39630
  return normalized;
39506
39631
  }
@@ -39903,7 +40028,7 @@ function prepareTrainingSelection(input) {
39903
40028
  import { constants as constants2 } from "node:fs";
39904
40029
  import { randomUUID as randomUUID17 } from "node:crypto";
39905
40030
  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 path41 from "node:path";
40031
+ import path42 from "node:path";
39907
40032
  function buildTasksetTrainingBundle(input) {
39908
40033
  const { taskset, modelRun, harnessRelease, tasksetRelease } = input;
39909
40034
  const releasedHarness2 = ImmutableReleaseRefSchema2.parse(harnessRelease);
@@ -40041,13 +40166,13 @@ function buildTasksetTrainingBundle(input) {
40041
40166
  async function materializeResolvedTrainingBundle(input) {
40042
40167
  const manifest = ResolvedTrainingBundleManifestSchema.parse(input.manifest);
40043
40168
  validateBundleManifest(manifest);
40044
- const directory = path41.join(input.cacheRoot, manifest.contentHash);
40045
- if (await exists(path41.join(directory, "bundle-manifest.json"))) {
40169
+ const directory = path42.join(input.cacheRoot, manifest.contentHash);
40170
+ if (await exists(path42.join(directory, "bundle-manifest.json"))) {
40046
40171
  await verifyResolvedTrainingBundle(directory, manifest);
40047
40172
  return { directory, manifest, cacheHit: true };
40048
40173
  }
40049
40174
  await mkdir5(input.cacheRoot, { recursive: true });
40050
- const temporary = path41.join(input.cacheRoot, `.materializing-${manifest.contentHash}-${process.pid}-${randomUUID17()}`);
40175
+ const temporary = path42.join(input.cacheRoot, `.materializing-${manifest.contentHash}-${process.pid}-${randomUUID17()}`);
40051
40176
  await mkdir5(temporary, { recursive: true, mode: 448 });
40052
40177
  try {
40053
40178
  for (const file of manifest.files) {
@@ -40056,10 +40181,10 @@ async function materializeResolvedTrainingBundle(input) {
40056
40181
  throw new Error(`Resolved Training Bundle asset ${file.path} failed verification.`);
40057
40182
  }
40058
40183
  const target = bundleAssetPath(temporary, file.path);
40059
- await mkdir5(path41.dirname(target), { recursive: true });
40184
+ await mkdir5(path42.dirname(target), { recursive: true });
40060
40185
  await writeFile4(target, value, { mode: 384 });
40061
40186
  }
40062
- await writeFile4(path41.join(temporary, "bundle-manifest.json"), canonicalJson(manifest), { mode: 384 });
40187
+ await writeFile4(path42.join(temporary, "bundle-manifest.json"), canonicalJson(manifest), { mode: 384 });
40063
40188
  await rename(temporary, directory).catch(async (error) => {
40064
40189
  if (!await exists(directory))
40065
40190
  throw error;
@@ -40071,7 +40196,7 @@ async function materializeResolvedTrainingBundle(input) {
40071
40196
  }
40072
40197
  }
40073
40198
  async function verifyResolvedTrainingBundle(directory, expected) {
40074
- const manifest = ResolvedTrainingBundleManifestSchema.parse(JSON.parse(await readFile7(path41.join(directory, "bundle-manifest.json"), "utf8")));
40199
+ const manifest = ResolvedTrainingBundleManifestSchema.parse(JSON.parse(await readFile7(path42.join(directory, "bundle-manifest.json"), "utf8")));
40075
40200
  const { contentHash: suppliedHash, ...content } = manifest;
40076
40201
  if (contentHash(content) !== suppliedHash) {
40077
40202
  throw new Error("Resolved Training Bundle manifest hash mismatch.");
@@ -40113,13 +40238,13 @@ function validateBundleManifest(manifest) {
40113
40238
  }
40114
40239
  }
40115
40240
  function bundleAssetPath(root, assetPath) {
40116
- if (assetPath.includes("\\") || assetPath.includes("\0") || path41.posix.isAbsolute(assetPath) || path41.posix.normalize(assetPath) !== assetPath) {
40241
+ if (assetPath.includes("\\") || assetPath.includes("\0") || path42.posix.isAbsolute(assetPath) || path42.posix.normalize(assetPath) !== assetPath) {
40117
40242
  throw new Error(`Resolved Training Bundle asset ${assetPath} has an invalid path.`);
40118
40243
  }
40119
- const resolvedRoot = path41.resolve(root);
40120
- const target = path41.resolve(root, ...assetPath.split("/"));
40121
- const relative2 = path41.relative(resolvedRoot, target);
40122
- if (relative2.startsWith("..") || path41.isAbsolute(relative2) || relative2 === "") {
40244
+ const resolvedRoot = path42.resolve(root);
40245
+ const target = path42.resolve(root, ...assetPath.split("/"));
40246
+ const relative2 = path42.relative(resolvedRoot, target);
40247
+ if (relative2.startsWith("..") || path42.isAbsolute(relative2) || relative2 === "") {
40123
40248
  throw new Error(`Resolved Training Bundle asset ${assetPath} escapes its root.`);
40124
40249
  }
40125
40250
  return target;
@@ -40132,8 +40257,8 @@ async function assertExactInventory(directory, expected) {
40132
40257
  const actual = /* @__PURE__ */ new Set();
40133
40258
  const visit = async (current) => {
40134
40259
  for (const entry of await readdir2(current, { withFileTypes: true })) {
40135
- const target = path41.join(current, entry.name);
40136
- const relative2 = path41.relative(directory, target).split(path41.sep).join("/");
40260
+ const target = path42.join(current, entry.name);
40261
+ const relative2 = path42.relative(directory, target).split(path42.sep).join("/");
40137
40262
  if (entry.isSymbolicLink()) {
40138
40263
  throw new Error(`Resolved Training Bundle contains a symbolic link at ${relative2}.`);
40139
40264
  }
@@ -40333,7 +40458,7 @@ function modelLabel(modelId) {
40333
40458
  }
40334
40459
 
40335
40460
  // ../server/src/training/training-dataset-selection.ts
40336
- import path42 from "node:path";
40461
+ import path43 from "node:path";
40337
40462
  function toProjectedTrainingData(projection) {
40338
40463
  return projection ? {
40339
40464
  path: projection.outputPath,
@@ -40368,7 +40493,7 @@ function createTrainingDatasetSelection(input) {
40368
40493
  seed,
40369
40494
  selectionStrategy: plan.recipe.method === "grpo" ? plan.recipe.dataset.selectionStrategy : "stable_hash_top_n",
40370
40495
  approvedSourceIds: plan.dataPolicy.approvedSourceIds,
40371
- outputPath: path42.join(
40496
+ outputPath: path43.join(
40372
40497
  input.storeDir,
40373
40498
  "training",
40374
40499
  "projections",
@@ -40382,7 +40507,7 @@ function createTrainingDatasetSelection(input) {
40382
40507
 
40383
40508
  // ../server/src/training/training-service-helpers.ts
40384
40509
  import { readFile as readFile8 } from "node:fs/promises";
40385
- import path43 from "node:path";
40510
+ import path44 from "node:path";
40386
40511
  function withAuthoritativeRecipeHashes(taskset, recipe) {
40387
40512
  if (!recipe || typeof recipe !== "object" || Array.isArray(recipe)) {
40388
40513
  return recipe;
@@ -40530,8 +40655,8 @@ function positiveInteger(value, fallback) {
40530
40655
  return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : fallback;
40531
40656
  }
40532
40657
  function isInside(root, target) {
40533
- const relative2 = path43.relative(root, target);
40534
- return relative2 !== "" && !relative2.startsWith("..") && !path43.isAbsolute(relative2);
40658
+ const relative2 = path44.relative(root, target);
40659
+ return relative2 !== "" && !relative2.startsWith("..") && !path44.isAbsolute(relative2);
40535
40660
  }
40536
40661
  async function assertArtifactIntegrity(artifactPath2, expectedHash, expectedSize) {
40537
40662
  const bytes2 = await readFile8(artifactPath2);
@@ -40544,14 +40669,14 @@ async function assertArtifactIntegrity(artifactPath2, expectedHash, expectedSize
40544
40669
 
40545
40670
  // ../server/src/training/openpond-managed-training-adapter.ts
40546
40671
  import { readFile as readFile10 } from "node:fs/promises";
40547
- import path47 from "node:path";
40672
+ import path48 from "node:path";
40548
40673
 
40549
40674
  // ../server/src/training/managed-rl-local-rollout-executor.ts
40550
40675
  import { randomUUID as randomUUID18 } from "node:crypto";
40551
40676
 
40552
40677
  // ../server/src/training/marketing-portfolio-managed-rl-adapter.ts
40553
40678
  import { createHash as createHash12 } from "node:crypto";
40554
- import path46 from "node:path";
40679
+ import path47 from "node:path";
40555
40680
 
40556
40681
  // ../server/src/training/marketing-portfolio-constraint-repair.ts
40557
40682
  var CHANNEL_IDS = [
@@ -40994,7 +41119,7 @@ function declaredEnvironmentId(taskset) {
40994
41119
 
40995
41120
  // ../server/src/training/marketing-portfolio-runtime-verifier.ts
40996
41121
  import { readFile as readFile9, readdir as readdir3 } from "node:fs/promises";
40997
- import path44 from "node:path";
41122
+ import path45 from "node:path";
40998
41123
  var AGENT_ID = "marketing-portfolio-manager";
40999
41124
  var ACTION_IDS = [
41000
41125
  "get-portfolio-snapshot",
@@ -41013,13 +41138,13 @@ async function verifyMarketingPortfolioRuntime(input) {
41013
41138
  scorer.profileRelativeAgentPath,
41014
41139
  "marketing Harness Agent path"
41015
41140
  );
41016
- const profileRoot = path44.resolve(input.harnessRoot);
41017
- const agentRoot = path44.resolve(profileRoot, relativeAgentPath);
41018
- const relative2 = path44.relative(profileRoot, agentRoot);
41019
- if (relative2.startsWith("..") || path44.isAbsolute(relative2)) {
41141
+ const profileRoot = path45.resolve(input.harnessRoot);
41142
+ const agentRoot = path45.resolve(profileRoot, relativeAgentPath);
41143
+ const relative2 = path45.relative(profileRoot, agentRoot);
41144
+ if (relative2.startsWith("..") || path45.isAbsolute(relative2)) {
41020
41145
  throw new Error("Pinned marketing Agent source escapes the Harness bundle.");
41021
41146
  }
41022
- const manifestPath = path44.join(agentRoot, ".openpond", "agent-manifest.json");
41147
+ const manifestPath = path45.join(agentRoot, ".openpond", "agent-manifest.json");
41023
41148
  const manifestBytes = await readFile9(manifestPath);
41024
41149
  const manifest = object2(
41025
41150
  JSON.parse(manifestBytes.toString("utf8")),
@@ -41070,9 +41195,9 @@ async function verifyMarketingPortfolioRuntime(input) {
41070
41195
  }
41071
41196
  }
41072
41197
  const scorerModule = requiredString4(scorer.module, "marketing scorer module");
41073
- const scorerModulePath = path44.resolve(agentRoot, scorerModule);
41074
- const relativeScorer = path44.relative(agentRoot, scorerModulePath);
41075
- if (relativeScorer.startsWith("..") || path44.isAbsolute(relativeScorer)) {
41198
+ const scorerModulePath = path45.resolve(agentRoot, scorerModule);
41199
+ const relativeScorer = path45.relative(agentRoot, scorerModulePath);
41200
+ if (relativeScorer.startsWith("..") || path45.isAbsolute(relativeScorer)) {
41076
41201
  throw new Error("Pinned marketing scorer escapes the Agent release.");
41077
41202
  }
41078
41203
  const scorerImplementationHash = sha256(await readFile9(scorerModulePath));
@@ -41098,7 +41223,7 @@ function withoutEpisodeSelector(schema, selector) {
41098
41223
  async function agentReleaseInventory(root) {
41099
41224
  const inventory = [];
41100
41225
  for (const file of await regularFiles(root)) {
41101
- const relative2 = path44.relative(root, file).split(path44.sep).join("/");
41226
+ const relative2 = path45.relative(root, file).split(path45.sep).join("/");
41102
41227
  if (relative2.startsWith("node_modules/") || relative2.startsWith(".openpond/traces/") || relative2 === ".openpond/eval-results.json") {
41103
41228
  continue;
41104
41229
  }
@@ -41117,7 +41242,7 @@ async function regularFiles(root) {
41117
41242
  if (entry.isSymbolicLink()) {
41118
41243
  throw new Error("Harness Agent releases cannot contain symlinks.");
41119
41244
  }
41120
- const target = path44.join(root, entry.name);
41245
+ const target = path45.join(root, entry.name);
41121
41246
  if (entry.isDirectory()) {
41122
41247
  if (entry.name !== "node_modules") files.push(...await regularFiles(target));
41123
41248
  } else if (entry.isFile()) {
@@ -41146,14 +41271,14 @@ function requiredString4(value, label) {
41146
41271
  // ../server/src/training/profile-agent-harness-runtime.ts
41147
41272
  import { spawn as spawn6 } from "node:child_process";
41148
41273
  import { mkdir as mkdir6 } from "node:fs/promises";
41149
- import path45 from "node:path";
41274
+ import path46 from "node:path";
41150
41275
  var MAX_PROCESS_OUTPUT_BYTES = 4 * 1024 * 1024;
41151
41276
  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
41277
  function createProfileAgentHarnessRuntime(input) {
41153
41278
  const nodePath2 = input.nodePath ?? process.execPath;
41154
- const agentCliPath = input.agentCliPath ?? path45.resolve(process.cwd(), "node_modules", ".bin", "openpond-agent");
41279
+ const agentCliPath = input.agentCliPath ?? path46.resolve(process.cwd(), "node_modules", ".bin", "openpond-agent");
41155
41280
  async function executeAction2(action) {
41156
- const actionArtifactRoot = path45.join(
41281
+ const actionArtifactRoot = path46.join(
41157
41282
  input.artifactRoot,
41158
41283
  "agent-actions",
41159
41284
  `${action.binding.actionId}-${contentHash(action.arguments).slice(0, 16)}`
@@ -41240,7 +41365,7 @@ async function runBoundedProcess(input) {
41240
41365
  size += chunk.byteLength;
41241
41366
  if (size > MAX_PROCESS_OUTPUT_BYTES) {
41242
41367
  child.kill("SIGKILL");
41243
- fail2(new Error(`${path45.basename(input.command)} output exceeded its limit.`));
41368
+ fail2(new Error(`${path46.basename(input.command)} output exceeded its limit.`));
41244
41369
  } else {
41245
41370
  target.push(chunk);
41246
41371
  }
@@ -41255,7 +41380,7 @@ async function runBoundedProcess(input) {
41255
41380
  if (code !== 0) {
41256
41381
  fail2(
41257
41382
  new Error(
41258
- `${path45.basename(input.command)} failed ${signal ? `with ${signal}` : `with exit code ${code}`}: ${err.slice(0, 2e3)}`
41383
+ `${path46.basename(input.command)} failed ${signal ? `with ${signal}` : `with exit code ${code}`}: ${err.slice(0, 2e3)}`
41259
41384
  )
41260
41385
  );
41261
41386
  } else {
@@ -41310,7 +41435,7 @@ async function executeMarketingPortfolioManagedRl(input) {
41310
41435
  const runtime = createProfileAgentHarnessRuntime({
41311
41436
  agentRoot: verified.agentRoot,
41312
41437
  scorerModulePath: verified.scorerModulePath,
41313
- artifactRoot: path46.join(input.storeDir, "training", "managed-rl-local", input.claim.jobId, input.claim.executionId)
41438
+ artifactRoot: path47.join(input.storeDir, "training", "managed-rl-local", input.claim.jobId, input.claim.executionId)
41314
41439
  });
41315
41440
  const baseSeed = typeof input.claim.request.seed === "number" && Number.isInteger(input.claim.request.seed) ? input.claim.request.seed : 0;
41316
41441
  const startedAt = (input.timestamp ?? (() => (/* @__PURE__ */ new Date()).toISOString()))();
@@ -41599,25 +41724,25 @@ var ManagedRlLocalRolloutExecutor = class {
41599
41724
  }
41600
41725
  throw lastError;
41601
41726
  }
41602
- async userRequest(path63, init) {
41727
+ async userRequest(path64, init) {
41603
41728
  const headers = hostedApiAuthHeaders(this.input.access.token);
41604
41729
  headers.set("accept", "application/json");
41605
41730
  headers.set("content-type", "application/json");
41606
41731
  headers.set("x-openpond-team-id", this.input.access.teamId);
41607
- const requestUrl = `${this.input.access.apiBaseUrl}${path63}`;
41732
+ const requestUrl = `${this.input.access.apiBaseUrl}${path64}`;
41608
41733
  return requestJson(this.input.fetchImpl ?? fetch, requestUrl, {
41609
41734
  ...init,
41610
41735
  headers: withVercelProtectionBypass(requestUrl, headers, this.input.env),
41611
41736
  signal: this.abortController.signal
41612
41737
  });
41613
41738
  }
41614
- policyRequest(path63, token, request, signal = this.abortController.signal) {
41739
+ policyRequest(path64, token, request, signal = this.abortController.signal) {
41615
41740
  const headers = new Headers({
41616
41741
  accept: "application/json",
41617
41742
  authorization: `Bearer ${token}`,
41618
41743
  "content-type": "application/json"
41619
41744
  });
41620
- const requestUrl = `${this.input.access.apiBaseUrl}${path63}`;
41745
+ const requestUrl = `${this.input.access.apiBaseUrl}${path64}`;
41621
41746
  return requestJson(
41622
41747
  this.input.fetchImpl ?? fetch,
41623
41748
  requestUrl,
@@ -42210,7 +42335,7 @@ var OpenPondManagedTrainingAdapter = class {
42210
42335
  if (validationTasks.length === 0) {
42211
42336
  throw new Error("OpenPond Managed requires at least one private validation task.");
42212
42337
  }
42213
- const bundleDirectory = path47.join(
42338
+ const bundleDirectory = path48.join(
42214
42339
  this.dependencies.storeDir,
42215
42340
  "training",
42216
42341
  "portable-releases",
@@ -42218,14 +42343,14 @@ var OpenPondManagedTrainingAdapter = class {
42218
42343
  plan.manifest.resolvedBundleHash
42219
42344
  );
42220
42345
  const bundleManifest = JSON.parse(
42221
- await this.readFileImpl(path47.join(bundleDirectory, "bundle-manifest.json"), "utf8")
42346
+ await this.readFileImpl(path48.join(bundleDirectory, "bundle-manifest.json"), "utf8")
42222
42347
  );
42223
42348
  if (bundleManifest.contentHash !== plan.manifest.resolvedBundleHash) {
42224
42349
  throw new Error("The managed resolved bundle changed before upload.");
42225
42350
  }
42226
42351
  const files = await Promise.all(
42227
42352
  bundleManifest.files.map(async (file) => {
42228
- const value = await this.readFileImpl(path47.join(bundleDirectory, file.path));
42353
+ const value = await this.readFileImpl(path48.join(bundleDirectory, file.path));
42229
42354
  if (value.byteLength !== file.sizeBytes || sha256(value) !== file.sha256) {
42230
42355
  throw new Error(`Managed training bundle file ${file.path} changed before upload.`);
42231
42356
  }
@@ -42427,7 +42552,7 @@ var OpenPondManagedTrainingAdapter = class {
42427
42552
  env: this.dependencies.env,
42428
42553
  store: this.dependencies.store,
42429
42554
  storeDir: this.dependencies.storeDir,
42430
- harnessRoot: path47.join(
42555
+ harnessRoot: path48.join(
42431
42556
  this.dependencies.storeDir,
42432
42557
  "training",
42433
42558
  "harnesses",
@@ -42501,11 +42626,11 @@ function createDestinationTrainingEngineRegistry(input) {
42501
42626
 
42502
42627
  // ../server/src/training/portable-model-run-service.ts
42503
42628
  import { mkdir as mkdir7, readFile as readFile12, writeFile as writeFile5 } from "node:fs/promises";
42504
- import path50 from "node:path";
42629
+ import path51 from "node:path";
42505
42630
 
42506
42631
  // ../server/src/training/portable-model-run-artifacts.ts
42507
42632
  import { readFile as readFile11, stat as stat6 } from "node:fs/promises";
42508
- import path48 from "node:path";
42633
+ import path49 from "node:path";
42509
42634
  import { fileURLToPath as fileURLToPath3 } from "node:url";
42510
42635
  async function importPortableModelRunArtifacts(input) {
42511
42636
  assertArtifacts(input.portable, input.executionRef, input.job);
@@ -42549,7 +42674,7 @@ async function importPortableModelRunArtifacts(input) {
42549
42674
  };
42550
42675
  }
42551
42676
  async function readRecoveredPortableArtifacts(input) {
42552
- const receipt = path48.join(
42677
+ const receipt = path49.join(
42553
42678
  input.storeDir,
42554
42679
  "training",
42555
42680
  "connected-artifacts",
@@ -42654,7 +42779,7 @@ function localArtifactPath(objectRef) {
42654
42779
  if (/^[a-z][a-z0-9+.-]*:/i.test(objectRef)) {
42655
42780
  throw new Error(`Portable artifact ${objectRef} was not materialized locally.`);
42656
42781
  }
42657
- return path48.resolve(objectRef);
42782
+ return path49.resolve(objectRef);
42658
42783
  }
42659
42784
  function managedRlCandidateRef(objectRef, expectedJobId) {
42660
42785
  const match = objectRef.match(/^sandbox-managed-rl:\/\/([^/]+)\/([^/?#]+)$/);
@@ -42688,15 +42813,15 @@ function portableFilenameFromRef(objectRef) {
42688
42813
  return basename.match(/^\d+-[a-f0-9]{12}-(.+)$/)?.[1] ?? basename;
42689
42814
  }
42690
42815
  function portableFilename(value) {
42691
- return typeof value === "string" && value.trim() ? path48.basename(value.replaceAll("\\", "/")) : null;
42816
+ return typeof value === "string" && value.trim() ? path49.basename(value.replaceAll("\\", "/")) : null;
42692
42817
  }
42693
42818
  function isAdapterWeights(name) {
42694
- const filename = path48.basename(name.replaceAll("\\", "/"));
42819
+ const filename = path49.basename(name.replaceAll("\\", "/"));
42695
42820
  return filename === "adapter_model.safetensors" || /^adapter_model-\d{5}-of-\d{5}\.safetensors$/.test(filename);
42696
42821
  }
42697
42822
  function trainingArtifactKind(kind, filename) {
42698
42823
  if (isAdapterWeights(filename)) return "adapter";
42699
- if (path48.basename(filename) === "adapter_config.json") {
42824
+ if (path49.basename(filename) === "adapter_config.json") {
42700
42825
  return "manifest";
42701
42826
  }
42702
42827
  if (kind === "trace") return "log";
@@ -42714,7 +42839,7 @@ function objectValue(value) {
42714
42839
  }
42715
42840
 
42716
42841
  // ../server/src/training/portable-model-run-lifecycle.ts
42717
- import path49 from "node:path";
42842
+ import path50 from "node:path";
42718
42843
  async function preparePortableModelRunLifecycle(input) {
42719
42844
  const baseModel = input.draft.baseModel;
42720
42845
  const method = input.draft.method;
@@ -43109,9 +43234,9 @@ function jobStatus(state) {
43109
43234
  return state;
43110
43235
  }
43111
43236
  function artifactReceiptPath(storeDir, artifactPath2) {
43112
- const relative2 = path49.relative(storeDir, artifactPath2);
43113
- if (relative2 && relative2 !== ".." && !relative2.startsWith(`..${path49.sep}`) && !path49.isAbsolute(relative2)) {
43114
- return relative2.split(path49.sep).join("/");
43237
+ const relative2 = path50.relative(storeDir, artifactPath2);
43238
+ if (relative2 && relative2 !== ".." && !relative2.startsWith(`..${path50.sep}`) && !path50.isAbsolute(relative2)) {
43239
+ return relative2.split(path50.sep).join("/");
43115
43240
  }
43116
43241
  return artifactPath2;
43117
43242
  }
@@ -43882,9 +44007,9 @@ function assertSubmittedManifest(input, expected) {
43882
44007
  }
43883
44008
  }
43884
44009
  async function publishRunGraph(input) {
43885
- const manifestDirectory = path50.join(input.storeDir, "training", "portable-releases", "manifests");
44010
+ const manifestDirectory = path51.join(input.storeDir, "training", "portable-releases", "manifests");
43886
44011
  await mkdir7(manifestDirectory, { recursive: true });
43887
- const manifestPath = path50.join(manifestDirectory, `${input.graph.manifest.contentHash}.json`);
44012
+ const manifestPath = path51.join(manifestDirectory, `${input.graph.manifest.contentHash}.json`);
43888
44013
  const serialized = `${JSON.stringify(input.graph.manifest, null, 2)}
43889
44014
  `;
43890
44015
  await writeFile5(manifestPath, serialized, {
@@ -43899,7 +44024,7 @@ async function publishRunGraph(input) {
43899
44024
  const resolvedBundle = await materializeResolvedTrainingBundle({
43900
44025
  manifest: input.graph.resolvedBundleManifest,
43901
44026
  assets: input.graph.assets,
43902
- cacheRoot: path50.join(input.storeDir, "training", "portable-releases", "resolved-bundles")
44027
+ cacheRoot: path51.join(input.storeDir, "training", "portable-releases", "resolved-bundles")
43903
44028
  });
43904
44029
  if (resolvedBundle.manifest.contentHash !== input.graph.manifest.resolvedBundleHash) {
43905
44030
  throw new Error("Resolved Training Bundle does not match the Harness Run Manifest.");
@@ -43988,12 +44113,12 @@ function createPortableTrainingServiceSupport(input) {
43988
44113
 
43989
44114
  // ../server/src/training/training-artifact-export-service.ts
43990
44115
  import { readFile as readFile13 } from "node:fs/promises";
43991
- import path51 from "node:path";
44116
+ import path52 from "node:path";
43992
44117
  function createTrainingArtifactExportService(deps) {
43993
44118
  async function exportBundle(bundleId) {
43994
44119
  const bundle = await deps.store.getTrainingBundle(bundleId);
43995
44120
  if (!bundle) throw new Error("Training Bundle not found.");
43996
- const directory = path51.join(
44121
+ const directory = path52.join(
43997
44122
  deps.storeDir,
43998
44123
  "training",
43999
44124
  "bundles",
@@ -44484,7 +44609,7 @@ function createTrainingModelBindingService(deps) {
44484
44609
  }
44485
44610
 
44486
44611
  // ../server/src/training/training-plan-lifecycle-service.ts
44487
- import path52 from "node:path";
44612
+ import path53 from "node:path";
44488
44613
  function createTrainingPlanLifecycleService(deps) {
44489
44614
  async function createPlan(input) {
44490
44615
  const taskset = await deps.store.getTaskset(input.tasksetId);
@@ -44542,7 +44667,7 @@ function createTrainingPlanLifecycleService(deps) {
44542
44667
  if (!plan) throw new Error("Training Plan not found.");
44543
44668
  const taskset = await deps.store.getTaskset(plan.tasksetId);
44544
44669
  if (!taskset) throw new Error("Taskset not found.");
44545
- const directory = path52.join(
44670
+ const directory = path53.join(
44546
44671
  deps.storeDir,
44547
44672
  "training",
44548
44673
  "bundles",
@@ -44832,13 +44957,13 @@ function createTrainingService(deps) {
44832
44957
  const activeJob = relatedJobs.find((job) => ["queued", "starting", "running", "cancelling", "reconciling"].includes(job.status));
44833
44958
  if (activeJob) throw new Error("Cancel the active training job before deleting this model.");
44834
44959
  const jobIds = new Set(relatedJobs.map((job) => job.id));
44835
- const managedTrainingRoot = path53.resolve(deps.storeDir, "training");
44960
+ const managedTrainingRoot = path54.resolve(deps.storeDir, "training");
44836
44961
  for (const artifact of artifacts.filter((artifact2) => jobIds.has(artifact2.jobId))) {
44837
- const artifactPath2 = path53.resolve(artifact.path);
44962
+ const artifactPath2 = path54.resolve(artifact.path);
44838
44963
  if (isInside(managedTrainingRoot, artifactPath2)) await rm3(artifactPath2, { force: true, recursive: true });
44839
44964
  }
44840
- for (const planId of planIds) await rm3(path53.join(managedTrainingRoot, "bundles", planId), { force: true, recursive: true });
44841
- await rm3(path53.join(managedTrainingRoot, "tasksets", taskset.id), { force: true, recursive: true });
44965
+ for (const planId of planIds) await rm3(path54.join(managedTrainingRoot, "bundles", planId), { force: true, recursive: true });
44966
+ await rm3(path54.join(managedTrainingRoot, "tasksets", taskset.id), { force: true, recursive: true });
44842
44967
  await deps.store.deleteTasksetData(tasksetId);
44843
44968
  return { deleted: true, tasksetId };
44844
44969
  }
@@ -44982,7 +45107,7 @@ function createTrainingService(deps) {
44982
45107
  };
44983
45108
  }
44984
45109
  async function materializeHarnessSource(input) {
44985
- const root = path53.join(
45110
+ const root = path54.join(
44986
45111
  input.storeDir,
44987
45112
  "training",
44988
45113
  "harnesses",
@@ -44994,11 +45119,11 @@ async function materializeHarnessSource(input) {
44994
45119
  return;
44995
45120
  } catch {
44996
45121
  }
44997
- await mkdir8(path53.dirname(root), { recursive: true });
45122
+ await mkdir8(path54.dirname(root), { recursive: true });
44998
45123
  const temporary = `${root}.materializing-${process.pid}`;
44999
45124
  await rm3(temporary, { recursive: true, force: true });
45000
45125
  try {
45001
- await cp(path53.resolve(input.sourcePath), temporary, {
45126
+ await cp(path54.resolve(input.sourcePath), temporary, {
45002
45127
  recursive: true,
45003
45128
  force: false,
45004
45129
  errorOnExist: true
@@ -47083,7 +47208,7 @@ function yieldToRuntime() {
47083
47208
  // ../server/src/training/dataset-artifact-service.ts
47084
47209
  import { spawn as spawn7 } from "node:child_process";
47085
47210
  import { access as access3 } from "node:fs/promises";
47086
- import path54 from "node:path";
47211
+ import path55 from "node:path";
47087
47212
  var MAX_WORKER_OUTPUT_BYTES = 12 * 1024 * 1024;
47088
47213
  function createDatasetArtifactService(deps) {
47089
47214
  async function summaries(profileId) {
@@ -47192,7 +47317,7 @@ function createDatasetArtifactService(deps) {
47192
47317
  entry.relativeManifestPath
47193
47318
  );
47194
47319
  await access3(manifestPath);
47195
- const outputPath = path54.resolve(input.outputPath);
47320
+ const outputPath = path55.resolve(input.outputPath);
47196
47321
  const output = await runDatasetWorker(deps.workerProjectDir, [
47197
47322
  "project",
47198
47323
  "--manifest",
@@ -47283,9 +47408,9 @@ async function summary(entry) {
47283
47408
  });
47284
47409
  }
47285
47410
  function safeArtifactPath(rootValue, relativeValue) {
47286
- const root = path54.resolve(rootValue);
47287
- const candidate2 = path54.resolve(root, relativeValue);
47288
- if (candidate2 !== root && !candidate2.startsWith(`${root}${path54.sep}`)) {
47411
+ const root = path55.resolve(rootValue);
47412
+ const candidate2 = path55.resolve(root, relativeValue);
47413
+ if (candidate2 !== root && !candidate2.startsWith(`${root}${path55.sep}`)) {
47289
47414
  throw new Error("Dataset artifact path escapes its registered storage root.");
47290
47415
  }
47291
47416
  return candidate2;
@@ -47362,7 +47487,7 @@ import {
47362
47487
  rm as rm5,
47363
47488
  writeFile as writeFile6
47364
47489
  } from "node:fs/promises";
47365
- import path55 from "node:path";
47490
+ import path56 from "node:path";
47366
47491
 
47367
47492
  // ../server/src/training/dataset-imports/hugging-face.ts
47368
47493
  import { randomUUID as randomUUID20 } from "node:crypto";
@@ -47500,8 +47625,8 @@ ${split.split}`) ?? {
47500
47625
  inspectedAt: (/* @__PURE__ */ new Date()).toISOString(),
47501
47626
  metadata: {
47502
47627
  sourceSchemaHash: contentHash(
47503
- columns.map(({ path: path63, logicalType: logicalType2, nullable }) => ({
47504
- path: path63,
47628
+ columns.map(({ path: path64, logicalType: logicalType2, nullable }) => ({
47629
+ path: path64,
47505
47630
  logicalType: logicalType2,
47506
47631
  nullable
47507
47632
  }))
@@ -47550,10 +47675,10 @@ function parquetSourceFile(value, repositoryId, revision) {
47550
47675
  if (item?.dataset !== repositoryId || typeof item.config !== "string" || typeof item.split !== "string" || typeof item.filename !== "string" || !item.filename.toLowerCase().endsWith(".parquet")) {
47551
47676
  return [];
47552
47677
  }
47553
- const path63 = [item.config, item.split, item.filename].flatMap((segment) => segment.split("/")).map((segment) => segment.trim()).filter(Boolean).join("/");
47554
- if (!path63 || path63.split("/").includes("..")) return [];
47678
+ const path64 = [item.config, item.split, item.filename].flatMap((segment) => segment.split("/")).map((segment) => segment.trim()).filter(Boolean).join("/");
47679
+ if (!path64 || path64.split("/").includes("..")) return [];
47555
47680
  return [{
47556
- path: path63,
47681
+ path: path64,
47557
47682
  configuration: item.config,
47558
47683
  split: item.split,
47559
47684
  revision,
@@ -47626,8 +47751,8 @@ function sourceColumns(features, rows) {
47626
47751
  });
47627
47752
  }
47628
47753
  }
47629
- return [...paths.entries()].map(([path63, value]) => ({
47630
- path: path63,
47754
+ return [...paths.entries()].map(([path64, value]) => ({
47755
+ path: path64,
47631
47756
  logicalType: value.type,
47632
47757
  nullable: value.nullable,
47633
47758
  sampleValues: value.values.slice(0, 5)
@@ -47645,21 +47770,21 @@ function flattenRecord(value, prefix, paths, rows) {
47645
47770
  return;
47646
47771
  }
47647
47772
  for (const [key, child] of Object.entries(value)) {
47648
- const path63 = prefix ? `${prefix}.${key}` : key;
47773
+ const path64 = prefix ? `${prefix}.${key}` : key;
47649
47774
  if (child && typeof child === "object" && !Array.isArray(child)) {
47650
- flattenRecord(child, path63, paths, rows);
47775
+ flattenRecord(child, path64, paths, rows);
47651
47776
  } else {
47652
- paths.set(path63, {
47777
+ paths.set(path64, {
47653
47778
  type: logicalType(child),
47654
- nullable: rows.some((row) => nestedValue(row, path63) == null),
47655
- values: rows.map((row) => nestedValue(row, path63)).filter((item) => item != null)
47779
+ nullable: rows.some((row) => nestedValue(row, path64) == null),
47780
+ values: rows.map((row) => nestedValue(row, path64)).filter((item) => item != null)
47656
47781
  });
47657
47782
  }
47658
47783
  }
47659
47784
  }
47660
- function nestedValue(value, path63) {
47785
+ function nestedValue(value, path64) {
47661
47786
  let current = value;
47662
- for (const segment of path63.split(".")) {
47787
+ for (const segment of path64.split(".")) {
47663
47788
  const record11 = asRecord15(current);
47664
47789
  if (!record11) return null;
47665
47790
  current = record11[segment];
@@ -48346,7 +48471,7 @@ function createDatasetImportService(deps) {
48346
48471
  ...current,
48347
48472
  status: "materializing",
48348
48473
  mapping,
48349
- targetStorageRoot: path55.resolve(targetStorageRoot),
48474
+ targetStorageRoot: path56.resolve(targetStorageRoot),
48350
48475
  tasksetId: current.tasksetId ?? safeTasksetId(input.name, current.id),
48351
48476
  tasksetRevision: current.status === "ready" ? (existingTaskset?.revision ?? current.tasksetRevision ?? 0) + 1 : current.tasksetRevision ?? 1,
48352
48477
  error: null,
@@ -48405,11 +48530,11 @@ function createDatasetImportService(deps) {
48405
48530
  let job = initial;
48406
48531
  const inspection = job.inspection;
48407
48532
  const mapping = job.mapping;
48408
- const configuredRoot = path55.resolve(job.targetStorageRoot);
48409
- const stagingRoot = path55.join(configuredRoot, "staging", job.id);
48410
- const sourceStaging = path55.join(stagingRoot, "source");
48411
- const materializedStaging = path55.join(stagingRoot, "materialized");
48412
- const finalRoot = path55.join(
48533
+ const configuredRoot = path56.resolve(job.targetStorageRoot);
48534
+ const stagingRoot = path56.join(configuredRoot, "staging", job.id);
48535
+ const sourceStaging = path56.join(stagingRoot, "source");
48536
+ const materializedStaging = path56.join(stagingRoot, "materialized");
48537
+ const finalRoot = path56.join(
48413
48538
  configuredRoot,
48414
48539
  "tasksets",
48415
48540
  job.tasksetId,
@@ -48461,7 +48586,7 @@ function createDatasetImportService(deps) {
48461
48586
  });
48462
48587
  continue;
48463
48588
  }
48464
- const temporary = path55.join(sourceStaging, `${index}.parquet.partial`);
48589
+ const temporary = path56.join(sourceStaging, `${index}.parquet.partial`);
48465
48590
  const result2 = await downloadDatasetFile({
48466
48591
  request,
48467
48592
  url: huggingFaceResolveUrl(
@@ -48484,14 +48609,14 @@ function createDatasetImportService(deps) {
48484
48609
  });
48485
48610
  }
48486
48611
  });
48487
- const relativeBlob = path55.join(
48612
+ const relativeBlob = path56.join(
48488
48613
  "blobs",
48489
48614
  "sha256",
48490
48615
  result2.contentHash.slice(0, 2),
48491
48616
  result2.contentHash
48492
48617
  );
48493
- const blobPath = path55.join(configuredRoot, relativeBlob);
48494
- await mkdir10(path55.dirname(blobPath), { recursive: true });
48618
+ const blobPath = path56.join(configuredRoot, relativeBlob);
48619
+ await mkdir10(path56.dirname(blobPath), { recursive: true });
48495
48620
  await installVerifiedDatasetBlob({
48496
48621
  temporaryPath: temporary,
48497
48622
  blobPath,
@@ -48529,8 +48654,8 @@ function createDatasetImportService(deps) {
48529
48654
  });
48530
48655
  const sourceId = `dataset_source_${sourceHash.slice(0, 24)}`;
48531
48656
  await mkdir10(materializedStaging, { recursive: true });
48532
- const controlPath = path55.join(stagingRoot, "materialize-control.json");
48533
- const resultPath = path55.join(stagingRoot, "materialize-result.json");
48657
+ const controlPath = path56.join(stagingRoot, "materialize-control.json");
48658
+ const resultPath = path56.join(stagingRoot, "materialize-result.json");
48534
48659
  await writeFile6(
48535
48660
  controlPath,
48536
48661
  canonicalJson({
@@ -48674,31 +48799,31 @@ function createDatasetImportService(deps) {
48674
48799
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
48675
48800
  };
48676
48801
  await writeFile6(
48677
- path55.join(materializedStaging, "dataset-manifest.json"),
48802
+ path56.join(materializedStaging, "dataset-manifest.json"),
48678
48803
  canonicalJson(manifest),
48679
48804
  "utf8"
48680
48805
  );
48681
48806
  await writeFile6(
48682
- path55.join(materializedStaging, "taskset.json"),
48807
+ path56.join(materializedStaging, "taskset.json"),
48683
48808
  canonicalJson(taskset),
48684
48809
  "utf8"
48685
48810
  );
48686
48811
  await writeFile6(
48687
- path55.join(materializedStaging, "receipt.json"),
48812
+ path56.join(materializedStaging, "receipt.json"),
48688
48813
  canonicalJson(receipt),
48689
48814
  "utf8"
48690
48815
  );
48691
48816
  await writeFile6(
48692
- path55.join(materializedStaging, "mapping.json"),
48817
+ path56.join(materializedStaging, "mapping.json"),
48693
48818
  canonicalJson(mapping),
48694
48819
  "utf8"
48695
48820
  );
48696
48821
  await writeFile6(
48697
- path55.join(materializedStaging, "quality-report.json"),
48822
+ path56.join(materializedStaging, "quality-report.json"),
48698
48823
  canonicalJson(result.qualityReport),
48699
48824
  "utf8"
48700
48825
  );
48701
- await mkdir10(path55.dirname(finalRoot), { recursive: true });
48826
+ await mkdir10(path56.dirname(finalRoot), { recursive: true });
48702
48827
  await rm5(finalRoot, { recursive: true, force: true });
48703
48828
  await rename4(materializedStaging, finalRoot);
48704
48829
  await deps.store.upsertExternalDatasetSource(source);
@@ -48775,7 +48900,7 @@ function reusableSourceFiles(taskset, configuredRoot) {
48775
48900
  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
48901
  continue;
48777
48902
  }
48778
- const blobPath = path55.join(
48903
+ const blobPath = path56.join(
48779
48904
  configuredRoot,
48780
48905
  "blobs",
48781
48906
  "sha256",
@@ -49029,8 +49154,8 @@ function planItem(stage, split, taskIds, multiplier) {
49029
49154
  }
49030
49155
 
49031
49156
  // ../server/src/training/harness-refiner-benchmark-result-persistence.ts
49032
- import { promises as fs23 } from "node:fs";
49033
- import path56 from "node:path";
49157
+ import { promises as fs24 } from "node:fs";
49158
+ import path57 from "node:path";
49034
49159
  function createResultManifest(input) {
49035
49160
  const core = {
49036
49161
  schemaVersion: "openpond.harnessRefinerBenchmarkResult.v2",
@@ -49065,25 +49190,25 @@ function createResultManifest(input) {
49065
49190
  return { ...core, contentHash: contentHash(core) };
49066
49191
  }
49067
49192
  async function writeManagedResult(storeDir, modelRunId, manifest) {
49068
- const root = path56.join(storeDir, "training", "model-runs", modelRunId, "benchmark");
49069
- await fs23.mkdir(root, { recursive: true });
49070
- const filePath = path56.join(root, `${manifest.contentHash}.json`);
49071
- await fs23.writeFile(filePath, `${JSON.stringify(manifest, null, 2)}
49193
+ const root = path57.join(storeDir, "training", "model-runs", modelRunId, "benchmark");
49194
+ await fs24.mkdir(root, { recursive: true });
49195
+ const filePath = path57.join(root, `${manifest.contentHash}.json`);
49196
+ await fs24.writeFile(filePath, `${JSON.stringify(manifest, null, 2)}
49072
49197
  `, "utf8");
49073
- return path56.relative(storeDir, filePath).replaceAll(path56.sep, "/");
49198
+ return path57.relative(storeDir, filePath).replaceAll(path57.sep, "/");
49074
49199
  }
49075
49200
  async function loadLatestManagedResult(storeDir, modelRunId) {
49076
- const root = path56.join(storeDir, "training", "model-runs", modelRunId, "benchmark");
49201
+ const root = path57.join(storeDir, "training", "model-runs", modelRunId, "benchmark");
49077
49202
  let entries;
49078
49203
  try {
49079
- entries = (await fs23.readdir(root)).filter((entry) => entry.endsWith(".json"));
49204
+ entries = (await fs24.readdir(root)).filter((entry) => entry.endsWith(".json"));
49080
49205
  } catch (error) {
49081
49206
  if (error.code === "ENOENT") return null;
49082
49207
  throw error;
49083
49208
  }
49084
49209
  const manifests = await Promise.all(entries.map(async (entry) => {
49085
49210
  const value = JSON.parse(
49086
- await fs23.readFile(path56.join(root, entry), "utf8")
49211
+ await fs24.readFile(path57.join(root, entry), "utf8")
49087
49212
  );
49088
49213
  return value.schemaVersion === "openpond.harnessRefinerBenchmarkResult.v2" && value.modelRunId === modelRunId ? value : null;
49089
49214
  }));
@@ -49110,14 +49235,14 @@ async function preserveProfileResult(input) {
49110
49235
  },
49111
49236
  ...await Promise.all(sourceFiles.map(async (relativePath) => ({
49112
49237
  path: `${prefix}/candidate-harness/${relativePath}`,
49113
- contents: await fs23.readFile(path56.join(sourceRoot, ...relativePath.split("/")))
49238
+ contents: await fs24.readFile(path57.join(sourceRoot, ...relativePath.split("/")))
49114
49239
  })))
49115
49240
  ]
49116
49241
  });
49117
49242
  }
49118
49243
  async function listFiles(root, relative2 = "") {
49119
- const directory = path56.join(root, ...relative2.split("/").filter(Boolean));
49120
- const entries = await fs23.readdir(directory, { withFileTypes: true });
49244
+ const directory = path57.join(root, ...relative2.split("/").filter(Boolean));
49245
+ const entries = await fs24.readdir(directory, { withFileTypes: true });
49121
49246
  const files = [];
49122
49247
  for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
49123
49248
  const next = relative2 ? `${relative2}/${entry.name}` : entry.name;
@@ -49184,8 +49309,8 @@ async function ensureBaseVersion(input) {
49184
49309
  }
49185
49310
 
49186
49311
  // ../server/src/training/harness-refiner-benchmark-service-support.ts
49187
- import { promises as fs24 } from "node:fs";
49188
- import path57 from "node:path";
49312
+ import { promises as fs25 } from "node:fs";
49313
+ import path58 from "node:path";
49189
49314
  function completedStage(input) {
49190
49315
  return {
49191
49316
  run: input.run,
@@ -49471,15 +49596,15 @@ async function checkpointRefinerUsage(store, modelRunId, usage, observedSpendUsd
49471
49596
  });
49472
49597
  }
49473
49598
  async function checkpointEvidenceSnapshot(store, storeDir, modelRunId, snapshot) {
49474
- const directory = path57.join(
49599
+ const directory = path58.join(
49475
49600
  storeDir,
49476
49601
  "training",
49477
49602
  "harness-refiner-benchmarks",
49478
49603
  modelRunId
49479
49604
  );
49480
- await fs24.mkdir(directory, { recursive: true });
49481
- const artifactPath2 = path57.join(directory, "evidence-snapshot.json");
49482
- await fs24.writeFile(artifactPath2, `${JSON.stringify(snapshot, null, 2)}
49605
+ await fs25.mkdir(directory, { recursive: true });
49606
+ const artifactPath2 = path58.join(directory, "evidence-snapshot.json");
49607
+ await fs25.writeFile(artifactPath2, `${JSON.stringify(snapshot, null, 2)}
49483
49608
  `, "utf8");
49484
49609
  const run = await store.getModelRun(modelRunId);
49485
49610
  if (!run || run.status !== "running" || !run.evaluationProgress) return run;
@@ -49500,7 +49625,7 @@ async function loadOrReconstructEvidenceSnapshot(input) {
49500
49625
  const ref = input.modelRun.evaluationProgress?.evidenceSnapshot;
49501
49626
  if (ref) {
49502
49627
  const manifest = parseEvidenceSnapshotManifest(
49503
- JSON.parse(await fs24.readFile(ref.artifactPath, "utf8"))
49628
+ JSON.parse(await fs25.readFile(ref.artifactPath, "utf8"))
49504
49629
  );
49505
49630
  if (manifest.id !== ref.id || manifest.contentHash !== ref.contentHash) {
49506
49631
  throw new Error("Durable benchmark evidence snapshot does not match its admitted ref.");
@@ -50330,11 +50455,21 @@ async function runSequentialHarnessAdaptation(input) {
50330
50455
  for (const value of records) {
50331
50456
  if (!value || typeof value !== "object" || Array.isArray(value)) continue;
50332
50457
  const record11 = value;
50333
- const inputTokens = numericToken(record11, ["promptTokens", "inputTokens"]);
50334
- const outputTokens = numericToken(record11, ["completionTokens", "outputTokens"]);
50458
+ const inputTokens = numericToken(record11, [
50459
+ "promptTokens",
50460
+ "prompt_tokens",
50461
+ "inputTokens",
50462
+ "input_tokens"
50463
+ ]);
50464
+ const outputTokens = numericToken(record11, [
50465
+ "completionTokens",
50466
+ "completion_tokens",
50467
+ "outputTokens",
50468
+ "output_tokens"
50469
+ ]);
50335
50470
  total.inputTokens += inputTokens;
50336
50471
  total.outputTokens += outputTokens;
50337
- total.totalTokens += numericToken(record11, ["totalTokens"]) || inputTokens + outputTokens;
50472
+ total.totalTokens += numericToken(record11, ["totalTokens", "total_tokens"]) || inputTokens + outputTokens;
50338
50473
  }
50339
50474
  return total;
50340
50475
  },
@@ -51218,7 +51353,7 @@ function usageCost(usage, pricing) {
51218
51353
  // ../server/src/training/benchmark-tasksets.ts
51219
51354
  import { createHash as createHash15 } from "node:crypto";
51220
51355
  import { mkdir as mkdir11, readFile as readFile16, writeFile as writeFile7 } from "node:fs/promises";
51221
- import path58 from "node:path";
51356
+ import path59 from "node:path";
51222
51357
  var BUILTIN_DEFINITION_ID = "harness-refiner";
51223
51358
  function createBenchmarkTasksetService(input) {
51224
51359
  const now2 = input.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
@@ -51228,7 +51363,7 @@ function createBenchmarkTasksetService(input) {
51228
51363
  if (existing?.benchmark?.releaseId === harnessRefinerBenchmarkRelease.id && existing.benchmark.releaseHash === harnessRefinerBenchmarkRelease.contentHash) {
51229
51364
  return existing;
51230
51365
  }
51231
- const tasksetRoot = path58.join(
51366
+ const tasksetRoot = path59.join(
51232
51367
  input.storeDir,
51233
51368
  "training",
51234
51369
  "tasksets",
@@ -51248,7 +51383,7 @@ function createBenchmarkTasksetService(input) {
51248
51383
  }
51249
51384
  async function releaseForTaskset(taskset) {
51250
51385
  if (taskset.purpose !== "benchmark" || !taskset.benchmark) return null;
51251
- const releasePath = path58.resolve(
51386
+ const releasePath = path59.resolve(
51252
51387
  input.storeDir,
51253
51388
  "training",
51254
51389
  "tasksets",
@@ -51291,12 +51426,12 @@ async function projectRelease(input) {
51291
51426
  input.release.tasks.flatMap((task) => task.artifactRefs)
51292
51427
  );
51293
51428
  const managedAssetById = /* @__PURE__ */ new Map();
51294
- await mkdir11(path58.join(input.tasksetRoot, "assets"), { recursive: true });
51295
- await mkdir11(path58.join(input.tasksetRoot, "benchmark"), { recursive: true });
51296
- await mkdir11(path58.join(input.tasksetRoot, "rubrics"), { recursive: true });
51297
- await mkdir11(path58.join(input.tasksetRoot, "verifiers"), { recursive: true });
51429
+ await mkdir11(path59.join(input.tasksetRoot, "assets"), { recursive: true });
51430
+ await mkdir11(path59.join(input.tasksetRoot, "benchmark"), { recursive: true });
51431
+ await mkdir11(path59.join(input.tasksetRoot, "rubrics"), { recursive: true });
51432
+ await mkdir11(path59.join(input.tasksetRoot, "verifiers"), { recursive: true });
51298
51433
  await writeFile7(
51299
- path58.join(input.tasksetRoot, "benchmark", "taskset.release.json"),
51434
+ path59.join(input.tasksetRoot, "benchmark", "taskset.release.json"),
51300
51435
  JSON.stringify(input.release),
51301
51436
  "utf8"
51302
51437
  );
@@ -51305,9 +51440,9 @@ async function projectRelease(input) {
51305
51440
  if (contentHash(contents) !== asset.contentHash) {
51306
51441
  throw new Error(`Benchmark asset ${asset.path} failed its content hash.`);
51307
51442
  }
51308
- const fileName = `${asset.id}-${path58.basename(asset.path)}`;
51309
- const artifactRef = path58.posix.join("assets", fileName);
51310
- await writeFile7(path58.join(input.tasksetRoot, artifactRef), contents, "utf8");
51443
+ const fileName = `${asset.id}-${path59.basename(asset.path)}`;
51444
+ const artifactRef = path59.posix.join("assets", fileName);
51445
+ await writeFile7(path59.join(input.tasksetRoot, artifactRef), contents, "utf8");
51311
51446
  managedAssetById.set(asset.id, {
51312
51447
  artifactRef,
51313
51448
  fileName,
@@ -51534,7 +51669,7 @@ async function copyVerifierAsset(assets, tasksetRoot, asset) {
51534
51669
  if (contentHash(contents) !== asset.contentHash) {
51535
51670
  throw new Error(`Benchmark verifier asset ${asset.path} failed its content hash.`);
51536
51671
  }
51537
- await writeFile7(path58.join(tasksetRoot, asset.path), contents, "utf8");
51672
+ await writeFile7(path59.join(tasksetRoot, asset.path), contents, "utf8");
51538
51673
  return contents;
51539
51674
  }
51540
51675
  function builtinAsset(assets, assetPath) {
@@ -51605,9 +51740,9 @@ function stringValue11(value) {
51605
51740
  // ../server/src/training/local-taskset-work-runtime.ts
51606
51741
  import { execFile as execFile8 } from "node:child_process";
51607
51742
  import { createHash as createHash16, randomUUID as randomUUID24 } from "node:crypto";
51608
- import { existsSync as existsSync12, promises as fs25 } from "node:fs";
51743
+ import { existsSync as existsSync12, promises as fs26 } from "node:fs";
51609
51744
  import os9 from "node:os";
51610
- import path59 from "node:path";
51745
+ import path60 from "node:path";
51611
51746
  function createLocalTasksetWorkRuntime(deps) {
51612
51747
  return {
51613
51748
  createSession: async (payload) => {
@@ -51661,7 +51796,7 @@ async function executeLocalWorkspaceTool(input) {
51661
51796
  const request = record10(input.payload);
51662
51797
  const action = string2(request.action);
51663
51798
  const args = record10(request.args);
51664
- const root = path59.resolve(input.session.cwd);
51799
+ const root = path60.resolve(input.session.cwd);
51665
51800
  await ensureLayout(root);
51666
51801
  try {
51667
51802
  if (action === "sandbox_create" || action === "sandbox_start") {
@@ -51688,8 +51823,8 @@ async function executeLocalWorkspaceTool(input) {
51688
51823
  if (action === "sandbox_upload_file") {
51689
51824
  const target = localPath(root, string2(args.path));
51690
51825
  const bytes2 = Buffer.from(string2(args.contentsBase64), "base64");
51691
- await fs25.mkdir(path59.dirname(target), { recursive: true, mode: 448 });
51692
- await fs25.writeFile(target, bytes2, { mode: 384 });
51826
+ await fs26.mkdir(path60.dirname(target), { recursive: true, mode: 448 });
51827
+ await fs26.writeFile(target, bytes2, { mode: 384 });
51693
51828
  return ok(action, `Uploaded ${relative(root, target)}.`, fileData(target, bytes2));
51694
51829
  }
51695
51830
  if (action === "sandbox_list_files") {
@@ -51700,7 +51835,7 @@ async function executeLocalWorkspaceTool(input) {
51700
51835
  if (action === "sandbox_read_file") {
51701
51836
  const target = localPath(root, string2(args.path));
51702
51837
  const maxBytes = integer(args.maxBytes, 512e3, 1, 1e6);
51703
- const bytes2 = await fs25.readFile(target);
51838
+ const bytes2 = await fs26.readFile(target);
51704
51839
  const bounded = bytes2.subarray(0, maxBytes);
51705
51840
  return ok(action, bounded.toString("utf8"), {
51706
51841
  path: relative(root, target),
@@ -51712,24 +51847,24 @@ async function executeLocalWorkspaceTool(input) {
51712
51847
  if (action === "sandbox_write_file") {
51713
51848
  const target = localPath(root, string2(args.path));
51714
51849
  const contents = string2(args.content, true);
51715
- await fs25.mkdir(path59.dirname(target), { recursive: true, mode: 448 });
51716
- await fs25.writeFile(target, contents, { encoding: "utf8", mode: 384 });
51850
+ await fs26.mkdir(path60.dirname(target), { recursive: true, mode: 448 });
51851
+ await fs26.writeFile(target, contents, { encoding: "utf8", mode: 384 });
51717
51852
  return ok(action, `Wrote ${relative(root, target)}.`, fileData(target, Buffer.from(contents)));
51718
51853
  }
51719
51854
  if (action === "sandbox_edit_file") {
51720
51855
  const target = localPath(root, string2(args.path));
51721
- const contents = await fs25.readFile(target, "utf8");
51856
+ const contents = await fs26.readFile(target, "utf8");
51722
51857
  const oldText = string2(args.oldText);
51723
51858
  if (!contents.includes(oldText)) {
51724
51859
  return fail(action, "The exact text to replace was not found.");
51725
51860
  }
51726
51861
  const next = args.replaceAll === true ? contents.replaceAll(oldText, string2(args.newText, true)) : contents.replace(oldText, string2(args.newText, true));
51727
- await fs25.writeFile(target, next, { encoding: "utf8", mode: 384 });
51862
+ await fs26.writeFile(target, next, { encoding: "utf8", mode: 384 });
51728
51863
  return ok(action, `Edited ${relative(root, target)}.`, fileData(target, Buffer.from(next)));
51729
51864
  }
51730
51865
  if (action === "sandbox_delete_file") {
51731
51866
  const target = localPath(root, string2(args.path));
51732
- await fs25.rm(target, { recursive: args.recursive === true, force: true });
51867
+ await fs26.rm(target, { recursive: args.recursive === true, force: true });
51733
51868
  return ok(action, `Deleted ${relative(root, target)}.`, { path: relative(root, target) });
51734
51869
  }
51735
51870
  if (action === "sandbox_exec") {
@@ -51742,7 +51877,7 @@ async function executeLocalWorkspaceTool(input) {
51742
51877
  output: [result.stdout, result.stderr].filter(Boolean).join("\n").trim(),
51743
51878
  data: {
51744
51879
  command,
51745
- cwd: path59.join(root, "work"),
51880
+ cwd: path60.join(root, "work"),
51746
51881
  exitCode: result.code,
51747
51882
  stdout: result.stdout,
51748
51883
  stderr: result.stderr
@@ -51751,24 +51886,24 @@ async function executeLocalWorkspaceTool(input) {
51751
51886
  }
51752
51887
  if (action === "sandbox_save_output") {
51753
51888
  const source = localPath(root, string2(args.path));
51754
- const bytes2 = await fs25.readFile(source);
51889
+ const bytes2 = await fs26.readFile(source);
51755
51890
  if (bytes2.byteLength > WORK_OUTPUT_MAX_BYTES) {
51756
51891
  return fail(action, `Work output exceeds ${WORK_OUTPUT_MAX_BYTES.toLocaleString()} bytes.`);
51757
51892
  }
51758
51893
  const title = safeName2(
51759
- typeof args.suggestedName === "string" && args.suggestedName.trim() ? args.suggestedName : path59.basename(source)
51894
+ typeof args.suggestedName === "string" && args.suggestedName.trim() ? args.suggestedName : path60.basename(source)
51760
51895
  );
51761
- const contentType2 = WORK_OUTPUT_CONTENT_TYPES[path59.extname(title).toLowerCase()];
51896
+ const contentType2 = WORK_OUTPUT_CONTENT_TYPES[path60.extname(title).toLowerCase()];
51762
51897
  if (!contentType2) return fail(action, `${title} is not a supported Work output format.`);
51763
- const outputDir = path59.join(
51898
+ const outputDir = path60.join(
51764
51899
  input.deps.storeDir,
51765
51900
  "work",
51766
51901
  "outputs",
51767
51902
  safeName2(input.session.id)
51768
51903
  );
51769
- await fs25.mkdir(outputDir, { recursive: true, mode: 448 });
51770
- const destination = path59.join(outputDir, `001-${randomUUID24()}-${title}`);
51771
- await fs25.writeFile(destination, bytes2, { mode: 384 });
51904
+ await fs26.mkdir(outputDir, { recursive: true, mode: 448 });
51905
+ const destination = path60.join(outputDir, `001-${randomUUID24()}-${title}`);
51906
+ await fs26.writeFile(destination, bytes2, { mode: 384 });
51772
51907
  const outputRef = FileOutputRefSchema.parse({
51773
51908
  kind: "file",
51774
51909
  id: `output-${createHash16("sha256").update(destination).digest("hex").slice(0, 24)}`,
@@ -51805,25 +51940,25 @@ async function executeLocalWorkspaceTool(input) {
51805
51940
  }
51806
51941
  async function ensureLayout(root) {
51807
51942
  await Promise.all(["inputs", "work", "outputs"].map(
51808
- (area) => fs25.mkdir(path59.join(root, area), { recursive: true, mode: 448 })
51943
+ (area) => fs26.mkdir(path60.join(root, area), { recursive: true, mode: 448 })
51809
51944
  ));
51810
51945
  }
51811
51946
  function localPath(root, value) {
51812
51947
  const normalized = value.replaceAll("\\", "/").replace(/^\/+/, "").replace(/^workspace(?:\/|$)/, "");
51813
- const target = path59.resolve(root, normalized);
51814
- if (target !== root && !target.startsWith(`${root}${path59.sep}`)) {
51948
+ const target = path60.resolve(root, normalized);
51949
+ if (target !== root && !target.startsWith(`${root}${path60.sep}`)) {
51815
51950
  throw new Error("Local Work path escaped its isolated workspace.");
51816
51951
  }
51817
51952
  return target;
51818
51953
  }
51819
51954
  async function listFiles2(root, target, recursive) {
51820
- const stat7 = await fs25.stat(target).catch(() => null);
51955
+ const stat7 = await fs26.stat(target).catch(() => null);
51821
51956
  if (!stat7) return [];
51822
51957
  if (!stat7.isDirectory()) return [relative(root, target)];
51823
- const entries = await fs25.readdir(target, { withFileTypes: true });
51958
+ const entries = await fs26.readdir(target, { withFileTypes: true });
51824
51959
  const files = [];
51825
51960
  for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
51826
- const item = path59.join(target, entry.name);
51961
+ const item = path60.join(target, entry.name);
51827
51962
  files.push(relative(root, item));
51828
51963
  if (recursive && entry.isDirectory()) files.push(...await listFiles2(root, item, true));
51829
51964
  if (files.length >= 1e3) break;
@@ -51832,8 +51967,8 @@ async function listFiles2(root, target, recursive) {
51832
51967
  }
51833
51968
  function runCommand5(command, cwd, timeoutMs) {
51834
51969
  return new Promise((resolve) => {
51835
- const nodeRuntimeRoot = path59.dirname(path59.dirname(process.execPath));
51836
- const localPythonRoot = path59.join(os9.homedir(), ".local", "lib");
51970
+ const nodeRuntimeRoot = path60.dirname(path60.dirname(process.execPath));
51971
+ const localPythonRoot = path60.join(os9.homedir(), ".local", "lib");
51837
51972
  const sandboxArgs = [
51838
51973
  "--tmpfs",
51839
51974
  "/",
@@ -51952,7 +52087,7 @@ function integer(value, fallback, minimum, maximum) {
51952
52087
  return typeof value === "number" && Number.isInteger(value) ? Math.min(maximum, Math.max(minimum, value)) : fallback;
51953
52088
  }
51954
52089
  function relative(root, target) {
51955
- return path59.relative(root, target).replaceAll(path59.sep, "/");
52090
+ return path60.relative(root, target).replaceAll(path60.sep, "/");
51956
52091
  }
51957
52092
  function safeName2(value) {
51958
52093
  return value.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "output";
@@ -52007,12 +52142,12 @@ function createBenchmarkRuntimeComposition(input) {
52007
52142
  // ../server/src/training/dataset-storage-service.ts
52008
52143
  import { constants as constants3 } from "node:fs";
52009
52144
  import { access as access4, mkdir as mkdir12, readFile as readFile18, rename as rename5, statfs as statfs2, writeFile as writeFile8 } from "node:fs/promises";
52010
- import path61 from "node:path";
52145
+ import path62 from "node:path";
52011
52146
 
52012
52147
  // ../server/src/training/dataset-storage-discovery.ts
52013
52148
  import { readdir as readdir4, readFile as readFile17 } from "node:fs/promises";
52014
52149
  import os10 from "node:os";
52015
- import path60 from "node:path";
52150
+ import path61 from "node:path";
52016
52151
  var NETWORK_FILE_SYSTEMS = /* @__PURE__ */ new Set([
52017
52152
  "9p",
52018
52153
  "afpfs",
@@ -52098,7 +52233,7 @@ function parseLinuxMountInfo(value, storeDir) {
52098
52233
  candidates.push({
52099
52234
  kind,
52100
52235
  label: driveLabel(mountPath, source, kind),
52101
- datasetStorePath: mountPath === "/" ? path60.join(storeDir, "datasets") : path60.join(mountPath, "OpenPond", "datasets"),
52236
+ datasetStorePath: mountPath === "/" ? path61.join(storeDir, "datasets") : path61.join(mountPath, "OpenPond", "datasets"),
52102
52237
  path: mountPath
52103
52238
  });
52104
52239
  }
@@ -52117,7 +52252,7 @@ function parseMacMountOutput(value, storeDir) {
52117
52252
  candidates.push({
52118
52253
  kind,
52119
52254
  label: driveLabel(mountPath, source, kind),
52120
- datasetStorePath: mountPath === "/" ? path60.join(storeDir, "datasets") : path60.join(mountPath, "OpenPond", "datasets"),
52255
+ datasetStorePath: mountPath === "/" ? path61.join(storeDir, "datasets") : path61.join(mountPath, "OpenPond", "datasets"),
52121
52256
  path: mountPath
52122
52257
  });
52123
52258
  }
@@ -52140,11 +52275,11 @@ function parseWindowsLogicalDisks(value, storeDir) {
52140
52275
  const root = `${deviceId}\\`;
52141
52276
  const volumeName = typeof record11.VolumeName === "string" ? record11.VolumeName.trim() : "";
52142
52277
  const kind = driveType === 4 ? "network" : driveType === 2 ? "removable" : "local";
52143
- const storeRoot = path60.win32.parse(path60.win32.resolve(storeDir)).root.toLowerCase();
52278
+ const storeRoot = path61.win32.parse(path61.win32.resolve(storeDir)).root.toLowerCase();
52144
52279
  return [{
52145
52280
  kind,
52146
52281
  label: volumeName || (root.toLowerCase() === storeRoot ? "System disk" : deviceId.toUpperCase()),
52147
- datasetStorePath: root.toLowerCase() === storeRoot ? path60.win32.join(storeDir, "datasets") : path60.win32.join(root, "OpenPond", "datasets"),
52282
+ datasetStorePath: root.toLowerCase() === storeRoot ? path61.win32.join(storeDir, "datasets") : path61.win32.join(root, "OpenPond", "datasets"),
52148
52283
  path: root
52149
52284
  }];
52150
52285
  });
@@ -52158,25 +52293,25 @@ function storageKindForPath(value) {
52158
52293
  }
52159
52294
  async function discoverGvfsCandidates() {
52160
52295
  const uid = typeof process.getuid === "function" ? process.getuid() : os10.userInfo().uid;
52161
- const gvfsRoot = path60.join("/run/user", String(uid), "gvfs");
52296
+ const gvfsRoot = path61.join("/run/user", String(uid), "gvfs");
52162
52297
  const entries = await readdir4(gvfsRoot, { withFileTypes: true }).catch(() => []);
52163
52298
  return entries.flatMap((entry) => {
52164
52299
  if (!entry.isDirectory()) return [];
52165
- const mountedPath = path60.join(gvfsRoot, entry.name);
52300
+ const mountedPath = path61.join(gvfsRoot, entry.name);
52166
52301
  return [{
52167
52302
  kind: "network",
52168
52303
  label: labelForGvfsMount(entry.name),
52169
- datasetStorePath: path60.join(mountedPath, "OpenPond", "datasets"),
52304
+ datasetStorePath: path61.join(mountedPath, "OpenPond", "datasets"),
52170
52305
  path: mountedPath
52171
52306
  }];
52172
52307
  });
52173
52308
  }
52174
52309
  function systemStorageCandidate(storeDir, platform) {
52175
- const root = path60.parse(path60.resolve(storeDir)).root;
52310
+ const root = path61.parse(path61.resolve(storeDir)).root;
52176
52311
  return {
52177
52312
  kind: "local",
52178
52313
  label: "System disk",
52179
- datasetStorePath: path60.join(storeDir, "datasets"),
52314
+ datasetStorePath: path61.join(storeDir, "datasets"),
52180
52315
  path: platform === "win32" ? root : root || "/"
52181
52316
  };
52182
52317
  }
@@ -52195,12 +52330,12 @@ function storageKind(input) {
52195
52330
  }
52196
52331
  function driveLabel(mountPath, source, kind) {
52197
52332
  if (mountPath === "/") return "System disk";
52198
- const mountName = path60.basename(mountPath);
52333
+ const mountName = path61.basename(mountPath);
52199
52334
  if (kind === "network") {
52200
52335
  const sourceName = source.replace(/\/+$/, "").split("/").pop();
52201
52336
  return decodeSafely(sourceName || mountName || source);
52202
52337
  }
52203
- return decodeSafely(mountName || path60.basename(source) || source);
52338
+ return decodeSafely(mountName || path61.basename(source) || source);
52204
52339
  }
52205
52340
  function labelForGvfsMount(name) {
52206
52341
  const separator = name.indexOf(":");
@@ -52234,7 +52369,7 @@ function uniqueCandidates2(candidates) {
52234
52369
  return [...unique2.values()];
52235
52370
  }
52236
52371
  function normalizedPath(value) {
52237
- const normalized = path60.normalize(value);
52372
+ const normalized = path61.normalize(value);
52238
52373
  return process.platform === "win32" ? normalized.toLowerCase() : normalized;
52239
52374
  }
52240
52375
 
@@ -52295,15 +52430,15 @@ var runCommandProbe = async (executable, args, options = {}) => {
52295
52430
 
52296
52431
  // ../server/src/training/dataset-storage-service.ts
52297
52432
  function createDatasetStorageService(input) {
52298
- const directory = path61.join(input.storeDir, "datasets");
52299
- const settingsPath = path61.join(directory, "settings.json");
52433
+ const directory = path62.join(input.storeDir, "datasets");
52434
+ const settingsPath = path62.join(directory, "settings.json");
52300
52435
  async function settings() {
52301
52436
  try {
52302
52437
  return DatasetStorageSettingsSchema.parse(JSON.parse(await readFile18(settingsPath, "utf8")));
52303
52438
  } catch {
52304
52439
  return DatasetStorageSettingsSchema.parse({
52305
52440
  schemaVersion: "openpond.datasetStorageSettings.v1",
52306
- datasetStorePath: path61.join(input.storeDir, "datasets"),
52441
+ datasetStorePath: path62.join(input.storeDir, "datasets"),
52307
52442
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
52308
52443
  });
52309
52444
  }
@@ -52315,7 +52450,7 @@ function createDatasetStorageService(input) {
52315
52450
  platform: process.platform,
52316
52451
  storeDir: input.storeDir
52317
52452
  });
52318
- if (!candidates.some((candidate2) => path61.resolve(candidate2.datasetStorePath) === path61.resolve(current.datasetStorePath))) {
52453
+ if (!candidates.some((candidate2) => path62.resolve(candidate2.datasetStorePath) === path62.resolve(current.datasetStorePath))) {
52319
52454
  candidates.push({
52320
52455
  datasetStorePath: current.datasetStorePath,
52321
52456
  kind: storageKindForPath(current.datasetStorePath),
@@ -52329,7 +52464,7 @@ function createDatasetStorageService(input) {
52329
52464
  return {
52330
52465
  ...candidate2,
52331
52466
  id: `dataset-storage-${Buffer.from(candidate2.path).toString("base64url").slice(0, 120)}`,
52332
- configured: path61.resolve(candidate2.datasetStorePath) === path61.resolve(current.datasetStorePath),
52467
+ configured: path62.resolve(candidate2.datasetStorePath) === path62.resolve(current.datasetStorePath),
52333
52468
  mounted: stats !== null,
52334
52469
  freeBytes: stats ? Number(stats.bavail) * Number(stats.bsize) : null,
52335
52470
  totalBytes: stats ? Number(stats.blocks) * Number(stats.bsize) : null,
@@ -52346,7 +52481,7 @@ function createDatasetStorageService(input) {
52346
52481
  const request = UpdateDatasetStorageSettingsRequestSchema.parse(value);
52347
52482
  const updated = DatasetStorageSettingsSchema.parse({
52348
52483
  schemaVersion: "openpond.datasetStorageSettings.v1",
52349
- datasetStorePath: path61.resolve(request.datasetStorePath),
52484
+ datasetStorePath: path62.resolve(request.datasetStorePath),
52350
52485
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
52351
52486
  });
52352
52487
  if (!await ensureWritable(updated.datasetStorePath)) {
@@ -52502,10 +52637,10 @@ function createManagedAdapterRegistryClient(dependencies = {}) {
52502
52637
  const fetchImpl = dependencies.fetchImpl ?? fetch;
52503
52638
  const resolveRegistryAccess = dependencies.resolveRegistryAccess ?? ((teamId) => resolveManagedAdapterUserAccess({ teamId }));
52504
52639
  const resolveInferenceAccess = dependencies.resolveInferenceAccess ?? ((teamId) => resolveManagedAdapterUserAccess({ teamId }));
52505
- async function requestJson2(resolveAccess, teamId, path63, init = {}) {
52640
+ async function requestJson2(resolveAccess, teamId, path64, init = {}) {
52506
52641
  const access5 = await resolveAccess(teamId);
52507
52642
  assertResolvedTeam(access5.teamId, teamId);
52508
- const requestUrl = `${access5.apiBaseUrl}${path63}`;
52643
+ const requestUrl = `${access5.apiBaseUrl}${path64}`;
52509
52644
  const headers = withVercelProtectionBypass(
52510
52645
  requestUrl,
52511
52646
  hostedApiAuthHeaders(access5.token),
@@ -53135,10 +53270,10 @@ async function createOpenPondServer(options = {}) {
53135
53270
  const harnessEvaluationReviewStream = createLocalHarnessEvaluationReviewModelStream(streamOpenPondHostedChatTurn2);
53136
53271
  const executeWebSearch = createWebSearchExecutorFromEnv();
53137
53272
  const executeConnectedAppTool = createCloudConnectedAppToolExecutor();
53138
- const attachmentRootDir = path62.join(storeDir, "attachments");
53273
+ const attachmentRootDir = path63.join(storeDir, "attachments");
53139
53274
  const logger = createLogger({
53140
53275
  channel: "server",
53141
- logDir: path62.join(storeDir, "logs"),
53276
+ logDir: path63.join(storeDir, "logs"),
53142
53277
  metadata: {
53143
53278
  version,
53144
53279
  runtimeVersion
@@ -53260,6 +53395,7 @@ async function createOpenPondServer(options = {}) {
53260
53395
  updateLocalProjectAgentSetupPayload,
53261
53396
  previewLocalProjectCloudSourcePayload,
53262
53397
  uploadLocalProjectCloudSourcePayload,
53398
+ localProjectActionCatalogPayload,
53263
53399
  patchSidebarAppPreference,
53264
53400
  listSidebarFileBookmarksPayload,
53265
53401
  patchSidebarFileBookmarkPayload,
@@ -53311,6 +53447,10 @@ async function createOpenPondServer(options = {}) {
53311
53447
  appendRuntimeEvent,
53312
53448
  isClosing: () => closing
53313
53449
  });
53450
+ const projectActionRunPayload = createProjectActionRunPayload({
53451
+ appendRuntimeEvent,
53452
+ resolveProjectRoot: async (projectId) => (await findLocalProject(store, projectId))?.workspacePath ?? null
53453
+ });
53314
53454
  const {
53315
53455
  createSession,
53316
53456
  patchSession,
@@ -53323,8 +53463,8 @@ async function createOpenPondServer(options = {}) {
53323
53463
  store,
53324
53464
  defaultSessionCwd,
53325
53465
  createManagedLocalWorkCwd: async (sessionId) => {
53326
- const workspacePath = path62.join(storeDir, "work", "tasks", sessionId);
53327
- await fs26.mkdir(workspacePath, { recursive: true, mode: 448 });
53466
+ const workspacePath = path63.join(storeDir, "work", "tasks", sessionId);
53467
+ await fs27.mkdir(workspacePath, { recursive: true, mode: 448 });
53328
53468
  return workspacePath;
53329
53469
  },
53330
53470
  loadAppPreferences,
@@ -53427,7 +53567,7 @@ async function createOpenPondServer(options = {}) {
53427
53567
  const tasksetAuthoringSkillText = tasksetAuthoringSkillArtifact.bundle;
53428
53568
  const taskCreatorService = createTaskCreatorService({
53429
53569
  store,
53430
- tasksetRootDir: path62.join(storeDir, "training", "tasksets"),
53570
+ tasksetRootDir: path63.join(storeDir, "training", "tasksets"),
53431
53571
  authoringSkillHash: contentHash(tasksetAuthoringSkillText),
53432
53572
  loadCodexHistoryThread: (sessionId) => readCodexHistoryThreadPayload(sessionId, {
53433
53573
  attachmentRootDir,
@@ -53456,7 +53596,7 @@ async function createOpenPondServer(options = {}) {
53456
53596
  });
53457
53597
  const datasetArtifactService = createDatasetArtifactService({
53458
53598
  store,
53459
- workerProjectDir: path62.resolve(process.cwd(), "python", "openpond-datasets")
53599
+ workerProjectDir: path63.resolve(process.cwd(), "python", "openpond-datasets")
53460
53600
  });
53461
53601
  const {
53462
53602
  benchmarkTasksets,
@@ -53560,7 +53700,7 @@ async function createOpenPondServer(options = {}) {
53560
53700
  const trainingChatSearchService = createTrainingChatSearchService({ store });
53561
53701
  const datasetImportService = createDatasetImportService({
53562
53702
  store,
53563
- workerProjectDir: path62.resolve(
53703
+ workerProjectDir: path63.resolve(
53564
53704
  process.cwd(),
53565
53705
  "python",
53566
53706
  "openpond-datasets"
@@ -53660,6 +53800,7 @@ async function createOpenPondServer(options = {}) {
53660
53800
  workInputsForSession: workOutputService.workInputsForSession,
53661
53801
  executeOpenPondCommand: openPondCommandAccess.executeCommand,
53662
53802
  executeProfileAction: profileRunPayload,
53803
+ executeProjectAction: projectActionRunPayload,
53663
53804
  executeDatasetBuilderAction: async ({
53664
53805
  session,
53665
53806
  provider,
@@ -53783,7 +53924,7 @@ async function createOpenPondServer(options = {}) {
53783
53924
  nextStep: response2.items.length === 0 ? "There are no pinned or saved files." : `Listed ${response2.items.length} sidebar file${response2.items.length === 1 ? "" : "s"}.`
53784
53925
  };
53785
53926
  }
53786
- const path63 = normalizeSidebarFilePath(requestedPath ?? "");
53927
+ const path64 = normalizeSidebarFilePath(requestedPath ?? "");
53787
53928
  const workspaceId = session.workspaceId ?? session.localProjectId ?? session.appId;
53788
53929
  if (!workspaceId) {
53789
53930
  throw new Error(
@@ -53796,18 +53937,18 @@ async function createOpenPondServer(options = {}) {
53796
53937
  workspaceKind,
53797
53938
  workspaceId,
53798
53939
  workspaceName,
53799
- path: path63,
53940
+ path: path64,
53800
53941
  status: action === "pin" ? "pinned" : action === "save_for_later" ? "saved_for_later" : "none",
53801
53942
  sourceSessionId: session.id
53802
53943
  });
53803
53944
  const changed = response.items.find(
53804
- (item) => item.workspaceKind === workspaceKind && item.workspaceId === workspaceId && item.path === path63
53945
+ (item) => item.workspaceKind === workspaceKind && item.workspaceId === workspaceId && item.path === path64
53805
53946
  ) ?? null;
53806
53947
  const verb = action === "pin" ? "Pinned" : action === "save_for_later" ? "Saved" : "Removed";
53807
53948
  return {
53808
53949
  ...response,
53809
53950
  changed,
53810
- nextStep: `${verb} ${path63}${action === "save_for_later" ? " for later" : ""}.`
53951
+ nextStep: `${verb} ${path64}${action === "save_for_later" ? " for later" : ""}.`
53811
53952
  };
53812
53953
  },
53813
53954
  listIntegrationConnections: listSandboxIntegrationConnections,
@@ -54400,6 +54541,7 @@ async function createOpenPondServer(options = {}) {
54400
54541
  openEventSubscriber,
54401
54542
  refreshCodexStatus,
54402
54543
  bootstrapPayload,
54544
+ localProjectActionCatalogPayload,
54403
54545
  skillSourceFilePayload,
54404
54546
  extensionCatalogPayload,
54405
54547
  extensionPreviewPayload,