@poe-platform/safe-bash 0.1.759 → 0.1.761
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.
- package/dist/image-ast/index.browser.js +74 -17
- package/dist/image-ast/index.js +74 -17
- package/dist/pdf-ast/ast.d.ts +8 -3
- package/dist/pdf-ast/index.js +80 -20
- package/dist/safe-bash/chunks/{chunk-AYPUGSOV.js → chunk-CRQDMBQA.js} +123 -8
- package/dist/safe-bash/command-chunks/{chunk-HVEAK3OS.js → chunk-6VX5ZQL5.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-7JA44PVV.js → chunk-GR725WRX.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-BAUGDXLZ.js → chunk-OSMLVM7P.js} +79 -17
- package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
- package/dist/safe-bash/commands/htmlq/index.js +4 -1
- package/dist/safe-bash/commands/python/index.browser.js +1 -1
- package/dist/safe-bash/commands/python/index.d.ts +1 -1
- package/dist/safe-bash/commands/python/llm-capability.d.ts +7 -3
- package/dist/safe-bash/commands/python/llm-capability.js +149 -10
- package/dist/safe-bash/core.browser.js +4 -3
- package/dist/safe-bash/shell/runtime.js +1 -1
- package/dist/safe-bash-command-ffmpeg/index.js +3125 -3085
- package/dist/safe-bash-command-gh/index.js +128 -27
- package/dist/safe-bash-command-git/LICENSE +21 -0
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +74 -17
- package/dist/safe-bash-command-pdfinfo/index.js +78 -20
- package/dist/safe-bash-command-pdftk/index.js +74 -17
- package/dist/safe-bash-command-pdftoppm/index.js +78 -20
- package/dist/safe-bash-command-pdftotext/index.js +74 -17
- package/dist/safe-bash-command-qpdf/index.js +74 -17
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +74 -17
- package/dist/safe-bash-command-wkhtmltopdf/index.js +74 -17
- package/dist/safe-bash-io-engine/internal.d.ts +2 -2
- package/dist/safe-bash-mcp/index.d.ts +1 -1
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +30 -0
- package/third-party/pdf-ast/licenses/AGG-2.3.txt +7 -0
- package/third-party/pdf-ast/licenses/MIT.txt +21 -0
|
@@ -11952,7 +11952,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
11952
11952
|
const [x, y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
11953
11953
|
transformedSegments.push({ kind: "cubic", x1, y1, x2, y2, x, y });
|
|
11954
11954
|
} else if (seg.kind === "rect") {
|
|
11955
|
-
if (hasRotOrShear) {
|
|
11955
|
+
if (hasRotOrShear || seg.width * st.ctm[0] < 0 || seg.height * st.ctm[3] < 0) {
|
|
11956
11956
|
const [p0x, p0y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
11957
11957
|
const [p1x, p1y] = transformPoint(st.ctm, seg.x + seg.width, seg.y);
|
|
11958
11958
|
const [p2x, p2y] = transformPoint(st.ctm, seg.x + seg.width, seg.y + seg.height);
|
|
@@ -11985,7 +11985,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
11985
11985
|
transformedSegments.push({ kind: "close" });
|
|
11986
11986
|
}
|
|
11987
11987
|
}
|
|
11988
|
-
|
|
11988
|
+
const applyClip = () => {
|
|
11989
|
+
if (!node.clip) return;
|
|
11990
|
+
st.clipPaths = [...st.clipPaths ?? [], {
|
|
11991
|
+
segments: transformedSegments,
|
|
11992
|
+
fillRule: node.clip === "W*" ? "evenodd" : "nonzero"
|
|
11993
|
+
}];
|
|
11989
11994
|
let cMinX = Infinity, cMinY = Infinity, cMaxX = -Infinity, cMaxY = -Infinity;
|
|
11990
11995
|
for (const s of transformedSegments) {
|
|
11991
11996
|
if (s.kind === "move" || s.kind === "line") {
|
|
@@ -12013,8 +12018,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
12013
12018
|
Math.min(st.clipRect[3], cMaxY)
|
|
12014
12019
|
] : [cMinX, cMinY, cMaxX, cMaxY];
|
|
12015
12020
|
}
|
|
12021
|
+
};
|
|
12022
|
+
if (node.paint === "n") {
|
|
12023
|
+
applyClip();
|
|
12024
|
+
break;
|
|
12016
12025
|
}
|
|
12017
|
-
if (node.paint === "n") break;
|
|
12018
12026
|
const isFill = ["f", "F", "f*", "B", "B*", "b", "b*"].includes(node.paint);
|
|
12019
12027
|
const isStroke = ["S", "s", "B", "B*", "b", "b*"].includes(node.paint);
|
|
12020
12028
|
let evaluatedFillPattern = false;
|
|
@@ -12147,7 +12155,10 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
12147
12155
|
}
|
|
12148
12156
|
}
|
|
12149
12157
|
}
|
|
12150
|
-
if (evaluatedFillPattern && !isStroke)
|
|
12158
|
+
if (evaluatedFillPattern && !isStroke) {
|
|
12159
|
+
applyClip();
|
|
12160
|
+
break;
|
|
12161
|
+
}
|
|
12151
12162
|
const fillRule = node.paint.includes("*") ? "evenodd" : "nonzero";
|
|
12152
12163
|
const ctmScale = Math.max(1e-6, Math.hypot(st.ctm[0], st.ctm[1]));
|
|
12153
12164
|
const scaledStrokeWidth = st.strokeWidth === 0 ? 0 : st.strokeWidth * ctmScale;
|
|
@@ -12167,6 +12178,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
12167
12178
|
...st.dashPhase !== void 0 ? { dashPhase: st.dashPhase } : {},
|
|
12168
12179
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
12169
12180
|
} });
|
|
12181
|
+
applyClip();
|
|
12170
12182
|
break;
|
|
12171
12183
|
}
|
|
12172
12184
|
case "xobject": {
|
|
@@ -13916,6 +13928,39 @@ function createTrueTypeFontHandle(truetype) {
|
|
|
13916
13928
|
}
|
|
13917
13929
|
};
|
|
13918
13930
|
}
|
|
13931
|
+
function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
13932
|
+
const points = [[x1, y1]];
|
|
13933
|
+
const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
|
|
13934
|
+
if (level > 16) return;
|
|
13935
|
+
const abx = (ax + bx) / 2, aby = (ay + by) / 2;
|
|
13936
|
+
const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
|
|
13937
|
+
const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
|
|
13938
|
+
const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
|
|
13939
|
+
const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
|
|
13940
|
+
const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
|
|
13941
|
+
const chordX = dx - ax, chordY = dy - ay;
|
|
13942
|
+
const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
|
|
13943
|
+
const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
|
|
13944
|
+
const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
|
|
13945
|
+
if (!significant2 && !significant3) {
|
|
13946
|
+
if (Math.abs(ax + cx - 2 * bx) + Math.abs(ay + cy - 2 * by) + Math.abs(bx + dx - 2 * cx) + Math.abs(by + dy - 2 * cy) <= 4) {
|
|
13947
|
+
points.push([midx, midy]);
|
|
13948
|
+
return;
|
|
13949
|
+
}
|
|
13950
|
+
} else {
|
|
13951
|
+
const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
|
|
13952
|
+
if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
|
|
13953
|
+
points.push([bcx, bcy]);
|
|
13954
|
+
return;
|
|
13955
|
+
}
|
|
13956
|
+
}
|
|
13957
|
+
subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
|
|
13958
|
+
subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
|
|
13959
|
+
};
|
|
13960
|
+
subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
|
|
13961
|
+
points.push([x4, y4]);
|
|
13962
|
+
return points;
|
|
13963
|
+
}
|
|
13919
13964
|
function decodePng(pngBytes) {
|
|
13920
13965
|
if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
|
|
13921
13966
|
throw new Error("Invalid PNG signature");
|
|
@@ -14367,14 +14412,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
14367
14412
|
const [p1x, p1y] = toScreen(seg.x1, seg.y1);
|
|
14368
14413
|
const [p2x, p2y] = toScreen(seg.x2, seg.y2);
|
|
14369
14414
|
const [p3x, p3y] = toScreen(seg.x, seg.y);
|
|
14370
|
-
const
|
|
14415
|
+
const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
|
|
14371
14416
|
let px = curX;
|
|
14372
14417
|
let py = curY;
|
|
14373
|
-
for (let
|
|
14374
|
-
const
|
|
14375
|
-
const mt = 1 - t;
|
|
14376
|
-
const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
|
|
14377
|
-
const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
|
|
14418
|
+
for (let i = 1; i < points.length; i++) {
|
|
14419
|
+
const [qx, qy] = points[i];
|
|
14378
14420
|
edges.push({ x0: px, y0: py, x1: qx, y1: qy });
|
|
14379
14421
|
px = qx;
|
|
14380
14422
|
py = qy;
|
|
@@ -14393,8 +14435,8 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
14393
14435
|
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
14394
14436
|
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
14395
14437
|
}
|
|
14396
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y
|
|
14397
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y);
|
|
14438
|
+
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
14439
|
+
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
14398
14440
|
edges.push(
|
|
14399
14441
|
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
14400
14442
|
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
@@ -14537,21 +14579,24 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
14537
14579
|
}
|
|
14538
14580
|
const aaVec = options.antialiasVector !== false;
|
|
14539
14581
|
const aaTxt = options.antialiasText !== false;
|
|
14540
|
-
|
|
14582
|
+
let cachedClips;
|
|
14583
|
+
let cachedClipMask;
|
|
14541
14584
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
14542
14585
|
for (const original of paintOperations(displayList)) {
|
|
14543
14586
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
14544
14587
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
14545
14588
|
const clips = original.value.clipPaths;
|
|
14546
|
-
let clipMask = clips
|
|
14589
|
+
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
14547
14590
|
if (clips && !clipMask) {
|
|
14548
14591
|
clipMask = new Uint8Array(width * height * 4).fill(255);
|
|
14549
|
-
for (const
|
|
14592
|
+
for (const clip of clips) {
|
|
14593
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
14550
14594
|
const layer = new Uint8Array(width * height * 4);
|
|
14551
|
-
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 });
|
|
14595
|
+
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
14552
14596
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
14553
14597
|
}
|
|
14554
|
-
|
|
14598
|
+
cachedClips = clips;
|
|
14599
|
+
cachedClipMask = clipMask;
|
|
14555
14600
|
}
|
|
14556
14601
|
const imageClips = original.value.clipImages;
|
|
14557
14602
|
if (imageClips) {
|
|
@@ -43287,3 +43332,15 @@ export {
|
|
|
43287
43332
|
* Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
|
|
43288
43333
|
* See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
|
|
43289
43334
|
*/
|
|
43335
|
+
/*!
|
|
43336
|
+
* Anti-Grain Geometry - Version 2.3
|
|
43337
|
+
* Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
|
43338
|
+
*
|
|
43339
|
+
* Permission to copy, use, modify, sell and distribute this software
|
|
43340
|
+
* is granted provided this copyright notice appears in all copies.
|
|
43341
|
+
* This software is provided "as is" without express or implied
|
|
43342
|
+
* warranty, and with no claim as to its suitability for any purpose.
|
|
43343
|
+
*
|
|
43344
|
+
* Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
|
|
43345
|
+
* See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
|
|
43346
|
+
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ByteSource, type CommandContext, type CommandDefinition, type CommandHandler, type CommandResult } from "../safe-bash-contracts/index.js";
|
|
2
2
|
export declare const RESOLVED_EXIT_ZERO: Promise<CommandResult>;
|
|
3
3
|
export declare const RESOLVED_EXIT_ONE: Promise<CommandResult>;
|
|
4
|
-
export declare const encoder: TextEncoder
|
|
5
|
-
export declare const decoder: TextDecoder
|
|
4
|
+
export declare const encoder: InstanceType<typeof TextEncoder>;
|
|
5
|
+
export declare const decoder: InstanceType<typeof TextDecoder>;
|
|
6
6
|
export declare const bufferLimit: number;
|
|
7
7
|
export { builtInDirectContextExecutors } from "../safe-bash-contracts/runtime-control.js";
|
|
8
8
|
export { isDefaultCommandOptions, registerDefaultExecutor, registerDefaultExecutors } from "../safe-bash-contracts/command.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable, Writable } from 'node:stream';
|
|
2
2
|
import http from 'node:http';
|
|
3
|
-
import { CommandDefinition, VirtualShellPlugin } from
|
|
3
|
+
import { CommandDefinition, VirtualShellPlugin } from '@poe-platform/safe-bash/contracts';
|
|
4
4
|
|
|
5
5
|
type JsonSchemaRegistry = Record<string, unknown>;
|
|
6
6
|
interface CompileJsonSchemaOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-bash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.761",
|
|
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.
|
|
844
|
+
"@poe-platform/safe-fs": "0.1.761",
|
|
845
845
|
"pdf-lib": "1.17.1",
|
|
846
846
|
"@noble/hashes": "2.4.0",
|
|
847
847
|
"pako": "3.0.1",
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# pdf-ast licensing
|
|
2
|
+
|
|
3
|
+
Original code is MIT-licensed; see `licenses/MIT.txt`. The bundled and adapted
|
|
4
|
+
components below retain their respective terms and notices.
|
|
5
|
+
|
|
1
6
|
# Mozilla PDF.js
|
|
2
7
|
|
|
3
8
|
The numeric recovery and malformed-command handling in `src/cos/lexer.ts`, and
|
|
@@ -185,6 +190,31 @@ a wider codespace. `src/fonts/simple-font-codespace.test.ts` checks that behavio
|
|
|
185
190
|
and the original upstream issue17069 equality fixture, including TJ fragments,
|
|
186
191
|
word spacing, Unicode labels spanning multiple characters, and save/reopen.
|
|
187
192
|
|
|
193
|
+
Ordinary clipping follows PDF.js `CanvasGraphics.consumePath`: install pending
|
|
194
|
+
`W`/`W*` intersections after painting the current path, retaining nonzero/even-odd
|
|
195
|
+
winding and implicit closure. `src/render/path-clipping.test.ts` ports the normal
|
|
196
|
+
rendering assertions from `test/unit/api_spec.js`'s `should render with
|
|
197
|
+
operationsFilter` case (7200 black and 12800 white pixels) and the unchanged
|
|
198
|
+
`clippath.pdf` fixture. Other local cases cover curves, reversed rectangles,
|
|
199
|
+
transforms, save/restore, text/image intersections, and issue17069's signature.
|
|
200
|
+
|
|
201
|
+
# PDFium / Anti-Grain Geometry curve subdivision
|
|
202
|
+
|
|
203
|
+
`src/render/cubic.ts` adapts `curve4_div` from PDFium revision
|
|
204
|
+
`a84323421e94f484faca52dd9d027934eba42ab8`, file
|
|
205
|
+
`third_party/agg23/agg_curves.cpp` (Anti-Grain Geometry 2.3).
|
|
206
|
+
Copyright (C) 2002–2005 Maxim Shemanarev. Permission terms are retained in the
|
|
207
|
+
source and `licenses/AGG-2.3.txt`.
|
|
208
|
+
|
|
209
|
+
The TypeScript adapter uses double-precision numbers and arrays, merges the
|
|
210
|
+
equivalent one/two-control-point distance cases, and keeps the upstream
|
|
211
|
+
half-pixel flatness, collinearity handling, and recursion limit of 16.
|
|
212
|
+
`src/render/cubic-flattening.test.ts` compares against points generated by
|
|
213
|
+
compiling the unchanged upstream C++ algorithm with a minimal vector-storage
|
|
214
|
+
adapter; other cases use independently rendered PDF.js pixels.
|
|
215
|
+
|
|
216
|
+
Source: https://github.com/chromium/pdfium/blob/a84323421e94f484faca52dd9d027934eba42ab8/third_party/agg23/agg_curves.cpp
|
|
217
|
+
|
|
188
218
|
|
|
189
219
|
# SVG labels
|
|
190
220
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Anti-Grain Geometry - Version 2.3
|
|
2
|
+
Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
|
3
|
+
|
|
4
|
+
Permission to copy, use, modify, sell and distribute this software
|
|
5
|
+
is granted provided this copyright notice appears in all copies.
|
|
6
|
+
This software is provided "as is" without express or implied
|
|
7
|
+
warranty, and with no claim as to its suitability for any purpose.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Poe Platform
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|