@poe-platform/safe-bash 0.1.788 → 0.1.790
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/image-ast/index.browser.js +147 -80
- package/dist/image-ast/index.js +147 -80
- package/dist/mp4-ast/mp4.d.ts +2 -0
- package/dist/pdf-ast/cos/parser.d.ts +1 -0
- package/dist/pdf-ast/cos/security.d.ts +2 -0
- package/dist/pdf-ast/cos/writer.d.ts +1 -0
- package/dist/pdf-ast/document.d.ts +3 -0
- package/dist/pdf-ast/edit/forms.d.ts +1 -0
- package/dist/pdf-ast/index.js +171 -82
- package/dist/safe-bash/chunks/{chunk-L5QQLNTO.js → chunk-22PI65AH.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Q3E6C3DX.js → chunk-2TAGYMPK.js} +49 -34
- package/dist/safe-bash/chunks/{chunk-Z3HX3ZBA.js → chunk-2W4HTMEK.js} +52 -48
- package/dist/safe-bash/chunks/{chunk-FFZXP6ZC.js → chunk-3M7L7XU2.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-XNODZRVD.js → chunk-3QAO6UYS.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-YPETOVQU.js → chunk-3VKFK3NF.js} +2 -2
- package/dist/safe-bash/chunks/chunk-5OST7NOX.js +42 -0
- package/dist/safe-bash/chunks/{chunk-KEBSX2AX.js → chunk-6HLURHVU.js} +2 -2
- package/dist/safe-bash/chunks/chunk-DYEUZE6Z.js +19 -0
- package/dist/safe-bash/chunks/{chunk-T2TGCHKE.js → chunk-FM3WBSZT.js} +2 -2
- package/dist/safe-bash/chunks/chunk-GAYRKQM6.js +22 -0
- package/dist/safe-bash/chunks/{chunk-Q45QCA4J.js → chunk-I3KSESCR.js} +0 -7
- package/dist/safe-bash/chunks/{chunk-OSKDIBQS.js → chunk-JLIMK5TD.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-2AYZCT5X.js → chunk-JQ2FAJJT.js} +27 -23
- package/dist/safe-bash/chunks/{chunk-QA3NVP43.js → chunk-JRE6Z3T7.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-DC5EHLKS.js → chunk-NDIL6T7Y.js} +5 -5
- package/dist/safe-bash/chunks/{chunk-747G42FY.js → chunk-OPR4UAIT.js} +2 -2
- package/dist/safe-bash/chunks/chunk-OSMQCYSP.js +19 -0
- package/dist/safe-bash/chunks/chunk-OYB332PQ.js +17 -0
- package/dist/safe-bash/chunks/{chunk-ZMYVCRAF.js → chunk-QTIH2AFE.js} +77 -69
- package/dist/safe-bash/chunks/{chunk-PYTLIUST.js → chunk-SBESXWT2.js} +43 -44
- package/dist/safe-bash/chunks/{chunk-4FDQJUFW.js → chunk-SDEPGTOF.js} +1 -1
- package/dist/safe-bash/chunks/chunk-UZU5BIJI.js +32 -0
- package/dist/safe-bash/chunks/{chunk-BI6JV62X.js → chunk-VCCMROTL.js} +7 -10
- package/dist/safe-bash/chunks/chunk-W47GHRRF.js +13 -0
- package/dist/safe-bash/chunks/{chunk-NPMQWZUZ.js → chunk-WS7KZIUM.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-3PZYHMGM.js → chunk-YYAERCWS.js} +7 -7
- package/dist/safe-bash/chunks/{chunk-5U7JECDB.js → chunk-ZPGVEUKF.js} +8 -7
- package/dist/safe-bash/chunks/{csvkit-K55OYAQC.js → csvkit-USUJG62I.js} +65 -11
- package/dist/safe-bash/chunks/{ffmpeg-BEFTQ6DZ.js → ffmpeg-KRGG5DLH.js} +21 -10
- package/dist/safe-bash/chunks/{gh-HQWOWLWE.js → gh-UCFDUZCX.js} +16 -8
- package/dist/safe-bash/chunks/{git-UFNPAOYZ.js → git-LPAF6KDG.js} +7 -9
- package/dist/safe-bash/chunks/{imagemagick-53BMHH6D.js → imagemagick-KGREKK4G.js} +38 -7
- package/dist/safe-bash/chunks/{implementation-QUTAAYMT.js → implementation-FXDRYS5A.js} +34 -8
- package/dist/safe-bash/chunks/{pdfimages-4OYI6FLG.js → pdfimages-UADCF4G4.js} +12 -8
- package/dist/safe-bash/chunks/{pdfinfo-I7U6TQPP.js → pdfinfo-O7UWPF4W.js} +38 -13
- package/dist/safe-bash/chunks/{pdftk-SUA6FMHI.js → pdftk-AERXIJTN.js} +13 -8
- package/dist/safe-bash/chunks/{pdftoppm-4C5DGEWX.js → pdftoppm-L466JQKI.js} +17 -10
- package/dist/safe-bash/chunks/{pdftotext-Y4WI225Y.js → pdftotext-SUSI4WXS.js} +19 -9
- package/dist/safe-bash/chunks/{qpdf-IORB4RV5.js → qpdf-YL24KVRH.js} +14 -8
- package/dist/safe-bash/chunks/{sips-WHAMJFEU.js → sips-QXEQZERX.js} +14 -7
- package/dist/safe-bash/chunks/{soffice-SYEK6WJS.js → soffice-TBITRML3.js} +16 -8
- package/dist/safe-bash/chunks/{wkhtmltopdf-ZIICWJLF.js → wkhtmltopdf-NJA2THRC.js} +27 -7
- package/dist/safe-bash/command-chunks/chunk-2C5BEBPY.js +1388 -0
- package/dist/safe-bash/command-chunks/{chunk-FXYWQ6S4.js → chunk-2EXV2ZLV.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-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-D7TADAYG.js → chunk-64LG3EVJ.js} +17 -0
- package/dist/safe-bash/command-chunks/{chunk-TOSM3T3A.js → chunk-6EASC5EC.js} +20 -9
- package/dist/safe-bash/command-chunks/{chunk-ZF3ZVGQC.js → chunk-7JRITHKW.js} +150 -80
- package/dist/safe-bash/command-chunks/{chunk-IJ3FXP4Q.js → chunk-A3ZX6SCY.js} +1 -1
- package/dist/safe-bash/{chunks/chunk-LD76P7AG.js → command-chunks/chunk-AKDMCNX4.js} +74 -39
- package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JUDOV5MJ.js → chunk-CBDVLMJB.js} +1 -1
- 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-H4LWTITX.js +169 -0
- package/dist/safe-bash/command-chunks/chunk-I2MQNBGR.js +145 -0
- package/dist/safe-bash/command-chunks/{chunk-Z7TYZG3A.js → chunk-IHHTTQX6.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-5GRLAARV.js → chunk-IOXI5ZAJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-INDIFLBW.js → chunk-JTAGNROA.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-Y5IHIAY3.js → chunk-MDPIOQUD.js} +12 -8
- package/dist/safe-bash/command-chunks/chunk-PGEYORBZ.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-QI4MGIN6.js +6 -0
- package/dist/safe-bash/command-chunks/chunk-QM4UZF3C.js +753 -0
- package/dist/safe-bash/command-chunks/chunk-QTYZAWSB.js +91 -0
- package/dist/safe-bash/command-chunks/chunk-SNK7K3XW.js +90 -0
- package/dist/safe-bash/command-chunks/chunk-T5OLGM43.js +314 -0
- package/dist/safe-bash/command-chunks/chunk-TB7IFMUZ.js +802 -0
- package/dist/safe-bash/command-chunks/{chunk-YNT4ZJHW.js → chunk-TPPBPIWL.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-VMK4XVKO.js +82 -0
- package/dist/safe-bash/command-chunks/chunk-VNSJKXDU.js +130 -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-YFNTMH6Z.js +6 -0
- 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/csplit/index.browser.js +2 -2
- package/dist/safe-bash/commands/docx/index.browser.js +4 -47
- 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/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
- package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
- package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
- package/dist/safe-bash/commands/llm/command.d.ts +1 -4
- package/dist/safe-bash/commands/llm/command.js +1 -248
- package/dist/safe-bash/commands/llm/elevenlabs-stream.d.ts +1 -2
- package/dist/safe-bash/commands/llm/elevenlabs-stream.js +1 -117
- package/dist/safe-bash/commands/llm/elevenlabs.d.ts +1 -15
- package/dist/safe-bash/commands/llm/elevenlabs.js +1 -123
- package/dist/safe-bash/commands/llm/index.browser.js +20 -15
- package/dist/safe-bash/commands/llm/index.d.ts +1 -6
- package/dist/safe-bash/commands/llm/index.js +1 -4
- package/dist/safe-bash/commands/llm/mime.d.ts +1 -2
- package/dist/safe-bash/commands/llm/mime.js +1 -136
- package/dist/safe-bash/commands/llm/openai-http.d.ts +1 -8
- package/dist/safe-bash/commands/llm/openai-http.js +1 -143
- package/dist/safe-bash/commands/llm/openai-sse.d.ts +1 -3
- package/dist/safe-bash/commands/llm/openai-sse.js +1 -78
- package/dist/safe-bash/commands/llm/openai.d.ts +1 -14
- package/dist/safe-bash/commands/llm/openai.js +1 -288
- package/dist/safe-bash/commands/llm/providers/elevenlabs.d.ts +1 -1
- package/dist/safe-bash/commands/llm/providers/elevenlabs.js +1 -1
- package/dist/safe-bash/commands/llm/providers/index.browser.js +6 -6
- package/dist/safe-bash/commands/llm/providers/index.d.ts +1 -3
- package/dist/safe-bash/commands/llm/providers/index.js +1 -2
- package/dist/safe-bash/commands/llm/providers/openai.d.ts +1 -1
- package/dist/safe-bash/commands/llm/providers/openai.js +1 -1
- package/dist/safe-bash/commands/llm/providers/shared.d.ts +1 -23
- package/dist/safe-bash/commands/llm/providers/shared.js +1 -65
- package/dist/safe-bash/commands/llm/service.d.ts +1 -37
- package/dist/safe-bash/commands/llm/service.js +1 -151
- package/dist/safe-bash/commands/llm/types.d.ts +1 -52
- package/dist/safe-bash/commands/llm/types.js +1 -1
- package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
- package/dist/safe-bash/commands/media/index.browser.js +1 -1
- package/dist/safe-bash/commands/network/index.browser.js +9 -9
- package/dist/safe-bash/commands/network/types.d.ts +2 -40
- package/dist/safe-bash/commands/node/index.browser.js +6 -8
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/op/index.js +12 -28
- 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/pr/index.browser.js +2 -2
- 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 +8 -8
- package/dist/safe-bash/commands/python/worker.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/commands/tsort/index.browser.js +2 -2
- package/dist/safe-bash/commands/xml/index.browser.js +2 -2
- package/dist/safe-bash/commands/yq/index.browser.js +3 -3
- 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 +10645 -14065
- package/dist/safe-bash/core.d.ts +10 -1
- package/dist/safe-bash/core.js +0 -1
- package/dist/safe-bash/jobs.browser.js +5 -4
- 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 +61 -80
- 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 +44 -18
- package/dist/safe-bash/yq-browser/index.js +1 -1
- 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 +8073 -7940
- 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-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/wasm.generated.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 +671 -273
- package/dist/safe-bash-command-llm/LICENSE +21 -0
- package/dist/safe-bash-command-llm/command.d.ts +5 -0
- package/dist/safe-bash-command-llm/command.js +14 -0
- package/dist/safe-bash-command-llm/configuration.d.ts +18 -0
- package/dist/safe-bash-command-llm/elevenlabs-stream.d.ts +2 -0
- package/dist/safe-bash-command-llm/elevenlabs-stream.js +7 -0
- package/dist/safe-bash-command-llm/elevenlabs.d.ts +15 -0
- package/dist/safe-bash-command-llm/elevenlabs.js +10 -0
- package/dist/safe-bash-command-llm/index.d.ts +10 -0
- package/dist/safe-bash-command-llm/index.js +46 -0
- package/dist/safe-bash-command-llm/mime.d.ts +2 -0
- package/dist/safe-bash-command-llm/mime.js +9 -0
- package/dist/safe-bash-command-llm/model-options.d.ts +3 -0
- package/dist/safe-bash-command-llm/openai-http.d.ts +8 -0
- package/dist/safe-bash-command-llm/openai-http.js +17 -0
- package/dist/safe-bash-command-llm/openai-sse.d.ts +3 -0
- package/dist/safe-bash-command-llm/openai-sse.js +8 -0
- package/dist/safe-bash-command-llm/openai.d.ts +14 -0
- package/dist/safe-bash-command-llm/openai.js +12 -0
- package/dist/safe-bash-command-llm/providers/elevenlabs.d.ts +1 -0
- package/dist/safe-bash-command-llm/providers/elevenlabs.js +11 -0
- package/dist/safe-bash-command-llm/providers/index.d.ts +3 -0
- package/dist/safe-bash-command-llm/providers/index.js +24 -0
- package/dist/safe-bash-command-llm/providers/openai.d.ts +1 -0
- package/dist/safe-bash-command-llm/providers/openai.js +13 -0
- package/dist/safe-bash-command-llm/providers/shared.d.ts +23 -0
- package/dist/safe-bash-command-llm/providers/shared.js +13 -0
- package/dist/safe-bash-command-llm/schemas.d.ts +2 -0
- package/dist/safe-bash-command-llm/service.d.ts +42 -0
- package/dist/safe-bash-command-llm/service.js +9 -0
- package/dist/safe-bash-command-llm/templates.d.ts +27 -0
- package/dist/safe-bash-command-llm/types.d.ts +87 -0
- package/dist/safe-bash-command-llm/types.js +6 -0
- package/dist/safe-bash-command-mmdc/command.d.ts +4 -0
- package/dist/safe-bash-command-mmdc/index.d.ts +1 -1
- package/dist/safe-bash-command-mmdc/index.js +7134 -6699
- package/dist/safe-bash-command-mmdc/layout.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/parser.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/png.d.ts +3 -0
- package/dist/safe-bash-command-mmdc/raster.d.ts +1 -0
- 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 +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.d.ts +7 -1
- package/dist/safe-bash-command-pdfimages/index.js +210 -113
- package/dist/safe-bash-command-pdfinfo/index.d.ts +24 -20
- package/dist/safe-bash-command-pdfinfo/index.js +517 -241
- package/dist/safe-bash-command-pdftk/index.d.ts +7 -3
- package/dist/safe-bash-command-pdftk/index.js +261 -125
- package/dist/safe-bash-command-pdftoppm/index.d.ts +15 -7
- package/dist/safe-bash-command-pdftoppm/index.js +326 -189
- package/dist/safe-bash-command-pdftotext/index.d.ts +9 -5
- package/dist/safe-bash-command-pdftotext/index.js +237 -107
- 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 +254 -130
- 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 +65 -46
- package/dist/safe-bash-command-soffice/index.d.ts +9 -3
- package/dist/safe-bash-command-soffice/index.js +66 -25
- 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-ssconvert/index.js +147 -80
- 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 +239 -118
- 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/default-executor.d.ts +5 -0
- package/dist/safe-bash-contracts/default-executor.js +37 -0
- 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/http.d.ts +41 -0
- package/dist/safe-bash-contracts/http.js +6 -0
- 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.d.ts +1 -1
- 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-query-engine/index.js +5 -5
- package/dist/safe-bash-query-engine/interpreter.js +3 -3
- package/dist/safe-bash-query-engine/query-core.js +5 -5
- package/package.json +2 -2
- package/dist/safe-bash/chunks/chunk-2G2T5MEM.js +0 -14
- package/dist/safe-bash/chunks/chunk-FJZNUUOQ.js +0 -81
- package/dist/safe-bash/chunks/chunk-GJWUEOT6.js +0 -14
- package/dist/safe-bash/chunks/chunk-LAPF2XE6.js +0 -14
- package/dist/safe-bash/chunks/chunk-O6356Z27.js +0 -37
- package/dist/safe-bash/chunks/chunk-S2LSZFZ6.js +0 -758
- package/dist/safe-bash/chunks/chunk-T3VDYWKZ.js +0 -21
- package/dist/safe-bash/chunks/chunk-VYW4Q6KF.js +0 -12
- package/dist/safe-bash/chunks/chunk-WHURJBET.js +0 -409
- 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-RTOJNFFL.js → chunk-KNI4GRXF.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
createCsplitCommands,
|
|
4
4
|
csplitCommands,
|
|
5
5
|
evalSyncCsplit
|
|
6
|
-
} from "../../chunks/chunk-
|
|
7
|
-
import "../../chunks/chunk-
|
|
6
|
+
} from "../../chunks/chunk-JRE6Z3T7.js";
|
|
7
|
+
import "../../chunks/chunk-I3KSESCR.js";
|
|
8
8
|
export {
|
|
9
9
|
createCsplitCommand,
|
|
10
10
|
createCsplitCommands,
|
|
@@ -1,56 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
contracts_exports
|
|
3
|
-
} from "../../chunks/chunk-FJZNUUOQ.js";
|
|
4
|
-
import "../../chunks/chunk-O6356Z27.js";
|
|
5
|
-
import {
|
|
6
|
-
command_exports
|
|
7
|
-
} from "../../chunks/chunk-T3VDYWKZ.js";
|
|
8
1
|
import {
|
|
9
2
|
init_platform
|
|
10
|
-
} from "../../chunks/chunk-
|
|
3
|
+
} from "../../chunks/chunk-I3KSESCR.js";
|
|
11
4
|
|
|
12
5
|
// packages/safe-bash/src/commands/docx/index.ts
|
|
13
6
|
init_platform();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
throw new TypeError("An explicit docx command engine is required.");
|
|
17
|
-
if (options.replace !== void 0 && typeof options.replace !== "boolean")
|
|
18
|
-
throw new TypeError("docx replace must be boolean.");
|
|
19
|
-
const engine = options.engine;
|
|
20
|
-
return {
|
|
21
|
-
name: "docx",
|
|
22
|
-
async execute(context) {
|
|
23
|
-
context.signal.throwIfAborted();
|
|
24
|
-
const arguments_ = (0, contracts_exports.getCommandArguments)(context);
|
|
25
|
-
const result = await engine.execute({
|
|
26
|
-
args: Object.freeze(arguments_.args.map((_, index) => arguments_.bytes(index))),
|
|
27
|
-
cwd: context.cwd,
|
|
28
|
-
filesystem: context.fs,
|
|
29
|
-
stdin: context.stdin,
|
|
30
|
-
...context.stdinIsDefault === void 0 ? {} : { stdinIsDefault: context.stdinIsDefault },
|
|
31
|
-
stdout: context.stdout,
|
|
32
|
-
stderr: context.stderr,
|
|
33
|
-
signal: context.signal,
|
|
34
|
-
...context.registerCleanup === void 0 ? {} : { registerCleanup: context.registerCleanup }
|
|
35
|
-
});
|
|
36
|
-
context.signal.throwIfAborted();
|
|
37
|
-
return { exitCode: (0, command_exports.validateExitCode)(result.exitCode) };
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function docxCommands(options) {
|
|
42
|
-
const command = createDocxCommand(options);
|
|
43
|
-
const replace = options.replace ?? false;
|
|
44
|
-
return {
|
|
45
|
-
name: "docx-commands",
|
|
46
|
-
setup(host) {
|
|
47
|
-
if (!replace && host.commands.has(command.name))
|
|
48
|
-
throw new Error("Command already registered: docx");
|
|
49
|
-
host.commands.register(command, { replace });
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
7
|
+
import {} from "../../../safe-bash-command-docx/index.js";
|
|
8
|
+
import { createDocxCommand, createDocxCommands, docxCommands } from "../../../safe-bash-command-docx/index.js";
|
|
53
9
|
export {
|
|
54
10
|
createDocxCommand,
|
|
11
|
+
createDocxCommands,
|
|
55
12
|
docxCommands
|
|
56
13
|
};
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface DocxCommandRequest {
|
|
4
|
-
readonly args: readonly Uint8Array[];
|
|
5
|
-
readonly cwd: string;
|
|
6
|
-
readonly filesystem: FileSystem;
|
|
7
|
-
readonly stdin: ByteSource;
|
|
8
|
-
readonly stdinIsDefault?: boolean;
|
|
9
|
-
readonly stdout: ByteSink;
|
|
10
|
-
readonly stderr: ByteSink;
|
|
11
|
-
readonly signal: AbortSignal;
|
|
12
|
-
readonly registerCleanup?: CommandContext["registerCleanup"];
|
|
13
|
-
}
|
|
14
|
-
export interface DocxCommandEngine {
|
|
15
|
-
execute(request: DocxCommandRequest): Promise<{
|
|
16
|
-
readonly exitCode: number;
|
|
17
|
-
}>;
|
|
18
|
-
}
|
|
19
|
-
export interface DocxCommandOptions {
|
|
20
|
-
readonly engine: DocxCommandEngine;
|
|
21
|
-
readonly replace?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare function createDocxCommand(options: DocxCommandOptions): CommandDefinition;
|
|
24
|
-
export declare function docxCommands(options: DocxCommandOptions): VirtualShellPlugin;
|
|
1
|
+
export * from "../../../safe-bash-command-docx/index.js";
|
|
2
|
+
export { createDocxCommand, createDocxCommands, docxCommands } from "../../../safe-bash-command-docx/index.js";
|
|
25
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export function createDocxCommand(options) {
|
|
4
|
-
if (!options?.engine || typeof options.engine.execute !== "function")
|
|
5
|
-
throw new TypeError("An explicit docx command engine is required.");
|
|
6
|
-
if (options.replace !== undefined && typeof options.replace !== "boolean")
|
|
7
|
-
throw new TypeError("docx replace must be boolean.");
|
|
8
|
-
const engine = options.engine;
|
|
9
|
-
return {
|
|
10
|
-
name: "docx",
|
|
11
|
-
async execute(context) {
|
|
12
|
-
context.signal.throwIfAborted();
|
|
13
|
-
const arguments_ = getCommandArguments(context);
|
|
14
|
-
const result = await engine.execute({
|
|
15
|
-
args: Object.freeze(arguments_.args.map((_, index) => arguments_.bytes(index))),
|
|
16
|
-
cwd: context.cwd,
|
|
17
|
-
filesystem: context.fs,
|
|
18
|
-
stdin: context.stdin,
|
|
19
|
-
...(context.stdinIsDefault === undefined ? {} : { stdinIsDefault: context.stdinIsDefault }),
|
|
20
|
-
stdout: context.stdout,
|
|
21
|
-
stderr: context.stderr,
|
|
22
|
-
signal: context.signal,
|
|
23
|
-
...(context.registerCleanup === undefined ? {} : { registerCleanup: context.registerCleanup })
|
|
24
|
-
});
|
|
25
|
-
context.signal.throwIfAborted();
|
|
26
|
-
return { exitCode: validateExitCode(result.exitCode) };
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export function docxCommands(options) {
|
|
31
|
-
const command = createDocxCommand(options);
|
|
32
|
-
const replace = options.replace ?? false;
|
|
33
|
-
return {
|
|
34
|
-
name: "docx-commands",
|
|
35
|
-
setup(host) {
|
|
36
|
-
if (!replace && host.commands.has(command.name))
|
|
37
|
-
throw new Error("Command already registered: docx");
|
|
38
|
-
host.commands.register(command, { replace });
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
1
|
+
export * from "../../../safe-bash-command-docx/index.js";
|
|
2
|
+
export { createDocxCommand, createDocxCommands, docxCommands } from "../../../safe-bash-command-docx/index.js";
|
|
42
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { CommandContext } from "../../contracts/command.js";
|
|
3
|
-
export declare function documentByteSource(source: ByteSource): {
|
|
4
|
-
open(signal: AbortSignal): AsyncIterable<Uint8Array>;
|
|
5
|
-
};
|
|
6
|
-
export declare function documentByteSink(sink: ByteSink): {
|
|
7
|
-
write(bytes: Uint8Array, signal: AbortSignal): Promise<void>;
|
|
8
|
-
};
|
|
9
|
-
export declare function createDocumentOutput(context: Pick<CommandContext, "signal" | "registerCleanup">, destination: ByteSink): {
|
|
10
|
-
readonly sink: {
|
|
11
|
-
write(bytes: Uint8Array, signal: AbortSignal): Promise<void>;
|
|
12
|
-
};
|
|
13
|
-
readonly cleanup: () => Promise<void>;
|
|
14
|
-
};
|
|
1
|
+
export * from "../../../safe-bash-command-docx/io.js";
|
|
15
2
|
//# sourceMappingURL=io.d.ts.map
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { createOutputOperation } from "../../contracts/output.js";
|
|
3
|
-
export function documentByteSource(source) {
|
|
4
|
-
return { open: signal => readBytes(source, signal) };
|
|
5
|
-
}
|
|
6
|
-
export function documentByteSink(sink) {
|
|
7
|
-
return { write: (bytes, signal) => writeBytes(sink, bytes, signal) };
|
|
8
|
-
}
|
|
9
|
-
export function createDocumentOutput(context, destination) {
|
|
10
|
-
const operation = createOutputOperation(context, destination);
|
|
11
|
-
return {
|
|
12
|
-
sink: documentByteSink(operation.output),
|
|
13
|
-
cleanup: operation.close,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
1
|
+
export * from "../../../safe-bash-command-docx/io.js";
|
|
16
2
|
//# sourceMappingURL=io.js.map
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
createFactorCommand,
|
|
3
3
|
createFactorCommands,
|
|
4
4
|
factorCommands
|
|
5
|
-
} from "../../chunks/chunk-
|
|
6
|
-
import "../../chunks/chunk-
|
|
5
|
+
} from "../../chunks/chunk-3M7L7XU2.js";
|
|
6
|
+
import "../../chunks/chunk-I3KSESCR.js";
|
|
7
7
|
export {
|
|
8
8
|
createFactorCommand,
|
|
9
9
|
createFactorCommands,
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
createGetoptCommands,
|
|
4
4
|
evalSyncGetopt,
|
|
5
5
|
getoptCommands
|
|
6
|
-
} from "../../chunks/chunk-
|
|
7
|
-
import "../../chunks/chunk-
|
|
6
|
+
} from "../../chunks/chunk-WS7KZIUM.js";
|
|
7
|
+
import "../../chunks/chunk-I3KSESCR.js";
|
|
8
8
|
export {
|
|
9
9
|
createGetoptCommand,
|
|
10
10
|
createGetoptCommands,
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
createHexdumpCommand,
|
|
4
4
|
createHexdumpCommands,
|
|
5
5
|
hexdumpCommands
|
|
6
|
-
} from "../../chunks/chunk-
|
|
7
|
-
import "../../chunks/chunk-
|
|
6
|
+
} from "../../chunks/chunk-22PI65AH.js";
|
|
7
|
+
import "../../chunks/chunk-I3KSESCR.js";
|
|
8
8
|
export {
|
|
9
9
|
createHdCommand,
|
|
10
10
|
createHexdumpCommand,
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
createIconvCommands,
|
|
4
4
|
evalSyncIconv,
|
|
5
5
|
iconvCommands
|
|
6
|
-
} from "../../chunks/chunk-
|
|
7
|
-
import "../../chunks/chunk-
|
|
6
|
+
} from "../../chunks/chunk-OPR4UAIT.js";
|
|
7
|
+
import "../../chunks/chunk-I3KSESCR.js";
|
|
8
8
|
export {
|
|
9
9
|
createIconvCommand,
|
|
10
10
|
createIconvCommands,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
dos2unixCommands,
|
|
7
7
|
dos2unixCommands2,
|
|
8
8
|
evalSyncLineEndings
|
|
9
|
-
} from "../../chunks/chunk-
|
|
10
|
-
import "../../chunks/chunk-
|
|
9
|
+
} from "../../chunks/chunk-3QAO6UYS.js";
|
|
10
|
+
import "../../chunks/chunk-I3KSESCR.js";
|
|
11
11
|
export {
|
|
12
12
|
createDos2unixCommand,
|
|
13
13
|
createDos2unixCommands,
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { LlmCommandsOptions } from "./types.js";
|
|
3
|
-
export declare function createLlmCommands(options: LlmCommandsOptions): readonly CommandDefinition[];
|
|
4
|
-
export declare function llmCommands(options: LlmCommandsOptions): VirtualShellPlugin;
|
|
1
|
+
export * from "../../../safe-bash-command-llm/command.js";
|
|
5
2
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1,249 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { inheritYieldCheckpoint, yieldTurn } from "../../contracts/yield.js";
|
|
3
|
-
import { writeDiagnostic } from "../../escaping.js";
|
|
4
|
-
import { pathOf } from "../internal.js";
|
|
5
|
-
import { acceptsMimeType, sniffMimeType } from "./mime.js";
|
|
6
|
-
import { createLlmService } from "./service.js";
|
|
7
|
-
async function parse(length, text, step) {
|
|
8
|
-
const parsed = { prompt: "", options: Object.create(null), attachments: [] };
|
|
9
|
-
const operands = [];
|
|
10
|
-
let ended = false;
|
|
11
|
-
for (let index = 0; index < length; index++) {
|
|
12
|
-
await step();
|
|
13
|
-
const argument = text(index);
|
|
14
|
-
if (ended || !argument.startsWith("-") || argument === "-") {
|
|
15
|
-
operands.push(argument);
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
if (argument === "--") {
|
|
19
|
-
ended = true;
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
const equals = argument.indexOf("=");
|
|
23
|
-
const long = argument.startsWith("--");
|
|
24
|
-
const flag = long ? argument.slice(0, equals < 0 ? undefined : equals) : argument.slice(0, 2);
|
|
25
|
-
const attached = long ? equals < 0 ? undefined : argument.slice(equals + 1) : argument.length > 2 ? argument.slice(2) : undefined;
|
|
26
|
-
const take = () => {
|
|
27
|
-
if (++index >= length)
|
|
28
|
-
throw new Error(`Option ${flag} requires an argument`);
|
|
29
|
-
return text(index);
|
|
30
|
-
};
|
|
31
|
-
if (!["-m", "--model", "-s", "--system", "-o", "--option", "-a", "--attachment", "--at"].includes(flag))
|
|
32
|
-
throw new Error(`Unknown option: ${flag}`);
|
|
33
|
-
const value = attached ?? take();
|
|
34
|
-
if (flag === "-m" || flag === "--model")
|
|
35
|
-
parsed.model = value;
|
|
36
|
-
else if (flag === "-s" || flag === "--system")
|
|
37
|
-
parsed.system = value;
|
|
38
|
-
else if (flag === "-o" || flag === "--option")
|
|
39
|
-
parsed.options[value] = take();
|
|
40
|
-
else if (flag === "--at")
|
|
41
|
-
parsed.attachments.push({ path: value, mimeType: take() });
|
|
42
|
-
else
|
|
43
|
-
parsed.attachments.push({ path: value });
|
|
44
|
-
}
|
|
45
|
-
parsed.prompt = operands.join(" ");
|
|
46
|
-
return parsed;
|
|
47
|
-
}
|
|
48
|
-
async function interrupted(start, signal) {
|
|
49
|
-
signal.throwIfAborted();
|
|
50
|
-
return new Promise((resolve, reject) => {
|
|
51
|
-
const aborted = () => reject(signal.reason);
|
|
52
|
-
signal.addEventListener("abort", aborted, { once: true });
|
|
53
|
-
Promise.resolve().then(() => { signal.throwIfAborted(); return start(); }).then(value => { signal.removeEventListener("abort", aborted); resolve(value); }, error => { signal.removeEventListener("abort", aborted); reject(error); });
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
async function execute(context, service) {
|
|
57
|
-
context.signal.throwIfAborted();
|
|
58
|
-
const controller = new AbortController();
|
|
59
|
-
const operation = createOutputOperation(context, context.stdout);
|
|
60
|
-
const signal = AbortSignal.any([operation.signal, controller.signal]);
|
|
61
|
-
inheritYieldCheckpoint(context.signal, signal);
|
|
62
|
-
let iterator;
|
|
63
|
-
let closed = false;
|
|
64
|
-
let ended = false;
|
|
65
|
-
operation.registerCleanup(() => {
|
|
66
|
-
if (closed)
|
|
67
|
-
return;
|
|
68
|
-
closed = true;
|
|
69
|
-
controller.abort(new Error("llm request closed"));
|
|
70
|
-
if (!ended && iterator) {
|
|
71
|
-
const resource = iterator;
|
|
72
|
-
void Promise.resolve().then(() => resource.return?.()).catch(() => { });
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
let work = 0;
|
|
76
|
-
const step = async () => {
|
|
77
|
-
signal.throwIfAborted();
|
|
78
|
-
if (closed)
|
|
79
|
-
throw new Error("LLM invocation is closed");
|
|
80
|
-
work++;
|
|
81
|
-
if (work % 256 === 0)
|
|
82
|
-
await yieldTurn(signal);
|
|
83
|
-
};
|
|
84
|
-
let writing = false;
|
|
85
|
-
const write = async (chunk) => {
|
|
86
|
-
writing = true;
|
|
87
|
-
await operation.output.write(chunk);
|
|
88
|
-
writing = false;
|
|
89
|
-
};
|
|
90
|
-
const emitText = async (text) => {
|
|
91
|
-
for (let offset = 0; offset < text.length;) {
|
|
92
|
-
await step();
|
|
93
|
-
let end = Math.min(text.length, offset + 16_384);
|
|
94
|
-
const last = text.charCodeAt(end - 1);
|
|
95
|
-
if (end < text.length && last >= 0xd800 && last <= 0xdbff)
|
|
96
|
-
end--;
|
|
97
|
-
await write(new TextEncoder().encode(text.slice(offset, end)));
|
|
98
|
-
offset = end;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
let inputBytes = 0;
|
|
102
|
-
const inputLimit = context.inputBudget?.maxBytes ?? Infinity;
|
|
103
|
-
const checkInput = (size) => {
|
|
104
|
-
context.inputBudget?.check(inputBytes + size);
|
|
105
|
-
if (size > inputLimit - inputBytes)
|
|
106
|
-
throw new FsError("EFBIG", { message: "llm input byte limit exceeded" });
|
|
107
|
-
};
|
|
108
|
-
const admitInput = (size) => {
|
|
109
|
-
checkInput(size);
|
|
110
|
-
inputBytes += size;
|
|
111
|
-
};
|
|
112
|
-
try {
|
|
113
|
-
const argumentsValue = getCommandArguments(context);
|
|
114
|
-
const argumentText = (index) => {
|
|
115
|
-
const bytes = argumentsValue.bytes(index);
|
|
116
|
-
if (!bytes)
|
|
117
|
-
throw new Error("Missing option argument");
|
|
118
|
-
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
119
|
-
};
|
|
120
|
-
if (argumentsValue.args.length === 1 && ["--help", "-h"].includes(argumentsValue.args[0])) {
|
|
121
|
-
argumentText(0);
|
|
122
|
-
await emitText("Usage: llm [prompt] [-m MODEL] [-s SYSTEM] [-o KEY VALUE] [-a PATH] [--at PATH MIMETYPE]\n llm models\nOptions: --model, --system, --option, --attachment; -- ends options\n");
|
|
123
|
-
return { exitCode: 0 };
|
|
124
|
-
}
|
|
125
|
-
if (argumentsValue.args.length === 2 && argumentsValue.args[0] === "models" && ["--help", "-h"].includes(argumentsValue.args[1])) {
|
|
126
|
-
argumentText(0);
|
|
127
|
-
argumentText(1);
|
|
128
|
-
await emitText("Usage: llm models [OPTIONS]\n\n List configured models\n\nOptions:\n -h, --help Show this message and exit.\n");
|
|
129
|
-
return { exitCode: 0 };
|
|
130
|
-
}
|
|
131
|
-
const args = await parse(argumentsValue.args.length, argumentText, step);
|
|
132
|
-
if (argumentsValue.args[0] === "models" && args.prompt === "models" && !args.attachments.length) {
|
|
133
|
-
for (const { provider, model } of service.models) {
|
|
134
|
-
await step();
|
|
135
|
-
await emitText(`${provider.name}/${model.id} aliases: ${model.aliases?.join(", ") || "-"} attachments: ${model.attachmentTypes?.join(", ") || "-"} output: ${model.outputType ?? "text/plain"}\n`);
|
|
136
|
-
}
|
|
137
|
-
return { exitCode: 0 };
|
|
138
|
-
}
|
|
139
|
-
const entry = service.resolve(args.model);
|
|
140
|
-
const fragments = [];
|
|
141
|
-
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
142
|
-
const input = await operation.acquire(() => context.stdinInput
|
|
143
|
-
? { next: () => context.stdinInput.read(Math.min(65536, inputLimit - inputBytes + 1), signal) }
|
|
144
|
-
: context.stdin[Symbol.asyncIterator](), async (iterator) => { await iterator.return?.(); });
|
|
145
|
-
while (true) {
|
|
146
|
-
await step();
|
|
147
|
-
const result = await interrupted(() => input.next(), signal);
|
|
148
|
-
signal.throwIfAborted();
|
|
149
|
-
if (result.done)
|
|
150
|
-
break;
|
|
151
|
-
const chunk = result.value;
|
|
152
|
-
if (!(chunk instanceof Uint8Array))
|
|
153
|
-
throw new TypeError("Byte sources must yield Uint8Array chunks");
|
|
154
|
-
admitInput(chunk.byteLength);
|
|
155
|
-
fragments.push(decoder.decode(chunk, { stream: true }));
|
|
156
|
-
}
|
|
157
|
-
fragments.push(decoder.decode());
|
|
158
|
-
const content = fragments.join("");
|
|
159
|
-
const attachments = [];
|
|
160
|
-
for (const attachment of args.attachments) {
|
|
161
|
-
await step();
|
|
162
|
-
if (attachment.path.includes("://"))
|
|
163
|
-
throw new Error("URL attachments are not supported");
|
|
164
|
-
const path = pathOf(context, attachment.path);
|
|
165
|
-
const stat = await interrupted(() => context.fs.stat(path, { signal }), signal);
|
|
166
|
-
checkInput(stat.size);
|
|
167
|
-
const bytes = await interrupted(() => context.fs.readFile(path, { signal,
|
|
168
|
-
...(inputLimit === Infinity ? {} : { maxBytes: inputLimit - inputBytes }),
|
|
169
|
-
}), signal);
|
|
170
|
-
signal.throwIfAborted();
|
|
171
|
-
if (!(bytes instanceof Uint8Array))
|
|
172
|
-
throw new TypeError("Attachment read must return Uint8Array");
|
|
173
|
-
admitInput(bytes.byteLength);
|
|
174
|
-
const mimeType = attachment.mimeType ?? sniffMimeType(path, bytes);
|
|
175
|
-
if (!acceptsMimeType(entry.model.attachmentTypes ?? [], mimeType))
|
|
176
|
-
throw new Error(`Model ${entry.model.id} does not accept ${mimeType}`);
|
|
177
|
-
attachments.push({ mimeType, bytes: new Uint8Array(bytes) });
|
|
178
|
-
}
|
|
179
|
-
const request = {
|
|
180
|
-
model: entry.model.id, prompt: content && args.prompt ? `${content}\n\n${args.prompt}` : content || args.prompt,
|
|
181
|
-
...(args.system === undefined ? {} : { system: args.system }), attachments, options: args.options, signal,
|
|
182
|
-
};
|
|
183
|
-
signal.throwIfAborted();
|
|
184
|
-
iterator = service.complete(request)[Symbol.asyncIterator]();
|
|
185
|
-
const text = (entry.model.outputType ?? "text/plain").toLowerCase().startsWith("text/");
|
|
186
|
-
let pendingSurrogate = "";
|
|
187
|
-
while (true) {
|
|
188
|
-
await step();
|
|
189
|
-
const result = await interrupted(() => iterator.next(), signal);
|
|
190
|
-
signal.throwIfAborted();
|
|
191
|
-
if (result.done) {
|
|
192
|
-
ended = true;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
if (text ? typeof result.value !== "string" : !(result.value instanceof Uint8Array))
|
|
196
|
-
throw new Error(`Provider ${entry.provider.name} returned a response chunk incompatible with ${entry.model.outputType ?? "text/plain"}`);
|
|
197
|
-
if (typeof result.value === "string") {
|
|
198
|
-
let chunk = pendingSurrogate + result.value;
|
|
199
|
-
const last = chunk.charCodeAt(chunk.length - 1);
|
|
200
|
-
pendingSurrogate = last >= 0xd800 && last <= 0xdbff ? chunk.slice(-1) : "";
|
|
201
|
-
if (pendingSurrogate)
|
|
202
|
-
chunk = chunk.slice(0, -1);
|
|
203
|
-
if (chunk)
|
|
204
|
-
await emitText(chunk);
|
|
205
|
-
}
|
|
206
|
-
else
|
|
207
|
-
await write(result.value);
|
|
208
|
-
}
|
|
209
|
-
if (text) {
|
|
210
|
-
if (pendingSurrogate)
|
|
211
|
-
await emitText(pendingSurrogate);
|
|
212
|
-
await write(Uint8Array.of(10));
|
|
213
|
-
}
|
|
214
|
-
return { exitCode: 0 };
|
|
215
|
-
}
|
|
216
|
-
catch (error) {
|
|
217
|
-
context.signal.throwIfAborted();
|
|
218
|
-
operation.signal.throwIfAborted();
|
|
219
|
-
controller.abort(error);
|
|
220
|
-
if (writing)
|
|
221
|
-
throw error;
|
|
222
|
-
await operation.close();
|
|
223
|
-
await writeDiagnostic(context.stderr, `${error instanceof Error ? error.message.slice(0, 4096) : "llm provider failed"}\n`, context.signal);
|
|
224
|
-
return { exitCode: 1 };
|
|
225
|
-
}
|
|
226
|
-
finally {
|
|
227
|
-
controller.abort(new Error("llm request closed"));
|
|
228
|
-
await operation.close();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
export function createLlmCommands(options) {
|
|
232
|
-
if (!options.service && options.providers === undefined)
|
|
233
|
-
throw new TypeError("Provide LLM providers or an authorized service");
|
|
234
|
-
if (options.service && (options.providers || options.defaultModel !== undefined))
|
|
235
|
-
throw new TypeError("Configure providers and defaultModel on the injected LLM service");
|
|
236
|
-
const service = options.service ?? createLlmService({ ...options, providers: options.providers ?? [] });
|
|
237
|
-
return [{ name: "llm", description: "Query injected language and media models", execute: context => execute(context, service) }];
|
|
238
|
-
}
|
|
239
|
-
export function llmCommands(options) {
|
|
240
|
-
const definitions = createLlmCommands(options);
|
|
241
|
-
const replace = options.replace ?? false;
|
|
242
|
-
return { name: "llm-commands", setup(host) {
|
|
243
|
-
if (!replace && host.commands.has("llm"))
|
|
244
|
-
throw new Error("Command already registered: llm");
|
|
245
|
-
for (const definition of definitions)
|
|
246
|
-
host.commands.register(definition, { replace });
|
|
247
|
-
} };
|
|
248
|
-
}
|
|
1
|
+
export * from "../../../safe-bash-command-llm/command.js";
|
|
249
2
|
//# sourceMappingURL=command.js.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function streamElevenLabs(transport: HttpTransport, request: HttpRequest, limit?: number): AsyncGenerator<Uint8Array>;
|
|
1
|
+
export * from "../../../safe-bash-command-llm/elevenlabs-stream.js";
|
|
3
2
|
//# sourceMappingURL=elevenlabs-stream.d.ts.map
|
|
@@ -1,118 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
signal.throwIfAborted();
|
|
3
|
-
let onAbort;
|
|
4
|
-
const aborted = new Promise((_resolve, reject) => {
|
|
5
|
-
onAbort = () => reject(signal.reason);
|
|
6
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
7
|
-
});
|
|
8
|
-
try {
|
|
9
|
-
return await Promise.race([Promise.resolve().then(() => { signal.throwIfAborted(); return operation(); }), aborted]);
|
|
10
|
-
}
|
|
11
|
-
finally {
|
|
12
|
-
signal.removeEventListener("abort", onAbort);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export async function* streamElevenLabs(transport, request, limit = Infinity) {
|
|
16
|
-
const { signal } = request;
|
|
17
|
-
signal.throwIfAborted();
|
|
18
|
-
let iterator;
|
|
19
|
-
let finished = false;
|
|
20
|
-
let failed = false;
|
|
21
|
-
let closed = false;
|
|
22
|
-
let size = 0;
|
|
23
|
-
const cleanups = new Map();
|
|
24
|
-
const runCleanup = (entry) => {
|
|
25
|
-
return entry.pending ??= Promise.resolve().then(entry.run);
|
|
26
|
-
};
|
|
27
|
-
const register = (cleanup, receiver) => {
|
|
28
|
-
if (cleanups.has(cleanup))
|
|
29
|
-
return;
|
|
30
|
-
const entry = { run: () => cleanup.call(receiver) };
|
|
31
|
-
cleanups.set(cleanup, entry);
|
|
32
|
-
if (closed)
|
|
33
|
-
void runCleanup(entry).catch(() => { });
|
|
34
|
-
};
|
|
35
|
-
const dispose = async () => {
|
|
36
|
-
closed = true;
|
|
37
|
-
let seen = 0;
|
|
38
|
-
const failures = [];
|
|
39
|
-
while (seen < cleanups.size) {
|
|
40
|
-
const entries = [...cleanups.values()].slice(seen);
|
|
41
|
-
seen = cleanups.size;
|
|
42
|
-
const results = await Promise.allSettled(entries.map(runCleanup));
|
|
43
|
-
for (const result of results)
|
|
44
|
-
if (result.status === "rejected")
|
|
45
|
-
failures.push(result.reason);
|
|
46
|
-
}
|
|
47
|
-
if (failures.length)
|
|
48
|
-
throw failures[0];
|
|
49
|
-
};
|
|
50
|
-
const close = async () => {
|
|
51
|
-
const failures = [];
|
|
52
|
-
try {
|
|
53
|
-
await dispose();
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
failures.push(error);
|
|
57
|
-
}
|
|
58
|
-
if (!finished && iterator?.return) {
|
|
59
|
-
const closing = Promise.resolve().then(() => iterator.return());
|
|
60
|
-
if (signal.aborted)
|
|
61
|
-
void closing.catch(() => { });
|
|
62
|
-
else {
|
|
63
|
-
try {
|
|
64
|
-
await closing;
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
failures.push(error);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (!failed) {
|
|
72
|
-
signal.throwIfAborted();
|
|
73
|
-
if (failures.length)
|
|
74
|
-
throw failures[0];
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const onAbort = () => { void dispose().catch(() => { }); };
|
|
78
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
79
|
-
try {
|
|
80
|
-
const acquired = await abortable(async () => {
|
|
81
|
-
signal.throwIfAborted();
|
|
82
|
-
const response = await transport({ ...request, registerCleanup: register });
|
|
83
|
-
register(response.dispose, response);
|
|
84
|
-
if (signal.aborted) {
|
|
85
|
-
await dispose();
|
|
86
|
-
signal.throwIfAborted();
|
|
87
|
-
}
|
|
88
|
-
return response;
|
|
89
|
-
}, signal);
|
|
90
|
-
signal.throwIfAborted();
|
|
91
|
-
if (acquired.status < 200 || acquired.status >= 300)
|
|
92
|
-
throw new Error(`ElevenLabs HTTP ${acquired.status}: ${acquired.statusText}`);
|
|
93
|
-
iterator = acquired.body[Symbol.asyncIterator]();
|
|
94
|
-
while (true) {
|
|
95
|
-
const next = await abortable(() => iterator.next(), signal);
|
|
96
|
-
signal.throwIfAborted();
|
|
97
|
-
if (next.done) {
|
|
98
|
-
finished = true;
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (!(next.value instanceof Uint8Array))
|
|
102
|
-
throw new TypeError("ElevenLabs audio stream must yield Uint8Array chunks");
|
|
103
|
-
size += next.value.byteLength;
|
|
104
|
-
if (size > limit)
|
|
105
|
-
throw new RangeError("Provider response byte limit exceeded");
|
|
106
|
-
yield Uint8Array.from(next.value);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
failed = true;
|
|
111
|
-
throw error;
|
|
112
|
-
}
|
|
113
|
-
finally {
|
|
114
|
-
signal.removeEventListener("abort", onAbort);
|
|
115
|
-
await close();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
1
|
+
export * from "../../../safe-bash-command-llm/elevenlabs-stream.js";
|
|
118
2
|
//# sourceMappingURL=elevenlabs-stream.js.map
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { LlmModel, LlmProvider } from "./types.js";
|
|
3
|
-
import { type LlmProviderLimits } from "./providers/shared.js";
|
|
4
|
-
export interface ElevenLabsModel extends LlmModel {
|
|
5
|
-
readonly endpoint: "tts" | "music";
|
|
6
|
-
readonly defaultVoiceId?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ElevenLabsProviderOptions {
|
|
9
|
-
readonly transport: HttpTransport;
|
|
10
|
-
readonly apiKey: string;
|
|
11
|
-
readonly baseUrl?: string;
|
|
12
|
-
readonly models: readonly ElevenLabsModel[];
|
|
13
|
-
readonly limits?: Partial<LlmProviderLimits>;
|
|
14
|
-
}
|
|
15
|
-
export declare function createElevenLabsProvider(options: ElevenLabsProviderOptions): LlmProvider;
|
|
1
|
+
export * from "../../../safe-bash-command-llm/elevenlabs.js";
|
|
16
2
|
//# sourceMappingURL=elevenlabs.d.ts.map
|