@poe-platform/safe-bash 0.1.814 → 0.1.815

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/dist/mp4-ast/index.d.ts +1 -0
  2. package/dist/mp4-ast/mp4-fragment-source.d.ts +35 -0
  3. package/dist/mp4-ast/mp4-sample-source.d.ts +5 -2
  4. package/dist/mp4-ast/types.d.ts +11 -0
  5. package/dist/pdf-ast/cos/object-reader.d.ts +3 -2
  6. package/dist/pdf-ast/edit/forms.d.ts +1 -0
  7. package/dist/pdf-ast/edit/retained-form-data.d.ts +9 -0
  8. package/dist/pdf-ast/index.d.ts +1 -0
  9. package/dist/pdf-ast/index.js +476 -55
  10. package/dist/safe-bash/command-chunks/{biff-KRHJ63K3-VQPJCVIL.js → biff-A7XPBWAK-DCLG5QKF.js} +1775 -1667
  11. package/dist/safe-bash/command-chunks/{chunk-AVGXFWEB.js → chunk-44F5TOHZ.js} +179 -58
  12. package/dist/safe-bash/command-chunks/{chunk-PIVH35EQ.js → chunk-6CDDKNNA.js} +1 -0
  13. package/dist/safe-bash/command-chunks/{chunk-K4XNUJVJ.js → chunk-6EINUY5G.js} +149 -165
  14. package/dist/safe-bash/command-chunks/{chunk-5BIQWWLB.js → chunk-CFMJXJS5.js} +1 -1
  15. package/dist/safe-bash/command-chunks/{chunk-3JM7E42I.js → chunk-GPGLTWNR.js} +106 -32
  16. package/dist/safe-bash/command-chunks/{chunk-2ETEJOYX.js → chunk-HQ2UN2L2.js} +8 -8
  17. package/dist/safe-bash/command-chunks/{chunk-CK2WFJZN.js → chunk-KASXIRKD.js} +12 -14
  18. package/dist/safe-bash/command-chunks/chunk-KHUT7BB5.js +65 -0
  19. package/dist/safe-bash/command-chunks/{chunk-LAPOMHGY.js → chunk-NEYITAAO.js} +114 -97
  20. package/dist/safe-bash/command-chunks/{chunk-FF7UGJWS.js → chunk-QDVDBN2N.js} +1 -1
  21. package/dist/safe-bash/command-chunks/{chunk-SW37YCBW.js → chunk-U3C6IT2C.js} +44 -30
  22. package/dist/safe-bash/command-chunks/{chunk-G3TAX3CV.js → chunk-WAT2562G.js} +610 -539
  23. package/dist/safe-bash/command-chunks/{chunk-VT7UBPAE.js → chunk-YW2VYN4V.js} +23 -11
  24. package/dist/safe-bash/command-chunks/{chunk-GQGMQMIM.js → chunk-ZIGENXGC.js} +243 -1
  25. package/dist/safe-bash/command-chunks/{command-engine-7V6PZR7G.js → command-engine-M7S4QIXV.js} +12 -4
  26. package/dist/safe-bash/command-chunks/{engine-UYJENSWK-VSCGKSQV.js → engine-YUYZJIB4-NZUDFEHL.js} +1 -1
  27. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  28. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  29. package/dist/safe-bash-command-ffprobe/media.d.ts +8 -2
  30. package/dist/safe-bash-command-ffprobe/media.js +4 -2
  31. package/dist/safe-bash-command-pandoc/command.js +3 -3
  32. package/dist/safe-bash-command-pandoc/index.js +8 -8
  33. package/dist/safe-bash-command-patch/index.js +7 -6
  34. package/dist/safe-bash-command-patch/patch-formats.d.ts +6 -5
  35. package/dist/safe-bash-command-patch/patch-formats.js +3 -2
  36. package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +7 -7
  37. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +1 -1
  38. package/dist/safe-bash-command-patch/patch-gnu-reject.js +3 -2
  39. package/dist/safe-bash-command-patch/patch-publication.js +3 -2
  40. package/dist/safe-bash-command-patch/patch-text.d.ts +13 -0
  41. package/dist/safe-bash-command-patch/patch.js +7 -6
  42. package/dist/safe-bash-command-patch/stored-patch.d.ts +29 -4
  43. package/dist/safe-bash-command-patch/stored-target.d.ts +2 -1
  44. package/dist/safe-bash-command-patch/unified.d.ts +18 -4
  45. package/dist/safe-bash-command-patch/unified.js +2 -1
  46. package/dist/safe-bash-command-pdftk/index.js +30 -20
  47. package/dist/safe-bash-command-pptx/engine.js +1 -1
  48. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  49. package/dist/safe-bash-presentation-engine/index.js +1 -1
  50. package/dist/safe-bash-presentation-engine/notes.d.ts +1 -0
  51. package/dist/safe-bash-presentation-engine/notes.js +7 -1
  52. package/dist/safe-bash-presentation-engine/retained-notes.d.ts +27 -0
  53. package/dist/safe-bash-xml-engine/document.js +2 -2
  54. package/dist/safe-bash-xml-engine/index.js +2 -2
  55. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  56. package/dist/spreadsheet-format-xls/biff-properties-merge.js +40 -21
  57. package/dist/spreadsheet-format-xls/biff-property-values.d.ts +31 -0
  58. package/dist/spreadsheet-format-xls/biff-property-values.js +158 -0
  59. package/package.json +3 -2
