@poe-platform/safe-bash 0.1.745 → 0.1.747

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 (59) hide show
  1. package/README.md +5 -1
  2. package/dist/image-ast/browser/sharp.d.ts +1 -1
  3. package/dist/image-ast/index.js +133 -35
  4. package/dist/image-ast/sharp.d.ts +1 -1
  5. package/dist/safe-bash/chunks/{chunk-2F7Q532M.js → chunk-4GK4FAT6.js} +3 -3
  6. package/dist/safe-bash/chunks/{chunk-EAUCLWEZ.js → chunk-55AGFLG5.js} +540 -284
  7. package/dist/safe-bash/chunks/{chunk-WCNFCN2G.js → chunk-BS6QFRNX.js} +2 -2
  8. package/dist/safe-bash/chunks/{chunk-IZZ7KX4E.js → chunk-JCXAGOEK.js} +40 -3
  9. package/dist/safe-bash/chunks/{chunk-I3DOFJSJ.js → chunk-MUWJPSGN.js} +2 -2
  10. package/dist/safe-bash/chunks/{chunk-7RP6WOWK.js → chunk-OF2PDE3W.js} +2 -2
  11. package/dist/safe-bash/chunks/{src-FTMTU65U.js → src-T672TQJC.js} +2 -2
  12. package/dist/safe-bash/command-chunks/{chunk-DRCPJVZF.js → chunk-44N2IRVP.js} +17 -5
  13. package/dist/safe-bash/command-chunks/{chunk-LYKC7WJB.js → chunk-6742OVAC.js} +37 -3
  14. package/dist/safe-bash/command-chunks/{chunk-BMBXSLVX.js → chunk-6QU5OLPJ.js} +2 -2
  15. package/dist/safe-bash/command-chunks/{chunk-YHANNN7I.js → chunk-S3BO2NJT.js} +7 -0
  16. package/dist/safe-bash/commands/basic.d.ts +2 -0
  17. package/dist/safe-bash/commands/basic.js +236 -9
  18. package/dist/safe-bash/commands/pr/index.browser.js +1 -1
  19. package/dist/safe-bash/commands/streams.js +9 -56
  20. package/dist/safe-bash/commands/table-text/index.js +5 -1
  21. package/dist/safe-bash/commands/text.js +13 -2
  22. package/dist/safe-bash/commands/time-env/shared.js +2 -2
  23. package/dist/safe-bash/commands/time-env/sleep.js +6 -4
  24. package/dist/safe-bash/commands/timeout/index.d.ts +7 -0
  25. package/dist/safe-bash/commands/timeout/index.js +52 -32
  26. package/dist/safe-bash/commands/timeout/scheduler.js +7 -6
  27. package/dist/safe-bash/core.browser.js +2698 -543
  28. package/dist/safe-bash/opt-in/commands/shuf/random.js +2 -3
  29. package/dist/safe-bash/opt-in/shell/extensions/read/index.js +1 -1
  30. package/dist/safe-bash/opt-in/shell/extensions/trap/index.d.ts +1 -2
  31. package/dist/safe-bash/opt-in/shell/extensions/trap/index.js +1 -8
  32. package/dist/safe-bash/playwright/adapter.d.ts +2 -0
  33. package/dist/safe-bash/playwright/private-target-transport.d.ts +1 -0
  34. package/dist/safe-bash/playwright/private-target-transport.js +21 -21
  35. package/dist/safe-bash/shell/runtime.d.ts +20 -1
  36. package/dist/safe-bash/shell/runtime.js +3021 -532
  37. package/dist/safe-bash/shell/sync-jq-expression.d.ts +6 -0
  38. package/dist/safe-bash/shell/sync-jq-expression.js +46 -0
  39. package/dist/safe-bash-command-cal/index.js +32 -12
  40. package/dist/safe-bash-command-hostname/index.js +22 -7
  41. package/dist/safe-bash-command-id/index.js +28 -9
  42. package/dist/safe-bash-command-pandoc/command.js +1 -1
  43. package/dist/safe-bash-command-pandoc/index.js +1 -1
  44. package/dist/safe-bash-command-ssconvert/command.d.ts +2 -2
  45. package/dist/safe-bash-command-ssconvert/contracts.d.ts +4 -0
  46. package/dist/safe-bash-command-ssconvert/engine.d.ts +2 -2
  47. package/dist/safe-bash-command-ssconvert/index.js +524 -276
  48. package/dist/safe-bash-command-whoami/index.js +26 -12
  49. package/dist/safe-bash-query-engine/index.js +3 -3
  50. package/dist/safe-bash-query-engine/interpreter.js +1 -1
  51. package/dist/safe-bash-query-engine/parser.js +1 -1
  52. package/dist/safe-bash-query-engine/query-core.js +3 -3
  53. package/dist/safe-playwright-cloudflare/browser-private-transport.js +8 -13
  54. package/dist/safe-playwright-cloudflare/browser-storage-control.js +13 -4
  55. package/dist/safe-playwright-cloudflare/browser-trace-archive.js +1 -1
  56. package/package.json +18 -14
  57. package/dist/image-ast/streams/node.d.ts +0 -10
  58. package/dist/image-ast/streams/node.js +0 -5
  59. package/dist/image-ast/streams/web.js +0 -94
