@lousy-agents/agent-shell 5.22.14 → 5.22.15

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 +42 -31
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1587,7 +1587,11 @@ function safeRealpathSync(targetPath, cache) {
1587
1587
  return cached;
1588
1588
  }
1589
1589
  try {
1590
- const resolved = realpathSync(pathForWindowsFilesystem(targetPath));
1590
+ const ordinary = realpathSync(pathForWindowsFilesystem(targetPath));
1591
+ // Ordinary resolution keeps the caller's letter case. Its result has no symlinks or
1592
+ // dot segments left, so native resolution on POSIX only adopts the on-disk spelling
1593
+ // that root admission compares against. Windows root admission reconciles aliases.
1594
+ const resolved = process.platform === "win32" ? ordinary : realpathSync.native(ordinary);
1591
1595
  cache?.set(targetPath, resolved);
1592
1596
  cache?.set(resolved, resolved);
1593
1597
  return resolved;
@@ -3814,6 +3818,7 @@ function validateDescriptor(value, allowUnknownFlags) {
3814
3818
  typeof value.currentUserSid !== "string" || !SID_RE.test(value.currentUserSid) ||
3815
3819
  (value.currentAppContainerSid != null && (typeof value.currentAppContainerSid !== "string" || !APP_CONTAINER_SID_RE.test(value.currentAppContainerSid))) ||
3816
3820
  typeof value.daclPresent !== "boolean" || typeof value.isLocal !== "boolean" ||
3821
+ (value.isVolumeRoot !== undefined && typeof value.isVolumeRoot !== "boolean") ||
3817
3822
  typeof value.aceListComplete !== "boolean" || !Array.isArray(value.unsupportedAceTypes) ||
3818
3823
  !value.unsupportedAceTypes.every(uint32) || !Array.isArray(value.aces) ||
3819
3824
  !value.aces.every(ace => validateAce(ace, allowUnknownFlags))) {
@@ -12212,9 +12217,14 @@ const onCopySourceAdmission = Symbol("onCopySourceAdmission");
12212
12217
 
12213
12218
  ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/file-sync.js
12214
12219
 
12220
+ function syncFile(handle) {
12221
+ return typeof handle === "number"
12222
+ ? new Promise((resolve, reject) => external_node_fs_namespaceObject.fsync(handle, error => error ? reject(error) : resolve()))
12223
+ : handle.sync();
12224
+ }
12215
12225
  async function syncFileBestEffort(handle) {
12216
12226
  try {
12217
- await handle.sync();
12227
+ await syncFile(handle);
12218
12228
  }
12219
12229
  catch (error) {
12220
12230
  if (error?.code !== "EPERM")
@@ -12920,6 +12930,7 @@ class NativeStagedFile {
12920
12930
  #verifyMode;
12921
12931
  #state = { status: "open", publication: NOT_PUBLISHED };
12922
12932
  #receipt;
12933
+ #publicationFlush;
12923
12934
  #rejectFinalSymlink = false;
12924
12935
  #unsupportedNoReplace;
12925
12936
  #fallbackCleanup;
@@ -12956,8 +12967,7 @@ class NativeStagedFile {
12956
12967
  const env_1 = { stack: [], error: void 0, hasError: false };
12957
12968
  try {
12958
12969
  const exclusive = params.overwrite === false && params.input.kind === "buffer" && params.input.stageBeforePublish === false;
12959
- // This owner never escapes. Only the internal verifier borrows its fd;
12960
- // public descriptor methods remain await-free and cannot race disposal.
12970
+ // This owner never escapes; only the internal verifier borrows its fd.
12961
12971
  const staged = native_staged_file_addDisposableResource(env_1, await NativeStagedFile.create({
12962
12972
  binding, parentFd, closeParentFd, directory, mode: params.mode, sync: params.sync,
12963
12973
  // Public staging uses portable names; existing POSIX writes accept literal names.
@@ -12976,9 +12986,10 @@ class NativeStagedFile {
12976
12986
  }
12977
12987
  let published;
12978
12988
  try {
12979
- published = exclusive
12989
+ const publication = exclusive
12980
12990
  ? staged.#completePublication(params.basename, false, params.onPublished)
12981
- : await staged.publish(params.basename, { overwrite: params.overwrite !== false }, params.onPublished);
12991
+ : staged.publish(params.basename, { overwrite: params.overwrite !== false }, params.onPublished);
12992
+ published = publication instanceof Promise ? await publication : publication;
12982
12993
  }
12983
12994
  catch (error) {
12984
12995
  if (!staged.#unsupportedNoReplace || isFsSafeNativeRequired() ||
@@ -13141,29 +13152,21 @@ class NativeStagedFile {
13141
13152
  restoreCopyMetadata(fd, input.metadata);
13142
13153
  if (this.#verifyMode)
13143
13154
  this.#assertStagePermissions(fd);
13144
- if (this.#owner.sync !== false) {
13145
- if (this.#owner.strictFileSync)
13146
- external_node_fs_namespaceObject.fsyncSync(fd);
13147
- else
13148
- syncFileBestEffortSync(fd);
13149
- }
13155
+ if (this.#owner.sync !== false)
13156
+ await (this.#owner.strictFileSync ? syncFile(fd) : syncFileBestEffort(fd));
13150
13157
  const stat = external_node_fs_namespaceObject.fstatSync(fd, { bigint: true });
13151
13158
  this.#receipt = createStagedFileReceipt(this.#owner.directory, this.#owner.name, stat);
13152
13159
  this.#assertCurrent();
13153
13160
  }
13154
13161
  catch (error) {
13155
13162
  const { receipt: cleanup, error: cleanupError } = this.#finalize();
13156
- if (cleanupError) {
13157
- throw stagedFailure("file", new AggregateError([error, cleanupError], "preparation and cleanup failed"), { phase: "prepare", publication: cleanup.publication, cleanup });
13158
- }
13159
- if (cleanup.status === "preserved") {
13160
- throw stagedFailure("file", error, { phase: "prepare", publication: cleanup.publication, cleanup });
13163
+ if (cleanupError || cleanup.status === "preserved") {
13164
+ throw stagedFailure("file", cleanupError
13165
+ ? new AggregateError([error, cleanupError], "preparation and cleanup failed") : error, { phase: "prepare", publication: cleanup.publication, cleanup });
13161
13166
  }
13162
13167
  throw error;
13163
13168
  }
13164
13169
  }
13165
- // Keep public descriptor work await-free: each call completes its mutations
13166
- // before the next invocation, including closure and cached cleanup failures.
13167
13170
  async assertCurrent() {
13168
13171
  this.#assertCurrent();
13169
13172
  }
@@ -13208,7 +13211,8 @@ class NativeStagedFile {
13208
13211
  }
13209
13212
  throw error;
13210
13213
  }
13211
- return this.#completePublication(basename, overwrite, onPublished);
13214
+ const publication = this.#completePublication(basename, overwrite, onPublished);
13215
+ return publication instanceof Promise ? await publication : publication;
13212
13216
  }
13213
13217
  catch (error) {
13214
13218
  if (isMutationAuthorityError(error))
@@ -13234,17 +13238,21 @@ class NativeStagedFile {
13234
13238
  external_node_fs_namespaceObject.fchmodSync(fd, this.#owner.mode);
13235
13239
  // Content was synced during preparation. A lost chmod leaves 0600, no wider
13236
13240
  // than modes retaining owner rw; restrictive modes still need a durable correction.
13237
- if (this.#owner.sync !== false && ((this.#owner.mode & 0o600) !== 0o600 || (stagedMode & ~this.#owner.mode) !== 0)) {
13238
- if (this.#owner.strictFileSync)
13239
- external_node_fs_namespaceObject.fsyncSync(fd);
13240
- else
13241
- syncFileBestEffortSync(fd);
13242
- }
13243
- if (this.#owner.sync !== false)
13244
- syncFileBestEffortSync(this.#owner.parentFd);
13245
- this.#assertNamed(basename, this.#owner.mode);
13246
- this.#assertDirectory();
13247
- return receipt;
13241
+ const verify = () => {
13242
+ this.#assertNamed(basename, this.#owner.mode);
13243
+ this.#assertDirectory();
13244
+ return receipt;
13245
+ };
13246
+ if (this.#owner.sync === false)
13247
+ return verify();
13248
+ this.#publicationFlush = Promise.resolve().then(async () => {
13249
+ if ((this.#owner.mode & 0o600) !== 0o600 || (stagedMode & ~this.#owner.mode) !== 0) {
13250
+ await (this.#owner.strictFileSync ? syncFile(fd) : syncFileBestEffort(fd));
13251
+ }
13252
+ await syncFileBestEffort(this.#owner.parentFd);
13253
+ return verify();
13254
+ }).finally(() => { this.#publicationFlush = undefined; });
13255
+ return this.#publicationFlush;
13248
13256
  }
13249
13257
  #finalize() {
13250
13258
  if (this.#state.status === "closed") {
@@ -13299,6 +13307,9 @@ class NativeStagedFile {
13299
13307
  return this.#state;
13300
13308
  }
13301
13309
  async cleanup() {
13310
+ // Native descriptors cannot close or be recycled while libuv is synchronizing them.
13311
+ if (this.#publicationFlush)
13312
+ await this.#publicationFlush.catch(() => { });
13302
13313
  const closed = this.#finalize();
13303
13314
  if (closed.error) {
13304
13315
  throw closed.error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lousy-agents/agent-shell",
3
- "version": "5.22.14",
3
+ "version": "5.22.15",
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.10",
40
+ "@openclaw/fs-safe": "0.26.12",
41
41
  "zod": "4.6.6"
42
42
  },
43
43
  "peerDependencies": {