@@ -1,3 +1,7 @@
1
+ import {
2
+ materializeText,
3
+ textSize
4
+ } from "./chunk-KHUT7BB5.js";
1
5
  import {
2
6
  decodeHeaderPath,
3
7
  isEpochHeader
@@ -40,11 +44,17 @@ async function parseUnifiedSection(cursor, budget) {
40
44
  }
41
45
  function bufferedLines() {
42
46
  const lines = [];
43
- return { lines, append(line) {
44
- lines.push(line);
47
+ return { lines, async append(line) {
48
+ lines.push({ kind: line.kind, text: await materializeText(line.text) });
49
+ } };
50
+ }
51
+ function bufferedHunks() {
52
+ const hunks = [];
53
+ return { hunks, append(hunk) {
54
+ hunks.push(hunk);
45
55
  } };
46
56
  }
47
- async function parseUnifiedReader(cursor, budget, single, createLines) {
57
+ async function parseUnifiedReader(cursor, budget, single, createLines, createHunks = bufferedHunks) {
48
58
  const physical = cursor.input;
49
59
  const patches = [];
50
60
  let index = cursor.index;
@@ -73,7 +83,8 @@ async function parseUnifiedReader(cursor, budget, single, createLines) {
73
83
  const newEpoch = isEpochHeader(await physical.read(index));
74
84
  index++;
75
85
  budget.file();
76
- const hunks = [];
86
+ const hunkBuilder = createHunks();
87
+ const hunks = hunkBuilder.hunks;
77
88
  let oldEnded = false;
78
89
  let newEnded = false;
79
90
  while (index < physical.length && (await physical.read(index)).startsWith("@@")) {
@@ -99,27 +110,28 @@ async function parseUnifiedReader(cursor, budget, single, createLines) {
99
110
  const c = budget.checkpoint();
100
111
  if (c) await c;
101
112
  }
102
- const body = await physical.read(index++);
113
+ const bodyIndex = index++;
114
+ const body = await physical.read(bodyIndex, physical.body ? 1 : void 0);
103
115
  const kind = body === "" ? " " : body?.[0];
104
116
  if (body === void 0 || kind !== " " && kind !== "+" && kind !== "-") throw new ToolError("truncated or malformed hunk body");
105
117
  if (kind !== "+" && oldEnded || kind !== "-" && newEnded) throw new ToolError("content follows an incomplete final line");
106
118
  if (kind !== "+") oldRead++;
107
119
  if (kind !== "-") newRead++;
108
120
  if (oldRead > oldCount || newRead > newCount) throw new ToolError("hunk line counts do not match header");
109
- const entry = { kind, text: `${body.slice(1)}
110
- ` };
121
+ const incomplete = physical.matches ? await physical.matches(index, "\") : await physical.read(index) === "\";
122
+ const text = physical.body ? await physical.body(bodyIndex, 1, incomplete) : `${body.slice(1)}${incomplete ? "" : "\n"}`;
123
+ const entry = { kind, text };
111
124
  changed ||= kind !== " ";
112
- if (await physical.read(index) === "\") {
113
- if (entry.text === "\n") throw new ToolError("empty incomplete line is not a valid text line");
125
+ if (incomplete) {
126
+ if (textSize(text) === 0) throw new ToolError("empty incomplete line is not a valid text line");
114
127
  index++;
115
- entry.text = entry.text.slice(0, -1);
116
128
  if (kind !== "+") oldEnded = true;
117
129
  if (kind !== "-") newEnded = true;
118
130
  }
119
131
  await bodyLines.append(entry);
120
132
  }
121
133
  if (!changed) throw new ToolError("hunk has no changes");
122
- hunks.push({ oldStart, oldCount, newStart, newCount, lines: bodyLines.lines, section: match[5] ?? "" });
134
+ await hunkBuilder.append({ oldStart, oldCount, newStart, newCount, lines: bodyLines.lines, section: match[5] ?? "" });
123
135
  }
124
136
  if (!hunks.length) throw new ToolError("file patch has no hunks");
125
137
  patches.push({ oldPath, newPath, oldEpoch, newEpoch, oldHeader, newHeader, hunks });
@@ -1,3 +1,8 @@
1
+ import {
2
+ openRetainedPresentationIndex,
3
+ stageRetainedOutput,
4
+ streamJson
5
+ } from "./chunk-4EHY6J2Z.js";
1
6
  import {
2
7
  attr,
3
8
  child,
@@ -11,6 +16,12 @@ import {
11
16
  import {
12
17
  SelectionError
13
18
  } from "./chunk-W3ZSWK76.js";
19
+ import {
20
+ openRetainedPresentationValidation
21
+ } from "./chunk-3GRMU7TM.js";
22
+ import {
23
+ dialects
24
+ } from "./chunk-AWPI4DZR.js";
14
25
  import {
15
26
  parseXmlPart
16
27
  } from "./chunk-DBLQUZGN.js";
@@ -18,11 +29,240 @@ import {
18
29
  relativePartReference
19
30
  } from "./chunk-WTVJLHMG.js";
20
31
  import {
21
- OfficeError
32
+ OfficeError,
33
+ RetainedValues,
34
+ equal,
35
+ folded,
36
+ literal,
37
+ openRetainedXmlDocument,
38
+ resolveOfficeResources
22
39
  } from "./chunk-CXME4YHU.js";
23
40
 
24
41
  // packages/safe-bash-presentation-engine/src/notes.ts
25
42
  import { SaxesParser } from "saxes";
43
+
44
+ // packages/safe-bash-presentation-engine/src/retained-notes.ts
45
+ import { PagedStorage } from "@poe-platform/safe-fs/storage";
46
+ async function openRetainedNotes(archive, fingerprint, options, settings, selectBeforeValidation = false) {
47
+ if (!options || typeof options !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(options)) || Object.keys(options).some((key) => key !== "selection"))
48
+ throw new OfficeError("invalid-value", "Invalid notes query.", "usage");
49
+ if (options.selection !== void 0 && (!options.selection || typeof options.selection !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(options.selection))))
50
+ throw new SelectionError("invalid-selection");
51
+ const selection = options.selection === void 0 ? void 0 : { ...options.selection, kind: options.selection.kind ?? "slide", ...options.selection.position ? { position: { ...options.selection.position } } : {} };
52
+ const context = resolveOfficeResources(settings), working = { ...settings.workingStorage }, signal = context.signal ?? new AbortController().signal;
53
+ const index = await openRetainedPresentationIndex(archive, fingerprint, { ...context, workingStorage: working });
54
+ const pages = new PagedStorage({ fs: working.fs, cwd: working.directory, env: {}, signal }, (working.cacheBytes ?? 1024 * 1024) / 16384);
55
+ let closed = false, closing, first = 0, last = 0, count = 0;
56
+ const check = () => {
57
+ if (closed) throw new OfficeError("invalid-handle", "Notes are closed.", "select");
58
+ if (signal.aborted) throw new OfficeError("cancelled", "Operation cancelled.", "select");
59
+ };
60
+ const failure = (error) => error instanceof OfficeError ? error : new OfficeError(signal.aborted ? "cancelled" : "io-failure", "Notes storage operation failed.", "select");
61
+ const close = () => {
62
+ closed = true;
63
+ return closing ??= (async () => {
64
+ const outcomes = await Promise.allSettled([index.close(), pages.close()]);
65
+ for (const outcome of outcomes) if (outcome.status === "rejected") throw outcome.reason;
66
+ })();
67
+ };
68
+ const values = new RetainedValues(pages, check, signal);
69
+ const range = (row2, field) => ({ start: row2[field], length: row2[field + 1] });
70
+ async function row(pointer) {
71
+ check();
72
+ const bytes = await pages.read(pointer, 11 /* Count */ * 8), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
73
+ return Array.from({ length: 11 /* Count */ }, (_, n) => view.getFloat64(n * 8, true));
74
+ }
75
+ async function write(pointer, numbers) {
76
+ check();
77
+ const bytes = new Uint8Array(numbers.length * 8), view = new DataView(bytes.buffer);
78
+ numbers.forEach((number, n) => view.setFloat64(n * 8, number, true));
79
+ await pages.write(pointer, bytes);
80
+ }
81
+ async function metadata(value) {
82
+ const decoder = new TextDecoder();
83
+ let result = "";
84
+ for await (const bytes of values.read(value)) result += decoder.decode(bytes, { stream: true });
85
+ return result + decoder.decode();
86
+ }
87
+ try {
88
+ if (selectBeforeValidation && selection) for await (const record of index.records.select(selection)) {
89
+ void record;
90
+ check();
91
+ }
92
+ const validation = await openRetainedPresentationValidation(archive, { ...context, workingStorage: working }, {
93
+ ...context.xmlLimits,
94
+ ...context.relationshipLimits,
95
+ maxBytes: Math.min(context.xmlLimits.maxBytes, context.relationshipLimits.maxBytes),
96
+ maxEntries: context.archiveLimits.maxMembers
97
+ });
98
+ const valid = validation.valid;
99
+ try {
100
+ await validation.close();
101
+ } catch (error) {
102
+ if (valid) await Promise.reject(error);
103
+ }
104
+ if (!valid) throw new OfficeError("invalid-opc", "Invalid presentation graph.", "validate-intent");
105
+ for await (const part of archive.parts()) {
106
+ const key = await values.store(folded(literal(part))), value = await values.store(literal(part));
107
+ await values.insert("parts", key, value);
108
+ }
109
+ const main = await openRetainedXmlDocument(archive.read(index.records.main), { ...context, workingStorage: working });
110
+ let dialect = dialects[0], mainFailed = false;
111
+ try {
112
+ for (const candidate of dialects) if (await equal(main.namespace(main.root), literal(candidate.p))) dialect = candidate;
113
+ } catch (error) {
114
+ mainFailed = true;
115
+ throw error;
116
+ } finally {
117
+ try {
118
+ await main.close();
119
+ } catch (error) {
120
+ if (!mainFailed) await Promise.reject(error);
121
+ }
122
+ }
123
+ async function target(owner, kind, internal) {
124
+ for await (const edge of index.graph.outgoing(owner)) if ((!internal || !edge.external) && await equal(edge.type(), literal(`${dialect.r}/${kind}`))) {
125
+ if (!edge.targetPart) return void 0;
126
+ const original = await values.find("parts", () => folded(edge.targetPart()));
127
+ if (!original) throw new OfficeError("missing-binding", "Package member is absent.", "index");
128
+ return { name: await metadata(original), reference: await values.store(edge.targetPart()) };
129
+ }
130
+ return void 0;
131
+ }
132
+ if (selection) {
133
+ for await (const slide of index.records.select(selection)) if (slide.kind !== "slide") throw new SelectionError("invalid-selection");
134
+ }
135
+ for await (const slide of selection ? index.records.select(selection) : index.records.records("slide")) {
136
+ const part = await target(slide.part, "notesSlide", true);
137
+ if (!part) continue;
138
+ const document = await openRetainedXmlDocument(archive.read(part.name), { ...context, workingStorage: working });
139
+ let failed = false;
140
+ try {
141
+ async function is(node, local, namespace) {
142
+ return node.kind === "element" && await equal(document.raw(node.localName), literal(local)) && await equal(document.namespace(node), namespace);
143
+ }
144
+ async function child2(node, local) {
145
+ if (!node) return void 0;
146
+ let found;
147
+ for await (const candidate of document.children(node)) if (await is(candidate, local, document.namespace(node))) {
148
+ if (found) throw new OfficeError("invalid-value", "Ambiguous shared structure.", "usage");
149
+ found = candidate;
150
+ }
151
+ return found;
152
+ }
153
+ async function required2(node, local) {
154
+ const found = await child2(node, local);
155
+ if (!found) throw new OfficeError("unsupported-edit", "Unsupported shared structure.", "validate-intent");
156
+ return found;
157
+ }
158
+ async function attribute(node, local) {
159
+ if (node) {
160
+ for await (const candidate of document.attributes(node)) if (await equal(document.raw(candidate.localName), literal(local)) && await equal(document.namespace(candidate), literal(""))) return candidate;
161
+ }
162
+ return void 0;
163
+ }
164
+ const tree = await required2(await required2(document.root, "cSld"), "spTree");
165
+ let body2;
166
+ for await (const node of document.children(tree)) if (await is(node, "sp", document.namespace(document.root))) {
167
+ const placeholder2 = await child2(await child2(await child2(node, "nvSpPr"), "nvPr"), "ph"), type = await attribute(placeholder2, "type");
168
+ if (type && await equal(document.text(type), literal("body"))) {
169
+ if (body2) throw new OfficeError("ambiguous-selection", "Notes have multiple speaker bodies.", "select");
170
+ body2 = node;
171
+ }
172
+ }
173
+ const id = await attribute(await child2(await child2(body2, "nvSpPr"), "cNvPr"), "id"), textBody = await child2(body2, "txBody");
174
+ const idRange = id ? await values.store(document.text(id)) : { start: -1, length: 0 };
175
+ let drawing = dialects[0].a;
176
+ for (const candidate of dialects) if (await equal(document.namespace(document.root), literal(candidate.p))) drawing = candidate.a;
177
+ async function* speakerText2() {
178
+ let separator = false;
179
+ if (textBody) {
180
+ for await (const paragraph of document.children(textBody)) if (await is(paragraph, "p", literal(drawing))) {
181
+ if (separator) yield* literal("\n");
182
+ separator = true;
183
+ for await (const inline of document.children(paragraph)) {
184
+ if (await is(inline, "br", literal(drawing))) yield* literal("\v");
185
+ else if (await is(inline, "r", literal(drawing)) || await is(inline, "fld", literal(drawing))) {
186
+ for await (const text2 of document.children(inline)) if (await is(text2, "t", literal(drawing))) yield* document.text(text2);
187
+ }
188
+ }
189
+ }
190
+ }
191
+ }
192
+ const text = textBody ? await values.store(speakerText2()) : { start: -1, length: 0 }, master = await target(part.name, "notesMaster", false);
193
+ if (!master) throw new OfficeError("invalid-opc", "Missing notes master.", "index");
194
+ const descriptor = await values.store(literal(JSON.stringify({ selector: slide.token, location: slide.location, slide: slide.position })));
195
+ const pointer = pages.allocate(11 /* Count */ * 8);
196
+ await write(pointer, [0, descriptor.start, descriptor.length, part.reference.start, part.reference.length, master.reference.start, master.reference.length, text.start, text.length, idRange.start, idRange.length]);
197
+ if (last) await write(last, [pointer]);
198
+ else first = pointer;
199
+ last = pointer;
200
+ count++;
201
+ } catch (error) {
202
+ failed = true;
203
+ throw error;
204
+ } finally {
205
+ try {
206
+ await document.close();
207
+ } catch (error) {
208
+ if (!failed) await Promise.reject(error);
209
+ }
210
+ }
211
+ }
212
+ await index.close();
213
+ check();
214
+ async function* records() {
215
+ try {
216
+ for (let pointer = first; pointer; ) {
217
+ const entry = await row(pointer), descriptor = JSON.parse(await metadata(range(entry, 1 /* Metadata */)));
218
+ yield {
219
+ ...descriptor,
220
+ part: () => values.read(range(entry, 3 /* Part */)),
221
+ master: () => values.read(range(entry, 5 /* Master */)),
222
+ text: entry[7 /* Text */] === -1 ? null : () => values.read(range(entry, 7 /* Text */)),
223
+ bodyShapeId: entry[9 /* Id */] === -1 ? null : () => values.read(range(entry, 9 /* Id */))
224
+ };
225
+ pointer = entry[0 /* Next */];
226
+ }
227
+ check();
228
+ } catch (error) {
229
+ throw failure(error);
230
+ }
231
+ }
232
+ return Object.freeze({ records, close, count });
233
+ } catch (error) {
234
+ await close().catch(() => {
235
+ });
236
+ throw failure(error);
237
+ }
238
+ }
239
+ async function stageRetainedNotes(archive, fingerprint, options, settings, output) {
240
+ const format = { ...output }, notes = await openRetainedNotes(archive, fingerprint, options, settings, format.operation === "notes.get");
241
+ let staged;
242
+ async function* locations() {
243
+ for await (const note of notes.records()) yield note.location;
244
+ }
245
+ async function* render() {
246
+ if (format.json) {
247
+ yield* streamJson({ version: 1, operation: format.operation, ok: true, data: format.operation === "notes.get" && !notes.count ? null : { notes: notes.records() }, affected: 0, warnings: [], errors: [], locations: locations() });
248
+ yield* literal("\n");
249
+ } else for await (const note of notes.records()) {
250
+ yield* literal(`${note.slide}: `);
251
+ if (note.text) yield* note.text();
252
+ yield* literal("\n");
253
+ }
254
+ }
255
+ try {
256
+ staged = await stageRetainedOutput(render(), settings, format.maxOutputBytes);
257
+ await notes.close();
258
+ return staged;
259
+ } catch (error) {
260
+ await Promise.allSettled([notes.close(), staged?.close()]);
261
+ throw error;
262
+ }
263
+ }
264
+
265
+ // packages/safe-bash-presentation-engine/src/notes.ts
26
266
  var relns = "http://schemas.openxmlformats.org/package/2006/relationships";
27
267
  function notesPart(s, slide) {
28
268
  return s.index.inventory.relationships.find(
@@ -366,6 +606,8 @@ async function mutateNotes(input, action, options, context) {
366
606
  }
367
607
 
368
608
  export {
609
+ openRetainedNotes,
610
+ stageRetainedNotes,
369
611
  readNotes,
370
612
  validateNotesOptions,
371
613
  mutateNotes
@@ -11,6 +11,9 @@ import {
11
11
  } from "./chunk-NUGQQDGE.js";
12
12
  import "./chunk-65DS4IOB.js";
13
13
 
14
+ // packages/safe-bash-command-pptx/src/command-engine.ts
15
+ import { stageRetainedNotes } from "../../safe-bash-presentation-engine/notes.js";
16
+
14
17
  // packages/safe-bash-command-pptx/src/retained-pack-manifest.ts
15
18
  import { PagedStorage } from "@poe-platform/safe-fs/storage";
16
19
  import { resourceContext } from "../../safe-bash-presentation-engine/resource-limits.js";
@@ -12078,8 +12081,8 @@ async function executeRequest(request, options2, owned) {
12078
12081
  publication = { inputPath: args.input, outputPath: destination, bytes: staged.bytes(), originalBytes: input, inPlace: args.inPlace ?? false, force: args.force ?? false, dryRun };
12079
12082
  }
12080
12083
  result = success(operation2, null);
12081
- } else if ((args.operation === "inspect" || args.operation === "text.get" || args.operation === "fields.list" || args.operation === "fields.get" || args.operation === "text.frames.list" || args.operation === "text.frames.get" || args.operation === "xml.get") && request.streaming) {
12082
- if (args.token) decodeSelectionToken2(args.token);
12084
+ } else if ((args.operation === "inspect" || args.operation === "text.get" || args.operation === "fields.list" || args.operation === "fields.get" || args.operation === "text.frames.list" || args.operation === "text.frames.get" || args.operation === "notes.list" || args.operation === "notes.get" || args.operation === "xml.get") && request.streaming) {
12085
+ if (args.token && args.operation !== "notes.list" && args.operation !== "notes.get") decodeSelectionToken2(args.token);
12083
12086
  const input = await request.streaming.openInput(args.input, Math.min(options2.context.limits.maxBytes, options2.context.archiveLimits.maxArchiveBytes));
12084
12087
  const hash = sha2564.create();
12085
12088
  for await (const bytes of input.stream()) {
@@ -12091,8 +12094,13 @@ async function executeRequest(request, options2, owned) {
12091
12094
  const archive = await openPackageArchive(input, context);
12092
12095
  let failed = false;
12093
12096
  try {
12094
- const scope = args.token ? decodeSelectionToken2(args.token).scope : args.scope;
12095
- stagedOutput = args.operation === "xml.get" ? await stageRetainedXmlPart(archive, fingerprint, {
12097
+ const scope = args.operation === "notes.list" || args.operation === "notes.get" ? void 0 : args.token ? decodeSelectionToken2(args.token).scope : args.scope;
12098
+ stagedOutput = args.operation === "notes.list" || args.operation === "notes.get" ? await stageRetainedNotes(archive, fingerprint, { selection: {
12099
+ kind: "slide",
12100
+ ...args.token ? { token: args.token } : {},
12101
+ ...args.slide === void 0 ? {} : { position: { coordinateSystem: "one-based", value: args.slide } },
12102
+ ...!args.token && (args.all || args.operation === "notes.list") ? { all: true } : {}
12103
+ } }, context, { json: args.json, operation: args.operation, maxOutputBytes: options2.maxOutputBytes }) : args.operation === "xml.get" ? await stageRetainedXmlPart(archive, fingerprint, {
12096
12104
  ...args.token === void 0 ? {} : { token: args.token },
12097
12105
  ...args.slide === void 0 ? {} : { slide: args.slide },
12098
12106
  ...args.shape === void 0 ? {} : { shape: args.shape },
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Si,
3
3
  gi
4
- } from "./chunk-2ETEJOYX.js";
4
+ } from "./chunk-HQ2UN2L2.js";
5
5
  import "./chunk-Z7ESJVFP.js";
6
6
  import "./chunk-WHWIZ2B7.js";
7
7
  import "./chunk-65DS4IOB.js";
@@ -20,7 +20,7 @@ import {
20
20
  sliceMp4,
21
21
  srtAst,
22
22
  webvttAst
23
- } from "../safe-bash/command-chunks/chunk-LAPOMHGY.js";
23
+ } from "../safe-bash/command-chunks/chunk-NEYITAAO.js";
24
24
  import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
25
25
 
26
26
  // packages/safe-bash-command-ffmpeg/src/index.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createFfprobeCommand
3
- } from "../safe-bash/command-chunks/chunk-K4XNUJVJ.js";
3
+ } from "../safe-bash/command-chunks/chunk-6EINUY5G.js";
4
4
  import "../safe-bash/command-chunks/chunk-MGBHGZEX.js";
5
- import "../safe-bash/command-chunks/chunk-LAPOMHGY.js";
5
+ import "../safe-bash/command-chunks/chunk-NEYITAAO.js";
6
6
  import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
7
7
 
8
8
  // packages/safe-bash-command-ffprobe/src/index.ts
@@ -1,6 +1,6 @@
1
1
  import { type AudioAst } from "../audio-ast/index.js";
2
2
  import { type CommandContext, type CommandDefinition } from "../safe-bash-contracts/command.js";
3
- import { createMediaAstRegistry, MediaBudgetTracker, type MediaAstPlugin, type MediaFeatureOptions, type MediaProbeResult, type MediaProbeRecords, type MediaResourceLimits } from "../mp4-ast/index.js";
3
+ import { createMediaAstRegistry, MediaBudgetTracker, type MediaAstPlugin, type MediaFeatureOptions, type MediaProbeResult, type MediaProbeRecords, type MediaProbeSourceRecords, type MediaProbeStream, type MediaResourceLimits } from "../mp4-ast/index.js";
4
4
  export interface MediaCommandsOptions {
5
5
  /**
6
6
  * Pluggable AST engines that determine which container formats, extensions,
@@ -60,7 +60,13 @@ export type FfprobeFormatOptions = {
60
60
  };
61
61
  /** Explicit buffering convenience for synchronous callers. */
62
62
  export declare function formatFfprobeResult(probe: MediaProbeResult, opts: FfprobeFormatOptions, audioInput?: AudioProbeInput): string;
63
- export declare function formatFfprobeResultChunks(probe: MediaProbeRecords, opts: FfprobeFormatOptions, audioInput?: AudioProbeInput): Generator<string>;
63
+ type SyncProbeRows = Omit<MediaProbeRecords, "streams" | "chapters"> & {
64
+ readonly streams: Iterable<MediaProbeStream>;
65
+ readonly chapters: Iterable<MediaProbeResult["chapters"][number]>;
66
+ };
67
+ export declare function formatFfprobeResultChunks(probe: SyncProbeRows, opts: FfprobeFormatOptions, audioInput?: AudioProbeInput): Generator<string>;
68
+ /** Consume one-shot caller-backed records with backpressure and iterator cleanup. */
69
+ export declare function formatFfprobeSourceChunks(probe: MediaProbeSourceRecords, opts: FfprobeFormatOptions, audioInput?: AudioProbeInput, signal?: AbortSignal): AsyncGenerator<string>;
64
70
  export declare function getDefaultMediaRegistry(): {
65
71
  astPlugins: readonly MediaAstPlugin[];
66
72
  registry: ReturnType<typeof createMediaAstRegistry>;
@@ -4,15 +4,16 @@ import {
4
4
  evalSyncFfprobe,
5
5
  formatFfprobeResult,
6
6
  formatFfprobeResultChunks,
7
+ formatFfprobeSourceChunks,
7
8
  formatIntrospectionOutput,
8
9
  getDefaultMediaRegistry,
9
10
  isStdin,
10
11
  loadManifestResources,
11
12
  resolvePath,
12
13
  rethrowRuntimeError
13
- } from "../safe-bash/command-chunks/chunk-K4XNUJVJ.js";
14
+ } from "../safe-bash/command-chunks/chunk-6EINUY5G.js";
14
15
  import "../safe-bash/command-chunks/chunk-MGBHGZEX.js";
15
- import "../safe-bash/command-chunks/chunk-LAPOMHGY.js";
16
+ import "../safe-bash/command-chunks/chunk-NEYITAAO.js";
16
17
  import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
17
18
  export {
18
19
  createFfprobeCommand,
@@ -20,6 +21,7 @@ export {
20
21
  evalSyncFfprobe,
21
22
  formatFfprobeResult,
22
23
  formatFfprobeResultChunks,
24
+ formatFfprobeSourceChunks,
23
25
  formatIntrospectionOutput,
24
26
  getDefaultMediaRegistry,
25
27
  isStdin,
@@ -1,8 +1,8 @@
1
1
  import {
2
- Ju,
2
+ Vu,
3
3
  gR,
4
4
  wR
5
- } from "../safe-bash/command-chunks/chunk-G3TAX3CV.js";
5
+ } from "../safe-bash/command-chunks/chunk-WAT2562G.js";
6
6
  import "../safe-bash/command-chunks/chunk-7QRIAJEQ.js";
7
7
  import "../safe-bash/command-chunks/chunk-IOEUZ4EA.js";
8
8
  import "../safe-bash/command-chunks/chunk-E6SK3OU2.js";
@@ -14,7 +14,7 @@ import "../safe-bash/command-chunks/chunk-5NKZJEUI.js";
14
14
  import "../safe-bash/command-chunks/chunk-QIFS4QHZ.js";
15
15
  import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
16
16
  export {
17
- Ju as createPandocCommand,
17
+ Vu as createPandocCommand,
18
18
  wR as createPandocCommands,
19
19
  gR as pandocCommands
20
20
  };
@@ -5,26 +5,26 @@ import {
5
5
  El,
6
6
  IE,
7
7
  Ie,
8
- Ju,
9
8
  OE,
10
9
  Oa,
11
10
  Qi,
12
- Qo,
13
11
  UP,
14
12
  Uu,
13
+ Vu,
14
+ Zo,
15
15
  Zs,
16
16
  _P,
17
17
  _u,
18
18
  cn,
19
19
  dd,
20
+ el,
20
21
  gR,
21
22
  ir,
22
23
  pT,
23
24
  pu,
24
25
  su,
25
- tl,
26
26
  wR
27
- } from "../safe-bash/command-chunks/chunk-G3TAX3CV.js";
27
+ } from "../safe-bash/command-chunks/chunk-WAT2562G.js";
28
28
  import "../safe-bash/command-chunks/chunk-7QRIAJEQ.js";
29
29
  import "../safe-bash/command-chunks/chunk-IOEUZ4EA.js";
30
30
  import "../safe-bash/command-chunks/chunk-E6SK3OU2.js";
@@ -52,7 +52,7 @@ function K(u = {}) {
52
52
  e2.signal.throwIfAborted();
53
53
  let a = new TextEncoder(), f, C;
54
54
  try {
55
- let o = tl(e2.args, i);
55
+ let o = el(e2.args, i);
56
56
  if (o !== void 0) f = a.encode(o);
57
57
  else {
58
58
  let s = e2.fs ? { ...e2.cwd === void 0 ? {} : { cwd: e2.cwd }, stdin: e2.stdin, ...e2.createOutput ? { createOutput: e2.createOutput.bind(e2) } : {}, ...e2.fs.readStream ? { readStream: async function* (t2, r, n) {
@@ -116,7 +116,7 @@ export {
116
116
  El as convert,
117
117
  UP as convertSync,
118
118
  Du as convertToOutput,
119
- Qo as coreFormats,
119
+ Zo as coreFormats,
120
120
  yr as createCiteprocFilterCapability,
121
121
  OE as createExecutionContext,
122
122
  Al as createFileOutput,
@@ -124,13 +124,13 @@ export {
124
124
  Ie as createFormatRegistry,
125
125
  pu as createJsonFilterCapability,
126
126
  _r as createLuaFilterCapability,
127
- Ju as createPandocCommand,
127
+ Vu as createPandocCommand,
128
128
  wR as createPandocCommands,
129
129
  K as createStandalonePandocCommand,
130
130
  Oa as defaultLimits,
131
131
  _u as evalSyncPandoc,
132
132
  pT as formatCapabilities,
133
- tl as inspectCommand,
133
+ el as inspectCommand,
134
134
  Zs as inspectFormats,
135
135
  IE as normalizeDocument,
136
136
  su as normalizeDocumentCooperatively,
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  patchCommand
3
- } from "../safe-bash/command-chunks/chunk-AVGXFWEB.js";
4
- import "../safe-bash/command-chunks/chunk-3JM7E42I.js";
5
- import "../safe-bash/command-chunks/chunk-5BIQWWLB.js";
6
- import "../safe-bash/command-chunks/chunk-CK2WFJZN.js";
3
+ } from "../safe-bash/command-chunks/chunk-44F5TOHZ.js";
4
+ import "../safe-bash/command-chunks/chunk-GPGLTWNR.js";
5
+ import "../safe-bash/command-chunks/chunk-CFMJXJS5.js";
6
+ import "../safe-bash/command-chunks/chunk-KASXIRKD.js";
7
7
  import {
8
8
  evalSyncPatch
9
9
  } from "../safe-bash/command-chunks/chunk-KSY3QHLY.js";
10
- import "../safe-bash/command-chunks/chunk-SW37YCBW.js";
11
- import "../safe-bash/command-chunks/chunk-VT7UBPAE.js";
10
+ import "../safe-bash/command-chunks/chunk-U3C6IT2C.js";
11
+ import "../safe-bash/command-chunks/chunk-YW2VYN4V.js";
12
+ import "../safe-bash/command-chunks/chunk-KHUT7BB5.js";
12
13
  import "../safe-bash/command-chunks/chunk-OQNX2OOS.js";
13
14
  import "../safe-bash/command-chunks/chunk-AJEQUVDN.js";
14
15
  import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
@@ -1,12 +1,13 @@
1
- import { type FilePatch, type PatchInput, type IndexedUnifiedCursor } from "./unified.js";
1
+ import { type FilePatch, type Hunk, type PatchInput, type IndexedUnifiedCursor } from "./unified.js";
2
2
  import { Budget } from "../safe-bash-diff-engine/shared.js";
3
+ import { type PatchText } from "./patch-text.js";
3
4
  export type PatchFormat = "unified" | "normal" | "context";
4
5
  export interface ParseProgress {
5
6
  error?: unknown;
6
7
  }
7
8
  export declare function parsePatch(text: string | PatchInput, budget: Budget, format: PatchFormat | undefined, target: string | undefined, progress?: ParseProgress, convert?: (source: AsyncIterable<string>) => Promise<FilePatch[]>): Promise<FilePatch[]>;
8
- export interface PatchParsers<Lines> {
9
- unified(cursor: IndexedUnifiedCursor): Promise<FilePatch<Lines>[]>;
10
- converted(source: AsyncIterable<string>): Promise<FilePatch<Lines>[]>;
9
+ export interface PatchParsers<Lines, Hunks = Hunk<Lines>[]> {
10
+ unified(cursor: IndexedUnifiedCursor): Promise<FilePatch<Lines, Hunks>[]>;
11
+ converted(source: AsyncIterable<PatchText>): Promise<FilePatch<Lines, Hunks>[]>;
11
12
  }
12
- export declare function parsePatchWith<Lines>(text: string | PatchInput, budget: Budget, format: PatchFormat | undefined, target: string | undefined, parsers: PatchParsers<Lines>, progress?: ParseProgress): Promise<FilePatch<Lines>[]>;
13
+ export declare function parsePatchWith<Lines, Hunks = Hunk<Lines>[]>(text: string | PatchInput, budget: Budget, format: PatchFormat | undefined, target: string | undefined, parsers: PatchParsers<Lines, Hunks>, progress?: ParseProgress): Promise<FilePatch<Lines, Hunks>[]>;
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  parsePatch,
3
3
  parsePatchWith
4
- } from "../safe-bash/command-chunks/chunk-SW37YCBW.js";
5
- import "../safe-bash/command-chunks/chunk-VT7UBPAE.js";
4
+ } from "../safe-bash/command-chunks/chunk-U3C6IT2C.js";
5
+ import "../safe-bash/command-chunks/chunk-YW2VYN4V.js";
6
+ import "../safe-bash/command-chunks/chunk-KHUT7BB5.js";
6
7
  import "../safe-bash/command-chunks/chunk-AJEQUVDN.js";
7
8
  import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
8
9
  export {
@@ -1,4 +1,4 @@
1
- import type { FilePatch, PatchLine } from "./unified.js";
1
+ import type { FilePatch, Hunk, PatchLine } from "./unified.js";
2
2
  import { type FileStat } from "../safe-bash-contracts/index.js";
3
3
  import { Budget } from "../safe-bash-diff-engine/shared.js";
4
4
  export interface PathOptions {
@@ -8,8 +8,8 @@ export interface PathOptions {
8
8
  readonly reject: string | undefined;
9
9
  readonly input: string | undefined;
10
10
  }
11
- export interface AuthorizedPatch<Lines = PatchLine[]> {
12
- readonly patch: FilePatch<Lines>;
11
+ export interface AuthorizedPatch<Lines = PatchLine[], Hunks = Hunk<Lines>[]> {
12
+ readonly patch: FilePatch<Lines, Hunks>;
13
13
  readonly oldName: string | undefined;
14
14
  readonly newName: string | undefined;
15
15
  readonly indexName: string | undefined;
@@ -17,15 +17,15 @@ export interface AuthorizedPatch<Lines = PatchLine[]> {
17
17
  readonly selected?: string;
18
18
  readonly posix?: boolean;
19
19
  }
20
- interface SelectionState<Lines> {
20
+ interface SelectionState<Lines, Hunks> {
21
21
  readonly reverse: boolean;
22
22
  readonly exists: (path: string) => Promise<boolean>;
23
- readonly advance: (patch: AuthorizedPatch<Lines>) => Promise<void>;
23
+ readonly advance: (patch: AuthorizedPatch<Lines, Hunks>) => Promise<void>;
24
24
  }
25
25
  export declare function regular(stat: FileStat | undefined, path: string): void;
26
26
  export declare function rejectName(target: string, options: PathOptions): string | undefined;
27
27
  export declare function pruneParents(target: string, cwd: string): string[];
28
- export declare function authorizePaths<Lines>(patches: readonly FilePatch<Lines>[], options: PathOptions, budget: Budget, state?: SelectionState<Lines>): Promise<AuthorizedPatch<Lines>[]>;
28
+ export declare function authorizePaths<Lines, Hunks>(patches: readonly FilePatch<Lines, Hunks>[], options: PathOptions, budget: Budget, state?: SelectionState<Lines, Hunks>): Promise<AuthorizedPatch<Lines, Hunks>[]>;
29
29
  export interface BackupOptions {
30
30
  suffix?: string;
31
31
  prefix?: string;
@@ -35,7 +35,7 @@ export interface BackupOptions {
35
35
  export declare function backupName(path: string, budget: Budget, options?: BackupOptions): Promise<string>;
36
36
  export declare function authorizeOutputs(paths: readonly (string | undefined)[], targets: ReadonlySet<string>, input: string | undefined, budget: Budget): Promise<void>;
37
37
  export declare function candidateStat(path: string, budget: Budget): Promise<FileStat | undefined>;
38
- export declare function selectTarget(authorized: AuthorizedPatch<unknown>, exists: (path: string) => Promise<boolean>, budget: Budget): Promise<string>;
38
+ export declare function selectTarget(authorized: AuthorizedPatch<unknown, unknown>, exists: (path: string) => Promise<boolean>, budget: Budget): Promise<string>;
39
39
  export declare function ensureParents(path: string, budget: Budget): Promise<void>;
40
40
  export declare function pruneDirectories(parents: ReadonlySet<string>, budget: Budget): Promise<void>;
41
41
  export {};