@poe-platform/safe-bash 0.1.762 → 0.1.764

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 (35) hide show
  1. package/dist/image-ast/index.browser.js +454 -208
  2. package/dist/image-ast/index.js +454 -208
  3. package/dist/pdf-ast/ast.d.ts +23 -0
  4. package/dist/pdf-ast/index.js +543 -244
  5. package/dist/safe-bash/chunks/{chunk-CRQDMBQA.js → chunk-FSH7QRIC.js} +10 -1
  6. package/dist/safe-bash/command-chunks/{chunk-D4GXXV65.js → chunk-B7YLGJRF.js} +2 -2
  7. package/dist/safe-bash/command-chunks/{chunk-P3Q2QSCA.js → chunk-G3IIEU2N.js} +457 -208
  8. package/dist/safe-bash/command-chunks/{chunk-F7MJRXQ2.js → chunk-RDPJGIQF.js} +1 -1
  9. package/dist/safe-bash/commands/python/index.browser.js +1 -1
  10. package/dist/safe-bash/commands/python/llm-module.js +3 -1
  11. package/dist/safe-bash/commands/python/shell-module.js +7 -0
  12. package/dist/safe-bash/core.browser.js +33 -13
  13. package/dist/safe-bash/shell/runtime.js +44 -12
  14. package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
  15. package/dist/safe-bash-checksum-engine/index.js +5 -1
  16. package/dist/safe-bash-command-ffmpeg/index.js +7476 -7338
  17. package/dist/safe-bash-command-gh/index.js +174 -105
  18. package/dist/safe-bash-command-imagemagick/index.js +2 -2
  19. package/dist/safe-bash-command-pandoc/command.js +3 -3
  20. package/dist/safe-bash-command-pandoc/index.js +3 -3
  21. package/dist/safe-bash-command-pdfimages/index.js +454 -208
  22. package/dist/safe-bash-command-pdfinfo/index.js +541 -244
  23. package/dist/safe-bash-command-pdftk/index.js +454 -208
  24. package/dist/safe-bash-command-pdftoppm/index.js +541 -244
  25. package/dist/safe-bash-command-pdftotext/index.js +454 -208
  26. package/dist/safe-bash-command-qpdf/index.js +454 -208
  27. package/dist/safe-bash-command-sips/index.js +2 -2
  28. package/dist/safe-bash-command-soffice/index.js +1 -1
  29. package/dist/safe-bash-command-ssconvert/index.js +514 -208
  30. package/dist/safe-bash-command-wkhtmltopdf/index.js +455 -208
  31. package/dist/safe-playwright-cloudflare/browser-snapshot-labels.d.ts +14 -0
  32. package/dist/safe-playwright-cloudflare/browser-snapshot-labels.js +62 -0
  33. package/dist/safe-playwright-cloudflare/browser-snapshot-scheduler.js +8 -1
  34. package/package.json +2 -2
  35. package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +27 -0
@@ -0,0 +1,14 @@
1
+ export interface SnapshotScript {
2
+ incrementalAriaSnapshot(node: Node, options: {
3
+ mode: string;
4
+ refPrefix?: string;
5
+ track?: string;
6
+ doNotRenderActive?: boolean;
7
+ }): {
8
+ full: string;
9
+ incremental?: string;
10
+ iframeRefs: string[];
11
+ };
12
+ _safeBashSnapshotLabels?: boolean;
13
+ }
14
+ export declare function installSnapshotLabelCache(injected: SnapshotScript): void;
@@ -0,0 +1,62 @@
1
+ // Chromium's control.labels NodeList scans the tree for each control. Reverse
2
+ // the lookup through native label.control once per tree and synchronous capture.
3
+ // Only the provider's utility world is changed; restore its descriptors even
4
+ // when capture throws, and never keep an index across DOM mutations.
5
+ export function installSnapshotLabelCache(injected) {
6
+ if (injected._safeBashSnapshotLabels)
7
+ return;
8
+ const snapshot = injected.incrementalAriaSnapshot;
9
+ injected.incrementalAriaSnapshot = function (node, options) {
10
+ const roots = new Map();
11
+ const descriptors = [];
12
+ try {
13
+ for (const constructor of [
14
+ HTMLButtonElement,
15
+ HTMLInputElement,
16
+ HTMLMeterElement,
17
+ HTMLOutputElement,
18
+ HTMLProgressElement,
19
+ HTMLSelectElement,
20
+ HTMLTextAreaElement
21
+ ]) {
22
+ const prototype = constructor.prototype;
23
+ const descriptor = Object.getOwnPropertyDescriptor(prototype, "labels");
24
+ if (!descriptor?.get)
25
+ throw new Error("Native labels getter is unavailable");
26
+ descriptors.push([prototype, descriptor]);
27
+ Object.defineProperty(prototype, "labels", {
28
+ ...descriptor,
29
+ get() {
30
+ if (this instanceof HTMLInputElement && this.type === "hidden")
31
+ return null;
32
+ const root = this.getRootNode();
33
+ let controls = roots.get(root);
34
+ if (!controls) {
35
+ controls = new Map();
36
+ roots.set(root, controls);
37
+ const labels = Array.from(root.querySelectorAll("label"));
38
+ if (root instanceof HTMLLabelElement)
39
+ labels.unshift(root);
40
+ for (const label of labels) {
41
+ const control = label.control;
42
+ if (!control)
43
+ continue;
44
+ let associated = controls.get(control);
45
+ if (!associated)
46
+ controls.set(control, (associated = []));
47
+ associated.push(label);
48
+ }
49
+ }
50
+ return controls.get(this) ?? [];
51
+ }
52
+ });
53
+ }
54
+ return snapshot.call(this, node, options);
55
+ }
56
+ finally {
57
+ for (const [prototype, descriptor] of descriptors)
58
+ Object.defineProperty(prototype, "labels", descriptor);
59
+ }
60
+ };
61
+ injected._safeBashSnapshotLabels = true;
62
+ }
@@ -1,3 +1,4 @@
1
+ import { installSnapshotLabelCache } from './browser-snapshot-labels.js';
1
2
  /** Serialize native frame capture before cold utility scripts become CDP payloads.
2
3
  * The pinned provider recurses only after this callback returns, so descendants
3
4
  * do not retain a parent slot. Native traversal, retries and refs stay intact. */
