poe-code 14.0.21 → 14.0.22

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 (155) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/metafile.json +1 -1
  4. package/package.json +1 -1
  5. package/packages/safe-bash/dist/browser.d.ts +5 -0
  6. package/packages/safe-bash/dist/browser.d.ts.map +1 -1
  7. package/packages/safe-bash/dist/browser.js +873 -122
  8. package/packages/safe-bash/dist/browser.js.map +4 -4
  9. package/packages/safe-bash/dist/commands/apply-patch/shared.js +2 -2
  10. package/packages/safe-bash/dist/commands/apply-patch/shared.js.map +1 -1
  11. package/packages/safe-bash/dist/commands/archive/internal.d.ts.map +1 -1
  12. package/packages/safe-bash/dist/commands/archive/internal.js +3 -2
  13. package/packages/safe-bash/dist/commands/archive/internal.js.map +1 -1
  14. package/packages/safe-bash/dist/commands/bytes/checksums/index.d.ts.map +1 -1
  15. package/packages/safe-bash/dist/commands/bytes/checksums/index.js +3 -2
  16. package/packages/safe-bash/dist/commands/bytes/checksums/index.js.map +1 -1
  17. package/packages/safe-bash/dist/commands/bytes/compression/gunzip.js +2 -2
  18. package/packages/safe-bash/dist/commands/bytes/compression/gunzip.js.map +1 -1
  19. package/packages/safe-bash/dist/commands/bytes/compression/stream.js +2 -2
  20. package/packages/safe-bash/dist/commands/bytes/compression/stream.js.map +1 -1
  21. package/packages/safe-bash/dist/commands/bytes/encoding/shared.js +3 -3
  22. package/packages/safe-bash/dist/commands/bytes/encoding/shared.js.map +1 -1
  23. package/packages/safe-bash/dist/commands/column/internal.d.ts.map +1 -1
  24. package/packages/safe-bash/dist/commands/column/internal.js +2 -1
  25. package/packages/safe-bash/dist/commands/column/internal.js.map +1 -1
  26. package/packages/safe-bash/dist/commands/diff-patch/shared.js +2 -2
  27. package/packages/safe-bash/dist/commands/diff-patch/shared.js.map +1 -1
  28. package/packages/safe-bash/dist/commands/du/budget.d.ts.map +1 -1
  29. package/packages/safe-bash/dist/commands/du/budget.js +3 -2
  30. package/packages/safe-bash/dist/commands/du/budget.js.map +1 -1
  31. package/packages/safe-bash/dist/commands/env-split.d.ts.map +1 -1
  32. package/packages/safe-bash/dist/commands/env-split.js +2 -1
  33. package/packages/safe-bash/dist/commands/env-split.js.map +1 -1
  34. package/packages/safe-bash/dist/commands/expr/internal.d.ts.map +1 -1
  35. package/packages/safe-bash/dist/commands/expr/internal.js +2 -1
  36. package/packages/safe-bash/dist/commands/expr/internal.js.map +1 -1
  37. package/packages/safe-bash/dist/commands/file/shared.d.ts.map +1 -1
  38. package/packages/safe-bash/dist/commands/file/shared.js +3 -2
  39. package/packages/safe-bash/dist/commands/file/shared.js.map +1 -1
  40. package/packages/safe-bash/dist/commands/find.d.ts.map +1 -1
  41. package/packages/safe-bash/dist/commands/find.js +12 -31
  42. package/packages/safe-bash/dist/commands/find.js.map +1 -1
  43. package/packages/safe-bash/dist/commands/html-to-markdown/budget.js +2 -2
  44. package/packages/safe-bash/dist/commands/html-to-markdown/budget.js.map +1 -1
  45. package/packages/safe-bash/dist/commands/metadata/internal.d.ts.map +1 -1
  46. package/packages/safe-bash/dist/commands/metadata/internal.js +2 -1
  47. package/packages/safe-bash/dist/commands/metadata/internal.js.map +1 -1
  48. package/packages/safe-bash/dist/commands/move.d.ts.map +1 -1
  49. package/packages/safe-bash/dist/commands/move.js +2 -1
  50. package/packages/safe-bash/dist/commands/move.js.map +1 -1
  51. package/packages/safe-bash/dist/commands/network/authorizer.d.ts +7 -0
  52. package/packages/safe-bash/dist/commands/network/authorizer.d.ts.map +1 -0
  53. package/packages/safe-bash/dist/commands/network/authorizer.js +48 -0
  54. package/packages/safe-bash/dist/commands/network/authorizer.js.map +1 -0
  55. package/packages/safe-bash/dist/commands/network/body.js +2 -2
  56. package/packages/safe-bash/dist/commands/network/body.js.map +1 -1
  57. package/packages/safe-bash/dist/commands/network/curl.js +2 -2
  58. package/packages/safe-bash/dist/commands/network/curl.js.map +1 -1
  59. package/packages/safe-bash/dist/commands/network/fetch-transport.d.ts +6 -0
  60. package/packages/safe-bash/dist/commands/network/fetch-transport.d.ts.map +1 -0
  61. package/packages/safe-bash/dist/commands/network/fetch-transport.js +80 -0
  62. package/packages/safe-bash/dist/commands/network/fetch-transport.js.map +1 -0
  63. package/packages/safe-bash/dist/commands/network/index.d.ts +2 -0
  64. package/packages/safe-bash/dist/commands/network/index.d.ts.map +1 -1
  65. package/packages/safe-bash/dist/commands/network/index.js +2 -0
  66. package/packages/safe-bash/dist/commands/network/index.js.map +1 -1
  67. package/packages/safe-bash/dist/commands/network/types.d.ts +1 -0
  68. package/packages/safe-bash/dist/commands/network/types.d.ts.map +1 -1
  69. package/packages/safe-bash/dist/commands/network/types.js +10 -0
  70. package/packages/safe-bash/dist/commands/network/types.js.map +1 -1
  71. package/packages/safe-bash/dist/commands/regex-execution/ere/limits.js +2 -2
  72. package/packages/safe-bash/dist/commands/regex-execution/ere/limits.js.map +1 -1
  73. package/packages/safe-bash/dist/commands/safejs/io.js +2 -2
  74. package/packages/safe-bash/dist/commands/safejs/io.js.map +1 -1
  75. package/packages/safe-bash/dist/commands/search/shared.js +2 -2
  76. package/packages/safe-bash/dist/commands/search/shared.js.map +1 -1
  77. package/packages/safe-bash/dist/commands/split/io.js +2 -2
  78. package/packages/safe-bash/dist/commands/split/io.js.map +1 -1
  79. package/packages/safe-bash/dist/commands/stream-format/shared.d.ts.map +1 -1
  80. package/packages/safe-bash/dist/commands/stream-format/shared.js +2 -1
  81. package/packages/safe-bash/dist/commands/stream-format/shared.js.map +1 -1
  82. package/packages/safe-bash/dist/commands/stream-inspection/shared.d.ts.map +1 -1
  83. package/packages/safe-bash/dist/commands/stream-inspection/shared.js +2 -1
  84. package/packages/safe-bash/dist/commands/stream-inspection/shared.js.map +1 -1
  85. package/packages/safe-bash/dist/commands/structured/limits.js +2 -2
  86. package/packages/safe-bash/dist/commands/structured/limits.js.map +1 -1
  87. package/packages/safe-bash/dist/commands/table-text/internal.d.ts.map +1 -1
  88. package/packages/safe-bash/dist/commands/table-text/internal.js +2 -1
  89. package/packages/safe-bash/dist/commands/table-text/internal.js.map +1 -1
  90. package/packages/safe-bash/dist/commands/text-programs/shared.js +2 -2
  91. package/packages/safe-bash/dist/commands/text-programs/shared.js.map +1 -1
  92. package/packages/safe-bash/dist/commands/tree/io.js +2 -2
  93. package/packages/safe-bash/dist/commands/tree/io.js.map +1 -1
  94. package/packages/safe-bash/dist/contracts/yield.d.ts +13 -0
  95. package/packages/safe-bash/dist/contracts/yield.d.ts.map +1 -0
  96. package/packages/safe-bash/dist/contracts/yield.js +41 -0
  97. package/packages/safe-bash/dist/contracts/yield.js.map +1 -0
  98. package/packages/safe-bash/dist/shell/arithmetic.js +1 -1
  99. package/packages/safe-bash/dist/shell/arithmetic.js.map +1 -1
  100. package/packages/safe-bash/dist/shell/arrays/ledger.d.ts.map +1 -1
  101. package/packages/safe-bash/dist/shell/arrays/ledger.js +2 -9
  102. package/packages/safe-bash/dist/shell/arrays/ledger.js.map +1 -1
  103. package/packages/safe-bash/dist/shell/conditional.d.ts.map +1 -1
  104. package/packages/safe-bash/dist/shell/conditional.js +2 -1
  105. package/packages/safe-bash/dist/shell/conditional.js.map +1 -1
  106. package/packages/safe-bash/dist/shell/env-warning.d.ts +2 -0
  107. package/packages/safe-bash/dist/shell/env-warning.d.ts.map +1 -0
  108. package/packages/safe-bash/dist/shell/env-warning.js +12 -0
  109. package/packages/safe-bash/dist/shell/env-warning.js.map +1 -0
  110. package/packages/safe-bash/dist/shell/index.d.ts +1 -0
  111. package/packages/safe-bash/dist/shell/index.d.ts.map +1 -1
  112. package/packages/safe-bash/dist/shell/index.js +1 -0
  113. package/packages/safe-bash/dist/shell/index.js.map +1 -1
  114. package/packages/safe-bash/dist/shell/input.d.ts.map +1 -1
  115. package/packages/safe-bash/dist/shell/input.js +4 -3
  116. package/packages/safe-bash/dist/shell/input.js.map +1 -1
  117. package/packages/safe-bash/dist/shell/parser.d.ts.map +1 -1
  118. package/packages/safe-bash/dist/shell/parser.js +15 -1
  119. package/packages/safe-bash/dist/shell/parser.js.map +1 -1
  120. package/packages/safe-bash/dist/shell/pattern.d.ts.map +1 -1
  121. package/packages/safe-bash/dist/shell/pattern.js +3 -2
  122. package/packages/safe-bash/dist/shell/pattern.js.map +1 -1
  123. package/packages/safe-bash/dist/shell/runtime.d.ts +3 -2
  124. package/packages/safe-bash/dist/shell/runtime.d.ts.map +1 -1
  125. package/packages/safe-bash/dist/shell/runtime.js +57 -55
  126. package/packages/safe-bash/dist/shell/runtime.js.map +1 -1
  127. package/packages/safe-bash/dist/shell/shell.d.ts.map +1 -1
  128. package/packages/safe-bash/dist/shell/shell.js +4 -1
  129. package/packages/safe-bash/dist/shell/shell.js.map +1 -1
  130. package/packages/safe-bash/dist/shell/types.d.ts +2 -0
  131. package/packages/safe-bash/dist/shell/types.d.ts.map +1 -1
  132. package/packages/safe-bash/dist/shell/types.js.map +1 -1
  133. package/packages/safe-bash/dist/shell/worker-limits.d.ts +3 -0
  134. package/packages/safe-bash/dist/shell/worker-limits.d.ts.map +1 -0
  135. package/packages/safe-bash/dist/shell/worker-limits.js +14 -0
  136. package/packages/safe-bash/dist/shell/worker-limits.js.map +1 -0
  137. package/packages/safe-fs/dist/core.d.ts +1 -0
  138. package/packages/safe-fs/dist/fs/quota/index.d.ts +9 -0
  139. package/packages/safe-fs/dist/index.d.ts +1 -0
  140. package/packages/safe-js/dist/browser/chunks/{chunk-QGN6DKT5.js → chunk-ET2GNCA5.js} +106 -1
  141. package/packages/safe-js/dist/browser/chunks/{chunk-QGN6DKT5.js.map → chunk-ET2GNCA5.js.map} +3 -3
  142. package/packages/safe-js/dist/browser/safe-fs-core.js +7 -3
  143. package/packages/safe-js/dist/browser/safe-fs.js +7 -3
  144. package/packages/safe-js/dist/chunks/{chunk-5XRQ3GNN.js → chunk-BUNDGMBF.js} +3 -3
  145. package/packages/safe-js/dist/chunks/{chunk-2QRYPKQQ.js → chunk-FEOGVSSU.js} +106 -1
  146. package/packages/safe-js/dist/chunks/{chunk-2QRYPKQQ.js.map → chunk-FEOGVSSU.js.map} +3 -3
  147. package/packages/safe-js/dist/chunks/{chunk-7M2SJPSZ.js → chunk-WFXKOHDU.js} +2 -2
  148. package/packages/safe-js/dist/cli.js +3 -3
  149. package/packages/safe-js/dist/index.js +3 -3
  150. package/packages/safe-js/dist/safe-fs-core.js +7 -3
  151. package/packages/safe-js/dist/safe-fs-core.js.map +1 -1
  152. package/packages/safe-js/dist/safe-fs-node.js +8 -4
  153. package/packages/safe-js/dist/safe-fs.js +8 -4
  154. /package/packages/safe-js/dist/chunks/{chunk-5XRQ3GNN.js.map → chunk-BUNDGMBF.js.map} +0 -0
  155. /package/packages/safe-js/dist/chunks/{chunk-7M2SJPSZ.js.map → chunk-WFXKOHDU.js.map} +0 -0
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  ACCESS_MODES,
3
+ FileSystemQuotaError,
3
4
  FsError,
