@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
@@ -1,4 +1,4 @@
1
- export { probeWavSource, type AudioProbeSource } from "./wav-source.js";
1
+ export { probeWavSource, type AudioProbeSource, type WavTagSpan } from "./wav-source.js";
2
2
  export * from "./types.js";
3
3
  export { decodePcm, encodeWav } from "./wav.js";
4
4
  export * from "./dsp.js";
@@ -328,6 +328,12 @@ async function probeWavSource(source, options = {}) {
328
328
  for (let pos = start + 4; pos < start + size; ) {
329
329
  const info = await read(pos, 8), id = info.text(0, 4), length = info.u32(4, true);
330
330
  if (length > start + size - pos - 8) throw new Error("WAV INFO exceeds LIST bounds");
331
+ if (options.onTag) {
332
+ await options.onTag({ key: infoNames[id] ?? id, offset: pos + 8, length });
333
+ options.signal?.throwIfAborted();
334
+ pos += 8 + length + length % 2;
335
+ continue;
336
+ }
331
337
  const decoder = new TextDecoder();
332
338
  let text2 = "", ended = false;
333
339
  for (let index = 0; index < length; index += 16384) {
@@ -4,7 +4,13 @@ export interface AudioProbeSource {
4
4
  readonly size: number;
5
5
  read(offset: number, length: number): Promise<Uint8Array>;
6
6
  }
7
- /** Skip sample/unknown payloads and AST nodes. Tag strings remain an explicit metadata model. */
7
+ export interface WavTagSpan {
8
+ readonly key: string;
9
+ readonly offset: number;
10
+ readonly length: number;
11
+ }
12
+ /** Skip sample/unknown payloads and AST nodes. onTag exposes spans instead of materialized tag strings. */
8
13
  export declare function probeWavSource(source: AudioProbeSource, options?: {
9
14
  signal?: AbortSignal;
15
+ onTag?: (span: WavTagSpan) => Promise<void>;
10
16
  }): Promise<Omit<AudioAst, "data" | "nodes" | "pictures">>;
@@ -1762,7 +1762,7 @@ async function openPdfImage(source, fs, directory, signal, options, storage) {
1762
1762
  if (failure) throw failure.error;
1763
1763
  };
1764
1764
  try {
1765
- document = await PdfRetainedDocument.open(retained, { fs, directory }, { signal, recovery: "repair", chunkBytes: 16384, maxNodes: 1 / 0, maxTokenBytes: 1 / 0, maxRecursionDepth: 1 / 0, maxPageTreeDepth: 1 / 0, xref: { arrayStorage: values, storedArrayKeys: ["Index"] }, valueArrays: { stringStorage: values, storedStringKeys: ["ActualText"], arrayStorage: values, storedArrayKeys: ["Widths", "W", "Differences", "ON", "OFF", "OCGs"], storedArrayPaths: [["ExtGState", "*", "D"]] } });
1765
+ document = await PdfRetainedDocument.open(retained, { fs, directory }, { signal, recovery: "repair", chunkBytes: 16384, maxNodes: 1 / 0, maxTokenBytes: 1 / 0, maxRecursionDepth: 1 / 0, maxPageTreeDepth: 1 / 0, xref: { arrayStorage: values, storedArrayKeys: ["Index"] }, valueArrays: { stringStorage: values, storedStringKeys: ["ActualText"], arrayStorage: values, storedArrayKeys: ["Contents", "Annots", "Kids", "Widths", "W", "Differences", "ON", "OFF", "OCGs"], storedArrayPaths: [["ExtGState", "*", "D"]] } });
1766
1766
  let pages = 0, selected;
1767
1767
  for await (let page of document.pages())
1768
1768
  pages++, page.index <= Math.max(0, settings.page ?? 0) && (selected = page);
@@ -42,6 +42,9 @@ export declare class PdfMutableObjectStore {
42
42
  private save;
43
43
  get(number: number): Promise<PdfRetainedOutputObject | undefined>;
44
44
  private load;
45
+ /** Borrow encoded stream bytes without parsing the object's dictionary. */
46
+ getStream(number: number): Promise<PdfRetainedOutputObject["stream"]>;
47
+ private streamSnapshot;
45
48
  /** Remember successful decoding only while this stream snapshot is current. */
46
49
  markDecoded(object: PdfRetainedOutputObject): Promise<void>;
47
50
  /** Enumerate live identities without parsing values or reading payloads. */
@@ -0,0 +1,42 @@
1
+ import { type PdfCosRef } from "../ast.js";
2
+ import { PdfFileSource } from "../source.js";
3
+ import type { PdfRetainedDocument } from "../retained-document.js";
4
+ import type { PdfIndexStorage } from "./object-index.js";
5
+ export interface ApplyQpdfJsonOptions {
6
+ /** The caller retains ownership of datafile handles. */
7
+ readonly dataFile?: (path: string) => Promise<PdfFileSource | undefined>;
8
+ readonly maxInputBytes?: number;
9
+ readonly syntaxError?: (offset: number, message: string, tokenOffset?: number) => never;
10
+ }
11
+ /** A mutable JSON-import document backed only by the caller filesystem. Apply
12
+ * updates sequentially and publish chunks only after all updates succeed.
13
+ * A failed update may have applied earlier objects; discard the owner on error. */
14
+ export declare class QpdfJsonDocument {
15
+ private readonly storage;
16
+ rootRef: PdfCosRef | undefined;
17
+ infoRef: PdfCosRef | undefined;
18
+ private readonly store;
19
+ private readonly backing;
20
+ private readonly positions;
21
+ private readonly order;
22
+ private readonly catalogs;
23
+ private ordinal;
24
+ private readonly controller;
25
+ private readonly signal;
26
+ private pending;
27
+ private closing;
28
+ constructor(storage: PdfIndexStorage, options?: {
29
+ signal?: AbortSignal;
30
+ });
31
+ private remember;
32
+ static fromDocument(document: PdfRetainedDocument, source: PdfFileSource, storage: PdfIndexStorage, options?: {
33
+ signal?: AbortSignal;
34
+ }): Promise<QpdfJsonDocument>;
35
+ apply(input: AsyncIterable<Uint8Array> | Iterable<Uint8Array>, options?: ApplyQpdfJsonOptions): Promise<void>;
36
+ private update;
37
+ chunks(options?: {
38
+ maxOutputBytes?: number;
39
+ chunkBytes?: number;
40
+ }): AsyncGenerator<Uint8Array>;
41
+ close(): Promise<void>;
42
+ }
@@ -10,6 +10,7 @@ export declare class QpdfJsonValues {
10
10
  private readonly scratch;
11
11
  private readonly first;
12
12
  private readonly next;
13
+ private sourceOrder;
13
14
  private closed;
14
15
  private work;
15
16
  private constructor();
@@ -26,6 +27,12 @@ export declare class QpdfJsonValues {
26
27
  /** Match the legacy reference grammar without collecting long zero padding. */
27
28
  reference(position: number): Promise<PdfCosRef | undefined>;
28
29
  private scalar;
30
+ validate(root: number): Promise<void>;
31
+ /** Look up a converted PDF dictionary name, after prefix decoding/collisions. */
32
+ property(root: number, name: string): Promise<number | undefined>;
33
+ private keyEquals;
34
+ /** Stream an imported stream dictionary with legacy filter/length handling. */
35
+ streamDictionary(root: number | undefined, length: number): AsyncGenerator<Uint8Array>;
29
36
  chunks(root: number): AsyncGenerator<Uint8Array>;
30
37
  close(): Promise<void>;
31
38
  }
@@ -75,3 +75,4 @@ export { retainedObjectOrder } from "./cos/retained-object-order.js";
75
75
  export { encryptRetainedPdfChunks } from "./cos/retained-encryption.js";
76
76
  export { replaceRetainedPdfName } from "./edit/retained-name-replacement.js";
77
77
  export { QpdfJsonValues } from "./cos/qpdf-json-values.js";
78
+ export { QpdfJsonDocument, type ApplyQpdfJsonOptions } from "./cos/qpdf-json-document.js";