diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e70d777..e26acff 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,8 +20,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Install mold linker run: sudo apt-get update && sudo apt-get install -y mold - - name: Check workspace - run: cargo check --workspace --all-targets --all-features + - name: Check + run: cargo check --all-targets --all-features test: name: Test Suite @@ -34,8 +34,7 @@ jobs: - name: Install mold linker run: sudo apt-get update && sudo apt-get install -y mold - name: Run unit tests - run: cargo nextest run --workspace - # Note: No doctests - clemini is a binary crate without a library target + run: cargo nextest run test-integration: name: Integration Tests @@ -86,7 +85,7 @@ jobs: - name: Install mold linker run: sudo apt-get update && sudo apt-get install -y mold - name: Run clippy - run: cargo clippy --workspace --all-targets --all-features -- -D warnings + run: cargo clippy --all-targets --all-features -- -D warnings doc: name: Documentation @@ -98,7 +97,7 @@ jobs: - name: Install mold linker run: sudo apt-get update && sudo apt-get install -y mold - name: Check documentation - run: cargo doc --workspace --no-deps --document-private-items + run: cargo doc --no-deps --document-private-items env: RUSTDOCFLAGS: -D warnings @@ -111,8 +110,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Install mold linker run: sudo apt-get update && sudo apt-get install -y mold - - name: Check workspace with MSRV - run: cargo check --workspace + - name: Check with MSRV + run: cargo check coverage: name: Code Coverage @@ -127,7 +126,7 @@ jobs: - name: Install mold linker run: sudo apt-get update && sudo apt-get install -y mold - name: Generate coverage - run: cargo llvm-cov --workspace --lcov --output-path lcov.info + run: cargo llvm-cov --lcov --output-path lcov.info - uses: codecov/codecov-action@v4 with: files: lcov.info diff --git a/.gitignore b/.gitignore index d846c6f..d032543 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # Rust /target/ -Cargo.lock # IDE .idea/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f9e60b..03ec65f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed +- Extracted clemitui into standalone repository ([evansenter/clemitui](https://github.com/evansenter/clemitui)), now referenced as a git dependency +- Committed Cargo.lock for reproducible builds +- Removed single-member workspace wrapper + ## [0.4.0] - 2026-01-24 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index 33cb3e9..cea0d7a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -33,19 +33,7 @@ Logs are stored in `~/.clemini/logs/` with daily rotation. The CLI has three modes: single-prompt (`-p "prompt"`), interactive REPL, and MCP server (`--mcp-server`). -### Workspace Structure - -This project is a Cargo workspace with two crates: - -``` -. -├── Cargo.toml # Workspace root -├── src/ # clemini crate (AI agent) -└── crates/ - └── clemitui/ # TUI library crate (reusable by any ACP agent) -``` - -#### clemini (AI Agent) +### Source Structure ``` src/ @@ -69,27 +57,9 @@ src/ └── ... # Individual tool modules (edit, read, grep, etc.) ``` -#### clemitui (TUI Library) - -Standalone crate for terminal UI, usable by any ACP-compatible agent: - -``` -crates/clemitui/ -├── Cargo.toml -├── src/ -│ ├── lib.rs # Re-exports -│ ├── format.rs # Primitive formatting functions (tool output, warnings) -│ ├── logging.rs # OutputSink trait, log_event functions -│ └── text_buffer.rs # TextBuffer for streaming markdown -└── tests/ - ├── common/mod.rs # Shared test helpers (strip_ansi, RAII guards, CaptureSink) - ├── acp_simulation_tests.rs # 29 tests simulating ACP agent patterns - └── e2e_tests.rs # 19 PTY-based tests for actual terminal output -``` - -**Design**: clemitui takes primitive types (strings, durations, token counts), not genai-rs types. This allows it to work with any ACP agent. clemini's format.rs re-exports these and adds genai-rs-specific wrappers. +### clemitui (External TUI Library) -Run clemitui tests: `cargo test -p clemitui` +Terminal UI is provided by [clemitui](https://github.com/evansenter/clemitui), a standalone crate referenced as a git dependency. It takes primitive types (strings, durations, token counts), not genai-rs types, so it can work with any ACP agent. clemini's `format.rs` and `logging.rs` re-export clemitui's API and add genai-rs-specific wrappers. ### Event-Driven Architecture @@ -158,6 +128,9 @@ Debugging: `LOUD_WIRE=1` logs all HTTP requests/responses. - `GEMINI_API_KEY` - Required - Model: `gemini-3-flash-preview` - Config: `~/.clemini/config.toml` (optional) + - `model` - Gemini model to use (default: `gemini-3-flash-preview`) + - `bash_timeout` - Timeout in seconds for bash commands (default: 120) + - `allowed_paths` - Additional paths tools can access beyond cwd (default: none) ## Documentation @@ -169,9 +142,10 @@ Debugging: `LOUD_WIRE=1` logs all HTTP requests/responses. ## Conventions -- Rust 2024 edition (let chains, etc.) +- Rust 2024 edition (let chains, etc.), MSRV 1.88 (enforced in CI) - Tools return JSON: success data or `{"error": "..."}` - Tool errors return as JSON (not propagated) so Gemini can see them and retry +- CI uses `cargo-nextest` for test execution (`make test-all` uses it locally too) ## Development Process @@ -189,6 +163,7 @@ Debugging: `LOUD_WIRE=1` logs all HTTP requests/responses. - `make clippy` (no warnings) - `make fmt` (run formatter, then commit any changes it makes) - `make test` (tests pass) +- Documentation must compile without warnings (CI runs `cargo doc --no-deps --document-private-items` with `-D warnings`) Don't skip tests. If a test is flaky or legitimately broken by your change, fix the test as part of the PR. @@ -216,7 +191,7 @@ Run locally with: `cargo test --test -- --include-ignored --nocapture` These use `validate_response_semantically()` from `tests/common/mod.rs` - a second Gemini call with structured output that judges whether responses are appropriate. This provides a middle ground between brittle string assertions and purely structural checks. **Shared test helpers** - Common patterns for test utilities: -- Put shared helpers in `tests/common/mod.rs` (for clemini) or `crates/clemitui/tests/common/mod.rs` (for clemitui) +- Put shared helpers in `tests/common/mod.rs` - Use `#![allow(dead_code)]` in shared test modules since not all test files use all helpers - RAII guards for cleanup: `DisableColors` (reset color override on drop), `LoggingGuard` (disable logging on drop) - Pattern: `let _guard = DisableColors::new();` at test start ensures cleanup even on panic diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..f31e261 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4120 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "agent-client-protocol" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2659b1089101b15db31137710159421cb44785ecdb5ba784be3b4a6f8cb8a475" +dependencies = [ + "agent-client-protocol-schema", + "anyhow", + "async-broadcast", + "async-trait", + "derive_more", + "futures", + "log", + "serde", + "serde_json", +] + +[[package]] +name = "agent-client-protocol-schema" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bc1fef9c32f03bce2ab44af35b6f483bfd169bf55cc59beeb2e3b1a00ae4d1" +dependencies = [ + "anyhow", + "derive_more", + "schemars", + "serde", + "serde_json", + "strum 0.27.2", +] + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "assert-json-diff" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "bstr" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "bytes" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" + +[[package]] +name = "cc" +version = "1.2.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.5.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" + +[[package]] +name = "clemini" +version = "0.4.0" +dependencies = [ + "agent-client-protocol", + "agent-client-protocol-schema", + "anyhow", + "async-trait", + "chrono", + "clap", + "clemitui", + "colored 2.2.0", + "ctrlc", + "dirs", + "expectrl", + "futures-util", + "genai-rs", + "glob", + "globset", + "grep", + "home", + "hostname", + "html2md", + "ignore", + "mockito", + "rand 0.8.5", + "reedline", + "regex", + "reqwest", + "rusqlite", + "serde", + "serde_json", + "serial_test", + "similar", + "strsim", + "syntect", + "tempfile", + "termimad", + "thiserror 2.0.17", + "tokio", + "tokio-util", + "toml", + "tracing", + "url", + "uuid", +] + +[[package]] +name = "clemitui" +version = "0.1.0" +source = "git+https://github.com/evansenter/clemitui#360cf9e84bed6ab1e57cfd047bef1998a50b07cb" +dependencies = [ + "colored 2.2.0", + "serde_json", + "termimad", +] + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "colored" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" +dependencies = [ + "lazy_static", + "windows-sys 0.59.0", +] + +[[package]] +name = "colored" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "colored_json" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35980a1b846f8e3e359fd18099172a0857140ba9230affc4f71348081e039b6" +dependencies = [ + "serde", + "serde_json", + "yansi", +] + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "conpty" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72b06487a0d4683349ad74d62e87ad639b09667082b3c495c5b6bab7d84b3da" +dependencies = [ + "windows", +] + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "coolor" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "980c2afde4af43d6a05c5be738f9eae595cff86dce1f38f88b95058a98c027f3" +dependencies = [ + "crossterm 0.29.0", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crokey" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51360853ebbeb3df20c76c82aecf43d387a62860f1a59ba65ab51f00eea85aad" +dependencies = [ + "crokey-proc_macros", + "crossterm 0.29.0", + "once_cell", + "serde", + "strict", +] + +[[package]] +name = "crokey-proc_macros" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf1a727caeb5ee5e0a0826a97f205a9cf84ee964b0b48239fef5214a00ae439" +dependencies = [ + "crossterm 0.29.0", + "proc-macro2", + "quote", + "strict", + "syn", +] + +[[package]] +name = "crossbeam" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crossterm" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" +dependencies = [ + "bitflags 2.10.0", + "crossterm_winapi", + "mio", + "parking_lot", + "rustix 0.38.44", + "serde", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" +dependencies = [ + "bitflags 2.10.0", + "crossterm_winapi", + "derive_more", + "document-features", + "mio", + "parking_lot", + "rustix 1.1.3", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "ctrlc" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73736a89c4aff73035ba2ed2e565061954da00d4970fc9ac25dcc85a2a20d790" +dependencies = [ + "dispatch2", + "nix 0.30.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "deranged" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn", + "unicode-xid", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "dispatch2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" +dependencies = [ + "bitflags 2.10.0", + "block2", + "libc", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "encoding_rs_io" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cc3c5651fb62ab8aa3103998dade57efdd028544bd300516baa31840c252a83" +dependencies = [ + "encoding_rs", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "expectrl" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede784925953fcab9a3351d5009bcb8d2b0c13e940924c88087e8e2ce0c4717a" +dependencies = [ + "conpty", + "nix 0.26.4", + "ptyprocess", + "regex", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fancy-regex" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f" +dependencies = [ + "bit-set", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "fd-lock" +version = "4.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" +dependencies = [ + "cfg-if", + "rustix 1.1.3", + "windows-sys 0.59.0", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "genai-rs" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac85934db25ab326be350e3269698c7b21ba688e693785af3f30926bc4a9890f" +dependencies = [ + "async-stream", + "async-trait", + "base64", + "bytes", + "chrono", + "colored 3.1.1", + "colored_json", + "futures-util", + "genai-rs-macros", + "inventory", + "regex", + "reqwest", + "serde", + "serde_json", + "thiserror 2.0.17", + "tokio", + "tokio-util", + "tracing", + "urlencoding", +] + +[[package]] +name = "genai-rs-macros" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2816f9d11bb3ed5b32540de20b8e76597338803ed589ccaa1d9c0e60c919150b" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", + "utoipa", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "globset" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52dfc19153a48bde0cbd630453615c8151bce3a5adfac7a0aebfbf0a1e1f57e3" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "grep" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308ae749734e28d749a86f33212c7b756748568ce332f970ac1d9cd8531f32e6" +dependencies = [ + "grep-cli", + "grep-matcher", + "grep-printer", + "grep-regex", + "grep-searcher", +] + +[[package]] +name = "grep-cli" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf32d263c5d5cc2a23ce587097f5ddafdb188492ba2e6fb638eaccdc22453631" +dependencies = [ + "bstr", + "globset", + "libc", + "log", + "termcolor", + "winapi-util", +] + +[[package]] +name = "grep-matcher" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36d7b71093325ab22d780b40d7df3066ae4aebb518ba719d38c697a8228a8023" +dependencies = [ + "memchr", +] + +[[package]] +name = "grep-printer" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c112110ae4a891aa4d83ab82ecf734b307497d066f437686175e83fbd4e013fe" +dependencies = [ + "bstr", + "grep-matcher", + "grep-searcher", + "log", + "serde", + "serde_json", + "termcolor", +] + +[[package]] +name = "grep-regex" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce0c256c3ad82bcc07b812c15a45ec1d398122e8e15124f96695234db7112ef" +dependencies = [ + "bstr", + "grep-matcher", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "grep-searcher" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac63295322dc48ebb20a25348147905d816318888e64f531bfc2a2bc0577dc34" +dependencies = [ + "bstr", + "encoding_rs", + "encoding_rs_io", + "grep-matcher", + "log", + "memchr", + "memmap2", +] + +[[package]] +name = "h2" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown 0.14.5", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "hostname" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617aaa3557aef3810a6369d0a99fac8a080891b68bd9f9812a1eeda0c0730cbd" +dependencies = [ + "cfg-if", + "libc", + "windows-link", +] + +[[package]] +name = "html2md" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cff9891f2e0d9048927fbdfc28b11bf378f6a93c7ba70b23d0fbee9af6071b4" +dependencies = [ + "html5ever", + "jni", + "lazy_static", + "markup5ever_rcdom", + "percent-encoding", + "regex", +] + +[[package]] +name = "html5ever" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "ignore" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "inventory" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +dependencies = [ + "rustversion", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "js-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy-regex" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5c13b6857ade4c8ee05c3c3dc97d2ab5415d691213825b90d3211c425c1f907" +dependencies = [ + "lazy-regex-proc_macros", + "once_cell", + "regex", +] + +[[package]] +name = "lazy-regex-proc_macros" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a95c68db5d41694cea563c86a4ba4dc02141c16ef64814108cb23def4d5438" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" + +[[package]] +name = "libredox" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +dependencies = [ + "bitflags 2.10.0", + "libc", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "markup5ever" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" +dependencies = [ + "log", + "phf", + "phf_codegen", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "markup5ever_rcdom" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edaa21ab3701bfee5099ade5f7e1f84553fd19228cf332f13cd6e964bf59be18" +dependencies = [ + "html5ever", + "markup5ever", + "tendril", + "xml5ever", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memmap2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimad" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c5d708226d186590a7b6d4a9780e2bdda5f689e0d58cd17012a298efd745d2" +dependencies = [ + "once_cell", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "mockito" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e0603425789b4a70fcc4ac4f5a46a566c116ee3e2a6b768dc623f7719c611de" +dependencies = [ + "assert-json-diff", + "bytes", + "colored 3.1.1", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "log", + "pin-project-lite", + "rand 0.9.2", + "regex", + "serde_json", + "serde_urlencoded", + "similar", + "tokio", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", + "pin-utils", +] + +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-conv" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "objc2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "openssl" +version = "0.10.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand 0.8.5", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "plist" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" +dependencies = [ + "base64", + "indexmap", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro2" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "ptyprocess" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e05aef7befb11a210468a2d77d978dde2c6381a0381e33beb575e91f57fe8cf" +dependencies = [ + "nix 0.26.4", +] + +[[package]] +name = "quick-xml" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c" +dependencies = [ + "memchr", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.17", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.17", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.10.0", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 1.0.69", +] + +[[package]] +name = "reedline" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9834765acaa2deedf29197f2da3d309801683beb20e25775bc0249f97a7b9a74" +dependencies = [ + "chrono", + "crossterm 0.28.1", + "fd-lock", + "itertools", + "nu-ansi-term", + "serde", + "strip-ansi-escapes", + "strum 0.26.3", + "strum_macros 0.26.4", + "thiserror 1.0.69", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regex" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rusqlite" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" +dependencies = [ + "bitflags 2.10.0", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", +] + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scc" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46e6f046b7fef48e2660c57ed794263155d713de679057f2d0c169bfc6e756cc" +dependencies = [ + "sdd", +] + +[[package]] +name = "schannel" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" +dependencies = [ + "dyn-clone", + "ref-cast", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sdd" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490dcfcbfef26be6800d11870ff2df8774fa6e86d047e3e8c8a76b25655e41ca" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.10.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serial_test" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d0b343e184fc3b7bb44dff0705fffcf4b3756ba6aff420dddd8b24ca145e555" +dependencies = [ + "futures-executor", + "futures-util", + "log", + "once_cell", + "parking_lot", + "scc", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f50427f258fb77356e4cd4aa0e87e2bd2c66dbcee41dc405282cae2bfc26c83" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + +[[package]] +name = "similar" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strict" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f42444fea5b87a39db4218d9422087e66a85d0e7a0963a439b07bcdf91804006" + +[[package]] +name = "string_cache" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", +] + +[[package]] +name = "strip-ansi-escapes" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a8f8038e7e7969abb3f1b7c2a811225e9296da208539e0f79c5251d6cac0025" +dependencies = [ + "vte", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros 0.27.2", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "syntect" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "656b45c05d95a5704399aeef6bd0ddec7b2b3531b7c9e900abbf7c4d2190c925" +dependencies = [ + "bincode", + "fancy-regex", + "flate2", + "fnv", + "once_cell", + "plist", + "regex-syntax", + "serde", + "serde_derive", + "serde_json", + "thiserror 2.0.17", + "walkdir", + "yaml-rust", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.10.0", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix 1.1.3", + "windows-sys 0.61.2", +] + +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "termimad" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22117210909e9dfff30a558f554c7fb3edb198ef614e7691386785fb7679677c" +dependencies = [ + "coolor", + "crokey", + "crossbeam", + "lazy-regex", + "minimad", + "serde", + "thiserror 1.0.69", + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags 2.10.0", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "utoipa" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fcc29c80c21c31608227e0912b2d7fddba57ad76b606890627ba8ee7964e993" +dependencies = [ + "indexmap", + "serde", + "serde_json", + "utoipa-gen", +] + +[[package]] +name = "utoipa-gen" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d79d08d92ab8af4c5e8a6da20c47ae3f61a0f1dabc1997cdf2d082b757ca08b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "uuid" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" +dependencies = [ + "getrandom 0.3.4", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vte" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077" +dependencies = [ + "memchr", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" +dependencies = [ + "cfg-if", + "futures-util", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "xml5ever" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bbb26405d8e919bc1547a5aa9abc95cbfa438f04844f5fdd9dc7596b748bf69" +dependencies = [ + "log", + "mac", + "markup5ever", +] + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd8f3f50b848df28f887acb68e41201b5aea6bc8a8dacc00fb40635ff9a72fea" diff --git a/Cargo.toml b/Cargo.toml index 3209f5a..e36e058 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,3 @@ -[workspace] -members = [".", "crates/clemitui"] -resolver = "3" - [package] name = "clemini" version = "0.4.0" @@ -11,8 +7,8 @@ description = "A Gemini-powered coding CLI, built with genai-rs" license = "MIT" [dependencies] -# Internal crates -clemitui = { path = "crates/clemitui" } +# TUI library (standalone crate) +clemitui = { git = "https://github.com/evansenter/clemitui" } # AI genai-rs = "0.7.2" diff --git a/crates/clemitui/Cargo.toml b/crates/clemitui/Cargo.toml deleted file mode 100644 index ecdaa90..0000000 --- a/crates/clemitui/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "clemitui" -version = "0.1.0" -edition = "2024" -rust-version = "1.88" -description = "Terminal UI for ACP-compatible AI agents" -license = "MIT" -repository = "https://github.com/evansenter/clemini" -keywords = ["cli", "tui", "ai", "llm", "acp"] -categories = ["command-line-interface", "text-processing"] - -[dependencies] -# Terminal formatting -colored = "2" -termimad = "0.30" - -# Serialization (for tool args formatting) -serde_json = "1" - -[dev-dependencies] -tempfile = "3.10" -expectrl = "0.7" - -[[bin]] -name = "clemitui-demo" -path = "src/bin/demo.rs" diff --git a/crates/clemitui/src/bin/demo.rs b/crates/clemitui/src/bin/demo.rs deleted file mode 100644 index a7f92e1..0000000 --- a/crates/clemitui/src/bin/demo.rs +++ /dev/null @@ -1,194 +0,0 @@ -//! Demo binary for clemitui E2E testing. -//! -//! This binary exercises clemitui's public API for PTY-based integration tests. -//! Each subcommand demonstrates a specific feature. - -use clemitui::{ - OutputSink, TextBuffer, format_cancelled, format_context_warning, format_ctrl_c, - format_error_detail, format_error_message, format_retry, format_tool_args, - format_tool_executing, format_tool_result, log_event, log_event_line, set_output_sink, -}; -use serde_json::json; -use std::env; -use std::sync::Arc; -use std::time::Duration; - -/// Simple stdout sink for demo purposes. -struct StdoutSink; - -impl OutputSink for StdoutSink { - fn emit(&self, message: &str) { - print!("{}", message); - } - - fn emit_line(&self, message: &str) { - println!("{}", message); - } -} - -fn main() { - // Force color output even in non-TTY (for test capture) - colored::control::set_override(true); - - let args: Vec = env::args().collect(); - if args.len() < 2 { - eprintln!("Usage: clemitui-demo [args...]"); - eprintln!("Commands:"); - eprintln!(" tool-executing [args_json]"); - eprintln!(" tool-result [error]"); - eprintln!(" text-buffer "); - eprintln!(" context-warning "); - eprintln!(" error-detail "); - eprintln!(" error-message "); - eprintln!(" retry "); - eprintln!(" ctrl-c"); - eprintln!(" cancelled"); - eprintln!(" logging"); - std::process::exit(1); - } - - match args[1].as_str() { - "tool-executing" => { - let name = args.get(2).map(|s| s.as_str()).unwrap_or("test_tool"); - let args_json = args.get(3).map(|s| s.as_str()).unwrap_or("{}"); - let args_value: serde_json::Value = - serde_json::from_str(args_json).unwrap_or(json!({})); - let output = format_tool_executing(name, &args_value); - print!("{}", output); // output already has newline - } - - "tool-result" => { - let name = args.get(2).map(|s| s.as_str()).unwrap_or("test_tool"); - let duration_ms: u64 = args.get(3).and_then(|s| s.parse().ok()).unwrap_or(100); - let tokens: u32 = args.get(4).and_then(|s| s.parse().ok()).unwrap_or(50); - let has_error = args.get(5).is_some(); - let duration = Duration::from_millis(duration_ms); - let output = format_tool_result(name, duration, tokens, has_error); - println!("{}", output); - } - - "text-buffer" => { - let markdown = args - .get(2) - .map(|s| s.as_str()) - .unwrap_or("**Hello** world!"); - let mut buffer = TextBuffer::new(); - buffer.push(markdown); - if let Some(rendered) = buffer.flush() { - println!("{}", rendered); - } - } - - "context-warning" => { - let used: u64 = args.get(2).and_then(|s| s.parse().ok()).unwrap_or(900000); - let limit: u64 = args.get(3).and_then(|s| s.parse().ok()).unwrap_or(1000000); - let percentage = (used as f64 / limit as f64) * 100.0; - let output = format_context_warning(percentage); - println!("{}", output); - } - - "error-detail" => { - let message = args - .get(2) - .map(|s| s.as_str()) - .unwrap_or("Something went wrong"); - let output = format_error_detail(message); - println!("{}", output); - } - - "error-message" => { - let message = args.get(2).map(|s| s.as_str()).unwrap_or("Error occurred"); - let output = format_error_message(message); - println!("{}", output); - } - - "retry" => { - let attempt: u32 = args.get(2).and_then(|s| s.parse().ok()).unwrap_or(1); - let max: u32 = args.get(3).and_then(|s| s.parse().ok()).unwrap_or(3); - let reason = args.get(4).map(|s| s.as_str()).unwrap_or("rate limit"); - let output = format_retry(attempt, max, Duration::from_secs(2), reason); - println!("{}", output); - } - - "ctrl-c" => { - let output = format_ctrl_c(); - println!("{}", output); - } - - "cancelled" => { - let output = format_cancelled(); - println!("{}", output); - } - - "logging" => { - // Test the logging infrastructure - set_output_sink(Arc::new(StdoutSink)); - log_event("This is a log event"); - log_event_line("This is a log line"); - log_event("Another event"); - } - - "tool-args-complex" => { - // Test complex tool args formatting - let args_json = json!({ - "command": "echo hello", - "timeout": 30, - "background": false, - "very_long_value": "This is a very long string that should be truncated when it exceeds the maximum length allowed for display" - }); - let formatted = format_tool_args("bash", &args_json); - println!("{}", formatted); - } - - "tool-args-edit" => { - // Test edit tool args filtering (should hide old_string/new_string) - let args_json = json!({ - "file_path": "/path/to/file.rs", - "old_string": "original content here", - "new_string": "replacement content here" - }); - let formatted = format_tool_args("edit", &args_json); - println!("{}", formatted); - } - - "text-buffer-multiline" => { - // Test multiline markdown rendering - let markdown = r#"# Header - -This is a paragraph with **bold** and *italic* text. - -- Item 1 -- Item 2 -- Item 3 - -```rust -fn main() { - println!("Hello!"); -} -``` -"#; - let mut buffer = TextBuffer::new(); - buffer.push(markdown); - if let Some(rendered) = buffer.flush() { - println!("{}", rendered); - } - } - - "text-buffer-streaming" => { - // Simulate streaming text accumulation - let mut buffer = TextBuffer::new(); - buffer.push("Hello "); - buffer.push("**world**"); - buffer.push("! This is "); - buffer.push("streaming text."); - if let Some(rendered) = buffer.flush() { - println!("{}", rendered); - } - } - - _ => { - eprintln!("Unknown command: {}", args[1]); - std::process::exit(1); - } - } -} diff --git a/crates/clemitui/src/format.rs b/crates/clemitui/src/format.rs deleted file mode 100644 index 740cf1a..0000000 --- a/crates/clemitui/src/format.rs +++ /dev/null @@ -1,529 +0,0 @@ -//! Pure formatting functions for UI output. -//! -//! All colored/styled output uses `format_*` helper functions defined here. -//! This keeps formatting testable, centralized, and out of business logic. -//! -//! # Categories -//! -//! ## Tool Output Formatters -//! - [`format_tool_executing`] - Tool start line (`┌─ name args`) -//! - [`format_tool_result`] - Tool completion line (`└─ name duration ~tokens tok`) -//! - [`format_tool_args`] - Format tool arguments as key=value pairs -//! - [`format_error_detail`] - Error detail line (indented) -//! -//! ## Other Formatters -//! - [`format_context_warning`] - Context window warnings -//! - [`format_retry`] - API retry messages - -use std::time::Duration; - -use colored::Colorize; -use serde_json::Value; - -// ============================================================================ -// Constants -// ============================================================================ - -/// Maximum argument display length before truncation. -const MAX_ARG_DISPLAY_LEN: usize = 80; - -// ============================================================================ -// Tool Argument Formatting -// ============================================================================ - -/// Format function call arguments for display. -/// -/// Converts a JSON object of arguments into a space-separated `key=value` string. -/// Long strings are truncated, and certain tool-specific keys are filtered out -/// (e.g., `old_string`/`new_string` for edit tool). -/// -/// # Example -/// -/// ``` -/// use clemitui::format_tool_args; -/// use serde_json::json; -/// -/// let args = json!({"file_path": "test.rs", "line": 42}); -/// let formatted = format_tool_args("read", &args); -/// assert!(formatted.contains("file_path=")); -/// ``` -pub fn format_tool_args(tool_name: &str, args: &Value) -> String { - let Some(obj) = args.as_object() else { - return String::new(); - }; - - let mut parts = Vec::new(); - for (k, v) in obj { - // Skip large strings for the edit tool as they are shown in the diff - if tool_name == "edit" && (k == "old_string" || k == "new_string") { - continue; - } - // Skip todos for todo_write as they are rendered below - if tool_name == "todo_write" && k == "todos" { - continue; - } - // Skip question/options for ask_user as they are rendered below - if tool_name == "ask_user" && (k == "question" || k == "options") { - continue; - } - - let val_str = match v { - Value::String(s) => { - let trimmed = s.replace('\n', " "); - if trimmed.len() > MAX_ARG_DISPLAY_LEN { - format!("\"{}...\"", &trimmed[..MAX_ARG_DISPLAY_LEN - 3]) - } else { - format!("\"{trimmed}\"") - } - } - Value::Number(n) => n.to_string(), - Value::Bool(b) => b.to_string(), - Value::Null => "null".to_string(), - _ => "...".to_string(), - }; - parts.push(format!("{k}={val_str}")); - } - - if parts.is_empty() { - String::new() - } else { - format!("{} ", parts.join(" ")) - } -} - -// ============================================================================ -// Tool Execution Formatting -// ============================================================================ - -/// Format tool executing line for display. -/// -/// Produces a line like `┌─ tool_name arg1=val1 arg2=val2`. -/// Includes trailing newline for use with `emit_line`. -/// -/// # Example -/// -/// ``` -/// use clemitui::format_tool_executing; -/// use serde_json::json; -/// -/// let line = format_tool_executing("read_file", &json!({"path": "test.rs"})); -/// assert!(line.contains("┌─")); -/// assert!(line.contains("read_file")); -/// ``` -pub fn format_tool_executing(name: &str, args: &Value) -> String { - let args_str = format_tool_args(name, args); - format!("┌─ {} {}\n", name.cyan(), args_str) -} - -/// Format tool result for display. -/// -/// Produces a line like `└─ tool_name 0.25s ~100 tok` or with ` ERROR` suffix. -/// -/// # Arguments -/// -/// * `name` - Tool name -/// * `duration` - How long the tool took to execute -/// * `estimated_tokens` - Approximate token count for the result -/// * `has_error` - Whether the tool result contains an error -/// -/// # Example -/// -/// ``` -/// use clemitui::format_tool_result; -/// use std::time::Duration; -/// -/// let line = format_tool_result("bash", Duration::from_millis(250), 100, false); -/// assert!(line.contains("└─")); -/// assert!(line.contains("bash")); -/// assert!(line.contains("0.25s")); -/// ``` -pub fn format_tool_result( - name: &str, - duration: Duration, - estimated_tokens: u32, - has_error: bool, -) -> String { - let error_suffix = if has_error { - " ERROR".bright_red().bold().to_string() - } else { - String::new() - }; - let elapsed_secs = duration.as_secs_f32(); - - let duration_str = if elapsed_secs < 0.001 { - format!("{:.3}s", elapsed_secs) - } else { - format!("{:.2}s", elapsed_secs) - }; - - format!( - "└─ {} {} ~{} tok{}", - name.cyan(), - duration_str.yellow(), - estimated_tokens, - error_suffix - ) -} - -/// Format error detail line for display (shown below tool result on error). -/// -/// Produces an indented line like ` └─ error: message`. -pub fn format_error_detail(error_message: &str) -> String { - format!(" └─ error: {}", error_message.dimmed()) -} - -// ============================================================================ -// Other Formatters -// ============================================================================ - -/// Format context warning message. -/// -/// Shows a warning when context window usage is high. At >95%, suggests using -/// `/clear` to reset. -pub fn format_context_warning(percentage: f64) -> String { - if percentage > 95.0 { - format!( - "WARNING: Context window at {:.1}%. Use /clear to reset.", - percentage - ) - } else { - format!("WARNING: Context window at {:.1}%.", percentage) - } -} - -/// Format API retry message. -/// -/// Shows retry information including attempt count and delay. -pub fn format_retry(attempt: u32, max_attempts: u32, delay: Duration, error: &str) -> String { - format!( - "[{}: retrying in {}s (attempt {}/{})]", - error.bright_yellow(), - delay.as_secs(), - attempt, - max_attempts - ) -} - -/// Format an error message (red). -pub fn format_error_message(msg: &str) -> String { - format!("{}", msg.red()) -} - -/// Format ctrl-c received message. -pub fn format_ctrl_c() -> &'static str { - "[ctrl-c received]" -} - -/// Format task cancelled/aborted message. -pub fn format_cancelled() -> String { - format!("{} task cancelled by client", "ABORTED".red()) -} - -// ============================================================================ -// Token Estimation -// ============================================================================ - -/// Approximate characters per token for estimation. -const CHARS_PER_TOKEN: usize = 4; - -/// Rough token estimate based on JSON string length. -/// -/// Uses a simple heuristic of ~4 characters per token. -pub fn estimate_tokens(value: &Value) -> u32 { - (value.to_string().len() / CHARS_PER_TOKEN) as u32 -} - -// ============================================================================ -// Tests -// ============================================================================ - -#[cfg(test)] -mod tests { - use super::*; - - // ========================================= - // Tool args formatting tests - // ========================================= - - #[test] - fn test_format_tool_args_empty() { - assert_eq!(format_tool_args("test", &serde_json::json!({})), ""); - assert_eq!(format_tool_args("test", &serde_json::json!(null)), ""); - assert_eq!( - format_tool_args("test", &serde_json::json!("not an object")), - "" - ); - } - - #[test] - fn test_format_tool_args_types() { - let args = serde_json::json!({ - "bool": true, - "num": 42, - "null": null, - "str": "hello" - }); - let formatted = format_tool_args("test", &args); - // serde_json::Map is sorted by key - assert_eq!(formatted, "bool=true null=null num=42 str=\"hello\" "); - } - - #[test] - fn test_format_tool_args_complex_types() { - let args = serde_json::json!({ - "arr": [1, 2], - "obj": {"a": 1} - }); - let formatted = format_tool_args("test", &args); - assert_eq!(formatted, "arr=... obj=... "); - } - - #[test] - fn test_format_tool_args_truncation() { - let long_str = "a".repeat(100); - let args = serde_json::json!({"long": long_str}); - let formatted = format_tool_args("test", &args); - let expected_val = format!("\"{}...\"", "a".repeat(77)); - assert_eq!(formatted, format!("long={} ", expected_val)); - } - - #[test] - fn test_format_tool_args_truncation_boundary() { - // MAX_ARG_DISPLAY_LEN is 80 - // Test exactly at boundaries: 79, 80, 81 chars - - // 79 chars - should NOT be truncated - let str_79 = "a".repeat(79); - let args = serde_json::json!({"s": str_79}); - let formatted = format_tool_args("test", &args); - assert!( - !formatted.contains("..."), - "79-char string should not be truncated" - ); - assert_eq!(formatted, format!("s=\"{}\" ", "a".repeat(79))); - - // 80 chars - should NOT be truncated (equal to max) - let str_80 = "a".repeat(80); - let args = serde_json::json!({"s": str_80}); - let formatted = format_tool_args("test", &args); - assert!( - !formatted.contains("..."), - "80-char string should not be truncated" - ); - assert_eq!(formatted, format!("s=\"{}\" ", "a".repeat(80))); - - // 81 chars - should be truncated - let str_81 = "a".repeat(81); - let args = serde_json::json!({"s": str_81}); - let formatted = format_tool_args("test", &args); - assert!( - formatted.contains("..."), - "81-char string should be truncated" - ); - // Truncated to 77 chars + "..." - assert_eq!(formatted, format!("s=\"{}...\" ", "a".repeat(77))); - } - - #[test] - fn test_format_tool_args_newlines() { - let args = serde_json::json!({"text": "hello\nworld"}); - let formatted = format_tool_args("test", &args); - assert_eq!(formatted, "text=\"hello world\" "); - } - - #[test] - fn test_format_tool_args_edit_filtering() { - let args = serde_json::json!({ - "file_path": "test.rs", - "old_string": "old content", - "new_string": "new content" - }); - let formatted = format_tool_args("edit", &args); - assert_eq!(formatted, "file_path=\"test.rs\" "); - } - - #[test] - fn test_format_tool_args_todo_write_filtering() { - let args = serde_json::json!({ - "todos": [ - {"content": "Task 1", "status": "pending"}, - {"content": "Task 2", "status": "completed"} - ] - }); - let formatted = format_tool_args("todo_write", &args); - assert_eq!(formatted, ""); - } - - #[test] - fn test_format_tool_args_ask_user_filtering() { - let args = serde_json::json!({ - "question": "What is your favorite color?", - "options": ["red", "blue", "green"] - }); - let formatted = format_tool_args("ask_user", &args); - assert_eq!(formatted, ""); - } - - // ========================================= - // Tool executing format tests - // ========================================= - - #[test] - fn test_format_tool_executing_basic() { - colored::control::set_override(false); - let args = serde_json::json!({"file_path": "test.rs"}); - let formatted = format_tool_executing("read_file", &args); - assert!(formatted.contains("┌─")); - assert!(formatted.contains("read_file")); - assert!(formatted.contains("file_path=\"test.rs\"")); - assert!(formatted.ends_with('\n'), "must end with newline"); - colored::control::unset_override(); - } - - #[test] - fn test_format_tool_executing_empty_args() { - colored::control::set_override(false); - let formatted = format_tool_executing("list_files", &serde_json::json!({})); - assert!(formatted.contains("┌─")); - assert!(formatted.contains("list_files")); - assert!(formatted.ends_with('\n'), "must end with newline"); - colored::control::unset_override(); - } - - // ========================================= - // Tool result format tests - // ========================================= - - #[test] - fn test_estimate_tokens() { - assert_eq!(estimate_tokens(&serde_json::json!("hello")), 1); - assert_eq!(estimate_tokens(&serde_json::json!({"key": "value"})), 3); - } - - #[test] - fn test_estimate_tokens_edge_cases() { - // Empty/minimal values - assert_eq!(estimate_tokens(&serde_json::json!(null)), 1); // "null" = 4 chars - assert_eq!(estimate_tokens(&serde_json::json!("")), 0); // "\"\"" = 2 chars / 4 = 0 - assert_eq!(estimate_tokens(&serde_json::json!([])), 0); // "[]" = 2 chars / 4 = 0 - assert_eq!(estimate_tokens(&serde_json::json!({})), 0); // "{}" = 2 chars / 4 = 0 - - // Large string (4000 chars = ~1000 tokens) - let large_str = "a".repeat(4000); - let tokens = estimate_tokens(&serde_json::json!(large_str)); - // "\"" + 4000 + "\"" = 4002 chars / 4 = 1000 - assert_eq!(tokens, 1000); - - // Deeply nested object - let nested = serde_json::json!({ - "a": {"b": {"c": {"d": "value"}}} - }); - let tokens = estimate_tokens(&nested); - assert!(tokens > 0, "Nested objects should have non-zero tokens"); - } - - #[test] - fn test_format_tool_result_duration() { - colored::control::set_override(false); - - // < 1ms -> 3 decimals - assert_eq!( - format_tool_result("test", Duration::from_micros(100), 10, false), - "└─ test 0.000s ~10 tok" - ); - - // >= 1ms -> 2 decimals - assert_eq!( - format_tool_result("test", Duration::from_millis(20), 10, false), - "└─ test 0.02s ~10 tok" - ); - - assert_eq!( - format_tool_result("test", Duration::from_millis(1450), 10, false), - "└─ test 1.45s ~10 tok" - ); - - colored::control::unset_override(); - } - - #[test] - fn test_format_tool_result_error() { - colored::control::set_override(false); - - let res = format_tool_result("test", Duration::from_millis(10), 25, true); - assert_eq!(res, "└─ test 0.01s ~25 tok ERROR"); - - let res = format_tool_result("test", Duration::from_millis(10), 25, false); - assert_eq!(res, "└─ test 0.01s ~25 tok"); - - colored::control::unset_override(); - } - - #[test] - fn test_format_error_detail() { - colored::control::set_override(false); - let detail = format_error_detail("permission denied"); - assert_eq!(detail, " └─ error: permission denied"); - colored::control::unset_override(); - } - - // ========================================= - // Context warning format tests - // ========================================= - - #[test] - fn test_format_context_warning_normal() { - let msg = format_context_warning(85.0); - assert!(msg.contains("85.0%")); - assert!(!msg.contains("/clear")); - } - - #[test] - fn test_format_context_warning_critical() { - let msg = format_context_warning(96.0); - assert!(msg.contains("96.0%")); - assert!(msg.contains("/clear")); - } - - // ========================================= - // Retry format tests - // ========================================= - - #[test] - fn test_format_retry() { - colored::control::set_override(false); - - let msg = format_retry(1, 3, Duration::from_secs(2), "rate limit exceeded"); - assert!(msg.contains("rate limit exceeded")); - assert!(msg.contains("2s")); - assert!(msg.contains("1/3")); - - colored::control::unset_override(); - } - - // ========================================= - // Simple message format tests - // ========================================= - - #[test] - fn test_format_ctrl_c() { - assert_eq!(format_ctrl_c(), "[ctrl-c received]"); - } - - #[test] - fn test_format_cancelled() { - colored::control::set_override(false); - let msg = format_cancelled(); - assert!(msg.contains("ABORTED")); - assert!(msg.contains("task cancelled by client")); - colored::control::unset_override(); - } - - #[test] - fn test_format_error_message() { - colored::control::set_override(false); - let msg = format_error_message("something went wrong"); - assert_eq!(msg, "something went wrong"); - colored::control::unset_override(); - } -} diff --git a/crates/clemitui/src/lib.rs b/crates/clemitui/src/lib.rs deleted file mode 100644 index dd76d46..0000000 --- a/crates/clemitui/src/lib.rs +++ /dev/null @@ -1,35 +0,0 @@ -//! Terminal UI utilities for ACP-compatible AI agents. -//! -//! clemitui provides formatting and logging utilities for AI coding assistants -//! that speak the Agent Client Protocol (ACP). It handles: -//! -//! - Streaming text rendering with markdown support -//! - Tool execution display (start/result formatting) -//! - Session logging infrastructure -//! -//! This crate is intentionally minimal, providing only primitive formatting -//! functions that take simple types (strings, durations, token counts). This -//! allows it to be used by any ACP-compatible agent without model-specific -//! dependencies. -//! -//! # Modules -//! -//! - [`mod@format`] - Pure formatting functions for tool output, warnings, etc. -//! - [`logging`] - OutputSink trait and global logging infrastructure -//! - [`text_buffer`] - Streaming text accumulation with markdown rendering - -pub mod format; -pub mod logging; -pub mod text_buffer; - -// Re-export commonly used types -pub use format::{ - estimate_tokens, format_cancelled, format_context_warning, format_ctrl_c, format_error_detail, - format_error_message, format_retry, format_tool_args, format_tool_executing, - format_tool_result, -}; -pub use logging::{ - OutputSink, disable_logging, enable_logging, is_logging_enabled, log_event, log_event_line, - set_output_sink, -}; -pub use text_buffer::TextBuffer; diff --git a/crates/clemitui/src/logging.rs b/crates/clemitui/src/logging.rs deleted file mode 100644 index 0db1e83..0000000 --- a/crates/clemitui/src/logging.rs +++ /dev/null @@ -1,239 +0,0 @@ -//! Logging infrastructure for clemitui. -//! -//! This module provides the core logging interfaces used throughout the crate. -//! Concrete sink implementations (FileSink, TerminalSink) are provided by the -//! application using clemitui since they have environment-specific dependencies. -//! -//! # Usage -//! -//! ```no_run -//! use clemitui::{OutputSink, set_output_sink, log_event}; -//! use std::sync::Arc; -//! -//! struct StdoutSink; -//! -//! impl OutputSink for StdoutSink { -//! fn emit(&self, message: &str) { -//! // Print message with trailing blank line for visual separation -//! println!("{}\n", message); -//! } -//! fn emit_line(&self, message: &str) { -//! // Print message without extra spacing (for continuous output) -//! println!("{}", message); -//! } -//! } -//! -//! // Set up the sink at application startup -//! set_output_sink(Arc::new(StdoutSink)); -//! -//! // Now logging works throughout the application -//! log_event("Tool completed successfully"); -//! ``` - -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::{Arc, RwLock}; - -/// Flag to disable logging (opt-out). Defaults to false (logging enabled). -/// Tests can set this to true to prevent log file writes. -static LOGGING_DISABLED: AtomicBool = AtomicBool::new(false); - -/// Disable logging to files. Call this in tests to prevent log writes. -pub fn disable_logging() { - LOGGING_DISABLED.store(true, Ordering::SeqCst); -} - -/// Re-enable logging after it was disabled. Primarily for test cleanup. -pub fn enable_logging() { - LOGGING_DISABLED.store(false, Ordering::SeqCst); -} - -/// Check if logging is enabled. Returns true unless explicitly disabled via `disable_logging()`. -pub fn is_logging_enabled() -> bool { - !LOGGING_DISABLED.load(Ordering::SeqCst) -} - -/// Trait for output sinks that handle logging and display. -/// -/// Implement this trait to control where log messages go (stdout, file, etc.). -/// -/// # Methods -/// -/// * `emit` - For complete blocks that should have visual separation (trailing blank line) -/// * `emit_line` - For continuous output without separation (e.g., multi-line tool output) -pub trait OutputSink: Send + Sync { - /// Emit a complete block with trailing blank line for visual separation. - fn emit(&self, message: &str); - /// Emit a line without trailing blank line (for multi-line tool output). - fn emit_line(&self, message: &str); -} - -static OUTPUT_SINK: RwLock>> = RwLock::new(None); - -/// Set the global output sink. Called once at startup by main.rs. -/// Can be called multiple times (e.g., in tests) - replaces the previous sink. -pub fn set_output_sink(sink: Arc) { - if let Ok(mut guard) = OUTPUT_SINK.write() { - *guard = Some(sink); - } -} - -/// Get the current output sink (for advanced use cases). -pub fn get_output_sink() -> Option> { - OUTPUT_SINK.read().ok().and_then(|guard| guard.clone()) -} - -/// Log a complete block with trailing blank line for visual separation. -pub fn log_event(message: &str) { - if !is_logging_enabled() { - return; - } - if let Some(sink) = get_output_sink() { - sink.emit(message); - } - // No fallback - OUTPUT_SINK is always set in production before logging. - // Skipping prevents test pollution of shared log files. -} - -/// Log a line without trailing blank line (for multi-line tool output). -pub fn log_event_line(message: &str) { - if !is_logging_enabled() { - return; - } - if let Some(sink) = get_output_sink() { - sink.emit_line(message); - } -} - -/// Reset the output sink (for testing). Clears the current sink. -pub fn reset_output_sink() { - if let Ok(mut guard) = OUTPUT_SINK.write() { - *guard = None; - } -} - -#[cfg(test)] -mod tests { - use super::*; - use std::sync::Mutex; - - #[test] - fn test_disable_logging() { - // Once disabled, logging stays disabled for the test process - disable_logging(); - assert!(!is_logging_enabled()); - } - - /// Mock OutputSink that captures emitted messages for testing. - struct MockSink { - emits: Mutex>, - lines: Mutex>, - } - - impl MockSink { - fn new() -> Self { - Self { - emits: Mutex::new(Vec::new()), - lines: Mutex::new(Vec::new()), - } - } - - fn emits(&self) -> Vec { - self.emits.lock().unwrap().clone() - } - - fn lines(&self) -> Vec { - self.lines.lock().unwrap().clone() - } - } - - impl OutputSink for MockSink { - fn emit(&self, message: &str) { - self.emits.lock().unwrap().push(message.to_string()); - } - - fn emit_line(&self, message: &str) { - self.lines.lock().unwrap().push(message.to_string()); - } - } - - #[test] - fn test_output_sink_set_get_reset() { - // Reset to clean state first - reset_output_sink(); - assert!(get_output_sink().is_none()); - - // Set a sink - let sink = Arc::new(MockSink::new()); - set_output_sink(sink.clone()); - assert!(get_output_sink().is_some()); - - // Reset clears the sink - reset_output_sink(); - assert!(get_output_sink().is_none()); - } - - #[test] - fn test_output_sink_replacement() { - enable_logging(); // Ensure logging is enabled (may have been disabled by other tests) - reset_output_sink(); - - // Set first sink and emit - let sink1 = Arc::new(MockSink::new()); - set_output_sink(sink1.clone()); - log_event("message1"); - assert_eq!(sink1.emits(), vec!["message1"]); - - // Replace with second sink - let sink2 = Arc::new(MockSink::new()); - set_output_sink(sink2.clone()); - log_event("message2"); - - // First sink didn't get second message - assert_eq!(sink1.emits(), vec!["message1"]); - // Second sink got its message - assert_eq!(sink2.emits(), vec!["message2"]); - - reset_output_sink(); - } - - #[test] - fn test_log_event_routes_to_emit() { - enable_logging(); // Ensure logging is enabled (may have been disabled by other tests) - reset_output_sink(); - - let sink = Arc::new(MockSink::new()); - set_output_sink(sink.clone()); - - log_event("block message"); - assert_eq!(sink.emits(), vec!["block message"]); - assert!(sink.lines().is_empty()); - - reset_output_sink(); - } - - #[test] - fn test_log_event_line_routes_to_emit_line() { - enable_logging(); // Ensure logging is enabled (may have been disabled by other tests) - reset_output_sink(); - - let sink = Arc::new(MockSink::new()); - set_output_sink(sink.clone()); - - log_event_line("line message"); - assert!(sink.emits().is_empty()); - assert_eq!(sink.lines(), vec!["line message"]); - - reset_output_sink(); - } - - #[test] - fn test_log_event_noop_when_no_sink() { - reset_output_sink(); - - // Should not panic when no sink is set - log_event("message"); - log_event_line("line"); - - // Just verify no panic occurred - } -} diff --git a/crates/clemitui/src/text_buffer.rs b/crates/clemitui/src/text_buffer.rs deleted file mode 100644 index 4b8f1fc..0000000 --- a/crates/clemitui/src/text_buffer.rs +++ /dev/null @@ -1,212 +0,0 @@ -//! Text buffer for accumulating streaming text with markdown rendering. -//! -//! The [`TextBuffer`] collects text chunks from streaming responses and -//! renders them with markdown formatting when flushed. - -use std::sync::LazyLock; -use termimad::MadSkin; - -// ============================================================================ -// Markdown Rendering -// ============================================================================ - -/// Termimad skin for markdown rendering. Left-aligns headers. -pub(crate) static SKIN: LazyLock = LazyLock::new(|| { - let mut skin = MadSkin::default(); - for h in &mut skin.headers { - h.align = termimad::Alignment::Left; - } - skin -}); - -/// Render text with markdown formatting but without line wrapping. -/// Uses a very large width to effectively disable termimad's wrapping. -pub(crate) fn render_markdown_nowrap(text: &str) -> String { - use termimad::FmtText; - FmtText::from(&SKIN, text, Some(10000)).to_string() -} - -// ============================================================================ -// Text Buffer -// ============================================================================ - -/// Buffer for accumulating streaming text until event boundaries. -/// -/// Text is buffered via `push()` during streaming, then flushed with markdown -/// rendering at logical boundaries (e.g., before tool execution, on completion). -/// The `flush()` method normalizes trailing newlines to exactly `\n\n`. -/// -/// # Example -/// -/// ``` -/// use clemitui::TextBuffer; -/// -/// let mut buffer = TextBuffer::new(); -/// buffer.push("Hello "); -/// buffer.push("world!"); -/// -/// let rendered = buffer.flush(); -/// assert!(rendered.is_some()); -/// assert!(rendered.unwrap().contains("Hello world!")); -/// -/// // Buffer is now empty -/// assert!(buffer.is_empty()); -/// ``` -#[derive(Debug, Default)] -pub struct TextBuffer(String); - -impl TextBuffer { - /// Create a new empty text buffer. - pub fn new() -> Self { - Self(String::new()) - } - - /// Append text to the buffer. - pub fn push(&mut self, text: &str) { - self.0.push_str(text); - } - - /// Flush buffered text with markdown rendering, normalized to `\n\n`. - /// Returns rendered text, or None if buffer was empty or whitespace-only. - pub fn flush(&mut self) -> Option { - if self.0.is_empty() { - return None; - } - - let text = std::mem::take(&mut self.0); - let rendered = render_markdown_nowrap(&text); - - // Normalize trailing newlines to exactly \n\n - let trimmed = rendered.trim_end_matches('\n'); - if trimmed.is_empty() { - None - } else { - Some(format!("{}\n\n", trimmed)) - } - } - - /// Check if the buffer is empty. - pub fn is_empty(&self) -> bool { - self.0.is_empty() - } -} - -// ============================================================================ -// Tests -// ============================================================================ - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_text_buffer_accumulates() { - let mut buffer = TextBuffer::new(); - - // Buffer text chunks - buffer.push("Hello "); - buffer.push("world!"); - - // Flush returns rendered content - let out = buffer.flush(); - assert!(out.is_some()); - assert!(out.unwrap().contains("Hello world!")); - - // Buffer is now empty - assert!(buffer.flush().is_none()); - assert!(buffer.is_empty()); - } - - #[test] - fn test_text_buffer_flush_empty() { - let mut buffer = TextBuffer::new(); - assert!(buffer.is_empty()); - let out = buffer.flush(); - assert!(out.is_none()); - } - - #[test] - fn test_text_buffer_flush_normalizes_to_double_newline() { - // flush() should normalize output to end with exactly \n\n - // This is critical for consistent spacing before tool calls - - // Case 1: Text with no trailing newline -> normalized to \n\n - let mut buffer = TextBuffer::new(); - buffer.push("Hello world"); - let out = buffer.flush().unwrap(); - assert!( - out.ends_with("\n\n"), - "Should end with \\n\\n, got: {:?}", - out - ); - assert!(!out.ends_with("\n\n\n"), "Should not have triple newline"); - - // Case 2: Text with single trailing newline -> normalized to \n\n - let mut buffer = TextBuffer::new(); - buffer.push("Hello world\n"); - let out = buffer.flush().unwrap(); - assert!( - out.ends_with("\n\n"), - "Should end with \\n\\n, got: {:?}", - out - ); - - // Case 3: Text with double trailing newline -> stays \n\n - let mut buffer = TextBuffer::new(); - buffer.push("Hello world\n\n"); - let out = buffer.flush().unwrap(); - assert!( - out.ends_with("\n\n"), - "Should end with \\n\\n, got: {:?}", - out - ); - assert!(!out.ends_with("\n\n\n"), "Should not have triple newline"); - } - - #[test] - fn test_text_buffer_flush_returns_none_for_whitespace_only() { - // If buffer only contains whitespace/newlines, flush should return None - let mut buffer = TextBuffer::new(); - buffer.push("\n\n"); - let out = buffer.flush(); - assert!(out.is_none(), "Whitespace-only buffer should return None"); - } - - #[test] - fn test_text_buffer_default() { - // TextBuffer implements Default - let buffer = TextBuffer::default(); - assert!(buffer.is_empty()); - } - - #[test] - fn test_render_markdown_nowrap() { - let rendered = render_markdown_nowrap("**bold** and *italic*"); - // Verify markdown is processed - should contain ANSI escape codes - assert!(!rendered.is_empty()); - // ANSI escape codes start with \x1b[ (ESC[) - assert!( - rendered.contains("\x1b["), - "Expected ANSI codes for bold/italic formatting, got: {:?}", - rendered - ); - // The text content should still be present - assert!(rendered.contains("bold"), "Should contain 'bold' text"); - assert!(rendered.contains("italic"), "Should contain 'italic' text"); - } - - #[test] - fn test_render_markdown_nowrap_plain_text() { - // Plain text without markdown should pass through - let rendered = render_markdown_nowrap("plain text"); - assert!(rendered.contains("plain text")); - } - - #[test] - fn test_render_markdown_nowrap_headers() { - // Headers should be rendered (SKIN left-aligns them) - let rendered = render_markdown_nowrap("# Header"); - assert!(!rendered.is_empty()); - assert!(rendered.contains("Header")); - } -} diff --git a/crates/clemitui/tests/acp_simulation_tests.rs b/crates/clemitui/tests/acp_simulation_tests.rs deleted file mode 100644 index 70d81b7..0000000 --- a/crates/clemitui/tests/acp_simulation_tests.rs +++ /dev/null @@ -1,1655 +0,0 @@ -//! ACP Agent Simulation Tests for clemitui. -//! -//! These tests simulate the patterns of formatting calls that an ACP-compatible -//! agent would make during complex operations, verifying clemitui handles -//! realistic workloads correctly. -//! -//! Run with: `cargo test -p clemitui --test acp_simulation_tests` - -mod common; - -use clemitui::{ - TextBuffer, enable_logging, format_cancelled, format_context_warning, format_ctrl_c, - format_error_detail, format_retry, format_tool_args, format_tool_executing, format_tool_result, - log_event, log_event_line, set_output_sink, -}; -use common::{ - CaptureSink, DisableColors, LoggingGuard, flush_to_output, format_tool_block, strip_ansi, -}; -use serde_json::json; -use std::sync::Arc; -use std::time::Duration; - -// ============================================================================= -// Rapid Tool Execution Sequences -// ============================================================================= - -/// Simulates an agent performing multiple glob searches in rapid succession -/// (e.g., exploring a codebase). -#[test] -fn test_rapid_glob_sequence() { - let _guard = DisableColors::new(); - - let patterns = [ - "**/*.rs", - "**/*.toml", - "**/*.md", - "**/test*.rs", - "**/mod.rs", - ]; - - let mut all_output = String::new(); - - for (i, pattern) in patterns.iter().enumerate() { - let args = json!({"pattern": pattern}); - all_output.push_str(&format_tool_block( - "glob", - &args, - 15 + i as u64 * 5, - 50, - false, - )); - } - - // Should have 5 tool execution blocks - assert_eq!( - all_output.matches("┌─").count(), - 5, - "Should have 5 opening brackets" - ); - assert_eq!( - all_output.matches("└─").count(), - 5, - "Should have 5 closing brackets" - ); - - // Each pattern should appear - for pattern in patterns { - assert!( - all_output.contains(pattern), - "Should contain pattern: {}", - pattern - ); - } -} - -/// Simulates an agent chaining grep -> read -> edit tools -/// (typical find-and-fix workflow). -#[test] -fn test_grep_read_edit_chain() { - let _guard = DisableColors::new(); - - let mut output = String::new(); - - // Step 1: grep to find occurrences - output.push_str(&format_tool_block( - "grep", - &json!({"pattern": "TODO", "path": "src/"}), - 45, - 120, - false, - )); - - // Step 2: read the file - output.push_str(&format_tool_block( - "read", - &json!({"file_path": "/project/src/main.rs", "offset": 100, "limit": 50}), - 12, - 250, - false, - )); - - // Step 3: edit the file - output.push_str(&format_tool_block( - "edit", - &json!({ - "file_path": "/project/src/main.rs", - "old_string": "TODO: implement", - "new_string": "DONE: implemented" - }), - 8, - 30, - false, - )); - - // Verify tool chain structure - assert!(output.contains("grep"), "Should contain grep"); - assert!(output.contains("read"), "Should contain read"); - assert!(output.contains("edit"), "Should contain edit"); - - // Edit tool should filter old_string/new_string - assert!( - !output.contains("TODO: implement"), - "Should NOT show old_string content" - ); - assert!( - !output.contains("DONE: implemented"), - "Should NOT show new_string content" - ); - assert!( - output.contains("file_path="), - "Should show file_path for edit" - ); -} - -/// Simulates rapid bash commands (e.g., running tests, build steps). -#[test] -fn test_rapid_bash_sequence() { - let _guard = DisableColors::new(); - - let commands = [ - ("cargo check", 1200, 80, false), - ("cargo clippy", 2500, 150, false), - ("cargo test", 3000, 500, false), - ("cargo build --release", 8000, 200, false), - ]; - - let mut output = String::new(); - - for (cmd, duration_ms, tokens, has_error) in commands { - output.push_str(&format_tool_block( - "bash", - &json!({"command": cmd}), - duration_ms, - tokens, - has_error, - )); - } - - // All commands should appear - for (cmd, _, _, _) in commands { - assert!(output.contains(cmd), "Should contain command: {}", cmd); - } - - // Duration formatting should be correct - assert!(output.contains("1.20s"), "Should show 1.20s"); - assert!(output.contains("2.50s"), "Should show 2.50s"); - assert!(output.contains("3.00s"), "Should show 3.00s"); - assert!(output.contains("8.00s"), "Should show 8.00s"); -} - -// ============================================================================= -// Long Streaming Markdown Scenarios -// ============================================================================= - -/// Simulates streaming a long markdown response with multiple sections. -#[test] -fn test_streaming_long_markdown() { - let mut buffer = TextBuffer::new(); - - // Simulate streaming chunks as they would arrive from an LLM - let chunks = [ - "# Project Analysis\n\n", - "Here's my analysis of the codebase:\n\n", - "## Overview\n\n", - "The project is structured as follows:\n\n", - "- `src/` - Main source code\n", - "- `tests/` - Test files\n", - "- `docs/` - Documentation\n\n", - "## Key Findings\n\n", - "1. **Architecture** - The code follows ", - "a clean event-driven pattern.\n", - "2. **Testing** - Good coverage ", - "with both unit and integration tests.\n", - "3. **Documentation** - Inline docs ", - "are comprehensive.\n\n", - "## Code Example\n\n", - "```rust\n", - "fn main() {\n", - " println!(\"Hello, world!\");\n", - "}\n", - "```\n\n", - "## Recommendations\n\n", - "Consider adding more integration tests.\n", - ]; - - for chunk in chunks { - buffer.push(chunk); - } - - let rendered = buffer.flush(); - assert!(rendered.is_some(), "Should have rendered content"); - - let content = strip_ansi(&rendered.unwrap()); - - // Verify all sections are present - assert!(content.contains("Project Analysis"), "Should have title"); - assert!(content.contains("Overview"), "Should have Overview section"); - assert!(content.contains("Key Findings"), "Should have Key Findings"); - assert!(content.contains("Code Example"), "Should have Code Example"); - assert!( - content.contains("Recommendations"), - "Should have Recommendations" - ); - - // Verify list items - assert!( - content.contains("Main source code"), - "Should have list content" - ); - - // Verify code block content is present - assert!( - content.contains("Hello, world!"), - "Should have code block content" - ); -} - -/// Simulates streaming with incomplete markdown that gets completed. -#[test] -fn test_streaming_incomplete_markdown_completion() { - let mut buffer = TextBuffer::new(); - - // Start with incomplete bold - buffer.push("This is **important"); - - // Continue streaming - buffer.push(" text** that spans chunks.\n\n"); - - // Add more content - buffer.push("And here's more content."); - - let rendered = buffer.flush(); - assert!(rendered.is_some(), "Should have rendered content"); - - let content = strip_ansi(&rendered.unwrap()); - assert!(content.contains("important"), "Should contain 'important'"); - assert!( - content.contains("spans chunks"), - "Should contain 'spans chunks'" - ); -} - -/// Simulates streaming a response with multiple code blocks. -#[test] -fn test_streaming_multiple_code_blocks() { - let mut buffer = TextBuffer::new(); - - buffer.push("Here's the Rust version:\n\n"); - buffer.push("```rust\nfn add(a: i32, b: i32) -> i32 {\n a + b\n}\n```\n\n"); - buffer.push("And the Python version:\n\n"); - buffer.push("```python\ndef add(a, b):\n return a + b\n```\n\n"); - buffer.push("Both achieve the same result."); - - let rendered = buffer.flush(); - assert!(rendered.is_some(), "Should have rendered content"); - - let content = strip_ansi(&rendered.unwrap()); - assert!(content.contains("Rust version"), "Should mention Rust"); - assert!(content.contains("Python version"), "Should mention Python"); - assert!(content.contains("a + b"), "Should have code content"); -} - -// ============================================================================= -// Interleaved Tool and Text Output -// ============================================================================= - -/// Simulates an agent explaining what it's doing while executing tools. -#[test] -fn test_interleaved_explanation_and_tools() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Agent explains what it will do - buffer.push("I'll search for TODO comments in the codebase.\n\n"); - if let Some(text) = buffer.flush() { - output.push_str(&strip_ansi(&text)); - output.push('\n'); - } - - // Execute grep tool - let grep_args = json!({"pattern": "TODO"}); - output.push_str(&strip_ansi(&format_tool_executing("grep", &grep_args))); - output.push_str(&strip_ansi(&format_tool_result( - "grep", - Duration::from_millis(35), - 80, - false, - ))); - output.push('\n'); - - // Agent comments on results - buffer.push("Found 3 TODO items. Let me read the first file.\n\n"); - if let Some(text) = buffer.flush() { - output.push_str(&strip_ansi(&text)); - output.push('\n'); - } - - // Execute read tool - let read_args = json!({"file_path": "src/main.rs"}); - output.push_str(&strip_ansi(&format_tool_executing("read", &read_args))); - output.push_str(&strip_ansi(&format_tool_result( - "read", - Duration::from_millis(12), - 150, - false, - ))); - output.push('\n'); - - // Final explanation - buffer.push("Here's what I found:\n\n- Line 42: TODO: add error handling\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify interleaving - assert!( - output.contains("search for TODO"), - "Should have initial explanation" - ); - assert!(output.contains("┌─"), "Should have tool markers"); - assert!( - output.contains("Found 3 TODO"), - "Should have middle explanation" - ); - assert!(output.contains("Line 42"), "Should have final explanation"); -} - -/// Simulates an agent providing step-by-step progress updates. -#[test] -fn test_step_by_step_progress() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - let steps = [ - ( - "Step 1: Checking project structure...", - "glob", - json!({"pattern": "**/*"}), - 25, - ), - ( - "Step 2: Reading configuration...", - "read", - json!({"file_path": "config.toml"}), - 10, - ), - ( - "Step 3: Running tests...", - "bash", - json!({"command": "cargo test"}), - 2500, - ), - ( - "Step 4: Building release...", - "bash", - json!({"command": "cargo build --release"}), - 5000, - ), - ]; - - for (explanation, tool, args, duration_ms) in steps { - // Add explanation - buffer.push(explanation); - buffer.push("\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Execute tool - output.push_str(&strip_ansi(&format_tool_executing(tool, &args))); - output.push_str(&strip_ansi(&format_tool_result( - tool, - Duration::from_millis(duration_ms), - 100, - false, - ))); - output.push('\n'); - } - - // Verify all steps present - assert!(output.contains("Step 1"), "Should have Step 1"); - assert!(output.contains("Step 2"), "Should have Step 2"); - assert!(output.contains("Step 3"), "Should have Step 3"); - assert!(output.contains("Step 4"), "Should have Step 4"); - - // Verify tools executed - assert!(output.contains("glob"), "Should have glob"); - assert!(output.contains("config.toml"), "Should have config.toml"); - assert!(output.contains("cargo test"), "Should have cargo test"); - assert!(output.contains("cargo build"), "Should have cargo build"); -} - -// ============================================================================= -// Error Recovery Visualization -// ============================================================================= - -/// Simulates a tool failing and agent recovering. -#[test] -fn test_tool_error_and_recovery() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // First attempt - fails - let args = json!({"file_path": "nonexistent.rs"}); - output.push_str(&strip_ansi(&format_tool_executing("read", &args))); - output.push_str(&strip_ansi(&format_tool_result( - "read", - Duration::from_millis(5), - 20, - true, // has_error = true - ))); - output.push_str(&strip_ansi(&format_error_detail( - "File not found: nonexistent.rs", - ))); - output.push('\n'); - - // Agent explains the error - buffer.push("\nThe file doesn't exist. Let me search for similar files.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Recovery attempt - glob search - let glob_args = json!({"pattern": "**/*.rs"}); - output.push_str(&strip_ansi(&format_tool_executing("glob", &glob_args))); - output.push_str(&strip_ansi(&format_tool_result( - "glob", - Duration::from_millis(20), - 50, - false, - ))); - output.push('\n'); - - // Found the right file - buffer.push("Found it! The file is `src/main.rs`.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Successful read - let correct_args = json!({"file_path": "src/main.rs"}); - output.push_str(&strip_ansi(&format_tool_executing("read", &correct_args))); - output.push_str(&strip_ansi(&format_tool_result( - "read", - Duration::from_millis(10), - 200, - false, - ))); - - // Verify error indicator - assert!(output.contains("ERROR"), "Should show ERROR marker"); - assert!( - output.contains("File not found"), - "Should show error detail" - ); - - // Verify recovery narrative - assert!(output.contains("doesn't exist"), "Should explain the error"); - assert!(output.contains("Found it"), "Should show recovery"); -} - -/// Simulates API retry scenario with backoff. -#[test] -fn test_api_retry_sequence() { - let _guard = DisableColors::new(); - - let mut output = String::new(); - - // First retry - output.push_str(&strip_ansi(&format_retry( - 1, - 3, - Duration::from_secs(2), - "rate limit exceeded", - ))); - output.push('\n'); - - // Second retry - output.push_str(&strip_ansi(&format_retry( - 2, - 3, - Duration::from_secs(4), - "rate limit exceeded", - ))); - output.push('\n'); - - // Verify retry formatting - assert!(output.contains("1/3"), "Should show attempt 1/3"); - assert!(output.contains("2/3"), "Should show attempt 2/3"); - assert!(output.contains("2s"), "Should show 2s delay"); - assert!(output.contains("4s"), "Should show 4s delay"); - assert!( - output.contains("rate limit"), - "Should show rate limit reason" - ); -} - -/// Simulates multiple consecutive errors (agent struggling). -#[test] -fn test_multiple_consecutive_errors() { - let _guard = DisableColors::new(); - - let mut output = String::new(); - - let error_sequence = [ - ( - "edit", - json!({"file_path": "test.rs", "old_string": "foo", "new_string": "bar"}), - "old_string not found in file", - ), - ( - "edit", - json!({"file_path": "test.rs", "old_string": "FOO", "new_string": "bar"}), - "old_string not found in file", - ), - ("read", json!({"file_path": "test.rs"}), ""), // Success to read file - ]; - - for (i, (tool, args, error)) in error_sequence.iter().enumerate() { - output.push_str(&strip_ansi(&format_tool_executing(tool, args))); - - let has_error = !error.is_empty(); - output.push_str(&strip_ansi(&format_tool_result( - tool, - Duration::from_millis(10), - 30, - has_error, - ))); - - if has_error { - output.push_str(&strip_ansi(&format_error_detail(error))); - } - output.push_str(&format!(" // attempt {}\n", i + 1)); - } - - // Should have 2 errors and 1 success - assert_eq!( - output.matches("ERROR").count(), - 2, - "Should have 2 ERROR markers" - ); - assert_eq!( - output.matches("old_string not found").count(), - 2, - "Should have 2 error details" - ); -} - -// ============================================================================= -// Context Window Warning Scenarios -// ============================================================================= - -/// Simulates context window filling up during a session. -#[test] -fn test_context_warning_progression() { - // format_context_warning only adds /clear when percentage > 95.0 (strict greater than) - let warnings = [ - (80.0, false), // First warning at 80% - (85.0, false), // Getting higher - (90.0, false), // Still below critical - (95.0, false), // At 95% - still no /clear (requires > 95.0) - (95.1, true), // Just above 95% - now suggests /clear - (98.0, true), // Very critical - ]; - - for (percentage, should_suggest_clear) in warnings { - let warning = format_context_warning(percentage); - - assert!( - warning.contains(&format!("{:.1}%", percentage)), - "Should contain percentage {:.1}%", - percentage - ); - - if should_suggest_clear { - assert!( - warning.contains("/clear"), - "Should suggest /clear at {:.1}%", - percentage - ); - } else { - assert!( - !warning.contains("/clear"), - "Should NOT suggest /clear at {:.1}%", - percentage - ); - } - } -} - -// ============================================================================= -// Large Output Handling -// ============================================================================= - -/// Simulates formatting very large tool arguments (should be truncated). -#[test] -fn test_large_argument_truncation() { - let _guard = DisableColors::new(); - - // Create a very long string argument - let long_content = "x".repeat(500); - let args = json!({ - "content": long_content, - "file_path": "output.txt" - }); - - let formatted = format_tool_args("write", &args); - - // Should be truncated (MAX_ARG_DISPLAY_LEN is 80) - assert!( - formatted.len() < 300, - "Should truncate very long arguments: len={}", - formatted.len() - ); - assert!( - formatted.contains("..."), - "Should have truncation indicator" - ); - assert!( - formatted.contains("file_path="), - "Should still show file_path" - ); -} - -/// Simulates a complex multi-tool operation with mixed output sizes. -#[test] -fn test_mixed_output_sizes() { - let _guard = DisableColors::new(); - - let operations = [ - ("glob", json!({"pattern": "*.rs"}), 10, 25), // Small output - ("read", json!({"file_path": "main.rs"}), 50, 2000), // Large output - ("grep", json!({"pattern": "fn "}), 30, 500), // Medium output - ("bash", json!({"command": "wc -l **/*.rs"}), 100, 50), // Small output - ]; - - let mut total_output = String::new(); - - for (tool, args, duration_ms, tokens) in operations { - let executing = format_tool_executing(tool, &args); - let result = format_tool_result(tool, Duration::from_millis(duration_ms), tokens, false); - - total_output.push_str(&executing); - total_output.push_str(&result); - total_output.push('\n'); - } - - let stripped = strip_ansi(&total_output); - - // All tools should be present - assert!(stripped.contains("glob"), "Should have glob"); - assert!(stripped.contains("read"), "Should have read"); - assert!(stripped.contains("grep"), "Should have grep"); - assert!(stripped.contains("bash"), "Should have bash"); - - // Token counts should vary - assert!(stripped.contains("~25 tok"), "Should show 25 tokens"); - assert!(stripped.contains("~2000 tok"), "Should show 2000 tokens"); - assert!(stripped.contains("~500 tok"), "Should show 500 tokens"); - assert!(stripped.contains("~50 tok"), "Should show 50 tokens"); -} - -// ============================================================================= -// Complex Multi-Turn Simulation -// ============================================================================= - -// ============================================================================= -// Background Task Scenarios -// ============================================================================= - -/// Simulates spawning a background task and later checking its output. -#[test] -fn test_background_task_lifecycle() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Agent explains - buffer.push("I'll run the test suite in the background while we continue working.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Spawn background task - let bash_args = json!({"command": "cargo test", "background": true}); - output.push_str(&strip_ansi(&format_tool_executing("bash", &bash_args))); - output.push_str(&strip_ansi(&format_tool_result( - "bash", - Duration::from_millis(50), - 30, - false, - ))); - output.push('\n'); - - // Simulate tool output showing task ID - output.push_str(" task bg-1 running in background\n\n"); - - // Agent continues with other work - buffer.push("Tests are running. Meanwhile, let me check the code coverage setup.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Do other work - output.push_str(&strip_ansi(&format_tool_executing( - "read", - &json!({"file_path": "codecov.yml"}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "read", - Duration::from_millis(10), - 50, - false, - ))); - output.push('\n'); - - // Later: check task output - buffer.push("Let me check if the tests completed.\n\n"); - flush_to_output(&mut buffer, &mut output); - - output.push_str(&strip_ansi(&format_tool_executing( - "task_output", - &json!({"task_id": "bg-1"}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task_output", - Duration::from_millis(5), - 500, - false, - ))); - output.push('\n'); - - // Agent reports results - buffer.push("Tests completed successfully: 223 passed, 0 failed.\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify background task flow - assert!(output.contains("background"), "Should mention background"); - assert!(output.contains("bg-1"), "Should show task ID"); - assert!(output.contains("task_output"), "Should check task output"); - assert!(output.contains("223 passed"), "Should report results"); -} - -/// Simulates multiple concurrent background tasks. -#[test] -fn test_multiple_background_tasks() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Spawn multiple background tasks - buffer.push("Running build and tests in parallel.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Task 1: Build - output.push_str(&strip_ansi(&format_tool_executing( - "bash", - &json!({"command": "cargo build --release", "background": true}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "bash", - Duration::from_millis(20), - 25, - false, - ))); - output.push_str(" task bg-1 running in background\n"); - - // Task 2: Tests - output.push_str(&strip_ansi(&format_tool_executing( - "bash", - &json!({"command": "cargo test", "background": true}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "bash", - Duration::from_millis(20), - 25, - false, - ))); - output.push_str(" task bg-2 running in background\n"); - - // Task 3: Clippy - output.push_str(&strip_ansi(&format_tool_executing( - "bash", - &json!({"command": "cargo clippy", "background": true}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "bash", - Duration::from_millis(20), - 25, - false, - ))); - output.push_str(" task bg-3 running in background\n\n"); - - // Later: check all tasks - for task_id in ["bg-1", "bg-2", "bg-3"] { - output.push_str(&strip_ansi(&format_tool_executing( - "task_output", - &json!({"task_id": task_id}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task_output", - Duration::from_millis(5), - 100, - false, - ))); - output.push('\n'); - } - - // Verify all tasks - assert!(output.contains("bg-1"), "Should have task bg-1"); - assert!(output.contains("bg-2"), "Should have task bg-2"); - assert!(output.contains("bg-3"), "Should have task bg-3"); - // Each task_output call produces 2 occurrences: executing line + result line - assert_eq!( - output.matches("task_output").count(), - 6, // 3 tasks × 2 (executing + result) - "Should check all 3 tasks (6 total: 3 executing + 3 result lines)" - ); -} - -/// Simulates a background task that fails. -#[test] -fn test_background_task_failure() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Spawn background task - output.push_str(&strip_ansi(&format_tool_executing( - "bash", - &json!({"command": "cargo test --features broken", "background": true}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "bash", - Duration::from_millis(20), - 25, - false, - ))); - output.push_str(" task bg-1 running in background\n\n"); - - // Check output - task failed - output.push_str(&strip_ansi(&format_tool_executing( - "task_output", - &json!({"task_id": "bg-1"}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task_output", - Duration::from_millis(5), - 200, - true, // Error - task failed - ))); - output.push_str(&strip_ansi(&format_error_detail("Task exited with code 1"))); - output.push('\n'); - - // Agent handles the failure - buffer.push("The tests failed. Let me investigate the error.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify error handling - assert!(output.contains("ERROR"), "Should show error marker"); - assert!(output.contains("exited with code"), "Should show exit code"); - assert!(output.contains("investigate"), "Should explain recovery"); -} - -// ============================================================================= -// Subagent / Task Delegation Scenarios -// ============================================================================= - -/// Simulates spawning a subagent for a delegated task. -#[test] -fn test_subagent_delegation() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Main agent explains delegation - buffer.push( - "This is a complex refactoring task. I'll delegate the test updates to a subagent.\n\n", - ); - flush_to_output(&mut buffer, &mut output); - - // Spawn subagent task - let task_args = json!({ - "prompt": "Update all tests in tests/ to use the new API. The function signatures changed from foo(x) to foo(x, y).", - "background": true - }); - output.push_str(&strip_ansi(&format_tool_executing("task", &task_args))); - output.push_str(&strip_ansi(&format_tool_result( - "task", - Duration::from_millis(100), - 50, - false, - ))); - output.push_str(" task acp-1 running in background\n\n"); - - // Main agent continues - buffer.push("Subagent is working on tests. I'll update the main source files.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Main agent does its work - output.push_str(&strip_ansi(&format_tool_executing( - "edit", - &json!({ - "file_path": "src/lib.rs", - "old_string": "fn foo(x: i32)", - "new_string": "fn foo(x: i32, y: i32)" - }), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "edit", - Duration::from_millis(10), - 30, - false, - ))); - output.push('\n'); - - // Check subagent result - buffer.push("Let me check if the subagent finished.\n\n"); - flush_to_output(&mut buffer, &mut output); - - output.push_str(&strip_ansi(&format_tool_executing( - "task_output", - &json!({"task_id": "acp-1"}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task_output", - Duration::from_millis(5), - 300, - false, - ))); - output.push('\n'); - - // Final summary - buffer.push("Subagent completed: updated 8 test files. All changes are ready for review.\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify subagent flow - assert!(output.contains("task"), "Should use task tool"); - assert!(output.contains("acp-1"), "Should show ACP task ID"); - assert!(output.contains("Subagent"), "Should mention subagent"); - assert!(output.contains("8 test files"), "Should report results"); -} - -/// Simulates multiple subagents working in parallel. -#[test] -fn test_parallel_subagents() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Explain parallel approach - buffer.push("I'll use parallel subagents to update different parts of the codebase:\n"); - buffer.push("1. Frontend updates\n"); - buffer.push("2. Backend updates\n"); - buffer.push("3. Documentation updates\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Spawn subagents - let tasks = [ - ("Update frontend components to use new theme", "acp-1"), - ("Update backend API handlers", "acp-2"), - ("Update documentation for new features", "acp-3"), - ]; - - for (prompt, task_id) in tasks { - output.push_str(&strip_ansi(&format_tool_executing( - "task", - &json!({"prompt": prompt, "background": true}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task", - Duration::from_millis(80), - 40, - false, - ))); - output.push_str(&format!(" task {} running in background\n", task_id)); - } - output.push('\n'); - - // Wait and collect results - buffer.push("All subagents dispatched. Waiting for completion...\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Check each result - for (_, task_id) in tasks { - output.push_str(&strip_ansi(&format_tool_executing( - "task_output", - &json!({"task_id": task_id}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task_output", - Duration::from_millis(5), - 150, - false, - ))); - output.push('\n'); - } - - // Verify parallel execution - assert!(output.contains("acp-1"), "Should have task acp-1"); - assert!(output.contains("acp-2"), "Should have task acp-2"); - assert!(output.contains("acp-3"), "Should have task acp-3"); - // "task " appears in: 3 spawns × 2 (executing + result) + 3 "task acp-X running" messages = 9 - assert_eq!( - output.matches("task ").count(), - 9, - "Should have 9 task references (3 spawns × 2 lines + 3 status messages)" - ); -} - -// ============================================================================= -// Kill Shell Scenarios -// ============================================================================= - -/// Simulates killing a long-running background task. -#[test] -fn test_kill_background_task() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Start a long-running task - output.push_str(&strip_ansi(&format_tool_executing( - "bash", - &json!({"command": "cargo build --all-targets", "background": true}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "bash", - Duration::from_millis(30), - 25, - false, - ))); - output.push_str(" task bg-1 running in background\n\n"); - - // Decide to kill it - buffer.push("Actually, I need to stop the build. The configuration is wrong.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Kill the task - output.push_str(&strip_ansi(&format_tool_executing( - "kill_shell", - &json!({"task_id": "bg-1"}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "kill_shell", - Duration::from_millis(10), - 15, - false, - ))); - output.push('\n'); - - // Confirm - buffer.push("Task killed. Let me fix the configuration first.\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify kill flow - assert!(output.contains("bg-1"), "Should reference task ID"); - assert!(output.contains("kill_shell"), "Should use kill_shell tool"); - assert!(output.contains("Task killed"), "Should confirm kill"); -} - -// ============================================================================= -// Complete Multi-Turn Simulation -// ============================================================================= - -/// Simulates a complete multi-turn agent interaction for a refactoring task. -#[test] -fn test_complete_refactoring_session() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut session_output = String::new(); - - // Turn 1: Agent explores the codebase - buffer - .push("I'll help you refactor the error handling. First, let me explore the codebase.\n\n"); - flush_to_output(&mut buffer, &mut session_output); - - // Glob search - session_output.push_str(&strip_ansi(&format_tool_executing( - "glob", - &json!({"pattern": "**/*.rs"}), - ))); - session_output.push_str(&strip_ansi(&format_tool_result( - "glob", - Duration::from_millis(20), - 150, - false, - ))); - session_output.push('\n'); - - // Grep for error handling - session_output.push_str(&strip_ansi(&format_tool_executing( - "grep", - &json!({"pattern": "unwrap\\(\\)", "path": "src/"}), - ))); - session_output.push_str(&strip_ansi(&format_tool_result( - "grep", - Duration::from_millis(45), - 300, - false, - ))); - session_output.push('\n'); - - // Agent summarizes findings - buffer.push( - "Found 12 uses of `unwrap()` that should be replaced with proper error handling:\n\n", - ); - buffer.push("- `src/main.rs`: 4 occurrences\n"); - buffer.push("- `src/lib.rs`: 3 occurrences\n"); - buffer.push("- `src/utils.rs`: 5 occurrences\n\n"); - flush_to_output(&mut buffer, &mut session_output); - - // Turn 2: Agent starts fixing - buffer.push("Let me start with `src/main.rs`.\n\n"); - flush_to_output(&mut buffer, &mut session_output); - - // Read file - session_output.push_str(&strip_ansi(&format_tool_executing( - "read", - &json!({"file_path": "src/main.rs"}), - ))); - session_output.push_str(&strip_ansi(&format_tool_result( - "read", - Duration::from_millis(15), - 500, - false, - ))); - session_output.push('\n'); - - // Edit file (multiple edits) - for i in 1..=4 { - session_output.push_str(&strip_ansi(&format_tool_executing( - "edit", - &json!({ - "file_path": "src/main.rs", - "old_string": format!("unwrap() // {}", i), - "new_string": "?" - }), - ))); - session_output.push_str(&strip_ansi(&format_tool_result( - "edit", - Duration::from_millis(8), - 30, - false, - ))); - session_output.push('\n'); - } - - // Agent confirms completion - buffer.push("Fixed all 4 occurrences in `src/main.rs`. "); - buffer.push("The function now returns `Result<(), Error>` instead of panicking.\n\n"); - buffer.push("Would you like me to continue with the other files?"); - flush_to_output(&mut buffer, &mut session_output); - - // Verify the complete session - assert!( - session_output.contains("refactor"), - "Should have initial explanation" - ); - assert!(session_output.contains("glob"), "Should have glob search"); - assert!(session_output.contains("grep"), "Should have grep search"); - assert!( - session_output.contains("12 uses"), - "Should summarize findings" - ); - // Each edit operation produces 2 occurrences: executing line + result line - assert_eq!( - session_output.matches("edit").count(), - 8, // 4 edits × 2 (executing + result) - "Should have 4 edit operations (8 total: 4 executing + 4 result lines)" - ); - assert!( - session_output.contains("Fixed all 4"), - "Should confirm completion" - ); - assert!( - session_output.contains("continue with"), - "Should offer next steps" - ); -} - -// ============================================================================= -// Cancellation and Interrupt Handling -// ============================================================================= - -/// Simulates user pressing ctrl-c during a long operation. -#[test] -fn test_ctrl_c_during_tool_execution() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Start a long-running tool - output.push_str(&strip_ansi(&format_tool_executing( - "bash", - &json!({"command": "cargo build --release"}), - ))); - - // User presses ctrl-c - output.push_str(format_ctrl_c()); - output.push('\n'); - - // Agent acknowledges - buffer.push("Build interrupted. Would you like me to continue or try something else?\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify - assert!(output.contains("bash"), "Should show tool that was running"); - assert!( - output.to_lowercase().contains("ctrl") || output.contains("interrupted"), - "Should indicate interruption" - ); -} - -/// Simulates operation being cancelled by user. -#[test] -fn test_operation_cancelled() { - let _guard = DisableColors::new(); - - let mut output = String::new(); - - // Start some work - output.push_str(&strip_ansi(&format_tool_executing( - "task", - &json!({"prompt": "Implement authentication system"}), - ))); - - // Operation cancelled - output.push_str(&strip_ansi(&format_cancelled())); - output.push('\n'); - - // Verify - assert!(output.contains("task"), "Should show what was cancelled"); - assert!( - output.to_lowercase().contains("cancel"), - "Should indicate cancellation" - ); -} - -// ============================================================================= -// Multi-Turn Conversation Simulation -// ============================================================================= - -/// Simulates a multi-turn debugging session with context accumulation. -#[test] -fn test_multi_turn_debugging_session() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Turn 1: User reports bug - buffer.push("I see there's a panic in `parse_config`. Let me investigate.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Read the file - output.push_str(&strip_ansi(&format_tool_executing( - "read", - &json!({"file_path": "src/config.rs"}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "read", - Duration::from_millis(5), - 1200, - false, - ))); - output.push('\n'); - - // Analysis - buffer.push( - "I found the issue. The `unwrap()` on line 42 panics when the config file is missing.\n\n", - ); - flush_to_output(&mut buffer, &mut output); - - // Turn 2: User asks for fix - // Agent proposes fix - output.push_str(&strip_ansi(&format_tool_executing( - "edit", - &json!({ - "file_path": "src/config.rs", - "old_string": "config.unwrap()", - "new_string": "config.unwrap_or_default()" - }), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "edit", - Duration::from_millis(8), - 30, - false, - ))); - output.push('\n'); - - // Turn 3: Verify fix - buffer.push("Applied the fix. Let me verify it compiles.\n\n"); - flush_to_output(&mut buffer, &mut output); - - output.push_str(&strip_ansi(&format_tool_executing( - "bash", - &json!({"command": "cargo check"}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "bash", - Duration::from_millis(2500), - 150, - false, - ))); - output.push('\n'); - - buffer.push("Compiles successfully. The panic should now be fixed.\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify multi-turn flow - assert!( - output.contains("parse_config"), - "Should reference original bug" - ); - assert!( - output.contains("unwrap"), - "Should identify the problematic code" - ); - assert!(output.contains("edit"), "Should propose edit"); - assert!(output.contains("cargo check"), "Should verify fix"); - assert!( - output.contains("successfully"), - "Should confirm successful fix" - ); -} - -/// Simulates a planning session before implementation. -#[test] -fn test_planning_before_implementation() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Agent starts planning - buffer.push("Let me plan the implementation for the authentication feature.\n\n"); - buffer.push("## Implementation Plan\n\n"); - buffer.push("1. Create auth middleware\n"); - buffer.push("2. Add JWT validation\n"); - buffer.push("3. Implement login/logout routes\n"); - buffer.push("4. Add session management\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Research existing patterns - output.push_str(&strip_ansi(&format_tool_executing( - "grep", - &json!({"pattern": "middleware", "path": "src/"}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "grep", - Duration::from_millis(20), - 150, - false, - ))); - output.push('\n'); - - output.push_str(&strip_ansi(&format_tool_executing( - "read", - &json!({"file_path": "src/middleware/mod.rs"}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "read", - Duration::from_millis(5), - 800, - false, - ))); - output.push('\n'); - - // Refine plan - buffer.push("Based on existing patterns, I'll use the same middleware structure.\n\n"); - buffer.push("Ready to implement. Should I proceed?\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify planning flow (markdown header rendered, so check for text without ##) - assert!( - output.contains("Implementation Plan"), - "Should have plan header" - ); - assert!(output.contains("grep"), "Should research patterns"); - assert!(output.contains("read"), "Should read existing code"); - assert!(output.contains("proceed"), "Should ask for confirmation"); -} - -// ============================================================================= -// Concurrent Task Coordination -// ============================================================================= - -/// Simulates coordinating multiple long-running tasks with status checks. -#[test] -fn test_task_coordination_with_polling() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Spawn multiple tasks - let tasks = [ - ("cargo test --lib", "bg-1"), - ("cargo test --doc", "bg-2"), - ("cargo clippy", "bg-3"), - ]; - - buffer.push("Running quality checks in parallel...\n\n"); - flush_to_output(&mut buffer, &mut output); - - for (cmd, task_id) in tasks { - output.push_str(&strip_ansi(&format_tool_executing( - "bash", - &json!({"command": cmd, "background": true}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "bash", - Duration::from_millis(30), - 20, - false, - ))); - output.push_str(&format!(" {} started as {}\n", cmd, task_id)); - } - output.push('\n'); - - // First poll - some still running - buffer.push("Checking status...\n\n"); - flush_to_output(&mut buffer, &mut output); - - // bg-1 completed - output.push_str(&strip_ansi(&format_tool_executing( - "task_output", - &json!({"task_id": "bg-1", "block": false}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task_output", - Duration::from_millis(5), - 100, - false, - ))); - output.push_str(" ✓ bg-1 completed successfully\n"); - - // bg-2 still running - output.push_str(&strip_ansi(&format_tool_executing( - "task_output", - &json!({"task_id": "bg-2", "block": false}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task_output", - Duration::from_millis(5), - 20, - false, - ))); - output.push_str(" ⏳ bg-2 still running...\n"); - - // bg-3 failed - output.push_str(&strip_ansi(&format_tool_executing( - "task_output", - &json!({"task_id": "bg-3", "block": false}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task_output", - Duration::from_millis(5), - 50, - true, - ))); - output.push_str(&strip_ansi(&format_error_detail("clippy found 3 warnings"))); - output.push('\n'); - - buffer.push("1 passed, 1 still running, 1 has warnings. Investigating clippy issues...\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify coordination - assert!( - output.contains("parallel"), - "Should mention parallel execution" - ); - assert!(output.contains("bg-1") && output.contains("bg-2") && output.contains("bg-3")); - assert!( - output.contains("completed") || output.contains("✓"), - "Should show completion" - ); - assert!( - output.contains("running") || output.contains("⏳"), - "Should show running status" - ); - assert!( - output.contains("ERROR"), - "Should show error from failed task" - ); -} - -// ============================================================================= -// Deep Nesting and Complex Workflows -// ============================================================================= - -/// Simulates a complex nested workflow: spawn subagent that spawns more tasks. -#[test] -fn test_nested_subagent_workflow() { - let _guard = DisableColors::new(); - - let mut buffer = TextBuffer::new(); - let mut output = String::new(); - - // Main agent delegates to subagent - buffer.push("This is a large refactoring task. I'll delegate to specialized subagents.\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Spawn architecture subagent - output.push_str(&strip_ansi(&format_tool_executing( - "task", - &json!({ - "prompt": "Analyze and improve the architecture of the auth module", - "background": true - }), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task", - Duration::from_millis(100), - 50, - false, - ))); - output.push_str(" acp-1 (architecture analyzer) running\n\n"); - - // Subagent reports back (simulated output) - buffer.push("acp-1 completed. Analysis:\n"); - buffer.push("- Found 3 circular dependencies\n"); - buffer.push("- Recommends extracting `TokenValidator` trait\n"); - buffer.push("- Suggests moving session logic to separate module\n\n"); - flush_to_output(&mut buffer, &mut output); - - // Main agent spawns implementation subagents based on analysis - let implementation_tasks = [ - ( - "Break circular dependency between auth and user modules", - "acp-2", - ), - ("Extract TokenValidator trait to separate crate", "acp-3"), - ("Move session logic to new session module", "acp-4"), - ]; - - buffer.push("Spawning implementation subagents based on analysis:\n\n"); - flush_to_output(&mut buffer, &mut output); - - for (prompt, task_id) in implementation_tasks { - output.push_str(&strip_ansi(&format_tool_executing( - "task", - &json!({"prompt": prompt, "background": true}), - ))); - output.push_str(&strip_ansi(&format_tool_result( - "task", - Duration::from_millis(80), - 40, - false, - ))); - output.push_str(&format!(" {} running\n", task_id)); - } - output.push('\n'); - - // Final summary - buffer.push("Refactoring in progress. 1 analysis + 3 implementation subagents spawned.\n"); - flush_to_output(&mut buffer, &mut output); - - // Verify nested workflow - assert!( - output.contains("acp-1"), - "Should have architecture subagent" - ); - assert!( - output.contains("acp-2") && output.contains("acp-3") && output.contains("acp-4"), - "Should spawn implementation subagents" - ); - assert!( - output.contains("circular"), - "Should report analysis findings" - ); - assert!( - output.contains("Refactoring in progress"), - "Should summarize overall status" - ); -} - -// ============================================================================= -// Logging Infrastructure Tests -// ============================================================================= - -/// Simulates logging multiple events through the OutputSink. -#[test] -fn test_output_sink_logging() { - let _logging_guard = LoggingGuard; // Ensures cleanup on panic - - let (sink, captured) = CaptureSink::new(); - - // Install sink and enable logging - set_output_sink(Arc::new(sink)); - enable_logging(); - - // Log some events - log_event("Starting operation..."); - log_event_line("Tool bash completed"); - log_event("Operation finished."); - - // Verify - let logs = captured.lock().unwrap(); - assert!(logs.len() >= 3, "Should have logged 3 events"); - assert!( - logs.iter().any(|l| l.contains("Starting")), - "Should contain start event" - ); - assert!( - logs.iter().any(|l| l.contains("bash")), - "Should contain tool event" - ); - assert!( - logs.iter().any(|l| l.contains("finished")), - "Should contain end event" - ); -} - -/// Test that logging can be disabled. -#[test] -fn test_logging_disabled() { - let _logging_guard = LoggingGuard; // Ensures cleanup on panic - - let (sink, captured) = CaptureSink::new(); - - set_output_sink(Arc::new(sink)); - clemitui::disable_logging(); - - // These should not be captured - log_event("Should not appear"); - log_event_line("Also should not appear"); - - let logs = captured.lock().unwrap(); - assert!(logs.is_empty(), "Should not log when disabled: {:?}", logs); -} diff --git a/crates/clemitui/tests/common/mod.rs b/crates/clemitui/tests/common/mod.rs deleted file mode 100644 index 3a0b4dd..0000000 --- a/crates/clemitui/tests/common/mod.rs +++ /dev/null @@ -1,232 +0,0 @@ -//! Shared test helpers for clemitui tests. -//! -//! This module provides common utilities used across test files to reduce -//! duplication and ensure consistent test behavior. - -// Allow dead code since not all test files use all helpers -#![allow(dead_code)] - -use clemitui::{OutputSink, TextBuffer, format_tool_executing, format_tool_result}; -use serde_json::Value; -use std::sync::{Arc, Mutex}; -use std::time::Duration; - -// ============================================================================= -// ANSI Stripping -// ============================================================================= - -/// Strip ANSI escape codes for content verification in tests. -/// -/// This allows tests to verify text content without being affected by -/// color codes or other terminal formatting. -pub fn strip_ansi(s: &str) -> String { - let mut result = String::new(); - let mut chars = s.chars().peekable(); - - while let Some(c) = chars.next() { - if c == '\x1b' { - // Skip the escape sequence - if chars.peek() == Some(&'[') { - chars.next(); // consume '[' - // Skip until we hit a letter (the terminator) - while let Some(&next) = chars.peek() { - chars.next(); - if next.is_ascii_alphabetic() { - break; - } - } - } - } else { - result.push(c); - } - } - - result -} - -// ============================================================================= -// RAII Guards -// ============================================================================= - -/// RAII guard that disables colored output for tests. -/// -/// This ensures colors are disabled during the test and automatically -/// restored when the guard is dropped, even if the test panics. -/// -/// # Example -/// -/// ```ignore -/// #[test] -/// fn my_test() { -/// let _guard = DisableColors::new(); -/// // ... test code with colors disabled ... -/// } // colors automatically restored here -/// ``` -pub struct DisableColors; - -impl DisableColors { - /// Create a new guard that disables colored output. - pub fn new() -> Self { - colored::control::set_override(false); - Self - } -} - -impl Default for DisableColors { - fn default() -> Self { - Self::new() - } -} - -impl Drop for DisableColors { - fn drop(&mut self) { - colored::control::unset_override(); - } -} - -/// RAII guard for logging state cleanup. -/// -/// Ensures logging is disabled when the guard is dropped, preventing -/// test pollution even if a test panics. -pub struct LoggingGuard; - -impl Drop for LoggingGuard { - fn drop(&mut self) { - clemitui::disable_logging(); - } -} - -// ============================================================================= -// Tool Execution Helpers -// ============================================================================= - -/// Format a complete tool execution block (executing + result + newline). -/// -/// This combines the common pattern of formatting both the tool start -/// and completion lines, with ANSI codes stripped for testing. -/// -/// # Arguments -/// -/// * `name` - Tool name (e.g., "bash", "grep", "edit") -/// * `args` - Tool arguments as JSON value -/// * `duration_ms` - Execution duration in milliseconds -/// * `tokens` - Token count for the result -/// * `has_error` - Whether the tool execution resulted in an error -/// -/// # Returns -/// -/// A string containing the formatted tool block with ANSI codes stripped. -pub fn format_tool_block( - name: &str, - args: &Value, - duration_ms: u64, - tokens: u32, - has_error: bool, -) -> String { - let mut result = String::new(); - result.push_str(&strip_ansi(&format_tool_executing(name, args))); - result.push_str(&strip_ansi(&format_tool_result( - name, - Duration::from_millis(duration_ms), - tokens, - has_error, - ))); - result.push('\n'); - result -} - -/// Flush TextBuffer content to output string with ANSI codes stripped. -/// -/// This handles the common pattern of flushing a TextBuffer and appending -/// the result to an output string for verification. -pub fn flush_to_output(buffer: &mut TextBuffer, output: &mut String) { - if let Some(text) = buffer.flush() { - output.push_str(&strip_ansi(&text)); - } -} - -// ============================================================================= -// Test Capture Sink -// ============================================================================= - -/// A test sink that captures all logged output for verification. -/// -/// This implements `OutputSink` and stores all emitted messages in a -/// thread-safe vector that can be inspected after the test. -/// -/// # Example -/// -/// ```ignore -/// let (sink, captured) = CaptureSink::new(); -/// set_output_sink(Arc::new(sink)); -/// enable_logging(); -/// -/// log_event("test message"); -/// -/// let logs = captured.lock().unwrap(); -/// assert!(logs.iter().any(|l| l.contains("test message"))); -/// ``` -pub struct CaptureSink { - /// The captured messages, wrapped in Arc for thread safety. - pub captured: Arc>>, -} - -impl CaptureSink { - /// Create a new capture sink and return both the sink and a handle - /// to the captured messages. - pub fn new() -> (Self, Arc>>) { - let captured = Arc::new(Mutex::new(Vec::new())); - let sink = Self { - captured: captured.clone(), - }; - (sink, captured) - } -} - -impl Default for CaptureSink { - fn default() -> Self { - Self::new().0 - } -} - -impl OutputSink for CaptureSink { - fn emit(&self, message: &str) { - self.captured.lock().unwrap().push(message.to_string()); - } - - fn emit_line(&self, message: &str) { - self.captured.lock().unwrap().push(message.to_string()); - } -} - -// ============================================================================= -// Test Assertions -// ============================================================================= - -/// Assert that output contains a tool execution marker. -/// -/// Verifies that the output contains the opening bracket (`┌─`) followed -/// by the tool name, indicating a tool execution was formatted. -#[allow(dead_code)] -pub fn assert_has_tool_executing(output: &str, tool_name: &str) { - assert!( - output.contains(&format!("┌─ {}", tool_name)), - "Output should contain tool executing marker for '{}'. Output:\n{}", - tool_name, - output - ); -} - -/// Assert that output contains a tool result marker. -/// -/// Verifies that the output contains the closing bracket (`└─`) followed -/// by the tool name, indicating a tool result was formatted. -#[allow(dead_code)] -pub fn assert_has_tool_result(output: &str, tool_name: &str) { - assert!( - output.contains(&format!("└─ {}", tool_name)), - "Output should contain tool result marker for '{}'. Output:\n{}", - tool_name, - output - ); -} diff --git a/crates/clemitui/tests/e2e_tests.rs b/crates/clemitui/tests/e2e_tests.rs deleted file mode 100644 index b66cc83..0000000 --- a/crates/clemitui/tests/e2e_tests.rs +++ /dev/null @@ -1,596 +0,0 @@ -//! PTY-based E2E tests for clemitui. -//! -//! These tests spawn the clemitui-demo binary in a pseudo-terminal and verify -//! the actual terminal output, including ANSI escape codes for colors. -//! -//! Run with: `cargo test -p clemitui --test e2e_tests` - -mod common; - -use common::strip_ansi; -use expectrl::{Session, session::OsProcess}; -use std::process::Command; -use std::time::Duration; - -/// Get the clemitui-demo binary path -fn demo_binary() -> String { - let debug_path = env!("CARGO_MANIFEST_DIR").to_string() + "/../../target/debug/clemitui-demo"; - if std::path::Path::new(&debug_path).exists() { - return debug_path; - } - // Fall back to release - env!("CARGO_MANIFEST_DIR").to_string() + "/../../target/release/clemitui-demo" -} - -/// Check if the demo binary exists -fn has_demo_binary() -> bool { - std::path::Path::new(&demo_binary()).exists() -} - -/// Spawn the demo binary with arguments -fn spawn_demo(args: &[&str]) -> Result, Box> { - let binary = demo_binary(); - let mut cmd = Command::new(&binary); - cmd.args(args); - let session = Session::spawn(cmd)?; - Ok(session) -} - -/// Read all output until EOF -fn read_until_eof(session: &mut Session) -> String { - use std::io::Read; - - session.set_expect_timeout(Some(Duration::from_secs(5))); - - let mut output = Vec::new(); - - // Read all available output using blocking read - loop { - let mut buf = [0u8; 4096]; - match session.read(&mut buf) { - Ok(0) => break, // EOF - Ok(n) => output.extend_from_slice(&buf[..n]), - Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => { - // No more data available, wait a bit and check for EOF - std::thread::sleep(Duration::from_millis(100)); - // Try once more - match session.read(&mut buf) { - Ok(0) => break, - Ok(n) => output.extend_from_slice(&buf[..n]), - Err(_) => break, - } - } - Err(_) => break, - } - } - - String::from_utf8_lossy(&output).to_string() -} - -// strip_ansi is imported from common module - -// ============================================================================= -// Tool Executing Tests -// ============================================================================= - -#[test] -fn test_tool_executing_basic() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found. Run `cargo build -p clemitui` first."); - return; - } - - let mut session = - spawn_demo(&["tool-executing", "bash", r#"{"command":"ls"}"#]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // Should contain tool name and opening bracket - assert!( - stripped.contains("bash"), - "Should contain tool name: {}", - stripped - ); - assert!( - stripped.contains("┌─"), - "Should contain opening bracket: {}", - stripped - ); - assert!( - stripped.contains("command="), - "Should contain args: {}", - stripped - ); -} - -#[test] -fn test_tool_executing_empty_args() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["tool-executing", "glob", "{}"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - assert!( - stripped.contains("glob"), - "Should contain tool name: {}", - stripped - ); - assert!( - stripped.contains("┌─"), - "Should contain opening bracket: {}", - stripped - ); -} - -// ============================================================================= -// Tool Result Tests -// ============================================================================= - -#[test] -fn test_tool_result_success() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["tool-result", "bash", "150", "100"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - assert!( - stripped.contains("bash"), - "Should contain tool name: {}", - stripped - ); - assert!( - stripped.contains("└─"), - "Should contain closing bracket: {}", - stripped - ); - assert!( - stripped.contains("0.15s"), - "Should contain duration: {}", - stripped - ); - assert!( - stripped.contains("100 tok"), - "Should contain tokens: {}", - stripped - ); -} - -#[test] -fn test_tool_result_with_error() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = - spawn_demo(&["tool-result", "bash", "50", "25", "error"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - assert!( - stripped.contains("bash"), - "Should contain tool name: {}", - stripped - ); - assert!( - stripped.contains("└─"), - "Should contain closing bracket: {}", - stripped - ); - // Error indicator should be present (either in color code or visible) -} - -// ============================================================================= -// TextBuffer Tests -// ============================================================================= - -#[test] -fn test_text_buffer_simple() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["text-buffer", "**Hello** world!"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // Should render the text (bold may be stripped but content should be there) - assert!( - stripped.contains("Hello"), - "Should contain 'Hello': {}", - stripped - ); - assert!( - stripped.contains("world"), - "Should contain 'world': {}", - stripped - ); -} - -#[test] -fn test_text_buffer_multiline() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["text-buffer-multiline"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // Should contain header - assert!( - stripped.contains("Header"), - "Should contain header: {}", - stripped - ); - // Should contain list items - assert!( - stripped.contains("Item 1"), - "Should contain list item: {}", - stripped - ); - // Should contain code - assert!( - stripped.contains("println"), - "Should contain code: {}", - stripped - ); -} - -#[test] -fn test_text_buffer_streaming() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["text-buffer-streaming"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // All streamed parts should be accumulated - assert!( - stripped.contains("Hello"), - "Should contain 'Hello': {}", - stripped - ); - assert!( - stripped.contains("world"), - "Should contain 'world': {}", - stripped - ); - assert!( - stripped.contains("streaming"), - "Should contain 'streaming': {}", - stripped - ); -} - -// ============================================================================= -// Context Warning Tests -// ============================================================================= - -#[test] -fn test_context_warning_normal() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = - spawn_demo(&["context-warning", "850000", "1000000"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // Should contain warning indicator and percentage - assert!( - stripped.contains("85.0%") || stripped.contains("context"), - "Should contain percentage or context warning: {}", - stripped - ); -} - -#[test] -fn test_context_warning_critical() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = - spawn_demo(&["context-warning", "950000", "1000000"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // Should contain critical warning (95%) - assert!( - stripped.contains("95.0%") || stripped.contains("context"), - "Should contain percentage: {}", - stripped - ); -} - -// ============================================================================= -// Error Formatting Tests -// ============================================================================= - -#[test] -fn test_error_detail() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["error-detail", "Connection refused"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - assert!( - stripped.contains("Connection refused"), - "Should contain error message: {}", - stripped - ); - assert!( - stripped.contains("└─") || stripped.contains("error"), - "Should have error formatting: {}", - stripped - ); -} - -#[test] -fn test_error_message() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["error-message", "File not found"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - assert!( - stripped.contains("File not found"), - "Should contain error: {}", - stripped - ); -} - -// ============================================================================= -// Retry Formatting Tests -// ============================================================================= - -#[test] -fn test_retry_format() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = - spawn_demo(&["retry", "2", "3", "rate limit exceeded"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - assert!( - stripped.contains("2") && stripped.contains("3"), - "Should contain attempt numbers: {}", - stripped - ); - assert!( - stripped.contains("rate limit"), - "Should contain reason: {}", - stripped - ); -} - -// ============================================================================= -// Ctrl-C and Cancelled Tests -// ============================================================================= - -#[test] -fn test_ctrl_c_message() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["ctrl-c"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // Should contain ctrl-c related message - assert!( - stripped.to_lowercase().contains("ctrl") - || stripped.to_lowercase().contains("cancel") - || stripped.to_lowercase().contains("interrupt"), - "Should contain ctrl-c message: {}", - stripped - ); -} - -#[test] -fn test_cancelled_message() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["cancelled"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - assert!( - stripped.to_lowercase().contains("cancel"), - "Should contain cancelled message: {}", - stripped - ); -} - -// ============================================================================= -// Logging Infrastructure Tests -// ============================================================================= - -#[test] -fn test_logging_output() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["logging"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // Should contain all logged messages - assert!( - stripped.contains("log event"), - "Should contain first log event: {}", - stripped - ); - assert!( - stripped.contains("log line"), - "Should contain log line: {}", - stripped - ); - assert!( - stripped.contains("Another"), - "Should contain another event: {}", - stripped - ); -} - -// ============================================================================= -// Tool Args Formatting Tests -// ============================================================================= - -#[test] -fn test_tool_args_complex() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["tool-args-complex"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // Should contain formatted args - assert!( - stripped.contains("command="), - "Should contain command arg: {}", - stripped - ); - assert!( - stripped.contains("echo hello"), - "Should contain command value: {}", - stripped - ); - // Long value should be truncated - assert!( - stripped.contains("...") || stripped.len() < 500, - "Long value should be truncated: {}", - stripped - ); -} - -#[test] -fn test_tool_args_edit_filtering() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = spawn_demo(&["tool-args-edit"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - let stripped = strip_ansi(&output); - - // Should contain file_path - assert!( - stripped.contains("file_path="), - "Should contain file_path: {}", - stripped - ); - // Should NOT expose old_string/new_string content (filtered for readability) - // The actual values should not appear in output - assert!( - !stripped.contains("original content here"), - "Should not expose old_string content: {}", - stripped - ); - assert!( - !stripped.contains("replacement content here"), - "Should not expose new_string content: {}", - stripped - ); -} - -// ============================================================================= -// ANSI Color Tests (verify colors are actually present) -// ============================================================================= - -#[test] -fn test_output_has_ansi_colors() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = - spawn_demo(&["tool-executing", "bash", r#"{"command":"ls"}"#]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - - // Should contain ANSI escape codes (color) - assert!( - output.contains("\x1b["), - "Output should contain ANSI escape codes for colors: {:?}", - output - ); -} - -#[test] -fn test_error_has_red_color() { - if !has_demo_binary() { - eprintln!("Skipping: demo binary not found"); - return; - } - - let mut session = - spawn_demo(&["tool-result", "bash", "50", "25", "error"]).expect("Failed to spawn"); - - let output = read_until_eof(&mut session); - - // Should contain ANSI escape codes - assert!( - output.contains("\x1b["), - "Error output should have color codes: {:?}", - output - ); -} diff --git a/src/main.rs b/src/main.rs index aaf8139..7bd2a59 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,8 +3,8 @@ use clap::Parser; use colored::Colorize; use genai_rs::Client; use reedline::{ - default_emacs_keybindings, EditCommand, Emacs, FileBackedHistory, KeyCode, KeyModifiers, - Prompt, PromptHistorySearch, Reedline, ReedlineEvent, Signal, kitty_protocol_available, + EditCommand, Emacs, FileBackedHistory, KeyCode, KeyModifiers, Prompt, PromptHistorySearch, + Reedline, ReedlineEvent, Signal, default_emacs_keybindings, kitty_protocol_available, }; use serde::Deserialize; use std::borrow::Cow;