@workbench-ai/workbench-core 0.0.49 → 0.0.50

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.
@@ -13,6 +13,6 @@ export declare function resolveDockerRuntimeImageRef(imageRef: string, options:
13
13
  }): string;
14
14
  export declare function normalizeRuntimeRegistry(value: string): string;
15
15
  export declare function normalizeWorkbenchWorkerId(value: unknown): string | undefined;
16
- export declare function resolveWorkbenchWorkerId(subjects: readonly unknown[], fallback: string): string;
16
+ export declare function resolveWorkbenchWorkerId(candidates: readonly unknown[], fallback: string): string;
17
17
  export declare function quoteShellArg(value: string): string;
18
18
  //# sourceMappingURL=runtime-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-utils.d.ts","sourceRoot":"","sources":["../src/runtime-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACL,MAAM,kCAAkC,CAAC;AAE1C,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAEvE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIvE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAI/D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE9D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE9D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,kCAAkC,EAAE,IAAI,CAWtG;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,EAChB,OAAO,EA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eAAe,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,GAChF,MAAM,CASR;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9D;AAeD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAS7E;AAED,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,SAAS,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CASjG;AAoBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKnD"}
@@ -75,9 +75,9 @@ export function normalizeWorkbenchWorkerId(value) {
75
75
  }
76
76
  return NON_IDENTIFYING_WORKER_IDS.has(normalized.toLowerCase()) ? undefined : normalized;
77
77
  }