@@ -54,7 +55,13 @@ export function createBrowserSnapshotScheduler() {
54
55
  }
55
56
  function snapshotAction(progress, frame, action) {
56
57
  return function (continuePolling) {
57
- return schedule(progress, frame, () => action.call(this, continuePolling));
58
+ return schedule(progress, frame, async () => {
59
+ const context = await progress.race(frame._utilityContext());
60
+ const injected = await progress.race(context.injectedScript());
61
+ await progress.race(injected.evaluate(installSnapshotLabelCache));
62
+ progress.signal.throwIfAborted();
63
+ return action.call(this, continuePolling);
64
+ });
58
65
  };
59
66
  }
60
67
  function prepareFrame(frame) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.762",
3
+ "version": "0.1.764",
4
4
  "description": "Extensible virtual shell with pluggable filesystems and streaming commands",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -841,7 +841,7 @@
841
841
  "access": "public"
842
842
  },
843
843
  "dependencies": {
844
- "@poe-platform/safe-fs": "0.1.762",
844
+ "@poe-platform/safe-fs": "0.1.764",
845
845
  "pdf-lib": "1.17.1",
846
846
  "@noble/hashes": "2.4.0",
847
847
  "pako": "3.0.1",
@@ -215,6 +215,20 @@ adapter; other cases use independently rendered PDF.js pixels.
215
215
 
216
216
  Source: https://github.com/chromium/pdfium/blob/a84323421e94f484faca52dd9d027934eba42ab8/third_party/agg23/agg_curves.cpp
217
217
 
218
+ `src/render/stroke.ts` adapts the cap, join, miter and arc calculations from
219
+ `third_party/agg23/agg_math_stroke.h`, with forward/backward contour assembly
220
+ from `agg_vcgen_stroke.cpp`, at the same PDFium revision and under the same AGG
221
+ permission terms. The adapter uses double-precision arrays, PDFium's
222
+ `miter_join_revert` bevel fallback, and a one-million-vertex expansion limit.
223
+ Local dash splitting preserves joins across vertices and closed seams, resets
224
+ phase per subpath, and handles odd arrays and zero-length round dots.
225
+ `src/render/stroke-joins.test.ts` checks native cap/join vectors plus independent
226
+ PDF.js pixels; Poppler also confirms the final zero-length dash is omitted.
227
+ The native harness calls unchanged upstream math routines with minimal support
228
+ headers and local contour assembly; it is not the full upstream generator.
229
+
230
+ Source: https://github.com/chromium/pdfium/blob/a84323421e94f484faca52dd9d027934eba42ab8/third_party/agg23/agg_math_stroke.h
231
+
218
232
 
219
233
  # SVG labels
220
234
 
@@ -359,6 +373,19 @@ device pixel as the enlargement threshold. `image-downsampling.test.ts` adds
359
373
  memory-only stripe, alpha, transform, stencil, and save/reopen regressions;
360
374
  the unchanged upstream issue13372 fixture also covers reduced patterned masks.
361
375
 
376
+ ExtGState soft-mask evaluation and rendering follow PDF.js `handleSMask`,
377
+ `beginGroup`, `_prepareSMaskCanvas`, and `_bakeSMaskCanvas` at the same revision
378
+ (Mozilla Foundation, Apache-2.0). The adapter captures page-coordinate mask
379
+ paints, resets group alpha/blend/soft-mask state, converts the luminosity
380
+ backdrop before filtering, and builds a 256-entry transfer table. Isolated
381
+ Forms retain their own paint groups so outer opacity is applied once.
382
+ Bitmap masks retain only the current prepared surface; SVG masks use the
383
+ export resolution while isolated Form contents remain vector groups.
384
+ `soft-mask.test.ts` ports four unchanged upstream equality fixtures, recorded
385
+ in `src/fixtures/SOURCES.md`, and adds local alpha/transform/group tests plus
386
+ the original issue17069 signature regression. Soft-mask evaluation is bounded
387
+ by the existing eight-level Form limit; mask-only text is excluded from extraction.
388
+
362
389
  Malformed dictionary-key recovery follows PDF.js `Parser.getObj`, skipping
363
390
  stray non-Name tokens only in local repair mode. Damaged optional ToUnicode
364
391
  streams follow `PartialEvaluator.readToUnicode` error recovery while retaining