@poe-platform/safe-bash 0.1.41 → 0.1.43
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/README.md +11 -2
- package/dist/safe-bash/browser.d.ts +5 -0
- package/dist/safe-bash/browser.d.ts.map +1 -1
- package/dist/safe-bash/browser.js +873 -122
- package/dist/safe-bash/browser.js.map +4 -4
- package/dist/safe-bash/commands/apply-patch/shared.js +2 -2
- package/dist/safe-bash/commands/apply-patch/shared.js.map +1 -1
- package/dist/safe-bash/commands/archive/internal.d.ts.map +1 -1
- package/dist/safe-bash/commands/archive/internal.js +3 -2
- package/dist/safe-bash/commands/archive/internal.js.map +1 -1
- package/dist/safe-bash/commands/bytes/checksums/index.d.ts.map +1 -1
- package/dist/safe-bash/commands/bytes/checksums/index.js +3 -2
- package/dist/safe-bash/commands/bytes/checksums/index.js.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/gunzip.js +2 -2
- package/dist/safe-bash/commands/bytes/compression/gunzip.js.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/stream.js +2 -2
- package/dist/safe-bash/commands/bytes/compression/stream.js.map +1 -1
- package/dist/safe-bash/commands/bytes/encoding/shared.js +3 -3
- package/dist/safe-bash/commands/bytes/encoding/shared.js.map +1 -1
- package/dist/safe-bash/commands/column/internal.d.ts.map +1 -1
- package/dist/safe-bash/commands/column/internal.js +2 -1
- package/dist/safe-bash/commands/column/internal.js.map +1 -1
- package/dist/safe-bash/commands/diff-patch/shared.js +2 -2
- package/dist/safe-bash/commands/diff-patch/shared.js.map +1 -1
- package/dist/safe-bash/commands/du/budget.d.ts.map +1 -1
- package/dist/safe-bash/commands/du/budget.js +3 -2
- package/dist/safe-bash/commands/du/budget.js.map +1 -1
- package/dist/safe-bash/commands/env-split.d.ts.map +1 -1
- package/dist/safe-bash/commands/env-split.js +2 -1
- package/dist/safe-bash/commands/env-split.js.map +1 -1
- package/dist/safe-bash/commands/expr/internal.d.ts.map +1 -1
- package/dist/safe-bash/commands/expr/internal.js +2 -1
- package/dist/safe-bash/commands/expr/internal.js.map +1 -1
- package/dist/safe-bash/commands/file/shared.d.ts.map +1 -1
- package/dist/safe-bash/commands/file/shared.js +3 -2
- package/dist/safe-bash/commands/file/shared.js.map +1 -1
- package/dist/safe-bash/commands/find.d.ts.map +1 -1
- package/dist/safe-bash/commands/find.js +12 -31
- package/dist/safe-bash/commands/find.js.map +1 -1
- package/dist/safe-bash/commands/html-to-markdown/budget.js +2 -2
- package/dist/safe-bash/commands/html-to-markdown/budget.js.map +1 -1
- package/dist/safe-bash/commands/metadata/internal.d.ts.map +1 -1
- package/dist/safe-bash/commands/metadata/internal.js +2 -1
- package/dist/safe-bash/commands/metadata/internal.js.map +1 -1
- package/dist/safe-bash/commands/move.d.ts.map +1 -1
- package/dist/safe-bash/commands/move.js +2 -1
- package/dist/safe-bash/commands/move.js.map +1 -1
- package/dist/safe-bash/commands/network/authorizer.d.ts +7 -0
- package/dist/safe-bash/commands/network/authorizer.d.ts.map +1 -0
- package/dist/safe-bash/commands/network/authorizer.js +48 -0
- package/dist/safe-bash/commands/network/authorizer.js.map +1 -0
- package/dist/safe-bash/commands/network/body.js +2 -2
- package/dist/safe-bash/commands/network/body.js.map +1 -1
- package/dist/safe-bash/commands/network/curl.js +2 -2
- package/dist/safe-bash/commands/network/curl.js.map +1 -1
- package/dist/safe-bash/commands/network/fetch-transport.d.ts +6 -0
- package/dist/safe-bash/commands/network/fetch-transport.d.ts.map +1 -0
- package/dist/safe-bash/commands/network/fetch-transport.js +80 -0
- package/dist/safe-bash/commands/network/fetch-transport.js.map +1 -0
- package/dist/safe-bash/commands/network/index.d.ts +2 -0
- package/dist/safe-bash/commands/network/index.d.ts.map +1 -1
- package/dist/safe-bash/commands/network/index.js +2 -0
- package/dist/safe-bash/commands/network/index.js.map +1 -1
- package/dist/safe-bash/commands/network/types.d.ts +1 -0
- package/dist/safe-bash/commands/network/types.d.ts.map +1 -1
- package/dist/safe-bash/commands/network/types.js +10 -0
- package/dist/safe-bash/commands/network/types.js.map +1 -1
- package/dist/safe-bash/commands/regex-execution/ere/limits.js +2 -2
- package/dist/safe-bash/commands/regex-execution/ere/limits.js.map +1 -1
- package/dist/safe-bash/commands/safejs/io.js +2 -2
- package/dist/safe-bash/commands/safejs/io.js.map +1 -1
- package/dist/safe-bash/commands/search/shared.js +2 -2
- package/dist/safe-bash/commands/search/shared.js.map +1 -1
- package/dist/safe-bash/commands/split/io.js +2 -2
- package/dist/safe-bash/commands/split/io.js.map +1 -1
- package/dist/safe-bash/commands/stream-format/shared.d.ts.map +1 -1
- package/dist/safe-bash/commands/stream-format/shared.js +2 -1
- package/dist/safe-bash/commands/stream-format/shared.js.map +1 -1
- package/dist/safe-bash/commands/stream-inspection/shared.d.ts.map +1 -1
- package/dist/safe-bash/commands/stream-inspection/shared.js +2 -1
- package/dist/safe-bash/commands/stream-inspection/shared.js.map +1 -1
- package/dist/safe-bash/commands/structured/limits.js +2 -2
- package/dist/safe-bash/commands/structured/limits.js.map +1 -1
- package/dist/safe-bash/commands/table-text/internal.d.ts.map +1 -1
- package/dist/safe-bash/commands/table-text/internal.js +2 -1
- package/dist/safe-bash/commands/table-text/internal.js.map +1 -1
- package/dist/safe-bash/commands/text-programs/shared.js +2 -2
- package/dist/safe-bash/commands/text-programs/shared.js.map +1 -1
- package/dist/safe-bash/commands/tree/io.js +2 -2
- package/dist/safe-bash/commands/tree/io.js.map +1 -1
- package/dist/safe-bash/contracts/yield.d.ts +13 -0
- package/dist/safe-bash/contracts/yield.d.ts.map +1 -0
- package/dist/safe-bash/contracts/yield.js +41 -0
- package/dist/safe-bash/contracts/yield.js.map +1 -0
- package/dist/safe-bash/shell/arithmetic.js +1 -1
- package/dist/safe-bash/shell/arithmetic.js.map +1 -1
- package/dist/safe-bash/shell/arrays/ledger.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/ledger.js +2 -9
- package/dist/safe-bash/shell/arrays/ledger.js.map +1 -1
- package/dist/safe-bash/shell/conditional.d.ts.map +1 -1
- package/dist/safe-bash/shell/conditional.js +2 -1
- package/dist/safe-bash/shell/conditional.js.map +1 -1
- package/dist/safe-bash/shell/env-warning.d.ts +2 -0
- package/dist/safe-bash/shell/env-warning.d.ts.map +1 -0
- package/dist/safe-bash/shell/env-warning.js +12 -0
- package/dist/safe-bash/shell/env-warning.js.map +1 -0
- package/dist/safe-bash/shell/index.d.ts +1 -0
- package/dist/safe-bash/shell/index.d.ts.map +1 -1
- package/dist/safe-bash/shell/index.js +1 -0
- package/dist/safe-bash/shell/index.js.map +1 -1
- package/dist/safe-bash/shell/input.d.ts.map +1 -1
- package/dist/safe-bash/shell/input.js +4 -3
- package/dist/safe-bash/shell/input.js.map +1 -1
- package/dist/safe-bash/shell/parser.d.ts.map +1 -1
- package/dist/safe-bash/shell/parser.js +15 -1
- package/dist/safe-bash/shell/parser.js.map +1 -1
- package/dist/safe-bash/shell/pattern.d.ts.map +1 -1
- package/dist/safe-bash/shell/pattern.js +3 -2
- package/dist/safe-bash/shell/pattern.js.map +1 -1
- package/dist/safe-bash/shell/runtime.d.ts +3 -2
- package/dist/safe-bash/shell/runtime.d.ts.map +1 -1
- package/dist/safe-bash/shell/runtime.js +57 -55
- package/dist/safe-bash/shell/runtime.js.map +1 -1
- package/dist/safe-bash/shell/shell.d.ts.map +1 -1
- package/dist/safe-bash/shell/shell.js +4 -1
- package/dist/safe-bash/shell/shell.js.map +1 -1
- package/dist/safe-bash/shell/types.d.ts +2 -0
- package/dist/safe-bash/shell/types.d.ts.map +1 -1
- package/dist/safe-bash/shell/types.js.map +1 -1
- package/dist/safe-bash/shell/worker-limits.d.ts +3 -0
- package/dist/safe-bash/shell/worker-limits.d.ts.map +1 -0
- package/dist/safe-bash/shell/worker-limits.js +14 -0
- package/dist/safe-bash/shell/worker-limits.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ These plugins are separate from `agentCommands()`; pass them to `shell.use(...)`
|
|
|
121
121
|
|
|
122
122
|
| Command | Plugin and configuration |
|
|
123
123
|
| --- | --- |
|
|
124
|
-
| `curl` | `networkCommands({ authorize, transport?, limits?, replace? })`: required authorization on every request, redirect, and retry.
|
|
124
|
+
| `curl` | `networkCommands({ authorize, transport?, limits?, replace? })`: required authorization on every request, redirect, and retry. Node uses the native HTTP transport; Workers can inject `createFetchTransport()`. `createOriginAuthorizer([...])` provides exact origin/hostname policy; its omitted allowlist is deliberately `*` (allow all). [Options and limits](src/commands/network/types.ts). |
|
|
125
125
|
| `node` | `nodeCommands({ runtime, limits?, replace? })`: runs JavaScript with an injected SafeJS runtime, virtual files, and shell streams. [Usage and supported subset](src/commands/node/README.md). |
|
|
126
126
|
| `safejs` | `safeJsCommands({ runtime, limits?, replace? })`: inject `run`, `createBudget`, `makeFsModule`, and `declareHostOperation` to execute programs. [Runtime contract](src/commands/safejs/types.ts). |
|
|
127
127
|
|
|
@@ -271,7 +271,7 @@ For SafeJS host integration, `makeSafeJsShellModule` exposes shell execution and
|
|
|
271
271
|
| --- | --- |
|
|
272
272
|
| `fs` | Required filesystem; no implicit host access. |
|
|
273
273
|
| `cwd` | Initial virtual directory; defaults to `/`. |
|
|
274
|
-
| `env` | Initial exported variables; defaults to an empty map, with `PWD` set from `cwd`. No host environment inheritance. |
|
|
274
|
+
| `env` | Initial exported variables; defaults to an empty map, with `PWD` set from `cwd`. No host environment inheritance. Never pass host `process.env` or any secret-bearing object: everything in `env` is readable by executed scripts (`env`, `printenv`, `$VAR`), and on Cloudflare Workers with `nodejs_compat` `process.env` contains the Worker's secret bindings. The shell logs a warning when it detects this. |
|
|
275
275
|
| `commands` | Existing `CommandRegistry`; defaults to an empty registry. |
|
|
276
276
|
| `limits` | Resource limits listed below. |
|
|
277
277
|
|
|
@@ -289,10 +289,19 @@ provided. Pass an `AbortSignal` as `signal` to cancel. [Option types](src/shell/
|
|
|
289
289
|
| `maxSourceBytes` | 1 MiB |
|
|
290
290
|
| `maxExpansionFields` | 10,000 |
|
|
291
291
|
| `maxExpansionBytes` | 16 MiB |
|
|
292
|
+
| `maxWallClockMs` | 30 seconds |
|
|
293
|
+
| `maxCpuMs` | 30 seconds, checked at command and cooperative-yield checkpoints |
|
|
292
294
|
| `pipeHighWaterMark` | 64 KiB |
|
|
293
295
|
|
|
294
296
|
Always call `dispose()` when finished. Shell failures normally produce an exit
|
|
295
297
|
code and stderr; limit violations, cancellation, and host failures can reject `exec()`.
|
|
298
|
+
For Cloudflare Workers, start with the exported `cloudflareWorkerLimits` profile
|
|
299
|
+
and configure command-family buffers at no more than 8 MiB. Create a separate
|
|
300
|
+
`Shell`, environment object, and quota-wrapped filesystem view for each tenant or
|
|
301
|
+
request. Never reuse tenant state across requests; import `withFileSystemQuota`
|
|
302
|
+
from `poe-code/safe-fs` to bound cumulative writes, including command-initiated
|
|
303
|
+
copies and streaming output. Admission control and rate limiting remain host
|
|
304
|
+
responsibilities.
|
|
296
305
|
|
|
297
306
|
### Command configuration
|
|
298
307
|
|
|
@@ -5,6 +5,11 @@ export * from "./fs/memory/index.js";
|
|
|
5
5
|
export * from "./fs/readonly/index.js";
|
|
6
6
|
export * from "./fs/mount/index.js";
|
|
7
7
|
export * from "./fs/overlay/index.js";
|
|
8
|
+
export { createFetchTransport } from "./commands/network/fetch-transport.js";
|
|
9
|
+
export type { FetchTransportOptions } from "./commands/network/fetch-transport.js";
|
|
10
|
+
export { createOriginAuthorizer } from "./commands/network/authorizer.js";
|
|
11
|
+
export type { OriginAllowlist, OriginAuthorizerOptions } from "./commands/network/authorizer.js";
|
|
12
|
+
export { cloudflareWorkerNetworkLimits } from "./commands/network/types.js";
|
|
8
13
|
export interface BrowserCommandsOptions {
|
|
9
14
|
readonly replace?: boolean;
|
|
10
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAOlF,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAOlF,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,YAAY,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AACjG,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAE5E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,IAAI,SAAS,iBAAiB,EAAE,CAKpE;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,kBAAkB,CAaxF"}
|