@poe-platform/safe-bash 0.1.809 → 0.1.810

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 (109) hide show
  1. package/dist/audio-ast/index.d.ts +1 -1
  2. package/dist/audio-ast/index.js +6 -0
  3. package/dist/audio-ast/wav-source.d.ts +7 -1
  4. package/dist/image-ast/index.js +1 -1
  5. package/dist/pdf-ast/cos/mutable-object-store.d.ts +3 -0
  6. package/dist/pdf-ast/cos/qpdf-json-document.d.ts +42 -0
  7. package/dist/pdf-ast/cos/qpdf-json-values.d.ts +7 -0
  8. package/dist/pdf-ast/index.d.ts +1 -0
  9. package/dist/pdf-ast/index.js +508 -37
  10. package/dist/pdf-ast/retained-document.d.ts +3 -1
  11. package/dist/safe-bash/chunks/{chunk-RQCK77SC.js → chunk-65TFMAZU.js} +2 -2
  12. package/dist/safe-bash/chunks/{chunk-SOFBGDXG.js → chunk-HHSOUC3Z.js} +32 -0
  13. package/dist/safe-bash/chunks/{chunk-WAZEELYB.js → chunk-ZA5FQ34E.js} +10 -5
  14. package/dist/safe-bash/command-chunks/biff-ORSHM4YX-QYPGRDAZ.js +4937 -0
  15. package/dist/safe-bash/command-chunks/{chunk-62ZAHKFS.js → chunk-2VCKUNDZ.js} +130 -14
  16. package/dist/safe-bash/command-chunks/{chunk-GLVD3JJG.js → chunk-BYZUOF6X.js} +2858 -2816
  17. package/dist/safe-bash/command-chunks/{chunk-6OKH4X67.js → chunk-CAXJ4RLF.js} +264 -1
  18. package/dist/safe-bash/command-chunks/{chunk-YJJBGN7U.js → chunk-CHR2OD2U.js} +9 -9
  19. package/dist/safe-bash/command-chunks/{chunk-D7XBUF76.js → chunk-D2ASPM7R.js} +109 -23
  20. package/dist/safe-bash/command-chunks/chunk-D5AYP2UM.js +816 -0
  21. package/dist/safe-bash/command-chunks/{chunk-WFDG3N5R.js → chunk-ECDEPKKW.js} +1 -1
  22. package/dist/safe-bash/command-chunks/{chunk-OQCJGUI6.js → chunk-HARUYHH7.js} +10 -10
  23. package/dist/safe-bash/command-chunks/{chunk-NVBUC644.js → chunk-HKGNBH7Z.js} +2 -2
  24. package/dist/safe-bash/command-chunks/chunk-MGBHGZEX.js +12 -0
  25. package/dist/safe-bash/command-chunks/{chunk-4557HE3J.js → chunk-PMWW7KSB.js} +161 -42
  26. package/dist/safe-bash/command-chunks/{chunk-JW3KIZU6.js → chunk-RUXY7GN5.js} +1 -1
  27. package/dist/safe-bash/command-chunks/{chunk-KELMIFVV.js → chunk-TI52LKLL.js} +1 -1
  28. package/dist/safe-bash/command-chunks/{chunk-JJQ72P3V.js → chunk-VCML4T5D.js} +1 -1
  29. package/dist/safe-bash/command-chunks/{chunk-5HGEXQVD.js → chunk-WC2OCF4H.js} +1 -1
  30. package/dist/safe-bash/command-chunks/chunk-WH3TIOTS.js +326 -0
  31. package/dist/safe-bash/command-chunks/{chunk-45FI2IPY.js → chunk-WQ6ABTJU.js} +3 -6
  32. package/dist/safe-bash/command-chunks/{chunk-NB7JO7FE.js → chunk-YTFWPJ3F.js} +1 -1
  33. package/dist/safe-bash/command-chunks/{chunk-GKYCV6BU.js → chunk-ZEPDT6I5.js} +482 -168
  34. package/dist/safe-bash/command-chunks/{command-engine-P5DFM4OU.js → command-engine-BEWABZ75.js} +10 -3
  35. package/dist/safe-bash/command-chunks/{engine-RU4OFLPO-CPLFYD67.js → engine-MEPOXIXT-WZMRHACG.js} +1 -1
  36. package/dist/safe-bash/command-chunks/pdf-LOZAXXS6-ERI57IAV.js +557 -0
  37. package/dist/safe-bash/commands/audio/index.browser.js +2 -14
  38. package/dist/safe-bash/commands/diff-patch/index.js +0 -2
  39. package/dist/safe-bash/commands/ffprobe/index.browser.js +2 -5
  40. package/dist/safe-bash/commands/pandoc/index.browser.js +3 -1
  41. package/dist/safe-bash/commands/text.js +10 -1
  42. package/dist/safe-bash/core.d.ts +2 -2
  43. package/dist/safe-bash/core.js +2 -2
  44. package/dist/safe-bash/full-core.browser.js +18 -22
  45. package/dist/safe-bash/lazy-optional.d.ts +9 -0
  46. package/dist/safe-bash/lazy-optional.js +24 -0
  47. package/dist/safe-bash/plugins/index.browser.js +5 -3
  48. package/dist/safe-bash/registry-entry.browser.js +1 -1
  49. package/dist/safe-bash-command-apply-patch/apply.js +2 -2
  50. package/dist/safe-bash-command-apply-patch/index.js +2 -2
  51. package/dist/safe-bash-command-apply-patch/parser.d.ts +20 -1
  52. package/dist/safe-bash-command-apply-patch/parser.js +1 -1
  53. package/dist/safe-bash-command-ffprobe/index.js +2 -1
  54. package/dist/safe-bash-command-ffprobe/media.js +2 -1
  55. package/dist/safe-bash-command-ffprobe/options.d.ts +15 -0
  56. package/dist/safe-bash-command-ffprobe/options.js +7 -0
  57. package/dist/safe-bash-command-media/index.js +2 -2
  58. package/dist/safe-bash-command-media/plugin.js +1 -1
  59. package/dist/safe-bash-command-media/remote.js +2 -2
  60. package/dist/safe-bash-command-pandoc/command.js +6 -6
  61. package/dist/safe-bash-command-pandoc/index.js +31 -31
  62. package/dist/safe-bash-command-patch/index.js +2 -2
  63. package/dist/safe-bash-command-patch/patch-publication.d.ts +2 -2
  64. package/dist/safe-bash-command-patch/patch-publication.js +1 -1
  65. package/dist/safe-bash-command-patch/patch.js +2 -2
  66. package/dist/safe-bash-command-pptx/engine.js +1 -1
  67. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  68. package/dist/safe-bash-command-xmllint/index.js +137 -30
  69. package/dist/safe-bash-compression-engine/bounded-codec.js +2 -2
  70. package/dist/safe-bash-compression-engine/codec-loader.js +1 -1
  71. package/dist/safe-bash-compression-engine/files.js +5 -5
  72. package/dist/safe-bash-compression-engine/index.js +4 -4
  73. package/dist/safe-bash-compression-engine/operand.js +5 -5
  74. package/dist/safe-bash-compression-engine/stream.js +4 -4
  75. package/dist/safe-bash-compression-engine/zstd-decode.js +3 -3
  76. package/dist/safe-bash-media-engine/imagemagick.d.ts +2 -0
  77. package/dist/safe-bash-media-engine/index.js +162 -72
  78. package/dist/safe-bash-network-engine/body.d.ts +1 -0
  79. package/dist/safe-bash-network-engine/body.js +1 -1
  80. package/dist/safe-bash-network-engine/transfer.js +11 -3
  81. package/dist/safe-bash-presentation-engine/command-placeholder.js +4 -3
  82. package/dist/safe-bash-presentation-engine/index.d.ts +1 -1
  83. package/dist/safe-bash-presentation-engine/index.js +9 -4
  84. package/dist/safe-bash-presentation-engine/presentation-model.js +3 -2
  85. package/dist/safe-bash-presentation-engine/retained-text.js +3 -3
  86. package/dist/safe-bash-presentation-engine/retained-xml-parts.d.ts +26 -0
  87. package/dist/safe-bash-presentation-engine/xml-parts.d.ts +1 -0
  88. package/dist/safe-bash-presentation-engine/xml-parts.js +7 -1
  89. package/dist/safe-bash-xml-engine/document.js +1 -1
  90. package/dist/safe-bash-xml-engine/index.js +1 -1
  91. package/dist/spreadsheet-engine/rendering/print/tab-layout.d.ts +11 -0
  92. package/dist/spreadsheet-engine/rendering/print/tab-layout.js +15 -0
  93. package/dist/spreadsheet-engine/rendering/print/text-lines.d.ts +2 -2
  94. package/dist/spreadsheet-engine/rendering/print/text-lines.js +3 -3
  95. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +4 -0
  96. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +137 -56
  97. package/dist/spreadsheet-format-xls/biff-encryption.d.ts +1 -1
  98. package/dist/spreadsheet-format-xls/biff-encryption.js +8 -3
  99. package/dist/spreadsheet-format-xls/biff-property-bytes.d.ts +1 -1
  100. package/dist/spreadsheet-format-xls/biff-property-bytes.js +2 -2
  101. package/dist/spreadsheet-format-xls/biff.js +11 -3
  102. package/package.json +3 -2
  103. package/dist/safe-bash/chunks/chunk-I2A5ZCPD.js +0 -17
  104. package/dist/safe-bash/chunks/chunk-PQTT2EZP.js +0 -8
  105. package/dist/safe-bash/command-chunks/biff-DS263V2K-2GP4GZT7.js +0 -4868
  106. package/dist/safe-bash/command-chunks/chunk-6ZFYWT3U.js +0 -581
  107. package/dist/safe-bash/command-chunks/chunk-S244SWDH.js +0 -153
  108. package/dist/safe-bash/command-chunks/pdf-T7AWYZGQ-KNAYJ7YF.js +0 -552
  109. /package/dist/safe-bash/command-chunks/{chunk-EMMSXKEJ.js → chunk-4Q4R3VZU.js} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  chunkBytes,
