@lousy-agents/cli 5.22.21 → 5.22.23
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/api/copilot-with-fastify/.devcontainer/devcontainer.json +1 -1
- package/api/copilot-with-fastify/package-lock.json +8 -8
- package/api/copilot-with-fastify/package.json +2 -2
- package/cli/copilot-with-citty/.devcontainer/devcontainer.json +1 -1
- package/cli/copilot-with-citty/package.json +1 -1
- package/dist/index.js +153 -95
- package/package.json +1 -1
- package/ui/copilot-with-react/.devcontainer/devcontainer.json +1 -1
- package/ui/copilot-with-react/package.json +1 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"ghcr.io/devcontainers/features/copilot-cli:1.0.0": {},
|
|
12
12
|
"ghcr.io/anthropics/devcontainer-features/claude-code:1": {
|
|
13
|
-
"version": "v2.1.
|
|
13
|
+
"version": "v2.1.316"
|
|
14
14
|
},
|
|
15
15
|
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1.0.2": {
|
|
16
16
|
"packages": "yamllint, shellcheck",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"@fastify/cors": "11.3.1",
|
|
12
12
|
"@fastify/sensible": "6.0.7",
|
|
13
13
|
"fastify": "5.12.7",
|
|
14
|
-
"kysely": "0.29.
|
|
14
|
+
"kysely": "0.29.8",
|
|
15
15
|
"pino": "10.4.0",
|
|
16
16
|
"postgres": "4.0.0",
|
|
17
17
|
"zod": "4.6.6"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@biomejs/biome": "2.5.15",
|
|
21
|
-
"@lousy-agents/mcp": "5.22.
|
|
21
|
+
"@lousy-agents/mcp": "5.22.22",
|
|
22
22
|
"@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
|
|
23
23
|
"@testcontainers/postgresql": "12.2.1",
|
|
24
24
|
"@types/node": "26.6.6",
|
|
@@ -974,9 +974,9 @@
|
|
|
974
974
|
}
|
|
975
975
|
},
|
|
976
976
|
"node_modules/@lousy-agents/mcp": {
|
|
977
|
-
"version": "5.22.
|
|
978
|
-
"resolved": "https://registry.npmjs.org/@lousy-agents/mcp/-/mcp-5.22.
|
|
979
|
-
"integrity": "sha512-
|
|
977
|
+
"version": "5.22.22",
|
|
978
|
+
"resolved": "https://registry.npmjs.org/@lousy-agents/mcp/-/mcp-5.22.22.tgz",
|
|
979
|
+
"integrity": "sha512-6EQViUmBn7H84vuyGwvvCc1fE1WLD7fG808+Vi7cPh6aKcZyp9JenyhNb+dfD9WFEHbtkMBoYLdaSM7FC/OeWQ==",
|
|
980
980
|
"dev": true,
|
|
981
981
|
"license": "BSD-2-Clause-Patent",
|
|
982
982
|
"dependencies": {
|
|
@@ -3809,9 +3809,9 @@
|
|
|
3809
3809
|
"license": "BSD-2-Clause"
|
|
3810
3810
|
},
|
|
3811
3811
|
"node_modules/kysely": {
|
|
3812
|
-
"version": "0.29.
|
|
3813
|
-
"resolved": "https://registry.npmjs.org/kysely/-/kysely-0.29.
|
|
3814
|
-
"integrity": "sha512-
|
|
3812
|
+
"version": "0.29.8",
|
|
3813
|
+
"resolved": "https://registry.npmjs.org/kysely/-/kysely-0.29.8.tgz",
|
|
3814
|
+
"integrity": "sha512-ixHU1H4R+LeC5Y0nAhYgiGRFpFRHm2DXKEmJSs/vbes9sKXyssyzxzE/NYiOJX5fY0BL28biCre3GqlCqUwyXQ==",
|
|
3815
3815
|
"license": "MIT",
|
|
3816
3816
|
"engines": {
|
|
3817
3817
|
"node": ">=22.0.0"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@fastify/cors": "11.3.1",
|
|
20
20
|
"@fastify/sensible": "6.0.7",
|
|
21
21
|
"fastify": "5.12.7",
|
|
22
|
-
"kysely": "0.29.
|
|
22
|
+
"kysely": "0.29.8",
|
|
23
23
|
"pino": "10.4.0",
|
|
24
24
|
"postgres": "4.0.0",
|
|
25
25
|
"zod": "4.6.6"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@biomejs/biome": "2.5.15",
|
|
32
|
-
"@lousy-agents/mcp": "5.22.
|
|
32
|
+
"@lousy-agents/mcp": "5.22.22",
|
|
33
33
|
"@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
|
|
34
34
|
"@testcontainers/postgresql": "12.2.1",
|
|
35
35
|
"@types/node": "26.6.6",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"ghcr.io/devcontainers/features/copilot-cli:1.0.0": {},
|
|
12
12
|
"ghcr.io/anthropics/devcontainer-features/claude-code:1": {
|
|
13
|
-
"version": "v2.1.
|
|
13
|
+
"version": "v2.1.316"
|
|
14
14
|
},
|
|
15
15
|
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1.0.2": {
|
|
16
16
|
"packages": "yamllint, shellcheck",
|
package/dist/index.js
CHANGED
|
@@ -4185,7 +4185,7 @@ function sameCleanupStatValue(left, right) {
|
|
|
4185
4185
|
return false;
|
|
4186
4186
|
return sameStatValue(left, right);
|
|
4187
4187
|
}
|
|
4188
|
-
function
|
|
4188
|
+
function sameFileIdentityForCleanup(left, right, platform = process.platform) {
|
|
4189
4189
|
if (platform !== "win32") {
|
|
4190
4190
|
return sameCleanupStatValue(left.dev, right.dev) && sameCleanupStatValue(left.ino, right.ino);
|
|
4191
4191
|
}
|
|
@@ -6173,19 +6173,32 @@ async function serializePathWrite(key, run) {
|
|
|
6173
6173
|
|
|
6174
6174
|
function assertOwnedDirectory(expected, actual) {
|
|
6175
6175
|
if (actual.isSymbolicLink() || !actual.isDirectory()) {
|
|
6176
|
-
throw new
|
|
6176
|
+
throw new errors_FsSafeError("not-file", "directory mode target must be a real directory");
|
|
6177
6177
|
}
|
|
6178
6178
|
if (!sameFileIdentityForCleanup(expected, actual)) {
|
|
6179
|
-
throw new
|
|
6179
|
+
throw new errors_FsSafeError("path-mismatch", "directory changed before its mode could be applied");
|
|
6180
|
+
}
|
|
6181
|
+
}
|
|
6182
|
+
/** The caller retains a verified native mkdir receipt and owns the descriptor lifetime. */
|
|
6183
|
+
function finalizeCreatedDirectoryModeSync(child, mode) {
|
|
6184
|
+
if (mode === undefined || !child.created || process.platform === "win32")
|
|
6185
|
+
return;
|
|
6186
|
+
const expected = strict_file_identity_inspectFileIdentitySync(() => external_node_fs_.fstatSync(child.fd, { bigint: true }));
|
|
6187
|
+
assertOwnedDirectory(expected, expected);
|
|
6188
|
+
external_node_fs_.fchmodSync(child.fd, mode & 0o7777);
|
|
6189
|
+
const finalized = strict_file_identity_inspectFileIdentitySync(() => external_node_fs_.fstatSync(child.fd, { bigint: true }), expected);
|
|
6190
|
+
assertOwnedDirectory(expected, finalized);
|
|
6191
|
+
if ((finalized.mode & 4095n) !== BigInt(mode & 0o7777)) {
|
|
6192
|
+
throw new errors_FsSafeError("path-mismatch", "created directory mode could not be finalized");
|
|
6180
6193
|
}
|
|
6181
6194
|
}
|
|
6182
6195
|
/** Serializes use and close: even a queued path-based fd operation retains its descriptor. */
|
|
6183
|
-
function
|
|
6196
|
+
function ownDirectoryMode(params) {
|
|
6184
6197
|
let pending = Promise.resolve();
|
|
6185
6198
|
let closing;
|
|
6186
6199
|
const enqueue = (run) => {
|
|
6187
6200
|
if (closing)
|
|
6188
|
-
return Promise.reject(new
|
|
6201
|
+
return Promise.reject(new errors_FsSafeError("path-mismatch", "directory mode owner is closed"));
|
|
6189
6202
|
const operation = pending.then(run);
|
|
6190
6203
|
pending = operation.catch(() => undefined);
|
|
6191
6204
|
return operation;
|
|
@@ -6238,7 +6251,7 @@ function directory_mode_node_ownDirectoryMode(params) {
|
|
|
6238
6251
|
throw dispatchDeadlineFailure.error;
|
|
6239
6252
|
checks.check?.();
|
|
6240
6253
|
if (!params.ignoreChmodError && finalMode !== mode) {
|
|
6241
|
-
throw new
|
|
6254
|
+
throw new errors_FsSafeError("path-mismatch", "directory final mode could not be verified");
|
|
6242
6255
|
}
|
|
6243
6256
|
}),
|
|
6244
6257
|
close() {
|
|
@@ -6286,7 +6299,7 @@ async function pinNodeDirectoryForMode(dirPath, options = {}) {
|
|
|
6286
6299
|
assertOwner(expected);
|
|
6287
6300
|
if (process.platform === "win32") {
|
|
6288
6301
|
// POSIX mode enforcement is unsupported; retain strict path identity checks.
|
|
6289
|
-
return
|
|
6302
|
+
return ownDirectoryMode({
|
|
6290
6303
|
inspect: async () => { assertOwner(await inspectDirectoryIdentity(dirPath, expected)); return 0; },
|
|
6291
6304
|
chmod: async () => undefined, close: async () => undefined, ignoreChmodError: true,
|
|
6292
6305
|
});
|
|
@@ -6333,7 +6346,7 @@ async function pinNodeDirectoryForMode(dirPath, options = {}) {
|
|
|
6333
6346
|
assertOwner(followed);
|
|
6334
6347
|
};
|
|
6335
6348
|
const observeCanonical = observer;
|
|
6336
|
-
const owner =
|
|
6349
|
+
const owner = ownDirectoryMode({
|
|
6337
6350
|
inspect,
|
|
6338
6351
|
inspectCanonical: observeCanonical ? () => {
|
|
6339
6352
|
const observed = observeCanonical();
|
|
@@ -7514,7 +7527,7 @@ function creation_boundary_assertPrivateCreationFile(stat, fd) {
|
|
|
7514
7527
|
assertDarwinCreationAcl(fd);
|
|
7515
7528
|
}
|
|
7516
7529
|
function assertRecordedFile(current, identity) {
|
|
7517
|
-
if (!current.isFile() || current.isSymbolicLink() || !
|
|
7530
|
+
if (!current.isFile() || current.isSymbolicLink() || !sameFileIdentityForCleanup(current, identity)) {
|
|
7518
7531
|
throw new errors_FsSafeError("path-mismatch", "created file cleanup preserved a replacement");
|
|
7519
7532
|
}
|
|
7520
7533
|
}
|
|
@@ -8294,7 +8307,7 @@ function exclusive_create_assertExclusiveCreateLeaf(pathname) {
|
|
|
8294
8307
|
|
|
8295
8308
|
|
|
8296
8309
|
|
|
8297
|
-
function*
|
|
8310
|
+
function* wait(value) {
|
|
8298
8311
|
return (yield value);
|
|
8299
8312
|
}
|
|
8300
8313
|
async function runAsync(procedure) {
|
|
@@ -8319,7 +8332,7 @@ function runSync(procedure) {
|
|
|
8319
8332
|
step = procedure.next(step.value);
|
|
8320
8333
|
return step.value;
|
|
8321
8334
|
}
|
|
8322
|
-
function
|
|
8335
|
+
function inspectAtomicIdentity(io, read, expected, synchronous = false, admit) {
|
|
8323
8336
|
if (io.asynchronous && !synchronous) {
|
|
8324
8337
|
const inspect = admit ? async () => {
|
|
8325
8338
|
const stat = await read();
|
|
@@ -8371,7 +8384,7 @@ class AtomicIo {
|
|
|
8371
8384
|
}
|
|
8372
8385
|
}
|
|
8373
8386
|
const resource = this.asyncFs
|
|
8374
|
-
? yield*
|
|
8387
|
+
? yield* wait(withMode
|
|
8375
8388
|
? this.asyncFs.open(pathname, flags, mode)
|
|
8376
8389
|
: this.asyncFs.open(pathname, flags))
|
|
8377
8390
|
: withMode
|
|
@@ -8384,7 +8397,7 @@ class AtomicIo {
|
|
|
8384
8397
|
return this.syncFs.lstatSync(pathname);
|
|
8385
8398
|
if (this.asyncFs === promises_)
|
|
8386
8399
|
return external_node_fs_.lstatSync(pathname);
|
|
8387
|
-
return yield*
|
|
8400
|
+
return yield* wait(this.asyncFs.lstat(pathname));
|
|
8388
8401
|
}
|
|
8389
8402
|
lstatExact(pathname, synchronousBuiltin = true) {
|
|
8390
8403
|
if (!this.asyncFs)
|
|
@@ -8396,34 +8409,40 @@ class AtomicIo {
|
|
|
8396
8409
|
*mkdir(directory, mode) {
|
|
8397
8410
|
if (this.asyncFs) {
|
|
8398
8411
|
const pathname = this.asyncFs === promises_ ? recursiveMkdirPath(directory) : directory;
|
|
8399
|
-
yield*
|
|
8412
|
+
yield* wait(this.asyncFs.mkdir(pathname, { recursive: true, mode }));
|
|
8400
8413
|
}
|
|
8401
8414
|
else {
|
|
8402
8415
|
const pathname = this.syncFs === external_node_fs_ ? recursiveMkdirPath(directory) : directory;
|
|
8403
8416
|
this.syncFs.mkdirSync(pathname, { recursive: true, mode });
|
|
8404
8417
|
}
|
|
8405
8418
|
}
|
|
8419
|
+
*mkdirExclusive(directory, mode) {
|
|
8420
|
+
if (this.asyncFs)
|
|
8421
|
+
yield* wait(this.asyncFs.mkdir(directory, { recursive: false, mode }));
|
|
8422
|
+
else
|
|
8423
|
+
this.syncFs.mkdirSync(directory, { recursive: false, mode });
|
|
8424
|
+
}
|
|
8406
8425
|
*rename(source, destination) {
|
|
8407
8426
|
if (this.asyncFs)
|
|
8408
|
-
yield*
|
|
8427
|
+
yield* wait(this.asyncFs.rename(source, destination));
|
|
8409
8428
|
else
|
|
8410
8429
|
this.syncFs.renameSync(source, destination);
|
|
8411
8430
|
}
|
|
8412
8431
|
*remove(pathname) {
|
|
8413
8432
|
if (this.asyncFs)
|
|
8414
|
-
yield*
|
|
8433
|
+
yield* wait(this.asyncFs.rm(pathname, { force: true }));
|
|
8415
8434
|
else
|
|
8416
8435
|
this.syncFs.rmSync(pathname, { force: true });
|
|
8417
8436
|
}
|
|
8418
8437
|
*unlink(pathname) {
|
|
8419
8438
|
if (this.asyncFs)
|
|
8420
|
-
yield*
|
|
8439
|
+
yield* wait(this.asyncFs.unlink(pathname));
|
|
8421
8440
|
else
|
|
8422
8441
|
this.syncFs.unlinkSync(pathname);
|
|
8423
8442
|
}
|
|
8424
8443
|
*delay(milliseconds) {
|
|
8425
8444
|
if (this.asynchronous)
|
|
8426
|
-
yield*
|
|
8445
|
+
yield* wait(sleep(milliseconds));
|
|
8427
8446
|
else
|
|
8428
8447
|
sleepSync(milliseconds);
|
|
8429
8448
|
}
|
|
@@ -8443,7 +8462,7 @@ class AtomicFile {
|
|
|
8443
8462
|
return this.io.syncFs.fstatSync(this.resource);
|
|
8444
8463
|
if (this.io.asyncFs === promises_)
|
|
8445
8464
|
return external_node_fs_.fstatSync(this.resource.fd);
|
|
8446
|
-
return yield*
|
|
8465
|
+
return yield* wait(this.resource.stat());
|
|
8447
8466
|
}
|
|
8448
8467
|
statExact() {
|
|
8449
8468
|
if (typeof this.resource === "number")
|
|
@@ -8462,7 +8481,7 @@ class AtomicFile {
|
|
|
8462
8481
|
if (typeof this.resource === "number")
|
|
8463
8482
|
this.io.syncFs.fsyncSync(this.resource);
|
|
8464
8483
|
else
|
|
8465
|
-
yield*
|
|
8484
|
+
yield* wait(this.resource.sync());
|
|
8466
8485
|
}
|
|
8467
8486
|
*syncBestEffort() {
|
|
8468
8487
|
try {
|
|
@@ -8495,7 +8514,7 @@ class AtomicFile {
|
|
|
8495
8514
|
}
|
|
8496
8515
|
*readFile(sizeHint) {
|
|
8497
8516
|
if (typeof this.resource !== "number")
|
|
8498
|
-
return yield*
|
|
8517
|
+
return yield* wait(readFileHandleBounded(this.resource, Infinity));
|
|
8499
8518
|
if (sizeHint === undefined)
|
|
8500
8519
|
return this.io.syncFs.readFileSync(this.resource);
|
|
8501
8520
|
const fd = this.resource;
|
|
@@ -8525,7 +8544,7 @@ class AtomicFile {
|
|
|
8525
8544
|
if (typeof this.resource === "number")
|
|
8526
8545
|
this.io.syncFs.ftruncateSync(this.resource, length);
|
|
8527
8546
|
else
|
|
8528
|
-
yield*
|
|
8547
|
+
yield* wait(this.resource.truncate(length));
|
|
8529
8548
|
}
|
|
8530
8549
|
}
|
|
8531
8550
|
|
|
@@ -8560,14 +8579,14 @@ function* replace_file_descriptor_syncDirectoryBestEffort(io, dirPath) {
|
|
|
8560
8579
|
}
|
|
8561
8580
|
}
|
|
8562
8581
|
function replace_file_descriptor_directoryOpenFlags() {
|
|
8563
|
-
return (
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8582
|
+
return (external_node_fs_.constants.O_RDONLY |
|
|
8583
|
+
external_node_fs_.constants.O_DIRECTORY |
|
|
8584
|
+
external_node_fs_.constants.O_NOFOLLOW |
|
|
8585
|
+
external_node_fs_.constants.O_NONBLOCK);
|
|
8567
8586
|
}
|
|
8568
8587
|
function assertDirectory(identity, dirPath) {
|
|
8569
8588
|
if (identity.isSymbolicLink() || !identity.isDirectory()) {
|
|
8570
|
-
throw new
|
|
8589
|
+
throw new errors_FsSafeError("not-file", `Atomic replace parent must be a real directory: ${dirPath}`);
|
|
8571
8590
|
}
|
|
8572
8591
|
return identity;
|
|
8573
8592
|
}
|
|
@@ -8578,16 +8597,16 @@ async function pinDirectoryForMode(params) {
|
|
|
8578
8597
|
if (process.platform === "win32") {
|
|
8579
8598
|
return;
|
|
8580
8599
|
}
|
|
8581
|
-
const expected = params.fsModule ===
|
|
8582
|
-
?
|
|
8583
|
-
: await
|
|
8600
|
+
const expected = params.expectedIdentity ?? (params.fsModule === promises_
|
|
8601
|
+
? strict_file_identity_inspectFileIdentitySync(() => assertDirectory(external_node_fs_.lstatSync(params.dirPath, { bigint: true }), params.dirPath))
|
|
8602
|
+
: await strict_file_identity_inspectFileIdentity(async () => assertDirectory(await params.fsModule.lstat(params.dirPath, { bigint: true }), params.dirPath)));
|
|
8584
8603
|
const handle = await params.fsModule.open(params.dirPath, replace_file_descriptor_directoryOpenFlags());
|
|
8585
8604
|
try {
|
|
8586
8605
|
const owner = ownDirectoryMode({
|
|
8587
8606
|
async inspect() {
|
|
8588
|
-
const opened = params.fsModule ===
|
|
8589
|
-
?
|
|
8590
|
-
: await
|
|
8607
|
+
const opened = params.fsModule === promises_
|
|
8608
|
+
? strict_file_identity_inspectFileIdentitySync(() => assertDirectory(external_node_fs_.fstatSync(handle.fd, { bigint: true }), params.dirPath), expected)
|
|
8609
|
+
: await strict_file_identity_inspectFileIdentity(async () => assertDirectory(await handle.stat({ bigint: true }), params.dirPath), expected);
|
|
8591
8610
|
return Number(opened.mode & 4095n);
|
|
8592
8611
|
},
|
|
8593
8612
|
chmod: (mode) => {
|
|
@@ -8618,7 +8637,7 @@ function* applyDirectoryMode(io, params) {
|
|
|
8618
8637
|
}));
|
|
8619
8638
|
let primary;
|
|
8620
8639
|
try {
|
|
8621
|
-
if (owner)
|
|
8640
|
+
if (owner && params.mode !== "preserve")
|
|
8622
8641
|
yield* wait(owner.apply(params.mode));
|
|
8623
8642
|
}
|
|
8624
8643
|
catch (error) {
|
|
@@ -8639,13 +8658,15 @@ function* applyDirectoryMode(io, params) {
|
|
|
8639
8658
|
if (process.platform === "win32")
|
|
8640
8659
|
return;
|
|
8641
8660
|
const admit = (stat) => assertDirectory(stat, params.dirPath);
|
|
8642
|
-
const expected = inspectAtomicIdentity(io, () => io.lstatExact(params.dirPath), undefined, false, admit);
|
|
8661
|
+
const expected = params.expectedIdentity ?? inspectAtomicIdentity(io, () => io.lstatExact(params.dirPath), undefined, false, admit);
|
|
8643
8662
|
const file = yield* io.open(params.dirPath, replace_file_descriptor_directoryOpenFlags());
|
|
8644
8663
|
let primary;
|
|
8645
8664
|
try {
|
|
8646
8665
|
inspectAtomicIdentity(io, () => file.statExact(), expected, false, admit);
|
|
8647
|
-
params.
|
|
8648
|
-
|
|
8666
|
+
if (params.mode !== "preserve") {
|
|
8667
|
+
params.mutation?.assert();
|
|
8668
|
+
file.chmod(params.mode & 0o7777);
|
|
8669
|
+
}
|
|
8649
8670
|
}
|
|
8650
8671
|
catch (error) {
|
|
8651
8672
|
primary = { error };
|
|
@@ -8664,7 +8685,7 @@ function* writeTempFile(io, params) {
|
|
|
8664
8685
|
params.mutation?.assert();
|
|
8665
8686
|
const file = yield* io.open(params.tempPath, "wx", params.mode);
|
|
8666
8687
|
try {
|
|
8667
|
-
const openedInspection =
|
|
8688
|
+
const openedInspection = inspectAtomicIdentity(io, () => file.statExact());
|
|
8668
8689
|
const identity = (io.asynchronous ? (yield openedInspection) : openedInspection);
|
|
8669
8690
|
params.onIdentity?.(identity);
|
|
8670
8691
|
params.mutation?.assert();
|
|
@@ -8673,7 +8694,7 @@ function* writeTempFile(io, params) {
|
|
|
8673
8694
|
yield writing;
|
|
8674
8695
|
if ((io.asyncFs === promises_ || (process.platform === "win32" && io.syncFs === external_node_fs_)) && !params.sync) {
|
|
8675
8696
|
// Matching non-durable writes have no I/O left after this identity fence.
|
|
8676
|
-
const current =
|
|
8697
|
+
const current = inspectAtomicIdentity(io, () => file.statExact(), identity, true);
|
|
8677
8698
|
const modeMask = process.platform === "win32" ? 0o200 : 0o7777;
|
|
8678
8699
|
if (Number(current.mode & BigInt(modeMask)) === (params.mode & modeMask))
|
|
8679
8700
|
return { file, identity };
|
|
@@ -8683,7 +8704,7 @@ function* writeTempFile(io, params) {
|
|
|
8683
8704
|
yield chmod;
|
|
8684
8705
|
if (params.sync)
|
|
8685
8706
|
yield* file.syncBestEffort();
|
|
8686
|
-
const currentInspection =
|
|
8707
|
+
const currentInspection = inspectAtomicIdentity(io, () => file.statExact(), identity);
|
|
8687
8708
|
if (io.asynchronous)
|
|
8688
8709
|
yield currentInspection;
|
|
8689
8710
|
return { file, identity };
|
|
@@ -8729,7 +8750,7 @@ async function removeOwnedPath(params) {
|
|
|
8729
8750
|
if (current.isSymbolicLink() ||
|
|
8730
8751
|
!current.isFile() ||
|
|
8731
8752
|
current.nlink !== 1n ||
|
|
8732
|
-
!
|
|
8753
|
+
!sameFileIdentityForCleanup(current, params.identity)) {
|
|
8733
8754
|
return "preserved";
|
|
8734
8755
|
}
|
|
8735
8756
|
await promises_.unlink(params.pathname);
|
|
@@ -8752,11 +8773,11 @@ async function cleanupPinnedFilePath(params) {
|
|
|
8752
8773
|
await assertAsyncDirectoryGuard(guard);
|
|
8753
8774
|
const parent = external_node_fs_.lstatSync(guard.dir, { bigint: true });
|
|
8754
8775
|
if (parent.isSymbolicLink() || !parent.isDirectory() ||
|
|
8755
|
-
!
|
|
8776
|
+
!sameFileIdentityForCleanup(parent, guard.stat))
|
|
8756
8777
|
return "preserved";
|
|
8757
8778
|
const opened = external_node_fs_.fstatSync(params.handle.fd, { bigint: true });
|
|
8758
8779
|
if (!opened.isFile() || opened.nlink !== 1n ||
|
|
8759
|
-
!
|
|
8780
|
+
!sameFileIdentityForCleanup(opened, params.identity))
|
|
8760
8781
|
return "preserved";
|
|
8761
8782
|
}
|
|
8762
8783
|
catch (error) {
|
|
@@ -8891,7 +8912,7 @@ function pathStillMatchesReceipt(entry) {
|
|
|
8891
8912
|
try {
|
|
8892
8913
|
const current = external_node_fs_.lstatSync(entry.path, { bigint: true });
|
|
8893
8914
|
return (!entry.singleLinkFile || (current.isFile() && current.nlink === 1n)) &&
|
|
8894
|
-
|
|
8915
|
+
sameFileIdentityForCleanup(current, entry.identity);
|
|
8895
8916
|
}
|
|
8896
8917
|
catch {
|
|
8897
8918
|
// A missing pathname grants no authority over an entry created after this lookup.
|
|
@@ -8995,7 +9016,7 @@ async function removePathIfIdentityUnchanged(targetPath, identity) {
|
|
|
8995
9016
|
const parentGuard = await directory_guard_createAsyncDirectoryGuard(external_node_path_.dirname(targetPath), { bigint: true });
|
|
8996
9017
|
await withAsyncDirectoryGuards([parentGuard], async () => {
|
|
8997
9018
|
const current = external_node_fs_.lstatSync(targetPath, { bigint: true });
|
|
8998
|
-
if (current.isSymbolicLink() || !current.isFile() || !
|
|
9019
|
+
if (current.isSymbolicLink() || !current.isFile() || !sameFileIdentityForCleanup(current, identity))
|
|
8999
9020
|
return;
|
|
9000
9021
|
await promises_.unlink(targetPath);
|
|
9001
9022
|
});
|
|
@@ -9070,7 +9091,7 @@ class AtomicTempOwner {
|
|
|
9070
9091
|
this.onIdentity(temp.identity);
|
|
9071
9092
|
}
|
|
9072
9093
|
inspectOwned(read, pathname, pathnameEntry, expected) {
|
|
9073
|
-
return
|
|
9094
|
+
return inspectAtomicIdentity(this.io, read, expected, false, stat => assertOwnedFile(stat, pathname, pathnameEntry));
|
|
9074
9095
|
}
|
|
9075
9096
|
*assertCurrent(pathname = this.pathname) {
|
|
9076
9097
|
const openedInspection = this.inspectOwned(() => this.resource.statExact(), pathname, false, this.identity);
|
|
@@ -9150,9 +9171,9 @@ class AtomicTempOwner {
|
|
|
9150
9171
|
try {
|
|
9151
9172
|
const observation = this.io.lstatExact(this.pathname);
|
|
9152
9173
|
const current = this.io.asyncFs && this.io.asyncFs !== promises_
|
|
9153
|
-
? yield*
|
|
9174
|
+
? yield* wait(observation) : observation;
|
|
9154
9175
|
if (!current.isSymbolicLink() && current.isFile() && current.nlink === 1n &&
|
|
9155
|
-
|
|
9176
|
+
sameFileIdentityForCleanup(current, identity)) {
|
|
9156
9177
|
yield* this.io.unlink(this.pathname);
|
|
9157
9178
|
}
|
|
9158
9179
|
return true;
|
|
@@ -9223,7 +9244,7 @@ function probeEntry(directory, name, names) {
|
|
|
9223
9244
|
original = strict_file_identity_inspectFileIdentitySync(() => external_node_fs_.lstatSync(originalPath, { bigint: true }));
|
|
9224
9245
|
try {
|
|
9225
9246
|
const other = strict_file_identity_inspectFileIdentitySync(() => external_node_fs_.lstatSync(external_node_path_.join(directory, alternate), { bigint: true }));
|
|
9226
|
-
const sameIdentity =
|
|
9247
|
+
const sameIdentity = sameFileIdentityForCleanup(original, other);
|
|
9227
9248
|
if (sameIdentity || bothListed) {
|
|
9228
9249
|
// Matching inodes can belong to newly linked case-distinct names.
|
|
9229
9250
|
const currentNames = new Set(external_node_fs_.readdirSync(directory));
|
|
@@ -12957,7 +12978,7 @@ async function withNativeDirectory(params, operation, discard) {
|
|
|
12957
12978
|
}
|
|
12958
12979
|
}
|
|
12959
12980
|
/** Admit only an ordinary direct child; aliases keep the full resolver. */
|
|
12960
|
-
function tryMkdirNativeDirectChild(root, relativePath) {
|
|
12981
|
+
function tryMkdirNativeDirectChild(root, relativePath, mode) {
|
|
12961
12982
|
if (!isSafePathSegment(relativePath, { allowDotPrefix: true }) || relativePath.endsWith(".") ||
|
|
12962
12983
|
getFsSafeTestHooks()?.beforeRootFallbackMutation)
|
|
12963
12984
|
return false;
|
|
@@ -12973,7 +12994,7 @@ function tryMkdirNativeDirectChild(root, relativePath) {
|
|
|
12973
12994
|
return false;
|
|
12974
12995
|
}
|
|
12975
12996
|
try {
|
|
12976
|
-
mkdirNativeRootChild({ root, target });
|
|
12997
|
+
mkdirNativeRootChild({ root, target }, mode);
|
|
12977
12998
|
return true;
|
|
12978
12999
|
}
|
|
12979
13000
|
catch (error) {
|
|
@@ -13082,7 +13103,7 @@ function ensureNativeRootCurrentLegacy(root, binding) {
|
|
|
13082
13103
|
root_create_native_disposeResources(env_4);
|
|
13083
13104
|
}
|
|
13084
13105
|
}
|
|
13085
|
-
function mkdirNativeRootChild(params) {
|
|
13106
|
+
function mkdirNativeRootChild(params, mode) {
|
|
13086
13107
|
const env_5 = { stack: [], error: void 0, hasError: false };
|
|
13087
13108
|
try {
|
|
13088
13109
|
const binding = native_getNativeBinding("openBeneath", "mkdirChildBeneath");
|
|
@@ -13092,19 +13113,28 @@ function mkdirNativeRootChild(params) {
|
|
|
13092
13113
|
rootPath: params.root.rootReal, rootIdentity: params.root.rootIdentity,
|
|
13093
13114
|
}), false);
|
|
13094
13115
|
verifyMkdirDirectory(binding, rootOwner.fd, params.root.rootReal);
|
|
13095
|
-
const flags = (nodeDirectorySearchOnlyFlags()?.flags ?? external_node_fs_.constants.O_RDONLY) |
|
|
13116
|
+
const flags = (mode === undefined ? nodeDirectorySearchOnlyFlags()?.flags ?? external_node_fs_.constants.O_RDONLY : external_node_fs_.constants.O_RDONLY) |
|
|
13096
13117
|
(external_node_fs_.constants.O_DIRECTORY ?? 0) | (external_node_fs_.constants.O_NOFOLLOW ?? 0);
|
|
13097
13118
|
const name = external_node_path_.basename(params.target);
|
|
13098
13119
|
// The admitted Root is already this operation's immediate parent. Retain
|
|
13099
13120
|
// both handles through the same fresh pathname and canonical identity fences.
|
|
13100
13121
|
const child = binding.mkdirOpenChildBeneath
|
|
13101
|
-
? binding.mkdirOpenChildBeneath(rootOwner.fd, name, 0o777, flags)
|
|
13102
|
-
:
|
|
13122
|
+
? binding.mkdirOpenChildBeneath(rootOwner.fd, name, mode ?? 0o777, flags)
|
|
13123
|
+
: {
|
|
13124
|
+
created: binding.mkdirChildBeneath(rootOwner.fd, name, mode ?? 0o777),
|
|
13125
|
+
fd: binding.openBeneath(rootOwner.fd, name, flags).fd,
|
|
13126
|
+
};
|
|
13103
13127
|
const close = captureNativeFdClose(binding);
|
|
13104
|
-
const childOwner = root_create_native_addDisposableResource(env_5, { [Symbol.dispose]() { close(child); } }, false);
|
|
13128
|
+
const childOwner = root_create_native_addDisposableResource(env_5, { [Symbol.dispose]() { close(child.fd); } }, false);
|
|
13105
13129
|
root_context_assertRootIdentityCurrentSync(params.root);
|
|
13106
|
-
verifyMkdirDirectory(binding, child, params.target);
|
|
13130
|
+
verifyMkdirDirectory(binding, child.fd, params.target);
|
|
13107
13131
|
verifyMkdirDirectory(binding, rootOwner.fd, params.root.rootReal);
|
|
13132
|
+
if (mode !== undefined && child.created) {
|
|
13133
|
+
finalizeCreatedDirectoryModeSync(child, mode);
|
|
13134
|
+
verifyMkdirDirectory(binding, child.fd, params.target);
|
|
13135
|
+
verifyMkdirDirectory(binding, rootOwner.fd, params.root.rootReal);
|
|
13136
|
+
root_context_assertRootIdentityCurrentSync(params.root);
|
|
13137
|
+
}
|
|
13108
13138
|
}
|
|
13109
13139
|
catch (e_5) {
|
|
13110
13140
|
env_5.error = e_5;
|
|
@@ -13472,7 +13502,7 @@ function removeSiblingIfOwned(params) {
|
|
|
13472
13502
|
if (current.isSymbolicLink() ||
|
|
13473
13503
|
!current.isFile() ||
|
|
13474
13504
|
(current.nlink !== 1n && current.nlink !== 2n) ||
|
|
13475
|
-
!
|
|
13505
|
+
!sameFileIdentityForCleanup(current, params.identity)) {
|
|
13476
13506
|
throw pathMismatch("isolated producer sibling changed before cleanup");
|
|
13477
13507
|
}
|
|
13478
13508
|
external_node_fs_.unlinkSync(params.targetPath);
|
|
@@ -14174,6 +14204,8 @@ async function createPrivateWindowsFileHandle(selected, options) {
|
|
|
14174
14204
|
|
|
14175
14205
|
|
|
14176
14206
|
|
|
14207
|
+
|
|
14208
|
+
|
|
14177
14209
|
function sameDirectoryFacts(left, right) {
|
|
14178
14210
|
return left.dev === right.dev && left.ino === right.ino && left.mode === right.mode &&
|
|
14179
14211
|
left.nlink === right.nlink;
|
|
@@ -14433,6 +14465,13 @@ async function mkdirPathComponentsWithGuards(params) {
|
|
|
14433
14465
|
if (!createdAuthorization || !createdEvidence) {
|
|
14434
14466
|
directory_guard_assertDirectoryGuard(parentGuard, "native");
|
|
14435
14467
|
}
|
|
14468
|
+
if (created && params.finalizeCreatedMode && params.mode !== undefined) {
|
|
14469
|
+
await runAsync(applyDirectoryMode(AtomicIo.async(promises_), {
|
|
14470
|
+
dirPath: currentGuard.dir, mode: params.mode, expectedIdentity: currentGuard.stat,
|
|
14471
|
+
}));
|
|
14472
|
+
directory_guard_assertDirectoryGuard(parentGuard, "native");
|
|
14473
|
+
directory_guard_assertDirectoryGuard(currentGuard, "native");
|
|
14474
|
+
}
|
|
14436
14475
|
current = admittedNextPath;
|
|
14437
14476
|
}
|
|
14438
14477
|
return current;
|
|
@@ -15235,9 +15274,9 @@ function removeNativeCreatedFileIfStillPinned(params) {
|
|
|
15235
15274
|
const targetPath = external_node_path_.join(params.parentPath, params.basename);
|
|
15236
15275
|
const target = external_node_fs_.lstatSync(targetPath, { bigint: true });
|
|
15237
15276
|
if (!parentPathStat.isSymbolicLink() && parentPathStat.isDirectory() &&
|
|
15238
|
-
|
|
15277
|
+
sameFileIdentityForCleanup(parentPathStat, parentFdStat) &&
|
|
15239
15278
|
!target.isSymbolicLink() && target.isFile() &&
|
|
15240
|
-
|
|
15279
|
+
sameFileIdentityForCleanup(target, params.created)) {
|
|
15241
15280
|
external_node_fs_.rmSync(targetPath);
|
|
15242
15281
|
}
|
|
15243
15282
|
}
|
|
@@ -16935,7 +16974,7 @@ function sidecarLockSnapshotMatches(current, observed) {
|
|
|
16935
16974
|
}
|
|
16936
16975
|
if (observed.stat &&
|
|
16937
16976
|
current.stat &&
|
|
16938
|
-
!
|
|
16977
|
+
!sameFileIdentityForCleanup(observed.stat, current.stat)) {
|
|
16939
16978
|
return false;
|
|
16940
16979
|
}
|
|
16941
16980
|
if (observed.raw !== undefined) {
|
|
@@ -17701,7 +17740,7 @@ function cleanupCreatedSidecar(lockPath, raw, fd, parent, identity) {
|
|
|
17701
17740
|
throw new errors_FsSafeError("helper-unavailable", "creator cleanup is unavailable");
|
|
17702
17741
|
}
|
|
17703
17742
|
const entry = parent.binding.rootRemovalStat(parent.fd, name);
|
|
17704
|
-
if (entry.directory || entry.symlink || !
|
|
17743
|
+
if (entry.directory || entry.symlink || !sameFileIdentityForCleanup(identity, entry))
|
|
17705
17744
|
throw sidecar_lock_retained_mismatch("identity");
|
|
17706
17745
|
}
|
|
17707
17746
|
else if (!parent.binding.stagedFileMatches || !parent.binding.removeStagedFile) {
|
|
@@ -17717,7 +17756,7 @@ function cleanupCreatedSidecar(lockPath, raw, fd, parent, identity) {
|
|
|
17717
17756
|
throw error;
|
|
17718
17757
|
}
|
|
17719
17758
|
const stat = external_node_fs_.fstatSync(fd, { bigint: true });
|
|
17720
|
-
if (!stat.isFile() || stat.nlink !== 1n || !
|
|
17759
|
+
if (!stat.isFile() || stat.nlink !== 1n || !sameFileIdentityForCleanup(identity, stat))
|
|
17721
17760
|
throw sidecar_lock_retained_mismatch("identity");
|
|
17722
17761
|
assertOwnerRecord(fd, Buffer.from(raw));
|
|
17723
17762
|
if (windows) {
|
|
@@ -17775,7 +17814,7 @@ function retainCreatedSidecar(lockPath, raw, createdFd, guard, nativeParent) {
|
|
|
17775
17814
|
let fd;
|
|
17776
17815
|
try {
|
|
17777
17816
|
const parentStat = external_node_fs_.fstatSync(parentFd, { bigint: true });
|
|
17778
|
-
if (!parentStat.isDirectory() || !
|
|
17817
|
+
if (!parentStat.isDirectory() || !sameFileIdentityForCleanup(guard.stat, parentStat))
|
|
17779
17818
|
throw sidecar_lock_retained_mismatch("identity");
|
|
17780
17819
|
fd = binding.openBeneath(parentFd, name, nativeOpenFlags(external_node_fs_.constants.O_RDONLY | external_node_fs_.constants.O_NONBLOCK)).fd;
|
|
17781
17820
|
const ownedFd = fd;
|
|
@@ -17790,7 +17829,7 @@ function retainCreatedSidecar(lockPath, raw, createdFd, guard, nativeParent) {
|
|
|
17790
17829
|
throw error;
|
|
17791
17830
|
}
|
|
17792
17831
|
const current = external_node_fs_.fstatSync(ownedFd, { bigint: true });
|
|
17793
|
-
if (!current.isFile() || current.nlink !== 1n || !
|
|
17832
|
+
if (!current.isFile() || current.nlink !== 1n || !sameFileIdentityForCleanup(created, current))
|
|
17794
17833
|
throw sidecar_lock_retained_mismatch("identity");
|
|
17795
17834
|
return true;
|
|
17796
17835
|
};
|
|
@@ -18217,7 +18256,7 @@ async function acquireSidecarLock(options, context) {
|
|
|
18217
18256
|
}
|
|
18218
18257
|
const snapshot = { raw, payload, stat: external_node_fs_.fstatSync(handle.fd, { bigint: true }), ownershipToken };
|
|
18219
18258
|
createdSnapshot = snapshot;
|
|
18220
|
-
if (retainedSidecar && !
|
|
18259
|
+
if (retainedSidecar && !sameFileIdentityForCleanup(retainedSidecar.identity, snapshot.stat)) {
|
|
18221
18260
|
throw new errors_FsSafeError("path-mismatch", "created sidecar lock identity changed before admission");
|
|
18222
18261
|
}
|
|
18223
18262
|
if (snapshot.stat.nlink === 0n) {
|
|
@@ -18493,7 +18532,7 @@ function snapshotMatchesSync(lockPath, observed) {
|
|
|
18493
18532
|
const openedStat = external_node_fs_.fstatSync(fd, { bigint: true });
|
|
18494
18533
|
// Token-owned files can have different descriptor/path identities on VirtioFS.
|
|
18495
18534
|
// Require a known descriptor identity without rejecting that supported drift.
|
|
18496
|
-
if (!openedStat.isFile() || !
|
|
18535
|
+
if (!openedStat.isFile() || !sameFileIdentityForCleanup(openedStat, openedStat)) {
|
|
18497
18536
|
return false;
|
|
18498
18537
|
}
|
|
18499
18538
|
if (observed.raw !== undefined && openedStat.size !== BigInt(Buffer.byteLength(observed.raw))) {
|
|
@@ -18501,7 +18540,7 @@ function snapshotMatchesSync(lockPath, observed) {
|
|
|
18501
18540
|
}
|
|
18502
18541
|
const raw = external_node_fs_.readFileSync(fd, "utf8");
|
|
18503
18542
|
const afterStat = external_node_fs_.lstatSync(lockPath, { bigint: true });
|
|
18504
|
-
if (!afterStat.isFile() || !
|
|
18543
|
+
if (!afterStat.isFile() || !sameFileIdentityForCleanup(beforeStat, afterStat)) {
|
|
18505
18544
|
return false;
|
|
18506
18545
|
}
|
|
18507
18546
|
return sidecarLockSnapshotMatches({ raw, payload: null, stat: afterStat }, observed);
|
|
@@ -18776,8 +18815,8 @@ async function publishCopyStage(params) {
|
|
|
18776
18815
|
const staged = external_node_fs_.lstatSync(temporaryPath, { bigint: true });
|
|
18777
18816
|
const opened = external_node_fs_.fstatSync(params.fd, { bigint: true });
|
|
18778
18817
|
if (!staged.isFile() || staged.isSymbolicLink() || staged.nlink !== 1n ||
|
|
18779
|
-
!
|
|
18780
|
-
!
|
|
18818
|
+
!sameFileIdentityForCleanup(staged, identity) ||
|
|
18819
|
+
!sameFileIdentityForCleanup(opened, identity)) {
|
|
18781
18820
|
throw new errors_FsSafeError("path-mismatch", "exclusive copy stage changed before publication");
|
|
18782
18821
|
}
|
|
18783
18822
|
};
|
|
@@ -18818,7 +18857,7 @@ async function publishCopyStage(params) {
|
|
|
18818
18857
|
}
|
|
18819
18858
|
const target = external_node_fs_.lstatSync(targetPath, { bigint: true });
|
|
18820
18859
|
if (!target.isFile() || target.isSymbolicLink() || target.nlink !== 1n ||
|
|
18821
|
-
!
|
|
18860
|
+
!sameFileIdentityForCleanup(target, identity)) {
|
|
18822
18861
|
throw new errors_FsSafeError("path-mismatch", "renamed copy target changed after publication");
|
|
18823
18862
|
}
|
|
18824
18863
|
}
|
|
@@ -18829,10 +18868,10 @@ async function publishCopyStage(params) {
|
|
|
18829
18868
|
const current = external_node_fs_.lstatSync(temporaryPath, { bigint: true });
|
|
18830
18869
|
const target = external_node_fs_.lstatSync(targetPath, { bigint: true });
|
|
18831
18870
|
if (parent.isSymbolicLink() || !parent.isDirectory() ||
|
|
18832
|
-
!
|
|
18871
|
+
!sameFileIdentityForCleanup(parent, params.parentGuard.stat) ||
|
|
18833
18872
|
current.isSymbolicLink() || !current.isFile() || current.nlink !== 2n ||
|
|
18834
18873
|
target.isSymbolicLink() || !target.isFile() || target.nlink !== 2n ||
|
|
18835
|
-
!
|
|
18874
|
+
!sameFileIdentityForCleanup(current, identity) || !sameFileIdentityForCleanup(target, identity)) {
|
|
18836
18875
|
throw new errors_FsSafeError("path-mismatch", "published copy temporary name changed before cleanup");
|
|
18837
18876
|
}
|
|
18838
18877
|
};
|
|
@@ -18856,7 +18895,7 @@ async function publishCopyStage(params) {
|
|
|
18856
18895
|
}
|
|
18857
18896
|
function isEmptyPlaceholder(current, identity) {
|
|
18858
18897
|
return current.isFile() && !current.isSymbolicLink() && current.nlink === 1n &&
|
|
18859
|
-
current.size === 0n &&
|
|
18898
|
+
current.size === 0n && sameFileIdentityForCleanup(current, identity);
|
|
18860
18899
|
}
|
|
18861
18900
|
function publishThroughPlaceholder(params, assertCurrent) {
|
|
18862
18901
|
const { targetPath, temporaryPath } = params;
|
|
@@ -18935,7 +18974,7 @@ async function openPublicationHandle(targetPath, identity) {
|
|
|
18935
18974
|
const opened = external_node_fs_.fstatSync(handle.fd, { bigint: true });
|
|
18936
18975
|
const named = external_node_fs_.lstatSync(targetPath, { bigint: true });
|
|
18937
18976
|
if (!opened.isFile() || !named.isFile() || named.isSymbolicLink() ||
|
|
18938
|
-
!
|
|
18977
|
+
!sameFileIdentityForCleanup(opened, identity) || !sameFileIdentityForCleanup(named, identity)) {
|
|
18939
18978
|
throw new errors_FsSafeError("path-mismatch", "publication descriptor handoff identity changed");
|
|
18940
18979
|
}
|
|
18941
18980
|
return handle;
|
|
@@ -19939,9 +19978,9 @@ var root_mkdir_native_disposeResources = (undefined && undefined.__disposeResour
|
|
|
19939
19978
|
|
|
19940
19979
|
|
|
19941
19980
|
|
|
19942
|
-
function tryMkdirNativeParents(root, relativePath) {
|
|
19981
|
+
function tryMkdirNativeParents(root, relativePath, mode) {
|
|
19943
19982
|
try {
|
|
19944
|
-
return mkdirOrdinaryNativeParents(root, relativePath);
|
|
19983
|
+
return mkdirOrdinaryNativeParents(root, relativePath, mode);
|
|
19945
19984
|
}
|
|
19946
19985
|
catch (error) {
|
|
19947
19986
|
if (hasNodeErrorCode(error, "ENOTDIR"))
|
|
@@ -19949,7 +19988,7 @@ function tryMkdirNativeParents(root, relativePath) {
|
|
|
19949
19988
|
throw error;
|
|
19950
19989
|
}
|
|
19951
19990
|
}
|
|
19952
|
-
function mkdirOrdinaryNativeParents(root, relativePath) {
|
|
19991
|
+
function mkdirOrdinaryNativeParents(root, relativePath, mode) {
|
|
19953
19992
|
if (getFsSafeTestHooks()?.beforeRootFallbackMutation)
|
|
19954
19993
|
return false;
|
|
19955
19994
|
const segments = relativePath.split(external_node_path_.sep === "\\" ? /[\\/]/ : "/");
|
|
@@ -19974,7 +20013,7 @@ function mkdirOrdinaryNativeParents(root, relativePath) {
|
|
|
19974
20013
|
catch (error) {
|
|
19975
20014
|
// Reuse this exact Root snapshot and failed parent observation without an
|
|
19976
20015
|
// intervening await. All opened ancestors still receive fresh native fences.
|
|
19977
|
-
return hasNodeErrorCode(error, "ENOENT") ? mkdirMissingParents(root, segments, rootStat) : false;
|
|
20016
|
+
return hasNodeErrorCode(error, "ENOENT") ? mkdirMissingParents(root, segments, rootStat, mode) : false;
|
|
19978
20017
|
}
|
|
19979
20018
|
try {
|
|
19980
20019
|
if (realpath_realpathSync.native(windows_path_alias_pathForWindowsFilesystem(parentPath)) !== parentPath)
|
|
@@ -19983,12 +20022,12 @@ function mkdirOrdinaryNativeParents(root, relativePath) {
|
|
|
19983
20022
|
catch {
|
|
19984
20023
|
return false;
|
|
19985
20024
|
}
|
|
19986
|
-
return mkdirExistingParent(root, segments, parentIdentity);
|
|
20025
|
+
return mkdirExistingParent(root, segments, parentIdentity, mode);
|
|
19987
20026
|
}
|
|
19988
20027
|
/** Ordinary missing suffixes need no policy callbacks or repeated path resolution. */
|
|
19989
|
-
function mkdirMissingParents(root, segments, rootStat) {
|
|
20028
|
+
function mkdirMissingParents(root, segments, rootStat, mode) {
|
|
19990
20029
|
const binding = native_getNativeBinding("openBeneath", "mkdirChildBeneath");
|
|
19991
|
-
if (!binding?.openBeneath || !binding.mkdirOpenChildBeneath)
|
|
20030
|
+
if (!binding?.openBeneath || !binding.mkdirChildBeneath || (!binding.mkdirOpenChildBeneath && mode === undefined))
|
|
19992
20031
|
return false;
|
|
19993
20032
|
let parentDepth = segments.length - 2;
|
|
19994
20033
|
let parentPath;
|
|
@@ -20028,7 +20067,7 @@ function mkdirMissingParents(root, segments, rootStat) {
|
|
|
20028
20067
|
if (errors.length)
|
|
20029
20068
|
throw new AggregateError(errors, "mkdir directory close failed");
|
|
20030
20069
|
} }, false);
|
|
20031
|
-
const flags = (nodeDirectorySearchOnlyFlags()?.flags ?? external_node_fs_.constants.O_RDONLY) |
|
|
20070
|
+
const flags = (mode === undefined ? nodeDirectorySearchOnlyFlags()?.flags ?? external_node_fs_.constants.O_RDONLY : external_node_fs_.constants.O_RDONLY) |
|
|
20032
20071
|
(external_node_fs_.constants.O_DIRECTORY ?? 0) | (external_node_fs_.constants.O_NOFOLLOW ?? 0);
|
|
20033
20072
|
let current = rootOwner.fd;
|
|
20034
20073
|
if (parentDepth > 0) {
|
|
@@ -20044,12 +20083,21 @@ function mkdirMissingParents(root, segments, rootStat) {
|
|
|
20044
20083
|
};
|
|
20045
20084
|
assertCurrent();
|
|
20046
20085
|
for (const segment of segments.slice(parentDepth)) {
|
|
20047
|
-
const child = binding.mkdirOpenChildBeneath
|
|
20086
|
+
const child = binding.mkdirOpenChildBeneath
|
|
20087
|
+
? binding.mkdirOpenChildBeneath(current, segment, mode ?? 0o777, flags)
|
|
20088
|
+
: {
|
|
20089
|
+
created: binding.mkdirChildBeneath(current, segment, mode ?? 0o777),
|
|
20090
|
+
fd: binding.openBeneath(current, segment, flags).fd,
|
|
20091
|
+
};
|
|
20048
20092
|
parentPath = external_node_path_.join(parentPath, segment);
|
|
20049
20093
|
directories.push({ fd: child.fd, pathname: parentPath });
|
|
20050
20094
|
// Retain every ancestor until the complete suffix is admitted. The
|
|
20051
20095
|
// post-create fence also precedes the next synchronous child mutation.
|
|
20052
20096
|
assertCurrent();
|
|
20097
|
+
if (mode !== undefined && child.created) {
|
|
20098
|
+
finalizeCreatedDirectoryModeSync(child, mode);
|
|
20099
|
+
assertCurrent();
|
|
20100
|
+
}
|
|
20053
20101
|
current = child.fd;
|
|
20054
20102
|
}
|
|
20055
20103
|
return true;
|
|
@@ -20068,7 +20116,7 @@ function mkdirMissingParents(root, segments, rootStat) {
|
|
|
20068
20116
|
throw error;
|
|
20069
20117
|
}
|
|
20070
20118
|
}
|
|
20071
|
-
function mkdirExistingParent(root, segments, parentIdentity) {
|
|
20119
|
+
function mkdirExistingParent(root, segments, parentIdentity, mode) {
|
|
20072
20120
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
20073
20121
|
try {
|
|
20074
20122
|
const target = external_node_path_.join(root.rootReal, ...segments);
|
|
@@ -20081,7 +20129,7 @@ function mkdirExistingParent(root, segments, parentIdentity) {
|
|
|
20081
20129
|
rootPath: root.rootReal, rootIdentity: root.rootIdentity,
|
|
20082
20130
|
}), false);
|
|
20083
20131
|
verifyMkdirDirectory(binding, rootOwner.fd, root.rootReal);
|
|
20084
|
-
const flags = (nodeDirectorySearchOnlyFlags()?.flags ?? external_node_fs_.constants.O_RDONLY) |
|
|
20132
|
+
const flags = (mode === undefined ? nodeDirectorySearchOnlyFlags()?.flags ?? external_node_fs_.constants.O_RDONLY : external_node_fs_.constants.O_RDONLY) |
|
|
20085
20133
|
(external_node_fs_.constants.O_DIRECTORY ?? 0) | (external_node_fs_.constants.O_NOFOLLOW ?? 0);
|
|
20086
20134
|
const close = captureNativeFdClose(binding);
|
|
20087
20135
|
const parent = binding.openBeneath(rootOwner.fd, segments.slice(0, -1).join("/"), flags).fd;
|
|
@@ -20091,14 +20139,24 @@ function mkdirExistingParent(root, segments, parentIdentity) {
|
|
|
20091
20139
|
root_context_assertRootIdentityCurrentSync(root);
|
|
20092
20140
|
const name = segments.at(-1);
|
|
20093
20141
|
const child = binding.mkdirOpenChildBeneath
|
|
20094
|
-
? binding.mkdirOpenChildBeneath(parent, name, 0o777, flags)
|
|
20095
|
-
:
|
|
20096
|
-
|
|
20142
|
+
? binding.mkdirOpenChildBeneath(parent, name, mode ?? 0o777, flags)
|
|
20143
|
+
: {
|
|
20144
|
+
created: binding.mkdirChildBeneath(parent, name, mode ?? 0o777),
|
|
20145
|
+
fd: binding.openBeneath(parent, name, flags).fd,
|
|
20146
|
+
};
|
|
20147
|
+
const childOwner = root_mkdir_native_addDisposableResource(env_2, { [Symbol.dispose]() { close(child.fd); } }, false);
|
|
20097
20148
|
root_context_assertRootIdentityCurrentSync(root);
|
|
20098
|
-
verifyMkdirDirectory(binding, child, target);
|
|
20149
|
+
verifyMkdirDirectory(binding, child.fd, target);
|
|
20099
20150
|
directory_guard_inspectDirectoryIdentitySync(parentPath, parentIdentity);
|
|
20100
20151
|
verifyMkdirDirectory(binding, parent, parentPath);
|
|
20101
20152
|
verifyMkdirDirectory(binding, rootOwner.fd, root.rootReal);
|
|
20153
|
+
if (mode !== undefined && child.created) {
|
|
20154
|
+
finalizeCreatedDirectoryModeSync(child, mode);
|
|
20155
|
+
verifyMkdirDirectory(binding, child.fd, target);
|
|
20156
|
+
verifyMkdirDirectory(binding, parent, parentPath);
|
|
20157
|
+
verifyMkdirDirectory(binding, rootOwner.fd, root.rootReal);
|
|
20158
|
+
root_context_assertRootIdentityCurrentSync(root);
|
|
20159
|
+
}
|
|
20102
20160
|
return true;
|
|
20103
20161
|
}
|
|
20104
20162
|
catch (e_2) {
|
|
@@ -21258,7 +21316,7 @@ async function assertMissingRemovalPrefixCurrent(rootGuard, intermediates) {
|
|
|
21258
21316
|
catch (error) {
|
|
21259
21317
|
throw removalAncestorChanged(error);
|
|
21260
21318
|
}
|
|
21261
|
-
if (!
|
|
21319
|
+
if (!sameFileIdentityForCleanup(deepestGuard.stat, deepest) ||
|
|
21262
21320
|
!sameCanonicalDirectory(deepestGuard.realPath, deepest.path)) {
|
|
21263
21321
|
throw removalAncestorChanged();
|
|
21264
21322
|
}
|
|
@@ -21283,7 +21341,7 @@ async function captureNonrecursiveRemovalAdmission(root, targetPath, options, re
|
|
|
21283
21341
|
await assertRootIdentityCurrent(root);
|
|
21284
21342
|
throw normalizeRemoveGuardError(error);
|
|
21285
21343
|
}
|
|
21286
|
-
if (!
|
|
21344
|
+
if (!sameFileIdentityForCleanup(rootGuard.stat, root.rootIdentity))
|
|
21287
21345
|
throw rootPathChangedError();
|
|
21288
21346
|
if (parentPath === root.rootReal) {
|
|
21289
21347
|
const rootAssertion = createRemovalDirectoryAssertion(rootGuard.dir, rootGuard.stat, rootGuard.realPath);
|
|
@@ -21447,7 +21505,7 @@ async function removePathInRootFallback(root, targetPath, options, receipts) {
|
|
|
21447
21505
|
});
|
|
21448
21506
|
let examined = 0;
|
|
21449
21507
|
const rootGuard = await directory_guard_createAsyncDirectoryGuard(root.rootReal, { bigint: true });
|
|
21450
|
-
if (!
|
|
21508
|
+
if (!sameFileIdentityForCleanup(rootGuard.stat, root.rootIdentity))
|
|
21451
21509
|
throw rootPathChangedError();
|
|
21452
21510
|
const guards = [
|
|
21453
21511
|
createRemovalDirectoryAssertion(rootGuard.dir, rootGuard.stat, rootGuard.realPath),
|
|
@@ -21524,7 +21582,7 @@ async function removePathInRootFallback(root, targetPath, options, receipts) {
|
|
|
21524
21582
|
throw normalizeRemovePathError(error, details(target, "inspect"));
|
|
21525
21583
|
}
|
|
21526
21584
|
if (!isPathInside(directoryGuard.realPath, target) || !isPathInside(target, directoryGuard.realPath) ||
|
|
21527
|
-
!
|
|
21585
|
+
!sameFileIdentityForCleanup(directoryGuard.stat, initial)) {
|
|
21528
21586
|
throw new errors_FsSafeError("path-mismatch", "removal directory changed during operation");
|
|
21529
21587
|
}
|
|
21530
21588
|
guards.push(createRemovalDirectoryAssertion(directoryGuard.dir, directoryGuard.stat, directoryGuard.realPath));
|
|
@@ -22199,7 +22257,7 @@ async function finishRootFallbackWrite(params) {
|
|
|
22199
22257
|
// identity without reading bytes; a different object must still fail.
|
|
22200
22258
|
await verify();
|
|
22201
22259
|
}
|
|
22202
|
-
else if (!
|
|
22260
|
+
else if (!sameFileIdentityForCleanup(current, identity)) {
|
|
22203
22261
|
const opened = await params.openForCompatibility();
|
|
22204
22262
|
accepted = handle = opened.opened.handle;
|
|
22205
22263
|
identity = opened.identity;
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"ghcr.io/devcontainers/features/copilot-cli:1.0.0": {},
|
|
12
12
|
"ghcr.io/anthropics/devcontainer-features/claude-code:1": {
|
|
13
|
-
"version": "v2.1.
|
|
13
|
+
"version": "v2.1.316"
|
|
14
14
|
},
|
|
15
15
|
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1.0.2": {
|
|
16
16
|
"packages": "libnss3, libnspr4, libatk1.0-0t64, libatk-bridge2.0-0t64, libcups2t64, libdrm2, libdbus-1-3, libatspi2.0-0t64, libxcomposite1, libxdamage1, libxfixes3, libxrandr2, libgbm1, libxkbcommon0, libasound2t64, yamllint, shellcheck",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@biomejs/biome": "2.5.15",
|
|
25
25
|
"@eslint/eslintrc": "3.3.7",
|
|
26
|
-
"@lousy-agents/mcp": "5.22.
|
|
26
|
+
"@lousy-agents/mcp": "5.22.22",
|
|
27
27
|
"@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
|
|
28
28
|
"@testing-library/jest-dom": "7.0.1",
|
|
29
29
|
"@testing-library/react": "16.3.3",
|