@lousy-agents/cli 5.23.1 → 5.23.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.
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@biomejs/biome": "2.5.15",
|
|
21
|
-
"@lousy-agents/mcp": "5.23.
|
|
21
|
+
"@lousy-agents/mcp": "5.23.1",
|
|
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.23.
|
|
978
|
-
"resolved": "https://registry.npmjs.org/@lousy-agents/mcp/-/mcp-5.23.
|
|
979
|
-
"integrity": "sha512-
|
|
977
|
+
"version": "5.23.1",
|
|
978
|
+
"resolved": "https://registry.npmjs.org/@lousy-agents/mcp/-/mcp-5.23.1.tgz",
|
|
979
|
+
"integrity": "sha512-XlXI2tu9lWy7FvXw1HFSZ1vr5xlzqy7xneu/EskV7gAuXaHp6EmJweURnqvz+gVKQgq9OWHLkzysDKBwr6zOiA==",
|
|
980
980
|
"dev": true,
|
|
981
981
|
"license": "BSD-2-Clause-Patent",
|
|
982
982
|
"dependencies": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@biomejs/biome": "2.5.15",
|
|
32
|
-
"@lousy-agents/mcp": "5.23.
|
|
32
|
+
"@lousy-agents/mcp": "5.23.1",
|
|
33
33
|
"@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
|
|
34
34
|
"@testcontainers/postgresql": "12.2.1",
|
|
35
35
|
"@types/node": "26.6.6",
|
package/dist/index.js
CHANGED
|
@@ -3767,18 +3767,16 @@ async function writeAllToFile(target, data, options = {}) {
|
|
|
3767
3767
|
const length = Math.min(WRITE_CHUNK_BYTES, buffer.byteLength - offset);
|
|
3768
3768
|
const position = options.position === undefined ? null : options.position + offset;
|
|
3769
3769
|
options.assertBeforeMutation?.();
|
|
3770
|
-
const written = typeof target === "number"
|
|
3771
|
-
?
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
})
|
|
3781
|
-
: (await target.write(buffer, offset, length, position)).bytesWritten;
|
|
3770
|
+
const written = typeof target === "number"
|
|
3771
|
+
? await new Promise((resolve, reject) => {
|
|
3772
|
+
external_node_fs_.write(target, buffer, offset, length, position, (error, bytesWritten) => {
|
|
3773
|
+
if (error)
|
|
3774
|
+
reject(error);
|
|
3775
|
+
else
|
|
3776
|
+
resolve(bytesWritten);
|
|
3777
|
+
});
|
|
3778
|
+
})
|
|
3779
|
+
: (await target.write(buffer, offset, length, position)).bytesWritten;
|
|
3782
3780
|
if (written <= 0) {
|
|
3783
3781
|
throw new errors_FsSafeError("helper-failed", "file write made no progress");
|
|
3784
3782
|
}
|
|
@@ -4824,6 +4822,7 @@ function assertWindowsAclRemediationAllowed() {
|
|
|
4824
4822
|
|
|
4825
4823
|
|
|
4826
4824
|
|
|
4825
|
+
|
|
4827
4826
|
const runtimePlatform = process.versions.bun ? (0,external_node_os_.platform)() : undefined;
|
|
4828
4827
|
const bunPosix = runtimePlatform === "darwin" || runtimePlatform === "linux" ? runtimePlatform : undefined;
|
|
4829
4828
|
function realpath_resolve(input, native) {
|
|
@@ -4892,6 +4891,21 @@ function realpath_resolve(input, native) {
|
|
|
4892
4891
|
const realpath_realpathSync = Object.assign((input) => realpath_resolve(input, false), {
|
|
4893
4892
|
native: (input) => realpath_resolve(input, true),
|
|
4894
4893
|
});
|
|
4894
|
+
/** Async on Node; retain runtime-specific native canonicalization guarantees. */
|
|
4895
|
+
async function realpath_realpathNative(input) {
|
|
4896
|
+
if (bunPosix)
|
|
4897
|
+
return realpath_realpathSync.native(input);
|
|
4898
|
+
try {
|
|
4899
|
+
return await promises_.realpath(input);
|
|
4900
|
+
}
|
|
4901
|
+
catch (error) {
|
|
4902
|
+
if (process.platform !== "win32" || error.code !== "EPERM" ||
|
|
4903
|
+
error.syscall !== "realpath")
|
|
4904
|
+
throw error;
|
|
4905
|
+
// AppContainer DOS-name translation still belongs to the native sync owner.
|
|
4906
|
+
return realpath_realpathSync.native(input);
|
|
4907
|
+
}
|
|
4908
|
+
}
|
|
4895
4909
|
|
|
4896
4910
|
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/directory-entry-path.js
|
|
4897
4911
|
|
|
@@ -6102,7 +6116,7 @@ async function resolveAbsolutePathForRead(filePath, options = {}) {
|
|
|
6102
6116
|
const normalized = assertAbsolutePathInput(filePath);
|
|
6103
6117
|
let canonicalPath;
|
|
6104
6118
|
try {
|
|
6105
|
-
canonicalPath =
|
|
6119
|
+
canonicalPath = await realpathNative(pathForWindowsFilesystem(normalized));
|
|
6106
6120
|
assertNoWindowsPathAlias(canonicalPath);
|
|
6107
6121
|
}
|
|
6108
6122
|
catch (err) {
|
|
@@ -8035,6 +8049,12 @@ function root_boundary_admitPathInsideRoot(params) {
|
|
|
8035
8049
|
|
|
8036
8050
|
|
|
8037
8051
|
|
|
8052
|
+
|
|
8053
|
+
|
|
8054
|
+
// Windows native realpath denies delete sharing. Preserve read/publication
|
|
8055
|
+
// scheduling until canonicalization can safely overlap replacement.
|
|
8056
|
+
const synchronousRootTraversal = process.platform === "win32";
|
|
8057
|
+
const root_path_existing_runRootTraversal = synchronousRootTraversal ? atomic_io_runSync : runAsync;
|
|
8038
8058
|
function absolutePathWithRawSegments(candidate) {
|
|
8039
8059
|
if (external_node_path_.sep !== "\\") {
|
|
8040
8060
|
if (external_node_path_.isAbsolute(candidate))
|
|
@@ -8052,7 +8072,7 @@ function absolutePathWithRawSegments(candidate) {
|
|
|
8052
8072
|
const base = drive ? external_node_path_.resolve(drive) : process.cwd();
|
|
8053
8073
|
return `${base}${base.endsWith(external_node_path_.sep) ? "" : external_node_path_.sep}${raw.slice(drive.length)}`;
|
|
8054
8074
|
}
|
|
8055
|
-
function rawPathRelativeToCanonicalRoot(candidate, rootCanonicalPath, options = {}) {
|
|
8075
|
+
function* rawPathRelativeToCanonicalRoot(candidate, rootCanonicalPath, options = {}, synchronous = true) {
|
|
8056
8076
|
windows_path_alias_assertNoWindowsPathAlias(candidate);
|
|
8057
8077
|
windows_path_alias_assertNoWindowsPathAlias(rootCanonicalPath);
|
|
8058
8078
|
const absolute = absolutePathWithRawSegments(candidate);
|
|
@@ -8071,7 +8091,7 @@ function rawPathRelativeToCanonicalRoot(candidate, rootCanonicalPath, options =
|
|
|
8071
8091
|
let isSymlink = false;
|
|
8072
8092
|
try {
|
|
8073
8093
|
const operationPath = windows_path_alias_pathForWindowsFilesystem(prefix);
|
|
8074
|
-
const stat = external_node_fs_.lstatSync(operationPath);
|
|
8094
|
+
const stat = synchronous ? external_node_fs_.lstatSync(operationPath) : yield* wait(promises_.lstat(operationPath));
|
|
8075
8095
|
isSymlink = stat.isSymbolicLink();
|
|
8076
8096
|
// Check the original leaf before canonicalization can erase an entry alias.
|
|
8077
8097
|
if (isSymlink && options.rejectFinalSymlink && index === finalComponentIndex) {
|
|
@@ -8080,10 +8100,11 @@ function rawPathRelativeToCanonicalRoot(candidate, rootCanonicalPath, options =
|
|
|
8080
8100
|
if (!isSymlink && !stat.isDirectory() && index < segments.length - 1)
|
|
8081
8101
|
return undefined;
|
|
8082
8102
|
traversedSymlink ||= isSymlink;
|
|
8083
|
-
canonical = realpath_realpathSync.native(operationPath);
|
|
8103
|
+
canonical = synchronous ? realpath_realpathSync.native(operationPath) : yield* wait(realpath_realpathNative(operationPath));
|
|
8084
8104
|
windows_path_alias_assertNoWindowsPathAlias(canonical);
|
|
8085
8105
|
if (isSymlink && index < segments.length - 1 &&
|
|
8086
|
-
!external_node_fs_.statSync(windows_path_alias_pathForWindowsFilesystem(canonical))
|
|
8106
|
+
!(synchronous ? external_node_fs_.statSync(windows_path_alias_pathForWindowsFilesystem(canonical))
|
|
8107
|
+
: yield* wait(promises_.stat(windows_path_alias_pathForWindowsFilesystem(canonical)))).isDirectory())
|
|
8087
8108
|
return undefined;
|
|
8088
8109
|
if (isSymlink && !isPathInside(rootCanonicalPath, canonical) && !isPathInside(canonical, rootCanonicalPath)) {
|
|
8089
8110
|
throw new errors_FsSafeError("outside-workspace", `symlink prefix resolves outside the root ancestry: ${formatErrorDetail(candidate)}`);
|
|
@@ -8112,9 +8133,10 @@ function rawPathRelativeToCanonicalRoot(candidate, rootCanonicalPath, options =
|
|
|
8112
8133
|
}
|
|
8113
8134
|
return undefined;
|
|
8114
8135
|
}
|
|
8115
|
-
function root_path_existing_pathExists(targetPath) {
|
|
8136
|
+
function* root_path_existing_pathExists(targetPath, synchronous) {
|
|
8116
8137
|
try {
|
|
8117
|
-
return external_node_fs_.lstatSync(windows_path_alias_pathForWindowsFilesystem(targetPath), { throwIfNoEntry: false })
|
|
8138
|
+
return (synchronous ? external_node_fs_.lstatSync(windows_path_alias_pathForWindowsFilesystem(targetPath), { throwIfNoEntry: false })
|
|
8139
|
+
: yield* wait(promises_.lstat(windows_path_alias_pathForWindowsFilesystem(targetPath)))) !== undefined;
|
|
8118
8140
|
}
|
|
8119
8141
|
catch (error) {
|
|
8120
8142
|
if (path_isNotFoundPathError(error)) {
|
|
@@ -8124,17 +8146,20 @@ function root_path_existing_pathExists(targetPath) {
|
|
|
8124
8146
|
}
|
|
8125
8147
|
}
|
|
8126
8148
|
async function resolvePathViaExistingAncestor(targetPath) {
|
|
8127
|
-
return
|
|
8149
|
+
return root_path_existing_runRootTraversal(resolveExistingAncestorProcedure(targetPath, "native", synchronousRootTraversal));
|
|
8128
8150
|
}
|
|
8129
|
-
function
|
|
8151
|
+
function* ordinaryExists(targetPath) {
|
|
8130
8152
|
return external_node_fs_.existsSync(windows_path_alias_pathForWindowsFilesystem(targetPath));
|
|
8131
8153
|
}
|
|
8132
8154
|
function resolvePathViaExistingAncestorSync(targetPath) {
|
|
8133
8155
|
return resolveExistingAncestor(targetPath, "ordinary");
|
|
8134
8156
|
}
|
|
8135
8157
|
function resolveExistingAncestor(targetPath, mode, preserveRawSegments = false, remainingHops = 64) {
|
|
8136
|
-
|
|
8137
|
-
|
|
8158
|
+
return atomic_io_runSync(resolveExistingAncestorProcedure(targetPath, mode, true, preserveRawSegments, remainingHops));
|
|
8159
|
+
}
|
|
8160
|
+
function* resolveExistingAncestorProcedure(targetPath, mode, synchronous, preserveRawSegments = false, remainingHops = 64) {
|
|
8161
|
+
const exists = (pathname) => mode === "native" || preserveRawSegments
|
|
8162
|
+
? root_path_existing_pathExists(pathname, synchronous) : ordinaryExists(pathname);
|
|
8138
8163
|
windows_path_alias_assertNoWindowsPathAlias(targetPath);
|
|
8139
8164
|
const normalized = windows_path_alias_resolvePathPreservingWindowsRoot(targetPath);
|
|
8140
8165
|
windows_path_alias_assertNoWindowsPathAlias(normalized);
|
|
@@ -8142,22 +8167,23 @@ function resolveExistingAncestor(targetPath, mode, preserveRawSegments = false,
|
|
|
8142
8167
|
let cursor = candidate;
|
|
8143
8168
|
const filesystemRoot = external_node_path_.parse(candidate).root;
|
|
8144
8169
|
while (cursor !== filesystemRoot &&
|
|
8145
|
-
!exists(cursor)) {
|
|
8170
|
+
!(yield* exists(cursor))) {
|
|
8146
8171
|
cursor = external_node_path_.dirname(cursor);
|
|
8147
8172
|
}
|
|
8148
|
-
if (!exists(cursor)) {
|
|
8173
|
+
if (!(yield* exists(cursor))) {
|
|
8149
8174
|
return normalized;
|
|
8150
8175
|
}
|
|
8151
8176
|
let rawResolvedAncestor;
|
|
8152
8177
|
try {
|
|
8153
|
-
rawResolvedAncestor =
|
|
8178
|
+
rawResolvedAncestor = synchronous ? realpath_realpathSync.native(windows_path_alias_pathForWindowsFilesystem(cursor))
|
|
8179
|
+
: yield* wait(realpath_realpathNative(windows_path_alias_pathForWindowsFilesystem(cursor)));
|
|
8154
8180
|
}
|
|
8155
8181
|
catch (error) {
|
|
8156
8182
|
if (!preserveRawSegments)
|
|
8157
8183
|
return normalized;
|
|
8158
8184
|
if (!path_isNotFoundPathError(error))
|
|
8159
8185
|
throw error;
|
|
8160
|
-
rawResolvedAncestor = resolveSymlinkHopPath(cursor, mode, false, remainingHops);
|
|
8186
|
+
rawResolvedAncestor = yield* resolveSymlinkHopPath(cursor, mode, false, remainingHops, synchronous);
|
|
8161
8187
|
}
|
|
8162
8188
|
windows_path_alias_assertNoWindowsPathAlias(rawResolvedAncestor);
|
|
8163
8189
|
const resolvedAncestor = windows_path_alias_resolvePathPreservingWindowsRoot(rawResolvedAncestor);
|
|
@@ -8173,10 +8199,10 @@ function resolveExistingAncestor(targetPath, mode, preserveRawSegments = false,
|
|
|
8173
8199
|
windows_path_alias_assertNoWindowsPathAlias(resolved);
|
|
8174
8200
|
return resolved;
|
|
8175
8201
|
}
|
|
8176
|
-
function resolveSymlinkHopPath(symlinkPath, mode, rejectUnresolved, remainingHops = 64) {
|
|
8202
|
+
function* resolveSymlinkHopPath(symlinkPath, mode, rejectUnresolved, remainingHops = 64, synchronous = true) {
|
|
8177
8203
|
try {
|
|
8178
|
-
const
|
|
8179
|
-
|
|
8204
|
+
const rawRealPath = synchronous ? realpath_realpathSync.native(symlinkPath)
|
|
8205
|
+
: yield* wait(realpath_realpathNative(symlinkPath));
|
|
8180
8206
|
windows_path_alias_assertNoWindowsPathAlias(rawRealPath, "filesystem", "resolved symlink path uses a Windows filesystem namespace alias");
|
|
8181
8207
|
const realPath = windows_path_alias_resolvePathPreservingWindowsRoot(rawRealPath);
|
|
8182
8208
|
windows_path_alias_assertNoWindowsPathAlias(realPath, "filesystem", "resolved symlink path uses a Windows filesystem namespace alias");
|
|
@@ -8190,14 +8216,14 @@ function resolveSymlinkHopPath(symlinkPath, mode, rejectUnresolved, remainingHop
|
|
|
8190
8216
|
throw error;
|
|
8191
8217
|
if (remainingHops <= 0)
|
|
8192
8218
|
throw new errors_FsSafeError("symlink", "too many unresolved symlink hops");
|
|
8193
|
-
const linkTarget = external_node_fs_.readlinkSync(symlinkPath);
|
|
8219
|
+
const linkTarget = synchronous ? external_node_fs_.readlinkSync(symlinkPath) : yield* wait(promises_.readlink(symlinkPath));
|
|
8194
8220
|
windows_path_alias_assertNoWindowsPathAlias(linkTarget, "filesystem", "symlink target uses a Windows filesystem namespace alias");
|
|
8195
8221
|
const linkDir = windows_path_alias_resolvePathPreservingWindowsRoot(external_node_path_.dirname(symlinkPath));
|
|
8196
8222
|
// Keep parent segments until the kernel has resolved the existing prefix.
|
|
8197
8223
|
const targetPath = external_node_path_.isAbsolute(linkTarget) ? linkTarget
|
|
8198
8224
|
: external_node_path_.parse(linkTarget).root ? windows_path_alias_resolvePathFromBasePreservingWindowsRoot(linkDir, linkTarget)
|
|
8199
8225
|
: `${linkDir}${external_node_path_.sep}${linkTarget}`;
|
|
8200
|
-
const resolved =
|
|
8226
|
+
const resolved = yield* resolveExistingAncestorProcedure(targetPath, mode, synchronous, true, remainingHops - 1);
|
|
8201
8227
|
windows_path_alias_assertNoWindowsPathAlias(resolved, "filesystem", "resolved symlink path uses a Windows filesystem namespace alias");
|
|
8202
8228
|
return resolved;
|
|
8203
8229
|
}
|
|
@@ -8325,7 +8351,7 @@ async function runAsync(procedure) {
|
|
|
8325
8351
|
}
|
|
8326
8352
|
return step.value;
|
|
8327
8353
|
}
|
|
8328
|
-
function
|
|
8354
|
+
function atomic_io_runSync(procedure) {
|
|
8329
8355
|
let step = procedure.next();
|
|
8330
8356
|
// Sync adapters retain their ordinary return values; this driver never reads then.
|
|
8331
8357
|
while (!step.done)
|
|
@@ -9276,21 +9302,21 @@ function probeTemporaryEntry(directory) {
|
|
|
9276
9302
|
const owner = new AtomicTempOwner(external_node_path_.join(directory, name), io);
|
|
9277
9303
|
try {
|
|
9278
9304
|
owner.start();
|
|
9279
|
-
owner.adopt(
|
|
9305
|
+
owner.adopt(atomic_io_runSync(writeTempFile(io, {
|
|
9280
9306
|
tempPath: owner.pathname,
|
|
9281
9307
|
content: "",
|
|
9282
9308
|
mode: 0o600,
|
|
9283
9309
|
sync: false,
|
|
9284
9310
|
onIdentity: owner.onIdentity,
|
|
9285
9311
|
})));
|
|
9286
|
-
|
|
9312
|
+
atomic_io_runSync(owner.assertCurrent());
|
|
9287
9313
|
const observed = probeEntry(directory, name, new Set(external_node_fs_.readdirSync(directory)));
|
|
9288
|
-
|
|
9314
|
+
atomic_io_runSync(owner.assertCurrent());
|
|
9289
9315
|
return observed;
|
|
9290
9316
|
}
|
|
9291
9317
|
finally {
|
|
9292
9318
|
// Failed cleanup invalidates the observation; the existing owner retains its exit retry.
|
|
9293
|
-
|
|
9319
|
+
atomic_io_runSync(owner.finish({ throwOnCleanupError: true }));
|
|
9294
9320
|
}
|
|
9295
9321
|
}
|
|
9296
9322
|
function probeDirectory(directory, allowTemporaryProbe, preferredName) {
|
|
@@ -11951,6 +11977,8 @@ function captureRootPathObservedDirectory(observation, observed, publicPath, can
|
|
|
11951
11977
|
|
|
11952
11978
|
|
|
11953
11979
|
|
|
11980
|
+
|
|
11981
|
+
|
|
11954
11982
|
const ROOT_PATH_ALIAS_POLICIES = {
|
|
11955
11983
|
strict: Object.freeze({
|
|
11956
11984
|
allowFinalSymlinkForUnlink: false,
|
|
@@ -11962,36 +11990,38 @@ const ROOT_PATH_ALIAS_POLICIES = {
|
|
|
11962
11990
|
}),
|
|
11963
11991
|
};
|
|
11964
11992
|
async function root_path_resolveRootPath(params) {
|
|
11965
|
-
return resolveRootPathInternal(params);
|
|
11993
|
+
return root_path_existing_runRootTraversal(resolveRootPathInternal(params));
|
|
11966
11994
|
}
|
|
11967
11995
|
async function resolveRootPathWithCanonicalRootObservation(params, observeRoot) {
|
|
11968
|
-
return resolveRootPathInternal(params, { observeRoot });
|
|
11996
|
+
return runRootTraversal(resolveRootPathInternal(params, { observeRoot }));
|
|
11969
11997
|
}
|
|
11970
11998
|
async function resolveRootPathWithObservation(params, request) {
|
|
11971
11999
|
const observation = { request };
|
|
11972
|
-
const resolved =
|
|
12000
|
+
const resolved = synchronousRootTraversal
|
|
12001
|
+
? atomic_io_runSync(resolveRootPathInternal(params, { observation }))
|
|
12002
|
+
: await root_path_existing_runRootTraversal(resolveRootPathInternal(params, { observation }));
|
|
11973
12003
|
return observation.receipt ? { resolved, receipt: observation.receipt } : { resolved };
|
|
11974
12004
|
}
|
|
11975
12005
|
// Removal receipts are separate from metadata observations and canonical-root
|
|
11976
|
-
// callbacks;
|
|
12006
|
+
// callbacks; retain their synchronous admission and mutation-fence owner.
|
|
11977
12007
|
async function resolveRootPathForRemoval(params, receipts) {
|
|
11978
|
-
return resolveRootPathInternal(params, { removalReceipts: receipts });
|
|
12008
|
+
return atomic_io_runSync(resolveRootPathInternal(params, { removalReceipts: receipts }, true));
|
|
11979
12009
|
}
|
|
11980
12010
|
function root_path_resolveRootPathSync(params) {
|
|
11981
|
-
return resolveRootPathInternal(params, { mode: "ordinary" });
|
|
12011
|
+
return atomic_io_runSync(resolveRootPathInternal(params, { mode: "ordinary" }, true));
|
|
11982
12012
|
}
|
|
11983
12013
|
function resolveRootPathSyncWithCanonicalRootObservation(params, observeRoot) {
|
|
11984
|
-
return resolveRootPathInternal(params, { mode: "ordinary", observeRoot });
|
|
12014
|
+
return runSync(resolveRootPathInternal(params, { mode: "ordinary", observeRoot }, true));
|
|
11985
12015
|
}
|
|
11986
|
-
function resolveRootPathInternal(params, options = {}) {
|
|
12016
|
+
function* resolveRootPathInternal(params, options = {}, synchronous = synchronousRootTraversal) {
|
|
11987
12017
|
try {
|
|
11988
|
-
return traverseRootPath(params, options);
|
|
12018
|
+
return yield* traverseRootPath(params, options, synchronous);
|
|
11989
12019
|
}
|
|
11990
12020
|
catch (error) {
|
|
11991
12021
|
throw sanitizeRootPathError(error);
|
|
11992
12022
|
}
|
|
11993
12023
|
}
|
|
11994
|
-
function prepareRootTraversal(params, rootPath, rootCanonicalPath, absolutePath, rawAbsolutePath) {
|
|
12024
|
+
function* prepareRootTraversal(params, rootPath, rootCanonicalPath, absolutePath, rawAbsolutePath, synchronous) {
|
|
11995
12025
|
let raw = rawAbsolutePath;
|
|
11996
12026
|
let trustedAbsolutePath = false;
|
|
11997
12027
|
// Even a metadata lookup on a foreign share contacts that host, including the
|
|
@@ -12007,7 +12037,7 @@ function prepareRootTraversal(params, rootPath, rootCanonicalPath, absolutePath,
|
|
|
12007
12037
|
else {
|
|
12008
12038
|
const canonical = admitRawPathInsideRoot(rootCanonicalPath, raw, params.rootIdentity);
|
|
12009
12039
|
const relative = canonical?.relativePath
|
|
12010
|
-
?? rawPathRelativeToCanonicalRoot(raw, rootCanonicalPath, params);
|
|
12040
|
+
?? (yield* rawPathRelativeToCanonicalRoot(raw, rootCanonicalPath, params, synchronous));
|
|
12011
12041
|
if (relative === undefined) {
|
|
12012
12042
|
throw pathEscapeError({ rootPath, absolutePath: raw, boundaryLabel: params.boundaryLabel });
|
|
12013
12043
|
}
|
|
@@ -12188,27 +12218,28 @@ function assertDirectoryBeforeMoreSegments(stat, pathname, isLast) {
|
|
|
12188
12218
|
throw Object.assign(new Error(`Path component is not a directory: ${pathname}`), { code: "ENOTDIR" });
|
|
12189
12219
|
}
|
|
12190
12220
|
}
|
|
12191
|
-
function assertResolvedLinkDirectory(pathname, isLast) {
|
|
12221
|
+
function* assertResolvedLinkDirectory(pathname, isLast, synchronous) {
|
|
12192
12222
|
if (isLast)
|
|
12193
12223
|
return;
|
|
12194
|
-
const stat = external_node_fs_.statSync(windows_path_alias_pathForWindowsFilesystem(pathname))
|
|
12224
|
+
const stat = synchronous ? external_node_fs_.statSync(windows_path_alias_pathForWindowsFilesystem(pathname))
|
|
12225
|
+
: yield* wait(promises_.stat(windows_path_alias_pathForWindowsFilesystem(pathname)));
|
|
12195
12226
|
assertDirectoryBeforeMoreSegments(stat, pathname, isLast);
|
|
12196
12227
|
}
|
|
12197
|
-
// Both
|
|
12198
|
-
//
|
|
12199
|
-
function traverseRootPath(params, { mode = "native", observation: observationOutput, observeRoot, removalReceipts }) {
|
|
12228
|
+
// Both drivers share containment policy. Observation receipts and platform-specific
|
|
12229
|
+
// native guards retain their existing synchronous owners.
|
|
12230
|
+
function* traverseRootPath(params, { mode = "native", observation: observationOutput, observeRoot, removalReceipts }, synchronous) {
|
|
12200
12231
|
const input = captureValidRootPathInputs(params);
|
|
12201
12232
|
const rawAbsolutePath = absolutePathWithRawSegments(input.absolutePath);
|
|
12202
12233
|
const rootPath = windows_path_alias_resolvePathPreservingWindowsRoot(input.rootPath);
|
|
12203
12234
|
const absolutePath = windows_path_alias_resolvePathPreservingWindowsRoot(rawAbsolutePath);
|
|
12204
12235
|
const rootCanonicalPath = input.rootCanonicalPath
|
|
12205
12236
|
? windows_path_alias_resolvePathPreservingWindowsRoot(input.rootCanonicalPath)
|
|
12206
|
-
:
|
|
12237
|
+
: yield* resolveExistingAncestorProcedure(rootPath, mode, synchronous);
|
|
12207
12238
|
windows_path_alias_assertNoWindowsPathAlias(rootPath);
|
|
12208
12239
|
windows_path_alias_assertNoWindowsPathAlias(absolutePath);
|
|
12209
12240
|
windows_path_alias_assertNoWindowsPathAlias(rootCanonicalPath);
|
|
12210
12241
|
observeRoot?.(rootCanonicalPath);
|
|
12211
|
-
const context = createLexicalTraversalContext(prepareRootTraversal(input, rootPath, rootCanonicalPath, absolutePath, rawAbsolutePath));
|
|
12242
|
+
const context = createLexicalTraversalContext(yield* prepareRootTraversal(input, rootPath, rootCanonicalPath, absolutePath, rawAbsolutePath, synchronous));
|
|
12212
12243
|
const { state } = context;
|
|
12213
12244
|
const observation = createLexicalTraversalObservation(context, observationOutput?.request);
|
|
12214
12245
|
for (let idx = 0; idx < state.segments.length; idx += 1) {
|
|
@@ -12245,7 +12276,8 @@ function traverseRootPath(params, { mode = "native", observation: observationOut
|
|
|
12245
12276
|
}
|
|
12246
12277
|
stat = isNativeDirectoryObservationGuard(observed)
|
|
12247
12278
|
? undefined
|
|
12248
|
-
: observed?.stat ?? external_node_fs_.lstatSync(state.lexicalCursor)
|
|
12279
|
+
: observed?.stat ?? (synchronous ? external_node_fs_.lstatSync(state.lexicalCursor)
|
|
12280
|
+
: yield* wait(promises_.lstat(state.lexicalCursor)));
|
|
12249
12281
|
}
|
|
12250
12282
|
}
|
|
12251
12283
|
catch (error) {
|
|
@@ -12308,12 +12340,12 @@ function traverseRootPath(params, { mode = "native", observation: observationOut
|
|
|
12308
12340
|
}
|
|
12309
12341
|
if (observation?.enabled)
|
|
12310
12342
|
disableLexicalTraversalObservation(context, observation);
|
|
12311
|
-
const linkCanonical = resolveSymlinkHopPath(state.lexicalCursor, mode, context.resolveParams.rejectUnresolvedSymlinks);
|
|
12343
|
+
const linkCanonical = yield* resolveSymlinkHopPath(state.lexicalCursor, mode, context.resolveParams.rejectUnresolvedSymlinks, 64, synchronous);
|
|
12312
12344
|
applyResolvedSymlinkHop(context, linkCanonical);
|
|
12313
12345
|
if (context.resolveParams.rejectSymlinks === true) {
|
|
12314
12346
|
throw new errors_FsSafeError("symlink", "symlink path component not allowed");
|
|
12315
12347
|
}
|
|
12316
|
-
assertResolvedLinkDirectory(linkCanonical, isLast);
|
|
12348
|
+
yield* assertResolvedLinkDirectory(linkCanonical, isLast, synchronous);
|
|
12317
12349
|
}
|
|
12318
12350
|
const completeObservation = observation?.enabled === true && observation.directoryGuard !== undefined &&
|
|
12319
12351
|
observation.targetPath === state.canonicalCursor && observation.target !== undefined;
|
|
@@ -12321,7 +12353,7 @@ function traverseRootPath(params, { mode = "native", observation: observationOut
|
|
|
12321
12353
|
? isNativeDirectoryObservationGuard(observation.target)
|
|
12322
12354
|
? "directory"
|
|
12323
12355
|
: toResolvedKind(observation.target.stat)
|
|
12324
|
-
:
|
|
12356
|
+
: yield* getPathKind(state.canonicalCursor, state.preserveFinalSymlink, synchronous);
|
|
12325
12357
|
if (completeObservation && observationOutput) {
|
|
12326
12358
|
observationOutput.receipt = {
|
|
12327
12359
|
kind: observation.request.kind,
|
|
@@ -12334,12 +12366,12 @@ function traverseRootPath(params, { mode = "native", observation: observationOut
|
|
|
12334
12366
|
}
|
|
12335
12367
|
return finalizeLexicalResolution(context, kind);
|
|
12336
12368
|
}
|
|
12337
|
-
function
|
|
12369
|
+
function* getPathKind(absolutePath, preserveFinalSymlink, synchronous) {
|
|
12338
12370
|
try {
|
|
12339
12371
|
const operationPath = windows_path_alias_pathForWindowsFilesystem(absolutePath);
|
|
12340
12372
|
const stat = preserveFinalSymlink
|
|
12341
|
-
? external_node_fs_.lstatSync(operationPath)
|
|
12342
|
-
: external_node_fs_.statSync(operationPath);
|
|
12373
|
+
? synchronous ? external_node_fs_.lstatSync(operationPath) : yield* wait(promises_.lstat(operationPath))
|
|
12374
|
+
: synchronous ? external_node_fs_.statSync(operationPath) : yield* wait(promises_.stat(operationPath));
|
|
12343
12375
|
return toResolvedKind(stat);
|
|
12344
12376
|
}
|
|
12345
12377
|
catch (error) {
|
|
@@ -15403,7 +15435,6 @@ function replayPinnedInput(fd, input) {
|
|
|
15403
15435
|
})() };
|
|
15404
15436
|
}
|
|
15405
15437
|
const pinned_write_input_isUint8Array = external_node_util_.types.isUint8Array;
|
|
15406
|
-
const SMALL_BUFFER_BYTES = 64 * 1024;
|
|
15407
15438
|
function streamChunkBytes(chunk) {
|
|
15408
15439
|
if (Buffer.isBuffer(chunk))
|
|
15409
15440
|
return chunk;
|
|
@@ -15418,16 +15449,6 @@ async function writePinnedInput(target, input, maxBytes, assertBeforeMutation) {
|
|
|
15418
15449
|
await writeCopyFileToFd(typeof target === "number" ? target : target.fd, input, maxBytes, assertBeforeMutation);
|
|
15419
15450
|
return;
|
|
15420
15451
|
}
|
|
15421
|
-
if (typeof target === "number" && input.kind === "buffer" &&
|
|
15422
|
-
input.stageBeforePublish !== false && !assertBeforeMutation) {
|
|
15423
|
-
const data = typeof input.data === "string" ? Buffer.from(input.data, input.encoding ?? "utf8") : input.data;
|
|
15424
|
-
if (data.byteLength <= SMALL_BUFFER_BYTES) {
|
|
15425
|
-
if (maxBytes !== undefined && data.byteLength > maxBytes) {
|
|
15426
|
-
throw new errors_FsSafeError("too-large", `file exceeds limit of ${maxBytes} bytes (got at least ${data.byteLength})`);
|
|
15427
|
-
}
|
|
15428
|
-
return writeAllToFile(target, data, { synchronous: true });
|
|
15429
|
-
}
|
|
15430
|
-
}
|
|
15431
15452
|
let bytes = 0;
|
|
15432
15453
|
const write = async (data) => {
|
|
15433
15454
|
bytes += data.byteLength;
|
|
@@ -15919,8 +15940,8 @@ function assertNativeStaging(binding) {
|
|
|
15919
15940
|
binding.createStagedFile,
|
|
15920
15941
|
binding.stagedFileMatches,
|
|
15921
15942
|
binding.removeStagedFile,
|
|
15922
|
-
binding.
|
|
15923
|
-
binding.
|
|
15943
|
+
binding.renameReplaceAsync,
|
|
15944
|
+
binding.renameNoReplaceAsync,
|
|
15924
15945
|
].some((fn) => typeof fn !== "function")) {
|
|
15925
15946
|
throw new errors_FsSafeError("helper-unavailable", "native retained-directory staging is unavailable");
|
|
15926
15947
|
}
|
|
@@ -15940,7 +15961,7 @@ class NativeStagedFile {
|
|
|
15940
15961
|
#verifyMode;
|
|
15941
15962
|
#state = { status: "open", publication: NOT_PUBLISHED };
|
|
15942
15963
|
#receipt;
|
|
15943
|
-
#
|
|
15964
|
+
#publicationTask;
|
|
15944
15965
|
#rejectFinalSymlink = false;
|
|
15945
15966
|
#unsupportedNoReplace;
|
|
15946
15967
|
#fallbackCleanup;
|
|
@@ -16131,7 +16152,7 @@ class NativeStagedFile {
|
|
|
16131
16152
|
if (this.#private)
|
|
16132
16153
|
assertDarwinCreationAcl(this.#owner.parentFd, "file");
|
|
16133
16154
|
try {
|
|
16134
|
-
state.fileFd = this.#owner.binding.createStagedFile(this.#owner.parentFd, this.#owner.name);
|
|
16155
|
+
state.fileFd = await this.#owner.binding.createStagedFile(this.#owner.parentFd, this.#owner.name);
|
|
16135
16156
|
}
|
|
16136
16157
|
catch (error) {
|
|
16137
16158
|
annotateReadOnlyOpenError(error, external_node_path_.join(this.#owner.directory.realPath, this.#owner.name));
|
|
@@ -16180,7 +16201,14 @@ class NativeStagedFile {
|
|
|
16180
16201
|
async assertCurrent() {
|
|
16181
16202
|
this.#assertCurrent();
|
|
16182
16203
|
}
|
|
16183
|
-
|
|
16204
|
+
publish(basename, options, onPublished) {
|
|
16205
|
+
if (this.#publicationTask)
|
|
16206
|
+
return Promise.reject(stagedFailure("file", new errors_FsSafeError("helper-failed", "staged file publication is pending"), { phase: "publish", publication: this.#state.status === "closed" ? this.#state.receipt.publication : this.#state.publication }));
|
|
16207
|
+
// Claim the operation before yielding so cleanup cannot recycle a worker's fds.
|
|
16208
|
+
return this.#publicationTask = Promise.resolve().then(() => this.#publish(basename, options, onPublished))
|
|
16209
|
+
.finally(() => { this.#publicationTask = undefined; });
|
|
16210
|
+
}
|
|
16211
|
+
async #publish(basename, options, onPublished) {
|
|
16184
16212
|
const overwrite = options?.overwrite;
|
|
16185
16213
|
try {
|
|
16186
16214
|
const state = this.#open();
|
|
@@ -16197,10 +16225,10 @@ class NativeStagedFile {
|
|
|
16197
16225
|
}
|
|
16198
16226
|
try {
|
|
16199
16227
|
if (overwrite) {
|
|
16200
|
-
this.#owner.binding.
|
|
16228
|
+
await this.#owner.binding.renameReplaceAsync(this.#owner.parentFd, this.#owner.name, this.#owner.parentFd, basename);
|
|
16201
16229
|
}
|
|
16202
16230
|
else {
|
|
16203
|
-
this.#owner.binding.
|
|
16231
|
+
await this.#owner.binding.renameNoReplaceAsync(this.#owner.parentFd, this.#owner.name, this.#owner.parentFd, basename);
|
|
16204
16232
|
}
|
|
16205
16233
|
}
|
|
16206
16234
|
catch (error) {
|
|
@@ -16255,14 +16283,13 @@ class NativeStagedFile {
|
|
|
16255
16283
|
};
|
|
16256
16284
|
if (this.#owner.sync === false)
|
|
16257
16285
|
return verify();
|
|
16258
|
-
|
|
16286
|
+
return Promise.resolve().then(async () => {
|
|
16259
16287
|
if ((this.#owner.mode & 0o600) !== 0o600 || (stagedMode & ~this.#owner.mode) !== 0) {
|
|
16260
16288
|
await (this.#owner.strictFileSync ? syncFile(fd) : syncFileBestEffort(fd));
|
|
16261
16289
|
}
|
|
16262
16290
|
await syncFileBestEffort(this.#owner.parentFd);
|
|
16263
16291
|
return verify();
|
|
16264
|
-
})
|
|
16265
|
-
return this.#publicationFlush;
|
|
16292
|
+
});
|
|
16266
16293
|
}
|
|
16267
16294
|
#finalize() {
|
|
16268
16295
|
if (this.#state.status === "closed") {
|
|
@@ -16317,9 +16344,9 @@ class NativeStagedFile {
|
|
|
16317
16344
|
return this.#state;
|
|
16318
16345
|
}
|
|
16319
16346
|
async cleanup() {
|
|
16320
|
-
// Native descriptors
|
|
16321
|
-
if (this.#
|
|
16322
|
-
await this.#
|
|
16347
|
+
// Native descriptors stay owned through the rename and all durability fences.
|
|
16348
|
+
if (this.#publicationTask)
|
|
16349
|
+
await this.#publicationTask.catch(() => { });
|
|
16323
16350
|
const closed = this.#finalize();
|
|
16324
16351
|
if (closed.error) {
|
|
16325
16352
|
throw closed.error;
|
|
@@ -16417,7 +16444,7 @@ var native_pinned_write_disposeResources = (undefined && undefined.__disposeReso
|
|
|
16417
16444
|
|
|
16418
16445
|
|
|
16419
16446
|
const writeCapabilities = ["openBeneath", "mkdirBeneath", "renameNoReplace", "renameReplace"];
|
|
16420
|
-
const posixWriteCapabilities = [...writeCapabilities, "createStagedFile", "stagedFileMatches", "removeStagedFile"];
|
|
16447
|
+
const posixWriteCapabilities = [...writeCapabilities, "createStagedFile", "stagedFileMatches", "removeStagedFile", "renameReplaceAsync", "renameNoReplaceAsync"];
|
|
16421
16448
|
function pinnedWriteCapabilities(params) {
|
|
16422
16449
|
const windows = process.platform === "win32";
|
|
16423
16450
|
const capabilities = windows ? [...writeCapabilities, "fstatIdentity"] : posixWriteCapabilities;
|
package/package.json
CHANGED
|
@@ -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.23.
|
|
26
|
+
"@lousy-agents/mcp": "5.23.1",
|
|
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",
|