├── .github ├── FUNDING.yml └── workflows │ ├── ci.yaml │ └── release.yaml ├── .gitignore ├── .pre-commit-config.yaml ├── CHANGELOG.md ├── Cargo.lock ├── Cargo.toml ├── Justfile ├── LICENSE ├── README.md ├── assets └── logo.png └── src ├── app.rs ├── chat.rs ├── chatgpt.rs ├── config.rs ├── event.rs ├── formatter.rs ├── handler.rs ├── help.rs ├── history.rs ├── lib.rs ├── llamacpp.rs ├── llm.rs ├── main.rs ├── notification.rs ├── ollama.rs ├── prompt.rs ├── spinner.rs ├── tui.rs └── ui.rs /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: pythops 2 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | on: 3 | push: 4 | branches: 5 | - "*" 6 | tags: 7 | - "!*" 8 | name: CI 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | 15 | - uses: taiki-e/install-action@just 16 | 17 | - uses: dtolnay/rust-toolchain@stable 18 | with: 19 | toolchain: stable 20 | components: clippy rustfmt 21 | 22 | - name: Run linting 23 | run: just lint 24 | 25 | - name: Run debug builds 26 | run: just build 27 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Release 3 | on: 4 | push: 5 | tags: 6 | - v[0-9]+.* 7 | jobs: 8 | body: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | contents: write 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v4 15 | - name: Extract release notes 16 | uses: ffurrer2/extract-release-notes@v2 17 | id: release_notes 18 | - name: Upload Body 19 | uses: softprops/action-gh-release@v2 20 | with: 21 | body: ${{ steps.release_notes.outputs.release_notes }} 22 | 23 | build: 24 | permissions: 25 | contents: write 26 | continue-on-error: false 27 | strategy: 28 | matrix: 29 | include: 30 | - target: x86_64-unknown-linux-gnu 31 | os: ubuntu-latest 32 | - target: x86_64-unknown-linux-musl 33 | os: ubuntu-latest 34 | - target: aarch64-apple-darwin 35 | os: macos-latest 36 | - target: x86_64-apple-darwin 37 | os: macos-latest 38 | - target: x86_64-pc-windows-msvc 39 | os: windows-latest 40 | - target: aarch64-pc-windows-msvc 41 | os: windows-latest 42 | runs-on: ${{ matrix.os }} 43 | steps: 44 | - name: Checkout 45 | uses: actions/checkout@v4 46 | - name: Add Musl 47 | if: matrix.target == 'x86_64-unknown-linux-musl' 48 | run: | 49 | sudo apt update 50 | sudo apt install -y musl-tools gcc 51 | - name: Install Target 52 | uses: dtolnay/rust-toolchain@stable 53 | with: 54 | targets: ${{ matrix.target }} 55 | - name: Compile 56 | run: cargo build --release --target ${{ matrix.target }} 57 | - name: Strip Binary (linux) 58 | if: matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'x86_64-unknown-linux-musl' 59 | run: strip ./target/${{ matrix.target }}/release/tenere 60 | - name: Rename Binary (unix) 61 | if: runner.os != 'Windows' 62 | run: mv ./target/${{ matrix.target }}/release/tenere ./tenere-${{ matrix.target }} 63 | - name: Rename Binary (windows) 64 | if: runner.os == 'Windows' 65 | run: mv ./target/${{ matrix.target }}/release/tenere.exe ./tenere-${{ matrix.target }}.exe 66 | - name: Upload Binary 67 | uses: softprops/action-gh-release@v2 68 | with: 69 | files: "tenere*" 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .undodir 3 | tenere.archive 4 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fail_fast: true 3 | repos: 4 | - repo: local 5 | hooks: 6 | - id: cargo-fmt 7 | name: cargo fmt 8 | entry: cargo fmt --all -- --check 9 | language: system 10 | types: [rust] 11 | - id: clippy 12 | name: clippy 13 | entry: | 14 | cargo clippy --workspace --all-targets --all-features -- -D warnings 15 | language: system 16 | pass_filenames: false 17 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [0.11.2] - 2024-09-05 9 | 10 | ### Added 11 | 12 | - Windows executables to release. 13 | - Windows config instructions. 14 | 15 | ### Changed 16 | 17 | - Reworked release github workflow. 18 | - Use `stdout` for crossterm instead of `stderr` 19 | 20 | ### Updated 21 | 22 | - Bump ratatui version 23 | 24 | ## [0.11.1] - 2024-03-19 25 | 26 | ### Changed 27 | 28 | - Update the license to GPLv3 29 | - Update the notification layout 30 | 31 | ## [0.11] - 2024-02-02 32 | 33 | ### Added 34 | 35 | - Support for [llama.cpp](https://github.com/ggerganov/llama.cpp) 36 | - Support for [ollama](https://github.com/ollama/ollama) 37 | 38 | ### Removed 39 | 40 | - Remove borders for chat block 41 | 42 | ## [0.10] - 2024-01-27 43 | 44 | ### Added 45 | 46 | - More vim like key bindings for the prompt 47 | - Add Visual mode for the prompt 48 | - Copy and paste from/to the clipboard in the prompt 49 | 50 | ### Fixed 51 | 52 | - Use model from the config file if defined 53 | 54 | ## [0.9] - 2023-11-01 55 | 56 | ### Features 57 | 58 | - Syntax highlights 59 | 60 | ### Removed 61 | 62 | - Scroll bars 63 | 64 | ## [0.8] - 2023-08-20 65 | 66 | ### Features 67 | 68 | - Stop the stream response with the key `t` 69 | - Add scrollbar for the chat block 70 | 71 | ## [0.7] - 2023-08-12 72 | 73 | ### Features 74 | 75 | - Support streamig responses for ChatGPT 76 | 77 | ## [0.6] - 2023-04-27 78 | 79 | ### Features 80 | 81 | - display a spinner in the waiting message 82 | - chatgpt url is configurable 83 | 84 | ## [0.5] - 2023-04-22 85 | 86 | ### Features 87 | 88 | - Save the current chat or chat history to a file with the key `s` 89 | 90 | ## [0.4] - 2023-04-21 91 | 92 | ### Features 93 | 94 | - Support configuration file 95 | 96 | ### Changes 97 | 98 | - Change `ctrl+l` to `n` to start a new chat 99 | 100 | ## [0.3] - 2023-04-20 101 | 102 | ### Features 103 | 104 | - Show chat history with the key `h` 105 | 106 | ### Changes 107 | 108 | - `?` to show help popup 109 | 110 | ### Removed 111 | 112 | - Remove mode block 113 | 114 | ## [0.2] - 2023-04-17 115 | 116 | ### Features 117 | 118 | - Use Arrow keys to scroll 119 | 120 | ### Fixes 121 | 122 | - Fix the scrolling issue 123 | 124 | ## [0.1] - 2023-04-16 125 | 126 | First release 🎉 127 | 128 | [unreleased]: https://github.com/WyvernIXTL/ubilerntui/compare/v0.11.1...HEAD 129 | [0.11.1]: https://github.com/pythops/tenere/compare/v0.11...v0.11.1 130 | [0.11]: https://github.com/pythops/tenere/compare/v0.10...v0.11 131 | [0.10]: https://github.com/pythops/tenere/compare/v0.9...v0.10 132 | [0.9]: https://github.com/pythops/tenere/compare/v0.8...v0.9 133 | [0.8]: https://github.com/pythops/tenere/compare/v0.7...v0.8 134 | [0.7]: https://github.com/pythops/tenere/compare/v0.6...v0.7 135 | [0.6]: https://github.com/pythops/tenere/compare/v0.5...v0.6 136 | [0.5]: https://github.com/pythops/tenere/compare/v0.4...v0.5 137 | [0.4]: https://github.com/pythops/tenere/compare/v0.3...v0.4 138 | [0.3]: https://github.com/pythops/tenere/compare/v0.2...v0.3 139 | [0.2]: https://github.com/pythops/tenere/compare/v0.1...v0.2 140 | [0.1]: https://github.com/pythops/tenere/releases/tag/v0.1 141 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.22.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "adler2" 22 | version = "2.0.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" 25 | 26 | [[package]] 27 | name = "ahash" 28 | version = "0.8.11" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" 31 | dependencies = [ 32 | "cfg-if", 33 | "once_cell", 34 | "version_check", 35 | "zerocopy", 36 | ] 37 | 38 | [[package]] 39 | name = "aho-corasick" 40 | version = "1.1.3" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 43 | dependencies = [ 44 | "memchr", 45 | ] 46 | 47 | [[package]] 48 | name = "allocator-api2" 49 | version = "0.2.18" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" 52 | 53 | [[package]] 54 | name = "ansi-to-tui" 55 | version = "7.0.0" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "67555e1f1ece39d737e28c8a017721287753af3f93225e4a445b29ccb0f5912c" 58 | dependencies = [ 59 | "nom", 60 | "ratatui", 61 | "simdutf8", 62 | "smallvec", 63 | "thiserror", 64 | ] 65 | 66 | [[package]] 67 | name = "ansi_colours" 68 | version = "1.2.3" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "14eec43e0298190790f41679fe69ef7a829d2a2ddd78c8c00339e84710e435fe" 71 | dependencies = [ 72 | "rgb", 73 | ] 74 | 75 | [[package]] 76 | name = "anstream" 77 | version = "0.6.15" 78 | source = "registry+https://github.com/rust-lang/crates.io-index" 79 | checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" 80 | dependencies = [ 81 | "anstyle", 82 | "anstyle-parse", 83 | "anstyle-query", 84 | "anstyle-wincon", 85 | "colorchoice", 86 | "is_terminal_polyfill", 87 | "utf8parse", 88 | ] 89 | 90 | [[package]] 91 | name = "anstyle" 92 | version = "1.0.8" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" 95 | 96 | [[package]] 97 | name = "anstyle-parse" 98 | version = "0.2.5" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" 101 | dependencies = [ 102 | "utf8parse", 103 | ] 104 | 105 | [[package]] 106 | name = "anstyle-query" 107 | version = "1.1.1" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" 110 | dependencies = [ 111 | "windows-sys 0.52.0", 112 | ] 113 | 114 | [[package]] 115 | name = "anstyle-wincon" 116 | version = "3.0.4" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" 119 | dependencies = [ 120 | "anstyle", 121 | "windows-sys 0.52.0", 122 | ] 123 | 124 | [[package]] 125 | name = "anyhow" 126 | version = "1.0.95" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" 129 | 130 | [[package]] 131 | name = "arboard" 132 | version = "3.4.0" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89" 135 | dependencies = [ 136 | "clipboard-win", 137 | "core-graphics", 138 | "image", 139 | "log", 140 | "objc2", 141 | "objc2-app-kit", 142 | "objc2-foundation", 143 | "parking_lot", 144 | "windows-sys 0.48.0", 145 | "x11rb", 146 | ] 147 | 148 | [[package]] 149 | name = "async-trait" 150 | version = "0.1.82" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" 153 | dependencies = [ 154 | "proc-macro2", 155 | "quote", 156 | "syn", 157 | ] 158 | 159 | [[package]] 160 | name = "autocfg" 161 | version = "1.3.0" 162 | source = "registry+https://github.com/rust-lang/crates.io-index" 163 | checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" 164 | 165 | [[package]] 166 | name = "backtrace" 167 | version = "0.3.73" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" 170 | dependencies = [ 171 | "addr2line", 172 | "cc", 173 | "cfg-if", 174 | "libc", 175 | "miniz_oxide 0.7.4", 176 | "object", 177 | "rustc-demangle", 178 | ] 179 | 180 | [[package]] 181 | name = "base64" 182 | version = "0.22.1" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" 185 | 186 | [[package]] 187 | name = "bat" 188 | version = "0.25.0" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | checksum = "2ab792c2ad113a666f08856c88cdec0a62d732559b1f3982eedf0142571e669a" 191 | dependencies = [ 192 | "ansi_colours", 193 | "anyhow", 194 | "bincode", 195 | "bugreport", 196 | "bytesize", 197 | "clap", 198 | "clircle", 199 | "console", 200 | "content_inspector", 201 | "encoding_rs", 202 | "etcetera", 203 | "flate2", 204 | "git2", 205 | "globset", 206 | "grep-cli", 207 | "home", 208 | "indexmap", 209 | "itertools", 210 | "nu-ansi-term", 211 | "once_cell", 212 | "path_abs", 213 | "plist", 214 | "regex", 215 | "semver", 216 | "serde", 217 | "serde_derive", 218 | "serde_with", 219 | "serde_yaml", 220 | "shell-words", 221 | "syntect", 222 | "terminal-colorsaurus", 223 | "thiserror", 224 | "toml", 225 | "unicode-width 0.1.13", 226 | "walkdir", 227 | "wild", 228 | ] 229 | 230 | [[package]] 231 | name = "bincode" 232 | version = "1.3.3" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" 235 | dependencies = [ 236 | "serde", 237 | ] 238 | 239 | [[package]] 240 | name = "bitflags" 241 | version = "1.3.2" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 244 | 245 | [[package]] 246 | name = "bitflags" 247 | version = "2.6.0" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" 250 | 251 | [[package]] 252 | name = "block2" 253 | version = "0.5.1" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" 256 | dependencies = [ 257 | "objc2", 258 | ] 259 | 260 | [[package]] 261 | name = "bstr" 262 | version = "1.10.0" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" 265 | dependencies = [ 266 | "memchr", 267 | "regex-automata", 268 | "serde", 269 | ] 270 | 271 | [[package]] 272 | name = "bugreport" 273 | version = "0.5.0" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "535120b8182547808081a66f1f77a64533c780b23da26763e0ee34dfb94f98c9" 276 | dependencies = [ 277 | "git-version", 278 | "shell-escape", 279 | "sys-info", 280 | ] 281 | 282 | [[package]] 283 | name = "bumpalo" 284 | version = "3.16.0" 285 | source = "registry+https://github.com/rust-lang/crates.io-index" 286 | checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" 287 | 288 | [[package]] 289 | name = "bytemuck" 290 | version = "1.17.1" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2" 293 | 294 | [[package]] 295 | name = "byteorder" 296 | version = "1.5.0" 297 | source = "registry+https://github.com/rust-lang/crates.io-index" 298 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 299 | 300 | [[package]] 301 | name = "byteorder-lite" 302 | version = "0.1.0" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" 305 | 306 | [[package]] 307 | name = "bytes" 308 | version = "1.7.1" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" 311 | 312 | [[package]] 313 | name = "bytesize" 314 | version = "1.3.0" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" 317 | 318 | [[package]] 319 | name = "cassowary" 320 | version = "0.3.0" 321 | source = "registry+https://github.com/rust-lang/crates.io-index" 322 | checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" 323 | 324 | [[package]] 325 | name = "castaway" 326 | version = "0.2.3" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5" 329 | dependencies = [ 330 | "rustversion", 331 | ] 332 | 333 | [[package]] 334 | name = "cc" 335 | version = "1.1.16" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" 338 | dependencies = [ 339 | "jobserver", 340 | "libc", 341 | "shlex", 342 | ] 343 | 344 | [[package]] 345 | name = "cfg-if" 346 | version = "1.0.0" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 349 | 350 | [[package]] 351 | name = "clap" 352 | version = "4.5.17" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" 355 | dependencies = [ 356 | "clap_builder", 357 | "clap_derive", 358 | ] 359 | 360 | [[package]] 361 | name = "clap_builder" 362 | version = "4.5.17" 363 | source = "registry+https://github.com/rust-lang/crates.io-index" 364 | checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" 365 | dependencies = [ 366 | "anstream", 367 | "anstyle", 368 | "clap_lex", 369 | "strsim", 370 | "terminal_size", 371 | ] 372 | 373 | [[package]] 374 | name = "clap_derive" 375 | version = "4.5.13" 376 | source = "registry+https://github.com/rust-lang/crates.io-index" 377 | checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" 378 | dependencies = [ 379 | "heck", 380 | "proc-macro2", 381 | "quote", 382 | "syn", 383 | ] 384 | 385 | [[package]] 386 | name = "clap_lex" 387 | version = "0.7.2" 388 | source = "registry+https://github.com/rust-lang/crates.io-index" 389 | checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" 390 | 391 | [[package]] 392 | name = "clipboard-win" 393 | version = "5.4.0" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | checksum = "15efe7a882b08f34e38556b14f2fb3daa98769d06c7f0c1b076dfd0d983bc892" 396 | dependencies = [ 397 | "error-code", 398 | ] 399 | 400 | [[package]] 401 | name = "clircle" 402 | version = "0.6.1" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "7d9334f725b46fb9bed8580b9b47a932587e044fadb344ed7fa98774b067ac1a" 405 | dependencies = [ 406 | "cfg-if", 407 | "windows", 408 | ] 409 | 410 | [[package]] 411 | name = "colorchoice" 412 | version = "1.0.2" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" 415 | 416 | [[package]] 417 | name = "compact_str" 418 | version = "0.8.0" 419 | source = "registry+https://github.com/rust-lang/crates.io-index" 420 | checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" 421 | dependencies = [ 422 | "castaway", 423 | "cfg-if", 424 | "itoa", 425 | "rustversion", 426 | "ryu", 427 | "static_assertions", 428 | ] 429 | 430 | [[package]] 431 | name = "console" 432 | version = "0.15.10" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" 435 | dependencies = [ 436 | "encode_unicode", 437 | "libc", 438 | "once_cell", 439 | "unicode-width 0.2.0", 440 | "windows-sys 0.59.0", 441 | ] 442 | 443 | [[package]] 444 | name = "content_inspector" 445 | version = "0.2.4" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38" 448 | dependencies = [ 449 | "memchr", 450 | ] 451 | 452 | [[package]] 453 | name = "core-foundation" 454 | version = "0.9.4" 455 | source = "registry+https://github.com/rust-lang/crates.io-index" 456 | checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" 457 | dependencies = [ 458 | "core-foundation-sys", 459 | "libc", 460 | ] 461 | 462 | [[package]] 463 | name = "core-foundation-sys" 464 | version = "0.8.7" 465 | source = "registry+https://github.com/rust-lang/crates.io-index" 466 | checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" 467 | 468 | [[package]] 469 | name = "core-graphics" 470 | version = "0.23.2" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" 473 | dependencies = [ 474 | "bitflags 1.3.2", 475 | "core-foundation", 476 | "core-graphics-types", 477 | "foreign-types", 478 | "libc", 479 | ] 480 | 481 | [[package]] 482 | name = "core-graphics-types" 483 | version = "0.1.3" 484 | source = "registry+https://github.com/rust-lang/crates.io-index" 485 | checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" 486 | dependencies = [ 487 | "bitflags 1.3.2", 488 | "core-foundation", 489 | "libc", 490 | ] 491 | 492 | [[package]] 493 | name = "crc32fast" 494 | version = "1.4.2" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" 497 | dependencies = [ 498 | "cfg-if", 499 | ] 500 | 501 | [[package]] 502 | name = "crossterm" 503 | version = "0.28.1" 504 | source = "registry+https://github.com/rust-lang/crates.io-index" 505 | checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" 506 | dependencies = [ 507 | "bitflags 2.6.0", 508 | "crossterm_winapi", 509 | "futures-core", 510 | "mio", 511 | "parking_lot", 512 | "rustix", 513 | "signal-hook", 514 | "signal-hook-mio", 515 | "winapi", 516 | ] 517 | 518 | [[package]] 519 | name = "crossterm_winapi" 520 | version = "0.9.1" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" 523 | dependencies = [ 524 | "winapi", 525 | ] 526 | 527 | [[package]] 528 | name = "darling" 529 | version = "0.20.10" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" 532 | dependencies = [ 533 | "darling_core", 534 | "darling_macro", 535 | ] 536 | 537 | [[package]] 538 | name = "darling_core" 539 | version = "0.20.10" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" 542 | dependencies = [ 543 | "fnv", 544 | "ident_case", 545 | "proc-macro2", 546 | "quote", 547 | "strsim", 548 | "syn", 549 | ] 550 | 551 | [[package]] 552 | name = "darling_macro" 553 | version = "0.20.10" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" 556 | dependencies = [ 557 | "darling_core", 558 | "quote", 559 | "syn", 560 | ] 561 | 562 | [[package]] 563 | name = "deranged" 564 | version = "0.3.11" 565 | source = "registry+https://github.com/rust-lang/crates.io-index" 566 | checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" 567 | dependencies = [ 568 | "powerfmt", 569 | ] 570 | 571 | [[package]] 572 | name = "dirs" 573 | version = "5.0.1" 574 | source = "registry+https://github.com/rust-lang/crates.io-index" 575 | checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" 576 | dependencies = [ 577 | "dirs-sys", 578 | ] 579 | 580 | [[package]] 581 | name = "dirs-sys" 582 | version = "0.4.1" 583 | source = "registry+https://github.com/rust-lang/crates.io-index" 584 | checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" 585 | dependencies = [ 586 | "libc", 587 | "option-ext", 588 | "redox_users", 589 | "windows-sys 0.48.0", 590 | ] 591 | 592 | [[package]] 593 | name = "either" 594 | version = "1.13.0" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" 597 | 598 | [[package]] 599 | name = "encode_unicode" 600 | version = "1.0.0" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" 603 | 604 | [[package]] 605 | name = "encoding_rs" 606 | version = "0.8.35" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" 609 | dependencies = [ 610 | "cfg-if", 611 | ] 612 | 613 | [[package]] 614 | name = "equivalent" 615 | version = "1.0.1" 616 | source = "registry+https://github.com/rust-lang/crates.io-index" 617 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 618 | 619 | [[package]] 620 | name = "errno" 621 | version = "0.3.9" 622 | source = "registry+https://github.com/rust-lang/crates.io-index" 623 | checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" 624 | dependencies = [ 625 | "libc", 626 | "windows-sys 0.52.0", 627 | ] 628 | 629 | [[package]] 630 | name = "error-code" 631 | version = "3.2.0" 632 | source = "registry+https://github.com/rust-lang/crates.io-index" 633 | checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" 634 | 635 | [[package]] 636 | name = "etcetera" 637 | version = "0.8.0" 638 | source = "registry+https://github.com/rust-lang/crates.io-index" 639 | checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" 640 | dependencies = [ 641 | "cfg-if", 642 | "home", 643 | "windows-sys 0.48.0", 644 | ] 645 | 646 | [[package]] 647 | name = "fdeflate" 648 | version = "0.3.4" 649 | source = "registry+https://github.com/rust-lang/crates.io-index" 650 | checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" 651 | dependencies = [ 652 | "simd-adler32", 653 | ] 654 | 655 | [[package]] 656 | name = "flate2" 657 | version = "1.0.33" 658 | source = "registry+https://github.com/rust-lang/crates.io-index" 659 | checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" 660 | dependencies = [ 661 | "crc32fast", 662 | "miniz_oxide 0.8.0", 663 | ] 664 | 665 | [[package]] 666 | name = "fnv" 667 | version = "1.0.7" 668 | source = "registry+https://github.com/rust-lang/crates.io-index" 669 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 670 | 671 | [[package]] 672 | name = "foreign-types" 673 | version = "0.5.0" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" 676 | dependencies = [ 677 | "foreign-types-macros", 678 | "foreign-types-shared", 679 | ] 680 | 681 | [[package]] 682 | name = "foreign-types-macros" 683 | version = "0.2.3" 684 | source = "registry+https://github.com/rust-lang/crates.io-index" 685 | checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" 686 | dependencies = [ 687 | "proc-macro2", 688 | "quote", 689 | "syn", 690 | ] 691 | 692 | [[package]] 693 | name = "foreign-types-shared" 694 | version = "0.3.1" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" 697 | 698 | [[package]] 699 | name = "form_urlencoded" 700 | version = "1.2.1" 701 | source = "registry+https://github.com/rust-lang/crates.io-index" 702 | checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 703 | dependencies = [ 704 | "percent-encoding", 705 | ] 706 | 707 | [[package]] 708 | name = "futures" 709 | version = "0.3.30" 710 | source = "registry+https://github.com/rust-lang/crates.io-index" 711 | checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" 712 | dependencies = [ 713 | "futures-channel", 714 | "futures-core", 715 | "futures-executor", 716 | "futures-io", 717 | "futures-sink", 718 | "futures-task", 719 | "futures-util", 720 | ] 721 | 722 | [[package]] 723 | name = "futures-channel" 724 | version = "0.3.30" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" 727 | dependencies = [ 728 | "futures-core", 729 | "futures-sink", 730 | ] 731 | 732 | [[package]] 733 | name = "futures-core" 734 | version = "0.3.30" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" 737 | 738 | [[package]] 739 | name = "futures-executor" 740 | version = "0.3.30" 741 | source = "registry+https://github.com/rust-lang/crates.io-index" 742 | checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" 743 | dependencies = [ 744 | "futures-core", 745 | "futures-task", 746 | "futures-util", 747 | ] 748 | 749 | [[package]] 750 | name = "futures-io" 751 | version = "0.3.30" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" 754 | 755 | [[package]] 756 | name = "futures-macro" 757 | version = "0.3.30" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" 760 | dependencies = [ 761 | "proc-macro2", 762 | "quote", 763 | "syn", 764 | ] 765 | 766 | [[package]] 767 | name = "futures-sink" 768 | version = "0.3.30" 769 | source = "registry+https://github.com/rust-lang/crates.io-index" 770 | checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" 771 | 772 | [[package]] 773 | name = "futures-task" 774 | version = "0.3.30" 775 | source = "registry+https://github.com/rust-lang/crates.io-index" 776 | checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" 777 | 778 | [[package]] 779 | name = "futures-util" 780 | version = "0.3.30" 781 | source = "registry+https://github.com/rust-lang/crates.io-index" 782 | checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" 783 | dependencies = [ 784 | "futures-channel", 785 | "futures-core", 786 | "futures-io", 787 | "futures-macro", 788 | "futures-sink", 789 | "futures-task", 790 | "memchr", 791 | "pin-project-lite", 792 | "pin-utils", 793 | "slab", 794 | ] 795 | 796 | [[package]] 797 | name = "gethostname" 798 | version = "0.4.3" 799 | source = "registry+https://github.com/rust-lang/crates.io-index" 800 | checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" 801 | dependencies = [ 802 | "libc", 803 | "windows-targets 0.48.5", 804 | ] 805 | 806 | [[package]] 807 | name = "getrandom" 808 | version = "0.2.15" 809 | source = "registry+https://github.com/rust-lang/crates.io-index" 810 | checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 811 | dependencies = [ 812 | "cfg-if", 813 | "libc", 814 | "wasi", 815 | ] 816 | 817 | [[package]] 818 | name = "gimli" 819 | version = "0.29.0" 820 | source = "registry+https://github.com/rust-lang/crates.io-index" 821 | checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" 822 | 823 | [[package]] 824 | name = "git-version" 825 | version = "0.3.9" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "1ad568aa3db0fcbc81f2f116137f263d7304f512a1209b35b85150d3ef88ad19" 828 | dependencies = [ 829 | "git-version-macro", 830 | ] 831 | 832 | [[package]] 833 | name = "git-version-macro" 834 | version = "0.3.9" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" 837 | dependencies = [ 838 | "proc-macro2", 839 | "quote", 840 | "syn", 841 | ] 842 | 843 | [[package]] 844 | name = "git2" 845 | version = "0.19.0" 846 | source = "registry+https://github.com/rust-lang/crates.io-index" 847 | checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" 848 | dependencies = [ 849 | "bitflags 2.6.0", 850 | "libc", 851 | "libgit2-sys", 852 | "log", 853 | "url", 854 | ] 855 | 856 | [[package]] 857 | name = "glob" 858 | version = "0.3.1" 859 | source = "registry+https://github.com/rust-lang/crates.io-index" 860 | checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" 861 | 862 | [[package]] 863 | name = "globset" 864 | version = "0.4.15" 865 | source = "registry+https://github.com/rust-lang/crates.io-index" 866 | checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" 867 | dependencies = [ 868 | "aho-corasick", 869 | "bstr", 870 | "log", 871 | "regex-automata", 872 | "regex-syntax", 873 | ] 874 | 875 | [[package]] 876 | name = "grep-cli" 877 | version = "0.1.11" 878 | source = "registry+https://github.com/rust-lang/crates.io-index" 879 | checksum = "47f1288f0e06f279f84926fa4c17e3fcd2a22b357927a82f2777f7be26e4cec0" 880 | dependencies = [ 881 | "bstr", 882 | "globset", 883 | "libc", 884 | "log", 885 | "termcolor", 886 | "winapi-util", 887 | ] 888 | 889 | [[package]] 890 | name = "hashbrown" 891 | version = "0.14.5" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" 894 | dependencies = [ 895 | "ahash", 896 | "allocator-api2", 897 | ] 898 | 899 | [[package]] 900 | name = "heck" 901 | version = "0.5.0" 902 | source = "registry+https://github.com/rust-lang/crates.io-index" 903 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 904 | 905 | [[package]] 906 | name = "hermit-abi" 907 | version = "0.3.9" 908 | source = "registry+https://github.com/rust-lang/crates.io-index" 909 | checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" 910 | 911 | [[package]] 912 | name = "home" 913 | version = "0.5.9" 914 | source = "registry+https://github.com/rust-lang/crates.io-index" 915 | checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" 916 | dependencies = [ 917 | "windows-sys 0.52.0", 918 | ] 919 | 920 | [[package]] 921 | name = "http" 922 | version = "1.1.0" 923 | source = "registry+https://github.com/rust-lang/crates.io-index" 924 | checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" 925 | dependencies = [ 926 | "bytes", 927 | "fnv", 928 | "itoa", 929 | ] 930 | 931 | [[package]] 932 | name = "http-body" 933 | version = "1.0.1" 934 | source = "registry+https://github.com/rust-lang/crates.io-index" 935 | checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" 936 | dependencies = [ 937 | "bytes", 938 | "http", 939 | ] 940 | 941 | [[package]] 942 | name = "http-body-util" 943 | version = "0.1.2" 944 | source = "registry+https://github.com/rust-lang/crates.io-index" 945 | checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" 946 | dependencies = [ 947 | "bytes", 948 | "futures-util", 949 | "http", 950 | "http-body", 951 | "pin-project-lite", 952 | ] 953 | 954 | [[package]] 955 | name = "httparse" 956 | version = "1.9.4" 957 | source = "registry+https://github.com/rust-lang/crates.io-index" 958 | checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" 959 | 960 | [[package]] 961 | name = "hyper" 962 | version = "1.4.1" 963 | source = "registry+https://github.com/rust-lang/crates.io-index" 964 | checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" 965 | dependencies = [ 966 | "bytes", 967 | "futures-channel", 968 | "futures-util", 969 | "http", 970 | "http-body", 971 | "httparse", 972 | "itoa", 973 | "pin-project-lite", 974 | "smallvec", 975 | "tokio", 976 | "want", 977 | ] 978 | 979 | [[package]] 980 | name = "hyper-rustls" 981 | version = "0.27.3" 982 | source = "registry+https://github.com/rust-lang/crates.io-index" 983 | checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" 984 | dependencies = [ 985 | "futures-util", 986 | "http", 987 | "hyper", 988 | "hyper-util", 989 | "rustls", 990 | "rustls-pki-types", 991 | "tokio", 992 | "tokio-rustls", 993 | "tower-service", 994 | "webpki-roots", 995 | ] 996 | 997 | [[package]] 998 | name = "hyper-util" 999 | version = "0.1.7" 1000 | source = "registry+https://github.com/rust-lang/crates.io-index" 1001 | checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" 1002 | dependencies = [ 1003 | "bytes", 1004 | "futures-channel", 1005 | "futures-util", 1006 | "http", 1007 | "http-body", 1008 | "hyper", 1009 | "pin-project-lite", 1010 | "socket2", 1011 | "tokio", 1012 | "tower", 1013 | "tower-service", 1014 | "tracing", 1015 | ] 1016 | 1017 | [[package]] 1018 | name = "ident_case" 1019 | version = "1.0.1" 1020 | source = "registry+https://github.com/rust-lang/crates.io-index" 1021 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 1022 | 1023 | [[package]] 1024 | name = "idna" 1025 | version = "0.5.0" 1026 | source = "registry+https://github.com/rust-lang/crates.io-index" 1027 | checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" 1028 | dependencies = [ 1029 | "unicode-bidi", 1030 | "unicode-normalization", 1031 | ] 1032 | 1033 | [[package]] 1034 | name = "image" 1035 | version = "0.25.2" 1036 | source = "registry+https://github.com/rust-lang/crates.io-index" 1037 | checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10" 1038 | dependencies = [ 1039 | "bytemuck", 1040 | "byteorder-lite", 1041 | "num-traits", 1042 | "png", 1043 | "tiff", 1044 | ] 1045 | 1046 | [[package]] 1047 | name = "indexmap" 1048 | version = "2.5.0" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" 1051 | dependencies = [ 1052 | "equivalent", 1053 | "hashbrown", 1054 | "serde", 1055 | ] 1056 | 1057 | [[package]] 1058 | name = "indoc" 1059 | version = "2.0.5" 1060 | source = "registry+https://github.com/rust-lang/crates.io-index" 1061 | checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" 1062 | 1063 | [[package]] 1064 | name = "instability" 1065 | version = "0.3.2" 1066 | source = "registry+https://github.com/rust-lang/crates.io-index" 1067 | checksum = "b23a0c8dfe501baac4adf6ebbfa6eddf8f0c07f56b058cc1288017e32397846c" 1068 | dependencies = [ 1069 | "quote", 1070 | "syn", 1071 | ] 1072 | 1073 | [[package]] 1074 | name = "ipnet" 1075 | version = "2.9.0" 1076 | source = "registry+https://github.com/rust-lang/crates.io-index" 1077 | checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" 1078 | 1079 | [[package]] 1080 | name = "is_terminal_polyfill" 1081 | version = "1.70.1" 1082 | source = "registry+https://github.com/rust-lang/crates.io-index" 1083 | checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" 1084 | 1085 | [[package]] 1086 | name = "itertools" 1087 | version = "0.13.0" 1088 | source = "registry+https://github.com/rust-lang/crates.io-index" 1089 | checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" 1090 | dependencies = [ 1091 | "either", 1092 | ] 1093 | 1094 | [[package]] 1095 | name = "itoa" 1096 | version = "1.0.11" 1097 | source = "registry+https://github.com/rust-lang/crates.io-index" 1098 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" 1099 | 1100 | [[package]] 1101 | name = "jobserver" 1102 | version = "0.1.32" 1103 | source = "registry+https://github.com/rust-lang/crates.io-index" 1104 | checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" 1105 | dependencies = [ 1106 | "libc", 1107 | ] 1108 | 1109 | [[package]] 1110 | name = "jpeg-decoder" 1111 | version = "0.3.1" 1112 | source = "registry+https://github.com/rust-lang/crates.io-index" 1113 | checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" 1114 | 1115 | [[package]] 1116 | name = "js-sys" 1117 | version = "0.3.70" 1118 | source = "registry+https://github.com/rust-lang/crates.io-index" 1119 | checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" 1120 | dependencies = [ 1121 | "wasm-bindgen", 1122 | ] 1123 | 1124 | [[package]] 1125 | name = "libc" 1126 | version = "0.2.158" 1127 | source = "registry+https://github.com/rust-lang/crates.io-index" 1128 | checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" 1129 | 1130 | [[package]] 1131 | name = "libgit2-sys" 1132 | version = "0.17.0+1.8.1" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" 1135 | dependencies = [ 1136 | "cc", 1137 | "libc", 1138 | "libz-sys", 1139 | "pkg-config", 1140 | ] 1141 | 1142 | [[package]] 1143 | name = "libredox" 1144 | version = "0.1.3" 1145 | source = "registry+https://github.com/rust-lang/crates.io-index" 1146 | checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" 1147 | dependencies = [ 1148 | "bitflags 2.6.0", 1149 | "libc", 1150 | ] 1151 | 1152 | [[package]] 1153 | name = "libz-sys" 1154 | version = "1.1.20" 1155 | source = "registry+https://github.com/rust-lang/crates.io-index" 1156 | checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" 1157 | dependencies = [ 1158 | "cc", 1159 | "libc", 1160 | "pkg-config", 1161 | "vcpkg", 1162 | ] 1163 | 1164 | [[package]] 1165 | name = "linked-hash-map" 1166 | version = "0.5.6" 1167 | source = "registry+https://github.com/rust-lang/crates.io-index" 1168 | checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" 1169 | 1170 | [[package]] 1171 | name = "linux-raw-sys" 1172 | version = "0.4.14" 1173 | source = "registry+https://github.com/rust-lang/crates.io-index" 1174 | checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" 1175 | 1176 | [[package]] 1177 | name = "lock_api" 1178 | version = "0.4.12" 1179 | source = "registry+https://github.com/rust-lang/crates.io-index" 1180 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 1181 | dependencies = [ 1182 | "autocfg", 1183 | "scopeguard", 1184 | ] 1185 | 1186 | [[package]] 1187 | name = "log" 1188 | version = "0.4.22" 1189 | source = "registry+https://github.com/rust-lang/crates.io-index" 1190 | checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" 1191 | 1192 | [[package]] 1193 | name = "lru" 1194 | version = "0.12.4" 1195 | source = "registry+https://github.com/rust-lang/crates.io-index" 1196 | checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" 1197 | dependencies = [ 1198 | "hashbrown", 1199 | ] 1200 | 1201 | [[package]] 1202 | name = "memchr" 1203 | version = "2.7.4" 1204 | source = "registry+https://github.com/rust-lang/crates.io-index" 1205 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 1206 | 1207 | [[package]] 1208 | name = "mime" 1209 | version = "0.3.17" 1210 | source = "registry+https://github.com/rust-lang/crates.io-index" 1211 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 1212 | 1213 | [[package]] 1214 | name = "minimal-lexical" 1215 | version = "0.2.1" 1216 | source = "registry+https://github.com/rust-lang/crates.io-index" 1217 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 1218 | 1219 | [[package]] 1220 | name = "miniz_oxide" 1221 | version = "0.7.4" 1222 | source = "registry+https://github.com/rust-lang/crates.io-index" 1223 | checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" 1224 | dependencies = [ 1225 | "adler", 1226 | "simd-adler32", 1227 | ] 1228 | 1229 | [[package]] 1230 | name = "miniz_oxide" 1231 | version = "0.8.0" 1232 | source = "registry+https://github.com/rust-lang/crates.io-index" 1233 | checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" 1234 | dependencies = [ 1235 | "adler2", 1236 | ] 1237 | 1238 | [[package]] 1239 | name = "mio" 1240 | version = "1.0.2" 1241 | source = "registry+https://github.com/rust-lang/crates.io-index" 1242 | checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" 1243 | dependencies = [ 1244 | "hermit-abi", 1245 | "libc", 1246 | "log", 1247 | "wasi", 1248 | "windows-sys 0.52.0", 1249 | ] 1250 | 1251 | [[package]] 1252 | name = "nom" 1253 | version = "7.1.3" 1254 | source = "registry+https://github.com/rust-lang/crates.io-index" 1255 | checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" 1256 | dependencies = [ 1257 | "memchr", 1258 | "minimal-lexical", 1259 | ] 1260 | 1261 | [[package]] 1262 | name = "nu-ansi-term" 1263 | version = "0.50.1" 1264 | source = "registry+https://github.com/rust-lang/crates.io-index" 1265 | checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" 1266 | dependencies = [ 1267 | "windows-sys 0.52.0", 1268 | ] 1269 | 1270 | [[package]] 1271 | name = "num-conv" 1272 | version = "0.1.0" 1273 | source = "registry+https://github.com/rust-lang/crates.io-index" 1274 | checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" 1275 | 1276 | [[package]] 1277 | name = "num-traits" 1278 | version = "0.2.19" 1279 | source = "registry+https://github.com/rust-lang/crates.io-index" 1280 | checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 1281 | dependencies = [ 1282 | "autocfg", 1283 | ] 1284 | 1285 | [[package]] 1286 | name = "num_threads" 1287 | version = "0.1.7" 1288 | source = "registry+https://github.com/rust-lang/crates.io-index" 1289 | checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" 1290 | dependencies = [ 1291 | "libc", 1292 | ] 1293 | 1294 | [[package]] 1295 | name = "objc-sys" 1296 | version = "0.3.5" 1297 | source = "registry+https://github.com/rust-lang/crates.io-index" 1298 | checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" 1299 | 1300 | [[package]] 1301 | name = "objc2" 1302 | version = "0.5.2" 1303 | source = "registry+https://github.com/rust-lang/crates.io-index" 1304 | checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" 1305 | dependencies = [ 1306 | "objc-sys", 1307 | "objc2-encode", 1308 | ] 1309 | 1310 | [[package]] 1311 | name = "objc2-app-kit" 1312 | version = "0.2.2" 1313 | source = "registry+https://github.com/rust-lang/crates.io-index" 1314 | checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" 1315 | dependencies = [ 1316 | "bitflags 2.6.0", 1317 | "block2", 1318 | "libc", 1319 | "objc2", 1320 | "objc2-core-data", 1321 | "objc2-core-image", 1322 | "objc2-foundation", 1323 | "objc2-quartz-core", 1324 | ] 1325 | 1326 | [[package]] 1327 | name = "objc2-core-data" 1328 | version = "0.2.2" 1329 | source = "registry+https://github.com/rust-lang/crates.io-index" 1330 | checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" 1331 | dependencies = [ 1332 | "bitflags 2.6.0", 1333 | "block2", 1334 | "objc2", 1335 | "objc2-foundation", 1336 | ] 1337 | 1338 | [[package]] 1339 | name = "objc2-core-image" 1340 | version = "0.2.2" 1341 | source = "registry+https://github.com/rust-lang/crates.io-index" 1342 | checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" 1343 | dependencies = [ 1344 | "block2", 1345 | "objc2", 1346 | "objc2-foundation", 1347 | "objc2-metal", 1348 | ] 1349 | 1350 | [[package]] 1351 | name = "objc2-encode" 1352 | version = "4.0.3" 1353 | source = "registry+https://github.com/rust-lang/crates.io-index" 1354 | checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8" 1355 | 1356 | [[package]] 1357 | name = "objc2-foundation" 1358 | version = "0.2.2" 1359 | source = "registry+https://github.com/rust-lang/crates.io-index" 1360 | checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" 1361 | dependencies = [ 1362 | "bitflags 2.6.0", 1363 | "block2", 1364 | "libc", 1365 | "objc2", 1366 | ] 1367 | 1368 | [[package]] 1369 | name = "objc2-metal" 1370 | version = "0.2.2" 1371 | source = "registry+https://github.com/rust-lang/crates.io-index" 1372 | checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" 1373 | dependencies = [ 1374 | "bitflags 2.6.0", 1375 | "block2", 1376 | "objc2", 1377 | "objc2-foundation", 1378 | ] 1379 | 1380 | [[package]] 1381 | name = "objc2-quartz-core" 1382 | version = "0.2.2" 1383 | source = "registry+https://github.com/rust-lang/crates.io-index" 1384 | checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" 1385 | dependencies = [ 1386 | "bitflags 2.6.0", 1387 | "block2", 1388 | "objc2", 1389 | "objc2-foundation", 1390 | "objc2-metal", 1391 | ] 1392 | 1393 | [[package]] 1394 | name = "object" 1395 | version = "0.36.4" 1396 | source = "registry+https://github.com/rust-lang/crates.io-index" 1397 | checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" 1398 | dependencies = [ 1399 | "memchr", 1400 | ] 1401 | 1402 | [[package]] 1403 | name = "once_cell" 1404 | version = "1.20.2" 1405 | source = "registry+https://github.com/rust-lang/crates.io-index" 1406 | checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" 1407 | 1408 | [[package]] 1409 | name = "onig" 1410 | version = "6.4.0" 1411 | source = "registry+https://github.com/rust-lang/crates.io-index" 1412 | checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" 1413 | dependencies = [ 1414 | "bitflags 1.3.2", 1415 | "libc", 1416 | "once_cell", 1417 | "onig_sys", 1418 | ] 1419 | 1420 | [[package]] 1421 | name = "onig_sys" 1422 | version = "69.8.1" 1423 | source = "registry+https://github.com/rust-lang/crates.io-index" 1424 | checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7" 1425 | dependencies = [ 1426 | "cc", 1427 | "pkg-config", 1428 | ] 1429 | 1430 | [[package]] 1431 | name = "option-ext" 1432 | version = "0.2.0" 1433 | source = "registry+https://github.com/rust-lang/crates.io-index" 1434 | checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" 1435 | 1436 | [[package]] 1437 | name = "parking_lot" 1438 | version = "0.12.3" 1439 | source = "registry+https://github.com/rust-lang/crates.io-index" 1440 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" 1441 | dependencies = [ 1442 | "lock_api", 1443 | "parking_lot_core", 1444 | ] 1445 | 1446 | [[package]] 1447 | name = "parking_lot_core" 1448 | version = "0.9.10" 1449 | source = "registry+https://github.com/rust-lang/crates.io-index" 1450 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 1451 | dependencies = [ 1452 | "cfg-if", 1453 | "libc", 1454 | "redox_syscall", 1455 | "smallvec", 1456 | "windows-targets 0.52.6", 1457 | ] 1458 | 1459 | [[package]] 1460 | name = "paste" 1461 | version = "1.0.15" 1462 | source = "registry+https://github.com/rust-lang/crates.io-index" 1463 | checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" 1464 | 1465 | [[package]] 1466 | name = "path_abs" 1467 | version = "0.5.1" 1468 | source = "registry+https://github.com/rust-lang/crates.io-index" 1469 | checksum = "05ef02f6342ac01d8a93b65f96db53fe68a92a15f41144f97fb00a9e669633c3" 1470 | dependencies = [ 1471 | "std_prelude", 1472 | ] 1473 | 1474 | [[package]] 1475 | name = "percent-encoding" 1476 | version = "2.3.1" 1477 | source = "registry+https://github.com/rust-lang/crates.io-index" 1478 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 1479 | 1480 | [[package]] 1481 | name = "pin-project" 1482 | version = "1.1.5" 1483 | source = "registry+https://github.com/rust-lang/crates.io-index" 1484 | checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" 1485 | dependencies = [ 1486 | "pin-project-internal", 1487 | ] 1488 | 1489 | [[package]] 1490 | name = "pin-project-internal" 1491 | version = "1.1.5" 1492 | source = "registry+https://github.com/rust-lang/crates.io-index" 1493 | checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" 1494 | dependencies = [ 1495 | "proc-macro2", 1496 | "quote", 1497 | "syn", 1498 | ] 1499 | 1500 | [[package]] 1501 | name = "pin-project-lite" 1502 | version = "0.2.14" 1503 | source = "registry+https://github.com/rust-lang/crates.io-index" 1504 | checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" 1505 | 1506 | [[package]] 1507 | name = "pin-utils" 1508 | version = "0.1.0" 1509 | source = "registry+https://github.com/rust-lang/crates.io-index" 1510 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1511 | 1512 | [[package]] 1513 | name = "pkg-config" 1514 | version = "0.3.30" 1515 | source = "registry+https://github.com/rust-lang/crates.io-index" 1516 | checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" 1517 | 1518 | [[package]] 1519 | name = "plist" 1520 | version = "1.7.0" 1521 | source = "registry+https://github.com/rust-lang/crates.io-index" 1522 | checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" 1523 | dependencies = [ 1524 | "base64", 1525 | "indexmap", 1526 | "quick-xml", 1527 | "serde", 1528 | "time", 1529 | ] 1530 | 1531 | [[package]] 1532 | name = "png" 1533 | version = "0.17.13" 1534 | source = "registry+https://github.com/rust-lang/crates.io-index" 1535 | checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" 1536 | dependencies = [ 1537 | "bitflags 1.3.2", 1538 | "crc32fast", 1539 | "fdeflate", 1540 | "flate2", 1541 | "miniz_oxide 0.7.4", 1542 | ] 1543 | 1544 | [[package]] 1545 | name = "powerfmt" 1546 | version = "0.2.0" 1547 | source = "registry+https://github.com/rust-lang/crates.io-index" 1548 | checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" 1549 | 1550 | [[package]] 1551 | name = "ppv-lite86" 1552 | version = "0.2.20" 1553 | source = "registry+https://github.com/rust-lang/crates.io-index" 1554 | checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" 1555 | dependencies = [ 1556 | "zerocopy", 1557 | ] 1558 | 1559 | [[package]] 1560 | name = "proc-macro2" 1561 | version = "1.0.86" 1562 | source = "registry+https://github.com/rust-lang/crates.io-index" 1563 | checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" 1564 | dependencies = [ 1565 | "unicode-ident", 1566 | ] 1567 | 1568 | [[package]] 1569 | name = "quick-xml" 1570 | version = "0.32.0" 1571 | source = "registry+https://github.com/rust-lang/crates.io-index" 1572 | checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2" 1573 | dependencies = [ 1574 | "memchr", 1575 | ] 1576 | 1577 | [[package]] 1578 | name = "quinn" 1579 | version = "0.11.5" 1580 | source = "registry+https://github.com/rust-lang/crates.io-index" 1581 | checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" 1582 | dependencies = [ 1583 | "bytes", 1584 | "pin-project-lite", 1585 | "quinn-proto", 1586 | "quinn-udp", 1587 | "rustc-hash", 1588 | "rustls", 1589 | "socket2", 1590 | "thiserror", 1591 | "tokio", 1592 | "tracing", 1593 | ] 1594 | 1595 | [[package]] 1596 | name = "quinn-proto" 1597 | version = "0.11.8" 1598 | source = "registry+https://github.com/rust-lang/crates.io-index" 1599 | checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" 1600 | dependencies = [ 1601 | "bytes", 1602 | "rand", 1603 | "ring", 1604 | "rustc-hash", 1605 | "rustls", 1606 | "slab", 1607 | "thiserror", 1608 | "tinyvec", 1609 | "tracing", 1610 | ] 1611 | 1612 | [[package]] 1613 | name = "quinn-udp" 1614 | version = "0.5.5" 1615 | source = "registry+https://github.com/rust-lang/crates.io-index" 1616 | checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" 1617 | dependencies = [ 1618 | "libc", 1619 | "once_cell", 1620 | "socket2", 1621 | "tracing", 1622 | "windows-sys 0.59.0", 1623 | ] 1624 | 1625 | [[package]] 1626 | name = "quote" 1627 | version = "1.0.37" 1628 | source = "registry+https://github.com/rust-lang/crates.io-index" 1629 | checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" 1630 | dependencies = [ 1631 | "proc-macro2", 1632 | ] 1633 | 1634 | [[package]] 1635 | name = "rand" 1636 | version = "0.8.5" 1637 | source = "registry+https://github.com/rust-lang/crates.io-index" 1638 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1639 | dependencies = [ 1640 | "libc", 1641 | "rand_chacha", 1642 | "rand_core", 1643 | ] 1644 | 1645 | [[package]] 1646 | name = "rand_chacha" 1647 | version = "0.3.1" 1648 | source = "registry+https://github.com/rust-lang/crates.io-index" 1649 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1650 | dependencies = [ 1651 | "ppv-lite86", 1652 | "rand_core", 1653 | ] 1654 | 1655 | [[package]] 1656 | name = "rand_core" 1657 | version = "0.6.4" 1658 | source = "registry+https://github.com/rust-lang/crates.io-index" 1659 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1660 | dependencies = [ 1661 | "getrandom", 1662 | ] 1663 | 1664 | [[package]] 1665 | name = "ratatui" 1666 | version = "0.29.0" 1667 | source = "registry+https://github.com/rust-lang/crates.io-index" 1668 | checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" 1669 | dependencies = [ 1670 | "bitflags 2.6.0", 1671 | "cassowary", 1672 | "compact_str", 1673 | "crossterm", 1674 | "indoc", 1675 | "instability", 1676 | "itertools", 1677 | "lru", 1678 | "paste", 1679 | "strum", 1680 | "time", 1681 | "unicode-segmentation", 1682 | "unicode-truncate", 1683 | "unicode-width 0.2.0", 1684 | ] 1685 | 1686 | [[package]] 1687 | name = "redox_syscall" 1688 | version = "0.5.3" 1689 | source = "registry+https://github.com/rust-lang/crates.io-index" 1690 | checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" 1691 | dependencies = [ 1692 | "bitflags 2.6.0", 1693 | ] 1694 | 1695 | [[package]] 1696 | name = "redox_users" 1697 | version = "0.4.6" 1698 | source = "registry+https://github.com/rust-lang/crates.io-index" 1699 | checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" 1700 | dependencies = [ 1701 | "getrandom", 1702 | "libredox", 1703 | "thiserror", 1704 | ] 1705 | 1706 | [[package]] 1707 | name = "regex" 1708 | version = "1.10.6" 1709 | source = "registry+https://github.com/rust-lang/crates.io-index" 1710 | checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" 1711 | dependencies = [ 1712 | "aho-corasick", 1713 | "memchr", 1714 | "regex-automata", 1715 | "regex-syntax", 1716 | ] 1717 | 1718 | [[package]] 1719 | name = "regex-automata" 1720 | version = "0.4.7" 1721 | source = "registry+https://github.com/rust-lang/crates.io-index" 1722 | checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" 1723 | dependencies = [ 1724 | "aho-corasick", 1725 | "memchr", 1726 | "regex-syntax", 1727 | ] 1728 | 1729 | [[package]] 1730 | name = "regex-syntax" 1731 | version = "0.8.4" 1732 | source = "registry+https://github.com/rust-lang/crates.io-index" 1733 | checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" 1734 | 1735 | [[package]] 1736 | name = "reqwest" 1737 | version = "0.12.7" 1738 | source = "registry+https://github.com/rust-lang/crates.io-index" 1739 | checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" 1740 | dependencies = [ 1741 | "base64", 1742 | "bytes", 1743 | "futures-core", 1744 | "futures-util", 1745 | "http", 1746 | "http-body", 1747 | "http-body-util", 1748 | "hyper", 1749 | "hyper-rustls", 1750 | "hyper-util", 1751 | "ipnet", 1752 | "js-sys", 1753 | "log", 1754 | "mime", 1755 | "once_cell", 1756 | "percent-encoding", 1757 | "pin-project-lite", 1758 | "quinn", 1759 | "rustls", 1760 | "rustls-pemfile", 1761 | "rustls-pki-types", 1762 | "serde", 1763 | "serde_json", 1764 | "serde_urlencoded", 1765 | "sync_wrapper", 1766 | "tokio", 1767 | "tokio-rustls", 1768 | "tower-service", 1769 | "url", 1770 | "wasm-bindgen", 1771 | "wasm-bindgen-futures", 1772 | "web-sys", 1773 | "webpki-roots", 1774 | "windows-registry", 1775 | ] 1776 | 1777 | [[package]] 1778 | name = "rgb" 1779 | version = "0.8.50" 1780 | source = "registry+https://github.com/rust-lang/crates.io-index" 1781 | checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" 1782 | dependencies = [ 1783 | "bytemuck", 1784 | ] 1785 | 1786 | [[package]] 1787 | name = "ring" 1788 | version = "0.17.8" 1789 | source = "registry+https://github.com/rust-lang/crates.io-index" 1790 | checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" 1791 | dependencies = [ 1792 | "cc", 1793 | "cfg-if", 1794 | "getrandom", 1795 | "libc", 1796 | "spin", 1797 | "untrusted", 1798 | "windows-sys 0.52.0", 1799 | ] 1800 | 1801 | [[package]] 1802 | name = "rustc-demangle" 1803 | version = "0.1.24" 1804 | source = "registry+https://github.com/rust-lang/crates.io-index" 1805 | checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" 1806 | 1807 | [[package]] 1808 | name = "rustc-hash" 1809 | version = "2.0.0" 1810 | source = "registry+https://github.com/rust-lang/crates.io-index" 1811 | checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" 1812 | 1813 | [[package]] 1814 | name = "rustix" 1815 | version = "0.38.35" 1816 | source = "registry+https://github.com/rust-lang/crates.io-index" 1817 | checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" 1818 | dependencies = [ 1819 | "bitflags 2.6.0", 1820 | "errno", 1821 | "libc", 1822 | "linux-raw-sys", 1823 | "windows-sys 0.52.0", 1824 | ] 1825 | 1826 | [[package]] 1827 | name = "rustls" 1828 | version = "0.23.12" 1829 | source = "registry+https://github.com/rust-lang/crates.io-index" 1830 | checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" 1831 | dependencies = [ 1832 | "once_cell", 1833 | "ring", 1834 | "rustls-pki-types", 1835 | "rustls-webpki", 1836 | "subtle", 1837 | "zeroize", 1838 | ] 1839 | 1840 | [[package]] 1841 | name = "rustls-pemfile" 1842 | version = "2.1.3" 1843 | source = "registry+https://github.com/rust-lang/crates.io-index" 1844 | checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" 1845 | dependencies = [ 1846 | "base64", 1847 | "rustls-pki-types", 1848 | ] 1849 | 1850 | [[package]] 1851 | name = "rustls-pki-types" 1852 | version = "1.8.0" 1853 | source = "registry+https://github.com/rust-lang/crates.io-index" 1854 | checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" 1855 | 1856 | [[package]] 1857 | name = "rustls-webpki" 1858 | version = "0.102.7" 1859 | source = "registry+https://github.com/rust-lang/crates.io-index" 1860 | checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56" 1861 | dependencies = [ 1862 | "ring", 1863 | "rustls-pki-types", 1864 | "untrusted", 1865 | ] 1866 | 1867 | [[package]] 1868 | name = "rustversion" 1869 | version = "1.0.17" 1870 | source = "registry+https://github.com/rust-lang/crates.io-index" 1871 | checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" 1872 | 1873 | [[package]] 1874 | name = "ryu" 1875 | version = "1.0.18" 1876 | source = "registry+https://github.com/rust-lang/crates.io-index" 1877 | checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" 1878 | 1879 | [[package]] 1880 | name = "same-file" 1881 | version = "1.0.6" 1882 | source = "registry+https://github.com/rust-lang/crates.io-index" 1883 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 1884 | dependencies = [ 1885 | "winapi-util", 1886 | ] 1887 | 1888 | [[package]] 1889 | name = "scopeguard" 1890 | version = "1.2.0" 1891 | source = "registry+https://github.com/rust-lang/crates.io-index" 1892 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1893 | 1894 | [[package]] 1895 | name = "semver" 1896 | version = "1.0.23" 1897 | source = "registry+https://github.com/rust-lang/crates.io-index" 1898 | checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" 1899 | 1900 | [[package]] 1901 | name = "serde" 1902 | version = "1.0.209" 1903 | source = "registry+https://github.com/rust-lang/crates.io-index" 1904 | checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" 1905 | dependencies = [ 1906 | "serde_derive", 1907 | ] 1908 | 1909 | [[package]] 1910 | name = "serde_derive" 1911 | version = "1.0.209" 1912 | source = "registry+https://github.com/rust-lang/crates.io-index" 1913 | checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" 1914 | dependencies = [ 1915 | "proc-macro2", 1916 | "quote", 1917 | "syn", 1918 | ] 1919 | 1920 | [[package]] 1921 | name = "serde_json" 1922 | version = "1.0.128" 1923 | source = "registry+https://github.com/rust-lang/crates.io-index" 1924 | checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" 1925 | dependencies = [ 1926 | "itoa", 1927 | "memchr", 1928 | "ryu", 1929 | "serde", 1930 | ] 1931 | 1932 | [[package]] 1933 | name = "serde_spanned" 1934 | version = "0.6.7" 1935 | source = "registry+https://github.com/rust-lang/crates.io-index" 1936 | checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" 1937 | dependencies = [ 1938 | "serde", 1939 | ] 1940 | 1941 | [[package]] 1942 | name = "serde_urlencoded" 1943 | version = "0.7.1" 1944 | source = "registry+https://github.com/rust-lang/crates.io-index" 1945 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1946 | dependencies = [ 1947 | "form_urlencoded", 1948 | "itoa", 1949 | "ryu", 1950 | "serde", 1951 | ] 1952 | 1953 | [[package]] 1954 | name = "serde_with" 1955 | version = "3.12.0" 1956 | source = "registry+https://github.com/rust-lang/crates.io-index" 1957 | checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" 1958 | dependencies = [ 1959 | "serde", 1960 | "serde_derive", 1961 | "serde_with_macros", 1962 | ] 1963 | 1964 | [[package]] 1965 | name = "serde_with_macros" 1966 | version = "3.12.0" 1967 | source = "registry+https://github.com/rust-lang/crates.io-index" 1968 | checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" 1969 | dependencies = [ 1970 | "darling", 1971 | "proc-macro2", 1972 | "quote", 1973 | "syn", 1974 | ] 1975 | 1976 | [[package]] 1977 | name = "serde_yaml" 1978 | version = "0.9.34+deprecated" 1979 | source = "registry+https://github.com/rust-lang/crates.io-index" 1980 | checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" 1981 | dependencies = [ 1982 | "indexmap", 1983 | "itoa", 1984 | "ryu", 1985 | "serde", 1986 | "unsafe-libyaml", 1987 | ] 1988 | 1989 | [[package]] 1990 | name = "shell-escape" 1991 | version = "0.1.5" 1992 | source = "registry+https://github.com/rust-lang/crates.io-index" 1993 | checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" 1994 | 1995 | [[package]] 1996 | name = "shell-words" 1997 | version = "1.1.0" 1998 | source = "registry+https://github.com/rust-lang/crates.io-index" 1999 | checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" 2000 | 2001 | [[package]] 2002 | name = "shlex" 2003 | version = "1.3.0" 2004 | source = "registry+https://github.com/rust-lang/crates.io-index" 2005 | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 2006 | 2007 | [[package]] 2008 | name = "signal-hook" 2009 | version = "0.3.17" 2010 | source = "registry+https://github.com/rust-lang/crates.io-index" 2011 | checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" 2012 | dependencies = [ 2013 | "libc", 2014 | "signal-hook-registry", 2015 | ] 2016 | 2017 | [[package]] 2018 | name = "signal-hook-mio" 2019 | version = "0.2.4" 2020 | source = "registry+https://github.com/rust-lang/crates.io-index" 2021 | checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" 2022 | dependencies = [ 2023 | "libc", 2024 | "mio", 2025 | "signal-hook", 2026 | ] 2027 | 2028 | [[package]] 2029 | name = "signal-hook-registry" 2030 | version = "1.4.2" 2031 | source = "registry+https://github.com/rust-lang/crates.io-index" 2032 | checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 2033 | dependencies = [ 2034 | "libc", 2035 | ] 2036 | 2037 | [[package]] 2038 | name = "simd-adler32" 2039 | version = "0.3.7" 2040 | source = "registry+https://github.com/rust-lang/crates.io-index" 2041 | checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" 2042 | 2043 | [[package]] 2044 | name = "simdutf8" 2045 | version = "0.1.4" 2046 | source = "registry+https://github.com/rust-lang/crates.io-index" 2047 | checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" 2048 | 2049 | [[package]] 2050 | name = "slab" 2051 | version = "0.4.9" 2052 | source = "registry+https://github.com/rust-lang/crates.io-index" 2053 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 2054 | dependencies = [ 2055 | "autocfg", 2056 | ] 2057 | 2058 | [[package]] 2059 | name = "smallvec" 2060 | version = "1.13.2" 2061 | source = "registry+https://github.com/rust-lang/crates.io-index" 2062 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 2063 | 2064 | [[package]] 2065 | name = "socket2" 2066 | version = "0.5.7" 2067 | source = "registry+https://github.com/rust-lang/crates.io-index" 2068 | checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" 2069 | dependencies = [ 2070 | "libc", 2071 | "windows-sys 0.52.0", 2072 | ] 2073 | 2074 | [[package]] 2075 | name = "spin" 2076 | version = "0.9.8" 2077 | source = "registry+https://github.com/rust-lang/crates.io-index" 2078 | checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" 2079 | 2080 | [[package]] 2081 | name = "static_assertions" 2082 | version = "1.1.0" 2083 | source = "registry+https://github.com/rust-lang/crates.io-index" 2084 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 2085 | 2086 | [[package]] 2087 | name = "std_prelude" 2088 | version = "0.2.12" 2089 | source = "registry+https://github.com/rust-lang/crates.io-index" 2090 | checksum = "8207e78455ffdf55661170876f88daf85356e4edd54e0a3dbc79586ca1e50cbe" 2091 | 2092 | [[package]] 2093 | name = "strsim" 2094 | version = "0.11.1" 2095 | source = "registry+https://github.com/rust-lang/crates.io-index" 2096 | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 2097 | 2098 | [[package]] 2099 | name = "strum" 2100 | version = "0.26.3" 2101 | source = "registry+https://github.com/rust-lang/crates.io-index" 2102 | checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" 2103 | dependencies = [ 2104 | "strum_macros", 2105 | ] 2106 | 2107 | [[package]] 2108 | name = "strum_macros" 2109 | version = "0.26.4" 2110 | source = "registry+https://github.com/rust-lang/crates.io-index" 2111 | checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" 2112 | dependencies = [ 2113 | "heck", 2114 | "proc-macro2", 2115 | "quote", 2116 | "rustversion", 2117 | "syn", 2118 | ] 2119 | 2120 | [[package]] 2121 | name = "subtle" 2122 | version = "2.6.1" 2123 | source = "registry+https://github.com/rust-lang/crates.io-index" 2124 | checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" 2125 | 2126 | [[package]] 2127 | name = "syn" 2128 | version = "2.0.77" 2129 | source = "registry+https://github.com/rust-lang/crates.io-index" 2130 | checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" 2131 | dependencies = [ 2132 | "proc-macro2", 2133 | "quote", 2134 | "unicode-ident", 2135 | ] 2136 | 2137 | [[package]] 2138 | name = "sync_wrapper" 2139 | version = "1.0.1" 2140 | source = "registry+https://github.com/rust-lang/crates.io-index" 2141 | checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" 2142 | dependencies = [ 2143 | "futures-core", 2144 | ] 2145 | 2146 | [[package]] 2147 | name = "syntect" 2148 | version = "5.2.0" 2149 | source = "registry+https://github.com/rust-lang/crates.io-index" 2150 | checksum = "874dcfa363995604333cf947ae9f751ca3af4522c60886774c4963943b4746b1" 2151 | dependencies = [ 2152 | "bincode", 2153 | "bitflags 1.3.2", 2154 | "flate2", 2155 | "fnv", 2156 | "once_cell", 2157 | "onig", 2158 | "plist", 2159 | "regex-syntax", 2160 | "serde", 2161 | "serde_derive", 2162 | "serde_json", 2163 | "thiserror", 2164 | "walkdir", 2165 | "yaml-rust", 2166 | ] 2167 | 2168 | [[package]] 2169 | name = "sys-info" 2170 | version = "0.9.1" 2171 | source = "registry+https://github.com/rust-lang/crates.io-index" 2172 | checksum = "0b3a0d0aba8bf96a0e1ddfdc352fc53b3df7f39318c71854910c3c4b024ae52c" 2173 | dependencies = [ 2174 | "cc", 2175 | "libc", 2176 | ] 2177 | 2178 | [[package]] 2179 | name = "tenere" 2180 | version = "0.11.2" 2181 | dependencies = [ 2182 | "ansi-to-tui", 2183 | "arboard", 2184 | "async-trait", 2185 | "bat", 2186 | "clap", 2187 | "crossterm", 2188 | "dirs", 2189 | "futures", 2190 | "ratatui", 2191 | "regex", 2192 | "reqwest", 2193 | "serde", 2194 | "serde_json", 2195 | "strum", 2196 | "strum_macros", 2197 | "tokio", 2198 | "toml", 2199 | "tui-textarea", 2200 | "unicode-width 0.2.0", 2201 | ] 2202 | 2203 | [[package]] 2204 | name = "termcolor" 2205 | version = "1.4.1" 2206 | source = "registry+https://github.com/rust-lang/crates.io-index" 2207 | checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" 2208 | dependencies = [ 2209 | "winapi-util", 2210 | ] 2211 | 2212 | [[package]] 2213 | name = "terminal-colorsaurus" 2214 | version = "0.4.7" 2215 | source = "registry+https://github.com/rust-lang/crates.io-index" 2216 | checksum = "858625398bdd5da7a96e8ad33a10031a50c3a5ad50d5aaa81a2827369a9c216c" 2217 | dependencies = [ 2218 | "cfg-if", 2219 | "libc", 2220 | "memchr", 2221 | "mio", 2222 | "terminal-trx", 2223 | "windows-sys 0.59.0", 2224 | ] 2225 | 2226 | [[package]] 2227 | name = "terminal-trx" 2228 | version = "0.2.3" 2229 | source = "registry+https://github.com/rust-lang/crates.io-index" 2230 | checksum = "57a5b836e7f4f81afe61b5cd399eee774f25edcfd47009a76e29f53bb6487833" 2231 | dependencies = [ 2232 | "cfg-if", 2233 | "libc", 2234 | "windows-sys 0.59.0", 2235 | ] 2236 | 2237 | [[package]] 2238 | name = "terminal_size" 2239 | version = "0.3.0" 2240 | source = "registry+https://github.com/rust-lang/crates.io-index" 2241 | checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" 2242 | dependencies = [ 2243 | "rustix", 2244 | "windows-sys 0.48.0", 2245 | ] 2246 | 2247 | [[package]] 2248 | name = "thiserror" 2249 | version = "1.0.63" 2250 | source = "registry+https://github.com/rust-lang/crates.io-index" 2251 | checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" 2252 | dependencies = [ 2253 | "thiserror-impl", 2254 | ] 2255 | 2256 | [[package]] 2257 | name = "thiserror-impl" 2258 | version = "1.0.63" 2259 | source = "registry+https://github.com/rust-lang/crates.io-index" 2260 | checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" 2261 | dependencies = [ 2262 | "proc-macro2", 2263 | "quote", 2264 | "syn", 2265 | ] 2266 | 2267 | [[package]] 2268 | name = "tiff" 2269 | version = "0.9.1" 2270 | source = "registry+https://github.com/rust-lang/crates.io-index" 2271 | checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" 2272 | dependencies = [ 2273 | "flate2", 2274 | "jpeg-decoder", 2275 | "weezl", 2276 | ] 2277 | 2278 | [[package]] 2279 | name = "time" 2280 | version = "0.3.36" 2281 | source = "registry+https://github.com/rust-lang/crates.io-index" 2282 | checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" 2283 | dependencies = [ 2284 | "deranged", 2285 | "itoa", 2286 | "libc", 2287 | "num-conv", 2288 | "num_threads", 2289 | "powerfmt", 2290 | "serde", 2291 | "time-core", 2292 | "time-macros", 2293 | ] 2294 | 2295 | [[package]] 2296 | name = "time-core" 2297 | version = "0.1.2" 2298 | source = "registry+https://github.com/rust-lang/crates.io-index" 2299 | checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" 2300 | 2301 | [[package]] 2302 | name = "time-macros" 2303 | version = "0.2.18" 2304 | source = "registry+https://github.com/rust-lang/crates.io-index" 2305 | checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" 2306 | dependencies = [ 2307 | "num-conv", 2308 | "time-core", 2309 | ] 2310 | 2311 | [[package]] 2312 | name = "tinyvec" 2313 | version = "1.8.0" 2314 | source = "registry+https://github.com/rust-lang/crates.io-index" 2315 | checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" 2316 | dependencies = [ 2317 | "tinyvec_macros", 2318 | ] 2319 | 2320 | [[package]] 2321 | name = "tinyvec_macros" 2322 | version = "0.1.1" 2323 | source = "registry+https://github.com/rust-lang/crates.io-index" 2324 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 2325 | 2326 | [[package]] 2327 | name = "tokio" 2328 | version = "1.40.0" 2329 | source = "registry+https://github.com/rust-lang/crates.io-index" 2330 | checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" 2331 | dependencies = [ 2332 | "backtrace", 2333 | "bytes", 2334 | "libc", 2335 | "mio", 2336 | "parking_lot", 2337 | "pin-project-lite", 2338 | "signal-hook-registry", 2339 | "socket2", 2340 | "tokio-macros", 2341 | "windows-sys 0.52.0", 2342 | ] 2343 | 2344 | [[package]] 2345 | name = "tokio-macros" 2346 | version = "2.4.0" 2347 | source = "registry+https://github.com/rust-lang/crates.io-index" 2348 | checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" 2349 | dependencies = [ 2350 | "proc-macro2", 2351 | "quote", 2352 | "syn", 2353 | ] 2354 | 2355 | [[package]] 2356 | name = "tokio-rustls" 2357 | version = "0.26.0" 2358 | source = "registry+https://github.com/rust-lang/crates.io-index" 2359 | checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" 2360 | dependencies = [ 2361 | "rustls", 2362 | "rustls-pki-types", 2363 | "tokio", 2364 | ] 2365 | 2366 | [[package]] 2367 | name = "toml" 2368 | version = "0.8.19" 2369 | source = "registry+https://github.com/rust-lang/crates.io-index" 2370 | checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" 2371 | dependencies = [ 2372 | "indexmap", 2373 | "serde", 2374 | "serde_spanned", 2375 | "toml_datetime", 2376 | "toml_edit", 2377 | ] 2378 | 2379 | [[package]] 2380 | name = "toml_datetime" 2381 | version = "0.6.8" 2382 | source = "registry+https://github.com/rust-lang/crates.io-index" 2383 | checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" 2384 | dependencies = [ 2385 | "serde", 2386 | ] 2387 | 2388 | [[package]] 2389 | name = "toml_edit" 2390 | version = "0.22.20" 2391 | source = "registry+https://github.com/rust-lang/crates.io-index" 2392 | checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" 2393 | dependencies = [ 2394 | "indexmap", 2395 | "serde", 2396 | "serde_spanned", 2397 | "toml_datetime", 2398 | "winnow", 2399 | ] 2400 | 2401 | [[package]] 2402 | name = "tower" 2403 | version = "0.4.13" 2404 | source = "registry+https://github.com/rust-lang/crates.io-index" 2405 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" 2406 | dependencies = [ 2407 | "futures-core", 2408 | "futures-util", 2409 | "pin-project", 2410 | "pin-project-lite", 2411 | "tokio", 2412 | "tower-layer", 2413 | "tower-service", 2414 | ] 2415 | 2416 | [[package]] 2417 | name = "tower-layer" 2418 | version = "0.3.3" 2419 | source = "registry+https://github.com/rust-lang/crates.io-index" 2420 | checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" 2421 | 2422 | [[package]] 2423 | name = "tower-service" 2424 | version = "0.3.3" 2425 | source = "registry+https://github.com/rust-lang/crates.io-index" 2426 | checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" 2427 | 2428 | [[package]] 2429 | name = "tracing" 2430 | version = "0.1.40" 2431 | source = "registry+https://github.com/rust-lang/crates.io-index" 2432 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 2433 | dependencies = [ 2434 | "pin-project-lite", 2435 | "tracing-core", 2436 | ] 2437 | 2438 | [[package]] 2439 | name = "tracing-core" 2440 | version = "0.1.32" 2441 | source = "registry+https://github.com/rust-lang/crates.io-index" 2442 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 2443 | dependencies = [ 2444 | "once_cell", 2445 | ] 2446 | 2447 | [[package]] 2448 | name = "try-lock" 2449 | version = "0.2.5" 2450 | source = "registry+https://github.com/rust-lang/crates.io-index" 2451 | checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" 2452 | 2453 | [[package]] 2454 | name = "tui-textarea" 2455 | version = "0.7.0" 2456 | source = "registry+https://github.com/rust-lang/crates.io-index" 2457 | checksum = "0a5318dd619ed73c52a9417ad19046724effc1287fb75cdcc4eca1d6ac1acbae" 2458 | dependencies = [ 2459 | "crossterm", 2460 | "ratatui", 2461 | "unicode-width 0.2.0", 2462 | ] 2463 | 2464 | [[package]] 2465 | name = "unicode-bidi" 2466 | version = "0.3.15" 2467 | source = "registry+https://github.com/rust-lang/crates.io-index" 2468 | checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" 2469 | 2470 | [[package]] 2471 | name = "unicode-ident" 2472 | version = "1.0.12" 2473 | source = "registry+https://github.com/rust-lang/crates.io-index" 2474 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 2475 | 2476 | [[package]] 2477 | name = "unicode-normalization" 2478 | version = "0.1.23" 2479 | source = "registry+https://github.com/rust-lang/crates.io-index" 2480 | checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" 2481 | dependencies = [ 2482 | "tinyvec", 2483 | ] 2484 | 2485 | [[package]] 2486 | name = "unicode-segmentation" 2487 | version = "1.11.0" 2488 | source = "registry+https://github.com/rust-lang/crates.io-index" 2489 | checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" 2490 | 2491 | [[package]] 2492 | name = "unicode-truncate" 2493 | version = "1.1.0" 2494 | source = "registry+https://github.com/rust-lang/crates.io-index" 2495 | checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" 2496 | dependencies = [ 2497 | "itertools", 2498 | "unicode-segmentation", 2499 | "unicode-width 0.1.13", 2500 | ] 2501 | 2502 | [[package]] 2503 | name = "unicode-width" 2504 | version = "0.1.13" 2505 | source = "registry+https://github.com/rust-lang/crates.io-index" 2506 | checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" 2507 | 2508 | [[package]] 2509 | name = "unicode-width" 2510 | version = "0.2.0" 2511 | source = "registry+https://github.com/rust-lang/crates.io-index" 2512 | checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" 2513 | 2514 | [[package]] 2515 | name = "unsafe-libyaml" 2516 | version = "0.2.11" 2517 | source = "registry+https://github.com/rust-lang/crates.io-index" 2518 | checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" 2519 | 2520 | [[package]] 2521 | name = "untrusted" 2522 | version = "0.9.0" 2523 | source = "registry+https://github.com/rust-lang/crates.io-index" 2524 | checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" 2525 | 2526 | [[package]] 2527 | name = "url" 2528 | version = "2.5.2" 2529 | source = "registry+https://github.com/rust-lang/crates.io-index" 2530 | checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" 2531 | dependencies = [ 2532 | "form_urlencoded", 2533 | "idna", 2534 | "percent-encoding", 2535 | ] 2536 | 2537 | [[package]] 2538 | name = "utf8parse" 2539 | version = "0.2.2" 2540 | source = "registry+https://github.com/rust-lang/crates.io-index" 2541 | checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 2542 | 2543 | [[package]] 2544 | name = "vcpkg" 2545 | version = "0.2.15" 2546 | source = "registry+https://github.com/rust-lang/crates.io-index" 2547 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 2548 | 2549 | [[package]] 2550 | name = "version_check" 2551 | version = "0.9.5" 2552 | source = "registry+https://github.com/rust-lang/crates.io-index" 2553 | checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" 2554 | 2555 | [[package]] 2556 | name = "walkdir" 2557 | version = "2.5.0" 2558 | source = "registry+https://github.com/rust-lang/crates.io-index" 2559 | checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" 2560 | dependencies = [ 2561 | "same-file", 2562 | "winapi-util", 2563 | ] 2564 | 2565 | [[package]] 2566 | name = "want" 2567 | version = "0.3.1" 2568 | source = "registry+https://github.com/rust-lang/crates.io-index" 2569 | checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 2570 | dependencies = [ 2571 | "try-lock", 2572 | ] 2573 | 2574 | [[package]] 2575 | name = "wasi" 2576 | version = "0.11.0+wasi-snapshot-preview1" 2577 | source = "registry+https://github.com/rust-lang/crates.io-index" 2578 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 2579 | 2580 | [[package]] 2581 | name = "wasm-bindgen" 2582 | version = "0.2.93" 2583 | source = "registry+https://github.com/rust-lang/crates.io-index" 2584 | checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" 2585 | dependencies = [ 2586 | "cfg-if", 2587 | "once_cell", 2588 | "wasm-bindgen-macro", 2589 | ] 2590 | 2591 | [[package]] 2592 | name = "wasm-bindgen-backend" 2593 | version = "0.2.93" 2594 | source = "registry+https://github.com/rust-lang/crates.io-index" 2595 | checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" 2596 | dependencies = [ 2597 | "bumpalo", 2598 | "log", 2599 | "once_cell", 2600 | "proc-macro2", 2601 | "quote", 2602 | "syn", 2603 | "wasm-bindgen-shared", 2604 | ] 2605 | 2606 | [[package]] 2607 | name = "wasm-bindgen-futures" 2608 | version = "0.4.43" 2609 | source = "registry+https://github.com/rust-lang/crates.io-index" 2610 | checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" 2611 | dependencies = [ 2612 | "cfg-if", 2613 | "js-sys", 2614 | "wasm-bindgen", 2615 | "web-sys", 2616 | ] 2617 | 2618 | [[package]] 2619 | name = "wasm-bindgen-macro" 2620 | version = "0.2.93" 2621 | source = "registry+https://github.com/rust-lang/crates.io-index" 2622 | checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" 2623 | dependencies = [ 2624 | "quote", 2625 | "wasm-bindgen-macro-support", 2626 | ] 2627 | 2628 | [[package]] 2629 | name = "wasm-bindgen-macro-support" 2630 | version = "0.2.93" 2631 | source = "registry+https://github.com/rust-lang/crates.io-index" 2632 | checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" 2633 | dependencies = [ 2634 | "proc-macro2", 2635 | "quote", 2636 | "syn", 2637 | "wasm-bindgen-backend", 2638 | "wasm-bindgen-shared", 2639 | ] 2640 | 2641 | [[package]] 2642 | name = "wasm-bindgen-shared" 2643 | version = "0.2.93" 2644 | source = "registry+https://github.com/rust-lang/crates.io-index" 2645 | checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" 2646 | 2647 | [[package]] 2648 | name = "web-sys" 2649 | version = "0.3.70" 2650 | source = "registry+https://github.com/rust-lang/crates.io-index" 2651 | checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" 2652 | dependencies = [ 2653 | "js-sys", 2654 | "wasm-bindgen", 2655 | ] 2656 | 2657 | [[package]] 2658 | name = "webpki-roots" 2659 | version = "0.26.5" 2660 | source = "registry+https://github.com/rust-lang/crates.io-index" 2661 | checksum = "0bd24728e5af82c6c4ec1b66ac4844bdf8156257fccda846ec58b42cd0cdbe6a" 2662 | dependencies = [ 2663 | "rustls-pki-types", 2664 | ] 2665 | 2666 | [[package]] 2667 | name = "weezl" 2668 | version = "0.1.8" 2669 | source = "registry+https://github.com/rust-lang/crates.io-index" 2670 | checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" 2671 | 2672 | [[package]] 2673 | name = "wild" 2674 | version = "2.2.1" 2675 | source = "registry+https://github.com/rust-lang/crates.io-index" 2676 | checksum = "a3131afc8c575281e1e80f36ed6a092aa502c08b18ed7524e86fbbb12bb410e1" 2677 | dependencies = [ 2678 | "glob", 2679 | ] 2680 | 2681 | [[package]] 2682 | name = "winapi" 2683 | version = "0.3.9" 2684 | source = "registry+https://github.com/rust-lang/crates.io-index" 2685 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 2686 | dependencies = [ 2687 | "winapi-i686-pc-windows-gnu", 2688 | "winapi-x86_64-pc-windows-gnu", 2689 | ] 2690 | 2691 | [[package]] 2692 | name = "winapi-i686-pc-windows-gnu" 2693 | version = "0.4.0" 2694 | source = "registry+https://github.com/rust-lang/crates.io-index" 2695 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 2696 | 2697 | [[package]] 2698 | name = "winapi-util" 2699 | version = "0.1.9" 2700 | source = "registry+https://github.com/rust-lang/crates.io-index" 2701 | checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" 2702 | dependencies = [ 2703 | "windows-sys 0.59.0", 2704 | ] 2705 | 2706 | [[package]] 2707 | name = "winapi-x86_64-pc-windows-gnu" 2708 | version = "0.4.0" 2709 | source = "registry+https://github.com/rust-lang/crates.io-index" 2710 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2711 | 2712 | [[package]] 2713 | name = "windows" 2714 | version = "0.56.0" 2715 | source = "registry+https://github.com/rust-lang/crates.io-index" 2716 | checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132" 2717 | dependencies = [ 2718 | "windows-core", 2719 | "windows-targets 0.52.6", 2720 | ] 2721 | 2722 | [[package]] 2723 | name = "windows-core" 2724 | version = "0.56.0" 2725 | source = "registry+https://github.com/rust-lang/crates.io-index" 2726 | checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6" 2727 | dependencies = [ 2728 | "windows-implement", 2729 | "windows-interface", 2730 | "windows-result 0.1.2", 2731 | "windows-targets 0.52.6", 2732 | ] 2733 | 2734 | [[package]] 2735 | name = "windows-implement" 2736 | version = "0.56.0" 2737 | source = "registry+https://github.com/rust-lang/crates.io-index" 2738 | checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b" 2739 | dependencies = [ 2740 | "proc-macro2", 2741 | "quote", 2742 | "syn", 2743 | ] 2744 | 2745 | [[package]] 2746 | name = "windows-interface" 2747 | version = "0.56.0" 2748 | source = "registry+https://github.com/rust-lang/crates.io-index" 2749 | checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc" 2750 | dependencies = [ 2751 | "proc-macro2", 2752 | "quote", 2753 | "syn", 2754 | ] 2755 | 2756 | [[package]] 2757 | name = "windows-registry" 2758 | version = "0.2.0" 2759 | source = "registry+https://github.com/rust-lang/crates.io-index" 2760 | checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" 2761 | dependencies = [ 2762 | "windows-result 0.2.0", 2763 | "windows-strings", 2764 | "windows-targets 0.52.6", 2765 | ] 2766 | 2767 | [[package]] 2768 | name = "windows-result" 2769 | version = "0.1.2" 2770 | source = "registry+https://github.com/rust-lang/crates.io-index" 2771 | checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" 2772 | dependencies = [ 2773 | "windows-targets 0.52.6", 2774 | ] 2775 | 2776 | [[package]] 2777 | name = "windows-result" 2778 | version = "0.2.0" 2779 | source = "registry+https://github.com/rust-lang/crates.io-index" 2780 | checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" 2781 | dependencies = [ 2782 | "windows-targets 0.52.6", 2783 | ] 2784 | 2785 | [[package]] 2786 | name = "windows-strings" 2787 | version = "0.1.0" 2788 | source = "registry+https://github.com/rust-lang/crates.io-index" 2789 | checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" 2790 | dependencies = [ 2791 | "windows-result 0.2.0", 2792 | "windows-targets 0.52.6", 2793 | ] 2794 | 2795 | [[package]] 2796 | name = "windows-sys" 2797 | version = "0.48.0" 2798 | source = "registry+https://github.com/rust-lang/crates.io-index" 2799 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 2800 | dependencies = [ 2801 | "windows-targets 0.48.5", 2802 | ] 2803 | 2804 | [[package]] 2805 | name = "windows-sys" 2806 | version = "0.52.0" 2807 | source = "registry+https://github.com/rust-lang/crates.io-index" 2808 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 2809 | dependencies = [ 2810 | "windows-targets 0.52.6", 2811 | ] 2812 | 2813 | [[package]] 2814 | name = "windows-sys" 2815 | version = "0.59.0" 2816 | source = "registry+https://github.com/rust-lang/crates.io-index" 2817 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 2818 | dependencies = [ 2819 | "windows-targets 0.52.6", 2820 | ] 2821 | 2822 | [[package]] 2823 | name = "windows-targets" 2824 | version = "0.48.5" 2825 | source = "registry+https://github.com/rust-lang/crates.io-index" 2826 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 2827 | dependencies = [ 2828 | "windows_aarch64_gnullvm 0.48.5", 2829 | "windows_aarch64_msvc 0.48.5", 2830 | "windows_i686_gnu 0.48.5", 2831 | "windows_i686_msvc 0.48.5", 2832 | "windows_x86_64_gnu 0.48.5", 2833 | "windows_x86_64_gnullvm 0.48.5", 2834 | "windows_x86_64_msvc 0.48.5", 2835 | ] 2836 | 2837 | [[package]] 2838 | name = "windows-targets" 2839 | version = "0.52.6" 2840 | source = "registry+https://github.com/rust-lang/crates.io-index" 2841 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 2842 | dependencies = [ 2843 | "windows_aarch64_gnullvm 0.52.6", 2844 | "windows_aarch64_msvc 0.52.6", 2845 | "windows_i686_gnu 0.52.6", 2846 | "windows_i686_gnullvm", 2847 | "windows_i686_msvc 0.52.6", 2848 | "windows_x86_64_gnu 0.52.6", 2849 | "windows_x86_64_gnullvm 0.52.6", 2850 | "windows_x86_64_msvc 0.52.6", 2851 | ] 2852 | 2853 | [[package]] 2854 | name = "windows_aarch64_gnullvm" 2855 | version = "0.48.5" 2856 | source = "registry+https://github.com/rust-lang/crates.io-index" 2857 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 2858 | 2859 | [[package]] 2860 | name = "windows_aarch64_gnullvm" 2861 | version = "0.52.6" 2862 | source = "registry+https://github.com/rust-lang/crates.io-index" 2863 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 2864 | 2865 | [[package]] 2866 | name = "windows_aarch64_msvc" 2867 | version = "0.48.5" 2868 | source = "registry+https://github.com/rust-lang/crates.io-index" 2869 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 2870 | 2871 | [[package]] 2872 | name = "windows_aarch64_msvc" 2873 | version = "0.52.6" 2874 | source = "registry+https://github.com/rust-lang/crates.io-index" 2875 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 2876 | 2877 | [[package]] 2878 | name = "windows_i686_gnu" 2879 | version = "0.48.5" 2880 | source = "registry+https://github.com/rust-lang/crates.io-index" 2881 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 2882 | 2883 | [[package]] 2884 | name = "windows_i686_gnu" 2885 | version = "0.52.6" 2886 | source = "registry+https://github.com/rust-lang/crates.io-index" 2887 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 2888 | 2889 | [[package]] 2890 | name = "windows_i686_gnullvm" 2891 | version = "0.52.6" 2892 | source = "registry+https://github.com/rust-lang/crates.io-index" 2893 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 2894 | 2895 | [[package]] 2896 | name = "windows_i686_msvc" 2897 | version = "0.48.5" 2898 | source = "registry+https://github.com/rust-lang/crates.io-index" 2899 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 2900 | 2901 | [[package]] 2902 | name = "windows_i686_msvc" 2903 | version = "0.52.6" 2904 | source = "registry+https://github.com/rust-lang/crates.io-index" 2905 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 2906 | 2907 | [[package]] 2908 | name = "windows_x86_64_gnu" 2909 | version = "0.48.5" 2910 | source = "registry+https://github.com/rust-lang/crates.io-index" 2911 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 2912 | 2913 | [[package]] 2914 | name = "windows_x86_64_gnu" 2915 | version = "0.52.6" 2916 | source = "registry+https://github.com/rust-lang/crates.io-index" 2917 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 2918 | 2919 | [[package]] 2920 | name = "windows_x86_64_gnullvm" 2921 | version = "0.48.5" 2922 | source = "registry+https://github.com/rust-lang/crates.io-index" 2923 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 2924 | 2925 | [[package]] 2926 | name = "windows_x86_64_gnullvm" 2927 | version = "0.52.6" 2928 | source = "registry+https://github.com/rust-lang/crates.io-index" 2929 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 2930 | 2931 | [[package]] 2932 | name = "windows_x86_64_msvc" 2933 | version = "0.48.5" 2934 | source = "registry+https://github.com/rust-lang/crates.io-index" 2935 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 2936 | 2937 | [[package]] 2938 | name = "windows_x86_64_msvc" 2939 | version = "0.52.6" 2940 | source = "registry+https://github.com/rust-lang/crates.io-index" 2941 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 2942 | 2943 | [[package]] 2944 | name = "winnow" 2945 | version = "0.6.18" 2946 | source = "registry+https://github.com/rust-lang/crates.io-index" 2947 | checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" 2948 | dependencies = [ 2949 | "memchr", 2950 | ] 2951 | 2952 | [[package]] 2953 | name = "x11rb" 2954 | version = "0.13.1" 2955 | source = "registry+https://github.com/rust-lang/crates.io-index" 2956 | checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" 2957 | dependencies = [ 2958 | "gethostname", 2959 | "rustix", 2960 | "x11rb-protocol", 2961 | ] 2962 | 2963 | [[package]] 2964 | name = "x11rb-protocol" 2965 | version = "0.13.1" 2966 | source = "registry+https://github.com/rust-lang/crates.io-index" 2967 | checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" 2968 | 2969 | [[package]] 2970 | name = "yaml-rust" 2971 | version = "0.4.5" 2972 | source = "registry+https://github.com/rust-lang/crates.io-index" 2973 | checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" 2974 | dependencies = [ 2975 | "linked-hash-map", 2976 | ] 2977 | 2978 | [[package]] 2979 | name = "zerocopy" 2980 | version = "0.7.35" 2981 | source = "registry+https://github.com/rust-lang/crates.io-index" 2982 | checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" 2983 | dependencies = [ 2984 | "byteorder", 2985 | "zerocopy-derive", 2986 | ] 2987 | 2988 | [[package]] 2989 | name = "zerocopy-derive" 2990 | version = "0.7.35" 2991 | source = "registry+https://github.com/rust-lang/crates.io-index" 2992 | checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" 2993 | dependencies = [ 2994 | "proc-macro2", 2995 | "quote", 2996 | "syn", 2997 | ] 2998 | 2999 | [[package]] 3000 | name = "zeroize" 3001 | version = "1.8.1" 3002 | source = "registry+https://github.com/rust-lang/crates.io-index" 3003 | checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" 3004 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tenere" 3 | version = "0.11.2" 4 | authors = ["Badr Badri "] 5 | license = "GPL-3.0-or-later" 6 | edition = "2021" 7 | description = "TUI interface for LLMs written in Rust" 8 | readme = "README.md" 9 | homepage = "https://github.com/pythops/tenere" 10 | repository = "https://github.com/pythops/tenere" 11 | 12 | [dependencies] 13 | ansi-to-tui = "7" 14 | arboard = "3" 15 | async-trait = "0.1" 16 | bat = "0.25" 17 | clap = { version = "4", features = ["derive", "cargo"] } 18 | crossterm = { version = "0.28", features = ["event-stream"] } 19 | dirs = "5" 20 | futures = "0.3" 21 | reqwest = { version = "0.12", default-features = false, features = [ 22 | "json", 23 | "rustls-tls", 24 | ] } 25 | ratatui = { version = "0.29", features = ["all-widgets"] } 26 | regex = "1" 27 | serde = { version = "1", features = ["derive"] } 28 | serde_json = "1" 29 | strum = "0.26" 30 | strum_macros = "0.26" 31 | tokio = { version = "1", features = ["full"] } 32 | toml = { version = "0.8" } 33 | tui-textarea = "0.7" 34 | unicode-width = "0.2" 35 | 36 | [profile.release] 37 | lto = "fat" 38 | strip = true 39 | codegen-units = 1 40 | -------------------------------------------------------------------------------- /Justfile: -------------------------------------------------------------------------------- 1 | default: 2 | @just --list 3 | 4 | test: 5 | @cargo nextest run 6 | 7 | lint: 8 | @cargo clippy --workspace --all-features -- -D warnings 9 | @cargo fmt --all -- --check 10 | 11 | build: 12 | @cargo build 13 | 14 | build-release: 15 | @cargo build --release 16 | 17 | update: 18 | @cargo upgrade 19 | 20 | build-release-linux: 21 | @cargo build --release --target=x86_64-unknown-linux-musl 22 | @strip target/x86_64-unknown-linux-musl/release/tenere 23 | 24 | build-release-macos: 25 | @cargo build --release --target=x86_64-apple-darwin 26 | @cargo build --release --target=aarch64-apple-darwin 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright © 2007 Free Software Foundation, Inc. 5 | 6 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for software and other kinds of works. 11 | 12 | The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. 13 | 14 | When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. 15 | 16 | To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. 17 | 18 | For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. 19 | 20 | Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. 21 | 22 | For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. 23 | 24 | Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. 25 | 26 | Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. 27 | 28 | The precise terms and conditions for copying, distribution and modification follow. 29 | 30 | TERMS AND CONDITIONS 31 | 32 | 0. Definitions. 33 | 34 | “This License” refers to version 3 of the GNU General Public License. 35 | 36 | “Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. 37 | 38 | “The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. 39 | 40 | To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. 41 | 42 | A “covered work” means either the unmodified Program or a work based on the Program. 43 | 44 | To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. 45 | 46 | To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. 47 | 48 | An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 49 | 50 | 1. Source Code. 51 | The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. 52 | 53 | A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. 54 | 55 | The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. 56 | 57 | The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. 58 | 59 | The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. 60 | 61 | The Corresponding Source for a work in source code form is that same work. 62 | 63 | 2. Basic Permissions. 64 | All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. 65 | 66 | You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. 67 | 68 | Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 69 | 70 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 71 | No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. 72 | 73 | When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 74 | 75 | 4. Conveying Verbatim Copies. 76 | You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. 77 | 78 | You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 79 | 80 | 5. Conveying Modified Source Versions. 81 | You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: 82 | 83 | a) The work must carry prominent notices stating that you modified it, and giving a relevant date. 84 | 85 | b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. 86 | 87 | c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. 88 | 89 | d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. 90 | 91 | A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 92 | 93 | 6. Conveying Non-Source Forms. 94 | You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: 95 | 96 | a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. 97 | 98 | b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. 99 | 100 | c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. 101 | 102 | d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. 103 | 104 | e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. 105 | 106 | A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. 107 | 108 | A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. 109 | 110 | “Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. 111 | 112 | If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). 113 | 114 | The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. 115 | 116 | Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 117 | 118 | 7. Additional Terms. 119 | “Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. 120 | 121 | When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. 122 | 123 | Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: 124 | 125 | a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or 126 | 127 | b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or 128 | 129 | c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or 130 | 131 | d) Limiting the use for publicity purposes of names of licensors or authors of the material; or 132 | 133 | e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or 134 | 135 | f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. 136 | 137 | All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. 138 | 139 | If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. 140 | 141 | Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 142 | 143 | 8. Termination. 144 | You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). 145 | 146 | However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. 147 | 148 | Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. 149 | 150 | Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 151 | 152 | 9. Acceptance Not Required for Having Copies. 153 | You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 154 | 155 | 10. Automatic Licensing of Downstream Recipients. 156 | Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. 157 | 158 | An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. 159 | 160 | You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 161 | 162 | 11. Patents. 163 | A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. 164 | 165 | A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. 166 | 167 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. 168 | 169 | In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. 170 | 171 | If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. 172 | 173 | If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. 174 | 175 | A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. 176 | 177 | Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 178 | 179 | 12. No Surrender of Others' Freedom. 180 | If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 181 | 182 | 13. Use with the GNU Affero General Public License. 183 | Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 184 | 185 | 14. Revised Versions of this License. 186 | The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 187 | 188 | Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. 189 | 190 | If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. 191 | 192 | Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 193 | 194 | 15. Disclaimer of Warranty. 195 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 196 | 197 | 16. Limitation of Liability. 198 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 199 | 200 | 17. Interpretation of Sections 15 and 16. 201 | If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 202 | 203 | END OF TERMS AND CONDITIONS 204 | 205 | How to Apply These Terms to Your New Programs 206 | 207 | If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. 208 | 209 | To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. 210 | 211 | 212 | Copyright (C) 213 | 214 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 215 | 216 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 217 | 218 | You should have received a copy of the GNU General Public License along with this program. If not, see . 219 | 220 | Also add information on how to contact you by electronic and paper mail. 221 | 222 | If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: 223 | 224 | Copyright (C) 225 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 226 | This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. 227 | 228 | The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. 229 | 230 | You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . 231 | 232 | The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . 233 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