package/README.md CHANGED
@@ -160,7 +160,7 @@ and other unsupported options remain unavailable.
160
160
 
161
161
  `printf` returns status 1 for invalid formats and options, retaining any output written before a format error. Its Bash format dialect accepts zero flags on string conversions and rejects numbered conversions such as `%1$s`; the grouping flag is accepted without locale-specific separators.
162
162
 
163
- `uniq INPUT OUTPUT` refuses aliases of the input, including symbolic and hard links, before opening the output. An existing output also requires the filesystem to establish that the files are distinct. `cut` accepts space/tab separators and padding in range lists, rejects empty comma items, and retains `--output-delimiter` between adjacent byte or character ranges. `chmod -r` removes read permissions; `--reference=FILE` copies a file's mode.
163
+ `uniq -s` and `uniq -w` count Unicode code points in valid UTF-8 records; invalid UTF-8 records retain byte comparisons. `uniq INPUT OUTPUT` refuses aliases of the input, including symbolic and hard links, before opening the output. An existing output also requires the filesystem to establish that the files are distinct. `cut` accepts space/tab separators and padding in range lists, rejects empty comma items, and retains `--output-delimiter` between adjacent byte or character ranges. `chmod -r` removes read permissions; `--reference=FILE` copies a file's mode.
164
164
 
165
165
  `cp -l` / `--link` creates hard links to source files; `cp -s` / `--symbolic-link` creates symbolic links using the source operand as the literal target. Relative symbolic targets require destinations in the current directory; use absolute source paths when copying into other directories. Link modes require filesystem link capabilities and support recursive copying, no-clobber and backups. `cp -x` / `--one-file-system` creates directories at known filesystem boundaries without copying their contents; unknown filesystem identities remain traversable.
166
166
 
@@ -626,6 +626,10 @@ nested command dispatch, and `regex` worker limits. Per-family options are
626
626
  `text`, `structured`, `search`, `diffPatch`, `metadata`, `archive`, `tableText`,
627
627
  `streamInspection`, `streamFormat`, `split`, `timeEnv`, `tree`, `file`, `column`,
628
628
  `htmlToMarkdown`, `du`, `expr`, `which`, `timeout`, and `applyPatch`.
629
+ `timeout.limits` bounds argument count, argument bytes, and timeout's own output
630
+ through `maxArguments`, `maxArgumentBytes`, and `maxOutputBytes`.
631
+ `timeEnv.maxTimerMilliseconds` and `timeout.maxTimerMilliseconds` accept `Infinity`;
632
+ host timer calls remain capped at 2147483647 ms and progress with frozen clocks.
629
633
  Use the [typed options and linked family interfaces](src/plugins/index.ts) for
630
634
  their individual limits and hooks, including clocks and schedulers. Family budgets
631
635
  are separate from shell counters; `limits.commandLimits.archive` supplies
@@ -1,4 +1,4 @@
1
- import { Duplex } from "#image-ast-streams";
1
+ import { Duplex } from "./streams/web.js";
2
2
  import { type ColorInput, type CompositeLayer, type ImageAstNode, type ImageFormat, type ImageMetadata, type ImageStats, type OutputInfo, type ResizeOptions, type SharpInputOptions } from "./ast.js";
3
3
  export declare class SharpInstance extends Duplex {
4
4
  private inputBytes;
@@ -28156,50 +28156,148 @@ function erodeImage(img, width = 1) {
28156
28156
  };
28157
28157
  }
28158
28158
 
