@poe-platform/safe-bash 0.1.771 → 0.1.773

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 (42) hide show
  1. package/dist/image-ast/index.browser.js +2801 -556
  2. package/dist/image-ast/index.js +2801 -556
  3. package/dist/pdf-ast/ast.d.ts +7 -0
  4. package/dist/pdf-ast/content/evaluator.d.ts +1 -0
  5. package/dist/pdf-ast/index.js +2845 -568
  6. package/dist/pdf-ast/render/raster.d.ts +1 -0
  7. package/dist/pdf-ast/vendor/pdfjs-fonts.d.mts +24 -0
  8. package/dist/pdf-ast/vendor/pdfjs-fonts.mjs +2621 -0
  9. package/dist/safe-bash/chunks/{chunk-FSH7QRIC.js → chunk-Z3HX3ZBA.js} +10 -4
  10. package/dist/safe-bash/command-chunks/{chunk-M2XU2YCK.js → chunk-5VXZSNM2.js} +2 -2
  11. package/dist/safe-bash/command-chunks/{chunk-C4AAJTXF.js → chunk-B2MM5DIT.js} +2804 -556
  12. package/dist/safe-bash/command-chunks/{chunk-NBENXODJ.js → chunk-G3NVK25P.js} +1 -1
  13. package/dist/safe-bash/commands/python/host-capabilities.js +15 -6
  14. package/dist/safe-bash/commands/python/index.browser.js +1 -1
  15. package/dist/safe-bash/core.browser.js +39 -39
  16. package/dist/safe-bash/core.d.ts +1 -1
  17. package/dist/safe-bash/plugins/composition.d.ts +2 -0
  18. package/dist/safe-bash/plugins/composition.js +2 -1
  19. package/dist/safe-bash-command-ffmpeg/index.js +10968 -9719
  20. package/dist/safe-bash-command-gh/index.d.ts +1 -0
  21. package/dist/safe-bash-command-gh/index.js +43 -13
  22. package/dist/safe-bash-command-gh/types.d.ts +1 -0
  23. package/dist/safe-bash-command-git/git_rust.wasm +0 -0
  24. package/dist/safe-bash-command-git/index.js +22 -15
  25. package/dist/safe-bash-command-git/wasm.generated.js +1 -1
  26. package/dist/safe-bash-command-imagemagick/index.js +2 -2
  27. package/dist/safe-bash-command-pandoc/command.js +3 -3
  28. package/dist/safe-bash-command-pandoc/index.js +3 -3
  29. package/dist/safe-bash-command-pdfimages/index.js +2800 -510
  30. package/dist/safe-bash-command-pdfinfo/index.js +2842 -568
  31. package/dist/safe-bash-command-pdftk/index.js +2800 -510
  32. package/dist/safe-bash-command-pdftoppm/index.js +2847 -637
  33. package/dist/safe-bash-command-pdftotext/index.js +2800 -510
  34. package/dist/safe-bash-command-qpdf/index.js +2800 -510
  35. package/dist/safe-bash-command-sips/index.js +2 -2
  36. package/dist/safe-bash-command-soffice/index.js +1 -1
  37. package/dist/safe-bash-command-ssconvert/index.js +2811 -566
  38. package/dist/safe-bash-command-wkhtmltopdf/index.js +2833 -510
  39. package/dist/safe-bash-mcp/index.d.ts +8 -2
  40. package/dist/safe-bash-mcp/index.js +13 -6
  41. package/package.json +7 -7
  42. package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +62 -1
