@poe-platform/safe-bash 0.1.744 → 0.1.745
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/README.md +5 -0
- package/dist/safe-bash/chunks/{chunk-2CO4WCMK.js → chunk-EAUCLWEZ.js} +16 -5
- package/dist/safe-bash/chunks/{chunk-WN7FYUWU.js → chunk-MC2KZY3D.js} +26 -13
- package/dist/safe-bash/chunks/{pdf-renderer-3TVUXNBT.js → pdf-renderer-4APIM7F7.js} +2 -2
- package/dist/safe-bash/chunks/{src-5VZS2ZKB.js → src-FTMTU65U.js} +2 -2
- package/dist/safe-bash/core.browser.js +1057 -619
- package/dist/safe-bash/opt-in/shell/extensions/read/index.js +1 -2
- package/dist/safe-bash/playwright/capability-events.d.ts +7 -0
- package/dist/safe-bash/playwright/capability-events.js +11 -3
- package/dist/safe-bash/playwright/controller.d.ts +14 -0
- package/dist/safe-bash/playwright/controller.js +36 -8
- package/dist/safe-bash/playwright/index.d.ts +1 -0
- package/dist/safe-bash/playwright/index.js +1 -0
- package/dist/safe-bash/shell/runtime.d.ts +14 -1
- package/dist/safe-bash/shell/runtime.js +1395 -717
- package/dist/safe-bash-command-ssconvert/index.js +15 -4
- package/dist/safe-bash-command-wkhtmltopdf/index.js +24 -11
- package/dist/safe-bash-command-wkhtmltopdf/limits.d.ts +1 -1
- package/dist/safe-bash-command-wkhtmltopdf/resources.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -595,6 +595,11 @@ Hosts accepting direct browser activity can call `renewSession({ name, context }
|
|
|
595
595
|
to renew that exact retained session's idle deadline without browser commands.
|
|
596
596
|
Browser snapshots have no byte limit, including automatic snapshots after
|
|
597
597
|
navigation. Legacy `maxSnapshotBytes` settings are ignored.
|
|
598
|
+
Pass `onSnapshot` to `createPlaywrightCli` or `createPlaywrightController` to inspect
|
|
599
|
+
navigation response headers and call `recapture()` before publishing YAML or JSON.
|
|
600
|
+
Page URL and title reflect changes made by the hook. The `/playwright` entrypoint
|
|
601
|
+
also exports `getPlaywrightMainFrameNavigation(context, page)` for passive metadata
|
|
602
|
+
reads. See the [snapshot hook contract](src/contracts/playwright-snapshot.md).
|
|
598
603
|
`playwright-cli --help` and `playwright-cli show --help` report dashboard
|
|
599
604
|
availability. Without a host dashboard ability, interactive local browser login is unavailable;
|
|
600
605
|
use the authentication flow supplied by the host application.
|
|
@@ -86878,6 +86878,16 @@ async function readLotus(bytes, context2) {
|
|
|
86878
86878
|
active = -1;
|
|
86879
86879
|
continue;
|
|
86880
86880
|
}
|
|
86881
|
+
if (version2 >= 4099 && version2 <= 4101 && id === 35) {
|
|
86882
|
+
consumeOperation();
|
|
86883
|
+
if (length < 5) await warn(`Record with type 0x23 has wrong length ${length}.`);
|
|
86884
|
+
else {
|
|
86885
|
+
const nameBytes = data4.bytes.subarray(4), zero = nameBytes.indexOf(0);
|
|
86886
|
+
const name5 = new TextDecoder("windows-1252").decode(zero < 0 ? nameBytes : nameBytes.subarray(0, zero));
|
|
86887
|
+
if (name5) sheet(data4.u16(2)).name = name5;
|
|
86888
|
+
}
|
|
86889
|
+
continue;
|
|
86890
|
+
}
|
|
86881
86891
|
if (id === (modern ? 9 : 11)) {
|
|
86882
86892
|
consumeOperation();
|
|
86883
86893
|
if (length < (modern ? 26 : 24)) {
|
|
@@ -87072,11 +87082,12 @@ async function readLotus(bytes, context2) {
|
|
|
87072
87082
|
else {
|
|
87073
87083
|
const subtype = data4.u16(0);
|
|
87074
87084
|
if (subtype === 14e3) {
|
|
87075
|
-
|
|
87085
|
+
consumeOperation();
|
|
87086
|
+
if (length < 5) await warn(`Record with type 0x1b has wrong length ${length}.`);
|
|
87076
87087
|
else {
|
|
87077
|
-
|
|
87078
|
-
const
|
|
87079
|
-
sheet(data4.
|
|
87088
|
+
const nameBytes = data4.bytes.subarray(4), zero = nameBytes.indexOf(0);
|
|
87089
|
+
const name5 = new TextDecoder("windows-1252").decode(zero < 0 ? nameBytes : nameBytes.subarray(0, zero));
|
|
87090
|
+
if (name5) sheet(data4.u16(2)).name = name5;
|
|
87080
87091
|
}
|
|
87081
87092
|
} else if (subtype === 4001) {
|
|
87082
87093
|
if (length < 24) await warn(`Record with type 0x1b has wrong length ${length}.`);
|
|
@@ -164083,4 +164094,4 @@ tslib/tslib.js:
|
|
|
164083
164094
|
@noble/ciphers/utils.js:
|
|
164084
164095
|
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
|
|
164085
164096
|
*/
|
|
164086
|
-
//# sourceMappingURL=chunk-
|
|
164097
|
+
//# sourceMappingURL=chunk-EAUCLWEZ.js.map
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
// packages/safe-bash-command-wkhtmltopdf/src/pdf-renderer.ts
|
|
10
10
|
init_platform();
|
|
11
|
+
import { yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
11
12
|
|
|
12
13
|
// packages/pdf-ast/src/index.ts
|
|
13
14
|
init_platform();
|
|
@@ -14369,10 +14370,10 @@ var ParseBudget = class {
|
|
|
14369
14370
|
this.options = options;
|
|
14370
14371
|
this.checkCancellation();
|
|
14371
14372
|
this.limits = {
|
|
14372
|
-
maxArguments: options.limits?.maxArguments,
|
|
14373
|
-
maxTextBytes: options.limits?.maxTextBytes,
|
|
14374
|
-
maxObjects: options.limits?.maxObjects,
|
|
14375
|
-
maxWork: options.limits?.maxWork
|
|
14373
|
+
maxArguments: options.limits?.maxArguments ?? Infinity,
|
|
14374
|
+
maxTextBytes: options.limits?.maxTextBytes ?? Infinity,
|
|
14375
|
+
maxObjects: options.limits?.maxObjects ?? Infinity,
|
|
14376
|
+
maxWork: options.limits?.maxWork ?? Infinity
|
|
14376
14377
|
};
|
|
14377
14378
|
for (const value of Object.values(this.limits)) {
|
|
14378
14379
|
if (value !== Infinity && (!Number.isSafeInteger(value) || value < 1)) {
|
|
@@ -15039,7 +15040,13 @@ var byteLengthGetter = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byt
|
|
|
15039
15040
|
var byteTypeGetter = Object.getOwnPropertyDescriptor(typedArrayPrototype, Symbol.toStringTag).get;
|
|
15040
15041
|
var copyBytes = Uint8Array.prototype.set;
|
|
15041
15042
|
async function withResources(options, run) {
|
|
15042
|
-
const limits = {
|
|
15043
|
+
const limits = {
|
|
15044
|
+
maxInputBytes: options.limits?.maxInputBytes ?? Infinity,
|
|
15045
|
+
maxDecodedBytes: options.limits?.maxDecodedBytes ?? Infinity,
|
|
15046
|
+
maxRetainedBytes: options.limits?.maxRetainedBytes ?? Infinity,
|
|
15047
|
+
maxWork: options.limits?.maxWork ?? Infinity,
|
|
15048
|
+
maxResources: options.limits?.maxResources ?? Infinity
|
|
15049
|
+
};
|
|
15043
15050
|
for (const key of ["maxInputBytes", "maxDecodedBytes", "maxRetainedBytes", "maxWork", "maxResources"]) {
|
|
15044
15051
|
if (limits[key] !== Infinity && (!Number.isSafeInteger(limits[key]) || limits[key] < 1)) {
|
|
15045
15052
|
throw new WkhtmltopdfError("INVALID_VALUE", "Resource limits must be positive safe integers");
|
|
@@ -15468,7 +15475,7 @@ async function runWkhtmltopdf(context, options = {}) {
|
|
|
15468
15475
|
await writeBytes(stdout.output, encoder.encode(text), signal);
|
|
15469
15476
|
result = { kind: "information", exitCode: 0 };
|
|
15470
15477
|
} else {
|
|
15471
|
-
const renderer = options.renderer ?? (await import("./pdf-renderer-
|
|
15478
|
+
const renderer = options.renderer ?? (await import("./pdf-renderer-4APIM7F7.js")).pdfAstRenderer;
|
|
15472
15479
|
requireRendererFeatures(renderer.profile, []);
|
|
15473
15480
|
let outputBytes = 0;
|
|
15474
15481
|
let outputChunks = 0;
|
|
@@ -15826,7 +15833,7 @@ function extractLinks(html) {
|
|
|
15826
15833
|
}
|
|
15827
15834
|
return links;
|
|
15828
15835
|
}
|
|
15829
|
-
function parseHtmlDocument(rawHtml, replacements) {
|
|
15836
|
+
async function parseHtmlDocument(rawHtml, replacements, signal) {
|
|
15830
15837
|
let html = rawHtml;
|
|
15831
15838
|
for (const [key, value] of replacements) {
|
|
15832
15839
|
if (key) html = html.split(key).join(value);
|
|
@@ -15838,7 +15845,10 @@ function parseHtmlDocument(rawHtml, replacements) {
|
|
|
15838
15845
|
const tokenRegex = /<(h[1-6]|p|pre|ul|ol|dl|table|svg|hr|img|blockquote|div|section|article)\b([^>]*)>([\s\S]*?)<\/\1>|<(hr|img)\b([^>]*?)\/?>/gi;
|
|
15839
15846
|
let lastIndex = 0;
|
|
15840
15847
|
let match;
|
|
15848
|
+
let work = 0;
|
|
15841
15849
|
while ((match = tokenRegex.exec(bodyHtml)) !== null) {
|
|
15850
|
+
signal.throwIfAborted();
|
|
15851
|
+
if (++work % 64 === 0) await yieldTurn(signal);
|
|
15842
15852
|
const leadingText = stripTags(bodyHtml.slice(lastIndex, match.index));
|
|
15843
15853
|
if (leadingText) {
|
|
15844
15854
|
blocks.push({ kind: "paragraph", text: leadingText, links: extractLinks(bodyHtml.slice(lastIndex, match.index)) });
|
|
@@ -15968,7 +15978,7 @@ function parseHtmlDocument(rawHtml, replacements) {
|
|
|
15968
15978
|
}
|
|
15969
15979
|
} else {
|
|
15970
15980
|
if (/<(h[1-6]|p|pre|ul|ol|dl|table|svg|hr|img|blockquote|div|section|article)\b/i.test(inner)) {
|
|
15971
|
-
const nested = parseHtmlDocument(inner, []);
|
|
15981
|
+
const nested = await parseHtmlDocument(inner, [], signal);
|
|
15972
15982
|
blocks.push(...nested.blocks);
|
|
15973
15983
|
} else {
|
|
15974
15984
|
const text = stripTags(inner);
|
|
@@ -16015,7 +16025,7 @@ function rgbColor(r, g, b, grayscale) {
|
|
|
16015
16025
|
const lum = Math.round((0.299 * r + 0.587 * g + 0.114 * b) * 1e3) / 1e3;
|
|
16016
16026
|
return { r: lum, g: lum, b: lum };
|
|
16017
16027
|
}
|
|
16018
|
-
function layoutObjectPages(blocks, box, settings) {
|
|
16028
|
+
async function layoutObjectPages(blocks, box, settings, signal) {
|
|
16019
16029
|
const pages = [];
|
|
16020
16030
|
let currentActions = [];
|
|
16021
16031
|
const headerReserve = settings.header.left || settings.header.center || settings.header.right ? 24 : 0;
|
|
@@ -16034,7 +16044,10 @@ function layoutObjectPages(blocks, box, settings) {
|
|
|
16034
16044
|
flushPage();
|
|
16035
16045
|
}
|
|
16036
16046
|
};
|
|
16047
|
+
let work = 0;
|
|
16037
16048
|
for (const block of blocks) {
|
|
16049
|
+
signal.throwIfAborted();
|
|
16050
|
+
if (++work % 64 === 0) await yieldTurn(signal);
|
|
16038
16051
|
if (block.kind === "pagebreak") {
|
|
16039
16052
|
flushPage();
|
|
16040
16053
|
continue;
|
|
@@ -16353,11 +16366,11 @@ function createPdfAstRenderer() {
|
|
|
16353
16366
|
const obj = job.objects[i];
|
|
16354
16367
|
const htmlBytes = inputs[i] ?? new Uint8Array(0);
|
|
16355
16368
|
const htmlText = decoder3.decode(htmlBytes);
|
|
16356
|
-
const parsed = parseHtmlDocument(htmlText, obj.settings.replacements);
|
|
16369
|
+
const parsed = await parseHtmlDocument(htmlText, obj.settings.replacements, signal);
|
|
16357
16370
|
if (!inferredDocumentTitle && parsed.title) {
|
|
16358
16371
|
inferredDocumentTitle = parsed.title;
|
|
16359
16372
|
}
|
|
16360
|
-
const pages = layoutObjectPages(parsed.blocks, box, obj.settings);
|
|
16373
|
+
const pages = await layoutObjectPages(parsed.blocks, box, obj.settings, signal);
|
|
16361
16374
|
laidOutPerObject.push(pages);
|
|
16362
16375
|
objectMeta.push({
|
|
16363
16376
|
title: parsed.title || inferredDocumentTitle || "Document",
|
|
@@ -16389,7 +16402,7 @@ function createPdfAstRenderer() {
|
|
|
16389
16402
|
producer: "@poe-code/pdf-ast"
|
|
16390
16403
|
});
|
|
16391
16404
|
for (const outPage of sequence.pages) {
|
|
16392
|
-
signal
|
|
16405
|
+
await yieldTurn(signal);
|
|
16393
16406
|
const spec = laidOutPerObject[outPage.objectIndex][outPage.pageIndex];
|
|
16394
16407
|
const meta = objectMeta[outPage.objectIndex];
|
|
16395
16408
|
const page = doc.addPage({ width: box.width, height: box.height });
|
|
@@ -16560,4 +16573,4 @@ export {
|
|
|
16560
16573
|
wkhtmltopdfCommands,
|
|
16561
16574
|
createWkhtmltopdfCommands
|
|
16562
16575
|
};
|
|
16563
|
-
//# sourceMappingURL=chunk-
|
|
16576
|
+
//# sourceMappingURL=chunk-MC2KZY3D.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
pdfAstRendererProfile,
|
|
6
6
|
pdfAstWkhtmltopdfCommand,
|
|
7
7
|
pdfAstWkhtmltopdfCommands
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MC2KZY3D.js";
|
|
9
9
|
import "./chunk-LSRHLNCR.js";
|
|
10
10
|
import "./chunk-ZG7GWQ5P.js";
|
|
11
11
|
export {
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
pdfAstWkhtmltopdfCommand,
|
|
17
17
|
pdfAstWkhtmltopdfCommands
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=pdf-renderer-
|
|
19
|
+
//# sourceMappingURL=pdf-renderer-4APIM7F7.js.map
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
updateWorkbook,
|
|
82
82
|
validSheetSize,
|
|
83
83
|
visitFormula
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-EAUCLWEZ.js";
|
|
85
85
|
import "./chunk-CVAVQZSF.js";
|
|
86
86
|
import "./chunk-RCM5PZBN.js";
|
|
87
87
|
import "./chunk-LSRHLNCR.js";
|
|
@@ -171,4 +171,4 @@ export {
|
|
|
171
171
|
validSheetSize,
|
|
172
172
|
visitFormula
|
|
173
173
|
};
|
|
174
|
-
//# sourceMappingURL=src-
|
|
174
|
+
//# sourceMappingURL=src-FTMTU65U.js.map
|