4
5
  MemoryFileSystem,
5
6
  MountFileSystem,
@@ -29,10 +30,12 @@ import {
29
30
  resolvePath,
30
31
  toByteSource,
31
32
  toFsError,
32
- validatePath
33
- } from "./chunks/chunk-QGN6DKT5.js";
33
+ validatePath,
34
+ withFileSystemQuota
35
+ } from "./chunks/chunk-ET2GNCA5.js";
34
36
  export {
35
37
  ACCESS_MODES,
38
+ FileSystemQuotaError,
36
39
  FsError,
37
40
  MemoryFileSystem,
38
41
  MountFileSystem,
@@ -62,6 +65,7 @@ export {
62
65
  resolvePath,
63
66
  toByteSource,
64
67
  toFsError,
65
- validatePath
68
+ validatePath,
69
+ withFileSystemQuota
66
70
  };
67
71
  //# sourceMappingURL=safe-fs-core.js.map
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  ACCESS_MODES,
3
+ FileSystemQuotaError,
3
4
  FsError,
4
5
  MemoryFileSystem,
5
6
  MountFileSystem,
@@ -29,10 +30,12 @@ import {
29
30
  resolvePath,
30
31
  toByteSource,
31
32
  toFsError,
32
- validatePath
33
- } from "./chunks/chunk-QGN6DKT5.js";
33
+ validatePath,
34
+ withFileSystemQuota
35
+ } from "./chunks/chunk-ET2GNCA5.js";
34
36
  export {
35
37
  ACCESS_MODES,
38
+ FileSystemQuotaError,
36
39
  FsError,
37
40
  MemoryFileSystem,
38
41
  MountFileSystem,
@@ -62,6 +65,7 @@ export {
62
65
  resolvePath,
63
66
  toByteSource,
64
67
  toFsError,
65
- validatePath
68
+ validatePath,
69
+ withFileSystemQuota
66
70
  };
67
71
  //# sourceMappingURL=safe-fs.js.map
@@ -34,11 +34,11 @@ import {
34
34
  createNodeFsBridge,
35
35
  readConfigRecord,
36
36
  validateFileSystemConfig
37
- } from "./chunk-7M2SJPSZ.js";
37
+ } from "./chunk-WFXKOHDU.js";
38
38
  import {
39
39
  FsError,
40
40
  isPathWithin
41
- } from "./chunk-2QRYPKQQ.js";
41
+ } from "./chunk-FEOGVSSU.js";
42
42
 