@@ -292,7 +292,10 @@ interface OAuthClientProvider$1 {
292
292
  requestUrl: URL;
293
293
  response: Response;
294
294
  challenge: OAuthUnauthorizedChallenge$1 | null;
295
- discovery: OAuthDiscoveryResult$1;
295
+ /** Validated metadata supplied by direct callers, if already available. */
296
+ discovery?: OAuthDiscoveryResult$1;
297
+ /** Lazy validated metadata; invoke only when OAuth recovery needs it. */
298
+ discover?: () => Promise<OAuthDiscoveryResult$1>;
296
299
  fetch: OAuthMetadataFetch$1;
297
300
  signal?: AbortSignal;
298
301
  /** Headers actually attached to this rejected request. */
@@ -983,7 +986,10 @@ interface OAuthClientProvider {
983
986
  requestUrl: URL;
984
987
  response: Response;
985
988
  challenge: OAuthUnauthorizedChallenge | null;
986
- discovery: OAuthDiscoveryResult;
989
+ /** Validated metadata supplied by direct callers, if already available. */
990
+ discovery?: OAuthDiscoveryResult;
991
+ /** Lazy validated metadata; invoke only when OAuth recovery needs it. */
992
+ discover?: () => Promise<OAuthDiscoveryResult>;
987
993
  fetch: OAuthMetadataFetch;
988
994
  signal?: AbortSignal;
989
995
  /** Headers actually attached to this rejected request. */
@@ -2120,7 +2120,10 @@ function createDefaultOAuthClientProvider(options) {
2120
2120
  };
2121
2121
  assertNoAccessTokenInUrl(input.requestUrl, "Protected resource request URL");
2122
2122
  const requestUrl = canonicalizeResourceIndicator(input.requestUrl);
2123
- const resource = canonicalizeResourceIndicator(input.discovery.resource);
2123
+ const discovery = input.discovery ?? structuredClone(await waitForOAuthOperation(input.discover?.() ?? Promise.reject(new Error("OAuth recovery requires metadata discovery")), input.signal));
2124
+ if (discovery === void 0)
2125
+ throw new Error("OAuth recovery requires metadata discovery");
2126
+ const resource = canonicalizeResourceIndicator(discovery.resource);
2124
2127
  assertRequestMatchesResource(requestUrl, resource);
2125
2128
  const cached = await waitForOAuthOperation(loadSession(resource), input.signal);
2126
2129
  const currentTokens = cached?.tokens ?? (!initialGrantConsumed && initialGrant?.resource === resource ? initialGrant.tokens : void 0);
@@ -2140,7 +2143,7 @@ function createDefaultOAuthClientProvider(options) {
2140
2143
  }
2141
2144
  const forceRefresh = rejectedCurrentGrant && (challengeError === "invalid_token" || input.presentedTokens !== void 0 && challengeError === void 0);
2142
2145
  const session = await ensureAuthorizedSession(resource, {
2143
- ...input.discovery,
2146
+ ...discovery,
2144
2147
  resource
2145
2148
  }, input.fetch, true, forceRefresh, input.signal, presentedTokens);
2146
2149
  if (session?.tokens?.accessToken === void 0) {
@@ -8284,7 +8287,10 @@ function createDefaultOAuthClientProvider2(options) {
8284
8287
  };
8285
8288
  assertNoAccessTokenInUrl2(input.requestUrl, "Protected resource request URL");
8286
8289
  const requestUrl = canonicalizeResourceIndicator2(input.requestUrl);
8287
- const resource = canonicalizeResourceIndicator2(input.discovery.resource);
8290
+ const discovery = input.discovery ?? structuredClone(await waitForOAuthOperation2(input.discover?.() ?? Promise.reject(new Error("OAuth recovery requires metadata discovery")), input.signal));
8291
+ if (discovery === void 0)
8292
+ throw new Error("OAuth recovery requires metadata discovery");
8293
+ const resource = canonicalizeResourceIndicator2(discovery.resource);
8288
8294
  assertRequestMatchesResource2(requestUrl, resource);
8289
8295
  const cached = await waitForOAuthOperation2(loadSession(resource), input.signal);
8290
8296
  const currentTokens = cached?.tokens ?? (!initialGrantConsumed && initialGrant?.resource === resource ? initialGrant.tokens : void 0);
@@ -8304,7 +8310,7 @@ function createDefaultOAuthClientProvider2(options) {
8304
8310
  }
8305
8311
  const forceRefresh = rejectedCurrentGrant && (challengeError === "invalid_token" || input.presentedTokens !== void 0 && challengeError === void 0);
8306
8312
  const session = await ensureAuthorizedSession(resource, {
8307
- ...input.discovery,
8313
+ ...discovery,
8308
8314
  resource
8309
8315
  }, input.fetch, true, forceRefresh, input.signal, presentedTokens);
8310
8316
  if (session?.tokens?.accessToken === void 0) {
@@ -10799,7 +10805,8 @@ var HttpTransport = class {
10799
10805
  try {
10800
10806
  const challenge = parseBearerWwwAuthenticateHeader(response.headers.get("WWW-Authenticate"));
10801
10807
  const resourceMetadataUrl = challenge?.params.resource_metadata;
10802
- const discovery = await discoveryClient.discover(this.url, { resourceMetadataUrl, signal });
10808
+ let discovery;
10809
+ const discover = () => discovery ??= discoveryClient.discover(this.url, { resourceMetadataUrl, signal });
10803
10810
  const providerResponse = response.clone();
10804
10811
  let result;
10805
10812
  try {
@@ -10807,7 +10814,7 @@ var HttpTransport = class {
10807
10814
  requestUrl: new URL(this.url),
10808
10815
  response: providerResponse,
10809
10816
  challenge,
10810
- discovery,
10817
+ discover,
10811
10818
  signal,
10812
10819
  requestHeaders: new Headers(requestHeaders),
10813
10820
  presentedTokens,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.771",
3
+ "version": "0.1.773",
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.771",
844
+ "@poe-platform/safe-fs": "0.1.773",
845
845
  "pdf-lib": "1.17.1",
846
846
  "@noble/hashes": "2.4.0",
847
847
  "pako": "3.0.1",
@@ -860,16 +860,16 @@
860
860
  "browser": "./dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.js",
861
861
  "default": "./dist/safe-bash/commands/archive/zip/aes-primitives.js"
862
862
  },
863
+ "#git-wasm": {
864
+ "types": "./dist/safe-bash-command-git/runtime.d.ts",
865
+ "workerd": "./dist/safe-bash-command-git/runtime.workerd.js",
866
+ "default": "./dist/safe-bash-command-git/runtime.js"
867
+ },
863
868
  "#safe-bash-network-platform": {
864
869
  "types": "./dist/safe-bash/commands/network/platform.d.ts",
865
870
  "workerd": "./dist/safe-bash/commands/network/platform-portable.js",
866
871
  "browser": "./dist/safe-bash/commands/network/platform-portable.js",
867
872
  "default": "./dist/safe-bash/commands/network/platform.js"
868
- },
869
- "#git-wasm": {
870
- "types": "./dist/safe-bash-command-git/runtime.d.ts",
871
- "workerd": "./dist/safe-bash-command-git/runtime.workerd.js",
872
- "default": "./dist/safe-bash-command-git/runtime.js"
873
873
  }
874
874
  },
875
875
  "peerDependencies": {
@@ -406,7 +406,68 @@ and intermediate-surface state reset. Bitmap and SVG exports follow
406
406
  ports the unchanged `transparency_group.pdf` and `bug1873345.pdf` equality
407
407
  fixtures, with independently obtained reference pixels. Full non-isolated
408
408
  backdrop compositing for groups with outer effects retains PDF.js's documented
409
- limitation. Form contents remain vectors in SVG output.
409
+ limitation.
410
+
411
+ Masked non-isolated Forms with inner blending or soft-mask effects follow
412
+ PDF.js `beginGroup`'s `needsBackdropCopy && inSMaskMode` path. The raster adapter
413
+ copies the existing page within the transformed Form BBox before painting the
414
+ group; ordinary outer-opacity groups keep their transparent intermediate.
415
+ `src/render/masked-group-backdrop.test.ts` covers this distinction and the
416
+ unchanged `issue13520.pdf` fixture. SVG uses a raster fallback for pages requiring
417
+ this backdrop copy; other Form groups retain their vector output.
418
+
419
+ CropBox handling follows PDF.js `Page.getBoundingBox` and `Page.view` in
420
+ `src/core/document.js`, and the SVG corner transform follows
421
+ `PageViewport.convertToViewportRectangle`. The adaptation stores bounds on the
422
+ local display list and crops before page rotation, keeping editing coordinates
423
+ unchanged. `src/render/crop-box.test.ts` covers these rules and the unmodified
424
+ `issue13520.pdf` equality fixture, recorded in `src/fixtures/SOURCES.md`.
425
+
426
+ MediaBox-origin rendering follows PDF.js `PageViewport` in
427
+ `src/display/page_viewport.js`: viewport coordinates subtract the normalized
428
+ lower-left page origin before applying rotation. Local rasterization applies
429
+ that translation to paths, strokes, images, clips, and intermediate mask/group
430
+ surfaces; SVG uses the vendored viewport transform. The unchanged PDF.js
431
+ `bug852992_reduced.pdf` soft-mask fixture and memory-only offset-page tests cover
432
+ this behavior in `src/render/media-box-origin.test.ts`.
433
+
434
+ Sampled-function interpolation adapts PDF.js `PDFFunction.constructSampled`
435
+ in `src/core/function.js`. The local evaluator reads the weighted neighboring
436
+ samples directly, supports unsigned packed samples through 32 bits, and handles
437
+ singleton axes without reading outside the table. Its degenerate-Domain test
438
+ is ported from `test/unit/colorspace_spec.js` (AlternateCS), with assertions on
439
+ the tint components before color conversion. The unchanged
440
+ `bug852992_reduced.pdf` fixture also verifies the restored soft-mask fade.
441
+
442
+ Exponential and stitched function evaluation follows PDF.js
443
+ `PDFFunction.constructInterpolated` and `constructStitched` in the same source:
444
+ apply the exponent to the input, and pass the stitched Encode result to the
445
+ child without rescaling it to a unit interval. Local memory-only regressions
446
+ cover non-unit domains, zero/negative exponents, output ranges, segment bounds,
447
+ reversed encoding, and image tint consistency. Domain and Range clipping also
448
+ follow the PDF function contract.
449
+
450
+ Calculator functions use the unmodified PDF.js `buildPostScriptJsFunction`
451
+ from `src/core/postscript/js_evaluator.js`, together with its AST and lexer.
452
+ The JavaScript evaluator interprets instructions without `eval`, `Function`,
453
+ or WebAssembly compilation. Compiled functions are cached weakly by COS stream;
454
+ code, Domain, or Range edits invalidate the entry. `pdfjs-postscript.test.ts`
455
+ ports 35 complete input/output vectors from `test/unit/postscript_spec.js`,
456
+ alongside comment, image-function integration, and edit-invalidation coverage.
457
+
458
+ The vendor bundle includes unmodified PDF.js `DeviceCmykCS` from
459
+ `src/core/colorspace.js`. Path, shading, and image color conversion use this
460
+ class directly, including CMYK palette entries and alternate tint colors.
461
+ `src/render/cmyk-colors.test.ts` ports the byte and floating-point reference
462
+ vectors from PDF.js `test/unit/colorspace_spec.js`, through local PDF APIs.
463
+
464
+ The same bundle exports unmodified `CalGrayCS`, `CalRGBCS`, and `LabCS`.
465
+ The shared calibrated-color adapter resolves COS parameters before calling
466
+ these classes. Paths, gradients, images, palettes, and calibrated alternate
467
+ tint spaces use the same converters. `calibrated-colors.test.ts` ports the
468
+ corresponding PDF.js `colorspace_spec.js` input/output vectors through those
469
+ APIs and the unchanged `calgray.pdf` equality fixture. Missing WhitePoint
470
+ retains the local D65 fallback for malformed input.
410
471
 
411
472
  Malformed dictionary-key recovery follows PDF.js `Parser.getObj`, skipping
412
473
  stray non-Name tokens only in local repair mode. Damaged optional ToUnicode