poe-code 14.0.20 → 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 +3 -10
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +3 -10
- 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-bash-mcp/dist/cli.d.ts +0 -2
- package/packages/safe-bash-mcp/dist/cli.js +0 -23
- package/packages/safe-bash-mcp/dist/index.d.ts +0 -21
- package/packages/safe-bash-mcp/dist/index.js +0 -141
- /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
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
toByteSource,
|
|
17
17
|
toFsError,
|
|
18
18
|
validatePath
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FEOGVSSU.js";
|
|
20
20
|
|
|
21
21
|
// packages/safe-fs/src/contracts/path.ts
|
|
22
22
|
import { posix } from "node:path";
|
|
@@ -2610,4 +2610,4 @@ export {
|
|
|
2610
2610
|
createFileSystem,
|
|
2611
2611
|
createNodeFileSystemAdapterRegistry
|
|
2612
2612
|
};
|
|
2613
|
-
//# sourceMappingURL=chunk-
|
|
2613
|
+
//# sourceMappingURL=chunk-WFXKOHDU.js.map
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveFsConfig,
|
|
23
23
|
splitFrontmatter,
|
|
24
24
|
withBrokenPipeGuard
|
|
25
|
-
} from "./chunks/chunk-
|
|
25
|
+
} from "./chunks/chunk-BUNDGMBF.js";
|
|
26
26
|
import {
|
|
27
27
|
Budget,
|
|
28
28
|
SandboxError,
|
|
@@ -35,8 +35,8 @@ import {
|
|
|
35
35
|
restore,
|
|
36
36
|
run
|
|
37
37
|
} from "./chunks/chunk-CZNLD2Z3.js";
|
|
38
|
-
import "./chunks/chunk-
|
|
39
|
-
import "./chunks/chunk-
|
|
38
|
+
import "./chunks/chunk-WFXKOHDU.js";
|
|
39
|
+
import "./chunks/chunk-FEOGVSSU.js";
|
|
40
40
|
import "./chunks/chunk-4YIDX44G.js";
|
|
41
41
|
|
|
42
42
|
// packages/safe-js/src/cli.ts
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runWithSpawnUsageAccumulator,
|
|
27
27
|
splitFrontmatter,
|
|
28
28
|
supportsSpawnMode
|
|
29
|
-
} from "./chunks/chunk-
|
|
29
|
+
} from "./chunks/chunk-BUNDGMBF.js";
|
|
30
30
|
import {
|
|
31
31
|
Budget,
|
|
32
32
|
FileSnapshotBackend,
|
|
@@ -51,8 +51,8 @@ import {
|
|
|
51
51
|
restore,
|
|
52
52
|
run
|
|
53
53
|
} from "./chunks/chunk-CZNLD2Z3.js";
|
|
54
|
-
import "./chunks/chunk-
|
|
55
|
-
import "./chunks/chunk-
|
|
54
|
+
import "./chunks/chunk-WFXKOHDU.js";
|
|
55
|
+
import "./chunks/chunk-FEOGVSSU.js";
|
|
56
56
|
import "./chunks/chunk-4YIDX44G.js";
|
|
57
57
|
|
|
58
58
|
// packages/safe-js/src/parse.ts
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ACCESS_MODES,
|
|
3
3
|
FileSystemBridge,
|
|
4
|
+
FileSystemQuotaError,
|
|
4
5
|
FsError,
|
|
5
6
|
MemoryFileSystem,
|
|
6
7
|
MountFileSystem,
|
|
@@ -25,8 +26,9 @@ import {
|
|
|
25
26
|
resolvePath,
|
|
26
27
|
toByteSource,
|
|
27
28
|
toFsError,
|
|
28
|
-
validatePath
|
|
29
|
-
|
|
29
|
+
validatePath,
|
|
30
|
+
withFileSystemQuota
|
|
31
|
+
} from "./chunks/chunk-FEOGVSSU.js";
|
|
30
32
|
import "./chunks/chunk-4YIDX44G.js";
|
|
31
33
|
|
|
32
34
|
// packages/safe-fs/src/contracts/portable-path.ts
|
|
@@ -96,6 +98,7 @@ function createFsBridge(fs, options) {
|
|
|
96
98
|
}
|
|
97
99
|
export {
|
|
98
100
|
ACCESS_MODES,
|
|
101
|
+
FileSystemQuotaError,
|
|
99
102
|
FsError,
|
|
100
103
|
MemoryFileSystem,
|
|
101
104
|
MountFileSystem,
|
|
@@ -125,6 +128,7 @@ export {
|
|
|
125
128
|
resolvePath,
|
|
126
129
|
toByteSource,
|
|
127
130
|
toFsError,
|
|
128
|
-
validatePath
|
|
131
|
+
validatePath,
|
|
132
|
+
withFileSystemQuota
|
|
129
133
|
};
|
|
130
134
|
//# sourceMappingURL=safe-fs-core.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../safe-fs/src/contracts/portable-path.ts", "../../safe-fs/src/bridge/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { dirname as virtualDirname } from \"./virtual-path.js\";\n\nfunction assertString(value: unknown): asserts value is string {\n if (typeof value !== \"string\") throw new TypeError(\"path must be a string\");\n}\n\nexport function basename(path: string, suffix = \"\"): string {\n assertString(path);\n assertString(suffix);\n if (suffix && path === suffix) return \"\";\n let end = path.length;\n while (end > 0 && path[end - 1] === \"/\") end--;\n if (end === 0 && suffix && suffix.length <= path.length) return path;\n const start = path.lastIndexOf(\"/\", end - 1) + 1;\n const base = path.slice(start, end);\n if (suffix.length > base.length && suffix.length <= path.length && suffix.endsWith(base)) return path.slice(start);\n return suffix && suffix.length < base.length && base.endsWith(suffix)\n ? base.slice(0, -suffix.length)\n : base;\n}\n\nexport const dirname = virtualDirname;\n\nexport function extname(path: string): string {\n const base = basename(path);\n const position = base.lastIndexOf(\".\");\n return position <= 0 || base === \"..\" ? \"\" : base.slice(position);\n}\n\nexport function isAbsolutePath(path: string): boolean {\n assertString(path);\n return path.startsWith(\"/\");\n}\n\nexport function joinPath(...paths: string[]): string {\n for (const path of paths) assertString(path);\n const joined = paths.filter(Boolean).join(\"/\");\n if (!joined) return \".\";\n const absolute = joined.startsWith(\"/\");\n const components: string[] = [];\n for (const component of joined.split(\"/\")) {\n if (!component || component === \".\") continue;\n if (component === \"..\") {\n if (components.length && components.at(-1) !== \"..\") components.pop();\n else if (!absolute) components.push(component);\n } else components.push(component);\n }\n const result = `${absolute ? \"/\" : \"\"}${components.join(\"/\")}` || \".\";\n return joined.endsWith(\"/\") && result !== \"/\" ? `${result}/` : result;\n}\n\nexport const posixPath = Object.freeze({ basename, dirname, extname, join: joinPath, isAbsolute: isAbsolutePath });\n", "import { platform } from \"#safe-fs-platform\";\nimport type { FileSystem } from \"../contracts/filesystem.js\";\nimport { dirname, relativePath, resolvePath } from \"../contracts/virtual-path.js\";\nimport { FileSystemBridge } from \"./filesystem.js\";\nimport type { FsBridgeOptions } from \"./types.js\";\n\nexport type {\n FsBridgeCodec, FsBridgeDirent, FsBridgeEncoding, FsBridgeFileSystem, FsBridgeOptions, FsBridgeStats\n} from \"./types.js\";\nexport type FsBridge = FileSystemBridge<Uint8Array<ArrayBuffer>>;\n\nexport function createFsBridge(fs: FileSystem, options: FsBridgeOptions): FsBridge {\n if (options === undefined || options === null) throw new TypeError(\"An explicit filesystem codec is required\");\n return new FileSystemBridge(fs, options, {\n codec: options.codec,\n copyBytes(bytes) { return new Uint8Array(bytes); },\n randomSuffix() { return platform.randomUUID().slice(0, 6); },\n paths: {\n isAbsolute(path) { return typeof path === \"string\" && path.startsWith(\"/\"); },\n dirname,\n relative: relativePath,\n resolve: resolvePath\n }\n });\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,aAAa,OAAyC;AAC7D,MAAI,OAAO,UAAU,SAAU,OAAM,IAAI,UAAU,uBAAuB;AAC5E;AAEO,SAAS,SAAS,MAAc,SAAS,IAAY;AAC1D,eAAa,IAAI;AACjB,eAAa,MAAM;AACnB,MAAI,UAAU,SAAS,OAAQ,QAAO;AACtC,MAAI,MAAM,KAAK;AACf,SAAO,MAAM,KAAK,KAAK,MAAM,CAAC,MAAM,IAAK;AACzC,MAAI,QAAQ,KAAK,UAAU,OAAO,UAAU,KAAK,OAAQ,QAAO;AAChE,QAAM,QAAQ,KAAK,YAAY,KAAK,MAAM,CAAC,IAAI;AAC/C,QAAM,OAAO,KAAK,MAAM,OAAO,GAAG;AAClC,MAAI,OAAO,SAAS,KAAK,UAAU,OAAO,UAAU,KAAK,UAAU,OAAO,SAAS,IAAI,EAAG,QAAO,KAAK,MAAM,KAAK;AACjH,SAAO,UAAU,OAAO,SAAS,KAAK,UAAU,KAAK,SAAS,MAAM,IAChE,KAAK,MAAM,GAAG,CAAC,OAAO,MAAM,IAC5B;AACN;AAEO,IAAMA,WAAU;AAEhB,SAAS,QAAQ,MAAsB;AAC5C,QAAM,OAAO,SAAS,IAAI;AAC1B,QAAM,WAAW,KAAK,YAAY,GAAG;AACrC,SAAO,YAAY,KAAK,SAAS,OAAO,KAAK,KAAK,MAAM,QAAQ;AAClE;AAEO,SAAS,eAAe,MAAuB;AACpD,eAAa,IAAI;AACjB,SAAO,KAAK,WAAW,GAAG;AAC5B;AAEO,SAAS,YAAY,OAAyB;AACnD,aAAW,QAAQ,MAAO,cAAa,IAAI;AAC3C,QAAM,SAAS,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG;AAC7C,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,WAAW,OAAO,WAAW,GAAG;AACtC,QAAM,aAAuB,CAAC;AAC9B,aAAW,aAAa,OAAO,MAAM,GAAG,GAAG;AACzC,QAAI,CAAC,aAAa,cAAc,IAAK;AACrC,QAAI,cAAc,MAAM;AACtB,UAAI,WAAW,UAAU,WAAW,GAAG,EAAE,MAAM,KAAM,YAAW,IAAI;AAAA,eAC3D,CAAC,SAAU,YAAW,KAAK,SAAS;AAAA,IAC/C,MAAO,YAAW,KAAK,SAAS;AAAA,EAClC;AACA,QAAM,SAAS,GAAG,WAAW,MAAM,EAAE,GAAG,WAAW,KAAK,GAAG,CAAC,MAAM;AAClE,SAAO,OAAO,SAAS,GAAG,KAAK,WAAW,MAAM,GAAG,MAAM,MAAM;AACjE;AAEO,IAAM,YAAY,OAAO,OAAO,EAAE,UAAU,SAAAA,UAAS,SAAS,MAAM,UAAU,YAAY,eAAe,CAAC;;;ACxC1G,SAAS,eAAe,IAAgB,SAAoC;AACjF,MAAI,YAAY,UAAa,YAAY,KAAM,OAAM,IAAI,UAAU,0CAA0C;AAC7G,SAAO,IAAI,iBAAiB,IAAI,SAAS;AAAA,IACvC,OAAO,QAAQ;AAAA,IACf,UAAU,OAAO;AAAE,aAAO,IAAI,WAAW,KAAK;AAAA,IAAG;AAAA,IACjD,eAAe;AAAE,aAAO,SAAS,WAAW,EAAE,MAAM,GAAG,CAAC;AAAA,IAAG;AAAA,IAC3D,OAAO;AAAA,MACL,WAAW,MAAM;AAAE,eAAO,OAAO,SAAS,YAAY,KAAK,WAAW,GAAG;AAAA,MAAG;AAAA,MAC5E;AAAA,MACA,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": ["dirname"]
|
|
7
7
|
}
|
|
@@ -19,9 +19,10 @@ import {
|
|
|
19
19
|
posixPath,
|
|
20
20
|
readConfigRecord,
|
|
21
21
|
validateFileSystemConfig
|
|
22
|
-
} from "./chunks/chunk-
|
|
22
|
+
} from "./chunks/chunk-WFXKOHDU.js";
|
|
23
23
|
import {
|
|
24
24
|
ACCESS_MODES,
|
|
25
|
+
FileSystemQuotaError,
|
|
25
26
|
FsError,
|
|
26
27
|
MemoryFileSystem,
|
|
27
28
|
MountFileSystem,
|
|
@@ -43,11 +44,13 @@ import {
|
|
|
43
44
|
resolvePath,
|
|
44
45
|
toByteSource,
|
|
45
46
|
toFsError,
|
|
46
|
-
validatePath
|
|
47
|
-
|
|
47
|
+
validatePath,
|
|
48
|
+
withFileSystemQuota
|
|
49
|
+
} from "./chunks/chunk-FEOGVSSU.js";
|
|
48
50
|
import "./chunks/chunk-4YIDX44G.js";
|
|
49
51
|
export {
|
|
50
52
|
ACCESS_MODES,
|
|
53
|
+
FileSystemQuotaError,
|
|
51
54
|
FsError,
|
|
52
55
|
MemoryFileSystem,
|
|
53
56
|
MockS3Client,
|
|
@@ -89,6 +92,7 @@ export {
|
|
|
89
92
|
toByteSource,
|
|
90
93
|
toFsError,
|
|
91
94
|
validateFileSystemConfig,
|
|
92
|
-
validatePath
|
|
95
|
+
validatePath,
|
|
96
|
+
withFileSystemQuota
|
|
93
97
|
};
|
|
94
98
|
//# sourceMappingURL=safe-fs-node.js.map
|
|
@@ -19,9 +19,10 @@ import {
|
|
|
19
19
|
posixPath,
|
|
20
20
|
readConfigRecord,
|
|
21
21
|
validateFileSystemConfig
|
|
22
|
-
} from "./chunks/chunk-
|
|
22
|
+
} from "./chunks/chunk-WFXKOHDU.js";
|
|
23
23
|
import {
|
|
24
24
|
ACCESS_MODES,
|
|
25
|
+
FileSystemQuotaError,
|
|
25
26
|
FsError,
|
|
26
27
|
MemoryFileSystem,
|
|
27
28
|
MountFileSystem,
|
|
@@ -43,11 +44,13 @@ import {
|
|
|
43
44
|
resolvePath,
|
|
44
45
|
toByteSource,
|
|
45
46
|
toFsError,
|
|
46
|
-
validatePath
|
|
47
|
-
|
|
47
|
+
validatePath,
|
|
48
|
+
withFileSystemQuota
|
|
49
|
+
} from "./chunks/chunk-FEOGVSSU.js";
|
|
48
50
|
import "./chunks/chunk-4YIDX44G.js";
|
|
49
51
|
export {
|
|
50
52
|
ACCESS_MODES,
|
|
53
|
+
FileSystemQuotaError,
|
|
51
54
|
FsError,
|
|
52
55
|
MemoryFileSystem,
|
|
53
56
|
MockS3Client,
|
|
@@ -89,6 +92,7 @@ export {
|
|
|
89
92
|
toByteSource,
|
|
90
93
|
toFsError,
|
|
91
94
|
validateFileSystemConfig,
|
|
92
|
-
validatePath
|
|
95
|
+
validatePath,
|
|
96
|
+
withFileSystemQuota
|
|
93
97
|
};
|
|
94
98
|
//# sourceMappingURL=safe-fs.js.map
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
|
-
import { parseArgs } from "node:util";
|
|
5
|
-
import { createSafeBashMcpServer } from "./index.js";
|
|
6
|
-
const { values } = parseArgs({
|
|
7
|
-
options: { config: { type: "string" } },
|
|
8
|
-
strict: true,
|
|
9
|
-
allowPositionals: false
|
|
10
|
-
});
|
|
11
|
-
const options = values.config === undefined
|
|
12
|
-
? {}
|
|
13
|
-
: (await import(pathToFileURL(resolve(values.config)).href)).default;
|
|
14
|
-
if (options === undefined) {
|
|
15
|
-
throw new TypeError("The config module must default-export SafeBashMcpOptions");
|
|
16
|
-
}
|
|
17
|
-
const server = createSafeBashMcpServer(options);
|
|
18
|
-
try {
|
|
19
|
-
await server.listen();
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
await server.close();
|
|
23
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Shell, type ShellOptions } from "poe-code/safe-bash";
|
|
2
|
-
import { type Server } from "../../tiny-stdio-mcp-server/dist/index.js";
|
|
3
|
-
export interface SafeBashMcpOptions extends Partial<ShellOptions> {
|
|
4
|
-
readonly createShell?: (options: ShellOptions) => Shell;
|
|
5
|
-
}
|
|
6
|
-
export interface ShellExecuteInput {
|
|
7
|
-
readonly command: string;
|
|
8
|
-
readonly cwd?: string;
|
|
9
|
-
readonly env?: Record<string, string>;
|
|
10
|
-
readonly stdin?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ShellExecuteOutput {
|
|
13
|
-
readonly stdout: string;
|
|
14
|
-
readonly stderr: string;
|
|
15
|
-
readonly exitCode: number;
|
|
16
|
-
}
|
|
17
|
-
export type SafeBashMcpServer = Server & {
|
|
18
|
-
readonly shell: Shell;
|
|
19
|
-
close(): Promise<void>;
|
|
20
|
-
};
|
|
21
|
-
export declare function createSafeBashMcpServer(options?: SafeBashMcpOptions): SafeBashMcpServer;
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { createMemoryFileSystem } from "poe-code/safe-fs";
|
|
2
|
-
import { CommandRegistry, Shell, createStandardCommands } from "poe-code/safe-bash";
|
|
3
|
-
import { createServer } from "tiny-stdio-mcp-server";
|
|
4
|
-
const inputSchema = {
|
|
5
|
-
type: "object",
|
|
6
|
-
properties: {
|
|
7
|
-
command: { type: "string", minLength: 1, description: "Bash source interpreted by safe-bash, never a host shell" },
|
|
8
|
-
cwd: { type: "string", description: "Working directory in the configured virtual filesystem for this call" },
|
|
9
|
-
env: { type: "object", additionalProperties: { type: "string" }, description: "Environment overrides for this call" },
|
|
10
|
-
stdin: { type: "string", description: "Standard input for this call" }
|
|
11
|
-
},
|
|
12
|
-
required: ["command"],
|
|
13
|
-
additionalProperties: false
|
|
14
|
-
};
|
|
15
|
-
const outputSchema = {
|
|
16
|
-
type: "object",
|
|
17
|
-
properties: {
|
|
18
|
-
stdout: { type: "string" },
|
|
19
|
-
stderr: { type: "string" },
|
|
20
|
-
exitCode: { type: "integer" }
|
|
21
|
-
},
|
|
22
|
-
required: ["stdout", "stderr", "exitCode"],
|
|
23
|
-
additionalProperties: false
|
|
24
|
-
};
|
|
25
|
-
export function createSafeBashMcpServer(options = {}) {
|
|
26
|
-
if (options === null || typeof options !== "object" || Array.isArray(options)) {
|
|
27
|
-
throw new TypeError("Safe-bash MCP options must be an object");
|
|
28
|
-
}
|
|
29
|
-
const { createShell, ...shellOptions } = options;
|
|
30
|
-
const resolvedOptions = {
|
|
31
|
-
...shellOptions,
|
|
32
|
-
fs: options.fs ?? createMemoryFileSystem(),
|
|
33
|
-
commands: options.commands ?? new CommandRegistry(createStandardCommands())
|
|
34
|
-
};
|
|
35
|
-
const shell = createShell ? createShell(resolvedOptions) : new Shell(resolvedOptions);
|
|
36
|
-
const lifetime = new AbortController();
|
|
37
|
-
let closing;
|
|
38
|
-
const close = () => {
|
|
39
|
-
if (closing === undefined) {
|
|
40
|
-
closing = shell.dispose();
|
|
41
|
-
lifetime.abort();
|
|
42
|
-
}
|
|
43
|
-
return closing;
|
|
44
|
-
};
|
|
45
|
-
let pending = Promise.resolve();
|
|
46
|
-
const server = createServer({ name: "safe-bash-mcp", version: "0.1.0" });
|
|
47
|
-
server.tool("shell_execute", "Execute Bash in a shared virtual filesystem. Calls run in order; cwd and environment changes do not persist across calls.", inputSchema, async ({ command, ...execOptions }) => {
|
|
48
|
-
const execution = pending.then(() => {
|
|
49
|
-
if (lifetime.signal.aborted)
|
|
50
|
-
throw new Error("Safe-bash MCP server is closed");
|
|
51
|
-
return shell.exec(command, execOptions);
|
|
52
|
-
});
|
|
53
|
-
pending = execution.then(() => undefined, () => undefined);
|
|
54
|
-
const { stdout, stderr, exitCode } = await execution;
|
|
55
|
-
const output = { stdout, stderr, exitCode };
|
|
56
|
-
return {
|
|
57
|
-
content: [{ type: "text", text: JSON.stringify(output) }],
|
|
58
|
-
structuredContent: output,
|
|
59
|
-
isError: exitCode !== 0
|
|
60
|
-
};
|
|
61
|
-
}, outputSchema);
|
|
62
|
-
const connect = server.connect;
|
|
63
|
-
return Object.assign(server, {
|
|
64
|
-
shell,
|
|
65
|
-
close,
|
|
66
|
-
async connect(transport) {
|
|
67
|
-
const readable = new PassThrough();
|
|
68
|
-
let stopped = false;
|
|
69
|
-
let failure;
|
|
70
|
-
const stop = () => {
|
|
71
|
-
if (stopped)
|
|
72
|
-
return;
|
|
73
|
-
stopped = true;
|
|
74
|
-
void close().catch(() => undefined);
|
|
75
|
-
transport.readable.unpipe(readable);
|
|
76
|
-
readable.end();
|
|
77
|
-
};
|
|
78
|
-
const fail = (error) => {
|
|
79
|
-
failure ??= error;
|
|
80
|
-
stop();
|
|
81
|
-
};
|
|
82
|
-
const writable = new Writable({
|
|
83
|
-
write(chunk, encoding, callback) {
|
|
84
|
-
if (!stopped) {
|
|
85
|
-
try {
|
|
86
|
-
transport.writable.write(chunk, encoding);
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
fail(error);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
callback();
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
const connection = connect({ readable, writable });
|
|
96
|
-
transport.readable.once("end", stop);
|
|
97
|
-
transport.readable.once("close", stop);
|
|
98
|
-
transport.readable.on("error", fail);
|
|
99
|
-
transport.writable.once("close", stop);
|
|
100
|
-
transport.writable.on("error", fail);
|
|
101
|
-
lifetime.signal.addEventListener("abort", stop, { once: true });
|
|
102
|
-
try {
|
|
103
|
-
if (lifetime.signal.aborted ||
|
|
104
|
-
transport.readable.readableEnded ||
|
|
105
|
-
transport.readable.destroyed ||
|
|
106
|
-
transport.writable.destroyed) {
|
|
107
|
-
stop();
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
transport.readable.pipe(readable);
|
|
111
|
-
}
|
|
112
|
-
await connection;
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
failure ??= error;
|
|
116
|
-
}
|
|
117
|
-
finally {
|
|
118
|
-
stop();
|
|
119
|
-
transport.readable.removeListener("end", stop);
|
|
120
|
-
transport.readable.removeListener("close", stop);
|
|
121
|
-
transport.readable.removeListener("error", fail);
|
|
122
|
-
transport.writable.removeListener("close", stop);
|
|
123
|
-
transport.writable.removeListener("error", fail);
|
|
124
|
-
lifetime.signal.removeEventListener("abort", stop);
|
|
125
|
-
readable.destroy();
|
|
126
|
-
writable.destroy();
|
|
127
|
-
}
|
|
128
|
-
try {
|
|
129
|
-
await close();
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
if (failure !== undefined)
|
|
133
|
-
throw new AggregateError([failure, error], "MCP transport and shell cleanup failed");
|
|
134
|
-
throw error;
|
|
135
|
-
}
|
|
136
|
-
if (failure !== undefined)
|
|
137
|
-
throw failure;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
import { PassThrough, Writable } from "node:stream";
|
|
File without changes
|
|
File without changes
|