Tenere

3 | A crab in the moroccan desert 4 |

TUI interface for LLMs written in Rust

5 |
6 | 7 | ## 📸 Demo 8 | 9 | ![Demo](https://github.com/pythops/tenere/assets/57548585/b33ed59b-1d94-4bc5-8e61-73e63f41137e) 10 | 11 |
12 | 13 | ## 🪄 Features 14 | 15 | - Syntax highlights 16 | - Chat history 17 | - Save chats to files 18 | - Vim keybinding (most common ops) 19 | - Copy text from/to clipboard (works only on the prompt) 20 | - Multiple backends 21 | - Automatically load the last saved chat into history 22 | 23 |
24 | 25 | ## 💎 Supported Backends 26 | 27 | - [x] ChatGPT 28 | - [x] llama.cpp 29 | - [x] ollama 30 | 31 |
32 | 33 | ## 🚀 Installation 34 | 35 | 36 | Packaging status 37 | 38 | 39 |
40 |
41 |
42 |
43 |
44 | 45 | ### 📥 Binary releases 46 | 47 | You can download the pre-built binaries from the [release page](https://github.com/pythops/tenere/releases) 48 | 49 | ### 📦 crates.io 50 | 51 | `tenere` can be installed from [crates.io](https://crates.io/crates/tenere) 52 | 53 | ```shell 54 | cargo install tenere 55 | ``` 56 | 57 | ### ❄️ NixOS / Nix 58 | 59 | Tenere is available in nixpkgs and can be installed via configuration.nix: 60 | 61 | ```nix 62 | environment.systemPackages = with pkgs; [ 63 | tenere 64 | ]; 65 | ``` 66 | For non-NixOS systems, install directly with: 67 | ```nix 68 | nix-env -iA nixpkgs.tenere 69 | ``` 70 | 71 | ### 📱 Mobile (nix-on-droid) 72 | 73 | Tenere works on Android via nix-on-droid ([demo](https://github.com/user-attachments/assets/c06e5650-0b5d-4f0a-816d-a2c1bd88774a)). 74 | 75 | To set up ([tutorial](https://www.youtube.com/watch?v=XiVz2UR9epE)): 76 | 77 | 1. Install nix-on-droid from F-Droid 78 | 2. Add tenere to your packages in ".config/nixpkgs/nix-on-droid.nix": 79 | 3. Run ``nix-on-droid switch`` 80 | 4. Create your config at ".config/tenere/config.toml" 81 | 82 | ### 🍺 Homebrew 83 | 84 | ``` 85 | brew install tenere 86 | ``` 87 | 88 | ### ⚒️ Build from source 89 | 90 | To build from the source, you need [Rust](https://www.rust-lang.org/) compiler and 91 | [Cargo package manager](https://doc.rust-lang.org/cargo/). 92 | 93 | Once Rust and Cargo are installed, run the following command to build: 94 | 95 | ```shell 96 | cargo build --release 97 | ``` 98 | 99 | This will produce an executable file at `target/release/tenere` that you can copy to a directory in your `$PATH`. 100 | 101 |
102 | 103 | ## ⚙️ Configuration 104 | 105 | Tenere can be configured using a TOML configuration file. By default, the configuration file is located at: 106 | 107 | - **Linux**: `$HOME/.config/tenere/config.toml` or `$XDG_CONFIG_HOME/tenere/config.toml` 108 | - **Mac**: `$HOME/Library/Application Support/tenere/config.toml` 109 | - **Windows**: `~/AppData/Roaming/tenere/config.toml` 110 | 111 | ### 🛠 Custom Configuration Path 112 | 113 | You can optionally specify a custom path for the configuration file using the `-c` flag. This allows you to override the default configuration file location. 114 | 115 | ### Example Usage 116 | 117 | ```sh 118 | # Use the default configuration path 119 | tenere 120 | 121 | # Specify a custom configuration path 122 | tenere -c ~/path/to/custom/config.toml 123 | ``` 124 | 125 | ### General settings 126 | 127 | Here are the available general settings: 128 | 129 | - `llm`: the llm model name. Possible values are: 130 | - `chatgpt` 131 | - `llamacpp` 132 | - `ollama` 133 | 134 | ```toml 135 | llm = "chatgpt" 136 | ``` 137 | 138 | ### Key bindings 139 | 140 | Tenere supports customizable key bindings. 141 | You can modify some of the default key bindings by updating the `[key_bindings]` section in the configuration file. 142 | Here is an example with the default key bindings 143 | 144 | ```toml 145 | [key_bindings] 146 | show_help = '?' 147 | show_history = 'h' 148 | new_chat = 'n' 149 | ``` 150 | 151 | ℹ️ Note 152 | 153 | > To avoid overlapping with vim key bindings, you need to use `ctrl` + `key` except for help `?`. 154 | 155 | ## Chatgpt 156 | 157 | To use `chatgpt` as the backend, you'll need to provide an API key for OpenAI. There are two ways to do this: 158 | 159 | Set an environment variable with your API key: 160 | 161 | ```shell 162 | export OPENAI_API_KEY="YOUTR KEY HERE" 163 | ``` 164 | 165 | Or 166 | 167 | Include your API key in the configuration file: 168 | 169 | ```toml 170 | [chatgpt] 171 | openai_api_key = "Your API key here" 172 | model = "gpt-3.5-turbo" 173 | url = "https://api.openai.com/v1/chat/completions" 174 | ``` 175 | 176 | The default model is set to `gpt-3.5-turbo`. Check out the [OpenAI documentation](https://platform.openai.com/docs/models/gpt-3-5) for more info. 177 | 178 | ## llama.cpp 179 | 180 | To use `llama.cpp` as the backend, you'll need to provide the url that points to the server : 181 | 182 | ```toml 183 | [llamacpp] 184 | url = "http://localhost:8080/v1/chat/completions" 185 | ``` 186 | 187 | If you configure the server with an api key, then you need to provide it as well: 188 | 189 | Setting an environment variable : 190 | 191 | ```shell 192 | export LLAMACPP_API_KEY="YOUTR KEY HERE" 193 | ``` 194 | 195 | Or 196 | 197 | Include your API key in the configuration file: 198 | 199 | ```toml 200 | [llamacpp] 201 | url = "http://localhost:8080/v1/chat/completions" 202 | api_key = "Your API Key here" 203 | ``` 204 | 205 | More infos about llama.cpp api [here](https://github.com/ggerganov/llama.cpp/blob/master/examples/server/README.md) 206 | 207 | ## Ollama 208 | 209 | To use `ollama` as the backend, you'll need to provide the url that points to the server with the model name : 210 | 211 | ```toml 212 | [ollama] 213 | url = "http://localhost:11434/api/chat" 214 | model = "Your model name here" 215 | ``` 216 | 217 | More infos about ollama api [here](https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-chat-completion) 218 | 219 |
220 | 221 | ## ⌨️ Key bindings 222 | 223 | ### Global 224 | 225 | These are the default key bindings regardless of the focused block. 226 | 227 | `ctrl + n`: Start a new chat and save the previous one in history and save it to `tenere.archive-i` file in `data directory`. 228 | 229 | `Tab`: Switch the focus. 230 | 231 | `j` or `Down arrow key`: Scroll down 232 | 233 | `k` or `Up arrow key`: Scroll up 234 | 235 | `ctrl + h` : Show chat history. Press `Esc` to dismiss it. 236 | 237 | `ctrl + t` : Stop the stream response 238 | 239 | `q` or `ctrl + c`: Quit the app 240 | 241 | `?`: Show the help pop-up. Press `Esc` to dismiss it 242 | 243 | ### Prompt 244 | 245 | There are 3 modes like vim: `Normal`, `Visual` and `Insert`. 246 | 247 | #### Insert mode 248 | 249 | `Esc`: to switch back to Normal mode. 250 | 251 | `Enter`: to create a new line. 252 | 253 | `Backspace`: to remove the previous character. 254 | 255 | #### Normal mode 256 | 257 | `Enter`: to submit the prompt 258 | 259 |
260 | 261 | `h or Left`: Move the cursor backward by one char. 262 | 263 | `j or Down`: Move the cursor down. 264 | 265 | `k or Up`: Move the cursor up. 266 | 267 | `l or Right`: Move the cursor forward by one char. 268 | 269 | `w`: Move the cursor right by one word. 270 | 271 | `b`: Move the cursor backward by one word. 272 | 273 | `0`: Move the cursor to the start of the line. 274 | 275 | `$`: Move the cursor to the end of the line. 276 | 277 | `G`: Go to the end. 278 | 279 | `gg`: Go to the top. 280 | 281 |
282 | 283 | `a`: Insert after the cursor. 284 | 285 | `A`: Insert at the end of the line. 286 | 287 | `i`: Insert before the cursor. 288 | 289 | `I`: Insert at the beginning of the line. 290 | 291 | `o`: Append a new line below the current line. 292 | 293 | `O`: Append a new line above the current line. 294 | 295 |
296 | 297 | `x`: Delete one char under to the cursor. 298 | 299 | `dd`: Cut the current line 300 | 301 | `D`: Delete the current line and 302 | 303 | `dw`: Delete the word next to the cursor. 304 | 305 | `db`: Delete the word on the left of the cursor. 306 | 307 | `d0`: Delete from the cursor to the beginning of the line. 308 | 309 | `d$`: Delete from the cursor to the end of the line. 310 | 311 |
312 | 313 | `C`: Change to the end of the line. 314 | 315 | `cc`: Change the current line. 316 | 317 | `c0`: Change from the cursor to the beginning of the line. 318 | 319 | `c$`: Change from the cursor to the end of the line. 320 | 321 | `cw`: Change the next word. 322 | 323 | `cb`: Change the word on the left of the cursor. 324 | 325 |
326 | 327 | `u`: Undo 328 | 329 | `p`: Paste 330 | 331 | #### Visual mode 332 | 333 | `v`: Switch to visual. 334 | 335 | `y`: Yank the selected text 336 | 337 |
338 | 339 | ## ⚖️ License 340 | 341 | GNU General Public License v3.0 or later 342 | -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pythops/tenere/7b87dbc001db447fe343505ab7ba85ffcf080fd1/assets/logo.png -------------------------------------------------------------------------------- /src/app.rs: -------------------------------------------------------------------------------- 1 | use crate::history::History; 2 | use crate::prompt::Prompt; 3 | use crate::{chat::Chat, help::Help}; 4 | use std; 5 | use std::sync::atomic::AtomicBool; 6 | 7 | use crate::notification::Notification; 8 | use crate::spinner::Spinner; 9 | use crate::{config::Config, formatter::Formatter}; 10 | use arboard::Clipboard; 11 | use crossterm::event::KeyCode; 12 | use ratatui::text::Line; 13 | 14 | use std::sync::Arc; 15 | 16 | pub type AppResult = std::result::Result>; 17 | 18 | #[derive(Debug, Clone, PartialEq)] 19 | pub enum FocusedBlock { 20 | Prompt, 21 | Chat, 22 | History, 23 | Preview, 24 | Help, 25 | } 26 | 27 | pub struct App<'a> { 28 | pub running: bool, 29 | pub prompt: Prompt<'a>, 30 | pub chat: Chat<'a>, 31 | pub focused_block: FocusedBlock, 32 | pub history: History<'a>, 33 | pub notifications: Vec, 34 | pub spinner: Spinner, 35 | pub terminate_response_signal: Arc, 36 | pub clipboard: Option, 37 | pub help: Help, 38 | pub previous_key: KeyCode, 39 | pub config: Arc, 40 | pub formatter: &'a Formatter<'a>, 41 | } 42 | 43 | impl<'a> App<'a> { 44 | pub fn new(config: Arc, formatter: &'a Formatter<'a>) -> Self { 45 | Self { 46 | running: true, 47 | prompt: Prompt::default(), 48 | chat: Chat::new(), 49 | focused_block: FocusedBlock::Prompt, 50 | history: History::new(), 51 | notifications: Vec::new(), 52 | spinner: Spinner::default(), 53 | terminate_response_signal: Arc::new(AtomicBool::new(false)), 54 | clipboard: Clipboard::new().ok(), 55 | help: Help::new(), 56 | previous_key: KeyCode::Null, 57 | config, 58 | formatter, 59 | } 60 | } 61 | 62 | pub fn tick(&mut self) { 63 | self.notifications.retain(|n| n.ttl > 0); 64 | self.notifications.iter_mut().for_each(|n| n.ttl -= 1); 65 | 66 | if self.spinner.active { 67 | self.chat.formatted_chat.lines.pop(); 68 | self.chat 69 | .formatted_chat 70 | .lines 71 | .push(Line::raw(format!("🤖: Waiting {}", self.spinner.draw()))); 72 | self.spinner.update(); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/chat.rs: -------------------------------------------------------------------------------- 1 | use std::{rc::Rc, sync::atomic::AtomicBool}; 2 | 3 | use ratatui::{ 4 | layout::Rect, 5 | text::Text, 6 | widgets::{Block, Paragraph, Wrap}, 7 | Frame, 8 | }; 9 | 10 | use crate::{formatter::Formatter, llm::LLMAnswer}; 11 | 12 | #[derive(Debug, Clone, Default)] 13 | pub struct Answer<'a> { 14 | pub plain_answer: String, 15 | pub formatted_answer: Text<'a>, 16 | } 17 | 18 | #[derive(Debug, Clone)] 19 | pub struct Chat<'a> { 20 | pub plain_chat: Vec, 21 | pub formatted_chat: Text<'a>, 22 | pub answer: Answer<'a>, 23 | pub scroll: u16, 24 | area_height: u16, 25 | area_width: u16, 26 | pub automatic_scroll: Rc, 27 | } 28 | 29 | impl Default for Chat<'_> { 30 | fn default() -> Self { 31 | Self { 32 | plain_chat: Vec::new(), 33 | formatted_chat: Text::raw(""), 34 | answer: Answer::default(), 35 | scroll: 0, 36 | area_height: 0, 37 | area_width: 0, 38 | automatic_scroll: Rc::new(AtomicBool::new(true)), 39 | } 40 | } 41 | } 42 | 43 | impl Chat<'_> { 44 | pub fn new() -> Self { 45 | Self::default() 46 | } 47 | 48 | pub fn handle_answer(&mut self, event: LLMAnswer, formatter: &Formatter) { 49 | match event { 50 | LLMAnswer::StartAnswer => { 51 | self.formatted_chat.lines.pop(); 52 | } 53 | 54 | LLMAnswer::Answer(answer) => { 55 | self.answer.plain_answer.push_str(answer.as_str()); 56 | 57 | self.answer.formatted_answer = 58 | formatter.format(format!("🤖: {}", &self.answer.plain_answer).as_str()); 59 | } 60 | 61 | LLMAnswer::EndAnswer => { 62 | self.formatted_chat 63 | .extend(self.answer.formatted_answer.clone()); 64 | 65 | self.formatted_chat.extend(Text::raw("\n")); 66 | 67 | self.plain_chat 68 | .push(format!("🤖: {}", self.answer.plain_answer)); 69 | 70 | self.answer = Answer::default(); 71 | } 72 | } 73 | } 74 | 75 | pub fn height(&self) -> usize { 76 | let mut chat = self.formatted_chat.clone(); 77 | 78 | chat.extend(self.answer.formatted_answer.clone()); 79 | 80 | let nb_lines = chat.lines.len() + 3; 81 | chat.lines.iter().fold(nb_lines, |acc, line| { 82 | acc + line.width() / self.area_width as usize 83 | }) 84 | } 85 | 86 | pub fn move_to_bottom(&mut self) { 87 | self.scroll = (self.formatted_chat.height() + self.answer.formatted_answer.height()) 88 | .saturating_sub((self.area_height - 2).into()) as u16; 89 | } 90 | 91 | pub fn move_to_top(&mut self) { 92 | self.scroll = 0; 93 | } 94 | 95 | pub fn render(&mut self, frame: &mut Frame, area: Rect) { 96 | let mut text = self.formatted_chat.clone(); 97 | text.extend(self.answer.formatted_answer.clone()); 98 | 99 | self.area_height = area.height; 100 | self.area_width = area.width; 101 | 102 | let scroll: u16 = { 103 | if self 104 | .automatic_scroll 105 | .load(std::sync::atomic::Ordering::Relaxed) 106 | { 107 | let scroll = self.height().saturating_sub(self.area_height.into()) as u16; 108 | self.scroll = scroll; 109 | scroll 110 | } else { 111 | self.scroll 112 | } 113 | }; 114 | 115 | let chat = Paragraph::new(text) 116 | .scroll((scroll, 0)) 117 | .wrap(Wrap { trim: false }) 118 | .block(Block::default()); 119 | 120 | frame.render_widget(chat, area); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/chatgpt.rs: -------------------------------------------------------------------------------- 1 | use std::sync::atomic::{AtomicBool, Ordering}; 2 | use std::sync::Arc; 3 | use tokio::time::{sleep, Duration}; 4 | 5 | use crate::event::Event; 6 | use async_trait::async_trait; 7 | use regex::Regex; 8 | use tokio::sync::mpsc::UnboundedSender; 9 | 10 | use crate::config::ChatGPTConfig; 11 | use crate::llm::{LLMAnswer, LLMRole, LLM}; 12 | use reqwest::header::HeaderMap; 13 | use serde_json::{json, Value}; 14 | use std; 15 | use std::collections::HashMap; 16 | 17 | #[derive(Clone, Debug)] 18 | pub struct ChatGPT { 19 | client: reqwest::Client, 20 | openai_api_key: String, 21 | model: String, 22 | url: String, 23 | messages: Vec>, 24 | } 25 | 26 | impl ChatGPT { 27 | pub fn new(config: ChatGPTConfig) -> Self { 28 | let openai_api_key = match std::env::var("OPENAI_API_KEY") { 29 | Ok(key) => key, 30 | Err(_) => config 31 | .openai_api_key 32 | .ok_or_else(|| { 33 | eprintln!( 34 | r#"Can not find the openai api key 35 | You need to define one whether in the configuration file or as an environment variable"# 36 | ); 37 | 38 | std::process::exit(1); 39 | }) 40 | .unwrap(), 41 | }; 42 | 43 | Self { 44 | client: reqwest::Client::new(), 45 | openai_api_key, 46 | model: config.model, 47 | url: config.url, 48 | messages: Vec::new(), 49 | } 50 | } 51 | } 52 | 53 | #[async_trait] 54 | impl LLM for ChatGPT { 55 | fn clear(&mut self) { 56 | self.messages = Vec::new(); 57 | } 58 | 59 | fn append_chat_msg(&mut self, msg: String, role: LLMRole) { 60 | let mut conv: HashMap = HashMap::new(); 61 | conv.insert("role".to_string(), role.to_string()); 62 | conv.insert("content".to_string(), msg); 63 | self.messages.push(conv); 64 | } 65 | 66 | async fn ask( 67 | &self, 68 | sender: UnboundedSender, 69 | terminate_response_signal: Arc, 70 | ) -> Result<(), Box> { 71 | let mut headers = HeaderMap::new(); 72 | headers.insert("Content-Type", "application/json".parse()?); 73 | headers.insert( 74 | "Authorization", 75 | format!("Bearer {}", self.openai_api_key).parse()?, 76 | ); 77 | 78 | let mut messages: Vec> = vec![ 79 | (HashMap::from([ 80 | ("role".to_string(), "system".to_string()), 81 | ( 82 | "content".to_string(), 83 | "You are a helpful assistant.".to_string(), 84 | ), 85 | ])), 86 | ]; 87 | 88 | messages.extend(self.messages.clone()); 89 | 90 | let body: Value = json!({ 91 | "model": self.model, 92 | "messages": messages, 93 | "stream": true, 94 | }); 95 | 96 | let response = self 97 | .client 98 | .post(&self.url) 99 | .headers(headers) 100 | .json(&body) 101 | .send() 102 | .await?; 103 | 104 | match response.error_for_status() { 105 | Ok(mut res) => { 106 | sender.send(Event::LLMEvent(LLMAnswer::StartAnswer))?; 107 | let re = Regex::new(r"data:\s(.*)")?; 108 | 109 | while let Some(chunk) = res.chunk().await? { 110 | let chunk = std::str::from_utf8(&chunk)?; 111 | 112 | for captures in re.captures_iter(chunk) { 113 | if let Some(data_json) = captures.get(1) { 114 | if terminate_response_signal.load(Ordering::Relaxed) { 115 | sender.send(Event::LLMEvent(LLMAnswer::EndAnswer))?; 116 | return Ok(()); 117 | } 118 | 119 | if data_json.as_str() == "[DONE]" { 120 | sender.send(Event::LLMEvent(LLMAnswer::EndAnswer))?; 121 | return Ok(()); 122 | } 123 | 124 | let answer: Value = serde_json::from_str(data_json.as_str())?; 125 | 126 | let msg = answer["choices"][0]["delta"]["content"] 127 | .as_str() 128 | .unwrap_or("\n"); 129 | 130 | if msg != "null" { 131 | sender.send(Event::LLMEvent(LLMAnswer::Answer(msg.to_string())))?; 132 | } 133 | 134 | sleep(Duration::from_millis(100)).await; 135 | } 136 | } 137 | } 138 | } 139 | Err(e) => return Err(Box::new(e)), 140 | } 141 | 142 | Ok(()) 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /src/config.rs: -------------------------------------------------------------------------------- 1 | use crate::llm::LLMBackend; 2 | use toml; 3 | 4 | use dirs; 5 | use serde::Deserialize; 6 | use std::path::PathBuf; 7 | 8 | #[derive(Deserialize, Debug)] 9 | pub struct Config { 10 | #[serde(default)] 11 | pub key_bindings: KeyBindings, 12 | 13 | #[serde(default = "default_llm_backend")] 14 | pub llm: LLMBackend, 15 | 16 | #[serde(default)] 17 | pub chatgpt: ChatGPTConfig, 18 | 19 | pub llamacpp: Option, 20 | 21 | pub ollama: Option, 22 | } 23 | 24 | pub fn default_llm_backend() -> LLMBackend { 25 | LLMBackend::ChatGPT 26 | } 27 | 28 | // ChatGPT 29 | #[derive(Deserialize, Debug, Clone)] 30 | pub struct ChatGPTConfig { 31 | pub openai_api_key: Option, 32 | 33 | #[serde(default = "ChatGPTConfig::default_model")] 34 | pub model: String, 35 | 36 | #[serde(default = "ChatGPTConfig::default_url")] 37 | pub url: String, 38 | } 39 | 40 | impl Default for ChatGPTConfig { 41 | fn default() -> Self { 42 | Self { 43 | openai_api_key: None, 44 | model: Self::default_model(), 45 | url: Self::default_url(), 46 | } 47 | } 48 | } 49 | 50 | impl ChatGPTConfig { 51 | pub fn default_model() -> String { 52 | String::from("gpt-3.5-turbo") 53 | } 54 | 55 | pub fn default_url() -> String { 56 | String::from("https://api.openai.com/v1/chat/completions") 57 | } 58 | } 59 | 60 | // LLamacpp 61 | 62 | #[derive(Deserialize, Debug, Clone)] 63 | pub struct LLamacppConfig { 64 | pub url: String, 65 | pub api_key: Option, 66 | } 67 | 68 | // Ollama 69 | 70 | #[derive(Deserialize, Debug, Clone)] 71 | pub struct OllamaConfig { 72 | pub url: String, 73 | pub model: String, 74 | } 75 | 76 | #[derive(Deserialize, Debug)] 77 | pub struct KeyBindings { 78 | #[serde(default = "KeyBindings::default_show_help")] 79 | pub show_help: char, 80 | 81 | #[serde(default = "KeyBindings::default_show_history")] 82 | pub show_history: char, 83 | 84 | #[serde(default = "KeyBindings::default_new_chat")] 85 | pub new_chat: char, 86 | 87 | #[serde(default = "KeyBindings::default_stop_stream")] 88 | pub stop_stream: char, 89 | } 90 | 91 | impl Default for KeyBindings { 92 | fn default() -> Self { 93 | Self { 94 | show_help: '?', 95 | show_history: 'h', 96 | new_chat: 'n', 97 | stop_stream: 't', 98 | } 99 | } 100 | } 101 | 102 | impl KeyBindings { 103 | fn default_show_help() -> char { 104 | '?' 105 | } 106 | 107 | fn default_show_history() -> char { 108 | 'h' 109 | } 110 | 111 | fn default_new_chat() -> char { 112 | 'n' 113 | } 114 | 115 | fn default_stop_stream() -> char { 116 | 't' 117 | } 118 | } 119 | 120 | impl Config { 121 | pub fn load(custom_path: Option) -> Self { 122 | let conf_path = if let Some(path) = custom_path { 123 | path 124 | } else { 125 | dirs::config_dir() 126 | .unwrap() 127 | .join("tenere") 128 | .join("config.toml") 129 | }; 130 | 131 | let config = std::fs::read_to_string(conf_path).unwrap_or_default(); 132 | let app_config: Config = toml::from_str(&config).unwrap(); 133 | 134 | if app_config.llm == LLMBackend::LLamacpp && app_config.llamacpp.is_none() { 135 | eprintln!("Config for LLamacpp is not provided"); 136 | std::process::exit(1) 137 | } 138 | 139 | if app_config.llm == LLMBackend::Ollama && app_config.ollama.is_none() { 140 | eprintln!("Config for Ollama is not provided"); 141 | std::process::exit(1) 142 | } 143 | 144 | app_config 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /src/event.rs: -------------------------------------------------------------------------------- 1 | use std::time::Duration; 2 | 3 | use crate::app::AppResult; 4 | use crate::llm::LLMAnswer; 5 | use crate::notification::Notification; 6 | use crossterm::event::{Event as CrosstermEvent, KeyEvent, MouseEvent}; 7 | use futures::{FutureExt, StreamExt}; 8 | use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}; 9 | 10 | #[derive(Clone, Debug)] 11 | pub enum Event { 12 | Tick, 13 | Key(KeyEvent), 14 | Mouse(MouseEvent), 15 | Resize(u16, u16), 16 | LLMEvent(LLMAnswer), 17 | Notification(Notification), 18 | } 19 | 20 | #[allow(dead_code)] 21 | #[derive(Debug)] 22 | pub struct EventHandler { 23 | pub sender: UnboundedSender, 24 | receiver: UnboundedReceiver, 25 | handler: tokio::task::JoinHandle<()>, 26 | } 27 | 28 | impl EventHandler { 29 | pub fn new(tick_rate: u64) -> Self { 30 | let tick_rate = Duration::from_millis(tick_rate); 31 | let (sender, receiver) = unbounded_channel(); 32 | let _sender = sender.clone(); 33 | let handler = tokio::spawn(async move { 34 | let mut reader = crossterm::event::EventStream::new(); 35 | let mut tick = tokio::time::interval(tick_rate); 36 | loop { 37 | let tick_delay = tick.tick(); 38 | let crossterm_event = reader.next().fuse(); 39 | tokio::select! { 40 | _ = tick_delay => { 41 | _sender.send(Event::Tick).unwrap(); 42 | } 43 | Some(Ok(evt)) = crossterm_event => { 44 | match evt { 45 | CrosstermEvent::Key(key) => { 46 | if key.kind == crossterm::event::KeyEventKind::Press { 47 | _sender.send(Event::Key(key)).unwrap(); 48 | } 49 | }, 50 | CrosstermEvent::Mouse(mouse) => { 51 | _sender.send(Event::Mouse(mouse)).unwrap(); 52 | }, 53 | CrosstermEvent::Resize(x, y) => { 54 | _sender.send(Event::Resize(x, y)).unwrap(); 55 | }, 56 | CrosstermEvent::FocusLost => { 57 | }, 58 | CrosstermEvent::FocusGained => { 59 | }, 60 | CrosstermEvent::Paste(_) => { 61 | }, 62 | } 63 | } 64 | }; 65 | } 66 | }); 67 | Self { 68 | sender, 69 | receiver, 70 | handler, 71 | } 72 | } 73 | 74 | pub async fn next(&mut self) -> AppResult { 75 | self.receiver 76 | .recv() 77 | .await 78 | .ok_or(Box::new(std::io::Error::new( 79 | std::io::ErrorKind::Other, 80 | "This is an IO error", 81 | ))) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/formatter.rs: -------------------------------------------------------------------------------- 1 | use ansi_to_tui::IntoText; 2 | 3 | use bat::{assets::HighlightingAssets, config::Config, controller::Controller, Input}; 4 | use ratatui::text::Text; 5 | 6 | pub struct Formatter<'a> { 7 | controller: Controller<'a>, 8 | } 9 | 10 | impl<'a> Formatter<'a> { 11 | pub fn new(config: &'a Config, assets: &'a HighlightingAssets) -> Self { 12 | let controller = Controller::new(config, assets); 13 | Self { controller } 14 | } 15 | 16 | pub fn init() -> (Config<'static>, HighlightingAssets) { 17 | let config = bat::config::Config { 18 | colored_output: true, 19 | ..Default::default() 20 | }; 21 | let assets = bat::assets::HighlightingAssets::from_binary(); 22 | (config, assets) 23 | } 24 | 25 | pub fn format(&self, input: &str) -> Text<'static> { 26 | let mut buffer = String::new(); 27 | let input = Input::from_bytes(input.as_bytes()).name("text.md"); 28 | self.controller 29 | .run(vec![input.into()], Some(&mut buffer)) 30 | .unwrap(); 31 | buffer.into_text().unwrap_or(Text::from(buffer)) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/handler.rs: -------------------------------------------------------------------------------- 1 | use crate::llm::{LLMAnswer, LLMRole}; 2 | use crate::{chat::Chat, prompt::Mode}; 3 | 4 | use crate::{ 5 | app::{App, AppResult, FocusedBlock}, 6 | event::Event, 7 | }; 8 | 9 | use crate::llm::LLM; 10 | use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; 11 | 12 | use ratatui::text::Line; 13 | 14 | use std::sync::Arc; 15 | use tokio::sync::Mutex; 16 | 17 | use tokio::sync::mpsc::UnboundedSender; 18 | 19 | pub async fn handle_key_events( 20 | key_event: KeyEvent, 21 | app: &mut App<'_>, 22 | llm: Arc>>, 23 | sender: UnboundedSender, 24 | ) -> AppResult<()> { 25 | match key_event.code { 26 | // Quit the app 27 | KeyCode::Char('q') if app.prompt.mode != Mode::Insert => { 28 | app.running = false; 29 | } 30 | 31 | KeyCode::Char('c') if key_event.modifiers == KeyModifiers::CONTROL => { 32 | app.running = false; 33 | } 34 | 35 | // Terminate the stream response 36 | KeyCode::Char('t') if key_event.modifiers == KeyModifiers::CONTROL => { 37 | app.terminate_response_signal 38 | .store(true, std::sync::atomic::Ordering::Relaxed); 39 | } 40 | 41 | // scroll down 42 | KeyCode::Char('j') | KeyCode::Down => match app.focused_block { 43 | FocusedBlock::History => { 44 | app.history.scroll_down(); 45 | } 46 | 47 | FocusedBlock::Chat => { 48 | app.chat 49 | .automatic_scroll 50 | .store(false, std::sync::atomic::Ordering::Relaxed); 51 | app.chat.scroll = app.chat.scroll.saturating_add(1); 52 | } 53 | 54 | FocusedBlock::Preview => { 55 | app.history.preview.scroll = app.history.preview.scroll.saturating_add(1); 56 | } 57 | _ => (), 58 | }, 59 | 60 | // scroll up 61 | KeyCode::Char('k') | KeyCode::Up => match app.focused_block { 62 | FocusedBlock::History => app.history.scroll_up(), 63 | 64 | FocusedBlock::Preview => { 65 | app.history.preview.scroll = app.history.preview.scroll.saturating_sub(1); 66 | } 67 | 68 | FocusedBlock::Chat => { 69 | app.chat 70 | .automatic_scroll 71 | .store(false, std::sync::atomic::Ordering::Relaxed); 72 | app.chat.scroll = app.chat.scroll.saturating_sub(1); 73 | } 74 | 75 | _ => (), 76 | }, 77 | 78 | // `G`: Mo to the bottom 79 | KeyCode::Char('G') => match app.focused_block { 80 | FocusedBlock::Chat => app.chat.move_to_bottom(), 81 | FocusedBlock::History => app.history.move_to_bottom(), 82 | _ => (), 83 | }, 84 | 85 | // `gg`: Move to the top 86 | KeyCode::Char('g') => { 87 | if app.previous_key == KeyCode::Char('g') { 88 | match app.focused_block { 89 | FocusedBlock::Chat => { 90 | app.chat.move_to_top(); 91 | } 92 | FocusedBlock::History => { 93 | app.history.move_to_top(); 94 | } 95 | _ => (), 96 | } 97 | } 98 | } 99 | 100 | // New chat 101 | KeyCode::Char(c) 102 | if c == app.config.key_bindings.new_chat 103 | && key_event.modifiers == KeyModifiers::CONTROL => 104 | { 105 | app.prompt.clear(); 106 | 107 | app.history 108 | .preview 109 | .text 110 | .push(app.chat.formatted_chat.clone()); 111 | 112 | app.history.text.push(app.chat.plain_chat.clone()); 113 | // after adding to history, save the chat in file 114 | app.history.save(app.history.text.len() - 1, sender.clone()); 115 | 116 | app.chat = Chat::default(); 117 | 118 | let llm = llm.clone(); 119 | { 120 | let mut llm = llm.lock().await; 121 | llm.clear(); 122 | } 123 | 124 | app.chat.scroll = 0; 125 | } 126 | 127 | // Switch the focus 128 | KeyCode::Tab => match app.focused_block { 129 | FocusedBlock::Chat => { 130 | app.focused_block = FocusedBlock::Prompt; 131 | 132 | app.chat 133 | .automatic_scroll 134 | .store(true, std::sync::atomic::Ordering::Relaxed); 135 | } 136 | FocusedBlock::Prompt => { 137 | app.chat.move_to_bottom(); 138 | 139 | app.focused_block = FocusedBlock::Chat; 140 | app.prompt.mode = Mode::Normal; 141 | } 142 | FocusedBlock::History => { 143 | app.focused_block = FocusedBlock::Preview; 144 | app.history.preview.scroll = 0; 145 | } 146 | FocusedBlock::Preview => { 147 | app.focused_block = FocusedBlock::History; 148 | app.history.preview.scroll = 0; 149 | } 150 | _ => (), 151 | }, 152 | 153 | // Show help 154 | KeyCode::Char(c) 155 | if c == app.config.key_bindings.show_help && app.prompt.mode != Mode::Insert => 156 | { 157 | app.focused_block = FocusedBlock::Help; 158 | app.chat 159 | .automatic_scroll 160 | .store(true, std::sync::atomic::Ordering::Relaxed); 161 | } 162 | 163 | // Show history 164 | KeyCode::Char(c) 165 | if c == app.config.key_bindings.show_history 166 | && app.prompt.mode != Mode::Insert 167 | && key_event.modifiers == KeyModifiers::CONTROL => 168 | { 169 | app.focused_block = FocusedBlock::History; 170 | app.chat 171 | .automatic_scroll 172 | .store(true, std::sync::atomic::Ordering::Relaxed); 173 | } 174 | 175 | // Discard help & history popups 176 | KeyCode::Esc => match app.focused_block { 177 | FocusedBlock::History | FocusedBlock::Preview | FocusedBlock::Help => { 178 | app.focused_block = FocusedBlock::Prompt 179 | } 180 | _ => {} 181 | }, 182 | 183 | _ => {} 184 | } 185 | 186 | if let FocusedBlock::Prompt = app.focused_block { 187 | if let Mode::Normal = app.prompt.mode { 188 | if key_event.code == KeyCode::Enter { 189 | let user_input = app.prompt.editor.lines().join("\n"); 190 | let user_input = user_input.trim(); 191 | if user_input.is_empty() { 192 | return Ok(()); 193 | } 194 | 195 | app.prompt.clear(); 196 | 197 | app.chat.plain_chat.push(format!("👤 : {}\n", user_input)); 198 | 199 | if app.chat.formatted_chat.width() == 0 { 200 | app.chat.formatted_chat = app 201 | .formatter 202 | .format(format!("👤: {}\n", user_input).as_str()); 203 | } else { 204 | app.chat.formatted_chat.extend( 205 | app.formatter 206 | .format(format!("👤: {}\n", user_input).as_str()), 207 | ); 208 | } 209 | 210 | let llm = llm.clone(); 211 | { 212 | let mut llm = llm.lock().await; 213 | llm.append_chat_msg(user_input.into(), LLMRole::USER); 214 | } 215 | 216 | app.spinner.active = true; 217 | 218 | app.chat 219 | .formatted_chat 220 | .lines 221 | .push(Line::raw("🤖: ".to_string())); 222 | 223 | let terminate_response_signal = app.terminate_response_signal.clone(); 224 | 225 | let sender = sender.clone(); 226 | 227 | let llm = llm.clone(); 228 | 229 | tokio::spawn(async move { 230 | let llm = llm.lock().await; 231 | let res = llm.ask(sender.clone(), terminate_response_signal).await; 232 | 233 | if let Err(e) = res { 234 | sender 235 | .send(Event::LLMEvent(LLMAnswer::StartAnswer)) 236 | .unwrap(); 237 | sender 238 | .send(Event::LLMEvent(LLMAnswer::Answer(e.to_string()))) 239 | .unwrap(); 240 | } 241 | }); 242 | } 243 | } 244 | 245 | app.prompt 246 | .handler(key_event, app.previous_key, app.clipboard.as_mut()); 247 | } 248 | 249 | app.previous_key = key_event.code; 250 | 251 | Ok(()) 252 | } 253 | -------------------------------------------------------------------------------- /src/help.rs: -------------------------------------------------------------------------------- 1 | use ratatui::{ 2 | layout::{Alignment, Constraint, Direction, Layout}, 3 | style::{Color, Style, Stylize}, 4 | widgets::{Block, BorderType, Borders, Cell, Clear, Padding, Row, Table}, 5 | Frame, 6 | }; 7 | 8 | pub struct Help { 9 | block_height: usize, 10 | keys: Vec<(Cell<'static>, &'static str)>, 11 | } 12 | 13 | impl Default for Help { 14 | fn default() -> Self { 15 | Self { 16 | block_height: 0, 17 | keys: vec![ 18 | ( 19 | Cell::from("Esc").bold().yellow(), 20 | "Switch to Normal mode / Dismiss pop-up", 21 | ), 22 | (Cell::from("Tab").bold().yellow(), "Switch the focus"), 23 | ( 24 | Cell::from("ctrl + n").bold().yellow(), 25 | "Start new chat and save the previous one to the history", 26 | ), 27 | (Cell::from("ctrl + h").bold().yellow(), "Show history"), 28 | ( 29 | Cell::from("ctrl + t").bold().yellow(), 30 | "Stop the stream response", 31 | ), 32 | (Cell::from("j or Down").bold().yellow(), "Scroll down"), 33 | (Cell::from("k or Up").bold().yellow(), "Scroll up"), 34 | (Cell::from("G").bold().yellow(), "Go to the end"), 35 | (Cell::from("gg").bold().yellow(), "Go to the top"), 36 | (Cell::from("?").bold().yellow(), "Show help"), 37 | ], 38 | } 39 | } 40 | } 41 | 42 | impl Help { 43 | pub fn new() -> Self { 44 | Self::default() 45 | } 46 | 47 | pub fn render(&mut self, frame: &mut Frame) { 48 | let layout = Layout::default() 49 | .direction(Direction::Vertical) 50 | .constraints([ 51 | Constraint::Fill(1), 52 | Constraint::Length(15), 53 | Constraint::Fill(1), 54 | ]) 55 | .flex(ratatui::layout::Flex::SpaceBetween) 56 | .split(frame.area()); 57 | 58 | let block = Layout::default() 59 | .direction(Direction::Horizontal) 60 | .constraints([ 61 | Constraint::Fill(1), 62 | Constraint::Min(75), 63 | Constraint::Fill(1), 64 | ]) 65 | .flex(ratatui::layout::Flex::SpaceBetween) 66 | .split(layout[1])[1]; 67 | 68 | self.block_height = block.height as usize; 69 | let widths = [Constraint::Length(12), Constraint::Fill(1)]; 70 | let rows: Vec = self 71 | .keys 72 | .iter() 73 | .map(|key| { 74 | Row::new(vec![key.0.to_owned(), key.1.into()]) 75 | .style(Style::default().fg(Color::White)) 76 | }) 77 | .collect(); 78 | 79 | let table = Table::new(rows, widths).block( 80 | Block::default() 81 | .padding(Padding::uniform(1)) 82 | .title(" Help ") 83 | .title_style(Style::default().bold().fg(Color::Green)) 84 | .title_alignment(Alignment::Center) 85 | .borders(Borders::ALL) 86 | .style(Style::default()) 87 | .border_type(BorderType::Thick) 88 | .border_style(Style::default().fg(Color::Green)), 89 | ); 90 | 91 | frame.render_widget(Clear, block); 92 | frame.render_widget(table, block); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/history.rs: -------------------------------------------------------------------------------- 1 | use core::str; 2 | use std::{fs, path::PathBuf}; 3 | 4 | use tokio::sync::mpsc::UnboundedSender; 5 | 6 | use ratatui::{ 7 | layout::{Alignment, Constraint, Direction, Layout}, 8 | style::{Color, Style, Stylize}, 9 | text::Text, 10 | widgets::{Block, Borders, Clear, List, ListItem, ListState, Paragraph, Wrap}, 11 | Frame, 12 | }; 13 | 14 | use crate::{ 15 | app::FocusedBlock, 16 | event::Event, 17 | notification::{Notification, NotificationLevel}, 18 | }; 19 | 20 | #[derive(Debug, Default, Clone)] 21 | pub struct Preview<'a> { 22 | pub text: Vec>, 23 | pub scroll: usize, 24 | } 25 | 26 | #[derive(Debug, Default, Clone)] 27 | pub struct History<'a> { 28 | state: ListState, 29 | pub text: Vec>, 30 | pub preview: Preview<'a>, 31 | } 32 | 33 | impl History<'_> { 34 | pub fn new() -> Self { 35 | Self { 36 | state: ListState::default(), 37 | text: Vec::new(), 38 | preview: Preview::default(), 39 | } 40 | } 41 | 42 | pub fn move_to_bottom(&mut self) { 43 | if !self.text.is_empty() { 44 | self.state.select(Some(self.text.len() - 1)); 45 | } 46 | } 47 | 48 | pub fn move_to_top(&mut self) { 49 | if !self.text.is_empty() { 50 | self.state.select(Some(0)); 51 | } 52 | } 53 | 54 | pub fn scroll_down(&mut self) { 55 | if self.text.is_empty() { 56 | return; 57 | } 58 | let i = match self.state.selected() { 59 | Some(i) => { 60 | if i < self.text.len() - 1 { 61 | i + 1 62 | } else { 63 | i 64 | } 65 | } 66 | None => 0, 67 | }; 68 | self.state.select(Some(i)); 69 | } 70 | pub fn scroll_up(&mut self) { 71 | if self.text.is_empty() { 72 | return; 73 | } 74 | let i = match self.state.selected() { 75 | Some(i) => { 76 | if i > 1 { 77 | i - 1 78 | } else { 79 | 0 80 | } 81 | } 82 | None => 0, 83 | }; 84 | self.state.select(Some(i)); 85 | } 86 | 87 | // check if data directory for the application exists, else it will create it 88 | pub fn check_data_directory_exists(&self, sender: UnboundedSender) { 89 | if let Some(data_directory) = dirs::data_dir() { 90 | let target_directory = data_directory.join("tenere"); 91 | 92 | if !target_directory.exists() { 93 | if let Err(e) = fs::create_dir_all(target_directory) { 94 | let notif = Notification::new(e.to_string(), NotificationLevel::Error); 95 | sender.send(Event::Notification(notif)).unwrap(); 96 | } 97 | } 98 | } 99 | } 100 | 101 | // load chat in the history from data directory 102 | pub fn load_history(&mut self, sender: UnboundedSender) { 103 | let directory_path: PathBuf = dirs::data_dir().unwrap().join("tenere"); 104 | 105 | if let Ok(paths) = fs::read_dir(directory_path.clone()) { 106 | // foreach archive file we add it to history 107 | for path in paths { 108 | if path.as_ref().unwrap().file_type().unwrap().is_file() { 109 | self.load_chat_from_file(path.unwrap().path().to_str().unwrap()); 110 | } 111 | } 112 | 113 | let notif = Notification::new("History loaded".to_string(), NotificationLevel::Info); 114 | 115 | sender.send(Event::Notification(notif)).unwrap(); 116 | } 117 | } 118 | 119 | /// Add to history the archive file if exists 120 | pub fn load_chat_from_file(&mut self, archive_file_name: &str) { 121 | if let Ok(text) = std::fs::read_to_string(archive_file_name) { 122 | // push full conversation in preview 123 | self.preview.text.push(Text::from(text.clone())); 124 | // get first line of the conversation 125 | let first_line: String = text.lines().next().unwrap_or("").to_string(); 126 | self.text.push(vec![first_line]); 127 | } 128 | } 129 | 130 | // call after adding new chat in history (Starting a new chat) 131 | // with the index of the chat in history to save 132 | pub fn save(&mut self, chat_index_in_history: usize, sender: UnboundedSender) { 133 | let file_name = format!("tenere.archive-{}", chat_index_in_history); 134 | let file_path: PathBuf = dirs::data_dir().unwrap().join("tenere").join(file_name); 135 | 136 | if !self.text.is_empty() { 137 | match std::fs::write(file_path.clone(), self.text[chat_index_in_history].join("")) { 138 | Ok(_) => { 139 | let notif = 140 | Notification::new("Chat saved".to_string(), NotificationLevel::Info); 141 | 142 | sender.send(Event::Notification(notif)).unwrap(); 143 | } 144 | Err(e) => { 145 | let notif = Notification::new(e.to_string(), NotificationLevel::Error); 146 | 147 | sender.send(Event::Notification(notif)).unwrap(); 148 | } 149 | } 150 | } 151 | } 152 | 153 | pub fn render(&mut self, frame: &mut Frame, focused_block: &FocusedBlock) { 154 | let layout = Layout::default() 155 | .direction(Direction::Vertical) 156 | .constraints([ 157 | Constraint::Fill(1), 158 | Constraint::Percentage(90), 159 | Constraint::Fill(1), 160 | ]) 161 | .split(frame.area())[1]; 162 | 163 | let block = Layout::default() 164 | .direction(Direction::Horizontal) 165 | .constraints([ 166 | Constraint::Fill(1), 167 | Constraint::Percentage(90), 168 | Constraint::Fill(1), 169 | ]) 170 | .split(layout)[1]; 171 | 172 | if !self.text.is_empty() && self.state.selected().is_none() { 173 | *self.state.offset_mut() = 0; 174 | self.state.select(Some(0)); 175 | } 176 | 177 | let (history_block, preview_block) = { 178 | let chunks = Layout::default() 179 | .direction(Direction::Horizontal) 180 | .constraints([Constraint::Percentage(50), Constraint::Percentage(50)]) 181 | .split(block); 182 | (chunks[0], chunks[1]) 183 | }; 184 | 185 | let items = self 186 | .text 187 | .iter() 188 | .map(|chat| match chat.first() { 189 | Some(v) => ListItem::new(v.to_owned()), 190 | None => ListItem::new(""), 191 | }) 192 | .collect::>(); 193 | 194 | let list = List::new(items) 195 | .block( 196 | Block::default() 197 | .borders(Borders::ALL) 198 | .title(" History ") 199 | .title_style(match focused_block { 200 | FocusedBlock::History => Style::default().bold(), 201 | _ => Style::default(), 202 | }) 203 | .title_alignment(Alignment::Center) 204 | .style(Style::default()) 205 | .border_style(match focused_block { 206 | FocusedBlock::History => Style::default().fg(Color::Green), 207 | _ => Style::default(), 208 | }), 209 | ) 210 | .highlight_style(Style::default().bg(Color::DarkGray)); 211 | 212 | let preview = Paragraph::new(match self.state.selected() { 213 | Some(i) => self.preview.text[i].clone(), 214 | None => Text::raw(""), 215 | }) 216 | .wrap(Wrap { trim: false }) 217 | .scroll((self.preview.scroll as u16, 0)) 218 | .block( 219 | Block::default() 220 | .title(" Preview ") 221 | .title_style(match focused_block { 222 | FocusedBlock::Preview => Style::default().bold(), 223 | _ => Style::default(), 224 | }) 225 | .title_alignment(Alignment::Center) 226 | .borders(Borders::ALL) 227 | .style(Style::default()) 228 | .border_style(match focused_block { 229 | FocusedBlock::Preview => Style::default().fg(Color::Green), 230 | _ => Style::default(), 231 | }), 232 | ); 233 | 234 | frame.render_widget(Clear, block); 235 | frame.render_widget(preview, preview_block); 236 | frame.render_stateful_widget(list, history_block, &mut self.state); 237 | } 238 | } 239 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod app; 2 | 3 | pub mod event; 4 | 5 | pub mod tui; 6 | 7 | pub mod handler; 8 | 9 | pub mod chatgpt; 10 | 11 | pub mod config; 12 | 13 | pub mod ui; 14 | 15 | pub mod notification; 16 | 17 | pub mod llm; 18 | 19 | pub mod spinner; 20 | 21 | pub mod formatter; 22 | 23 | pub mod prompt; 24 | 25 | pub mod help; 26 | 27 | pub mod history; 28 | 29 | pub mod chat; 30 | 31 | pub mod llamacpp; 32 | 33 | pub mod ollama; 34 | -------------------------------------------------------------------------------- /src/llamacpp.rs: -------------------------------------------------------------------------------- 1 | use std::sync::atomic::{AtomicBool, Ordering}; 2 | use std::sync::Arc; 3 | 4 | use crate::event::Event; 5 | use async_trait::async_trait; 6 | use regex::Regex; 7 | use tokio::sync::mpsc::UnboundedSender; 8 | 9 | use crate::config::LLamacppConfig; 10 | use crate::llm::{LLMAnswer, LLMRole, LLM}; 11 | use reqwest::header::HeaderMap; 12 | use serde_json::{json, Value}; 13 | use std; 14 | use std::collections::HashMap; 15 | 16 | #[derive(Clone, Debug)] 17 | pub struct LLamacpp { 18 | client: reqwest::Client, 19 | url: String, 20 | api_key: Option, 21 | messages: Vec>, 22 | } 23 | 24 | impl LLamacpp { 25 | pub fn new(config: LLamacppConfig) -> Self { 26 | let api_key = match std::env::var("LLAMACPP_API_KEY") { 27 | Ok(key) => Some(key), 28 | Err(_) => config.api_key.clone(), 29 | }; 30 | 31 | Self { 32 | client: reqwest::Client::new(), 33 | url: config.url, 34 | api_key, 35 | messages: Vec::new(), 36 | } 37 | } 38 | } 39 | 40 | #[async_trait] 41 | impl LLM for LLamacpp { 42 | fn clear(&mut self) { 43 | self.messages = Vec::new(); 44 | } 45 | 46 | fn append_chat_msg(&mut self, msg: String, role: LLMRole) { 47 | let mut conv: HashMap = HashMap::new(); 48 | conv.insert("role".to_string(), role.to_string()); 49 | conv.insert("content".to_string(), msg); 50 | self.messages.push(conv); 51 | } 52 | 53 | async fn ask( 54 | &self, 55 | sender: UnboundedSender, 56 | terminate_response_signal: Arc, 57 | ) -> Result<(), Box> { 58 | let mut headers = HeaderMap::new(); 59 | headers.insert("Content-Type", "application/json".parse()?); 60 | 61 | if let Some(api_key) = &self.api_key { 62 | headers.insert("Authorization", format!("Bearer {}", api_key).parse()?); 63 | } 64 | 65 | let mut messages: Vec> = vec![ 66 | (HashMap::from([ 67 | ("role".to_string(), "system".to_string()), 68 | ( 69 | "content".to_string(), 70 | "You are a helpful assistant.".to_string(), 71 | ), 72 | ])), 73 | ]; 74 | 75 | messages.extend(self.messages.clone()); 76 | 77 | let body: Value = json!({ 78 | "messages": messages, 79 | "stream": true, 80 | }); 81 | 82 | let response = self 83 | .client 84 | .post(&self.url) 85 | .headers(headers) 86 | .json(&body) 87 | .send() 88 | .await?; 89 | 90 | match response.error_for_status() { 91 | Ok(mut res) => { 92 | sender.send(Event::LLMEvent(LLMAnswer::StartAnswer))?; 93 | let re = Regex::new(r"data:\s(.*)")?; 94 | while let Some(chunk) = res.chunk().await? { 95 | let chunk = std::str::from_utf8(&chunk)?; 96 | 97 | for captures in re.captures_iter(chunk) { 98 | if let Some(data_json) = captures.get(1) { 99 | if terminate_response_signal.load(Ordering::Relaxed) { 100 | sender.send(Event::LLMEvent(LLMAnswer::EndAnswer))?; 101 | return Ok(()); 102 | } 103 | 104 | let answer: Value = serde_json::from_str(data_json.as_str())?; 105 | 106 | if answer["choices"]["finish_reason"] == "stop" { 107 | sender.send(Event::LLMEvent(LLMAnswer::EndAnswer))?; 108 | return Ok(()); 109 | } 110 | 111 | let msg = answer["choices"][0]["delta"]["content"] 112 | .as_str() 113 | .unwrap_or("\n"); 114 | 115 | sender.send(Event::LLMEvent(LLMAnswer::Answer(msg.to_string())))?; 116 | } 117 | } 118 | } 119 | } 120 | Err(e) => return Err(Box::new(e)), 121 | } 122 | 123 | sender.send(Event::LLMEvent(LLMAnswer::EndAnswer))?; 124 | 125 | Ok(()) 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/llm.rs: -------------------------------------------------------------------------------- 1 | use crate::chatgpt::ChatGPT; 2 | use crate::config::Config; 3 | use crate::event::Event; 4 | use crate::llamacpp::LLamacpp; 5 | use crate::ollama::Ollama; 6 | use async_trait::async_trait; 7 | use serde::Deserialize; 8 | use std::sync::atomic::AtomicBool; 9 | use strum_macros::Display; 10 | use strum_macros::EnumIter; 11 | use tokio::sync::mpsc::UnboundedSender; 12 | 13 | use std::sync::Arc; 14 | 15 | #[async_trait] 16 | pub trait LLM: Send + Sync { 17 | async fn ask( 18 | &self, 19 | sender: UnboundedSender, 20 | terminate_response_signal: Arc, 21 | ) -> Result<(), Box>; 22 | 23 | fn append_chat_msg(&mut self, msg: String, role: LLMRole); 24 | fn clear(&mut self); 25 | } 26 | 27 | #[derive(Clone, Debug)] 28 | pub enum LLMAnswer { 29 | StartAnswer, 30 | Answer(String), 31 | EndAnswer, 32 | } 33 | 34 | #[derive(EnumIter, Display, Debug)] 35 | #[strum(serialize_all = "lowercase")] 36 | pub enum LLMRole { 37 | ASSISTANT, 38 | SYSTEM, 39 | USER, 40 | } 41 | 42 | #[derive(Deserialize, PartialEq, Debug)] 43 | #[serde(rename_all = "lowercase")] 44 | pub enum LLMBackend { 45 | ChatGPT, 46 | LLamacpp, 47 | Ollama, 48 | } 49 | 50 | pub struct LLMModel; 51 | 52 | impl LLMModel { 53 | pub async fn init(model: &LLMBackend, config: Arc) -> Box { 54 | match model { 55 | LLMBackend::ChatGPT => Box::new(ChatGPT::new(config.chatgpt.clone())), 56 | LLMBackend::LLamacpp => Box::new(LLamacpp::new(config.llamacpp.clone().unwrap())), 57 | LLMBackend::Ollama => Box::new(Ollama::new(config.ollama.clone().unwrap())), 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use ratatui::backend::CrosstermBackend; 2 | use ratatui::Terminal; 3 | use std::{env, io, path::PathBuf}; 4 | use tenere::app::{App, AppResult}; 5 | use tenere::config::Config; 6 | use tenere::event::{Event, EventHandler}; 7 | use tenere::formatter::Formatter; 8 | use tenere::handler::handle_key_events; 9 | use tenere::llm::{LLMAnswer, LLMRole}; 10 | use tenere::tui::Tui; 11 | 12 | use tenere::llm::LLMModel; 13 | 14 | use std::sync::Arc; 15 | use tokio::sync::Mutex; 16 | 17 | use clap::{crate_description, crate_version, Arg, Command}; 18 | 19 | #[tokio::main] 20 | async fn main() -> AppResult<()> { 21 | let matches = Command::new("tenere") 22 | .about(crate_description!()) 23 | .version(crate_version!()) 24 | .arg( 25 | Arg::new("config") 26 | .short('c') 27 | .long("config") 28 | .help("Path to custom config file") 29 | .value_name("FILE"), 30 | ) 31 | .get_matches(); 32 | 33 | let config_path = matches.get_one::("config").map(PathBuf::from); 34 | let config = Arc::new(Config::load(config_path)); 35 | 36 | let (formatter_config, formatter_assets) = Formatter::init(); 37 | let formatter = Formatter::new(&formatter_config, &formatter_assets); 38 | 39 | let mut app = App::new(config.clone(), &formatter); 40 | 41 | let llm = Arc::new(Mutex::new( 42 | LLMModel::init(&config.llm, config.clone()).await, 43 | )); 44 | 45 | let backend = CrosstermBackend::new(io::stdout()); 46 | let terminal = Terminal::new(backend)?; 47 | let events = EventHandler::new(250); 48 | let mut tui = Tui::new(terminal, events); 49 | tui.init()?; 50 | 51 | // create data directory if not exists 52 | app.history 53 | .check_data_directory_exists(tui.events.sender.clone()); 54 | 55 | // load potential history data from archive files 56 | app.history.load_history(tui.events.sender.clone()); 57 | 58 | while app.running { 59 | tui.draw(&mut app)?; 60 | match tui.events.next().await? { 61 | Event::Tick => app.tick(), 62 | Event::Key(key_event) => { 63 | handle_key_events(key_event, &mut app, llm.clone(), tui.events.sender.clone()) 64 | .await?; 65 | } 66 | Event::Mouse(_) => {} 67 | Event::Resize(_, _) => {} 68 | Event::LLMEvent(LLMAnswer::Answer(answer)) => { 69 | app.chat 70 | .handle_answer(LLMAnswer::Answer(answer), &formatter); 71 | } 72 | Event::LLMEvent(LLMAnswer::EndAnswer) => { 73 | { 74 | let mut llm = llm.lock().await; 75 | llm.append_chat_msg(app.chat.answer.plain_answer.clone(), LLMRole::ASSISTANT); 76 | } 77 | 78 | app.chat.handle_answer(LLMAnswer::EndAnswer, &formatter); 79 | app.terminate_response_signal 80 | .store(false, std::sync::atomic::Ordering::Relaxed); 81 | } 82 | Event::LLMEvent(LLMAnswer::StartAnswer) => { 83 | app.spinner.active = false; 84 | app.chat.handle_answer(LLMAnswer::StartAnswer, &formatter); 85 | } 86 | 87 | Event::Notification(notification) => { 88 | app.notifications.push(notification); 89 | } 90 | } 91 | } 92 | 93 | tui.exit()?; 94 | Ok(()) 95 | } 96 | -------------------------------------------------------------------------------- /src/notification.rs: -------------------------------------------------------------------------------- 1 | use ratatui::{ 2 | layout::{Alignment, Constraint, Direction, Layout, Rect}, 3 | style::{Color, Modifier, Style}, 4 | text::{Line, Text}, 5 | widgets::{Block, BorderType, Borders, Clear, Paragraph, Wrap}, 6 | Frame, 7 | }; 8 | 9 | #[derive(Debug, Clone)] 10 | pub struct Notification { 11 | pub message: String, 12 | pub level: NotificationLevel, 13 | pub ttl: u16, 14 | } 15 | 16 | #[derive(Debug, Clone)] 17 | pub enum NotificationLevel { 18 | Error, 19 | Warning, 20 | Info, 21 | } 22 | 23 | impl Notification { 24 | pub fn new(message: String, level: NotificationLevel) -> Self { 25 | Self { 26 | message, 27 | level, 28 | ttl: 4, 29 | } 30 | } 31 | 32 | pub fn render(&self, index: usize, frame: &mut Frame) { 33 | let (color, title) = match self.level { 34 | NotificationLevel::Info => (Color::Green, "Info"), 35 | NotificationLevel::Warning => (Color::Yellow, "Warning"), 36 | NotificationLevel::Error => (Color::Red, "Error"), 37 | }; 38 | 39 | let mut text = Text::from(vec![ 40 | Line::from(title).style(Style::new().fg(color).add_modifier(Modifier::BOLD)) 41 | ]); 42 | 43 | text.extend(Text::from(self.message.as_str())); 44 | 45 | let notification_height = text.height() as u16 + 2; 46 | let notification_width = text.width() as u16 + 4; 47 | 48 | let block = Paragraph::new(text) 49 | .wrap(Wrap { trim: false }) 50 | .alignment(Alignment::Center) 51 | .block( 52 | Block::default() 53 | .borders(Borders::ALL) 54 | .style(Style::default()) 55 | .border_type(BorderType::Thick) 56 | .border_style(Style::default().fg(color)), 57 | ); 58 | 59 | let area = notification_rect( 60 | index as u16, 61 | notification_height, 62 | notification_width, 63 | frame.area(), 64 | ); 65 | 66 | frame.render_widget(Clear, area); 67 | frame.render_widget(block, area); 68 | } 69 | } 70 | 71 | pub fn notification_rect(offset: u16, height: u16, width: u16, r: Rect) -> Rect { 72 | let popup_layout = Layout::default() 73 | .direction(Direction::Vertical) 74 | .constraints( 75 | [ 76 | Constraint::Length(height * offset), 77 | Constraint::Length(height), 78 | Constraint::Min(1), 79 | ] 80 | .as_ref(), 81 | ) 82 | .split(r); 83 | 84 | Layout::default() 85 | .direction(Direction::Horizontal) 86 | .constraints( 87 | [ 88 | Constraint::Min(1), 89 | Constraint::Length(width), 90 | Constraint::Length(2), 91 | ] 92 | .as_ref(), 93 | ) 94 | .split(popup_layout[1])[1] 95 | } 96 | -------------------------------------------------------------------------------- /src/ollama.rs: -------------------------------------------------------------------------------- 1 | use std::sync::atomic::{AtomicBool, Ordering}; 2 | 3 | use std::sync::Arc; 4 | 5 | use crate::config::OllamaConfig; 6 | use crate::event::Event; 7 | use async_trait::async_trait; 8 | use tokio::sync::mpsc::UnboundedSender; 9 | 10 | use crate::llm::{LLMAnswer, LLMRole, LLM}; 11 | use reqwest::header::HeaderMap; 12 | use serde_json::{json, Value}; 13 | use std; 14 | use std::collections::HashMap; 15 | 16 | #[derive(Clone, Debug)] 17 | pub struct Ollama { 18 | client: reqwest::Client, 19 | url: String, 20 | model: String, 21 | messages: Vec>, 22 | } 23 | 24 | impl Ollama { 25 | pub fn new(config: OllamaConfig) -> Self { 26 | Self { 27 | client: reqwest::Client::new(), 28 | url: config.url, 29 | model: config.model, 30 | messages: Vec::new(), 31 | } 32 | } 33 | } 34 | 35 | #[async_trait] 36 | impl LLM for Ollama { 37 | fn clear(&mut self) { 38 | self.messages = Vec::new(); 39 | } 40 | 41 | fn append_chat_msg(&mut self, msg: String, role: LLMRole) { 42 | let mut conv: HashMap = HashMap::new(); 43 | conv.insert("role".to_string(), role.to_string()); 44 | conv.insert("content".to_string(), msg); 45 | self.messages.push(conv); 46 | } 47 | 48 | async fn ask( 49 | &self, 50 | sender: UnboundedSender, 51 | terminate_response_signal: Arc, 52 | ) -> Result<(), Box> { 53 | let mut headers = HeaderMap::new(); 54 | headers.insert("Content-Type", "application/json".parse()?); 55 | 56 | let mut messages: Vec> = vec![ 57 | (HashMap::from([ 58 | ("role".to_string(), "system".to_string()), 59 | ( 60 | "content".to_string(), 61 | "You are a helpful assistant.".to_string(), 62 | ), 63 | ])), 64 | ]; 65 | 66 | messages.extend(self.messages.clone()); 67 | 68 | let body: Value = json!({ 69 | "messages": messages, 70 | "model": self.model, 71 | "stream": true, 72 | }); 73 | 74 | let response = self 75 | .client 76 | .post(&self.url) 77 | .headers(headers) 78 | .json(&body) 79 | .send() 80 | .await?; 81 | 82 | match response.error_for_status() { 83 | Ok(mut res) => { 84 | sender.send(Event::LLMEvent(LLMAnswer::StartAnswer))?; 85 | while let Some(chunk) = res.chunk().await? { 86 | if terminate_response_signal.load(Ordering::Relaxed) { 87 | sender.send(Event::LLMEvent(LLMAnswer::EndAnswer))?; 88 | return Ok(()); 89 | } 90 | 91 | let answer: Value = serde_json::from_slice(chunk.as_ref())?; 92 | 93 | if answer["done"].as_bool().unwrap() { 94 | sender.send(Event::LLMEvent(LLMAnswer::EndAnswer))?; 95 | return Ok(()); 96 | } 97 | 98 | let msg = answer["message"]["content"].as_str().unwrap_or("\n"); 99 | 100 | sender.send(Event::LLMEvent(LLMAnswer::Answer(msg.to_string())))?; 101 | } 102 | } 103 | Err(e) => return Err(Box::new(e)), 104 | } 105 | 106 | sender.send(Event::LLMEvent(LLMAnswer::EndAnswer))?; 107 | 108 | Ok(()) 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/prompt.rs: -------------------------------------------------------------------------------- 1 | use arboard::Clipboard; 2 | use ratatui::{ 3 | layout::{Margin, Rect}, 4 | style::{Color, Style}, 5 | text::Text, 6 | widgets::{Block, BorderType, Borders}, 7 | Frame, 8 | }; 9 | use tui_textarea::{CursorMove, TextArea}; 10 | use unicode_width::UnicodeWidthStr; 11 | 12 | use crate::app::FocusedBlock; 13 | use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; 14 | 15 | #[derive(Debug, PartialEq)] 16 | pub enum Mode { 17 | Normal, 18 | Insert, 19 | Visual, 20 | } 21 | 22 | pub struct Prompt<'a> { 23 | pub mode: Mode, 24 | pub formatted_prompt: Text<'a>, 25 | pub editor: TextArea<'a>, 26 | } 27 | 28 | impl Default for Prompt<'_> { 29 | fn default() -> Self { 30 | let mut editor = TextArea::default(); 31 | editor.remove_line_number(); 32 | editor.set_cursor_line_style(Style::default()); 33 | editor.set_selection_style(Style::default().bg(Color::DarkGray)); 34 | 35 | Self { 36 | mode: Mode::Normal, 37 | formatted_prompt: Text::raw(""), 38 | editor, 39 | } 40 | } 41 | } 42 | 43 | impl Prompt<'_> { 44 | pub fn new() -> Self { 45 | Self::default() 46 | } 47 | 48 | pub fn clear(&mut self) { 49 | self.formatted_prompt = Text::raw(""); 50 | self.editor.select_all(); 51 | self.editor.cut(); 52 | } 53 | 54 | pub fn height(&self, frame_size: &Rect) -> u16 { 55 | let prompt_block_max_height = (0.4 * frame_size.height as f32) as u16; 56 | 57 | let height: u16 = 1 + self 58 | .editor 59 | .lines() 60 | .iter() 61 | .map(|line| 1 + line.width() as u16 / frame_size.width) 62 | .sum::(); 63 | 64 | std::cmp::min(height, prompt_block_max_height) 65 | } 66 | 67 | pub fn handler( 68 | &mut self, 69 | key_event: KeyEvent, 70 | previous_key: KeyCode, 71 | clipboard: Option<&mut Clipboard>, 72 | ) { 73 | match self.mode { 74 | Mode::Insert => match key_event.code { 75 | KeyCode::Enter => { 76 | self.editor.insert_newline(); 77 | } 78 | 79 | KeyCode::Char(c) => { 80 | self.editor.insert_char(c); 81 | } 82 | 83 | KeyCode::Backspace => { 84 | self.editor.delete_char(); 85 | } 86 | 87 | KeyCode::Esc => { 88 | self.mode = Mode::Normal; 89 | } 90 | _ => {} 91 | }, 92 | Mode::Normal | Mode::Visual => match key_event.code { 93 | KeyCode::Char('i') => { 94 | self.mode = Mode::Insert; 95 | } 96 | 97 | KeyCode::Esc => { 98 | self.mode = Mode::Normal; 99 | self.editor.cancel_selection(); 100 | } 101 | 102 | KeyCode::Char('v') => { 103 | self.mode = Mode::Visual; 104 | self.editor.start_selection(); 105 | } 106 | 107 | KeyCode::Char('h') | KeyCode::Left if key_event.modifiers == KeyModifiers::NONE => { 108 | self.editor.move_cursor(CursorMove::Back); 109 | } 110 | 111 | KeyCode::Char('j') | KeyCode::Down if key_event.modifiers == KeyModifiers::NONE => { 112 | self.editor.move_cursor(CursorMove::Down); 113 | } 114 | 115 | KeyCode::Char('k') | KeyCode::Up if key_event.modifiers == KeyModifiers::NONE => { 116 | self.editor.move_cursor(CursorMove::Up); 117 | } 118 | 119 | KeyCode::Char('l') | KeyCode::Right 120 | if key_event.modifiers == KeyModifiers::NONE => 121 | { 122 | self.editor.move_cursor(CursorMove::Forward); 123 | } 124 | 125 | KeyCode::Char('w') => match previous_key { 126 | KeyCode::Char('d') => { 127 | self.editor.delete_next_word(); 128 | } 129 | KeyCode::Char('c') => { 130 | self.editor.delete_next_word(); 131 | self.mode = Mode::Insert; 132 | } 133 | 134 | _ => self.editor.move_cursor(CursorMove::WordForward), 135 | }, 136 | 137 | KeyCode::Char('b') => match previous_key { 138 | KeyCode::Char('d') => { 139 | self.editor.delete_word(); 140 | } 141 | KeyCode::Char('c') => { 142 | self.editor.delete_word(); 143 | self.mode = Mode::Insert; 144 | } 145 | 146 | _ => self.editor.move_cursor(CursorMove::WordBack), 147 | }, 148 | 149 | KeyCode::Char('$') => match previous_key { 150 | KeyCode::Char('d') => { 151 | self.editor.delete_line_by_end(); 152 | } 153 | KeyCode::Char('c') => { 154 | self.editor.delete_line_by_end(); 155 | self.mode = Mode::Insert; 156 | } 157 | _ => self.editor.move_cursor(CursorMove::End), 158 | }, 159 | 160 | KeyCode::Char('0') => match previous_key { 161 | KeyCode::Char('d') => { 162 | self.editor.delete_line_by_head(); 163 | } 164 | KeyCode::Char('c') => { 165 | self.editor.delete_line_by_head(); 166 | self.mode = Mode::Insert; 167 | } 168 | _ => self.editor.move_cursor(CursorMove::Head), 169 | }, 170 | 171 | KeyCode::Char('G') => self.editor.move_cursor(CursorMove::Bottom), 172 | 173 | KeyCode::Char('g') => { 174 | if previous_key == KeyCode::Char('g') { 175 | self.editor.move_cursor(CursorMove::Jump(0, 0)) 176 | } 177 | } 178 | 179 | KeyCode::Char('D') => { 180 | self.editor.move_cursor(CursorMove::Head); 181 | self.editor.delete_line_by_end(); 182 | self.editor.delete_line_by_head(); 183 | } 184 | 185 | KeyCode::Char('d') => { 186 | if previous_key == KeyCode::Char('d') { 187 | self.editor.move_cursor(CursorMove::Head); 188 | self.editor.delete_line_by_end(); 189 | } 190 | } 191 | 192 | KeyCode::Char('c') => { 193 | if previous_key == KeyCode::Char('c') { 194 | self.editor.move_cursor(CursorMove::Head); 195 | self.editor.delete_line_by_end(); 196 | self.mode = Mode::Insert; 197 | } 198 | } 199 | 200 | KeyCode::Char('C') => { 201 | self.editor.delete_line_by_end(); 202 | self.mode = Mode::Insert; 203 | } 204 | 205 | KeyCode::Char('x') => { 206 | self.editor.delete_next_char(); 207 | } 208 | 209 | KeyCode::Char('a') => { 210 | self.editor.move_cursor(CursorMove::Forward); 211 | self.mode = Mode::Insert; 212 | } 213 | 214 | KeyCode::Char('A') => { 215 | self.editor.move_cursor(CursorMove::End); 216 | self.mode = Mode::Insert; 217 | } 218 | 219 | KeyCode::Char('o') => { 220 | self.editor.move_cursor(CursorMove::End); 221 | self.editor.insert_newline(); 222 | self.mode = Mode::Insert; 223 | } 224 | 225 | KeyCode::Char('O') => { 226 | self.editor.move_cursor(CursorMove::Head); 227 | self.editor.insert_newline(); 228 | self.editor.move_cursor(CursorMove::Up); 229 | self.mode = Mode::Insert; 230 | } 231 | 232 | KeyCode::Char('I') => { 233 | self.editor.move_cursor(CursorMove::Head); 234 | self.mode = Mode::Insert; 235 | } 236 | 237 | KeyCode::Char('y') => { 238 | self.editor.copy(); 239 | if let Some(clipboard) = clipboard { 240 | let text = self.editor.yank_text(); 241 | let _ = clipboard.set_text(text); 242 | } 243 | } 244 | 245 | KeyCode::Char('p') => { 246 | if !self.editor.paste() { 247 | if let Some(clipboard) = clipboard { 248 | if let Ok(text) = clipboard.get_text() { 249 | self.editor.insert_str(text); 250 | } 251 | } 252 | } 253 | } 254 | 255 | KeyCode::Char('u') => { 256 | self.editor.undo(); 257 | } 258 | 259 | _ => {} 260 | }, 261 | } 262 | } 263 | 264 | pub fn render(&mut self, frame: &mut Frame, block: Rect, focused_block: &FocusedBlock) { 265 | frame.render_widget( 266 | Block::default() 267 | .borders(Borders::all()) 268 | .border_style({ 269 | if *focused_block == FocusedBlock::Prompt { 270 | match self.mode { 271 | Mode::Insert => Style::default().fg(Color::Green), 272 | Mode::Normal => Style::default(), 273 | Mode::Visual => Style::default().fg(Color::Yellow), 274 | } 275 | } else { 276 | Style::default() 277 | } 278 | }) 279 | .border_type({ 280 | if *focused_block == FocusedBlock::Prompt { 281 | BorderType::Thick 282 | } else { 283 | BorderType::Rounded 284 | } 285 | }), 286 | block, 287 | ); 288 | 289 | frame.render_widget( 290 | &self.editor, 291 | block.inner(Margin { 292 | horizontal: 1, 293 | vertical: 1, 294 | }), 295 | ); 296 | } 297 | } 298 | -------------------------------------------------------------------------------- /src/spinner.rs: -------------------------------------------------------------------------------- 1 | static SPINNER_CHARS: &[char] = &['⣷', '⣯', '⣟', '⡿', '⢿', '⣻', '⣽', '⣾']; 2 | 3 | #[derive(Default, Debug)] 4 | pub struct Spinner { 5 | pub active: bool, 6 | pub index: usize, 7 | } 8 | 9 | impl Spinner { 10 | pub fn draw(&self) -> char { 11 | SPINNER_CHARS[self.index] 12 | } 13 | 14 | pub fn update(&mut self) { 15 | self.index += 1; 16 | self.index %= SPINNER_CHARS.len(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/tui.rs: -------------------------------------------------------------------------------- 1 | use crate::app::{App, AppResult}; 2 | use crate::event::EventHandler; 3 | use crate::ui; 4 | use crossterm::event::{DisableMouseCapture, EnableMouseCapture}; 5 | use crossterm::terminal::{self, EnterAlternateScreen, LeaveAlternateScreen}; 6 | use ratatui::backend::Backend; 7 | use ratatui::Terminal; 8 | use std::io; 9 | use std::panic; 10 | 11 | #[derive(Debug)] 12 | pub struct Tui { 13 | terminal: Terminal, 14 | pub events: EventHandler, 15 | } 16 | 17 | impl Tui { 18 | pub fn new(terminal: Terminal, events: EventHandler) -> Self { 19 | Self { terminal, events } 20 | } 21 | 22 | pub fn init(&mut self) -> AppResult<()> { 23 | terminal::enable_raw_mode()?; 24 | crossterm::execute!(io::stdout(), EnterAlternateScreen, EnableMouseCapture)?; 25 | 26 | let panic_hook = panic::take_hook(); 27 | panic::set_hook(Box::new(move |panic| { 28 | Self::reset().expect("failed to reset the terminal"); 29 | panic_hook(panic); 30 | })); 31 | 32 | self.terminal.hide_cursor()?; 33 | self.terminal.clear()?; 34 | Ok(()) 35 | } 36 | 37 | pub fn draw(&mut self, app: &mut App) -> AppResult<()> { 38 | self.terminal.draw(|frame| ui::render(app, frame))?; 39 | Ok(()) 40 | } 41 | 42 | fn reset() -> AppResult<()> { 43 | terminal::disable_raw_mode()?; 44 | crossterm::execute!(io::stdout(), LeaveAlternateScreen, DisableMouseCapture)?; 45 | Ok(()) 46 | } 47 | 48 | pub fn exit(&mut self) -> AppResult<()> { 49 | Self::reset()?; 50 | self.terminal.show_cursor()?; 51 | Ok(()) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/ui.rs: -------------------------------------------------------------------------------- 1 | use std; 2 | 3 | use crate::app::{App, FocusedBlock}; 4 | use ratatui::{ 5 | layout::{Constraint, Direction, Layout}, 6 | Frame, 7 | }; 8 | 9 | pub type AppResult = std::result::Result>; 10 | 11 | pub fn render(app: &mut App, frame: &mut Frame) { 12 | let frame_size = frame.area(); 13 | 14 | let prompt_block_height = app.prompt.height(&frame_size) + 3; 15 | 16 | let (chat_block, prompt_block) = { 17 | let chunks = Layout::default() 18 | .direction(Direction::Vertical) 19 | .constraints([Constraint::Min(1), Constraint::Length(prompt_block_height)].as_ref()) 20 | .split(frame.area()); 21 | (chunks[0], chunks[1]) 22 | }; 23 | 24 | // Chat 25 | app.chat.render(frame, chat_block); 26 | 27 | // Prompt 28 | app.prompt.render(frame, prompt_block, &app.focused_block); 29 | 30 | // History 31 | if let FocusedBlock::History | FocusedBlock::Preview = app.focused_block { 32 | app.history.render(frame, &app.focused_block); 33 | } 34 | 35 | // Help 36 | if let FocusedBlock::Help = app.focused_block { 37 | app.help.render(frame); 38 | } 39 | 40 | // Notifications 41 | for (index, notification) in app.notifications.iter().enumerate() { 42 | notification.render(index, frame); 43 | } 44 | } 45 | --------------------------------------------------------------------------------