78
- export function resolveWorkbenchWorkerId(subjects, fallback) {
79
- for (const subject of subjects) {
80
- const normalized = normalizeWorkbenchWorkerId(subject);
78
+ export function resolveWorkbenchWorkerId(candidates, fallback) {
79
+ for (const candidate of candidates) {
80
+ const normalized = normalizeWorkbenchWorkerId(candidate);
81
81
  if (normalized) {
82
82
  return normalized;
83
83
  }
@@ -513,17 +513,17 @@ function findDockerSourceRoot() {
513
513
  }
514
514
  const cwd = process.cwd();
515
515
  const moduleDir = path.dirname(fileURLToPath(import.meta.url));
516
- const subjects = [
516
+ const candidates = [
517
517
  cwd,
518
518
  path.resolve(cwd, ".."),
519
519
  path.resolve(cwd, "../.."),
520
520
  path.resolve(cwd, "../../.."),
521
521
  path.resolve(moduleDir, "../../../../../.."),
522
522
  ];
523
- for (const subject of subjects) {
524
- if (existsSync(path.join(subject, "products/workbench/packages/core/worker/sandbox-adapter-runner.cjs")) &&
525
- existsSync(path.join(subject, "products/workbench/packages/core/src/index.ts"))) {
526
- return subject;
523
+ for (const candidate of candidates) {
524
+ if (existsSync(path.join(candidate, "products/workbench/packages/core/worker/sandbox-adapter-runner.cjs")) &&
525
+ existsSync(path.join(candidate, "products/workbench/packages/core/src/index.ts"))) {
526
+ return candidate;
527
527
  }
528
528
  }
529
529
  return null;
@@ -32,7 +32,7 @@ export function createWorkbenchSandboxFileStore(args) {
32
32
  };
33
33
  }
34
34
  export function materializeWorkbenchSandboxInput(args, execution, input) {
35
- if (input.name === "subject") {
35
+ if (input.name === "candidate") {
36
36
  return materializedFileInput(input, args.baseFiles);
37
37
  }
38
38
  if (input.name === "case") {
@@ -165,8 +165,8 @@ export async function executionResultFromCompletedSandboxJob(args) {
165
165
  };
166
166
  }
167
167
  export function outputPayloadForContract(output, outputName) {
168
- if (outputName === "subject_patch") {
169
- return isJsonPayload(output.subjectPatch) ? output.subjectPatch : undefined;
168
+ if (outputName === "candidate_patch") {
169
+ return isJsonPayload(output.candidatePatch) ? output.candidatePatch : undefined;
170
170
  }
171
171
  if (outputName === "result") {
172
172
  return isJsonPayload(output.result) ? output.result : undefined;
@@ -146,7 +146,7 @@ export function createWorkbenchSandboxExecutionMetadata(args) {
146
146
  },
147
147
  capability: {
148
148
  ...args.capability,
149
- subject: { ...args.capability.subject },
149
+ candidate: { ...args.capability.candidate },
150
150
  inputs: args.capability.inputs.map((input) => ({ ...input })),
151
151
  network: { ...args.capability.network },
152
152
  },
@@ -211,11 +211,11 @@ export function createWorkbenchExecutionCapability(execution, options = {}) {
211
211
  const ttlMs = options.ttlMs ?? Math.max(60_000, execution.policy.resources.timeoutMinutes * 60_000 + 60_000);
212
212
  return {
213
213
  executionId: execution.id,
214
- subject: {
214
+ candidate: {
215
215
  tenantId: execution.policy.tenantId,
216
216
  projectId: execution.projectId,
217
217
  runId: execution.runId,
218
- ...(execution.subjectId ? { subjectId: execution.subjectId } : {}),
218
+ ...(execution.candidateId ? { candidateId: execution.candidateId } : {}),
219
219
  },
220
220
  inputs: execution.inputs.map((input) => ({ ...input })),
221
221
  outputPrefix: options.outputPrefix ?? `executions/${execution.id}/outputs/`,
@@ -228,14 +228,14 @@ export function collectExecutionCapabilityScopeIssues(capability, execution, opt
228
228
  if (capability.executionId !== execution.id) {
229
229
  issues.push(`Capability execution id ${capability.executionId} does not match ${execution.id}.`);
230
230
  }
231
- if (capability.subject.tenantId !== execution.policy.tenantId) {
231
+ if (capability.candidate.tenantId !== execution.policy.tenantId) {
232
232
  issues.push(`Capability tenant id does not match execution ${execution.id}.`);
233
233
  }
234
- if (capability.subject.projectId !== execution.projectId || capability.subject.runId !== execution.runId) {
234
+ if (capability.candidate.projectId !== execution.projectId || capability.candidate.runId !== execution.runId) {
235
235
  issues.push(`Capability project/run scope does not match execution ${execution.id}.`);
236
236
  }
237
- if ((capability.subject.subjectId ?? null) !== (execution.subjectId ?? null)) {
238
- issues.push(`Capability subject scope does not match execution ${execution.id}.`);
237
+ if ((capability.candidate.candidateId ?? null) !== (execution.candidateId ?? null)) {
238
+ issues.push(`Capability candidate scope does not match execution ${execution.id}.`);
239
239
  }
240
240
  if (!capability.outputPrefix.startsWith(`executions/${execution.id}/`)) {
241
241
  issues.push(`Capability output prefix must be scoped under executions/${execution.id}/.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workbench-ai/workbench-core",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,8 +22,8 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "yaml": "^2.8.2",
25
- "@workbench-ai/workbench-contract": "0.0.49",
26
- "@workbench-ai/workbench-protocol": "0.0.49"
25
+ "@workbench-ai/workbench-contract": "0.0.50",
26
+ "@workbench-ai/workbench-protocol": "0.0.50"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^24.3.1",
@@ -204,7 +204,7 @@ function runtimeInputsFromInputBundle(bundle) {
204
204
  }
205
205
  }
206
206
  return {
207
- baseFiles: filesByName.get("subject") || [],
207
+ baseFiles: filesByName.get("candidate") || [],
208
208
  engineResolveFiles: filesByName.get("case") || [],
209
209
  traceFiles: filesByName.get("traces") || [],
210
210
  };
@@ -252,7 +252,7 @@ function isJson(value) {
252
252
 
253
253
  function collectExecutionMismatchIssues(jobExecution, execution) {
254
254
  const issues = [];
255
- for (const key of ["id", "projectId", "runId", "subjectId", "purpose"]) {
255
+ for (const key of ["id", "projectId", "runId", "candidateId", "purpose"]) {
256
256
  if ((jobExecution[key] ?? null) !== (execution[key] ?? null)) {
257
257
  issues.push(`job execution ${key} does not match request execution ${key}.`);
258
258
  }
@@ -1,8 +0,0 @@
1
- import type { SurfaceSnapshotFile, WorkbenchSubjectPatch } from "@workbench-ai/workbench-contract";
2
- export interface ApplyWorkbenchSubjectPatchInput {
3
- baseFiles: readonly SurfaceSnapshotFile[];
4
- patch: WorkbenchSubjectPatch;
5
- edits: readonly string[];
6
- }
7
- export declare function applyWorkbenchSubjectPatch(input: ApplyWorkbenchSubjectPatchInput): SurfaceSnapshotFile[];
8
- //# sourceMappingURL=subject-patch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subject-patch.d.ts","sourceRoot":"","sources":["../src/subject-patch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC1C,KAAK,EAAE,qBAAqB,CAAC;IAC7B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,GAAG,mBAAmB,EAAE,CAgDxG"}