@workbench-ai/workbench-core 0.0.63 → 0.0.65
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/execution-events.d.ts +2 -2
- package/dist/execution-events.d.ts.map +1 -1
- package/dist/execution-events.js +6 -6
- package/dist/execution-evidence.d.ts +11 -11
- package/dist/execution-jobs.d.ts +5 -5
- package/dist/execution-runtime-types.d.ts +3 -3
- package/dist/execution-scheduler.d.ts +12 -12
- package/dist/execution-scheduler.d.ts.map +1 -1
- package/dist/execution-scheduler.js +5 -5
- package/dist/execution-traces.d.ts +3 -3
- package/dist/index.d.ts +24 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +56 -54
- package/dist/inspection.d.ts +111 -0
- package/dist/inspection.d.ts.map +1 -0
- package/dist/inspection.js +217 -0
- package/dist/sandbox-backends/index.d.ts +12 -20
- package/dist/sandbox-backends/index.d.ts.map +1 -1
- package/dist/sandbox-backends/index.js +15 -26
- package/dist/sandbox-backends/names.d.ts +2 -3
- package/dist/sandbox-backends/names.d.ts.map +1 -1
- package/dist/sandbox-backends/names.js +5 -5
- package/dist/sandbox-inputs.d.ts +6 -6
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sandbox-backends/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,8BAA8B,EAC/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,0BAA0B,EAE1B,yBAAyB,EACzB,YAAY,EACb,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAEL,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sandbox-backends/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,8BAA8B,EAC/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,0BAA0B,EAE1B,yBAAyB,EACzB,YAAY,EACb,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAEL,KAAK,2BAA2B,EAEjC,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,sBAAsB,EACtB,kCAAkC,EAClC,KAAK,2BAA2B,GACjC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oCAAoC,EACpC,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,2BAA2B,CAAC;IACrC,YAAY,EAAE,0BAA0B,CAAC;CAC1C;AAED,MAAM,WAAW,gCAAgC;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,2BAA2B,CAAC;IACrC,QAAQ,EAAE,sBAAsB,CAAC;CAClC;AAED,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,8BAA8B,EACpC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,yBAAyB,GACnC,YAAY,CAMd;AAED,wBAAgB,sCAAsC,CACpD,OAAO,EAAE,2BAA2B,GACnC,4BAA4B,CAQ9B;AAED,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAYN;AAED,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,2BAA2B,EACpC,SAAS,EAAE,gCAAgC,GAC1C,uBAAuB,CAiBzB"}
|
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
import { isWorkbenchExecutionNetworkEgress, } from "@workbench-ai/workbench-contract";
|
|
2
2
|
import { createDockerSandboxBackendDescriptor, createDockerSandboxPlane, } from "./docker.js";
|
|
3
|
-
import { DOCKER_SANDBOX_BACKEND,
|
|
4
|
-
export { DOCKER_SANDBOX_BACKEND,
|
|
3
|
+
import { DOCKER_SANDBOX_BACKEND, resolveWorkbenchSandboxBackendName, } from "./names.js";
|
|
4
|
+
export { DOCKER_SANDBOX_BACKEND, resolveWorkbenchSandboxBackendName, } from "./names.js";
|
|
5
5
|
export { createDockerSandboxBackendDescriptor, createDockerSandboxPlane, } from "./docker.js";
|
|
6
|
-
export function
|
|
7
|
-
const resolved =
|
|
6
|
+
export function createSandboxBackendPlaneForBackend(backend, args, startedAt, fileStore) {
|
|
7
|
+
const resolved = resolveWorkbenchSandboxBackendName(backend);
|
|
8
8
|
if (resolved !== DOCKER_SANDBOX_BACKEND) {
|
|
9
|
-
throw new Error(`Unsupported local sandbox
|
|
9
|
+
throw new Error(`Unsupported local sandbox backend ${backend}.`);
|
|
10
10
|
}
|
|
11
11
|
return createDockerSandboxPlane(args, startedAt, fileStore);
|
|
12
12
|
}
|
|
13
|
-
export function
|
|
14
|
-
if (
|
|
15
|
-
|
|
13
|
+
export function sandboxHostHealthExpectationForBackend(backend) {
|
|
14
|
+
if (backend !== DOCKER_SANDBOX_BACKEND) {
|
|
15
|
+
resolveWorkbenchSandboxBackendName(backend);
|
|
16
16
|
}
|
|
17
17
|
return {
|
|
18
|
-
|
|
19
|
-
backend: provider,
|
|
18
|
+
backend,
|
|
20
19
|
capabilities: createDockerSandboxBackendDescriptor().capabilities,
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
export function
|
|
24
|
-
const expected =
|
|
22
|
+
export function assertSandboxHostHealthForBackend(value, backend) {
|
|
23
|
+
const expected = sandboxHostHealthExpectationForBackend(backend);
|
|
25
24
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
26
25
|
throw new Error("sandbox host health response must be an object.");
|
|
27
26
|
}
|
|
28
27
|
const record = value;
|
|
29
|
-
if (record.provider !== expected.provider) {
|
|
30
|
-
throw new Error(`sandbox host provider ${String(record.provider ?? "missing")} does not match expected ${expected.provider}.`);
|
|
31
|
-
}
|
|
32
28
|
if (record.backend !== expected.backend) {
|
|
33
29
|
throw new Error(`sandbox host backend ${String(record.backend ?? "missing")} does not match expected ${expected.backend}.`);
|
|
34
30
|
}
|
|
@@ -36,12 +32,9 @@ export function assertSandboxHostHealthForProvider(value, provider) {
|
|
|
36
32
|
throw new Error(`sandbox host capabilities are invalid for backend ${expected.backend}.`);
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
|
-
export function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export function sandboxProviderAdmissionForResources(provider, resources) {
|
|
43
|
-
if (provider !== DOCKER_SANDBOX_BACKEND) {
|
|
44
|
-
resolveWorkbenchSandboxProviderName(provider);
|
|
35
|
+
export function sandboxBackendAdmissionForResources(backend, resources) {
|
|
36
|
+
if (backend !== DOCKER_SANDBOX_BACKEND) {
|
|
37
|
+
resolveWorkbenchSandboxBackendName(backend);
|
|
45
38
|
}
|
|
46
39
|
assertPositiveResource(resources.cpu, "resources.cpu");
|
|
47
40
|
assertPositiveResource(resources.memoryGb, "resources.memoryGb");
|
|
@@ -49,18 +42,14 @@ export function sandboxProviderAdmissionForResources(provider, resources) {
|
|
|
49
42
|
assertPositiveResource(resources.diskGb, "resources.diskGb");
|
|
50
43
|
}
|
|
51
44
|
return {
|
|
52
|
-
|
|
45
|
+
backend,
|
|
53
46
|
hostCost: {
|
|
54
47
|
cpu: resources.cpu,
|
|
55
48
|
memoryGb: resources.memoryGb,
|
|
56
49
|
diskGb: resources.diskGb ?? 1,
|
|
57
50
|
},
|
|
58
|
-
providerLeases: [],
|
|
59
51
|
};
|
|
60
52
|
}
|
|
61
|
-
export function sandboxProviderLeaseScope(provider) {
|
|
62
|
-
throw new Error(`Local sandbox provider ${provider} does not use provider leases.`);
|
|
63
|
-
}
|
|
64
53
|
function isSandboxBackendCapabilities(value) {
|
|
65
54
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
66
55
|
return false;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const DOCKER_SANDBOX_BACKEND = "docker";
|
|
2
2
|
export type WorkbenchSandboxBackendName = typeof DOCKER_SANDBOX_BACKEND;
|
|
3
|
-
export
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function resolveWorkbenchSandboxProviderName(value: string | null | undefined): WorkbenchSandboxProviderName;
|
|
3
|
+
export declare function isWorkbenchSandboxBackendName(value: string): value is WorkbenchSandboxBackendName;
|
|
4
|
+
export declare function resolveWorkbenchSandboxBackendName(value: string | null | undefined): WorkbenchSandboxBackendName;
|
|
6
5
|
//# sourceMappingURL=names.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../src/sandbox-backends/names.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAE/C,MAAM,MAAM,2BAA2B,GAAG,OAAO,sBAAsB,CAAC;AAExE,
|
|
1
|
+
{"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../src/sandbox-backends/names.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAE/C,MAAM,MAAM,2BAA2B,GAAG,OAAO,sBAAsB,CAAC;AAExE,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,2BAA2B,CAEjG;AAED,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC/B,2BAA2B,CAS7B"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export const DOCKER_SANDBOX_BACKEND = "docker";
|
|
2
|
-
export function
|
|
2
|
+
export function isWorkbenchSandboxBackendName(value) {
|
|
3
3
|
return value === DOCKER_SANDBOX_BACKEND;
|
|
4
4
|
}
|
|
5
|
-
export function
|
|
5
|
+
export function resolveWorkbenchSandboxBackendName(value) {
|
|
6
6
|
const normalized = value?.trim();
|
|
7
7
|
if (!normalized) {
|
|
8
|
-
throw new Error("Sandbox
|
|
8
|
+
throw new Error("Sandbox backend is required.");
|
|
9
9
|
}
|
|
10
|
-
if (
|
|
10
|
+
if (isWorkbenchSandboxBackendName(normalized)) {
|
|
11
11
|
return normalized;
|
|
12
12
|
}
|
|
13
|
-
throw new Error(`Unsupported local sandbox
|
|
13
|
+
throw new Error(`Unsupported local sandbox backend ${normalized}. Supported backends: docker.`);
|
|
14
14
|
}
|
package/dist/sandbox-inputs.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { BlobObjectRef,
|
|
1
|
+
import type { BlobObjectRef, RemoteWorkbenchJob, Json, SurfaceSnapshotFile, WorkbenchExecutionCapability, WorkbenchExecutionResult, WorkbenchExecutionSpec, WorkbenchSandboxExecutionMetadata } from "@workbench-ai/workbench-contract";
|
|
2
2
|
import { type SandboxCreateRequest, type SandboxExecutionFileStore, type SandboxMaterializedInput } from "./sandbox-plane.ts";
|
|
3
3
|
import type { WorkbenchExecutionRuntimeInput } from "./execution-runtime-types.ts";
|
|
4
|
-
export declare function readWorkbenchExecutionSpec(job:
|
|
4
|
+
export declare function readWorkbenchExecutionSpec(job: RemoteWorkbenchJob): WorkbenchExecutionSpec;
|
|
5
5
|
export declare function createWorkbenchSandboxFileStore(args: WorkbenchExecutionRuntimeInput): SandboxExecutionFileStore;
|
|
6
6
|
export declare function materializeWorkbenchSandboxInput(args: WorkbenchExecutionRuntimeInput, execution: WorkbenchExecutionSpec, input: WorkbenchExecutionSpec["inputs"][number]): SandboxMaterializedInput;
|
|
7
7
|
export declare function materializedFileInput(input: WorkbenchExecutionSpec["inputs"][number], files: readonly SurfaceSnapshotFile[]): SandboxMaterializedInput;
|
|
8
8
|
export declare function createSandboxAdapterRequest(args: WorkbenchExecutionRuntimeInput, request: SandboxCreateRequest, startedAt: string): Json;
|
|
9
|
-
export declare function sanitizeWorkbenchExecutionJobForSandbox(job:
|
|
9
|
+
export declare function sanitizeWorkbenchExecutionJobForSandbox(job: RemoteWorkbenchJob, execution: WorkbenchExecutionSpec): RemoteWorkbenchJob;
|
|
10
10
|
export declare function materializedInputForSandboxRequest(input: SandboxMaterializedInput): Record<string, Json>;
|
|
11
11
|
export declare function executionResultFromCompletedSandboxJob(args: {
|
|
12
|
-
completedJob:
|
|
12
|
+
completedJob: RemoteWorkbenchJob;
|
|
13
13
|
execution: WorkbenchExecutionSpec;
|
|
14
14
|
startedAt: string;
|
|
15
15
|
backend: string;
|
|
@@ -21,7 +21,7 @@ export declare function executionResultFromCompletedSandboxJob(args: {
|
|
|
21
21
|
export declare function outputPayloadForContract(output: Record<string, unknown>, outputName: string): Json | undefined;
|
|
22
22
|
export declare function sandboxOutputRef(capability: WorkbenchExecutionCapability, outputName: string, body: string): Promise<BlobObjectRef>;
|
|
23
23
|
export declare function sha256Hex(body: string): Promise<string>;
|
|
24
|
-
export declare function withSandboxCompletionMetadata(job:
|
|
25
|
-
export declare function attachSandboxMetadataToJob(job:
|
|
24
|
+
export declare function withSandboxCompletionMetadata(job: RemoteWorkbenchJob, metadata: WorkbenchSandboxExecutionMetadata): RemoteWorkbenchJob;
|
|
25
|
+
export declare function attachSandboxMetadataToJob(job: RemoteWorkbenchJob, metadata: unknown): RemoteWorkbenchJob;
|
|
26
26
|
export declare function isSurfaceSnapshotFile(value: unknown): value is SurfaceSnapshotFile;
|
|
27
27
|
//# sourceMappingURL=sandbox-inputs.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workbench-ai/workbench-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.65",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"yaml": "^2.8.2",
|
|
20
|
-
"@workbench-ai/workbench-
|
|
21
|
-
"@workbench-ai/workbench-
|
|
20
|
+
"@workbench-ai/workbench-protocol": "0.0.65",
|
|
21
|
+
"@workbench-ai/workbench-contract": "0.0.65"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^24.3.1",
|