openpond 0.0.32 → 0.0.34
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/{app-layer-CUQQUVJS.js → app-layer-UQQNF5VZ.js} +3 -3
- package/dist/chunks/{apps-TAYMUCWX.js → apps-7NSC56K5.js} +3 -3
- package/dist/chunks/{chunk-W2DJR3FA.js → chunk-2GCNPJMD.js} +1 -1
- package/dist/chunks/{chunk-GYZYZGKS.js → chunk-5MM3P5KY.js} +2 -2
- package/dist/chunks/{chunk-E5RVRUJB.js → chunk-B5CFIWWU.js} +1 -1
- package/dist/chunks/{chunk-FQW3AQVJ.js → chunk-BZPAW4JY.js} +31 -0
- package/dist/chunks/{chunk-5RHZKQRK.js → chunk-E3RLJ5XT.js} +2 -2
- package/dist/chunks/{chunk-3UOLQG6N.js → chunk-EBCLEJRO.js} +1 -1
- package/dist/chunks/{chunk-D264OHTR.js → chunk-F6FFL3AA.js} +2 -2
- package/dist/chunks/{chunk-PJXJ2HRT.js → chunk-G7XOSECC.js} +33 -0
- package/dist/chunks/{chunk-EONKWOLU.js → chunk-HGZ3O4TS.js} +2 -2
- package/dist/chunks/{chunk-DCNAXREU.js → chunk-JVTACGKD.js} +3 -3
- package/dist/chunks/{chunk-Y4F4XD5V.js → chunk-MMDKFTJB.js} +1 -1
- package/dist/chunks/{chunk-4HQURM3N.js → chunk-TF234YN4.js} +1 -1
- package/dist/chunks/{chunk-3ZJIEA5F.js → chunk-U4TUOBXO.js} +1 -1
- package/dist/chunks/{chunk-4M4WAORL.js → chunk-UASXM3RR.js} +4 -4
- package/dist/chunks/{chunk-OXQG773T.js → chunk-V7SHAMUN.js} +33 -33
- package/dist/chunks/{chunk-Q5MZCRJA.js → chunk-ZDEBKTWR.js} +1 -1
- package/dist/chunks/{chunk-XADW35CL.js → chunk-ZRNFOHFH.js} +3 -3
- package/dist/chunks/{cli-WW5BVN5Z.js → cli-4ETE5RS2.js} +4 -4
- package/dist/chunks/{cli-ZOCP7X5M.js → cli-VEDK2B42.js} +6 -6
- package/dist/chunks/{core-commands-SYGK7K57.js → core-commands-J3IQGQOL.js} +4 -4
- package/dist/chunks/{extend-Q5HZ7TMA.js → extend-3F3LLDOF.js} +9 -9
- package/dist/chunks/{harness-ZPBPQVAS.js → harness-JER7P6MJ.js} +3 -3
- package/dist/chunks/{help-3V3TRQNX.js → help-75NFCYJ4.js} +1 -1
- package/dist/chunks/{opchat-OUPMEFE5.js → opchat-UT5V7MR2.js} +5 -5
- package/dist/chunks/{organizations-5CSLBDAW.js → organizations-ERKRLVNQ.js} +4 -4
- package/dist/chunks/{profile-OQYSXHOG.js → profile-A3CUSDIF.js} +7 -7
- package/dist/chunks/{project-agent-TBTWOUJF.js → project-agent-FCV5HPYT.js} +6 -6
- package/dist/chunks/{sandbox-command-HCHPY7KW.js → sandbox-command-L2QPIWZ5.js} +4 -4
- package/dist/chunks/{sandbox-template-PNTOZ6W3.js → sandbox-template-XOIWROEK.js} +5 -5
- package/dist/chunks/{src-C6MXLDYQ.js → src-ENVQ7ARM.js} +2 -2
- package/dist/chunks/{src-GZT4UX6I.js → src-V4FUQNHR.js} +676 -462
- package/dist/chunks/{teams-bot-CQ76XI6T.js → teams-bot-OR3ZJHQ5.js} +3 -3
- package/dist/chunks/{workspaces-DHVVOTVR.js → workspaces-L73SRLPA.js} +2 -2
- package/dist/cli.js +10 -10
- package/dist/web/assets/{AppsView-CF2g-7FH.js → AppsView-CLjjVkjr.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-lUsLUl20.js → BrowserSidebar-CkNO8723.js} +1 -1
- package/dist/web/assets/{CloudWorkView-BnfGW4OV.js → CloudWorkView-Cu_VqkaD.js} +1 -1
- package/dist/web/assets/{CommandMenu-BsS4Bgb6.js → CommandMenu-DWtdkvmq.js} +1 -1
- package/dist/web/assets/{CommunityView-C8qVOwlp.js → CommunityView-f03qOTER.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-C_LIpfSq.js → ComposerCreateImproveStrip-CZpiQJsJ.js} +1 -1
- package/dist/web/assets/{GetStartedView-Du533wOh.js → GetStartedView-CLMmryTG.js} +1 -1
- package/dist/web/assets/LabsRoute-BwR2g71k.js +4 -0
- package/dist/web/assets/{NewProjectDialog-DH7wA1z9.js → NewProjectDialog-PrbA4fL6.js} +1 -1
- package/dist/web/assets/{ProfileSettingsSection-D7JvMZdW.js → ProfileSettingsSection-CD_x_V8d.js} +1 -1
- package/dist/web/assets/SettingsView-BMmlKvlB.js +63 -0
- package/dist/web/assets/SettingsView-CAPf81v3.css +1 -0
- package/dist/web/assets/{TeamChatView-D_CE7br9.js → TeamChatView-B5SlhDso.js} +2 -2
- package/dist/web/assets/{TerminalOverlay-CC-VDSlp.js → TerminalOverlay-DaGfEprz.js} +1 -1
- package/dist/web/assets/TrainingComputeDialog-BFY6E0yU.js +1 -0
- package/dist/web/assets/{TrainingCreationPanel-NFCoaBUI.js → TrainingCreationPanel-Cp66gMed.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-BWEmVFjM.js → TrainingDraftPanel-BX5CCqlO.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-SlLlGZM1.js → WorkspaceDiffPanel-D7ZEbryF.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-BAoMBTVD.js → WorkspaceEnvironmentMenu-D4DmAJaS.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-CVIFrzyl.js → WorkspaceGitDialogs-DHOfJxbL.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-0trp0-TI.js → WorkspaceMonacoEditor-C0fDue2d.js} +3 -3
- package/dist/web/assets/{boxes-CFihgX2z.js → boxes-CXLqRF98.js} +1 -1
- package/dist/web/assets/{create-pipeline-request-AJWLMTyw.js → create-pipeline-request-C26NOc7v.js} +1 -1
- package/dist/web/assets/{cssMode-HvqfCFyP.js → cssMode-DmtwKUVm.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-C5mUmACv.js → git-commit-horizontal-CDDZl4iA.js} +1 -1
- package/dist/web/assets/{htmlMode-C8btgUt-.js → htmlMode-Box0EOm1.js} +1 -1
- package/dist/web/assets/index-BUyeKpY6.js +1 -0
- package/dist/web/assets/{index-D7Vr3zcV.js → index-CKmte5ok.js} +55 -55
- package/dist/web/assets/{info-D0xuy5IB.js → info-4Iy6BKvT.js} +1 -1
- package/dist/web/assets/{jsonMode-5zVz9G0X.js → jsonMode-g7t_3HFv.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-DxlSSL7c.js → lspLanguageFeatures-CwhFOYc9.js} +1 -1
- package/dist/web/assets/{monaco.contribution-BKpVvKK9.js → monaco.contribution-B-QC_ls9.js} +2 -2
- package/dist/web/assets/{monaco.contribution-B1pWWwqT.js → monaco.contribution-CW2ctrTm.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BXdXsSWI.js → monaco.contribution-CwMt3eHi.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CIjjzpUR.js → monaco.contribution-DGZAePHI.js} +2 -2
- package/dist/web/assets/{monitor-B4-9Shtp.js → monitor-DOVjBLkr.js} +1 -1
- package/dist/web/assets/{play-BJdhBqQE.js → play-DLCuESeG.js} +1 -1
- package/dist/web/assets/{python-CEK8J4w_.js → python-DRNmHcYd.js} +1 -1
- package/dist/web/assets/{refresh-cw-DE0u_nmZ.js → refresh-cw-JNUovwk4.js} +1 -1
- package/dist/web/assets/{reply-2MfLJ93n.js → reply-D4QvJyzE.js} +1 -1
- package/dist/web/assets/{save-CBIVKaf8.js → save-BR4O4UDP.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-CC73mtvA.js → toggleHighContrast-CrfdWIsV.js} +1 -1
- package/dist/web/assets/training-DeVTd0m8.css +1 -0
- package/dist/web/assets/{tsMode-Bhn9wr_1.js → tsMode-ZuV9go1B.js} +1 -1
- package/dist/web/assets/useComputeSettings-DUNS6uOl.js +1 -0
- package/dist/web/assets/useComputeSettings-R2Sw621I.css +1 -0
- package/dist/web/assets/{wifi-off-BKTqnqj0.js → wifi-off-XFVqsf4c.js} +1 -1
- package/dist/web/assets/{workers-C_adgrEg.js → workers-CJpO1Wzj.js} +1 -1
- package/dist/web/assets/{yaml-DDRAcADU.js → yaml-AQ4ok5ED.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/LabsRoute-yk8lNMQc.js +0 -3
- package/dist/web/assets/SettingsView-C9TgCaWG.js +0 -63
- package/dist/web/assets/SettingsView-DwbGu8Kj.css +0 -1
- package/dist/web/assets/index-DUqAiF57.js +0 -1
- package/dist/web/assets/training-BY8siNUK.css +0 -1
|
@@ -28,10 +28,10 @@ import {
|
|
|
28
28
|
truncatePatch,
|
|
29
29
|
uniqueSortedPaths,
|
|
30
30
|
workspaceImageContentType
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-B5CFIWWU.js";
|
|
32
32
|
import {
|
|
33
33
|
runOpenPondServerCli
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-E3RLJ5XT.js";
|
|
35
35
|
import {
|
|
36
36
|
APP_PREFERENCES_CACHE_KEY,
|
|
37
37
|
APP_PREFERENCES_CACHE_TYPE,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
isCliEntrypoint,
|
|
45
45
|
now,
|
|
46
46
|
textFromUnknown
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-ZDEBKTWR.js";
|
|
48
48
|
import {
|
|
49
49
|
createOpenPondRepoApp,
|
|
50
50
|
getBundledRuntimeVersion,
|
|
@@ -56,12 +56,14 @@ import {
|
|
|
56
56
|
streamOpenPondHostedChatTurn,
|
|
57
57
|
switchOpenPondAccount,
|
|
58
58
|
updateOpenPondAccountConfig
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-MMDKFTJB.js";
|
|
60
60
|
import {
|
|
61
61
|
AccountStateSchema,
|
|
62
62
|
AppPreferencesSchema,
|
|
63
63
|
ApplyCloudWorkItemLocalPatchRequestSchema,
|
|
64
64
|
ApplyCreateImproveRunActionRequestSchema,
|
|
65
|
+
BaseModelCandidateSchema,
|
|
66
|
+
BaseModelPreferenceSchema,
|
|
65
67
|
BaselineReportSchema,
|
|
66
68
|
BootstrapPayloadSchema,
|
|
67
69
|
CROSS_SYSTEM_BOOTSTRAP_SYSTEM_PROMPT,
|
|
@@ -310,7 +312,7 @@ import {
|
|
|
310
312
|
saveProfilePushStatus,
|
|
311
313
|
workspacePathFromLocalPathWorkspaceId,
|
|
312
314
|
writeSourceUploadCache
|
|
313
|
-
} from "./chunk-
|
|
315
|
+
} from "./chunk-G7XOSECC.js";
|
|
314
316
|
import {
|
|
315
317
|
CONNECTED_APP_PROVIDER_TOOL_NAMES,
|
|
316
318
|
CONNECTED_APP_TOOL_CALL_ENDPOINT,
|
|
@@ -2985,7 +2987,7 @@ var require_websocket = __commonJS({
|
|
|
2985
2987
|
var http = __require("http");
|
|
2986
2988
|
var net = __require("net");
|
|
2987
2989
|
var tls = __require("tls");
|
|
2988
|
-
var { randomBytes: randomBytes5, createHash:
|
|
2990
|
+
var { randomBytes: randomBytes5, createHash: createHash15 } = __require("crypto");
|
|
2989
2991
|
var { Duplex, Readable } = __require("stream");
|
|
2990
2992
|
var { URL: URL2 } = __require("url");
|
|
2991
2993
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -3653,7 +3655,7 @@ var require_websocket = __commonJS({
|
|
|
3653
3655
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
3654
3656
|
return;
|
|
3655
3657
|
}
|
|
3656
|
-
const digest =
|
|
3658
|
+
const digest = createHash15("sha1").update(key + GUID).digest("base64");
|
|
3657
3659
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
3658
3660
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
3659
3661
|
return;
|
|
@@ -4022,7 +4024,7 @@ var require_websocket_server = __commonJS({
|
|
|
4022
4024
|
var EventEmitter = __require("events");
|
|
4023
4025
|
var http = __require("http");
|
|
4024
4026
|
var { Duplex } = __require("stream");
|
|
4025
|
-
var { createHash:
|
|
4027
|
+
var { createHash: createHash15 } = __require("crypto");
|
|
4026
4028
|
var extension2 = require_extension();
|
|
4027
4029
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
4028
4030
|
var subprotocol2 = require_subprotocol();
|
|
@@ -4329,7 +4331,7 @@ var require_websocket_server = __commonJS({
|
|
|
4329
4331
|
);
|
|
4330
4332
|
}
|
|
4331
4333
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
4332
|
-
const digest =
|
|
4334
|
+
const digest = createHash15("sha1").update(key + GUID).digest("base64");
|
|
4333
4335
|
const headers = [
|
|
4334
4336
|
"HTTP/1.1 101 Switching Protocols",
|
|
4335
4337
|
"Upgrade: websocket",
|
|
@@ -24824,7 +24826,7 @@ async function resolveCodexBinary(binaryPath) {
|
|
|
24824
24826
|
} catch {
|
|
24825
24827
|
return null;
|
|
24826
24828
|
}
|
|
24827
|
-
}))).filter((
|
|
24829
|
+
}))).filter((candidate3) => Boolean(candidate3));
|
|
24828
24830
|
candidates.sort((left, right) => {
|
|
24829
24831
|
const versionDelta = compareVersionParts(right.versionParts, left.versionParts);
|
|
24830
24832
|
if (versionDelta !== 0)
|
|
@@ -25289,7 +25291,7 @@ function trustedProviderContextLimit(input) {
|
|
|
25289
25291
|
const hostedProvider = hostedContextProvider(input.provider);
|
|
25290
25292
|
if (hostedProvider) return hostedContextLimit(hostedProvider, model);
|
|
25291
25293
|
const cache = input.settings?.modelCaches[input.provider];
|
|
25292
|
-
const cachedModel = cache?.models.find((
|
|
25294
|
+
const cachedModel = cache?.models.find((candidate3) => candidate3.id === model);
|
|
25293
25295
|
return cachedModel?.contextWindow ?? null;
|
|
25294
25296
|
}
|
|
25295
25297
|
function estimateHostedMessageTokens(messages) {
|
|
@@ -25945,13 +25947,13 @@ async function uniqueSoulFilename(storeDir, name) {
|
|
|
25945
25947
|
const directory = storeDir;
|
|
25946
25948
|
await fs2.mkdir(directory, { recursive: true });
|
|
25947
25949
|
const base = slugify(name);
|
|
25948
|
-
let
|
|
25950
|
+
let candidate3 = `soul-${base}.md`;
|
|
25949
25951
|
for (let index = 2; ; index += 1) {
|
|
25950
25952
|
try {
|
|
25951
|
-
await fs2.access(path3.join(directory,
|
|
25952
|
-
|
|
25953
|
+
await fs2.access(path3.join(directory, candidate3));
|
|
25954
|
+
candidate3 = `soul-${base}-${index}.md`;
|
|
25953
25955
|
} catch {
|
|
25954
|
-
return
|
|
25956
|
+
return candidate3;
|
|
25955
25957
|
}
|
|
25956
25958
|
}
|
|
25957
25959
|
}
|
|
@@ -26457,16 +26459,16 @@ function cleanStorageName(value) {
|
|
|
26457
26459
|
function uniqueSafeFileName(name, usedNames, fallbackIndex) {
|
|
26458
26460
|
const normalized = path5.basename(name).replace(/[^a-zA-Z0-9._ -]+/g, "-").trim();
|
|
26459
26461
|
const safeName = normalized || `attachment-${fallbackIndex}`;
|
|
26460
|
-
let
|
|
26462
|
+
let candidate3 = safeName;
|
|
26461
26463
|
let index = 2;
|
|
26462
|
-
while (usedNames.has(
|
|
26464
|
+
while (usedNames.has(candidate3)) {
|
|
26463
26465
|
const extension2 = path5.extname(safeName);
|
|
26464
26466
|
const base = extension2 ? safeName.slice(0, -extension2.length) : safeName;
|
|
26465
|
-
|
|
26467
|
+
candidate3 = `${base}-${index}${extension2}`;
|
|
26466
26468
|
index += 1;
|
|
26467
26469
|
}
|
|
26468
|
-
usedNames.add(
|
|
26469
|
-
return
|
|
26470
|
+
usedNames.add(candidate3);
|
|
26471
|
+
return candidate3;
|
|
26470
26472
|
}
|
|
26471
26473
|
function formatBytes(value) {
|
|
26472
26474
|
if (value < 1024) return `${value} B`;
|
|
@@ -27638,7 +27640,7 @@ function resolveOpenAiCompatibleProvider(input) {
|
|
|
27638
27640
|
if (!auth) {
|
|
27639
27641
|
throw new Error(missingApiKeyMessage(input.providerId, input.settings));
|
|
27640
27642
|
}
|
|
27641
|
-
const model = input.modelId?.trim() || config?.defaultModel?.trim() || cache?.models.find((
|
|
27643
|
+
const model = input.modelId?.trim() || config?.defaultModel?.trim() || cache?.models.find((candidate3) => candidate3.id.trim())?.id.trim() || "";
|
|
27642
27644
|
if (!model && input.requireModel !== false) {
|
|
27643
27645
|
throw new Error(`Provider ${input.providerId} requires a model.`);
|
|
27644
27646
|
}
|
|
@@ -30131,7 +30133,7 @@ var SqliteStoreCore = class {
|
|
|
30131
30133
|
}
|
|
30132
30134
|
if (currentVersion === CURRENT_SQLITE_SCHEMA_VERSION) return;
|
|
30133
30135
|
if (hadDatabase) await this.backupDatabaseFiles(storeDir, `before-v${currentVersion + 1}`);
|
|
30134
|
-
for (const migration of SQLITE_MIGRATIONS.filter((
|
|
30136
|
+
for (const migration of SQLITE_MIGRATIONS.filter((candidate3) => candidate3.version > currentVersion)) {
|
|
30135
30137
|
await this.exec("BEGIN IMMEDIATE");
|
|
30136
30138
|
try {
|
|
30137
30139
|
await migration.run(this);
|
|
@@ -31467,14 +31469,14 @@ var SqliteTrainingStore = class extends SqliteTrainingModelStore {
|
|
|
31467
31469
|
return this.getParsedPayload("SELECT payload FROM task_candidates WHERE profile_id = ? AND fingerprint = ?", [profileId, fingerprint], TaskCandidateSchema.parse);
|
|
31468
31470
|
}
|
|
31469
31471
|
async upsertTaskCandidate(candidateInput) {
|
|
31470
|
-
const
|
|
31472
|
+
const candidate3 = TaskCandidateSchema.parse(candidateInput);
|
|
31471
31473
|
await this.upsertPayload(
|
|
31472
31474
|
`INSERT INTO task_candidates (id, profile_id, status, fingerprint, payload, created_at, updated_at)
|
|
31473
31475
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
31474
31476
|
ON CONFLICT(id) DO UPDATE SET profile_id = excluded.profile_id, status = excluded.status, fingerprint = excluded.fingerprint, payload = excluded.payload, updated_at = excluded.updated_at`,
|
|
31475
|
-
[
|
|
31477
|
+
[candidate3.id, candidate3.profileId, candidate3.status, candidate3.fingerprint, JSON.stringify(candidate3), candidate3.createdAt, candidate3.updatedAt]
|
|
31476
31478
|
);
|
|
31477
|
-
return
|
|
31479
|
+
return candidate3;
|
|
31478
31480
|
}
|
|
31479
31481
|
async saveTaskAttempt(attemptInput) {
|
|
31480
31482
|
const attempt = TaskAttemptResultSchema.parse(attemptInput);
|
|
@@ -33075,7 +33077,7 @@ var SqliteStore = class extends SqliteCreateImproveStore {
|
|
|
33075
33077
|
async upsertApproval(approval) {
|
|
33076
33078
|
await this.ready;
|
|
33077
33079
|
const write2 = this.writeQueue.then(async () => {
|
|
33078
|
-
const index = this.data.approvals.findIndex((
|
|
33080
|
+
const index = this.data.approvals.findIndex((candidate3) => candidate3.id === approval.id);
|
|
33079
33081
|
const previousSessionId = index === -1 ? null : this.data.approvals[index].sessionId;
|
|
33080
33082
|
const sortIndex = index === -1 ? this.data.approvals.length : index;
|
|
33081
33083
|
await this.run(
|
|
@@ -34089,8 +34091,8 @@ function findImagePathValue(value, depth = 0, key = "") {
|
|
|
34089
34091
|
}
|
|
34090
34092
|
if (Array.isArray(value)) {
|
|
34091
34093
|
for (const item2 of value) {
|
|
34092
|
-
const
|
|
34093
|
-
if (
|
|
34094
|
+
const candidate3 = findImagePathValue(item2, depth + 1, key);
|
|
34095
|
+
if (candidate3) return candidate3;
|
|
34094
34096
|
}
|
|
34095
34097
|
return null;
|
|
34096
34098
|
}
|
|
@@ -34098,13 +34100,13 @@ function findImagePathValue(value, depth = 0, key = "") {
|
|
|
34098
34100
|
const record12 = value;
|
|
34099
34101
|
for (const [childKey, child] of Object.entries(record12)) {
|
|
34100
34102
|
if (!isImagePathKey(childKey)) continue;
|
|
34101
|
-
const
|
|
34102
|
-
if (
|
|
34103
|
+
const candidate3 = findImagePathValue(child, depth + 1, childKey);
|
|
34104
|
+
if (candidate3) return candidate3;
|
|
34103
34105
|
}
|
|
34104
34106
|
for (const [childKey, child] of Object.entries(record12)) {
|
|
34105
34107
|
if (isImagePathKey(childKey)) continue;
|
|
34106
|
-
const
|
|
34107
|
-
if (
|
|
34108
|
+
const candidate3 = findImagePathValue(child, depth + 1, childKey);
|
|
34109
|
+
if (candidate3) return candidate3;
|
|
34108
34110
|
}
|
|
34109
34111
|
return null;
|
|
34110
34112
|
}
|
|
@@ -35838,7 +35840,7 @@ async function readCodexHistoryThreadPayload(sessionId, options = {}) {
|
|
|
35838
35840
|
includeThreadId: threadId,
|
|
35839
35841
|
metadataLimit: 1
|
|
35840
35842
|
});
|
|
35841
|
-
thread = threads.find((
|
|
35843
|
+
thread = threads.find((candidate3) => candidate3.threadId === threadId);
|
|
35842
35844
|
}
|
|
35843
35845
|
if (!thread) throw new Error("Codex history session not found");
|
|
35844
35846
|
const parseInput = {
|
|
@@ -36910,11 +36912,11 @@ function localImagePathByName(name) {
|
|
|
36910
36912
|
path12.join(os4.homedir(), "Downloads", name),
|
|
36911
36913
|
path12.join(os4.homedir(), "Desktop", name)
|
|
36912
36914
|
];
|
|
36913
|
-
return candidates.find((
|
|
36914
|
-
const contentType2 = chatAttachmentImageContentType("",
|
|
36915
|
+
return candidates.find((candidate3) => {
|
|
36916
|
+
const contentType2 = chatAttachmentImageContentType("", candidate3);
|
|
36915
36917
|
if (!contentType2) return false;
|
|
36916
36918
|
try {
|
|
36917
|
-
const stat4 = statSync(
|
|
36919
|
+
const stat4 = statSync(candidate3);
|
|
36918
36920
|
return stat4.isFile() && stat4.size > 0 && stat4.size <= MAX_CODEX_HISTORY_IMAGE_BYTES;
|
|
36919
36921
|
} catch {
|
|
36920
36922
|
return false;
|
|
@@ -37157,7 +37159,7 @@ function createOpenPondCache(deps) {
|
|
|
37157
37159
|
}
|
|
37158
37160
|
async function upsertScaffoldApp(scope, app) {
|
|
37159
37161
|
const existing = await loadScaffoldApps(scope);
|
|
37160
|
-
const next2 = [app, ...existing.filter((
|
|
37162
|
+
const next2 = [app, ...existing.filter((candidate3) => candidate3.id !== app.id)];
|
|
37161
37163
|
await store.setCacheEntry("openpond.scaffoldApps", scope, next2);
|
|
37162
37164
|
}
|
|
37163
37165
|
async function mergeScaffoldApps(scope, apps) {
|
|
@@ -39449,10 +39451,10 @@ async function detectSandboxTemplateAt(rootPath) {
|
|
|
39449
39451
|
diagnostics: validation.diagnostics
|
|
39450
39452
|
};
|
|
39451
39453
|
}
|
|
39452
|
-
function addCandidate(candidates, seen,
|
|
39453
|
-
if (seen.has(
|
|
39454
|
-
seen.add(
|
|
39455
|
-
candidates.push(
|
|
39454
|
+
function addCandidate(candidates, seen, candidate3) {
|
|
39455
|
+
if (seen.has(candidate3)) return;
|
|
39456
|
+
seen.add(candidate3);
|
|
39457
|
+
candidates.push(candidate3);
|
|
39456
39458
|
}
|
|
39457
39459
|
async function collectSandboxTemplateCandidates(basePath, candidates, seen, depth) {
|
|
39458
39460
|
if (depth <= 0 || !await directoryExists2(basePath)) return;
|
|
@@ -39485,8 +39487,8 @@ async function detectLocalProjectSandboxTemplate(input) {
|
|
|
39485
39487
|
SANDBOX_TEMPLATE_SCAN_DEPTH
|
|
39486
39488
|
);
|
|
39487
39489
|
}
|
|
39488
|
-
for (const
|
|
39489
|
-
const detected = await detectSandboxTemplateAt(
|
|
39490
|
+
for (const candidate3 of candidates) {
|
|
39491
|
+
const detected = await detectSandboxTemplateAt(candidate3);
|
|
39490
39492
|
if (detected) return detected;
|
|
39491
39493
|
}
|
|
39492
39494
|
return null;
|
|
@@ -39703,7 +39705,7 @@ async function ensureSystemLocalProject(store, input) {
|
|
|
39703
39705
|
};
|
|
39704
39706
|
const unchanged = existing && existing.path === project.path && existing.workspacePath === project.workspacePath && existing.systemKind === project.systemKind && existing.hiddenFromDefaultSidebar === project.hiddenFromDefaultSidebar;
|
|
39705
39707
|
if (!unchanged) {
|
|
39706
|
-
await saveLocalProjects(store, [project, ...projects.filter((
|
|
39708
|
+
await saveLocalProjects(store, [project, ...projects.filter((candidate3) => candidate3.id !== project.id)]);
|
|
39707
39709
|
}
|
|
39708
39710
|
return unchanged ? existing : project;
|
|
39709
39711
|
}
|
|
@@ -39732,7 +39734,7 @@ async function upsertLocalProject(store, payload, options = {}) {
|
|
|
39732
39734
|
createdAt: existing?.createdAt ?? timestamp2,
|
|
39733
39735
|
updatedAt: timestamp2
|
|
39734
39736
|
};
|
|
39735
|
-
await saveLocalProjects(store, [project, ...projects.filter((
|
|
39737
|
+
await saveLocalProjects(store, [project, ...projects.filter((candidate3) => candidate3.id !== project.id)]);
|
|
39736
39738
|
return { project, created: !existing };
|
|
39737
39739
|
}
|
|
39738
39740
|
async function findLocalProject(store, projectId) {
|
|
@@ -40824,9 +40826,9 @@ var WorkspaceLspManager = class {
|
|
|
40824
40826
|
evictLeastRecentlyUsedClients(requiredSlots) {
|
|
40825
40827
|
let evicted = 0;
|
|
40826
40828
|
while (this.clients.size + requiredSlots > this.maxClients) {
|
|
40827
|
-
const
|
|
40828
|
-
if (!
|
|
40829
|
-
const [key, slot] =
|
|
40829
|
+
const candidate3 = Array.from(this.clients.entries()).filter(([, slot2]) => Boolean(slot2.client)).sort((left, right) => left[1].lastUsedAtMs - right[1].lastUsedAtMs)[0];
|
|
40830
|
+
if (!candidate3) break;
|
|
40831
|
+
const [key, slot] = candidate3;
|
|
40830
40832
|
slot.client?.shutdown();
|
|
40831
40833
|
this.clients.delete(key);
|
|
40832
40834
|
evicted += 1;
|
|
@@ -41258,16 +41260,16 @@ async function findExecutable(command, root, repoPath) {
|
|
|
41258
41260
|
const stop = path18.resolve(repoPath);
|
|
41259
41261
|
while (current === stop || current.startsWith(`${stop}${path18.sep}`)) {
|
|
41260
41262
|
for (const suffix of suffixes) {
|
|
41261
|
-
const
|
|
41262
|
-
if (await executableExists(
|
|
41263
|
+
const candidate3 = path18.join(current, "node_modules", ".bin", `${command}${suffix}`);
|
|
41264
|
+
if (await executableExists(candidate3)) return candidate3;
|
|
41263
41265
|
}
|
|
41264
41266
|
if (current === stop) break;
|
|
41265
41267
|
current = path18.dirname(current);
|
|
41266
41268
|
}
|
|
41267
41269
|
for (const entry of (process.env.PATH ?? "").split(path18.delimiter).filter(Boolean)) {
|
|
41268
41270
|
for (const suffix of suffixes) {
|
|
41269
|
-
const
|
|
41270
|
-
if (await executableExists(
|
|
41271
|
+
const candidate3 = path18.join(entry, `${command}${suffix}`);
|
|
41272
|
+
if (await executableExists(candidate3)) return candidate3;
|
|
41271
41273
|
}
|
|
41272
41274
|
}
|
|
41273
41275
|
return null;
|
|
@@ -41276,8 +41278,8 @@ async function findModuleFile(modulePath, root, repoPath) {
|
|
|
41276
41278
|
let current = root;
|
|
41277
41279
|
const stop = path18.resolve(repoPath);
|
|
41278
41280
|
while (current === stop || current.startsWith(`${stop}${path18.sep}`)) {
|
|
41279
|
-
const
|
|
41280
|
-
if (await fileExists3(
|
|
41281
|
+
const candidate3 = path18.join(current, "node_modules", modulePath);
|
|
41282
|
+
if (await fileExists3(candidate3)) return candidate3;
|
|
41281
41283
|
if (current === stop) break;
|
|
41282
41284
|
current = path18.dirname(current);
|
|
41283
41285
|
}
|
|
@@ -41288,8 +41290,8 @@ async function resolveCustomExecutable(command, root, repoPath) {
|
|
|
41288
41290
|
const trimmed = command.trim();
|
|
41289
41291
|
if (!trimmed) return null;
|
|
41290
41292
|
if (path18.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\")) {
|
|
41291
|
-
const
|
|
41292
|
-
return await executableExists(
|
|
41293
|
+
const candidate3 = path18.isAbsolute(trimmed) ? trimmed : path18.resolve(root, trimmed);
|
|
41294
|
+
return await executableExists(candidate3) ? candidate3 : null;
|
|
41293
41295
|
}
|
|
41294
41296
|
return findExecutable(trimmed, root, repoPath);
|
|
41295
41297
|
}
|
|
@@ -41340,8 +41342,8 @@ var serverDefinitions = [
|
|
|
41340
41342
|
async spawn(root, repoPath) {
|
|
41341
41343
|
const venvBin = process.platform === "win32" ? "Scripts" : "bin";
|
|
41342
41344
|
for (const venv of [process.env.VIRTUAL_ENV, path18.join(root, ".venv"), path18.join(root, "venv")].filter(Boolean)) {
|
|
41343
|
-
const
|
|
41344
|
-
if (await executableExists(
|
|
41345
|
+
const candidate3 = path18.join(venv, venvBin, process.platform === "win32" ? "pyright-langserver.cmd" : "pyright-langserver");
|
|
41346
|
+
if (await executableExists(candidate3)) return { command: candidate3, args: ["--stdio"] };
|
|
41345
41347
|
}
|
|
41346
41348
|
const command = await findExecutable("pyright-langserver", root, repoPath);
|
|
41347
41349
|
return command ? { command, args: ["--stdio"] } : null;
|
|
@@ -43027,37 +43029,37 @@ function sanitizeNpmPackageNameForVendor(packageName) {
|
|
|
43027
43029
|
function resolveLocalOpenPondAgentSdkMaterializationSource(projectPath, packageJson) {
|
|
43028
43030
|
const versionSpec = readOpenPondAgentSdkVersionSpec(packageJson);
|
|
43029
43031
|
if (versionSpec?.startsWith("file:")) {
|
|
43030
|
-
const
|
|
43031
|
-
if (isOpenPondAgentSdkPackageRoot(
|
|
43032
|
+
const candidate3 = path22.resolve(projectPath, versionSpec.slice("file:".length));
|
|
43033
|
+
if (isOpenPondAgentSdkPackageRoot(candidate3)) {
|
|
43032
43034
|
return {
|
|
43033
43035
|
kind: "package_root",
|
|
43034
|
-
packageRoot:
|
|
43035
|
-
dependencyBaseDir:
|
|
43036
|
-
packageJson: JSON.parse(readFileSyncUtf8(path22.join(
|
|
43036
|
+
packageRoot: candidate3,
|
|
43037
|
+
dependencyBaseDir: candidate3,
|
|
43038
|
+
packageJson: JSON.parse(readFileSyncUtf8(path22.join(candidate3, "package.json")))
|
|
43037
43039
|
};
|
|
43038
43040
|
}
|
|
43039
|
-
if (isLocalNpmTarball(
|
|
43040
|
-
const tarballContents = readFileSync3(
|
|
43041
|
+
if (isLocalNpmTarball(candidate3)) {
|
|
43042
|
+
const tarballContents = readFileSync3(candidate3);
|
|
43041
43043
|
const tarballPackageJson = readPackageJsonFromNpmTarball(tarballContents);
|
|
43042
43044
|
if (tarballPackageJson.name === "openpond-agent-sdk") {
|
|
43043
43045
|
return {
|
|
43044
43046
|
kind: "tarball",
|
|
43045
|
-
tarballPath:
|
|
43047
|
+
tarballPath: candidate3,
|
|
43046
43048
|
tarballContents,
|
|
43047
|
-
dependencyBaseDir: path22.dirname(
|
|
43049
|
+
dependencyBaseDir: path22.dirname(candidate3),
|
|
43048
43050
|
packageJson: tarballPackageJson
|
|
43049
43051
|
};
|
|
43050
43052
|
}
|
|
43051
43053
|
}
|
|
43052
43054
|
}
|
|
43053
43055
|
if (versionSpec?.startsWith("workspace:")) {
|
|
43054
|
-
const
|
|
43055
|
-
if (
|
|
43056
|
+
const candidate3 = findOpenPondAgentSdkPackageRootInAncestors(projectPath);
|
|
43057
|
+
if (candidate3) {
|
|
43056
43058
|
return {
|
|
43057
43059
|
kind: "package_root",
|
|
43058
|
-
packageRoot:
|
|
43059
|
-
dependencyBaseDir:
|
|
43060
|
-
packageJson: JSON.parse(readFileSyncUtf8(path22.join(
|
|
43060
|
+
packageRoot: candidate3,
|
|
43061
|
+
dependencyBaseDir: candidate3,
|
|
43062
|
+
packageJson: JSON.parse(readFileSyncUtf8(path22.join(candidate3, "package.json")))
|
|
43061
43063
|
};
|
|
43062
43064
|
}
|
|
43063
43065
|
}
|
|
@@ -43074,8 +43076,8 @@ function findOpenPondAgentSdkPackageRootInAncestors(projectPath) {
|
|
|
43074
43076
|
current = parent;
|
|
43075
43077
|
}
|
|
43076
43078
|
}
|
|
43077
|
-
function isOpenPondAgentSdkPackageRoot(
|
|
43078
|
-
const packageJsonPath = path22.join(
|
|
43079
|
+
function isOpenPondAgentSdkPackageRoot(candidate3) {
|
|
43080
|
+
const packageJsonPath = path22.join(candidate3, "package.json");
|
|
43079
43081
|
if (!existsSync5(packageJsonPath))
|
|
43080
43082
|
return false;
|
|
43081
43083
|
try {
|
|
@@ -43085,11 +43087,11 @@ function isOpenPondAgentSdkPackageRoot(candidate2) {
|
|
|
43085
43087
|
return false;
|
|
43086
43088
|
}
|
|
43087
43089
|
}
|
|
43088
|
-
function isLocalNpmTarball(
|
|
43089
|
-
if (!existsSync5(
|
|
43090
|
+
function isLocalNpmTarball(candidate3) {
|
|
43091
|
+
if (!existsSync5(candidate3))
|
|
43090
43092
|
return false;
|
|
43091
43093
|
try {
|
|
43092
|
-
return statSync2(
|
|
43094
|
+
return statSync2(candidate3).isFile() && (candidate3.endsWith(".tgz") || candidate3.endsWith(".tar.gz"));
|
|
43093
43095
|
} catch {
|
|
43094
43096
|
return false;
|
|
43095
43097
|
}
|
|
@@ -43729,7 +43731,7 @@ async function materializeHostedProfileAgentSource(input) {
|
|
|
43729
43731
|
if (!input.state.sourcePath) {
|
|
43730
43732
|
throw new Error("Active OpenPond profile is missing a source path.");
|
|
43731
43733
|
}
|
|
43732
|
-
const agent = input.state.agents.find((
|
|
43734
|
+
const agent = input.state.agents.find((candidate3) => candidate3.id === input.agentId);
|
|
43733
43735
|
if (!agent) {
|
|
43734
43736
|
throw new Error(`Profile agent not found for hosted materialization: ${input.agentId}`);
|
|
43735
43737
|
}
|
|
@@ -43848,7 +43850,7 @@ function resolveProfileAgentSourceRoot(sourcePath, agentPath) {
|
|
|
43848
43850
|
return normalized === "agent/agent.ts" || normalized.endsWith("/agent.ts") ? sourcePath : absolute;
|
|
43849
43851
|
}
|
|
43850
43852
|
function hostedEntrypointForProfileAgent(state, agentId) {
|
|
43851
|
-
const action = state.actionCatalog.find((
|
|
43853
|
+
const action = state.actionCatalog.find((candidate3) => candidate3.agentId === agentId && (candidate3.sourceActionId === "chat" || candidate3.name === "chat")) ?? state.actionCatalog.find((candidate3) => candidate3.agentId === agentId);
|
|
43852
43854
|
return {
|
|
43853
43855
|
scope: "action",
|
|
43854
43856
|
name: typeof action?.sourceActionId === "string" && action.sourceActionId || typeof action?.name === "string" && action.name || "chat"
|
|
@@ -45220,10 +45222,10 @@ function createServerPayloads(deps) {
|
|
|
45220
45222
|
}
|
|
45221
45223
|
async function findOpenPondApp(appId) {
|
|
45222
45224
|
let data = await loadOpenPondData();
|
|
45223
|
-
let app = data.apps.find((
|
|
45225
|
+
let app = data.apps.find((candidate3) => candidate3.id === appId);
|
|
45224
45226
|
if (!app) {
|
|
45225
45227
|
data = await loadOpenPondData({ force: true });
|
|
45226
|
-
app = data.apps.find((
|
|
45228
|
+
app = data.apps.find((candidate3) => candidate3.id === appId);
|
|
45227
45229
|
}
|
|
45228
45230
|
if (!app) throw new Error("OpenPond app not found");
|
|
45229
45231
|
return app;
|
|
@@ -50920,10 +50922,10 @@ function selectPortableModelArtifacts(artifacts) {
|
|
|
50920
50922
|
const normalized = providerFilename.replaceAll("\\", "/");
|
|
50921
50923
|
const name = path27.posix.basename(normalized);
|
|
50922
50924
|
if (!PORTABLE_MODEL_FILENAMES.has(name) && !SHARDED_ADAPTER_WEIGHTS_PATTERN.test(name)) continue;
|
|
50923
|
-
const
|
|
50925
|
+
const candidate3 = { artifact, name, providerFilename };
|
|
50924
50926
|
const current = selected.get(name);
|
|
50925
|
-
if (!current || shouldPreferArtifact(
|
|
50926
|
-
selected.set(name,
|
|
50927
|
+
if (!current || shouldPreferArtifact(candidate3, current)) {
|
|
50928
|
+
selected.set(name, candidate3);
|
|
50927
50929
|
}
|
|
50928
50930
|
}
|
|
50929
50931
|
return [...selected.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
@@ -51006,14 +51008,14 @@ function tarEntrySize(size) {
|
|
|
51006
51008
|
function tarPadding(size) {
|
|
51007
51009
|
return (TAR_BLOCK_BYTES - size % TAR_BLOCK_BYTES) % TAR_BLOCK_BYTES;
|
|
51008
51010
|
}
|
|
51009
|
-
function shouldPreferArtifact(
|
|
51010
|
-
const candidateDepth = artifactPathDepth(
|
|
51011
|
+
function shouldPreferArtifact(candidate3, current) {
|
|
51012
|
+
const candidateDepth = artifactPathDepth(candidate3.providerFilename);
|
|
51011
51013
|
const currentDepth = artifactPathDepth(current.providerFilename);
|
|
51012
51014
|
if (candidateDepth !== currentDepth) return candidateDepth < currentDepth;
|
|
51013
|
-
if (
|
|
51014
|
-
return
|
|
51015
|
+
if (candidate3.artifact.createdAt !== current.artifact.createdAt) {
|
|
51016
|
+
return candidate3.artifact.createdAt > current.artifact.createdAt;
|
|
51015
51017
|
}
|
|
51016
|
-
return
|
|
51018
|
+
return candidate3.artifact.id > current.artifact.id;
|
|
51017
51019
|
}
|
|
51018
51020
|
function artifactPathDepth(value) {
|
|
51019
51021
|
return value.replaceAll("\\", "/").split("/").filter(Boolean).length;
|
|
@@ -55142,10 +55144,10 @@ async function rankedSearchItems(repoPath, files, query, limit) {
|
|
|
55142
55144
|
const averageLength = documents.reduce((sum2, document) => sum2 + document.length, 0) / documents.length;
|
|
55143
55145
|
const candidates = [];
|
|
55144
55146
|
for (const document of documents) {
|
|
55145
|
-
const
|
|
55146
|
-
if (
|
|
55147
|
+
const candidate3 = rankedCandidate(document, queryTerms, documentFrequency, documents.length, averageLength);
|
|
55148
|
+
if (candidate3) candidates.push(candidate3);
|
|
55147
55149
|
}
|
|
55148
|
-
const items = candidates.sort((left, right) => right.score - left.score || left.document.filePath.localeCompare(right.document.filePath)).slice(0, limit).map((
|
|
55150
|
+
const items = candidates.sort((left, right) => right.score - left.score || left.document.filePath.localeCompare(right.document.filePath)).slice(0, limit).map((candidate3) => rankedSearchItem(candidate3, queryTerms, query));
|
|
55149
55151
|
return { items, truncated: candidates.length > limit };
|
|
55150
55152
|
}
|
|
55151
55153
|
async function rankedDocument(repoPath, filePath2, queryTerms) {
|
|
@@ -55181,19 +55183,19 @@ function rankedCandidate(document, queryTerms, documentFrequency, documentCount,
|
|
|
55181
55183
|
score += pathCoverageBoost(document, queryTerms);
|
|
55182
55184
|
return { document, matchedTerms, score };
|
|
55183
55185
|
}
|
|
55184
|
-
function rankedSearchItem(
|
|
55185
|
-
const bestLine = bestRankedLine(
|
|
55186
|
+
function rankedSearchItem(candidate3, queryTerms, query) {
|
|
55187
|
+
const bestLine = bestRankedLine(candidate3.document.content, queryTerms, query);
|
|
55186
55188
|
return {
|
|
55187
|
-
ref: workspaceFileRef(
|
|
55188
|
-
title:
|
|
55189
|
-
snippet: bestLine ? `${bestLine.line}: ${bestLine.text}` : `Matched terms: ${
|
|
55190
|
-
score: roundScore(
|
|
55189
|
+
ref: workspaceFileRef(candidate3.document.filePath),
|
|
55190
|
+
title: candidate3.document.filePath,
|
|
55191
|
+
snippet: bestLine ? `${bestLine.line}: ${bestLine.text}` : `Matched terms: ${candidate3.matchedTerms.join(", ")}`,
|
|
55192
|
+
score: roundScore(candidate3.score),
|
|
55191
55193
|
metadata: {
|
|
55192
55194
|
source: "workspace",
|
|
55193
55195
|
matchKind: "ranked",
|
|
55194
55196
|
searchMode: "ranked",
|
|
55195
|
-
path:
|
|
55196
|
-
matchedTerms:
|
|
55197
|
+
path: candidate3.document.filePath,
|
|
55198
|
+
matchedTerms: candidate3.matchedTerms,
|
|
55197
55199
|
...bestLine ? { line: bestLine.line } : {}
|
|
55198
55200
|
}
|
|
55199
55201
|
};
|
|
@@ -55501,7 +55503,7 @@ function readSessionResource(input) {
|
|
|
55501
55503
|
if (parsed.scope === "artifacts") {
|
|
55502
55504
|
const item2 = scopedEvents(input.events, input.sessionId).find((event2) => event2.id === parsed.identifier);
|
|
55503
55505
|
if (!item2) throw new Error(`Artifact event not found: ${parsed.identifier}`);
|
|
55504
|
-
const artifact = artifactResourcesFromEvent(item2).find((
|
|
55506
|
+
const artifact = artifactResourcesFromEvent(item2).find((candidate3) => candidate3.artifactRef === parsed.artifactRef);
|
|
55505
55507
|
if (!artifact) throw new Error(`Artifact resource not found: ${parsed.artifactRef}`);
|
|
55506
55508
|
const contentType2 = contentTypeForPath(artifact.artifactRef) ?? "application/octet-stream";
|
|
55507
55509
|
const contentText = artifact.contentText ?? null;
|
|
@@ -56065,8 +56067,8 @@ function goalContextDocumentForRef(events, sessionId, identifier) {
|
|
|
56065
56067
|
}
|
|
56066
56068
|
function goalContextDocumentsFromEvent(event2) {
|
|
56067
56069
|
const output = [];
|
|
56068
|
-
const add = (
|
|
56069
|
-
const record12 = asRecord11(
|
|
56070
|
+
const add = (candidate3) => {
|
|
56071
|
+
const record12 = asRecord11(candidate3);
|
|
56070
56072
|
if (!record12 || !looksLikeGoalContextDocument(record12)) return;
|
|
56071
56073
|
const source = asRecord11(record12.source);
|
|
56072
56074
|
const id = stringValue14(record12.id) ?? stringValue14(record12.documentId) ?? stringValue14(source?.path) ?? stringValue14(record12.title);
|
|
@@ -57959,8 +57961,8 @@ function boundedRecordMap(value, limit) {
|
|
|
57959
57961
|
const record12 = recordFromUnknown3(value);
|
|
57960
57962
|
if (!record12) return {};
|
|
57961
57963
|
const entries = [];
|
|
57962
|
-
for (const [key,
|
|
57963
|
-
const parsed = recordFromUnknown3(
|
|
57964
|
+
for (const [key, candidate3] of Object.entries(record12)) {
|
|
57965
|
+
const parsed = recordFromUnknown3(candidate3);
|
|
57964
57966
|
if (!parsed) continue;
|
|
57965
57967
|
entries.push([key, parsed]);
|
|
57966
57968
|
if (entries.length >= limit) break;
|
|
@@ -58420,14 +58422,14 @@ Revision requested: ${action.revision}`,
|
|
|
58420
58422
|
if (run.state !== "awaiting_questions") {
|
|
58421
58423
|
throw new Error("Create/Improve run is not waiting for questions.");
|
|
58422
58424
|
}
|
|
58423
|
-
const question = run.questions.find((
|
|
58425
|
+
const question = run.questions.find((candidate3) => candidate3.id === action.questionId);
|
|
58424
58426
|
if (!question || question.status !== "pending") {
|
|
58425
58427
|
throw new Error("Create/Improve question is no longer pending.");
|
|
58426
58428
|
}
|
|
58427
|
-
const option = question.options.find((
|
|
58429
|
+
const option = question.options.find((candidate3) => candidate3.value === action.value);
|
|
58428
58430
|
const questions = run.questions.map(
|
|
58429
|
-
(
|
|
58430
|
-
...
|
|
58431
|
+
(candidate3) => candidate3.id === action.questionId ? {
|
|
58432
|
+
...candidate3,
|
|
58431
58433
|
status: "answered",
|
|
58432
58434
|
answer: {
|
|
58433
58435
|
value: action.value,
|
|
@@ -58436,10 +58438,10 @@ Revision requested: ${action.revision}`,
|
|
|
58436
58438
|
answeredAt: timestamp2,
|
|
58437
58439
|
metadata: {}
|
|
58438
58440
|
}
|
|
58439
|
-
} :
|
|
58441
|
+
} : candidate3
|
|
58440
58442
|
);
|
|
58441
58443
|
const remainingRequired = questions.some(
|
|
58442
|
-
(
|
|
58444
|
+
(candidate3) => candidate3.required && candidate3.status === "pending"
|
|
58443
58445
|
);
|
|
58444
58446
|
return nextCreateImproveRunRevision(run, {
|
|
58445
58447
|
state: remainingRequired ? "awaiting_questions" : "planning",
|
|
@@ -58454,15 +58456,15 @@ Revision requested: ${action.revision}`,
|
|
|
58454
58456
|
if (run.state !== "awaiting_promotion" && !retryingLocalVerification) {
|
|
58455
58457
|
throw new Error("Create/Improve candidate is not awaiting promotion.");
|
|
58456
58458
|
}
|
|
58457
|
-
const
|
|
58458
|
-
if (
|
|
58459
|
+
const candidate3 = requireRunCandidate(run, action.candidateId);
|
|
58460
|
+
if (candidate3.status !== "evaluated" || !candidate3.git?.headCommit) {
|
|
58459
58461
|
throw new Error("Create/Improve candidate must be committed and evaluated before it can be applied.");
|
|
58460
58462
|
}
|
|
58461
|
-
if (run.tasksetRef && (
|
|
58463
|
+
if (run.tasksetRef && (candidate3.tasksetRef?.id !== run.tasksetRef.id || candidate3.tasksetRef.revision !== run.tasksetRef.revision || candidate3.tasksetRef.contentHash !== run.tasksetRef.contentHash)) {
|
|
58462
58464
|
throw new Error("Create/Improve candidate is not linked to the exact approved Taskset revision.");
|
|
58463
58465
|
}
|
|
58464
58466
|
const candidateReceipts = run.evaluationReceipts.filter(
|
|
58465
|
-
(receipt) => receipt.candidateId ===
|
|
58467
|
+
(receipt) => receipt.candidateId === candidate3.id && receipt.subject === "candidate"
|
|
58466
58468
|
);
|
|
58467
58469
|
if (candidateReceipts.length === 0 || candidateReceipts.some(
|
|
58468
58470
|
(receipt) => receipt.status !== "passed" || receipt.publishGate === "failed"
|
|
@@ -58486,7 +58488,7 @@ Revision requested: ${action.revision}`,
|
|
|
58486
58488
|
...run.metadata,
|
|
58487
58489
|
releaseAction: {
|
|
58488
58490
|
type: action.type,
|
|
58489
|
-
candidateId:
|
|
58491
|
+
candidateId: candidate3.id,
|
|
58490
58492
|
requestedAt: timestamp2
|
|
58491
58493
|
}
|
|
58492
58494
|
},
|
|
@@ -58497,11 +58499,11 @@ Revision requested: ${action.revision}`,
|
|
|
58497
58499
|
if (!["pull_request_open", "blocked"].includes(run.state)) {
|
|
58498
58500
|
throw new Error("Create/Improve run has no open PR to reconcile.");
|
|
58499
58501
|
}
|
|
58500
|
-
const
|
|
58501
|
-
if (!
|
|
58502
|
+
const candidate3 = requireRunCandidate(run, action.candidateId);
|
|
58503
|
+
if (!candidate3.git?.pullRequest) {
|
|
58502
58504
|
throw new Error("Create/Improve candidate has no PR to reconcile.");
|
|
58503
58505
|
}
|
|
58504
|
-
if (run.state === "blocked" &&
|
|
58506
|
+
if (run.state === "blocked" && candidate3.git.pullRequest.state !== "merged") {
|
|
58505
58507
|
throw new Error("Only a merged PR with failed verification can be reconciled from a blocked run.");
|
|
58506
58508
|
}
|
|
58507
58509
|
return nextCreateImproveRunRevision(run, {
|
|
@@ -58511,7 +58513,7 @@ Revision requested: ${action.revision}`,
|
|
|
58511
58513
|
...run.metadata,
|
|
58512
58514
|
releaseAction: {
|
|
58513
58515
|
type: action.type,
|
|
58514
|
-
candidateId:
|
|
58516
|
+
candidateId: candidate3.id,
|
|
58515
58517
|
requestedAt: timestamp2
|
|
58516
58518
|
}
|
|
58517
58519
|
},
|
|
@@ -58522,9 +58524,9 @@ Revision requested: ${action.revision}`,
|
|
|
58522
58524
|
if (!["awaiting_promotion", "pull_request_open"].includes(run.state)) {
|
|
58523
58525
|
throw new Error("Create/Improve candidate is not available for rejection.");
|
|
58524
58526
|
}
|
|
58525
|
-
const
|
|
58527
|
+
const candidate3 = requireRunCandidate(run, action.candidateId);
|
|
58526
58528
|
const reason = action.reason?.trim() || "Candidate rejected.";
|
|
58527
|
-
if (
|
|
58529
|
+
if (candidate3.git?.pullRequest) {
|
|
58528
58530
|
return nextCreateImproveRunRevision(run, {
|
|
58529
58531
|
state: "reconciling_release",
|
|
58530
58532
|
blockedReason: null,
|
|
@@ -58532,7 +58534,7 @@ Revision requested: ${action.revision}`,
|
|
|
58532
58534
|
...run.metadata,
|
|
58533
58535
|
releaseAction: {
|
|
58534
58536
|
type: action.type,
|
|
58535
|
-
candidateId:
|
|
58537
|
+
candidateId: candidate3.id,
|
|
58536
58538
|
reason,
|
|
58537
58539
|
requestedAt: timestamp2
|
|
58538
58540
|
}
|
|
@@ -58543,7 +58545,7 @@ Revision requested: ${action.revision}`,
|
|
|
58543
58545
|
return nextCreateImproveRunRevision(run, {
|
|
58544
58546
|
state: "rejected",
|
|
58545
58547
|
candidates: run.candidates.map(
|
|
58546
|
-
(item2) => item2.id ===
|
|
58548
|
+
(item2) => item2.id === candidate3.id ? { ...item2, status: "rejected", updatedAt: timestamp2 } : item2
|
|
58547
58549
|
),
|
|
58548
58550
|
releaseOutcome: {
|
|
58549
58551
|
...run.releaseOutcome,
|
|
@@ -58555,7 +58557,7 @@ Revision requested: ${action.revision}`,
|
|
|
58555
58557
|
...run.metadata,
|
|
58556
58558
|
releaseAction: {
|
|
58557
58559
|
type: action.type,
|
|
58558
|
-
candidateId:
|
|
58560
|
+
candidateId: candidate3.id,
|
|
58559
58561
|
reason,
|
|
58560
58562
|
completedAt: timestamp2
|
|
58561
58563
|
}
|
|
@@ -58584,11 +58586,11 @@ Revision requested: ${action.revision}`,
|
|
|
58584
58586
|
}, action.actionId);
|
|
58585
58587
|
}
|
|
58586
58588
|
function requireRunCandidate(run, candidateId) {
|
|
58587
|
-
const
|
|
58588
|
-
if (!
|
|
58589
|
+
const candidate3 = run.candidates.find((item2) => item2.id === candidateId);
|
|
58590
|
+
if (!candidate3) {
|
|
58589
58591
|
throw new Error(`Create/Improve candidate not found: ${candidateId}`);
|
|
58590
58592
|
}
|
|
58591
|
-
return
|
|
58593
|
+
return candidate3;
|
|
58592
58594
|
}
|
|
58593
58595
|
function createPlanExecutionRunForApprovedAdapter(run, session) {
|
|
58594
58596
|
if (run.state !== "applying_source" || run.plan?.status !== "approved" || run.adapter.kind === "local") {
|
|
@@ -58681,7 +58683,7 @@ function withCreateImproveRun(turn, run) {
|
|
|
58681
58683
|
}
|
|
58682
58684
|
function resumeStateFromMetadata(run) {
|
|
58683
58685
|
if (run.state === "blocked" && run.operation === "improve" && run.target.kind === "agent" && run.candidates.some(
|
|
58684
|
-
(
|
|
58686
|
+
(candidate3) => Boolean(candidate3.git?.worktreePath) && ["draft", "checking"].includes(candidate3.status)
|
|
58685
58687
|
)) {
|
|
58686
58688
|
return "applying_source";
|
|
58687
58689
|
}
|
|
@@ -60603,11 +60605,11 @@ function normalizePlannerSourcePlanOperation(value) {
|
|
|
60603
60605
|
function extractJsonObject(content) {
|
|
60604
60606
|
const trimmed = content.trim();
|
|
60605
60607
|
const fenced = /^```(?:json)?\s*([\s\S]*?)\s*```$/i.exec(trimmed);
|
|
60606
|
-
const
|
|
60607
|
-
if (
|
|
60608
|
-
const start =
|
|
60609
|
-
const end =
|
|
60610
|
-
return start >= 0 && end > start ?
|
|
60608
|
+
const candidate3 = fenced?.[1]?.trim() ?? trimmed;
|
|
60609
|
+
if (candidate3.startsWith("{") && candidate3.endsWith("}")) return candidate3;
|
|
60610
|
+
const start = candidate3.indexOf("{");
|
|
60611
|
+
const end = candidate3.lastIndexOf("}");
|
|
60612
|
+
return start >= 0 && end > start ? candidate3.slice(start, end + 1) : null;
|
|
60611
60613
|
}
|
|
60612
60614
|
function targetIdFromObjective(objective) {
|
|
60613
60615
|
return normalizeTargetId(
|
|
@@ -60797,16 +60799,16 @@ async function applyApprovedLocalCreateImproveRun(snapshot, options = {}) {
|
|
|
60797
60799
|
blockedReason: null,
|
|
60798
60800
|
checkRefs: checkResult.checkRefs,
|
|
60799
60801
|
candidates: runningChecks.candidates.map(
|
|
60800
|
-
(
|
|
60801
|
-
...
|
|
60802
|
+
(candidate3) => candidate3.id === candidateId ? {
|
|
60803
|
+
...candidate3,
|
|
60802
60804
|
status: "accepted",
|
|
60803
|
-
checkRefs: mergeRefs(
|
|
60805
|
+
checkRefs: mergeRefs(candidate3.checkRefs, checkResult.checkRefs),
|
|
60804
60806
|
evaluationReceiptRefs: mergeRefs(
|
|
60805
|
-
|
|
60807
|
+
candidate3.evaluationReceiptRefs,
|
|
60806
60808
|
[evaluationReceiptId]
|
|
60807
60809
|
),
|
|
60808
60810
|
updatedAt: completedAt
|
|
60809
|
-
} :
|
|
60811
|
+
} : candidate3
|
|
60810
60812
|
),
|
|
60811
60813
|
evaluationReceipts: [
|
|
60812
60814
|
...runningChecks.evaluationReceipts.filter((receipt) => receipt.id !== evaluationReceiptId),
|
|
@@ -62852,7 +62854,7 @@ async function authorAgentImprovementCandidate(run, context, services = {}) {
|
|
|
62852
62854
|
const authoringExecutionId = `candidate_authoring_${candidateId}`;
|
|
62853
62855
|
const evaluationExecutionId = `evaluation_${candidateId}_${run.tasksetRef?.revision ?? "sdk"}`;
|
|
62854
62856
|
const existingCandidate = run.candidates.find(
|
|
62855
|
-
(
|
|
62857
|
+
(candidate3) => candidate3.id === candidateId && Boolean(candidate3.git?.worktreePath) && ["draft", "checking"].includes(candidate3.status)
|
|
62856
62858
|
);
|
|
62857
62859
|
const workspace = existingCandidate?.git ? restoreAgentImprovementWorkspace(activeTarget, existingCandidate.git) : await (services.prepareWorkspace ?? prepareAgentImprovementWorkspace)({
|
|
62858
62860
|
run,
|
|
@@ -62867,7 +62869,7 @@ async function authorAgentImprovementCandidate(run, context, services = {}) {
|
|
|
62867
62869
|
if (!existingCandidate) {
|
|
62868
62870
|
current = nextCreateImproveRunRevision(run, {
|
|
62869
62871
|
candidates: [
|
|
62870
|
-
...run.candidates.filter((
|
|
62872
|
+
...run.candidates.filter((candidate3) => candidate3.id !== candidateId),
|
|
62871
62873
|
candidateRecord({
|
|
62872
62874
|
id: candidateId,
|
|
62873
62875
|
run,
|
|
@@ -62922,7 +62924,7 @@ async function authorAgentImprovementCandidate(run, context, services = {}) {
|
|
|
62922
62924
|
current = nextCreateImproveRunRevision(current, {
|
|
62923
62925
|
state: "running_checks",
|
|
62924
62926
|
candidates: current.candidates.map(
|
|
62925
|
-
(
|
|
62927
|
+
(candidate3) => candidate3.id === candidateId ? { ...candidate3, status: "checking", updatedAt: timestamp2() } : candidate3
|
|
62926
62928
|
),
|
|
62927
62929
|
metadata: {
|
|
62928
62930
|
...current.metadata,
|
|
@@ -62947,20 +62949,20 @@ async function authorAgentImprovementCandidate(run, context, services = {}) {
|
|
|
62947
62949
|
current = nextCreateImproveRunRevision(current, {
|
|
62948
62950
|
state: "evaluating",
|
|
62949
62951
|
candidates: current.candidates.map(
|
|
62950
|
-
(
|
|
62951
|
-
...
|
|
62952
|
+
(candidate3) => candidate3.id === candidateId ? {
|
|
62953
|
+
...candidate3,
|
|
62952
62954
|
status: "authored",
|
|
62953
62955
|
git: committedGit,
|
|
62954
|
-
sourceRefs: mergeRefs2(
|
|
62956
|
+
sourceRefs: mergeRefs2(candidate3.sourceRefs, [
|
|
62955
62957
|
`git:${committedGit.headCommit}`,
|
|
62956
62958
|
...committedGit.changedPaths
|
|
62957
62959
|
]),
|
|
62958
|
-
artifactRefs: mergeRefs2(
|
|
62960
|
+
artifactRefs: mergeRefs2(candidate3.artifactRefs, [
|
|
62959
62961
|
`git-diff:${committedGit.baseCommit}..${committedGit.headCommit}`
|
|
62960
62962
|
]),
|
|
62961
|
-
checkRefs: mergeRefs2(
|
|
62963
|
+
checkRefs: mergeRefs2(candidate3.checkRefs, checkResult.checkRefs),
|
|
62962
62964
|
updatedAt: timestamp2()
|
|
62963
|
-
} :
|
|
62965
|
+
} : candidate3
|
|
62964
62966
|
),
|
|
62965
62967
|
checkRefs: mergeRefs2(current.checkRefs, checkResult.checkRefs),
|
|
62966
62968
|
sourceRefs: mergeRefs2(current.sourceRefs, [
|
|
@@ -63041,13 +63043,13 @@ async function authorAgentImprovementCandidate(run, context, services = {}) {
|
|
|
63041
63043
|
return nextCreateImproveRunRevision(current, {
|
|
63042
63044
|
state: "awaiting_promotion",
|
|
63043
63045
|
candidates: current.candidates.map(
|
|
63044
|
-
(
|
|
63045
|
-
...
|
|
63046
|
+
(candidate3) => candidate3.id === candidateId ? {
|
|
63047
|
+
...candidate3,
|
|
63046
63048
|
status: "evaluated",
|
|
63047
63049
|
git: committedGit,
|
|
63048
|
-
evaluationReceiptRefs: mergeRefs2(
|
|
63050
|
+
evaluationReceiptRefs: mergeRefs2(candidate3.evaluationReceiptRefs, receiptIds),
|
|
63049
63051
|
updatedAt: completedAt
|
|
63050
|
-
} :
|
|
63052
|
+
} : candidate3
|
|
63051
63053
|
),
|
|
63052
63054
|
evaluationReceipts: [
|
|
63053
63055
|
...current.evaluationReceipts.filter((receipt) => !receiptIds.includes(receipt.id)),
|
|
@@ -63148,14 +63150,14 @@ function publicTasksetAuthoringContext(run, taskset) {
|
|
|
63148
63150
|
}
|
|
63149
63151
|
};
|
|
63150
63152
|
}
|
|
63151
|
-
function assertMatchedTasksetExecutions(run, active,
|
|
63153
|
+
function assertMatchedTasksetExecutions(run, active, candidate3) {
|
|
63152
63154
|
if (!run.tasksetRef) return;
|
|
63153
|
-
for (const receipt of [active,
|
|
63155
|
+
for (const receipt of [active, candidate3]) {
|
|
63154
63156
|
if (receipt.tasksetId !== run.tasksetRef.id || receipt.tasksetHash !== run.tasksetRef.contentHash || receipt.metadata.trustedTasksetExecution !== true) {
|
|
63155
63157
|
throw new Error("Agent comparison did not use the exact approved trusted Taskset execution.");
|
|
63156
63158
|
}
|
|
63157
63159
|
}
|
|
63158
|
-
if (typeof active.metadata.executionContractHash !== "string" || active.metadata.executionContractHash !==
|
|
63160
|
+
if (typeof active.metadata.executionContractHash !== "string" || active.metadata.executionContractHash !== candidate3.metadata.executionContractHash) {
|
|
63159
63161
|
throw new Error("Active and candidate Agent evaluations used different Taskset execution contracts.");
|
|
63160
63162
|
}
|
|
63161
63163
|
}
|
|
@@ -63285,31 +63287,31 @@ function attachModelTargetRefs(input) {
|
|
|
63285
63287
|
}));
|
|
63286
63288
|
const candidateEvaluationReceiptIds = evaluationReceipts.filter(({ evaluation }) => evaluation.subject === "candidate").map(({ id }) => id);
|
|
63287
63289
|
const modelCandidates = input.run.candidates.filter(
|
|
63288
|
-
(
|
|
63290
|
+
(candidate3) => candidate3.target.kind === "model"
|
|
63289
63291
|
);
|
|
63290
63292
|
const existingModelCandidate = modelCandidates.find(
|
|
63291
|
-
(
|
|
63293
|
+
(candidate3) => candidate3.target.kind === "model" && candidate3.target.trainingJobId === target.trainingJobId
|
|
63292
63294
|
) ?? modelCandidates.find(
|
|
63293
|
-
(
|
|
63295
|
+
(candidate3) => candidate3.target.kind === "model" && !candidate3.target.trainingJobId && !candidate3.target.artifactId
|
|
63294
63296
|
);
|
|
63295
63297
|
const priorModelCandidate = modelCandidates.at(-1) ?? null;
|
|
63296
63298
|
const modelCandidateId = existingModelCandidate?.id ?? (modelCandidates.length && target.trainingJobId ? `model_candidate_${input.run.id}_${target.trainingJobId}` : `model_candidate_${input.run.id}`);
|
|
63297
|
-
const updateModelCandidate = (
|
|
63298
|
-
...
|
|
63299
|
+
const updateModelCandidate = (candidate3) => ({
|
|
63300
|
+
...candidate3,
|
|
63299
63301
|
target,
|
|
63300
|
-
status: evaluationReceipts.length ? "evaluated" :
|
|
63301
|
-
tasksetRef:
|
|
63302
|
-
sourceRefs: input.run.tasksetRef ? [.../* @__PURE__ */ new Set([...
|
|
63303
|
-
artifactRefs: target.artifactId ? [.../* @__PURE__ */ new Set([...
|
|
63304
|
-
evaluationReceiptRefs: candidateEvaluationReceiptIds.length ? [.../* @__PURE__ */ new Set([...
|
|
63302
|
+
status: evaluationReceipts.length ? "evaluated" : candidate3.status,
|
|
63303
|
+
tasksetRef: candidate3.tasksetRef ?? input.run.tasksetRef,
|
|
63304
|
+
sourceRefs: input.run.tasksetRef ? [.../* @__PURE__ */ new Set([...candidate3.sourceRefs, input.run.tasksetRef.id])] : candidate3.sourceRefs,
|
|
63305
|
+
artifactRefs: target.artifactId ? [.../* @__PURE__ */ new Set([...candidate3.artifactRefs, target.artifactId])] : candidate3.artifactRefs,
|
|
63306
|
+
evaluationReceiptRefs: candidateEvaluationReceiptIds.length ? [.../* @__PURE__ */ new Set([...candidate3.evaluationReceiptRefs, ...candidateEvaluationReceiptIds])] : candidate3.evaluationReceiptRefs,
|
|
63305
63307
|
updatedAt: timestamp2,
|
|
63306
63308
|
metadata: {
|
|
63307
|
-
...
|
|
63309
|
+
...candidate3.metadata,
|
|
63308
63310
|
trainingPlanId: target.trainingPlanId,
|
|
63309
63311
|
trainingJobId: target.trainingJobId
|
|
63310
63312
|
}
|
|
63311
63313
|
});
|
|
63312
|
-
const candidates = existingModelCandidate ? input.run.candidates.map((
|
|
63314
|
+
const candidates = existingModelCandidate ? input.run.candidates.map((candidate3) => candidate3.id === existingModelCandidate.id ? updateModelCandidate(candidate3) : candidate3) : [
|
|
63313
63315
|
...input.run.candidates,
|
|
63314
63316
|
updateModelCandidate({
|
|
63315
63317
|
id: modelCandidateId,
|
|
@@ -63421,8 +63423,8 @@ function isAgentImprovementReleaseAction(action) {
|
|
|
63421
63423
|
}
|
|
63422
63424
|
async function executeAgentImprovementReleaseAction(input) {
|
|
63423
63425
|
const timestamp2 = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
63424
|
-
const
|
|
63425
|
-
if (!
|
|
63426
|
+
const candidate3 = requireCandidate(input.run, input.action.candidateId);
|
|
63427
|
+
if (!candidate3.git) throw new Error("Agent candidate has no Git lineage.");
|
|
63426
63428
|
const activeTarget = resolveLocalCreatePipelineTarget(input.run);
|
|
63427
63429
|
let current = input.run;
|
|
63428
63430
|
try {
|
|
@@ -63434,7 +63436,7 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63434
63436
|
}) : await applyAgentImprovementCandidateLocally({
|
|
63435
63437
|
run: current,
|
|
63436
63438
|
repoPath: activeTarget.repoPath,
|
|
63437
|
-
git:
|
|
63439
|
+
git: candidate3.git,
|
|
63438
63440
|
command: input.command
|
|
63439
63441
|
});
|
|
63440
63442
|
let receipt2;
|
|
@@ -63449,8 +63451,8 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63449
63451
|
cwd: activeTarget.sourceRoot,
|
|
63450
63452
|
sourceRef: activeTarget.sourceRootRelativePath,
|
|
63451
63453
|
sourceCommit: profileCommit,
|
|
63452
|
-
sourceBranch:
|
|
63453
|
-
candidateId:
|
|
63454
|
+
sourceBranch: candidate3.git.baseBranch,
|
|
63455
|
+
candidateId: candidate3.id,
|
|
63454
63456
|
subject: "post_release",
|
|
63455
63457
|
taskset: taskset2,
|
|
63456
63458
|
gradeAttempt: input.gradeTaskAttempt
|
|
@@ -63472,7 +63474,7 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63472
63474
|
kind: "release",
|
|
63473
63475
|
id: profileCommit,
|
|
63474
63476
|
status: "verification_error",
|
|
63475
|
-
metadata: { candidateId:
|
|
63477
|
+
metadata: { candidateId: candidate3.id }
|
|
63476
63478
|
}),
|
|
63477
63479
|
blockedReason: `The change was applied locally, but its post-merge Evals could not run: ${message3}`,
|
|
63478
63480
|
metadata: {
|
|
@@ -63491,7 +63493,7 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63491
63493
|
const released2 = receipt2.status === "passed" && receipt2.publishGate === "passed";
|
|
63492
63494
|
const outcomeEvidence2 = released2 ? createOutcomeEvidenceSnapshot({
|
|
63493
63495
|
run: current,
|
|
63494
|
-
candidateId:
|
|
63496
|
+
candidateId: candidate3.id,
|
|
63495
63497
|
outcome: "released",
|
|
63496
63498
|
reason: "The promoted Agent passed trusted post-release Taskset evaluation.",
|
|
63497
63499
|
receiptRefs: [receipt2.id],
|
|
@@ -63500,20 +63502,20 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63500
63502
|
if (released2) {
|
|
63501
63503
|
await cleanupAgentImprovementWorkspace({
|
|
63502
63504
|
repoPath: activeTarget.repoPath,
|
|
63503
|
-
git:
|
|
63505
|
+
git: candidate3.git,
|
|
63504
63506
|
command: input.command
|
|
63505
63507
|
}).catch(() => void 0);
|
|
63506
63508
|
}
|
|
63507
63509
|
return nextCreateImproveRunRevision(current, {
|
|
63508
63510
|
state: released2 ? "released" : "blocked",
|
|
63509
|
-
candidates: updateCandidate(current,
|
|
63511
|
+
candidates: updateCandidate(current, candidate3.id, {
|
|
63510
63512
|
status: released2 ? "accepted" : "evaluated",
|
|
63511
63513
|
git: {
|
|
63512
|
-
...
|
|
63513
|
-
worktreePath: released2 ? null :
|
|
63514
|
+
...candidate3.git,
|
|
63515
|
+
worktreePath: released2 ? null : candidate3.git.worktreePath
|
|
63514
63516
|
},
|
|
63515
63517
|
evaluationReceiptRefs: unique([
|
|
63516
|
-
...
|
|
63518
|
+
...candidate3.evaluationReceiptRefs,
|
|
63517
63519
|
receipt2.id
|
|
63518
63520
|
]),
|
|
63519
63521
|
updatedAt: releasedAt2
|
|
@@ -63537,7 +63539,7 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63537
63539
|
id: profileCommit,
|
|
63538
63540
|
status: released2 ? "released" : "verification_failed",
|
|
63539
63541
|
metadata: {
|
|
63540
|
-
candidateId:
|
|
63542
|
+
candidateId: candidate3.id,
|
|
63541
63543
|
verificationReceiptId: receipt2.id
|
|
63542
63544
|
}
|
|
63543
63545
|
}),
|
|
@@ -63557,15 +63559,15 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63557
63559
|
if (input.action.type === "open_pull_request") {
|
|
63558
63560
|
const pullRequest2 = await openAgentImprovementPullRequest({
|
|
63559
63561
|
run: current,
|
|
63560
|
-
git:
|
|
63561
|
-
evaluationSummary: evaluationSummary(current,
|
|
63562
|
+
git: candidate3.git,
|
|
63563
|
+
evaluationSummary: evaluationSummary(current, candidate3),
|
|
63562
63564
|
command: input.command
|
|
63563
63565
|
});
|
|
63564
63566
|
const completedAt = timestamp2();
|
|
63565
63567
|
return nextCreateImproveRunRevision(current, {
|
|
63566
63568
|
state: "pull_request_open",
|
|
63567
|
-
candidates: updateCandidate(current,
|
|
63568
|
-
git: { ...
|
|
63569
|
+
candidates: updateCandidate(current, candidate3.id, {
|
|
63570
|
+
git: { ...candidate3.git, pullRequest: pullRequest2 },
|
|
63569
63571
|
updatedAt: completedAt
|
|
63570
63572
|
}),
|
|
63571
63573
|
releaseOutcome: {
|
|
@@ -63599,9 +63601,9 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63599
63601
|
}
|
|
63600
63602
|
if (input.action.type === "reject_candidate") {
|
|
63601
63603
|
const reason = input.action.reason?.trim() || "Candidate rejected.";
|
|
63602
|
-
if (
|
|
63604
|
+
if (candidate3.git.pullRequest) {
|
|
63603
63605
|
await closeAgentImprovementPullRequest({
|
|
63604
|
-
git:
|
|
63606
|
+
git: candidate3.git,
|
|
63605
63607
|
reason,
|
|
63606
63608
|
cwd: activeTarget.repoPath,
|
|
63607
63609
|
command: input.command
|
|
@@ -63609,38 +63611,38 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63609
63611
|
}
|
|
63610
63612
|
await cleanupAgentImprovementWorkspace({
|
|
63611
63613
|
repoPath: activeTarget.repoPath,
|
|
63612
|
-
git:
|
|
63614
|
+
git: candidate3.git,
|
|
63613
63615
|
command: input.command
|
|
63614
63616
|
}).catch(() => void 0);
|
|
63615
63617
|
const completedAt = timestamp2();
|
|
63616
63618
|
const outcomeEvidence2 = createOutcomeEvidenceSnapshot({
|
|
63617
63619
|
run: current,
|
|
63618
|
-
candidateId:
|
|
63620
|
+
candidateId: candidate3.id,
|
|
63619
63621
|
outcome: "rejected",
|
|
63620
63622
|
reason,
|
|
63621
|
-
receiptRefs:
|
|
63623
|
+
receiptRefs: candidate3.evaluationReceiptRefs,
|
|
63622
63624
|
timestamp: completedAt
|
|
63623
63625
|
});
|
|
63624
63626
|
return nextCreateImproveRunRevision(current, {
|
|
63625
63627
|
state: "rejected",
|
|
63626
|
-
candidates: updateCandidate(current,
|
|
63628
|
+
candidates: updateCandidate(current, candidate3.id, {
|
|
63627
63629
|
status: "rejected",
|
|
63628
|
-
git:
|
|
63629
|
-
...
|
|
63630
|
+
git: candidate3.git.pullRequest ? {
|
|
63631
|
+
...candidate3.git,
|
|
63630
63632
|
pullRequest: {
|
|
63631
|
-
...
|
|
63633
|
+
...candidate3.git.pullRequest,
|
|
63632
63634
|
state: "closed",
|
|
63633
63635
|
updatedAt: completedAt
|
|
63634
63636
|
},
|
|
63635
63637
|
worktreePath: null
|
|
63636
|
-
} : { ...
|
|
63638
|
+
} : { ...candidate3.git, worktreePath: null },
|
|
63637
63639
|
updatedAt: completedAt
|
|
63638
63640
|
}),
|
|
63639
63641
|
releaseOutcome: {
|
|
63640
63642
|
...current.releaseOutcome,
|
|
63641
63643
|
status: "rejected",
|
|
63642
|
-
pullRequest:
|
|
63643
|
-
...
|
|
63644
|
+
pullRequest: candidate3.git.pullRequest ? {
|
|
63645
|
+
...candidate3.git.pullRequest,
|
|
63644
63646
|
state: "closed",
|
|
63645
63647
|
updatedAt: completedAt
|
|
63646
63648
|
} : null,
|
|
@@ -63660,7 +63662,7 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63660
63662
|
});
|
|
63661
63663
|
}
|
|
63662
63664
|
const pullRequest = await inspectAgentImprovementPullRequest({
|
|
63663
|
-
git:
|
|
63665
|
+
git: candidate3.git,
|
|
63664
63666
|
cwd: activeTarget.repoPath,
|
|
63665
63667
|
command: input.command
|
|
63666
63668
|
});
|
|
@@ -63668,8 +63670,8 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63668
63670
|
const checkedAt = timestamp2();
|
|
63669
63671
|
return nextCreateImproveRunRevision(current, {
|
|
63670
63672
|
state: "pull_request_open",
|
|
63671
|
-
candidates: updateCandidate(current,
|
|
63672
|
-
git: { ...
|
|
63673
|
+
candidates: updateCandidate(current, candidate3.id, {
|
|
63674
|
+
git: { ...candidate3.git, pullRequest },
|
|
63673
63675
|
updatedAt: checkedAt
|
|
63674
63676
|
}),
|
|
63675
63677
|
releaseOutcome: {
|
|
@@ -63691,15 +63693,15 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63691
63693
|
if (pullRequest.state === "closed") {
|
|
63692
63694
|
await cleanupAgentImprovementWorkspace({
|
|
63693
63695
|
repoPath: activeTarget.repoPath,
|
|
63694
|
-
git:
|
|
63696
|
+
git: candidate3.git,
|
|
63695
63697
|
command: input.command
|
|
63696
63698
|
}).catch(() => void 0);
|
|
63697
63699
|
const closedAt = timestamp2();
|
|
63698
63700
|
return nextCreateImproveRunRevision(current, {
|
|
63699
63701
|
state: "rejected",
|
|
63700
|
-
candidates: updateCandidate(current,
|
|
63702
|
+
candidates: updateCandidate(current, candidate3.id, {
|
|
63701
63703
|
status: "rejected",
|
|
63702
|
-
git: { ...
|
|
63704
|
+
git: { ...candidate3.git, pullRequest, worktreePath: null },
|
|
63703
63705
|
updatedAt: closedAt
|
|
63704
63706
|
}),
|
|
63705
63707
|
releaseOutcome: {
|
|
@@ -63714,8 +63716,8 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63714
63716
|
}
|
|
63715
63717
|
const mergedCommit = await syncMergedAgentImprovement({
|
|
63716
63718
|
repoPath: activeTarget.repoPath,
|
|
63717
|
-
baseBranch:
|
|
63718
|
-
remoteName:
|
|
63719
|
+
baseBranch: candidate3.git.baseBranch,
|
|
63720
|
+
remoteName: candidate3.git.remoteName,
|
|
63719
63721
|
command: input.command
|
|
63720
63722
|
});
|
|
63721
63723
|
const taskset = current.tasksetRef ? await input.resolveTaskset?.(
|
|
@@ -63728,8 +63730,8 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63728
63730
|
cwd: activeTarget.sourceRoot,
|
|
63729
63731
|
sourceRef: activeTarget.sourceRootRelativePath,
|
|
63730
63732
|
sourceCommit: mergedCommit,
|
|
63731
|
-
sourceBranch:
|
|
63732
|
-
candidateId:
|
|
63733
|
+
sourceBranch: candidate3.git.baseBranch,
|
|
63734
|
+
candidateId: candidate3.id,
|
|
63733
63735
|
subject: "post_release",
|
|
63734
63736
|
taskset,
|
|
63735
63737
|
gradeAttempt: input.gradeTaskAttempt
|
|
@@ -63738,7 +63740,7 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63738
63740
|
const released = receipt.status === "passed" && receipt.publishGate === "passed";
|
|
63739
63741
|
const outcomeEvidence = released ? createOutcomeEvidenceSnapshot({
|
|
63740
63742
|
run: current,
|
|
63741
|
-
candidateId:
|
|
63743
|
+
candidateId: candidate3.id,
|
|
63742
63744
|
outcome: "released",
|
|
63743
63745
|
reason: "The promoted Agent passed trusted post-release Taskset evaluation.",
|
|
63744
63746
|
receiptRefs: [receipt.id],
|
|
@@ -63747,21 +63749,21 @@ async function executeAgentImprovementReleaseAction(input) {
|
|
|
63747
63749
|
if (released) {
|
|
63748
63750
|
await cleanupAgentImprovementWorkspace({
|
|
63749
63751
|
repoPath: activeTarget.repoPath,
|
|
63750
|
-
git:
|
|
63752
|
+
git: candidate3.git,
|
|
63751
63753
|
command: input.command
|
|
63752
63754
|
}).catch(() => void 0);
|
|
63753
63755
|
}
|
|
63754
63756
|
return nextCreateImproveRunRevision(current, {
|
|
63755
63757
|
state: released ? "released" : "blocked",
|
|
63756
|
-
candidates: updateCandidate(current,
|
|
63758
|
+
candidates: updateCandidate(current, candidate3.id, {
|
|
63757
63759
|
status: released ? "accepted" : "evaluated",
|
|
63758
63760
|
git: {
|
|
63759
|
-
...
|
|
63761
|
+
...candidate3.git,
|
|
63760
63762
|
pullRequest,
|
|
63761
|
-
worktreePath: released ? null :
|
|
63763
|
+
worktreePath: released ? null : candidate3.git.worktreePath
|
|
63762
63764
|
},
|
|
63763
63765
|
evaluationReceiptRefs: unique([
|
|
63764
|
-
...
|
|
63766
|
+
...candidate3.evaluationReceiptRefs,
|
|
63765
63767
|
receipt.id
|
|
63766
63768
|
]),
|
|
63767
63769
|
updatedAt: releasedAt
|
|
@@ -63829,7 +63831,7 @@ function uniqueEvidence(run, evidence) {
|
|
|
63829
63831
|
}
|
|
63830
63832
|
async function verifyAppliedProfileCommit(input) {
|
|
63831
63833
|
const command = input.command ?? (async (name, args, cwd, env) => {
|
|
63832
|
-
const { runWorkspaceCommand } = await import("./workspaces-
|
|
63834
|
+
const { runWorkspaceCommand } = await import("./workspaces-L73SRLPA.js");
|
|
63833
63835
|
return runWorkspaceCommand(name, args, cwd, env);
|
|
63834
63836
|
});
|
|
63835
63837
|
const result = await command("git", ["rev-parse", "HEAD"], input.repoPath);
|
|
@@ -63840,18 +63842,18 @@ async function verifyAppliedProfileCommit(input) {
|
|
|
63840
63842
|
return head;
|
|
63841
63843
|
}
|
|
63842
63844
|
function requireCandidate(run, candidateId) {
|
|
63843
|
-
const
|
|
63844
|
-
if (!
|
|
63845
|
-
return
|
|
63845
|
+
const candidate3 = run.candidates.find((item2) => item2.id === candidateId);
|
|
63846
|
+
if (!candidate3) throw new Error(`Create/Improve candidate not found: ${candidateId}`);
|
|
63847
|
+
return candidate3;
|
|
63846
63848
|
}
|
|
63847
63849
|
function updateCandidate(run, candidateId, patch) {
|
|
63848
63850
|
return run.candidates.map(
|
|
63849
|
-
(
|
|
63851
|
+
(candidate3) => candidate3.id === candidateId ? { ...candidate3, ...patch } : candidate3
|
|
63850
63852
|
);
|
|
63851
63853
|
}
|
|
63852
|
-
function evaluationSummary(run,
|
|
63854
|
+
function evaluationSummary(run, candidate3) {
|
|
63853
63855
|
const receipts = run.evaluationReceipts.filter(
|
|
63854
|
-
(receipt) => receipt.candidateId ===
|
|
63856
|
+
(receipt) => receipt.candidateId === candidate3.id && (receipt.subject === "active" || receipt.subject === "candidate")
|
|
63855
63857
|
);
|
|
63856
63858
|
return receipts.map((receipt) => {
|
|
63857
63859
|
const counts = receipt.summaryCounts;
|
|
@@ -67236,7 +67238,7 @@ function createSubagentContinuationRuntime(deps) {
|
|
|
67236
67238
|
const records = await deps2.listUsageRecords({ status: "completed" });
|
|
67237
67239
|
const totalTokens = subagentUsageTotal(records, runIds);
|
|
67238
67240
|
const roleTokens = subagentUsageTotal(records, roleRunIds);
|
|
67239
|
-
const role = input.preferences.subagents.roles.find((
|
|
67241
|
+
const role = input.preferences.subagents.roles.find((candidate3) => candidate3.id === input.roleId) ?? null;
|
|
67240
67242
|
return {
|
|
67241
67243
|
totalTokens,
|
|
67242
67244
|
roleTokens,
|
|
@@ -67277,7 +67279,7 @@ function createSubagentContinuationRuntime(deps) {
|
|
|
67277
67279
|
throw new Error(`Subagent run ${run.id} is linked to a different child conversation.`);
|
|
67278
67280
|
}
|
|
67279
67281
|
const preferences = await loadAppPreferences();
|
|
67280
|
-
const role = preferences.subagents.roles.find((
|
|
67282
|
+
const role = preferences.subagents.roles.find((candidate3) => candidate3.id === run.roleId);
|
|
67281
67283
|
if (!role?.enabled) throw new Error(`Subagent role ${run.roleId} is not enabled.`);
|
|
67282
67284
|
const budget = await subagentUsageBudgetForParent({
|
|
67283
67285
|
parentSessionId: run.parentSessionId,
|
|
@@ -68483,7 +68485,7 @@ function createSubagentToolRuntime(deps) {
|
|
|
68483
68485
|
const deps2 = requireSubagentDeps();
|
|
68484
68486
|
const preferences = await loadAppPreferences();
|
|
68485
68487
|
if (!preferences.subagents.enabled) throw new Error("Subagents are disabled in settings.");
|
|
68486
|
-
const role = preferences.subagents.roles.find((
|
|
68488
|
+
const role = preferences.subagents.roles.find((candidate3) => candidate3.id === input.roleId);
|
|
68487
68489
|
if (!role?.enabled) throw new Error(`Subagent role ${input.roleId} is not enabled.`);
|
|
68488
68490
|
const parentModelRef = context.model ? { providerId: context.provider, modelId: context.model } : null;
|
|
68489
68491
|
const modelRef = role.modelRef ?? preferences.subagents.defaultModelRef ?? parentModelRef ?? preferences.defaultChatModelRef ?? {
|
|
@@ -69146,7 +69148,7 @@ function createTurnRunner(deps) {
|
|
|
69146
69148
|
async function subagentExplorationSteeringPolicyForSession(session, preferences) {
|
|
69147
69149
|
if (!session.subagentRoleId) return SubagentExplorationSteeringPolicySchema.parse({});
|
|
69148
69150
|
const resolvedPreferences = preferences ?? await loadAppPreferences();
|
|
69149
|
-
const role = resolvedPreferences.subagents.roles.find((
|
|
69151
|
+
const role = resolvedPreferences.subagents.roles.find((candidate3) => candidate3.id === session.subagentRoleId);
|
|
69150
69152
|
return role?.explorationSteering ?? SubagentExplorationSteeringPolicySchema.parse({});
|
|
69151
69153
|
}
|
|
69152
69154
|
function actionCatalogInstructionModeForProvider(provider) {
|
|
@@ -69770,8 +69772,8 @@ function createTurnRunner(deps) {
|
|
|
69770
69772
|
const providerTurnId = `${session.provider}-${turn.id}`;
|
|
69771
69773
|
const model = turnModelRef?.modelId ?? input.model ?? null;
|
|
69772
69774
|
const providerSettings = loadProviderSettings ? await loadProviderSettings() : null;
|
|
69773
|
-
const runtimeModel = model ?? providerSettings?.providers[session.provider]?.defaultModel ?? providerSettings?.modelCaches[session.provider]?.models.find((
|
|
69774
|
-
const providerModel = providerSettings?.modelCaches[session.provider]?.models.find((
|
|
69775
|
+
const runtimeModel = model ?? providerSettings?.providers[session.provider]?.defaultModel ?? providerSettings?.modelCaches[session.provider]?.models.find((candidate3) => candidate3.id.trim())?.id ?? null;
|
|
69776
|
+
const providerModel = providerSettings?.modelCaches[session.provider]?.models.find((candidate3) => candidate3.id === runtimeModel);
|
|
69775
69777
|
const localModelConfiguration = session.provider === "local-adapter" ? LocalModelChatConfigurationSchema.safeParse(providerModel?.raw?.chatConfiguration).data ?? null : null;
|
|
69776
69778
|
const contextLimitTokens = localModelConfiguration?.contextWindowTokens ?? trustedProviderContextLimit({ provider: session.provider, model: runtimeModel, settings: providerSettings });
|
|
69777
69779
|
await updateStoredTurn(turn.id, (current) => ({ ...current, providerTurnId }));
|
|
@@ -70629,21 +70631,21 @@ function createSubagentLifecycleWatcher(options) {
|
|
|
70629
70631
|
if (run.required && staleRunIds.has(run.id)) candidates.push({ run, reason: "required_stale", stale: true });
|
|
70630
70632
|
}
|
|
70631
70633
|
for (const run of input.staleRuns) {
|
|
70632
|
-
if (run.required && !candidates.some((
|
|
70634
|
+
if (run.required && !candidates.some((candidate3) => candidate3.run.id === run.id && candidate3.reason === "required_stale")) {
|
|
70633
70635
|
candidates.push({ run, reason: "required_stale", stale: true });
|
|
70634
70636
|
}
|
|
70635
70637
|
}
|
|
70636
70638
|
const grouped = /* @__PURE__ */ new Map();
|
|
70637
|
-
for (const
|
|
70638
|
-
if (!
|
|
70639
|
-
const scopeKey = `${
|
|
70639
|
+
for (const candidate3 of candidates) {
|
|
70640
|
+
if (!candidate3.run.parentSessionId) continue;
|
|
70641
|
+
const scopeKey = `${candidate3.run.parentSessionId}:${candidate3.run.parentGoalId ?? "thread"}`;
|
|
70640
70642
|
const scoped = grouped.get(scopeKey) ?? [];
|
|
70641
|
-
scoped.push(
|
|
70643
|
+
scoped.push(candidate3);
|
|
70642
70644
|
grouped.set(scopeKey, scoped);
|
|
70643
70645
|
}
|
|
70644
70646
|
return [...grouped.values()].map((groupCandidates) => {
|
|
70645
70647
|
const first = groupCandidates[0].run;
|
|
70646
|
-
const reasons = uniqueWakeReasons(groupCandidates.map((
|
|
70648
|
+
const reasons = uniqueWakeReasons(groupCandidates.map((candidate3) => candidate3.reason));
|
|
70647
70649
|
return {
|
|
70648
70650
|
parentSessionId: first.parentSessionId,
|
|
70649
70651
|
parentGoalId: first.parentGoalId ?? null,
|
|
@@ -70691,7 +70693,7 @@ function createSubagentLifecycleWatcher(options) {
|
|
|
70691
70693
|
return groups;
|
|
70692
70694
|
}
|
|
70693
70695
|
async function queueParentLifecycleWake(group, checkedAt) {
|
|
70694
|
-
const runIds = uniqueStrings2(group.candidates.map((
|
|
70696
|
+
const runIds = uniqueStrings2(group.candidates.map((candidate3) => candidate3.run.id));
|
|
70695
70697
|
const baseDecision = {
|
|
70696
70698
|
key: group.key,
|
|
70697
70699
|
parentSessionId: group.parentSessionId,
|
|
@@ -70809,10 +70811,10 @@ function createSubagentLifecycleWatcher(options) {
|
|
|
70809
70811
|
wakeKey: group.key,
|
|
70810
70812
|
parentSessionId: group.parentSessionId,
|
|
70811
70813
|
parentGoalId: group.parentGoalId,
|
|
70812
|
-
runIds: uniqueStrings2(group.candidates.map((
|
|
70814
|
+
runIds: uniqueStrings2(group.candidates.map((candidate3) => candidate3.run.id)),
|
|
70813
70815
|
reasons: group.reasons,
|
|
70814
|
-
statuses: uniqueStrings2(group.candidates.map((
|
|
70815
|
-
staleRunIds: group.candidates.filter((
|
|
70816
|
+
statuses: uniqueStrings2(group.candidates.map((candidate3) => candidate3.run.status)),
|
|
70817
|
+
staleRunIds: group.candidates.filter((candidate3) => candidate3.stale).map((candidate3) => candidate3.run.id),
|
|
70816
70818
|
wakeQueued: input.queued,
|
|
70817
70819
|
wakeQueuedParentSessionId: input.queued ? group.parentSessionId : null,
|
|
70818
70820
|
wakeSkippedReason: input.skippedReason
|
|
@@ -71035,17 +71037,17 @@ function staleAttentionKey(run) {
|
|
|
71035
71037
|
}
|
|
71036
71038
|
function lifecycleWakeKey(parentSessionId, parentGoalId, candidates) {
|
|
71037
71039
|
const parts = candidates.map(
|
|
71038
|
-
(
|
|
71039
|
-
|
|
71040
|
-
|
|
71041
|
-
|
|
71042
|
-
|
|
71040
|
+
(candidate3) => [
|
|
71041
|
+
candidate3.reason,
|
|
71042
|
+
candidate3.run.id,
|
|
71043
|
+
candidate3.run.status,
|
|
71044
|
+
candidate3.run.updatedAt ?? candidate3.run.completedAt ?? candidate3.run.createdAt
|
|
71043
71045
|
].join(":")
|
|
71044
71046
|
).sort();
|
|
71045
71047
|
return `subagent-lifecycle:${parentSessionId}:${parentGoalId ?? "thread"}:${parts.join("|")}`;
|
|
71046
71048
|
}
|
|
71047
71049
|
function subagentLifecycleWakePrompt(group) {
|
|
71048
|
-
const runPackets = group.candidates.map((
|
|
71050
|
+
const runPackets = group.candidates.map((candidate3) => subagentLifecycleReviewPacket(candidate3)).join("\n\n");
|
|
71049
71051
|
return [
|
|
71050
71052
|
"The subagent lifecycle watcher found required child work that needs main-agent attention.",
|
|
71051
71053
|
"",
|
|
@@ -71066,8 +71068,8 @@ function subagentLifecycleWakePrompt(group) {
|
|
|
71066
71068
|
"Do not poll for routine lifecycle status; this wake was queued only for a required lifecycle attention event."
|
|
71067
71069
|
].filter(Boolean).join("\n");
|
|
71068
71070
|
}
|
|
71069
|
-
function subagentLifecycleReviewPacket(
|
|
71070
|
-
const run =
|
|
71071
|
+
function subagentLifecycleReviewPacket(candidate3) {
|
|
71072
|
+
const run = candidate3.run;
|
|
71071
71073
|
const metadata = recordFromUnknown4(run.metadata);
|
|
71072
71074
|
const failureHandoff = recordFromUnknown4(metadata?.failureHandoff);
|
|
71073
71075
|
const packetQualityEvidence = normalizedPacketQualityEvidence(run.review.packetQuality.evidence);
|
|
@@ -71075,7 +71077,7 @@ function subagentLifecycleReviewPacket(candidate2) {
|
|
|
71075
71077
|
return [
|
|
71076
71078
|
`Run ${run.id} (${run.roleId})`,
|
|
71077
71079
|
`Status: ${run.status}`,
|
|
71078
|
-
`Reason: ${
|
|
71080
|
+
`Reason: ${candidate3.reason}${candidate3.stale ? " (stale)" : ""}`,
|
|
71079
71081
|
`Required: ${run.required ? "yes" : "no"}`,
|
|
71080
71082
|
run.parentGoalId ? `Goal: ${run.parentGoalId}` : null,
|
|
71081
71083
|
`Updated: ${run.updatedAt ?? run.progress.updatedAt ?? run.completedAt ?? run.startedAt ?? run.createdAt}`,
|
|
@@ -72451,10 +72453,10 @@ ${detail}`);
|
|
|
72451
72453
|
}
|
|
72452
72454
|
function resolveSandboxTemplateRunTarget(manifest, target) {
|
|
72453
72455
|
const executables = sandboxTemplateExecutableEntries(manifest);
|
|
72454
|
-
const match = executables.find((
|
|
72456
|
+
const match = executables.find((candidate3) => candidate3.name === target);
|
|
72455
72457
|
if (!match) {
|
|
72456
72458
|
throw new Error(
|
|
72457
|
-
`Sandbox template target not found: ${target}. Available: ${executables.map((
|
|
72459
|
+
`Sandbox template target not found: ${target}. Available: ${executables.map((candidate3) => `${candidate3.kind}:${candidate3.name}`).join(", ")}`
|
|
72458
72460
|
);
|
|
72459
72461
|
}
|
|
72460
72462
|
return match;
|
|
@@ -75760,7 +75762,7 @@ var TAILSCALE_MAX_BUFFER = 2 * 1024 * 1024;
|
|
|
75760
75762
|
function tailscaleBinary() {
|
|
75761
75763
|
const explicit = process.env.TAILSCALE_BINARY?.trim();
|
|
75762
75764
|
if (explicit) return explicit;
|
|
75763
|
-
return tailscaleBinaryCandidates().find((
|
|
75765
|
+
return tailscaleBinaryCandidates().find((candidate3) => existsSync10(candidate3)) ?? "tailscale";
|
|
75764
75766
|
}
|
|
75765
75767
|
function tailscaleBinaryCandidates() {
|
|
75766
75768
|
if (process.platform === "darwin") {
|
|
@@ -76490,8 +76492,8 @@ async function resolveWhisperBinary() {
|
|
|
76490
76492
|
"/usr/bin/whisper-cli",
|
|
76491
76493
|
"/usr/bin/whisper-cpp"
|
|
76492
76494
|
];
|
|
76493
|
-
for (const
|
|
76494
|
-
const resolved =
|
|
76495
|
+
for (const candidate3 of candidates) {
|
|
76496
|
+
const resolved = candidate3.includes(path45.sep) ? candidate3 : await findExecutableOnPath(candidate3);
|
|
76495
76497
|
if (resolved && await executableExists2(resolved)) return resolved;
|
|
76496
76498
|
}
|
|
76497
76499
|
return null;
|
|
@@ -76499,8 +76501,8 @@ async function resolveWhisperBinary() {
|
|
|
76499
76501
|
async function findExecutableOnPath(command) {
|
|
76500
76502
|
const paths = (process.env.PATH ?? "").split(path45.delimiter).filter(Boolean);
|
|
76501
76503
|
for (const directory of paths) {
|
|
76502
|
-
const
|
|
76503
|
-
if (await executableExists2(
|
|
76504
|
+
const candidate3 = path45.join(directory, command);
|
|
76505
|
+
if (await executableExists2(candidate3)) return candidate3;
|
|
76504
76506
|
}
|
|
76505
76507
|
return null;
|
|
76506
76508
|
}
|
|
@@ -77227,7 +77229,7 @@ function createInsightsService(options) {
|
|
|
77227
77229
|
enabledSources,
|
|
77228
77230
|
timestamp: timestamp2
|
|
77229
77231
|
});
|
|
77230
|
-
const evidenceSources = Array.from(new Set(candidates.map((
|
|
77232
|
+
const evidenceSources = Array.from(new Set(candidates.map((candidate3) => candidate3.evidenceSource))).sort();
|
|
77231
77233
|
if (!scanOptions.force && latestSequence <= previousConsumedSequence && candidates.length === 0) {
|
|
77232
77234
|
lastScannedCreatePipelineSequence = Math.max(lastScannedCreatePipelineSequence, latestSequence);
|
|
77233
77235
|
return InsightsScanResponseSchema.parse({
|
|
@@ -77395,23 +77397,23 @@ function createInsightsService(options) {
|
|
|
77395
77397
|
let upsertCount = 0;
|
|
77396
77398
|
let noOpCount = 0;
|
|
77397
77399
|
let resolveCount = 0;
|
|
77398
|
-
for (const
|
|
77399
|
-
currentEvidenceSources.add(
|
|
77400
|
-
const evidenceId = evidenceIdentity(
|
|
77400
|
+
for (const candidate3 of candidates) {
|
|
77401
|
+
currentEvidenceSources.add(candidate3.evidenceSource);
|
|
77402
|
+
const evidenceId = evidenceIdentity(candidate3.evidenceSource, candidate3.evidenceKey);
|
|
77401
77403
|
const keep = currentByEvidenceId.get(evidenceId) ?? /* @__PURE__ */ new Set();
|
|
77402
|
-
if (
|
|
77404
|
+
if (candidate3.keepFingerprint) keep.add(candidate3.keepFingerprint);
|
|
77403
77405
|
currentByEvidenceId.set(evidenceId, keep);
|
|
77404
|
-
if (
|
|
77406
|
+
if (candidate3.item) {
|
|
77405
77407
|
upsertCount += 1;
|
|
77406
77408
|
actions.push({
|
|
77407
77409
|
action: "upsert",
|
|
77408
|
-
item:
|
|
77410
|
+
item: candidate3.item
|
|
77409
77411
|
});
|
|
77410
77412
|
} else {
|
|
77411
77413
|
noOpCount += 1;
|
|
77412
77414
|
actions.push({
|
|
77413
77415
|
action: "no_op",
|
|
77414
|
-
createImproveRunId:
|
|
77416
|
+
createImproveRunId: candidate3.evidenceKey,
|
|
77415
77417
|
reason: "Latest evidence state does not need an active insight."
|
|
77416
77418
|
});
|
|
77417
77419
|
}
|
|
@@ -77687,7 +77689,7 @@ function collectInsightEvidence(input) {
|
|
|
77687
77689
|
if (input.enabledSources.has("create_edit")) {
|
|
77688
77690
|
candidates.push(
|
|
77689
77691
|
...detectCreateEditInsights(input.entries, input.timestamp).map(
|
|
77690
|
-
(
|
|
77692
|
+
(candidate3) => createEditEvidenceCandidate(candidate3)
|
|
77691
77693
|
)
|
|
77692
77694
|
);
|
|
77693
77695
|
}
|
|
@@ -77709,26 +77711,26 @@ function collectInsightEvidence(input) {
|
|
|
77709
77711
|
if (input.enabledSources.has("usage_anomaly")) {
|
|
77710
77712
|
candidates.push(
|
|
77711
77713
|
...detectUsageAnomalyInsights(input.usageRecords, input.timestamp).map(
|
|
77712
|
-
(
|
|
77714
|
+
(candidate3) => usageAnomalyEvidenceCandidate(candidate3)
|
|
77713
77715
|
)
|
|
77714
77716
|
);
|
|
77715
77717
|
}
|
|
77716
77718
|
return candidates;
|
|
77717
77719
|
}
|
|
77718
|
-
function createEditEvidenceCandidate(
|
|
77720
|
+
function createEditEvidenceCandidate(candidate3) {
|
|
77719
77721
|
return {
|
|
77720
|
-
item:
|
|
77722
|
+
item: candidate3.item ? withEvidencePayload(candidate3.item, "create_edit", candidate3.createImproveRunId) : null,
|
|
77721
77723
|
evidenceSource: "create_edit",
|
|
77722
|
-
evidenceKey:
|
|
77723
|
-
keepFingerprint:
|
|
77724
|
+
evidenceKey: candidate3.createImproveRunId,
|
|
77725
|
+
keepFingerprint: candidate3.keepFingerprint
|
|
77724
77726
|
};
|
|
77725
77727
|
}
|
|
77726
|
-
function usageAnomalyEvidenceCandidate(
|
|
77728
|
+
function usageAnomalyEvidenceCandidate(candidate3) {
|
|
77727
77729
|
return {
|
|
77728
|
-
item:
|
|
77730
|
+
item: candidate3.item,
|
|
77729
77731
|
evidenceSource: "usage_anomaly",
|
|
77730
|
-
evidenceKey:
|
|
77731
|
-
keepFingerprint:
|
|
77732
|
+
evidenceKey: candidate3.evidenceKey,
|
|
77733
|
+
keepFingerprint: candidate3.keepFingerprint
|
|
77732
77734
|
};
|
|
77733
77735
|
}
|
|
77734
77736
|
function parseCreateImproveRunFromEvent(event2) {
|
|
@@ -77963,17 +77965,17 @@ function insightEvidenceHash(entries, candidates) {
|
|
|
77963
77965
|
sessionId: entry.event.sessionId ?? null,
|
|
77964
77966
|
turnId: entry.event.turnId ?? null
|
|
77965
77967
|
})),
|
|
77966
|
-
candidates: candidates.map((
|
|
77967
|
-
evidenceSource:
|
|
77968
|
-
evidenceKey:
|
|
77969
|
-
keepFingerprint:
|
|
77970
|
-
item:
|
|
77971
|
-
fingerprint:
|
|
77972
|
-
severity:
|
|
77973
|
-
type:
|
|
77974
|
-
title:
|
|
77975
|
-
summary:
|
|
77976
|
-
payload:
|
|
77968
|
+
candidates: candidates.map((candidate3) => ({
|
|
77969
|
+
evidenceSource: candidate3.evidenceSource,
|
|
77970
|
+
evidenceKey: candidate3.evidenceKey,
|
|
77971
|
+
keepFingerprint: candidate3.keepFingerprint,
|
|
77972
|
+
item: candidate3.item ? {
|
|
77973
|
+
fingerprint: candidate3.item.fingerprint,
|
|
77974
|
+
severity: candidate3.item.severity,
|
|
77975
|
+
type: candidate3.item.type,
|
|
77976
|
+
title: candidate3.item.title,
|
|
77977
|
+
summary: candidate3.item.summary,
|
|
77978
|
+
payload: candidate3.item.payload
|
|
77977
77979
|
} : null
|
|
77978
77980
|
}))
|
|
77979
77981
|
}));
|
|
@@ -78046,19 +78048,19 @@ function insightsRunEvidencePreview(input) {
|
|
|
78046
78048
|
};
|
|
78047
78049
|
}
|
|
78048
78050
|
function insightsEvidenceItems(candidates) {
|
|
78049
|
-
return candidates.map((
|
|
78050
|
-
evidenceSource:
|
|
78051
|
-
evidenceKey:
|
|
78052
|
-
fingerprint:
|
|
78053
|
-
insight:
|
|
78054
|
-
severity:
|
|
78055
|
-
type:
|
|
78056
|
-
title:
|
|
78057
|
-
summary:
|
|
78058
|
-
sourceSessionId:
|
|
78059
|
-
sourceTurnId:
|
|
78060
|
-
createImproveRunState:
|
|
78061
|
-
sourceEventSequence:
|
|
78051
|
+
return candidates.map((candidate3) => ({
|
|
78052
|
+
evidenceSource: candidate3.evidenceSource,
|
|
78053
|
+
evidenceKey: candidate3.evidenceKey,
|
|
78054
|
+
fingerprint: candidate3.keepFingerprint,
|
|
78055
|
+
insight: candidate3.item ? {
|
|
78056
|
+
severity: candidate3.item.severity,
|
|
78057
|
+
type: candidate3.item.type,
|
|
78058
|
+
title: candidate3.item.title,
|
|
78059
|
+
summary: candidate3.item.summary,
|
|
78060
|
+
sourceSessionId: candidate3.item.payload.sessionId ?? null,
|
|
78061
|
+
sourceTurnId: candidate3.item.payload.turnId ?? null,
|
|
78062
|
+
createImproveRunState: candidate3.item.payload.createImproveRunState ?? null,
|
|
78063
|
+
sourceEventSequence: candidate3.item.payload.sourceEventSequence ?? null
|
|
78062
78064
|
} : null
|
|
78063
78065
|
}));
|
|
78064
78066
|
}
|
|
@@ -78987,10 +78989,10 @@ async function resolveOpenPondAgentCli(agentRootPath) {
|
|
|
78987
78989
|
candidates.push(path47.join(basePath, "node_modules", ".bin", "openpond-agent"));
|
|
78988
78990
|
}
|
|
78989
78991
|
const seen = /* @__PURE__ */ new Set();
|
|
78990
|
-
for (const
|
|
78991
|
-
if (seen.has(
|
|
78992
|
-
seen.add(
|
|
78993
|
-
if (await fileExists6(
|
|
78992
|
+
for (const candidate3 of candidates) {
|
|
78993
|
+
if (seen.has(candidate3)) continue;
|
|
78994
|
+
seen.add(candidate3);
|
|
78995
|
+
if (await fileExists6(candidate3)) return candidate3;
|
|
78994
78996
|
}
|
|
78995
78997
|
throw new Error("openpond-agent CLI was not found in node_modules/.bin");
|
|
78996
78998
|
}
|
|
@@ -79301,7 +79303,7 @@ function scriptedTasksetAuthoringEnvelope(messages) {
|
|
|
79301
79303
|
const excerpts = Array.isArray(item2.excerpts) ? item2.excerpts.filter((excerpt) => Boolean(excerpt) && typeof excerpt === "object" && !Array.isArray(excerpt)) : [];
|
|
79302
79304
|
return excerpts.flatMap((excerpt, excerptIndex) => {
|
|
79303
79305
|
if (excerpt.role !== "user" || typeof excerpt.text !== "string" || typeof excerpt.turnId !== "string") return [];
|
|
79304
|
-
const assistant = excerpts.find((
|
|
79306
|
+
const assistant = excerpts.find((candidate3) => candidate3.role === "assistant" && candidate3.turnId === excerpt.turnId && typeof candidate3.text === "string");
|
|
79305
79307
|
if (!assistant || typeof assistant.text !== "string") return [];
|
|
79306
79308
|
return [{
|
|
79307
79309
|
id: `scripted_example_${sourceIndex}_${excerptIndex}`,
|
|
@@ -80963,7 +80965,7 @@ function supportRecord(item2) {
|
|
|
80963
80965
|
function descriptorMatches(descriptor, account2) {
|
|
80964
80966
|
if (!account2) return false;
|
|
80965
80967
|
const value = normalize(descriptor);
|
|
80966
|
-
return [account2.name, ...account2.aliases].some((
|
|
80968
|
+
return [account2.name, ...account2.aliases].some((candidate3) => value.includes(normalize(candidate3)));
|
|
80967
80969
|
}
|
|
80968
80970
|
function normalize(value) {
|
|
80969
80971
|
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -81700,7 +81702,7 @@ function groundTruth(world) {
|
|
|
81700
81702
|
const unmatched = world.payments.filter((payment) => !payment.matchedInvoiceId);
|
|
81701
81703
|
const matches = unmatched.flatMap((payment) => {
|
|
81702
81704
|
const invoice = world.invoices.find(
|
|
81703
|
-
(
|
|
81705
|
+
(candidate3) => candidate3.amountCents === payment.amountCents && candidate3.currency === payment.currency && descriptorMatchesAccount(payment.descriptor, accountById.get(candidate3.accountId))
|
|
81704
81706
|
);
|
|
81705
81707
|
return invoice ? [{ payment_id: payment.paymentId, invoice_id: invoice.invoiceId, account_id: invoice.accountId }] : [];
|
|
81706
81708
|
}).sort((left, right) => left.payment_id.localeCompare(right.payment_id));
|
|
@@ -81878,7 +81880,7 @@ function createCrossSystemExpertBootstrapService(deps) {
|
|
|
81878
81880
|
trajectoryCount: records.length
|
|
81879
81881
|
});
|
|
81880
81882
|
const tasks = taskset.tasks.map((task) => {
|
|
81881
|
-
const link = prepared.taskLinks.find((
|
|
81883
|
+
const link = prepared.taskLinks.find((candidate3) => candidate3.tasksetTask.id === task.id);
|
|
81882
81884
|
if (!link) return task;
|
|
81883
81885
|
const record12 = recordByEnvironmentTaskId.get(link.environmentTask.id);
|
|
81884
81886
|
if (!record12) throw new Error(`Approved trajectory for ${link.environmentTask.id} is missing.`);
|
|
@@ -82305,9 +82307,9 @@ async function attemptContextForRequest(store, request) {
|
|
|
82305
82307
|
const tasks = worlds.flatMap(generateCrossSystemTasks);
|
|
82306
82308
|
const generatedTask = resolveGeneratedTask(taskset.tasks, tasks, request);
|
|
82307
82309
|
if (!generatedTask) throw new Error("Use one generated Cross-System Operations question from this Taskset for constrained chat testing.");
|
|
82308
|
-
const authoredTask = taskset.tasks.find((
|
|
82310
|
+
const authoredTask = taskset.tasks.find((candidate3) => candidate3.id === request.taskId || candidate3.metadata.taskId === generatedTask.id);
|
|
82309
82311
|
if (!authoredTask) throw new Error(`Generated Cross-System Operations task ${generatedTask.id} has no authored Taskset record.`);
|
|
82310
|
-
const world = worlds.find((
|
|
82312
|
+
const world = worlds.find((candidate3) => candidate3.id === generatedTask.worldId);
|
|
82311
82313
|
if (!world) throw new Error("Generated chat task has no matching synthetic world.");
|
|
82312
82314
|
return { taskset, authoredTask, generatedTask, world };
|
|
82313
82315
|
}
|
|
@@ -82548,7 +82550,7 @@ function parseLocalAdapterOutput(output, tools) {
|
|
|
82548
82550
|
throw new LocalAdapterToolProtocolError("malformed_envelope", "Local model final output must use ANSWER: followed by one JSON object.");
|
|
82549
82551
|
}
|
|
82550
82552
|
if (typeof value.name !== "string" || !value.name.trim()) throw new LocalAdapterToolProtocolError("malformed_envelope", "Tool-call envelope requires a name.");
|
|
82551
|
-
const tool = tools.find((
|
|
82553
|
+
const tool = tools.find((candidate3) => candidate3.function?.name === value.name);
|
|
82552
82554
|
if (!tool?.function) throw new LocalAdapterToolProtocolError("unknown_tool", `Local model requested unregistered tool ${value.name}.`);
|
|
82553
82555
|
if (!isRecord5(value.arguments)) throw new LocalAdapterToolProtocolError("schema_violation", "Tool-call arguments must be one JSON object.");
|
|
82554
82556
|
const issue = validateJsonSchema(value.arguments, tool.function.parameters ?? {}, "arguments");
|
|
@@ -82578,7 +82580,7 @@ function localAdapterToolInstruction(tools, toolChoice) {
|
|
|
82578
82580
|
}
|
|
82579
82581
|
function validateJsonSchema(value, schema, path72) {
|
|
82580
82582
|
if (Array.isArray(schema.anyOf)) {
|
|
82581
|
-
return schema.anyOf.some((
|
|
82583
|
+
return schema.anyOf.some((candidate3) => isRecord5(candidate3) && !validateJsonSchema(value, candidate3, path72)) ? null : `${path72} does not match an allowed schema.`;
|
|
82582
82584
|
}
|
|
82583
82585
|
const type = schema.type;
|
|
82584
82586
|
if (type === "object") {
|
|
@@ -82616,7 +82618,7 @@ function validateJsonSchema(value, schema, path72) {
|
|
|
82616
82618
|
if (typeof schema.minimum === "number" && Number(value) < schema.minimum) return `${path72} is below its minimum.`;
|
|
82617
82619
|
if (typeof schema.maximum === "number" && Number(value) > schema.maximum) return `${path72} exceeds its maximum.`;
|
|
82618
82620
|
} else if (type === "null" && value !== null) return `${path72} must be null.`;
|
|
82619
|
-
if (Array.isArray(schema.enum) && !schema.enum.some((
|
|
82621
|
+
if (Array.isArray(schema.enum) && !schema.enum.some((candidate3) => Object.is(candidate3, value))) return `${path72} is outside the allowed enum.`;
|
|
82620
82622
|
return null;
|
|
82621
82623
|
}
|
|
82622
82624
|
function parseArgumentsForHistory(value) {
|
|
@@ -83558,7 +83560,7 @@ function resolveCrossSystemTask(taskset, input) {
|
|
|
83558
83560
|
if (input.prompt && input.prompt !== generatedTask.prompt && input.prompt !== authoredTask.input.prompt) {
|
|
83559
83561
|
throw new Error("Policy prompt does not match the immutable Cross-System Taskset row.");
|
|
83560
83562
|
}
|
|
83561
|
-
const world = worlds.find((
|
|
83563
|
+
const world = worlds.find((candidate3) => candidate3.id === generatedTask.worldId);
|
|
83562
83564
|
if (!world) throw new Error(`Generated task ${generatedTask.id} has no deterministic world.`);
|
|
83563
83565
|
return { taskset, authoredTask, generatedTask, world };
|
|
83564
83566
|
}
|
|
@@ -83735,7 +83737,7 @@ function crossSystemGroundTruth(source) {
|
|
|
83735
83737
|
seed: worldSeed,
|
|
83736
83738
|
split: worldSplit,
|
|
83737
83739
|
difficulty: worldDifficulty
|
|
83738
|
-
})).find((
|
|
83740
|
+
})).find((candidate3) => candidate3.id === taskId);
|
|
83739
83741
|
return task ? { prompt: task.prompt, expectedAnswer: task.expectedAnswer } : null;
|
|
83740
83742
|
}
|
|
83741
83743
|
function crossSystemTasksetMetadata(sources) {
|
|
@@ -83900,6 +83902,7 @@ function createTaskCreatorService(deps) {
|
|
|
83900
83902
|
objective: input.objective?.trim() || null,
|
|
83901
83903
|
methodHint: input.methodHint ?? null,
|
|
83902
83904
|
preferredBaseModelId: input.preferredBaseModelId ?? null,
|
|
83905
|
+
preferredBaseModel: input.preferredBaseModel ?? null,
|
|
83903
83906
|
sourceIds: input.sourceIds,
|
|
83904
83907
|
candidateId: input.candidateId ?? null,
|
|
83905
83908
|
analysisModel: input.analysisModel ?? null,
|
|
@@ -84635,9 +84638,9 @@ function authoringTimeoutSignal(parent, timeoutMs) {
|
|
|
84635
84638
|
}
|
|
84636
84639
|
function parseEnvelope(content) {
|
|
84637
84640
|
const candidates = [content, content.replace(/^```(?:json)?\s*/i, "").replace(/```\s*$/, "")];
|
|
84638
|
-
for (const
|
|
84641
|
+
for (const candidate3 of candidates) {
|
|
84639
84642
|
try {
|
|
84640
|
-
const parsed = ModelProposalEnvelopeSchema.safeParse(JSON.parse(
|
|
84643
|
+
const parsed = ModelProposalEnvelopeSchema.safeParse(JSON.parse(candidate3));
|
|
84641
84644
|
if (parsed.success) return parsed.data;
|
|
84642
84645
|
} catch {
|
|
84643
84646
|
}
|
|
@@ -84684,9 +84687,9 @@ async function resolveTasksetAuthoringSkillRoot(repoRoot = process.cwd(), execut
|
|
|
84684
84687
|
path50.resolve(path50.dirname(executablePath), "skills", SKILL_DIRECTORY),
|
|
84685
84688
|
path50.resolve(moduleDirectory, "skills", SKILL_DIRECTORY),
|
|
84686
84689
|
path50.resolve(moduleDirectory, "..", "skills", SKILL_DIRECTORY)
|
|
84687
|
-
].filter((
|
|
84688
|
-
for (const
|
|
84689
|
-
if (await access2(path50.join(
|
|
84690
|
+
].filter((candidate3) => Boolean(candidate3));
|
|
84691
|
+
for (const candidate3 of candidates) {
|
|
84692
|
+
if (await access2(path50.join(candidate3, "SKILL.md")).then(() => true, () => false)) return candidate3;
|
|
84690
84693
|
}
|
|
84691
84694
|
throw new Error(`Bundled Taskset Authoring skill was not found. Checked: ${candidates.join(", ")}`);
|
|
84692
84695
|
}
|
|
@@ -84763,7 +84766,7 @@ function createTaskMinerService(deps) {
|
|
|
84763
84766
|
const fingerprint = contentHash([input.profileId, signature]);
|
|
84764
84767
|
const existing = await deps.store.findTaskCandidateByFingerprint(input.profileId, fingerprint);
|
|
84765
84768
|
const timestamp2 = now();
|
|
84766
|
-
const
|
|
84769
|
+
const candidate3 = TaskCandidateSchema.parse({
|
|
84767
84770
|
schemaVersion: "openpond.taskCandidate.v1",
|
|
84768
84771
|
id: existing?.id ?? `task_candidate_${randomUUID28()}`,
|
|
84769
84772
|
profileId: input.profileId,
|
|
@@ -84794,8 +84797,8 @@ function createTaskMinerService(deps) {
|
|
|
84794
84797
|
} : {}
|
|
84795
84798
|
}
|
|
84796
84799
|
});
|
|
84797
|
-
await deps.store.upsertTaskCandidate(
|
|
84798
|
-
candidates.push(
|
|
84800
|
+
await deps.store.upsertTaskCandidate(candidate3);
|
|
84801
|
+
candidates.push(candidate3);
|
|
84799
84802
|
await input.onProgress?.({ stage: "persisting", processedSources, totalSources: sources.length, candidatesFound: candidates.length, skippedSources: 0 });
|
|
84800
84803
|
}
|
|
84801
84804
|
await input.onProgress?.({ stage: "complete", processedSources: sources.length, totalSources: sources.length, candidatesFound: candidates.length, skippedSources: 0 });
|
|
@@ -84859,7 +84862,7 @@ function createTaskMinerService(deps) {
|
|
|
84859
84862
|
});
|
|
84860
84863
|
throwIfAborted3(controller.signal);
|
|
84861
84864
|
const completedAt = now();
|
|
84862
|
-
current = await deps.store.saveTaskMinerRun({ ...current, status: "succeeded", candidateIds: candidates.map((
|
|
84865
|
+
current = await deps.store.saveTaskMinerRun({ ...current, status: "succeeded", candidateIds: candidates.map((candidate3) => candidate3.id), progress: { ...current.progress, stage: "complete", candidatesFound: candidates.length }, completedAt, updatedAt: completedAt });
|
|
84863
84866
|
} catch (error) {
|
|
84864
84867
|
const completedAt = now();
|
|
84865
84868
|
const cancelled = controller.signal.aborted || error instanceof Error && error.name === "AbortError";
|
|
@@ -84950,13 +84953,13 @@ function createTaskMinerService(deps) {
|
|
|
84950
84953
|
await Promise.allSettled([...activeRuns.values()].map((active) => active.execution));
|
|
84951
84954
|
}
|
|
84952
84955
|
async function patch(id, input) {
|
|
84953
|
-
const
|
|
84954
|
-
if (!
|
|
84956
|
+
const candidate3 = await deps.store.getTaskCandidate(id);
|
|
84957
|
+
if (!candidate3) throw new Error("Task Candidate not found.");
|
|
84955
84958
|
if (input.mergeIntoId) {
|
|
84956
84959
|
const target = await deps.store.getTaskCandidate(input.mergeIntoId);
|
|
84957
|
-
if (!target || target.profileId !==
|
|
84960
|
+
if (!target || target.profileId !== candidate3.profileId) throw new Error("Merge target was not found in this profile.");
|
|
84958
84961
|
}
|
|
84959
|
-
return deps.store.upsertTaskCandidate(TaskCandidateSchema.parse({ ...
|
|
84962
|
+
return deps.store.upsertTaskCandidate(TaskCandidateSchema.parse({ ...candidate3, status: input.mergeIntoId ? "retired" : input.status ?? candidate3.status, mergedIntoId: input.mergeIntoId ?? candidate3.mergedIntoId, updatedAt: now() }));
|
|
84960
84963
|
}
|
|
84961
84964
|
return { config, updateConfig, run, startRun, cancelRun, patch, close };
|
|
84962
84965
|
}
|
|
@@ -85363,7 +85366,7 @@ function createTaskEvaluationService(deps) {
|
|
|
85363
85366
|
const customVerifier = await customVerifierFor(taskset.id);
|
|
85364
85367
|
const grades = [];
|
|
85365
85368
|
for (const attempt of attempts) {
|
|
85366
|
-
const task = taskset.tasks.find((
|
|
85369
|
+
const task = taskset.tasks.find((candidate3) => candidate3.id === attempt.taskId);
|
|
85367
85370
|
if (!task) throw new Error(`Baseline task ${attempt.taskId} was not found.`);
|
|
85368
85371
|
grades.push(await gradeTasksetBaselineAttempt({
|
|
85369
85372
|
task,
|
|
@@ -85486,7 +85489,7 @@ function createTaskEvaluationService(deps) {
|
|
|
85486
85489
|
async function readiness(tasksetId) {
|
|
85487
85490
|
const taskset = await requireTaskset2(tasksetId);
|
|
85488
85491
|
const [baselineReports, auditReports] = await Promise.all([deps.store.listBaselineReports(tasksetId), deps.store.listGraderAuditReports(tasksetId)]);
|
|
85489
|
-
let graderAudit = auditReports.find((
|
|
85492
|
+
let graderAudit = auditReports.find((candidate3) => candidate3.tasksetHash === taskset.contentHash) ?? null;
|
|
85490
85493
|
if (!graderAudit && !taskset.graders.some((grader) => grader.kind === "model_judge")) {
|
|
85491
85494
|
graderAudit = (await auditFixtures({ tasksetId })).report;
|
|
85492
85495
|
}
|
|
@@ -86183,10 +86186,10 @@ var LocalCpuTrainingDestination = class {
|
|
|
86183
86186
|
path56.join(this.deps.storeDir, "training", "tasksets", taskset.id, "taskset.json"),
|
|
86184
86187
|
...taskset.sourceRefs.map(() => "")
|
|
86185
86188
|
];
|
|
86186
|
-
for (const
|
|
86189
|
+
for (const candidate3 of candidates) if (candidate3) {
|
|
86187
86190
|
try {
|
|
86188
|
-
await access3(
|
|
86189
|
-
return
|
|
86191
|
+
await access3(candidate3);
|
|
86192
|
+
return candidate3;
|
|
86190
86193
|
} catch {
|
|
86191
86194
|
}
|
|
86192
86195
|
}
|
|
@@ -86307,7 +86310,7 @@ var FireworksApiClient = class {
|
|
|
86307
86310
|
async resolveAccount() {
|
|
86308
86311
|
const payload = await this.json("/v1/accounts");
|
|
86309
86312
|
const accounts = payload.accounts ?? [];
|
|
86310
|
-
const account2 = accounts.find((
|
|
86313
|
+
const account2 = accounts.find((candidate3) => candidate3.state !== "SUSPENDED" && (!candidate3.suspendState || candidate3.suspendState === "UNSUSPENDED")) ?? accounts[0];
|
|
86311
86314
|
if (!account2?.name?.startsWith("accounts/")) {
|
|
86312
86315
|
throw new Error("Fireworks returned no account accessible to the saved provider credential.");
|
|
86313
86316
|
}
|
|
@@ -87739,18 +87742,18 @@ function evaluationDeploymentLeases(job) {
|
|
|
87739
87742
|
if (!Array.isArray(raw)) return [];
|
|
87740
87743
|
return raw.flatMap((value) => {
|
|
87741
87744
|
if (!value || typeof value !== "object" || Array.isArray(value)) return [];
|
|
87742
|
-
const
|
|
87743
|
-
if (typeof
|
|
87745
|
+
const candidate3 = value;
|
|
87746
|
+
if (typeof candidate3.accountId !== "string" || typeof candidate3.deploymentId !== "string" || candidate3.stage !== "base" && candidate3.stage !== "trained" || typeof candidate3.createdAt !== "string" || typeof candidate3.expiresAt !== "string" || !Number.isFinite(Date.parse(candidate3.expiresAt))) {
|
|
87744
87747
|
return [];
|
|
87745
87748
|
}
|
|
87746
87749
|
return [{
|
|
87747
|
-
accountId:
|
|
87748
|
-
deploymentId:
|
|
87749
|
-
stage:
|
|
87750
|
-
model: typeof
|
|
87751
|
-
deployedModelId: typeof
|
|
87752
|
-
createdAt:
|
|
87753
|
-
expiresAt:
|
|
87750
|
+
accountId: candidate3.accountId,
|
|
87751
|
+
deploymentId: candidate3.deploymentId,
|
|
87752
|
+
stage: candidate3.stage,
|
|
87753
|
+
model: typeof candidate3.model === "string" ? candidate3.model : void 0,
|
|
87754
|
+
deployedModelId: typeof candidate3.deployedModelId === "string" ? candidate3.deployedModelId : void 0,
|
|
87755
|
+
createdAt: candidate3.createdAt,
|
|
87756
|
+
expiresAt: candidate3.expiresAt
|
|
87754
87757
|
}];
|
|
87755
87758
|
});
|
|
87756
87759
|
}
|
|
@@ -87827,7 +87830,7 @@ async function readEvaluationDeployment(input) {
|
|
|
87827
87830
|
}
|
|
87828
87831
|
const deployments = await input.client.listDeployments(input.accountId);
|
|
87829
87832
|
const deployment = deployments.find(
|
|
87830
|
-
(
|
|
87833
|
+
(candidate3) => resourceId(candidate3.name ?? "") === input.deploymentId
|
|
87831
87834
|
);
|
|
87832
87835
|
if (deployment) return deployment;
|
|
87833
87836
|
return retryFireworksControlPlane(
|
|
@@ -87875,8 +87878,8 @@ async function unloadEvaluationLoras(input) {
|
|
|
87875
87878
|
if (!deployedModelIds.length) {
|
|
87876
87879
|
const deployedModels = await input.client.listDeployedModels(input.accountId);
|
|
87877
87880
|
deployedModelIds = deployedModels.filter(
|
|
87878
|
-
(
|
|
87879
|
-
).map((
|
|
87881
|
+
(candidate3) => candidate3.deployment === input.deploymentName && (!input.model || candidate3.model === input.model)
|
|
87882
|
+
).map((candidate3) => resourceId(candidate3.name ?? "")).filter(Boolean);
|
|
87880
87883
|
}
|
|
87881
87884
|
const uniqueIds = [...new Set(deployedModelIds)];
|
|
87882
87885
|
for (const deployedModelId of uniqueIds) {
|
|
@@ -88275,7 +88278,7 @@ var FireworksDestinationBase = class {
|
|
|
88275
88278
|
(event2) => event2.type === "metric" && event2.payload.providerMetricSource === "fireworks_sft"
|
|
88276
88279
|
)) return;
|
|
88277
88280
|
const artifact = (await this.deps.store.listTrainingArtifacts(job.id)).find(
|
|
88278
|
-
(
|
|
88281
|
+
(candidate3) => candidate3.kind === "metrics" && candidate3.metadata.providerFilename === "fireworks-sft-metrics.jsonl"
|
|
88279
88282
|
);
|
|
88280
88283
|
if (!artifact) return;
|
|
88281
88284
|
const bytes = await readFile11(artifact.path);
|
|
@@ -88952,7 +88955,7 @@ var FireworksDestinationEvaluation = class extends FireworksDestinationBase {
|
|
|
88952
88955
|
results.filter((result) => result.stage === spec.stage).map((result) => result.taskId)
|
|
88953
88956
|
);
|
|
88954
88957
|
for (const task of frozen.filter(
|
|
88955
|
-
(
|
|
88958
|
+
(candidate3) => !completedTaskIds.has(candidate3.id)
|
|
88956
88959
|
)) {
|
|
88957
88960
|
const timestamp2 = this.timestamp();
|
|
88958
88961
|
await persistAttempt(
|
|
@@ -89759,7 +89762,7 @@ var FireworksTrainingDestination = class extends FireworksDestinationJob {
|
|
|
89759
89762
|
const issues = [...compatibility.issues];
|
|
89760
89763
|
if (plan.recipe.method === "grpo") {
|
|
89761
89764
|
const trainExampleCount = taskset.tasks.filter(
|
|
89762
|
-
(
|
|
89765
|
+
(candidate3) => candidate3.split === "train"
|
|
89763
89766
|
).length;
|
|
89764
89767
|
const requiredRollouts = trainExampleCount * plan.recipe.rollout.groupSize;
|
|
89765
89768
|
if (plan.recipe.resourceLimits.maxRollouts < requiredRollouts) {
|
|
@@ -89802,7 +89805,7 @@ var FireworksTrainingDestination = class extends FireworksDestinationJob {
|
|
|
89802
89805
|
message: "The Fireworks RFT grader hash does not match the immutable Taskset."
|
|
89803
89806
|
});
|
|
89804
89807
|
}
|
|
89805
|
-
for (const task of taskset.tasks.filter((
|
|
89808
|
+
for (const task of taskset.tasks.filter((candidate3) => candidate3.split === "train")) {
|
|
89806
89809
|
try {
|
|
89807
89810
|
resolveCrossSystemTrainTask(taskset, { rowId: task.id });
|
|
89808
89811
|
} catch (error) {
|
|
@@ -90201,7 +90204,7 @@ var FireworksTrainingDestination = class extends FireworksDestinationJob {
|
|
|
90201
90204
|
const thresholdPassed = artifact.metadata.thresholdPassed === true;
|
|
90202
90205
|
const evaluationComplete = artifact.metadata.evaluationComplete === true;
|
|
90203
90206
|
const lineages = await this.deps.store.listModelArtifactLineage(taskset.id);
|
|
90204
|
-
const lineage = lineages.find((
|
|
90207
|
+
const lineage = lineages.find((candidate3) => candidate3.jobId === job.id);
|
|
90205
90208
|
if (!lineage) {
|
|
90206
90209
|
throw new Error("Imported Fireworks model lineage was not found.");
|
|
90207
90210
|
}
|
|
@@ -95231,8 +95234,8 @@ async function resolveActiveRftJob(store, init) {
|
|
|
95231
95234
|
);
|
|
95232
95235
|
});
|
|
95233
95236
|
if (checkpointMatch) return checkpointMatch;
|
|
95234
|
-
for (const
|
|
95235
|
-
const { job } =
|
|
95237
|
+
for (const candidate3 of candidates) {
|
|
95238
|
+
const { job } = candidate3;
|
|
95236
95239
|
const refs = new Set([
|
|
95237
95240
|
job.id,
|
|
95238
95241
|
optionalString4(job.metadata.providerJobId),
|
|
@@ -95241,7 +95244,7 @@ async function resolveActiveRftJob(store, init) {
|
|
|
95241
95244
|
optionalString4(job.metadata.providerRunId)
|
|
95242
95245
|
].filter((value) => Boolean(value)));
|
|
95243
95246
|
if (refs.has(init.metadata.run_id) || refs.has(init.metadata.experiment_id)) {
|
|
95244
|
-
return
|
|
95247
|
+
return candidate3;
|
|
95245
95248
|
}
|
|
95246
95249
|
}
|
|
95247
95250
|
if (candidates.length === 1) return candidates[0];
|
|
@@ -95605,8 +95608,8 @@ function createLocalAdapterChatRuntime(deps) {
|
|
|
95605
95608
|
projectDir: deps.projectDir,
|
|
95606
95609
|
idleTimeoutMs: deps.idleTimeoutMs ?? target.configuration.keepWarmSeconds * 1e3,
|
|
95607
95610
|
startupTimeoutMs: deps.startupTimeoutMs ?? 12e4,
|
|
95608
|
-
onIdle: (
|
|
95609
|
-
if (activeWorker ===
|
|
95611
|
+
onIdle: (candidate3) => {
|
|
95612
|
+
if (activeWorker === candidate3) activeWorker = null;
|
|
95610
95613
|
}
|
|
95611
95614
|
});
|
|
95612
95615
|
activeWorker = worker;
|
|
@@ -96215,7 +96218,7 @@ function createFireworksServingService(deps) {
|
|
|
96215
96218
|
modelArtifactLineageId: context.lineage.id
|
|
96216
96219
|
});
|
|
96217
96220
|
const session = sessions.find(
|
|
96218
|
-
(
|
|
96221
|
+
(candidate3) => candidate3.runtimeId === runtimeId && candidate3.state === "ready"
|
|
96219
96222
|
);
|
|
96220
96223
|
if (!session?.accountId) {
|
|
96221
96224
|
throw new Error("Start Fireworks serving for this Model before chatting.");
|
|
@@ -96271,7 +96274,7 @@ function createFireworksServingService(deps) {
|
|
|
96271
96274
|
timers.clear();
|
|
96272
96275
|
const sessions = await deps.store.listFireworksModelServingSessions();
|
|
96273
96276
|
for (const session of sessions.filter(
|
|
96274
|
-
(
|
|
96277
|
+
(candidate3) => candidate3.runtimeId === runtimeId && ACTIVE_STATES.has(candidate3.state)
|
|
96275
96278
|
)) {
|
|
96276
96279
|
await stop(session.id, "shutdown");
|
|
96277
96280
|
}
|
|
@@ -96447,6 +96450,159 @@ function delay3(milliseconds) {
|
|
|
96447
96450
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, milliseconds)));
|
|
96448
96451
|
}
|
|
96449
96452
|
|
|
96453
|
+
// ../server/src/training/base-model-candidates.ts
|
|
96454
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
96455
|
+
var LOCAL_DESTINATIONS = /* @__PURE__ */ new Set(["local_cpu_fixture", "local_cuda", "local_mlx"]);
|
|
96456
|
+
var TINY_CPU_MODEL = "openpond/tiny-cpu-gpt2-fixture";
|
|
96457
|
+
function projectBaseModelCandidates(input) {
|
|
96458
|
+
const candidates = [];
|
|
96459
|
+
const managedModelIds = new Set(
|
|
96460
|
+
input.destinations.filter((destination) => !LOCAL_DESTINATIONS.has(destination.destinationId)).flatMap((destination) => destination.modelAllowlist)
|
|
96461
|
+
);
|
|
96462
|
+
for (const modelId of managedModelIds) {
|
|
96463
|
+
const options = executionOptions(input.destinations, modelId, false);
|
|
96464
|
+
if (!options.length) continue;
|
|
96465
|
+
candidates.push(candidate2({
|
|
96466
|
+
preference: {
|
|
96467
|
+
schemaVersion: "openpond.baseModelPreference.v1",
|
|
96468
|
+
modelId,
|
|
96469
|
+
revision: null,
|
|
96470
|
+
tokenizerRevision: null,
|
|
96471
|
+
chatTemplateHash: null,
|
|
96472
|
+
modelAssetId: null,
|
|
96473
|
+
source: "managed"
|
|
96474
|
+
},
|
|
96475
|
+
label: modelLabel(modelId),
|
|
96476
|
+
sourceLabel: sourceLabel(options),
|
|
96477
|
+
options,
|
|
96478
|
+
compatibilityReason: null
|
|
96479
|
+
}));
|
|
96480
|
+
}
|
|
96481
|
+
const builtinOptions = executionOptions(input.destinations, TINY_CPU_MODEL, true);
|
|
96482
|
+
if (builtinOptions.length) {
|
|
96483
|
+
candidates.push(candidate2({
|
|
96484
|
+
preference: {
|
|
96485
|
+
schemaVersion: "openpond.baseModelPreference.v1",
|
|
96486
|
+
modelId: TINY_CPU_MODEL,
|
|
96487
|
+
revision: "architecture-v2-seed-17-context-512",
|
|
96488
|
+
tokenizerRevision: "wordlevel-v1",
|
|
96489
|
+
chatTemplateHash: "fixture00000000",
|
|
96490
|
+
modelAssetId: null,
|
|
96491
|
+
source: "builtin"
|
|
96492
|
+
},
|
|
96493
|
+
label: "Tiny CPU correctness fixture",
|
|
96494
|
+
sourceLabel: "This machine",
|
|
96495
|
+
options: builtinOptions,
|
|
96496
|
+
compatibilityReason: null
|
|
96497
|
+
}));
|
|
96498
|
+
}
|
|
96499
|
+
const localByLineage = /* @__PURE__ */ new Map();
|
|
96500
|
+
for (const model of input.inventory?.models ?? []) {
|
|
96501
|
+
if (!model.trainingCompatible || !model.modelId || !model.revision || !model.tokenizerRevision || !model.chatTemplateHash) continue;
|
|
96502
|
+
const lineage = [
|
|
96503
|
+
model.modelId,
|
|
96504
|
+
model.revision,
|
|
96505
|
+
model.tokenizerRevision,
|
|
96506
|
+
model.chatTemplateHash
|
|
96507
|
+
].join("\n");
|
|
96508
|
+
if (!localByLineage.has(lineage)) localByLineage.set(lineage, model);
|
|
96509
|
+
}
|
|
96510
|
+
for (const model of localByLineage.values()) {
|
|
96511
|
+
const options = executionOptions(input.destinations, model.modelId, true);
|
|
96512
|
+
if (!options.length) continue;
|
|
96513
|
+
candidates.push(candidate2({
|
|
96514
|
+
preference: {
|
|
96515
|
+
schemaVersion: "openpond.baseModelPreference.v1",
|
|
96516
|
+
modelId: model.modelId,
|
|
96517
|
+
revision: model.revision,
|
|
96518
|
+
tokenizerRevision: model.tokenizerRevision,
|
|
96519
|
+
chatTemplateHash: model.chatTemplateHash,
|
|
96520
|
+
modelAssetId: model.id,
|
|
96521
|
+
source: "local"
|
|
96522
|
+
},
|
|
96523
|
+
label: model.name,
|
|
96524
|
+
sourceLabel: localSourceLabel(model),
|
|
96525
|
+
options,
|
|
96526
|
+
compatibilityReason: model.compatibilityReason
|
|
96527
|
+
}));
|
|
96528
|
+
}
|
|
96529
|
+
return candidates.sort(compareCandidates);
|
|
96530
|
+
}
|
|
96531
|
+
function legacyBaseModelPreference(modelId) {
|
|
96532
|
+
return {
|
|
96533
|
+
schemaVersion: "openpond.baseModelPreference.v1",
|
|
96534
|
+
modelId,
|
|
96535
|
+
revision: null,
|
|
96536
|
+
tokenizerRevision: null,
|
|
96537
|
+
chatTemplateHash: null,
|
|
96538
|
+
modelAssetId: null,
|
|
96539
|
+
source: modelId === TINY_CPU_MODEL ? "builtin" : "managed"
|
|
96540
|
+
};
|
|
96541
|
+
}
|
|
96542
|
+
function executionOptions(destinations, modelId, local) {
|
|
96543
|
+
return destinations.filter((destination) => LOCAL_DESTINATIONS.has(destination.destinationId) === local && destination.modelAllowlist.includes(modelId)).map((destination) => ({
|
|
96544
|
+
destinationId: destination.destinationId,
|
|
96545
|
+
available: destination.available,
|
|
96546
|
+
methods: destination.methods,
|
|
96547
|
+
parameterizations: destination.parameterizations,
|
|
96548
|
+
nonProduction: destination.nonProduction,
|
|
96549
|
+
unavailableReason: destination.unavailableReason
|
|
96550
|
+
}));
|
|
96551
|
+
}
|
|
96552
|
+
function candidate2(input) {
|
|
96553
|
+
const availableOptions = input.options.filter((option) => option.available);
|
|
96554
|
+
const available = availableOptions.length > 0;
|
|
96555
|
+
const reasons = [
|
|
96556
|
+
input.compatibilityReason,
|
|
96557
|
+
...input.options.map((option) => option.unavailableReason)
|
|
96558
|
+
].filter((reason) => Boolean(reason));
|
|
96559
|
+
return BaseModelCandidateSchema.parse({
|
|
96560
|
+
schemaVersion: "openpond.baseModelCandidate.v1",
|
|
96561
|
+
selectionKey: `base_model_${createHash12("sha256").update(JSON.stringify(input.preference)).digest("hex").slice(0, 24)}`,
|
|
96562
|
+
label: input.label,
|
|
96563
|
+
sourceLabel: input.sourceLabel,
|
|
96564
|
+
preference: input.preference,
|
|
96565
|
+
available,
|
|
96566
|
+
nonProduction: (availableOptions.length ? availableOptions : input.options).every((option) => option.nonProduction),
|
|
96567
|
+
unavailableReason: available ? null : [...new Set(reasons)].join(" ") || "No compatible training destination is available.",
|
|
96568
|
+
methods: [...new Set(input.options.flatMap((option) => option.methods))],
|
|
96569
|
+
executionOptions: input.options
|
|
96570
|
+
});
|
|
96571
|
+
}
|
|
96572
|
+
function compareCandidates(left, right) {
|
|
96573
|
+
const rank = (candidate3) => {
|
|
96574
|
+
if (candidate3.preference.source === "managed" && candidate3.available) return 0;
|
|
96575
|
+
if (candidate3.preference.source === "local" && candidate3.available) return 1;
|
|
96576
|
+
if (candidate3.preference.source === "builtin" && candidate3.available) return 2;
|
|
96577
|
+
return 3;
|
|
96578
|
+
};
|
|
96579
|
+
return rank(left) - rank(right) || left.label.localeCompare(right.label);
|
|
96580
|
+
}
|
|
96581
|
+
function sourceLabel(options) {
|
|
96582
|
+
const labels = [...new Set(options.map((option) => destinationLabel(option.destinationId)))];
|
|
96583
|
+
return labels.length === 1 ? labels[0] : "Managed";
|
|
96584
|
+
}
|
|
96585
|
+
function localSourceLabel(model) {
|
|
96586
|
+
if (model.source === "huggingface") return "Hugging Face \xB7 This machine";
|
|
96587
|
+
if (model.source === "mlx") return "MLX \xB7 This machine";
|
|
96588
|
+
return "This machine";
|
|
96589
|
+
}
|
|
96590
|
+
function destinationLabel(destinationId) {
|
|
96591
|
+
const labels = {
|
|
96592
|
+
fireworks: "Fireworks",
|
|
96593
|
+
prime_hosted: "Prime hosted",
|
|
96594
|
+
openpond_managed: "OpenPond managed",
|
|
96595
|
+
local_cpu_fixture: "Local CPU",
|
|
96596
|
+
local_cuda: "Local NVIDIA GPU",
|
|
96597
|
+
local_mlx: "Apple Silicon"
|
|
96598
|
+
};
|
|
96599
|
+
return labels[destinationId] ?? destinationId.replaceAll("_", " ");
|
|
96600
|
+
}
|
|
96601
|
+
function modelLabel(modelId) {
|
|
96602
|
+
const name = modelId.split("/").filter(Boolean).at(-1) ?? modelId;
|
|
96603
|
+
return name.replace(/(\d+)p(\d+)b/gi, "$1.$2B").replace(/(\d+)b/gi, "$1B").replaceAll("-", " ").replace(/\b\w/g, (value) => value.toUpperCase());
|
|
96604
|
+
}
|
|
96605
|
+
|
|
96450
96606
|
// ../server/src/training/training-service.ts
|
|
96451
96607
|
function createTrainingService(deps) {
|
|
96452
96608
|
const registry = new TrainingDestinationRegistry();
|
|
@@ -96699,7 +96855,33 @@ function createTrainingService(deps) {
|
|
|
96699
96855
|
}
|
|
96700
96856
|
async function state(profileId) {
|
|
96701
96857
|
await Promise.all([fireworks.reconcile(), fireworksServing.reconcile()]);
|
|
96702
|
-
const [
|
|
96858
|
+
const [
|
|
96859
|
+
plans,
|
|
96860
|
+
bundles,
|
|
96861
|
+
jobs,
|
|
96862
|
+
artifacts,
|
|
96863
|
+
models,
|
|
96864
|
+
rolloutReceipts,
|
|
96865
|
+
modelBindings,
|
|
96866
|
+
servingSessions,
|
|
96867
|
+
destinationCapabilities,
|
|
96868
|
+
computeInventory,
|
|
96869
|
+
secretRefs,
|
|
96870
|
+
fireworksCredential
|
|
96871
|
+
] = await Promise.all([
|
|
96872
|
+
deps.store.listTrainingPlans(),
|
|
96873
|
+
deps.store.listTrainingBundles(),
|
|
96874
|
+
deps.store.listTrainingJobs(),
|
|
96875
|
+
deps.store.listTrainingArtifacts(),
|
|
96876
|
+
deps.store.listModelArtifactLineage(),
|
|
96877
|
+
deps.store.listRolloutTrajectoryReceipts(),
|
|
96878
|
+
deps.store.listModelBindings(),
|
|
96879
|
+
fireworksServing.list(profileId),
|
|
96880
|
+
destinations(),
|
|
96881
|
+
deps.computeInventory?.() ?? Promise.resolve(null),
|
|
96882
|
+
listTrainingDestinationSecretRefs(path66.join(deps.storeDir, "secrets")),
|
|
96883
|
+
deps.resolveFireworksCredential?.() ?? Promise.resolve(null)
|
|
96884
|
+
]);
|
|
96703
96885
|
return {
|
|
96704
96886
|
plans,
|
|
96705
96887
|
bundles,
|
|
@@ -96710,6 +96892,10 @@ function createTrainingService(deps) {
|
|
|
96710
96892
|
modelBindings,
|
|
96711
96893
|
servingSessions,
|
|
96712
96894
|
destinations: destinationCapabilities,
|
|
96895
|
+
baseModelCandidates: projectBaseModelCandidates({
|
|
96896
|
+
destinations: destinationCapabilities,
|
|
96897
|
+
inventory: computeInventory
|
|
96898
|
+
}),
|
|
96713
96899
|
credentialRefs: [
|
|
96714
96900
|
...secretRefs.filter((credential) => credential.destinationId !== "fireworks"),
|
|
96715
96901
|
{
|
|
@@ -97110,8 +97296,8 @@ function createTrainingService(deps) {
|
|
|
97110
97296
|
if (run.target.kind !== "model" || run.target.trainingJobId !== input.jobId && run.target.artifactId !== input.artifactId) {
|
|
97111
97297
|
continue;
|
|
97112
97298
|
}
|
|
97113
|
-
const
|
|
97114
|
-
const candidates =
|
|
97299
|
+
const candidate3 = run.candidates.find((item2) => item2.target.kind === "model" && (item2.target.trainingJobId === input.jobId || item2.artifactRefs.includes(input.artifactId)));
|
|
97300
|
+
const candidates = candidate3 ? run.candidates.map((item2) => item2.id === candidate3.id ? {
|
|
97115
97301
|
...item2,
|
|
97116
97302
|
status: input.status === "released" ? "accepted" : input.status === "rejected" ? "rejected" : item2.status,
|
|
97117
97303
|
updatedAt: input.timestamp
|
|
@@ -97186,11 +97372,11 @@ function createTrainingService(deps) {
|
|
|
97186
97372
|
}
|
|
97187
97373
|
function withAuthoritativeRecipeHashes(taskset, recipe) {
|
|
97188
97374
|
if (!recipe || typeof recipe !== "object" || Array.isArray(recipe)) return recipe;
|
|
97189
|
-
const
|
|
97190
|
-
if (
|
|
97191
|
-
const reward =
|
|
97375
|
+
const candidate3 = recipe;
|
|
97376
|
+
if (candidate3.method !== "grpo") return recipe;
|
|
97377
|
+
const reward = candidate3.reward && typeof candidate3.reward === "object" && !Array.isArray(candidate3.reward) ? candidate3.reward : {};
|
|
97192
97378
|
return {
|
|
97193
|
-
...
|
|
97379
|
+
...candidate3,
|
|
97194
97380
|
reward: {
|
|
97195
97381
|
...reward,
|
|
97196
97382
|
graderHash: contentHash(taskset.graders)
|
|
@@ -97416,7 +97602,8 @@ function createTasksetAuthoringCreateImproveRun(input) {
|
|
|
97416
97602
|
specializedEvaluator: "taskset",
|
|
97417
97603
|
source: "shared_taskset_authoring",
|
|
97418
97604
|
resourceIntent: input.resourceIntent ?? "workproduct",
|
|
97419
|
-
preferredBaseModelId: input.preferredBaseModelId ?? null
|
|
97605
|
+
preferredBaseModelId: input.preferredBaseModelId ?? null,
|
|
97606
|
+
preferredBaseModel: input.preferredBaseModel ?? null
|
|
97420
97607
|
},
|
|
97421
97608
|
createdAt: timestamp2,
|
|
97422
97609
|
updatedAt: timestamp2
|
|
@@ -97437,6 +97624,7 @@ function createExistingTasksetModelCreateImproveRun(input) {
|
|
|
97437
97624
|
},
|
|
97438
97625
|
resourceIntent: "workproduct",
|
|
97439
97626
|
preferredBaseModelId: input.preferredBaseModelId,
|
|
97627
|
+
preferredBaseModel: input.preferredBaseModel,
|
|
97440
97628
|
timestamp: timestamp2
|
|
97441
97629
|
});
|
|
97442
97630
|
const tasksetRef = createTasksetRef({
|
|
@@ -97463,7 +97651,8 @@ function createExistingTasksetModelCreateImproveRun(input) {
|
|
|
97463
97651
|
source: "existing_dataset_model",
|
|
97464
97652
|
tasksetRevision: input.taskset.revision,
|
|
97465
97653
|
tasksetHash: input.taskset.contentHash,
|
|
97466
|
-
preferredBaseModelId: input.preferredBaseModelId
|
|
97654
|
+
preferredBaseModelId: input.preferredBaseModelId,
|
|
97655
|
+
preferredBaseModel: input.preferredBaseModel
|
|
97467
97656
|
},
|
|
97468
97657
|
updatedAt: timestamp2
|
|
97469
97658
|
});
|
|
@@ -97655,16 +97844,16 @@ function advanceUnexecutedModelRunTasksetRef(run, taskset) {
|
|
|
97655
97844
|
});
|
|
97656
97845
|
return nextCreateImproveRunRevision(run, {
|
|
97657
97846
|
tasksetRef,
|
|
97658
|
-
candidates: run.candidates.map((
|
|
97659
|
-
...
|
|
97847
|
+
candidates: run.candidates.map((candidate3) => candidate3.target.kind === "model" ? {
|
|
97848
|
+
...candidate3,
|
|
97660
97849
|
tasksetRef,
|
|
97661
97850
|
updatedAt: taskset.updatedAt,
|
|
97662
97851
|
metadata: {
|
|
97663
|
-
...
|
|
97852
|
+
...candidate3.metadata,
|
|
97664
97853
|
tasksetRevision: taskset.revision,
|
|
97665
97854
|
tasksetHash: taskset.contentHash
|
|
97666
97855
|
}
|
|
97667
|
-
} :
|
|
97856
|
+
} : candidate3),
|
|
97668
97857
|
metadata: {
|
|
97669
97858
|
...run.metadata,
|
|
97670
97859
|
tasksetRevision: taskset.revision,
|
|
@@ -97754,7 +97943,8 @@ async function syncTasksetAuthoringCreateImproveRun(store, creation) {
|
|
|
97754
97943
|
...run.metadata,
|
|
97755
97944
|
taskCreationId: creation.id,
|
|
97756
97945
|
taskCreationState: creation.state,
|
|
97757
|
-
preferredBaseModelId: creation.request.preferredBaseModelId
|
|
97946
|
+
preferredBaseModelId: creation.request.preferredBaseModelId,
|
|
97947
|
+
preferredBaseModel: creation.request.preferredBaseModel
|
|
97758
97948
|
},
|
|
97759
97949
|
updatedAt: creation.updatedAt
|
|
97760
97950
|
};
|
|
@@ -97913,21 +98103,21 @@ async function syncModelTrainingCreateImproveRuns(input) {
|
|
|
97913
98103
|
const modelTarget = storedRun.target;
|
|
97914
98104
|
let run = storedRun;
|
|
97915
98105
|
let candidateStateChanged = false;
|
|
97916
|
-
const reconciledCandidates = run.candidates.map((
|
|
97917
|
-
if (
|
|
97918
|
-
return
|
|
98106
|
+
const reconciledCandidates = run.candidates.map((candidate3) => {
|
|
98107
|
+
if (candidate3.target.kind !== "model" || !candidate3.target.trainingJobId || ["accepted", "rejected", "failed"].includes(candidate3.status)) {
|
|
98108
|
+
return candidate3;
|
|
97919
98109
|
}
|
|
97920
|
-
const candidateJob = jobById.get(
|
|
98110
|
+
const candidateJob = jobById.get(candidate3.target.trainingJobId);
|
|
97921
98111
|
if (candidateJob?.status !== "failed" && candidateJob?.status !== "cancelled") {
|
|
97922
|
-
return
|
|
98112
|
+
return candidate3;
|
|
97923
98113
|
}
|
|
97924
98114
|
candidateStateChanged = true;
|
|
97925
98115
|
return {
|
|
97926
|
-
...
|
|
98116
|
+
...candidate3,
|
|
97927
98117
|
status: "failed",
|
|
97928
98118
|
updatedAt: candidateJob.updatedAt,
|
|
97929
98119
|
metadata: {
|
|
97930
|
-
...
|
|
98120
|
+
...candidate3.metadata,
|
|
97931
98121
|
terminalJobStatus: candidateJob.status,
|
|
97932
98122
|
terminalJobError: candidateJob.error
|
|
97933
98123
|
}
|
|
@@ -97939,7 +98129,7 @@ async function syncModelTrainingCreateImproveRuns(input) {
|
|
|
97939
98129
|
updatedAt: new Date(
|
|
97940
98130
|
Math.max(
|
|
97941
98131
|
Date.parse(run.updatedAt),
|
|
97942
|
-
...reconciledCandidates.map((
|
|
98132
|
+
...reconciledCandidates.map((candidate3) => Date.parse(candidate3.updatedAt))
|
|
97943
98133
|
)
|
|
97944
98134
|
).toISOString()
|
|
97945
98135
|
});
|
|
@@ -98050,8 +98240,8 @@ function compareFrozenEvaluationContract(expectedTaskIds, activeAttempts, candid
|
|
|
98050
98240
|
}
|
|
98051
98241
|
for (const taskId of expectedTaskIds) {
|
|
98052
98242
|
const active = activeByTask.get(taskId);
|
|
98053
|
-
const
|
|
98054
|
-
if (active.seed !==
|
|
98243
|
+
const candidate3 = candidateByTask.get(taskId);
|
|
98244
|
+
if (active.seed !== candidate3.seed || active.attempt !== candidate3.attempt || active.split !== candidate3.split) {
|
|
98055
98245
|
return `Base and trained model evaluation used different budgets or seeds for task ${taskId}.`;
|
|
98056
98246
|
}
|
|
98057
98247
|
}
|
|
@@ -98124,16 +98314,22 @@ function createTrainingApi(deps) {
|
|
|
98124
98314
|
}
|
|
98125
98315
|
if (action === "delete_taskset") return deps.training.deleteTaskset(requiredString5(input.tasksetId, "tasksetId"));
|
|
98126
98316
|
if (action === "create_model_from_taskset") {
|
|
98317
|
+
const preferredBaseModel = requiredBaseModelPreference(
|
|
98318
|
+
input.preferredBaseModel,
|
|
98319
|
+
input.preferredBaseModelId
|
|
98320
|
+
);
|
|
98127
98321
|
return createModelFromTaskset({
|
|
98128
98322
|
profileId: requiredString5(input.profileId, "profileId"),
|
|
98129
98323
|
tasksetId: requiredString5(input.tasksetId, "tasksetId"),
|
|
98130
|
-
preferredBaseModelId:
|
|
98131
|
-
|
|
98132
|
-
"preferredBaseModelId"
|
|
98133
|
-
)
|
|
98324
|
+
preferredBaseModelId: preferredBaseModel.modelId,
|
|
98325
|
+
preferredBaseModel
|
|
98134
98326
|
});
|
|
98135
98327
|
}
|
|
98136
98328
|
if (action === "start_creation") {
|
|
98329
|
+
const preferredBaseModel = nullableBaseModelPreference(
|
|
98330
|
+
input.preferredBaseModel,
|
|
98331
|
+
input.preferredBaseModelId
|
|
98332
|
+
);
|
|
98137
98333
|
return startModelCreation({
|
|
98138
98334
|
profileId: requiredString5(input.profileId, "profileId"),
|
|
98139
98335
|
sourceIds: stringArray9(input.sourceIds),
|
|
@@ -98143,7 +98339,8 @@ function createTrainingApi(deps) {
|
|
|
98143
98339
|
resourceIntent: input.resourceIntent === "dataset" ? "dataset" : "workproduct",
|
|
98144
98340
|
objective: string(input.objective),
|
|
98145
98341
|
methodHint: trainingMethodHint(input.methodHint),
|
|
98146
|
-
preferredBaseModelId:
|
|
98342
|
+
preferredBaseModelId: preferredBaseModel?.modelId ?? null,
|
|
98343
|
+
preferredBaseModel,
|
|
98147
98344
|
candidateId: string(input.candidateId),
|
|
98148
98345
|
analysisModel: input.analysisModel ? ChatModelRefSchema.parse(input.analysisModel) : null,
|
|
98149
98346
|
analysisReasoningEffort: input.analysisReasoningEffort ? CodexReasoningEffortSchema.parse(input.analysisReasoningEffort) : null,
|
|
@@ -98167,11 +98364,11 @@ function createTrainingApi(deps) {
|
|
|
98167
98364
|
if (action === "configure_miner") return deps.taskMiner.updateConfig(requiredString5(input.profileId, "profileId"), TaskMinerConfigSchema.parse(input.config));
|
|
98168
98365
|
if (action === "patch_candidate") return deps.taskMiner.patch(requiredString5(input.candidateId, "candidateId"), PatchTaskCandidateRequestSchema.parse(input.patch));
|
|
98169
98366
|
if (action === "create_candidate") {
|
|
98170
|
-
const
|
|
98171
|
-
if (!
|
|
98172
|
-
const sourceIds = [...new Set(
|
|
98173
|
-
await deps.taskMiner.patch(
|
|
98174
|
-
return startModelCreation({ profileId:
|
|
98367
|
+
const candidate3 = await deps.store.getTaskCandidate(requiredString5(input.candidateId, "candidateId"));
|
|
98368
|
+
if (!candidate3) throw new Error("Task Candidate not found.");
|
|
98369
|
+
const sourceIds = [...new Set(candidate3.evidence.flatMap((item2) => item2.sourceRefIds))];
|
|
98370
|
+
await deps.taskMiner.patch(candidate3.id, { status: "creating" });
|
|
98371
|
+
return startModelCreation({ profileId: candidate3.profileId, sourceIds, surface: "task_candidate", mode: input.mode === "customize" ? "customize" : "defaults", entryMode: "automated", objective: string(input.objective) ?? candidate3.summary, candidateId: candidate3.id, analysisModel: input.analysisModel ? ChatModelRefSchema.parse(input.analysisModel) : null, analysisReasoningEffort: input.analysisReasoningEffort ? CodexReasoningEffortSchema.parse(input.analysisReasoningEffort) : null });
|
|
98175
98372
|
}
|
|
98176
98373
|
if (action === "grade") return deps.evaluation.grade({ tasksetId: requiredString5(input.tasksetId, "tasksetId"), taskId: requiredString5(input.taskId, "taskId"), attempt: input.attempt });
|
|
98177
98374
|
if (action === "baseline") return deps.evaluation.baseline({ tasksetId: requiredString5(input.tasksetId, "tasksetId"), models: modelRefs(input.models), seeds: numberArray(input.seeds), attemptsPerTask: number(input.attemptsPerTask) });
|
|
@@ -98254,8 +98451,8 @@ function createTrainingApi(deps) {
|
|
|
98254
98451
|
limit: 100
|
|
98255
98452
|
});
|
|
98256
98453
|
const stableModelId = result.plan.modelId;
|
|
98257
|
-
const exactRun = linkedRuns.find((
|
|
98258
|
-
const unexecutedPriorRun = linkedRuns.find((
|
|
98454
|
+
const exactRun = linkedRuns.find((candidate3) => (!stableModelId || candidate3.target.id === stableModelId) && candidate3.tasksetRef?.id === taskset.id && candidate3.tasksetRef.revision === taskset.revision && candidate3.tasksetRef.contentHash === taskset.contentHash && candidate3.target.kind === "model" && !candidate3.target.trainingPlanId && !candidate3.target.trainingJobId && !candidate3.target.artifactId && candidate3.externalExecutionRefs.length === 0 && candidate3.evaluationReceipts.length === 0) ?? null;
|
|
98455
|
+
const unexecutedPriorRun = linkedRuns.find((candidate3) => (!stableModelId || candidate3.target.id === stableModelId) && candidate3.tasksetRef?.id === taskset.id && candidate3.target.kind === "model" && !candidate3.target.trainingPlanId && !candidate3.target.trainingJobId && !candidate3.target.artifactId && candidate3.externalExecutionRefs.length === 0 && candidate3.evaluationReceipts.length === 0) ?? null;
|
|
98259
98456
|
const linkedRun = exactRun ?? (unexecutedPriorRun ? advanceUnexecutedModelRunTasksetRef(unexecutedPriorRun, taskset) : null);
|
|
98260
98457
|
let run;
|
|
98261
98458
|
if (linkedRun?.tasksetRef) {
|
|
@@ -98280,7 +98477,7 @@ function createTrainingApi(deps) {
|
|
|
98280
98477
|
modelId: stableModelId,
|
|
98281
98478
|
tasksetId: result.plan.tasksetId,
|
|
98282
98479
|
displayName: linkedRuns.find(
|
|
98283
|
-
(
|
|
98480
|
+
(candidate3) => candidate3.target.id === stableModelId
|
|
98284
98481
|
)?.target.displayName ?? taskset.name,
|
|
98285
98482
|
trainingPlanId: result.plan.id,
|
|
98286
98483
|
trainingJobId: result.job.id,
|
|
@@ -98322,7 +98519,8 @@ function createTrainingApi(deps) {
|
|
|
98322
98519
|
sources,
|
|
98323
98520
|
targetIntent: input.targetIntent,
|
|
98324
98521
|
resourceIntent: input.resourceIntent,
|
|
98325
|
-
preferredBaseModelId: input.preferredBaseModelId
|
|
98522
|
+
preferredBaseModelId: input.preferredBaseModelId,
|
|
98523
|
+
preferredBaseModel: input.preferredBaseModel
|
|
98326
98524
|
});
|
|
98327
98525
|
const existingRun = input.createImproveRunId ? await deps.store.getCreateImproveRun(input.createImproveRunId) : null;
|
|
98328
98526
|
if (input.createImproveRunId && !existingRun) {
|
|
@@ -98339,7 +98537,8 @@ function createTrainingApi(deps) {
|
|
|
98339
98537
|
blockedReason: null,
|
|
98340
98538
|
metadata: {
|
|
98341
98539
|
...existingRun.metadata,
|
|
98342
|
-
preferredBaseModelId: input.preferredBaseModelId ?? null
|
|
98540
|
+
preferredBaseModelId: input.preferredBaseModelId ?? null,
|
|
98541
|
+
preferredBaseModel: input.preferredBaseModel ?? null
|
|
98343
98542
|
},
|
|
98344
98543
|
updatedAt: freshRun.updatedAt
|
|
98345
98544
|
}) : freshRun;
|
|
@@ -98371,11 +98570,13 @@ function createTrainingApi(deps) {
|
|
|
98371
98570
|
(run2) => run2.tasksetRef?.id === taskset.id && run2.tasksetRef.revision === taskset.revision && run2.tasksetRef.contentHash === taskset.contentHash
|
|
98372
98571
|
);
|
|
98373
98572
|
if (existing) {
|
|
98374
|
-
|
|
98573
|
+
const preferenceChanged = existing.metadata.preferredBaseModelId !== input.preferredBaseModelId || JSON.stringify(existing.metadata.preferredBaseModel ?? null) !== JSON.stringify(input.preferredBaseModel);
|
|
98574
|
+
if (preferenceChanged && existing.target.kind === "model" && !existing.target.trainingPlanId && !existing.target.trainingJobId && !existing.target.artifactId && existing.externalExecutionRefs.length === 0) {
|
|
98375
98575
|
const updated = nextCreateImproveRunRevision(existing, {
|
|
98376
98576
|
metadata: {
|
|
98377
98577
|
...existing.metadata,
|
|
98378
|
-
preferredBaseModelId: input.preferredBaseModelId
|
|
98578
|
+
preferredBaseModelId: input.preferredBaseModelId,
|
|
98579
|
+
preferredBaseModel: input.preferredBaseModel
|
|
98379
98580
|
},
|
|
98380
98581
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
98381
98582
|
});
|
|
@@ -98386,7 +98587,8 @@ function createTrainingApi(deps) {
|
|
|
98386
98587
|
const run = createExistingTasksetModelCreateImproveRun({
|
|
98387
98588
|
profileId: input.profileId,
|
|
98388
98589
|
taskset,
|
|
98389
|
-
preferredBaseModelId: input.preferredBaseModelId
|
|
98590
|
+
preferredBaseModelId: input.preferredBaseModelId,
|
|
98591
|
+
preferredBaseModel: input.preferredBaseModel
|
|
98390
98592
|
});
|
|
98391
98593
|
return deps.store.upsertCreateImproveRun(run);
|
|
98392
98594
|
}
|
|
@@ -98416,6 +98618,7 @@ function createTrainingApi(deps) {
|
|
|
98416
98618
|
targetIntent,
|
|
98417
98619
|
resourceIntent: creation.request.resourceIntent,
|
|
98418
98620
|
preferredBaseModelId: creation.request.preferredBaseModelId,
|
|
98621
|
+
preferredBaseModel: creation.request.preferredBaseModel,
|
|
98419
98622
|
timestamp: timestamp2
|
|
98420
98623
|
});
|
|
98421
98624
|
await deps.store.upsertCreateImproveRun({
|
|
@@ -98460,6 +98663,17 @@ function requiredString5(value, name) {
|
|
|
98460
98663
|
if (!parsed) throw new Error(`${name} is required.`);
|
|
98461
98664
|
return parsed;
|
|
98462
98665
|
}
|
|
98666
|
+
function nullableBaseModelPreference(value, legacyId) {
|
|
98667
|
+
const parsed = BaseModelPreferenceSchema.safeParse(value);
|
|
98668
|
+
if (parsed.success) return parsed.data;
|
|
98669
|
+
const modelId = string(legacyId);
|
|
98670
|
+
return modelId ? legacyBaseModelPreference(modelId) : null;
|
|
98671
|
+
}
|
|
98672
|
+
function requiredBaseModelPreference(value, legacyId) {
|
|
98673
|
+
const preference = nullableBaseModelPreference(value, legacyId);
|
|
98674
|
+
if (!preference) throw new Error("preferredBaseModel is required.");
|
|
98675
|
+
return preference;
|
|
98676
|
+
}
|
|
98463
98677
|
function stringArray9(value) {
|
|
98464
98678
|
return Array.isArray(value) ? value.filter((item2) => typeof item2 === "string" && Boolean(item2.trim())).map((item2) => item2.trim()) : [];
|
|
98465
98679
|
}
|
|
@@ -98488,13 +98702,13 @@ function trainingMethodHint(value) {
|
|
|
98488
98702
|
return value === "sft" || value === "dpo" || value === "grpo" ? value : null;
|
|
98489
98703
|
}
|
|
98490
98704
|
function tasksetTargetIntent(value) {
|
|
98491
|
-
const
|
|
98492
|
-
const kind =
|
|
98705
|
+
const candidate3 = record11(value);
|
|
98706
|
+
const kind = candidate3.kind;
|
|
98493
98707
|
return {
|
|
98494
98708
|
kind: kind === "agent" || kind === "skill" || kind === "extension" || kind === "model" || kind === "configuration" ? kind : null,
|
|
98495
|
-
id: string(
|
|
98496
|
-
displayName: string(
|
|
98497
|
-
operation:
|
|
98709
|
+
id: string(candidate3.id),
|
|
98710
|
+
displayName: string(candidate3.displayName),
|
|
98711
|
+
operation: candidate3.operation === "improve" ? "improve" : "create"
|
|
98498
98712
|
};
|
|
98499
98713
|
}
|
|
98500
98714
|
function creationSurface(value) {
|
|
@@ -98503,10 +98717,10 @@ function creationSurface(value) {
|
|
|
98503
98717
|
function crossSystemWorldSpecs(value) {
|
|
98504
98718
|
if (!Array.isArray(value)) throw new Error("worldSpecs must be an array.");
|
|
98505
98719
|
return value.map((item2) => {
|
|
98506
|
-
const
|
|
98507
|
-
const seed = number(
|
|
98508
|
-
const split =
|
|
98509
|
-
const difficulty =
|
|
98720
|
+
const candidate3 = record11(item2);
|
|
98721
|
+
const seed = number(candidate3.seed);
|
|
98722
|
+
const split = candidate3.split;
|
|
98723
|
+
const difficulty = candidate3.difficulty;
|
|
98510
98724
|
if (!Number.isInteger(seed) || split !== "train" && split !== "validation" && split !== "frozen_eval" || difficulty !== "easy" && difficulty !== "medium" && difficulty !== "hard") {
|
|
98511
98725
|
throw new Error("Each world spec requires an integer seed, valid split, and valid difficulty.");
|
|
98512
98726
|
}
|
|
@@ -98515,7 +98729,7 @@ function crossSystemWorldSpecs(value) {
|
|
|
98515
98729
|
}
|
|
98516
98730
|
|
|
98517
98731
|
// ../server/src/training/training-chat-search.ts
|
|
98518
|
-
import { createHash as
|
|
98732
|
+
import { createHash as createHash13 } from "node:crypto";
|
|
98519
98733
|
function createTrainingChatSearchService(deps) {
|
|
98520
98734
|
let metadataKey = null;
|
|
98521
98735
|
let activeIndexKey = null;
|
|
@@ -98531,7 +98745,7 @@ function createTrainingChatSearchService(deps) {
|
|
|
98531
98745
|
query: request.query,
|
|
98532
98746
|
offset: request.offset,
|
|
98533
98747
|
limit: request.limit,
|
|
98534
|
-
candidateIds: candidates.map((
|
|
98748
|
+
candidateIds: candidates.map((candidate3) => candidate3.sessionId)
|
|
98535
98749
|
});
|
|
98536
98750
|
return TrainingChatSearchResultSchema.parse(result);
|
|
98537
98751
|
}
|
|
@@ -98539,23 +98753,23 @@ function createTrainingChatSearchService(deps) {
|
|
|
98539
98753
|
const nextKey = candidateSetKey(candidates);
|
|
98540
98754
|
if (metadataKey === nextKey) return;
|
|
98541
98755
|
const [openPondEvidence, knownCodexSignatures] = await Promise.all([
|
|
98542
|
-
deps.store.openPondTrainingChatSearchEvidence(candidates.map((
|
|
98756
|
+
deps.store.openPondTrainingChatSearchEvidence(candidates.map((candidate3) => candidate3.sessionId)),
|
|
98543
98757
|
deps.store.trainingChatSearchSignatures("codex")
|
|
98544
98758
|
]);
|
|
98545
98759
|
const openPondDocuments = openPondSearchDocuments(openPondEvidence);
|
|
98546
98760
|
const knownOpenPondIds = new Set(openPondDocuments.map((document) => document.sessionId));
|
|
98547
|
-
for (const
|
|
98548
|
-
if (knownOpenPondIds.has(
|
|
98549
|
-
openPondDocuments.push(candidateDocument("openpond",
|
|
98761
|
+
for (const candidate3 of candidates) {
|
|
98762
|
+
if (knownOpenPondIds.has(candidate3.sessionId) || codexHistoryThreadIdFromSessionId(candidate3.sessionId)) continue;
|
|
98763
|
+
openPondDocuments.push(candidateDocument("openpond", candidate3, "", `title:${candidateSignature(candidate3)}`, true));
|
|
98550
98764
|
}
|
|
98551
|
-
const codexDocuments = candidates.flatMap((
|
|
98552
|
-
if (!codexHistoryThreadIdFromSessionId(
|
|
98553
|
-
const baseSignature = candidateSignature(
|
|
98765
|
+
const codexDocuments = candidates.flatMap((candidate3) => {
|
|
98766
|
+
if (!codexHistoryThreadIdFromSessionId(candidate3.sessionId)) return [];
|
|
98767
|
+
const baseSignature = candidateSignature(candidate3);
|
|
98554
98768
|
const bodySignature = `body:${baseSignature}`;
|
|
98555
|
-
const indexed = knownCodexSignatures.get(
|
|
98769
|
+
const indexed = knownCodexSignatures.get(candidate3.sessionId) === bodySignature;
|
|
98556
98770
|
return [candidateDocument(
|
|
98557
98771
|
"codex",
|
|
98558
|
-
|
|
98772
|
+
candidate3,
|
|
98559
98773
|
"",
|
|
98560
98774
|
indexed ? bodySignature : `metadata:${baseSignature}`,
|
|
98561
98775
|
indexed
|
|
@@ -98568,7 +98782,7 @@ function createTrainingChatSearchService(deps) {
|
|
|
98568
98782
|
metadataKey = nextKey;
|
|
98569
98783
|
}
|
|
98570
98784
|
function scheduleBodyIndex(candidates) {
|
|
98571
|
-
const codexCandidates = candidates.filter((
|
|
98785
|
+
const codexCandidates = candidates.filter((candidate3) => codexHistoryThreadIdFromSessionId(candidate3.sessionId));
|
|
98572
98786
|
const key = candidateSetKey(codexCandidates);
|
|
98573
98787
|
if (!codexCandidates.length || key === activeIndexKey || key === completedIndexKey || pendingIndex?.key === key) return;
|
|
98574
98788
|
pendingIndex = { candidates: codexCandidates, key };
|
|
@@ -98593,14 +98807,14 @@ function createTrainingChatSearchService(deps) {
|
|
|
98593
98807
|
deps.store.trainingChatSearchSignatures("codex")
|
|
98594
98808
|
]);
|
|
98595
98809
|
const fileByThreadId = new Map(files.map((file) => [file.threadId, file]));
|
|
98596
|
-
for (const
|
|
98597
|
-
const bodySignature = `body:${candidateSignature(
|
|
98598
|
-
if (knownSignatures.get(
|
|
98599
|
-
const threadId = codexHistoryThreadIdFromSessionId(
|
|
98810
|
+
for (const candidate3 of candidates) {
|
|
98811
|
+
const bodySignature = `body:${candidateSignature(candidate3)}`;
|
|
98812
|
+
if (knownSignatures.get(candidate3.sessionId) === bodySignature) continue;
|
|
98813
|
+
const threadId = codexHistoryThreadIdFromSessionId(candidate3.sessionId);
|
|
98600
98814
|
const file = threadId ? fileByThreadId.get(threadId) : null;
|
|
98601
98815
|
const body = file ? await readCodexHistorySearchText({ filePath: file.filePath }).catch(() => "") : "";
|
|
98602
98816
|
await deps.store.upsertTrainingChatSearchDocument(
|
|
98603
|
-
candidateDocument("codex",
|
|
98817
|
+
candidateDocument("codex", candidate3, body, bodySignature, true)
|
|
98604
98818
|
);
|
|
98605
98819
|
await yieldToRuntime();
|
|
98606
98820
|
}
|
|
@@ -98621,31 +98835,31 @@ function openPondSearchDocuments(evidence) {
|
|
|
98621
98835
|
};
|
|
98622
98836
|
});
|
|
98623
98837
|
}
|
|
98624
|
-
function candidateDocument(source,
|
|
98838
|
+
function candidateDocument(source, candidate3, body, signature, bodyIndexed) {
|
|
98625
98839
|
return {
|
|
98626
|
-
sessionId:
|
|
98840
|
+
sessionId: candidate3.sessionId,
|
|
98627
98841
|
source,
|
|
98628
98842
|
signature,
|
|
98629
|
-
title:
|
|
98843
|
+
title: candidate3.title,
|
|
98630
98844
|
body,
|
|
98631
|
-
updatedAt:
|
|
98845
|
+
updatedAt: candidate3.updatedAt,
|
|
98632
98846
|
eligible: true,
|
|
98633
98847
|
bodyIndexed
|
|
98634
98848
|
};
|
|
98635
98849
|
}
|
|
98636
98850
|
function uniqueCandidates(candidates) {
|
|
98637
98851
|
const byId = /* @__PURE__ */ new Map();
|
|
98638
|
-
for (const
|
|
98852
|
+
for (const candidate3 of candidates) byId.set(candidate3.sessionId, candidate3);
|
|
98639
98853
|
return [...byId.values()];
|
|
98640
98854
|
}
|
|
98641
98855
|
function candidateSetKey(candidates) {
|
|
98642
|
-
return hash2(candidates.map((
|
|
98856
|
+
return hash2(candidates.map((candidate3) => `${candidate3.sessionId}:${candidate3.title}:${candidate3.updatedAt}`).sort());
|
|
98643
98857
|
}
|
|
98644
|
-
function candidateSignature(
|
|
98645
|
-
return hash2([
|
|
98858
|
+
function candidateSignature(candidate3) {
|
|
98859
|
+
return hash2([candidate3.sessionId, candidate3.title, candidate3.updatedAt]);
|
|
98646
98860
|
}
|
|
98647
98861
|
function hash2(parts) {
|
|
98648
|
-
return
|
|
98862
|
+
return createHash13("sha256").update(parts.join("\0")).digest("hex");
|
|
98649
98863
|
}
|
|
98650
98864
|
function yieldToRuntime() {
|
|
98651
98865
|
return new Promise((resolve) => setImmediate(resolve));
|
|
@@ -98860,15 +99074,15 @@ function migProfileBytes(profile) {
|
|
|
98860
99074
|
}
|
|
98861
99075
|
function firstString(value, keys) {
|
|
98862
99076
|
for (const key of keys) {
|
|
98863
|
-
const
|
|
98864
|
-
if (typeof
|
|
99077
|
+
const candidate3 = value[key];
|
|
99078
|
+
if (typeof candidate3 === "string" && candidate3.trim()) return candidate3.trim();
|
|
98865
99079
|
}
|
|
98866
99080
|
return null;
|
|
98867
99081
|
}
|
|
98868
99082
|
function firstNumber(value, keys) {
|
|
98869
99083
|
for (const key of keys) {
|
|
98870
|
-
const
|
|
98871
|
-
const parsed = typeof
|
|
99084
|
+
const candidate3 = value[key];
|
|
99085
|
+
const parsed = typeof candidate3 === "number" ? candidate3 : typeof candidate3 === "string" ? Number.parseInt(candidate3.replace(/[^\d]/g, ""), 10) : Number.NaN;
|
|
98872
99086
|
if (Number.isSafeInteger(parsed) && parsed >= 0) return parsed;
|
|
98873
99087
|
}
|
|
98874
99088
|
return null;
|
|
@@ -98932,8 +99146,8 @@ function macOperatingSystem(swVers) {
|
|
|
98932
99146
|
return [name, version, build ? `(${build})` : null].filter(Boolean).join(" ");
|
|
98933
99147
|
}
|
|
98934
99148
|
function arrayForKey(value, key) {
|
|
98935
|
-
const
|
|
98936
|
-
return Array.isArray(
|
|
99149
|
+
const candidate3 = value[key];
|
|
99150
|
+
return Array.isArray(candidate3) ? candidate3.filter((item2) => Boolean(item2) && typeof item2 === "object" && !Array.isArray(item2)) : [];
|
|
98937
99151
|
}
|
|
98938
99152
|
function stringField2(value, key) {
|
|
98939
99153
|
return typeof value[key] === "string" && value[key].trim() ? value[key].trim() : null;
|
|
@@ -98955,7 +99169,7 @@ function parseProfilerMemory(value) {
|
|
|
98955
99169
|
}
|
|
98956
99170
|
|
|
98957
99171
|
// ../server/src/compute/model-discovery.ts
|
|
98958
|
-
import { createHash as
|
|
99172
|
+
import { createHash as createHash14 } from "node:crypto";
|
|
98959
99173
|
import { readdir as readdir2, readFile as readFile14, stat as stat3 } from "node:fs/promises";
|
|
98960
99174
|
import os11 from "node:os";
|
|
98961
99175
|
import path67 from "node:path";
|
|
@@ -98967,7 +99181,7 @@ async function discoverModelAssets(settings, scannedAt) {
|
|
|
98967
99181
|
const roots = uniqueRoots([
|
|
98968
99182
|
{ path: path67.join(os11.homedir(), ".cache", "huggingface", "hub"), source: "huggingface", maxDepth: 3 },
|
|
98969
99183
|
...settings.modelStorePath ? [{ path: settings.modelStorePath, source: "local", maxDepth: 4 }] : [],
|
|
98970
|
-
...settings.additionalModelPaths.map((
|
|
99184
|
+
...settings.additionalModelPaths.map((candidate3) => ({ path: candidate3, source: candidate3.toLowerCase().includes("mlx") ? "mlx" : "local", maxDepth: 3 }))
|
|
98971
99185
|
]);
|
|
98972
99186
|
const local = (await Promise.all(roots.map(async (root) => {
|
|
98973
99187
|
try {
|
|
@@ -99119,7 +99333,7 @@ async function readJson2(filePath2) {
|
|
|
99119
99333
|
}
|
|
99120
99334
|
}
|
|
99121
99335
|
function hash3(value) {
|
|
99122
|
-
return
|
|
99336
|
+
return createHash14("sha256").update(value).digest("hex");
|
|
99123
99337
|
}
|
|
99124
99338
|
function stringValue26(value) {
|
|
99125
99339
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
@@ -99514,10 +99728,10 @@ function decodeSafely(value) {
|
|
|
99514
99728
|
}
|
|
99515
99729
|
function uniqueCandidates2(candidates) {
|
|
99516
99730
|
const unique2 = /* @__PURE__ */ new Map();
|
|
99517
|
-
for (const
|
|
99518
|
-
const key = normalizedPath(
|
|
99731
|
+
for (const candidate3 of candidates) {
|
|
99732
|
+
const key = normalizedPath(candidate3.path);
|
|
99519
99733
|
const current = unique2.get(key);
|
|
99520
|
-
if (!current || current.label === "System disk") unique2.set(key,
|
|
99734
|
+
if (!current || current.label === "System disk") unique2.set(key, candidate3);
|
|
99521
99735
|
}
|
|
99522
99736
|
return [...unique2.values()];
|
|
99523
99737
|
}
|
|
@@ -99732,15 +99946,15 @@ function createComputeService(deps) {
|
|
|
99732
99946
|
const discovered = deps.storageCandidates ? await deps.storageCandidates() : await discoverStorageCandidates({ commandProbe, platform, storeDir: deps.storeDir });
|
|
99733
99947
|
const configuredPaths = new Set([currentSettings.modelStorePath, ...currentSettings.additionalModelPaths].filter((value) => Boolean(value)).map(normalizedPath2));
|
|
99734
99948
|
const candidates = [...discovered];
|
|
99735
|
-
if (currentSettings.modelStorePath && !discovered.some((
|
|
99949
|
+
if (currentSettings.modelStorePath && !discovered.some((candidate3) => normalizedPath2(candidate3.modelStorePath) === normalizedPath2(currentSettings.modelStorePath))) {
|
|
99736
99950
|
candidates.push({ path: currentSettings.modelStorePath, modelStorePath: currentSettings.modelStorePath, label: "Manual location", kind: storageKindForPath(currentSettings.modelStorePath) });
|
|
99737
99951
|
}
|
|
99738
|
-
for (const
|
|
99739
|
-
if (candidates.some((existing) => normalizedPath2(existing.path) === normalizedPath2(
|
|
99740
|
-
candidates.push({ path:
|
|
99952
|
+
for (const candidate3 of currentSettings.additionalModelPaths) {
|
|
99953
|
+
if (candidates.some((existing) => normalizedPath2(existing.path) === normalizedPath2(candidate3) || normalizedPath2(existing.modelStorePath) === normalizedPath2(candidate3))) continue;
|
|
99954
|
+
candidates.push({ path: candidate3, modelStorePath: candidate3, label: path70.basename(candidate3) || candidate3, kind: storageKindForPath(candidate3) });
|
|
99741
99955
|
}
|
|
99742
|
-
return Promise.all(uniqueByPath(candidates).map(async (
|
|
99743
|
-
const resolved = path70.resolve(
|
|
99956
|
+
return Promise.all(uniqueByPath(candidates).map(async (candidate3) => {
|
|
99957
|
+
const resolved = path70.resolve(candidate3.path);
|
|
99744
99958
|
let mounted = false;
|
|
99745
99959
|
let writable = false;
|
|
99746
99960
|
let totalBytes = null;
|
|
@@ -99750,16 +99964,16 @@ function createComputeService(deps) {
|
|
|
99750
99964
|
mounted = true;
|
|
99751
99965
|
totalBytes = safeBytes(stats.blocks, stats.bsize);
|
|
99752
99966
|
freeBytes = safeBytes(stats.bavail, stats.bsize);
|
|
99753
|
-
writable = await canWriteOrCreate(
|
|
99967
|
+
writable = await canWriteOrCreate(candidate3.modelStorePath);
|
|
99754
99968
|
} catch {
|
|
99755
99969
|
}
|
|
99756
99970
|
return {
|
|
99757
99971
|
id: `storage:${pathId(resolved)}`,
|
|
99758
|
-
label:
|
|
99972
|
+
label: candidate3.label,
|
|
99759
99973
|
path: resolved,
|
|
99760
|
-
modelStorePath: path70.resolve(
|
|
99761
|
-
kind:
|
|
99762
|
-
configured: configuredPaths.has(normalizedPath2(
|
|
99974
|
+
modelStorePath: path70.resolve(candidate3.modelStorePath),
|
|
99975
|
+
kind: candidate3.kind,
|
|
99976
|
+
configured: configuredPaths.has(normalizedPath2(candidate3.modelStorePath)) || configuredPaths.has(normalizedPath2(candidate3.path)),
|
|
99763
99977
|
mounted,
|
|
99764
99978
|
writable,
|
|
99765
99979
|
totalBytes,
|
|
@@ -99850,15 +100064,15 @@ function safeBytes(blocks, size) {
|
|
|
99850
100064
|
return Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
99851
100065
|
}
|
|
99852
100066
|
async function canWriteOrCreate(target) {
|
|
99853
|
-
let
|
|
100067
|
+
let candidate3 = path70.resolve(target);
|
|
99854
100068
|
while (true) {
|
|
99855
100069
|
try {
|
|
99856
|
-
await access6(
|
|
100070
|
+
await access6(candidate3, constants3.W_OK);
|
|
99857
100071
|
return true;
|
|
99858
100072
|
} catch {
|
|
99859
|
-
const parent = path70.dirname(
|
|
99860
|
-
if (parent ===
|
|
99861
|
-
|
|
100073
|
+
const parent = path70.dirname(candidate3);
|
|
100074
|
+
if (parent === candidate3) return false;
|
|
100075
|
+
candidate3 = parent;
|
|
99862
100076
|
}
|
|
99863
100077
|
}
|
|
99864
100078
|
}
|
|
@@ -101210,19 +101424,19 @@ ${grader.rubric}`
|
|
|
101210
101424
|
getCreateImproveCandidateDiffPayload: async (runId, candidateId) => {
|
|
101211
101425
|
const run = await getCreateImproveRun(runId);
|
|
101212
101426
|
if (!run) throw new Error("Create/Improve run not found.");
|
|
101213
|
-
const
|
|
101427
|
+
const candidate3 = run.candidates.find(
|
|
101214
101428
|
(item2) => item2.id === candidateId
|
|
101215
101429
|
);
|
|
101216
|
-
if (!
|
|
101430
|
+
if (!candidate3?.git?.headCommit)
|
|
101217
101431
|
throw new Error("Candidate change is not available.");
|
|
101218
|
-
const repoPath =
|
|
101432
|
+
const repoPath = candidate3.git.worktreePath ?? (run.adapter.kind === "local" || run.adapter.kind === "promote_local_to_hosted" ? run.adapter.repoPath : null);
|
|
101219
101433
|
if (!repoPath)
|
|
101220
101434
|
throw new Error("Candidate source is no longer available.");
|
|
101221
101435
|
return loadGitCommitDiffAtPath(
|
|
101222
101436
|
repoPath,
|
|
101223
|
-
`candidate:${run.id}:${
|
|
101224
|
-
|
|
101225
|
-
|
|
101437
|
+
`candidate:${run.id}:${candidate3.id}`,
|
|
101438
|
+
candidate3.git.baseCommit,
|
|
101439
|
+
candidate3.git.headCommit
|
|
101226
101440
|
);
|
|
101227
101441
|
},
|
|
101228
101442
|
applyCreateImproveAction,
|