@workbench-ai/workbench 0.0.67 → 0.0.68
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/dev-open/client.css +37 -246
- package/dist/dev-open/client.js +245 -286
- package/dist/index.d.ts +2 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1261 -5183
- package/dist/open-server.d.ts +12 -0
- package/dist/open-server.d.ts.map +1 -0
- package/dist/open-server.js +180 -0
- package/package.json +5 -5
- package/dist/adapter-command-env.d.ts +0 -8
- package/dist/adapter-command-env.d.ts.map +0 -1
- package/dist/adapter-command-env.js +0 -80
- package/dist/adapter-project.d.ts +0 -29
- package/dist/adapter-project.d.ts.map +0 -1
- package/dist/adapter-project.js +0 -332
- package/dist/benchmark-fingerprint.d.ts +0 -6
- package/dist/benchmark-fingerprint.d.ts.map +0 -1
- package/dist/benchmark-fingerprint.js +0 -42
- package/dist/command-model.d.ts +0 -5
- package/dist/command-model.d.ts.map +0 -1
- package/dist/command-model.js +0 -537
- package/dist/dev-open-server.d.ts +0 -18
- package/dist/dev-open-server.d.ts.map +0 -1
- package/dist/dev-open-server.js +0 -297
- package/dist/init-scaffold.d.ts +0 -22
- package/dist/init-scaffold.d.ts.map +0 -1
- package/dist/init-scaffold.js +0 -30
- package/dist/init-template-pack.d.ts +0 -19
- package/dist/init-template-pack.d.ts.map +0 -1
- package/dist/init-template-pack.js +0 -262
- package/dist/local-archive.d.ts +0 -48
- package/dist/local-archive.d.ts.map +0 -1
- package/dist/local-archive.js +0 -838
- package/dist/local-inspection.d.ts +0 -9
- package/dist/local-inspection.d.ts.map +0 -1
- package/dist/local-inspection.js +0 -354
- package/dist/project-source.d.ts +0 -63
- package/dist/project-source.d.ts.map +0 -1
- package/dist/project-source.js +0 -682
- package/dist/workspace-snapshot.d.ts +0 -10
- package/dist/workspace-snapshot.d.ts.map +0 -1
- package/dist/workspace-snapshot.js +0 -81
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { TextDecoder } from "node:util";
|
|
4
|
-
export class WorkspaceSnapshotError extends Error {
|
|
5
|
-
}
|
|
6
|
-
const SNAPSHOT_FILE_MAX_BYTES = 20 * 1024 * 1024;
|
|
7
|
-
const SNAPSHOT_IGNORED_DIRECTORIES = new Set([
|
|
8
|
-
".git",
|
|
9
|
-
".workbench",
|
|
10
|
-
"node_modules",
|
|
11
|
-
"__pycache__",
|
|
12
|
-
".pytest_cache",
|
|
13
|
-
]);
|
|
14
|
-
const SNAPSHOT_IGNORED_FILES = new Set([".DS_Store"]);
|
|
15
|
-
const utf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
16
|
-
export async function readSnapshotFiles(inputPath) {
|
|
17
|
-
const stat = await fs.stat(inputPath);
|
|
18
|
-
if (stat.isFile()) {
|
|
19
|
-
return [await readSnapshotFile(inputPath, path.basename(inputPath), stat)];
|
|
20
|
-
}
|
|
21
|
-
if (!stat.isDirectory()) {
|
|
22
|
-
throw new WorkspaceSnapshotError(`Snapshot path must be a file or directory: ${inputPath}`);
|
|
23
|
-
}
|
|
24
|
-
const files = [];
|
|
25
|
-
await walk(inputPath, inputPath, files);
|
|
26
|
-
if (files.length === 0) {
|
|
27
|
-
throw new WorkspaceSnapshotError(`Snapshot directory has no files: ${inputPath}`);
|
|
28
|
-
}
|
|
29
|
-
return files;
|
|
30
|
-
}
|
|
31
|
-
async function walk(root, current, files) {
|
|
32
|
-
const entries = (await fs.readdir(current, { withFileTypes: true })).sort((left, right) => left.name.localeCompare(right.name));
|
|
33
|
-
for (const entry of entries) {
|
|
34
|
-
if (SNAPSHOT_IGNORED_DIRECTORIES.has(entry.name)) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
const absolutePath = path.join(current, entry.name);
|
|
38
|
-
if (entry.isDirectory()) {
|
|
39
|
-
await walk(root, absolutePath, files);
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (!entry.isFile()) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (SNAPSHOT_IGNORED_FILES.has(entry.name) ||
|
|
46
|
-
entry.name.endsWith(".pyc") ||
|
|
47
|
-
entry.name.endsWith(".pyo")) {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
files.push(await readSnapshotFile(absolutePath, path.relative(root, absolutePath).split(path.sep).join("/"), await fs.stat(absolutePath)));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function readSnapshotFile(filePath, relativePath, stat) {
|
|
54
|
-
if (stat.size > SNAPSHOT_FILE_MAX_BYTES) {
|
|
55
|
-
throw new WorkspaceSnapshotError(`Snapshot file is too large: ${filePath}`);
|
|
56
|
-
}
|
|
57
|
-
const content = await fs.readFile(filePath);
|
|
58
|
-
const executable = (stat.mode & 0o111) !== 0;
|
|
59
|
-
const text = decodeUtf8(content);
|
|
60
|
-
if (text !== null) {
|
|
61
|
-
return {
|
|
62
|
-
path: relativePath,
|
|
63
|
-
content: text,
|
|
64
|
-
...(executable ? { executable: true } : {}),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
path: relativePath,
|
|
69
|
-
content: content.toString("base64"),
|
|
70
|
-
encoding: "base64",
|
|
71
|
-
...(executable ? { executable: true } : {}),
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function decodeUtf8(content) {
|
|
75
|
-
try {
|
|
76
|
-
return utf8Decoder.decode(content);
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
}
|