43
43
  // packages/safe-js/src/migrate.ts
44
44
  import { createHash } from "node:crypto";
@@ -8245,4 +8245,4 @@ export {
8245
8245
  parseMcpConfig,
8246
8246
  makeMcpModule
8247
8247
  };
8248
- //# sourceMappingURL=chunk-5XRQ3GNN.js.map
8248
+ //# sourceMappingURL=chunk-BUNDGMBF.js.map
@@ -3688,6 +3688,109 @@ function createOverlayFileSystem(options) {
3688
3688
  return new OverlayFileSystem(options);
3689
3689
  }
3690
3690
 
3691
+ // packages/safe-fs/src/fs/quota/index.ts
3692
+ var FileSystemQuotaError = class extends Error {
3693
+ constructor(maxBytes) {
3694
+ super(`Filesystem quota exceeded (${maxBytes} bytes)`);
3695
+ this.maxBytes = maxBytes;
3696
+ this.name = "FileSystemQuotaError";
3697
+ }
3698
+ maxBytes;
3699
+ };
3700
+ async function usedBytes(fs, options) {
3701
+ let total = 0;
3702
+ const pending = ["/"];
3703
+ while (pending.length) {
3704
+ const directory = pending.pop();
3705
+ for (const entry of await fs.readdir(directory, options)) {
3706
+ const path = `${directory === "/" ? "" : directory}/${entry.name}`;
3707
+ if (entry.type === "directory") pending.push(path);
3708
+ else total += (await fs.lstat(path, options)).size;
3709
+ }
3710
+ }
3711
+ return total;
3712
+ }
3713
+ async function existingBytes(fs, path, options) {
3714
+ try {
3715
+ const stat = await fs.lstat(path, options);
3716
+ return stat.type === "directory" ? 0 : stat.size;
3717
+ } catch (error) {
3718
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") return 0;
3719
+ throw error;
3720
+ }
3721
+ }
3722
+ function withFileSystemQuota(fs, options) {
3723
+ if (!Number.isSafeInteger(options.maxBytes) || options.maxBytes < 0) throw new RangeError("maxBytes must be a nonnegative safe integer");
3724
+ let queue = Promise.resolve();
3725
+ const mutate = (operation) => {
3726
+ const result = queue.then(operation);
3727
+ queue = result.catch(() => void 0);
3728
+ return result;
3729
+ };
3730
+ const assertDelta = async (path, nextBytes, fsOptions) => {
3731
+ const current = await existingBytes(fs, path, fsOptions);
3732
+ if (await usedBytes(fs, fsOptions) - current + nextBytes > options.maxBytes) throw new FileSystemQuotaError(options.maxBytes);
3733
+ };
3734
+ const mutations = {
3735
+ writeFile(path, data, writeOptions) {
3736
+ return mutate(async () => {
3737
+ const append = writeOptions?.flag === "a" || writeOptions?.flag === "ax";
3738
+ const current = append ? await existingBytes(fs, path, writeOptions) : 0;
3739
+ await assertDelta(path, current + data.length, writeOptions);
3740
+ await fs.writeFile(path, data, writeOptions);
3741
+ });
3742
+ },
3743
+ appendFile(path, data, appendOptions) {
3744
+ return mutate(async () => {
3745
+ await assertDelta(path, await existingBytes(fs, path, appendOptions) + data.length, appendOptions);
3746
+ await fs.appendFile(path, data, appendOptions);
3747
+ });
3748
+ },
3749
+ copyFile(source, destination, copyOptions) {
3750
+ return mutate(async () => {
3751
+ await assertDelta(destination, (await fs.stat(source, copyOptions)).size, copyOptions);
3752
+ await fs.copyFile(source, destination, copyOptions);
3753
+ });
3754
+ },
3755
+ truncate(path, length = 0, truncateOptions) {
3756
+ return mutate(async () => {
3757
+ await assertDelta(path, length, truncateOptions);
3758
+ await fs.truncate(path, length, truncateOptions);
3759
+ });
3760
+ },
3761
+ link(source, destination, linkOptions) {
3762
+ return mutate(async () => {
3763
+ await assertDelta(destination, (await fs.stat(source, linkOptions)).size, linkOptions);
3764
+ await fs.link(source, destination, linkOptions);
3765
+ });
3766
+ },
3767
+ symlink(target, path, linkOptions) {
3768
+ return mutate(async () => {
3769
+ await assertDelta(path, new TextEncoder().encode(target).length, linkOptions);
3770
+ await fs.symlink(target, path, linkOptions);
3771
+ });
3772
+ },
3773
+ writeStream(path, source, writeOptions) {
3774
+ return mutate(async () => {
3775
+ const append = writeOptions?.flag === "a" || writeOptions?.flag === "ax";
3776
+ if (!append) await fs.writeFile(path, new Uint8Array(), writeOptions);
3777
+ for await (const chunk of source) {
3778
+ await assertDelta(path, await existingBytes(fs, path, writeOptions) + chunk.length, writeOptions);
3779
+ await fs.appendFile(path, chunk, writeOptions);
3780
+ }
3781
+ });
3782
+ }
3783
+ };
3784
+ return new Proxy(fs, {
3785
+ get(target, property) {
3786
+ const replacement = Reflect.get(mutations, property);
3787
+ if (typeof replacement === "function") return replacement;
3788
+ const original = Reflect.get(target, property);
3789
+ return typeof original === "function" ? original.bind(target) : original;
3790
+ }
3791
+ });
3792
+ }
3793
+
3691
3794
  // packages/safe-fs/src/bridge/stats.ts
3692
3795
  function predicates(type) {
3693
3796
  return {
@@ -4310,6 +4413,8 @@ export {
4310
4413
  createMountFileSystem,
4311
4414
  OverlayFileSystem,
4312
4415
  createOverlayFileSystem,
4416
+ FileSystemQuotaError,
4417
+ withFileSystemQuota,
4313
4418
  FileSystemBridge
4314
4419
  };
4315
- //# sourceMappingURL=chunk-2QRYPKQQ.js.map
4420
+ //# sourceMappingURL=chunk-FEOGVSSU.js.map