@poe-platform/safe-bash 0.1.787 → 0.1.789
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 +1 -1
- package/dist/safe-bash/chunks/{chunk-WHURJBET.js → chunk-2MUJ7RLZ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PYTLIUST.js → chunk-CTUHLNJM.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Z3HX3ZBA.js → chunk-D4PHJK4T.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-O6356Z27.js → chunk-H7MMJS26.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Q3E6C3DX.js → chunk-KHJGUF2W.js} +14 -0
- package/dist/safe-bash/chunks/{chunk-FJZNUUOQ.js → chunk-VUVKC6HV.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-ZMYVCRAF.js → chunk-X5ZCECM6.js} +2 -2
- package/dist/safe-bash/chunks/{git-UFNPAOYZ.js → git-HO7WDPHZ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-PFBJR2PY.js → chunk-2KRKKW5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4DSJDVBM.js → chunk-32F3RBUW.js} +10 -749
- package/dist/safe-bash/command-chunks/{chunk-WVWWRMFD.js → chunk-3KROFHBT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-L3MLMXL4.js → chunk-3ZK5F23O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4QX6XCDD.js → chunk-4RNIZ3RT.js} +79 -0
- package/dist/safe-bash/command-chunks/{chunk-IFUNAM4D.js → chunk-5L62A5RO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-D7TADAYG.js → chunk-64LG3EVJ.js} +17 -0
- package/dist/safe-bash/command-chunks/{chunk-JUDOV5MJ.js → chunk-6F7QJMJ3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IJ3FXP4Q.js → chunk-A3ZX6SCY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-DREUDEQG.js → chunk-AT6ZSOE6.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-BUKYQBXO.js → chunk-BJ6DGYJA.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-NSEUBSOD.js → chunk-CXMOCPPH.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-XGMWWUHV.js → chunk-CZ5DAK4K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z57TV6TC.js → chunk-EZ2DTOLI.js} +4 -2
- package/dist/safe-bash/command-chunks/{chunk-ADCGH6A7.js → chunk-FH3D75FC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WYJTWJZ5.js → chunk-G3G6W5ZE.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3HDIDEUJ.js → chunk-GF54KE2M.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3JS4FOLB.js → chunk-HETU7MYN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z7TYZG3A.js → chunk-IHHTTQX6.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-INDIFLBW.js → chunk-JTAGNROA.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-Z47EO74H.js → chunk-MYKK3Q5G.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GZOUGVVV.js → chunk-OYZ534IK.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-PGEYORBZ.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-QM4UZF3C.js +753 -0
- package/dist/safe-bash/command-chunks/{chunk-TOSM3T3A.js → chunk-UJOO6DKY.js} +20 -9
- package/dist/safe-bash/command-chunks/{chunk-TFZEYNMX.js → chunk-VQLFJCG7.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-BIXN77VL.js → chunk-VUG324ER.js} +10 -0
- package/dist/safe-bash/command-chunks/{chunk-2LP3VMPA.js → chunk-WFDW4XXD.js} +1 -17
- package/dist/safe-bash/command-chunks/chunk-WR37IS4O.js +318 -0
- package/dist/safe-bash/command-chunks/{chunk-Y5IHIAY3.js → chunk-XNHSCU6I.js} +7 -3
- package/dist/safe-bash/commands/basic.js +148 -48
- package/dist/safe-bash/commands/bytes/compression/index.js +5 -6
- package/dist/safe-bash/commands/cmp.d.ts +2 -3
- package/dist/safe-bash/commands/cmp.js +2 -689
- package/dist/safe-bash/commands/docx/index.browser.js +3 -46
- package/dist/safe-bash/commands/docx/index.d.ts +2 -24
- package/dist/safe-bash/commands/docx/index.js +2 -41
- package/dist/safe-bash/commands/docx/io.d.ts +1 -14
- package/dist/safe-bash/commands/docx/io.js +1 -15
- package/dist/safe-bash/commands/llm/index.browser.js +3 -3
- package/dist/safe-bash/commands/network/index.browser.js +3 -3
- package/dist/safe-bash/commands/node/index.browser.js +3 -3
- package/dist/safe-bash/commands/pptx/index.d.ts +2 -28
- package/dist/safe-bash/commands/pptx/index.js +2 -152
- package/dist/safe-bash/commands/printf-float.d.ts +1 -0
- package/dist/safe-bash/commands/printf-float.js +48 -38
- package/dist/safe-bash/commands/printf-format.js +9 -6
- package/dist/safe-bash/commands/printf-quote.d.ts +3 -0
- package/dist/safe-bash/commands/printf-quote.js +62 -0
- package/dist/safe-bash/commands/printf-wide.d.ts +5 -0
- package/dist/safe-bash/commands/printf-wide.js +41 -0
- package/dist/safe-bash/commands/python/index.browser.js +2 -2
- package/dist/safe-bash/commands/truncate.d.ts +2 -3
- package/dist/safe-bash/commands/truncate.js +2 -686
- package/dist/safe-bash/contracts/diagnostics.d.ts +2 -0
- package/dist/safe-bash/contracts/diagnostics.js +2 -0
- package/dist/safe-bash/contracts/runtime-control.d.ts +2 -0
- package/dist/safe-bash/contracts/runtime-control.js +2 -0
- package/dist/safe-bash/core.browser.d.ts +1 -1
- package/dist/safe-bash/core.browser.js +2651 -4871
- package/dist/safe-bash/core.d.ts +10 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -2
- package/dist/safe-bash/opt-in/commands/cmp/index.js +776 -79
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +0 -12
- package/dist/safe-bash/opt-in/commands/cmp/options.js +0 -153
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +8 -3
- package/dist/safe-bash/opt-in/commands/truncate/index.js +790 -272
- package/dist/safe-bash/opt-in/commands/truncate/sync.d.ts +1 -0
- package/dist/safe-bash/opt-in/commands/truncate/sync.js +60 -0
- package/dist/safe-bash/optional-host.browser.js +9 -1
- package/dist/safe-bash/optional-host.d.ts +3 -1
- package/dist/safe-bash/optional-host.js +3 -1
- package/dist/safe-bash/shell/runtime.js +10 -6
- package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
- package/dist/safe-bash-checksum-engine/index.js +14 -2
- package/dist/safe-bash-command-bzip2/index.js +2 -1
- package/dist/safe-bash-command-cmp/index.d.ts +10 -0
- package/dist/safe-bash-command-cmp/index.js +796 -0
- package/dist/safe-bash-command-cmp/options.d.ts +12 -0
- package/dist/safe-bash-command-cmp/options.js +42 -0
- package/dist/safe-bash-command-csvcut/index.js +11 -8
- package/dist/safe-bash-command-csvgrep/index.js +35 -7
- package/dist/safe-bash-command-csvkit/codecs/python.js +4 -3
- package/dist/safe-bash-command-csvkit/codecs/utf8.js +3 -2
- package/dist/safe-bash-command-csvkit/index.js +80 -324
- package/dist/safe-bash-command-csvkit/python-regex.d.ts +5 -0
- package/dist/safe-bash-command-csvkit/python-regex.js +14 -0
- package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/sync-support.js +4 -2
- package/dist/safe-bash-command-diff3/index.js +3 -0
- package/dist/safe-bash-command-docx/LICENSE +21 -0
- package/dist/safe-bash-command-docx/index.d.ts +30 -0
- package/dist/safe-bash-command-docx/index.js +67 -0
- package/dist/safe-bash-command-docx/io.d.ts +14 -0
- package/dist/safe-bash-command-docx/io.js +26 -0
- package/dist/safe-bash-command-envsubst/index.js +34 -3
- package/dist/safe-bash-command-exiftool/index.js +3 -0
- package/dist/safe-bash-command-ffmpeg/index.js +1102 -1088
- package/dist/safe-bash-command-fold/family.js +1 -1
- package/dist/safe-bash-command-fold/index.js +1 -1
- package/dist/safe-bash-command-htmlq/index.js +5 -0
- package/dist/safe-bash-command-imagemagick/index.d.ts +25 -21
- package/dist/safe-bash-command-imagemagick/index.js +669 -271
- package/dist/safe-bash-command-mmdc/index.js +48 -10
- package/dist/safe-bash-command-mmdc/svg.d.ts +1 -0
- package/dist/safe-bash-command-op/index.js +19 -14
- package/dist/safe-bash-command-pandoc/command.js +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -1
- package/dist/safe-bash-command-pdfimages/index.d.ts +7 -1
- package/dist/safe-bash-command-pdfimages/index.js +63 -33
- package/dist/safe-bash-command-pdfinfo/index.d.ts +24 -20
- package/dist/safe-bash-command-pdfinfo/index.js +370 -161
- package/dist/safe-bash-command-pdftk/index.d.ts +7 -3
- package/dist/safe-bash-command-pdftk/index.js +114 -45
- package/dist/safe-bash-command-pdftoppm/index.d.ts +15 -7
- package/dist/safe-bash-command-pdftoppm/index.js +179 -109
- package/dist/safe-bash-command-pdftotext/index.d.ts +9 -5
- package/dist/safe-bash-command-pdftotext/index.js +90 -27
- package/dist/safe-bash-command-pptx/LICENSE +21 -0
- package/dist/safe-bash-command-pptx/index.d.ts +33 -0
- package/dist/safe-bash-command-pptx/index.js +168 -0
- package/dist/safe-bash-command-qpdf/index.d.ts +9 -3
- package/dist/safe-bash-command-qpdf/index.js +80 -29
- package/dist/safe-bash-command-sha512sum/index.js +12 -475
- package/dist/safe-bash-command-sips/index.d.ts +9 -5
- package/dist/safe-bash-command-sips/index.js +63 -44
- package/dist/safe-bash-command-soffice/index.d.ts +9 -3
- package/dist/safe-bash-command-soffice/index.js +65 -24
- package/dist/safe-bash-command-sqlite3/engine.d.ts +9 -0
- package/dist/safe-bash-command-sqlite3/index.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/index.js +851 -352
- package/dist/safe-bash-command-ssconvert/formats/xls.js +3 -3
- package/dist/safe-bash-command-timeout/index.js +3 -3
- package/dist/safe-bash-command-truncate/index.d.ts +8 -3
- package/dist/safe-bash-command-truncate/index.js +790 -272
- package/dist/safe-bash-command-truncate/sync.d.ts +1 -0
- package/dist/safe-bash-command-truncate/sync.js +60 -0
- package/dist/safe-bash-command-wkhtmltopdf/index.js +92 -38
- package/dist/safe-bash-command-wkhtmltopdf/pdf-renderer.d.ts +1 -1
- package/dist/safe-bash-command-xxd/index.js +78 -20
- package/dist/safe-bash-command-xz/command.d.ts +4 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +1 -1
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/command.js +3 -3
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +9 -9
- package/dist/safe-bash-contracts/filesystem-descriptor.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +8 -8
- package/dist/safe-bash-contracts/index.js +21 -19
- package/dist/safe-bash-contracts/io.d.ts +12 -0
- package/dist/safe-bash-contracts/io.js +4 -1
- package/dist/safe-bash-contracts/output.js +3 -2
- package/dist/safe-bash-contracts/runtime-control.js +2 -2
- package/dist/safe-bash-contracts/signals.js +1 -1
- package/dist/safe-bash-contracts/yield.d.ts +1 -0
- package/dist/safe-bash-contracts/yield.js +3 -1
- package/dist/safe-bash-csv-engine/index.d.ts +10 -1
- package/dist/safe-bash-csv-engine/index.js +78 -6
- package/dist/safe-bash-io-engine/commands/search/requirements.js +3 -3
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +3 -3
- package/dist/safe-bash-io-engine/gnu-information.js +1 -1
- package/dist/safe-bash-io-engine/internal.d.ts +1 -1
- package/dist/safe-bash-io-engine/internal.js +2 -2
- package/dist/safe-bash-mcp/index.browser.d.ts +875 -0
- package/dist/safe-bash-mcp/index.browser.js +8740 -0
- package/dist/safe-bash-mcp/index.js +32 -31
- package/dist/safe-bash-query-engine/capture.js +3 -3
- package/dist/safe-bash-query-engine/delpaths.js +3 -3
- package/dist/safe-bash-query-engine/formats.js +2 -2
- package/dist/safe-bash-query-engine/index.js +12 -12
- package/dist/safe-bash-query-engine/indices.js +3 -3
- package/dist/safe-bash-query-engine/input.js +1 -1
- package/dist/safe-bash-query-engine/interpreter.js +10 -10
- package/dist/safe-bash-query-engine/query-core.js +12 -12
- package/dist/safe-bash-query-engine/regex.js +3 -3
- package/dist/safe-bash-query-engine/splits.js +4 -4
- package/dist/safe-bash-query-engine/values.js +2 -2
- package/package.json +9 -3
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +0 -95
- package/dist/safe-bash/opt-in/commands/cmp/io.js +0 -218
- package/dist/safe-bash/command-chunks/{chunk-FXYWQ6S4.js → chunk-2VTMZTV3.js} +0 -0
- package/dist/safe-bash/command-chunks/{chunk-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
|
@@ -387,6 +387,7 @@ var MMDC_HELP_TEXT = [
|
|
|
387
387
|
|
|
388
388
|
// packages/safe-bash-command-mmdc/dist/command.js
|
|
389
389
|
init_buffer();
|
|
390
|
+
import { yieldTurn } from "../safe-bash-contracts/yield.js";
|
|
390
391
|
import { writeFileOutput } from "../safe-bash-contracts/filesystem-output-budget.js";
|
|
391
392
|
import { commandRuntimeIdentity, getCommandArguments } from "../safe-bash-contracts/command.js";
|
|
392
393
|
import { FsError } from "../safe-bash-contracts/errors.js";
|
|
@@ -7728,10 +7729,11 @@ function renderNode(node, fontFamily, monoFontFamily, index, idPrefix) {
|
|
|
7728
7729
|
const linesSvg = node.lines.map((l) => renderTextLine(l, fontFamily, monoFontFamily)).join("");
|
|
7729
7730
|
return `<g class="mmdc-node" data-id="${escapeXml(node.id)}">${shapeSvg}${dividersSvg}${badgesSvg}${linesSvg}</g>`;
|
|
7730
7731
|
}
|
|
7731
|
-
function
|
|
7732
|
+
function* serializeSceneToSvgSteps(scene, budget, svgId) {
|
|
7732
7733
|
const { theme } = scene;
|
|
7733
7734
|
const idPrefix = svgId === void 0 ? "" : `svg-${Array.from(svgId, (ch) => ch.codePointAt(0).toString(16)).join("-")}-`;
|
|
7734
7735
|
const parts = [];
|
|
7736
|
+
let work = 0;
|
|
7735
7737
|
parts.push(`<svg xmlns="http://www.w3.org/2000/svg"${svgId === void 0 ? "" : ` id="${escapeXml(svgId)}"`} width="${scene.width}" height="${scene.height}" viewBox="${scene.viewBox.x} ${scene.viewBox.y} ${scene.viewBox.width} ${scene.viewBox.height}" role="img">`);
|
|
7736
7738
|
if (scene.title) {
|
|
7737
7739
|
parts.push(`<title>${escapeXml(scene.title)}</title>`);
|
|
@@ -7744,6 +7746,8 @@ function serializeSceneToSvg(scene, budget, svgId) {
|
|
|
7744
7746
|
parts.push(`<rect width="${scene.viewBox.width}" height="${scene.viewBox.height}" fill="${escapeXml(scene.backgroundColor)}"/>`);
|
|
7745
7747
|
}
|
|
7746
7748
|
for (const life of scene.lifelines) {
|
|
7749
|
+
if (++work % 16 === 0)
|
|
7750
|
+
yield;
|
|
7747
7751
|
parts.push(`<line x1="${life.x}" y1="${life.y1}" x2="${life.x}" y2="${life.y2}" stroke="${escapeXml(life.stroke)}" stroke-width="1.25" stroke-dasharray="5 5"/>`);
|
|
7748
7752
|
}
|
|
7749
7753
|
scene.groups.forEach((group, idx) => {
|
|
@@ -7764,16 +7768,25 @@ function serializeSceneToSvg(scene, budget, svgId) {
|
|
|
7764
7768
|
parts.push(`</g>`);
|
|
7765
7769
|
});
|
|
7766
7770
|
for (const act of scene.activations) {
|
|
7771
|
+
if (++work % 16 === 0)
|
|
7772
|
+
yield;
|
|
7767
7773
|
parts.push(`<rect x="${act.x}" y="${act.y}" width="${act.width}" height="${act.height}" rx="2" fill="${escapeXml(act.fill)}" stroke="${escapeXml(act.stroke)}" stroke-width="1.25"/>`);
|
|
7768
7774
|
}
|
|
7769
7775
|
for (const edge of scene.edges) {
|
|
7776
|
+
if (++work % 16 === 0)
|
|
7777
|
+
yield;
|
|
7770
7778
|
const dash = edge.lineStyle === "dotted" ? ` stroke-dasharray="5 4"` : "";
|
|
7771
7779
|
parts.push(`<g class="mmdc-edge" data-id="${escapeXml(edge.id)}"><path d="${edge.d}" fill="none" stroke="${escapeXml(edge.stroke)}" stroke-width="${edge.strokeWidth}" stroke-linecap="round" stroke-linejoin="round"${dash}/>` + renderMarker(edge.startMarker) + renderMarker(edge.endMarker) + `</g>`);
|
|
7772
7780
|
}
|
|
7773
|
-
scene.nodes.
|
|
7781
|
+
for (let idx = 0; idx < scene.nodes.length; idx++) {
|
|
7782
|
+
if (++work % 16 === 0)
|
|
7783
|
+
yield;
|
|
7784
|
+
const node = scene.nodes[idx];
|
|
7774
7785
|
parts.push(renderNode(node, theme.fontFamily, theme.monospaceFontFamily, idx, idPrefix));
|
|
7775
|
-
}
|
|
7786
|
+
}
|
|
7776
7787
|
for (const edge of scene.edges) {
|
|
7788
|
+
if (++work % 16 === 0)
|
|
7789
|
+
yield;
|
|
7777
7790
|
if (edge.labelPill) {
|
|
7778
7791
|
parts.push(renderPill(edge.labelPill, theme.fontFamily, theme.monospaceFontFamily));
|
|
7779
7792
|
}
|
|
@@ -7785,6 +7798,8 @@ function serializeSceneToSvg(scene, budget, svgId) {
|
|
|
7785
7798
|
}
|
|
7786
7799
|
}
|
|
7787
7800
|
for (const note of scene.notes) {
|
|
7801
|
+
if (++work % 16 === 0)
|
|
7802
|
+
yield;
|
|
7788
7803
|
const filterAttr = note.shadow ? ` filter="url(#${idPrefix}mmdc-shadow)"` : "";
|
|
7789
7804
|
const linesSvg = note.lines.map((l) => renderTextLine(l, theme.fontFamily, theme.monospaceFontFamily)).join("");
|
|
7790
7805
|
parts.push(`<g class="mmdc-note" data-id="${escapeXml(note.id)}"><rect x="${note.x}" y="${note.y}" width="${note.width}" height="${note.height}" rx="${note.rx}" fill="${escapeXml(note.fill)}" stroke="${escapeXml(note.stroke)}" stroke-width="1.25"${filterAttr}/>` + linesSvg + `</g>`);
|
|
@@ -7794,6 +7809,13 @@ function serializeSceneToSvg(scene, budget, svgId) {
|
|
|
7794
7809
|
budget?.chargeOutputBytes(encoder3.encode(svg).byteLength);
|
|
7795
7810
|
return svg;
|
|
7796
7811
|
}
|
|
7812
|
+
function serializeSceneToSvg(scene, budget, svgId) {
|
|
7813
|
+
const steps = serializeSceneToSvgSteps(scene, budget, svgId);
|
|
7814
|
+
let step = steps.next();
|
|
7815
|
+
while (!step.done)
|
|
7816
|
+
step = steps.next();
|
|
7817
|
+
return step.value;
|
|
7818
|
+
}
|
|
7797
7819
|
|
|
7798
7820
|
// packages/safe-bash-command-mmdc/dist/command.js
|
|
7799
7821
|
var encoder4 = new TextEncoder();
|
|
@@ -7978,7 +8000,7 @@ function resolveRenderOptions(options) {
|
|
|
7978
8000
|
} }
|
|
7979
8001
|
};
|
|
7980
8002
|
}
|
|
7981
|
-
function
|
|
8003
|
+
function* renderMermaidSvgSteps(source, options) {
|
|
7982
8004
|
options = resolveRenderOptions(options);
|
|
7983
8005
|
const hostCeiling = options?.settings?.limits ? admitMermaidLimits(options.settings.limits, defaultMermaidLimits) : defaultMermaidLimits;
|
|
7984
8006
|
const limits = admitMermaidLimits(options?.limits, hostCeiling);
|
|
@@ -7994,7 +8016,7 @@ function renderMermaidSvg(source, options) {
|
|
|
7994
8016
|
if (!check.ok) {
|
|
7995
8017
|
throw new MermaidError("E_LIMIT", `Scene geometry verification failed: ${check.violations[0] ?? "invalid geometry"}`);
|
|
7996
8018
|
}
|
|
7997
|
-
const svg =
|
|
8019
|
+
const svg = yield* serializeSceneToSvgSteps(scene, budget, options?.svgId);
|
|
7998
8020
|
return {
|
|
7999
8021
|
svg,
|
|
8000
8022
|
width: scene.width,
|
|
@@ -8004,6 +8026,13 @@ function renderMermaidSvg(source, options) {
|
|
|
8004
8026
|
accounting: budget.snapshot()
|
|
8005
8027
|
};
|
|
8006
8028
|
}
|
|
8029
|
+
function renderMermaidSvg(source, options) {
|
|
8030
|
+
const steps = renderMermaidSvgSteps(source, options);
|
|
8031
|
+
let step = steps.next();
|
|
8032
|
+
while (!step.done)
|
|
8033
|
+
step = steps.next();
|
|
8034
|
+
return step.value;
|
|
8035
|
+
}
|
|
8007
8036
|
function renderMermaidPng(source, options) {
|
|
8008
8037
|
options = resolveRenderOptions(options);
|
|
8009
8038
|
const hostCeiling = options?.settings?.limits ? admitMermaidLimits(options.settings.limits, defaultMermaidLimits) : defaultMermaidLimits;
|
|
@@ -8276,7 +8305,8 @@ async function runMmdc(context, options = {}) {
|
|
|
8276
8305
|
span: { offset: 0, line: 1, column: 1 }
|
|
8277
8306
|
});
|
|
8278
8307
|
}
|
|
8279
|
-
await
|
|
8308
|
+
await yieldTurn(signal);
|
|
8309
|
+
signal.throwIfAborted();
|
|
8280
8310
|
budget.check();
|
|
8281
8311
|
const resolvedMode = cfgThemeMode ?? parsedArgs.theme ?? snapSettings.theme?.mode ?? "light";
|
|
8282
8312
|
const mergedSettings = {
|
|
@@ -8305,15 +8335,23 @@ async function runMmdc(context, options = {}) {
|
|
|
8305
8335
|
};
|
|
8306
8336
|
let outputBytes;
|
|
8307
8337
|
if (parsedArgs.outputFormat === "svg") {
|
|
8308
|
-
const
|
|
8309
|
-
|
|
8338
|
+
const steps = renderMermaidSvgSteps(sourceText, renderOptions);
|
|
8339
|
+
let step = steps.next();
|
|
8340
|
+
while (!step.done) {
|
|
8341
|
+
await yieldTurn(signal);
|
|
8342
|
+
signal.throwIfAborted();
|
|
8343
|
+
step = steps.next();
|
|
8344
|
+
}
|
|
8345
|
+
outputBytes = encoder4.encode(step.value.svg);
|
|
8310
8346
|
} else {
|
|
8311
|
-
await
|
|
8347
|
+
await yieldTurn(signal);
|
|
8348
|
+
signal.throwIfAborted();
|
|
8312
8349
|
budget.check();
|
|
8313
8350
|
const res = renderMermaidPng(sourceText, renderOptions);
|
|
8314
8351
|
outputBytes = res.png;
|
|
8315
8352
|
}
|
|
8316
|
-
await
|
|
8353
|
+
await yieldTurn(signal);
|
|
8354
|
+
signal.throwIfAborted();
|
|
8317
8355
|
budget.check();
|
|
8318
8356
|
if (outPath === "-") {
|
|
8319
8357
|
await writeBytes(stdout.output, outputBytes, signal);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { MermaidBudget, MermaidScene } from "./contracts.js";
|
|
2
2
|
export declare function escapeXml(raw: string): string;
|
|
3
|
+
export declare function serializeSceneToSvgSteps(scene: MermaidScene, budget?: MermaidBudget, svgId?: string): Generator<void, string>;
|
|
3
4
|
export declare function serializeSceneToSvg(scene: MermaidScene, budget?: MermaidBudget, svgId?: string): string;
|
|
@@ -7,6 +7,7 @@ init_buffer();
|
|
|
7
7
|
|
|
8
8
|
// packages/safe-bash-command-op/dist/cli.js
|
|
9
9
|
init_buffer();
|
|
10
|
+
import { InputByteBudget } from "../safe-bash-contracts/io.js";
|
|
10
11
|
|
|
11
12
|
// packages/safe-bash-command-op/dist/encoding.js
|
|
12
13
|
init_buffer();
|
|
@@ -3992,27 +3993,25 @@ function approvalManifest(request, requests, prepared, effects) {
|
|
|
3992
3993
|
return freezeJson(manifest);
|
|
3993
3994
|
}
|
|
3994
3995
|
function createOpCommand(options = {}) {
|
|
3995
|
-
const
|
|
3996
|
-
|
|
3997
|
-
if (inputLimits.maxInputBytes !== Infinity && (!Number.isSafeInteger(inputLimits.maxInputBytes) || inputLimits.maxInputBytes < 1))
|
|
3996
|
+
const maxInputBytes = options.limits?.maxInputBytes ?? Infinity;
|
|
3997
|
+
if (maxInputBytes !== Infinity && (!Number.isSafeInteger(maxInputBytes) || maxInputBytes < 1))
|
|
3998
3998
|
throw new RangeError("Invalid op limit: maxInputBytes");
|
|
3999
|
+
const { backend = createObjectBackend(), authorize, approve, authorizeResolution, approveResolved, approvalMode = "resolved", version = "0.0.1", channel = "stable" } = options;
|
|
3999
4000
|
const handlers = { ...options.handlers };
|
|
4000
4001
|
const planners = new Map(Object.entries(handlers).flatMap(([key, handler]) => typeof handler.prepare === "function" ? [[key, handler.prepare.bind(handler)]] : []));
|
|
4001
4002
|
return {
|
|
4002
4003
|
name: "op",
|
|
4003
4004
|
async execute(callerContext) {
|
|
4005
|
+
const budget = new InputByteBudget(maxInputBytes);
|
|
4004
4006
|
const context = {
|
|
4005
4007
|
...callerContext,
|
|
4006
|
-
stdin:
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
yield chunk;
|
|
4014
|
-
}
|
|
4015
|
-
} },
|
|
4008
|
+
stdin: budget.read(callerContext.stdin, callerContext.signal),
|
|
4009
|
+
...callerContext.readFile ? { readFile: async (path) => {
|
|
4010
|
+
budget.assertOpen();
|
|
4011
|
+
const bytes = await callerContext.readFile(path);
|
|
4012
|
+
budget.charge(bytes.byteLength);
|
|
4013
|
+
return bytes;
|
|
4014
|
+
} } : {},
|
|
4016
4015
|
binding: void 0,
|
|
4017
4016
|
args: Object.freeze([...callerContext.args]),
|
|
4018
4017
|
env: Object.freeze({ ...callerContext.env }),
|
|
@@ -4196,7 +4195,13 @@ function createOpCommand(options = {}) {
|
|
|
4196
4195
|
}
|
|
4197
4196
|
return { exitCode: 0 };
|
|
4198
4197
|
} catch (error) {
|
|
4199
|
-
|
|
4198
|
+
let message = error instanceof Error ? error.message : "operation failed";
|
|
4199
|
+
try {
|
|
4200
|
+
budget.assertOpen();
|
|
4201
|
+
} catch {
|
|
4202
|
+
message = `input exceeds maximum size of ${maxInputBytes} bytes`;
|
|
4203
|
+
}
|
|
4204
|
+
await original.stderr.write(new TextEncoder().encode(`op: ${context.signal.aborted ? "operation aborted" : message}
|
|
4200
4205
|
`));
|
|
4201
4206
|
return { exitCode: context.signal.aborted ? 130 : 1 };
|
|
4202
4207
|
} finally {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createPandocCommand,
|
|
3
3
|
createPandocCommands,
|
|
4
4
|
pandocCommands
|
|
5
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
5
|
+
} from "../safe-bash/command-chunks/chunk-2VTMZTV3.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
|
|
8
8
|
import "../safe-bash/command-chunks/chunk-5GRLAARV.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
readDocument,
|
|
22
22
|
resolveConversionArgs,
|
|
23
23
|
writeDocument
|
|
24
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
24
|
+
} from "../safe-bash/command-chunks/chunk-2VTMZTV3.js";
|
|
25
25
|
import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
|
|
26
26
|
import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
|
|
27
27
|
import "../safe-bash/command-chunks/chunk-5GRLAARV.js";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type CommandDefinition } from "../safe-bash-contracts/command.js";
|
|
2
2
|
import type { VirtualShellPlugin } from "../safe-bash-contracts/plugin.js";
|
|
3
|
+
export interface PdfimagesLimits {
|
|
4
|
+
readonly maxInputBytes: number;
|
|
5
|
+
}
|
|
3
6
|
export interface PdfimagesCommandOptions {
|
|
7
|
+
readonly limits?: Partial<PdfimagesLimits>;
|
|
4
8
|
readonly replace?: boolean;
|
|
5
9
|
}
|
|
6
10
|
export interface PdfimagesCliResult {
|
|
@@ -9,12 +13,14 @@ export interface PdfimagesCliResult {
|
|
|
9
13
|
readonly stderr: string;
|
|
10
14
|
}
|
|
11
15
|
export declare function runPdfimagesCli(argv: readonly string[], files: Map<string, Uint8Array>, options?: {
|
|
16
|
+
readonly signal?: AbortSignal;
|
|
12
17
|
readonly onAllocateBytes?: (bytes: number) => void;
|
|
13
18
|
}): Promise<PdfimagesCliResult>;
|
|
14
19
|
export declare function runPdfimagesCliSync(argv: readonly string[], files: Map<string, Uint8Array>, options?: {
|
|
20
|
+
readonly signal?: AbortSignal;
|
|
15
21
|
readonly onAllocateBytes?: (bytes: number) => void;
|
|
16
22
|
}): PdfimagesCliResult;
|
|
17
|
-
export declare function createPdfimagesCommand(
|
|
23
|
+
export declare function createPdfimagesCommand(options?: PdfimagesCommandOptions): CommandDefinition;
|
|
18
24
|
export declare const pdfimagesCommand: CommandDefinition;
|
|
19
25
|
export declare function pdfimagesPlugin(options?: PdfimagesCommandOptions): VirtualShellPlugin;
|
|
20
26
|
export declare const pdfimagesCommands: typeof pdfimagesPlugin;
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/safe-bash-command-pdfimages/dist/index.js
|
|
6
6
|
init_buffer();
|
|
7
|
+
import { yieldTurn, drainCooperativeSteps as drainSteps } from "../safe-bash-contracts/yield.js";
|
|
8
|
+
import { InputByteBudget } from "../safe-bash-contracts/io.js";
|
|
7
9
|
import { writeFileOutput } from "../safe-bash-contracts/filesystem-output-budget.js";
|
|
8
10
|
import {
|
|
9
11
|
commandRuntimeIdentity,
|
|
@@ -44292,10 +44294,8 @@ function extractPdfimagesPositionals(argv) {
|
|
|
44292
44294
|
}
|
|
44293
44295
|
return pos;
|
|
44294
44296
|
}
|
|
44295
|
-
|
|
44296
|
-
|
|
44297
|
-
}
|
|
44298
|
-
function runPdfimagesCliSync(argv, files, options = {}) {
|
|
44297
|
+
function* runPdfimagesCliSteps(argv, files, options = {}) {
|
|
44298
|
+
let cooperativeWork = 63;
|
|
44299
44299
|
let listOnly = false;
|
|
44300
44300
|
let usePng = false;
|
|
44301
44301
|
let useJpeg = false;
|
|
@@ -44312,6 +44312,8 @@ function runPdfimagesCliSync(argv, files, options = {}) {
|
|
|
44312
44312
|
let password = "";
|
|
44313
44313
|
const positionals = [];
|
|
44314
44314
|
for (let i = 0; i < argv.length; i++) {
|
|
44315
|
+
if (++cooperativeWork % 64 === 0)
|
|
44316
|
+
yield;
|
|
44315
44317
|
const arg = argv[i];
|
|
44316
44318
|
if (arg === "-v" || arg === "--version") {
|
|
44317
44319
|
return { exitCode: 0, stdout: "pdfimages version 24.08.0\n", stderr: "" };
|
|
@@ -44323,23 +44325,34 @@ function runPdfimagesCliSync(argv, files, options = {}) {
|
|
|
44323
44325
|
stderr: ""
|
|
44324
44326
|
};
|
|
44325
44327
|
}
|
|
44326
|
-
if (arg === "-list")
|
|
44327
|
-
|
|
44328
|
-
else if (arg === "-
|
|
44329
|
-
|
|
44330
|
-
else if (arg === "-
|
|
44331
|
-
|
|
44332
|
-
else if (arg === "-
|
|
44328
|
+
if (arg === "-list")
|
|
44329
|
+
listOnly = true;
|
|
44330
|
+
else if (arg === "-png")
|
|
44331
|
+
usePng = true;
|
|
44332
|
+
else if (arg === "-j")
|
|
44333
|
+
useJpeg = true;
|
|
44334
|
+
else if (arg === "-tiff")
|
|
44335
|
+
useTiff = true;
|
|
44336
|
+
else if (arg === "-jp2")
|
|
44337
|
+
useJp2 = true;
|
|
44338
|
+
else if (arg === "-jbig2")
|
|
44339
|
+
useJbig2 = true;
|
|
44340
|
+
else if (arg === "-ccitt")
|
|
44341
|
+
useCcitt = true;
|
|
44333
44342
|
else if (arg === "-all") {
|
|
44334
44343
|
usePng = true;
|
|
44335
44344
|
useJpeg = true;
|
|
44336
44345
|
useJp2 = true;
|
|
44337
44346
|
useJbig2 = true;
|
|
44338
44347
|
useCcitt = true;
|
|
44339
|
-
} else if (arg === "-p")
|
|
44340
|
-
|
|
44341
|
-
else if (arg === "-
|
|
44342
|
-
|
|
44348
|
+
} else if (arg === "-p")
|
|
44349
|
+
includePage = true;
|
|
44350
|
+
else if (arg === "-u")
|
|
44351
|
+
uniqueOnly = true;
|
|
44352
|
+
else if (arg === "-print-filenames")
|
|
44353
|
+
printFilenames = true;
|
|
44354
|
+
else if (arg === "-q")
|
|
44355
|
+
quiet = true;
|
|
44343
44356
|
else if (arg === "-f") {
|
|
44344
44357
|
firstPage = Math.max(1, Number.parseInt(argv[++i] ?? "1", 10) || 1);
|
|
44345
44358
|
} else if (arg === "-l") {
|
|
@@ -44382,9 +44395,11 @@ function runPdfimagesCliSync(argv, files, options = {}) {
|
|
|
44382
44395
|
});
|
|
44383
44396
|
const seenObjectIds = /* @__PURE__ */ new Set();
|
|
44384
44397
|
const extracted = uniqueOnly ? allExtracted.filter((img) => {
|
|
44385
|
-
if (img.inline || !img.objectId)
|
|
44398
|
+
if (img.inline || !img.objectId)
|
|
44399
|
+
return true;
|
|
44386
44400
|
const key = `${img.objectId.objNum}:${img.objectId.genNum}`;
|
|
44387
|
-
if (seenObjectIds.has(key))
|
|
44401
|
+
if (seenObjectIds.has(key))
|
|
44402
|
+
return false;
|
|
44388
44403
|
seenObjectIds.add(key);
|
|
44389
44404
|
return true;
|
|
44390
44405
|
}) : allExtracted;
|
|
@@ -44395,22 +44410,16 @@ function runPdfimagesCliSync(argv, files, options = {}) {
|
|
|
44395
44410
|
const root = positionals[1] ?? "image";
|
|
44396
44411
|
const printedFilenames = [];
|
|
44397
44412
|
for (let idx = 0; idx < extracted.length; idx++) {
|
|
44413
|
+
if (++cooperativeWork % 64 === 0)
|
|
44414
|
+
yield;
|
|
44398
44415
|
const img = extracted[idx];
|
|
44399
44416
|
const numStr = String(idx).padStart(3, "0");
|
|
44400
44417
|
const objField = img.inline || !img.objectId ? " [inline]" : `${String(img.objectId.objNum).padStart(6)} ${String(img.objectId.genNum).padStart(2)}`;
|
|
44401
44418
|
const sizeStr = formatPopplerSize(img.byteLength).padStart(5);
|
|
44402
|
-
const ratioStr = formatPopplerRatio(
|
|
44403
|
-
img.byteLength,
|
|
44404
|
-
img.width,
|
|
44405
|
-
img.height,
|
|
44406
|
-
img.components,
|
|
44407
|
-
img.bitsPerComponent
|
|
44408
|
-
).padStart(5);
|
|
44419
|
+
const ratioStr = formatPopplerRatio(img.byteLength, img.width, img.height, img.components, img.bitsPerComponent).padStart(5);
|
|
44409
44420
|
const interpStr = (img.interpolate ? "yes" : "no").padStart(6);
|
|
44410
44421
|
const colorCol = (img.colorSpaceLabel ?? img.colorSpace).padEnd(5);
|
|
44411
|
-
listLines.push(
|
|
44412
|
-
`${String(img.pageNumber).padStart(4)} ${String(idx).padStart(5)} ${img.type.padEnd(6)} ${String(img.width).padStart(5)} ${String(img.height).padStart(6)} ${colorCol} ${String(img.components).padStart(4)} ${String(img.bitsPerComponent).padStart(3)} ${img.encoding.padEnd(5)} ${interpStr} ${objField} ${String(img.xPpi).padStart(5)} ${String(img.yPpi).padStart(5)} ${sizeStr} ${ratioStr}`
|
|
44413
|
-
);
|
|
44422
|
+
listLines.push(`${String(img.pageNumber).padStart(4)} ${String(idx).padStart(5)} ${img.type.padEnd(6)} ${String(img.width).padStart(5)} ${String(img.height).padStart(6)} ${colorCol} ${String(img.components).padStart(4)} ${String(img.bitsPerComponent).padStart(3)} ${img.encoding.padEnd(5)} ${interpStr} ${objField} ${String(img.xPpi).padStart(5)} ${String(img.yPpi).padStart(5)} ${sizeStr} ${ratioStr}`);
|
|
44414
44423
|
if (!listOnly) {
|
|
44415
44424
|
let ext;
|
|
44416
44425
|
let outBytes;
|
|
@@ -44445,7 +44454,8 @@ function runPdfimagesCliSync(argv, files, options = {}) {
|
|
|
44445
44454
|
if (ext === "jb2e" && img.jbig2GlobalsBytes) {
|
|
44446
44455
|
const jb2gName = includePage ? `${root}-${String(img.pageNumber).padStart(3, "0")}-${numStr}.jb2g` : `${root}-${numStr}.jb2g`;
|
|
44447
44456
|
files.set(jb2gName, img.jbig2GlobalsBytes);
|
|
44448
|
-
if (printFilenames)
|
|
44457
|
+
if (printFilenames)
|
|
44458
|
+
printedFilenames.push(jb2gName);
|
|
44449
44459
|
}
|
|
44450
44460
|
if (ext === "ccitt") {
|
|
44451
44461
|
const paramsBase = includePage ? `${root}-${String(img.pageNumber).padStart(3, "0")}-${numStr}.params` : `${root}-${numStr}.params`;
|
|
@@ -44460,9 +44470,11 @@ function runPdfimagesCliSync(argv, files, options = {}) {
|
|
|
44460
44470
|
].join(" ");
|
|
44461
44471
|
files.set(paramsBase, new TextEncoder().encode(`${extraFlags}
|
|
44462
44472
|
`));
|
|
44463
|
-
if (printFilenames)
|
|
44473
|
+
if (printFilenames)
|
|
44474
|
+
printedFilenames.push(paramsBase);
|
|
44464
44475
|
}
|
|
44465
|
-
if (printFilenames)
|
|
44476
|
+
if (printFilenames)
|
|
44477
|
+
printedFilenames.push(outName);
|
|
44466
44478
|
}
|
|
44467
44479
|
}
|
|
44468
44480
|
if (listOnly) {
|
|
@@ -44473,7 +44485,19 @@ function runPdfimagesCliSync(argv, files, options = {}) {
|
|
|
44473
44485
|
}
|
|
44474
44486
|
return { exitCode: 0, stdout: "", stderr: "" };
|
|
44475
44487
|
}
|
|
44488
|
+
async function runPdfimagesCli(argv, files, options = {}) {
|
|
44489
|
+
return drainSteps(runPdfimagesCliSteps(argv, files, options), options.signal);
|
|
44490
|
+
}
|
|
44491
|
+
function runPdfimagesCliSync(argv, files, options = {}) {
|
|
44492
|
+
const steps = runPdfimagesCliSteps(argv, files, options);
|
|
44493
|
+
let next = steps.next();
|
|
44494
|
+
while (!next.done) {
|
|
44495
|
+
next = steps.next();
|
|
44496
|
+
}
|
|
44497
|
+
return next.value;
|
|
44498
|
+
}
|
|
44476
44499
|
async function executePdfimages(context) {
|
|
44500
|
+
let cooperativeWork = 63;
|
|
44477
44501
|
const invocation = createOutputOperation(context, { write: async () => {
|
|
44478
44502
|
} });
|
|
44479
44503
|
try {
|
|
@@ -44493,6 +44517,7 @@ async function executePdfimages(context) {
|
|
|
44493
44517
|
const chunks = [];
|
|
44494
44518
|
let total = 0;
|
|
44495
44519
|
for await (const chunk of readBytes(context.stdin, invocation.signal)) {
|
|
44520
|
+
if (++cooperativeWork % 64 === 0) await yieldTurn(context.signal);
|
|
44496
44521
|
chunks.push(chunk);
|
|
44497
44522
|
total += chunk.byteLength;
|
|
44498
44523
|
chargeBytes(chunk.byteLength);
|
|
@@ -44501,6 +44526,7 @@ async function executePdfimages(context) {
|
|
|
44501
44526
|
const buf = new Uint8Array(total);
|
|
44502
44527
|
let off = 0;
|
|
44503
44528
|
for (const c of chunks) {
|
|
44529
|
+
if (++cooperativeWork % 64 === 0) await yieldTurn(context.signal);
|
|
44504
44530
|
buf.set(c, off);
|
|
44505
44531
|
off += c.byteLength;
|
|
44506
44532
|
}
|
|
@@ -44508,6 +44534,7 @@ async function executePdfimages(context) {
|
|
|
44508
44534
|
}
|
|
44509
44535
|
}
|
|
44510
44536
|
for (const token of positionals) {
|
|
44537
|
+
if (++cooperativeWork % 64 === 0) await yieldTurn(context.signal);
|
|
44511
44538
|
if (token === "-") continue;
|
|
44512
44539
|
try {
|
|
44513
44540
|
const bytes = await context.fs.readFile(resolveVfsPath(token), { signal: invocation.signal });
|
|
@@ -44516,8 +44543,9 @@ async function executePdfimages(context) {
|
|
|
44516
44543
|
} catch {
|
|
44517
44544
|
}
|
|
44518
44545
|
}
|
|
44546
|
+
context.inputBudget?.check(0);
|
|
44519
44547
|
const existingSnap = new Map(vfsFiles);
|
|
44520
|
-
const res = await runPdfimagesCli(argv, vfsFiles, { onAllocateBytes: chargeBytes });
|
|
44548
|
+
const res = await runPdfimagesCli(argv, vfsFiles, { onAllocateBytes: chargeBytes, signal: invocation.signal });
|
|
44521
44549
|
if (res.stderr) {
|
|
44522
44550
|
await writeBytes(context.stderr, new TextEncoder().encode(res.stderr), invocation.signal);
|
|
44523
44551
|
}
|
|
@@ -44526,6 +44554,7 @@ async function executePdfimages(context) {
|
|
|
44526
44554
|
await writeBytes(stdout.output, new TextEncoder().encode(res.stdout), invocation.signal);
|
|
44527
44555
|
}
|
|
44528
44556
|
for (const [key, val] of vfsFiles.entries()) {
|
|
44557
|
+
if (++cooperativeWork % 64 === 0) await yieldTurn(context.signal);
|
|
44529
44558
|
if (key !== "-" && existingSnap.get(key) !== val) {
|
|
44530
44559
|
const abs = resolveVfsPath(key);
|
|
44531
44560
|
const parentDir = abs.slice(0, abs.lastIndexOf("/")) || "/";
|
|
@@ -44541,13 +44570,14 @@ async function executePdfimages(context) {
|
|
|
44541
44570
|
await invocation.close();
|
|
44542
44571
|
}
|
|
44543
44572
|
}
|
|
44544
|
-
function createPdfimagesCommand(
|
|
44573
|
+
function createPdfimagesCommand(options = {}) {
|
|
44574
|
+
const maxInputBytes = InputByteBudget.limit(options.limits?.maxInputBytes);
|
|
44545
44575
|
return Object.freeze({
|
|
44546
44576
|
name: "pdfimages",
|
|
44547
44577
|
runtimeIdentity: commandRuntimeIdentity,
|
|
44548
44578
|
description: "List and extract embedded images from PDF pages via @poe-code/pdf-ast",
|
|
44549
44579
|
execute(context) {
|
|
44550
|
-
return
|
|
44580
|
+
return new InputByteBudget(maxInputBytes).run(context, executePdfimages);
|
|
44551
44581
|
}
|
|
44552
44582
|
});
|
|
44553
44583
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type CommandContext, type CommandDefinition } from "../safe-bash-contracts/command.js";
|
|
2
2
|
import type { VirtualShellPlugin } from "../safe-bash-contracts/plugin.js";
|
|
3
|
+
export interface PdfinfoLimits {
|
|
4
|
+
readonly maxInputBytes: number;
|
|
5
|
+
}
|
|
3
6
|
export interface PdfinfoCommandOptions {
|
|
7
|
+
readonly limits?: Partial<PdfinfoLimits>;
|
|
4
8
|
readonly replace?: boolean;
|
|
5
9
|
}
|
|
6
10
|
export interface PdfinfoInspectionOptions {
|
|
@@ -13,72 +17,72 @@ export interface PdfinfoCliResult {
|
|
|
13
17
|
readonly stderr: string;
|
|
14
18
|
}
|
|
15
19
|
export declare function inspectPdfBytes(bytes: Uint8Array, argv?: readonly string[], options?: PdfinfoInspectionOptions): PdfinfoCliResult;
|
|
16
|
-
export declare function runPdfinfoCli(argv: readonly string[], files: ReadonlyMap<string, Uint8Array>, stdinBytes?: Uint8Array): Promise<PdfinfoCliResult>;
|
|
20
|
+
export declare function runPdfinfoCli(argv: readonly string[], files: ReadonlyMap<string, Uint8Array>, stdinBytes?: Uint8Array, signal?: AbortSignal): Promise<PdfinfoCliResult>;
|
|
17
21
|
export declare function pdfinfo(context: CommandContext): Promise<{
|
|
18
22
|
exitCode: number;
|
|
19
23
|
}>;
|
|
20
|
-
export declare function createPdfinfoCommand(
|
|
24
|
+
export declare function createPdfinfoCommand(options?: PdfinfoCommandOptions): CommandDefinition;
|
|
21
25
|
export declare const pdfinfoCommand: CommandDefinition;
|
|
22
|
-
export declare function runPdftoppmCli(argv: readonly string[], files: Map<string, Uint8Array
|
|
26
|
+
export declare function runPdftoppmCli(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): Promise<{
|
|
23
27
|
exitCode: number;
|
|
24
28
|
stdout: string;
|
|
25
29
|
stderr: string;
|
|
26
30
|
stdoutBytes?: Uint8Array;
|
|
27
31
|
}>;
|
|
28
|
-
export declare function runPdfimagesCli(argv: readonly string[], files: Map<string, Uint8Array
|
|
32
|
+
export declare function runPdfimagesCli(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): Promise<{
|
|
29
33
|
exitCode: number;
|
|
30
34
|
stdout: string;
|
|
31
35
|
stderr: string;
|
|
32
36
|
}>;
|
|
33
|
-
export declare function runPdfuniteCli(argv: readonly string[], files: Map<string, Uint8Array
|
|
37
|
+
export declare function runPdfuniteCli(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): Promise<{
|
|
34
38
|
exitCode: number;
|
|
35
39
|
stdout: string;
|
|
36
40
|
stderr: string;
|
|
37
41
|
}>;
|
|
38
|
-
export declare function runPdfseparateCli(argv: readonly string[], files: Map<string, Uint8Array
|
|
42
|
+
export declare function runPdfseparateCli(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): Promise<{
|
|
39
43
|
exitCode: number;
|
|
40
44
|
stdout: string;
|
|
41
45
|
stderr: string;
|
|
42
46
|
}>;
|
|
43
|
-
export declare function runPdffontsCli(argv: readonly string[], files: Map<string, Uint8Array
|
|
47
|
+
export declare function runPdffontsCli(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): Promise<{
|
|
44
48
|
exitCode: number;
|
|
45
49
|
stdout: string;
|
|
46
50
|
stderr: string;
|
|
47
51
|
}>;
|
|
48
|
-
export declare function runPdffontsCliSync(argv: readonly string[], files: Map<string, Uint8Array
|
|
52
|
+
export declare function runPdffontsCliSync(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): {
|
|
49
53
|
exitCode: number;
|
|
50
54
|
stdout: string;
|
|
51
55
|
stderr: string;
|
|
52
56
|
};
|
|
53
|
-
export declare function
|
|
57
|
+
export declare function runPdfdetachCli(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): Promise<{
|
|
54
58
|
exitCode: number;
|
|
55
59
|
stdout: string;
|
|
56
60
|
stderr: string;
|
|
57
|
-
}
|
|
58
|
-
export declare function
|
|
61
|
+
}>;
|
|
62
|
+
export declare function runPdfdetachCliSync(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): {
|
|
59
63
|
exitCode: number;
|
|
60
64
|
stdout: string;
|
|
61
65
|
stderr: string;
|
|
62
|
-
}
|
|
63
|
-
export declare function createPdftoppmCommand(
|
|
66
|
+
};
|
|
67
|
+
export declare function createPdftoppmCommand(options?: PdfinfoCommandOptions): CommandDefinition;
|
|
64
68
|
export declare const pdftoppmCommand: CommandDefinition;
|
|
65
|
-
export declare function createPdfimagesCommand(
|
|
69
|
+
export declare function createPdfimagesCommand(options?: PdfinfoCommandOptions): CommandDefinition;
|
|
66
70
|
export declare const pdfimagesCommand: CommandDefinition;
|
|
67
|
-
export declare function createPdfuniteCommand(
|
|
71
|
+
export declare function createPdfuniteCommand(options?: PdfinfoCommandOptions): CommandDefinition;
|
|
68
72
|
export declare const pdfuniteCommand: CommandDefinition;
|
|
69
|
-
export declare function createPdfseparateCommand(
|
|
73
|
+
export declare function createPdfseparateCommand(options?: PdfinfoCommandOptions): CommandDefinition;
|
|
70
74
|
export declare const pdfseparateCommand: CommandDefinition;
|
|
71
|
-
export declare function createPdffontsCommand(
|
|
75
|
+
export declare function createPdffontsCommand(options?: PdfinfoCommandOptions): CommandDefinition;
|
|
72
76
|
export declare const pdffontsCommand: CommandDefinition;
|
|
73
|
-
export declare function createPdfdetachCommand(
|
|
77
|
+
export declare function createPdfdetachCommand(options?: PdfinfoCommandOptions): CommandDefinition;
|
|
74
78
|
export declare const pdfdetachCommand: CommandDefinition;
|
|
75
|
-
export declare function runPdftocairoCli(argv: readonly string[], files: Map<string, Uint8Array
|
|
79
|
+
export declare function runPdftocairoCli(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): Promise<{
|
|
76
80
|
exitCode: number;
|
|
77
81
|
stdout: string;
|
|
78
82
|
stderr: string;
|
|
79
83
|
stdoutBytes?: Uint8Array;
|
|
80
84
|
}>;
|
|
81
|
-
export declare function createPdftocairoCommand(
|
|
85
|
+
export declare function createPdftocairoCommand(options?: PdfinfoCommandOptions): CommandDefinition;
|
|
82
86
|
export declare const pdftocairoCommand: CommandDefinition;
|
|
83
87
|
export declare function pdfinfoCommands(options?: PdfinfoCommandOptions): VirtualShellPlugin;
|
|
84
88
|
export type PdfinfoCommandsOptions = PdfinfoCommandOptions;
|