@poe-platform/safe-bash 0.1.630 → 0.1.631
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/office-package/compression.d.ts +19 -0
- package/dist/office-package/compression.js +186 -0
- package/dist/office-package/runtime.d.ts +11 -0
- package/dist/office-package/runtime.js +28 -0
- package/dist/safe-bash/chunks/{bz2-B2RXT4EX.js → bz2-ACU4EOVE.js} +2 -2
- package/dist/safe-bash/chunks/chunk-2E4KBFO6.js +239 -0
- package/dist/safe-bash/chunks/chunk-2E4KBFO6.js.map +7 -0
- package/dist/safe-bash/chunks/chunk-3E5M2WEL.js +33 -0
- package/dist/safe-bash/chunks/chunk-3E5M2WEL.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-KQ6J7JHQ.js → chunk-3LD67SER.js} +12 -10
- package/dist/safe-bash/chunks/{chunk-KQ6J7JHQ.js.map → chunk-3LD67SER.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-6LSSEOG7.js → chunk-6HNK7Q66.js} +11 -7
- package/dist/safe-bash/chunks/{chunk-6LSSEOG7.js.map → chunk-6HNK7Q66.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-AD7UAP5B.js → chunk-7EEWZY5S.js} +10 -8
- package/dist/safe-bash/chunks/{chunk-AD7UAP5B.js.map → chunk-7EEWZY5S.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-RNKTWFEM.js → chunk-CDBQXRWL.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-UYX72YHY.js → chunk-CHHAB5SS.js} +10 -74
- package/dist/safe-bash/chunks/{chunk-UYX72YHY.js.map → chunk-CHHAB5SS.js.map} +3 -3
- package/dist/safe-bash/chunks/{chunk-6YSBXTTJ.js → chunk-EI4X5ETX.js} +12 -10
- package/dist/safe-bash/chunks/{chunk-6YSBXTTJ.js.map → chunk-EI4X5ETX.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-KZ7QCYNT.js → chunk-GIBLUW2U.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-KZ7QCYNT.js.map → chunk-GIBLUW2U.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-GPV7ZFYS.js +1528 -0
- package/dist/safe-bash/chunks/chunk-GPV7ZFYS.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-N5CYTGBN.js → chunk-H3E67KTZ.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-N5CYTGBN.js.map → chunk-H3E67KTZ.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-AFH57PPL.js → chunk-IEKESMO4.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-DPJWEGIX.js → chunk-JLBIUYT3.js} +2 -2
- package/dist/safe-bash/chunks/chunk-JZDO5MC3.js +77 -0
- package/dist/safe-bash/chunks/chunk-JZDO5MC3.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-GFZKQIPL.js → chunk-LA6BX562.js} +8 -6
- package/dist/safe-bash/chunks/{chunk-GFZKQIPL.js.map → chunk-LA6BX562.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-PVJJFCGA.js → chunk-M3GPCYSP.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-FWDMJTQO.js → chunk-NDCZ3UBP.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-FWDMJTQO.js.map → chunk-NDCZ3UBP.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-2KL6W6NB.js → chunk-O2EVBRKF.js} +1 -2
- package/dist/safe-bash/chunks/chunk-OFT77XIB.js +389 -0
- package/dist/safe-bash/chunks/chunk-OFT77XIB.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-PCLOK32J.js → chunk-PC6BEIAF.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-PCLOK32J.js.map → chunk-PC6BEIAF.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-3M5F7LD5.js → chunk-QWKP7ZU7.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-3M5F7LD5.js.map → chunk-QWKP7ZU7.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-THXJ6CLF.js +53 -0
- package/dist/safe-bash/chunks/chunk-THXJ6CLF.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-K7W6Q6FN.js → chunk-V73A742N.js} +58 -16
- package/dist/safe-bash/chunks/chunk-V73A742N.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-4BYUV5PA.js → chunk-VN3ZGME3.js} +12 -8
- package/dist/safe-bash/chunks/{chunk-4BYUV5PA.js.map → chunk-VN3ZGME3.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-3BZ5NQ73.js → chunk-WECHUK3Y.js} +369 -36
- package/dist/safe-bash/chunks/chunk-WECHUK3Y.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-X55AMTNM.js → chunk-WIOEUR7D.js} +14 -10
- package/dist/safe-bash/chunks/{chunk-X55AMTNM.js.map → chunk-WIOEUR7D.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-WPIOO4NX.js +443 -0
- package/dist/safe-bash/chunks/chunk-WPIOO4NX.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-C7QNJ3D4.js → chunk-WYTI64IU.js} +2 -2
- package/dist/safe-bash/chunks/{xz-AVXFDXW4.js → xz-U4QDTPZL.js} +2 -2
- package/dist/safe-bash/chunks/{zstd-R6RPHJYO.js → zstd-OG5RPYXO.js} +2 -2
- package/dist/safe-bash/commands/archive/zip/crc.d.ts +2 -0
- package/dist/safe-bash/commands/archive/zip/crc.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/crc.js +7 -0
- package/dist/safe-bash/commands/archive/zip/crc.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/crypto.d.ts +4 -0
- package/dist/safe-bash/commands/archive/zip/crypto.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/crypto.js +34 -0
- package/dist/safe-bash/commands/archive/zip/crypto.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/help.d.ts +3 -0
- package/dist/safe-bash/commands/archive/zip/help.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/help.js +87 -0
- package/dist/safe-bash/commands/archive/zip/help.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/move.d.ts +12 -0
- package/dist/safe-bash/commands/archive/zip/move.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/move.js +60 -0
- package/dist/safe-bash/commands/archive/zip/move.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/options.js +5 -5
- package/dist/safe-bash/commands/archive/zip/options.js.map +1 -1
- package/dist/safe-bash/commands/archive/zip-format.d.ts +1 -1
- package/dist/safe-bash/commands/archive/zip-format.d.ts.map +1 -1
- package/dist/safe-bash/commands/archive/zip-format.js +14 -17
- package/dist/safe-bash/commands/archive/zip-format.js.map +1 -1
- package/dist/safe-bash/commands/archive/zip.d.ts.map +1 -1
- package/dist/safe-bash/commands/archive/zip.js +45 -15
- package/dist/safe-bash/commands/archive/zip.js.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.d.ts +2 -0
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.d.ts.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.js +4 -0
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.js.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/codec.d.ts +4 -24
- package/dist/safe-bash/commands/bytes/compression/codec.d.ts.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/codec.js +12 -168
- package/dist/safe-bash/commands/bytes/compression/codec.js.map +1 -1
- package/dist/safe-bash/commands/cmp.js +1 -1
- package/dist/safe-bash/commands/cmp.js.map +1 -1
- package/dist/safe-bash/commands/csplit/index.browser.js +10 -7
- package/dist/safe-bash/commands/docx/index.browser.js +54 -0
- package/dist/safe-bash/commands/docx/index.browser.js.map +7 -0
- package/dist/safe-bash/commands/docx/index.d.ts +25 -0
- package/dist/safe-bash/commands/docx/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/docx/index.js +42 -0
- package/dist/safe-bash/commands/docx/index.js.map +1 -0
- package/dist/safe-bash/commands/docx/io.d.ts +15 -0
- package/dist/safe-bash/commands/docx/io.d.ts.map +1 -0
- package/dist/safe-bash/commands/docx/io.js +16 -0
- package/dist/safe-bash/commands/docx/io.js.map +1 -0
- package/dist/safe-bash/commands/factor/index.browser.js +7 -5
- package/dist/safe-bash/commands/filesystem.d.ts.map +1 -1
- package/dist/safe-bash/commands/filesystem.js +9 -1
- package/dist/safe-bash/commands/filesystem.js.map +1 -1
- package/dist/safe-bash/commands/getopt/index.browser.js +7 -5
- package/dist/safe-bash/commands/hexdump/index.browser.js +8 -6
- package/dist/safe-bash/commands/iconv/index.browser.js +8 -6
- package/dist/safe-bash/commands/line-endings/index.browser.js +10 -7
- package/dist/safe-bash/commands/llm/index.browser.js +10 -8
- package/dist/safe-bash/commands/llm/providers/index.browser.js +3 -3
- package/dist/safe-bash/commands/network/index.browser.js +11 -8
- package/dist/safe-bash/commands/node/index.browser.js +8 -6
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/op/index.js +0 -1
- package/dist/safe-bash/commands/op/index.js.map +2 -2
- package/dist/safe-bash/commands/pptx/index.d.ts +29 -0
- package/dist/safe-bash/commands/pptx/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/pptx/index.js +153 -0
- package/dist/safe-bash/commands/pptx/index.js.map +1 -0
- package/dist/safe-bash/commands/pr/index.browser.js +8 -6
- package/dist/safe-bash/commands/predicates.js +1 -1
- package/dist/safe-bash/commands/python/execution.d.ts +3 -0
- package/dist/safe-bash/commands/python/execution.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/execution.js +193 -0
- package/dist/safe-bash/commands/python/execution.js.map +1 -0
- package/dist/safe-bash/commands/python/index.browser.js +21 -0
- package/dist/safe-bash/commands/python/index.browser.js.map +7 -0
- package/dist/safe-bash/commands/python/index.d.ts +49 -0
- package/dist/safe-bash/commands/python/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/index.js +317 -0
- package/dist/safe-bash/commands/python/index.js.map +1 -0
- package/dist/safe-bash/commands/python/installation.d.ts +9 -0
- package/dist/safe-bash/commands/python/installation.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/installation.js +80 -0
- package/dist/safe-bash/commands/python/installation.js.map +1 -0
- package/dist/safe-bash/commands/python/invocation.d.ts +10 -0
- package/dist/safe-bash/commands/python/invocation.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/invocation.js +81 -0
- package/dist/safe-bash/commands/python/invocation.js.map +1 -0
- package/dist/safe-bash/commands/python/node.d.ts +12 -0
- package/dist/safe-bash/commands/python/node.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/node.js +33 -0
- package/dist/safe-bash/commands/python/node.js.map +1 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.d.ts +5 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.js +179 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.js.map +1 -0
- package/dist/safe-bash/commands/python/provisioning.d.ts +49 -0
- package/dist/safe-bash/commands/python/provisioning.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/provisioning.js +320 -0
- package/dist/safe-bash/commands/python/provisioning.js.map +1 -0
- package/dist/safe-bash/commands/python/reply.d.ts +3 -0
- package/dist/safe-bash/commands/python/reply.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/reply.js +103 -0
- package/dist/safe-bash/commands/python/reply.js.map +1 -0
- package/dist/safe-bash/commands/python/worker.browser.js +736 -0
- package/dist/safe-bash/commands/python/worker.browser.js.map +7 -0
- package/dist/safe-bash/commands/python/worker.d.ts +47 -0
- package/dist/safe-bash/commands/python/worker.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/worker.js +373 -0
- package/dist/safe-bash/commands/python/worker.js.map +1 -0
- package/dist/safe-bash/commands/tsort/index.browser.js +8 -6
- package/dist/safe-bash/commands/xml/index.browser.js +9 -7
- package/dist/safe-bash/commands/yq/index.browser.js +10 -8
- package/dist/safe-bash/commands/yq/index.d.ts.map +1 -1
- package/dist/safe-bash/commands/yq/index.js +32 -4
- package/dist/safe-bash/commands/yq/index.js.map +1 -1
- package/dist/safe-bash/commands/yq/parser.d.ts.map +1 -1
- package/dist/safe-bash/commands/yq/parser.js +21 -5
- package/dist/safe-bash/commands/yq/parser.js.map +1 -1
- package/dist/safe-bash/contracts/command.d.ts +2 -0
- package/dist/safe-bash/contracts/command.d.ts.map +1 -1
- package/dist/safe-bash/contracts/command.js +6 -2
- package/dist/safe-bash/contracts/command.js.map +1 -1
- package/dist/safe-bash/contracts/filesystem-descriptor.d.ts +13 -0
- package/dist/safe-bash/contracts/filesystem-descriptor.d.ts.map +1 -0
- package/dist/safe-bash/contracts/filesystem-descriptor.js +189 -0
- package/dist/safe-bash/contracts/filesystem-descriptor.js.map +1 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.d.ts +15 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.d.ts.map +1 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.js +69 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.js.map +1 -0
- package/dist/safe-bash/contracts/filesystem-output.d.ts +11 -5
- package/dist/safe-bash/contracts/filesystem-output.d.ts.map +1 -1
- package/dist/safe-bash/contracts/filesystem-output.js +229 -20
- package/dist/safe-bash/contracts/filesystem-output.js.map +1 -1
- package/dist/safe-bash/contracts/io.d.ts +29 -0
- package/dist/safe-bash/contracts/io.d.ts.map +1 -1
- package/dist/safe-bash/contracts/io.js +317 -37
- package/dist/safe-bash/contracts/io.js.map +1 -1
- package/dist/safe-bash/core.browser.js +5502 -2210
- package/dist/safe-bash/core.browser.js.map +4 -4
- package/dist/safe-bash/core.d.ts +1 -0
- package/dist/safe-bash/core.d.ts.map +1 -1
- package/dist/safe-bash/core.js +1 -0
- package/dist/safe-bash/core.js.map +1 -1
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +95 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.js +99 -0
- package/dist/safe-bash/opt-in/commands/cmp/io.js +218 -0
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +24 -0
- package/dist/safe-bash/opt-in/commands/cmp/options.js +195 -0
- package/dist/safe-bash/opt-in/commands/dd/conversions.js +152 -0
- package/dist/safe-bash/opt-in/commands/dd/index.d.ts +18 -0
- package/dist/safe-bash/opt-in/commands/dd/index.js +561 -0
- package/dist/safe-bash/opt-in/commands/dd/io.d.ts +31 -0
- package/dist/safe-bash/opt-in/commands/dd/io.js +244 -0
- package/dist/safe-bash/opt-in/commands/dd/options.js +184 -0
- package/dist/safe-bash/opt-in/commands/dd/report.js +69 -0
- package/dist/safe-bash/opt-in/commands/install/arguments.js +224 -0
- package/dist/safe-bash/opt-in/commands/install/index.d.ts +6 -0
- package/dist/safe-bash/opt-in/commands/install/index.js +678 -0
- package/dist/safe-bash/opt-in/commands/install/mode.js +71 -0
- package/dist/safe-bash/opt-in/commands/install/options.d.ts +36 -0
- package/dist/safe-bash/opt-in/commands/install/options.js +27 -0
- package/dist/safe-bash/opt-in/commands/shuf/args.js +179 -0
- package/dist/safe-bash/opt-in/commands/shuf/index.d.ts +6 -0
- package/dist/safe-bash/opt-in/commands/shuf/index.js +20 -0
- package/dist/safe-bash/opt-in/commands/shuf/input.js +93 -0
- package/dist/safe-bash/opt-in/commands/shuf/options.d.ts +9 -0
- package/dist/safe-bash/opt-in/commands/shuf/options.js +8 -0
- package/dist/safe-bash/opt-in/commands/shuf/random.js +114 -0
- package/dist/safe-bash/opt-in/commands/shuf/shuf.d.ts +3 -0
- package/dist/safe-bash/opt-in/commands/shuf/shuf.js +230 -0
- package/dist/safe-bash/opt-in/commands/shuf/usage.js +24 -0
- package/dist/safe-bash/opt-in/commands/truncate/arguments.js +186 -0
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +9 -0
- package/dist/safe-bash/opt-in/commands/truncate/index.js +244 -0
- package/dist/safe-bash/opt-in/commands/yes/index.d.ts +11 -0
- package/dist/safe-bash/opt-in/commands/yes/index.js +167 -0
- package/dist/safe-bash/opt-in/commands/yq/arguments.js +177 -0
- package/dist/safe-bash/opt-in/commands/yq/evaluate.js +564 -0
- package/dist/safe-bash/opt-in/commands/yq/expression.js +183 -0
- package/dist/safe-bash/opt-in/commands/yq/inplace.js +65 -0
- package/dist/safe-bash/opt-in/commands/yq/mike.d.ts +9 -0
- package/dist/safe-bash/opt-in/commands/yq/mike.js +192 -0
- package/dist/safe-bash/opt-in/commands/yq/native-encoder.js +165 -0
- package/dist/safe-bash/opt-in/commands/yq/native-work.d.ts +44 -0
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +188 -0
- package/dist/safe-bash/opt-in/commands/yq/nodes.js +621 -0
- package/dist/safe-bash/opt-in/entrypoints/arrays.d.ts +1 -0
- package/dist/safe-bash/opt-in/entrypoints/arrays.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/cmp.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/cmp.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/dd.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/dd.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/devices.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/devices.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/install.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/install.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/jobs.d.ts +1 -0
- package/dist/safe-bash/opt-in/entrypoints/jobs.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/mapfile.d.ts +1 -0
- package/dist/safe-bash/opt-in/entrypoints/mapfile.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/read.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/read.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/shuf.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/shuf.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/trap.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/trap.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/truncate.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/truncate.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/yes.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/yes.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/yq.d.ts +3 -0
- package/dist/safe-bash/opt-in/entrypoints/yq.js +1 -0
- package/dist/safe-bash/opt-in/fs/devices/index.d.ts +8 -0
- package/dist/safe-bash/opt-in/fs/devices/index.js +292 -0
- package/dist/safe-bash/opt-in/optional.d.ts +28 -0
- package/dist/safe-bash/opt-in/optional.js +14 -0
- package/dist/safe-bash/opt-in/shell/extensions/arrays/index.d.ts +2 -0
- package/dist/safe-bash/opt-in/shell/extensions/arrays/index.js +4 -0
- package/dist/safe-bash/opt-in/shell/extensions/jobs/index.d.ts +2 -0
- package/dist/safe-bash/opt-in/shell/extensions/jobs/index.js +291 -0
- package/dist/safe-bash/opt-in/shell/extensions/jobs/state.js +374 -0
- package/dist/safe-bash/opt-in/shell/extensions/mapfile/index.d.ts +24 -0
- package/dist/safe-bash/opt-in/shell/extensions/mapfile/index.js +338 -0
- package/dist/safe-bash/opt-in/shell/extensions/read/index.d.ts +5 -0
- package/dist/safe-bash/opt-in/shell/extensions/read/index.js +351 -0
- package/dist/safe-bash/opt-in/shell/extensions/trap/index.d.ts +9 -0
- package/dist/safe-bash/opt-in/shell/extensions/trap/index.js +210 -0
- package/dist/safe-bash/optional-host.d.ts +5 -0
- package/dist/safe-bash/optional-host.d.ts.map +1 -0
- package/dist/safe-bash/optional-host.js +3 -0
- package/dist/safe-bash/optional-host.js.map +1 -0
- package/dist/safe-bash/shell/arrays/bindings.d.ts +15 -5
- package/dist/safe-bash/shell/arrays/bindings.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/bindings.js +131 -23
- package/dist/safe-bash/shell/arrays/bindings.js.map +1 -1
- package/dist/safe-bash/shell/arrays/ledger.d.ts +1 -0
- package/dist/safe-bash/shell/arrays/ledger.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/ledger.js +19 -0
- package/dist/safe-bash/shell/arrays/ledger.js.map +1 -1
- package/dist/safe-bash/shell/arrays/state.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/state.js +3 -1
- package/dist/safe-bash/shell/arrays/state.js.map +1 -1
- package/dist/safe-bash/shell/arrays/syntax.d.ts +4 -1
- package/dist/safe-bash/shell/arrays/syntax.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/syntax.js +3 -3
- package/dist/safe-bash/shell/arrays/syntax.js.map +1 -1
- package/dist/safe-bash/shell/conditional.js +1 -1
- package/dist/safe-bash/shell/descriptors.d.ts +31 -0
- package/dist/safe-bash/shell/descriptors.d.ts.map +1 -0
- package/dist/safe-bash/shell/descriptors.js +234 -0
- package/dist/safe-bash/shell/descriptors.js.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.d.ts +2 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.d.ts.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.js +717 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.js.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name.d.ts +3 -0
- package/dist/safe-bash/shell/diagnostic-name.d.ts.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name.js +89 -0
- package/dist/safe-bash/shell/diagnostic-name.js.map +1 -0
- package/dist/safe-bash/shell/display.js +1 -1
- package/dist/safe-bash/shell/display.js.map +1 -1
- package/dist/safe-bash/shell/extensions.d.ts +188 -0
- package/dist/safe-bash/shell/extensions.d.ts.map +1 -0
- package/dist/safe-bash/shell/extensions.js +141 -0
- package/dist/safe-bash/shell/extensions.js.map +1 -0
- package/dist/safe-bash/shell/input.d.ts +66 -14
- package/dist/safe-bash/shell/input.d.ts.map +1 -1
- package/dist/safe-bash/shell/input.js +947 -173
- package/dist/safe-bash/shell/input.js.map +1 -1
- package/dist/safe-bash/shell/parser.d.ts +38 -6
- package/dist/safe-bash/shell/parser.d.ts.map +1 -1
- package/dist/safe-bash/shell/parser.js +339 -52
- package/dist/safe-bash/shell/parser.js.map +1 -1
- package/dist/safe-bash/shell/runtime.d.ts +92 -20
- package/dist/safe-bash/shell/runtime.d.ts.map +1 -1
- package/dist/safe-bash/shell/runtime.js +2547 -689
- package/dist/safe-bash/shell/runtime.js.map +1 -1
- package/dist/safe-bash/shell/shell.d.ts.map +1 -1
- package/dist/safe-bash/shell/shell.js +52 -21
- package/dist/safe-bash/shell/shell.js.map +1 -1
- package/dist/safe-bash/shell/types.d.ts +4 -0
- package/dist/safe-bash/shell/types.d.ts.map +1 -1
- package/dist/safe-bash/shell/types.js.map +1 -1
- package/package.json +92 -4
- package/dist/safe-bash/chunks/chunk-3BZ5NQ73.js.map +0 -7
- package/dist/safe-bash/chunks/chunk-4DBWBEU7.js +0 -194
- package/dist/safe-bash/chunks/chunk-4DBWBEU7.js.map +0 -7
- package/dist/safe-bash/chunks/chunk-CXMIIXJA.js +0 -178
- package/dist/safe-bash/chunks/chunk-CXMIIXJA.js.map +0 -7
- package/dist/safe-bash/chunks/chunk-K7W6Q6FN.js.map +0 -7
- /package/dist/safe-bash/chunks/{bz2-B2RXT4EX.js.map → bz2-ACU4EOVE.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-RNKTWFEM.js.map → chunk-CDBQXRWL.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-AFH57PPL.js.map → chunk-IEKESMO4.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-DPJWEGIX.js.map → chunk-JLBIUYT3.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-PVJJFCGA.js.map → chunk-M3GPCYSP.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-2KL6W6NB.js.map → chunk-O2EVBRKF.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-C7QNJ3D4.js.map → chunk-WYTI64IU.js.map} +0 -0
- /package/dist/safe-bash/chunks/{xz-AVXFDXW4.js.map → xz-U4QDTPZL.js.map} +0 -0
- /package/dist/safe-bash/chunks/{zstd-R6RPHJYO.js.map → zstd-OG5RPYXO.js.map} +0 -0
package/README.md
CHANGED
|
@@ -231,6 +231,7 @@ For SafeJS host integration, `makeSafeJsShellModule` exposes shell execution and
|
|
|
231
231
|
| `new Shell(...)` option | Behavior |
|
|
232
232
|
| --- | --- |
|
|
233
233
|
| `fs` | Required filesystem; no implicit host access. |
|
|
234
|
+
| `deviceView` | `"default"` (the default) adds synthetic `/dev/null` and shadows ordinary backing files there. `"provided"` uses the supplied filesystem's paths and capabilities, including an `exec` filesystem override, without adding devices. Nested commands retain the selected view. |
|
|
234
235
|
| `cwd` | Initial virtual directory; defaults to `/`. |
|
|
235
236
|
| `env` | Initial exported variables; defaults to an empty map, with `PWD` set from `cwd`. No host environment inheritance. Never pass host `process.env` or any secret-bearing object: everything in `env` is readable by executed scripts (`env`, `printenv`, `$VAR`), and on Cloudflare Workers with `nodejs_compat` `process.env` contains the Worker's secret bindings. The shell warns only for the identical host `process.env` object, not copies, and does not filter values. |
|
|
236
237
|
| `commands` | Existing `CommandRegistry`; defaults to an empty registry. |
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CodecRuntime, type ByteSource } from "./runtime.js";
|
|
2
|
+
export interface CodecInput {
|
|
3
|
+
chunk(): Promise<Uint8Array | undefined>;
|
|
4
|
+
restore(bytes: Uint8Array): void;
|
|
5
|
+
}
|
|
6
|
+
export interface CodecOptions {
|
|
7
|
+
readonly mode: "gzip" | "gunzip" | "inflate-raw" | "deflate-raw";
|
|
8
|
+
readonly chunkSize?: number;
|
|
9
|
+
readonly level?: number;
|
|
10
|
+
readonly onFailure?: (error: unknown) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface CompressionReader extends CodecInput {
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface CompressionCodec {
|
|
16
|
+
CodecReader: new (source: ByteSource, signal: AbortSignal) => CompressionReader;
|
|
17
|
+
codec(input: CodecInput, options: CodecOptions, signal: AbortSignal): ByteSource;
|
|
18
|
+
}
|
|
19
|
+
export declare function createCompressionCodec(runtime?: CodecRuntime): CompressionCodec;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { ZStream, Z_OK, Z_STREAM_END, Z_BUF_ERROR, Z_DATA_ERROR, Z_NO_FLUSH, Z_FINISH, zlibDeflateInit2, zlibDeflate, zlibDeflateEnd, zlibInflateInit2, zlibInflate, zlibInflateReset, zlibInflateEnd } from "pako";
|
|
2
|
+
import { CodecError, defaultRuntime } from "./runtime.js";
|
|
3
|
+
export function createCompressionCodec(runtime = defaultRuntime) {
|
|
4
|
+
const { yieldTurn, readBytes, diagnostic } = runtime;
|
|
5
|
+
class CodecReader {
|
|
6
|
+
signal;
|
|
7
|
+
iterator;
|
|
8
|
+
pending = new Uint8Array();
|
|
9
|
+
pulls = 0;
|
|
10
|
+
closing;
|
|
11
|
+
constructor(source, signal) {
|
|
12
|
+
this.signal = signal;
|
|
13
|
+
this.iterator = readBytes(source, signal);
|
|
14
|
+
}
|
|
15
|
+
async chunk() {
|
|
16
|
+
this.signal.throwIfAborted();
|
|
17
|
+
if (this.closing)
|
|
18
|
+
return undefined;
|
|
19
|
+
if (this.pending.length) {
|
|
20
|
+
const bytes = this.pending;
|
|
21
|
+
this.pending = new Uint8Array();
|
|
22
|
+
return bytes;
|
|
23
|
+
}
|
|
24
|
+
for (;;) {
|
|
25
|
+
if (++this.pulls % 64 === 0)
|
|
26
|
+
await yieldTurn(this.signal);
|
|
27
|
+
const next = await this.iterator.next();
|
|
28
|
+
if (next.done)
|
|
29
|
+
return undefined;
|
|
30
|
+
if (next.value.length)
|
|
31
|
+
return next.value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
restore(bytes) {
|
|
35
|
+
this.pending = bytes;
|
|
36
|
+
}
|
|
37
|
+
close() {
|
|
38
|
+
this.pending = new Uint8Array();
|
|
39
|
+
return (this.closing ??= this.iterator.return(undefined).then(() => { }));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function codecError(status, message) {
|
|
43
|
+
const error = new Error(message || "internal error");
|
|
44
|
+
Object.assign(error, {
|
|
45
|
+
code: status === Z_BUF_ERROR
|
|
46
|
+
? "Z_BUF_ERROR"
|
|
47
|
+
: status === Z_DATA_ERROR
|
|
48
|
+
? "Z_DATA_ERROR"
|
|
49
|
+
: "Z_STREAM_ERROR"
|
|
50
|
+
});
|
|
51
|
+
return diagnostic(error);
|
|
52
|
+
}
|
|
53
|
+
async function* codec(input, options, signal) {
|
|
54
|
+
signal.throwIfAborted();
|
|
55
|
+
const requestedSize = options.chunkSize ?? 64 * 1024;
|
|
56
|
+
if (!Number.isSafeInteger(requestedSize) || requestedSize <= 0)
|
|
57
|
+
throw new RangeError("invalid codec chunk size");
|
|
58
|
+
const chunkSize = Math.min(requestedSize, 64 * 1024);
|
|
59
|
+
let output = new Uint8Array(chunkSize);
|
|
60
|
+
const encoding = options.mode === "gzip" || options.mode === "deflate-raw";
|
|
61
|
+
const stream = new ZStream();
|
|
62
|
+
const initialized = encoding
|
|
63
|
+
? zlibDeflateInit2(stream, options.level ?? 6, 8, options.mode === "deflate-raw" ? -15 : 31, 8, 0, true)
|
|
64
|
+
: zlibInflateInit2(stream, options.mode === "inflate-raw" ? -15 : 31);
|
|
65
|
+
if (initialized !== Z_OK) {
|
|
66
|
+
if (encoding)
|
|
67
|
+
zlibDeflateEnd(stream);
|
|
68
|
+
else
|
|
69
|
+
zlibInflateEnd(stream);
|
|
70
|
+
throw codecError(initialized, stream.msg);
|
|
71
|
+
}
|
|
72
|
+
let current = new Uint8Array();
|
|
73
|
+
let offset = 0;
|
|
74
|
+
let eof = false;
|
|
75
|
+
let needsInput = true;
|
|
76
|
+
let memberEnded = false;
|
|
77
|
+
let calls = 0;
|
|
78
|
+
let work = 0;
|
|
79
|
+
let filled = 0;
|
|
80
|
+
try {
|
|
81
|
+
for (;;) {
|
|
82
|
+
signal.throwIfAborted();
|
|
83
|
+
if (needsInput || memberEnded) {
|
|
84
|
+
if (offset === current.length && !eof) {
|
|
85
|
+
let ready = false;
|
|
86
|
+
const pending = input.chunk().then((value) => {
|
|
87
|
+
ready = true;
|
|
88
|
+
return value;
|
|
89
|
+
}, (error) => {
|
|
90
|
+
options.onFailure?.(error);
|
|
91
|
+
throw error;
|
|
92
|
+
});
|
|
93
|
+
if (filled) {
|
|
94
|
+
const turn = new AbortController();
|
|
95
|
+
try {
|
|
96
|
+
await Promise.race([pending, yieldTurn(AbortSignal.any([signal, turn.signal]))]);
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
turn.abort();
|
|
100
|
+
}
|
|
101
|
+
if (!ready) {
|
|
102
|
+
yield output.subarray(0, filled);
|
|
103
|
+
output = new Uint8Array(chunkSize);
|
|
104
|
+
filled = 0;
|
|
105
|
+
signal.throwIfAborted();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
current = (await pending) ?? new Uint8Array();
|
|
109
|
+
offset = 0;
|
|
110
|
+
eof = current.length === 0;
|
|
111
|
+
}
|
|
112
|
+
if (memberEnded) {
|
|
113
|
+
if (eof)
|
|
114
|
+
return;
|
|
115
|
+
if (current[offset] === 0) {
|
|
116
|
+
while ((await input.chunk()) !== undefined)
|
|
117
|
+
await yieldTurn(signal);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const reset = zlibInflateReset(stream);
|
|
121
|
+
if (reset !== Z_OK)
|
|
122
|
+
throw codecError(reset, stream.msg);
|
|
123
|
+
memberEnded = false;
|
|
124
|
+
}
|
|
125
|
+
stream.input = current;
|
|
126
|
+
stream.next_in = offset;
|
|
127
|
+
stream.avail_in = Math.min(current.length - offset, 64 * 1024);
|
|
128
|
+
}
|
|
129
|
+
stream.output = output;
|
|
130
|
+
stream.next_out = filled;
|
|
131
|
+
stream.avail_out = chunkSize - filled;
|
|
132
|
+
const before = stream.avail_in;
|
|
133
|
+
const status = encoding
|
|
134
|
+
? zlibDeflate(stream, eof ? Z_FINISH : Z_NO_FLUSH)
|
|
135
|
+
: zlibInflate(stream, Z_NO_FLUSH);
|
|
136
|
+
offset = stream.next_in;
|
|
137
|
+
const consumed = before - stream.avail_in;
|
|
138
|
+
const produced = stream.next_out - filled;
|
|
139
|
+
filled = stream.next_out;
|
|
140
|
+
if (status !== Z_OK && status !== Z_STREAM_END && status !== Z_BUF_ERROR)
|
|
141
|
+
throw codecError(status, stream.msg);
|
|
142
|
+
if (filled === chunkSize || (status === Z_STREAM_END && filled)) {
|
|
143
|
+
yield output.subarray(0, filled);
|
|
144
|
+
output = new Uint8Array(chunkSize);
|
|
145
|
+
filled = 0;
|
|
146
|
+
}
|
|
147
|
+
signal.throwIfAborted();
|
|
148
|
+
work += consumed + produced;
|
|
149
|
+
if (++calls >= 64 || work >= 64 * 1024) {
|
|
150
|
+
await yieldTurn(signal);
|
|
151
|
+
calls = 0;
|
|
152
|
+
work = 0;
|
|
153
|
+
}
|
|
154
|
+
if (status === Z_STREAM_END) {
|
|
155
|
+
if (options.mode === "inflate-raw") {
|
|
156
|
+
input.restore(current.subarray(offset));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (encoding)
|
|
160
|
+
return;
|
|
161
|
+
memberEnded = true;
|
|
162
|
+
}
|
|
163
|
+
if (!consumed && !produced && status !== Z_STREAM_END) {
|
|
164
|
+
if (eof)
|
|
165
|
+
throw diagnostic(new CodecError("unexpected end of file"));
|
|
166
|
+
if (stream.avail_in)
|
|
167
|
+
throw codecError(status, stream.msg);
|
|
168
|
+
}
|
|
169
|
+
needsInput = stream.avail_in === 0 && stream.avail_out !== 0;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
options.onFailure?.(error);
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
if (encoding)
|
|
178
|
+
zlibDeflateEnd(stream);
|
|
179
|
+
else
|
|
180
|
+
zlibInflateEnd(stream);
|
|
181
|
+
stream.input = new Uint8Array();
|
|
182
|
+
stream.output = new Uint8Array();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return { codec, CodecReader };
|
|
186
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ByteSource = AsyncIterable<Uint8Array>;
|
|
2
|
+
export declare class CodecError extends Error {
|
|
3
|
+
readonly code: "invalid-package" | "resource-limit";
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
export interface CodecRuntime {
|
|
7
|
+
yieldTurn(signal: AbortSignal): Promise<void>;
|
|
8
|
+
readBytes(source: ByteSource, signal: AbortSignal): AsyncGenerator<Uint8Array>;
|
|
9
|
+
diagnostic(error: unknown): unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare const defaultRuntime: CodecRuntime;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export class CodecError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "CodecError";
|
|
6
|
+
this.code = message.includes("limit") ? "resource-limit" : "invalid-package";
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export const defaultRuntime = {
|
|
10
|
+
async yieldTurn(signal) {
|
|
11
|
+
signal.throwIfAborted();
|
|
12
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
13
|
+
signal.throwIfAborted();
|
|
14
|
+
},
|
|
15
|
+
async *readBytes(source, signal) {
|
|
16
|
+
signal.throwIfAborted();
|
|
17
|
+
for await (const bytes of source) {
|
|
18
|
+
signal.throwIfAborted();
|
|
19
|
+
if (!(bytes instanceof Uint8Array))
|
|
20
|
+
throw new TypeError("Expected byte chunks");
|
|
21
|
+
yield bytes;
|
|
22
|
+
}
|
|
23
|
+
signal.throwIfAborted();
|
|
24
|
+
},
|
|
25
|
+
diagnostic(error) {
|
|
26
|
+
return error instanceof Error ? new CodecError(error.message) : error;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_platform
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O2EVBRKF.js";
|
|
4
4
|
|
|
5
5
|
// packages/safe-bash/src/commands/bytes/compression/native/generated/bz2.mjs
|
|
6
6
|
init_platform();
|
|
@@ -4833,4 +4833,4 @@ export {
|
|
|
4833
4833
|
ke as default
|
|
4834
4834
|
};
|
|
4835
4835
|
/*! Native codec: bz2 bzip2-1.0.8. See ../LICENSES.txt and ../sources.json. */
|
|
4836
|
-
//# sourceMappingURL=bz2-
|
|
4836
|
+
//# sourceMappingURL=bz2-ACU4EOVE.js.map
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FsError
|
|
3
|
+
} from "./chunk-WPIOO4NX.js";
|
|
4
|
+
import {
|
|
5
|
+
init_platform
|
|
6
|
+
} from "./chunk-O2EVBRKF.js";
|
|
7
|
+
|
|
8
|
+
// packages/safe-bash/src/contracts/filesystem-descriptor.ts
|
|
9
|
+
init_platform();
|
|
10
|
+
import { FsError as FsError2 } from "@poe-platform/safe-fs/core";
|
|
11
|
+
|
|
12
|
+
// packages/safe-bash/src/contracts/filesystem-output-budget.ts
|
|
13
|
+
init_platform();
|
|
14
|
+
var filesystemOutputBudgets = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
function bindFileOutputBudget(context, budget, countedWrite) {
|
|
16
|
+
if (!context.registerCleanup) throw new TypeError("Shell output budgets require invocation cleanup ownership");
|
|
17
|
+
filesystemOutputBudgets.set(context.registerCleanup, { sinkBudget: budget, ...countedWrite === void 0 ? {} : { countedWrite } });
|
|
18
|
+
}
|
|
19
|
+
function assertCountedFileOutput(context) {
|
|
20
|
+
context.signal.throwIfAborted();
|
|
21
|
+
const budget = context.registerCleanup && filesystemOutputBudgets.get(context.registerCleanup);
|
|
22
|
+
if (budget && !budget.countedWrite) throw new FsError("ENOTSUP", { syscall: "write", message: "counted filesystem output budget is not bound" });
|
|
23
|
+
}
|
|
24
|
+
async function writeFileOutputCounted(context, chunk, write) {
|
|
25
|
+
assertCountedFileOutput(context);
|
|
26
|
+
if (!(chunk instanceof Uint8Array)) throw new TypeError("Filesystem output must be Uint8Array");
|
|
27
|
+
const budget = context.registerCleanup && filesystemOutputBudgets.get(context.registerCleanup);
|
|
28
|
+
const requested = chunk.byteLength;
|
|
29
|
+
let called = false;
|
|
30
|
+
let accepting = true;
|
|
31
|
+
let accepted;
|
|
32
|
+
let active;
|
|
33
|
+
const guarded = () => {
|
|
34
|
+
try {
|
|
35
|
+
context.signal.throwIfAborted();
|
|
36
|
+
if (!accepting) throw new FsError("EBADF", { syscall: "write" });
|
|
37
|
+
if (called) throw new FsError("EIO", { syscall: "write", message: "counted writer invoked more than once" });
|
|
38
|
+
called = true;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
return Promise.reject(error);
|
|
41
|
+
}
|
|
42
|
+
active = (async () => {
|
|
43
|
+
const count = await write();
|
|
44
|
+
context.signal.throwIfAborted();
|
|
45
|
+
if (!Number.isSafeInteger(count) || count < 0 || count > requested) throw new FsError("EIO", { syscall: "write", message: "invalid byte count" });
|
|
46
|
+
accepted = count;
|
|
47
|
+
return count;
|
|
48
|
+
})();
|
|
49
|
+
void active.catch(() => {
|
|
50
|
+
});
|
|
51
|
+
return active;
|
|
52
|
+
};
|
|
53
|
+
let result;
|
|
54
|
+
let failure;
|
|
55
|
+
try {
|
|
56
|
+
result = await (budget?.countedWrite ? budget.countedWrite(chunk, guarded) : guarded());
|
|
57
|
+
} catch (reason) {
|
|
58
|
+
failure = { reason };
|
|
59
|
+
}
|
|
60
|
+
accepting = false;
|
|
61
|
+
try {
|
|
62
|
+
await active;
|
|
63
|
+
} catch (reason) {
|
|
64
|
+
failure ??= { reason };
|
|
65
|
+
}
|
|
66
|
+
context.signal.throwIfAborted();
|
|
67
|
+
if (failure) throw failure.reason;
|
|
68
|
+
if (accepted === void 0 || result !== accepted) throw new FsError("EIO", { syscall: "write", message: "counted writer changed the accepted byte count" });
|
|
69
|
+
return accepted;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// packages/safe-bash/src/contracts/filesystem-descriptor.ts
|
|
73
|
+
async function openCommandFile(context, path, options) {
|
|
74
|
+
const { cleanupFailurePrioritySignal } = context;
|
|
75
|
+
let descriptor;
|
|
76
|
+
let accepting = true;
|
|
77
|
+
let closing;
|
|
78
|
+
let closeFailure;
|
|
79
|
+
let work = Promise.resolve();
|
|
80
|
+
let acquisitionSettled;
|
|
81
|
+
const acquired = new Promise((resolve) => {
|
|
82
|
+
acquisitionSettled = resolve;
|
|
83
|
+
});
|
|
84
|
+
let scope;
|
|
85
|
+
const close = () => {
|
|
86
|
+
accepting = false;
|
|
87
|
+
closing ??= (async () => {
|
|
88
|
+
await acquired;
|
|
89
|
+
await work;
|
|
90
|
+
const retained = descriptor;
|
|
91
|
+
descriptor = void 0;
|
|
92
|
+
try {
|
|
93
|
+
await retained?.close();
|
|
94
|
+
} catch (reason) {
|
|
95
|
+
closeFailure = { reason, acknowledged: false, drained: false };
|
|
96
|
+
throw reason;
|
|
97
|
+
} finally {
|
|
98
|
+
scope?.removeEventListener("abort", aborted);
|
|
99
|
+
if (closeFailure) closeFailure.drained = true;
|
|
100
|
+
}
|
|
101
|
+
})();
|
|
102
|
+
void closing.catch(() => {
|
|
103
|
+
});
|
|
104
|
+
return closing;
|
|
105
|
+
};
|
|
106
|
+
const aborted = () => {
|
|
107
|
+
void close().catch(() => {
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
const check = (signal) => {
|
|
111
|
+
context.signal.throwIfAborted();
|
|
112
|
+
scope?.throwIfAborted();
|
|
113
|
+
signal?.throwIfAborted();
|
|
114
|
+
};
|
|
115
|
+
const run = (syscall, forwarded, action) => {
|
|
116
|
+
const signal = forwarded.signal;
|
|
117
|
+
try {
|
|
118
|
+
check(signal);
|
|
119
|
+
if (!accepting) throw new FsError2("EBADF", { syscall, path });
|
|
120
|
+
} catch (error) {
|
|
121
|
+
return Promise.reject(error);
|
|
122
|
+
}
|
|
123
|
+
const operation = work.then(async () => {
|
|
124
|
+
check(signal);
|
|
125
|
+
const local = signal ? AbortSignal.any([scope, signal]) : scope;
|
|
126
|
+
try {
|
|
127
|
+
const result = await action(descriptor, { signal: local });
|
|
128
|
+
check(signal);
|
|
129
|
+
return result;
|
|
130
|
+
} catch (error) {
|
|
131
|
+
check(signal);
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
work = operation.then(() => {
|
|
136
|
+
}, () => {
|
|
137
|
+
});
|
|
138
|
+
return operation;
|
|
139
|
+
};
|
|
140
|
+
try {
|
|
141
|
+
if (context.descriptorCleanup !== "caller") context.registerCleanup?.(async () => {
|
|
142
|
+
try {
|
|
143
|
+
await close();
|
|
144
|
+
} catch (reason) {
|
|
145
|
+
if (!closeFailure?.drained || !closeFailure.acknowledged || !Object.is(reason, closeFailure.reason)) {
|
|
146
|
+
if (cleanupFailurePrioritySignal === void 0) check();
|
|
147
|
+
else cleanupFailurePrioritySignal.throwIfAborted();
|
|
148
|
+
throw reason;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
check();
|
|
152
|
+
});
|
|
153
|
+
const request = { ...options };
|
|
154
|
+
scope = request.signal ? AbortSignal.any([context.signal, request.signal]) : context.signal;
|
|
155
|
+
scope.addEventListener("abort", aborted, { once: true });
|
|
156
|
+
check();
|
|
157
|
+
if (!accepting) throw new FsError2("EBADF", { syscall: "open", path });
|
|
158
|
+
if (request.access !== "read") assertCountedFileOutput(context);
|
|
159
|
+
const fsOptions = { signal: scope };
|
|
160
|
+
const capabilities = request.creation === "exclusive" ? context.fs.capabilities : await context.fs.capabilitiesFor?.(path, { ...fsOptions, ...request.creation === "ifMissing" ? { create: true } : {} }) ?? context.fs.capabilities;
|
|
161
|
+
check();
|
|
162
|
+
if (!accepting) throw new FsError2("EBADF", { syscall: "open", path });
|
|
163
|
+
if (!context.fs.open || capabilities?.open === false) throw new FsError2("ENOTSUP", { syscall: "open", path });
|
|
164
|
+
descriptor = await context.fs.open(path, { ...request, signal: scope });
|
|
165
|
+
acquisitionSettled();
|
|
166
|
+
check();
|
|
167
|
+
if (!accepting) throw new FsError2("EBADF", { syscall: "open", path });
|
|
168
|
+
const { delegateZeroLengthWrite, ...retainedCapabilities } = descriptor.capabilities;
|
|
169
|
+
const position = retainedCapabilities.position === true && typeof descriptor.getPosition === "function";
|
|
170
|
+
const probeRead = retainedCapabilities.readObservation === true ? descriptor.probeRead : void 0;
|
|
171
|
+
if (retainedCapabilities.readObservation === true && typeof probeRead !== "function") throw new FsError2("ENOTSUP", { syscall: "probeRead", path });
|
|
172
|
+
const admitted = Object.freeze({
|
|
173
|
+
...retainedCapabilities,
|
|
174
|
+
positionedRead: retainedCapabilities.positionedRead && request.access !== "write",
|
|
175
|
+
positionedWrite: retainedCapabilities.positionedWrite && request.access !== "read" && (!request.append || retainedCapabilities.positionedAppendWrite === true),
|
|
176
|
+
truncate: retainedCapabilities.truncate && request.access !== "read",
|
|
177
|
+
...retainedCapabilities.position === void 0 ? {} : { position },
|
|
178
|
+
...retainedCapabilities.positionedAppendWrite === void 0 ? {} : {
|
|
179
|
+
positionedAppendWrite: retainedCapabilities.positionedAppendWrite === true && retainedCapabilities.positionedWrite && request.access !== "read"
|
|
180
|
+
},
|
|
181
|
+
...delegateZeroLengthWrite === void 0 ? {} : {
|
|
182
|
+
delegateZeroLengthWrite: delegateZeroLengthWrite === true && request.access !== "read"
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
check();
|
|
186
|
+
if (!accepting) throw new FsError2("EBADF", { syscall: "open", path });
|
|
187
|
+
return {
|
|
188
|
+
capabilities: admitted,
|
|
189
|
+
...probeRead === void 0 ? {} : { probeRead: (forwarded = {}) => run("probeRead", forwarded, async (retained, supplied) => {
|
|
190
|
+
const readiness = await probeRead.call(retained, supplied);
|
|
191
|
+
if (readiness !== "ready" && readiness !== "blocked" && readiness !== "unknown") throw new FsError2("EIO", { syscall: "probeRead", path });
|
|
192
|
+
return readiness;
|
|
193
|
+
}) },
|
|
194
|
+
...position ? { getPosition: (forwarded = {}) => run("getPosition", forwarded, async (retained, supplied) => {
|
|
195
|
+
if (retained.capabilities.position !== true || typeof retained.getPosition !== "function") throw new FsError2("ENOTSUP", { syscall: "getPosition", path });
|
|
196
|
+
const cursor = await retained.getPosition(supplied);
|
|
197
|
+
if (!Number.isSafeInteger(cursor) || cursor < 0) throw new FsError2("EIO", { syscall: "getPosition", path });
|
|
198
|
+
return cursor;
|
|
199
|
+
}) } : {},
|
|
200
|
+
stat: (forwarded = {}) => run("fstat", forwarded, (retained, supplied) => retained.stat(supplied)),
|
|
201
|
+
read: (buffer, position2, forwarded = {}) => run("read", forwarded, async (retained, supplied) => {
|
|
202
|
+
if (request.access === "write") throw new FsError2("EBADF", { syscall: "read", path });
|
|
203
|
+
return retained.read(buffer, position2, supplied);
|
|
204
|
+
}),
|
|
205
|
+
write: (buffer, position2, forwarded = {}) => run("write", forwarded, async (retained, supplied) => {
|
|
206
|
+
if (request.access === "read") throw new FsError2("EBADF", { syscall: "write", path });
|
|
207
|
+
return writeFileOutputCounted({ ...context, signal: supplied.signal }, buffer, () => retained.write(buffer, position2, supplied));
|
|
208
|
+
}),
|
|
209
|
+
truncate: (length, forwarded = {}) => run("ftruncate", forwarded, async (retained, supplied) => {
|
|
210
|
+
if (request.access === "read") throw new FsError2("EBADF", { syscall: "ftruncate", path });
|
|
211
|
+
await retained.truncate(length, supplied);
|
|
212
|
+
}),
|
|
213
|
+
sync: (dataOnly, forwarded = {}) => run(dataOnly ? "fdatasync" : "fsync", forwarded, (retained, supplied) => retained.sync(dataOnly, supplied)),
|
|
214
|
+
close,
|
|
215
|
+
acknowledgeCloseFailure: (reason) => {
|
|
216
|
+
if (!closeFailure || !Object.is(reason, closeFailure.reason)) return false;
|
|
217
|
+
if (closeFailure.acknowledged) return true;
|
|
218
|
+
if (context.signal.aborted || scope?.aborted) return false;
|
|
219
|
+
closeFailure.acknowledged = true;
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
} catch (error) {
|
|
224
|
+
acquisitionSettled();
|
|
225
|
+
try {
|
|
226
|
+
await close();
|
|
227
|
+
} catch {
|
|
228
|
+
}
|
|
229
|
+
check();
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export {
|
|
235
|
+
filesystemOutputBudgets,
|
|
236
|
+
bindFileOutputBudget,
|
|
237
|
+
openCommandFile
|
|
238
|
+
};
|
|
239
|
+
//# sourceMappingURL=chunk-2E4KBFO6.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/contracts/filesystem-descriptor.ts", "../../src/contracts/filesystem-output-budget.ts"],
|
|
4
|
+
"sourcesContent": ["import { FsError } from \"poe-code/safe-fs/core\";\nimport type { FileDescriptor, FsOptions, OpenFileOptions } from \"poe-code/safe-fs/core\";\nimport { assertCountedFileOutput, writeFileOutputCounted, type FileOutputContext } from \"./filesystem-output-budget.js\";\n\nexport interface CommandFileDescriptor extends FileDescriptor {\n acknowledgeCloseFailure(reason: unknown): boolean;\n}\n\n/** descriptorCleanup: \"caller\" requires an already-enrolled owner that drains late\n * acquisitions and closes the returned descriptor; output accounting keeps the\n * original registerCleanup identity in either ownership mode. */\nexport async function openCommandFile(context: FileOutputContext & { readonly cleanupFailurePrioritySignal?: AbortSignal | undefined; readonly descriptorCleanup?: \"caller\" }, path: string, options: OpenFileOptions): Promise<CommandFileDescriptor> {\n const { cleanupFailurePrioritySignal } = context;\n let descriptor: FileDescriptor | undefined;\n let accepting = true;\n let closing: Promise<void> | undefined;\n let closeFailure: { reason: unknown; acknowledged: boolean; drained: boolean } | undefined;\n let work: Promise<void> = Promise.resolve();\n let acquisitionSettled!: () => void;\n const acquired = new Promise<void>(resolve => { acquisitionSettled = resolve; });\n let scope: AbortSignal | undefined;\n const close = (): Promise<void> => {\n accepting = false;\n closing ??= (async () => {\n await acquired;\n await work;\n const retained = descriptor;\n descriptor = undefined;\n try { await retained?.close(); }\n catch (reason) { closeFailure = { reason, acknowledged: false, drained: false }; throw reason; }\n finally {\n scope?.removeEventListener(\"abort\", aborted);\n if (closeFailure) closeFailure.drained = true;\n }\n })();\n void closing.catch(() => {});\n return closing;\n };\n const aborted = (): void => { void close().catch(() => {}); };\n const check = (signal?: AbortSignal): void => {\n context.signal.throwIfAborted();\n scope?.throwIfAborted();\n signal?.throwIfAborted();\n };\n const run = <Result>(syscall: string, forwarded: FsOptions,\n action: (retained: FileDescriptor, options: FsOptions) => Promise<Result>): Promise<Result> => {\n const signal = forwarded.signal;\n try {\n check(signal);\n if (!accepting) throw new FsError(\"EBADF\", { syscall, path });\n } catch (error) { return Promise.reject(error); }\n const operation = work.then(async () => {\n check(signal);\n const local = signal ? AbortSignal.any([scope!, signal]) : scope!;\n try {\n const result = await action(descriptor!, { signal: local });\n check(signal);\n return result;\n } catch (error) {\n check(signal);\n throw error;\n }\n });\n work = operation.then(() => {}, () => {});\n return operation;\n };\n try {\n if (context.descriptorCleanup !== \"caller\") context.registerCleanup?.(async () => {\n try { await close(); }\n catch (reason) {\n if (!closeFailure?.drained || !closeFailure.acknowledged || !Object.is(reason, closeFailure.reason)) {\n if (cleanupFailurePrioritySignal === undefined) check();\n else cleanupFailurePrioritySignal.throwIfAborted();\n throw reason;\n }\n }\n check();\n });\n const request = { ...options };\n scope = request.signal ? AbortSignal.any([context.signal, request.signal]) : context.signal;\n scope.addEventListener(\"abort\", aborted, { once: true });\n check();\n if (!accepting) throw new FsError(\"EBADF\", { syscall: \"open\", path });\n if (request.access !== \"read\") assertCountedFileOutput(context);\n const fsOptions = { signal: scope };\n // A following capability query cannot precede atomic exclusive acquisition:\n // even a self-loop final symlink must be refused by open with EEXIST.\n const capabilities = request.creation === \"exclusive\" ? context.fs.capabilities\n : await context.fs.capabilitiesFor?.(path, { ...fsOptions, ...(request.creation === \"ifMissing\" ? { create: true } : {}) }) ?? context.fs.capabilities;\n check();\n if (!accepting) throw new FsError(\"EBADF\", { syscall: \"open\", path });\n if (!context.fs.open || capabilities?.open === false) throw new FsError(\"ENOTSUP\", { syscall: \"open\", path });\n descriptor = await context.fs.open(path, { ...request, signal: scope });\n acquisitionSettled();\n check();\n if (!accepting) throw new FsError(\"EBADF\", { syscall: \"open\", path });\n const { delegateZeroLengthWrite, ...retainedCapabilities } = descriptor.capabilities;\n const position = retainedCapabilities.position === true && typeof descriptor.getPosition === \"function\";\n const probeRead = retainedCapabilities.readObservation === true ? descriptor.probeRead : undefined;\n if (retainedCapabilities.readObservation === true && typeof probeRead !== \"function\") throw new FsError(\"ENOTSUP\", { syscall: \"probeRead\", path });\n const admitted = Object.freeze({ ...retainedCapabilities,\n positionedRead: retainedCapabilities.positionedRead && request.access !== \"write\",\n positionedWrite: retainedCapabilities.positionedWrite && request.access !== \"read\"\n && (!request.append || retainedCapabilities.positionedAppendWrite === true),\n truncate: retainedCapabilities.truncate && request.access !== \"read\",\n ...(retainedCapabilities.position === undefined ? {} : { position }),\n ...(retainedCapabilities.positionedAppendWrite === undefined ? {} : {\n positionedAppendWrite: retainedCapabilities.positionedAppendWrite === true\n && retainedCapabilities.positionedWrite && request.access !== \"read\",\n }),\n ...(delegateZeroLengthWrite === undefined ? {} : {\n delegateZeroLengthWrite: delegateZeroLengthWrite === true && request.access !== \"read\",\n }),\n });\n check();\n if (!accepting) throw new FsError(\"EBADF\", { syscall: \"open\", path });\n return {\n capabilities: admitted,\n ...(probeRead === undefined ? {} : { probeRead: (forwarded: FsOptions = {}) => run(\"probeRead\", forwarded, async (retained, supplied) => {\n const readiness = await probeRead.call(retained, supplied);\n if (readiness !== \"ready\" && readiness !== \"blocked\" && readiness !== \"unknown\") throw new FsError(\"EIO\", { syscall: \"probeRead\", path });\n return readiness;\n }) }),\n ...(position ? { getPosition: (forwarded: FsOptions = {}) => run(\"getPosition\", forwarded, async (retained, supplied) => {\n if (retained.capabilities.position !== true || typeof retained.getPosition !== \"function\") throw new FsError(\"ENOTSUP\", { syscall: \"getPosition\", path });\n const cursor = await retained.getPosition(supplied);\n if (!Number.isSafeInteger(cursor) || cursor < 0) throw new FsError(\"EIO\", { syscall: \"getPosition\", path });\n return cursor;\n }) } : {}),\n stat: (forwarded = {}) => run(\"fstat\", forwarded, (retained, supplied) => retained.stat(supplied)),\n read: (buffer, position, forwarded = {}) => run(\"read\", forwarded, async (retained, supplied) => {\n if (request.access === \"write\") throw new FsError(\"EBADF\", { syscall: \"read\", path });\n return retained.read(buffer, position, supplied);\n }),\n write: (buffer, position, forwarded = {}) => run(\"write\", forwarded, async (retained, supplied) => {\n if (request.access === \"read\") throw new FsError(\"EBADF\", { syscall: \"write\", path });\n return writeFileOutputCounted({ ...context, signal: supplied.signal! }, buffer, () => retained.write(buffer, position, supplied));\n }),\n truncate: (length, forwarded = {}) => run(\"ftruncate\", forwarded, async (retained, supplied) => {\n if (request.access === \"read\") throw new FsError(\"EBADF\", { syscall: \"ftruncate\", path });\n await retained.truncate(length, supplied);\n }),\n sync: (dataOnly, forwarded = {}) => run(dataOnly ? \"fdatasync\" : \"fsync\", forwarded, (retained, supplied) => retained.sync(dataOnly, supplied)),\n close,\n acknowledgeCloseFailure: (reason: unknown): boolean => {\n if (!closeFailure || !Object.is(reason, closeFailure.reason)) return false;\n if (closeFailure.acknowledged) return true;\n if (context.signal.aborted || scope?.aborted) return false;\n closeFailure.acknowledged = true;\n return true;\n },\n };\n } catch (error) {\n acquisitionSettled();\n try { await close(); } catch {}\n check();\n throw error;\n }\n}\n", "import type { CommandContext } from \"./command.js\";\nimport { FsError } from \"./errors.js\";\nimport type { ByteSink } from \"./io.js\";\n\nexport type CountedFileWrite = (chunk: Uint8Array, write: () => Promise<number>) => Promise<number>;\n\nexport const filesystemOutputBudgets = new WeakMap<NonNullable<CommandContext[\"registerCleanup\"]>, {\n readonly sinkBudget: (sink: ByteSink) => ByteSink;\n readonly countedWrite?: CountedFileWrite;\n}>();\n\nexport type FileOutputContext = Pick<CommandContext, \"fs\" | \"signal\" | \"registerCleanup\"> & {\n readonly cleanupFailurePrioritySignal?: AbortSignal | undefined;\n readonly outputBudget?: \"shell\" | \"independent\";\n};\n\nexport function bindFileOutputBudget(context: Pick<CommandContext, \"registerCleanup\">, budget: (sink: ByteSink) => ByteSink, countedWrite?: CountedFileWrite): void {\n if (!context.registerCleanup) throw new TypeError(\"Shell output budgets require invocation cleanup ownership\");\n filesystemOutputBudgets.set(context.registerCleanup, { sinkBudget: budget, ...(countedWrite === undefined ? {} : { countedWrite }) });\n}\n\nexport function assertCountedFileOutput(context: Pick<CommandContext, \"registerCleanup\" | \"signal\">): void {\n context.signal.throwIfAborted();\n const budget = context.registerCleanup && filesystemOutputBudgets.get(context.registerCleanup);\n if (budget && !budget.countedWrite) throw new FsError(\"ENOTSUP\", { syscall: \"write\", message: \"counted filesystem output budget is not bound\" });\n}\n\nexport async function writeFileOutputCounted(context: Pick<CommandContext, \"registerCleanup\" | \"signal\">,\n chunk: Uint8Array, write: () => Promise<number>): Promise<number> {\n assertCountedFileOutput(context);\n if (!(chunk instanceof Uint8Array)) throw new TypeError(\"Filesystem output must be Uint8Array\");\n const budget = context.registerCleanup && filesystemOutputBudgets.get(context.registerCleanup);\n const requested = chunk.byteLength;\n let called = false;\n let accepting = true;\n let accepted: number | undefined;\n let active: Promise<number> | undefined;\n const guarded = (): Promise<number> => {\n try {\n context.signal.throwIfAborted();\n if (!accepting) throw new FsError(\"EBADF\", { syscall: \"write\" });\n if (called) throw new FsError(\"EIO\", { syscall: \"write\", message: \"counted writer invoked more than once\" });\n called = true;\n } catch (error) { return Promise.reject(error); }\n active = (async () => {\n const count = await write();\n context.signal.throwIfAborted();\n if (!Number.isSafeInteger(count) || count < 0 || count > requested) throw new FsError(\"EIO\", { syscall: \"write\", message: \"invalid byte count\" });\n accepted = count;\n return count;\n })();\n void active.catch(() => {});\n return active;\n };\n let result: number | undefined;\n let failure: { reason: unknown } | undefined;\n try {\n result = await (budget?.countedWrite ? budget.countedWrite(chunk, guarded) : guarded());\n } catch (reason) { failure = { reason }; }\n accepting = false;\n try { await active; } catch (reason) { failure ??= { reason }; }\n context.signal.throwIfAborted();\n if (failure) throw failure.reason;\n if (accepted === undefined || result !== accepted) throw new FsError(\"EIO\", { syscall: \"write\", message: \"counted writer changed the accepted byte count\" });\n return accepted;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAAA;AAAA,SAAS,WAAAA,gBAAe;;;ACAxB;AAMO,IAAM,0BAA0B,oBAAI,QAGxC;AAOI,SAAS,qBAAqB,SAAkD,QAAsC,cAAuC;AAClK,MAAI,CAAC,QAAQ,gBAAiB,OAAM,IAAI,UAAU,2DAA2D;AAC7G,0BAAwB,IAAI,QAAQ,iBAAiB,EAAE,YAAY,QAAQ,GAAI,iBAAiB,SAAY,CAAC,IAAI,EAAE,aAAa,EAAG,CAAC;AACtI;AAEO,SAAS,wBAAwB,SAAmE;AACzG,UAAQ,OAAO,eAAe;AAC9B,QAAM,SAAS,QAAQ,mBAAmB,wBAAwB,IAAI,QAAQ,eAAe;AAC7F,MAAI,UAAU,CAAC,OAAO,aAAc,OAAM,IAAI,QAAQ,WAAW,EAAE,SAAS,SAAS,SAAS,gDAAgD,CAAC;AACjJ;AAEA,eAAsB,uBAAuB,SAC3C,OAAmB,OAA+C;AAClE,0BAAwB,OAAO;AAC/B,MAAI,EAAE,iBAAiB,YAAa,OAAM,IAAI,UAAU,sCAAsC;AAC9F,QAAM,SAAS,QAAQ,mBAAmB,wBAAwB,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AS,EAAE,SAAS,SAAS,KAAK,CAAC;AACpF,eAAO,uBAAuB,EAAE,GAAG,SAAS,QAAQ,SAAS,OAAQ,GAAG,QAAQ,MAAM,SAAS,MAAM,QAAQC,WAAU,QAAQ,CAAC;AAAA,MAClI,CAAC;AAAA,MACD,UAAU,CAAC,QAAQ,YAAY,CAAC,MAAM,IAAI,aAAa,WAAW,OAAO,UAAU,aAAa;AAC9F,YAAI,QAAQ,WAAW,OAAQ,OAAM,IAAID,SAAQ,SAAS,EAAE,SAAS,aAAa,KAAK,CAAC;AACxF,cAAM,SAAS,SAAS,QAAQ,QAAQ;AAAA,MAC1C,CAAC;AAAA,MACD,MAAM,CAAC,UAAU,YAAY,CAAC,MAAM,IAAI,WAAW,cAAc,SAAS,WAAW,CAAC,UAAU,aAAa,SAAS,KAAK,UAAU,QAAQ,CAAC;AAAA,MAC9I;AAAA,MACA,yBAAyB,CAAC,WAA6B;AACrD,YAAI,CAAC,gBAAgB,CAAC,OAAO,GAAG,QAAQ,aAAa,MAAM,EAAG,QAAO;AACrE,YAAI,aAAa,aAAc,QAAO;AACtC,YAAI,QAAQ,OAAO,WAAW,OAAO,QAAS,QAAO;AACrD,qBAAa,eAAe;AAC5B,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,uBAAmB;AACnB,QAAI;AAAE,YAAM,MAAM;AAAA,IAAG,QAAQ;AAAA,IAAC;AAC9B,UAAM;AACN,UAAM;AAAA,EACR;AACF;",
|
|
6
|
+
"names": ["FsError", "FsError", "position"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CommandArgumentIdentityError
|
|
3
|
+
} from "./chunk-CHHAB5SS.js";
|
|
4
|
+
import {
|
|
5
|
+
FsError
|
|
6
|
+
} from "./chunk-WPIOO4NX.js";
|
|
7
|
+
import {
|
|
8
|
+
init_platform
|
|
9
|
+
} from "./chunk-O2EVBRKF.js";
|
|
10
|
+
|
|
11
|
+
// packages/safe-bash/src/diagnostics.ts
|
|
12
|
+
init_platform();
|
|
13
|
+
var PublicDiagnostic = class extends Error {
|
|
14
|
+
};
|
|
15
|
+
function publicDiagnosticMessage(error, onInternalError) {
|
|
16
|
+
if (error instanceof FsError || error instanceof CommandArgumentIdentityError) return error.message;
|
|
17
|
+
if (error instanceof PublicDiagnostic && !Object.hasOwn(error, "cause")) return error.message;
|
|
18
|
+
const original = error instanceof PublicDiagnostic ? error.cause : error;
|
|
19
|
+
const detail = error instanceof PublicDiagnostic ? error.message : "internal error";
|
|
20
|
+
try {
|
|
21
|
+
const pending = onInternalError?.(original);
|
|
22
|
+
if (pending !== void 0) void Promise.resolve(pending).catch(() => void 0);
|
|
23
|
+
} catch {
|
|
24
|
+
return detail;
|
|
25
|
+
}
|
|
26
|
+
return detail;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
PublicDiagnostic,
|
|
31
|
+
publicDiagnosticMessage
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-3E5M2WEL.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/diagnostics.ts"],
|
|
4
|
+
"sourcesContent": ["import { FsError } from \"./contracts/errors.js\";\nimport { CommandArgumentIdentityError, type InternalErrorHandler } from \"./contracts/command.js\";\n\nexport class PublicDiagnostic extends Error {}\n\nexport function publicDiagnosticMessage(error: unknown, onInternalError?: InternalErrorHandler): string {\n if (error instanceof FsError || error instanceof CommandArgumentIdentityError) return error.message;\n if (error instanceof PublicDiagnostic && !Object.hasOwn(error, \"cause\")) return error.message;\n const original: unknown = error instanceof PublicDiagnostic ? error.cause : error;\n const detail = error instanceof PublicDiagnostic ? error.message : \"internal error\";\n try {\n const pending = onInternalError?.(original);\n if (pending !== undefined) void Promise.resolve(pending).catch(() => undefined);\n } catch { return detail; }\n return detail;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAAA;AAGO,IAAM,mBAAN,cAA+B,MAAM;AAAC;AAEtC,SAAS,wBAAwB,OAAgB,iBAAgD;AACtG,MAAI,iBAAiB,WAAW,iBAAiB,6BAA8B,QAAO,MAAM;AAC5F,MAAI,iBAAiB,oBAAoB,CAAC,OAAO,OAAO,OAAO,OAAO,EAAG,QAAO,MAAM;AACtF,QAAM,WAAoB,iBAAiB,mBAAmB,MAAM,QAAQ;AAC5E,QAAM,SAAS,iBAAiB,mBAAmB,MAAM,UAAU;AACnE,MAAI;AACF,UAAM,UAAU,kBAAkB,QAAQ;AAC1C,QAAI,YAAY,OAAW,MAAK,QAAQ,QAAQ,OAAO,EAAE,MAAM,MAAM,MAAS;AAAA,EAChF,QAAQ;AAAE,WAAO;AAAA,EAAQ;AACzB,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createOutputOperation
|
|
3
|
+
} from "./chunk-CDBQXRWL.js";
|
|
1
4
|
import {
|
|
2
5
|
acceptsMimeType,
|
|
3
6
|
sniffMimeType
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
createOutputOperation
|
|
7
|
-
} from "./chunk-RNKTWFEM.js";
|
|
7
|
+
} from "./chunk-M3GPCYSP.js";
|
|
8
8
|
import {
|
|
9
9
|
pathOf,
|
|
10
10
|
writeDiagnostic
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LA6BX562.js";
|
|
12
12
|
import {
|
|
13
|
-
getCommandArguments,
|
|
14
13
|
inheritYieldCheckpoint,
|
|
15
14
|
yieldTurn
|
|
16
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-THXJ6CLF.js";
|
|
16
|
+
import {
|
|
17
|
+
getCommandArguments
|
|
18
|
+
} from "./chunk-CHHAB5SS.js";
|
|
17
19
|
import {
|
|
18
20
|
FsError
|
|
19
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-WPIOO4NX.js";
|
|
20
22
|
import {
|
|
21
23
|
init_platform
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-O2EVBRKF.js";
|
|
23
25
|
|
|
24
26
|
// packages/safe-bash/src/commands/llm/index.ts
|
|
25
27
|
init_platform();
|
|
@@ -283,4 +285,4 @@ export {
|
|
|
283
285
|
createLlmCommands,
|
|
284
286
|
llmCommands
|
|
285
287
|
};
|
|
286
|
-
//# sourceMappingURL=chunk-
|
|
288
|
+
//# sourceMappingURL=chunk-3LD67SER.js.map
|