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.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-bash/dist/browser.d.ts +5 -0
- package/packages/safe-bash/dist/browser.d.ts.map +1 -1
- package/packages/safe-bash/dist/browser.js +873 -122
- package/packages/safe-bash/dist/browser.js.map +4 -4
- package/packages/safe-bash/dist/commands/apply-patch/shared.js +2 -2
- package/packages/safe-bash/dist/commands/apply-patch/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/archive/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/archive/internal.js +3 -2
- package/packages/safe-bash/dist/commands/archive/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/bytes/checksums/index.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/bytes/checksums/index.js +3 -2
- package/packages/safe-bash/dist/commands/bytes/checksums/index.js.map +1 -1
- package/packages/safe-bash/dist/commands/bytes/compression/gunzip.js +2 -2
- package/packages/safe-bash/dist/commands/bytes/compression/gunzip.js.map +1 -1
- package/packages/safe-bash/dist/commands/bytes/compression/stream.js +2 -2
- package/packages/safe-bash/dist/commands/bytes/compression/stream.js.map +1 -1
- package/packages/safe-bash/dist/commands/bytes/encoding/shared.js +3 -3
- package/packages/safe-bash/dist/commands/bytes/encoding/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/column/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/column/internal.js +2 -1
- package/packages/safe-bash/dist/commands/column/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/diff-patch/shared.js +2 -2
- package/packages/safe-bash/dist/commands/diff-patch/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/du/budget.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/du/budget.js +3 -2
- package/packages/safe-bash/dist/commands/du/budget.js.map +1 -1
- package/packages/safe-bash/dist/commands/env-split.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/env-split.js +2 -1
- package/packages/safe-bash/dist/commands/env-split.js.map +1 -1
- package/packages/safe-bash/dist/commands/expr/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/expr/internal.js +2 -1
- package/packages/safe-bash/dist/commands/expr/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/file/shared.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/file/shared.js +3 -2
- package/packages/safe-bash/dist/commands/file/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/find.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/find.js +12 -31
- package/packages/safe-bash/dist/commands/find.js.map +1 -1
- package/packages/safe-bash/dist/commands/html-to-markdown/budget.js +2 -2
- package/packages/safe-bash/dist/commands/html-to-markdown/budget.js.map +1 -1
- package/packages/safe-bash/dist/commands/metadata/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/metadata/internal.js +2 -1
- package/packages/safe-bash/dist/commands/metadata/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/move.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/move.js +2 -1
- package/packages/safe-bash/dist/commands/move.js.map +1 -1
- package/packages/safe-bash/dist/commands/network/authorizer.d.ts +7 -0
- package/packages/safe-bash/dist/commands/network/authorizer.d.ts.map +1 -0
- package/packages/safe-bash/dist/commands/network/authorizer.js +48 -0
- package/packages/safe-bash/dist/commands/network/authorizer.js.map +1 -0
- package/packages/safe-bash/dist/commands/network/body.js +2 -2
- package/packages/safe-bash/dist/commands/network/body.js.map +1 -1
- package/packages/safe-bash/dist/commands/network/curl.js +2 -2
- package/packages/safe-bash/dist/commands/network/curl.js.map +1 -1
- package/packages/safe-bash/dist/commands/network/fetch-transport.d.ts +6 -0
- package/packages/safe-bash/dist/commands/network/fetch-transport.d.ts.map +1 -0
- package/packages/safe-bash/dist/commands/network/fetch-transport.js +80 -0
- package/packages/safe-bash/dist/commands/network/fetch-transport.js.map +1 -0
- package/packages/safe-bash/dist/commands/network/index.d.ts +2 -0
- package/packages/safe-bash/dist/commands/network/index.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/network/index.js +2 -0
- package/packages/safe-bash/dist/commands/network/index.js.map +1 -1
- package/packages/safe-bash/dist/commands/network/types.d.ts +1 -0
- package/packages/safe-bash/dist/commands/network/types.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/network/types.js +10 -0
- package/packages/safe-bash/dist/commands/network/types.js.map +1 -1
- package/packages/safe-bash/dist/commands/regex-execution/ere/limits.js +2 -2
- package/packages/safe-bash/dist/commands/regex-execution/ere/limits.js.map +1 -1
- package/packages/safe-bash/dist/commands/safejs/io.js +2 -2
- package/packages/safe-bash/dist/commands/safejs/io.js.map +1 -1
- package/packages/safe-bash/dist/commands/search/shared.js +2 -2
- package/packages/safe-bash/dist/commands/search/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/split/io.js +2 -2
- package/packages/safe-bash/dist/commands/split/io.js.map +1 -1
- package/packages/safe-bash/dist/commands/stream-format/shared.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/stream-format/shared.js +2 -1
- package/packages/safe-bash/dist/commands/stream-format/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/stream-inspection/shared.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/stream-inspection/shared.js +2 -1
- package/packages/safe-bash/dist/commands/stream-inspection/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/structured/limits.js +2 -2
- package/packages/safe-bash/dist/commands/structured/limits.js.map +1 -1
- package/packages/safe-bash/dist/commands/table-text/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/table-text/internal.js +2 -1
- package/packages/safe-bash/dist/commands/table-text/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/text-programs/shared.js +2 -2
- package/packages/safe-bash/dist/commands/text-programs/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/tree/io.js +2 -2
- package/packages/safe-bash/dist/commands/tree/io.js.map +1 -1
- package/packages/safe-bash/dist/contracts/yield.d.ts +13 -0
- package/packages/safe-bash/dist/contracts/yield.d.ts.map +1 -0
- package/packages/safe-bash/dist/contracts/yield.js +41 -0
- package/packages/safe-bash/dist/contracts/yield.js.map +1 -0
- package/packages/safe-bash/dist/shell/arithmetic.js +1 -1
- package/packages/safe-bash/dist/shell/arithmetic.js.map +1 -1
- package/packages/safe-bash/dist/shell/arrays/ledger.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/arrays/ledger.js +2 -9
- package/packages/safe-bash/dist/shell/arrays/ledger.js.map +1 -1
- package/packages/safe-bash/dist/shell/conditional.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/conditional.js +2 -1
- package/packages/safe-bash/dist/shell/conditional.js.map +1 -1
- package/packages/safe-bash/dist/shell/env-warning.d.ts +2 -0
- package/packages/safe-bash/dist/shell/env-warning.d.ts.map +1 -0
- package/packages/safe-bash/dist/shell/env-warning.js +12 -0
- package/packages/safe-bash/dist/shell/env-warning.js.map +1 -0
- package/packages/safe-bash/dist/shell/index.d.ts +1 -0
- package/packages/safe-bash/dist/shell/index.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/index.js +1 -0
- package/packages/safe-bash/dist/shell/index.js.map +1 -1
- package/packages/safe-bash/dist/shell/input.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/input.js +4 -3
- package/packages/safe-bash/dist/shell/input.js.map +1 -1
- package/packages/safe-bash/dist/shell/parser.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/parser.js +15 -1
- package/packages/safe-bash/dist/shell/parser.js.map +1 -1
- package/packages/safe-bash/dist/shell/pattern.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/pattern.js +3 -2
- package/packages/safe-bash/dist/shell/pattern.js.map +1 -1
- package/packages/safe-bash/dist/shell/runtime.d.ts +3 -2
- package/packages/safe-bash/dist/shell/runtime.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/runtime.js +57 -55
- package/packages/safe-bash/dist/shell/runtime.js.map +1 -1
- package/packages/safe-bash/dist/shell/shell.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/shell.js +4 -1
- package/packages/safe-bash/dist/shell/shell.js.map +1 -1
- package/packages/safe-bash/dist/shell/types.d.ts +2 -0
- package/packages/safe-bash/dist/shell/types.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/types.js.map +1 -1
- package/packages/safe-bash/dist/shell/worker-limits.d.ts +3 -0
- package/packages/safe-bash/dist/shell/worker-limits.d.ts.map +1 -0
- package/packages/safe-bash/dist/shell/worker-limits.js +14 -0
- package/packages/safe-bash/dist/shell/worker-limits.js.map +1 -0
- package/packages/safe-fs/dist/core.d.ts +1 -0
- package/packages/safe-fs/dist/fs/quota/index.d.ts +9 -0
- package/packages/safe-fs/dist/index.d.ts +1 -0
- package/packages/safe-js/dist/browser/chunks/{chunk-QGN6DKT5.js → chunk-ET2GNCA5.js} +106 -1
- package/packages/safe-js/dist/browser/chunks/{chunk-QGN6DKT5.js.map → chunk-ET2GNCA5.js.map} +3 -3
- package/packages/safe-js/dist/browser/safe-fs-core.js +7 -3
- package/packages/safe-js/dist/browser/safe-fs.js +7 -3
- package/packages/safe-js/dist/chunks/{chunk-5XRQ3GNN.js → chunk-BUNDGMBF.js} +3 -3
- package/packages/safe-js/dist/chunks/{chunk-2QRYPKQQ.js → chunk-FEOGVSSU.js} +106 -1
- package/packages/safe-js/dist/chunks/{chunk-2QRYPKQQ.js.map → chunk-FEOGVSSU.js.map} +3 -3
- package/packages/safe-js/dist/chunks/{chunk-7M2SJPSZ.js → chunk-WFXKOHDU.js} +2 -2
- package/packages/safe-js/dist/cli.js +3 -3
- package/packages/safe-js/dist/index.js +3 -3
- package/packages/safe-js/dist/safe-fs-core.js +7 -3
- package/packages/safe-js/dist/safe-fs-core.js.map +1 -1
- package/packages/safe-js/dist/safe-fs-node.js +8 -4
- package/packages/safe-js/dist/safe-fs.js +8 -4
- /package/packages/safe-js/dist/chunks/{chunk-5XRQ3GNN.js.map → chunk-BUNDGMBF.js.map} +0 -0
- /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
|
-
|
|
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
|
-
|
|
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-
|
|
37
|
+
} from "./chunk-WFXKOHDU.js";
|
|
38
38
|
import {
|
|
39
39
|
FsError,
|
|
40
40
|
isPathWithin
|
|
41
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
4420
|
+
//# sourceMappingURL=chunk-FEOGVSSU.js.map
|