@lousy-agents/agent-shell 5.22.1 → 5.22.3

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 +88 -7
  2. package/package.json +3 -3
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
- 402(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
5
+ 317(__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");
@@ -1719,6 +1719,47 @@ function errorCauseOptions(error) {
1719
1719
 
1720
1720
  ;// CONCATENATED MODULE: external "node:os"
1721
1721
  const external_node_os_namespaceObject = __rspack_createRequire_require("node:os");
1722
+ ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/windows-appcontainer.js
1723
+
1724
+
1725
+ /** The native owner caches immutable primary-token membership across Workers. */
1726
+ function isWindowsAppContainer(binding) {
1727
+ if (!binding.isWindowsAppContainer)
1728
+ return undefined;
1729
+ try {
1730
+ const membership = binding.isWindowsAppContainer();
1731
+ if (typeof membership !== "boolean")
1732
+ throw new Error("Invalid AppContainer membership");
1733
+ return membership;
1734
+ }
1735
+ catch (cause) {
1736
+ throw new errors_FsSafeError("permission-unverified", "Windows process token membership could not be verified", { cause });
1737
+ }
1738
+ }
1739
+ function windows_appcontainer_assertWindowsHelperAllowed() {
1740
+ if (process.platform !== "win32")
1741
+ return;
1742
+ const binding = native_getNativeBinding();
1743
+ if (binding && isWindowsAppContainer(binding)) {
1744
+ // Current libuv can hang while creating child-process pipes in a lowbox.
1745
+ throw new errors_FsSafeError("helper-unavailable", "External Windows security helpers are unavailable inside an AppContainer");
1746
+ }
1747
+ }
1748
+ function assertWindowsAclRemediationAllowed() {
1749
+ if (process.platform !== "win32")
1750
+ return;
1751
+ let binding;
1752
+ try {
1753
+ binding = getNativeBinding();
1754
+ }
1755
+ catch {
1756
+ return;
1757
+ } // Command formatting remains available without an addon.
1758
+ if (binding && isWindowsAppContainer(binding)) {
1759
+ throw new FsSafeError("helper-unavailable", "Windows ACL reset commands are unavailable inside an AppContainer");
1760
+ }
1761
+ }
1762
+
1722
1763
  ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/realpath.js
1723
1764
 
1724
1765
 
@@ -1726,9 +1767,41 @@ const external_node_os_namespaceObject = __rspack_createRequire_require("node:os
1726
1767
 
1727
1768
 
1728
1769
 
1770
+
1729
1771
  const runtimePlatform = process.versions.bun ? (0,external_node_os_namespaceObject.platform)() : undefined;
1730
1772
  const bunPosix = runtimePlatform === "darwin" || runtimePlatform === "linux" ? runtimePlatform : undefined;
1731
1773
  function realpath_resolve(input, native) {
1774
+ if (native && process.platform === "win32") {
1775
+ try {
1776
+ return external_node_fs_namespaceObject.realpathSync.native(input);
1777
+ }
1778
+ catch (error) {
1779
+ if (error.code !== "EPERM" || error.syscall !== "realpath")
1780
+ throw error;
1781
+ let binding;
1782
+ try {
1783
+ binding = native_getNativeBinding();
1784
+ }
1785
+ catch {
1786
+ binding = undefined;
1787
+ }
1788
+ if (!binding || !isWindowsAppContainer(binding))
1789
+ throw error;
1790
+ if (!binding?.resolveWindowsCanonicalPath) {
1791
+ throw new errors_FsSafeError("helper-unavailable", "Windows canonicalization after a denied DOS-name query requires the native binding", { cause: error });
1792
+ }
1793
+ let resolved;
1794
+ try {
1795
+ resolved = binding.resolveWindowsCanonicalPath(input);
1796
+ }
1797
+ catch (cause) {
1798
+ throw new errors_FsSafeError("path-mismatch", "Windows canonical path cannot be verified safely", { cause });
1799
+ }
1800
+ if (resolved === null)
1801
+ throw error;
1802
+ return resolved;
1803
+ }
1804
+ }
1732
1805
  if (bunPosix) {
1733
1806
  // Bun 1.4.2 normalizes native path components and opens the leaf for reads.
1734
1807
  // The Rust OS resolver preserves permissions, locks and physical spelling.
@@ -3428,6 +3501,7 @@ function shortPath(value) {
3428
3501
 
3429
3502
 
3430
3503
 
3504
+
3431
3505
  const execFileAsync = (0,external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
3432
3506
  const DEFAULT_PERMISSION_EXEC_TIMEOUT_MS = 30_000;
3433
3507
  function formatPermissionErrorDetail(value) {
@@ -3605,6 +3679,7 @@ function getPermissionCommandFailure(error, command, durationMs) {
3605
3679
  return { command, durationMs: Math.round(durationMs), ...detail };
3606
3680
  }
3607
3681
  async function executePermissionCommand(command, args, timeoutMs = DEFAULT_PERMISSION_EXEC_TIMEOUT_MS) {
3682
+ assertWindowsHelperAllowed();
3608
3683
  const startedAt = performance.now();
3609
3684
  try {
3610
3685
  return (await execFileAsync(command, args, {
@@ -3628,6 +3703,7 @@ async function executePermissionCommand(command, args, timeoutMs = DEFAULT_PERMI
3628
3703
  ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/windows-security-facts.js
3629
3704
 
3630
3705
  const SID_RE = /^s-\d+-\d+(?:-\d+)+$/;
3706
+ const APP_CONTAINER_SID_RE = /^s-1-15-2(?:-\d+){7,}$/;
3631
3707
  const SYSTEM_SID = "s-1-5-18";
3632
3708
  const ADMINISTRATORS_SID = "s-1-5-32-544";
3633
3709
  const WORLD_SIDS = new Set([
@@ -3662,6 +3738,7 @@ function validateAce(value, allowUnknownFlags) {
3662
3738
  function validateDescriptor(value, allowUnknownFlags) {
3663
3739
  if (!record(value) || typeof value.ownerSid !== "string" || !SID_RE.test(value.ownerSid) ||
3664
3740
  typeof value.currentUserSid !== "string" || !SID_RE.test(value.currentUserSid) ||
3741
+ (value.currentAppContainerSid != null && (typeof value.currentAppContainerSid !== "string" || !APP_CONTAINER_SID_RE.test(value.currentAppContainerSid))) ||
3665
3742
  typeof value.daclPresent !== "boolean" || typeof value.isLocal !== "boolean" ||
3666
3743
  typeof value.aceListComplete !== "boolean" || !Array.isArray(value.unsupportedAceTypes) ||
3667
3744
  !value.unsupportedAceTypes.every(uint32) || !Array.isArray(value.aces) ||
@@ -3687,6 +3764,8 @@ function summarize(facts) {
3687
3764
  let groupReadable = false;
3688
3765
  let groupWritable = false;
3689
3766
  const trusted = new Set([facts.currentUserSid, SYSTEM_SID, ADMINISTRATORS_SID]);
3767
+ if (facts.currentAppContainerSid)
3768
+ trusted.add(facts.currentAppContainerSid);
3690
3769
  for (const ace of facts.aces) {
3691
3770
  if (ace.aceType !== "allow" || ace.flags.inheritOnly || trusted.has(ace.sid))
3692
3771
  continue;
@@ -3755,6 +3834,7 @@ function windows_security_helper_explainWindowsSecurityHelperFailure(error) {
3755
3834
 
3756
3835
 
3757
3836
 
3837
+
3758
3838
  const MAX_OUTPUT_BYTES = 1024 * 1024;
3759
3839
  const TERMINATION_GRACE_MS = 1_000;
3760
3840
  const FULL_IDENTITY = /^[0-9a-f]{16}:[0-9a-f]{32}$/;
@@ -3857,6 +3937,7 @@ function explainHelperFailure(error, file) {
3857
3937
  }
3858
3938
  }
3859
3939
  function executeSync(operation, params) {
3940
+ assertWindowsHelperAllowed();
3860
3941
  const { file, args, env } = windows_security_command_command(operation, params);
3861
3942
  const startedAt = performance.now();
3862
3943
  const result = spawnSync(file, args, {
@@ -3929,6 +4010,7 @@ function hasUnsettledWindowsSecurityCommand(error) {
3929
4010
  }
3930
4011
  function ignoreLateError() { }
3931
4012
  async function execute(operation, params, request) {
4013
+ windows_appcontainer_assertWindowsHelperAllowed();
3932
4014
  const selected = request ?? windows_security_command_command(operation, params);
3933
4015
  const { file, args, env, input, timeoutMs = (/* inlined export .DEFAULT_PERMISSION_EXEC_TIMEOUT_MS */30000), maxOutputBytes = MAX_OUTPUT_BYTES } = selected;
3934
4016
  const startedAt = performance.now();
@@ -5355,7 +5437,7 @@ class AtomicFile {
5355
5437
  }
5356
5438
  *readFile(sizeHint) {
5357
5439
  if (typeof this.resource !== "number")
5358
- return yield* atomic_io_wait(this.resource.readFile());
5440
+ return yield* atomic_io_wait(readFileHandleBounded(this.resource, Infinity));
5359
5441
  if (sizeHint === undefined)
5360
5442
  return this.io.syncFs.readFileSync(this.resource);
5361
5443
  const fd = this.resource;
@@ -15751,6 +15833,7 @@ function publishThroughPlaceholder(params, assertCurrent) {
15751
15833
 
15752
15834
 
15753
15835
 
15836
+
15754
15837
 
15755
15838
 
15756
15839
  async function runPinnedStagedWrite(params, parentPath, parentGuard) {
@@ -15869,7 +15952,7 @@ async function runPinnedStagedWrite(params, parentPath, parentGuard) {
15869
15952
  const expectedHash = sha256Hex(params.input.data, params.input.encoding);
15870
15953
  readHandle = await promises_namespaceObject.open(targetPath, read_open_flags_resolveReadOpenFlags());
15871
15954
  const readHandleStat = external_node_fs_namespaceObject.fstatSync(readHandle.fd, { bigint: true });
15872
- const actualHash = sha256Hex(await readHandle.readFile());
15955
+ const actualHash = sha256Hex(await readFileHandleBounded(readHandle, Infinity));
15873
15956
  if (actualHash !== expectedHash) {
15874
15957
  throw new errors_FsSafeError("path-mismatch", "fallback target changed during write");
15875
15958
  }
@@ -16620,9 +16703,7 @@ async function read_opened_file_readOpenedFileSafely(params) {
16620
16703
  if (maxBytes !== undefined && params.opened.stat.size > maxBytes) {
16621
16704
  throw new errors_FsSafeError("too-large", `file exceeds limit of ${maxBytes} bytes (got ${params.opened.stat.size})`);
16622
16705
  }
16623
- const buffer = maxBytes === undefined
16624
- ? await params.opened.handle.readFile()
16625
- : await readFileHandleBoundedWithSize(params.opened.handle, maxBytes, params.opened.stat.size);
16706
+ const buffer = await readFileHandleBoundedWithSize(params.opened.handle, maxBytes ?? Infinity, params.opened.stat.size);
16626
16707
  return {
16627
16708
  buffer,
16628
16709
  containment: params.opened.containment,
@@ -33745,4 +33826,4 @@ if (installedChunkData !== 0) { // 0 means "already installed".'
33745
33826
  // module factories are used so entry inlining is disabled
33746
33827
  // startup
33747
33828
  // Load entry module and return exports
33748
- var __webpack_exports__ = __webpack_require__(402);
33829
+ var __webpack_exports__ = __webpack_require__(317);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lousy-agents/agent-shell",
3
- "version": "5.22.1",
3
+ "version": "5.22.3",
4
4
  "description": "A flight recorder for npm script execution",
5
5
  "type": "module",
6
6
  "repository": {
@@ -37,11 +37,11 @@
37
37
  "typecheck": "tsc --noEmit"
38
38
  },
39
39
  "dependencies": {
40
- "@openclaw/fs-safe": "0.26.3",
40
+ "@openclaw/fs-safe": "0.26.5",
41
41
  "zod": "4.5.2"
42
42
  },
43
43
  "peerDependencies": {
44
- "@github/copilot-sdk": "1.0.20"
44
+ "@github/copilot-sdk": "1.0.21"
45
45
  },
46
46
  "peerDependenciesMeta": {
47
47
  "@github/copilot-sdk": {