stitchkit 0.69.0 → 0.70.0
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/README.md +4 -4
- package/dist/agent-runtime/coding-tool-contract.d.ts +1 -0
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-paths.d.ts +1 -0
- package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
- package/dist/agent-runtime/contained-files.d.ts +29 -4
- package/dist/agent-runtime/contained-files.d.ts.map +1 -1
- package/dist/agent-runtime/harness-file-resources.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime-coding-tools.js +197 -137
- package/dist/agent-runtime-harness.js +12 -8
- package/dist/agent-runtime.js +9 -7
- package/dist/cli.js +7 -6
- package/dist/{index-t4dpby6e.js → index-0yphgata.js} +1 -1
- package/dist/{index-444747ww.js → index-38hs3a58.js} +10 -8
- package/dist/index-3xnq72rz.js +21 -0
- package/dist/{index-kg9xx84n.js → index-7rey2b8s.js} +1 -1
- package/dist/{index-zh459sfj.js → index-aczggrty.js} +1 -1
- package/dist/index-bd17ytae.js +192 -0
- package/dist/{index-q7gdep2c.js → index-da1aqnhb.js} +2 -2
- package/dist/{index-p1be103g.js → index-ktsps64f.js} +4 -2
- package/dist/{index-mbxds404.js → index-mjx0wt4c.js} +8 -6
- package/dist/{index-h8vn1jcr.js → index-qzbg46b6.js} +6 -4
- package/dist/{index-h7ctj1kp.js → index-s8nt8c22.js} +14 -11
- package/dist/{index-d1jsvkyk.js → index-vbf2p6me.js} +1 -1
- package/dist/{index-xxsq3ca1.js → index-vc498pst.js} +1 -1
- package/dist/{index-x18ndp4p.js → index-vj3vvpaa.js} +1 -192
- package/dist/{index-3eqrkqhg.js → index-vy5bjy07.js} +7 -3
- package/dist/{index-kxxyvkka.js → index-wc80at9n.js} +2 -2
- package/dist/index-xbtcszs7.js +202 -0
- package/dist/{index-gqdfpv4n.js → index-y3w12g8d.js} +2 -2
- package/dist/node.js +5 -4
- package/dist/observability/index.js +4 -3
- package/dist/remote.js +4 -3
- package/dist/server/index.js +11 -9
- package/dist/testing.js +4 -3
- package/dist/tool-invoker.js +6 -5
- package/dist/tools/agent-tool-error.d.ts +14 -0
- package/dist/tools/agent-tool-error.d.ts.map +1 -0
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools.js +15 -12
- package/llms-full.txt +56 -14
- package/package.json +1 -1
- package/dist/index-v3dpzpjw.js +0 -92
package/package.json
CHANGED
package/dist/index-v3dpzpjw.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// src/agent-runtime/contained-files.ts
|
|
2
|
-
import { constants } from "node:fs";
|
|
3
|
-
import { lstat, open, readdir, realpath } from "node:fs/promises";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
async function readContainedUtf8File(absolute, maxBytes) {
|
|
6
|
-
const handle = await open(absolute, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
7
|
-
try {
|
|
8
|
-
const metadata = await handle.stat();
|
|
9
|
-
if (!metadata.isFile())
|
|
10
|
-
throw new Error("Contained path is not a regular file");
|
|
11
|
-
if (metadata.size > maxBytes)
|
|
12
|
-
throw new Error("Contained file exceeds byte budget");
|
|
13
|
-
const buffer = Buffer.alloc(metadata.size);
|
|
14
|
-
let offset = 0;
|
|
15
|
-
while (offset < buffer.byteLength) {
|
|
16
|
-
const { bytesRead } = await handle.read(buffer, offset, buffer.byteLength - offset, offset);
|
|
17
|
-
if (bytesRead === 0)
|
|
18
|
-
break;
|
|
19
|
-
offset += bytesRead;
|
|
20
|
-
}
|
|
21
|
-
if (offset !== metadata.size)
|
|
22
|
-
throw new Error("Contained file changed while being read");
|
|
23
|
-
return {
|
|
24
|
-
text: new TextDecoder("utf-8", { fatal: true }).decode(buffer),
|
|
25
|
-
bytes: offset,
|
|
26
|
-
mode: metadata.mode
|
|
27
|
-
};
|
|
28
|
-
} finally {
|
|
29
|
-
await handle.close();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function inside(root, target) {
|
|
33
|
-
const relative = path.relative(root, target);
|
|
34
|
-
return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
35
|
-
}
|
|
36
|
-
async function walkContainedFiles(input) {
|
|
37
|
-
const scan = await scanContainedFiles({ ...input, symlinks: "refuse" });
|
|
38
|
-
if (scan.truncated)
|
|
39
|
-
throw new Error("Contained file traversal exceeded its bounds");
|
|
40
|
-
return scan.files;
|
|
41
|
-
}
|
|
42
|
-
async function scanContainedFiles(input) {
|
|
43
|
-
const root = await realpath(input.root);
|
|
44
|
-
const files = [];
|
|
45
|
-
let truncated = false;
|
|
46
|
-
let skippedDirectories = 0;
|
|
47
|
-
let skippedSymlinks = 0;
|
|
48
|
-
const visit = async (directory, depth) => {
|
|
49
|
-
if (truncated)
|
|
50
|
-
return;
|
|
51
|
-
if (depth > input.maxDepth) {
|
|
52
|
-
truncated = true;
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const entries = await readdir(directory, { withFileTypes: true });
|
|
56
|
-
entries.sort((left, right) => left.name.localeCompare(right.name));
|
|
57
|
-
for (const entry of entries) {
|
|
58
|
-
const absolute = path.join(directory, entry.name);
|
|
59
|
-
const metadata = await lstat(absolute);
|
|
60
|
-
if (metadata.isSymbolicLink()) {
|
|
61
|
-
if (input.symlinks === "refuse") {
|
|
62
|
-
throw new Error(`Contained file traversal refuses symlink: ${path.relative(root, absolute)}`);
|
|
63
|
-
}
|
|
64
|
-
skippedSymlinks += 1;
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (metadata.isDirectory()) {
|
|
68
|
-
const relative = path.relative(root, absolute);
|
|
69
|
-
if (input.excludeDirectory?.(relative)) {
|
|
70
|
-
skippedDirectories += 1;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
await visit(absolute, depth + 1);
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (!metadata.isFile())
|
|
77
|
-
continue;
|
|
78
|
-
const resolved = await realpath(absolute);
|
|
79
|
-
if (!inside(root, resolved))
|
|
80
|
-
throw new Error("Contained file traversal escaped root");
|
|
81
|
-
if (files.length >= input.maxFiles) {
|
|
82
|
-
truncated = true;
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
files.push({ absolute: resolved, relative: path.relative(root, resolved) });
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
await visit(root, 0);
|
|
89
|
-
return { files, truncated, skippedDirectories, skippedSymlinks };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export { readContainedUtf8File, walkContainedFiles, scanContainedFiles };
|