6
6
  stagingLimit,
7
7
  transform
8
- } from "./chunk-NVBUC644.js";
8
+ } from "./chunk-HKGNBH7Z.js";
9
9
  import {
10
10
  formats
11
11
  } from "./chunk-5AQAWIYK.js";
@@ -61,7 +61,7 @@ async function parse(text, work) {
61
61
  } };
62
62
  } }, work);
63
63
  }
64
- async function parseRecords(lines, work) {
64
+ async function parseRecords(lines, work, collections) {
65
65
  if (!lines.length || (await lines.get(0)).prefix !== "*** Begin Patch" || (await lines.get(lines.length - 1)).prefix !== "*** End Patch") throw new PatchError("expected Begin Patch and End Patch envelope", 2);
66
66
  const files = [];
67
67
  let index = 1;
@@ -87,8 +87,8 @@ async function parseRecords(lines, work) {
87
87
  destinationLabel = await (await lines.get(index++)).read(13);
88
88
  destination = await targetPath(destinationLabel, work);
89
89
  }
90
- const added = [];
91
- const hunks = [];
90
+ const added = collections?.texts() ?? [];
91
+ const hunks = collections?.hunks() ?? [];
92
92
  let current;
93
93
  let finished = false;
94
94
  while (index < lines.length - 1) {
@@ -97,7 +97,7 @@ async function parseRecords(lines, work) {
97
97
  if (line.prefix.startsWith("*** Add File: ") || line.prefix.startsWith("*** Delete File: ") || line.prefix.startsWith("*** Update File: ")) break;
98
98
  if (kind === "add") {
99
99
  if (!line.prefix.startsWith("+")) throw new PatchError(`invalid Add body at patch line ${index + 1}`, 2);
100
- added.push(line.slice(1));
100
+ await added.push(line.slice(1));
101
101
  } else if (kind === "delete") throw new PatchError("Delete cannot have a body", 2);
102
102
  else if (finished) throw new PatchError("EOF must terminate the file's last hunk", 2);
103
103
  else if (line.prefix === "@@" || line.prefix.startsWith("@@ ")) {
@@ -106,10 +106,10 @@ async function parseRecords(lines, work) {
106
106
  if (!named || current.anchors.length === 0) throw new PatchError("empty update hunk", 2);
107
107
  } else {
108
108
  work.count("maxHunks", 1);
109
- current = { anchors: [], lines: [], eof: false };
110
- hunks.push(current);
109
+ if (current) await hunks.push(current);
110
+ current = { anchors: collections?.texts() ?? [], lines: collections?.lines() ?? [], eof: false };
111
111
  }
112
- if (named) current.anchors.push(line.slice(3));
112
+ if (named) await current.anchors.push(line.slice(3));
113
113
  } else if (line.prefix === "*** End of File") {
114
114
  if (!current?.lines.length) throw new PatchError("EOF requires a nonempty hunk", 2);
115
115
  current.eof = true;
@@ -119,13 +119,13 @@ async function parseRecords(lines, work) {
119
119
  if (prefix !== " " && prefix !== "+" && prefix !== "-") throw new PatchError(`invalid hunk line ${index + 1}`, 2);
120
120
  if (!current) {
121
121
  work.count("maxHunks", 1);
122
- current = { anchors: [], lines: [], eof: false };
123
- hunks.push(current);
122
+ current = { anchors: collections?.texts() ?? [], lines: collections?.lines() ?? [], eof: false };
124
123
  }
125
- current.lines.push({ kind: prefix, text: line.slice(1) });
124
+ await current.lines.push({ kind: prefix, text: line.slice(1) });
126
125
  }
127
126
  index++;
128
127
  }
128
+ if (current) await hunks.push(current);
129
129
  if (kind === "update" && (hunks.length === 0 ? destination === void 0 : !current?.lines.length)) throw new PatchError("Update requires a nonempty hunk", 2);
130
130
  files.push({ kind, path, label, added, hunks, ...destination === void 0 ? {} : { destination, destinationLabel } });
131
131
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  zstdDecode
3
- } from "./chunk-KELMIFVV.js";
3
+ } from "./chunk-TI52LKLL.js";
4
4
  import {
5
5
  boundedCodec
6
- } from "./chunk-JW3KIZU6.js";
6
+ } from "./chunk-RUXY7GN5.js";
7
7
  import {
8
8
  gunzipMembers
9
9
  } from "./chunk-52DDLGBS.js";
@@ -0,0 +1,12 @@
1
+ // packages/safe-bash-command-ffprobe/src/options.ts
2
+ function resolveFfprobeLimits(options) {
3
+ const limits = { maxInputBytes: 32 * 1024 * 1024, maxOutputBytes: 1024 * 1024, ...options };
4
+ for (const value of [limits.maxInputBytes, limits.maxOutputBytes]) {
5
+ if (value !== void 0 && (!Number.isSafeInteger(value) || value < 1)) throw new RangeError("Invalid ffprobe limit");
6
+ }
7
+ return limits;
8
+ }
9
+
10
+ export {
11
+ resolveFfprobeLimits
12
+ };
@@ -20,9 +20,83 @@ import {
20
20
  import { readFileStream } from "../../safe-bash-contracts/filesystem.js";
21
21
  import { readBytes } from "../../safe-bash-contracts/index.js";
22
22
  import { posixPath as posix } from "../../safe-bash-contracts/path.js";
23
- import { yieldTurn } from "../../safe-bash-contracts/yield.js";
23
+ import { inheritYieldCheckpoint, yieldTurn as yieldTurn2 } from "../../safe-bash-contracts/yield.js";
24
24
  import { decodeBytes, encodeBytes } from "../../safe-bash-io-engine/byte-encoding.js";
25
25
  import { pathOf } from "../../safe-bash-io-engine/internal.js";
26
+
27
+ // packages/safe-bash-network-engine/src/replay.ts
28
+ import { FsError } from "../../safe-bash-contracts/index.js";
29
+ import { yieldTurn } from "../../safe-bash-contracts/yield.js";
30
+ function verify(actual, expected) {
31
+ const identity = expected.opaqueIdentity !== void 0 ? actual.opaqueIdentity === expected.opaqueIdentity : expected.dev !== void 0 && expected.ino !== void 0 && actual.dev === expected.dev && actual.ino === expected.ino;
32
+ if (!identity || expected.identityScope === void 0 || actual.identityScope !== expected.identityScope || actual.type !== "file" || actual.size !== expected.size || actual.revision !== expected.revision || actual.opaqueVersion !== expected.opaqueVersion || actual.mtimeMs !== expected.mtimeMs || actual.ctimeMs !== expected.ctimeMs)
33
+ throw new FsError("EBUSY", { message: "Upload replay storage changed" });
34
+ }
35
+ async function createReplay(fs, directory, signal) {
36
+ const parent = await fs.stat(directory, { signal });
37
+ const caps = await fs.capabilitiesFor?.(directory, { signal }) ?? fs.capabilities;
38
+ if (!caps.retainedStagingCleanup || !caps.retainedStagingWrite || !caps.retainedRead || !fs.createStagedFile || !fs.openReadFile)
39
+ throw new FsError("ENOTSUP", { message: "Upload replay requires retained caller storage" });
40
+ const name = Array.from(randomBytes(18), (byte) => byte.toString(16).padStart(2, "0")).join("");
41
+ const stage = await fs.createStagedFile(`${directory === "/" ? "" : directory}/.curl-replay-${name}`, "upload", { type: "file", data: new Uint8Array() }, { parent, mode: 384, retainCleanup: true, signal });
42
+ const { writer, cleanup } = stage;
43
+ if (!writer || !cleanup) {
44
+ try {
45
+ await cleanup?.remove();
46
+ } finally {
47
+ await cleanup?.close();
48
+ }
49
+ throw new FsError("EIO", { message: "Missing retained upload handles" });
50
+ }
51
+ let size = 0;
52
+ let sealed;
53
+ let reader;
54
+ let closing;
55
+ return {
56
+ async write(bytes) {
57
+ for (let offset = 0; offset < bytes.length; offset += 16384) {
58
+ const chunk = bytes.slice(offset, offset + 16384);
59
+ await writer.write(chunk, { signal });
60
+ size += chunk.length;
61
+ }
62
+ },
63
+ async *read(replaySignal) {
64
+ replaySignal.throwIfAborted();
65
+ sealed ??= await writer.finish({ signal: replaySignal });
66
+ if (sealed.size !== size) throw new FsError("EIO", { message: "Incomplete upload replay storage" });
67
+ reader ??= await fs.openReadFile(stage.file.path, { signal: replaySignal });
68
+ verify(await reader.stat({ signal: replaySignal }), sealed);
69
+ let chunks = 0;
70
+ for (let position = 0; position < size; ) {
71
+ if (++chunks % 256 === 0) await yieldTurn(replaySignal);
72
+ replaySignal.throwIfAborted();
73
+ verify(await reader.stat({ signal: replaySignal }), sealed);
74
+ const count = Math.min(16384, size - position);
75
+ const bytes = await reader.read(position, count, { signal: replaySignal });
76
+ if (!bytes.length || bytes.length > count) throw new FsError("EIO", { message: "Invalid upload replay read" });
77
+ verify(await reader.stat({ signal: replaySignal }), sealed);
78
+ position += bytes.length;
79
+ yield bytes.slice();
80
+ }
81
+ },
82
+ close() {
83
+ closing ??= (async () => {
84
+ try {
85
+ await reader?.close();
86
+ } finally {
87
+ try {
88
+ await cleanup.remove();
89
+ } finally {
90
+ await cleanup.close();
91
+ }
92
+ }
93
+ })();
94
+ return closing;
95
+ }
96
+ };
97
+ }
98
+
99
+ // packages/safe-bash-network-engine/src/body.ts
26
100
  function multipartBoundary() {
27
101
  let boundary = "virtual-bash-";
28
102
  for (const byte of randomBytes(18)) boundary += byte.toString(16).padStart(2, "0");
@@ -214,7 +288,7 @@ async function* transfer(source, encoder, signal) {
214
288
  yield encode(output);
215
289
  output = "";
216
290
  }
217
- await yieldTurn(signal);
291
+ await yieldTurn2(signal);
218
292
  }
219
293
  }
220
294
  signal.throwIfAborted();
@@ -251,8 +325,12 @@ function createBody(context, args, limits) {
251
325
  let opened = false;
252
326
  let replayComplete = false;
253
327
  let replayable = true;
254
- let cachedBytes = 0;
255
- let cache = [];
328
+ let replay;
329
+ let active = false;
330
+ let activeIterator;
331
+ const lifetime = new AbortController();
332
+ let closing;
333
+ let closed = false;
256
334
  let stdinUsed = false;
257
335
  const source = async function* (part, signal) {
258
336
  if (part.bytes !== void 0) {
@@ -303,51 +381,90 @@ function createBody(context, args, limits) {
303
381
  };
304
382
  return {
305
383
  ...contentType === void 0 ? {} : { contentType },
384
+ close() {
385
+ closed = true;
386
+ lifetime.abort();
387
+ closing ??= (async () => {
388
+ try {
389
+ await activeIterator?.return(void 0);
390
+ } finally {
391
+ await replay?.close();
392
+ }
393
+ })();
394
+ return closing;
395
+ },
306
396
  open(signal) {
307
- return (async function* () {
308
- if (hasStdin && opened) {
309
- if (!replayComplete || !replayable) throw new CurlError(65, "Cannot replay stdin upload within the host buffer limit");
310
- for (const chunk of cache) {
311
- signal.throwIfAborted();
312
- yield chunk.slice();
397
+ const combined = AbortSignal.any([signal, lifetime.signal]);
398
+ inheritYieldCheckpoint(signal, combined);
399
+ signal = combined;
400
+ async function* generate() {
401
+ signal.throwIfAborted();
402
+ if (closed || active) throw new CurlError(65, "Upload body is closed or in use");
403
+ active = true;
404
+ activeIterator = iterator;
405
+ try {
406
+ if (hasStdin && opened) {
407
+ if (!replayComplete || !replayable || !replay) throw new CurlError(65, "Cannot replay stdin upload from caller storage");
408
+ try {
409
+ yield* replay.read(signal);
410
+ } catch {
411
+ replayable = false;
412
+ signal.throwIfAborted();
413
+ throw new CurlError(65, "Failed reading stdin replay storage");
414
+ }
415
+ return;
313
416
  }
314
- return;
315
- }
316
- opened = true;
317
- let count = 0;
318
- let chunks = 0;
319
- for (const part of parts) {
320
- if (part.separator && count === 0) continue;
321
- let prefix = part.prefix;
322
- for await (const raw of transfer(source(part, signal), part.encoder, signal)) {
323
- if (++chunks % 256 === 0) await yieldTurn(signal);
324
- for (let offset = 0; offset < raw.length; offset += 16 * 1024) {
417
+ opened = true;
418
+ if (hasStdin) {
419
+ try {
420
+ replay = await createReplay(context.fs, context.cwd, signal);
421
+ } catch {
325
422
  signal.throwIfAborted();
326
- let chunk = raw.subarray(offset, offset + 16 * 1024);
327
- if (part.strip) chunk = chunk.filter((byte) => byte !== 0 && byte !== 10 && byte !== 13);
328
- if (part.urlencode) chunk = percent(chunk);
329
- count += chunk.length + (prefix?.length ?? 0);
330
- if (count > limits.maxUploadBytes) throw new CurlError(63, "Upload exceeds host byte limit");
331
- if (prefix?.length) {
332
- const prefixed = new Uint8Array(prefix.length + chunk.length);
333
- prefixed.set(prefix);
334
- prefixed.set(chunk, prefix.length);
335
- chunk = prefixed;
336
- prefix = void 0;
337
- }
338
- if (hasStdin && replayable) {
339
- cachedBytes += chunk.length;
340
- if (cachedBytes > limits.maxBufferBytes) {
341
- replayable = false;
342
- cache = [];
343
- } else cache.push(new Uint8Array(chunk));
423
+ replayable = false;
424
+ }
425
+ }
426
+ let count = 0;
427
+ let chunks = 0;
428
+ for (const part of parts) {
429
+ if (part.separator && count === 0) continue;
430
+ let prefix = part.prefix;
431
+ for await (const raw of transfer(source(part, signal), part.encoder, signal)) {
432
+ if (++chunks % 256 === 0) await yieldTurn2(signal);
433
+ for (let offset = 0; offset < raw.length; offset += 16 * 1024) {
434
+ signal.throwIfAborted();
435
+ let chunk = raw.subarray(offset, offset + 16 * 1024);
436
+ if (part.strip) chunk = chunk.filter((byte) => byte !== 0 && byte !== 10 && byte !== 13);
437
+ if (part.urlencode) chunk = percent(chunk);
438
+ count += chunk.length + (prefix?.length ?? 0);
439
+ if (count > limits.maxUploadBytes) throw new CurlError(63, "Upload exceeds host byte limit");
440
+ if (prefix?.length) {
441
+ const prefixed = new Uint8Array(prefix.length + chunk.length);
442
+ prefixed.set(prefix);
443
+ prefixed.set(chunk, prefix.length);
444
+ chunk = prefixed;
445
+ prefix = void 0;
446
+ }
447
+ if (hasStdin && replayable) {
448
+ try {
449
+ await replay.write(chunk);
450
+ } catch {
451
+ signal.throwIfAborted();
452
+ replayable = false;
453
+ await replay.close();
454
+ }
455
+ }
456
+ if (chunk.length) yield chunk;
344
457
  }
345
- if (chunk.length) yield chunk;
346
458
  }
347
459
  }
460
+ replayComplete = true;
461
+ } finally {
462
+ active = false;
463
+ activeIterator = void 0;
348
464
  }
349
- replayComplete = true;
350
- })();
465
+ }
466
+ const iterator = generate();
467
+ return iterator;
351
468
  }
352
469
  };
353
470
  }
@@ -358,6 +475,8 @@ async function queryData(body, signal, limits) {
358
475
  signal.throwIfAborted();
359
476
  if (error instanceof CurlError) throw error;
360
477
  throw new CurlError(63, "Query data exceeds host buffer limit");
478
+ } finally {
479
+ await body.close();
361
480
  }
362
481
  }
363
482
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCodec
3
- } from "./chunk-EMMSXKEJ.js";
3
+ } from "./chunk-4Q4R3VZU.js";
4
4
  import {
5
5
  CompressedDataError
6
6
  } from "./chunk-V7IP2PFT.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  boundedCodec
3
- } from "./chunk-JW3KIZU6.js";
3
+ } from "./chunk-RUXY7GN5.js";
4
4
  import {
5
5
  gunzipMember
6
6
  } from "./chunk-52DDLGBS.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-7WIC7SFR.js";
7
7
  import {
8
8
  mediaCommands
9
- } from "./chunk-45FI2IPY.js";
9
+ } from "./chunk-WQ6ABTJU.js";
10
10
 
11
11
  // packages/safe-bash-command-media/src/remote.ts
12
12
  import { readBytes } from "@poe-platform/safe-fs/core";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Presentation
3
- } from "./chunk-NB7JO7FE.js";
3
+ } from "./chunk-YTFWPJ3F.js";
4
4
  import {
5
5
  SlidePlaceholder
6
6
  } from "./chunk-YUVH6CE4.js";