28159
- // src/streams/node.ts
28160
- import { Buffer } from "node:buffer";
28161
- import { EventEmitter } from "node:events";
28162
- import { Duplex } from "node:stream";
28163
- var outputBytes = Buffer.from;
28164
- var isBuffer = Buffer.isBuffer;
28165
-
28166
- // ../safe-fs/dist/platform/node.js
28167
- import { AsyncLocalStorage } from "node:async_hooks";
28168
- import { randomUUID } from "node:crypto";
28169
- import * as util from "node:util";
28170
- import { constants } from "node:os";
28171
- var systemErrnos = (() => {
28172
- const fallback = new Map(Object.entries(constants.errno).map(([name, errno]) => [name, -Math.abs(errno)]));
28173
- if (typeof util.getSystemErrorMap !== "function")
28174
- return fallback;
28175
- try {
28176
- return new Map([...util.getSystemErrorMap()].map(([errno, [name]]) => [name, errno]));
28177
- } catch {
28178
- return fallback;
28159
+ // src/streams/web.ts
28160
+ var outputBytes = Uint8Array.from.bind(Uint8Array);
28161
+ var isBuffer = (_input) => false;
28162
+ var EventEmitter = class {
28163
+ listeners = /* @__PURE__ */ new Map();
28164
+ on(event, listener) {
28165
+ let listeners = this.listeners.get(event);
28166
+ if (!listeners) this.listeners.set(event, listeners = /* @__PURE__ */ new Set());
28167
+ listeners.add(listener);
28168
+ return this;
28179
28169
  }
28180
- })();
28181
- var negotiating = new AsyncLocalStorage();
28170
+ once(event, listener) {
28171
+ const once = (...args) => {
28172
+ this.removeListener(event, once);
28173
+ listener(...args);
28174
+ };
28175
+ return this.on(event, once);
28176
+ }
28177
+ removeListener(event, listener) {
28178
+ this.listeners.get(event)?.delete(listener);
28179
+ return this;
28180
+ }
28181
+ emit(event, ...args) {
28182
+ const listeners = [...this.listeners.get(event) ?? []];
28183
+ for (const listener of listeners) listener(...args);
28184
+ return listeners.length > 0;
28185
+ }
28186
+ };
28187
+ var Duplex = class extends EventEmitter {
28188
+ readable;
28189
+ writable;
28190
+ writableFinished = false;
28191
+ controller;
28192
+ closed = false;
28193
+ constructor() {
28194
+ super();
28195
+ this.readable = new ReadableStream({
28196
+ start: (controller) => {
28197
+ this.controller = controller;
28198
+ },
28199
+ pull: () => {
28200
+ this._read();
28201
+ },
28202
+ cancel: (reason) => {
28203
+ this.destroy(reason instanceof Error ? reason : void 0);
28204
+ }
28205
+ }, { highWaterMark: 0 });
28206
+ this.writable = new WritableStream({
28207
+ write: (chunk) => new Promise((resolve, reject) => {
28208
+ this._write(chunk, "utf8", (error) => {
28209
+ if (error) {
28210
+ this.destroy(error);
28211
+ reject(error);
28212
+ } else resolve();
28213
+ });
28214
+ }),
28215
+ close: () => {
28216
+ this.writableFinished = true;
28217
+ this.emit("finish");
28218
+ },
28219
+ abort: (reason) => {
28220
+ this.destroy(reason instanceof Error ? reason : void 0);
28221
+ }
28222
+ });
28223
+ }
28224
+ _write(_chunk, _encoding, callback) {
28225
+ callback(new Error("Writable operation is not implemented"));
28226
+ }
28227
+ _read() {
28228
+ throw new Error("Readable operation is not implemented");
28229
+ }
28230
+ push(chunk) {
28231
+ if (this.closed) return false;
28232
+ if (chunk === null) {
28233
+ this.closed = true;
28234
+ this.controller.close();
28235
+ } else this.controller.enqueue(new Uint8Array(chunk));
28236
+ return (this.controller.desiredSize ?? 0) > 0;
28237
+ }
28238
+ destroy(error) {
28239
+ if (!this.closed) {
28240
+ this.closed = true;
28241
+ this.controller.error(error ?? new Error("Stream cancelled"));
28242
+ this.emit("error", error ?? new Error("Stream cancelled"));
28243
+ }
28244
+ return this;
28245
+ }
28246
+ async *[Symbol.asyncIterator]() {
28247
+ const reader = this.readable.getReader();
28248
+ try {
28249
+ while (true) {
28250
+ const result = await reader.read();
28251
+ if (result.done) return;
28252
+ yield result.value;
28253
+ }
28254
+ } finally {
28255
+ await reader.cancel();
28256
+ reader.releaseLock();
28257
+ }
28258
+ }
28259
+ };
28260
+
28261
+ // ../safe-fs/dist/platform/browser.js
28182
28262
  var platform = Object.freeze({
28183
- nativeFileSystem: Object.freeze({ open: true, permissions: true, timestamps: true, conditionalChmod: true, trustedOwnedStaging: true, atomicRename: true }),
28263
+ nativeFileSystem: Object.freeze({ open: false, permissions: false, timestamps: false, conditionalChmod: false, trustedOwnedStaging: false, atomicRename: false }),
28184
28264
  maxCollectionBytes: Infinity,
28185
- errno(code) {
28186
- const errno = systemErrnos.get(code === "EOPNOTSUPP" ? "ENOTSUP" : code);
28187
- if (errno === void 0)
28188
- throw new TypeError(`Unsupported platform errno code: ${code}`);
28189
- return errno;
28265
+ errno(_code) {
28266
+ return void 0;
28190
28267
  },
28191
- callbackAuthorities: true,
28192
- randomUUID
28268
+ callbackAuthorities: false,
28269
+ randomUUID() {
28270
+ const crypto = globalThis.crypto;
28271
+ if (typeof crypto?.randomUUID === "function")
28272
+ return crypto.randomUUID();
28273
+ if (typeof crypto?.getRandomValues !== "function") {
28274
+ throw new FsError("ENOTSUP", { message: "secure crypto is required for overlay staging" });
28275
+ }
28276
+ const bytes = crypto.getRandomValues(new Uint8Array(16));
28277
+ bytes[6] = bytes[6] & 15 | 64;
28278
+ bytes[8] = bytes[8] & 63 | 128;
28279
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
28280
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
28281
+ }
28193
28282
  });
28283
+ var operationKey = /* @__PURE__ */ Symbol("filesystem-comparison");
28284
+ var contexts = /* @__PURE__ */ new WeakSet();
28194
28285
  var comparisonContext = Object.freeze({
28195
- active(_options) {
28196
- return negotiating.getStore() === true;
28286
+ active(options) {
28287
+ const context = options[operationKey];
28288
+ return context !== void 0 && contexts.has(context);
28197
28289
  },
28198
- run(options, action) {
28199
- return negotiating.run(true, () => action(options));
28290
+ async run(options, action) {
28291
+ const context = Object.freeze({});
28292
+ contexts.add(context);
28293
+ const nested = { ...options, [operationKey]: context };
28294
+ try {
28295
+ return await action(nested);
28296
+ } finally {
28297
+ contexts.delete(context);
28298
+ }
28200
28299
  }
28201
28300
  });
28202
- var transportBudgets = new AsyncLocalStorage();
28203
28301
 
28204
28302
  // ../safe-fs/dist/contracts/errors.js
28205
28303
  var descriptions = {
@@ -1,4 +1,4 @@
1
- import { Duplex } from "#image-ast-streams";
1
+ import { Duplex } from "./streams/web.js";
2
2
  import { type ColorInput, type CompositeLayer, type ImageAstNode, type ImageFormat, type ImageMetadata, type ImageStats, type OutputInfo, type ResizeOptions, type SharpInputOptions } from "./ast.js";
3
3
  export declare class SharpInstance extends Duplex {
4
4
  private inputBytes;
@@ -1438,8 +1438,8 @@ function settings2(options) {
1438
1438
  if (value !== Infinity && (!Number.isSafeInteger(value) || value < 1)) throw new RangeError(`Invalid time-env limit: ${name}`);
1439
1439
  }
1440
1440
  const maxTimerMilliseconds = options.maxTimerMilliseconds ?? 2147483647;
1441
- if (!Number.isInteger(maxTimerMilliseconds) || maxTimerMilliseconds < 1 || maxTimerMilliseconds > 2147483647) {
1442
- throw new RangeError("maxTimerMilliseconds must be between1 and2147483647");
1441
+ if (maxTimerMilliseconds !== Infinity && (!Number.isInteger(maxTimerMilliseconds) || maxTimerMilliseconds < 1 || maxTimerMilliseconds > 2147483647)) {
1442
+ throw new RangeError("maxTimerMilliseconds must be between 1 and 2147483647 or Infinity");
1443
1443
  }
1444
1444
  const scheduler = options.scheduler ?? {
1445
1445
  now: () => performance.now(),
@@ -2079,4 +2079,4 @@ export {
2079
2079
  createPrCommands,
2080
2080
  prCommands
2081
2081
  };
2082
- //# sourceMappingURL=chunk-2F7Q532M.js.map
2082
+ //# sourceMappingURL=chunk-4GK4FAT6.js.map