openpond 0.0.60 → 0.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{actions-command-BNVIILSL.js → actions-command-QVYIPEN5.js} +2 -2
- package/dist/chunks/{app-layer-RNQXXM6L.js → app-layer-GCNXR4F3.js} +5 -5
- package/dist/chunks/{app-server-runtime-7LGK37P6.js → app-server-runtime-737DBOSH.js} +8 -8
- package/dist/chunks/{apps-LV3CSMLT.js → apps-JB3POF6Z.js} +5 -5
- package/dist/chunks/{chunk-LMQ4MPQI.js → chunk-32R4GQD3.js} +51 -57
- package/dist/chunks/{chunk-AHILPQXV.js → chunk-5HMXXGWZ.js} +3 -3
- package/dist/chunks/{chunk-TOCZQEPW.js → chunk-6RMGHEFF.js} +1 -1
- package/dist/chunks/{chunk-I23UKEYS.js → chunk-B3WVCPXG.js} +46 -14
- package/dist/chunks/{chunk-XFZYNYRI.js → chunk-BQQS5RRI.js} +5903 -3813
- package/dist/chunks/{chunk-SKUS4NPW.js → chunk-IZ3XGRAG.js} +154 -5
- package/dist/chunks/{chunk-PVGJXCAK.js → chunk-L5JTI6LQ.js} +52 -52
- package/dist/chunks/{chunk-RC3N77IV.js → chunk-LBIVEX6V.js} +33 -33
- package/dist/chunks/{chunk-LDRWEAOB.js → chunk-NPEWMLRH.js} +1 -1
- package/dist/chunks/{chunk-NFNEENNR.js → chunk-OYWTQABY.js} +1 -1
- package/dist/chunks/{chunk-VG4H4TQG.js → chunk-TOMMZN6V.js} +1757 -55
- package/dist/chunks/{chunk-FHP7OMEI.js → chunk-XIUCBUUQ.js} +1 -1
- package/dist/chunks/{chunk-DXSHQ6TO.js → chunk-XSHMPOQV.js} +10 -5
- package/dist/chunks/{chunk-63N6442Q.js → chunk-YSVY4O42.js} +1 -1
- package/dist/chunks/{chunk-7QLVLGDM.js → chunk-ZAX7MLQJ.js} +1 -1
- package/dist/chunks/{chunk-2J3LG4U7.js → chunk-ZJPLJP2Q.js} +2 -2
- package/dist/chunks/{cli-DBZ7S6ZF.js → cli-MFFCFH3P.js} +7 -7
- package/dist/chunks/{core-commands-H2UC3LHG.js → core-commands-KCFU7U5Y.js} +6 -6
- package/dist/chunks/{desktop-test-TV64EY5A.js → desktop-test-FEQVX4N4.js} +5 -5
- package/dist/chunks/{extension-XMWCG6YG.js → extension-M4DH25KH.js} +16 -51
- package/dist/chunks/{help-NEYFMHWQ.js → help-ZUIE4EPY.js} +1 -1
- package/dist/chunks/{opchat-ZL5JJQ5L.js → opchat-7KRZIFFD.js} +5 -5
- package/dist/chunks/{organizations-4IEC35QB.js → organizations-ZWPFNM6K.js} +7 -7
- package/dist/chunks/{profile-EVASCDIN.js → profile-GF57OWI6.js} +6 -6
- package/dist/chunks/{project-agent-DMN64RZJ.js → project-agent-65MXZHGM.js} +6 -6
- package/dist/chunks/{sandbox-command-WKGVO32R.js → sandbox-command-WH2OQRHP.js} +6 -6
- package/dist/chunks/{sandbox-template-BJUS4KJM.js → sandbox-template-W5HU24TF.js} +7 -7
- package/dist/chunks/{src-E2UCLY54.js → src-O5QXOQ5H.js} +1221 -417
- package/dist/chunks/{src-KLQEJ6RO.js → src-YUIJKNIC.js} +4 -4
- package/dist/chunks/{teams-bot-HUXYJ6XA.js → teams-bot-5ATLXSHC.js} +5 -5
- package/dist/chunks/{workspaces-4OKABHI3.js → workspaces-4XJ3GXL4.js} +2 -2
- package/dist/cli.js +13 -13
- package/dist/index.js +10 -5
- package/dist/sandbox/sandbox-instance-client.d.ts +2 -1
- package/dist/sandbox/types/org-project-agent.d.ts +10 -1
- package/dist/web/assets/{AppDialog-CxLYXiI1.js → AppDialog-BvdkukM_.js} +1 -1
- package/dist/web/assets/{AppsView-CVTUkahv.js → AppsView-9h3-BQbk.js} +1 -1
- package/dist/web/assets/BrowserSidebar-C6WJ5wIu.js +1 -0
- package/dist/web/assets/CommandMenu-C7en9zgQ.js +1 -0
- package/dist/web/assets/CommunityView-CoqI6Dks.js +1 -0
- package/dist/web/assets/ComposerCreateImproveStrip-DMq6A2Ba.js +1 -0
- package/dist/web/assets/{GetStartedView-l9MUYMYH.js → GetStartedView-B-zgx1jI.js} +1 -1
- package/dist/web/assets/LabModelVersionDetailPage-CkNOBygO.js +1 -0
- package/dist/web/assets/LabSkillSidebar-CmRHuu78.js +1 -0
- package/dist/web/assets/LabsRoute-DLPZqEev.js +3 -0
- package/dist/web/assets/MainChatThread-CFGsODmc.js +2 -0
- package/dist/web/assets/MainPane-B2kcZpM0.js +6 -0
- package/dist/web/assets/MarkdownText-C4Ixpl-i.js +9 -0
- package/dist/web/assets/Messages-DmEk_BWS.js +10 -0
- package/dist/web/assets/NativeSkillSidebar-Cn824hrX.js +1 -0
- package/dist/web/assets/{NewProjectDialog-CiGPfI5s.js → NewProjectDialog-BFEDv4Ga.js} +1 -1
- package/dist/web/assets/OutputsPage-hfQyqQzx.js +1 -0
- package/dist/web/assets/RightChatPanelStack-CiPKX3Ea.js +1 -0
- package/dist/web/assets/ScheduledWorkPage-CyoZsUCe.js +1 -0
- package/dist/web/assets/SettingsView-BZkrIOc0.css +1 -0
- package/dist/web/assets/SettingsView-DWWs9gel.js +6 -0
- package/dist/web/assets/TeamChatView-C4RWAO8c.js +3 -0
- package/dist/web/assets/{TerminalOverlay-Bb0RJR04.js → TerminalOverlay-CpsPuPIM.js} +1 -1
- package/dist/web/assets/TrainingCreationPanel-DMLpUVbJ.js +1 -0
- package/dist/web/assets/TrainingDraftPanel-gAhpwkYs.js +1 -0
- package/dist/web/assets/{UsageSettingsSection-Cdc_jGFX.js → UsageSettingsSection-WBtxLhBx.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-CUpwqvzZ.js +14 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-LIbOBT4f.js +32 -0
- package/dist/web/assets/{WorkspaceGitDialogs-CK6ahRty.js → WorkspaceGitDialogs-8y7rRSou.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-BQoN7jWa.js → WorkspaceMonacoEditor-BpHmWrCD.js} +3 -3
- package/dist/web/assets/{arrow-up-right-CzBZuWNj.js → arrow-up-right-3TbyK1ec.js} +1 -1
- package/dist/web/assets/{chevron-up-DW-qEVSP.js → chevron-up-C4tTuxXs.js} +1 -1
- package/dist/web/assets/{cloud-upload-CjLR-8-r.js → cloud-upload-ZGHLWEn3.js} +1 -1
- package/dist/web/assets/{cssMode-CQQJhS7v.js → cssMode-kfZCOm_r.js} +1 -1
- package/dist/web/assets/{folder-open-BpUcIJHn.js → folder-open-C4WG_lDr.js} +1 -1
- package/dist/web/assets/{folder-plus-8NHsIAxQ.js → folder-plus-CKRaDeR3.js} +1 -1
- package/dist/web/assets/{git-branch-DO3iP_fL.js → git-branch-yLi5tff8.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-BSWa2I3g.js → git-commit-horizontal-BPyGYak3.js} +1 -1
- package/dist/web/assets/{htmlMode-DaAKO9wk.js → htmlMode-DT--Et9k.js} +1 -1
- package/dist/web/assets/index--lwjVZXT.js +178 -0
- package/dist/web/assets/index-B_HvNtwl.css +1 -0
- package/dist/web/assets/index-C9-OtZl8.js +1 -0
- package/dist/web/assets/{info-DiEvrUda.js → info-CzzHwSUb.js} +1 -1
- package/dist/web/assets/{jsonMode-Biu1ZTZ7.js → jsonMode-CKg1GzqC.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-lwoDxGgl.js → lspLanguageFeatures-B76Yo6xo.js} +1 -1
- package/dist/web/assets/{monaco.contribution-DzHhgeLy.js → monaco.contribution-BRuQU-2A.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BqQSY5-t.js → monaco.contribution-CLpGfCSS.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Ic8LKME8.js → monaco.contribution-CS3H8RrD.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Ce2MS2Nv.js → monaco.contribution-DqeexNAI.js} +2 -2
- package/dist/web/assets/{play-D9F3t5Cx.js → play-EDFh3BPS.js} +1 -1
- package/dist/web/assets/{python-BhVCwr-K.js → python-De_Vr_hD.js} +1 -1
- package/dist/web/assets/{refresh-cw-DRN17xPU.js → refresh-cw-DRJJ-X1U.js} +1 -1
- package/dist/web/assets/{save-CDZwpzlG.js → save-BSxqIWP6.js} +1 -1
- package/dist/web/assets/{square-Cf_AXs4a.js → square-BV-Vgh5a.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-Bb_m9pXM.js → toggleHighContrast-1Suz4cxo.js} +1 -1
- package/dist/web/assets/{tsMode-BaWkaSHN.js → tsMode-DMyzpvFI.js} +1 -1
- package/dist/web/assets/{upload-Cef29aCP.js → upload-jVxCW0dO.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-CAAqoZ0V.js → useLocalAgentSchedules-DNpnOBA8.js} +1 -1
- package/dist/web/assets/{wifi-off-C8cC22F6.js → wifi-off-IzGGiOX_.js} +1 -1
- package/dist/web/assets/{workers-GOdHtcZt.js → workers-Crdnk6Zy.js} +1 -1
- package/dist/web/assets/{yaml-jBIxwMeR.js → yaml-CF3tmjgW.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/BrowserSidebar-oHniLA05.js +0 -1
- package/dist/web/assets/CommandMenu-Db_5OiKs.js +0 -1
- package/dist/web/assets/CommunityView-HTwMEO-T.js +0 -1
- package/dist/web/assets/ComposerCreateImproveStrip-ER26yFe-.js +0 -1
- package/dist/web/assets/LabModelVersionDetailPage-Dgf-DlJi.js +0 -1
- package/dist/web/assets/LabSkillSidebar-CyX8sVm1.js +0 -1
- package/dist/web/assets/LabsRoute-BC1ST9qT.js +0 -3
- package/dist/web/assets/MainChatThread-BfW92Rv1.js +0 -2
- package/dist/web/assets/MainPane-DlciH8yR.js +0 -6
- package/dist/web/assets/MarkdownText-CyOeCVjf.js +0 -9
- package/dist/web/assets/Messages-BDtEbIKv.js +0 -9
- package/dist/web/assets/NativeSkillSidebar-D0BlvEtE.js +0 -1
- package/dist/web/assets/OutputsPage-DNU2yD7q.js +0 -1
- package/dist/web/assets/RightChatPanelStack-Cs63fQwk.js +0 -1
- package/dist/web/assets/ScheduledWorkPage-DMKHFbeE.js +0 -1
- package/dist/web/assets/SettingsView-C39BqlSI.css +0 -1
- package/dist/web/assets/SettingsView-L0g-g2fL.js +0 -6
- package/dist/web/assets/TeamChatView-CSVMTUAE.js +0 -3
- package/dist/web/assets/TrainingCreationPanel-VIWlpVV2.js +0 -1
- package/dist/web/assets/TrainingDraftPanel-MTYsR-Ry.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-BgIbxMMu.js +0 -14
- package/dist/web/assets/WorkspaceEnvironmentMenu-C97GqYn9.js +0 -32
- package/dist/web/assets/circle-alert-B_xROoPY.js +0 -1
- package/dist/web/assets/folder-git-2-ktXin28y.js +0 -1
- package/dist/web/assets/folder-tLv6TMN2.js +0 -1
- package/dist/web/assets/index-BtiK52K1.js +0 -1
- package/dist/web/assets/index-CE2hroF6.css +0 -1
- package/dist/web/assets/index-DHxBMQIJ.js +0 -174
- package/dist/web/assets/square-pen-ChJgNiDm.js +0 -1
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
appDataDir,
|
|
10
10
|
asRecord,
|
|
11
11
|
attachModelTargetRefs,
|
|
12
|
+
autoTitlePromptFromPayload,
|
|
12
13
|
booleanValue,
|
|
13
14
|
chatAttachmentContext,
|
|
14
15
|
chatAttachmentImageContentType,
|
|
@@ -43,6 +44,7 @@ import {
|
|
|
43
44
|
createScriptedOpenPondChatStream,
|
|
44
45
|
createServerWorkQueues,
|
|
45
46
|
createSessionStore,
|
|
47
|
+
createSessionTitleService,
|
|
46
48
|
createTaskCreatorService,
|
|
47
49
|
createTaskEvaluationService,
|
|
48
50
|
createTasksetRef,
|
|
@@ -137,10 +139,11 @@ import {
|
|
|
137
139
|
upsertInternalSandboxProject,
|
|
138
140
|
validateOpenAiCompatibleProvider,
|
|
139
141
|
waitForWorkReceiptSettlement,
|
|
142
|
+
withPendingAutoTitle,
|
|
140
143
|
workspaceHasHead,
|
|
141
144
|
workspaceToolExperienceBlocker,
|
|
142
145
|
writeWorkspaceFile
|
|
143
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-BQQS5RRI.js";
|
|
144
147
|
import {
|
|
145
148
|
appWorkspacePaths,
|
|
146
149
|
checkWorkspaceGitAvailability,
|
|
@@ -166,14 +169,14 @@ import {
|
|
|
166
169
|
runCommand,
|
|
167
170
|
startMacOSCommandLineToolsInstall,
|
|
168
171
|
workspaceImageContentType
|
|
169
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-NPEWMLRH.js";
|
|
170
173
|
import {
|
|
171
174
|
runOpenPondServerCli
|
|
172
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-5HMXXGWZ.js";
|
|
173
176
|
import {
|
|
174
177
|
createAppServer,
|
|
175
178
|
runAgentCompaction
|
|
176
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-OYWTQABY.js";
|
|
177
180
|
import {
|
|
178
181
|
APP_PREFERENCES_CACHE_KEY,
|
|
179
182
|
APP_PREFERENCES_CACHE_TYPE,
|
|
@@ -185,7 +188,7 @@ import {
|
|
|
185
188
|
isCliEntrypoint,
|
|
186
189
|
now,
|
|
187
190
|
textFromUnknown
|
|
188
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-6RMGHEFF.js";
|
|
189
192
|
import {
|
|
190
193
|
createOpenPondRepoApp,
|
|
191
194
|
getBundledRuntimeVersion,
|
|
@@ -199,7 +202,7 @@ import {
|
|
|
199
202
|
streamOpenPondHostedChatTurn,
|
|
200
203
|
switchOpenPondAccount,
|
|
201
204
|
updateOpenPondAccountConfig
|
|
202
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-32R4GQD3.js";
|
|
203
206
|
import {
|
|
204
207
|
AccountStateSchema,
|
|
205
208
|
AdapterValidationReceiptSchema,
|
|
@@ -432,17 +435,20 @@ import {
|
|
|
432
435
|
workFormatCapabilityForContentType,
|
|
433
436
|
workspacePathFromLocalPathWorkspaceId,
|
|
434
437
|
writeSourceUploadCache
|
|
435
|
-
} from "./chunk-
|
|
438
|
+
} from "./chunk-L5JTI6LQ.js";
|
|
436
439
|
import "./chunk-QETF6ILG.js";
|
|
437
440
|
import {
|
|
441
|
+
ArtifactManifestSchema,
|
|
438
442
|
AttemptReceiptContentSchema,
|
|
439
443
|
AttemptReceiptSchema,
|
|
440
444
|
BenchmarkDefinitionSchema,
|
|
441
445
|
CONNECTED_APP_INTEGRATION_SKILLS,
|
|
442
446
|
DEFAULT_REFINER_MAX_OUTPUT_TOKENS,
|
|
443
447
|
EvidenceArtifactRefSchema,
|
|
448
|
+
ImmutableAssetRefSchema,
|
|
444
449
|
ImmutableReleaseRefSchema,
|
|
445
450
|
OPENPOND_MANIFEST_FILE_NAME,
|
|
451
|
+
RewardReceiptSchema,
|
|
446
452
|
SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME,
|
|
447
453
|
SANDBOX_TEMPLATE_PREVIEW_PORT_MAX,
|
|
448
454
|
SANDBOX_TEMPLATE_PREVIEW_PORT_MIN,
|
|
@@ -470,17 +476,19 @@ import {
|
|
|
470
476
|
sandboxTemplateScaffoldFiles,
|
|
471
477
|
sha256,
|
|
472
478
|
validateSandboxTemplateYaml,
|
|
479
|
+
verifyArtifactManifest,
|
|
480
|
+
verifyRewardReceipt,
|
|
473
481
|
workEvidenceReceiptRef,
|
|
474
482
|
workSourceOpaqueRef,
|
|
475
483
|
workWorkspaceOpaqueRef
|
|
476
|
-
} from "./chunk-
|
|
484
|
+
} from "./chunk-TOMMZN6V.js";
|
|
477
485
|
import {
|
|
478
486
|
external_exports,
|
|
479
487
|
yaml
|
|
480
488
|
} from "./chunk-WYDVQOBL.js";
|
|
481
489
|
import {
|
|
482
490
|
withVercelProtectionBypass
|
|
483
|
-
} from "./chunk-
|
|
491
|
+
} from "./chunk-XSHMPOQV.js";
|
|
484
492
|
import {
|
|
485
493
|
__commonJS,
|
|
486
494
|
__require,
|
|
@@ -13333,9 +13341,9 @@ var require_dist = __commonJS({
|
|
|
13333
13341
|
});
|
|
13334
13342
|
|
|
13335
13343
|
// ../server/src/index.ts
|
|
13336
|
-
import
|
|
13344
|
+
import path62 from "node:path";
|
|
13337
13345
|
import { randomUUID as randomUUID24 } from "node:crypto";
|
|
13338
|
-
import { promises as
|
|
13346
|
+
import { promises as fs26 } from "node:fs";
|
|
13339
13347
|
|
|
13340
13348
|
// ../../packages/codex-provider/dist/client.js
|
|
13341
13349
|
import { spawn } from "node:child_process";
|
|
@@ -15351,6 +15359,12 @@ var FALLBACK_PROVIDER_PRESETS = [
|
|
|
15351
15359
|
contextWindow: 1048576,
|
|
15352
15360
|
capabilities: REASONING_MODEL_CAPABILITIES
|
|
15353
15361
|
},
|
|
15362
|
+
{
|
|
15363
|
+
id: "accounts/fireworks/models/nemotron-lightning-3p5-30b-a3b",
|
|
15364
|
+
displayName: "Nemotron Lightning 3.5 30B A3B",
|
|
15365
|
+
contextWindow: 262144,
|
|
15366
|
+
capabilities: REASONING_MODEL_CAPABILITIES
|
|
15367
|
+
},
|
|
15354
15368
|
{
|
|
15355
15369
|
id: "accounts/fireworks/models/minimax-m3",
|
|
15356
15370
|
displayName: "MiniMax M3",
|
|
@@ -20740,9 +20754,19 @@ function agentSdkRunScriptCommand(packageManager, scriptName) {
|
|
|
20740
20754
|
return `bun run ${scriptName}`;
|
|
20741
20755
|
return `pnpm run ${scriptName}`;
|
|
20742
20756
|
}
|
|
20757
|
+
function agentSdkRunJsonScriptCommand(packageManager, scriptName) {
|
|
20758
|
+
if (packageManager === "pnpm")
|
|
20759
|
+
return `pnpm --silent run ${scriptName}`;
|
|
20760
|
+
if (packageManager === "yarn")
|
|
20761
|
+
return `yarn --silent ${scriptName}`;
|
|
20762
|
+
if (packageManager === "npm")
|
|
20763
|
+
return `npm run --silent ${scriptName}`;
|
|
20764
|
+
if (packageManager === "bun")
|
|
20765
|
+
return `bun run --silent ${scriptName}`;
|
|
20766
|
+
return `pnpm --silent run ${scriptName}`;
|
|
20767
|
+
}
|
|
20743
20768
|
|
|
20744
20769
|
// ../../packages/cloud/dist/profile/project-source-upload-agent-sdk.js
|
|
20745
|
-
var OPENPOND_PNPM_PACKAGE_MANAGER = "pnpm@11.13.0";
|
|
20746
20770
|
var AGENT_SDK_VENDOR_TARBALL_PATH = ".openpond/vendor/openpond-agent-sdk.tgz";
|
|
20747
20771
|
var AGENT_SDK_VENDOR_NPM_DEPENDENCY_DIR = ".openpond/vendor/npm";
|
|
20748
20772
|
var AGENT_SDK_MATERIALIZED_DEPENDENCY_SPEC = `file:${AGENT_SDK_VENDOR_TARBALL_PATH}`;
|
|
@@ -20772,6 +20796,8 @@ async function buildAgentSdkMaterializedDependency(projectPath, packageJson) {
|
|
|
20772
20796
|
const sdkDependencyTarballs = await packAgentSdkRuntimeDependencyTarballs({
|
|
20773
20797
|
sdkPackageJson: sdkSource.packageJson,
|
|
20774
20798
|
dependencyBaseDir: sdkSource.dependencyBaseDir,
|
|
20799
|
+
projectPackageJson: packageJson,
|
|
20800
|
+
projectPath,
|
|
20775
20801
|
tempDir
|
|
20776
20802
|
});
|
|
20777
20803
|
const packageManager = detectAgentSdkPackageManager(projectPath, packageJson);
|
|
@@ -20832,21 +20858,34 @@ ${details}` : ""}`);
|
|
|
20832
20858
|
return fs9.readFile(path15.join(tempDir, tarballName));
|
|
20833
20859
|
}
|
|
20834
20860
|
async function packAgentSdkRuntimeDependencyTarballs(params) {
|
|
20835
|
-
const
|
|
20836
|
-
const
|
|
20861
|
+
const sdkDependencies = recordStringMap(params.sdkPackageJson.dependencies);
|
|
20862
|
+
const projectDependencies = recordStringMap(params.projectPackageJson.dependencies);
|
|
20863
|
+
delete projectDependencies["openpond-agent-sdk"];
|
|
20864
|
+
const pending = [
|
|
20865
|
+
...Object.entries(sdkDependencies).map(([packageName, versionSpec]) => ({
|
|
20866
|
+
packageName,
|
|
20867
|
+
versionSpec,
|
|
20868
|
+
dependencyBaseDir: params.dependencyBaseDir
|
|
20869
|
+
})),
|
|
20870
|
+
...Object.entries(projectDependencies).map(([packageName, versionSpec]) => ({
|
|
20871
|
+
packageName,
|
|
20872
|
+
versionSpec,
|
|
20873
|
+
dependencyBaseDir: params.projectPath
|
|
20874
|
+
}))
|
|
20875
|
+
].sort((left, right) => left.packageName.localeCompare(right.packageName));
|
|
20837
20876
|
const seen = /* @__PURE__ */ new Set();
|
|
20838
20877
|
const tarballs = [];
|
|
20839
20878
|
while (pending.length > 0) {
|
|
20840
|
-
const { packageName, versionSpec } = pending.shift();
|
|
20879
|
+
const { packageName, versionSpec, dependencyBaseDir } = pending.shift();
|
|
20841
20880
|
if (seen.has(packageName))
|
|
20842
20881
|
continue;
|
|
20843
20882
|
seen.add(packageName);
|
|
20844
20883
|
const packTarget = npmPackTargetForDependency({
|
|
20845
20884
|
packageName,
|
|
20846
20885
|
versionSpec,
|
|
20847
|
-
dependencyBaseDir
|
|
20886
|
+
dependencyBaseDir
|
|
20848
20887
|
});
|
|
20849
|
-
const pack = await runCommand2("npm", ["pack", "--silent", "--pack-destination", params.tempDir, packTarget], { cwd:
|
|
20888
|
+
const pack = await runCommand2("npm", ["pack", "--silent", "--pack-destination", params.tempDir, packTarget], { cwd: dependencyBaseDir });
|
|
20850
20889
|
if (pack.code !== 0) {
|
|
20851
20890
|
const details = [pack.stderr.trim(), pack.stdout.trim()].filter(Boolean).join("\n");
|
|
20852
20891
|
throw new Error(`failed to pack openpond-agent-sdk dependency ${packageName}${details ? `:
|
|
@@ -20868,12 +20907,20 @@ ${details}` : ""}`);
|
|
|
20868
20907
|
sizeBytes: contents.byteLength
|
|
20869
20908
|
});
|
|
20870
20909
|
for (const [dependencyName, dependencySpec] of Object.entries(recordStringMap(packedPackageJson.dependencies))) {
|
|
20871
|
-
pending.push({
|
|
20910
|
+
pending.push({
|
|
20911
|
+
packageName: dependencyName,
|
|
20912
|
+
versionSpec: dependencySpec,
|
|
20913
|
+
dependencyBaseDir
|
|
20914
|
+
});
|
|
20872
20915
|
}
|
|
20873
20916
|
for (const [dependencyName, dependencySpec] of Object.entries(recordStringMap(packedPackageJson.optionalDependencies))) {
|
|
20874
20917
|
if (!isSupportedSandboxOptionalDependency(dependencyName))
|
|
20875
20918
|
continue;
|
|
20876
|
-
pending.push({
|
|
20919
|
+
pending.push({
|
|
20920
|
+
packageName: dependencyName,
|
|
20921
|
+
versionSpec: dependencySpec,
|
|
20922
|
+
dependencyBaseDir
|
|
20923
|
+
});
|
|
20877
20924
|
}
|
|
20878
20925
|
}
|
|
20879
20926
|
return tarballs.sort((left, right) => left.packageName.localeCompare(right.packageName));
|
|
@@ -21008,8 +21055,8 @@ function rewriteAgentSdkPackageJsonForMaterialization(packageJson, dependencyTar
|
|
|
21008
21055
|
if (Object.keys(overrides).length > 0) {
|
|
21009
21056
|
rewritten.overrides = overrides;
|
|
21010
21057
|
}
|
|
21011
|
-
if (packageManager === "unknown") {
|
|
21012
|
-
rewritten.packageManager
|
|
21058
|
+
if (packageManager === "pnpm" || packageManager === "unknown") {
|
|
21059
|
+
delete rewritten.packageManager;
|
|
21013
21060
|
}
|
|
21014
21061
|
for (const key of ["devDependencies", "peerDependencies"]) {
|
|
21015
21062
|
const entries = recordCopy(rewritten[key]);
|
|
@@ -21484,18 +21531,18 @@ function readAgentSdkProjectPackageJson(projectPath) {
|
|
|
21484
21531
|
}
|
|
21485
21532
|
function buildAgentSdkCommandHints(packageJson, packageManager) {
|
|
21486
21533
|
return {
|
|
21487
|
-
inspect: buildAgentSdkCommandHint(packageJson, packageManager, "agent:inspect", "openpond-agent inspect --json"),
|
|
21534
|
+
inspect: buildAgentSdkCommandHint(packageJson, packageManager, "agent:inspect", "openpond-agent inspect --json", true),
|
|
21488
21535
|
build: buildAgentSdkCommandHint(packageJson, packageManager, "agent:build", "openpond-agent build"),
|
|
21489
21536
|
validate: buildAgentSdkCommandHint(packageJson, packageManager, "agent:validate", "openpond-agent validate"),
|
|
21490
21537
|
eval: buildAgentSdkCommandHint(packageJson, packageManager, "agent:eval", "openpond-agent eval")
|
|
21491
21538
|
};
|
|
21492
21539
|
}
|
|
21493
|
-
function buildAgentSdkCommandHint(packageJson, packageManager, scriptName, fallback) {
|
|
21540
|
+
function buildAgentSdkCommandHint(packageJson, packageManager, scriptName, fallback, jsonOutput = false) {
|
|
21494
21541
|
const scripts = packageJson.scripts;
|
|
21495
21542
|
const hasScript = scripts && typeof scripts === "object" && !Array.isArray(scripts) && typeof scripts[scriptName] === "string";
|
|
21496
21543
|
if (!hasScript)
|
|
21497
21544
|
return fallback;
|
|
21498
|
-
return agentSdkRunScriptCommand(packageManager, scriptName);
|
|
21545
|
+
return jsonOutput ? agentSdkRunJsonScriptCommand(packageManager, scriptName) : agentSdkRunScriptCommand(packageManager, scriptName);
|
|
21499
21546
|
}
|
|
21500
21547
|
function readOpenPondAgentSdkVersionSpec2(packageJson) {
|
|
21501
21548
|
for (const key of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
@@ -25413,11 +25460,11 @@ async function communityRequestPayload(action, dependencies = {}) {
|
|
|
25413
25460
|
const payload = await requestCommunityApi(request.path, request.init, dependencies);
|
|
25414
25461
|
return schemaForAction(action).parse(payload);
|
|
25415
25462
|
}
|
|
25416
|
-
async function requestCommunityApi(
|
|
25463
|
+
async function requestCommunityApi(path63, init = {}, dependencies = {}) {
|
|
25417
25464
|
const access5 = await resolveHostedApiAccess(dependencies);
|
|
25418
25465
|
const headers = hostedApiAuthHeaders(access5.token);
|
|
25419
25466
|
headers.set("Content-Type", "application/json");
|
|
25420
|
-
const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${
|
|
25467
|
+
const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${path63}`, {
|
|
25421
25468
|
...init,
|
|
25422
25469
|
headers
|
|
25423
25470
|
});
|
|
@@ -25586,11 +25633,11 @@ async function uploadCommunityAttachment(action, dependencies) {
|
|
|
25586
25633
|
)
|
|
25587
25634
|
);
|
|
25588
25635
|
}
|
|
25589
|
-
function post(
|
|
25590
|
-
return jsonRequest(
|
|
25636
|
+
function post(path63, body) {
|
|
25637
|
+
return jsonRequest(path63, "POST", body);
|
|
25591
25638
|
}
|
|
25592
|
-
function jsonRequest(
|
|
25593
|
-
return { path:
|
|
25639
|
+
function jsonRequest(path63, method, body) {
|
|
25640
|
+
return { path: path63, init: { method, body: JSON.stringify(body) } };
|
|
25594
25641
|
}
|
|
25595
25642
|
|
|
25596
25643
|
// ../server/src/api/routes/community-routes.ts
|
|
@@ -25962,13 +26009,13 @@ function verifySignedWorkspaceImageRequest(requestUrl, token) {
|
|
|
25962
26009
|
if (!appId || !rawPath || !expiresRaw || !signature) {
|
|
25963
26010
|
return { ok: false, status: 401, error: "Signed asset URL is missing required claims." };
|
|
25964
26011
|
}
|
|
25965
|
-
const
|
|
26012
|
+
const path63 = normalizeSignedWorkspaceImagePath(rawPath);
|
|
25966
26013
|
const expiresAt = Number(expiresRaw);
|
|
25967
|
-
if (!
|
|
26014
|
+
if (!path63 || !Number.isInteger(expiresAt)) {
|
|
25968
26015
|
return { ok: false, status: 401, error: "Signed asset URL is invalid." };
|
|
25969
26016
|
}
|
|
25970
26017
|
if (expiresAt < Date.now()) return { ok: false, status: 401, error: "Signed asset URL expired." };
|
|
25971
|
-
const claims = { appId: appId.trim(), path:
|
|
26018
|
+
const claims = { appId: appId.trim(), path: path63, expiresAt };
|
|
25972
26019
|
if (!safeSignatureEqual(signature, signWorkspaceImageClaims(claims, token))) {
|
|
25973
26020
|
return { ok: false, status: 401, error: "Signed asset URL signature is invalid." };
|
|
25974
26021
|
}
|
|
@@ -26062,9 +26109,9 @@ function requiredSearchParam(requestUrl, name) {
|
|
|
26062
26109
|
}
|
|
26063
26110
|
function normalizeSignedWorkspaceImagePath(value) {
|
|
26064
26111
|
if (/^file:\/\//i.test(value) || /^\//.test(value) || /^[A-Za-z]:[\\/]/.test(value)) return null;
|
|
26065
|
-
const
|
|
26066
|
-
if (!
|
|
26067
|
-
return
|
|
26112
|
+
const path63 = normalizeWorkspaceFilePath(value);
|
|
26113
|
+
if (!path63 || !workspaceImageContentType(path63)) return null;
|
|
26114
|
+
return path63;
|
|
26068
26115
|
}
|
|
26069
26116
|
function normalizeSignedLocalImagePath(value) {
|
|
26070
26117
|
const cleaned = normalizeSignedLocalAssetPath(value);
|
|
@@ -31602,7 +31649,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
|
|
|
31602
31649
|
0,
|
|
31603
31650
|
patchPaths.length - SANDBOX_SOURCE_READBACK_MAX_FILES
|
|
31604
31651
|
);
|
|
31605
|
-
for (const
|
|
31652
|
+
for (const path63 of patchPaths.slice(0, SANDBOX_SOURCE_READBACK_MAX_FILES)) {
|
|
31606
31653
|
const remainingBytes = SANDBOX_SOURCE_READBACK_MAX_TOTAL_BYTES - totalReturnedBytes;
|
|
31607
31654
|
if (remainingBytes <= 0) {
|
|
31608
31655
|
skippedFiles += 1;
|
|
@@ -31617,7 +31664,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
|
|
|
31617
31664
|
await sandboxRequestPayload({
|
|
31618
31665
|
type: "download_file",
|
|
31619
31666
|
sandboxId: input.sandboxId,
|
|
31620
|
-
payload: { path:
|
|
31667
|
+
payload: { path: path63, maxBytes }
|
|
31621
31668
|
})
|
|
31622
31669
|
);
|
|
31623
31670
|
const file = asRecord9(downloadPayload.file);
|
|
@@ -31625,7 +31672,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
|
|
|
31625
31672
|
const returnedBytes = numberValue3(file.returnedBytes);
|
|
31626
31673
|
const sizeBytes = numberValue3(file.totalSizeBytes) ?? numberValue3(file.sizeBytes);
|
|
31627
31674
|
const entry = {
|
|
31628
|
-
path:
|
|
31675
|
+
path: path63,
|
|
31629
31676
|
sizeBytes,
|
|
31630
31677
|
returnedBytes,
|
|
31631
31678
|
isBinary,
|
|
@@ -31644,7 +31691,7 @@ async function captureSandboxSourceReadbackArtifact(input) {
|
|
|
31644
31691
|
files.push(entry);
|
|
31645
31692
|
} catch (error) {
|
|
31646
31693
|
files.push({
|
|
31647
|
-
path:
|
|
31694
|
+
path: path63,
|
|
31648
31695
|
sizeBytes: null,
|
|
31649
31696
|
returnedBytes: null,
|
|
31650
31697
|
isBinary: false,
|
|
@@ -31846,10 +31893,10 @@ ${message2}` : message2;
|
|
|
31846
31893
|
const file = asRecord9(payload.file);
|
|
31847
31894
|
const contentsBase64 = typeof file.contentsBase64 === "string" ? file.contentsBase64 : "";
|
|
31848
31895
|
const text3 = contentsBase64 ? Buffer11.from(contentsBase64, "base64").toString("utf8") : "";
|
|
31849
|
-
const
|
|
31850
|
-
return text3 ? `${
|
|
31896
|
+
const path63 = typeof file.path === "string" ? file.path : "file";
|
|
31897
|
+
return text3 ? `${path63}
|
|
31851
31898
|
|
|
31852
|
-
${text3}` : `Read ${
|
|
31899
|
+
${text3}` : `Read ${path63}`;
|
|
31853
31900
|
}
|
|
31854
31901
|
if (action === "sandbox_exec") {
|
|
31855
31902
|
const command = asRecord9(payload.command);
|
|
@@ -31886,31 +31933,31 @@ ${output}` : `Action ${actionName} ${status}`;
|
|
|
31886
31933
|
}
|
|
31887
31934
|
if (action === "sandbox_upload_file") {
|
|
31888
31935
|
const file = asRecord9(payload.file);
|
|
31889
|
-
const
|
|
31890
|
-
return appendPreservation(`Uploaded ${
|
|
31936
|
+
const path63 = typeof file.path === "string" ? file.path : "file";
|
|
31937
|
+
return appendPreservation(`Uploaded ${path63}.`);
|
|
31891
31938
|
}
|
|
31892
31939
|
if (action === "sandbox_write_file") {
|
|
31893
31940
|
const file = asRecord9(payload.file);
|
|
31894
|
-
const
|
|
31895
|
-
return appendPreservation(`Wrote ${
|
|
31941
|
+
const path63 = typeof file.path === "string" ? file.path : "file";
|
|
31942
|
+
return appendPreservation(`Wrote ${path63}.`);
|
|
31896
31943
|
}
|
|
31897
31944
|
if (action === "sandbox_edit_file") {
|
|
31898
31945
|
const edit = asRecord9(payload.edit);
|
|
31899
|
-
const
|
|
31946
|
+
const path63 = typeof edit.path === "string" ? edit.path : "file";
|
|
31900
31947
|
const replacements = typeof edit.replacements === "number" ? edit.replacements : 0;
|
|
31901
31948
|
return appendPreservation(
|
|
31902
|
-
`Edited ${
|
|
31949
|
+
`Edited ${path63} with ${replacements} replacement${replacements === 1 ? "" : "s"}.`
|
|
31903
31950
|
);
|
|
31904
31951
|
}
|
|
31905
31952
|
if (action === "sandbox_delete_file") {
|
|
31906
31953
|
const deleted = asRecord9(payload.deleted);
|
|
31907
|
-
const
|
|
31908
|
-
return appendPreservation(`Deleted ${
|
|
31954
|
+
const path63 = typeof deleted.path === "string" ? deleted.path : "file";
|
|
31955
|
+
return appendPreservation(`Deleted ${path63}.`);
|
|
31909
31956
|
}
|
|
31910
31957
|
if (action === "sandbox_mkdir") {
|
|
31911
31958
|
const directory = asRecord9(payload.directory);
|
|
31912
|
-
const
|
|
31913
|
-
return appendPreservation(`Created directory ${
|
|
31959
|
+
const path63 = typeof directory.path === "string" ? directory.path : "directory";
|
|
31960
|
+
return appendPreservation(`Created directory ${path63}.`);
|
|
31914
31961
|
}
|
|
31915
31962
|
if (action === "sandbox_move_file") {
|
|
31916
31963
|
const moved = asRecord9(payload.moved);
|
|
@@ -36120,7 +36167,7 @@ async function openTailscaleApp() {
|
|
|
36120
36167
|
|
|
36121
36168
|
// ../server/src/voice-transcription.ts
|
|
36122
36169
|
import { Buffer as Buffer12 } from "node:buffer";
|
|
36123
|
-
import { spawn as spawn5 } from "node:child_process";
|
|
36170
|
+
import { execFile as execFile6, spawn as spawn5 } from "node:child_process";
|
|
36124
36171
|
import { constants as fsConstants, promises as fs20 } from "node:fs";
|
|
36125
36172
|
import os7 from "node:os";
|
|
36126
36173
|
import path36 from "node:path";
|
|
@@ -36131,17 +36178,23 @@ var TRANSCRIPTION_TIMEOUT_MS = 12e4;
|
|
|
36131
36178
|
var MODEL_MIN_BYTES = 10 * 1024 * 1024;
|
|
36132
36179
|
var MODEL_MAX_BYTES = 2 * 1024 * 1024 * 1024;
|
|
36133
36180
|
var PROCESS_OUTPUT_MAX_CHARS = 64 * 1024;
|
|
36181
|
+
var WHISPER_CPP_VERSION = "v1.9.2";
|
|
36182
|
+
var WHISPER_CPP_RELEASE_BASE = `https://github.com/ggml-org/whisper.cpp/releases/download/${WHISPER_CPP_VERSION}`;
|
|
36183
|
+
var BINARY_DIR_NAME = "voice-binaries";
|
|
36184
|
+
var BINARY_MIN_BYTES = 5e5;
|
|
36185
|
+
var BINARY_MAX_BYTES = 1e8;
|
|
36134
36186
|
function createVoiceTranscriptionService(input) {
|
|
36135
36187
|
const modelName = normalizedModelName(process.env.OPENPOND_WHISPER_MODEL_NAME);
|
|
36136
36188
|
const modelPath = process.env.OPENPOND_WHISPER_MODEL?.trim() || path36.join(input.storeDir, "voice-models", `ggml-${modelName}.bin`);
|
|
36137
36189
|
let modelDownload = null;
|
|
36190
|
+
let binaryDownload = null;
|
|
36138
36191
|
const closeController = new AbortController();
|
|
36139
36192
|
const activeProcesses = /* @__PURE__ */ new Set();
|
|
36140
36193
|
const activeTranscriptions = /* @__PURE__ */ new Set();
|
|
36141
36194
|
let closing = false;
|
|
36142
36195
|
let closePromise = null;
|
|
36143
36196
|
async function status() {
|
|
36144
|
-
const binaryPath = await
|
|
36197
|
+
const binaryPath = await ensureBinary();
|
|
36145
36198
|
const modelReady = await fileExists4(modelPath);
|
|
36146
36199
|
return {
|
|
36147
36200
|
available: Boolean(binaryPath && (modelReady || canDownloadDefaultModel())),
|
|
@@ -36153,6 +36206,30 @@ function createVoiceTranscriptionService(input) {
|
|
|
36153
36206
|
installHint: binaryPath ? null : whisperInstallHint()
|
|
36154
36207
|
};
|
|
36155
36208
|
}
|
|
36209
|
+
async function ensureBinary() {
|
|
36210
|
+
const resolved = await resolveWhisperBinary();
|
|
36211
|
+
if (resolved) return resolved;
|
|
36212
|
+
const assetInfo = getPlatformAssetInfo();
|
|
36213
|
+
if (!assetInfo) return null;
|
|
36214
|
+
const binaryDir = path36.join(input.storeDir, BINARY_DIR_NAME);
|
|
36215
|
+
const binaryPath = path36.join(binaryDir, "whisper-cli");
|
|
36216
|
+
if (await fileExists4(binaryPath)) {
|
|
36217
|
+
const isExec = await executableExists2(binaryPath);
|
|
36218
|
+
if (isExec) return binaryPath;
|
|
36219
|
+
}
|
|
36220
|
+
if (!binaryDownload) {
|
|
36221
|
+
binaryDownload = downloadAndExtractWhisperBinary(
|
|
36222
|
+
binaryDir,
|
|
36223
|
+
binaryPath,
|
|
36224
|
+
assetInfo,
|
|
36225
|
+
input.logger,
|
|
36226
|
+
closeController.signal
|
|
36227
|
+
).finally(() => {
|
|
36228
|
+
binaryDownload = null;
|
|
36229
|
+
});
|
|
36230
|
+
}
|
|
36231
|
+
return binaryDownload;
|
|
36232
|
+
}
|
|
36156
36233
|
async function ensureModel() {
|
|
36157
36234
|
if (await fileExists4(modelPath)) return modelPath;
|
|
36158
36235
|
if (process.env.OPENPOND_WHISPER_MODEL?.trim()) {
|
|
@@ -36182,7 +36259,7 @@ function createVoiceTranscriptionService(input) {
|
|
|
36182
36259
|
}
|
|
36183
36260
|
async function runTranscription(payload) {
|
|
36184
36261
|
const request = parseVoiceTranscriptionRequest(payload);
|
|
36185
|
-
const binaryPath = await
|
|
36262
|
+
const binaryPath = await ensureBinary();
|
|
36186
36263
|
if (!binaryPath) throw new Error(whisperInstallHint());
|
|
36187
36264
|
const audio = Buffer12.from(request.audioBase64, "base64");
|
|
36188
36265
|
if (audio.byteLength === 0) throw new Error("No voice audio was recorded.");
|
|
@@ -36229,7 +36306,7 @@ function createVoiceTranscriptionService(input) {
|
|
|
36229
36306
|
closing = true;
|
|
36230
36307
|
closeController.abort();
|
|
36231
36308
|
for (const child of activeProcesses) stopVoiceProcess(child);
|
|
36232
|
-
closePromise = Promise.allSettled([...activeTranscriptions, ...modelDownload ? [modelDownload] : []]).then(() => {
|
|
36309
|
+
closePromise = Promise.allSettled([...activeTranscriptions, ...modelDownload ? [modelDownload] : [], ...binaryDownload ? [binaryDownload] : []]).then(() => {
|
|
36233
36310
|
if (activeProcesses.size > 0) {
|
|
36234
36311
|
throw new Error(`Voice transcription leaked ${activeProcesses.size} process(es).`);
|
|
36235
36312
|
}
|
|
@@ -36274,7 +36351,14 @@ async function runWhisper(input) {
|
|
|
36274
36351
|
reject(new Error("Voice transcription service is closed."));
|
|
36275
36352
|
return;
|
|
36276
36353
|
}
|
|
36277
|
-
const child = spawn5(input.binaryPath, args, {
|
|
36354
|
+
const child = spawn5(input.binaryPath, args, {
|
|
36355
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
36356
|
+
env: {
|
|
36357
|
+
...process.env,
|
|
36358
|
+
// Ensure whisper-cli can find shared libraries bundled alongside it
|
|
36359
|
+
LD_LIBRARY_PATH: [path36.dirname(input.binaryPath), process.env.LD_LIBRARY_PATH].filter(Boolean).join(":")
|
|
36360
|
+
}
|
|
36361
|
+
});
|
|
36278
36362
|
input.activeProcesses.add(child);
|
|
36279
36363
|
let stderr = "";
|
|
36280
36364
|
let stdout = "";
|
|
@@ -36447,13 +36531,158 @@ async function fileExists4(filePath) {
|
|
|
36447
36531
|
}
|
|
36448
36532
|
}
|
|
36449
36533
|
function whisperInstallHint() {
|
|
36534
|
+
if (process.platform === "darwin" || process.platform === "linux") {
|
|
36535
|
+
return "Could not auto-download whisper.cpp. Install it manually (e.g. `brew install whisper-cpp` on macOS or build from github.com/ggml-org/whisper.cpp), or set OPENPOND_WHISPER_CPP_BIN to the binary path.";
|
|
36536
|
+
}
|
|
36537
|
+
return "Local dictation requires whisper.cpp on macOS or Linux.";
|
|
36538
|
+
}
|
|
36539
|
+
function getPlatformAssetInfo() {
|
|
36450
36540
|
if (process.platform === "darwin") {
|
|
36451
|
-
return
|
|
36541
|
+
return { assetName: "whisper-bin-x64.zip", archiveType: "zip" };
|
|
36452
36542
|
}
|
|
36453
36543
|
if (process.platform === "linux") {
|
|
36454
|
-
|
|
36544
|
+
if (process.arch === "arm64") {
|
|
36545
|
+
return { assetName: "whisper-bin-ubuntu-arm64.tar.gz", archiveType: "tar.gz" };
|
|
36546
|
+
}
|
|
36547
|
+
if (process.arch === "x64") {
|
|
36548
|
+
return { assetName: "whisper-bin-ubuntu-x64.tar.gz", archiveType: "tar.gz" };
|
|
36549
|
+
}
|
|
36550
|
+
}
|
|
36551
|
+
return null;
|
|
36552
|
+
}
|
|
36553
|
+
async function downloadAndExtractWhisperBinary(binaryDir, finalBinaryPath, assetInfo, logger, signal) {
|
|
36554
|
+
const url = `${WHISPER_CPP_RELEASE_BASE}/${assetInfo.assetName}`;
|
|
36555
|
+
await fs20.mkdir(binaryDir, { recursive: true });
|
|
36556
|
+
const tempArchive = path36.join(binaryDir, `whisper-archive.${process.pid}.${Date.now()}.tmp`);
|
|
36557
|
+
const extractDir = path36.join(binaryDir, `extract-${process.pid}-${Date.now()}`);
|
|
36558
|
+
logger.info("downloading whisper binary", { url, targetDir: binaryDir });
|
|
36559
|
+
try {
|
|
36560
|
+
const response = await fetch(url, { signal, redirect: "follow" });
|
|
36561
|
+
if (!response.ok || !response.body) {
|
|
36562
|
+
throw new Error(`Unable to download whisper binary: ${response.status} ${response.statusText}`.trim());
|
|
36563
|
+
}
|
|
36564
|
+
const sizeBytes = await streamBinaryResponseToFile({
|
|
36565
|
+
response,
|
|
36566
|
+
targetPath: tempArchive,
|
|
36567
|
+
signal,
|
|
36568
|
+
minBytes: BINARY_MIN_BYTES,
|
|
36569
|
+
maxBytes: BINARY_MAX_BYTES
|
|
36570
|
+
});
|
|
36571
|
+
logger.info("whisper binary downloaded", { sizeBytes, extracting: true });
|
|
36572
|
+
await fs20.mkdir(extractDir, { recursive: true });
|
|
36573
|
+
if (assetInfo.archiveType === "tar.gz") {
|
|
36574
|
+
await runExtractionCommand("tar", ["xzf", tempArchive, "-C", extractDir], signal);
|
|
36575
|
+
} else {
|
|
36576
|
+
await runExtractionCommand("unzip", ["-o", tempArchive, "-d", extractDir], signal);
|
|
36577
|
+
}
|
|
36578
|
+
const foundBinary = await findWhisperBinaryInDirectory(extractDir);
|
|
36579
|
+
if (!foundBinary) {
|
|
36580
|
+
throw new Error("whisper-cli binary not found in downloaded archive.");
|
|
36581
|
+
}
|
|
36582
|
+
const binaryParentDir = path36.dirname(foundBinary);
|
|
36583
|
+
await fs20.mkdir(binaryDir, { recursive: true });
|
|
36584
|
+
await moveAllFiles(binaryParentDir, binaryDir);
|
|
36585
|
+
await fs20.chmod(finalBinaryPath, 493).catch(() => void 0);
|
|
36586
|
+
logger.info("whisper binary installed", { binaryPath: finalBinaryPath });
|
|
36587
|
+
return finalBinaryPath;
|
|
36588
|
+
} finally {
|
|
36589
|
+
await Promise.all([
|
|
36590
|
+
fs20.rm(tempArchive, { force: true }),
|
|
36591
|
+
fs20.rm(extractDir, { force: true, recursive: true })
|
|
36592
|
+
]);
|
|
36593
|
+
}
|
|
36594
|
+
}
|
|
36595
|
+
async function streamBinaryResponseToFile(input) {
|
|
36596
|
+
const declaredBytes = Number(input.response.headers.get("content-length"));
|
|
36597
|
+
if (Number.isFinite(declaredBytes) && declaredBytes > input.maxBytes) {
|
|
36598
|
+
throw new Error("Whisper binary download exceeds the configured byte limit.");
|
|
36599
|
+
}
|
|
36600
|
+
const reader = input.response.body?.getReader();
|
|
36601
|
+
if (!reader) throw new Error("Whisper binary download did not return a response body.");
|
|
36602
|
+
const file = await fs20.open(input.targetPath, "wx", 384);
|
|
36603
|
+
let sizeBytes = 0;
|
|
36604
|
+
try {
|
|
36605
|
+
try {
|
|
36606
|
+
while (true) {
|
|
36607
|
+
if (input.signal.aborted) throw new Error("Whisper binary download was cancelled.");
|
|
36608
|
+
const { done, value } = await reader.read();
|
|
36609
|
+
if (done) break;
|
|
36610
|
+
sizeBytes += value.byteLength;
|
|
36611
|
+
if (sizeBytes > input.maxBytes) {
|
|
36612
|
+
throw new Error("Whisper binary download exceeds the configured byte limit.");
|
|
36613
|
+
}
|
|
36614
|
+
await file.write(value);
|
|
36615
|
+
}
|
|
36616
|
+
} catch (error) {
|
|
36617
|
+
await reader.cancel().catch(() => void 0);
|
|
36618
|
+
throw error;
|
|
36619
|
+
} finally {
|
|
36620
|
+
await file.close();
|
|
36621
|
+
}
|
|
36622
|
+
} catch (error) {
|
|
36623
|
+
await fs20.rm(input.targetPath, { force: true });
|
|
36624
|
+
throw error;
|
|
36625
|
+
}
|
|
36626
|
+
if (sizeBytes < input.minBytes) {
|
|
36627
|
+
await fs20.rm(input.targetPath, { force: true });
|
|
36628
|
+
throw new Error("Downloaded whisper binary is incomplete.");
|
|
36629
|
+
}
|
|
36630
|
+
await fs20.chmod(input.targetPath, 384).catch(() => void 0);
|
|
36631
|
+
return sizeBytes;
|
|
36632
|
+
}
|
|
36633
|
+
async function runExtractionCommand(command, args, signal) {
|
|
36634
|
+
await new Promise((resolve, reject) => {
|
|
36635
|
+
if (signal.aborted) {
|
|
36636
|
+
reject(new Error("Whisper binary extraction was cancelled."));
|
|
36637
|
+
return;
|
|
36638
|
+
}
|
|
36639
|
+
const child = execFile6(command, args, { signal, maxBuffer: 10 * 1024 * 1024 }, (error) => {
|
|
36640
|
+
if (error) {
|
|
36641
|
+
reject(new Error(`Whisper binary extraction failed: ${error.message}`));
|
|
36642
|
+
return;
|
|
36643
|
+
}
|
|
36644
|
+
resolve();
|
|
36645
|
+
});
|
|
36646
|
+
if (child.exitCode === null && child.signalCode === null && signal.aborted) {
|
|
36647
|
+
child.kill("SIGTERM");
|
|
36648
|
+
}
|
|
36649
|
+
});
|
|
36650
|
+
}
|
|
36651
|
+
async function findWhisperBinaryInDirectory(directory) {
|
|
36652
|
+
const entries = await fs20.readdir(directory, { withFileTypes: true });
|
|
36653
|
+
for (const entry of entries) {
|
|
36654
|
+
const fullPath = path36.join(directory, entry.name);
|
|
36655
|
+
if (entry.isDirectory()) {
|
|
36656
|
+
const found = await findWhisperBinaryInDirectory(fullPath);
|
|
36657
|
+
if (found) return found;
|
|
36658
|
+
} else if (entry.isFile() && (entry.name === "whisper-cli" || entry.name === "whisper-cpp")) {
|
|
36659
|
+
if (await executableExists2(fullPath)) return fullPath;
|
|
36660
|
+
}
|
|
36661
|
+
}
|
|
36662
|
+
return null;
|
|
36663
|
+
}
|
|
36664
|
+
async function moveAllFiles(srcDir, destDir) {
|
|
36665
|
+
const entries = await fs20.readdir(srcDir, { withFileTypes: true });
|
|
36666
|
+
for (const entry of entries) {
|
|
36667
|
+
const srcPath = path36.join(srcDir, entry.name);
|
|
36668
|
+
const destPath = path36.join(destDir, entry.name);
|
|
36669
|
+
if (entry.isSymbolicLink()) {
|
|
36670
|
+
const linkTarget = await fs20.readlink(srcPath);
|
|
36671
|
+
await fs20.symlink(linkTarget, destPath).catch(() => void 0);
|
|
36672
|
+
await fs20.rm(srcPath, { force: true }).catch(() => void 0);
|
|
36673
|
+
} else if (entry.isDirectory()) {
|
|
36674
|
+
await fs20.mkdir(destPath, { recursive: true });
|
|
36675
|
+
await moveAllFiles(srcPath, destPath);
|
|
36676
|
+
await fs20.rmdir(srcPath).catch(() => void 0);
|
|
36677
|
+
} else if (entry.isFile()) {
|
|
36678
|
+
await fs20.rename(srcPath, destPath);
|
|
36679
|
+
if (entry.name === "whisper-cli" || entry.name === "whisper-cpp") {
|
|
36680
|
+
await fs20.chmod(destPath, 493).catch(() => void 0);
|
|
36681
|
+
} else if (entry.name.endsWith(".so") || entry.name.includes(".so.")) {
|
|
36682
|
+
await fs20.chmod(destPath, 493).catch(() => void 0);
|
|
36683
|
+
}
|
|
36684
|
+
}
|
|
36455
36685
|
}
|
|
36456
|
-
return "Local dictation requires whisper.cpp on macOS or Linux.";
|
|
36457
36686
|
}
|
|
36458
36687
|
|
|
36459
36688
|
// ../server/src/openpond/browser-control-queue.ts
|
|
@@ -36705,7 +36934,7 @@ function headerValue2(value) {
|
|
|
36705
36934
|
|
|
36706
36935
|
// ../server/src/agents/local-agent-scheduler.ts
|
|
36707
36936
|
var import_cron_parser = __toESM(require_dist(), 1);
|
|
36708
|
-
import { execFile as
|
|
36937
|
+
import { execFile as execFile7 } from "node:child_process";
|
|
36709
36938
|
import { randomUUID as randomUUID14 } from "node:crypto";
|
|
36710
36939
|
import { promises as fs21 } from "node:fs";
|
|
36711
36940
|
import path37 from "node:path";
|
|
@@ -36764,7 +36993,7 @@ function trimOutput2(value) {
|
|
|
36764
36993
|
}
|
|
36765
36994
|
|
|
36766
36995
|
// ../server/src/agents/local-agent-scheduler.ts
|
|
36767
|
-
var execFileAsync4 = promisify4(
|
|
36996
|
+
var execFileAsync4 = promisify4(execFile7);
|
|
36768
36997
|
var DEFAULT_TICK_MS = 15e3;
|
|
36769
36998
|
var DEFAULT_RECONCILE_MS = 6e4;
|
|
36770
36999
|
var INSPECT_TIMEOUT_MS = 6e4;
|
|
@@ -37530,11 +37759,11 @@ async function teamChatRequestPayload(action, dependencies = {}) {
|
|
|
37530
37759
|
const payload = await requestTeamChatApi(request.path, request.init, dependencies);
|
|
37531
37760
|
return schemaForAction2(action).parse(payload);
|
|
37532
37761
|
}
|
|
37533
|
-
async function requestTeamChatApi(
|
|
37762
|
+
async function requestTeamChatApi(path63, init = {}, dependencies = {}) {
|
|
37534
37763
|
const access5 = await resolveHostedApiAccess(dependencies);
|
|
37535
37764
|
const headers = hostedApiAuthHeaders(access5.token);
|
|
37536
37765
|
headers.set("Content-Type", "application/json");
|
|
37537
|
-
const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${
|
|
37766
|
+
const response = await (dependencies.fetchImpl ?? fetch)(`${access5.apiBaseUrl}${path63}`, {
|
|
37538
37767
|
...init,
|
|
37539
37768
|
headers
|
|
37540
37769
|
});
|
|
@@ -37766,11 +37995,11 @@ async function uploadTeamChatAttachment(action, dependencies) {
|
|
|
37766
37995
|
)
|
|
37767
37996
|
);
|
|
37768
37997
|
}
|
|
37769
|
-
function post2(
|
|
37770
|
-
return jsonRequest2(
|
|
37998
|
+
function post2(path63, body) {
|
|
37999
|
+
return jsonRequest2(path63, "POST", body);
|
|
37771
38000
|
}
|
|
37772
|
-
function jsonRequest2(
|
|
37773
|
-
return { path:
|
|
38001
|
+
function jsonRequest2(path63, method, body) {
|
|
38002
|
+
return { path: path63, init: { method, body: JSON.stringify(body) } };
|
|
37774
38003
|
}
|
|
37775
38004
|
|
|
37776
38005
|
// ../server/src/openpond/team-chat-executor.ts
|
|
@@ -40839,25 +41068,25 @@ var ManagedRlLocalRolloutExecutor = class {
|
|
|
40839
41068
|
}
|
|
40840
41069
|
throw lastError;
|
|
40841
41070
|
}
|
|
40842
|
-
async userRequest(
|
|
41071
|
+
async userRequest(path63, init) {
|
|
40843
41072
|
const headers = hostedApiAuthHeaders(this.input.access.token);
|
|
40844
41073
|
headers.set("accept", "application/json");
|
|
40845
41074
|
headers.set("content-type", "application/json");
|
|
40846
41075
|
headers.set("x-openpond-team-id", this.input.access.teamId);
|
|
40847
|
-
const requestUrl = `${this.input.access.apiBaseUrl}${
|
|
41076
|
+
const requestUrl = `${this.input.access.apiBaseUrl}${path63}`;
|
|
40848
41077
|
return requestJson(this.input.fetchImpl ?? fetch, requestUrl, {
|
|
40849
41078
|
...init,
|
|
40850
41079
|
headers: withVercelProtectionBypass(requestUrl, headers, this.input.env),
|
|
40851
41080
|
signal: this.abortController.signal
|
|
40852
41081
|
});
|
|
40853
41082
|
}
|
|
40854
|
-
policyRequest(
|
|
41083
|
+
policyRequest(path63, token, request, signal = this.abortController.signal) {
|
|
40855
41084
|
const headers = new Headers({
|
|
40856
41085
|
accept: "application/json",
|
|
40857
41086
|
authorization: `Bearer ${token}`,
|
|
40858
41087
|
"content-type": "application/json"
|
|
40859
41088
|
});
|
|
40860
|
-
const requestUrl = `${this.input.access.apiBaseUrl}${
|
|
41089
|
+
const requestUrl = `${this.input.access.apiBaseUrl}${path63}`;
|
|
40861
41090
|
return requestJson(
|
|
40862
41091
|
this.input.fetchImpl ?? fetch,
|
|
40863
41092
|
requestUrl,
|
|
@@ -41065,7 +41294,7 @@ function managedRunEvidence(detail, syncedAt) {
|
|
|
41065
41294
|
);
|
|
41066
41295
|
const finalGroup = [...detail.rolloutGroups].filter((group) => group.rewardMean != null).sort((left, right) => left.groupIndex - right.groupIndex).at(-1);
|
|
41067
41296
|
const lease = [...detail.gpuLeases].sort((left, right) => left.id.localeCompare(right.id)).at(-1);
|
|
41068
|
-
const
|
|
41297
|
+
const checkpoint2 = [...detail.checkpoints].filter((candidate2) => candidate2.state === "ready").sort(
|
|
41069
41298
|
(left, right) => Number(right.isFinal) - Number(left.isFinal) || Number(right.isLatest) - Number(left.isLatest) || right.policyVersion - left.policyVersion
|
|
41070
41299
|
).at(0);
|
|
41071
41300
|
return ManagedTrainingRunEvidenceSchema.parse({
|
|
@@ -41102,11 +41331,11 @@ function managedRunEvidence(detail, syncedAt) {
|
|
|
41102
41331
|
cost: {
|
|
41103
41332
|
totalUsd: decimal(detail.job.accruedSpendUsd)
|
|
41104
41333
|
},
|
|
41105
|
-
checkpoint:
|
|
41106
|
-
id:
|
|
41107
|
-
policyVersion:
|
|
41108
|
-
sha256:
|
|
41109
|
-
sizeBytes:
|
|
41334
|
+
checkpoint: checkpoint2 ? {
|
|
41335
|
+
id: checkpoint2.id,
|
|
41336
|
+
policyVersion: checkpoint2.policyVersion,
|
|
41337
|
+
sha256: checkpoint2.adapterSha256 ?? null,
|
|
41338
|
+
sizeBytes: checkpoint2.sizeBytes ?? null
|
|
41110
41339
|
} : null,
|
|
41111
41340
|
evaluations: detail.evaluations.map((evaluation) => ({
|
|
41112
41341
|
kind: evaluation.kind,
|
|
@@ -41211,19 +41440,19 @@ function managedTrainingEvents(input) {
|
|
|
41211
41440
|
}
|
|
41212
41441
|
});
|
|
41213
41442
|
}
|
|
41214
|
-
for (const
|
|
41443
|
+
for (const checkpoint2 of input.detail.checkpoints.filter(
|
|
41215
41444
|
(candidate2) => candidate2.state === "ready"
|
|
41216
41445
|
)) {
|
|
41217
41446
|
candidates.push({
|
|
41218
|
-
identity: `checkpoint:${
|
|
41219
|
-
timestamp:
|
|
41447
|
+
identity: `checkpoint:${checkpoint2.id}`,
|
|
41448
|
+
timestamp: checkpoint2.readyAt ?? checkpoint2.updatedAt,
|
|
41220
41449
|
type: "checkpoint",
|
|
41221
41450
|
payload: {
|
|
41222
|
-
checkpointId:
|
|
41223
|
-
policyVersion:
|
|
41224
|
-
sha256:
|
|
41225
|
-
sizeBytes:
|
|
41226
|
-
final:
|
|
41451
|
+
checkpointId: checkpoint2.id,
|
|
41452
|
+
policyVersion: checkpoint2.policyVersion,
|
|
41453
|
+
sha256: checkpoint2.adapterSha256 ?? null,
|
|
41454
|
+
sizeBytes: checkpoint2.sizeBytes ?? null,
|
|
41455
|
+
final: checkpoint2.isFinal
|
|
41227
41456
|
}
|
|
41228
41457
|
});
|
|
41229
41458
|
}
|
|
@@ -41237,7 +41466,7 @@ function managedTrainingEvents(input) {
|
|
|
41237
41466
|
payload: {
|
|
41238
41467
|
state: input.detail.job.state,
|
|
41239
41468
|
artifactCount: input.detail.checkpoints.filter(
|
|
41240
|
-
(
|
|
41469
|
+
(checkpoint2) => checkpoint2.state === "ready"
|
|
41241
41470
|
).length,
|
|
41242
41471
|
optimizerUpdates: input.detail.trainingSteps.filter(
|
|
41243
41472
|
(step) => step.state === "committed"
|
|
@@ -46740,8 +46969,8 @@ ${split.split}`) ?? {
|
|
|
46740
46969
|
inspectedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
46741
46970
|
metadata: {
|
|
46742
46971
|
sourceSchemaHash: contentHash(
|
|
46743
|
-
columns.map(({ path:
|
|
46744
|
-
path:
|
|
46972
|
+
columns.map(({ path: path63, logicalType: logicalType2, nullable }) => ({
|
|
46973
|
+
path: path63,
|
|
46745
46974
|
logicalType: logicalType2,
|
|
46746
46975
|
nullable
|
|
46747
46976
|
}))
|
|
@@ -46790,10 +47019,10 @@ function parquetSourceFile(value, repositoryId, revision) {
|
|
|
46790
47019
|
if (item?.dataset !== repositoryId || typeof item.config !== "string" || typeof item.split !== "string" || typeof item.filename !== "string" || !item.filename.toLowerCase().endsWith(".parquet")) {
|
|
46791
47020
|
return [];
|
|
46792
47021
|
}
|
|
46793
|
-
const
|
|
46794
|
-
if (!
|
|
47022
|
+
const path63 = [item.config, item.split, item.filename].flatMap((segment) => segment.split("/")).map((segment) => segment.trim()).filter(Boolean).join("/");
|
|
47023
|
+
if (!path63 || path63.split("/").includes("..")) return [];
|
|
46795
47024
|
return [{
|
|
46796
|
-
path:
|
|
47025
|
+
path: path63,
|
|
46797
47026
|
configuration: item.config,
|
|
46798
47027
|
split: item.split,
|
|
46799
47028
|
revision,
|
|
@@ -46866,8 +47095,8 @@ function sourceColumns(features, rows) {
|
|
|
46866
47095
|
});
|
|
46867
47096
|
}
|
|
46868
47097
|
}
|
|
46869
|
-
return [...paths.entries()].map(([
|
|
46870
|
-
path:
|
|
47098
|
+
return [...paths.entries()].map(([path63, value]) => ({
|
|
47099
|
+
path: path63,
|
|
46871
47100
|
logicalType: value.type,
|
|
46872
47101
|
nullable: value.nullable,
|
|
46873
47102
|
sampleValues: value.values.slice(0, 5)
|
|
@@ -46885,21 +47114,21 @@ function flattenRecord(value, prefix, paths, rows) {
|
|
|
46885
47114
|
return;
|
|
46886
47115
|
}
|
|
46887
47116
|
for (const [key, child] of Object.entries(value)) {
|
|
46888
|
-
const
|
|
47117
|
+
const path63 = prefix ? `${prefix}.${key}` : key;
|
|
46889
47118
|
if (child && typeof child === "object" && !Array.isArray(child)) {
|
|
46890
|
-
flattenRecord(child,
|
|
47119
|
+
flattenRecord(child, path63, paths, rows);
|
|
46891
47120
|
} else {
|
|
46892
|
-
paths.set(
|
|
47121
|
+
paths.set(path63, {
|
|
46893
47122
|
type: logicalType(child),
|
|
46894
|
-
nullable: rows.some((row) => nestedValue(row,
|
|
46895
|
-
values: rows.map((row) => nestedValue(row,
|
|
47123
|
+
nullable: rows.some((row) => nestedValue(row, path63) == null),
|
|
47124
|
+
values: rows.map((row) => nestedValue(row, path63)).filter((item) => item != null)
|
|
46896
47125
|
});
|
|
46897
47126
|
}
|
|
46898
47127
|
}
|
|
46899
47128
|
}
|
|
46900
|
-
function nestedValue(value,
|
|
47129
|
+
function nestedValue(value, path63) {
|
|
46901
47130
|
let current = value;
|
|
46902
|
-
for (const segment of
|
|
47131
|
+
for (const segment of path63.split(".")) {
|
|
46903
47132
|
const record11 = asRecord15(current);
|
|
46904
47133
|
if (!record11) return null;
|
|
46905
47134
|
current = record11[segment];
|
|
@@ -47225,7 +47454,7 @@ function graderFixtures(taskId, expected, split) {
|
|
|
47225
47454
|
output: fixture.output,
|
|
47226
47455
|
infrastructureError: fixture.infrastructureError,
|
|
47227
47456
|
expectedPassed: fixture.expectedPassed,
|
|
47228
|
-
expectedRewardEligible: fixture.
|
|
47457
|
+
expectedRewardEligible: fixture.label !== "infrastructure_failure",
|
|
47229
47458
|
metadata: {
|
|
47230
47459
|
artifactBacked: true,
|
|
47231
47460
|
artifactSplit: split
|
|
@@ -48089,6 +48318,8 @@ function errorMessage4(error) {
|
|
|
48089
48318
|
}
|
|
48090
48319
|
|
|
48091
48320
|
// ../server/src/training/harness-refiner-benchmark-protocol.ts
|
|
48321
|
+
var HARNESS_REFINER_BENCHMARK_MAX_INVOCATIONS_PER_TASK = 2;
|
|
48322
|
+
var HARNESS_REFINER_BENCHMARK_REFINER_TIMEOUT_MS = 18e4;
|
|
48092
48323
|
function createHarnessRefinerExecutionPlan(input) {
|
|
48093
48324
|
if (input.seeds.length !== 1 || input.repetitions !== 1) {
|
|
48094
48325
|
throw new Error(
|
|
@@ -48101,8 +48332,8 @@ function createHarnessRefinerExecutionPlan(input) {
|
|
|
48101
48332
|
const adaptation = taskIdsForSplit(input.taskset, benchmark.adaptationSplit);
|
|
48102
48333
|
const multiplier = input.seeds.length * input.repetitions;
|
|
48103
48334
|
return [
|
|
48104
|
-
planItem("baseline", benchmark.evaluationSplit, heldOut, multiplier),
|
|
48105
48335
|
planItem("adaptation", benchmark.adaptationSplit, adaptation, multiplier),
|
|
48336
|
+
planItem("baseline", benchmark.evaluationSplit, heldOut, multiplier),
|
|
48106
48337
|
planItem("candidate_adaptation", benchmark.adaptationSplit, adaptation, multiplier),
|
|
48107
48338
|
planItem("candidate", benchmark.evaluationSplit, heldOut, multiplier)
|
|
48108
48339
|
];
|
|
@@ -48291,7 +48522,8 @@ function createResultManifest(input) {
|
|
|
48291
48522
|
evidenceSnapshot: input.evidenceSnapshot,
|
|
48292
48523
|
lineage: input.lineage,
|
|
48293
48524
|
publicationPolicy: {
|
|
48294
|
-
|
|
48525
|
+
primaryReward: "deterministic_output_contract",
|
|
48526
|
+
supplementaryJudge: "not_executed_uncalibrated",
|
|
48295
48527
|
diagnosticPasses: 1,
|
|
48296
48528
|
confirmationPasses: 1,
|
|
48297
48529
|
uncertainty: "paired_per_case_descriptive"
|
|
@@ -48433,7 +48665,9 @@ function completedStage(input) {
|
|
|
48433
48665
|
attempt: result.attempt,
|
|
48434
48666
|
grade: result.grade,
|
|
48435
48667
|
artifacts: result.artifacts,
|
|
48436
|
-
receiptContentHash: result.portable.receipt.contentHash
|
|
48668
|
+
receiptContentHash: result.portable.receipt.contentHash,
|
|
48669
|
+
artifactManifest: result.portable.artifactManifest,
|
|
48670
|
+
rewardReceipt: result.portable.rewardReceipt
|
|
48437
48671
|
}))
|
|
48438
48672
|
};
|
|
48439
48673
|
}
|
|
@@ -48461,7 +48695,9 @@ async function combineRetriedBenchmarkStage(input) {
|
|
|
48461
48695
|
attempt: result.attempt,
|
|
48462
48696
|
grade: result.grade,
|
|
48463
48697
|
artifacts: result.artifacts,
|
|
48464
|
-
receiptContentHash: result.portable.receipt.contentHash
|
|
48698
|
+
receiptContentHash: result.portable.receipt.contentHash,
|
|
48699
|
+
artifactManifest: result.portable.artifactManifest,
|
|
48700
|
+
rewardReceipt: result.portable.rewardReceipt
|
|
48465
48701
|
},
|
|
48466
48702
|
receipt: result.portable.receipt
|
|
48467
48703
|
}
|
|
@@ -48560,7 +48796,8 @@ async function loadCompletedBenchmarkStage(input) {
|
|
|
48560
48796
|
attempt,
|
|
48561
48797
|
grade,
|
|
48562
48798
|
artifacts: await input.store.listTaskAttemptArtifacts({ attemptId: attempt.id }),
|
|
48563
|
-
receiptContentHash: portableReceiptContentHash(attempt)
|
|
48799
|
+
receiptContentHash: portableReceiptContentHash(attempt),
|
|
48800
|
+
...portableCanonicalReceipts(attempt)
|
|
48564
48801
|
};
|
|
48565
48802
|
}));
|
|
48566
48803
|
return { run, attempts: evidence };
|
|
@@ -48577,15 +48814,19 @@ async function loadBenchmarkAttemptEvidenceByIds(input) {
|
|
|
48577
48814
|
`Sequential adaptation evidence has ${selected.length}/${wanted.size} attempts.`
|
|
48578
48815
|
);
|
|
48579
48816
|
}
|
|
48817
|
+
const selectedById = new Map(selected.map((attempt) => [attempt.id, attempt]));
|
|
48580
48818
|
const gradesByAttempt = new Map(grades.map((grade) => [grade.attemptId, grade]));
|
|
48581
|
-
return Promise.all(
|
|
48819
|
+
return Promise.all(input.attemptIds.map(async (attemptId) => {
|
|
48820
|
+
const attempt = selectedById.get(attemptId);
|
|
48821
|
+
if (!attempt) throw new Error(`Sequential adaptation attempt ${attemptId} is unavailable.`);
|
|
48582
48822
|
const grade = gradesByAttempt.get(attempt.id);
|
|
48583
48823
|
if (!grade) throw new Error(`Attempt ${attempt.id} has no durable grade.`);
|
|
48584
48824
|
return {
|
|
48585
48825
|
attempt,
|
|
48586
48826
|
grade,
|
|
48587
48827
|
artifacts: await input.store.listTaskAttemptArtifacts({ attemptId: attempt.id }),
|
|
48588
|
-
receiptContentHash: portableReceiptContentHash(attempt)
|
|
48828
|
+
receiptContentHash: portableReceiptContentHash(attempt),
|
|
48829
|
+
...portableCanonicalReceipts(attempt)
|
|
48589
48830
|
};
|
|
48590
48831
|
}));
|
|
48591
48832
|
}
|
|
@@ -48602,6 +48843,25 @@ function portableReceiptContentHash(attempt) {
|
|
|
48602
48843
|
}
|
|
48603
48844
|
return hash3;
|
|
48604
48845
|
}
|
|
48846
|
+
function portableCanonicalReceipts(attempt) {
|
|
48847
|
+
try {
|
|
48848
|
+
const artifactManifest = ArtifactManifestSchema.parse(
|
|
48849
|
+
attempt.metadata.portableArtifactManifest
|
|
48850
|
+
);
|
|
48851
|
+
const rewardReceipt = RewardReceiptSchema.parse(
|
|
48852
|
+
attempt.metadata.portableRewardReceipt
|
|
48853
|
+
);
|
|
48854
|
+
if (!verifyArtifactManifest(artifactManifest) || !verifyRewardReceipt(rewardReceipt)) {
|
|
48855
|
+
throw new Error("Canonical reward evidence failed content-hash verification.");
|
|
48856
|
+
}
|
|
48857
|
+
return { artifactManifest, rewardReceipt };
|
|
48858
|
+
} catch (error) {
|
|
48859
|
+
throw new Error(
|
|
48860
|
+
`Attempt ${attempt.id} has no valid durable canonical reward evidence.`,
|
|
48861
|
+
{ cause: error }
|
|
48862
|
+
);
|
|
48863
|
+
}
|
|
48864
|
+
}
|
|
48605
48865
|
function objectRecord(value) {
|
|
48606
48866
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
48607
48867
|
}
|
|
@@ -48929,58 +49189,6 @@ function frozenToolEvidence(snapshot, mode, cohort) {
|
|
|
48929
49189
|
}
|
|
48930
49190
|
};
|
|
48931
49191
|
}
|
|
48932
|
-
async function benchmarkLineage(input) {
|
|
48933
|
-
const [outcomes, validations, applyReceipts] = await Promise.all([
|
|
48934
|
-
input.store.listHarnessImprovementArtifacts(
|
|
48935
|
-
input.workspaceId,
|
|
48936
|
-
"refiner_outcome",
|
|
48937
|
-
1e3
|
|
48938
|
-
),
|
|
48939
|
-
input.store.listHarnessImprovementArtifacts(
|
|
48940
|
-
input.workspaceId,
|
|
48941
|
-
"targeted_validation",
|
|
48942
|
-
1e4
|
|
48943
|
-
),
|
|
48944
|
-
input.store.listHarnessImprovementArtifacts(
|
|
48945
|
-
input.workspaceId,
|
|
48946
|
-
"apply_receipt",
|
|
48947
|
-
1e3
|
|
48948
|
-
)
|
|
48949
|
-
]);
|
|
48950
|
-
const adaptationEvidenceHash = contentHash(input.adaptationAttempts.map((result) => ({
|
|
48951
|
-
attempt: result.attempt.id,
|
|
48952
|
-
receipt: result.receiptContentHash,
|
|
48953
|
-
grade: contentHash(result.grade)
|
|
48954
|
-
})));
|
|
48955
|
-
const proposalResults = input.refinerResults.filter((result) => result.proposal);
|
|
48956
|
-
const requiredValidationsPassed = proposalResults.every(
|
|
48957
|
-
(result) => result.proposal.validationPlan.filter((plan) => plan.required).every((plan) => result.validations.some(
|
|
48958
|
-
(validation) => validation.validationId === plan.id && validation.status === "passed"
|
|
48959
|
-
))
|
|
48960
|
-
);
|
|
48961
|
-
const proposalHashes = new Set(
|
|
48962
|
-
proposalResults.map((result) => result.proposal.contentHash)
|
|
48963
|
-
);
|
|
48964
|
-
const appliedProposalHashes = new Set(applyReceipts.flatMap((artifact) => {
|
|
48965
|
-
const proposal = "proposal" in artifact ? artifact.proposal : null;
|
|
48966
|
-
return proposal && typeof proposal === "object" && "contentHash" in proposal ? [String(proposal.contentHash)] : [];
|
|
48967
|
-
}));
|
|
48968
|
-
const everyProposalHasReceipt = [...proposalHashes].every(
|
|
48969
|
-
(hash3) => appliedProposalHashes.has(hash3)
|
|
48970
|
-
);
|
|
48971
|
-
return {
|
|
48972
|
-
adaptationEvidenceHash,
|
|
48973
|
-
refinerInputHash: input.refinerInputHash,
|
|
48974
|
-
refinerOutcomeHash: contentHash(outcomes),
|
|
48975
|
-
validationHash: contentHash(validations),
|
|
48976
|
-
applyReceiptHash: contentHash(applyReceipts),
|
|
48977
|
-
candidateRelease: {
|
|
48978
|
-
id: input.candidateRelease.id,
|
|
48979
|
-
contentHash: input.candidateRelease.contentHash
|
|
48980
|
-
},
|
|
48981
|
-
valid: outcomes.length === input.refinerResults.length && requiredValidationsPassed && everyProposalHasReceipt
|
|
48982
|
-
};
|
|
48983
|
-
}
|
|
48984
49192
|
function comparisonInvalidReasons(input) {
|
|
48985
49193
|
const reasons = [];
|
|
48986
49194
|
for (const [label, run] of [
|
|
@@ -49064,7 +49272,7 @@ async function resumeHarnessRefinerComparison(input) {
|
|
|
49064
49272
|
tasksetId: taskset.id,
|
|
49065
49273
|
attemptIds: sequentialAttemptIds
|
|
49066
49274
|
});
|
|
49067
|
-
if (priorManifest.tasksetRelease.contentHash !==
|
|
49275
|
+
if (priorManifest.tasksetRelease.id !== baseline.run.tasksetRelease.id || priorManifest.tasksetRelease.contentHash !== baseline.run.tasksetRelease.contentHash || priorManifest.harness.baseline.contentHash !== baseline.run.harnessRelease.contentHash) {
|
|
49068
49276
|
throw new Error("Comparison recovery manifest drifted from the admitted benchmark.");
|
|
49069
49277
|
}
|
|
49070
49278
|
const currentReleaseRef = workspace.currentChannel.release;
|
|
@@ -49310,7 +49518,106 @@ async function resumeHarnessRefinerComparison(input) {
|
|
|
49310
49518
|
}));
|
|
49311
49519
|
}
|
|
49312
49520
|
|
|
49521
|
+
// ../server/src/training/harness-refiner-benchmark-lineage.ts
|
|
49522
|
+
async function benchmarkLineage(input) {
|
|
49523
|
+
const [outcomes, rawProposals, rawValidations, applyReceipts] = await Promise.all([
|
|
49524
|
+
input.store.listHarnessImprovementArtifacts(
|
|
49525
|
+
input.workspaceId,
|
|
49526
|
+
"refiner_outcome",
|
|
49527
|
+
1e3
|
|
49528
|
+
),
|
|
49529
|
+
input.store.listHarnessImprovementArtifacts(
|
|
49530
|
+
input.workspaceId,
|
|
49531
|
+
"proposal",
|
|
49532
|
+
1e3
|
|
49533
|
+
),
|
|
49534
|
+
input.store.listHarnessImprovementArtifacts(
|
|
49535
|
+
input.workspaceId,
|
|
49536
|
+
"targeted_validation",
|
|
49537
|
+
1e4
|
|
49538
|
+
),
|
|
49539
|
+
input.store.listHarnessImprovementArtifacts(
|
|
49540
|
+
input.workspaceId,
|
|
49541
|
+
"apply_receipt",
|
|
49542
|
+
1e3
|
|
49543
|
+
)
|
|
49544
|
+
]);
|
|
49545
|
+
const proposals = rawProposals;
|
|
49546
|
+
const validations = rawValidations;
|
|
49547
|
+
const adaptationEvidenceHash = contentHash(input.adaptationAttempts.map((result) => ({
|
|
49548
|
+
attempt: result.attempt.id,
|
|
49549
|
+
receipt: result.receiptContentHash,
|
|
49550
|
+
grade: contentHash(result.grade)
|
|
49551
|
+
})));
|
|
49552
|
+
const requiredValidationsPassed = proposals.every(
|
|
49553
|
+
(proposal) => proposal.validationPlan.filter((plan) => plan.required).every((plan) => validations.some(
|
|
49554
|
+
(validation) => validation.validationId === plan.id && validation.status === "passed"
|
|
49555
|
+
))
|
|
49556
|
+
);
|
|
49557
|
+
const proposalHashes = new Set(
|
|
49558
|
+
proposals.map((proposal) => proposal.contentHash)
|
|
49559
|
+
);
|
|
49560
|
+
const appliedProposalHashes = new Set(applyReceipts.flatMap((artifact) => {
|
|
49561
|
+
const proposal = "proposal" in artifact ? artifact.proposal : null;
|
|
49562
|
+
return proposal && typeof proposal === "object" && "contentHash" in proposal ? [String(proposal.contentHash)] : [];
|
|
49563
|
+
}));
|
|
49564
|
+
const everyProposalHasReceipt = [...proposalHashes].every(
|
|
49565
|
+
(hash3) => appliedProposalHashes.has(hash3)
|
|
49566
|
+
);
|
|
49567
|
+
return {
|
|
49568
|
+
adaptationEvidenceHash,
|
|
49569
|
+
refinerInputHash: input.refinerInputHash,
|
|
49570
|
+
refinerOutcomeHash: contentHash(outcomes),
|
|
49571
|
+
validationHash: contentHash(validations),
|
|
49572
|
+
applyReceiptHash: contentHash(applyReceipts),
|
|
49573
|
+
candidateRelease: {
|
|
49574
|
+
id: input.candidateRelease.id,
|
|
49575
|
+
contentHash: input.candidateRelease.contentHash
|
|
49576
|
+
},
|
|
49577
|
+
valid: outcomes.length === input.completedSteps.filter((step) => step.outcome).length && requiredValidationsPassed && everyProposalHasReceipt
|
|
49578
|
+
};
|
|
49579
|
+
}
|
|
49580
|
+
|
|
49313
49581
|
// ../server/src/training/harness-refiner-benchmark-refiner-stage.ts
|
|
49582
|
+
var MAX_REFINER_ARTIFACT_MANIFEST_ENTRIES = 100;
|
|
49583
|
+
var BenchmarkRefinerInvocationError = class extends Error {
|
|
49584
|
+
constructor(message2, details, options) {
|
|
49585
|
+
super(message2, options);
|
|
49586
|
+
this.details = details;
|
|
49587
|
+
}
|
|
49588
|
+
details;
|
|
49589
|
+
name = "BenchmarkRefinerInvocationError";
|
|
49590
|
+
};
|
|
49591
|
+
function benchmarkRefinerRewardPacket(input) {
|
|
49592
|
+
const manifestEntries = input.artifactManifest.entries.slice(
|
|
49593
|
+
0,
|
|
49594
|
+
MAX_REFINER_ARTIFACT_MANIFEST_ENTRIES
|
|
49595
|
+
);
|
|
49596
|
+
return {
|
|
49597
|
+
schemaVersion: "openpond.refinerRewardPacket.v1",
|
|
49598
|
+
attemptRef: input.rewardReceipt.attemptRef,
|
|
49599
|
+
artifactManifest: {
|
|
49600
|
+
ref: {
|
|
49601
|
+
id: input.artifactManifest.id,
|
|
49602
|
+
contentHash: input.artifactManifest.contentHash
|
|
49603
|
+
},
|
|
49604
|
+
entries: manifestEntries,
|
|
49605
|
+
entryCount: input.artifactManifest.entries.length,
|
|
49606
|
+
truncated: manifestEntries.length < input.artifactManifest.entries.length
|
|
49607
|
+
},
|
|
49608
|
+
rewardReceipt: input.rewardReceipt,
|
|
49609
|
+
attempt: {
|
|
49610
|
+
status: input.rewardReceipt.outcomeClass,
|
|
49611
|
+
infrastructureError: input.attempt.infrastructureError,
|
|
49612
|
+
outputPresent: typeof input.attempt.output.text === "string" && input.attempt.output.text.trim().length > 0,
|
|
49613
|
+
artifactCount: input.artifactCount,
|
|
49614
|
+
runtimeEventCount: input.attempt.runtimeEventRefs.length,
|
|
49615
|
+
modelRequestCount: Array.isArray(input.attempt.metadata.usage) ? input.attempt.metadata.usage.length : input.attempt.metadata.usage ? 1 : 0,
|
|
49616
|
+
latencyMs: input.attempt.latencyMs,
|
|
49617
|
+
usage: attemptUsageSummary(input.attempt.metadata.usage)
|
|
49618
|
+
}
|
|
49619
|
+
};
|
|
49620
|
+
}
|
|
49314
49621
|
async function materializeBenchmarkRefinerBoundary(input) {
|
|
49315
49622
|
const attempt = input.result.attempt;
|
|
49316
49623
|
const sessionId = stringMetadata2(attempt.metadata, "sessionId");
|
|
@@ -49361,7 +49668,17 @@ async function materializeBenchmarkRefinerBoundary(input) {
|
|
|
49361
49668
|
}
|
|
49362
49669
|
}
|
|
49363
49670
|
});
|
|
49364
|
-
|
|
49671
|
+
const existingTurn = await input.store.getTurn(turn.id);
|
|
49672
|
+
if (!existingTurn) {
|
|
49673
|
+
await input.store.insertTurn(turn);
|
|
49674
|
+
} else {
|
|
49675
|
+
await input.store.updateTurn(turn.id, (current) => TurnSchema.parse({
|
|
49676
|
+
...current,
|
|
49677
|
+
modelRef: turn.modelRef,
|
|
49678
|
+
metadata: { ...current.metadata, ...turn.metadata },
|
|
49679
|
+
harnessSnapshot: turn.harnessSnapshot
|
|
49680
|
+
}));
|
|
49681
|
+
}
|
|
49365
49682
|
const assistantOutput = attempt.output.text;
|
|
49366
49683
|
if (typeof assistantOutput === "string" && assistantOutput.trim()) {
|
|
49367
49684
|
await input.store.appendRuntimeEvent(event({
|
|
@@ -49374,26 +49691,14 @@ async function materializeBenchmarkRefinerBoundary(input) {
|
|
|
49374
49691
|
output: assistantOutput
|
|
49375
49692
|
}));
|
|
49376
49693
|
}
|
|
49377
|
-
const
|
|
49378
|
-
|
|
49379
|
-
|
|
49380
|
-
|
|
49381
|
-
|
|
49382
|
-
failureClass: input.result.grade.failureClass,
|
|
49383
|
-
rewardEligible: input.result.grade.rewardEligible,
|
|
49384
|
-
feedback: input.result.grade.feedback,
|
|
49385
|
-
evaluationCriteria: task.expectedOutput,
|
|
49386
|
-
attempt: {
|
|
49387
|
-
status: attempt.infrastructureError ? "infrastructure_failure" : "completed",
|
|
49388
|
-
infrastructureError: attempt.infrastructureError,
|
|
49389
|
-
outputPresent: typeof attempt.output.text === "string" && attempt.output.text.trim().length > 0,
|
|
49390
|
-
artifactCount: input.result.artifacts.length,
|
|
49391
|
-
runtimeEventCount: attempt.runtimeEventRefs.length,
|
|
49392
|
-
modelRequestCount: Array.isArray(attempt.metadata.usage) ? attempt.metadata.usage.length : attempt.metadata.usage ? 1 : 0,
|
|
49393
|
-
latencyMs: attempt.latencyMs,
|
|
49394
|
-
usage: attemptUsageSummary(attempt.metadata.usage)
|
|
49395
|
-
}
|
|
49694
|
+
const rewardPacket = benchmarkRefinerRewardPacket({
|
|
49695
|
+
attempt,
|
|
49696
|
+
artifactManifest: input.result.artifactManifest,
|
|
49697
|
+
rewardReceipt: input.result.rewardReceipt,
|
|
49698
|
+
artifactCount: input.result.artifacts.length
|
|
49396
49699
|
});
|
|
49700
|
+
const rewardEvidence = JSON.stringify(rewardPacket);
|
|
49701
|
+
const rewardPassed = input.result.rewardReceipt.status === "scored" && input.result.rewardReceipt.passed;
|
|
49397
49702
|
await input.store.appendRuntimeEvent(event({
|
|
49398
49703
|
sessionId: session.id,
|
|
49399
49704
|
turnId: turn.id,
|
|
@@ -49401,14 +49706,23 @@ async function materializeBenchmarkRefinerBoundary(input) {
|
|
|
49401
49706
|
source: "server",
|
|
49402
49707
|
appId: session.appId,
|
|
49403
49708
|
action: "taskset_grade",
|
|
49404
|
-
status:
|
|
49405
|
-
output:
|
|
49406
|
-
error:
|
|
49709
|
+
status: rewardPassed ? "completed" : "failed",
|
|
49710
|
+
output: rewardEvidence,
|
|
49711
|
+
error: rewardPassed ? void 0 : rewardEvidence,
|
|
49407
49712
|
data: {
|
|
49408
49713
|
result: {
|
|
49409
|
-
output:
|
|
49410
|
-
passed:
|
|
49411
|
-
|
|
49714
|
+
output: rewardEvidence,
|
|
49715
|
+
passed: rewardPassed,
|
|
49716
|
+
status: input.result.rewardReceipt.status,
|
|
49717
|
+
reward: input.result.rewardReceipt.reward,
|
|
49718
|
+
rewardReceiptRef: {
|
|
49719
|
+
id: input.result.rewardReceipt.id,
|
|
49720
|
+
contentHash: input.result.rewardReceipt.contentHash
|
|
49721
|
+
},
|
|
49722
|
+
artifactManifestRef: {
|
|
49723
|
+
id: input.result.artifactManifest.id,
|
|
49724
|
+
contentHash: input.result.artifactManifest.contentHash
|
|
49725
|
+
}
|
|
49412
49726
|
}
|
|
49413
49727
|
}
|
|
49414
49728
|
}));
|
|
@@ -49419,7 +49733,12 @@ async function runBenchmarkRefinerAfterAttempt(input) {
|
|
|
49419
49733
|
if (!boundary) {
|
|
49420
49734
|
throw new Error(`Adaptation attempt ${input.result.attempt.id} has no Refiner boundary.`);
|
|
49421
49735
|
}
|
|
49422
|
-
const
|
|
49736
|
+
const existingTrigger = await queuedTriggerForTurn({
|
|
49737
|
+
store: input.store,
|
|
49738
|
+
workspaceId: input.runtime.workspace.id,
|
|
49739
|
+
turnId: boundary.turn.id
|
|
49740
|
+
});
|
|
49741
|
+
const detection = existingTrigger ? { observations: [], trigger: existingTrigger } : await recordLocalHarnessImprovementBoundary({
|
|
49423
49742
|
store: input.store,
|
|
49424
49743
|
session: boundary.session,
|
|
49425
49744
|
turn: boundary.turn,
|
|
@@ -49435,37 +49754,274 @@ async function runBenchmarkRefinerAfterAttempt(input) {
|
|
|
49435
49754
|
input.budget.assertAvailable(`Refiner turn ${detection.trigger.id}`);
|
|
49436
49755
|
const usage = emptyUsageCategory();
|
|
49437
49756
|
let providerInvoked = false;
|
|
49757
|
+
let providerRequestCount = 0;
|
|
49758
|
+
let requestsWithAuthoritativeCost = 0;
|
|
49759
|
+
let estimatedCostUsd = 0;
|
|
49760
|
+
const startedAt = input.now();
|
|
49761
|
+
let result = null;
|
|
49762
|
+
let failure = null;
|
|
49438
49763
|
try {
|
|
49439
|
-
|
|
49764
|
+
result = await runLocalHarnessRefinerWorker({
|
|
49440
49765
|
store: input.store,
|
|
49441
49766
|
storeDir: input.storeDir,
|
|
49442
49767
|
trigger: detection.trigger,
|
|
49443
49768
|
stream: async function* (streamInput) {
|
|
49444
49769
|
providerInvoked = true;
|
|
49445
|
-
|
|
49446
|
-
|
|
49447
|
-
|
|
49448
|
-
|
|
49449
|
-
|
|
49450
|
-
|
|
49451
|
-
|
|
49770
|
+
providerRequestCount += 1;
|
|
49771
|
+
let requestHadAuthoritativeCost = false;
|
|
49772
|
+
estimatedCostUsd += conservativeRefinerRequestCost(
|
|
49773
|
+
streamInput.messages,
|
|
49774
|
+
input.admittedPricing
|
|
49775
|
+
);
|
|
49776
|
+
try {
|
|
49777
|
+
for await (const delta of input.refinerStream({
|
|
49778
|
+
...streamInput,
|
|
49779
|
+
model: input.model,
|
|
49780
|
+
pricing: input.admittedPricing
|
|
49781
|
+
})) {
|
|
49782
|
+
if (typeof delta.costUsd === "number") requestHadAuthoritativeCost = true;
|
|
49783
|
+
if (delta.usage !== void 0 || delta.costUsd !== void 0) {
|
|
49784
|
+
addUsage(usage, delta.usage, delta.costUsd);
|
|
49785
|
+
}
|
|
49786
|
+
if (delta.text) yield { text: delta.text };
|
|
49787
|
+
}
|
|
49788
|
+
} finally {
|
|
49789
|
+
if (requestHadAuthoritativeCost) requestsWithAuthoritativeCost += 1;
|
|
49452
49790
|
}
|
|
49453
49791
|
},
|
|
49454
49792
|
signal: input.signal,
|
|
49793
|
+
timeoutMs: HARNESS_REFINER_BENCHMARK_REFINER_TIMEOUT_MS,
|
|
49455
49794
|
now: input.now
|
|
49456
49795
|
});
|
|
49457
|
-
|
|
49458
|
-
|
|
49459
|
-
|
|
49460
|
-
|
|
49796
|
+
} catch (error) {
|
|
49797
|
+
failure = error;
|
|
49798
|
+
}
|
|
49799
|
+
const completedAt = input.now();
|
|
49800
|
+
const costBasis = providerInvoked ? usage.costUsd !== null && requestsWithAuthoritativeCost === providerRequestCount ? "authoritative" : "estimated" : "none";
|
|
49801
|
+
const chargedCost = costBasis === "authoritative" ? usage.costUsd : costBasis === "estimated" ? Math.max(usage.costUsd ?? 0, estimatedCostUsd) : null;
|
|
49802
|
+
if (providerInvoked) {
|
|
49803
|
+
try {
|
|
49804
|
+
input.budget.charge(chargedCost, "Refiner");
|
|
49461
49805
|
await checkpointRefinerUsage(
|
|
49462
49806
|
input.store,
|
|
49463
49807
|
input.modelRun.id,
|
|
49464
49808
|
usage,
|
|
49465
49809
|
input.budget.observedSpendUsd
|
|
49466
49810
|
);
|
|
49811
|
+
} catch (error) {
|
|
49812
|
+
failure ??= error;
|
|
49813
|
+
}
|
|
49814
|
+
}
|
|
49815
|
+
if (failure) {
|
|
49816
|
+
const message2 = failure instanceof Error ? failure.message : String(failure);
|
|
49817
|
+
const failureKind = benchmarkRefinerFailureKind(failure, input.signal);
|
|
49818
|
+
const retryable = failureKind !== "cancelled";
|
|
49819
|
+
await input.store.appendRuntimeEvent(event({
|
|
49820
|
+
sessionId: boundary.session.id,
|
|
49821
|
+
turnId: boundary.turn.id,
|
|
49822
|
+
name: "harness.refiner.failed",
|
|
49823
|
+
source: "server",
|
|
49824
|
+
appId: boundary.session.appId,
|
|
49825
|
+
status: "failed",
|
|
49826
|
+
output: message2,
|
|
49827
|
+
data: {
|
|
49828
|
+
trigger: {
|
|
49829
|
+
id: detection.trigger.id,
|
|
49830
|
+
contentHash: detection.trigger.contentHash
|
|
49831
|
+
},
|
|
49832
|
+
benchmark: true,
|
|
49833
|
+
modelRunId: input.modelRun.id,
|
|
49834
|
+
attemptId: input.result.attempt.id,
|
|
49835
|
+
failureKind,
|
|
49836
|
+
retryable,
|
|
49837
|
+
costBasis,
|
|
49838
|
+
estimatedCostUsd: costBasis === "estimated" ? estimatedCostUsd : null
|
|
49839
|
+
}
|
|
49840
|
+
})).catch(() => void 0);
|
|
49841
|
+
throw new BenchmarkRefinerInvocationError(message2, {
|
|
49842
|
+
trigger: detection.trigger,
|
|
49843
|
+
usage,
|
|
49844
|
+
costBasis,
|
|
49845
|
+
estimatedCostUsd: costBasis === "estimated" ? estimatedCostUsd : null,
|
|
49846
|
+
failureKind,
|
|
49847
|
+
retryable,
|
|
49848
|
+
startedAt,
|
|
49849
|
+
completedAt
|
|
49850
|
+
}, { cause: failure });
|
|
49851
|
+
}
|
|
49852
|
+
return {
|
|
49853
|
+
detection,
|
|
49854
|
+
result,
|
|
49855
|
+
invocation: {
|
|
49856
|
+
usage,
|
|
49857
|
+
costBasis,
|
|
49858
|
+
estimatedCostUsd: costBasis === "estimated" ? estimatedCostUsd : null,
|
|
49859
|
+
startedAt,
|
|
49860
|
+
completedAt
|
|
49467
49861
|
}
|
|
49862
|
+
};
|
|
49863
|
+
}
|
|
49864
|
+
async function queuedTriggerForTurn(input) {
|
|
49865
|
+
const triggers = await input.store.listHarnessImprovementArtifacts(
|
|
49866
|
+
input.workspaceId,
|
|
49867
|
+
"trigger_decision",
|
|
49868
|
+
1e3
|
|
49869
|
+
);
|
|
49870
|
+
return triggers.find(
|
|
49871
|
+
(trigger) => trigger.turnId === input.turnId && trigger.decision === "queue_refiner"
|
|
49872
|
+
) ?? null;
|
|
49873
|
+
}
|
|
49874
|
+
function conservativeRefinerRequestCost(messages, pricing) {
|
|
49875
|
+
const inputCharacters = messages.reduce(
|
|
49876
|
+
(total, message2) => total + message2.content.length,
|
|
49877
|
+
0
|
|
49878
|
+
);
|
|
49879
|
+
const estimatedInputTokens = Math.ceil(inputCharacters / 3);
|
|
49880
|
+
return (estimatedInputTokens * pricing.inputUsdPerMillionTokens + DEFAULT_REFINER_MAX_OUTPUT_TOKENS * pricing.outputUsdPerMillionTokens) / 1e6;
|
|
49881
|
+
}
|
|
49882
|
+
function benchmarkRefinerFailureKind(error, signal) {
|
|
49883
|
+
if (signal.aborted) return "cancelled";
|
|
49884
|
+
const message2 = error instanceof Error ? error.message : String(error);
|
|
49885
|
+
if (/timed out|timeout/i.test(message2)) return "timeout";
|
|
49886
|
+
if (/invalid structured output|response limit|JSON/i.test(message2)) {
|
|
49887
|
+
return "invalid_output";
|
|
49468
49888
|
}
|
|
49889
|
+
if (/provider|rate limit|billing|signed out|network|fetch/i.test(message2)) {
|
|
49890
|
+
return "provider_failure";
|
|
49891
|
+
}
|
|
49892
|
+
return "unknown";
|
|
49893
|
+
}
|
|
49894
|
+
|
|
49895
|
+
// ../server/src/training/harness-refiner-benchmark-sequential-checkpoint.ts
|
|
49896
|
+
import { promises as fs24 } from "node:fs";
|
|
49897
|
+
import path57 from "node:path";
|
|
49898
|
+
function createBenchmarkRefinerInvocationReceipt(input) {
|
|
49899
|
+
const core = {
|
|
49900
|
+
schemaVersion: "openpond.benchmarkRefinerInvocation.v1",
|
|
49901
|
+
id: `benchmark-refiner-invocation-${contentHash({
|
|
49902
|
+
taskId: input.taskId,
|
|
49903
|
+
attemptId: input.attemptId,
|
|
49904
|
+
invocationOrdinal: input.invocationOrdinal,
|
|
49905
|
+
trigger: input.trigger,
|
|
49906
|
+
status: input.status,
|
|
49907
|
+
startedAt: input.startedAt
|
|
49908
|
+
}).slice(0, 24)}`,
|
|
49909
|
+
...input
|
|
49910
|
+
};
|
|
49911
|
+
return { ...core, contentHash: contentHash(core) };
|
|
49912
|
+
}
|
|
49913
|
+
async function loadSequentialAdaptationCheckpoint(input) {
|
|
49914
|
+
const filePath = checkpointPath(input.storeDir, input.modelRunId);
|
|
49915
|
+
let parsed;
|
|
49916
|
+
try {
|
|
49917
|
+
parsed = JSON.parse(await fs24.readFile(filePath, "utf8"));
|
|
49918
|
+
} catch (error) {
|
|
49919
|
+
if (error.code === "ENOENT") return null;
|
|
49920
|
+
throw error;
|
|
49921
|
+
}
|
|
49922
|
+
return parseCheckpoint(parsed, input.modelRunId);
|
|
49923
|
+
}
|
|
49924
|
+
async function initializeSequentialAdaptationCheckpoint(input) {
|
|
49925
|
+
const existing = await loadSequentialAdaptationCheckpoint(input);
|
|
49926
|
+
if (existing) {
|
|
49927
|
+
if (!sameRef(existing.initialHarness, input.initialHarness)) {
|
|
49928
|
+
throw new Error("Sequential adaptation checkpoint changed its initial Harness release.");
|
|
49929
|
+
}
|
|
49930
|
+
return existing;
|
|
49931
|
+
}
|
|
49932
|
+
return writeSequentialAdaptationCheckpoint({
|
|
49933
|
+
storeDir: input.storeDir,
|
|
49934
|
+
checkpoint: checkpoint({
|
|
49935
|
+
modelRunId: input.modelRunId,
|
|
49936
|
+
initialHarness: input.initialHarness,
|
|
49937
|
+
steps: [],
|
|
49938
|
+
invocations: [],
|
|
49939
|
+
updatedAt: input.now
|
|
49940
|
+
})
|
|
49941
|
+
});
|
|
49942
|
+
}
|
|
49943
|
+
async function appendSequentialAdaptationInvocation(input) {
|
|
49944
|
+
const current = await initializeSequentialAdaptationCheckpoint({
|
|
49945
|
+
storeDir: input.storeDir,
|
|
49946
|
+
modelRunId: input.modelRunId,
|
|
49947
|
+
initialHarness: input.initialHarness,
|
|
49948
|
+
now: input.now
|
|
49949
|
+
});
|
|
49950
|
+
if (!input.invocation && !input.step) {
|
|
49951
|
+
throw new Error("A sequential checkpoint append requires an invocation or step.");
|
|
49952
|
+
}
|
|
49953
|
+
const invocations = input.invocation ? [
|
|
49954
|
+
...current.invocations.filter((item) => item.id !== input.invocation.id),
|
|
49955
|
+
input.invocation
|
|
49956
|
+
] : current.invocations;
|
|
49957
|
+
const steps = input.step ? [
|
|
49958
|
+
...current.steps.filter((item) => item.taskId !== input.step.taskId),
|
|
49959
|
+
input.step
|
|
49960
|
+
].sort((left, right) => left.ordinal - right.ordinal) : current.steps;
|
|
49961
|
+
return writeSequentialAdaptationCheckpoint({
|
|
49962
|
+
storeDir: input.storeDir,
|
|
49963
|
+
checkpoint: checkpoint({
|
|
49964
|
+
modelRunId: current.modelRunId,
|
|
49965
|
+
initialHarness: current.initialHarness,
|
|
49966
|
+
steps,
|
|
49967
|
+
invocations,
|
|
49968
|
+
updatedAt: input.now
|
|
49969
|
+
})
|
|
49970
|
+
});
|
|
49971
|
+
}
|
|
49972
|
+
function checkpoint(input) {
|
|
49973
|
+
const core = {
|
|
49974
|
+
schemaVersion: "openpond.sequentialAdaptationCheckpoint.v1",
|
|
49975
|
+
...input
|
|
49976
|
+
};
|
|
49977
|
+
return { ...core, contentHash: contentHash(core) };
|
|
49978
|
+
}
|
|
49979
|
+
async function writeSequentialAdaptationCheckpoint(input) {
|
|
49980
|
+
const filePath = checkpointPath(input.storeDir, input.checkpoint.modelRunId);
|
|
49981
|
+
const directory = path57.dirname(filePath);
|
|
49982
|
+
await fs24.mkdir(directory, { recursive: true });
|
|
49983
|
+
const temporaryPath = `${filePath}.${process.pid}.tmp`;
|
|
49984
|
+
await fs24.writeFile(
|
|
49985
|
+
temporaryPath,
|
|
49986
|
+
`${JSON.stringify(input.checkpoint, null, 2)}
|
|
49987
|
+
`,
|
|
49988
|
+
"utf8"
|
|
49989
|
+
);
|
|
49990
|
+
await fs24.rename(temporaryPath, filePath);
|
|
49991
|
+
return input.checkpoint;
|
|
49992
|
+
}
|
|
49993
|
+
function parseCheckpoint(value, modelRunId) {
|
|
49994
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
49995
|
+
throw new Error("Sequential adaptation checkpoint is malformed.");
|
|
49996
|
+
}
|
|
49997
|
+
const record11 = value;
|
|
49998
|
+
if (record11.schemaVersion !== "openpond.sequentialAdaptationCheckpoint.v1" || record11.modelRunId !== modelRunId || !record11.initialHarness || !Array.isArray(record11.steps) || !Array.isArray(record11.invocations) || typeof record11.updatedAt !== "string" || typeof record11.contentHash !== "string") {
|
|
49999
|
+
throw new Error("Sequential adaptation checkpoint is malformed.");
|
|
50000
|
+
}
|
|
50001
|
+
const { contentHash: admittedHash, ...core } = record11;
|
|
50002
|
+
if (contentHash(core) !== admittedHash) {
|
|
50003
|
+
throw new Error("Sequential adaptation checkpoint failed content-hash validation.");
|
|
50004
|
+
}
|
|
50005
|
+
const parsed = record11;
|
|
50006
|
+
for (const invocation of parsed.invocations) {
|
|
50007
|
+
const { contentHash: invocationHash, ...invocationCore } = invocation;
|
|
50008
|
+
if (contentHash(invocationCore) !== invocationHash) {
|
|
50009
|
+
throw new Error(`Refiner invocation ${invocation.id} failed content-hash validation.`);
|
|
50010
|
+
}
|
|
50011
|
+
}
|
|
50012
|
+
return parsed;
|
|
50013
|
+
}
|
|
50014
|
+
function checkpointPath(storeDir, modelRunId) {
|
|
50015
|
+
return path57.join(
|
|
50016
|
+
storeDir,
|
|
50017
|
+
"training",
|
|
50018
|
+
"harness-refiner-benchmarks",
|
|
50019
|
+
modelRunId,
|
|
50020
|
+
"sequential-adaptation.json"
|
|
50021
|
+
);
|
|
50022
|
+
}
|
|
50023
|
+
function sameRef(left, right) {
|
|
50024
|
+
return left.id === right.id && left.contentHash === right.contentHash;
|
|
49469
50025
|
}
|
|
49470
50026
|
|
|
49471
50027
|
// ../server/src/training/harness-refiner-benchmark-sequential-stage.ts
|
|
@@ -49473,58 +50029,143 @@ async function runSequentialHarnessAdaptation(input) {
|
|
|
49473
50029
|
const runRefinerAfterAttempt = input.adapters?.runRefinerAfterAttempt ?? runBenchmarkRefinerAfterAttempt;
|
|
49474
50030
|
const loadRuntimeFromRelease = input.adapters?.loadRuntimeFromRelease ?? loadLocalHarnessRuntimeFromRelease;
|
|
49475
50031
|
const buildLineage = input.adapters?.buildLineage ?? benchmarkLineage;
|
|
50032
|
+
const loadAttemptEvidenceByIds = input.adapters?.loadAttemptEvidenceByIds ?? loadBenchmarkAttemptEvidenceByIds;
|
|
49476
50033
|
await input.store.setHarnessBackgroundReviewSettings({
|
|
49477
50034
|
workspaceId: input.initialRuntime.workspace.id,
|
|
49478
50035
|
enabled: true,
|
|
49479
50036
|
updatedAt: input.now()
|
|
49480
50037
|
});
|
|
49481
|
-
|
|
49482
|
-
|
|
50038
|
+
const initialHarness = {
|
|
50039
|
+
id: input.initialRuntime.release.harnessRelease.id,
|
|
50040
|
+
contentHash: input.initialRuntime.release.harnessRelease.contentHash
|
|
50041
|
+
};
|
|
50042
|
+
let checkpoint2 = await initializeSequentialAdaptationCheckpoint({
|
|
50043
|
+
storeDir: input.storeDir,
|
|
50044
|
+
modelRunId: input.modelRun.id,
|
|
50045
|
+
initialHarness,
|
|
50046
|
+
now: input.now()
|
|
50047
|
+
});
|
|
50048
|
+
assertCheckpointTaskOrder(checkpoint2.steps, input.taskIds);
|
|
50049
|
+
let runtime = await restoreCheckpointRuntime({
|
|
50050
|
+
store: input.store,
|
|
50051
|
+
initialRuntime: input.initialRuntime,
|
|
50052
|
+
steps: checkpoint2.steps,
|
|
50053
|
+
loadRuntimeFromRelease
|
|
50054
|
+
});
|
|
50055
|
+
const attempts = checkpoint2.steps.length ? await loadAttemptEvidenceByIds({
|
|
50056
|
+
store: input.store,
|
|
50057
|
+
tasksetId: input.taskset.id,
|
|
50058
|
+
attemptIds: checkpoint2.steps.map((step) => step.attemptId)
|
|
50059
|
+
}) : [];
|
|
50060
|
+
const attemptsById = new Map(attempts.map((attempt) => [attempt.attempt.id, attempt]));
|
|
49483
50061
|
const refinerResults = [];
|
|
49484
|
-
const steps = [];
|
|
50062
|
+
const steps = [...checkpoint2.steps];
|
|
49485
50063
|
try {
|
|
49486
50064
|
for (const [ordinal, taskId] of input.taskIds.entries()) {
|
|
50065
|
+
if (ordinal < steps.length) continue;
|
|
49487
50066
|
input.signal.throwIfAborted();
|
|
49488
50067
|
const before = {
|
|
49489
50068
|
id: runtime.release.harnessRelease.id,
|
|
49490
50069
|
contentHash: runtime.release.harnessRelease.contentHash
|
|
49491
50070
|
};
|
|
49492
|
-
const
|
|
49493
|
-
|
|
49494
|
-
|
|
49495
|
-
|
|
49496
|
-
|
|
49497
|
-
|
|
49498
|
-
|
|
49499
|
-
|
|
49500
|
-
|
|
49501
|
-
|
|
49502
|
-
|
|
49503
|
-
|
|
49504
|
-
|
|
49505
|
-
|
|
49506
|
-
|
|
49507
|
-
|
|
49508
|
-
|
|
49509
|
-
|
|
49510
|
-
|
|
49511
|
-
|
|
49512
|
-
}
|
|
49513
|
-
|
|
49514
|
-
|
|
49515
|
-
|
|
49516
|
-
|
|
49517
|
-
|
|
49518
|
-
|
|
49519
|
-
|
|
49520
|
-
|
|
49521
|
-
|
|
49522
|
-
|
|
49523
|
-
|
|
49524
|
-
|
|
49525
|
-
|
|
49526
|
-
|
|
49527
|
-
|
|
50071
|
+
const priorInvocations = checkpoint2.invocations.filter(
|
|
50072
|
+
(invocation2) => invocation2.taskId === taskId
|
|
50073
|
+
);
|
|
50074
|
+
const lastInvocation = priorInvocations.at(-1);
|
|
50075
|
+
if (lastInvocation?.status === "failed" && priorInvocations.length >= HARNESS_REFINER_BENCHMARK_MAX_INVOCATIONS_PER_TASK) {
|
|
50076
|
+
throw new Error(
|
|
50077
|
+
`Sequential Refiner exhausted ${HARNESS_REFINER_BENCHMARK_MAX_INVOCATIONS_PER_TASK} admitted invocations for ${taskId}.`
|
|
50078
|
+
);
|
|
50079
|
+
}
|
|
50080
|
+
let evidence = lastInvocation?.status === "failed" ? attemptsById.get(lastInvocation.attemptId) : void 0;
|
|
50081
|
+
if (!evidence && lastInvocation?.status === "failed") {
|
|
50082
|
+
[evidence] = await loadAttemptEvidenceByIds({
|
|
50083
|
+
store: input.store,
|
|
50084
|
+
tasksetId: input.taskset.id,
|
|
50085
|
+
attemptIds: [lastInvocation.attemptId]
|
|
50086
|
+
});
|
|
50087
|
+
if (evidence) {
|
|
50088
|
+
attempts.push(evidence);
|
|
50089
|
+
attemptsById.set(evidence.attempt.id, evidence);
|
|
50090
|
+
}
|
|
50091
|
+
}
|
|
50092
|
+
if (!evidence) {
|
|
50093
|
+
const executed = await input.evaluation.execute({
|
|
50094
|
+
tasksetId: input.taskset.id,
|
|
50095
|
+
taskId,
|
|
50096
|
+
model: input.model,
|
|
50097
|
+
reasoningEffort: input.reasoningEffort,
|
|
50098
|
+
seed: input.seed,
|
|
50099
|
+
attempt: 0,
|
|
50100
|
+
sampling: { maxOutputTokens: 4096, temperature: 0, topP: 1 },
|
|
50101
|
+
releasedHarness: releasedHarness(runtime.release, runtime.instructionContext),
|
|
50102
|
+
hostedTokenPricing: input.admittedPricing,
|
|
50103
|
+
parentModelRunId: input.modelRun.id,
|
|
50104
|
+
signal: input.signal,
|
|
50105
|
+
toolEvidence: frozenToolEvidence(input.evidenceSnapshot, "replay", "adaptation")
|
|
50106
|
+
});
|
|
50107
|
+
await input.onAttemptComplete(executed);
|
|
50108
|
+
evidence = {
|
|
50109
|
+
attempt: executed.attempt,
|
|
50110
|
+
grade: executed.grade,
|
|
50111
|
+
artifacts: executed.artifacts,
|
|
50112
|
+
receiptContentHash: executed.portable.receipt.contentHash,
|
|
50113
|
+
artifactManifest: executed.portable.artifactManifest,
|
|
50114
|
+
rewardReceipt: executed.portable.rewardReceipt
|
|
50115
|
+
};
|
|
50116
|
+
attempts.push(evidence);
|
|
50117
|
+
attemptsById.set(evidence.attempt.id, evidence);
|
|
50118
|
+
}
|
|
50119
|
+
let refined;
|
|
50120
|
+
try {
|
|
50121
|
+
refined = await runRefinerAfterAttempt({
|
|
50122
|
+
store: input.store,
|
|
50123
|
+
storeDir: input.storeDir,
|
|
50124
|
+
modelRun: input.modelRun,
|
|
50125
|
+
model: input.model,
|
|
50126
|
+
taskset: input.taskset,
|
|
50127
|
+
runtime,
|
|
50128
|
+
result: evidence,
|
|
50129
|
+
budget: input.budget,
|
|
50130
|
+
admittedPricing: input.admittedPricing,
|
|
50131
|
+
refinerStream: input.refinerStream,
|
|
50132
|
+
signal: input.signal,
|
|
50133
|
+
now: input.now
|
|
50134
|
+
});
|
|
50135
|
+
} catch (error) {
|
|
50136
|
+
if (error instanceof BenchmarkRefinerInvocationError) {
|
|
50137
|
+
checkpoint2 = await appendSequentialAdaptationInvocation({
|
|
50138
|
+
storeDir: input.storeDir,
|
|
50139
|
+
modelRunId: input.modelRun.id,
|
|
50140
|
+
initialHarness,
|
|
50141
|
+
invocation: createBenchmarkRefinerInvocationReceipt({
|
|
50142
|
+
taskId,
|
|
50143
|
+
attemptId: evidence.attempt.id,
|
|
50144
|
+
invocationOrdinal: priorInvocations.length,
|
|
50145
|
+
trigger: {
|
|
50146
|
+
id: error.details.trigger.id,
|
|
50147
|
+
contentHash: error.details.trigger.contentHash
|
|
50148
|
+
},
|
|
50149
|
+
status: "failed",
|
|
50150
|
+
outcome: null,
|
|
50151
|
+
failure: {
|
|
50152
|
+
kind: error.details.failureKind,
|
|
50153
|
+
message: error.message.slice(0, 2e3),
|
|
50154
|
+
retryable: error.details.retryable
|
|
50155
|
+
},
|
|
50156
|
+
inputHarness: before,
|
|
50157
|
+
outputHarness: before,
|
|
50158
|
+
usage: error.details.usage,
|
|
50159
|
+
costBasis: error.details.costBasis,
|
|
50160
|
+
estimatedCostUsd: error.details.estimatedCostUsd,
|
|
50161
|
+
startedAt: error.details.startedAt,
|
|
50162
|
+
completedAt: error.details.completedAt
|
|
50163
|
+
}),
|
|
50164
|
+
now: error.details.completedAt
|
|
50165
|
+
});
|
|
50166
|
+
}
|
|
50167
|
+
throw error;
|
|
50168
|
+
}
|
|
49528
50169
|
if (refined.result) refinerResults.push(refined.result);
|
|
49529
50170
|
const workspace = await input.store.getHarnessWorkspace(runtime.workspace.id);
|
|
49530
50171
|
const releaseRef = workspace?.currentChannel.release;
|
|
@@ -49538,7 +50179,7 @@ async function runSequentialHarnessAdaptation(input) {
|
|
|
49538
50179
|
id: runtime.release.harnessRelease.id,
|
|
49539
50180
|
contentHash: runtime.release.harnessRelease.contentHash
|
|
49540
50181
|
};
|
|
49541
|
-
|
|
50182
|
+
const step = {
|
|
49542
50183
|
ordinal,
|
|
49543
50184
|
taskId,
|
|
49544
50185
|
attemptId: evidence.attempt.id,
|
|
@@ -49555,6 +50196,38 @@ async function runSequentialHarnessAdaptation(input) {
|
|
|
49555
50196
|
decision: refined.result.outcome.decision
|
|
49556
50197
|
} : null,
|
|
49557
50198
|
changed: before.contentHash !== after.contentHash
|
|
50199
|
+
};
|
|
50200
|
+
steps.push(step);
|
|
50201
|
+
const invocation = refined.result && refined.invocation ? createBenchmarkRefinerInvocationReceipt({
|
|
50202
|
+
taskId,
|
|
50203
|
+
attemptId: evidence.attempt.id,
|
|
50204
|
+
invocationOrdinal: priorInvocations.length,
|
|
50205
|
+
trigger: {
|
|
50206
|
+
id: refined.detection.trigger.id,
|
|
50207
|
+
contentHash: refined.detection.trigger.contentHash
|
|
50208
|
+
},
|
|
50209
|
+
status: "completed",
|
|
50210
|
+
outcome: {
|
|
50211
|
+
id: refined.result.outcome.id,
|
|
50212
|
+
contentHash: refined.result.outcome.contentHash,
|
|
50213
|
+
decision: refined.result.outcome.decision
|
|
50214
|
+
},
|
|
50215
|
+
failure: null,
|
|
50216
|
+
inputHarness: before,
|
|
50217
|
+
outputHarness: after,
|
|
50218
|
+
usage: refined.invocation.usage,
|
|
50219
|
+
costBasis: refined.invocation.costBasis,
|
|
50220
|
+
estimatedCostUsd: refined.invocation.estimatedCostUsd,
|
|
50221
|
+
startedAt: refined.invocation.startedAt,
|
|
50222
|
+
completedAt: refined.invocation.completedAt
|
|
50223
|
+
}) : void 0;
|
|
50224
|
+
checkpoint2 = await appendSequentialAdaptationInvocation({
|
|
50225
|
+
storeDir: input.storeDir,
|
|
50226
|
+
modelRunId: input.modelRun.id,
|
|
50227
|
+
initialHarness,
|
|
50228
|
+
invocation,
|
|
50229
|
+
step,
|
|
50230
|
+
now: input.now()
|
|
49558
50231
|
});
|
|
49559
50232
|
}
|
|
49560
50233
|
} finally {
|
|
@@ -49593,10 +50266,6 @@ async function runSequentialHarnessAdaptation(input) {
|
|
|
49593
50266
|
const costs = attempts.flatMap(
|
|
49594
50267
|
(evidence) => typeof evidence.attempt.costUsd === "number" ? [evidence.attempt.costUsd] : []
|
|
49595
50268
|
);
|
|
49596
|
-
const initialHarness = {
|
|
49597
|
-
id: input.initialRuntime.release.harnessRelease.id,
|
|
49598
|
-
contentHash: input.initialRuntime.release.harnessRelease.contentHash
|
|
49599
|
-
};
|
|
49600
50269
|
const finalHarness = {
|
|
49601
50270
|
id: runtime.release.harnessRelease.id,
|
|
49602
50271
|
contentHash: runtime.release.harnessRelease.contentHash
|
|
@@ -49633,7 +50302,7 @@ async function runSequentialHarnessAdaptation(input) {
|
|
|
49633
50302
|
store: input.store,
|
|
49634
50303
|
workspaceId: input.initialRuntime.workspace.id,
|
|
49635
50304
|
adaptationAttempts: attempts,
|
|
49636
|
-
|
|
50305
|
+
completedSteps: steps,
|
|
49637
50306
|
candidateRelease: finalHarness,
|
|
49638
50307
|
refinerInputHash: contentHash(attempts.map((evidence) => ({
|
|
49639
50308
|
attempt: evidence.attempt.id,
|
|
@@ -49650,6 +50319,26 @@ async function runSequentialHarnessAdaptation(input) {
|
|
|
49650
50319
|
refinerResults
|
|
49651
50320
|
};
|
|
49652
50321
|
}
|
|
50322
|
+
function assertCheckpointTaskOrder(steps, taskIds) {
|
|
50323
|
+
for (const [index, step] of steps.entries()) {
|
|
50324
|
+
if (step.ordinal !== index || step.taskId !== taskIds[index]) {
|
|
50325
|
+
throw new Error("Sequential adaptation checkpoint drifted from the admitted task order.");
|
|
50326
|
+
}
|
|
50327
|
+
}
|
|
50328
|
+
}
|
|
50329
|
+
async function restoreCheckpointRuntime(input) {
|
|
50330
|
+
const last = input.steps.at(-1);
|
|
50331
|
+
if (!last) return input.initialRuntime;
|
|
50332
|
+
const workspace = await input.store.getHarnessWorkspace(input.initialRuntime.workspace.id);
|
|
50333
|
+
if (!workspace?.currentChannel.release || workspace.currentChannel.release.id !== last.outputHarness.id || workspace.currentChannel.release.contentHash !== last.outputHarness.contentHash) {
|
|
50334
|
+
throw new Error("Sequential adaptation workspace drifted from its durable checkpoint.");
|
|
50335
|
+
}
|
|
50336
|
+
const release = await input.store.getHarnessReleaseRecord(last.outputHarness.contentHash);
|
|
50337
|
+
if (!release || release.harnessRelease.id !== last.outputHarness.id) {
|
|
50338
|
+
throw new Error("Sequential adaptation checkpoint release is unavailable.");
|
|
50339
|
+
}
|
|
50340
|
+
return input.loadRuntimeFromRelease({ workspace, release });
|
|
50341
|
+
}
|
|
49653
50342
|
function numericToken(record11, keys) {
|
|
49654
50343
|
for (const key of keys) {
|
|
49655
50344
|
const value = record11[key];
|
|
@@ -49680,7 +50369,7 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
49680
50369
|
});
|
|
49681
50370
|
if (!taskset.benchmark) throw new Error("Harness Refiner Taskset is unavailable.");
|
|
49682
50371
|
if (taskset.graders.some(
|
|
49683
|
-
(grader) => grader.kind === "model_judge" && grader.calibrationStatus !== "passed"
|
|
50372
|
+
(grader) => grader.kind === "model_judge" && grader.rewardEligible && grader.calibrationStatus !== "passed"
|
|
49684
50373
|
)) {
|
|
49685
50374
|
const calibration = await deps.evaluation.calibrateModelJudges(taskset.id);
|
|
49686
50375
|
if (!calibration.passed) {
|
|
@@ -49755,7 +50444,7 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
49755
50444
|
attemptPlan: executionPlan
|
|
49756
50445
|
},
|
|
49757
50446
|
evaluationProgress: {
|
|
49758
|
-
stage: "
|
|
50447
|
+
stage: "adaptation",
|
|
49759
50448
|
completedAttempts: 0,
|
|
49760
50449
|
totalAttempts: totalPlannedAttempts(executionPlan),
|
|
49761
50450
|
accounting: emptyEvaluationAccounting()
|
|
@@ -49802,13 +50491,23 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
49802
50491
|
}
|
|
49803
50492
|
if (activeRuns.has(modelRunId) || run.status === "running") return run;
|
|
49804
50493
|
const canResumeFromRefiner = run.evaluationProgress?.stage === "refiner" && run.evaluationProgress?.completedAttempts === completedBeforeStage(run.evaluation.attemptPlan, "candidate_adaptation");
|
|
50494
|
+
const candidateAdaptationStart = completedBeforeStage(
|
|
50495
|
+
run.evaluation.attemptPlan,
|
|
50496
|
+
"candidate_adaptation"
|
|
50497
|
+
);
|
|
50498
|
+
const candidateAdaptationEnd = candidateAdaptationStart + requirePlanStage(run.evaluation.attemptPlan, "candidate_adaptation").attemptCount;
|
|
50499
|
+
const sequentialCheckpoint = await loadSequentialAdaptationCheckpoint({
|
|
50500
|
+
storeDir: deps.storeDir,
|
|
50501
|
+
modelRunId: run.id
|
|
50502
|
+
});
|
|
50503
|
+
const canResumeFromCandidateAdaptation = run.evaluationProgress?.stage === "candidate_adaptation" && run.evaluationProgress.completedAttempts >= candidateAdaptationStart && run.evaluationProgress.completedAttempts <= candidateAdaptationEnd && Boolean(sequentialCheckpoint);
|
|
49805
50504
|
const hasCompletedComparisonCheckpoint = ["candidate_adaptation", "candidate", "comparison"].includes(
|
|
49806
50505
|
run.evaluationProgress?.stage ?? ""
|
|
49807
50506
|
) && run.evaluationProgress?.completedAttempts === totalPlannedAttempts(run.evaluation.attemptPlan);
|
|
49808
50507
|
const canResumeFromComparison = hasCompletedComparisonCheckpoint && Boolean(await loadLatestManagedResult(deps.storeDir, run.id));
|
|
49809
|
-
if (!["failed", "cancelled"].includes(run.status) || !canResumeFromRefiner && !canResumeFromComparison) {
|
|
50508
|
+
if (!["failed", "cancelled"].includes(run.status) || !canResumeFromRefiner && !canResumeFromCandidateAdaptation && !canResumeFromComparison) {
|
|
49810
50509
|
throw new Error(
|
|
49811
|
-
"Only a Harness Refiner run with a durable Refiner or comparison checkpoint can resume."
|
|
50510
|
+
"Only a Harness Refiner run with a durable Refiner, sequential adaptation, or comparison checkpoint can resume."
|
|
49812
50511
|
);
|
|
49813
50512
|
}
|
|
49814
50513
|
const project = await requireModelProject(deps.store, run.modelId, run.profileId);
|
|
@@ -49899,12 +50598,22 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
49899
50598
|
);
|
|
49900
50599
|
const candidatePlan = requirePlanStage(executionPlan, "candidate");
|
|
49901
50600
|
const resumeFromRefiner = modelRun.evaluationProgress?.stage === "refiner" && modelRun.evaluationProgress.completedAttempts === completedBeforeStage(executionPlan, "candidate_adaptation");
|
|
50601
|
+
const candidateAdaptationStart = completedBeforeStage(
|
|
50602
|
+
executionPlan,
|
|
50603
|
+
"candidate_adaptation"
|
|
50604
|
+
);
|
|
50605
|
+
const candidateAdaptationEnd = candidateAdaptationStart + candidateAdaptationPlan.attemptCount;
|
|
50606
|
+
const sequentialCheckpoint = await loadSequentialAdaptationCheckpoint({
|
|
50607
|
+
storeDir: deps.storeDir,
|
|
50608
|
+
modelRunId: modelRun.id
|
|
50609
|
+
});
|
|
50610
|
+
const resumeFromCandidateAdaptation = modelRun.evaluationProgress?.stage === "candidate_adaptation" && modelRun.evaluationProgress.completedAttempts >= candidateAdaptationStart && modelRun.evaluationProgress.completedAttempts <= candidateAdaptationEnd && Boolean(sequentialCheckpoint);
|
|
49902
50611
|
const resumeFromComparison = ["candidate_adaptation", "candidate", "comparison"].includes(
|
|
49903
50612
|
modelRun.evaluationProgress?.stage ?? ""
|
|
49904
50613
|
) && modelRun.evaluationProgress?.completedAttempts === totalAttempts;
|
|
49905
50614
|
const budget = new BenchmarkSpendBudget(
|
|
49906
50615
|
input.maximumSpendUsd,
|
|
49907
|
-
resumeFromRefiner || resumeFromComparison ? modelRun.evaluationProgress?.accounting?.observedSpendUsd ?? 0 : 0
|
|
50616
|
+
resumeFromRefiner || resumeFromCandidateAdaptation || resumeFromComparison ? modelRun.evaluationProgress?.accounting?.observedSpendUsd ?? 0 : 0
|
|
49908
50617
|
);
|
|
49909
50618
|
if (resumeFromComparison) {
|
|
49910
50619
|
return resumeHarnessRefinerComparison({
|
|
@@ -49931,7 +50640,7 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
49931
50640
|
}
|
|
49932
50641
|
let evidenceSnapshot = new BenchmarkEvidenceSnapshot();
|
|
49933
50642
|
const observeStageAttempts = (stage, label) => {
|
|
49934
|
-
let completedInStage = 0;
|
|
50643
|
+
let completedInStage = modelRun.evaluationProgress?.accounting?.attempts.filter((attempt) => attempt.phase === stage).length ?? 0;
|
|
49935
50644
|
return async (result) => {
|
|
49936
50645
|
context.signal.throwIfAborted();
|
|
49937
50646
|
budget.assertAvailable(label);
|
|
@@ -49960,7 +50669,7 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
49960
50669
|
let baseline;
|
|
49961
50670
|
let adaptation;
|
|
49962
50671
|
let adaptationAttempts;
|
|
49963
|
-
if (resumeFromRefiner) {
|
|
50672
|
+
if (resumeFromRefiner || resumeFromCandidateAdaptation) {
|
|
49964
50673
|
baseline = await loadCompletedBenchmarkStage({
|
|
49965
50674
|
store: deps.store,
|
|
49966
50675
|
modelRunId: modelRun.id,
|
|
@@ -49984,33 +50693,34 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
49984
50693
|
]
|
|
49985
50694
|
});
|
|
49986
50695
|
} else {
|
|
49987
|
-
const
|
|
50696
|
+
const executedAdaptation = await deps.evaluation.executeBenchmark({
|
|
49988
50697
|
tasksetId: taskset.id,
|
|
49989
50698
|
phase: "baseline",
|
|
49990
50699
|
model: input.model,
|
|
49991
50700
|
reasoningEffort: input.reasoningEffort,
|
|
49992
50701
|
seeds: input.seeds,
|
|
49993
50702
|
repetitions: input.repetitions,
|
|
49994
|
-
split:
|
|
49995
|
-
taskIds:
|
|
50703
|
+
split: adaptationPlan.split,
|
|
50704
|
+
taskIds: adaptationPlan.taskIds,
|
|
49996
50705
|
sampling: { maxOutputTokens: 4096, temperature: 0, topP: 1 },
|
|
49997
50706
|
releasedHarness: baselineHarness,
|
|
49998
50707
|
hostedTokenPricing: admittedPricing,
|
|
49999
50708
|
parentModelRunId: modelRun.id,
|
|
50000
50709
|
signal: context.signal,
|
|
50001
|
-
toolEvidence: frozenToolEvidence(evidenceSnapshot, "record", "
|
|
50002
|
-
onAttemptComplete: observeStageAttempts("
|
|
50710
|
+
toolEvidence: frozenToolEvidence(evidenceSnapshot, "record", "adaptation"),
|
|
50711
|
+
onAttemptComplete: observeStageAttempts("adaptation", "adaptation baseline")
|
|
50003
50712
|
});
|
|
50004
|
-
|
|
50713
|
+
adaptation = completedStage(executedAdaptation);
|
|
50714
|
+
adaptationAttempts = adaptation.attempts;
|
|
50005
50715
|
await ensureBaseVersion({
|
|
50006
50716
|
store: deps.store,
|
|
50007
50717
|
project: context.project,
|
|
50008
50718
|
modelRun,
|
|
50009
50719
|
model: input.model,
|
|
50010
|
-
baseline:
|
|
50720
|
+
baseline: executedAdaptation.attempts[0]
|
|
50011
50721
|
});
|
|
50012
|
-
if (
|
|
50013
|
-
throw new Error("
|
|
50722
|
+
if (adaptation.run.harnessRelease.id !== modelRun.harnessRelease.id || adaptation.run.harnessRelease.contentHash !== modelRun.harnessRelease.contentHash) {
|
|
50723
|
+
throw new Error("Adaptation baseline drifted from the admitted Harness release.");
|
|
50014
50724
|
}
|
|
50015
50725
|
await checkpointEvidenceSnapshot(
|
|
50016
50726
|
deps.store,
|
|
@@ -50019,29 +50729,31 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
50019
50729
|
evidenceSnapshot.manifest()
|
|
50020
50730
|
);
|
|
50021
50731
|
await updateProgress(deps.store, modelRun.id, {
|
|
50022
|
-
stage: "
|
|
50023
|
-
completedAttempts: completedBeforeStage(executionPlan, "
|
|
50732
|
+
stage: "baseline",
|
|
50733
|
+
completedAttempts: completedBeforeStage(executionPlan, "baseline"),
|
|
50024
50734
|
totalAttempts
|
|
50025
50735
|
});
|
|
50026
|
-
const
|
|
50736
|
+
const executedBaseline = await deps.evaluation.executeBenchmark({
|
|
50027
50737
|
tasksetId: taskset.id,
|
|
50028
50738
|
phase: "baseline",
|
|
50029
50739
|
model: input.model,
|
|
50030
50740
|
reasoningEffort: input.reasoningEffort,
|
|
50031
50741
|
seeds: input.seeds,
|
|
50032
50742
|
repetitions: input.repetitions,
|
|
50033
|
-
split:
|
|
50034
|
-
taskIds:
|
|
50743
|
+
split: baselinePlan.split,
|
|
50744
|
+
taskIds: baselinePlan.taskIds,
|
|
50035
50745
|
sampling: { maxOutputTokens: 4096, temperature: 0, topP: 1 },
|
|
50036
50746
|
releasedHarness: baselineHarness,
|
|
50037
50747
|
hostedTokenPricing: admittedPricing,
|
|
50038
50748
|
parentModelRunId: modelRun.id,
|
|
50039
50749
|
signal: context.signal,
|
|
50040
|
-
toolEvidence: frozenToolEvidence(evidenceSnapshot, "record", "
|
|
50041
|
-
onAttemptComplete: observeStageAttempts("
|
|
50750
|
+
toolEvidence: frozenToolEvidence(evidenceSnapshot, "record", "held_out"),
|
|
50751
|
+
onAttemptComplete: observeStageAttempts("baseline", "held-out baseline")
|
|
50042
50752
|
});
|
|
50043
|
-
|
|
50044
|
-
|
|
50753
|
+
baseline = completedStage(executedBaseline);
|
|
50754
|
+
if (baseline.run.harnessRelease.id !== modelRun.harnessRelease.id || baseline.run.harnessRelease.contentHash !== modelRun.harnessRelease.contentHash) {
|
|
50755
|
+
throw new Error("Held-out baseline drifted from the admitted Harness release.");
|
|
50756
|
+
}
|
|
50045
50757
|
await checkpointEvidenceSnapshot(
|
|
50046
50758
|
deps.store,
|
|
50047
50759
|
deps.storeDir,
|
|
@@ -50054,16 +50766,18 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
50054
50766
|
totalAttempts
|
|
50055
50767
|
});
|
|
50056
50768
|
}
|
|
50057
|
-
if (resumeFromRefiner && !modelRun.evaluationProgress?.evidenceSnapshot) {
|
|
50769
|
+
if ((resumeFromRefiner || resumeFromCandidateAdaptation) && !modelRun.evaluationProgress?.evidenceSnapshot) {
|
|
50058
50770
|
throw new Error(
|
|
50059
50771
|
"Sequential adaptation cannot resume because the interrupted run did not preserve its exact frozen evidence snapshot. Start a new run to preserve a valid causal comparison."
|
|
50060
50772
|
);
|
|
50061
50773
|
}
|
|
50062
|
-
|
|
50063
|
-
|
|
50064
|
-
|
|
50065
|
-
|
|
50066
|
-
|
|
50774
|
+
if (!resumeFromCandidateAdaptation) {
|
|
50775
|
+
await updateProgress(deps.store, modelRun.id, {
|
|
50776
|
+
stage: "candidate_adaptation",
|
|
50777
|
+
completedAttempts: candidateAdaptationStart,
|
|
50778
|
+
totalAttempts
|
|
50779
|
+
});
|
|
50780
|
+
}
|
|
50067
50781
|
const candidateAdaptation = await runSequentialHarnessAdaptation({
|
|
50068
50782
|
store: deps.store,
|
|
50069
50783
|
storeDir: deps.storeDir,
|
|
@@ -50295,13 +51009,13 @@ function createHarnessRefinerBenchmarkService(deps) {
|
|
|
50295
51009
|
}
|
|
50296
51010
|
|
|
50297
51011
|
// ../server/src/training/task-attempt-grader-evidence.ts
|
|
50298
|
-
import { execFile as
|
|
51012
|
+
import { execFile as execFile8 } from "node:child_process";
|
|
50299
51013
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
50300
51014
|
import { promisify as promisify5 } from "node:util";
|
|
50301
51015
|
var MAX_ARTIFACTS = 5;
|
|
50302
51016
|
var MAX_ARTIFACT_BYTES = 20 * 1024 * 1024;
|
|
50303
51017
|
var MAX_EXTRACTED_CHARS = 4e4;
|
|
50304
|
-
var execFileAsync5 = promisify5(
|
|
51018
|
+
var execFileAsync5 = promisify5(execFile8);
|
|
50305
51019
|
function createTaskAttemptModelJudge(input) {
|
|
50306
51020
|
return async ({ grader, task, attempt }) => {
|
|
50307
51021
|
const usages = [];
|
|
@@ -50377,6 +51091,18 @@ async function loadTaskAttemptGraderEvidence(input) {
|
|
|
50377
51091
|
content: boundedText(stdout)
|
|
50378
51092
|
};
|
|
50379
51093
|
}
|
|
51094
|
+
if (isOpenXmlArtifact(artifact.mediaType)) {
|
|
51095
|
+
const extracted = await extractOpenXmlArtifact(
|
|
51096
|
+
artifact.path,
|
|
51097
|
+
artifact.mediaType
|
|
51098
|
+
);
|
|
51099
|
+
return {
|
|
51100
|
+
...base,
|
|
51101
|
+
extraction: "open_xml_text",
|
|
51102
|
+
content: boundedText(extracted.content),
|
|
51103
|
+
structure: extracted.structure
|
|
51104
|
+
};
|
|
51105
|
+
}
|
|
50380
51106
|
if (isTextArtifact(artifact.mediaType)) {
|
|
50381
51107
|
return {
|
|
50382
51108
|
...base,
|
|
@@ -50396,8 +51122,73 @@ async function loadTaskAttemptGraderEvidence(input) {
|
|
|
50396
51122
|
}
|
|
50397
51123
|
function isTextArtifact(mediaType) {
|
|
50398
51124
|
return Boolean(
|
|
50399
|
-
mediaType?.startsWith("text/") || mediaType === "application/json" || mediaType === "application/xml"
|
|
51125
|
+
mediaType?.startsWith("text/") || mediaType === "application/json" || mediaType === "application/javascript" || mediaType === "application/sql" || mediaType === "application/xml" || mediaType === "application/yaml"
|
|
51126
|
+
);
|
|
51127
|
+
}
|
|
51128
|
+
function isOpenXmlArtifact(mediaType) {
|
|
51129
|
+
return mediaType === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || mediaType === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || mediaType === "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
51130
|
+
}
|
|
51131
|
+
async function extractOpenXmlArtifact(artifactPath2, mediaType) {
|
|
51132
|
+
const options = {
|
|
51133
|
+
env: { ...process.env, PATH: executableSearchPath() },
|
|
51134
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
51135
|
+
timeout: 15e3
|
|
51136
|
+
};
|
|
51137
|
+
const { stdout: listing } = await execFileAsync5(
|
|
51138
|
+
"unzip",
|
|
51139
|
+
["-Z1", artifactPath2],
|
|
51140
|
+
options
|
|
50400
51141
|
);
|
|
51142
|
+
const entries = listing.split(/\r?\n/).filter(Boolean);
|
|
51143
|
+
const selected = openXmlTextEntries(entries, mediaType).slice(0, 250);
|
|
51144
|
+
const parts = [];
|
|
51145
|
+
for (const entry of selected) {
|
|
51146
|
+
const { stdout } = await execFileAsync5(
|
|
51147
|
+
"unzip",
|
|
51148
|
+
["-p", artifactPath2, entry],
|
|
51149
|
+
options
|
|
51150
|
+
);
|
|
51151
|
+
const text3 = readableXmlText(stdout);
|
|
51152
|
+
if (text3) parts.push(`[${entry}]
|
|
51153
|
+
${text3}`);
|
|
51154
|
+
}
|
|
51155
|
+
return {
|
|
51156
|
+
content: parts.join("\n\n"),
|
|
51157
|
+
structure: {
|
|
51158
|
+
archiveEntryCount: entries.length,
|
|
51159
|
+
extractedEntryCount: selected.length,
|
|
51160
|
+
sheetCount: entries.filter((entry) => /^xl\/worksheets\/sheet\d+\.xml$/.test(entry)).length,
|
|
51161
|
+
slideCount: entries.filter((entry) => /^ppt\/slides\/slide\d+\.xml$/.test(entry)).length,
|
|
51162
|
+
chartCount: entries.filter((entry) => /\/charts\/chart\d+\.xml$/.test(entry)).length,
|
|
51163
|
+
imageCount: entries.filter((entry) => /\/media\//.test(entry)).length
|
|
51164
|
+
}
|
|
51165
|
+
};
|
|
51166
|
+
}
|
|
51167
|
+
function openXmlTextEntries(entries, mediaType) {
|
|
51168
|
+
if (mediaType.includes("wordprocessingml")) {
|
|
51169
|
+
return entries.filter(
|
|
51170
|
+
(entry) => /^word\/(?:document|header\d+|footer\d+|footnotes|endnotes|comments)\.xml$/.test(entry)
|
|
51171
|
+
);
|
|
51172
|
+
}
|
|
51173
|
+
if (mediaType.includes("spreadsheetml")) {
|
|
51174
|
+
return entries.filter(
|
|
51175
|
+
(entry) => entry === "xl/workbook.xml" || entry === "xl/sharedStrings.xml" || /^xl\/worksheets\/sheet\d+\.xml$/.test(entry) || /^xl\/charts\/chart\d+\.xml$/.test(entry)
|
|
51176
|
+
);
|
|
51177
|
+
}
|
|
51178
|
+
return entries.filter(
|
|
51179
|
+
(entry) => /^ppt\/(?:slides\/slide\d+|notesSlides\/notesSlide\d+|charts\/chart\d+)\.xml$/.test(entry)
|
|
51180
|
+
).sort(naturalEntryOrder);
|
|
51181
|
+
}
|
|
51182
|
+
function naturalEntryOrder(left, right) {
|
|
51183
|
+
return left.localeCompare(right, void 0, { numeric: true });
|
|
51184
|
+
}
|
|
51185
|
+
function readableXmlText(value) {
|
|
51186
|
+
return decodeXmlEntities(
|
|
51187
|
+
value.replace(/<\/?(?:w:p|a:p|row|si|sheetData|c)(?:\s[^>]*)?>/g, "\n").replace(/<(?:w:tab|a:br)(?:\s[^>]*)?\/?\s*>/g, " ").replace(/<[^>]+>/g, " ")
|
|
51188
|
+
).split(/\r?\n/).map((line) => line.replace(/[\t ]+/g, " ").trim()).filter(Boolean).join("\n");
|
|
51189
|
+
}
|
|
51190
|
+
function decodeXmlEntities(value) {
|
|
51191
|
+
return value.replace(/&#x([0-9a-f]+);/gi, (_, hex) => String.fromCodePoint(Number.parseInt(hex, 16))).replace(/&#(\d+);/g, (_, decimal2) => String.fromCodePoint(Number.parseInt(decimal2, 10))).replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
50401
51192
|
}
|
|
50402
51193
|
function boundedText(value) {
|
|
50403
51194
|
return value.length <= MAX_EXTRACTED_CHARS ? value : `${value.slice(0, MAX_EXTRACTED_CHARS)}
|
|
@@ -50468,7 +51259,7 @@ function usageCost(usage, pricing) {
|
|
|
50468
51259
|
// ../server/src/training/benchmark-tasksets.ts
|
|
50469
51260
|
import { createHash as createHash15 } from "node:crypto";
|
|
50470
51261
|
import { mkdir as mkdir11, readFile as readFile16, writeFile as writeFile7 } from "node:fs/promises";
|
|
50471
|
-
import
|
|
51262
|
+
import path58 from "node:path";
|
|
50472
51263
|
var BUILTIN_DEFINITION_ID = "harness-refiner";
|
|
50473
51264
|
function createBenchmarkTasksetService(input) {
|
|
50474
51265
|
const now2 = input.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
@@ -50478,7 +51269,7 @@ function createBenchmarkTasksetService(input) {
|
|
|
50478
51269
|
if (existing?.benchmark?.releaseId === harnessRefinerBenchmarkRelease.id && existing.benchmark.releaseHash === harnessRefinerBenchmarkRelease.contentHash) {
|
|
50479
51270
|
return existing;
|
|
50480
51271
|
}
|
|
50481
|
-
const tasksetRoot =
|
|
51272
|
+
const tasksetRoot = path58.join(
|
|
50482
51273
|
input.storeDir,
|
|
50483
51274
|
"training",
|
|
50484
51275
|
"tasksets",
|
|
@@ -50498,7 +51289,7 @@ function createBenchmarkTasksetService(input) {
|
|
|
50498
51289
|
}
|
|
50499
51290
|
async function releaseForTaskset(taskset) {
|
|
50500
51291
|
if (taskset.purpose !== "benchmark" || !taskset.benchmark) return null;
|
|
50501
|
-
const releasePath =
|
|
51292
|
+
const releasePath = path58.resolve(
|
|
50502
51293
|
input.storeDir,
|
|
50503
51294
|
"training",
|
|
50504
51295
|
"tasksets",
|
|
@@ -50519,18 +51310,23 @@ function definitionForRelease(release) {
|
|
|
50519
51310
|
return createBenchmarkDefinition({
|
|
50520
51311
|
schemaVersion: "openpond.benchmarkDefinition.v1",
|
|
50521
51312
|
id: BUILTIN_DEFINITION_ID,
|
|
50522
|
-
title: "Harness Refiner
|
|
50523
|
-
description: "Measures whether sequential, evidence-driven Harness improvements
|
|
51313
|
+
title: "Harness Refiner 20260818 v2",
|
|
51314
|
+
description: "Measures whether sequential, evidence-driven Harness improvements change verified reward on a frozen cohort; foreground tokens are secondary.",
|
|
50524
51315
|
tasksetRelease: { id: release.id, contentHash: release.contentHash },
|
|
50525
51316
|
adaptationSplit: "validation",
|
|
50526
51317
|
evaluationSplit: "frozen_eval",
|
|
50527
|
-
primaryMetric: "
|
|
51318
|
+
primaryMetric: "success_rate",
|
|
50528
51319
|
qualityGate: "non_regression",
|
|
50529
51320
|
caseCounts: {
|
|
50530
51321
|
adaptation: release.tasks.filter((task) => task.split === "validation").length,
|
|
50531
51322
|
evaluation: release.tasks.filter((task) => task.split === "frozen_eval").length
|
|
50532
51323
|
},
|
|
50533
|
-
metadata: {
|
|
51324
|
+
metadata: {
|
|
51325
|
+
builtin: true,
|
|
51326
|
+
protocol: "sequential_product_lifecycle_v3",
|
|
51327
|
+
orderSeed: "harness-refiner-20260818-order-v1",
|
|
51328
|
+
secondaryMetrics: ["foreground_tokens"]
|
|
51329
|
+
}
|
|
50534
51330
|
});
|
|
50535
51331
|
}
|
|
50536
51332
|
async function projectRelease(input) {
|
|
@@ -50541,12 +51337,12 @@ async function projectRelease(input) {
|
|
|
50541
51337
|
input.release.tasks.flatMap((task) => task.artifactRefs)
|
|
50542
51338
|
);
|
|
50543
51339
|
const managedAssetById = /* @__PURE__ */ new Map();
|
|
50544
|
-
await mkdir11(
|
|
50545
|
-
await mkdir11(
|
|
50546
|
-
await mkdir11(
|
|
50547
|
-
await mkdir11(
|
|
51340
|
+
await mkdir11(path58.join(input.tasksetRoot, "assets"), { recursive: true });
|
|
51341
|
+
await mkdir11(path58.join(input.tasksetRoot, "benchmark"), { recursive: true });
|
|
51342
|
+
await mkdir11(path58.join(input.tasksetRoot, "rubrics"), { recursive: true });
|
|
51343
|
+
await mkdir11(path58.join(input.tasksetRoot, "verifiers"), { recursive: true });
|
|
50548
51344
|
await writeFile7(
|
|
50549
|
-
|
|
51345
|
+
path58.join(input.tasksetRoot, "benchmark", "taskset.release.json"),
|
|
50550
51346
|
JSON.stringify(input.release),
|
|
50551
51347
|
"utf8"
|
|
50552
51348
|
);
|
|
@@ -50555,9 +51351,9 @@ async function projectRelease(input) {
|
|
|
50555
51351
|
if (contentHash(contents) !== asset.contentHash) {
|
|
50556
51352
|
throw new Error(`Benchmark asset ${asset.path} failed its content hash.`);
|
|
50557
51353
|
}
|
|
50558
|
-
const fileName = `${asset.id}-${
|
|
50559
|
-
const artifactRef =
|
|
50560
|
-
await writeFile7(
|
|
51354
|
+
const fileName = `${asset.id}-${path58.basename(asset.path)}`;
|
|
51355
|
+
const artifactRef = path58.posix.join("assets", fileName);
|
|
51356
|
+
await writeFile7(path58.join(input.tasksetRoot, artifactRef), contents, "utf8");
|
|
50561
51357
|
managedAssetById.set(asset.id, {
|
|
50562
51358
|
artifactRef,
|
|
50563
51359
|
fileName,
|
|
@@ -50566,19 +51362,17 @@ async function projectRelease(input) {
|
|
|
50566
51362
|
mediaType: asset.mediaType
|
|
50567
51363
|
});
|
|
50568
51364
|
}
|
|
50569
|
-
const rubricGrader = input.release.graders.find(
|
|
50570
|
-
(grader) => grader.kind === "model_judge"
|
|
50571
|
-
);
|
|
50572
51365
|
const verifierGrader = input.release.graders.find(
|
|
50573
51366
|
(grader) => grader.kind === "custom_verifier"
|
|
50574
51367
|
);
|
|
50575
|
-
|
|
50576
|
-
|
|
51368
|
+
const supplementaryJudge = supplementaryModelJudge(input.release);
|
|
51369
|
+
if (!verifierGrader) {
|
|
51370
|
+
throw new Error("Benchmark release requires a custom verifier.");
|
|
50577
51371
|
}
|
|
50578
|
-
|
|
51372
|
+
await copyVerifierAsset(
|
|
50579
51373
|
input.assets,
|
|
50580
51374
|
input.tasksetRoot,
|
|
50581
|
-
|
|
51375
|
+
supplementaryJudge.rubricRef
|
|
50582
51376
|
);
|
|
50583
51377
|
await copyVerifierAsset(
|
|
50584
51378
|
input.assets,
|
|
@@ -50587,10 +51381,6 @@ async function projectRelease(input) {
|
|
|
50587
51381
|
);
|
|
50588
51382
|
const sourceId = `source-${input.tasksetId}`;
|
|
50589
51383
|
const tasks = input.release.tasks.map((task) => {
|
|
50590
|
-
const deliverable = stringValue11(task.expectedOutput?.deliverable);
|
|
50591
|
-
const validationKinds = Array.isArray(task.expectedOutput?.validation) ? task.expectedOutput.validation.filter(
|
|
50592
|
-
(value) => typeof value === "string"
|
|
50593
|
-
) : [];
|
|
50594
51384
|
return {
|
|
50595
51385
|
schemaVersion: "openpond.taskData.v1",
|
|
50596
51386
|
id: task.id,
|
|
@@ -50616,9 +51406,18 @@ async function projectRelease(input) {
|
|
|
50616
51406
|
metadata: { portableContentHash: asset.contentHash }
|
|
50617
51407
|
};
|
|
50618
51408
|
}),
|
|
50619
|
-
requiredOutputs:
|
|
51409
|
+
requiredOutputs: (task.requiredOutputs ?? []).map((output) => ({
|
|
51410
|
+
path: output.path,
|
|
51411
|
+
mediaType: output.mediaType,
|
|
51412
|
+
schemaRef: output.schemaRef?.id ?? null,
|
|
51413
|
+
maxBytes: output.maxBytes ?? void 0,
|
|
51414
|
+
metadata: output.metadata
|
|
51415
|
+
})),
|
|
50620
51416
|
tags: task.tags,
|
|
50621
|
-
metadata: {
|
|
51417
|
+
metadata: {
|
|
51418
|
+
portableTaskId: task.id,
|
|
51419
|
+
portableTaskRecord: task
|
|
51420
|
+
}
|
|
50622
51421
|
};
|
|
50623
51422
|
});
|
|
50624
51423
|
const sourceFileHashes = [...managedAssetById.values()].map((asset) => asset.sha256);
|
|
@@ -50636,29 +51435,9 @@ async function projectRelease(input) {
|
|
|
50636
51435
|
exportName: "verify",
|
|
50637
51436
|
timeoutMs: verifierGrader.timeoutMs,
|
|
50638
51437
|
networkPolicy: "none",
|
|
50639
|
-
metadata: { portableVerifierHash: verifierGrader.verifierRef.contentHash }
|
|
50640
|
-
},
|
|
50641
|
-
{
|
|
50642
|
-
id: rubricGrader.id,
|
|
50643
|
-
version: rubricGrader.version,
|
|
50644
|
-
label: "Task quality",
|
|
50645
|
-
kind: "model_judge",
|
|
50646
|
-
weight: rubricGrader.weight,
|
|
50647
|
-
hardGate: rubricGrader.hardGate,
|
|
50648
|
-
rewardEligible: false,
|
|
50649
|
-
privileged: rubricGrader.privileged,
|
|
50650
|
-
rubric,
|
|
50651
|
-
judge: { providerId: "openpond", modelId: "openpond-chat" },
|
|
50652
|
-
calibrationFixtureRefs: [
|
|
50653
|
-
"benchmark-positive",
|
|
50654
|
-
"benchmark-negative",
|
|
50655
|
-
"benchmark-boundary"
|
|
50656
|
-
],
|
|
50657
|
-
calibrationStatus: "pending",
|
|
50658
|
-
temperature: 0,
|
|
50659
51438
|
metadata: {
|
|
50660
|
-
|
|
50661
|
-
|
|
51439
|
+
portableVerifierHash: verifierGrader.verifierRef.contentHash,
|
|
51440
|
+
portableVerifierRef: verifierGrader.verifierRef
|
|
50662
51441
|
}
|
|
50663
51442
|
}
|
|
50664
51443
|
];
|
|
@@ -50719,6 +51498,7 @@ async function projectRelease(input) {
|
|
|
50719
51498
|
networkPolicy: input.release.environment.networkPolicy,
|
|
50720
51499
|
metadata: {
|
|
50721
51500
|
portableEnvironmentHash: contentHash(input.release.environment),
|
|
51501
|
+
portableTools: input.release.tools,
|
|
50722
51502
|
maxToolTurns: 40
|
|
50723
51503
|
}
|
|
50724
51504
|
},
|
|
@@ -50727,7 +51507,7 @@ async function projectRelease(input) {
|
|
|
50727
51507
|
taskKind: "single_agent",
|
|
50728
51508
|
supportedSignals: [],
|
|
50729
51509
|
compatibleMethods: ["none"],
|
|
50730
|
-
rewardKinds: ["deterministic"
|
|
51510
|
+
rewardKinds: ["deterministic"],
|
|
50731
51511
|
requiresTools: true,
|
|
50732
51512
|
requiresState: true,
|
|
50733
51513
|
requiresPrivilegedGrading: true,
|
|
@@ -50768,7 +51548,16 @@ async function projectRelease(input) {
|
|
|
50768
51548
|
portableTasksetRelease: {
|
|
50769
51549
|
id: input.release.id,
|
|
50770
51550
|
contentHash: input.release.contentHash
|
|
50771
|
-
}
|
|
51551
|
+
},
|
|
51552
|
+
supplementaryModelJudge: {
|
|
51553
|
+
id: supplementaryJudge.id,
|
|
51554
|
+
version: supplementaryJudge.version,
|
|
51555
|
+
rubricHash: supplementaryJudge.rubricRef.contentHash,
|
|
51556
|
+
calibrationStatus: supplementaryJudge.calibrationStatus,
|
|
51557
|
+
executable: false,
|
|
51558
|
+
rewardEligible: false
|
|
51559
|
+
},
|
|
51560
|
+
portableCapabilities: input.release.capabilities
|
|
50772
51561
|
}
|
|
50773
51562
|
});
|
|
50774
51563
|
return TasksetSchema.parse({
|
|
@@ -50784,7 +51573,7 @@ async function copyVerifierAsset(assets, tasksetRoot, asset) {
|
|
|
50784
51573
|
if (contentHash(contents) !== asset.contentHash) {
|
|
50785
51574
|
throw new Error(`Benchmark verifier asset ${asset.path} failed its content hash.`);
|
|
50786
51575
|
}
|
|
50787
|
-
await writeFile7(
|
|
51576
|
+
await writeFile7(path58.join(tasksetRoot, asset.path), contents, "utf8");
|
|
50788
51577
|
return contents;
|
|
50789
51578
|
}
|
|
50790
51579
|
function builtinAsset(assets, assetPath) {
|
|
@@ -50794,19 +51583,6 @@ function builtinAsset(assets, assetPath) {
|
|
|
50794
51583
|
}
|
|
50795
51584
|
return contents;
|
|
50796
51585
|
}
|
|
50797
|
-
function requiredOutputs(taskId, deliverable, validationKinds) {
|
|
50798
|
-
const output = deliverable === "pdf" ? { extension: "pdf", mediaType: "application/pdf" } : deliverable === "spreadsheet" ? {
|
|
50799
|
-
extension: "xlsx",
|
|
50800
|
-
mediaType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
50801
|
-
} : null;
|
|
50802
|
-
if (!output) return [];
|
|
50803
|
-
return [{
|
|
50804
|
-
path: `${taskId}.${output.extension}`,
|
|
50805
|
-
mediaType: output.mediaType,
|
|
50806
|
-
maxBytes: 1e7,
|
|
50807
|
-
metadata: { validationKinds }
|
|
50808
|
-
}];
|
|
50809
|
-
}
|
|
50810
51586
|
function benchmarkFixtures(taskId) {
|
|
50811
51587
|
return [
|
|
50812
51588
|
{
|
|
@@ -50830,7 +51606,7 @@ function benchmarkFixtures(taskId) {
|
|
|
50830
51606
|
},
|
|
50831
51607
|
infrastructureError: null,
|
|
50832
51608
|
expectedPassed: false,
|
|
50833
|
-
expectedRewardEligible:
|
|
51609
|
+
expectedRewardEligible: true,
|
|
50834
51610
|
metadata: {}
|
|
50835
51611
|
},
|
|
50836
51612
|
{
|
|
@@ -50840,7 +51616,7 @@ function benchmarkFixtures(taskId) {
|
|
|
50840
51616
|
output: { text: "The launch is moving to August 27 while testing finishes." },
|
|
50841
51617
|
infrastructureError: null,
|
|
50842
51618
|
expectedPassed: false,
|
|
50843
|
-
expectedRewardEligible:
|
|
51619
|
+
expectedRewardEligible: true,
|
|
50844
51620
|
metadata: {}
|
|
50845
51621
|
}
|
|
50846
51622
|
];
|
|
@@ -50848,16 +51624,29 @@ function benchmarkFixtures(taskId) {
|
|
|
50848
51624
|
function uniqueAssets(assets) {
|
|
50849
51625
|
return [...new Map(assets.map((asset) => [asset.id, asset])).values()];
|
|
50850
51626
|
}
|
|
50851
|
-
function
|
|
50852
|
-
|
|
51627
|
+
function supplementaryModelJudge(release) {
|
|
51628
|
+
const raw = release.metadata.supplementaryModelJudge;
|
|
51629
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
51630
|
+
throw new Error("Benchmark release has no supplementary model-judge metadata.");
|
|
51631
|
+
}
|
|
51632
|
+
const value = raw;
|
|
51633
|
+
if (typeof value.id !== "string" || typeof value.version !== "string" || value.calibrationStatus !== "pending" || value.executable !== false || value.rewardEligible !== false) {
|
|
51634
|
+
throw new Error("Benchmark supplementary model-judge metadata is invalid.");
|
|
51635
|
+
}
|
|
51636
|
+
return {
|
|
51637
|
+
id: value.id,
|
|
51638
|
+
version: value.version,
|
|
51639
|
+
calibrationStatus: value.calibrationStatus,
|
|
51640
|
+
rubricRef: ImmutableAssetRefSchema.parse(value.rubricRef)
|
|
51641
|
+
};
|
|
50853
51642
|
}
|
|
50854
51643
|
|
|
50855
51644
|
// ../server/src/training/local-taskset-work-runtime.ts
|
|
50856
|
-
import { execFile as
|
|
51645
|
+
import { execFile as execFile9 } from "node:child_process";
|
|
50857
51646
|
import { createHash as createHash16, randomUUID as randomUUID23 } from "node:crypto";
|
|
50858
|
-
import { existsSync as existsSync12, promises as
|
|
51647
|
+
import { existsSync as existsSync12, promises as fs25 } from "node:fs";
|
|
50859
51648
|
import os8 from "node:os";
|
|
50860
|
-
import
|
|
51649
|
+
import path59 from "node:path";
|
|
50861
51650
|
function createLocalTasksetWorkRuntime(deps) {
|
|
50862
51651
|
return {
|
|
50863
51652
|
createSession: async (payload) => {
|
|
@@ -50911,7 +51700,7 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
50911
51700
|
const request = record10(input.payload);
|
|
50912
51701
|
const action = string2(request.action);
|
|
50913
51702
|
const args = record10(request.args);
|
|
50914
|
-
const root =
|
|
51703
|
+
const root = path59.resolve(input.session.cwd);
|
|
50915
51704
|
await ensureLayout(root);
|
|
50916
51705
|
try {
|
|
50917
51706
|
if (action === "sandbox_create" || action === "sandbox_start") {
|
|
@@ -50938,8 +51727,8 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
50938
51727
|
if (action === "sandbox_upload_file") {
|
|
50939
51728
|
const target = localPath(root, string2(args.path));
|
|
50940
51729
|
const bytes2 = Buffer.from(string2(args.contentsBase64), "base64");
|
|
50941
|
-
await
|
|
50942
|
-
await
|
|
51730
|
+
await fs25.mkdir(path59.dirname(target), { recursive: true, mode: 448 });
|
|
51731
|
+
await fs25.writeFile(target, bytes2, { mode: 384 });
|
|
50943
51732
|
return ok(action, `Uploaded ${relative(root, target)}.`, fileData(target, bytes2));
|
|
50944
51733
|
}
|
|
50945
51734
|
if (action === "sandbox_list_files") {
|
|
@@ -50950,7 +51739,7 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
50950
51739
|
if (action === "sandbox_read_file") {
|
|
50951
51740
|
const target = localPath(root, string2(args.path));
|
|
50952
51741
|
const maxBytes = integer(args.maxBytes, 512e3, 1, 1e6);
|
|
50953
|
-
const bytes2 = await
|
|
51742
|
+
const bytes2 = await fs25.readFile(target);
|
|
50954
51743
|
const bounded = bytes2.subarray(0, maxBytes);
|
|
50955
51744
|
return ok(action, bounded.toString("utf8"), {
|
|
50956
51745
|
path: relative(root, target),
|
|
@@ -50962,24 +51751,24 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
50962
51751
|
if (action === "sandbox_write_file") {
|
|
50963
51752
|
const target = localPath(root, string2(args.path));
|
|
50964
51753
|
const contents = string2(args.content, true);
|
|
50965
|
-
await
|
|
50966
|
-
await
|
|
51754
|
+
await fs25.mkdir(path59.dirname(target), { recursive: true, mode: 448 });
|
|
51755
|
+
await fs25.writeFile(target, contents, { encoding: "utf8", mode: 384 });
|
|
50967
51756
|
return ok(action, `Wrote ${relative(root, target)}.`, fileData(target, Buffer.from(contents)));
|
|
50968
51757
|
}
|
|
50969
51758
|
if (action === "sandbox_edit_file") {
|
|
50970
51759
|
const target = localPath(root, string2(args.path));
|
|
50971
|
-
const contents = await
|
|
51760
|
+
const contents = await fs25.readFile(target, "utf8");
|
|
50972
51761
|
const oldText = string2(args.oldText);
|
|
50973
51762
|
if (!contents.includes(oldText)) {
|
|
50974
51763
|
return fail(action, "The exact text to replace was not found.");
|
|
50975
51764
|
}
|
|
50976
51765
|
const next = args.replaceAll === true ? contents.replaceAll(oldText, string2(args.newText, true)) : contents.replace(oldText, string2(args.newText, true));
|
|
50977
|
-
await
|
|
51766
|
+
await fs25.writeFile(target, next, { encoding: "utf8", mode: 384 });
|
|
50978
51767
|
return ok(action, `Edited ${relative(root, target)}.`, fileData(target, Buffer.from(next)));
|
|
50979
51768
|
}
|
|
50980
51769
|
if (action === "sandbox_delete_file") {
|
|
50981
51770
|
const target = localPath(root, string2(args.path));
|
|
50982
|
-
await
|
|
51771
|
+
await fs25.rm(target, { recursive: args.recursive === true, force: true });
|
|
50983
51772
|
return ok(action, `Deleted ${relative(root, target)}.`, { path: relative(root, target) });
|
|
50984
51773
|
}
|
|
50985
51774
|
if (action === "sandbox_exec") {
|
|
@@ -50992,7 +51781,7 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
50992
51781
|
output: [result.stdout, result.stderr].filter(Boolean).join("\n").trim(),
|
|
50993
51782
|
data: {
|
|
50994
51783
|
command,
|
|
50995
|
-
cwd:
|
|
51784
|
+
cwd: path59.join(root, "work"),
|
|
50996
51785
|
exitCode: result.code,
|
|
50997
51786
|
stdout: result.stdout,
|
|
50998
51787
|
stderr: result.stderr
|
|
@@ -51001,24 +51790,24 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
51001
51790
|
}
|
|
51002
51791
|
if (action === "sandbox_save_output") {
|
|
51003
51792
|
const source = localPath(root, string2(args.path));
|
|
51004
|
-
const bytes2 = await
|
|
51793
|
+
const bytes2 = await fs25.readFile(source);
|
|
51005
51794
|
if (bytes2.byteLength > WORK_OUTPUT_MAX_BYTES) {
|
|
51006
51795
|
return fail(action, `Work output exceeds ${WORK_OUTPUT_MAX_BYTES.toLocaleString()} bytes.`);
|
|
51007
51796
|
}
|
|
51008
51797
|
const title = safeName2(
|
|
51009
|
-
typeof args.suggestedName === "string" && args.suggestedName.trim() ? args.suggestedName :
|
|
51798
|
+
typeof args.suggestedName === "string" && args.suggestedName.trim() ? args.suggestedName : path59.basename(source)
|
|
51010
51799
|
);
|
|
51011
|
-
const contentType2 = WORK_OUTPUT_CONTENT_TYPES[
|
|
51800
|
+
const contentType2 = WORK_OUTPUT_CONTENT_TYPES[path59.extname(title).toLowerCase()];
|
|
51012
51801
|
if (!contentType2) return fail(action, `${title} is not a supported Work output format.`);
|
|
51013
|
-
const outputDir =
|
|
51802
|
+
const outputDir = path59.join(
|
|
51014
51803
|
input.deps.storeDir,
|
|
51015
51804
|
"work",
|
|
51016
51805
|
"outputs",
|
|
51017
51806
|
safeName2(input.session.id)
|
|
51018
51807
|
);
|
|
51019
|
-
await
|
|
51020
|
-
const destination =
|
|
51021
|
-
await
|
|
51808
|
+
await fs25.mkdir(outputDir, { recursive: true, mode: 448 });
|
|
51809
|
+
const destination = path59.join(outputDir, `001-${randomUUID23()}-${title}`);
|
|
51810
|
+
await fs25.writeFile(destination, bytes2, { mode: 384 });
|
|
51022
51811
|
const outputRef = FileOutputRefSchema.parse({
|
|
51023
51812
|
kind: "file",
|
|
51024
51813
|
id: `output-${createHash16("sha256").update(destination).digest("hex").slice(0, 24)}`,
|
|
@@ -51055,25 +51844,25 @@ async function executeLocalWorkspaceTool(input) {
|
|
|
51055
51844
|
}
|
|
51056
51845
|
async function ensureLayout(root) {
|
|
51057
51846
|
await Promise.all(["inputs", "work", "outputs"].map(
|
|
51058
|
-
(area) =>
|
|
51847
|
+
(area) => fs25.mkdir(path59.join(root, area), { recursive: true, mode: 448 })
|
|
51059
51848
|
));
|
|
51060
51849
|
}
|
|
51061
51850
|
function localPath(root, value) {
|
|
51062
51851
|
const normalized = value.replaceAll("\\", "/").replace(/^\/+/, "").replace(/^workspace(?:\/|$)/, "");
|
|
51063
|
-
const target =
|
|
51064
|
-
if (target !== root && !target.startsWith(`${root}${
|
|
51852
|
+
const target = path59.resolve(root, normalized);
|
|
51853
|
+
if (target !== root && !target.startsWith(`${root}${path59.sep}`)) {
|
|
51065
51854
|
throw new Error("Local Work path escaped its isolated workspace.");
|
|
51066
51855
|
}
|
|
51067
51856
|
return target;
|
|
51068
51857
|
}
|
|
51069
51858
|
async function listFiles2(root, target, recursive) {
|
|
51070
|
-
const stat7 = await
|
|
51859
|
+
const stat7 = await fs25.stat(target).catch(() => null);
|
|
51071
51860
|
if (!stat7) return [];
|
|
51072
51861
|
if (!stat7.isDirectory()) return [relative(root, target)];
|
|
51073
|
-
const entries = await
|
|
51862
|
+
const entries = await fs25.readdir(target, { withFileTypes: true });
|
|
51074
51863
|
const files = [];
|
|
51075
51864
|
for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
51076
|
-
const item =
|
|
51865
|
+
const item = path59.join(target, entry.name);
|
|
51077
51866
|
files.push(relative(root, item));
|
|
51078
51867
|
if (recursive && entry.isDirectory()) files.push(...await listFiles2(root, item, true));
|
|
51079
51868
|
if (files.length >= 1e3) break;
|
|
@@ -51082,8 +51871,8 @@ async function listFiles2(root, target, recursive) {
|
|
|
51082
51871
|
}
|
|
51083
51872
|
function runCommand5(command, cwd, timeoutMs) {
|
|
51084
51873
|
return new Promise((resolve) => {
|
|
51085
|
-
const nodeRuntimeRoot =
|
|
51086
|
-
const localPythonRoot =
|
|
51874
|
+
const nodeRuntimeRoot = path59.dirname(path59.dirname(process.execPath));
|
|
51875
|
+
const localPythonRoot = path59.join(os8.homedir(), ".local", "lib");
|
|
51087
51876
|
const sandboxArgs = [
|
|
51088
51877
|
"--tmpfs",
|
|
51089
51878
|
"/",
|
|
@@ -51135,7 +51924,7 @@ function runCommand5(command, cwd, timeoutMs) {
|
|
|
51135
51924
|
"-lc",
|
|
51136
51925
|
command
|
|
51137
51926
|
];
|
|
51138
|
-
|
|
51927
|
+
execFile9(
|
|
51139
51928
|
"/bin/bwrap",
|
|
51140
51929
|
sandboxArgs,
|
|
51141
51930
|
{ cwd, timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024 },
|
|
@@ -51202,7 +51991,7 @@ function integer(value, fallback, minimum, maximum) {
|
|
|
51202
51991
|
return typeof value === "number" && Number.isInteger(value) ? Math.min(maximum, Math.max(minimum, value)) : fallback;
|
|
51203
51992
|
}
|
|
51204
51993
|
function relative(root, target) {
|
|
51205
|
-
return
|
|
51994
|
+
return path59.relative(root, target).replaceAll(path59.sep, "/");
|
|
51206
51995
|
}
|
|
51207
51996
|
function safeName2(value) {
|
|
51208
51997
|
return value.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "output";
|
|
@@ -51257,12 +52046,12 @@ function createBenchmarkRuntimeComposition(input) {
|
|
|
51257
52046
|
// ../server/src/training/dataset-storage-service.ts
|
|
51258
52047
|
import { constants as constants3 } from "node:fs";
|
|
51259
52048
|
import { access as access4, mkdir as mkdir12, readFile as readFile18, rename as rename5, statfs as statfs2, writeFile as writeFile8 } from "node:fs/promises";
|
|
51260
|
-
import
|
|
52049
|
+
import path61 from "node:path";
|
|
51261
52050
|
|
|
51262
52051
|
// ../server/src/training/dataset-storage-discovery.ts
|
|
51263
52052
|
import { readdir as readdir4, readFile as readFile17 } from "node:fs/promises";
|
|
51264
52053
|
import os9 from "node:os";
|
|
51265
|
-
import
|
|
52054
|
+
import path60 from "node:path";
|
|
51266
52055
|
var NETWORK_FILE_SYSTEMS = /* @__PURE__ */ new Set([
|
|
51267
52056
|
"9p",
|
|
51268
52057
|
"afpfs",
|
|
@@ -51348,7 +52137,7 @@ function parseLinuxMountInfo(value, storeDir) {
|
|
|
51348
52137
|
candidates.push({
|
|
51349
52138
|
kind,
|
|
51350
52139
|
label: driveLabel(mountPath, source, kind),
|
|
51351
|
-
datasetStorePath: mountPath === "/" ?
|
|
52140
|
+
datasetStorePath: mountPath === "/" ? path60.join(storeDir, "datasets") : path60.join(mountPath, "OpenPond", "datasets"),
|
|
51352
52141
|
path: mountPath
|
|
51353
52142
|
});
|
|
51354
52143
|
}
|
|
@@ -51367,7 +52156,7 @@ function parseMacMountOutput(value, storeDir) {
|
|
|
51367
52156
|
candidates.push({
|
|
51368
52157
|
kind,
|
|
51369
52158
|
label: driveLabel(mountPath, source, kind),
|
|
51370
|
-
datasetStorePath: mountPath === "/" ?
|
|
52159
|
+
datasetStorePath: mountPath === "/" ? path60.join(storeDir, "datasets") : path60.join(mountPath, "OpenPond", "datasets"),
|
|
51371
52160
|
path: mountPath
|
|
51372
52161
|
});
|
|
51373
52162
|
}
|
|
@@ -51390,11 +52179,11 @@ function parseWindowsLogicalDisks(value, storeDir) {
|
|
|
51390
52179
|
const root = `${deviceId}\\`;
|
|
51391
52180
|
const volumeName = typeof record11.VolumeName === "string" ? record11.VolumeName.trim() : "";
|
|
51392
52181
|
const kind = driveType === 4 ? "network" : driveType === 2 ? "removable" : "local";
|
|
51393
|
-
const storeRoot =
|
|
52182
|
+
const storeRoot = path60.win32.parse(path60.win32.resolve(storeDir)).root.toLowerCase();
|
|
51394
52183
|
return [{
|
|
51395
52184
|
kind,
|
|
51396
52185
|
label: volumeName || (root.toLowerCase() === storeRoot ? "System disk" : deviceId.toUpperCase()),
|
|
51397
|
-
datasetStorePath: root.toLowerCase() === storeRoot ?
|
|
52186
|
+
datasetStorePath: root.toLowerCase() === storeRoot ? path60.win32.join(storeDir, "datasets") : path60.win32.join(root, "OpenPond", "datasets"),
|
|
51398
52187
|
path: root
|
|
51399
52188
|
}];
|
|
51400
52189
|
});
|
|
@@ -51408,25 +52197,25 @@ function storageKindForPath(value) {
|
|
|
51408
52197
|
}
|
|
51409
52198
|
async function discoverGvfsCandidates() {
|
|
51410
52199
|
const uid = typeof process.getuid === "function" ? process.getuid() : os9.userInfo().uid;
|
|
51411
|
-
const gvfsRoot =
|
|
52200
|
+
const gvfsRoot = path60.join("/run/user", String(uid), "gvfs");
|
|
51412
52201
|
const entries = await readdir4(gvfsRoot, { withFileTypes: true }).catch(() => []);
|
|
51413
52202
|
return entries.flatMap((entry) => {
|
|
51414
52203
|
if (!entry.isDirectory()) return [];
|
|
51415
|
-
const mountedPath =
|
|
52204
|
+
const mountedPath = path60.join(gvfsRoot, entry.name);
|
|
51416
52205
|
return [{
|
|
51417
52206
|
kind: "network",
|
|
51418
52207
|
label: labelForGvfsMount(entry.name),
|
|
51419
|
-
datasetStorePath:
|
|
52208
|
+
datasetStorePath: path60.join(mountedPath, "OpenPond", "datasets"),
|
|
51420
52209
|
path: mountedPath
|
|
51421
52210
|
}];
|
|
51422
52211
|
});
|
|
51423
52212
|
}
|
|
51424
52213
|
function systemStorageCandidate(storeDir, platform) {
|
|
51425
|
-
const root =
|
|
52214
|
+
const root = path60.parse(path60.resolve(storeDir)).root;
|
|
51426
52215
|
return {
|
|
51427
52216
|
kind: "local",
|
|
51428
52217
|
label: "System disk",
|
|
51429
|
-
datasetStorePath:
|
|
52218
|
+
datasetStorePath: path60.join(storeDir, "datasets"),
|
|
51430
52219
|
path: platform === "win32" ? root : root || "/"
|
|
51431
52220
|
};
|
|
51432
52221
|
}
|
|
@@ -51445,12 +52234,12 @@ function storageKind(input) {
|
|
|
51445
52234
|
}
|
|
51446
52235
|
function driveLabel(mountPath, source, kind) {
|
|
51447
52236
|
if (mountPath === "/") return "System disk";
|
|
51448
|
-
const mountName =
|
|
52237
|
+
const mountName = path60.basename(mountPath);
|
|
51449
52238
|
if (kind === "network") {
|
|
51450
52239
|
const sourceName = source.replace(/\/+$/, "").split("/").pop();
|
|
51451
52240
|
return decodeSafely(sourceName || mountName || source);
|
|
51452
52241
|
}
|
|
51453
|
-
return decodeSafely(mountName ||
|
|
52242
|
+
return decodeSafely(mountName || path60.basename(source) || source);
|
|
51454
52243
|
}
|
|
51455
52244
|
function labelForGvfsMount(name) {
|
|
51456
52245
|
const separator = name.indexOf(":");
|
|
@@ -51484,7 +52273,7 @@ function uniqueCandidates2(candidates) {
|
|
|
51484
52273
|
return [...unique2.values()];
|
|
51485
52274
|
}
|
|
51486
52275
|
function normalizedPath(value) {
|
|
51487
|
-
const normalized =
|
|
52276
|
+
const normalized = path60.normalize(value);
|
|
51488
52277
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
51489
52278
|
}
|
|
51490
52279
|
|
|
@@ -51545,15 +52334,15 @@ var runCommandProbe = async (executable, args, options = {}) => {
|
|
|
51545
52334
|
|
|
51546
52335
|
// ../server/src/training/dataset-storage-service.ts
|
|
51547
52336
|
function createDatasetStorageService(input) {
|
|
51548
|
-
const directory =
|
|
51549
|
-
const settingsPath =
|
|
52337
|
+
const directory = path61.join(input.storeDir, "datasets");
|
|
52338
|
+
const settingsPath = path61.join(directory, "settings.json");
|
|
51550
52339
|
async function settings() {
|
|
51551
52340
|
try {
|
|
51552
52341
|
return DatasetStorageSettingsSchema.parse(JSON.parse(await readFile18(settingsPath, "utf8")));
|
|
51553
52342
|
} catch {
|
|
51554
52343
|
return DatasetStorageSettingsSchema.parse({
|
|
51555
52344
|
schemaVersion: "openpond.datasetStorageSettings.v1",
|
|
51556
|
-
datasetStorePath:
|
|
52345
|
+
datasetStorePath: path61.join(input.storeDir, "datasets"),
|
|
51557
52346
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
51558
52347
|
});
|
|
51559
52348
|
}
|
|
@@ -51565,7 +52354,7 @@ function createDatasetStorageService(input) {
|
|
|
51565
52354
|
platform: process.platform,
|
|
51566
52355
|
storeDir: input.storeDir
|
|
51567
52356
|
});
|
|
51568
|
-
if (!candidates.some((candidate2) =>
|
|
52357
|
+
if (!candidates.some((candidate2) => path61.resolve(candidate2.datasetStorePath) === path61.resolve(current.datasetStorePath))) {
|
|
51569
52358
|
candidates.push({
|
|
51570
52359
|
datasetStorePath: current.datasetStorePath,
|
|
51571
52360
|
kind: storageKindForPath(current.datasetStorePath),
|
|
@@ -51579,7 +52368,7 @@ function createDatasetStorageService(input) {
|
|
|
51579
52368
|
return {
|
|
51580
52369
|
...candidate2,
|
|
51581
52370
|
id: `dataset-storage-${Buffer.from(candidate2.path).toString("base64url").slice(0, 120)}`,
|
|
51582
|
-
configured:
|
|
52371
|
+
configured: path61.resolve(candidate2.datasetStorePath) === path61.resolve(current.datasetStorePath),
|
|
51583
52372
|
mounted: stats !== null,
|
|
51584
52373
|
freeBytes: stats ? Number(stats.bavail) * Number(stats.bsize) : null,
|
|
51585
52374
|
totalBytes: stats ? Number(stats.blocks) * Number(stats.bsize) : null,
|
|
@@ -51596,7 +52385,7 @@ function createDatasetStorageService(input) {
|
|
|
51596
52385
|
const request = UpdateDatasetStorageSettingsRequestSchema.parse(value);
|
|
51597
52386
|
const updated = DatasetStorageSettingsSchema.parse({
|
|
51598
52387
|
schemaVersion: "openpond.datasetStorageSettings.v1",
|
|
51599
|
-
datasetStorePath:
|
|
52388
|
+
datasetStorePath: path61.resolve(request.datasetStorePath),
|
|
51600
52389
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
51601
52390
|
});
|
|
51602
52391
|
if (!await ensureWritable(updated.datasetStorePath)) {
|
|
@@ -51752,10 +52541,10 @@ function createManagedAdapterRegistryClient(dependencies = {}) {
|
|
|
51752
52541
|
const fetchImpl = dependencies.fetchImpl ?? fetch;
|
|
51753
52542
|
const resolveRegistryAccess = dependencies.resolveRegistryAccess ?? ((teamId) => resolveManagedAdapterUserAccess({ teamId }));
|
|
51754
52543
|
const resolveInferenceAccess = dependencies.resolveInferenceAccess ?? ((teamId) => resolveManagedAdapterUserAccess({ teamId }));
|
|
51755
|
-
async function requestJson2(resolveAccess, teamId,
|
|
52544
|
+
async function requestJson2(resolveAccess, teamId, path63, init = {}) {
|
|
51756
52545
|
const access5 = await resolveAccess(teamId);
|
|
51757
52546
|
assertResolvedTeam(access5.teamId, teamId);
|
|
51758
|
-
const requestUrl = `${access5.apiBaseUrl}${
|
|
52547
|
+
const requestUrl = `${access5.apiBaseUrl}${path63}`;
|
|
51759
52548
|
const headers = withVercelProtectionBypass(
|
|
51760
52549
|
requestUrl,
|
|
51761
52550
|
hostedApiAuthHeaders(access5.token),
|
|
@@ -52385,10 +53174,10 @@ async function createOpenPondServer(options = {}) {
|
|
|
52385
53174
|
const harnessEvaluationReviewStream = createLocalHarnessEvaluationReviewModelStream(streamOpenPondHostedChatTurn2);
|
|
52386
53175
|
const executeWebSearch = createWebSearchExecutorFromEnv();
|
|
52387
53176
|
const executeConnectedAppTool = createCloudConnectedAppToolExecutor();
|
|
52388
|
-
const attachmentRootDir =
|
|
53177
|
+
const attachmentRootDir = path62.join(storeDir, "attachments");
|
|
52389
53178
|
const logger = createLogger({
|
|
52390
53179
|
channel: "server",
|
|
52391
|
-
logDir:
|
|
53180
|
+
logDir: path62.join(storeDir, "logs"),
|
|
52392
53181
|
metadata: {
|
|
52393
53182
|
version,
|
|
52394
53183
|
runtimeVersion
|
|
@@ -52578,14 +53367,27 @@ async function createOpenPondServer(options = {}) {
|
|
|
52578
53367
|
store,
|
|
52579
53368
|
defaultSessionCwd,
|
|
52580
53369
|
createManagedLocalWorkCwd: async (sessionId) => {
|
|
52581
|
-
const workspacePath =
|
|
52582
|
-
await
|
|
53370
|
+
const workspacePath = path62.join(storeDir, "work", "tasks", sessionId);
|
|
53371
|
+
await fs26.mkdir(workspacePath, { recursive: true, mode: 448 });
|
|
52583
53372
|
return workspacePath;
|
|
52584
53373
|
},
|
|
52585
53374
|
loadAppPreferences,
|
|
52586
53375
|
appendRuntimeEvent,
|
|
52587
53376
|
loadLastUsedProfile: async () => (await loadOpenPondProfileLibrary()).lastUsed
|
|
52588
53377
|
});
|
|
53378
|
+
const sessionTitleService = createSessionTitleService({
|
|
53379
|
+
appendRuntimeEvent,
|
|
53380
|
+
getSession,
|
|
53381
|
+
logger,
|
|
53382
|
+
stream: streamOpenPondHostedChatTurn2,
|
|
53383
|
+
updateSession
|
|
53384
|
+
});
|
|
53385
|
+
const createSessionWithAutoTitle = async (payload) => {
|
|
53386
|
+
const prompt = autoTitlePromptFromPayload(payload);
|
|
53387
|
+
const session = await createSession(withPendingAutoTitle(payload));
|
|
53388
|
+
if (prompt) sessionTitleService.schedule(session.id, prompt);
|
|
53389
|
+
return session;
|
|
53390
|
+
};
|
|
52589
53391
|
const {
|
|
52590
53392
|
activeWorkspace,
|
|
52591
53393
|
appendWorkspaceDiffEvent,
|
|
@@ -52682,7 +53484,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
52682
53484
|
const tasksetAuthoringSkillText = tasksetAuthoringSkillArtifact.bundle;
|
|
52683
53485
|
const taskCreatorService = createTaskCreatorService({
|
|
52684
53486
|
store,
|
|
52685
|
-
tasksetRootDir:
|
|
53487
|
+
tasksetRootDir: path62.join(storeDir, "training", "tasksets"),
|
|
52686
53488
|
authoringSkillHash: contentHash(tasksetAuthoringSkillText),
|
|
52687
53489
|
loadCodexHistoryThread: (sessionId) => readCodexHistoryThreadPayload(sessionId, {
|
|
52688
53490
|
attachmentRootDir,
|
|
@@ -52711,7 +53513,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
52711
53513
|
});
|
|
52712
53514
|
const datasetArtifactService = createDatasetArtifactService({
|
|
52713
53515
|
store,
|
|
52714
|
-
workerProjectDir:
|
|
53516
|
+
workerProjectDir: path62.resolve(process.cwd(), "python", "openpond-datasets")
|
|
52715
53517
|
});
|
|
52716
53518
|
const {
|
|
52717
53519
|
benchmarkTasksets,
|
|
@@ -52815,7 +53617,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
52815
53617
|
const trainingChatSearchService = createTrainingChatSearchService({ store });
|
|
52816
53618
|
const datasetImportService = createDatasetImportService({
|
|
52817
53619
|
store,
|
|
52818
|
-
workerProjectDir:
|
|
53620
|
+
workerProjectDir: path62.resolve(
|
|
52819
53621
|
process.cwd(),
|
|
52820
53622
|
"python",
|
|
52821
53623
|
"openpond-datasets"
|
|
@@ -53039,7 +53841,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
53039
53841
|
nextStep: response2.items.length === 0 ? "There are no pinned or saved files." : `Listed ${response2.items.length} sidebar file${response2.items.length === 1 ? "" : "s"}.`
|
|
53040
53842
|
};
|
|
53041
53843
|
}
|
|
53042
|
-
const
|
|
53844
|
+
const path63 = normalizeSidebarFilePath(requestedPath ?? "");
|
|
53043
53845
|
const workspaceId = session.workspaceId ?? session.localProjectId ?? session.appId;
|
|
53044
53846
|
if (!workspaceId) {
|
|
53045
53847
|
throw new Error(
|
|
@@ -53052,18 +53854,18 @@ async function createOpenPondServer(options = {}) {
|
|
|
53052
53854
|
workspaceKind,
|
|
53053
53855
|
workspaceId,
|
|
53054
53856
|
workspaceName,
|
|
53055
|
-
path:
|
|
53857
|
+
path: path63,
|
|
53056
53858
|
status: action === "pin" ? "pinned" : action === "save_for_later" ? "saved_for_later" : "none",
|
|
53057
53859
|
sourceSessionId: session.id
|
|
53058
53860
|
});
|
|
53059
53861
|
const changed = response.items.find(
|
|
53060
|
-
(item) => item.workspaceKind === workspaceKind && item.workspaceId === workspaceId && item.path ===
|
|
53862
|
+
(item) => item.workspaceKind === workspaceKind && item.workspaceId === workspaceId && item.path === path63
|
|
53061
53863
|
) ?? null;
|
|
53062
53864
|
const verb = action === "pin" ? "Pinned" : action === "save_for_later" ? "Saved" : "Removed";
|
|
53063
53865
|
return {
|
|
53064
53866
|
...response,
|
|
53065
53867
|
changed,
|
|
53066
|
-
nextStep: `${verb} ${
|
|
53868
|
+
nextStep: `${verb} ${path63}${action === "save_for_later" ? " for later" : ""}.`
|
|
53067
53869
|
};
|
|
53068
53870
|
},
|
|
53069
53871
|
listIntegrationConnections: listSandboxIntegrationConnections,
|
|
@@ -53579,13 +54381,14 @@ async function createOpenPondServer(options = {}) {
|
|
|
53579
54381
|
});
|
|
53580
54382
|
const harnessEvaluationReviewScheduler = createLocalHarnessEvaluationReviewScheduler({
|
|
53581
54383
|
store,
|
|
54384
|
+
storeDir,
|
|
53582
54385
|
stream: harnessEvaluationReviewStream,
|
|
53583
54386
|
isClosing: () => closing,
|
|
53584
54387
|
logger
|
|
53585
54388
|
});
|
|
53586
54389
|
const agentRuntime = createAppServer({
|
|
53587
54390
|
ports: createAgentRuntimePorts({
|
|
53588
|
-
createSession,
|
|
54391
|
+
createSession: createSessionWithAutoTitle,
|
|
53589
54392
|
getSession,
|
|
53590
54393
|
turnsForSession: (sessionId) => store.turnsForSession(sessionId, 1e3),
|
|
53591
54394
|
runtimeEventsForSession: (sessionId) => store.runtimeEventsForSession(sessionId),
|
|
@@ -53599,7 +54402,8 @@ async function createOpenPondServer(options = {}) {
|
|
|
53599
54402
|
reviewHarness: (request) => reviewSelectedLocalHarnessEvaluation({
|
|
53600
54403
|
store,
|
|
53601
54404
|
request,
|
|
53602
|
-
stream: harnessEvaluationReviewStream
|
|
54405
|
+
stream: harnessEvaluationReviewStream,
|
|
54406
|
+
continuation: { storeDir, stream: harnessEvaluationReviewStream }
|
|
53603
54407
|
}),
|
|
53604
54408
|
acceptHarnessEvaluationReview: async (request) => {
|
|
53605
54409
|
const profile = await loadOpenPondProfileState();
|
|
@@ -53763,7 +54567,7 @@ async function createOpenPondServer(options = {}) {
|
|
|
53763
54567
|
browserControlComplete: browserControlQueue.completeRequest,
|
|
53764
54568
|
browserControlStatus: browserControlQueue.status,
|
|
53765
54569
|
agentRuntime,
|
|
53766
|
-
createSession,
|
|
54570
|
+
createSession: createSessionWithAutoTitle,
|
|
53767
54571
|
patchSession: patchSessionPayload,
|
|
53768
54572
|
sendTurn,
|
|
53769
54573
|
runSessionCommand: runSessionCommandPayload,
|