@poe-platform/safe-bash 0.1.817 → 0.1.819
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-ast/index.js +2 -2
- package/dist/mp4-ast/index.d.ts +2 -1
- package/dist/mp4-ast/mp4-metadata-source.d.ts +10 -0
- package/dist/mp4-ast/mp4-packets-source.d.ts +8 -1
- package/dist/mp4-ast/types.d.ts +21 -3
- package/dist/office-xml/retained-xml-document.d.ts +2 -2
- package/dist/pdf-ast/ast.d.ts +2 -0
- package/dist/pdf-ast/content/evaluator.d.ts +7 -0
- package/dist/pdf-ast/content/retained-evaluator.d.ts +2 -2
- package/dist/pdf-ast/content/retained-page.d.ts +2 -2
- package/dist/pdf-ast/cos/compact-number.d.ts +19 -0
- package/dist/pdf-ast/cos/mutable-object-store.d.ts +2 -1
- package/dist/pdf-ast/cos/retained-node-writer.d.ts +9 -0
- package/dist/pdf-ast/cos/text-store.d.ts +27 -0
- package/dist/pdf-ast/edit/retained-bookmarks.d.ts +2 -2
- package/dist/pdf-ast/edit/retained-info-updates.d.ts +3 -3
- package/dist/pdf-ast/edit/retained-merge-outlines.d.ts +43 -0
- package/dist/pdf-ast/edit/retained-page-copy.d.ts +2 -0
- package/dist/pdf-ast/extract/html-text-stream.d.ts +14 -0
- package/dist/pdf-ast/extract/logical-text-stream.d.ts +14 -0
- package/dist/pdf-ast/extract/raw-text-index.d.ts +18 -4
- package/dist/pdf-ast/extract/retained-color.d.ts +6 -6
- package/dist/pdf-ast/extract/retained-decoded-image.d.ts +2 -2
- package/dist/pdf-ast/extract/stored-text-glyphs.d.ts +8 -0
- package/dist/pdf-ast/fonts/retained.d.ts +2 -2
- package/dist/pdf-ast/image.d.ts +2 -0
- package/dist/pdf-ast/image.js +19 -0
- package/dist/pdf-ast/index.d.ts +6 -0
- package/dist/pdf-ast/index.js +270 -66852
- package/dist/pdf-ast/render/postscript.d.ts +6 -0
- package/dist/pdf-ast/render/raster.d.ts +21 -1
- package/dist/pdf-ast/retained-document.d.ts +23 -95
- package/dist/pdf-ast/retained-reader.d.ts +113 -0
- package/dist/safe-bash/ast-grep.js +1 -1
- package/dist/safe-bash/audio-ast.js +1 -1
- package/dist/safe-bash/byte-encoding.js +1 -1
- package/dist/safe-bash/chunks/{chunk-HD6DWOAC.js → chunk-67QE3JLU.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-HPQE675Q.js → chunk-ESH5MDQR.js} +1 -1
- package/dist/safe-bash/chunks/chunk-HNT2MR4W.js +45 -0
- package/dist/safe-bash/chunks/{chunk-SXSEF5E2.js → chunk-IRJS54AA.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-AXGI5JVL.js → chunk-NAETSXBW.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-WW7QPLH2.js → chunk-PSD2RSOS.js} +2 -1
- package/dist/safe-bash/chunks/{chunk-FQRI5AS5.js → chunk-VF3Q2V3E.js} +1 -1
- package/dist/safe-bash/chunks/{pdfinfo-KQIQEDOF.js → pdfinfo-G7BGZXBN.js} +2 -12
- package/dist/safe-bash/command-chunks/biff-AYJZR2YV-YFF3BK43.js +5741 -0
- package/dist/safe-bash/command-chunks/{chunk-FEBTT5NH.js → chunk-22D6Q6SW.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-ALD53QFL.js → chunk-2C4QMQQD.js} +42 -12
- package/dist/safe-bash/command-chunks/{chunk-ZHHALBM7.js → chunk-2E53ZL5D.js} +11 -9
- package/dist/safe-bash/command-chunks/{chunk-EJ4UP7DA.js → chunk-2ESK2YIE.js} +27 -5
- package/dist/safe-bash/command-chunks/{chunk-CKA7ZROU.js → chunk-2GU2UU2Z.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-L2VLASZ4.js → chunk-2GUI3ZKE.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-2H6RJPCQ.js +721 -0
- package/dist/safe-bash/command-chunks/{chunk-DRHONH2C.js → chunk-2IGH6JIP.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QDV2NIFR.js → chunk-2TMTGVJR.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-MQE77MEQ.js → chunk-2V6EUWE3.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-BIJW6QWB.js → chunk-2VSNIHIW.js} +21 -21
- package/dist/safe-bash/command-chunks/{chunk-FSG6UC2N.js → chunk-2XR7B6DY.js} +420 -167
- package/dist/safe-bash/command-chunks/{chunk-EY3UE26F.js → chunk-2YC6MWQB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-NLCUQD7Y.js → chunk-3DID6MQY.js} +21 -11
- package/dist/safe-bash/command-chunks/{chunk-5VO534FR.js → chunk-3K5FCRUG.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-BSTABZIK.js → chunk-3LMUKOP2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XBWD6SI3.js → chunk-3MFYCMQU.js} +37 -37
- package/dist/safe-bash/command-chunks/chunk-3PO534WJ.js +37 -0
- package/dist/safe-bash/command-chunks/{chunk-UFLMOU3B.js → chunk-3RDEX4AF.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-DOVWHVHI.js → chunk-3TXPZLFI.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-TID5TSQW.js → chunk-42OQIFPW.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-UJYXSLM6.js → chunk-45QE6QRR.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-LMLBQSAM.js → chunk-4HJEZGYN.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-5QXRIZSS.js → chunk-4Q3HP33O.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-EBX5RKKT.js → chunk-4XYGJB24.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-NDALIHKK.js → chunk-4ZQYBCB2.js} +22 -22
- package/dist/safe-bash/command-chunks/{chunk-OFONWWEZ.js → chunk-5IHJWBDR.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-TG2RVQLP.js → chunk-5KWEZV5H.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-UYZ6EFZE.js → chunk-5P5SF75H.js} +83 -34
- package/dist/safe-bash/command-chunks/{chunk-P462JTNT.js → chunk-5PJ6VT2O.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-SICTBSLW.js → chunk-5QR4LTAK.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-ARE267HR.js → chunk-5XIJYTQU.js} +7 -7
- package/dist/safe-bash/command-chunks/chunk-63WEASJ7.js +137 -0
- package/dist/safe-bash/command-chunks/{chunk-3K5CVXUV.js → chunk-64L57DEI.js} +19 -19
- package/dist/safe-bash/command-chunks/{chunk-2ALHVXEM.js → chunk-6EK76ERE.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4772DJKS.js → chunk-6GCK2KSL.js} +61 -26
- package/dist/safe-bash/command-chunks/{chunk-T5OQ53XS.js → chunk-6IID5HTY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ABL2DPJI.js → chunk-6PDXNY3T.js} +13 -13
- package/dist/safe-bash/command-chunks/{chunk-X42MJT2J.js → chunk-6RE4MZYM.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-AF2IO57Q.js → chunk-6REH56FL.js} +14 -140
- package/dist/safe-bash/command-chunks/{chunk-XFIDOCYH.js → chunk-6ZHNKHQQ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-6JGICYHP.js → chunk-75OUKYCM.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-POGVOCOB.js → chunk-772WNCU6.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-3DWFXESW.js → chunk-7GJJDM2F.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-XVEI4HZL.js → chunk-7JTJQKIV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WIW3KDBS.js → chunk-7NFICYRU.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-3ZVK2OAY.js → chunk-A4GYNM2E.js} +6 -5
- package/dist/safe-bash/command-chunks/chunk-AC4FFCRL.js +3820 -0
- package/dist/safe-bash/command-chunks/{chunk-SQBWAFUI.js → chunk-ADN7BU5X.js} +58 -26
- package/dist/safe-bash/command-chunks/{chunk-FHQOFEQK.js → chunk-AEHEOKI2.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-BZRWZ6GO.js → chunk-AH3ZEPAN.js} +12 -9
- package/dist/safe-bash/command-chunks/{chunk-3MUFXGA2.js → chunk-AR65HNNX.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-VNNNVT4C.js → chunk-ARA57PMC.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-3VGQTLO6.js → chunk-AXUHORS3.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-B6NAEWHC.js +53 -0
- package/dist/safe-bash/command-chunks/{chunk-2ZWRW6UQ.js → chunk-B74LVFAN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-E4TF5W6O.js → chunk-BBOYR6LV.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-ZM7HMBAJ.js → chunk-BDGNKRY4.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-KDBU5Q2N.js → chunk-BFOVQUTF.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-GNT3SCF3.js → chunk-BOMCPF7N.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ZNCPIZCN.js → chunk-BSLXS4PE.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-N6TG44VG.js → chunk-BTDSUATE.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VZJRFHMZ.js → chunk-BXDNFBKZ.js} +26 -2
- package/dist/safe-bash/command-chunks/chunk-BZLLQWRK.js +296 -0
- package/dist/safe-bash/command-chunks/{chunk-YXR4JE4U.js → chunk-C3FERGHU.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-C5SLY3RB.js +279 -0
- package/dist/safe-bash/command-chunks/{chunk-5O45KGW5.js → chunk-C5VUJOUQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-T4SEQU66.js → chunk-CI6KHUFK.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-CJIFJ45R.js +203 -0
- package/dist/safe-bash/command-chunks/{chunk-OTEHQQU7.js → chunk-CKQ5SXOO.js} +8 -59
- package/dist/safe-bash/command-chunks/{chunk-LJ3UYESS.js → chunk-CP5EO5TT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-TY7JXEWI.js → chunk-CPCXE2TM.js} +13 -13
- package/dist/safe-bash/command-chunks/{chunk-VVWHFNHD.js → chunk-CXOAMPOV.js} +420 -28
- package/dist/safe-bash/command-chunks/{chunk-57PK2QFX.js → chunk-D3WMD32B.js} +16 -16
- package/dist/safe-bash/command-chunks/{chunk-LECGQSQW.js → chunk-D54L2IOZ.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-FGARVKAX.js → chunk-DBYY7IDI.js} +24 -20
- package/dist/safe-bash/command-chunks/{chunk-LNAZ3E4Q.js → chunk-DGFMOT4O.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-N5J3IZZK.js → chunk-DQVOBGI2.js} +12414 -8140
- package/dist/safe-bash/command-chunks/{chunk-OHEZQ4QA.js → chunk-DTLIBRCQ.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-FGHSE3RZ.js → chunk-DZ4ELL34.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ICJH6A73.js → chunk-DZTT5SLG.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-77NXQZGK.js → chunk-DZY7V74W.js} +3 -1
- package/dist/safe-bash/command-chunks/chunk-E47FFS5M.js +52 -0
- package/dist/safe-bash/command-chunks/{chunk-LNKZVU5V.js → chunk-E76WK7OQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-EWC56JNI.js → chunk-EBMKGNKF.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-5GDF5FAS.js → chunk-EEJ3YXVO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GMBUOYTN.js → chunk-EG7VVDV3.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-N32AP43V.js → chunk-EIZFAUUD.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-FR63MJSO.js → chunk-ESIEU4E4.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-QJZJWL2X.js → chunk-ET3CPTJT.js} +38 -25
- package/dist/safe-bash/command-chunks/{chunk-UT5X6QRU.js → chunk-ETS4BINB.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-SBXS4S6Y.js → chunk-EU5SR3LS.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-FTZFCMVI.js → chunk-FAVWWMFW.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-YKODRSGT.js → chunk-FCGMSOF6.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-S5ER73EA.js → chunk-FGK6HLSY.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-WMV5224N.js → chunk-FILE5PBI.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-7ADQE64C.js → chunk-FMGNXOMV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XPQUUFQD.js → chunk-FPOM47UA.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-ZZERSKAR.js → chunk-FX54I4AC.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-CORUUCS2.js → chunk-GAYTDZPP.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-GCSKS22X.js +15 -0
- package/dist/safe-bash/command-chunks/{chunk-2QZUAZTH.js → chunk-GIQUIF6E.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-UVZJAV2S.js → chunk-GNPPPYDF.js} +1 -78
- package/dist/safe-bash/command-chunks/{chunk-B6XTAKKQ.js → chunk-GNVAW6NL.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-GQV5RWMN.js +27 -0
- package/dist/safe-bash/command-chunks/{chunk-PWHIVWQT.js → chunk-GVDVRC7J.js} +15 -19
- package/dist/safe-bash/command-chunks/{chunk-N4HWOLGZ.js → chunk-GY2C555A.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-KXM3HTAF.js → chunk-GYKQ3IOV.js} +27 -14
- package/dist/safe-bash/command-chunks/{chunk-VMZIAFVJ.js → chunk-HBR5PWX4.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-YPG55QTP.js → chunk-HCJWEB6P.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ZOEKSH3R.js → chunk-HCPEYQKT.js} +5 -4
- package/dist/safe-bash/command-chunks/{chunk-U42WHQRH.js → chunk-HCZITM4C.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-4SISSPIH.js → chunk-HLRLMFMS.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-HNEWGADJ.js +43 -0
- package/dist/safe-bash/command-chunks/{chunk-DZOKH5BL.js → chunk-HQFX5XKV.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-QNX5LZBK.js → chunk-HSB55ED5.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-G3FK5VVG.js → chunk-HTBUIRTH.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QCIAX6HZ.js → chunk-HUAQZFON.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-6M3JTPKE.js → chunk-HVLF3Y4B.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-AYQPJQJR.js → chunk-I6CQDCIP.js} +8 -8
- package/dist/safe-bash/command-chunks/chunk-I7MEH76L.js +276 -0
- package/dist/safe-bash/command-chunks/{chunk-E3BL7W5C.js → chunk-IAHYG67O.js} +152 -80
- package/dist/safe-bash/command-chunks/{chunk-TXWDR2P4.js → chunk-IBT3OWXB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-EAGIJ4VW.js → chunk-IC5XC4TO.js} +118 -118
- package/dist/safe-bash/command-chunks/{chunk-ERWIJYCS.js → chunk-IGZOQT2L.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-CKIXC7AO.js → chunk-IPKYPADE.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-FJLSYX5P.js → chunk-ITJDLFPW.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-MUTARE5I.js → chunk-IYEAS7TU.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-WDVPHDBH.js → chunk-J3ISXTYB.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-J3VS55K4.js +69097 -0
- package/dist/safe-bash/command-chunks/chunk-J4I7KCQQ.js +495 -0
- package/dist/safe-bash/command-chunks/{chunk-IWVANZWH.js → chunk-JLPBGKVC.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-HQEYSSZV.js → chunk-JLS6XKAR.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IJE65P52.js → chunk-JMUB5A26.js} +27 -8
- package/dist/safe-bash/command-chunks/{chunk-HOJ7WDTS.js → chunk-JQPDVCBU.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-LQX7RAF7.js → chunk-JSW6YH6T.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DM5WURQL.js → chunk-JY2T3KV2.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-IZ3SD5S2.js → chunk-K2NV6H7E.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-YJ5IA5YQ.js → chunk-K576GZED.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-VZTVR3JI.js → chunk-K6J3KFQ2.js} +17 -122
- package/dist/safe-bash/command-chunks/{chunk-RTHYAGKI.js → chunk-KD4JUF6R.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-FUYZUETI.js → chunk-KQE2D7PX.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-Q65GWGQR.js → chunk-KVTZJBLM.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-ONQP4FNV.js → chunk-KZICRCQ7.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-L365UGC7.js +250 -0
- package/dist/safe-bash/command-chunks/{chunk-UKAGRRLZ.js → chunk-LBBJ5S3W.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WHZ6XK7Y.js → chunk-LBILRPVR.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ENMJHB2C.js → chunk-LDR3PPM3.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-LJLB7TBN.js +775 -0
- package/dist/safe-bash/command-chunks/{chunk-A6OTPNNI.js → chunk-LPKMNCC5.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-JA36YOZI.js → chunk-LUJUYUOG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-FB2WPI3M.js → chunk-LZHFVNEV.js} +17 -107
- package/dist/safe-bash/command-chunks/{chunk-4X2MPZXW.js → chunk-M42GCI5F.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-URQSUMMJ.js → chunk-M7MQTU77.js} +6 -6
- package/dist/safe-bash/command-chunks/chunk-MCUDSE4H.js +77 -0
- package/dist/safe-bash/command-chunks/{chunk-V6JPIZUW.js → chunk-MD5ZSARP.js} +9 -9
- package/dist/safe-bash/command-chunks/chunk-MEST2HID.js +112 -0
- package/dist/safe-bash/command-chunks/{chunk-26JE5JEB.js → chunk-MLMFFBOU.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-HOKPYTHQ.js → chunk-MPRUGL4W.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-E22EAYJN.js → chunk-MQCLG2CT.js} +177 -34
- package/dist/safe-bash/command-chunks/{chunk-G3LUT475.js → chunk-N5Y7WWO6.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-MZYQKH26.js → chunk-NA6YAGAH.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-PPN53PX3.js → chunk-NDJPULBE.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-2IMIKROX.js → chunk-NN6OWOJG.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-SWIF6BBY.js → chunk-NNYOPI7K.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-GAROGIVU.js → chunk-NP2QXF2X.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-SNA2LVBX.js → chunk-NPVOYY2A.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-T2FRXSQT.js → chunk-NR7POLKP.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-A4P37F3P.js → chunk-NWA7ZJDV.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-45DKGZYO.js → chunk-O3FTKLWR.js} +423 -213
- package/dist/safe-bash/command-chunks/{chunk-6KJDTKE4.js → chunk-O4H7HPMP.js} +35 -393
- package/dist/safe-bash/command-chunks/{chunk-J6FNSVHT.js → chunk-OLNV5MI6.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-BBEAO5N7.js → chunk-OLXMWQJ5.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-MDFNUNK5.js → chunk-OMD45J52.js} +25 -21
- package/dist/safe-bash/command-chunks/{chunk-AXI7VMLG.js → chunk-OOYVZAWL.js} +3 -41
- package/dist/safe-bash/command-chunks/{chunk-2TWXRJPB.js → chunk-OPKLIF5P.js} +17 -17
- package/dist/safe-bash/command-chunks/{chunk-E3DF7RTE.js → chunk-OT75C5YS.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-ROQ3VNVX.js → chunk-OVCSXD7N.js} +10 -10
- package/dist/safe-bash/command-chunks/chunk-P3LHQOX7.js +371 -0
- package/dist/safe-bash/command-chunks/{chunk-OFDJJRAD.js → chunk-P3TV5GIG.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-LQDANF2B.js → chunk-P5UFNPRE.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-5V7WIQ2D.js → chunk-PAEAEFK3.js} +122 -12
- package/dist/safe-bash/command-chunks/{chunk-OWCBX5M2.js → chunk-PAY4ULWY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-TXU7MMHN.js → chunk-PH722HK2.js} +16 -16
- package/dist/safe-bash/command-chunks/{chunk-OU4VE5CR.js → chunk-PKH57OIC.js} +8 -6
- package/dist/safe-bash/command-chunks/{chunk-GTOMW4VV.js → chunk-PNOXBL2B.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-L4XSOULP.js → chunk-PPNPXNM6.js} +38 -2
- package/dist/safe-bash/command-chunks/{chunk-DXOXUKQB.js → chunk-PVKSBXHB.js} +11 -9
- package/dist/safe-bash/command-chunks/{chunk-EZDWPTYB.js → chunk-PYYAX5FB.js} +23 -23
- package/dist/safe-bash/command-chunks/{chunk-MOUCMZZP.js → chunk-PZVFNPRC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-UPWLHHZ2.js → chunk-QCCRQU44.js} +18 -18
- package/dist/safe-bash/command-chunks/{chunk-IVKAFEPO.js → chunk-QEVSG6HQ.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-6YF2QADH.js → chunk-QGSY4ZAU.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-LZY46GYY.js → chunk-QMWBKR4C.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-4YFTJS5U.js → chunk-QMXOKYMJ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-CHZE6FNT.js → chunk-QPHI7Y7Z.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-N3ZH4YYH.js → chunk-QQ7ORF2D.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-4ABR3KGK.js → chunk-QWQHLMDX.js} +7 -7
- package/dist/safe-bash/command-chunks/chunk-QX3WKBLI.js +58 -0
- package/dist/safe-bash/command-chunks/{chunk-V6OWCRHN.js → chunk-QZPSGPN5.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-R36PDP3L.js +106 -0
- package/dist/safe-bash/command-chunks/{chunk-N35IJXBK.js → chunk-R43WEA4C.js} +14 -14
- package/dist/safe-bash/command-chunks/{chunk-5YL453ZF.js → chunk-R6VXFTYL.js} +47 -47
- package/dist/safe-bash/command-chunks/{chunk-OVUY46QF.js → chunk-RC4TNFNF.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-PU5DMQGG.js → chunk-RESJSUHH.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-OCOJMKDP.js → chunk-RHXV2KG5.js} +522 -8
- package/dist/safe-bash/command-chunks/{chunk-7B2MHKIW.js → chunk-RKON2TGI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-OIHQXURE.js → chunk-ROE6KD4C.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ITXSHOLP.js → chunk-RQTFK7AV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-BKK4MS3V.js → chunk-RR6XG2I6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-CFMJXJS5.js → chunk-RTUDDAAY.js} +9 -4
- package/dist/safe-bash/command-chunks/{chunk-FAU2KL6I.js → chunk-S5MBHFLB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-R7LF4XQV.js → chunk-S6223MIG.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-6W4RMBFH.js → chunk-SKDJCMGI.js} +12 -10
- package/dist/safe-bash/command-chunks/{chunk-NCNHJRIY.js → chunk-SKF6PGA5.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-3PM46VWH.js → chunk-SLD5A7IL.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-KYIGYYEY.js → chunk-SMCRKN3O.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-H56BSMFQ.js → chunk-T2LZWXWF.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-KDDXLHN7.js → chunk-TMJG745A.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-QMBMZSJF.js → chunk-TP5MZHCB.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-ET6LMDEX.js → chunk-TPSRY72Q.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-ZAYTFXUX.js → chunk-TTPT3OME.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-GR4ONCQ5.js → chunk-U6VSRO6E.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-5VF2EA7Z.js → chunk-U7J3R7HX.js} +6 -1
- package/dist/safe-bash/command-chunks/{chunk-A5SPMSKD.js → chunk-UDRJKA3P.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-3B444A5G.js → chunk-UI5AS3FS.js} +10 -2
- package/dist/safe-bash/command-chunks/{chunk-RVWIEXR7.js → chunk-UMOQHHSV.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-WH624PKJ.js → chunk-UNI6QG45.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-BOVDUJ3A.js → chunk-UTSN7AKE.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-F5QYUK2E.js → chunk-UWIDPTOB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-345YBIHP.js → chunk-V2J6AC6S.js} +19 -19
- package/dist/safe-bash/command-chunks/{chunk-ZZ27QNBY.js → chunk-V2PJO6JL.js} +29 -60
- package/dist/safe-bash/command-chunks/{chunk-QNETPOMH.js → chunk-VAMBWXDV.js} +72 -21
- package/dist/safe-bash/command-chunks/{chunk-KM2SMMXZ.js → chunk-VJQ5OWS5.js} +80 -2
- package/dist/safe-bash/command-chunks/{chunk-OCV5ZU35.js → chunk-VSTAHYCV.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-MI2WY75O.js → chunk-VWBNUCUP.js} +28 -11
- package/dist/safe-bash/command-chunks/{chunk-SL4LD25A.js → chunk-W4BC2YGQ.js} +15 -15
- package/dist/safe-bash/command-chunks/{chunk-Y3ZRIZL7.js → chunk-W5LH7D23.js} +26 -13
- package/dist/safe-bash/command-chunks/{chunk-62RG3GHF.js → chunk-W6L4Z2VX.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-RRAQII52.js → chunk-WEXEZRMH.js} +7 -7
- package/dist/safe-bash/command-chunks/chunk-WIUEM7HP.js +58 -0
- package/dist/safe-bash/command-chunks/{chunk-AQ3XOOPQ.js → chunk-WKS2PAZL.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-WOECEZAC.js +921 -0
- package/dist/safe-bash/command-chunks/{chunk-A2L3U7DW.js → chunk-WOO3YO2X.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-7YDJ7LDO.js → chunk-WOT2YXBT.js} +8 -223
- package/dist/safe-bash/command-chunks/{chunk-LT2YCGC5.js → chunk-WV3C6BRD.js} +14 -14
- package/dist/safe-bash/command-chunks/{chunk-PRO7JOIH.js → chunk-X3EDCCXU.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-WMBELKPP.js → chunk-XE75H5ZZ.js} +15 -15
- package/dist/safe-bash/command-chunks/{chunk-SHLT5R64.js → chunk-XMNPE6RN.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-ISFGPCED.js → chunk-XNVL6AOV.js} +16 -16
- package/dist/safe-bash/command-chunks/{chunk-OBIXFO25.js → chunk-XPUYA7YU.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-5KZMR6AJ.js → chunk-XXUMECE4.js} +22 -20
- package/dist/safe-bash/command-chunks/{chunk-OAM2SUUI.js → chunk-YB5TNDY6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KLAC2MIZ.js → chunk-YJMS5Q4Y.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-FLSXHLJG.js → chunk-YJTP4ROI.js} +15 -15
- package/dist/safe-bash/command-chunks/{chunk-7ITPO2V6.js → chunk-YNFQ5AXM.js} +80 -45
- package/dist/safe-bash/command-chunks/{chunk-7PYDVQPB.js → chunk-YWP62BAZ.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-YXIJOYT6.js +416 -0
- package/dist/safe-bash/command-chunks/{chunk-NQL3WNFI.js → chunk-YYRVGXJH.js} +44 -5
- package/dist/safe-bash/command-chunks/{chunk-35DU6I2M.js → chunk-Z7UPCDTU.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-O2XP6HQN.js → chunk-ZBGP6XEG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VWRHPDCD.js → chunk-ZIDESNHW.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-VVV45NLY.js → chunk-ZJUU5IAS.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3ZWFE4CK.js → chunk-ZLMCWAAU.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-7OCTMVYJ.js → chunk-ZNABMTV3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QOKFSYD5.js → chunk-ZODGWV3Y.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-DIRK47GT.js → chunk-ZPBL7TYJ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-5MNQTHED.js → chunk-ZQ4NQ24M.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-4IDV763L.js → chunk-ZS4J5B6Y.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-ZTW2E5OT.js +1016 -0
- package/dist/safe-bash/command-chunks/{chunk-NKK76B4V.js → chunk-ZUOID3FA.js} +14 -14
- package/dist/safe-bash/command-chunks/chunk-ZWGERYLT.js +192 -0
- package/dist/safe-bash/command-chunks/{chunk-F2NF6FHV.js → chunk-ZXIOTUXC.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-LFSWLJPR.js → chunk-ZZ6EIACJ.js} +250 -41
- package/dist/safe-bash/command-chunks/{chunk-XMRQ6UP2.js → chunk-ZZO3GYEZ.js} +1 -11
- package/dist/safe-bash/command-chunks/{command-engine-2QXVRRH3.js → command-engine-B6X6WAMX.js} +381 -114
- package/dist/safe-bash/command-chunks/{engine-T4GP6QOK-ECFKMR5V.js → engine-UPLVIV72-IGXUDNO5.js} +1 -1
- package/dist/safe-bash/command-chunks/model-store-RGLCVIML.js +54 -0
- package/dist/safe-bash/command-chunks/paradox-BHPRIGXX-RQN37FHB.js +370 -0
- package/dist/safe-bash/command-chunks/prompt-tool-debug-ERJKK3XZ.js +171 -0
- package/dist/safe-bash/commands/alias/index.js +1 -1
- package/dist/safe-bash/commands/apply-patch/index.js +1 -1
- package/dist/safe-bash/commands/archive/create.js +1 -1
- package/dist/safe-bash/commands/archive/extract.js +1 -1
- package/dist/safe-bash/commands/archive/format.js +1 -1
- package/dist/safe-bash/commands/archive/index.js +1 -1
- package/dist/safe-bash/commands/archive/internal.js +1 -1
- package/dist/safe-bash/commands/archive/listing.js +1 -1
- package/dist/safe-bash/commands/archive/modes.js +1 -1
- package/dist/safe-bash/commands/archive/options.js +1 -1
- package/dist/safe-bash/commands/archive/stream.js +1 -1
- package/dist/safe-bash/commands/archive/transform.js +1 -1
- package/dist/safe-bash/commands/archive/unzip/safety.js +1 -1
- package/dist/safe-bash/commands/archive/unzip.js +1 -1
- package/dist/safe-bash/commands/archive/zip/aes.js +1 -1
- package/dist/safe-bash/commands/archive/zip/comments.js +1 -1
- package/dist/safe-bash/commands/archive/zip/crc.js +1 -1
- package/dist/safe-bash/commands/archive/zip/crypto.js +1 -1
- package/dist/safe-bash/commands/archive/zip/dates.js +1 -1
- package/dist/safe-bash/commands/archive/zip/environment.js +1 -1
- package/dist/safe-bash/commands/archive/zip/grow.js +1 -1
- package/dist/safe-bash/commands/archive/zip/help.js +1 -1
- package/dist/safe-bash/commands/archive/zip/line-endings.js +1 -1
- package/dist/safe-bash/commands/archive/zip/log.js +1 -1
- package/dist/safe-bash/commands/archive/zip/lzma.js +1 -1
- package/dist/safe-bash/commands/archive/zip/move.js +1 -1
- package/dist/safe-bash/commands/archive/zip/names.js +1 -1
- package/dist/safe-bash/commands/archive/zip/options.js +1 -1
- package/dist/safe-bash/commands/archive/zip/repair.js +1 -1
- package/dist/safe-bash/commands/archive/zip/safety.js +1 -1
- package/dist/safe-bash/commands/archive/zip/sfx.js +1 -1
- package/dist/safe-bash/commands/archive/zip/test-command.js +1 -1
- package/dist/safe-bash/commands/archive/zip/volumes.js +1 -1
- package/dist/safe-bash/commands/archive/zip/zip64.js +1 -1
- package/dist/safe-bash/commands/archive/zip-format.js +1 -1
- package/dist/safe-bash/commands/archive/zip.js +1 -1
- package/dist/safe-bash/commands/ast-grep/index.js +1 -1
- package/dist/safe-bash/commands/audio/index.browser.js +2 -8
- package/dist/safe-bash/commands/audio/index.js +1 -1
- package/dist/safe-bash/commands/awk/index.js +1 -1
- package/dist/safe-bash/commands/base32/index.js +1 -1
- package/dist/safe-bash/commands/base64/index.js +1 -1
- package/dist/safe-bash/commands/bc/index.browser.js +1 -1
- package/dist/safe-bash/commands/bc/index.js +1 -1
- package/dist/safe-bash/commands/bytes/checksums/sm3.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/codec-loader.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/codec.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/errors.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/file-operation.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/files.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/gunzip.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/stream.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/xz-list.js +1 -1
- package/dist/safe-bash/commands/bytes/compression/zstd-decode.js +1 -1
- package/dist/safe-bash/commands/bytes/encoding/base.js +1 -1
- package/dist/safe-bash/commands/bytes/encoding/shared.js +1 -1
- package/dist/safe-bash/commands/bytes/input-budget.js +1 -1
- package/dist/safe-bash/commands/bzip2/index.js +1 -1
- package/dist/safe-bash/commands/cal/index.js +1 -1
- package/dist/safe-bash/commands/caller/index.js +1 -1
- package/dist/safe-bash/commands/canonicalize-existing-parent.js +1 -1
- package/dist/safe-bash/commands/chmod/index.js +1 -1
- package/dist/safe-bash/commands/column/index.js +1 -1
- package/dist/safe-bash/commands/comm/index.js +1 -1
- package/dist/safe-bash/commands/copy-backup.js +1 -1
- package/dist/safe-bash/commands/copy-preserve.js +1 -1
- package/dist/safe-bash/commands/copy-source.js +1 -1
- package/dist/safe-bash/commands/cp/index.js +1 -1
- package/dist/safe-bash/commands/csplit/index.js +1 -1
- package/dist/safe-bash/commands/csvcut/index.js +1 -1
- package/dist/safe-bash/commands/csvgrep/index.js +1 -1
- package/dist/safe-bash/commands/csvkit/index.js +1 -1
- package/dist/safe-bash/commands/curl/index.js +1 -1
- package/dist/safe-bash/commands/date/index.js +1 -1
- package/dist/safe-bash/commands/df/index.js +1 -1
- package/dist/safe-bash/commands/diff/index.js +1 -1
- package/dist/safe-bash/commands/diff-patch/diff-format.js +1 -1
- package/dist/safe-bash/commands/diff-patch/diff-options.js +1 -1
- package/dist/safe-bash/commands/diff-patch/diff-output.js +1 -1
- package/dist/safe-bash/commands/diff-patch/diff.js +1 -1
- package/dist/safe-bash/commands/diff-patch/index.js +2 -2
- package/dist/safe-bash/commands/diff-patch/patch-envelope.js +1 -1
- package/dist/safe-bash/commands/diff-patch/patch-formats.js +1 -1
- package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.js +1 -1
- package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.js +1 -1
- package/dist/safe-bash/commands/diff-patch/patch-path.js +1 -1
- package/dist/safe-bash/commands/diff-patch/patch-publication.js +1 -1
- package/dist/safe-bash/commands/diff-patch/patch.js +1 -1
- package/dist/safe-bash/commands/diff-patch/shared.js +1 -1
- package/dist/safe-bash/commands/diff-patch/unified.js +1 -1
- package/dist/safe-bash/commands/diff3/index.js +1 -1
- package/dist/safe-bash/commands/diffpdf/index.js +1 -1
- package/dist/safe-bash/commands/directory-admission.js +1 -1
- package/dist/safe-bash/commands/docx/index.js +1 -1
- package/dist/safe-bash/commands/docx/io.js +1 -1
- package/dist/safe-bash/commands/dos2unix/index.js +1 -1
- package/dist/safe-bash/commands/dot/index.js +1 -1
- package/dist/safe-bash/commands/du/index.js +1 -1
- package/dist/safe-bash/commands/egrep/index.js +1 -1
- package/dist/safe-bash/commands/env/index.js +1 -1
- package/dist/safe-bash/commands/env-split.js +1 -1
- package/dist/safe-bash/commands/exiftool/index.js +1 -1
- package/dist/safe-bash/commands/expand/index.js +1 -1
- package/dist/safe-bash/commands/expr/index.js +1 -1
- package/dist/safe-bash/commands/factor/index.js +1 -1
- package/dist/safe-bash/commands/fd/index.js +1 -1
- package/dist/safe-bash/commands/ffmpeg/index.js +1 -1
- package/dist/safe-bash/commands/ffprobe/index.js +1 -1
- package/dist/safe-bash/commands/fgrep/index.js +1 -1
- package/dist/safe-bash/commands/file/index.js +1 -1
- package/dist/safe-bash/commands/filesystem-requirements.js +1 -1
- package/dist/safe-bash/commands/find/index.js +1 -1
- package/dist/safe-bash/commands/find-format.js +1 -1
- package/dist/safe-bash/commands/find.js +1 -1
- package/dist/safe-bash/commands/fmt/index.js +1 -1
- package/dist/safe-bash/commands/fold/index.js +1 -1
- package/dist/safe-bash/commands/getconf/index.js +1 -1
- package/dist/safe-bash/commands/getopt/index.js +1 -1
- package/dist/safe-bash/commands/gnu-information.js +1 -1
- package/dist/safe-bash/commands/gpg/index.js +1 -1
- package/dist/safe-bash/commands/graphviz/index.js +3 -3
- package/dist/safe-bash/commands/grep/index.js +1 -1
- package/dist/safe-bash/commands/grep-aliases/aliases.js +1 -1
- package/dist/safe-bash/commands/grep.js +1 -1
- package/dist/safe-bash/commands/gzip/index.js +1 -1
- package/dist/safe-bash/commands/hexdump/index.js +1 -1
- package/dist/safe-bash/commands/hostname/index.js +1 -1
- package/dist/safe-bash/commands/html-to-markdown/index.js +1 -1
- package/dist/safe-bash/commands/htmlq/index.js +1 -1
- package/dist/safe-bash/commands/iconv/index.js +1 -1
- package/dist/safe-bash/commands/id/index.js +1 -1
- package/dist/safe-bash/commands/imagemagick/index.js +1 -1
- package/dist/safe-bash/commands/internal.js +1 -1
- package/dist/safe-bash/commands/join/index.js +1 -1
- package/dist/safe-bash/commands/jq/index.js +1 -1
- package/dist/safe-bash/commands/less/index.js +1 -1
- package/dist/safe-bash/commands/line-endings/index.js +1 -1
- package/dist/safe-bash/commands/llm/collections.js +1 -1
- package/dist/safe-bash/commands/llm/command.js +1 -1
- package/dist/safe-bash/commands/llm/elevenlabs-stream.js +1 -1
- package/dist/safe-bash/commands/llm/elevenlabs.js +1 -1
- package/dist/safe-bash/commands/llm/index.browser.js +21 -1
- package/dist/safe-bash/commands/llm/index.js +1 -1
- package/dist/safe-bash/commands/llm/mime.js +1 -1
- package/dist/safe-bash/commands/llm/openai-http.js +1 -1
- package/dist/safe-bash/commands/llm/openai-sse.js +1 -1
- package/dist/safe-bash/commands/llm/openai.js +1 -1
- package/dist/safe-bash/commands/llm/providers/elevenlabs.js +1 -1
- package/dist/safe-bash/commands/llm/providers/index.js +1 -1
- package/dist/safe-bash/commands/llm/providers/openai.js +1 -1
- package/dist/safe-bash/commands/llm/providers/shared.js +1 -1
- package/dist/safe-bash/commands/llm/service.js +1 -1
- package/dist/safe-bash/commands/locale/index.js +1 -1
- package/dist/safe-bash/commands/md5sum/index.js +1 -1
- package/dist/safe-bash/commands/mdq/index.js +1 -1
- package/dist/safe-bash/commands/media/index.js +1 -1
- package/dist/safe-bash/commands/media/plugin.js +1 -1
- package/dist/safe-bash/commands/media/remote.js +1 -1
- package/dist/safe-bash/commands/media/settings.js +1 -1
- package/dist/safe-bash/commands/metadata/chmod.js +1 -1
- package/dist/safe-bash/commands/metadata/internal.js +1 -1
- package/dist/safe-bash/commands/metadata/mktemp.js +1 -1
- package/dist/safe-bash/commands/metadata/stat.js +1 -1
- package/dist/safe-bash/commands/mktemp/index.js +1 -1
- package/dist/safe-bash/commands/mmdc/index.js +1 -1
- package/dist/safe-bash/commands/more/index.js +1 -1
- package/dist/safe-bash/commands/neato/index.js +1 -1
- package/dist/safe-bash/commands/network/aggregate.js +1 -1
- package/dist/safe-bash/commands/network/args.js +1 -1
- package/dist/safe-bash/commands/network/authorizer.js +1 -1
- package/dist/safe-bash/commands/network/body.js +1 -1
- package/dist/safe-bash/commands/network/curl.js +1 -1
- package/dist/safe-bash/commands/network/deadline.js +1 -1
- package/dist/safe-bash/commands/network/decode.js +1 -1
- package/dist/safe-bash/commands/network/fetch-transport.js +1 -1
- package/dist/safe-bash/commands/network/form-content-type.js +1 -1
- package/dist/safe-bash/commands/network/form-headers.js +1 -1
- package/dist/safe-bash/commands/network/glob.js +1 -1
- package/dist/safe-bash/commands/network/input.js +1 -1
- package/dist/safe-bash/commands/network/output.js +1 -1
- package/dist/safe-bash/commands/network/platform-portable.js +1 -1
- package/dist/safe-bash/commands/network/platform.js +1 -1
- package/dist/safe-bash/commands/network/private-address.js +1 -1
- package/dist/safe-bash/commands/network/shared.js +1 -1
- package/dist/safe-bash/commands/network/types.js +1 -1
- package/dist/safe-bash/commands/network/url.js +1 -1
- package/dist/safe-bash/commands/network/wget.js +1 -1
- package/dist/safe-bash/commands/nl/index.js +1 -1
- package/dist/safe-bash/commands/node/browser.js +1 -1
- package/dist/safe-bash/commands/node/buffer.js +1 -1
- package/dist/safe-bash/commands/node/default-runtime.js +1 -1
- package/dist/safe-bash/commands/node/filesystem.js +1 -1
- package/dist/safe-bash/commands/node/path.js +1 -1
- package/dist/safe-bash/commands/node/safejs.js +1 -1
- package/dist/safe-bash/commands/node/source-maps.js +1 -1
- package/dist/safe-bash/commands/node/timers.js +1 -1
- package/dist/safe-bash/commands/node/types.js +1 -1
- package/dist/safe-bash/commands/node/worker-types.js +1 -1
- package/dist/safe-bash/commands/nproc/index.js +1 -1
- package/dist/safe-bash/commands/numfmt/index.js +1 -1
- package/dist/safe-bash/commands/od/index.js +1 -1
- package/dist/safe-bash/commands/op/index.js +23 -1
- package/dist/safe-bash/commands/openssl/index.js +1 -1
- package/dist/safe-bash/commands/pandoc/index.browser.js +1 -1
- package/dist/safe-bash/commands/pandoc/index.js +1 -1
- package/dist/safe-bash/commands/paste/index.js +1 -1
- package/dist/safe-bash/commands/patch/index.js +1 -1
- package/dist/safe-bash/commands/pathchk/index.js +1 -1
- package/dist/safe-bash/commands/pdfimages/index.js +1 -1
- package/dist/safe-bash/commands/pdfinfo/index.js +1 -1
- package/dist/safe-bash/commands/pdfseparate/index.js +1 -1
- package/dist/safe-bash/commands/pdftk/index.js +1 -1
- package/dist/safe-bash/commands/pdftoppm/index.js +1 -1
- package/dist/safe-bash/commands/pdftotext/index.js +1 -1
- package/dist/safe-bash/commands/pdfunite/index.js +1 -1
- package/dist/safe-bash/commands/playwright/index.js +1 -1
- package/dist/safe-bash/commands/portable-random.js +1 -1
- package/dist/safe-bash/commands/portable-requirements.js +1 -1
- package/dist/safe-bash/commands/pptx/index.js +1 -1
- package/dist/safe-bash/commands/pr/index.js +1 -1
- package/dist/safe-bash/commands/printenv/index.js +1 -1
- package/dist/safe-bash/commands/python/executor-pool.js +1 -1
- package/dist/safe-bash/commands/python/executor.browser.js +2 -1
- package/dist/safe-bash/commands/python/executor.js +1 -1
- package/dist/safe-bash/commands/python/host-capabilities.js +1 -1
- package/dist/safe-bash/commands/python/index.browser.js +3 -1
- package/dist/safe-bash/commands/python/index.js +1 -1
- package/dist/safe-bash/commands/python/jspi-assets.js +1 -1
- package/dist/safe-bash/commands/python/jspi-trampoline.js +1 -1
- package/dist/safe-bash/commands/python/jspi.js +1 -1
- package/dist/safe-bash/commands/python/llm-capability.js +1 -1
- package/dist/safe-bash/commands/python/llm-dependencies.js +1 -1
- package/dist/safe-bash/commands/python/llm-module.js +1 -1
- package/dist/safe-bash/commands/python/llm-provider.js +1 -1
- package/dist/safe-bash/commands/python/llm-reference-module.js +1 -1
- package/dist/safe-bash/commands/python/provisioning.js +1 -1
- package/dist/safe-bash/commands/python/shell-capability.js +1 -1
- package/dist/safe-bash/commands/python/shell-module.js +1 -1
- package/dist/safe-bash/commands/python/worker.js +1 -1
- package/dist/safe-bash/commands/qpdf/index.js +1 -1
- package/dist/safe-bash/commands/qrencode/index.js +1 -1
- package/dist/safe-bash/commands/readlink/index.js +1 -1
- package/dist/safe-bash/commands/readlink-missing.js +1 -1
- package/dist/safe-bash/commands/realpath/index.js +1 -1
- package/dist/safe-bash/commands/record-buffer.js +1 -1
- package/dist/safe-bash/commands/regex-execution/ascii.js +1 -1
- package/dist/safe-bash/commands/regex-execution/bounded-glob.js +1 -1
- package/dist/safe-bash/commands/regex-execution/bounded-provider.js +1 -1
- package/dist/safe-bash/commands/regex-execution/ere/errors.js +1 -1
- package/dist/safe-bash/commands/regex-execution/ere/limits.js +1 -1
- package/dist/safe-bash/commands/regex-execution/ere/matcher.js +1 -1
- package/dist/safe-bash/commands/regex-execution/ere/syntax.js +1 -1
- package/dist/safe-bash/commands/regex-execution/portable.js +1 -1
- package/dist/safe-bash/commands/regex-execution/protocol.js +1 -1
- package/dist/safe-bash/commands/regex-execution/utf8.js +1 -1
- package/dist/safe-bash/commands/rev/index.js +1 -1
- package/dist/safe-bash/commands/rg/index.js +1 -1
- package/dist/safe-bash/commands/rgrep/index.js +1 -1
- package/dist/safe-bash/commands/rsvg-convert/index.js +1 -1
- package/dist/safe-bash/commands/safejs/io.js +1 -1
- package/dist/safe-bash/commands/safejs/options.js +1 -1
- package/dist/safe-bash/commands/safejs/render.js +1 -1
- package/dist/safe-bash/commands/safejs/runtime.js +1 -1
- package/dist/safe-bash/commands/safejs/types.js +1 -1
- package/dist/safe-bash/commands/search/ergonomic-regex.js +1 -1
- package/dist/safe-bash/commands/search/file-types.js +1 -1
- package/dist/safe-bash/commands/search/glob.js +1 -1
- package/dist/safe-bash/commands/search/grep-files.js +1 -1
- package/dist/safe-bash/commands/search/grep.js +1 -1
- package/dist/safe-bash/commands/search/matcher.js +1 -1
- package/dist/safe-bash/commands/search/options.js +1 -1
- package/dist/safe-bash/commands/search/output.js +1 -1
- package/dist/safe-bash/commands/search/requirements.js +1 -1
- package/dist/safe-bash/commands/search/rg-command.js +1 -1
- package/dist/safe-bash/commands/search/shared.js +1 -1
- package/dist/safe-bash/commands/search/walk.js +1 -1
- package/dist/safe-bash/commands/sed/index.js +1 -1
- package/dist/safe-bash/commands/seq/index.js +1 -1
- package/dist/safe-bash/commands/sha1sum/index.js +1 -1
- package/dist/safe-bash/commands/sha256sum/index.js +1 -1
- package/dist/safe-bash/commands/sha512sum/index.js +1 -1
- package/dist/safe-bash/commands/sips/index.js +1 -1
- package/dist/safe-bash/commands/sleep/index.js +1 -1
- package/dist/safe-bash/commands/soffice/index.js +1 -1
- package/dist/safe-bash/commands/sort/index.js +1 -1
- package/dist/safe-bash/commands/sort-admission.js +1 -1
- package/dist/safe-bash/commands/sox/index.js +1 -1
- package/dist/safe-bash/commands/soxi/index.js +1 -1
- package/dist/safe-bash/commands/split/index.js +1 -1
- package/dist/safe-bash/commands/sponge/index.js +1 -1
- package/dist/safe-bash/commands/sqlite3/index.js +1 -1
- package/dist/safe-bash/commands/ssh/index.js +1 -1
- package/dist/safe-bash/commands/stat/index.js +1 -1
- package/dist/safe-bash/commands/stream-format/shared.js +1 -1
- package/dist/safe-bash/commands/stream-inspection/numeric-options.js +1 -1
- package/dist/safe-bash/commands/stream-inspection/shared.js +1 -1
- package/dist/safe-bash/commands/stream-inspection/strings-object.js +1 -1
- package/dist/safe-bash/commands/strings/index.js +1 -1
- package/dist/safe-bash/commands/structured/bytes.js +1 -1
- package/dist/safe-bash/commands/structured/capture.js +1 -1
- package/dist/safe-bash/commands/structured/dates.js +1 -1
- package/dist/safe-bash/commands/structured/delpaths.js +1 -1
- package/dist/safe-bash/commands/structured/formats.js +1 -1
- package/dist/safe-bash/commands/structured/indices.js +1 -1
- package/dist/safe-bash/commands/structured/input.js +1 -1
- package/dist/safe-bash/commands/structured/interpreter.js +1 -1
- package/dist/safe-bash/commands/structured/jq.js +1 -1
- package/dist/safe-bash/commands/structured/limits.js +1 -1
- package/dist/safe-bash/commands/structured/numbers.js +1 -1
- package/dist/safe-bash/commands/structured/parser.js +1 -1
- package/dist/safe-bash/commands/structured/query-core.js +1 -1
- package/dist/safe-bash/commands/structured/recurse.js +1 -1
- package/dist/safe-bash/commands/structured/regex.js +1 -1
- package/dist/safe-bash/commands/structured/split.js +1 -1
- package/dist/safe-bash/commands/structured/splits.js +1 -1
- package/dist/safe-bash/commands/structured/values.js +1 -1
- package/dist/safe-bash/commands/svgo/index.js +1 -1
- package/dist/safe-bash/commands/table-text/internal.js +1 -1
- package/dist/safe-bash/commands/tac/index.js +1 -1
- package/dist/safe-bash/commands/tar/index.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk-inspection.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk-pipes.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk-pretty.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk-quote.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk-reader.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk-retention.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk-runtime.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk-syntax.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk-values.js +1 -1
- package/dist/safe-bash/commands/text-programs/awk.js +1 -1
- package/dist/safe-bash/commands/text-programs/inplace.js +1 -1
- package/dist/safe-bash/commands/text-programs/regex.js +1 -1
- package/dist/safe-bash/commands/text-programs/replacement-buffer.js +1 -1
- package/dist/safe-bash/commands/text-programs/sed.js +1 -1
- package/dist/safe-bash/commands/text-programs/shared.js +1 -1
- package/dist/safe-bash/commands/time-env/calendar.js +1 -1
- package/dist/safe-bash/commands/time-env/format.js +1 -1
- package/dist/safe-bash/commands/time-env/shared.js +1 -1
- package/dist/safe-bash/commands/timeout/index.js +1 -1
- package/dist/safe-bash/commands/touch/index.js +1 -1
- package/dist/safe-bash/commands/touch-target.js +1 -1
- package/dist/safe-bash/commands/touch-times.js +1 -1
- package/dist/safe-bash/commands/tree/index.js +1 -1
- package/dist/safe-bash/commands/tsort/index.js +1 -1
- package/dist/safe-bash/commands/unalias/index.js +1 -1
- package/dist/safe-bash/commands/uname/index.js +1 -1
- package/dist/safe-bash/commands/unexpand/index.js +1 -1
- package/dist/safe-bash/commands/unix2dos/index.js +1 -1
- package/dist/safe-bash/commands/unrtf/index.js +1 -1
- package/dist/safe-bash/commands/unzip/index.js +1 -1
- package/dist/safe-bash/commands/wdiff/index.js +1 -1
- package/dist/safe-bash/commands/wget/index.js +1 -1
- package/dist/safe-bash/commands/which/index.js +1 -1
- package/dist/safe-bash/commands/whoami/index.js +1 -1
- package/dist/safe-bash/commands/wkhtmltopdf/index.js +1 -1
- package/dist/safe-bash/commands/xan/index.js +1 -1
- package/dist/safe-bash/commands/xml/index.js +1 -1
- package/dist/safe-bash/commands/xmllint/index.js +1 -1
- package/dist/safe-bash/commands/xq/index.js +1 -1
- package/dist/safe-bash/commands/xxd/index.js +1 -1
- package/dist/safe-bash/commands/xz/index.js +1 -1
- package/dist/safe-bash/commands/yq/index.js +1 -1
- package/dist/safe-bash/commands/zip/index.js +1 -1
- package/dist/safe-bash/commands/zstd/index.js +1 -1
- package/dist/safe-bash/core.browser.js +2 -2
- package/dist/safe-bash/full-core.browser.js +29 -7
- package/dist/safe-bash/integrations/safejs/filesystem.js +1 -1
- package/dist/safe-bash/integrations/safejs/shell.js +1 -1
- package/dist/safe-bash/integrations/safejs/values.js +1 -1
- package/dist/safe-bash/playwright/abilities.js +1 -1
- package/dist/safe-bash/playwright/ability-execution.js +1 -1
- package/dist/safe-bash/playwright/adapter.js +1 -1
- package/dist/safe-bash/playwright/builtins.js +1 -1
- package/dist/safe-bash/playwright/canonical-locator-parser.js +1 -1
- package/dist/safe-bash/playwright/capability-events.js +1 -1
- package/dist/safe-bash/playwright/capability-result.js +1 -1
- package/dist/safe-bash/playwright/catalog.js +1 -1
- package/dist/safe-bash/playwright/checkpoint.js +1 -1
- package/dist/safe-bash/playwright/command-budget.js +1 -1
- package/dist/safe-bash/playwright/command-reference.js +1 -1
- package/dist/safe-bash/playwright/config-ini.js +1 -1
- package/dist/safe-bash/playwright/config-json.js +1 -1
- package/dist/safe-bash/playwright/controller.js +1 -1
- package/dist/safe-bash/playwright/devices.js +1 -1
- package/dist/safe-bash/playwright/download-capabilities.js +1 -1
- package/dist/safe-bash/playwright/drop-capability.js +1 -1
- package/dist/safe-bash/playwright/find.js +1 -1
- package/dist/safe-bash/playwright/frame-snapshot.js +1 -1
- package/dist/safe-bash/playwright/generated-locator.js +1 -1
- package/dist/safe-bash/playwright/help-reference.js +1 -1
- package/dist/safe-bash/playwright/help.js +1 -1
- package/dist/safe-bash/playwright/highlight.js +1 -1
- package/dist/safe-bash/playwright/index.js +1 -1
- package/dist/safe-bash/playwright/invocation.js +1 -1
- package/dist/safe-bash/playwright/locator-selector.js +1 -1
- package/dist/safe-bash/playwright/modal-capabilities.js +1 -1
- package/dist/safe-bash/playwright/native-evaluation.js +1 -1
- package/dist/safe-bash/playwright/native-json-snapshot.js +1 -1
- package/dist/safe-bash/playwright/native-snapshot.js +1 -1
- package/dist/safe-bash/playwright/native-storage-realm.js +1 -1
- package/dist/safe-bash/playwright/native-storage-replacement.js +1 -1
- package/dist/safe-bash/playwright/native-storage-sources.generated.js +1 -1
- package/dist/safe-bash/playwright/native-storage-targets.js +1 -1
- package/dist/safe-bash/playwright/network-policy.js +1 -1
- package/dist/safe-bash/playwright/open-options.js +1 -1
- package/dist/safe-bash/playwright/private-target-transport.js +1 -1
- package/dist/safe-bash/playwright/profile.js +1 -1
- package/dist/safe-bash/playwright/recording-capabilities.js +1 -1
- package/dist/safe-bash/playwright/recovery.js +1 -1
- package/dist/safe-bash/playwright/resource-limit.js +1 -1
- package/dist/safe-bash/playwright/response.js +1 -1
- package/dist/safe-bash/playwright/route-capabilities.js +1 -1
- package/dist/safe-bash/playwright/route-policy.js +1 -1
- package/dist/safe-bash/playwright/screenshot.js +1 -1
- package/dist/safe-bash/playwright/session-configuration.js +1 -1
- package/dist/safe-bash/playwright/session-runtime.js +1 -1
- package/dist/safe-bash/playwright/session-selection.js +1 -1
- package/dist/safe-bash/playwright/snapshot-reference-error.js +1 -1
- package/dist/safe-bash/playwright/snapshot.js +1 -1
- package/dist/safe-bash/playwright/standard-capabilities.js +1 -1
- package/dist/safe-bash/playwright/storage-capabilities.js +1 -1
- package/dist/safe-bash/playwright/storage-state.js +1 -1
- package/dist/safe-bash/playwright/target-screenshot.js +1 -1
- package/dist/safe-bash/playwright/targets.js +1 -1
- package/dist/safe-bash/playwright/tracing-capabilities.js +1 -1
- package/dist/safe-bash/playwright/webmcp-capabilities.js +1 -1
- package/dist/safe-bash/playwright/webmcp-params.js +1 -1
- package/dist/safe-bash/playwright/workspace-assets.js +1 -1
- package/dist/safe-bash/playwright/workspace.js +1 -1
- package/dist/safe-bash/plugins/index.browser.js +4 -4
- package/dist/safe-bash/registry-entry.browser.js +2 -2
- package/dist/safe-bash/search.browser.js +1 -1
- package/dist/safe-bash/shell/parser.js +2 -1
- package/dist/safe-bash/shell/pattern.js +1 -1
- package/dist/safe-bash/shell/string-operations.js +1 -1
- package/dist/safe-bash/shell-entry.browser.js +2 -2
- package/dist/safe-bash/ts-ast.js +1 -1
- package/dist/safe-bash-checksum-engine/index.js +1 -1
- package/dist/safe-bash-command-audio/index.js +2 -2
- package/dist/safe-bash-command-awk/awk-inspection.js +2 -2
- package/dist/safe-bash-command-awk/awk-runtime.js +2 -2
- package/dist/safe-bash-command-awk/awk-syntax.js +1 -1
- package/dist/safe-bash-command-awk/awk.js +6 -6
- package/dist/safe-bash-command-awk/index.js +6 -6
- package/dist/safe-bash-command-bc/index.js +13 -14
- package/dist/safe-bash-command-cal/index.js +25 -31
- package/dist/safe-bash-command-cp/index.js +3 -3
- package/dist/safe-bash-command-csvgrep/command.d.ts +1 -0
- package/dist/safe-bash-command-csvgrep/index.js +7 -0
- package/dist/safe-bash-command-diff/diff.js +2 -2
- package/dist/safe-bash-command-diff/index.js +2 -2
- package/dist/safe-bash-command-docx/sdk.js +1 -1
- package/dist/safe-bash-command-expr/bre-engine.js +1 -1
- package/dist/safe-bash-command-factor/command.js +2 -2
- package/dist/safe-bash-command-factor/index.js +2 -2
- package/dist/safe-bash-command-fd/index.js +4 -3
- package/dist/safe-bash-command-ffmpeg/index.js +13 -2
- package/dist/safe-bash-command-ffprobe/index.js +2 -2
- package/dist/safe-bash-command-ffprobe/media.js +2 -2
- package/dist/safe-bash-command-getconf/index.js +11 -4
- package/dist/safe-bash-command-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/index.js +96 -14
- package/dist/safe-bash-command-html-to-markdown/index.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/stored-text.d.ts +2 -0
- package/dist/safe-bash-command-html-to-markdown/stored-text.js +1 -1
- package/dist/safe-bash-command-imagemagick/index.js +18 -4
- package/dist/safe-bash-command-jq/index.js +1 -1
- package/dist/safe-bash-command-jq/jq.js +1 -1
- package/dist/safe-bash-command-llm/collections.js +48 -192
- package/dist/safe-bash-command-llm/command.js +14 -6
- package/dist/safe-bash-command-llm/elevenlabs.js +2 -2
- package/dist/safe-bash-command-llm/fragment-loaders.d.ts +29 -0
- package/dist/safe-bash-command-llm/fragments.d.ts +24 -0
- package/dist/safe-bash-command-llm/import-json-document.d.ts +5 -2
- package/dist/safe-bash-command-llm/index.d.ts +7 -0
- package/dist/safe-bash-command-llm/index.js +47 -17
- package/dist/safe-bash-command-llm/input-budget.d.ts +2 -0
- package/dist/safe-bash-command-llm/openai-sse.d.ts +1 -1
- package/dist/safe-bash-command-llm/openai-sse.js +4 -1
- package/dist/safe-bash-command-llm/openai.js +11 -7
- package/dist/safe-bash-command-llm/providers/elevenlabs.js +2 -2
- package/dist/safe-bash-command-llm/providers/index.js +16 -10
- package/dist/safe-bash-command-llm/providers/openai.js +11 -7
- package/dist/safe-bash-command-llm/providers/shared.d.ts +2 -0
- package/dist/safe-bash-command-llm/providers/shared.js +1 -1
- package/dist/safe-bash-command-llm/retained-spool.d.ts +4 -0
- package/dist/safe-bash-command-llm/service.d.ts +3 -1
- package/dist/safe-bash-command-llm/service.js +5 -2
- package/dist/safe-bash-command-llm/tool-chain.d.ts +22 -0
- package/dist/safe-bash-command-llm/tool-execution.d.ts +55 -0
- package/dist/safe-bash-command-llm/tool-registry.d.ts +43 -0
- package/dist/safe-bash-command-llm/types.d.ts +39 -11
- package/dist/safe-bash-command-llm/url-fragment-source.d.ts +6 -0
- package/dist/safe-bash-command-llm/url-source.d.ts +3 -1
- package/dist/safe-bash-command-mcp/index.browser.d.ts +1 -0
- package/dist/safe-bash-command-mcp/index.browser.js +4 -4
- package/dist/safe-bash-command-mcp/index.d.ts +1 -0
- package/dist/safe-bash-command-mcp/index.js +28 -7
- package/dist/safe-bash-command-mdq/index.js +10 -3
- package/dist/safe-bash-command-node/commands/node/browser.js +6 -6
- package/dist/safe-bash-command-node/commands/node/default-runtime.js +6 -6
- package/dist/safe-bash-command-node/commands/node/filesystem.js +2 -2
- package/dist/safe-bash-command-node/commands/node/quickjs.js +1 -1
- package/dist/safe-bash-command-node/commands/node/safejs.js +6 -6
- package/dist/safe-bash-command-node/commands/node/timers.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +9 -9
- package/dist/safe-bash-command-pandoc/index.js +57 -57
- package/dist/safe-bash-command-pandoc/lua-filters.js +1 -1
- package/dist/safe-bash-command-patch/index.js +6 -6
- package/dist/safe-bash-command-patch/patch-formats.js +2 -2
- package/dist/safe-bash-command-patch/patch-publication.js +1 -1
- package/dist/safe-bash-command-patch/patch.js +5 -5
- package/dist/safe-bash-command-patch/unified.js +1 -1
- package/dist/safe-bash-command-pdfinfo/index.js +2 -2
- package/dist/safe-bash-command-pdftk/index.js +550 -137
- package/dist/safe-bash-command-pdftoppm/index.js +89 -124
- package/dist/safe-bash-command-pdftotext/index.d.ts +1 -1
- package/dist/safe-bash-command-pdftotext/index.js +554 -381
- package/dist/safe-bash-command-playwright-cli/index.js +26 -25
- package/dist/safe-bash-command-playwright-cli/playwright/abilities.js +7 -7
- package/dist/safe-bash-command-playwright-cli/playwright/adapter.js +3 -3
- package/dist/safe-bash-command-playwright-cli/playwright/controller.js +16 -15
- package/dist/safe-bash-command-playwright-cli/playwright/index.js +26 -25
- package/dist/safe-bash-command-playwright-cli/playwright/native-storage-replacement.js +2 -2
- package/dist/safe-bash-command-playwright-cli/playwright/open-options.js +2 -2
- package/dist/safe-bash-command-playwright-cli/playwright/profile.d.ts +1 -1
- package/dist/safe-bash-command-playwright-cli/playwright/profile.js +6 -5
- package/dist/safe-bash-command-playwright-cli/playwright/standard-capabilities.js +5 -5
- package/dist/safe-bash-command-playwright-cli/playwright/storage-capabilities.js +3 -3
- package/dist/safe-bash-command-pptx/engine.js +2 -2
- package/dist/safe-bash-command-python/executor.d.ts +1 -0
- package/dist/safe-bash-command-python/executor.js +24 -22
- package/dist/safe-bash-command-python/index.js +24 -22
- package/dist/safe-bash-command-python/jspi.js +2 -2
- package/dist/safe-bash-command-python/llm-capability.js +1 -1
- package/dist/safe-bash-command-python/llm-functions-loader.d.ts +5 -0
- package/dist/safe-bash-command-python/llm-packages.js +51 -2
- package/dist/safe-bash-command-python/llm-provider.js +1 -1
- package/dist/safe-bash-command-rg/glob.d.ts +6 -0
- package/dist/safe-bash-command-rg/glob.js +2 -2
- package/dist/safe-bash-command-rg/index.js +8 -8
- package/dist/safe-bash-command-rg/matcher.d.ts +2 -0
- package/dist/safe-bash-command-rg/matcher.js +2 -2
- package/dist/safe-bash-command-rg/options.d.ts +2 -0
- package/dist/safe-bash-command-rg/options.js +1 -1
- package/dist/safe-bash-command-rg/output.js +3 -3
- package/dist/safe-bash-command-rg/replacement.js +2 -2
- package/dist/safe-bash-command-rg/rg-command.js +8 -8
- package/dist/safe-bash-command-rg/shared.d.ts +0 -2
- package/dist/safe-bash-command-rg/shared.js +2 -4
- package/dist/safe-bash-command-rg/walk.js +4 -4
- package/dist/safe-bash-command-safejs/index.js +5 -5
- package/dist/safe-bash-command-safejs/runtime.js +3 -3
- package/dist/safe-bash-command-soffice/index.js +2 -2
- package/dist/safe-bash-command-sqlite3/engine.d.ts +15 -0
- package/dist/safe-bash-command-sqlite3/index.js +310 -15
- package/dist/safe-bash-command-ssconvert/index.js +13 -13
- package/dist/safe-bash-command-tar/create.js +2 -2
- package/dist/safe-bash-command-tar/extract.js +2 -2
- package/dist/safe-bash-command-tar/index.js +6 -6
- package/dist/safe-bash-command-tar/modes.js +4 -4
- package/dist/safe-bash-command-unzip/index.js +5 -5
- package/dist/safe-bash-command-unzip/unzip.js +2 -2
- package/dist/safe-bash-command-yq/parser.js +1 -1
- package/dist/safe-bash-command-yq/query.js +1 -1
- package/dist/safe-bash-contracts/escaping.js +2 -2
- package/dist/safe-bash-contracts/index.js +15 -15
- package/dist/safe-bash-csv-engine/index.js +5 -3
- package/dist/safe-bash-csv-engine/python-codepages.js +2 -1
- package/dist/safe-bash-csv-engine/python-file-codepages.d.ts +1 -0
- package/dist/safe-bash-csv-engine/python-file-codepages.js +8 -0
- package/dist/safe-bash-csv-engine/python-utf16.js +3 -2
- package/dist/safe-bash-csv-engine/text-decoder.js +5 -3
- package/dist/safe-bash-docx-engine/ancillary-resources.js +10 -10
- package/dist/safe-bash-docx-engine/batch-operations.js +68 -68
- package/dist/safe-bash-docx-engine/batch-result-schema.js +80 -80
- package/dist/safe-bash-docx-engine/batch.js +79 -79
- package/dist/safe-bash-docx-engine/bookmarks.js +18 -18
- package/dist/safe-bash-docx-engine/charts.js +11 -11
- package/dist/safe-bash-docx-engine/command-option-rules.js +5 -5
- package/dist/safe-bash-docx-engine/command-properties.js +3 -3
- package/dist/safe-bash-docx-engine/comments.js +27 -27
- package/dist/safe-bash-docx-engine/control-bindings.js +22 -22
- package/dist/safe-bash-docx-engine/control-repeat.js +21 -21
- package/dist/safe-bash-docx-engine/controls.js +19 -19
- package/dist/safe-bash-docx-engine/create.js +10 -10
- package/dist/safe-bash-docx-engine/diagrams.js +11 -11
- package/dist/safe-bash-docx-engine/diff.js +13 -13
- package/dist/safe-bash-docx-engine/document-properties.js +17 -17
- package/dist/safe-bash-docx-engine/equations.js +18 -18
- package/dist/safe-bash-docx-engine/extract.js +14 -14
- package/dist/safe-bash-docx-engine/fields.js +23 -23
- package/dist/safe-bash-docx-engine/font-inventory.js +18 -18
- package/dist/safe-bash-docx-engine/font-resources.js +5 -5
- package/dist/safe-bash-docx-engine/image-batch-operations.js +13 -13
- package/dist/safe-bash-docx-engine/image-insertion.js +22 -22
- package/dist/safe-bash-docx-engine/image-layout.js +20 -20
- package/dist/safe-bash-docx-engine/image-replacement.js +23 -23
- package/dist/safe-bash-docx-engine/images.js +20 -20
- package/dist/safe-bash-docx-engine/index.js +138 -138
- package/dist/safe-bash-docx-engine/inspection.js +21 -21
- package/dist/safe-bash-docx-engine/invocation.js +8 -8
- package/dist/safe-bash-docx-engine/io.js +8 -8
- package/dist/safe-bash-docx-engine/links.js +21 -21
- package/dist/safe-bash-docx-engine/lists.js +20 -20
- package/dist/safe-bash-docx-engine/locations.js +15 -15
- package/dist/safe-bash-docx-engine/notes.js +22 -22
- package/dist/safe-bash-docx-engine/objects.js +20 -20
- package/dist/safe-bash-docx-engine/operation-json-schema.js +3 -3
- package/dist/safe-bash-docx-engine/operation-schema.js +2 -2
- package/dist/safe-bash-docx-engine/pack.js +14 -14
- package/dist/safe-bash-docx-engine/package-view-batch-operations.js +21 -21
- package/dist/safe-bash-docx-engine/pandoc-adapter.js +29 -29
- package/dist/safe-bash-docx-engine/paragraph-edit.js +26 -26
- package/dist/safe-bash-docx-engine/part-provider.js +3 -3
- package/dist/safe-bash-docx-engine/property-values.js +3 -3
- package/dist/safe-bash-docx-engine/publication.js +8 -8
- package/dist/safe-bash-docx-engine/removal.js +21 -21
- package/dist/safe-bash-docx-engine/revision-decisions.js +23 -23
- package/dist/safe-bash-docx-engine/revision-edit.js +20 -20
- package/dist/safe-bash-docx-engine/revisions.js +18 -18
- package/dist/safe-bash-docx-engine/run-format.js +20 -20
- package/dist/safe-bash-docx-engine/sanitize.js +35 -35
- package/dist/safe-bash-docx-engine/sections.js +19 -19
- package/dist/safe-bash-docx-engine/settings.js +12 -12
- package/dist/safe-bash-docx-engine/shape-edit.js +22 -22
- package/dist/safe-bash-docx-engine/signatures.js +16 -16
- package/dist/safe-bash-docx-engine/stories.js +22 -22
- package/dist/safe-bash-docx-engine/structure-model-batch-operations.js +38 -38
- package/dist/safe-bash-docx-engine/style-model-batch-operations.js +26 -26
- package/dist/safe-bash-docx-engine/style-model-result-schema.js +44 -44
- package/dist/safe-bash-docx-engine/styles.js +18 -18
- package/dist/safe-bash-docx-engine/table-edit.js +28 -28
- package/dist/safe-bash-docx-engine/table-read.js +16 -16
- package/dist/safe-bash-docx-engine/template.js +22 -22
- package/dist/safe-bash-docx-engine/text-replace.js +20 -20
- package/dist/safe-bash-docx-engine/text-resource-read.js +16 -16
- package/dist/safe-bash-docx-engine/text.js +16 -16
- package/dist/safe-bash-docx-engine/validation.js +6 -6
- package/dist/safe-bash-docx-engine/xml-parts.js +23 -23
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +4 -4
- package/dist/safe-bash-line-ending-engine/command.js +4 -4
- package/dist/safe-bash-line-ending-engine/index.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-blocks.js +1 -1
- package/dist/safe-bash-markdown-engine/index.js +3 -3
- package/dist/safe-bash-network-engine/transfer.js +12 -12
- package/dist/safe-bash-pptx-engine/bytes.js +1 -1
- package/dist/safe-bash-pptx-engine/index.js +1 -1
- package/dist/safe-bash-presentation-engine/accessibility.js +33 -31
- package/dist/safe-bash-presentation-engine/animation-editing.js +17 -16
- package/dist/safe-bash-presentation-engine/animations.js +17 -16
- package/dist/safe-bash-presentation-engine/backgrounds.js +18 -17
- package/dist/safe-bash-presentation-engine/bytes.js +4 -4
- package/dist/safe-bash-presentation-engine/chart-editing.js +36 -34
- package/dist/safe-bash-presentation-engine/chart-object-operations.js +26 -25
- package/dist/safe-bash-presentation-engine/charts.js +33 -31
- package/dist/safe-bash-presentation-engine/command-placeholder.js +63 -60
- package/dist/safe-bash-presentation-engine/comments.js +18 -17
- package/dist/safe-bash-presentation-engine/connector-operations.js +34 -32
- package/dist/safe-bash-presentation-engine/connectors.js +31 -29
- package/dist/safe-bash-presentation-engine/content-types.js +5 -5
- package/dist/safe-bash-presentation-engine/creation.js +7 -7
- package/dist/safe-bash-presentation-engine/diff.js +40 -37
- package/dist/safe-bash-presentation-engine/drawing-format.js +21 -20
- package/dist/safe-bash-presentation-engine/drawing-operations.js +33 -31
- package/dist/safe-bash-presentation-engine/drawing-schema.js +22 -21
- package/dist/safe-bash-presentation-engine/equations.js +18 -17
- package/dist/safe-bash-presentation-engine/errors.js +3 -3
- package/dist/safe-bash-presentation-engine/fields.js +18 -17
- package/dist/safe-bash-presentation-engine/font-metrics.js +4 -4
- package/dist/safe-bash-presentation-engine/image-extraction.js +23 -21
- package/dist/safe-bash-presentation-engine/image-formatting.js +35 -33
- package/dist/safe-bash-presentation-engine/image-insertion.js +20 -19
- package/dist/safe-bash-presentation-engine/image-metadata.d.ts +7 -1
- package/dist/safe-bash-presentation-engine/image-metadata.js +5 -3
- package/dist/safe-bash-presentation-engine/image-replacement.js +24 -22
- package/dist/safe-bash-presentation-engine/image-value.js +6 -6
- package/dist/safe-bash-presentation-engine/images.d.ts +1 -0
- package/dist/safe-bash-presentation-engine/images.js +24 -20
- package/dist/safe-bash-presentation-engine/index.js +151 -146
- package/dist/safe-bash-presentation-engine/layouts.js +17 -16
- package/dist/safe-bash-presentation-engine/length.js +4 -4
- package/dist/safe-bash-presentation-engine/links.js +17 -16
- package/dist/safe-bash-presentation-engine/masters.js +16 -15
- package/dist/safe-bash-presentation-engine/media-editing.js +30 -25
- package/dist/safe-bash-presentation-engine/media-extraction.d.ts +4 -0
- package/dist/safe-bash-presentation-engine/media-extraction.js +33 -19
- package/dist/safe-bash-presentation-engine/media.d.ts +2 -0
- package/dist/safe-bash-presentation-engine/media.js +32 -18
- package/dist/safe-bash-presentation-engine/memberships.d.ts +1 -0
- package/dist/safe-bash-presentation-engine/memberships.js +25 -17
- package/dist/safe-bash-presentation-engine/notes.js +20 -18
- package/dist/safe-bash-presentation-engine/ole-enum.js +5 -5
- package/dist/safe-bash-presentation-engine/ole-insertion.js +22 -21
- package/dist/safe-bash-presentation-engine/opaque-objects.d.ts +4 -0
- package/dist/safe-bash-presentation-engine/opaque-objects.js +30 -12
- package/dist/safe-bash-presentation-engine/package-reader.js +6 -6
- package/dist/safe-bash-presentation-engine/package-tools.js +24 -20
- package/dist/safe-bash-presentation-engine/package-uri.js +4 -4
- package/dist/safe-bash-presentation-engine/package-writer.js +5 -5
- package/dist/safe-bash-presentation-engine/presentation-model.js +62 -59
- package/dist/safe-bash-presentation-engine/presentation-settings.d.ts +1 -0
- package/dist/safe-bash-presentation-engine/presentation-settings.js +25 -16
- package/dist/safe-bash-presentation-engine/properties.js +21 -18
- package/dist/safe-bash-presentation-engine/relationships.js +5 -5
- package/dist/safe-bash-presentation-engine/resource-limits.js +2 -2
- package/dist/safe-bash-presentation-engine/retained-extraction-output.d.ts +8 -4
- package/dist/safe-bash-presentation-engine/retained-fonts.d.ts +26 -0
- package/dist/safe-bash-presentation-engine/retained-image-metadata.d.ts +13 -0
- package/dist/safe-bash-presentation-engine/retained-inspection.js +16 -14
- package/dist/safe-bash-presentation-engine/retained-media-extraction.d.ts +21 -0
- package/dist/safe-bash-presentation-engine/retained-media.d.ts +54 -0
- package/dist/safe-bash-presentation-engine/retained-memberships.d.ts +25 -0
- package/dist/safe-bash-presentation-engine/retained-object-extraction.d.ts +22 -0
- package/dist/safe-bash-presentation-engine/retained-objects.d.ts +25 -0
- package/dist/safe-bash-presentation-engine/retained-package.js +6 -6
- package/dist/safe-bash-presentation-engine/retained-presentation-settings.d.ts +25 -0
- package/dist/safe-bash-presentation-engine/retained-shape-geometry.d.ts +20 -0
- package/dist/safe-bash-presentation-engine/retained-text.d.ts +24 -4
- package/dist/safe-bash-presentation-engine/retained-text.js +35 -31
- package/dist/safe-bash-presentation-engine/retained-transitions.d.ts +18 -0
- package/dist/safe-bash-presentation-engine/sanitize.js +22 -19
- package/dist/safe-bash-presentation-engine/selectors.js +11 -11
- package/dist/safe-bash-presentation-engine/shape-groups.js +33 -31
- package/dist/safe-bash-presentation-engine/shape-operations.js +32 -30
- package/dist/safe-bash-presentation-engine/shape-path-operations.js +34 -32
- package/dist/safe-bash-presentation-engine/shape-paths.js +17 -16
- package/dist/safe-bash-presentation-engine/shape-presets.js +4 -4
- package/dist/safe-bash-presentation-engine/shape-selection.js +33 -31
- package/dist/safe-bash-presentation-engine/shape-transforms.d.ts +6 -0
- package/dist/safe-bash-presentation-engine/shape-transforms.js +26 -20
- package/dist/safe-bash-presentation-engine/shapes.js +28 -27
- package/dist/safe-bash-presentation-engine/slide-copy.js +21 -17
- package/dist/safe-bash-presentation-engine/slide-import.js +19 -18
- package/dist/safe-bash-presentation-engine/slide-merge-split.js +21 -20
- package/dist/safe-bash-presentation-engine/slide-model.js +46 -44
- package/dist/safe-bash-presentation-engine/slide-removal.js +19 -18
- package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +10 -10
- package/dist/safe-bash-presentation-engine/slides.js +21 -19
- package/dist/safe-bash-presentation-engine/table-operations.js +35 -33
- package/dist/safe-bash-presentation-engine/table-spans.js +34 -32
- package/dist/safe-bash-presentation-engine/tables.js +33 -31
- package/dist/safe-bash-presentation-engine/tags.js +20 -18
- package/dist/safe-bash-presentation-engine/template-bindings.js +36 -34
- package/dist/safe-bash-presentation-engine/template-repeat.js +46 -41
- package/dist/safe-bash-presentation-engine/text-fitting.js +28 -27
- package/dist/safe-bash-presentation-engine/text-frames.js +28 -27
- package/dist/safe-bash-presentation-engine/text-paragraphs.js +28 -27
- package/dist/safe-bash-presentation-engine/text-reading.js +12 -12
- package/dist/safe-bash-presentation-engine/text-replacement.js +18 -17
- package/dist/safe-bash-presentation-engine/text-runs.js +21 -20
- package/dist/safe-bash-presentation-engine/themes.js +17 -16
- package/dist/safe-bash-presentation-engine/transitions.d.ts +1 -0
- package/dist/safe-bash-presentation-engine/transitions.js +24 -16
- package/dist/safe-bash-presentation-engine/validation.js +11 -10
- package/dist/safe-bash-presentation-engine/xml-parts.js +21 -19
- package/dist/safe-bash-presentation-engine/xml-view.js +4 -4
- package/dist/safe-bash-presentation-engine/xml.js +4 -4
- package/dist/safe-bash-query-engine/capture.js +5 -5
- package/dist/safe-bash-query-engine/dates.js +2 -2
- package/dist/safe-bash-query-engine/delpaths.js +5 -5
- package/dist/safe-bash-query-engine/formats.js +3 -3
- package/dist/safe-bash-query-engine/index.js +15 -15
- package/dist/safe-bash-query-engine/indices.js +5 -5
- package/dist/safe-bash-query-engine/input.js +2 -2
- package/dist/safe-bash-query-engine/interpreter.d.ts +2 -1
- package/dist/safe-bash-query-engine/interpreter.js +13 -13
- package/dist/safe-bash-query-engine/limits.d.ts +1 -0
- package/dist/safe-bash-query-engine/limits.js +1 -1
- package/dist/safe-bash-query-engine/parser.js +2 -2
- package/dist/safe-bash-query-engine/query-core.js +15 -15
- package/dist/safe-bash-query-engine/recurse.js +2 -2
- package/dist/safe-bash-query-engine/regex.js +6 -6
- package/dist/safe-bash-query-engine/split.js +2 -2
- package/dist/safe-bash-query-engine/splits.js +7 -7
- package/dist/safe-bash-query-engine/values.js +4 -4
- package/dist/safe-bash-regex-engine/ere/matcher.d.ts +1 -1
- package/dist/safe-bash-regex-engine/ere/matcher.js +18 -10
- package/dist/safe-bash-regex-engine/ere/syntax.d.ts +1 -1
- package/dist/safe-bash-regex-engine/ere/syntax.js +1 -1
- package/dist/safe-bash-regex-engine/ere/types.d.ts +1 -0
- package/dist/safe-bash-regex-engine/execution/bounded-provider.js +5 -6
- package/dist/safe-bash-search-engine/ergonomic-regex.d.ts +1 -0
- package/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
- package/dist/safe-bash-sqlite-engine/sqlite-read-session.d.ts +17 -0
- package/dist/safe-bash-sqlite-engine/storage.d.ts +1 -0
- package/dist/safe-bash-sqlite-engine/storage.js +159 -89
- package/dist/safe-bash-xml-engine/document.js +3 -3
- package/dist/safe-bash-xml-engine/evaluate.js +1 -1
- package/dist/safe-bash-xml-engine/index.js +4 -4
- package/dist/safe-bash-xml-engine/json.js +14 -7
- package/dist/safe-bash-xml-engine/query.js +2 -2
- package/dist/safe-bash-xml-engine/recovery.d.ts +13 -3
- package/dist/safe-bash-xml-engine/stored-document.d.ts +18 -3
- package/dist/safe-bash-xml-engine/stored-document.js +1 -1
- package/dist/safe-bash-xml-engine/stored-evaluate.js +5 -5
- package/dist/safe-bash-xml-engine/stored-map.d.ts +35 -0
- package/dist/safe-bash-zip-engine/index.js +3 -3
- package/dist/safe-bash-zip-engine/zip/repair.js +3 -3
- package/dist/safe-bash-zip-engine/zip/sfx.js +3 -3
- package/dist/safe-bash-zip-engine/zip-format.js +3 -3
- package/dist/safe-playwright-cloudflare/browser-provider.generated.js +11819 -11773
- package/dist/safe-playwright-cloudflare/browser-run-code-guest.generated.js +1 -1
- package/dist/spreadsheet-engine/formatting/cell-text.js +1 -1
- package/dist/spreadsheet-engine/{rendering/print → formatting}/general-number.js +3 -3
- package/dist/spreadsheet-engine/formulas/functions/python-printf.js +16 -10
- package/dist/spreadsheet-engine/solver/program.js +3 -2
- package/dist/spreadsheet-engine/solver/run.js +8 -2
- package/dist/spreadsheet-engine/solver/sensitivity.d.ts +4 -2
- package/dist/spreadsheet-engine/solver/sensitivity.js +80 -42
- package/dist/spreadsheet-format-xls/biff-properties-merge.d.ts +2 -1
- package/dist/spreadsheet-format-xls/biff-properties-merge.js +35 -29
- package/dist/spreadsheet-format-xls/biff-properties-write.js +16 -7
- package/dist/spreadsheet-format-xls/biff-property-names.d.ts +3 -0
- package/dist/spreadsheet-format-xls/biff-property-names.js +44 -1
- package/dist/spreadsheet-format-xls/biff-property-observations.d.ts +33 -0
- package/dist/spreadsheet-format-xls/biff-property-observations.js +160 -0
- package/package.json +8 -5
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +15 -0
- package/third-party/pdf-ast/licenses/PYTHON-PSF.txt +254 -0
- package/third-party/pdf-ast/licenses/V8-BSD.txt +61 -0
- package/dist/safe-bash/chunks/chunk-FL6XE3W4.js +0 -35
- package/dist/safe-bash/command-chunks/biff-KLS4T7FP-UO3CXFFF.js +0 -5581
- package/dist/safe-bash/command-chunks/chunk-6EZWG56T.js +0 -455
- package/dist/safe-bash/command-chunks/chunk-6RLWPB44.js +0 -107
- package/dist/safe-bash/command-chunks/chunk-CGJ7GMHO.js +0 -297
- package/dist/safe-bash/command-chunks/chunk-E64ZI2YB.js +0 -550
- package/dist/safe-bash/command-chunks/chunk-IOXMGD2H.js +0 -260
- package/dist/safe-bash/command-chunks/chunk-KSM5CCHT.js +0 -1850
- package/dist/safe-bash/command-chunks/chunk-P4OWVKMD.js +0 -228
- package/dist/safe-bash/command-chunks/chunk-UPXFSGQG.js +0 -134
- package/dist/safe-bash/command-chunks/chunk-WKUV62RJ.js +0 -92
- package/dist/safe-bash/command-chunks/chunk-WOL3LBXE.js +0 -144
- package/dist/safe-bash/command-chunks/chunk-Z3PGWMSQ.js +0 -63
- package/dist/safe-bash/command-chunks/model-store-I7YAWL5V.js +0 -54
- package/dist/safe-bash/command-chunks/paradox-4FCZE53D-LQPGVMEL.js +0 -365
- package/dist/safe-bash-xml-engine/stored-namespaces.d.ts +0 -21
- package/dist/safe-bash/command-chunks/{chunk-WKU65Z3Q.js → chunk-3NJETNC2.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-SRXARACJ.js → chunk-3TP4SSPS.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-AV6N7DDA.js → chunk-DDYPQAXN.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-FEKECRJP.js → chunk-EBTKM7KX.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-M3OXQXCU.js → chunk-NBRXQUK7.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-WVD5WZXD.js → chunk-QWHBQBPB.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-5MFRN3CB.js → chunk-R64BI5MT.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-2ANW3FXH.js → chunk-U33GIOUY.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-OEKLEUUW.js → chunk-YZE7BKHC.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-WXW665TV.js → chunk-ZSHXZ3XG.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-RXXNLH7A.js → chunk-ZSQCROFE.js} +3 -3
- package/dist/safe-bash/command-chunks/{dif-BXKPQOCO-4KB3RC6G.js → dif-BXKPQOCO-FVJYYGYB.js} +4 -4
- package/dist/safe-bash/command-chunks/{pln-DFS7VLVS-OVOBS4QX.js → pln-DFS7VLVS-JATX6FS7.js} +3 -3
- package/dist/safe-bash/command-chunks/{psion-YBI6JEQI-GY4S6ZLC.js → psion-YBI6JEQI-6OMC2PGC.js} +3 -3
- package/dist/safe-bash/command-chunks/{sylk-25D7TL2Y-RU6ANKGT.js → sylk-25D7TL2Y-NJKBZZTF.js} +4 -4
- /package/dist/spreadsheet-engine/{rendering/print → formatting}/general-number.d.ts +0 -0
|
@@ -1,1850 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createLlmService,
|
|
3
|
-
validateModelOptions
|
|
4
|
-
} from "./chunk-7ITPO2V6.js";
|
|
5
|
-
import {
|
|
6
|
-
createLlmConfiguration,
|
|
7
|
-
createLlmSpool,
|
|
8
|
-
embeddingCommand,
|
|
9
|
-
fileSource,
|
|
10
|
-
publishConfiguration
|
|
11
|
-
} from "./chunk-7YDJ7LDO.js";
|
|
12
|
-
import {
|
|
13
|
-
attachmentBytesId,
|
|
14
|
-
getLlmAttachmentUrlId
|
|
15
|
-
} from "./chunk-2ZWRW6UQ.js";
|
|
16
|
-
import {
|
|
17
|
-
resolveUrlAttachment,
|
|
18
|
-
validateAttachmentUrl
|
|
19
|
-
} from "./chunk-OTEHQQU7.js";
|
|
20
|
-
import {
|
|
21
|
-
jsonValue,
|
|
22
|
-
waitForSource
|
|
23
|
-
} from "./chunk-UVZJAV2S.js";
|
|
24
|
-
import {
|
|
25
|
-
acceptsMimeType,
|
|
26
|
-
sniffMimeType
|
|
27
|
-
} from "./chunk-VMA3NJXU.js";
|
|
28
|
-
|
|
29
|
-
// packages/safe-bash-command-llm/src/url-source.ts
|
|
30
|
-
import { FsError } from "../../safe-bash-contracts/index.js";
|
|
31
|
-
import { inheritYieldCheckpoint, yieldTurn } from "../../safe-bash-contracts/yield.js";
|
|
32
|
-
function createLlmUrlSource(options) {
|
|
33
|
-
validateAttachmentUrl(options.url);
|
|
34
|
-
const limit = options.maxBytes ?? Infinity;
|
|
35
|
-
if (limit !== Infinity && (!Number.isSafeInteger(limit) || limit < 0)) throw new RangeError("Invalid URL input byte limit");
|
|
36
|
-
if (typeof options.fetch !== "function") throw new TypeError("Attachment URL loading is not configured");
|
|
37
|
-
options.signal.throwIfAborted();
|
|
38
|
-
const controller = new AbortController();
|
|
39
|
-
const signal = AbortSignal.any([options.signal, controller.signal]);
|
|
40
|
-
inheritYieldCheckpoint(options.signal, signal);
|
|
41
|
-
let response;
|
|
42
|
-
let reader;
|
|
43
|
-
let closed = false, consumed = false;
|
|
44
|
-
let cancellation;
|
|
45
|
-
const cancel = () => {
|
|
46
|
-
if (!response) return Promise.resolve();
|
|
47
|
-
return cancellation ??= Promise.resolve().then(() => reader ? reader.cancel() : response.body?.cancel());
|
|
48
|
-
};
|
|
49
|
-
const abort = () => {
|
|
50
|
-
void cancel().catch(() => void 0);
|
|
51
|
-
};
|
|
52
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
53
|
-
const dispose = async () => {
|
|
54
|
-
closed = true;
|
|
55
|
-
controller.abort(new FsError("EBADF", { message: "LLM URL input is closed" }));
|
|
56
|
-
signal.removeEventListener("abort", abort);
|
|
57
|
-
const cleanup = cancel();
|
|
58
|
-
if (options.signal.aborted) void cleanup.catch(() => void 0);
|
|
59
|
-
else await cleanup;
|
|
60
|
-
};
|
|
61
|
-
return { dispose, bytes: { async *[Symbol.asyncIterator]() {
|
|
62
|
-
if (closed || consumed) throw new FsError("EBADF", { message: "LLM URL input is closed or consumed" });
|
|
63
|
-
consumed = true;
|
|
64
|
-
let failed = false, size = 0, windows = 0;
|
|
65
|
-
try {
|
|
66
|
-
signal.throwIfAborted();
|
|
67
|
-
await waitForSource(() => options.fetch(options.url, { method: "GET", redirect: "manual", signal }).then((value) => {
|
|
68
|
-
response = value;
|
|
69
|
-
if (closed || signal.aborted) void cancel().catch(() => void 0);
|
|
70
|
-
return value;
|
|
71
|
-
}), signal);
|
|
72
|
-
signal.throwIfAborted();
|
|
73
|
-
if (!response.ok) throw new Error(`Attachment URL returned HTTP ${response.status}`);
|
|
74
|
-
if (!response.body) return;
|
|
75
|
-
reader = response.body.getReader();
|
|
76
|
-
while (true) {
|
|
77
|
-
const next = await waitForSource(() => reader.read(), signal);
|
|
78
|
-
if (next.done) return;
|
|
79
|
-
if (!(next.value instanceof Uint8Array)) throw new TypeError("Attachment URL must return byte chunks");
|
|
80
|
-
if (next.value.length > limit - size) throw new FsError("EFBIG", { message: "Attachment URL input byte limit exceeded" });
|
|
81
|
-
options.admitBytes?.(next.value.length);
|
|
82
|
-
size += next.value.length;
|
|
83
|
-
if (!next.value.length && ++windows % 64 === 0) await yieldTurn(signal);
|
|
84
|
-
for (let offset = 0; offset < next.value.length; offset += 16384) {
|
|
85
|
-
if (++windows % 64 === 0) await yieldTurn(signal);
|
|
86
|
-
signal.throwIfAborted();
|
|
87
|
-
yield next.value.slice(offset, offset + 16384);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
} catch (error) {
|
|
91
|
-
failed = true;
|
|
92
|
-
throw signal.aborted ? signal.reason : error;
|
|
93
|
-
} finally {
|
|
94
|
-
await dispose().catch((error) => {
|
|
95
|
-
if (!failed) throw error;
|
|
96
|
-
});
|
|
97
|
-
reader?.releaseLock();
|
|
98
|
-
}
|
|
99
|
-
} } };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// packages/safe-bash-command-llm/src/embed-models-command.ts
|
|
103
|
-
var groupHelp = "Usage: llm embed-models [OPTIONS] COMMAND [ARGS]...\n\n Manage available embedding models\n\nOptions:\n -h, --help Show this message and exit.\n\nCommands:\n list* List available embedding models\n default Show or set the default embedding model\n";
|
|
104
|
-
async function embeddingModelsCommand(context, service, tokens, emit, diagnostic, step, maxConfigurationBytes = Infinity) {
|
|
105
|
-
if (tokens[0] === "--" && ["list", "default"].includes(tokens[1] ?? "")) tokens = tokens.slice(1);
|
|
106
|
-
const defaults = tokens[0] === "default", explicit = tokens[0] === "list" || defaults;
|
|
107
|
-
const command = defaults ? "default" : "list";
|
|
108
|
-
const usage = `Usage: llm embed-models ${command} [OPTIONS]${defaults ? " [MODEL]" : ""}
|
|
109
|
-
`;
|
|
110
|
-
const fail = async (message, withUsage = true) => {
|
|
111
|
-
await diagnostic((withUsage ? usage + `Try 'llm embed-models ${command} -h' for help.
|
|
112
|
-
|
|
113
|
-
` : "") + `Error: ${message}
|
|
114
|
-
`);
|
|
115
|
-
return 2;
|
|
116
|
-
};
|
|
117
|
-
const terminator = tokens.indexOf("--");
|
|
118
|
-
const groupFlags = terminator < 0 ? tokens : tokens.slice(0, terminator);
|
|
119
|
-
if (!explicit && groupFlags.some((token) => token === "--help" || token.startsWith("-") && !token.startsWith("--") && token.slice(1).includes("h"))) {
|
|
120
|
-
await emit(groupHelp);
|
|
121
|
-
return 0;
|
|
122
|
-
}
|
|
123
|
-
const args = explicit ? tokens.slice(1) : tokens.filter((_, index) => index !== terminator);
|
|
124
|
-
const queries = [], operands = [];
|
|
125
|
-
let ended = false, help = false, remove = false;
|
|
126
|
-
for (let index = 0; index < args.length; index++) {
|
|
127
|
-
await step();
|
|
128
|
-
const token = args[index];
|
|
129
|
-
if (!ended && token === "--") {
|
|
130
|
-
ended = true;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
if (ended || !token.startsWith("-") || token === "-") {
|
|
134
|
-
operands.push(token);
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (token === "--help" || token === "-h") {
|
|
138
|
-
help = true;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (defaults && token === "--remove-default") {
|
|
142
|
-
remove = true;
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
if (!token.startsWith("--")) {
|
|
146
|
-
for (let cursor = 1; cursor < token.length; cursor++) {
|
|
147
|
-
const flag2 = "-" + token[cursor];
|
|
148
|
-
if (flag2 === "-h") {
|
|
149
|
-
help = true;
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
if (defaults || flag2 !== "-q") return fail(`No such option: ${flag2}`);
|
|
153
|
-
const value2 = token.slice(cursor + 1) || args[++index];
|
|
154
|
-
if (value2 === void 0) return fail(`Option '${flag2}' requires an argument.`, false);
|
|
155
|
-
queries.push(value2.toLowerCase());
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
const equals = token.indexOf("=");
|
|
161
|
-
const flag = token.slice(0, equals < 0 ? void 0 : equals);
|
|
162
|
-
if (equals >= 0 && (flag === "--help" || defaults && flag === "--remove-default")) return fail(`Option '${flag}' does not take a value.`, false);
|
|
163
|
-
if (defaults || flag !== "--query") return fail(`No such option: ${flag}`);
|
|
164
|
-
const attached = equals < 0 ? void 0 : token.slice(equals + 1);
|
|
165
|
-
const value = attached ?? args[++index];
|
|
166
|
-
if (value === void 0) return fail(`Option '${flag}' requires an argument.`, false);
|
|
167
|
-
queries.push(value.toLowerCase());
|
|
168
|
-
}
|
|
169
|
-
if (help) {
|
|
170
|
-
await emit(usage + (defaults ? "\n Show or set the default embedding model\n\nOptions:\n --remove-default Reset to specifying no default model\n -h, --help Show this message and exit.\n" : "\n List available embedding models\n\nOptions:\n -q, --query TEXT Search for embedding models matching these strings\n -h, --help Show this message and exit.\n"));
|
|
171
|
-
return 0;
|
|
172
|
-
}
|
|
173
|
-
const extra = operands.slice(defaults ? 1 : 0);
|
|
174
|
-
if (extra.length) return fail(`Got unexpected extra argument${extra.length === 1 ? "" : "s"} (${extra.join(" ")})`);
|
|
175
|
-
const configuration = createLlmConfiguration(context, maxConfigurationBytes);
|
|
176
|
-
if (defaults) {
|
|
177
|
-
const selected = operands[0];
|
|
178
|
-
if (!selected && !remove) {
|
|
179
|
-
const model = await configuration.defaultModel("default_embedding_model.txt");
|
|
180
|
-
if (model === void 0) await diagnostic("<No default embedding model set>\n");
|
|
181
|
-
else await emit(model + "\n");
|
|
182
|
-
} else if (remove) await configuration.setDefaultModel(null, "default_embedding_model.txt");
|
|
183
|
-
else {
|
|
184
|
-
const resolved = await configuration.resolveAlias(selected);
|
|
185
|
-
let entry;
|
|
186
|
-
try {
|
|
187
|
-
entry = service.resolve(resolved);
|
|
188
|
-
} catch {
|
|
189
|
-
}
|
|
190
|
-
if (!entry?.model.capabilities?.includes("embed") || !entry.provider.embed && !entry.provider.embedSources) {
|
|
191
|
-
await diagnostic(`Error: Unknown embedding model: ${selected}
|
|
192
|
-
`);
|
|
193
|
-
return 1;
|
|
194
|
-
}
|
|
195
|
-
await configuration.setDefaultModel(entry.model.id, "default_embedding_model.txt");
|
|
196
|
-
}
|
|
197
|
-
return 0;
|
|
198
|
-
}
|
|
199
|
-
const configured = await configuration.aliases();
|
|
200
|
-
let emitted = false;
|
|
201
|
-
for (const entry of service.models) {
|
|
202
|
-
await step();
|
|
203
|
-
if (!entry.model.capabilities?.includes("embed") || !entry.provider.embed && !entry.provider.embedSources) continue;
|
|
204
|
-
const aliases = [...entry.model.aliases ?? []];
|
|
205
|
-
for (const [alias, target] of Object.entries(configured)) {
|
|
206
|
-
await step();
|
|
207
|
-
if (target === entry.model.id) aliases.push(alias);
|
|
208
|
-
}
|
|
209
|
-
const description = `${entry.provider.name}: ${entry.model.id}`;
|
|
210
|
-
const terms = [description, ...aliases].map((value) => value.toLowerCase());
|
|
211
|
-
if (!queries.every((query) => terms.some((term) => term.includes(query)))) continue;
|
|
212
|
-
await emit(description + (aliases.length ? ` (aliases: ${aliases.join(", ")})` : "") + "\n");
|
|
213
|
-
emitted = true;
|
|
214
|
-
}
|
|
215
|
-
if (!emitted) await emit("\n");
|
|
216
|
-
return 0;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// packages/safe-bash-command-llm/src/usage.ts
|
|
220
|
-
async function* serializeLlmTokenUsage(usage, signal) {
|
|
221
|
-
signal.throwIfAborted();
|
|
222
|
-
const encoder = new TextEncoder();
|
|
223
|
-
let separator = "";
|
|
224
|
-
for (const name of ["input", "output"]) {
|
|
225
|
-
const value = usage?.[name];
|
|
226
|
-
if (value === void 0 || value === null) continue;
|
|
227
|
-
if (typeof value !== "number" || !Number.isFinite(value)) throw new TypeError(`Invalid LLM ${name} token count`);
|
|
228
|
-
yield encoder.encode(`${separator}${value.toLocaleString("en-US", { maximumFractionDigits: 20 })} ${name}`);
|
|
229
|
-
separator = ", ";
|
|
230
|
-
}
|
|
231
|
-
const details = usage?.details;
|
|
232
|
-
if (!details || typeof details !== "object") return;
|
|
233
|
-
let nonempty = false;
|
|
234
|
-
for (const key in details) if (Object.hasOwn(details, key)) {
|
|
235
|
-
nonempty = true;
|
|
236
|
-
break;
|
|
237
|
-
}
|
|
238
|
-
if (!nonempty) return;
|
|
239
|
-
yield encoder.encode(separator);
|
|
240
|
-
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
241
|
-
let formatted = "", quoted = false, escaped = false;
|
|
242
|
-
for await (const bytes of jsonValue(details, signal)) {
|
|
243
|
-
const json = decoder.decode(bytes, { stream: true });
|
|
244
|
-
for (let index = 0; index < json.length; index++) {
|
|
245
|
-
const character = json[index];
|
|
246
|
-
const code = json.charCodeAt(index);
|
|
247
|
-
if (code >= 127) formatted += "\\u" + code.toString(16).padStart(4, "0");
|
|
248
|
-
else {
|
|
249
|
-
formatted += character;
|
|
250
|
-
if (!quoted && (character === "," || character === ":")) formatted += " ";
|
|
251
|
-
}
|
|
252
|
-
if (escaped) escaped = false;
|
|
253
|
-
else if (character === "\\") escaped = true;
|
|
254
|
-
else if (character === '"') quoted = !quoted;
|
|
255
|
-
if (formatted.length >= 4096) {
|
|
256
|
-
signal.throwIfAborted();
|
|
257
|
-
yield encoder.encode(formatted);
|
|
258
|
-
formatted = "";
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
decoder.decode();
|
|
263
|
-
signal.throwIfAborted();
|
|
264
|
-
if (formatted) yield encoder.encode(formatted);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// packages/safe-bash-command-llm/src/input-budget.ts
|
|
268
|
-
import { FsError as FsError2, shellValueByteLength } from "../../safe-bash-contracts/index.js";
|
|
269
|
-
function createLlmInputBudget(limits = {}, parent) {
|
|
270
|
-
for (const [name, value] of Object.entries({ maxInputBytes: limits.maxInputBytes, maxBufferedInputBytes: limits.maxBufferedInputBytes })) {
|
|
271
|
-
if (value !== void 0 && value !== Infinity && (!Number.isSafeInteger(value) || value < 0)) throw new RangeError(`Invalid LLM input limit: ${name}`);
|
|
272
|
-
}
|
|
273
|
-
const totalLimit = Math.min(limits.maxInputBytes ?? Infinity, parent?.maxBytes ?? Infinity);
|
|
274
|
-
const bufferedLimit = limits.maxBufferedInputBytes ?? Infinity;
|
|
275
|
-
let total = 0, buffered = 0;
|
|
276
|
-
const check = (size, materialized = false) => {
|
|
277
|
-
if (!Number.isSafeInteger(size) || size < 0) throw new RangeError("Invalid LLM input size");
|
|
278
|
-
if (materialized && size > bufferedLimit - buffered) throw new FsError2("EFBIG", { message: "llm buffered input byte limit exceeded" });
|
|
279
|
-
if (size > totalLimit - total) throw new FsError2("EFBIG", { message: "llm input byte limit exceeded" });
|
|
280
|
-
parent?.check(total + size);
|
|
281
|
-
};
|
|
282
|
-
return {
|
|
283
|
-
check,
|
|
284
|
-
get totalBytes() {
|
|
285
|
-
return total;
|
|
286
|
-
},
|
|
287
|
-
remaining(materialized = false) {
|
|
288
|
-
return Math.min(totalLimit - total, materialized ? bufferedLimit - buffered : Infinity);
|
|
289
|
-
},
|
|
290
|
-
admit(size, materialized = false) {
|
|
291
|
-
check(size, materialized);
|
|
292
|
-
total += size;
|
|
293
|
-
if (materialized) buffered += size;
|
|
294
|
-
},
|
|
295
|
-
admitText(text) {
|
|
296
|
-
const size = shellValueByteLength(text);
|
|
297
|
-
check(size, true);
|
|
298
|
-
total += size;
|
|
299
|
-
buffered += size;
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// packages/safe-bash-command-llm/src/command.ts
|
|
305
|
-
import { pipeBytes, createOutputOperation, getCommandArguments, shellValueByteLength as shellValueByteLength2, FsError as FsError5 } from "../../safe-bash-contracts/index.js";
|
|
306
|
-
import { inheritYieldCheckpoint as inheritYieldCheckpoint2, yieldTurn as yieldTurn4 } from "../../safe-bash-contracts/yield.js";
|
|
307
|
-
import { writeDiagnostic } from "../../safe-bash-contracts/escaping.js";
|
|
308
|
-
import { pathOf as pathOf3 } from "../../safe-bash-contracts/path.js";
|
|
309
|
-
|
|
310
|
-
// packages/safe-bash-command-llm/src/templates.ts
|
|
311
|
-
import { FsError as FsError3 } from "../../safe-bash-contracts/index.js";
|
|
312
|
-
import { pathOf } from "../../safe-bash-contracts/path.js";
|
|
313
|
-
function unicodeOrder(left, right) {
|
|
314
|
-
let a = 0, b = 0;
|
|
315
|
-
while (a < left.length && b < right.length) {
|
|
316
|
-
const x = left.codePointAt(a), y = right.codePointAt(b);
|
|
317
|
-
if (x !== y) return x - y;
|
|
318
|
-
a += x > 65535 ? 2 : 1;
|
|
319
|
-
b += y > 65535 ? 2 : 1;
|
|
320
|
-
}
|
|
321
|
-
return (a < left.length ? 1 : 0) - (b < right.length ? 1 : 0);
|
|
322
|
-
}
|
|
323
|
-
var templateFields = ["name", "prompt", "system", "model", "defaults", "options", "attachments", "attachment_types", "extract", "extract_last", "schema_object", "fragments", "system_fragments", "tools", "functions"];
|
|
324
|
-
function template(value, name) {
|
|
325
|
-
if (typeof value === "string") return { name, prompt: value };
|
|
326
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`Invalid template: ${name}`);
|
|
327
|
-
const fields = { ...value, name };
|
|
328
|
-
for (const [key, item] of Object.entries(fields)) {
|
|
329
|
-
if (!templateFields.includes(key)) throw new Error(`Unsupported template field: ${key}`);
|
|
330
|
-
if (item === null) {
|
|
331
|
-
delete fields[key];
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
|
-
if (["attachments", "fragments", "system_fragments", "tools"].includes(key)) {
|
|
335
|
-
if (!Array.isArray(item) || item.some((value2) => typeof value2 !== "string")) throw new Error(`Invalid template: ${name}`);
|
|
336
|
-
} else if (key === "attachment_types") {
|
|
337
|
-
if (!Array.isArray(item) || item.some((value2) => !value2 || typeof value2 !== "object" || Array.isArray(value2) || typeof value2.type !== "string" || typeof value2.value !== "string")) throw new Error(`Invalid template: ${name}`);
|
|
338
|
-
fields[key] = item.map(({ type, value: value2 }) => ({ type, value: value2 }));
|
|
339
|
-
} else if (["defaults", "options"].includes(key)) {
|
|
340
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) throw new Error(`Invalid template: ${name}`);
|
|
341
|
-
} else if (key === "schema_object") {
|
|
342
|
-
if (typeof item !== "object" || Array.isArray(item)) throw new Error(`Invalid template: ${name}`);
|
|
343
|
-
} else if (["extract", "extract_last"].includes(key)) {
|
|
344
|
-
if (typeof item !== "boolean") throw new Error(`Invalid template: ${name}`);
|
|
345
|
-
} else if (typeof item !== "string") throw new Error(`Invalid template: ${name}`);
|
|
346
|
-
}
|
|
347
|
-
return { ...fields, name };
|
|
348
|
-
}
|
|
349
|
-
function interpolate(text, params, validateOnly = false, admitText) {
|
|
350
|
-
if (!text) return text;
|
|
351
|
-
let result = "";
|
|
352
|
-
const append = (value) => {
|
|
353
|
-
if (!validateOnly) {
|
|
354
|
-
admitText?.(value);
|
|
355
|
-
result += value;
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
const missing = [];
|
|
359
|
-
for (let index = 0; index < text.length; index++) {
|
|
360
|
-
if (text[index] !== "$") {
|
|
361
|
-
const point = text.codePointAt(index);
|
|
362
|
-
const literal = String.fromCodePoint(point);
|
|
363
|
-
append(literal);
|
|
364
|
-
if (point > 65535) index++;
|
|
365
|
-
continue;
|
|
366
|
-
}
|
|
367
|
-
if (text[index + 1] === "$") {
|
|
368
|
-
append("$");
|
|
369
|
-
index++;
|
|
370
|
-
continue;
|
|
371
|
-
}
|
|
372
|
-
const start = index, braced = text[index + 1] === "{";
|
|
373
|
-
if (braced) index++;
|
|
374
|
-
let name = "";
|
|
375
|
-
while (index + 1 < text.length && "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".includes(text[index + 1])) name += text[++index];
|
|
376
|
-
if (!name || "0123456789".includes(name[0]) || braced && text[index + 1] !== "}") throw new Error(`Invalid placeholder in template at position ${start}`);
|
|
377
|
-
if (braced) index++;
|
|
378
|
-
if (!Object.hasOwn(params, name)) {
|
|
379
|
-
if (!missing.includes(name)) missing.push(name);
|
|
380
|
-
} else if (!validateOnly) append(String(params[name]));
|
|
381
|
-
}
|
|
382
|
-
if (missing.length) throw new Error(`Missing variables: ${missing.join(", ")}`);
|
|
383
|
-
return result;
|
|
384
|
-
}
|
|
385
|
-
function validateLlmTemplateParameters(value, params) {
|
|
386
|
-
const variables = { ...value.defaults, ...params, input: "" };
|
|
387
|
-
for (const text of [value.prompt, value.system]) interpolate(text, variables, true);
|
|
388
|
-
}
|
|
389
|
-
function llmTemplateUsesInput(value) {
|
|
390
|
-
for (const text of [value.prompt, value.system]) {
|
|
391
|
-
if (!text) continue;
|
|
392
|
-
for (let index = 0; index < text.length; index++) {
|
|
393
|
-
if (text[index] !== "$") continue;
|
|
394
|
-
if (text[index + 1] === "$") {
|
|
395
|
-
index++;
|
|
396
|
-
continue;
|
|
397
|
-
}
|
|
398
|
-
let name = "";
|
|
399
|
-
while (index + 1 < text.length && "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".includes(text[index + 1])) name += text[++index];
|
|
400
|
-
if (name === "input") return true;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
return false;
|
|
404
|
-
}
|
|
405
|
-
function evaluateLlmTemplate(value, input, params, admitText) {
|
|
406
|
-
const variables = { ...value.defaults, ...params, input };
|
|
407
|
-
if (!value.prompt) admitText?.(input);
|
|
408
|
-
return { prompt: value.prompt ? interpolate(value.prompt, variables, false, admitText) : input, ...value.system === void 0 ? {} : { system: interpolate(value.system, variables, false, admitText) } };
|
|
409
|
-
}
|
|
410
|
-
function abortLoader(start, signal, late) {
|
|
411
|
-
signal.throwIfAborted();
|
|
412
|
-
return new Promise((resolve, reject) => {
|
|
413
|
-
const abort = () => {
|
|
414
|
-
signal.removeEventListener("abort", abort);
|
|
415
|
-
reject(signal.reason);
|
|
416
|
-
};
|
|
417
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
418
|
-
Promise.resolve().then(() => {
|
|
419
|
-
signal.throwIfAborted();
|
|
420
|
-
return start();
|
|
421
|
-
}).then((value) => {
|
|
422
|
-
signal.removeEventListener("abort", abort);
|
|
423
|
-
if (signal.aborted) {
|
|
424
|
-
if (late) void Promise.resolve().then(() => late(value)).catch(() => void 0);
|
|
425
|
-
reject(signal.reason);
|
|
426
|
-
} else resolve(value);
|
|
427
|
-
}, (error) => {
|
|
428
|
-
signal.removeEventListener("abort", abort);
|
|
429
|
-
reject(signal.aborted ? signal.reason : error);
|
|
430
|
-
});
|
|
431
|
-
if (signal.aborted) abort();
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
function createLlmTemplateStore(context, loaders) {
|
|
435
|
-
const directory = `${createLlmConfiguration(context).directory}/templates`;
|
|
436
|
-
const filename = (name) => {
|
|
437
|
-
if (!name || name.includes("/") || name.includes("\\") || name === "." || name === "..") throw new Error(`Invalid template name: ${name}`);
|
|
438
|
-
return `${directory}/${name}.yaml`;
|
|
439
|
-
};
|
|
440
|
-
const load = async (name) => {
|
|
441
|
-
try {
|
|
442
|
-
context.signal.throwIfAborted();
|
|
443
|
-
if (name.startsWith("https://") || name.startsWith("http://")) {
|
|
444
|
-
const fetch = context.fetch ?? context.capabilities?.fetch;
|
|
445
|
-
if (!fetch) throw new Error("Template URL loading is not configured");
|
|
446
|
-
if (!loaders || loaders.maxRemoteBytes !== Infinity && (!Number.isSafeInteger(loaders.maxRemoteBytes) || loaders.maxRemoteBytes < 1)) throw new Error("Template URL byte limit is not configured");
|
|
447
|
-
const materializedLimit = loaders.maxBytes ?? Infinity;
|
|
448
|
-
let response, failed = false;
|
|
449
|
-
let reader;
|
|
450
|
-
const abort = () => {
|
|
451
|
-
void reader?.cancel().catch(() => {
|
|
452
|
-
});
|
|
453
|
-
};
|
|
454
|
-
try {
|
|
455
|
-
response = await abortLoader(() => fetch(name, { signal: context.signal }), context.signal, async (response2) => {
|
|
456
|
-
await response2.body?.cancel();
|
|
457
|
-
});
|
|
458
|
-
if (!response.ok) {
|
|
459
|
-
const kind = response.status < 500 ? "Client" : "Server";
|
|
460
|
-
throw new Error(`${kind} error '${response.status} ${response.statusText}' for url '${name}'
|
|
461
|
-
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/${response.status}`);
|
|
462
|
-
}
|
|
463
|
-
reader = response.body?.getReader();
|
|
464
|
-
context.signal.addEventListener("abort", abort, { once: true });
|
|
465
|
-
context.signal.throwIfAborted();
|
|
466
|
-
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
467
|
-
const chunks = [];
|
|
468
|
-
let total = 0;
|
|
469
|
-
while (reader) {
|
|
470
|
-
context.signal.throwIfAborted();
|
|
471
|
-
const next = await abortLoader(() => reader.read(), context.signal);
|
|
472
|
-
context.signal.throwIfAborted();
|
|
473
|
-
if (next.done) break;
|
|
474
|
-
total += next.value.byteLength;
|
|
475
|
-
if (total > loaders.maxRemoteBytes) throw new RangeError("Template URL exceeds byte limit");
|
|
476
|
-
if (total > materializedLimit) throw new FsError3("EFBIG", { message: "llm buffered input byte limit exceeded" });
|
|
477
|
-
loaders.admitBytes?.(next.value.byteLength);
|
|
478
|
-
chunks.push(decoder.decode(next.value, { stream: true }));
|
|
479
|
-
}
|
|
480
|
-
chunks.push(decoder.decode());
|
|
481
|
-
const { parse: parse3 } = await import("../bundled-yaml/index.js");
|
|
482
|
-
const value = template(parse3(chunks.join("")), name);
|
|
483
|
-
Object.defineProperty(value, "functionsTrusted", { value: false });
|
|
484
|
-
return value;
|
|
485
|
-
} catch (error) {
|
|
486
|
-
failed = true;
|
|
487
|
-
context.signal.throwIfAborted();
|
|
488
|
-
throw new Error(`Could not load template ${name}: ${error instanceof Error ? error.message : String(error)}`);
|
|
489
|
-
} finally {
|
|
490
|
-
context.signal.removeEventListener("abort", abort);
|
|
491
|
-
if (reader) {
|
|
492
|
-
const cancelled = reader.cancel();
|
|
493
|
-
if (context.signal.aborted) {
|
|
494
|
-
void cancelled.catch(() => void 0);
|
|
495
|
-
reader.releaseLock();
|
|
496
|
-
} else try {
|
|
497
|
-
await cancelled.catch((error) => {
|
|
498
|
-
if (!failed) throw error;
|
|
499
|
-
});
|
|
500
|
-
} finally {
|
|
501
|
-
reader.releaseLock();
|
|
502
|
-
}
|
|
503
|
-
} else if (response?.body) {
|
|
504
|
-
const cancelled = response.body.cancel();
|
|
505
|
-
if (context.signal.aborted) void cancelled.catch(() => void 0);
|
|
506
|
-
else await cancelled.catch((error) => {
|
|
507
|
-
if (!failed) throw error;
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
const { parse: parse2 } = await import("../bundled-yaml/index.js");
|
|
513
|
-
let path = pathOf(context, name);
|
|
514
|
-
try {
|
|
515
|
-
await context.fs.stat(path, { signal: context.signal });
|
|
516
|
-
} catch (error) {
|
|
517
|
-
if (!(error instanceof FsError3) || error.code !== "ENOENT") throw error;
|
|
518
|
-
const colon = name.indexOf(":");
|
|
519
|
-
if (colon > 0) {
|
|
520
|
-
const prefix = name.slice(0, colon);
|
|
521
|
-
let valid = true;
|
|
522
|
-
for (const letter of prefix) if (!"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-".includes(letter)) {
|
|
523
|
-
valid = false;
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
if (valid) {
|
|
527
|
-
const loader = loaders?.loaders?.get(prefix);
|
|
528
|
-
if (!loader) throw new Error(`Unknown template prefix: ${prefix}`);
|
|
529
|
-
try {
|
|
530
|
-
const loaded = await abortLoader(() => loader(name.slice(colon + 1), context.signal), context.signal);
|
|
531
|
-
context.signal.throwIfAborted();
|
|
532
|
-
const materializedLimit = loaders?.maxBytes ?? Infinity;
|
|
533
|
-
let loadedBytes = 0;
|
|
534
|
-
if (loaders?.admitBytes || materializedLimit !== Infinity) for await (const bytes2 of jsonValue(loaded, context.signal)) {
|
|
535
|
-
loadedBytes += bytes2.byteLength;
|
|
536
|
-
if (loadedBytes > materializedLimit) throw new FsError3("EFBIG", { message: "llm buffered input byte limit exceeded" });
|
|
537
|
-
loaders?.admitBytes?.(bytes2.byteLength);
|
|
538
|
-
}
|
|
539
|
-
const value = template(loaded, loaded.name);
|
|
540
|
-
Object.defineProperty(value, "functionsTrusted", { value: false });
|
|
541
|
-
return value;
|
|
542
|
-
} catch (error2) {
|
|
543
|
-
context.signal.throwIfAborted();
|
|
544
|
-
throw new Error(`Could not load template ${name}: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
path = filename(name);
|
|
549
|
-
}
|
|
550
|
-
const size = (await context.fs.stat(path, { signal: context.signal })).size;
|
|
551
|
-
if (size > (loaders?.maxBytes ?? Infinity)) throw new FsError3("EFBIG", { message: "llm buffered input byte limit exceeded" });
|
|
552
|
-
const bytes = await context.fs.readFile(path, { signal: context.signal, ...loaders?.maxBytes === void 0 || loaders.maxBytes === Infinity ? {} : { maxBytes: loaders.maxBytes } });
|
|
553
|
-
loaders?.admitBytes?.(bytes.byteLength);
|
|
554
|
-
return template(parse2(new TextDecoder("utf-8", { fatal: true }).decode(bytes)), name);
|
|
555
|
-
} catch (error) {
|
|
556
|
-
if (error instanceof FsError3 && error.code === "ENOENT") throw new Error(`Invalid template: ${name}`);
|
|
557
|
-
throw error;
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
const publish = async (name, bytes) => {
|
|
561
|
-
const path = filename(name);
|
|
562
|
-
await context.fs.mkdir(directory, { recursive: true, signal: context.signal });
|
|
563
|
-
const parent = await context.fs.stat(directory, { signal: context.signal });
|
|
564
|
-
let expected;
|
|
565
|
-
try {
|
|
566
|
-
expected = await context.fs.lstat(path, { signal: context.signal });
|
|
567
|
-
} catch (error) {
|
|
568
|
-
if (!(error instanceof FsError3) || error.code !== "ENOENT") throw error;
|
|
569
|
-
expected = null;
|
|
570
|
-
}
|
|
571
|
-
await publishConfiguration(context.fs, directory, path, bytes, parent, expected, context.signal);
|
|
572
|
-
};
|
|
573
|
-
return {
|
|
574
|
-
directory,
|
|
575
|
-
load,
|
|
576
|
-
async save(name, value) {
|
|
577
|
-
const { stringify } = await import("../bundled-yaml/index.js");
|
|
578
|
-
await publish(name, new TextEncoder().encode(stringify(value, { indent: 4, lineWidth: 0 })));
|
|
579
|
-
},
|
|
580
|
-
async command(args, output, diagnostic) {
|
|
581
|
-
const actions = ["list", "edit", "loaders", "path", "show"];
|
|
582
|
-
const grouped = args.length === 1 && ["--help", "-h"].includes(args[0]);
|
|
583
|
-
const routed = args[0] === "--" ? args.slice(1) : args;
|
|
584
|
-
const explicit = actions.includes(routed[0] ?? "");
|
|
585
|
-
const command = explicit ? routed[0] : "list";
|
|
586
|
-
const tokens = explicit ? routed.slice(1) : routed;
|
|
587
|
-
const descriptions = {
|
|
588
|
-
list: "List available prompt templates",
|
|
589
|
-
edit: "Edit the specified prompt template using the default $EDITOR",
|
|
590
|
-
loaders: "Show template loaders registered by plugins",
|
|
591
|
-
path: "Output the path to the templates directory",
|
|
592
|
-
show: "Show the specified prompt template"
|
|
593
|
-
};
|
|
594
|
-
const usage = `Usage: llm templates ${command} [OPTIONS]${["show", "edit"].includes(command) ? " NAME" : ""}
|
|
595
|
-
`;
|
|
596
|
-
if (grouped) {
|
|
597
|
-
await output("Usage: llm templates [OPTIONS] COMMAND [ARGS]...\n\n Manage stored prompt templates\n\nOptions:\n -h, --help Show this message and exit.\n\nCommands:\n list* List available prompt templates\n edit Edit the specified prompt template using the default $EDITOR\n loaders Show template loaders registered by plugins\n path Output the path to the templates directory\n show Show the specified prompt template\n");
|
|
598
|
-
return 0;
|
|
599
|
-
}
|
|
600
|
-
let optionsEnded = false;
|
|
601
|
-
const operands = [];
|
|
602
|
-
let failure;
|
|
603
|
-
let help = false, showUsage = true;
|
|
604
|
-
for (const token of tokens) {
|
|
605
|
-
context.signal.throwIfAborted();
|
|
606
|
-
if (!optionsEnded && token === "--") optionsEnded = true;
|
|
607
|
-
else if (!optionsEnded && token === "--help") help = true;
|
|
608
|
-
else if (!optionsEnded && token.startsWith("--help=")) {
|
|
609
|
-
failure = "Option '--help' does not take a value.";
|
|
610
|
-
showUsage = false;
|
|
611
|
-
break;
|
|
612
|
-
} else if (!optionsEnded && token.startsWith("-") && !token.startsWith("--") && token !== "-") {
|
|
613
|
-
for (const letter of token.slice(1)) {
|
|
614
|
-
if (letter === "h") help = true;
|
|
615
|
-
else {
|
|
616
|
-
failure = `No such option: -${letter}`;
|
|
617
|
-
break;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
if (failure) break;
|
|
621
|
-
} else if (!optionsEnded && token.startsWith("-") && token !== "-") {
|
|
622
|
-
failure = `No such option: ${token.split("=")[0]}`;
|
|
623
|
-
break;
|
|
624
|
-
} else operands.push(token);
|
|
625
|
-
}
|
|
626
|
-
if (help && !failure) {
|
|
627
|
-
await output(usage + `
|
|
628
|
-
${descriptions[command]}
|
|
629
|
-
|
|
630
|
-
Options:
|
|
631
|
-
-h, --help Show this message and exit.
|
|
632
|
-
`);
|
|
633
|
-
return 0;
|
|
634
|
-
}
|
|
635
|
-
const needsName = ["show", "edit"].includes(command);
|
|
636
|
-
failure ??= needsName && !operands.length ? "Missing argument 'NAME'." : operands.length > (needsName ? 1 : 0) ? `Got unexpected extra argument (${operands[needsName ? 1 : 0]})` : void 0;
|
|
637
|
-
if (failure) {
|
|
638
|
-
await diagnostic((showUsage ? usage + `Try 'llm templates ${command} -h' for help.
|
|
639
|
-
|
|
640
|
-
` : "") + `Error: ${failure}
|
|
641
|
-
`);
|
|
642
|
-
return 2;
|
|
643
|
-
}
|
|
644
|
-
const name = operands[0];
|
|
645
|
-
if (command === "loaders") {
|
|
646
|
-
if (!loaders?.loaders?.size) await output("No template loaders found\n");
|
|
647
|
-
else for (const [prefix, loader] of loaders.loaders) {
|
|
648
|
-
context.signal.throwIfAborted();
|
|
649
|
-
const lines = (loader.description || "Undocumented").split("\n");
|
|
650
|
-
let margin;
|
|
651
|
-
for (const line of lines) {
|
|
652
|
-
if (!line.trim()) continue;
|
|
653
|
-
let length = 0;
|
|
654
|
-
while (length < line.length && (line[length] === " " || line[length] === " ")) length++;
|
|
655
|
-
const leading = line.slice(0, length);
|
|
656
|
-
if (margin === void 0) margin = leading;
|
|
657
|
-
else {
|
|
658
|
-
let common = 0;
|
|
659
|
-
while (common < margin.length && common < leading.length && margin[common] === leading[common]) common++;
|
|
660
|
-
margin = margin.slice(0, common);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
const docs = lines.map((line) => line.trim() ? line.slice(margin?.length ?? 0) : "").join("\n").trim();
|
|
664
|
-
await output(prefix + ":\n" + docs.split("\n").map((line) => line.trim() ? " " + line : line).join("\n") + "\n");
|
|
665
|
-
}
|
|
666
|
-
return 0;
|
|
667
|
-
}
|
|
668
|
-
if (command === "path") {
|
|
669
|
-
await output(directory + "\n");
|
|
670
|
-
return 0;
|
|
671
|
-
}
|
|
672
|
-
if (command === "show" && name) {
|
|
673
|
-
let value;
|
|
674
|
-
try {
|
|
675
|
-
value = await load(name);
|
|
676
|
-
} catch {
|
|
677
|
-
throw new Error(`Template '${name}' not found or invalid`);
|
|
678
|
-
}
|
|
679
|
-
const { templateYaml } = await import("./template-yaml-2YVS7IVT.js");
|
|
680
|
-
await output(templateYaml(value));
|
|
681
|
-
return 0;
|
|
682
|
-
}
|
|
683
|
-
if (command === "edit") {
|
|
684
|
-
if (!context.invoke) throw new Error("Template editor is not configured");
|
|
685
|
-
const path = filename(name);
|
|
686
|
-
try {
|
|
687
|
-
await context.fs.lstat(path, { signal: context.signal });
|
|
688
|
-
} catch (error) {
|
|
689
|
-
if (!(error instanceof FsError3) || error.code !== "ENOENT") throw error;
|
|
690
|
-
await publish(name, new TextEncoder().encode("prompt: "));
|
|
691
|
-
}
|
|
692
|
-
const editor = context.env.VISUAL || context.env.EDITOR || "vi";
|
|
693
|
-
const result = await context.invoke("sh", ["-c", editor + ' "$1"', "llm-template-editor", path], {
|
|
694
|
-
signal: context.signal,
|
|
695
|
-
cwd: context.cwd,
|
|
696
|
-
env: context.env,
|
|
697
|
-
replaceEnv: true,
|
|
698
|
-
...context.stdin ? { stdin: context.stdin } : {},
|
|
699
|
-
...context.stdout ? { stdout: context.stdout } : {},
|
|
700
|
-
...context.stderr ? { stderr: context.stderr } : {},
|
|
701
|
-
externalInvocation: true
|
|
702
|
-
});
|
|
703
|
-
context.signal.throwIfAborted();
|
|
704
|
-
if (result.exitCode !== 0) throw new Error("Editing failed!");
|
|
705
|
-
await load(name);
|
|
706
|
-
return 0;
|
|
707
|
-
}
|
|
708
|
-
let files;
|
|
709
|
-
try {
|
|
710
|
-
files = await context.fs.readdir(directory, { signal: context.signal });
|
|
711
|
-
} catch (error) {
|
|
712
|
-
if (error instanceof FsError3 && error.code === "ENOENT") return 0;
|
|
713
|
-
throw error;
|
|
714
|
-
}
|
|
715
|
-
const values = [];
|
|
716
|
-
for (const file of files) {
|
|
717
|
-
if (file.type !== "file" || !file.name.endsWith(".yaml")) continue;
|
|
718
|
-
try {
|
|
719
|
-
values.push(await load(file.name.slice(0, -5)));
|
|
720
|
-
} catch {
|
|
721
|
-
context.signal.throwIfAborted();
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
const width = Math.max(0, ...values.map((value) => [...value.name].length));
|
|
725
|
-
for (const value of values.sort((a, b) => unicodeOrder(a.name, b.name))) {
|
|
726
|
-
const description = (value.system ? `system: ${value.system}${value.prompt ? ` prompt: ${value.prompt}` : ""}` : value.prompt ?? "").split("\n").join(" ");
|
|
727
|
-
let suppliedColumns = NaN;
|
|
728
|
-
const columnText = (context.env.COLUMNS ?? "").trim();
|
|
729
|
-
const digits = columnText.startsWith("+") || columnText.startsWith("-") ? columnText.slice(1) : columnText;
|
|
730
|
-
let valid = digits.length > 0;
|
|
731
|
-
for (const digit of digits) if (!"0123456789".includes(digit)) {
|
|
732
|
-
valid = false;
|
|
733
|
-
break;
|
|
734
|
-
}
|
|
735
|
-
if (valid) suppliedColumns = Number(columnText);
|
|
736
|
-
const columns = Number.isSafeInteger(suppliedColumns) && suppliedColumns > 0 ? suppliedColumns : 80;
|
|
737
|
-
const text = `${value.name}${" ".repeat(width - [...value.name].length)} : ${description}`;
|
|
738
|
-
const points = [...text];
|
|
739
|
-
const truncated = points.length > columns ? points.slice(0, Math.max(0, columns - 3)).join("") + "..." : text;
|
|
740
|
-
await output(truncated + "\n");
|
|
741
|
-
}
|
|
742
|
-
return 0;
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
// packages/safe-bash-command-llm/src/extract-range.ts
|
|
748
|
-
import { yieldTurn as yieldTurn2 } from "../../safe-bash-contracts/yield.js";
|
|
749
|
-
|
|
750
|
-
// packages/safe-bash-command-llm/src/word-ranges.ts
|
|
751
|
-
var wordRanges = [[48, 57], [65, 90], [95, 95], [97, 122], [170, 170], [178, 179], [181, 181], [185, 186], [188, 190], [192, 214], [216, 246], [248, 705], [710, 721], [736, 740], [748, 748], [750, 750], [880, 884], [886, 887], [890, 893], [895, 895], [902, 902], [904, 906], [908, 908], [910, 929], [931, 1013], [1015, 1153], [1162, 1327], [1329, 1366], [1369, 1369], [1376, 1416], [1488, 1514], [1519, 1522], [1568, 1610], [1632, 1641], [1646, 1647], [1649, 1747], [1749, 1749], [1765, 1766], [1774, 1788], [1791, 1791], [1808, 1808], [1810, 1839], [1869, 1957], [1969, 1969], [1984, 2026], [2036, 2037], [2042, 2042], [2048, 2069], [2074, 2074], [2084, 2084], [2088, 2088], [2112, 2136], [2144, 2154], [2208, 2228], [2230, 2247], [2308, 2361], [2365, 2365], [2384, 2384], [2392, 2401], [2406, 2415], [2417, 2432], [2437, 2444], [2447, 2448], [2451, 2472], [2474, 2480], [2482, 2482], [2486, 2489], [2493, 2493], [2510, 2510], [2524, 2525], [2527, 2529], [2534, 2545], [2548, 2553], [2556, 2556], [2565, 2570], [2575, 2576], [2579, 2600], [2602, 2608], [2610, 2611], [2613, 2614], [2616, 2617], [2649, 2652], [2654, 2654], [2662, 2671], [2674, 2676], [2693, 2701], [2703, 2705], [2707, 2728], [2730, 2736], [2738, 2739], [2741, 2745], [2749, 2749], [2768, 2768], [2784, 2785], [2790, 2799], [2809, 2809], [2821, 2828], [2831, 2832], [2835, 2856], [2858, 2864], [2866, 2867], [2869, 2873], [2877, 2877], [2908, 2909], [2911, 2913], [2918, 2927], [2929, 2935], [2947, 2947], [2949, 2954], [2958, 2960], [2962, 2965], [2969, 2970], [2972, 2972], [2974, 2975], [2979, 2980], [2984, 2986], [2990, 3001], [3024, 3024], [3046, 3058], [3077, 3084], [3086, 3088], [3090, 3112], [3114, 3129], [3133, 3133], [3160, 3162], [3168, 3169], [3174, 3183], [3192, 3198], [3200, 3200], [3205, 3212], [3214, 3216], [3218, 3240], [3242, 3251], [3253, 3257], [3261, 3261], [3294, 3294], [3296, 3297], [3302, 3311], [3313, 3314], [3332, 3340], [3342, 3344], [3346, 3386], [3389, 3389], [3406, 3406], [3412, 3414], [3416, 3425], [3430, 3448], [3450, 3455], [3461, 3478], [3482, 3505], [3507, 3515], [3517, 3517], [3520, 3526], [3558, 3567], [3585, 3632], [3634, 3635], [3648, 3654], [3664, 3673], [3713, 3714], [3716, 3716], [3718, 3722], [3724, 3747], [3749, 3749], [3751, 3760], [3762, 3763], [3773, 3773], [3776, 3780], [3782, 3782], [3792, 3801], [3804, 3807], [3840, 3840], [3872, 3891], [3904, 3911], [3913, 3948], [3976, 3980], [4096, 4138], [4159, 4169], [4176, 4181], [4186, 4189], [4193, 4193], [4197, 4198], [4206, 4208], [4213, 4225], [4238, 4238], [4240, 4249], [4256, 4293], [4295, 4295], [4301, 4301], [4304, 4346], [4348, 4680], [4682, 4685], [4688, 4694], [4696, 4696], [4698, 4701], [4704, 4744], [4746, 4749], [4752, 4784], [4786, 4789], [4792, 4798], [4800, 4800], [4802, 4805], [4808, 4822], [4824, 4880], [4882, 4885], [4888, 4954], [4969, 4988], [4992, 5007], [5024, 5109], [5112, 5117], [5121, 5740], [5743, 5759], [5761, 5786], [5792, 5866], [5870, 5880], [5888, 5900], [5902, 5905], [5920, 5937], [5952, 5969], [5984, 5996], [5998, 6e3], [6016, 6067], [6103, 6103], [6108, 6108], [6112, 6121], [6128, 6137], [6160, 6169], [6176, 6264], [6272, 6276], [6279, 6312], [6314, 6314], [6320, 6389], [6400, 6430], [6470, 6509], [6512, 6516], [6528, 6571], [6576, 6601], [6608, 6618], [6656, 6678], [6688, 6740], [6784, 6793], [6800, 6809], [6823, 6823], [6917, 6963], [6981, 6987], [6992, 7001], [7043, 7072], [7086, 7141], [7168, 7203], [7232, 7241], [7245, 7293], [7296, 7304], [7312, 7354], [7357, 7359], [7401, 7404], [7406, 7411], [7413, 7414], [7418, 7418], [7424, 7615], [7680, 7957], [7960, 7965], [7968, 8005], [8008, 8013], [8016, 8023], [8025, 8025], [8027, 8027], [8029, 8029], [8031, 8061], [8064, 8116], [8118, 8124], [8126, 8126], [8130, 8132], [8134, 8140], [8144, 8147], [8150, 8155], [8160, 8172], [8178, 8180], [8182, 8188], [8304, 8305], [8308, 8313], [8319, 8329], [8336, 8348], [8450, 8450], [8455, 8455], [8458, 8467], [8469, 8469], [8473, 8477], [8484, 8484], [8486, 8486], [8488, 8488], [8490, 8493], [8495, 8505], [8508, 8511], [8517, 8521], [8526, 8526], [8528, 8585], [9312, 9371], [9450, 9471], [10102, 10131], [11264, 11310], [11312, 11358], [11360, 11492], [11499, 11502], [11506, 11507], [11517, 11517], [11520, 11557], [11559, 11559], [11565, 11565], [11568, 11623], [11631, 11631], [11648, 11670], [11680, 11686], [11688, 11694], [11696, 11702], [11704, 11710], [11712, 11718], [11720, 11726], [11728, 11734], [11736, 11742], [11823, 11823], [12293, 12295], [12321, 12329], [12337, 12341], [12344, 12348], [12353, 12438], [12445, 12447], [12449, 12538], [12540, 12543], [12549, 12591], [12593, 12686], [12690, 12693], [12704, 12735], [12784, 12799], [12832, 12841], [12872, 12879], [12881, 12895], [12928, 12937], [12977, 12991], [13312, 19903], [19968, 40956], [40960, 42124], [42192, 42237], [42240, 42508], [42512, 42539], [42560, 42606], [42623, 42653], [42656, 42735], [42775, 42783], [42786, 42888], [42891, 42943], [42946, 42954], [42997, 43009], [43011, 43013], [43015, 43018], [43020, 43042], [43056, 43061], [43072, 43123], [43138, 43187], [43216, 43225], [43250, 43255], [43259, 43259], [43261, 43262], [43264, 43301], [43312, 43334], [43360, 43388], [43396, 43442], [43471, 43481], [43488, 43492], [43494, 43518], [43520, 43560], [43584, 43586], [43588, 43595], [43600, 43609], [43616, 43638], [43642, 43642], [43646, 43695], [43697, 43697], [43701, 43702], [43705, 43709], [43712, 43712], [43714, 43714], [43739, 43741], [43744, 43754], [43762, 43764], [43777, 43782], [43785, 43790], [43793, 43798], [43808, 43814], [43816, 43822], [43824, 43866], [43868, 43881], [43888, 44002], [44016, 44025], [44032, 55203], [55216, 55238], [55243, 55291], [63744, 64109], [64112, 64217], [64256, 64262], [64275, 64279], [64285, 64285], [64287, 64296], [64298, 64310], [64312, 64316], [64318, 64318], [64320, 64321], [64323, 64324], [64326, 64433], [64467, 64829], [64848, 64911], [64914, 64967], [65008, 65019], [65136, 65140], [65142, 65276], [65296, 65305], [65313, 65338], [65345, 65370], [65382, 65470], [65474, 65479], [65482, 65487], [65490, 65495], [65498, 65500], [65536, 65547], [65549, 65574], [65576, 65594], [65596, 65597], [65599, 65613], [65616, 65629], [65664, 65786], [65799, 65843], [65856, 65912], [65930, 65931], [66176, 66204], [66208, 66256], [66273, 66299], [66304, 66339], [66349, 66378], [66384, 66421], [66432, 66461], [66464, 66499], [66504, 66511], [66513, 66517], [66560, 66717], [66720, 66729], [66736, 66771], [66776, 66811], [66816, 66855], [66864, 66915], [67072, 67382], [67392, 67413], [67424, 67431], [67584, 67589], [67592, 67592], [67594, 67637], [67639, 67640], [67644, 67644], [67647, 67669], [67672, 67702], [67705, 67742], [67751, 67759], [67808, 67826], [67828, 67829], [67835, 67867], [67872, 67897], [67968, 68023], [68028, 68047], [68050, 68096], [68112, 68115], [68117, 68119], [68121, 68149], [68160, 68168], [68192, 68222], [68224, 68255], [68288, 68295], [68297, 68324], [68331, 68335], [68352, 68405], [68416, 68437], [68440, 68466], [68472, 68497], [68521, 68527], [68608, 68680], [68736, 68786], [68800, 68850], [68858, 68899], [68912, 68921], [69216, 69246], [69248, 69289], [69296, 69297], [69376, 69415], [69424, 69445], [69457, 69460], [69552, 69579], [69600, 69622], [69635, 69687], [69714, 69743], [69763, 69807], [69840, 69864], [69872, 69881], [69891, 69926], [69942, 69951], [69956, 69956], [69959, 69959], [69968, 70002], [70006, 70006], [70019, 70066], [70081, 70084], [70096, 70106], [70108, 70108], [70113, 70132], [70144, 70161], [70163, 70187], [70272, 70278], [70280, 70280], [70282, 70285], [70287, 70301], [70303, 70312], [70320, 70366], [70384, 70393], [70405, 70412], [70415, 70416], [70419, 70440], [70442, 70448], [70450, 70451], [70453, 70457], [70461, 70461], [70480, 70480], [70493, 70497], [70656, 70708], [70727, 70730], [70736, 70745], [70751, 70753], [70784, 70831], [70852, 70853], [70855, 70855], [70864, 70873], [71040, 71086], [71128, 71131], [71168, 71215], [71236, 71236], [71248, 71257], [71296, 71338], [71352, 71352], [71360, 71369], [71424, 71450], [71472, 71483], [71680, 71723], [71840, 71922], [71935, 71942], [71945, 71945], [71948, 71955], [71957, 71958], [71960, 71983], [71999, 71999], [72001, 72001], [72016, 72025], [72096, 72103], [72106, 72144], [72161, 72161], [72163, 72163], [72192, 72192], [72203, 72242], [72250, 72250], [72272, 72272], [72284, 72329], [72349, 72349], [72384, 72440], [72704, 72712], [72714, 72750], [72768, 72768], [72784, 72812], [72818, 72847], [72960, 72966], [72968, 72969], [72971, 73008], [73030, 73030], [73040, 73049], [73056, 73061], [73063, 73064], [73066, 73097], [73112, 73112], [73120, 73129], [73440, 73458], [73648, 73648], [73664, 73684], [73728, 74649], [74752, 74862], [74880, 75075], [77824, 78894], [82944, 83526], [92160, 92728], [92736, 92766], [92768, 92777], [92880, 92909], [92928, 92975], [92992, 92995], [93008, 93017], [93019, 93025], [93027, 93047], [93053, 93071], [93760, 93846], [93952, 94026], [94032, 94032], [94099, 94111], [94176, 94177], [94179, 94179], [94208, 100343], [100352, 101589], [101632, 101640], [110592, 110878], [110928, 110930], [110948, 110951], [110960, 111355], [113664, 113770], [113776, 113788], [113792, 113800], [113808, 113817], [119520, 119539], [119648, 119672], [119808, 119892], [119894, 119964], [119966, 119967], [119970, 119970], [119973, 119974], [119977, 119980], [119982, 119993], [119995, 119995], [119997, 120003], [120005, 120069], [120071, 120074], [120077, 120084], [120086, 120092], [120094, 120121], [120123, 120126], [120128, 120132], [120134, 120134], [120138, 120144], [120146, 120485], [120488, 120512], [120514, 120538], [120540, 120570], [120572, 120596], [120598, 120628], [120630, 120654], [120656, 120686], [120688, 120712], [120714, 120744], [120746, 120770], [120772, 120779], [120782, 120831], [123136, 123180], [123191, 123197], [123200, 123209], [123214, 123214], [123584, 123627], [123632, 123641], [124928, 125124], [125127, 125135], [125184, 125251], [125259, 125259], [125264, 125273], [126065, 126123], [126125, 126127], [126129, 126132], [126209, 126253], [126255, 126269], [126464, 126467], [126469, 126495], [126497, 126498], [126500, 126500], [126503, 126503], [126505, 126514], [126516, 126519], [126521, 126521], [126523, 126523], [126530, 126530], [126535, 126535], [126537, 126537], [126539, 126539], [126541, 126543], [126545, 126546], [126548, 126548], [126551, 126551], [126553, 126553], [126555, 126555], [126557, 126557], [126559, 126559], [126561, 126562], [126564, 126564], [126567, 126570], [126572, 126578], [126580, 126583], [126585, 126588], [126590, 126590], [126592, 126601], [126603, 126619], [126625, 126627], [126629, 126633], [126635, 126651], [127232, 127244], [130032, 130041], [131072, 173789], [173824, 177972], [177984, 178205], [178208, 183969], [183984, 191456], [194560, 195101], [196608, 201546]];
|
|
752
|
-
|
|
753
|
-
// packages/safe-bash-command-llm/src/extract-range.ts
|
|
754
|
-
function isWord(value) {
|
|
755
|
-
let low = 0, high = wordRanges.length - 1;
|
|
756
|
-
while (low <= high) {
|
|
757
|
-
const mid = low + high >>> 1;
|
|
758
|
-
const [start, end] = wordRanges[mid];
|
|
759
|
-
if (value < start) high = mid - 1;
|
|
760
|
-
else if (value > end) low = mid + 1;
|
|
761
|
-
else return true;
|
|
762
|
-
}
|
|
763
|
-
return false;
|
|
764
|
-
}
|
|
765
|
-
async function findExtractedRange(reader, last, signal) {
|
|
766
|
-
let cache = new Uint8Array(0);
|
|
767
|
-
let cacheStart = -1, work = 0;
|
|
768
|
-
async function byte(position2) {
|
|
769
|
-
signal.throwIfAborted();
|
|
770
|
-
if (++work % 4096 === 0) await yieldTurn2(signal);
|
|
771
|
-
if (position2 < 0 || position2 >= reader.size) throw new Error("Invalid extraction position");
|
|
772
|
-
if (position2 < cacheStart || position2 >= cacheStart + cache.length) {
|
|
773
|
-
cache = await reader.read(position2, Math.min(16384, reader.size - position2));
|
|
774
|
-
cacheStart = position2;
|
|
775
|
-
signal.throwIfAborted();
|
|
776
|
-
if (!cache.length || cache.length > Math.min(16384, reader.size - position2)) throw new Error("Invalid extraction read");
|
|
777
|
-
}
|
|
778
|
-
return cache[position2 - cacheStart];
|
|
779
|
-
}
|
|
780
|
-
async function line(start) {
|
|
781
|
-
let position2 = start, ticks = 0;
|
|
782
|
-
while (position2 < reader.size && await byte(position2) === 96) {
|
|
783
|
-
ticks++;
|
|
784
|
-
position2++;
|
|
785
|
-
}
|
|
786
|
-
let opening = ticks >= 3, closing = ticks >= 3;
|
|
787
|
-
while (position2 < reader.size) {
|
|
788
|
-
const value = await byte(position2);
|
|
789
|
-
if (value === 10) return { start, next: position2 + 1, ticks, opening, closing };
|
|
790
|
-
closing = closing && value === 32;
|
|
791
|
-
let point = value, width = 1;
|
|
792
|
-
if (value >= 194 && value <= 244) {
|
|
793
|
-
width = value < 224 ? 2 : value < 240 ? 3 : 4;
|
|
794
|
-
point = value & (width === 2 ? 31 : width === 3 ? 15 : 7);
|
|
795
|
-
for (let i = 1; i < width; i++) {
|
|
796
|
-
if (position2 + i >= reader.size) {
|
|
797
|
-
opening = false;
|
|
798
|
-
width = 1;
|
|
799
|
-
break;
|
|
800
|
-
}
|
|
801
|
-
const continuation = await byte(position2 + i);
|
|
802
|
-
if (continuation < 128 || continuation > 191) {
|
|
803
|
-
opening = false;
|
|
804
|
-
width = 1;
|
|
805
|
-
break;
|
|
806
|
-
}
|
|
807
|
-
point = point << 6 | continuation & 63;
|
|
808
|
-
}
|
|
809
|
-
} else if (value >= 128) opening = false;
|
|
810
|
-
opening = opening && isWord(point);
|
|
811
|
-
position2 += width;
|
|
812
|
-
}
|
|
813
|
-
return { start, next: reader.size, ticks, opening: false, closing };
|
|
814
|
-
}
|
|
815
|
-
const failedLengths = new Uint8Array(16384);
|
|
816
|
-
let position = 0, selected;
|
|
817
|
-
while (position < reader.size) {
|
|
818
|
-
const candidate = await line(position);
|
|
819
|
-
position = candidate.next;
|
|
820
|
-
if (!candidate.opening) continue;
|
|
821
|
-
if (candidate.ticks < failedLengths.length * 8 && failedLengths[candidate.ticks >>> 3] & 1 << (candidate.ticks & 7)) continue;
|
|
822
|
-
let matched = false;
|
|
823
|
-
let search = candidate.next;
|
|
824
|
-
while (search < reader.size) {
|
|
825
|
-
const ending = await line(search);
|
|
826
|
-
search = ending.next;
|
|
827
|
-
if (ending.closing && ending.ticks === candidate.ticks) {
|
|
828
|
-
matched = true;
|
|
829
|
-
selected = { start: candidate.next, end: ending.start };
|
|
830
|
-
if (!last) return selected;
|
|
831
|
-
position = ending.next;
|
|
832
|
-
break;
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
if (!matched && candidate.ticks < failedLengths.length * 8) failedLengths[candidate.ticks >>> 3] |= 1 << (candidate.ticks & 7);
|
|
836
|
-
}
|
|
837
|
-
return selected;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
// packages/safe-bash-command-llm/src/schemas.ts
|
|
841
|
-
function parseLlmSchemaDsl(input, multi = false) {
|
|
842
|
-
const properties = /* @__PURE__ */ Object.create(null);
|
|
843
|
-
const required = [];
|
|
844
|
-
const types = { int: "integer", float: "number", bool: "boolean", str: "string" };
|
|
845
|
-
for (const field of input.split(input.includes("\n") ? "\n" : ",").map((value) => value.trim()).filter(Boolean)) {
|
|
846
|
-
const colon = field.indexOf(":");
|
|
847
|
-
const info = (colon < 0 ? field : field.slice(0, colon)).trim();
|
|
848
|
-
const description = colon < 0 ? "" : field.slice(colon + 1).trim();
|
|
849
|
-
const parts = [];
|
|
850
|
-
let word = "";
|
|
851
|
-
for (const character of info) {
|
|
852
|
-
if (character.trim() === "") {
|
|
853
|
-
if (word) parts.push(word);
|
|
854
|
-
word = "";
|
|
855
|
-
} else word += character;
|
|
856
|
-
}
|
|
857
|
-
if (word) parts.push(word);
|
|
858
|
-
const name = parts[0];
|
|
859
|
-
if (!name) throw new Error("Schema field requires a name");
|
|
860
|
-
const indicator = parts[1] ?? "str";
|
|
861
|
-
const type = Object.hasOwn(types, indicator) ? types[indicator] : "string";
|
|
862
|
-
properties[name] = { type, ...description ? { description } : {} };
|
|
863
|
-
required.push(name);
|
|
864
|
-
}
|
|
865
|
-
const schema = { type: "object", properties, required };
|
|
866
|
-
return multi ? { type: "object", properties: { items: { type: "array", items: schema } }, required: ["items"] } : schema;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
// packages/safe-bash-command-llm/src/schema-input.ts
|
|
870
|
-
import { FsError as FsError4 } from "../../safe-bash-contracts/index.js";
|
|
871
|
-
import { pathOf as pathOf2 } from "../../safe-bash-contracts/path.js";
|
|
872
|
-
async function resolveLlmSchemaInput(context, input, options) {
|
|
873
|
-
context.signal.throwIfAborted();
|
|
874
|
-
let schema;
|
|
875
|
-
const trimmed = input.trim();
|
|
876
|
-
if (trimmed.startsWith("t:")) {
|
|
877
|
-
const name = trimmed.slice(2);
|
|
878
|
-
const template2 = await options.loadTemplate(name);
|
|
879
|
-
schema = template2.schema_object;
|
|
880
|
-
if (!schema) throw new Error("Template '" + name + "' has no schema");
|
|
881
|
-
} else {
|
|
882
|
-
if (trimmed.startsWith("{")) {
|
|
883
|
-
try {
|
|
884
|
-
schema = JSON.parse(input);
|
|
885
|
-
} catch {
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
if (schema === void 0 && (trimmed.includes(" ") || input.includes(","))) schema = parseLlmSchemaDsl(input);
|
|
889
|
-
if (schema === void 0) {
|
|
890
|
-
const path = pathOf2(context, input);
|
|
891
|
-
let stat;
|
|
892
|
-
try {
|
|
893
|
-
stat = await context.fs.stat(path, { signal: context.signal });
|
|
894
|
-
} catch (error) {
|
|
895
|
-
if (!(error instanceof FsError4) || error.code !== "ENOENT") throw error;
|
|
896
|
-
}
|
|
897
|
-
if (stat) {
|
|
898
|
-
const source = await fileSource({ fs: context.fs, path, signal: context.signal, maxBytes: options.maxBytes ?? Infinity, expectedStat: stat });
|
|
899
|
-
let text = "";
|
|
900
|
-
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
901
|
-
try {
|
|
902
|
-
for await (const bytes of source.bytes) {
|
|
903
|
-
options.admitBytes?.(bytes.byteLength);
|
|
904
|
-
text += decoder.decode(bytes, { stream: true });
|
|
905
|
-
}
|
|
906
|
-
text += decoder.decode();
|
|
907
|
-
} finally {
|
|
908
|
-
await source.dispose();
|
|
909
|
-
}
|
|
910
|
-
try {
|
|
911
|
-
schema = JSON.parse(text);
|
|
912
|
-
} catch {
|
|
913
|
-
throw new Error("Schema file contained invalid JSON");
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
context.signal.throwIfAborted();
|
|
919
|
-
if (!schema || typeof schema !== "object" || Array.isArray(schema)) throw new Error("Invalid schema");
|
|
920
|
-
return options.multi ? { type: "object", properties: { items: { type: "array", items: schema } }, required: ["items"] } : schema;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
// packages/safe-bash-command-llm/src/configuration-command.ts
|
|
924
|
-
async function configurationCommand(context, service, args, output, diagnostic, maxConfigurationBytes = Infinity) {
|
|
925
|
-
if (args.length === 1 && args[0] === "--version") {
|
|
926
|
-
await output("llm, version 0.27.1\n");
|
|
927
|
-
return true;
|
|
928
|
-
}
|
|
929
|
-
const keysCmd = args[0] === "keys";
|
|
930
|
-
const aliases = args[0] === "aliases";
|
|
931
|
-
const defaults = args[0] === "models" && args[1] === "default";
|
|
932
|
-
const options = args[0] === "models" && args[1] === "options";
|
|
933
|
-
if (!keysCmd && !aliases && !defaults && !options) return false;
|
|
934
|
-
const configuration = createLlmConfiguration(context, maxConfigurationBytes);
|
|
935
|
-
if (keysCmd) {
|
|
936
|
-
const tokens2 = args.slice(1), sub = tokens2[0];
|
|
937
|
-
if (sub === "path" && tokens2.length === 1) {
|
|
938
|
-
await output(`${configuration.directory}/keys.json
|
|
939
|
-
`);
|
|
940
|
-
return true;
|
|
941
|
-
}
|
|
942
|
-
if (sub === void 0 || sub === "list" && tokens2.length === 1) {
|
|
943
|
-
const path = `${configuration.directory}/keys.json`;
|
|
944
|
-
let exists = true;
|
|
945
|
-
try {
|
|
946
|
-
await context.fs.lstat(path, { signal: context.signal });
|
|
947
|
-
} catch {
|
|
948
|
-
exists = false;
|
|
949
|
-
}
|
|
950
|
-
if (!exists) {
|
|
951
|
-
await output("No keys found\n");
|
|
952
|
-
return true;
|
|
953
|
-
}
|
|
954
|
-
const stored = await configuration.keys();
|
|
955
|
-
for (const key of Object.keys(stored).sort()) {
|
|
956
|
-
await output(`${key}
|
|
957
|
-
`);
|
|
958
|
-
}
|
|
959
|
-
return true;
|
|
960
|
-
}
|
|
961
|
-
if (sub === "get" && tokens2.length === 2) {
|
|
962
|
-
await output(`${await configuration.getKey(tokens2[1])}
|
|
963
|
-
`);
|
|
964
|
-
return true;
|
|
965
|
-
}
|
|
966
|
-
if (sub === "set") {
|
|
967
|
-
let name;
|
|
968
|
-
let value;
|
|
969
|
-
for (let i = 1; i < tokens2.length; i++) {
|
|
970
|
-
const token = tokens2[i];
|
|
971
|
-
if (token === "--value") {
|
|
972
|
-
if (++i >= tokens2.length) throw new Error("Option '--value' requires an argument");
|
|
973
|
-
value = tokens2[i];
|
|
974
|
-
} else if (token.startsWith("--value=")) {
|
|
975
|
-
value = token.slice(8);
|
|
976
|
-
} else if (token.startsWith("-")) {
|
|
977
|
-
throw new Error(`No such option: ${token}`);
|
|
978
|
-
} else if (name === void 0) {
|
|
979
|
-
name = token;
|
|
980
|
-
} else {
|
|
981
|
-
throw new Error("Unexpected extra arguments");
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
if (!name) throw new Error("Missing argument 'NAME'");
|
|
985
|
-
if (value === void 0) {
|
|
986
|
-
let stdinText = "";
|
|
987
|
-
const decoder = new TextDecoder();
|
|
988
|
-
for await (const chunk of context.stdin) {
|
|
989
|
-
context.signal.throwIfAborted();
|
|
990
|
-
stdinText += decoder.decode(chunk, { stream: true });
|
|
991
|
-
}
|
|
992
|
-
stdinText += decoder.decode();
|
|
993
|
-
value = stdinText.replace(/\r?\n$/, "");
|
|
994
|
-
}
|
|
995
|
-
await configuration.setKey(name, value);
|
|
996
|
-
return true;
|
|
997
|
-
}
|
|
998
|
-
throw new Error("Invalid keys command");
|
|
999
|
-
}
|
|
1000
|
-
const canonical = async (model) => {
|
|
1001
|
-
const resolved = await configuration.resolveAlias(model);
|
|
1002
|
-
try {
|
|
1003
|
-
return service.resolve(resolved).model.id;
|
|
1004
|
-
} catch {
|
|
1005
|
-
return resolved;
|
|
1006
|
-
}
|
|
1007
|
-
};
|
|
1008
|
-
const tokens = args.slice(aliases ? 1 : 2), command = tokens[0];
|
|
1009
|
-
if (defaults) {
|
|
1010
|
-
if (tokens.length > 1) throw new Error("Unexpected extra arguments");
|
|
1011
|
-
if (command === void 0) await output(`${await configuration.defaultModel() ?? service.resolve().model.id}
|
|
1012
|
-
`);
|
|
1013
|
-
else {
|
|
1014
|
-
const model = service.resolve(await canonical(command)).model.id;
|
|
1015
|
-
await configuration.setDefaultModel(model);
|
|
1016
|
-
}
|
|
1017
|
-
return true;
|
|
1018
|
-
}
|
|
1019
|
-
if (aliases) {
|
|
1020
|
-
if (command === "path" && tokens.length === 1) await output(`${configuration.directory}/aliases.json
|
|
1021
|
-
`);
|
|
1022
|
-
else if (command === "set") {
|
|
1023
|
-
const operands = [], queries = [];
|
|
1024
|
-
for (let index = 1; index < tokens.length; index++) {
|
|
1025
|
-
const token = tokens[index];
|
|
1026
|
-
if (token === "-q" || token === "--query") {
|
|
1027
|
-
const query = tokens[++index];
|
|
1028
|
-
if (query === void 0) throw new Error(`Option '${token}' requires an argument`);
|
|
1029
|
-
queries.push(query);
|
|
1030
|
-
} else if (token.startsWith("--query=")) queries.push(token.slice(8));
|
|
1031
|
-
else if (token.startsWith("-q") && token.length > 2) queries.push(token.slice(2));
|
|
1032
|
-
else if (token.startsWith("-")) throw new Error(`No such option: ${token}`);
|
|
1033
|
-
else operands.push(token);
|
|
1034
|
-
}
|
|
1035
|
-
if (!operands.length || operands.length > 2) throw new Error("Invalid aliases set arguments");
|
|
1036
|
-
let model = operands[1];
|
|
1037
|
-
const queried = model === void 0;
|
|
1038
|
-
if (model === void 0) {
|
|
1039
|
-
if (!queries.length) throw new Error("You must provide a model_id or at least one -q option");
|
|
1040
|
-
const persisted = await configuration.aliases();
|
|
1041
|
-
const found = service.models.find((entry) => queries.every((query) => [entry.provider.name, entry.model.id, ...entry.model.aliases ?? [], ...Object.entries(persisted).filter(([, id]) => id === entry.model.id).map(([alias]) => alias)].some((text) => text.toLowerCase().includes(query.toLowerCase()))));
|
|
1042
|
-
if (!found) throw new Error(`No model found matching query: ${queries.join(", ")}`);
|
|
1043
|
-
model = found.model.id;
|
|
1044
|
-
}
|
|
1045
|
-
await configuration.setAlias(operands[0], await canonical(model));
|
|
1046
|
-
if (queried) await diagnostic(`Alias '${operands[0]}' set to model '${model}'
|
|
1047
|
-
`);
|
|
1048
|
-
} else if (command === "remove" && tokens.length === 2) await configuration.removeAlias(tokens[1]);
|
|
1049
|
-
else if ((command === void 0 || command === "list" || command === "--json") && tokens.slice(command === void 0 ? 0 : 1).every((token) => token === "--json")) {
|
|
1050
|
-
const values = {};
|
|
1051
|
-
for (const { model } of service.models) for (const alias of model.aliases ?? []) if (alias !== model.id) Object.defineProperty(values, alias, { value: model.id, enumerable: true, configurable: true, writable: true });
|
|
1052
|
-
const entries = Object.entries({ ...values, ...await configuration.aliases() });
|
|
1053
|
-
if (tokens.includes("--json")) await output(JSON.stringify(Object.fromEntries(entries), null, 4) + "\n");
|
|
1054
|
-
else {
|
|
1055
|
-
const width = Math.max(0, ...entries.map(([alias]) => [...alias].length));
|
|
1056
|
-
for (const [alias, model] of entries) await output(`${alias}${" ".repeat(width - [...alias].length)} : ${model}
|
|
1057
|
-
`);
|
|
1058
|
-
}
|
|
1059
|
-
} else throw new Error("Invalid aliases command");
|
|
1060
|
-
return true;
|
|
1061
|
-
}
|
|
1062
|
-
if (command === "set" && tokens.length === 4) {
|
|
1063
|
-
const model = await canonical(tokens[1]);
|
|
1064
|
-
const entry = service.models.find((entry2) => entry2.model.id === model);
|
|
1065
|
-
if (entry) validateModelOptions(entry.model, { [tokens[2]]: tokens[3] });
|
|
1066
|
-
await configuration.setModelOption(model, tokens[2], tokens[3]);
|
|
1067
|
-
await diagnostic(`Set default option ${tokens[2]}=${tokens[3]} for model ${model}
|
|
1068
|
-
`);
|
|
1069
|
-
} else if (command === "show" && tokens.length === 2) {
|
|
1070
|
-
const model = await canonical(tokens[1]), values = await configuration.modelOptions(model);
|
|
1071
|
-
if (!Object.keys(values).length) await diagnostic(`No default options set for model '${model}'.
|
|
1072
|
-
`);
|
|
1073
|
-
else for (const [key, value] of Object.entries(values)) await output(`${key}: ${value}
|
|
1074
|
-
`);
|
|
1075
|
-
} else if (command === "clear" && (tokens.length === 2 || tokens.length === 3)) {
|
|
1076
|
-
const model = await canonical(tokens[1]);
|
|
1077
|
-
const keys = tokens[2] === void 0 ? Object.keys(await configuration.modelOptions(model)) : [tokens[2]];
|
|
1078
|
-
await configuration.clearModelOption(model, tokens[2]);
|
|
1079
|
-
if (keys.length === 1) await output(`Cleared option '${keys[0]}' for model ${model}
|
|
1080
|
-
`);
|
|
1081
|
-
else if (keys.length > 1) await output(`Cleared ${keys.join(", ")} options for model ${model}
|
|
1082
|
-
`);
|
|
1083
|
-
} else if (command === "list" && tokens.length === 1 || command === void 0) {
|
|
1084
|
-
await listOptions(configuration, output, diagnostic);
|
|
1085
|
-
} else throw new Error("Invalid models options command");
|
|
1086
|
-
return true;
|
|
1087
|
-
}
|
|
1088
|
-
async function listOptions(configuration, output, diagnostic) {
|
|
1089
|
-
const entries = Object.entries(await configuration.allModelOptions());
|
|
1090
|
-
if (!entries.length) await diagnostic("No default options set for any models.\n");
|
|
1091
|
-
for (const [model, values] of entries) {
|
|
1092
|
-
await output(`${model}:
|
|
1093
|
-
`);
|
|
1094
|
-
for (const [key, value] of Object.entries(values)) await output(` ${key}: ${value}
|
|
1095
|
-
`);
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
// packages/safe-bash-command-llm/src/model-selection.ts
|
|
1100
|
-
import { yieldTurn as yieldTurn3 } from "../../safe-bash-contracts/yield.js";
|
|
1101
|
-
function getLlmModelAliases({ provider, model }, configured) {
|
|
1102
|
-
const aliases = new Set(model.aliases);
|
|
1103
|
-
for (const [alias, target] of Object.entries(configured)) {
|
|
1104
|
-
if (target === model.id || target === `${provider.name}/${model.id}` || model.aliases?.includes(target)) aliases.add(alias);
|
|
1105
|
-
}
|
|
1106
|
-
return [...aliases];
|
|
1107
|
-
}
|
|
1108
|
-
async function selectLlmModelByQuery(models, queries, configuredAliases = {}, signal) {
|
|
1109
|
-
if (!queries.length) throw new TypeError("Model selection requires a query");
|
|
1110
|
-
let selected;
|
|
1111
|
-
const normalized = queries.map((query) => query.toLowerCase());
|
|
1112
|
-
for (let index = 0; index < models.length; index++) {
|
|
1113
|
-
signal?.throwIfAborted();
|
|
1114
|
-
if (signal && index && index % 256 === 0) await yieldTurn3(signal);
|
|
1115
|
-
const entry = models[index];
|
|
1116
|
-
const terms = [`${entry.provider.name}: ${entry.model.id}`, ...getLlmModelAliases(entry, configuredAliases)].map((value) => value.toLowerCase());
|
|
1117
|
-
if (normalized.every((query) => terms.some((term) => term.includes(query))) && (!selected || [...entry.model.id].length < [...selected.model.id].length)) selected = entry;
|
|
1118
|
-
}
|
|
1119
|
-
signal?.throwIfAborted();
|
|
1120
|
-
if (!selected) throw new Error(`No model found matching queries ${queries.join(", ")}`);
|
|
1121
|
-
return selected;
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
// packages/safe-bash-command-llm/src/models-list.ts
|
|
1125
|
-
var modelsGroupHelp = "Usage: llm models [OPTIONS] COMMAND [ARGS]...\n\n Manage available models\n\nOptions:\n -h, --help Show this message and exit.\n\nCommands:\n list* List available models\n default Show or set the default model\n options Manage default options for models\n";
|
|
1126
|
-
var LlmModelsUsageError = class extends Error {
|
|
1127
|
-
constructor(message, usage = true) {
|
|
1128
|
-
super((usage ? "Usage: llm models list [OPTIONS]\nTry 'llm models list -h' for help.\n\n" : "") + `Error: ${message}`);
|
|
1129
|
-
}
|
|
1130
|
-
};
|
|
1131
|
-
function wrapDescription(description) {
|
|
1132
|
-
const lines = [];
|
|
1133
|
-
let line = "";
|
|
1134
|
-
for (const word of description.split(" ")) {
|
|
1135
|
-
if (!word) continue;
|
|
1136
|
-
if (line && line.length + word.length + 1 > 70) {
|
|
1137
|
-
lines.push(line);
|
|
1138
|
-
line = "";
|
|
1139
|
-
}
|
|
1140
|
-
line += (line ? " " : "") + word;
|
|
1141
|
-
}
|
|
1142
|
-
if (line) lines.push(line);
|
|
1143
|
-
return lines.join("\n ");
|
|
1144
|
-
}
|
|
1145
|
-
async function listLlmModels(context, service, tokens, emit, step, maxConfigurationBytes = Infinity) {
|
|
1146
|
-
const explicit = tokens[0] === "list";
|
|
1147
|
-
const terminator = tokens.indexOf("--");
|
|
1148
|
-
const groupFlags = terminator < 0 ? tokens : tokens.slice(0, terminator);
|
|
1149
|
-
if (!explicit && groupFlags.some((token) => token === "--help" || token.startsWith("-") && !token.startsWith("--") && token.slice(1).includes("h"))) {
|
|
1150
|
-
await emit(modelsGroupHelp);
|
|
1151
|
-
return;
|
|
1152
|
-
}
|
|
1153
|
-
const queries = [], selected = [];
|
|
1154
|
-
let schemas = false, tools = false, asyncModels = false, options = false, help = false, ended = false;
|
|
1155
|
-
const unexpected = [];
|
|
1156
|
-
const args = explicit ? tokens.slice(1) : tokens.filter((_, index) => index !== terminator);
|
|
1157
|
-
for (let index = 0; index < args.length; index++) {
|
|
1158
|
-
await step();
|
|
1159
|
-
const argument = args[index];
|
|
1160
|
-
if (ended) {
|
|
1161
|
-
unexpected.push(argument);
|
|
1162
|
-
continue;
|
|
1163
|
-
}
|
|
1164
|
-
if (argument === "--") {
|
|
1165
|
-
ended = true;
|
|
1166
|
-
continue;
|
|
1167
|
-
}
|
|
1168
|
-
if (argument === "--help" || argument === "-h") {
|
|
1169
|
-
help = true;
|
|
1170
|
-
continue;
|
|
1171
|
-
}
|
|
1172
|
-
if (argument === "--options") {
|
|
1173
|
-
options = true;
|
|
1174
|
-
continue;
|
|
1175
|
-
}
|
|
1176
|
-
if (argument === "--schemas") {
|
|
1177
|
-
schemas = true;
|
|
1178
|
-
continue;
|
|
1179
|
-
}
|
|
1180
|
-
if (argument === "--tools") {
|
|
1181
|
-
tools = true;
|
|
1182
|
-
continue;
|
|
1183
|
-
}
|
|
1184
|
-
if (argument === "--async") {
|
|
1185
|
-
asyncModels = true;
|
|
1186
|
-
continue;
|
|
1187
|
-
}
|
|
1188
|
-
if (!argument.startsWith("-") || argument === "-") {
|
|
1189
|
-
unexpected.push(argument);
|
|
1190
|
-
continue;
|
|
1191
|
-
}
|
|
1192
|
-
const equals = argument.indexOf("=");
|
|
1193
|
-
const long = argument.startsWith("--");
|
|
1194
|
-
const flag = long ? argument.slice(0, equals < 0 ? void 0 : equals) : argument.slice(0, 2);
|
|
1195
|
-
const attached = long ? equals < 0 ? void 0 : argument.slice(equals + 1) : argument.length > 2 ? argument.slice(2) : void 0;
|
|
1196
|
-
if (equals >= 0 && ["--schemas", "--tools", "--async", "--options", "--help", "-h"].includes(flag)) throw new LlmModelsUsageError(`Option '${flag}' does not take a value.`, false);
|
|
1197
|
-
if (!["-q", "--query", "-m", "--model"].includes(flag)) throw new LlmModelsUsageError(`No such option: ${flag}`);
|
|
1198
|
-
const value = attached ?? args[++index];
|
|
1199
|
-
if (value === void 0) throw new LlmModelsUsageError(`Option '${flag}' requires an argument.`, false);
|
|
1200
|
-
(flag === "-q" || flag === "--query" ? queries : selected).push(value);
|
|
1201
|
-
}
|
|
1202
|
-
if (help) {
|
|
1203
|
-
await emit("Usage: llm models list [OPTIONS]\n\n List available models\n\nOptions:\n --options Show options for each model, if available\n --async List async models\n --schemas List models that support schemas\n --tools List models that support tools\n -q, --query TEXT Search for models matching these strings\n -m, --model TEXT Specific model IDs\n -h, --help Show this message and exit.\n");
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
if (unexpected.length) throw new LlmModelsUsageError(`Got unexpected extra argument${unexpected.length === 1 ? "" : "s"} (${unexpected.join(" ")})`);
|
|
1207
|
-
const configuration = createLlmConfiguration(context, maxConfigurationBytes);
|
|
1208
|
-
const configuredAliases = await configuration.aliases();
|
|
1209
|
-
const shownDescriptions = /* @__PURE__ */ new Set();
|
|
1210
|
-
for (const { provider, model } of service.models) {
|
|
1211
|
-
await step();
|
|
1212
|
-
const aliases = getLlmModelAliases({ provider, model }, configuredAliases);
|
|
1213
|
-
const description = `${provider.name}: ${model.id}`;
|
|
1214
|
-
const terms = [description, ...aliases].map((value) => value.toLowerCase());
|
|
1215
|
-
if (!queries.every((query) => terms.some((term) => term.includes(query.toLowerCase())))) continue;
|
|
1216
|
-
if (selected.length && !selected.some((value) => value === model.id || aliases.includes(value))) continue;
|
|
1217
|
-
if (schemas && !model.capabilities?.includes("schema") || tools || asyncModels) continue;
|
|
1218
|
-
let output = description + (aliases.length ? ` (aliases: ${aliases.join(", ")})` : "");
|
|
1219
|
-
if (model.outputType) output += `
|
|
1220
|
-
Output type: ${model.outputType}`;
|
|
1221
|
-
if (options && Object.keys(model.options ?? {}).length) {
|
|
1222
|
-
output += "\n Options:";
|
|
1223
|
-
for (const [name, rule] of Object.entries(model.options)) {
|
|
1224
|
-
const type = { number: "float", integer: "int", boolean: "boolean", string: "str", object: "dict", array: "list" }[rule.type];
|
|
1225
|
-
output += `
|
|
1226
|
-
${name}: ${type}`;
|
|
1227
|
-
if (rule.description && !shownDescriptions.has(provider.name)) output += `
|
|
1228
|
-
${wrapDescription(rule.description)}`;
|
|
1229
|
-
}
|
|
1230
|
-
shownDescriptions.add(provider.name);
|
|
1231
|
-
}
|
|
1232
|
-
if (options && model.attachmentTypes?.length) output += `
|
|
1233
|
-
Attachment types:
|
|
1234
|
-
${[...model.attachmentTypes].sort().join(", ")}`;
|
|
1235
|
-
if (options && model.capabilities?.includes("schema")) output += "\n Features:\n - schemas";
|
|
1236
|
-
await emit(output + "\n");
|
|
1237
|
-
}
|
|
1238
|
-
if (!queries.length && !selected.length && !schemas && !options) {
|
|
1239
|
-
const configured = await configuration.defaultModel();
|
|
1240
|
-
let model = configured;
|
|
1241
|
-
if (model === void 0) {
|
|
1242
|
-
try {
|
|
1243
|
-
model = service.resolve().model.id;
|
|
1244
|
-
} catch {
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
if (model !== void 0) await emit(`Default: ${model}
|
|
1248
|
-
`);
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
// packages/safe-bash-command-llm/src/command.ts
|
|
1253
|
-
var llmReferenceVersion = "0.27.1";
|
|
1254
|
-
async function parse(length, text, step, admitBytes) {
|
|
1255
|
-
const parsed = { prompt: "", queries: [], params: {}, options: /* @__PURE__ */ Object.create(null), attachments: [] };
|
|
1256
|
-
const operands = [];
|
|
1257
|
-
let ended = false;
|
|
1258
|
-
for (let index = 0; index < length; index++) {
|
|
1259
|
-
await step();
|
|
1260
|
-
const argument = text(index);
|
|
1261
|
-
if (!ended && ["--no-log", "-n"].includes(argument)) continue;
|
|
1262
|
-
if (!ended && ["-x", "--extract", "--xl", "--extract-last"].includes(argument)) {
|
|
1263
|
-
parsed.extract = argument === "--xl" || argument === "--extract-last" ? "last" : parsed.extract ?? "first";
|
|
1264
|
-
parsed.noStream = true;
|
|
1265
|
-
continue;
|
|
1266
|
-
}
|
|
1267
|
-
if (!ended && (argument === "-u" || argument === "--usage")) {
|
|
1268
|
-
parsed.usage = true;
|
|
1269
|
-
continue;
|
|
1270
|
-
}
|
|
1271
|
-
if (!ended && argument === "--no-stream") {
|
|
1272
|
-
parsed.noStream = true;
|
|
1273
|
-
continue;
|
|
1274
|
-
}
|
|
1275
|
-
if (ended || !argument.startsWith("-") || argument === "-") {
|
|
1276
|
-
operands.push(argument);
|
|
1277
|
-
continue;
|
|
1278
|
-
}
|
|
1279
|
-
if (argument === "--") {
|
|
1280
|
-
ended = true;
|
|
1281
|
-
continue;
|
|
1282
|
-
}
|
|
1283
|
-
const equals = argument.indexOf("=");
|
|
1284
|
-
const long = argument.startsWith("--");
|
|
1285
|
-
const flag = long ? argument.slice(0, equals < 0 ? void 0 : equals) : argument.slice(0, 2);
|
|
1286
|
-
const attached = long ? equals < 0 ? void 0 : argument.slice(equals + 1) : argument.length > 2 ? argument.slice(2) : void 0;
|
|
1287
|
-
const take = () => {
|
|
1288
|
-
if (++index >= length) throw new Error(`Option ${flag} requires an argument`);
|
|
1289
|
-
return text(index);
|
|
1290
|
-
};
|
|
1291
|
-
if (!["-q", "--query", "-m", "--model", "-s", "--system", "-o", "--option", "-a", "--attachment", "--at", "--attachment-type", "-t", "--template", "--save", "-p", "--param", "--key", "--schema", "--schema-multi"].includes(flag)) throw new Error(`Unknown option: ${flag}`);
|
|
1292
|
-
const value = attached ?? take();
|
|
1293
|
-
if (flag === "-q" || flag === "--query") parsed.queries.push(value);
|
|
1294
|
-
else if (flag === "-t" || flag === "--template") parsed.template = value;
|
|
1295
|
-
else if (flag === "--schema") parsed.schema = value;
|
|
1296
|
-
else if (flag === "--schema-multi") parsed.schemaMulti = value;
|
|
1297
|
-
else if (flag === "--key") parsed.key = value;
|
|
1298
|
-
else if (flag === "--save") parsed.save = value;
|
|
1299
|
-
else if (flag === "-p" || flag === "--param") Object.defineProperty(parsed.params, value, { value: take(), enumerable: true, configurable: true, writable: true });
|
|
1300
|
-
else if (flag === "-m" || flag === "--model") parsed.model = value;
|
|
1301
|
-
else if (flag === "-s" || flag === "--system") parsed.system = value;
|
|
1302
|
-
else if (flag === "-o" || flag === "--option") parsed.options[value] = take();
|
|
1303
|
-
else if (flag === "--at" || flag === "--attachment-type") parsed.attachments.push({ path: value, mimeType: take() });
|
|
1304
|
-
else parsed.attachments.push({ path: value });
|
|
1305
|
-
}
|
|
1306
|
-
if (operands.length > 1) admitBytes(operands.length - 1);
|
|
1307
|
-
parsed.prompt = operands.join(" ");
|
|
1308
|
-
return parsed;
|
|
1309
|
-
}
|
|
1310
|
-
async function interrupted(start, signal) {
|
|
1311
|
-
signal.throwIfAborted();
|
|
1312
|
-
return new Promise((resolve, reject) => {
|
|
1313
|
-
const aborted = () => reject(signal.reason);
|
|
1314
|
-
signal.addEventListener("abort", aborted, { once: true });
|
|
1315
|
-
Promise.resolve().then(() => {
|
|
1316
|
-
signal.throwIfAborted();
|
|
1317
|
-
return start();
|
|
1318
|
-
}).then(
|
|
1319
|
-
(value) => {
|
|
1320
|
-
signal.removeEventListener("abort", aborted);
|
|
1321
|
-
resolve(value);
|
|
1322
|
-
},
|
|
1323
|
-
(error) => {
|
|
1324
|
-
signal.removeEventListener("abort", aborted);
|
|
1325
|
-
reject(error);
|
|
1326
|
-
}
|
|
1327
|
-
);
|
|
1328
|
-
});
|
|
1329
|
-
}
|
|
1330
|
-
async function execute(context, service, limits, templateLoaderOptions, collections) {
|
|
1331
|
-
context.signal.throwIfAborted();
|
|
1332
|
-
const controller = new AbortController();
|
|
1333
|
-
const operation = createOutputOperation(context, context.stdout);
|
|
1334
|
-
const signal = AbortSignal.any([operation.signal, controller.signal]);
|
|
1335
|
-
inheritYieldCheckpoint2(context.signal, signal);
|
|
1336
|
-
let iterator;
|
|
1337
|
-
let responseUsage;
|
|
1338
|
-
let closed = false;
|
|
1339
|
-
let ended = false;
|
|
1340
|
-
operation.registerCleanup(() => {
|
|
1341
|
-
if (closed) return;
|
|
1342
|
-
closed = true;
|
|
1343
|
-
controller.abort(new Error("llm request closed"));
|
|
1344
|
-
if (!ended && iterator) {
|
|
1345
|
-
const resource = iterator;
|
|
1346
|
-
void Promise.resolve().then(() => resource.return?.()).catch(() => {
|
|
1347
|
-
});
|
|
1348
|
-
}
|
|
1349
|
-
});
|
|
1350
|
-
let work = 0;
|
|
1351
|
-
const step = async () => {
|
|
1352
|
-
signal.throwIfAborted();
|
|
1353
|
-
if (closed) throw new Error("LLM invocation is closed");
|
|
1354
|
-
work++;
|
|
1355
|
-
if (work % 256 === 0) await yieldTurn4(signal);
|
|
1356
|
-
};
|
|
1357
|
-
let outputSpool;
|
|
1358
|
-
let outputBytes = 0;
|
|
1359
|
-
let writing = false;
|
|
1360
|
-
const write = async (chunk) => {
|
|
1361
|
-
if (chunk.byteLength > (limits?.maxOutputBytes ?? Infinity) - outputBytes) throw new FsError5("EFBIG", { message: "llm output byte limit exceeded" });
|
|
1362
|
-
outputBytes += chunk.byteLength;
|
|
1363
|
-
if (outputSpool) {
|
|
1364
|
-
await outputSpool.write(chunk);
|
|
1365
|
-
return;
|
|
1366
|
-
}
|
|
1367
|
-
writing = true;
|
|
1368
|
-
await operation.output.write(chunk);
|
|
1369
|
-
writing = false;
|
|
1370
|
-
};
|
|
1371
|
-
const emitText = async (text) => {
|
|
1372
|
-
for (let offset = 0; offset < text.length; ) {
|
|
1373
|
-
await step();
|
|
1374
|
-
let end = Math.min(text.length, offset + 16384);
|
|
1375
|
-
const last = text.charCodeAt(end - 1);
|
|
1376
|
-
if (end < text.length && last >= 55296 && last <= 56319) end--;
|
|
1377
|
-
await write(new TextEncoder().encode(text.slice(offset, end)));
|
|
1378
|
-
offset = end;
|
|
1379
|
-
}
|
|
1380
|
-
};
|
|
1381
|
-
const input = createLlmInputBudget(limits);
|
|
1382
|
-
let shellInputBytes = 0;
|
|
1383
|
-
const admitInput = (size, materialized = false) => {
|
|
1384
|
-
context.inputBudget?.check(shellInputBytes + size);
|
|
1385
|
-
input.admit(size, materialized);
|
|
1386
|
-
shellInputBytes += size;
|
|
1387
|
-
};
|
|
1388
|
-
const admitBuffered = (size) => input.admit(size, true);
|
|
1389
|
-
const invocationLoaders = { ...templateLoaderOptions, get maxBytes() {
|
|
1390
|
-
return input.remaining(true);
|
|
1391
|
-
}, admitBytes: admitBuffered };
|
|
1392
|
-
try {
|
|
1393
|
-
const argumentsValue = getCommandArguments(context);
|
|
1394
|
-
const argumentText = (index) => {
|
|
1395
|
-
const value = argumentsValue.values[index];
|
|
1396
|
-
if (value === void 0) throw new Error("Missing option argument");
|
|
1397
|
-
input.admit(shellValueByteLength2(value), true);
|
|
1398
|
-
const bytes = argumentsValue.bytes(index);
|
|
1399
|
-
if (!bytes) throw new Error("Missing option argument");
|
|
1400
|
-
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
1401
|
-
};
|
|
1402
|
-
if (argumentsValue.args[0] === "--version") {
|
|
1403
|
-
argumentText(0);
|
|
1404
|
-
await emitText(`llm, version ${llmReferenceVersion}
|
|
1405
|
-
`);
|
|
1406
|
-
return { exitCode: 0 };
|
|
1407
|
-
}
|
|
1408
|
-
if (argumentsValue.args[0]?.startsWith("--version=")) {
|
|
1409
|
-
argumentText(0);
|
|
1410
|
-
await writeDiagnostic(context.stderr, "Error: Option '--version' does not take a value.\n", signal);
|
|
1411
|
-
return { exitCode: 2 };
|
|
1412
|
-
}
|
|
1413
|
-
if (argumentsValue.args.length === 1 && ["--help", "-h"].includes(argumentsValue.args[0])) {
|
|
1414
|
-
argumentText(0);
|
|
1415
|
-
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, -u/--usage; -- ends options\n");
|
|
1416
|
-
return { exitCode: 0 };
|
|
1417
|
-
}
|
|
1418
|
-
if (argumentsValue.args.length === 2 && argumentsValue.args[0] === "models" && ["--help", "-h"].includes(argumentsValue.args[1])) {
|
|
1419
|
-
argumentText(0);
|
|
1420
|
-
argumentText(1);
|
|
1421
|
-
await emitText(modelsGroupHelp);
|
|
1422
|
-
return { exitCode: 0 };
|
|
1423
|
-
}
|
|
1424
|
-
if (argumentsValue.args[0] === "schemas" && argumentsValue.args[1] !== "dsl") {
|
|
1425
|
-
await writeDiagnostic(context.stderr, "Error: Stored schema history is host-owned. Use an inline schema, file, template, or 'llm schemas dsl'.\n", signal);
|
|
1426
|
-
return { exitCode: 2 };
|
|
1427
|
-
}
|
|
1428
|
-
if (argumentsValue.args[0] === "schemas" && argumentsValue.args[1] === "dsl") {
|
|
1429
|
-
const tokens = Array.from({ length: argumentsValue.args.length - 2 }, (_, index) => argumentText(index + 2));
|
|
1430
|
-
const usage = "Usage: llm schemas dsl [OPTIONS] INPUT\n";
|
|
1431
|
-
if (tokens.includes("--help") || tokens.includes("-h")) {
|
|
1432
|
-
await emitText(usage + "\n Convert LLM's schema DSL to a JSON schema\n\n llm schema dsl 'name, age int, bio: their bio'\n\nOptions:\n --multi Wrap in an array\n -h, --help Show this message and exit.\n");
|
|
1433
|
-
return { exitCode: 0 };
|
|
1434
|
-
}
|
|
1435
|
-
let multi = false, optionsEnded = false;
|
|
1436
|
-
const inputs = [];
|
|
1437
|
-
let failure;
|
|
1438
|
-
for (const token of tokens) {
|
|
1439
|
-
await step();
|
|
1440
|
-
if (!optionsEnded && token === "--") optionsEnded = true;
|
|
1441
|
-
else if (!optionsEnded && token === "--multi") multi = true;
|
|
1442
|
-
else if (!optionsEnded && token.startsWith("-") && token !== "-") {
|
|
1443
|
-
failure = `No such option: ${token}`;
|
|
1444
|
-
break;
|
|
1445
|
-
} else inputs.push(token);
|
|
1446
|
-
}
|
|
1447
|
-
failure ??= inputs.length === 0 ? "Missing argument 'INPUT'." : inputs.length > 1 ? `Got unexpected extra argument (${inputs[1]})` : void 0;
|
|
1448
|
-
if (failure) {
|
|
1449
|
-
await writeDiagnostic(context.stderr, usage + "Try 'llm schemas dsl -h' for help.\n\nError: " + failure + "\n", signal);
|
|
1450
|
-
return { exitCode: 2 };
|
|
1451
|
-
}
|
|
1452
|
-
await emitText(JSON.stringify(parseLlmSchemaDsl(inputs[0], multi), null, 2) + "\n");
|
|
1453
|
-
return { exitCode: 0 };
|
|
1454
|
-
}
|
|
1455
|
-
if (argumentsValue.args[0] === "collections" || argumentsValue.args[0] === "similar" || argumentsValue.args[0] === "embed-multi" || collections && argumentsValue.args[0] === "embed") {
|
|
1456
|
-
const tokens = Array.from({ length: argumentsValue.args.length - 1 }, (_, index) => argumentText(index + 1));
|
|
1457
|
-
if (!collections) {
|
|
1458
|
-
await writeDiagnostic(context.stderr, "Error: Collection storage is not configured\n", signal);
|
|
1459
|
-
return { exitCode: 1 };
|
|
1460
|
-
}
|
|
1461
|
-
return { exitCode: await collections.execute({ context: { ...context, signal }, service, command: argumentsValue.args[0], tokens, write, diagnostic: (text2) => writeDiagnostic(context.stderr, text2, signal), step, admit: admitInput, maxConfigurationBytes: limits?.maxConfigurationBytes ?? Infinity, maxInputBytes: limits?.maxInputBytes ?? Infinity }) };
|
|
1462
|
-
}
|
|
1463
|
-
if (argumentsValue.args[0] === "embed") {
|
|
1464
|
-
const tokens = Array.from({ length: argumentsValue.args.length - 1 }, (_, index) => argumentText(index + 1));
|
|
1465
|
-
return { exitCode: await embeddingCommand({ ...context, signal }, service, tokens, write, (text2) => writeDiagnostic(context.stderr, text2, signal), step, admitInput, limits?.maxConfigurationBytes) };
|
|
1466
|
-
}
|
|
1467
|
-
if (argumentsValue.args[0] === "embed-models") {
|
|
1468
|
-
const tokens = Array.from({ length: argumentsValue.args.length - 1 }, (_, index) => argumentText(index + 1));
|
|
1469
|
-
return { exitCode: await embeddingModelsCommand({ ...context, signal }, service, tokens, emitText, (text2) => writeDiagnostic(context.stderr, text2, signal), step, limits?.maxConfigurationBytes) };
|
|
1470
|
-
}
|
|
1471
|
-
if (argumentsValue.args[0] === "templates") {
|
|
1472
|
-
let exitCode = 0;
|
|
1473
|
-
try {
|
|
1474
|
-
exitCode = await createLlmTemplateStore(context, invocationLoaders).command(Array.from({ length: argumentsValue.args.length - 1 }, (_, index) => argumentText(index + 1)), emitText, (text2) => writeDiagnostic(context.stderr, text2, signal));
|
|
1475
|
-
} catch (error) {
|
|
1476
|
-
throw new Error(`Error: ${error instanceof Error ? error.message : "Template failed"}`);
|
|
1477
|
-
}
|
|
1478
|
-
return { exitCode };
|
|
1479
|
-
}
|
|
1480
|
-
const configurationInvocation = argumentsValue.args[0] === "keys" || argumentsValue.args[0] === "aliases" || argumentsValue.args[0] === "models" && ["default", "options"].includes(argumentsValue.args[1] ?? "") || argumentsValue.args[0] === "--version";
|
|
1481
|
-
if (configurationInvocation) {
|
|
1482
|
-
try {
|
|
1483
|
-
const tokens = Array.from({ length: argumentsValue.args.length }, (_, index) => argumentText(index));
|
|
1484
|
-
if (await configurationCommand(context, service, tokens, emitText, (text2) => writeDiagnostic(context.stderr, text2, signal), limits?.maxConfigurationBytes)) return { exitCode: 0 };
|
|
1485
|
-
} catch (error) {
|
|
1486
|
-
throw new Error(`Error: ${error instanceof Error ? error.message : "Configuration failed"}`);
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
if (argumentsValue.args[0] === "models") {
|
|
1490
|
-
await listLlmModels(context, service, Array.from({ length: argumentsValue.args.length - 1 }, (_, index) => argumentText(index + 1)), emitText, step, limits?.maxConfigurationBytes);
|
|
1491
|
-
return { exitCode: 0 };
|
|
1492
|
-
}
|
|
1493
|
-
const promptOffset = argumentsValue.args[0] === "prompt" ? 1 : 0;
|
|
1494
|
-
const args = await parse(argumentsValue.args.length - promptOffset, (index) => argumentText(index + promptOffset), step, admitBuffered);
|
|
1495
|
-
const configuration = createLlmConfiguration(context, limits?.maxConfigurationBytes, invocationLoaders);
|
|
1496
|
-
if (args.model === void 0 && args.queries.length) {
|
|
1497
|
-
try {
|
|
1498
|
-
args.model = (await selectLlmModelByQuery(service.models, args.queries, await configuration.aliases(), signal)).model.id;
|
|
1499
|
-
} catch (error) {
|
|
1500
|
-
throw new Error(`Error: ${error instanceof Error ? error.message : "Model selection failed"}`);
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
const templateStore = createLlmTemplateStore(context, invocationLoaders);
|
|
1504
|
-
const schemaInput = args.schemaMulti ?? args.schema;
|
|
1505
|
-
let schema = schemaInput ? await resolveLlmSchemaInput({ ...context, signal }, schemaInput, {
|
|
1506
|
-
multi: Boolean(args.schemaMulti),
|
|
1507
|
-
maxBytes: input.remaining(true),
|
|
1508
|
-
admitBytes: admitBuffered,
|
|
1509
|
-
loadTemplate: (name) => templateStore.load(name)
|
|
1510
|
-
}) : void 0;
|
|
1511
|
-
if (args.save && args.template) throw new Error("Error: --save cannot be used with --template");
|
|
1512
|
-
let stored;
|
|
1513
|
-
try {
|
|
1514
|
-
stored = args.template === void 0 ? void 0 : await templateStore.load(args.template);
|
|
1515
|
-
} catch (error) {
|
|
1516
|
-
throw new Error(`Error: ${error instanceof Error ? error.message : "Invalid template"}`);
|
|
1517
|
-
}
|
|
1518
|
-
if (stored) {
|
|
1519
|
-
if (stored.schema_object) schema = stored.schema_object;
|
|
1520
|
-
try {
|
|
1521
|
-
validateLlmTemplateParameters(stored, args.params);
|
|
1522
|
-
} catch (error) {
|
|
1523
|
-
throw new Error(`Error: ${error instanceof Error ? error.message : "Invalid template"}`);
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
const selected = args.model ?? stored?.model ?? (args.save ? void 0 : await configuration.defaultModel());
|
|
1527
|
-
const model = selected === void 0 ? void 0 : await configuration.resolveAlias(selected);
|
|
1528
|
-
const entry = args.save && selected === void 0 ? void 0 : service.resolve(model);
|
|
1529
|
-
const streamed = entry !== void 0 && service.streamSources !== void 0 && entry.provider.completeSources !== void 0 && entry.model.inputSources !== false;
|
|
1530
|
-
const stagePrompt = streamed && stored === void 0 && args.save === void 0;
|
|
1531
|
-
let promptSpool;
|
|
1532
|
-
let stdinBytes = 0;
|
|
1533
|
-
const fragments = [];
|
|
1534
|
-
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
1535
|
-
const templateUsesInput = stored !== void 0 && llmTemplateUsesInput(stored);
|
|
1536
|
-
if (stored === void 0 || templateUsesInput) {
|
|
1537
|
-
const stdin = await operation.acquire(() => context.stdinInput ? { next: () => context.stdinInput.read(Math.min(65536, input.remaining(!stagePrompt) + 1), signal) } : context.stdin[Symbol.asyncIterator](), async (iterator2) => {
|
|
1538
|
-
await iterator2.return?.();
|
|
1539
|
-
});
|
|
1540
|
-
while (true) {
|
|
1541
|
-
await step();
|
|
1542
|
-
const result = await interrupted(() => stdin.next(), signal);
|
|
1543
|
-
signal.throwIfAborted();
|
|
1544
|
-
if (result.done) break;
|
|
1545
|
-
const chunk = result.value;
|
|
1546
|
-
if (!(chunk instanceof Uint8Array)) throw new TypeError("Byte sources must yield Uint8Array chunks");
|
|
1547
|
-
admitInput(chunk.byteLength, !stagePrompt);
|
|
1548
|
-
stdinBytes += chunk.byteLength;
|
|
1549
|
-
if (stagePrompt) {
|
|
1550
|
-
for (let offset = 0; offset < chunk.byteLength; offset += 16384) {
|
|
1551
|
-
await step();
|
|
1552
|
-
decoder.decode(chunk.subarray(offset, Math.min(offset + 16384, chunk.byteLength)), { stream: true });
|
|
1553
|
-
}
|
|
1554
|
-
if (chunk.byteLength) {
|
|
1555
|
-
promptSpool ??= await operation.acquire(() => createLlmSpool(context.fs, context.cwd, signal, "input"), (spool) => spool.close());
|
|
1556
|
-
await promptSpool.write(chunk);
|
|
1557
|
-
}
|
|
1558
|
-
} else fragments.push(decoder.decode(chunk, { stream: true }));
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
const decoderTail = decoder.decode();
|
|
1562
|
-
if (!stagePrompt) fragments.push(decoderTail);
|
|
1563
|
-
if (stdinBytes && args.prompt) input.admit(1, !stagePrompt);
|
|
1564
|
-
if (promptSpool && args.prompt) {
|
|
1565
|
-
if (stdinBytes) await promptSpool.write(new TextEncoder().encode(" "));
|
|
1566
|
-
for (let start = 0; start < args.prompt.length; ) {
|
|
1567
|
-
await step();
|
|
1568
|
-
let end = Math.min(args.prompt.length, start + 8192);
|
|
1569
|
-
const last = args.prompt.charCodeAt(end - 1);
|
|
1570
|
-
if (end < args.prompt.length && last >= 55296 && last <= 56319) end--;
|
|
1571
|
-
await promptSpool.write(new TextEncoder().encode(args.prompt.slice(start, end)));
|
|
1572
|
-
start = end;
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
const content = fragments.join("");
|
|
1576
|
-
let prompt = content && args.prompt ? `${content} ${args.prompt}` : content || args.prompt;
|
|
1577
|
-
if (args.save) {
|
|
1578
|
-
const attachments2 = args.attachments.filter((item) => item.mimeType === void 0).map((item) => item.path);
|
|
1579
|
-
const attachmentTypes = args.attachments.filter((item) => item.mimeType !== void 0).map((item) => ({ type: item.mimeType, value: item.path }));
|
|
1580
|
-
const saved = {
|
|
1581
|
-
...schema === void 0 ? {} : { schema_object: schema },
|
|
1582
|
-
...args.model === void 0 ? {} : { model: entry.model.id },
|
|
1583
|
-
...prompt ? { prompt } : {},
|
|
1584
|
-
...args.system === void 0 ? {} : { system: args.system },
|
|
1585
|
-
...args.extract === "last" ? { extract_last: true } : args.extract === "first" ? { extract: true } : {},
|
|
1586
|
-
...Object.keys(args.params).length ? { defaults: args.params } : {},
|
|
1587
|
-
...Object.keys(args.options).length ? { options: args.options } : {},
|
|
1588
|
-
...attachments2.length ? { attachments: attachments2 } : {},
|
|
1589
|
-
...attachmentTypes.length ? { attachment_types: attachmentTypes } : {}
|
|
1590
|
-
};
|
|
1591
|
-
await templateStore.save(args.save, saved);
|
|
1592
|
-
return { exitCode: 0 };
|
|
1593
|
-
}
|
|
1594
|
-
if (stored) {
|
|
1595
|
-
try {
|
|
1596
|
-
if (!args.extract && (stored.extract_last || stored.extract)) {
|
|
1597
|
-
args.extract = stored.extract_last ? "last" : "first";
|
|
1598
|
-
args.noStream = true;
|
|
1599
|
-
}
|
|
1600
|
-
const evaluated = evaluateLlmTemplate(stored, templateUsesInput ? prompt : "", args.params, input.admitText);
|
|
1601
|
-
if (evaluated.prompt && !templateUsesInput && args.prompt) input.admit(1, true);
|
|
1602
|
-
if (evaluated.prompt) prompt = !templateUsesInput && args.prompt ? `${evaluated.prompt}
|
|
1603
|
-
${args.prompt}` : evaluated.prompt;
|
|
1604
|
-
if (args.system === void 0 && evaluated.system !== void 0) args.system = evaluated.system;
|
|
1605
|
-
} catch (error) {
|
|
1606
|
-
throw new Error(`Error: ${error instanceof Error ? error.message : "Invalid template"}`);
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
if (!entry) throw new Error("No model selected; use --model or configure defaultModel");
|
|
1610
|
-
args.options = { ...await configuration.modelOptions(entry.model.id), ...stored?.options, ...args.options };
|
|
1611
|
-
args.attachments = [
|
|
1612
|
-
...(stored?.attachments ?? []).map((path) => ({ path })),
|
|
1613
|
-
...args.attachments.filter((item) => item.mimeType === void 0),
|
|
1614
|
-
...(stored?.attachment_types ?? []).map((item) => ({ path: item.value, mimeType: item.type })),
|
|
1615
|
-
...args.attachments.filter((item) => item.mimeType !== void 0)
|
|
1616
|
-
];
|
|
1617
|
-
const attachments = [];
|
|
1618
|
-
const sourceAttachments = [];
|
|
1619
|
-
const textSource = (value) => ({
|
|
1620
|
-
async dispose() {
|
|
1621
|
-
},
|
|
1622
|
-
bytes: { async *[Symbol.asyncIterator]() {
|
|
1623
|
-
for (let offset = 0; offset < value.length; ) {
|
|
1624
|
-
await step();
|
|
1625
|
-
let end = Math.min(value.length, offset + 16384);
|
|
1626
|
-
const last = value.charCodeAt(end - 1);
|
|
1627
|
-
if (end < value.length && last >= 55296 && last <= 56319) end--;
|
|
1628
|
-
yield new TextEncoder().encode(value.slice(offset, end));
|
|
1629
|
-
offset = end;
|
|
1630
|
-
}
|
|
1631
|
-
} }
|
|
1632
|
-
});
|
|
1633
|
-
for (const attachment of args.attachments) {
|
|
1634
|
-
await step();
|
|
1635
|
-
if (attachment.path.includes("://")) {
|
|
1636
|
-
const reference = await resolveUrlAttachment({ ...context, signal }, attachment.path, attachment.mimeType);
|
|
1637
|
-
if (attachment.mimeType === void 0) admitInput(shellValueByteLength2(reference.mimeType), true);
|
|
1638
|
-
if (!acceptsMimeType(entry.model.attachmentTypes ?? [], reference.mimeType)) throw new Error(`Model ${entry.model.id} does not accept ${reference.mimeType}`);
|
|
1639
|
-
if (acceptsMimeType(["image/*"], reference.mimeType)) {
|
|
1640
|
-
if (!entry.model.attachmentUrls) throw new Error(`Model ${entry.model.id} does not support URL attachments`);
|
|
1641
|
-
if (streamed) sourceAttachments.push(reference);
|
|
1642
|
-
else attachments.push(reference);
|
|
1643
|
-
} else {
|
|
1644
|
-
const fetch = context.capabilities?.fetch;
|
|
1645
|
-
if (!fetch) throw new Error("Attachment URL loading is not configured");
|
|
1646
|
-
const source = await operation.acquire(() => createLlmUrlSource({
|
|
1647
|
-
url: reference.url,
|
|
1648
|
-
fetch,
|
|
1649
|
-
signal,
|
|
1650
|
-
maxBytes: input.remaining(!streamed),
|
|
1651
|
-
admitBytes: (bytes2) => admitInput(bytes2, !streamed)
|
|
1652
|
-
}), (source2) => source2.dispose());
|
|
1653
|
-
const identity = acceptsMimeType(["application/pdf"], reference.mimeType) ? { id: await getLlmAttachmentUrlId(reference.url, signal) } : {};
|
|
1654
|
-
if (streamed) sourceAttachments.push({ mimeType: reference.mimeType, source, ...identity });
|
|
1655
|
-
else {
|
|
1656
|
-
const chunks = [];
|
|
1657
|
-
let size = 0;
|
|
1658
|
-
for await (const chunk of source.bytes) {
|
|
1659
|
-
chunks.push(chunk);
|
|
1660
|
-
size += chunk.length;
|
|
1661
|
-
}
|
|
1662
|
-
const bytes2 = new Uint8Array(size);
|
|
1663
|
-
let offset = 0;
|
|
1664
|
-
for (const chunk of chunks) {
|
|
1665
|
-
bytes2.set(chunk, offset);
|
|
1666
|
-
offset += chunk.length;
|
|
1667
|
-
}
|
|
1668
|
-
attachments.push({ mimeType: reference.mimeType, bytes: bytes2, ...identity });
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
continue;
|
|
1672
|
-
}
|
|
1673
|
-
const path = pathOf3(context, attachment.path);
|
|
1674
|
-
const stat = await interrupted(() => context.fs.stat(path, { signal }), signal);
|
|
1675
|
-
context.inputBudget?.check(shellInputBytes + stat.size);
|
|
1676
|
-
input.check(stat.size, !streamed);
|
|
1677
|
-
const remainingBytes = Math.min(
|
|
1678
|
-
input.remaining(!streamed),
|
|
1679
|
-
(context.inputBudget?.maxBytes ?? Infinity) - shellInputBytes
|
|
1680
|
-
);
|
|
1681
|
-
if (streamed) {
|
|
1682
|
-
const source = await operation.acquire(() => fileSource({ fs: context.fs, path, signal, maxBytes: remainingBytes, expectedStat: stat }), (source2) => source2.dispose());
|
|
1683
|
-
const chunks = source.bytes[Symbol.asyncIterator]();
|
|
1684
|
-
const first = await interrupted(() => chunks.next(), signal);
|
|
1685
|
-
const mimeType2 = attachment.mimeType ?? sniffMimeType(path, first.done ? new Uint8Array() : first.value);
|
|
1686
|
-
if (!acceptsMimeType(entry.model.attachmentTypes ?? [], mimeType2)) throw new Error(`Model ${entry.model.id} does not accept ${mimeType2}`);
|
|
1687
|
-
admitInput(stat.size);
|
|
1688
|
-
let closed2 = false, consumed = false;
|
|
1689
|
-
sourceAttachments.push({ mimeType: mimeType2, source: {
|
|
1690
|
-
async dispose() {
|
|
1691
|
-
closed2 = true;
|
|
1692
|
-
await source.dispose();
|
|
1693
|
-
},
|
|
1694
|
-
bytes: { async *[Symbol.asyncIterator]() {
|
|
1695
|
-
if (closed2 || consumed) throw new FsError5("EBADF", { message: "LLM attachment source is closed" });
|
|
1696
|
-
consumed = true;
|
|
1697
|
-
signal.throwIfAborted();
|
|
1698
|
-
if (!first.done) yield first.value;
|
|
1699
|
-
while (true) {
|
|
1700
|
-
if (closed2) throw new FsError5("EBADF", { message: "LLM attachment source is closed" });
|
|
1701
|
-
const next = await interrupted(() => chunks.next(), signal);
|
|
1702
|
-
if (closed2) throw new FsError5("EBADF", { message: "LLM attachment source is closed" });
|
|
1703
|
-
if (next.done) break;
|
|
1704
|
-
yield next.value;
|
|
1705
|
-
}
|
|
1706
|
-
} }
|
|
1707
|
-
} });
|
|
1708
|
-
continue;
|
|
1709
|
-
}
|
|
1710
|
-
const bytes = await interrupted(() => context.fs.readFile(path, {
|
|
1711
|
-
signal,
|
|
1712
|
-
...remainingBytes === Infinity ? {} : { maxBytes: remainingBytes }
|
|
1713
|
-
}), signal);
|
|
1714
|
-
signal.throwIfAborted();
|
|
1715
|
-
if (!(bytes instanceof Uint8Array)) throw new TypeError("Attachment read must return Uint8Array");
|
|
1716
|
-
admitInput(bytes.byteLength, true);
|
|
1717
|
-
const mimeType = attachment.mimeType ?? sniffMimeType(path, bytes);
|
|
1718
|
-
if (!acceptsMimeType(entry.model.attachmentTypes ?? [], mimeType)) throw new Error(`Model ${entry.model.id} does not accept ${mimeType}`);
|
|
1719
|
-
attachments.push({ mimeType, bytes: new Uint8Array(bytes), ...acceptsMimeType(["application/pdf"], mimeType) && !bytes.length ? { id: await attachmentBytesId(bytes, signal) } : {} });
|
|
1720
|
-
}
|
|
1721
|
-
const resolvedKey = args.key === void 0 ? void 0 : await configuration.resolveKey(args.key);
|
|
1722
|
-
const request = {
|
|
1723
|
-
...schema === void 0 ? {} : { schema },
|
|
1724
|
-
model: entry.model.id,
|
|
1725
|
-
prompt,
|
|
1726
|
-
...args.system === void 0 ? {} : { system: args.system },
|
|
1727
|
-
attachments,
|
|
1728
|
-
options: args.options,
|
|
1729
|
-
signal,
|
|
1730
|
-
stream: !args.noStream,
|
|
1731
|
-
...resolvedKey === void 0 ? {} : { key: resolvedKey }
|
|
1732
|
-
};
|
|
1733
|
-
signal.throwIfAborted();
|
|
1734
|
-
if (args.noStream) outputSpool = await operation.acquire(() => createLlmSpool(context.fs, context.cwd, signal), (spool) => spool.close());
|
|
1735
|
-
if (streamed) {
|
|
1736
|
-
const events = service.streamSources({
|
|
1737
|
-
model: request.model,
|
|
1738
|
-
options: request.options,
|
|
1739
|
-
signal,
|
|
1740
|
-
stream: request.stream,
|
|
1741
|
-
prompt: promptSpool ? { bytes: promptSpool.replay(), dispose: promptSpool.close } : textSource(prompt),
|
|
1742
|
-
...schema === void 0 ? {} : { schema },
|
|
1743
|
-
...args.system === void 0 ? {} : { system: textSource(args.system) },
|
|
1744
|
-
...resolvedKey === void 0 ? {} : { key: resolvedKey },
|
|
1745
|
-
attachments: sourceAttachments
|
|
1746
|
-
});
|
|
1747
|
-
iterator = (async function* () {
|
|
1748
|
-
for await (const event of events) {
|
|
1749
|
-
if (event.type === "text") yield event.text;
|
|
1750
|
-
else if (event.type === "bytes") yield event.data;
|
|
1751
|
-
else responseUsage = event.response.usage;
|
|
1752
|
-
}
|
|
1753
|
-
})()[Symbol.asyncIterator]();
|
|
1754
|
-
} else iterator = service.complete(request)[Symbol.asyncIterator]();
|
|
1755
|
-
const text = (entry.model.outputType ?? "text/plain").toLowerCase().startsWith("text/");
|
|
1756
|
-
let pendingSurrogate = "";
|
|
1757
|
-
while (true) {
|
|
1758
|
-
await step();
|
|
1759
|
-
const result = await interrupted(() => iterator.next(), signal);
|
|
1760
|
-
signal.throwIfAborted();
|
|
1761
|
-
if (result.done) {
|
|
1762
|
-
ended = true;
|
|
1763
|
-
if (result.value?.usage) responseUsage = result.value.usage;
|
|
1764
|
-
break;
|
|
1765
|
-
}
|
|
1766
|
-
if (text ? typeof result.value !== "string" : !(result.value instanceof Uint8Array)) throw new Error(`Provider ${entry.provider.name} returned a response chunk incompatible with ${entry.model.outputType ?? "text/plain"}`);
|
|
1767
|
-
if (typeof result.value === "string") {
|
|
1768
|
-
let chunk = pendingSurrogate + result.value;
|
|
1769
|
-
const last = chunk.charCodeAt(chunk.length - 1);
|
|
1770
|
-
pendingSurrogate = last >= 55296 && last <= 56319 ? chunk.slice(-1) : "";
|
|
1771
|
-
if (pendingSurrogate) chunk = chunk.slice(0, -1);
|
|
1772
|
-
if (chunk) await emitText(chunk);
|
|
1773
|
-
} else await write(result.value);
|
|
1774
|
-
}
|
|
1775
|
-
if (text) {
|
|
1776
|
-
if (pendingSurrogate) await emitText(pendingSurrogate);
|
|
1777
|
-
if (!args.extract) await write(Uint8Array.of(10));
|
|
1778
|
-
}
|
|
1779
|
-
if (outputSpool) for await (const chunk of outputSpool.replay(args.extract && text ? async (reader) => {
|
|
1780
|
-
const range = await findExtractedRange(reader, args.extract === "last", signal);
|
|
1781
|
-
return range && range.end > range.start ? range : void 0;
|
|
1782
|
-
} : void 0)) {
|
|
1783
|
-
writing = true;
|
|
1784
|
-
await operation.output.write(chunk);
|
|
1785
|
-
writing = false;
|
|
1786
|
-
}
|
|
1787
|
-
if (args.extract && text) await operation.output.write(Uint8Array.of(10));
|
|
1788
|
-
if (args.usage) {
|
|
1789
|
-
await writeDiagnostic(context.stderr, "Token usage: ", signal);
|
|
1790
|
-
await pipeBytes(serializeLlmTokenUsage(responseUsage, signal), context.stderr, signal);
|
|
1791
|
-
await writeDiagnostic(context.stderr, "\n", signal);
|
|
1792
|
-
}
|
|
1793
|
-
return { exitCode: 0 };
|
|
1794
|
-
} catch (error) {
|
|
1795
|
-
context.signal.throwIfAborted();
|
|
1796
|
-
operation.signal.throwIfAborted();
|
|
1797
|
-
controller.abort(error);
|
|
1798
|
-
if (writing) throw error;
|
|
1799
|
-
await operation.close();
|
|
1800
|
-
await writeDiagnostic(context.stderr, `${error instanceof Error || error instanceof TypeError ? error.message.slice(0, 4096) : "llm provider failed"}
|
|
1801
|
-
`, context.signal);
|
|
1802
|
-
return { exitCode: error instanceof LlmModelsUsageError ? 2 : 1 };
|
|
1803
|
-
} finally {
|
|
1804
|
-
controller.abort(new Error("llm request closed"));
|
|
1805
|
-
await operation.close();
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
function createLlmCommand(options = {}) {
|
|
1809
|
-
for (const [name, value] of Object.entries(options.limits ?? {})) {
|
|
1810
|
-
if (value === void 0 || value === Infinity) continue;
|
|
1811
|
-
if (!Number.isSafeInteger(value) || value < 0) throw new TypeError(`Invalid llm limit: ${name}`);
|
|
1812
|
-
}
|
|
1813
|
-
const limits = options.limits === void 0 ? void 0 : Object.freeze({ ...options.limits });
|
|
1814
|
-
if (options.service && (options.providers !== void 0 || options.defaultModel !== void 0)) throw new TypeError("Configure providers and defaultModel on the injected LLM service");
|
|
1815
|
-
const maxRemoteBytes = options.maxRemoteTemplateBytes ?? limits?.maxInputBytes ?? Infinity;
|
|
1816
|
-
const templateLoaderOptions = { maxRemoteBytes, ...options.templateLoaders ? { loaders: options.templateLoaders } : {} };
|
|
1817
|
-
const service = options.service ?? createLlmService({ ...options, providers: options.providers ?? [] });
|
|
1818
|
-
const collections = options.collections;
|
|
1819
|
-
return { name: "llm", description: "Query injected language and media models", execute: (context) => execute(context, service, limits, templateLoaderOptions, collections) };
|
|
1820
|
-
}
|
|
1821
|
-
function createLlmCommands(options = {}) {
|
|
1822
|
-
return [createLlmCommand(options)];
|
|
1823
|
-
}
|
|
1824
|
-
function llmCommands(options = {}) {
|
|
1825
|
-
const definitions = createLlmCommands(options);
|
|
1826
|
-
const replace = options.replace ?? false;
|
|
1827
|
-
return { name: "llm-commands", setup(host) {
|
|
1828
|
-
if (!replace && host.commands.has("llm")) throw new Error("Command already registered: llm");
|
|
1829
|
-
for (const definition of definitions) host.commands.register(definition, { replace });
|
|
1830
|
-
} };
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
export {
|
|
1834
|
-
serializeLlmTokenUsage,
|
|
1835
|
-
createLlmInputBudget,
|
|
1836
|
-
createLlmUrlSource,
|
|
1837
|
-
validateLlmTemplateParameters,
|
|
1838
|
-
llmTemplateUsesInput,
|
|
1839
|
-
evaluateLlmTemplate,
|
|
1840
|
-
createLlmTemplateStore,
|
|
1841
|
-
findExtractedRange,
|
|
1842
|
-
parseLlmSchemaDsl,
|
|
1843
|
-
resolveLlmSchemaInput,
|
|
1844
|
-
getLlmModelAliases,
|
|
1845
|
-
selectLlmModelByQuery,
|
|
1846
|
-
llmReferenceVersion,
|
|
1847
|
-
createLlmCommand,
|
|
1848
|
-
createLlmCommands,
|
|
1849
|
-
llmCommands
|
|
1850
|
-
};
|