@workbench-ai/workbench 0.0.51 → 0.0.53
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/benchmark-fingerprint.d.ts +1 -3
- package/dist/benchmark-fingerprint.d.ts.map +1 -1
- package/dist/benchmark-fingerprint.js +19 -87
- package/dist/command-model.d.ts.map +1 -1
- package/dist/command-model.js +5 -3
- package/dist/dev-open/client.js +2 -2
- package/dist/dev-open-server.js +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +116 -83
- package/dist/local-archive.d.ts +4 -2
- package/dist/local-archive.d.ts.map +1 -1
- package/dist/local-archive.js +115 -24
- package/dist/project-source.d.ts +1 -0
- package/dist/project-source.d.ts.map +1 -1
- package/dist/project-source.js +23 -1
- package/package.json +4 -4
package/dist/local-archive.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises as fs } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { buildWorkbenchTraceSessionsFromFiles, candidateRecordWithoutDerivedFields, sanitizeWorkbenchRuntimeCandidateForExchange, sanitizeWorkbenchRuntimeJobForExchange, selectExecutionOutputFilesForInspection, workbenchRuntimeBundleStats, workbenchSurfaceFilesEqualForExchange, } from "@workbench-ai/workbench-core";
|
|
3
|
+
import { buildWorkbenchTraceSessionsFromFiles, candidateRecordWithoutDerivedFields, sanitizeWorkbenchRuntimeCandidateForExchange, sanitizeWorkbenchRuntimeJobForExchange, selectExecutionOutputFilesForInspection, workbenchRuntimeExplicitActiveId, workbenchRuntimeBundleStats, workbenchSurfaceFilesEqualForExchange, } from "@workbench-ai/workbench-core";
|
|
4
4
|
const RUNTIME_DIR = ".workbench/runtime";
|
|
5
5
|
const CANDIDATE_RECORDS_DIR = "candidates";
|
|
6
6
|
export function localRuntimeDir(workspace) {
|
|
@@ -71,16 +71,24 @@ export async function saveLocalJobs(workspace, jobs) {
|
|
|
71
71
|
}
|
|
72
72
|
await writeArchivedLocalJobs(workspace, jobs, new Map());
|
|
73
73
|
}
|
|
74
|
-
export async function exportLocalRuntimeBundle(workspace) {
|
|
74
|
+
export async function exportLocalRuntimeBundle(workspace, options = {}) {
|
|
75
75
|
const snapshot = await loadLocalArchive(workspace);
|
|
76
76
|
const jobs = (await readLocalJobs(workspace)).map(sanitizeRuntimeJobForExchange);
|
|
77
77
|
const executionFiles = await Promise.all(jobs.map(async (job) => ({
|
|
78
78
|
jobId: job.id,
|
|
79
79
|
files: await readLocalExecutionFiles(workspace, job.id),
|
|
80
80
|
})));
|
|
81
|
+
const activeId = options.currentBenchmarkFingerprint
|
|
82
|
+
? workbenchRuntimeExplicitActiveId({
|
|
83
|
+
candidates: snapshot.candidates,
|
|
84
|
+
runs: snapshot.runs,
|
|
85
|
+
preferredActiveId: snapshot.activeId,
|
|
86
|
+
benchmarkFingerprint: options.currentBenchmarkFingerprint,
|
|
87
|
+
})
|
|
88
|
+
: snapshot.activeId;
|
|
81
89
|
return {
|
|
82
90
|
schema: "workbench.runtime.bundle.v1",
|
|
83
|
-
activeId
|
|
91
|
+
activeId,
|
|
84
92
|
candidates: snapshot.candidates.map(sanitizeWorkbenchRuntimeCandidateForExchange),
|
|
85
93
|
candidateFiles: Object.entries(snapshot.candidateFiles).map(([candidateId, files]) => ({
|
|
86
94
|
candidateId,
|
|
@@ -93,7 +101,7 @@ export async function exportLocalRuntimeBundle(workspace) {
|
|
|
93
101
|
events: snapshot.events.map((event) => ({ ...event })),
|
|
94
102
|
};
|
|
95
103
|
}
|
|
96
|
-
export async function importLocalRuntimeBundle(workspace, bundle) {
|
|
104
|
+
export async function importLocalRuntimeBundle(workspace, bundle, currentBenchmarkFingerprint) {
|
|
97
105
|
validateRuntimeBundleSchema(bundle);
|
|
98
106
|
const snapshot = await loadLocalArchive(workspace);
|
|
99
107
|
const existingJobs = (await readLocalJobs(workspace)).map(sanitizeRuntimeJobForExchange);
|
|
@@ -105,7 +113,7 @@ export async function importLocalRuntimeBundle(workspace, bundle) {
|
|
|
105
113
|
const incomingCandidates = bundle.candidates.map(sanitizeWorkbenchRuntimeCandidateForExchange);
|
|
106
114
|
const candidates = mergeRecordsById(existingCandidates, incomingCandidates, (candidate) => candidate.id, (didChange) => {
|
|
107
115
|
changed ||= didChange;
|
|
108
|
-
}).sort(compareLocalCandidateRecords);
|
|
116
|
+
}, runtimeCandidatesCompatibleForExchange, mergeRuntimeCandidateForExchange).sort(compareLocalCandidateRecords);
|
|
109
117
|
const candidateFiles = { ...snapshot.candidateFiles };
|
|
110
118
|
for (const group of bundle.candidateFiles) {
|
|
111
119
|
const candidateId = localRecordName(group.candidateId);
|
|
@@ -121,21 +129,12 @@ export async function importLocalRuntimeBundle(workspace, bundle) {
|
|
|
121
129
|
}
|
|
122
130
|
candidateFiles[candidateId] = files;
|
|
123
131
|
}
|
|
124
|
-
const candidateIds = new Set(candidates.map((candidate) => candidate.id));
|
|
125
|
-
const activeId = bundle.activeId && candidateIds.has(bundle.activeId)
|
|
126
|
-
? bundle.activeId
|
|
127
|
-
: snapshot.activeId && candidateIds.has(snapshot.activeId)
|
|
128
|
-
? snapshot.activeId
|
|
129
|
-
: null;
|
|
130
|
-
if (activeId !== snapshot.activeId) {
|
|
131
|
-
changed = true;
|
|
132
|
-
}
|
|
133
132
|
const evaluations = mergeRecordsById(snapshot.evaluations, bundle.evaluations, (evaluation) => evaluation.id, (didChange) => {
|
|
134
133
|
changed ||= didChange;
|
|
135
|
-
}).sort((left, right) => left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id));
|
|
134
|
+
}, runtimeEvaluationsCompatibleForExchange).sort((left, right) => left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id));
|
|
136
135
|
const runs = mergeRecordsById(snapshot.runs, bundle.runs, (run) => run.id, (didChange) => {
|
|
137
136
|
changed ||= didChange;
|
|
138
|
-
}).sort((left, right) => left.startedAt.localeCompare(right.startedAt) || left.id.localeCompare(right.id));
|
|
137
|
+
}, runtimeRunsCompatibleForExchange).sort((left, right) => left.startedAt.localeCompare(right.startedAt) || left.id.localeCompare(right.id));
|
|
139
138
|
const events = mergeRecordsById(snapshot.events, bundle.events, runtimeEventKey, (didChange) => {
|
|
140
139
|
changed ||= didChange;
|
|
141
140
|
}).sort((left, right) => left.at.localeCompare(right.at) || left.id.localeCompare(right.id));
|
|
@@ -143,13 +142,20 @@ export async function importLocalRuntimeBundle(workspace, bundle) {
|
|
|
143
142
|
await Promise.all(existingJobs.map(async (job) => {
|
|
144
143
|
executionFilesByJobId.set(job.id, await readLocalExecutionFiles(workspace, job.id));
|
|
145
144
|
}));
|
|
145
|
+
const existingJobById = new Map(existingJobs.map((job) => [job.id, job]));
|
|
146
|
+
const incomingJobById = new Map(bundle.jobs.map(sanitizeRuntimeJobForExchange).map((job) => [job.id, job]));
|
|
146
147
|
for (const group of bundle.executionFiles) {
|
|
147
148
|
const jobId = localRecordName(group.jobId);
|
|
148
149
|
const files = copySurfaceFiles(group.files);
|
|
149
150
|
const existing = executionFilesByJobId.get(jobId);
|
|
150
151
|
if (existing) {
|
|
151
152
|
if (!workbenchSurfaceFilesEqualForExchange(existing, files)) {
|
|
152
|
-
|
|
153
|
+
const existingJob = existingJobById.get(jobId) ?? null;
|
|
154
|
+
const incomingJob = incomingJobById.get(jobId) ?? null;
|
|
155
|
+
if (!existingJob || !incomingJob || !runtimeJobsEqualForExchange(existingJob, incomingJob)) {
|
|
156
|
+
throw new Error(`Runtime history conflict for execution files ${jobId}.`);
|
|
157
|
+
}
|
|
158
|
+
changed = true;
|
|
153
159
|
}
|
|
154
160
|
}
|
|
155
161
|
else {
|
|
@@ -161,6 +167,15 @@ export async function importLocalRuntimeBundle(workspace, bundle) {
|
|
|
161
167
|
changed ||= didChange;
|
|
162
168
|
}, runtimeJobsEqualForExchange).sort((left, right) => (left.startedAt ?? left.createdAt).localeCompare(right.startedAt ?? right.createdAt) ||
|
|
163
169
|
left.id.localeCompare(right.id));
|
|
170
|
+
const activeId = workbenchRuntimeExplicitActiveId({
|
|
171
|
+
candidates,
|
|
172
|
+
runs,
|
|
173
|
+
preferredActiveId: bundle.activeId ?? null,
|
|
174
|
+
benchmarkFingerprint: currentBenchmarkFingerprint,
|
|
175
|
+
});
|
|
176
|
+
if (activeId !== snapshot.activeId) {
|
|
177
|
+
changed = true;
|
|
178
|
+
}
|
|
164
179
|
await saveLocalArchive(workspace, {
|
|
165
180
|
activeId,
|
|
166
181
|
candidates,
|
|
@@ -332,7 +347,7 @@ function validateRuntimeBundleSchema(bundle) {
|
|
|
332
347
|
throw new Error("Unsupported Workbench runtime bundle.");
|
|
333
348
|
}
|
|
334
349
|
}
|
|
335
|
-
function mergeRecordsById(existing, incoming, idFor, markChanged, equal = runtimeRecordsEqual) {
|
|
350
|
+
function mergeRecordsById(existing, incoming, idFor, markChanged, equal = runtimeRecordsEqual, merge = (_left, right) => right) {
|
|
336
351
|
const records = new Map();
|
|
337
352
|
for (const record of existing) {
|
|
338
353
|
records.set(localRecordName(idFor(record)), record);
|
|
@@ -340,13 +355,19 @@ function mergeRecordsById(existing, incoming, idFor, markChanged, equal = runtim
|
|
|
340
355
|
for (const record of incoming) {
|
|
341
356
|
const id = localRecordName(idFor(record));
|
|
342
357
|
const previous = records.get(id);
|
|
343
|
-
if (!previous
|
|
344
|
-
if (previous) {
|
|
345
|
-
throw new Error(`Runtime history conflict for id ${id}.`);
|
|
346
|
-
}
|
|
358
|
+
if (!previous) {
|
|
347
359
|
markChanged(true);
|
|
360
|
+
records.set(id, record);
|
|
361
|
+
continue;
|
|
348
362
|
}
|
|
349
|
-
|
|
363
|
+
if (!equal(previous, record)) {
|
|
364
|
+
throw new Error(`Runtime history conflict for id ${id}.`);
|
|
365
|
+
}
|
|
366
|
+
const merged = merge(previous, record);
|
|
367
|
+
if (!runtimeRecordsEqual(previous, merged)) {
|
|
368
|
+
markChanged(true);
|
|
369
|
+
}
|
|
370
|
+
records.set(id, merged);
|
|
350
371
|
}
|
|
351
372
|
return [...records.values()];
|
|
352
373
|
}
|
|
@@ -355,7 +376,10 @@ function runtimeRecordsEqual(left, right) {
|
|
|
355
376
|
JSON.stringify(canonicalRuntimeJson(right));
|
|
356
377
|
}
|
|
357
378
|
function runtimeJobsEqualForExchange(left, right) {
|
|
358
|
-
|
|
379
|
+
if (runtimeRecordsEqual(runtimeComparableJob(left), runtimeComparableJob(right))) {
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
return runtimeRecordsEqual(runtimeJobIdentityForExchange(left), runtimeJobIdentityForExchange(right));
|
|
359
383
|
}
|
|
360
384
|
function runtimeComparableJob(job) {
|
|
361
385
|
const comparable = sanitizeRuntimeJobForExchange(job);
|
|
@@ -369,6 +393,70 @@ function runtimeComparableJob(job) {
|
|
|
369
393
|
output: portableOutput,
|
|
370
394
|
};
|
|
371
395
|
}
|
|
396
|
+
function runtimeCandidatesCompatibleForExchange(left, right) {
|
|
397
|
+
return runtimeRecordsEqual(runtimeCandidateIdentityForExchange(left), runtimeCandidateIdentityForExchange(right));
|
|
398
|
+
}
|
|
399
|
+
function runtimeCandidateIdentityForExchange(candidate) {
|
|
400
|
+
const { eval: _eval, prompt: _prompt, meta: _meta, status: _status, usage: _usage, visibility: _visibility, ownerUserId: _ownerUserId, ownerUsername: _ownerUsername, metrics: _metrics, candidateRunId: _candidateRunId, candidateRunName: _candidateRunName, ...identity } = candidate;
|
|
401
|
+
return identity;
|
|
402
|
+
}
|
|
403
|
+
function mergeRuntimeCandidateForExchange(left, right) {
|
|
404
|
+
return {
|
|
405
|
+
...left,
|
|
406
|
+
...right,
|
|
407
|
+
...(right.eval ? { eval: right.eval } : left.eval ? { eval: left.eval } : {}),
|
|
408
|
+
...(right.prompt ? { prompt: right.prompt } : left.prompt ? { prompt: left.prompt } : {}),
|
|
409
|
+
...(right.meta !== undefined ? { meta: right.meta } : left.meta !== undefined ? { meta: left.meta } : {}),
|
|
410
|
+
...(right.usage ? { usage: right.usage } : left.usage ? { usage: left.usage } : {}),
|
|
411
|
+
visibility: right.visibility ?? left.visibility,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function runtimeEvaluationsCompatibleForExchange(left, right) {
|
|
415
|
+
if (runtimeRecordsEqual(left, right)) {
|
|
416
|
+
return true;
|
|
417
|
+
}
|
|
418
|
+
return runtimeRecordsEqual(runtimeEvaluationIdentityForExchange(left), runtimeEvaluationIdentityForExchange(right));
|
|
419
|
+
}
|
|
420
|
+
function runtimeEvaluationIdentityForExchange(evaluation) {
|
|
421
|
+
return {
|
|
422
|
+
id: evaluation.id,
|
|
423
|
+
runId: evaluation.runId,
|
|
424
|
+
candidateId: evaluation.candidateId,
|
|
425
|
+
candidateVersion: evaluation.candidateVersion,
|
|
426
|
+
benchmarkFingerprint: evaluation.benchmarkFingerprint,
|
|
427
|
+
candidateFingerprint: evaluation.candidateFingerprint,
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function runtimeRunsCompatibleForExchange(left, right) {
|
|
431
|
+
if (runtimeRecordsEqual(left, right)) {
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
return runtimeRecordsEqual(runtimeRunIdentityForExchange(left), runtimeRunIdentityForExchange(right));
|
|
435
|
+
}
|
|
436
|
+
function runtimeRunIdentityForExchange(run) {
|
|
437
|
+
return {
|
|
438
|
+
id: run.id,
|
|
439
|
+
workflow: run.workflow,
|
|
440
|
+
benchmarkFingerprint: run.benchmarkFingerprint,
|
|
441
|
+
candidateId: run.candidateId ?? null,
|
|
442
|
+
outputCandidateId: run.outputCandidateId ?? null,
|
|
443
|
+
engineRun: run.engineRun,
|
|
444
|
+
improver: run.improver,
|
|
445
|
+
strategy: run.strategy,
|
|
446
|
+
budget: run.budget,
|
|
447
|
+
samples: run.samples,
|
|
448
|
+
attemptsRequested: run.attemptsRequested,
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function runtimeJobIdentityForExchange(job) {
|
|
452
|
+
return {
|
|
453
|
+
id: job.id,
|
|
454
|
+
runId: job.runId,
|
|
455
|
+
candidateId: job.candidateId,
|
|
456
|
+
kind: job.kind,
|
|
457
|
+
attempt: job.attempt,
|
|
458
|
+
};
|
|
459
|
+
}
|
|
372
460
|
function canonicalRuntimeJson(value) {
|
|
373
461
|
if (Array.isArray(value)) {
|
|
374
462
|
return value.map(canonicalRuntimeJson);
|
|
@@ -431,6 +519,9 @@ function validateCandidateRecord(candidate) {
|
|
|
431
519
|
requireArchivePositiveInteger(candidate.ordinal, `candidate ${candidate.id}.ordinal`);
|
|
432
520
|
requireArchiveString(candidate.benchmarkFingerprint, `candidate ${candidate.id}.benchmarkFingerprint`);
|
|
433
521
|
requireArchiveString(candidate.candidateFingerprint, `candidate ${candidate.id}.candidateFingerprint`);
|
|
522
|
+
if (candidate.visibility !== "private" && candidate.visibility !== "public") {
|
|
523
|
+
throw new Error(`candidate ${candidate.id}.visibility must be private or public.`);
|
|
524
|
+
}
|
|
434
525
|
requireArchiveString(candidate.createdAt, `candidate ${candidate.id}.createdAt`);
|
|
435
526
|
}
|
|
436
527
|
function validateEvaluationRecord(evaluation) {
|
package/dist/project-source.d.ts
CHANGED
|
@@ -58,5 +58,6 @@ interface LocalProjectSourceOptions {
|
|
|
58
58
|
}
|
|
59
59
|
export declare function readLocalProjectSource(source: string, options?: LocalProjectSourceOptions): Promise<LocalProjectSource>;
|
|
60
60
|
export declare function readLocalAuthoredProjectSource(source: string, options?: LocalProjectSourceOptions): Promise<LocalAuthoredProjectSource>;
|
|
61
|
+
export declare function hostedEngineResolveFiles(source: LocalProjectSource): HostedFile[];
|
|
61
62
|
export {};
|
|
62
63
|
//# sourceMappingURL=project-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-source.d.ts","sourceRoot":"","sources":["../src/project-source.ts"],"names":[],"mappings":"AAKA,OAAO,EAOL,kCAAkC,EAGlC,KAAK,IAAI,EACT,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":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|
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { BENCHMARK_SPEC_FILE, CANDIDATE_SPEC_FILE, buildWorkbenchProjectSourceFiles, engineResolveInvocationForSpec, normalizeSurfaceFiles, parseWorkbenchSourceFiles, resolveWorkbenchResolvedSourceYaml, serializeWorkbenchResolvedSourceYaml, validateWorkbenchResolvedSourceYaml, } from "@workbench-ai/workbench-core";
|
|
6
|
-
import { assertWorkbenchAdapterOperationSupport, assertWorkbenchAdapterOperationResultOk, collectWorkbenchAdapterInvocations, readWorkbenchAdapterOperationResult, workbenchAdapterOperationCommand, workbenchAdapterOperationResultPath, } from "@workbench-ai/workbench-protocol";
|
|
6
|
+
import { assertWorkbenchAdapterOperationSupport, assertWorkbenchAdapterOperationResultOk, collectWorkbenchAdapterInvocations, readWorkbenchAdapterOperationResult, WORKBENCH_ADAPTER_RESULT_FILE, WORKBENCH_ADAPTER_RESULT_PROTOCOL, workbenchAdapterOperationCommand, workbenchAdapterOperationResultPath, } from "@workbench-ai/workbench-protocol";
|
|
7
7
|
import { readSnapshotFiles, WorkspaceSnapshotError, } from "./workspace-snapshot.js";
|
|
8
8
|
import { defaultAdapterManifests, composeRuntimeDockerfileWithAdapters, resolveDefaultWorkbenchAdapter, resolveProjectAdapterSource, resolveWorkbenchAdaptersForProject, } from "./adapter-project.js";
|
|
9
9
|
import { createAdapterCommandEnv } from "./adapter-command-env.js";
|
|
@@ -136,6 +136,28 @@ export async function readLocalAuthoredProjectSource(source, options = {}) {
|
|
|
136
136
|
],
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
+
export function hostedEngineResolveFiles(source) {
|
|
140
|
+
return [
|
|
141
|
+
...source.engineResolveFiles,
|
|
142
|
+
{
|
|
143
|
+
path: WORKBENCH_ADAPTER_RESULT_FILE,
|
|
144
|
+
content: `${JSON.stringify({
|
|
145
|
+
protocol: WORKBENCH_ADAPTER_RESULT_PROTOCOL,
|
|
146
|
+
operation: "engine.resolve",
|
|
147
|
+
ok: true,
|
|
148
|
+
value: {
|
|
149
|
+
cases: source.engineCases,
|
|
150
|
+
...(source.engineResolveEnvironment
|
|
151
|
+
? { environment: source.engineResolveEnvironment }
|
|
152
|
+
: {}),
|
|
153
|
+
},
|
|
154
|
+
feedback: {
|
|
155
|
+
path: source.engineResolveFingerprintPath,
|
|
156
|
+
},
|
|
157
|
+
}, null, 2)}\n`,
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
}
|
|
139
161
|
async function resolveLocalProjectSourcePaths(source, options) {
|
|
140
162
|
const resolved = path.resolve(source);
|
|
141
163
|
const stat = await fs.stat(resolved).catch(() => null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workbench-ai/workbench",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"yaml": "^2.8.2",
|
|
24
|
-
"@workbench-ai/workbench-
|
|
25
|
-
"@workbench-ai/workbench-
|
|
26
|
-
"@workbench-ai/workbench-
|
|
24
|
+
"@workbench-ai/workbench-built-in-adapters": "0.0.53",
|
|
25
|
+
"@workbench-ai/workbench-core": "0.0.53",
|
|
26
|
+
"@workbench-ai/workbench-protocol": "0.0.53"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@tailwindcss/postcss": "^4.2.2",
|