@workbench-ai/workbench-protocol 0.0.64 → 0.0.66
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/adapter-protocol.d.ts.map +1 -1
- package/dist/adapter-protocol.js +2 -4
- package/dist/engine-resolve-result.d.ts.map +1 -1
- package/dist/engine-resolve-result.js +3 -36
- package/dist/snapshot-files.d.ts +6 -0
- package/dist/snapshot-files.d.ts.map +1 -0
- package/dist/snapshot-files.js +44 -0
- package/package.json +7 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-protocol.d.ts","sourceRoot":"","sources":["../src/adapter-protocol.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter-protocol.d.ts","sourceRoot":"","sources":["../src/adapter-protocol.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAQ/B,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AACjE,eAAO,MAAM,iCAAiC,gCAAgC,CAAC;AAC/E,eAAO,MAAM,6BAA6B,0BAA0B,CAAC;AAErE,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,EAAE,OAAO,0BAA0B,CAAC;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,yBAAyB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
@@ -2,6 +2,7 @@ import { promises as fs } from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { normalizeWorkbenchEngineResolveResult, } from "./engine-resolve-result.js";
|
|
4
4
|
import { normalizeWorkbenchAdapterOperation, } from "./adapter-manifest.js";
|
|
5
|
+
import { normalizeSurfaceSnapshotFiles, } from "./snapshot-files.js";
|
|
5
6
|
export const WORKBENCH_ADAPTER_PROTOCOL = "workbench.adapter.v3";
|
|
6
7
|
export const WORKBENCH_ADAPTER_RESULT_PROTOCOL = "workbench.adapter-result.v1";
|
|
7
8
|
export const WORKBENCH_ADAPTER_RESULT_FILE = "workbench-result.json";
|
|
@@ -196,14 +197,11 @@ function normalizeResult(value, label) {
|
|
|
196
197
|
}
|
|
197
198
|
function normalizeCandidatePatch(value, label) {
|
|
198
199
|
const record = requiredJsonRecord(value, label);
|
|
199
|
-
if (!Array.isArray(record.files)) {
|
|
200
|
-
throw new Error(`${label}.files must be an array.`);
|
|
201
|
-
}
|
|
202
200
|
if (!Array.isArray(record.fileChanges) || !record.fileChanges.every((entry) => typeof entry === "string")) {
|
|
203
201
|
throw new Error(`${label}.fileChanges must be a string array.`);
|
|
204
202
|
}
|
|
205
203
|
return {
|
|
206
|
-
files: record.files,
|
|
204
|
+
files: normalizeSurfaceSnapshotFiles(record.files, `${label}.files`),
|
|
207
205
|
fileChanges: [...record.fileChanges],
|
|
208
206
|
...(typeof record.summary === "string" ? { summary: record.summary } : {}),
|
|
209
207
|
...(record.feedback !== undefined ? { feedback: record.feedback } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-resolve-result.d.ts","sourceRoot":"","sources":["../src/engine-resolve-result.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine-resolve-result.d.ts","sourceRoot":"","sources":["../src/engine-resolve-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,E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ecutionNetworkEgress, } from "@workbench-ai/workbench-contract";
|
|
2
|
+
import { normalizeSurfaceRelativePath, normalizeSurfaceSnapshotFiles, } from "./snapshot-files.js";
|
|
3
3
|
export function normalizeWorkbenchEngineResolveResult(value, label = "engine.resolve result") {
|
|
4
4
|
const record = requiredRecord(value, label);
|
|
5
5
|
if (!Array.isArray(record.cases)) {
|
|
@@ -24,7 +24,7 @@ export function normalizeWorkbenchEngineCase(value, label) {
|
|
|
24
24
|
throw new Error(`${label}.id must be a non-empty string.`);
|
|
25
25
|
}
|
|
26
26
|
return {
|
|
27
|
-
id:
|
|
27
|
+
id: normalizeSurfaceRelativePath(record.id, `${label}.id`),
|
|
28
28
|
case: normalizeWorkbenchEngineCaseSpec(record.case, `${label}.case`),
|
|
29
29
|
files: normalizeWorkbenchEngineCaseFiles(record.files, `${label}.files`),
|
|
30
30
|
};
|
|
@@ -103,40 +103,7 @@ function normalizeNetworkPolicy(value, label) {
|
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
function normalizeEngineResolveFiles(value, label) {
|
|
106
|
-
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
if (!Array.isArray(value)) {
|
|
110
|
-
throw new Error(`${label} must be an array.`);
|
|
111
|
-
}
|
|
112
|
-
return value.map((entry, index) => {
|
|
113
|
-
const record = requiredRecord(entry, `${label}[${index}]`);
|
|
114
|
-
if (typeof record.path !== "string" || record.path.trim().length === 0) {
|
|
115
|
-
throw new Error(`${label}[${index}].path must be a non-empty string.`);
|
|
116
|
-
}
|
|
117
|
-
if (typeof record.content !== "string") {
|
|
118
|
-
throw new Error(`${label}[${index}].content must be a string.`);
|
|
119
|
-
}
|
|
120
|
-
const encoding = record.encoding === "base64" ? "base64" : "utf8";
|
|
121
|
-
const kind = record.kind === "binary" || encoding === "base64" ? "binary" : "text";
|
|
122
|
-
return {
|
|
123
|
-
path: normalizeRelativePath(record.path, `${label}[${index}].path`),
|
|
124
|
-
kind,
|
|
125
|
-
encoding,
|
|
126
|
-
content: record.content,
|
|
127
|
-
executable: record.executable === true,
|
|
128
|
-
};
|
|
129
|
-
}).sort((left, right) => left.path.localeCompare(right.path));
|
|
130
|
-
}
|
|
131
|
-
function normalizeRelativePath(filePath, label) {
|
|
132
|
-
const normalized = path.posix.normalize(filePath.replace(/\\/gu, "/").replace(/^\/+/u, ""));
|
|
133
|
-
if (!normalized || normalized === "." || normalized.includes("\0")) {
|
|
134
|
-
throw new Error(`${label} must be a non-empty relative path.`);
|
|
135
|
-
}
|
|
136
|
-
if (normalized === ".." || normalized.startsWith("../") || path.posix.isAbsolute(normalized)) {
|
|
137
|
-
throw new Error(`${label} must not escape the engine-resolve result.`);
|
|
138
|
-
}
|
|
139
|
-
return normalized;
|
|
106
|
+
return normalizeSurfaceSnapshotFiles(value, label, { optional: true });
|
|
140
107
|
}
|
|
141
108
|
function requiredRecord(value, label) {
|
|
142
109
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SurfaceSnapshotFile } from "@workbench-ai/workbench-contract";
|
|
2
|
+
export declare function normalizeSurfaceSnapshotFiles(value: unknown, label: string, options?: {
|
|
3
|
+
optional?: boolean;
|
|
4
|
+
}): SurfaceSnapshotFile[];
|
|
5
|
+
export declare function normalizeSurfaceRelativePath(filePath: string, label: string): string;
|
|
6
|
+
//# sourceMappingURL=snapshot-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot-files.d.ts","sourceRoot":"","sources":["../src/snapshot-files.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAE1C,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GACnC,mBAAmB,EAAE,CA0BvB;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CASpF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
export function normalizeSurfaceSnapshotFiles(value, label, options = {}) {
|
|
3
|
+
if (value === undefined && options.optional) {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
6
|
+
if (!Array.isArray(value)) {
|
|
7
|
+
throw new Error(`${label} must be an array.`);
|
|
8
|
+
}
|
|
9
|
+
return value.map((entry, index) => {
|
|
10
|
+
const itemLabel = `${label}[${index}]`;
|
|
11
|
+
const record = requiredRecord(entry, itemLabel);
|
|
12
|
+
if (typeof record.path !== "string" || record.path.trim().length === 0) {
|
|
13
|
+
throw new Error(`${itemLabel}.path must be a non-empty string.`);
|
|
14
|
+
}
|
|
15
|
+
if (typeof record.content !== "string") {
|
|
16
|
+
throw new Error(`${itemLabel}.content must be a string.`);
|
|
17
|
+
}
|
|
18
|
+
const encoding = record.encoding === "base64" ? "base64" : "utf8";
|
|
19
|
+
const kind = record.kind === "binary" || encoding === "base64" ? "binary" : "text";
|
|
20
|
+
return {
|
|
21
|
+
path: normalizeSurfaceRelativePath(record.path, `${itemLabel}.path`),
|
|
22
|
+
kind,
|
|
23
|
+
encoding,
|
|
24
|
+
content: record.content,
|
|
25
|
+
executable: record.executable === true,
|
|
26
|
+
};
|
|
27
|
+
}).sort((left, right) => left.path.localeCompare(right.path));
|
|
28
|
+
}
|
|
29
|
+
export function normalizeSurfaceRelativePath(filePath, label) {
|
|
30
|
+
const normalized = path.posix.normalize(filePath.replace(/\\/gu, "/").replace(/^\/+/u, ""));
|
|
31
|
+
if (!normalized || normalized === "." || normalized.includes("\0")) {
|
|
32
|
+
throw new Error(`${label} must be a non-empty relative path.`);
|
|
33
|
+
}
|
|
34
|
+
if (normalized === ".." || normalized.startsWith("../") || path.posix.isAbsolute(normalized)) {
|
|
35
|
+
throw new Error(`${label} must not escape the result root.`);
|
|
36
|
+
}
|
|
37
|
+
return normalized;
|
|
38
|
+
}
|
|
39
|
+
function requiredRecord(value, label) {
|
|
40
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
41
|
+
throw new Error(`${label} must be an object.`);
|
|
42
|
+
}
|
|
43
|
+
return value;
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workbench-ai/workbench-protocol",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.66",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/workbench-ai/workbench.git",
|
|
7
|
+
"directory": "packages/protocol"
|
|
8
|
+
},
|
|
4
9
|
"type": "module",
|
|
5
10
|
"main": "dist/index.js",
|
|
6
11
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +20,7 @@
|
|
|
15
20
|
],
|
|
16
21
|
"dependencies": {
|
|
17
22
|
"yaml": "^2.8.2",
|
|
18
|
-
"@workbench-ai/workbench-contract": "0.0.
|
|
23
|
+
"@workbench-ai/workbench-contract": "0.0.66"
|
|
19
24
|
},
|
|
20
25
|
"devDependencies": {
|
|
21
26
|
"@types/node": "^24.3.1",
|