@lousy-agents/agent-shell 5.22.15 → 5.22.17

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.
Files changed (2) hide show
  1. package/dist/index.js +80 -13
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __rspack_createRequire } from "node:module";
3
3
  const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
4
4
  var __webpack_modules__ = ({
5
- 433(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
5
+ 617(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
6
6
 
7
7
  ;// CONCATENATED MODULE: external "node:child_process"
8
8
  const external_node_child_process_namespaceObject = __rspack_createRequire_require("node:child_process");
@@ -15796,8 +15796,8 @@ function pinnedWriteModeAssertion(fd, mode, assertBeforeMutation, privateCreatio
15796
15796
 
15797
15797
 
15798
15798
  // Node has no portable no-replace rename. Publish the completed stage by link,
15799
- // then remove its verified temporary name without yielding.
15800
- function publishCopyStage(params) {
15799
+ // then remove its verified temporary name after any descriptor handoff.
15800
+ async function publishCopyStage(params) {
15801
15801
  const { identity, temporaryPath, targetPath } = params;
15802
15802
  const assertCurrent = () => {
15803
15803
  directory_guard_assertSyncDirectoryGuard(params.parentGuard);
@@ -15851,13 +15851,23 @@ function publishCopyStage(params) {
15851
15851
  }
15852
15852
  }
15853
15853
  else {
15854
- const parent = external_node_fs_namespaceObject.lstatSync(external_node_path_namespaceObject.dirname(temporaryPath), { bigint: true });
15855
- const current = external_node_fs_namespaceObject.lstatSync(temporaryPath, { bigint: true });
15856
- if (parent.isSymbolicLink() || !parent.isDirectory() ||
15857
- !file_identity_sameFileIdentityForCleanup(parent, params.parentGuard.stat) ||
15858
- current.isSymbolicLink() || !current.isFile() ||
15859
- !file_identity_sameFileIdentityForCleanup(current, identity)) {
15860
- throw new errors_FsSafeError("path-mismatch", "published copy temporary name changed before cleanup");
15854
+ const verifyPair = () => {
15855
+ directory_guard_assertSyncDirectoryGuard(params.parentGuard);
15856
+ const parent = external_node_fs_namespaceObject.lstatSync(external_node_path_namespaceObject.dirname(temporaryPath), { bigint: true });
15857
+ const current = external_node_fs_namespaceObject.lstatSync(temporaryPath, { bigint: true });
15858
+ const target = external_node_fs_namespaceObject.lstatSync(targetPath, { bigint: true });
15859
+ if (parent.isSymbolicLink() || !parent.isDirectory() ||
15860
+ !file_identity_sameFileIdentityForCleanup(parent, params.parentGuard.stat) ||
15861
+ current.isSymbolicLink() || !current.isFile() || current.nlink !== 2n ||
15862
+ target.isSymbolicLink() || !target.isFile() || target.nlink !== 2n ||
15863
+ !file_identity_sameFileIdentityForCleanup(current, identity) || !file_identity_sameFileIdentityForCleanup(target, identity)) {
15864
+ throw new errors_FsSafeError("path-mismatch", "published copy temporary name changed before cleanup");
15865
+ }
15866
+ };
15867
+ verifyPair();
15868
+ if (params.beforeTemporaryUnlink) {
15869
+ await params.beforeTemporaryUnlink();
15870
+ verifyPair();
15861
15871
  }
15862
15872
  // This removes the stage's name, never the published destination or source.
15863
15873
  external_node_fs_namespaceObject.unlinkSync(temporaryPath);
@@ -15930,6 +15940,40 @@ function publishThroughPlaceholder(params, assertCurrent) {
15930
15940
  }
15931
15941
  }
15932
15942
 
15943
+ ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/publication-handle.js
15944
+
15945
+
15946
+
15947
+
15948
+
15949
+
15950
+ /** Pin the published name before releasing a descriptor opened through its stage. */
15951
+ async function openPublicationHandle(targetPath, identity) {
15952
+ const flags = read_open_flags_resolveReadOpenFlags();
15953
+ const handle = await promises_namespaceObject.open(targetPath, flags).catch(async (error) => {
15954
+ // Restrictive final modes must not be widened just to inspect publication.
15955
+ if (!hasErrorCode(error, "EACCES") || (process.arch !== "x64" && process.arch !== "arm64"))
15956
+ throw error;
15957
+ const metadataFlag = process.platform === "linux" ? 0x200000 : undefined; // O_PATH
15958
+ if (metadataFlag === undefined)
15959
+ throw error;
15960
+ return promises_namespaceObject.open(targetPath, metadataFlag | external_node_fs_namespaceObject.constants.O_NOFOLLOW);
15961
+ });
15962
+ try {
15963
+ const opened = external_node_fs_namespaceObject.fstatSync(handle.fd, { bigint: true });
15964
+ const named = external_node_fs_namespaceObject.lstatSync(targetPath, { bigint: true });
15965
+ if (!opened.isFile() || !named.isFile() || named.isSymbolicLink() ||
15966
+ !file_identity_sameFileIdentityForCleanup(opened, identity) || !file_identity_sameFileIdentityForCleanup(named, identity)) {
15967
+ throw new errors_FsSafeError("path-mismatch", "publication descriptor handoff identity changed");
15968
+ }
15969
+ return handle;
15970
+ }
15971
+ catch (error) {
15972
+ await handle.close().catch(() => undefined);
15973
+ throw error;
15974
+ }
15975
+ }
15976
+
15933
15977
  ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/pinned-write-staged.js
15934
15978
 
15935
15979
 
@@ -15951,6 +15995,7 @@ function publishThroughPlaceholder(params, assertCurrent) {
15951
15995
 
15952
15996
 
15953
15997
 
15998
+
15954
15999
 
15955
16000
 
15956
16001
  async function runPinnedStagedWrite(params, parentPath, parentGuard) {
@@ -15968,6 +16013,7 @@ async function runPinnedStagedWrite(params, parentPath, parentGuard) {
15968
16013
  let handle;
15969
16014
  let tempIdentity;
15970
16015
  let readHandle;
16016
+ let handoffCloseFailure;
15971
16017
  let renamed = false;
15972
16018
  const completeCreate = params.overwrite === false && params.input.kind !== "file" && params.input.stageBeforePublish === true;
15973
16019
  let receipt;
@@ -16022,11 +16068,15 @@ async function runPinnedStagedWrite(params, parentPath, parentGuard) {
16022
16068
  }), external_node_path_namespaceObject.basename(tempPath), external_node_fs_namespaceObject.fstatSync(handle.fd, { bigint: true }));
16023
16069
  }
16024
16070
  let verifiedIdentity = expectedTempStat;
16071
+ // Keep unreadable modes supported where Node has no read-free file open.
16072
+ const canHandoff = process.platform !== "win32" &&
16073
+ ((params.mode & 0o400) !== 0 ||
16074
+ (process.platform === "linux" && (process.arch === "x64" || process.arch === "arm64")));
16025
16075
  phase = "publish";
16026
16076
  await withAsyncDirectoryGuards([parentGuard], async () => {
16027
16077
  assertFinalSymlinkRejected(targetPath, params.rejectFinalSymlink);
16028
16078
  if (params.overwrite === false) {
16029
- publishCopyStage({
16079
+ await publishCopyStage({
16030
16080
  temporaryPath: tempPath, targetPath, fd: handle.fd,
16031
16081
  identity: tempIdentity, parentGuard,
16032
16082
  assertBeforeMutation,
@@ -16040,6 +16090,18 @@ async function runPinnedStagedWrite(params, parentPath, parentGuard) {
16040
16090
  publication = Object.freeze({ status: "published", staged: receipt, basename: params.basename, overwrite: false });
16041
16091
  params.onPublished?.(identity);
16042
16092
  },
16093
+ beforeTemporaryUnlink: !canHandoff ? undefined : async () => {
16094
+ readHandle = await openPublicationHandle(targetPath, expectedTempStat);
16095
+ // Keep the destination pinned while closing the stage's NFS dentry.
16096
+ const stagedHandle = handle;
16097
+ handle = undefined;
16098
+ try {
16099
+ await stagedHandle.close();
16100
+ }
16101
+ catch (error) {
16102
+ handoffCloseFailure = { error };
16103
+ }
16104
+ },
16043
16105
  });
16044
16106
  }
16045
16107
  else {
@@ -16067,6 +16129,7 @@ async function runPinnedStagedWrite(params, parentPath, parentGuard) {
16067
16129
  throw new errors_FsSafeError("path-mismatch", "fallback target changed during write");
16068
16130
  }
16069
16131
  const expectedHash = sha256Hex(params.input.data, params.input.encoding);
16132
+ await readHandle?.close();
16070
16133
  readHandle = await promises_namespaceObject.open(targetPath, read_open_flags_resolveReadOpenFlags());
16071
16134
  const readHandleStat = external_node_fs_namespaceObject.fstatSync(readHandle.fd, { bigint: true });
16072
16135
  const actualHash = sha256Hex(await readFileHandleBounded(readHandle, Infinity));
@@ -16105,7 +16168,11 @@ async function runPinnedStagedWrite(params, parentPath, parentGuard) {
16105
16168
  pathname: tempPath, handle, identity: tempIdentity, parentGuard, throwOnCleanupError: true,
16106
16169
  }) : "not-needed";
16107
16170
  },
16108
- close: [async () => { await readHandle?.close(); }, async () => { await handle?.close(); }],
16171
+ close: [async () => { await readHandle?.close(); }, async () => {
16172
+ await handle?.close();
16173
+ if (handoffCloseFailure)
16174
+ throw handoffCloseFailure.error;
16175
+ }],
16109
16176
  });
16110
16177
  }
16111
16178
  else
@@ -34463,4 +34530,4 @@ if (installedChunkData !== 0) { // 0 means "already installed".'
34463
34530
  // module factories are used so entry inlining is disabled
34464
34531
  // startup
34465
34532
  // Load entry module and return exports
34466
- var __webpack_exports__ = __webpack_require__(433);
34533
+ var __webpack_exports__ = __webpack_require__(617);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lousy-agents/agent-shell",
3
- "version": "5.22.15",
3
+ "version": "5.22.17",
4
4
  "description": "A flight recorder for npm script execution",
5
5
  "type": "module",
6
6
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "typecheck": "tsc --noEmit"
38
38
  },
39
39
  "dependencies": {
40
- "@openclaw/fs-safe": "0.26.12",
40
+ "@openclaw/fs-safe": "0.26.13",
41
41
  "zod": "4.6.6"
42
42
  },
43
43
  "peerDependencies": {