@wrongstack/acp 0.316.2 → 0.317.2
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/client.js +12 -3
- package/dist/index.js +12 -3
- package/package.json +2 -2
package/dist/client.js
CHANGED
|
@@ -332,6 +332,9 @@ var FileServer = class {
|
|
|
332
332
|
}
|
|
333
333
|
/** Write a text file. Atomic via write-then-rename. */
|
|
334
334
|
async writeTextFile(params) {
|
|
335
|
+
if (typeof params.content !== "string") {
|
|
336
|
+
throw new FsError("INVALID_PATH", params.path, "content must be a string");
|
|
337
|
+
}
|
|
335
338
|
const byteLength = Buffer.byteLength(params.content, "utf8");
|
|
336
339
|
if (byteLength > this.maxWriteBytes) {
|
|
337
340
|
throw new FsError(
|
|
@@ -385,8 +388,11 @@ var FileServer = class {
|
|
|
385
388
|
throw new FsError("INVALID_PATH", p, "path must be absolute (ACP requirement)");
|
|
386
389
|
}
|
|
387
390
|
const resolved = path.resolve(p);
|
|
388
|
-
const
|
|
389
|
-
|
|
391
|
+
const isWindows = process.platform === "win32";
|
|
392
|
+
const normResolved = isWindows ? resolved.toLowerCase() : resolved;
|
|
393
|
+
const normRoot = isWindows ? this.root.toLowerCase() : this.root;
|
|
394
|
+
const rootWithSep = normRoot.endsWith(path.sep) ? normRoot : normRoot + path.sep;
|
|
395
|
+
if (normResolved !== normRoot && !normResolved.startsWith(rootWithSep)) {
|
|
390
396
|
throw new FsError("OUTSIDE_ROOT", resolved, "path is outside the project root");
|
|
391
397
|
}
|
|
392
398
|
await this.assertRealInside(resolved);
|
|
@@ -399,6 +405,8 @@ var FileServer = class {
|
|
|
399
405
|
*/
|
|
400
406
|
async assertRealInside(resolvedPath) {
|
|
401
407
|
let probe = resolvedPath;
|
|
408
|
+
const isWindows = process.platform === "win32";
|
|
409
|
+
const normRealRoot = isWindows ? this.realRoot.toLowerCase() : this.realRoot;
|
|
402
410
|
for (; ; ) {
|
|
403
411
|
let real;
|
|
404
412
|
try {
|
|
@@ -415,7 +423,8 @@ var FileServer = class {
|
|
|
415
423
|
}
|
|
416
424
|
throw mapFsError(err, resolvedPath);
|
|
417
425
|
}
|
|
418
|
-
|
|
426
|
+
const normReal = isWindows ? real.toLowerCase() : real;
|
|
427
|
+
if (normReal === normRealRoot || normReal.startsWith(normRealRoot + path.sep)) return;
|
|
419
428
|
throw new FsError(
|
|
420
429
|
"OUTSIDE_ROOT",
|
|
421
430
|
resolvedPath,
|
package/dist/index.js
CHANGED
|
@@ -1596,6 +1596,9 @@ var FileServer = class {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
/** Write a text file. Atomic via write-then-rename. */
|
|
1598
1598
|
async writeTextFile(params) {
|
|
1599
|
+
if (typeof params.content !== "string") {
|
|
1600
|
+
throw new FsError("INVALID_PATH", params.path, "content must be a string");
|
|
1601
|
+
}
|
|
1599
1602
|
const byteLength = Buffer.byteLength(params.content, "utf8");
|
|
1600
1603
|
if (byteLength > this.maxWriteBytes) {
|
|
1601
1604
|
throw new FsError(
|
|
@@ -1649,8 +1652,11 @@ var FileServer = class {
|
|
|
1649
1652
|
throw new FsError("INVALID_PATH", p, "path must be absolute (ACP requirement)");
|
|
1650
1653
|
}
|
|
1651
1654
|
const resolved = path2.resolve(p);
|
|
1652
|
-
const
|
|
1653
|
-
|
|
1655
|
+
const isWindows = process.platform === "win32";
|
|
1656
|
+
const normResolved = isWindows ? resolved.toLowerCase() : resolved;
|
|
1657
|
+
const normRoot = isWindows ? this.root.toLowerCase() : this.root;
|
|
1658
|
+
const rootWithSep = normRoot.endsWith(path2.sep) ? normRoot : normRoot + path2.sep;
|
|
1659
|
+
if (normResolved !== normRoot && !normResolved.startsWith(rootWithSep)) {
|
|
1654
1660
|
throw new FsError("OUTSIDE_ROOT", resolved, "path is outside the project root");
|
|
1655
1661
|
}
|
|
1656
1662
|
await this.assertRealInside(resolved);
|
|
@@ -1663,6 +1669,8 @@ var FileServer = class {
|
|
|
1663
1669
|
*/
|
|
1664
1670
|
async assertRealInside(resolvedPath) {
|
|
1665
1671
|
let probe = resolvedPath;
|
|
1672
|
+
const isWindows = process.platform === "win32";
|
|
1673
|
+
const normRealRoot = isWindows ? this.realRoot.toLowerCase() : this.realRoot;
|
|
1666
1674
|
for (; ; ) {
|
|
1667
1675
|
let real;
|
|
1668
1676
|
try {
|
|
@@ -1679,7 +1687,8 @@ var FileServer = class {
|
|
|
1679
1687
|
}
|
|
1680
1688
|
throw mapFsError(err, resolvedPath);
|
|
1681
1689
|
}
|
|
1682
|
-
|
|
1690
|
+
const normReal = isWindows ? real.toLowerCase() : real;
|
|
1691
|
+
if (normReal === normRealRoot || normReal.startsWith(normRealRoot + path2.sep)) return;
|
|
1683
1692
|
throw new FsError(
|
|
1684
1693
|
"OUTSIDE_ROOT",
|
|
1685
1694
|
resolvedPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/acp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.317.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ACP (Agent Client Protocol) integration for WrongStack — client + agent support",
|
|
6
6
|
"keywords": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@agentclientprotocol/sdk": "^1.4.0",
|
|
55
|
-
"@wrongstack/core": "0.
|
|
55
|
+
"@wrongstack/core": "0.317.2"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^26.2.0",
|