diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5ffff9a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,21 @@ +## Thinking Path + + +## What Changed + + +## Verification + +- [ ] `cargo test` passes +- [ ] `cargo clippy -- -D warnings` clean +- [ ] `cargo fmt --check` clean + +## Risks + + +## Checklist +- [ ] Tests pass locally +- [ ] No new warnings from clippy +- [ ] Code is formatted with `cargo fmt` +- [ ] Commit messages follow conventional format +- [ ] Co-Authored-By trailer included for agent commits diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2010cdf..1405fe8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,36 @@ jobs: - name: test run: cargo test --workspace + benchmark: + name: Benchmark + needs: [test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + - name: Cache cargo + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-bench- + - name: Install jq + run: sudo apt-get update && sudo apt-get install -y jq + - name: Run benchmarks + run: bash benchmarks/run.sh + - name: Upload benchmark results + if: always() + uses: actions/upload-artifact@v4 + with: + name: benchmark-results + path: benchmark-results.json + security: name: Security Audit runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 4c37925..70b8693 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /target -Cargo.lock .env *.db *.db-shm diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 180c544..522ac2a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,7 +63,7 @@ Scopes: `core`, `tools`, `memory`, `cli`, `gateway`, `tui`, `paperclip`, `github ## Branching model ``` -main ← stable, protected — PRs from dev only, requires human approval +main ← stable, protected — PRs from dev only, merged autonomously when CI is green and review passes dev ← integration — PRs from feature/* only (no direct commits) feature/* ← new features fix/* ← bug fixes @@ -71,7 +71,7 @@ main ← stable, protected — PRs from dev only, requires human ap chore/* ← deps / CI / tooling ``` -All feature branches cut from `dev`. Open a PR to `dev`; `dev` → `main` requires board approval. +All feature branches cut from `dev`. Open a PR to `dev`; `dev` → `main` merges happen autonomously when all CI gates pass and review is complete. Squash-merge preferred for feature/* and fix/*; merge commit for larger milestones. ## Testing philosophy diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..a2b3c06 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,3905 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[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 = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +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.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[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 = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[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 = "axum" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +dependencies = [ + "async-trait", + "axum-core", + "base64", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sha1", + "sync_wrapper", + "tokio", + "tokio-tungstenite 0.24.0", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cassowary" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cc" +version = "1.2.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7a4d3ec6524d28a329fc53654bbadc9bdd7b0431f5d65f1a56ffb28a1ee5283" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1110bd8a634a1ab8cb04345d8d878267d57c3cf1b38d91b71af6686408bbca6a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "compact_str" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + +[[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 = "console" +version = "0.15.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" +dependencies = [ + "encode_unicode", + "libc", + "once_cell", + "unicode-width 0.2.2", + "windows-sys 0.59.0", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[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" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +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 = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[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.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" +dependencies = [ + "bitflags", + "crossterm_winapi", + "futures-core", + "libc", + "mio 0.8.11", + "parking_lot", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" +dependencies = [ + "bitflags", + "crossterm_winapi", + "mio 1.2.0", + "parking_lot", + "rustix 0.38.44", + "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 = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "data-encoding" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[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 = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "downcast" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +dependencies = [ + "serde", +] + +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[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 = "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 = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + +[[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 = "fastrand" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a043dc74da1e37d6afe657061213aa6f425f855399a11d3463c6ecccc4dfda1f" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "spin", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[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 = "fragile" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8878864ba14bb86e818a412bfd6f18f9eabd4ec0f008a28e8f7eb61db532fcf9" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", + "wasip3", +] + +[[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 = "harness-cli" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "clap", + "console", + "futures", + "harness-core", + "harness-evolution", + "harness-gateway", + "harness-memory", + "harness-paperclip", + "harness-tools", + "indicatif", + "serde", + "serde_json", + "tokio", + "tokio-test", + "toml", + "tracing", + "tracing-subscriber", + "uuid", +] + +[[package]] +name = "harness-core" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "futures", + "mockall", + "reqwest", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", + "tokio-test", + "toml", + "tracing", + "uuid", +] + +[[package]] +name = "harness-evolution" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "harness-core", + "harness-memory", + "serde", + "serde_json", + "sqlx", + "tempfile", + "thiserror 1.0.69", + "tokio", + "tokio-test", + "tracing", + "uuid", +] + +[[package]] +name = "harness-gateway" +version = "0.1.0" +dependencies = [ + "anyhow", + "axum", + "chrono", + "futures", + "reqwest", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", + "tokio-tungstenite 0.21.0", + "tower-http 0.5.2", + "tracing", + "uuid", +] + +[[package]] +name = "harness-github" +version = "0.1.0" +dependencies = [ + "anyhow", + "axum", + "harness-core", + "hex", + "hmac", + "reqwest", + "serde", + "serde_json", + "sha2", + "thiserror 1.0.69", + "tokio", + "tower-http 0.5.2", + "tracing", +] + +[[package]] +name = "harness-memory" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "harness-core", + "serde", + "serde_json", + "sqlx", + "tempfile", + "thiserror 1.0.69", + "tokio", + "tokio-test", + "tracing", + "uuid", +] + +[[package]] +name = "harness-paperclip" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "futures", + "reqwest", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", + "tracing", + "uuid", +] + +[[package]] +name = "harness-tools" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "dashmap", + "harness-core", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", + "tokio-test", + "tracing", +] + +[[package]] +name = "harness-tui" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "clap", + "crossterm 0.27.0", + "futures-util", + "ratatui", + "serde", + "serde_json", + "tokio", + "tokio-tungstenite 0.24.0", + "tracing", + "tracing-subscriber", + "uuid", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[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.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "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", +] + +[[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.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "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.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +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.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[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 = "indexmap" +version = "2.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a8a2b9cb3e0b0c1803dbb0758ffac5de2f425b23c28f518faabd9d805342ff" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "indicatif" +version = "0.17.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width 0.2.2", + "web-time", +] + +[[package]] +name = "indoc" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" +dependencies = [ + "rustversion", +] + +[[package]] +name = "instability" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf9fed6d91cfb734e7476a06bde8300a1b94e217e1b523b6f0cd1a01998c71d" +dependencies = [ + "darling", + "indoc", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "iri-string" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" +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.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e04e2ef80ce82e13552136fabeef8a5ed1f985a96805761cbb9a2c34e7664d9" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.184" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ddbf48fd451246b1f8c2610bd3b4ac0cc6e149d89832867093ab69a17194f08" +dependencies = [ + "bitflags", + "libc", + "plain", + "redox_syscall 0.7.3", +] + +[[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 = "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.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[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" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "mockall" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39a6bfcc6c8c7eed5ee98b9c3e33adc726054389233e201c95dab2d41a3839d2" +dependencies = [ + "cfg-if", + "downcast", + "fragile", + "mockall_derive", + "predicates", + "predicates-tree", +] + +[[package]] +name = "mockall_derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ca3004c2efe9011bd4e461bd8256445052b9615405b4f7ea43fc8ca5c20898" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[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-bigint-dig" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" +dependencies = [ + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[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.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "951c002c75e16ea2c65b8c7e4d3d51d5530d8dfa7d060b4776828c88cfb18ecf" +dependencies = [ + "bitflags", + "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.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "openssl-sys" +version = "0.9.112" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d55af3b3e226502be1526dfdba67ab0e9c96fc293004e79576b2b9edb0dbdb" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[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 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "portable-atomic" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "predicates" +version = "3.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ada8f2932f28a27ee7b70dd6c1c39ea0675c55a36879ab92f3a715eaa1e63cfe" +dependencies = [ + "anstyle", + "predicates-core", +] + +[[package]] +name = "predicates-core" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cad38746f3166b4031b1a0d39ad9f954dd291e7854fcc0eed52ee41a0b50d144" + +[[package]] +name = "predicates-tree" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0de1b847b39c8131db0467e9df1ff60e6d0562ab8e9a16e568ad0fdb372e2f2" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[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", +] + +[[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 = "ratatui" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdef7f9be5c0122f890d58bdf4d964349ba6a6161f705907526d891efabba57d" +dependencies = [ + "bitflags", + "cassowary", + "compact_str", + "crossterm 0.28.1", + "instability", + "itertools", + "lru", + "paste", + "strum", + "strum_macros", + "unicode-segmentation", + "unicode-truncate", + "unicode-width 0.1.14", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_syscall" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[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", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower", + "tower-http 0.6.8", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", +] + +[[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 = "rsa" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" +dependencies = [ + "once_cell", + "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 = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8279bb85272c9f10811ae6a6c547ff594d6a7f3c6c6b02ee9726d1d0dcfcdd06" +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.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[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_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_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[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 = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[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 0.8.11", + "mio 1.2.0", + "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 = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlx" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" +dependencies = [ + "base64", + "bytes", + "chrono", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashbrown 0.15.5", + "hashlink", + "indexmap", + "log", + "memchr", + "native-tls", + "once_cell", + "percent-encoding", + "serde", + "serde_json", + "sha2", + "smallvec", + "thiserror 2.0.18", + "tokio", + "tokio-stream", + "tracing", + "url", + "uuid", +] + +[[package]] +name = "sqlx-macros" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" +dependencies = [ + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" +dependencies = [ + "atoi", + "base64", + "bitflags", + "byteorder", + "bytes", + "chrono", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror 2.0.18", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" +dependencies = [ + "atoi", + "base64", + "bitflags", + "byteorder", + "chrono", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror 2.0.18", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" +dependencies = [ + "atoi", + "chrono", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "serde_urlencoded", + "sqlx-core", + "thiserror 2.0.18", + "tracing", + "url", + "uuid", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[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" +dependencies = [ + "strum_macros", +] + +[[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 = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +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 = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "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.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.2", + "once_cell", + "rustix 1.1.4", + "windows-sys 0.61.2", +] + +[[package]] +name = "termtree" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" + +[[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.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[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.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +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.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd1c4c0fc4a7ab90fc15ef6daaa3ec3b893f004f915f2392557ed23237820cd" +dependencies = [ + "bytes", + "libc", + "mio 1.2.0", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +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-stream" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-test" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6d24790a10a7af737693a3e8f1d03faef7e6ca0cc99aae5066f533766de545" +dependencies = [ + "futures-core", + "tokio", + "tokio-stream", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.21.0", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" +dependencies = [ + "futures-util", + "log", + "native-tls", + "tokio", + "tokio-native-tls", + "tungstenite 0.24.0", +] + +[[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-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", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +dependencies = [ + "bitflags", + "bytes", + "http", + "http-body", + "http-body-util", + "pin-project-lite", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags", + "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 = [ + "log", + "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", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand", + "sha1", + "thiserror 1.0.69", + "url", + "utf-8", +] + +[[package]] +name = "tungstenite" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "native-tls", + "rand", + "sha1", + "thiserror 1.0.69", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-segmentation" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" + +[[package]] +name = "unicode-truncate" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" +dependencies = [ + "itertools", + "unicode-segmentation", + "unicode-width 0.1.14", +] + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[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 = "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 = "uuid" +version = "1.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9" +dependencies = [ + "getrandom 0.4.2", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[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 = "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 = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03623de6905b7206edd0a75f69f747f134b7f0a2323392d664448bf2d3c5d87e" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[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 = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd70027e39b12f0849461e08ffc50b9cd7688d942c1c8e3c7b22273236b4dd0a" +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 = "whoami" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" +dependencies = [ + "libredox", + "wasite", +] + +[[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-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[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.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[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", + "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_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_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_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_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[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_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_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_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 = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml index bcf6835..8072f38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,76 +1,80 @@ -[workspace] -members = ["crates/*"] -resolver = "2" - -[workspace.package] -version = "0.1.0" -edition = "2021" -authors = ["paperclip-harness contributors"] -license = "MIT OR Apache-2.0" -rust-version = "1.75" - -[workspace.dependencies] -# Async runtime -tokio = { version = "1", features = ["full"] } -tokio-util = "0.7" -futures = "0.3" -async-trait = "0.1" - -# Serialization -serde = { version = "1", features = ["derive"] } -serde_json = "1" -toml = "0.8" - -# Error handling -anyhow = "1" -thiserror = "1" - -# Logging / tracing -tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] } - -# CLI -clap = { version = "4", features = ["derive", "env"] } - -# HTTP server -axum = { version = "0.7", features = ["ws"] } -tower = "0.4" -tower-http = { version = "0.5", features = ["cors", "trace"] } - -# HTTP client (LLM API) -reqwest = { version = "0.12", features = ["json", "stream"] } - -# Database -sqlx = { version = "0.8", features = ["runtime-tokio-native-tls", "sqlite", "uuid", "chrono"] } - -# Utilities -uuid = { version = "1", features = ["v4", "serde"] } -chrono = { version = "0.4", features = ["serde"] } -dashmap = "5" - -# Workspace crates -harness-core = { path = "crates/core" } -harness-tools = { path = "crates/tools" } -harness-memory = { path = "crates/memory" } - -[profile.release] -lto = true -codegen-units = 1 -strip = true - -[profile.dev] -opt-level = 0 -debug = true - -[workspace.lints.rust] -unsafe_code = "forbid" -unused_imports = "warn" -unused_variables = "warn" -dead_code = "warn" - -[workspace.lints.clippy] -all = "warn" -pedantic = "warn" -unwrap_used = "warn" -expect_used = "warn" -panic = "warn" +[workspace] +members = ["crates/*"] +resolver = "2" + +[workspace.package] +version = "0.1.0" +edition = "2021" +authors = ["anvil contributors"] +license = "MIT OR Apache-2.0" +rust-version = "1.75" + +[workspace.dependencies] +# Async runtime +tokio = { version = "1", features = ["full"] } +tokio-util = "0.7" +futures = "0.3" +async-trait = "0.1" + +# Serialization +serde = { version = "1", features = ["derive"] } +serde_json = "1" +toml = "0.8" + +# Error handling +anyhow = "1" +thiserror = "1" + +# Logging / tracing +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] } + +# CLI +clap = { version = "4", features = ["derive", "env"] } + +# HTTP server +axum = { version = "0.7", features = ["ws"] } +tower = "0.4" +tower-http = { version = "0.5", features = ["cors", "trace"] } + +# HTTP client (LLM API) +reqwest = { version = "0.12", features = ["json", "stream"] } + +# Database +sqlx = { version = "0.8", features = ["runtime-tokio-native-tls", "sqlite", "uuid", "chrono"] } + +# Utilities +uuid = { version = "1", features = ["v4", "serde"] } +chrono = { version = "0.4", features = ["serde"] } +dashmap = "5" + +# Workspace crates +harness-core = { path = "crates/core" } +harness-tools = { path = "crates/tools" } +harness-memory = { path = "crates/memory" } +harness-github = { path = "crates/github" } +harness-paperclip = { path = "crates/paperclip" } +harness-evolution = { path = "crates/evolution" } +harness-gateway = { path = "crates/gateway" } + +[profile.release] +lto = true +codegen-units = 1 +strip = true + +[profile.dev] +opt-level = 0 +debug = true + +[workspace.lints.rust] +unsafe_code = "forbid" +unused_imports = "warn" +unused_variables = "warn" +dead_code = "warn" + +[workspace.lints.clippy] +all = "warn" +pedantic = "warn" +unwrap_used = "warn" +expect_used = "warn" +panic = "warn" diff --git a/README.md b/README.md index 3efbc00..f2bf44f 100644 --- a/README.md +++ b/README.md @@ -118,10 +118,15 @@ export PAPERCLIP_API_KEY=... export PAPERCLIP_API_URL=http://localhost:3100 anvil paperclip --agent-id --company-id +# Dogfood artifact freshness check (use before sharing target/debug binaries) +cargo build -p harness-cli +./target/debug/anvil --help | grep paperclip +./target/debug/anvil paperclip --help + # Search episodic memory anvil memory search "recent goals" -# Check your config +# Check config + native build prerequisites (cc, pkg-config, openssl) anvil config --check ``` @@ -216,6 +221,40 @@ This harness is informed by studying the best open-source agent frameworks: --- +## Development Philosophy + +**Purpose:** Anvil is a testing and evaluation infrastructure harness — the forge where agent capabilities are built, measured, and proven. + +### Evolution Workflow + +Anvil evolves through usage, not roadmaps: + +1. **Use** — Run Anvil in real agent workflows. Observe what works and what breaks. +2. **Journal** — Record friction, failures, and surprises as structured feedback. +3. **Derive** — Convert feedback into concrete issues with measurable acceptance criteria. +4. **Branch** — Implement on feature branches. One concern per branch. +5. **Benchmark** — CI runs the benchmark suite on every PR. Scores are emitted as `benchmark-results.json` in a standard format. +6. **Merge** — Only merge when benchmarks confirm the change improves (or at minimum does not regress) the overall score. + +### Branch Model + +Anvil uses long-lived branches with benchmark-driven pruning: + +1. **Develop parallel branches** — Multiple approaches to the same problem can coexist. +2. **Evaluate and compare** — The same benchmark suite runs on each branch for side-by-side comparison. +3. **Pick winner / drop loser** — Higher benchmark score wins. The losing branch is cancelled. +4. **Release candidate** — The winner is promoted to an RC for final validation. +5. **Merge to main** — Only after RC passes all gates. + +### Benchmark-Driven Merge Decisions + +- PRs that regress the overall score below threshold are blocked. +- When competing branches solve the same problem, CI compares their scores and recommends the winner. +- Post-merge regressions trigger revert recommendations. +- Benchmark history is tracked via CI artifacts for trend analysis. + +--- + ## Contributing ### Who this is for @@ -249,6 +288,39 @@ cargo fmt --check cargo audit ``` +### Testing with the echo provider + +The `EchoProvider` enables full end-to-end testing without any LLM API key or credits: + +```bash +# Run the agent loop with the echo provider (mirrors input back) +anvil run --provider echo --goal "test task" + +# Run the full integration test suite (uses echo provider, no API key needed) +cargo test -p harness-cli --test echo_integration +``` + +**Scripted tool calls:** For tests that need deterministic tool-call behaviour, +use `EchoProvider::scripted()` to queue tool calls that are emitted in order +before falling back to the normal echo response: + +```rust +use harness_core::provider::{EchoProvider, ScriptedToolCall}; + +let provider = EchoProvider::scripted(vec![ + ScriptedToolCall { + id: "call-1".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "ping"}), + }, +]); +// First provider call returns ToolUse; subsequent calls echo normally. +``` + +Integration tests live in `crates/cli/tests/echo_integration.rs` and cover: +plain echo, scripted tool dispatch, max-iteration caps, memory persistence, +and named-session continuity. + ### Commit style Follow [Conventional Commits](https://www.conventionalcommits.org/): diff --git a/TOOLS.md b/TOOLS.md index 1c6eb8a..0d58a4f 100644 --- a/TOOLS.md +++ b/TOOLS.md @@ -18,26 +18,61 @@ Brand Artist monitors `/claude-public/` for new skills and updates this file per All production assets live in `assets/`. Source of truth is the SVG files — do not commit rasterized versions as primary assets. -| File | Purpose | Last updated | -|------|---------|--------------| -| `assets/anvil.svg` | App icon — dark bg, ember glow | 2026-04-04 | -| `assets/anvil-icon.svg` | Standalone icon variant | 2026-04-04 | -| `assets/anvil-logo.svg` | Logo mark | 2026-04-04 | -| `assets/anvil-lockup.svg` | Horizontal lockup — icon + wordmark | 2026-04-04 | -| `assets/anvil-mascot.svg` | Brand character / mascot | 2026-04-04 | +### Icons & App + +| File | Purpose | viewBox | Last updated | +|------|---------|---------|--------------| +| `assets/anvil.svg` | App icon — dark bg, ember glow, graceful horn | 200×200 | 2026-04-10 | +| `assets/anvil-icon.svg` | Compact icon variant (small UI use) | 64×64 | 2026-04-04 | +| `assets/anvil-light.svg` | Light-mode app icon — warm-white bg | 200×200 | 2026-04-10 | +| `assets/anvil-mono.svg` | Monochrome — transparent bg, `currentColor` fill | 200×200 | 2026-04-10 | +| `assets/anvil-favicon.svg` | Favicon — bold simplified silhouette | 32×32 | 2026-04-10 | + +### Lockups + +| File | Purpose | viewBox | Notes | +|------|---------|---------|-------| +| `assets/anvil-logo.svg` | **Primary lockup** — icon + wordmark, dark bg, fixed stroke `#d8d8d8` | 280×80 | Use on dark surfaces | +| `assets/anvil-lockup.svg` | **Alternative lockup** — icon + wordmark, `currentColor` strokes | 260×80 | Adapts to light/dark context | + +### Marketing & Social + +| File | Purpose | viewBox | Last updated | +|------|---------|---------|--------------| +| `assets/anvil-social.svg` | Open Graph / Twitter Card | 1200×630 | 2026-04-10 | +| `assets/anvil-github-avatar.svg` | GitHub org / profile avatar | 400×400 | 2026-04-10 | +| `assets/anvil-mascot.svg` | Brand character "Anvi" | 200×200 | 2026-04-10 | ### Design tokens | Token | Value | Usage | |-------|-------|-------| -| Background | `#1c1c1c` / `#151515` | Icon dark bg | -| Steel light | `#8a8a8a` | Anvil top face highlight | -| Steel mid | `#585858` | Anvil body mid | -| Steel dark | `#363636` | Anvil body shadow | -| Ember orange | `#ff7200` | Glow line center | -| Ember edge | `#ff5500` | Glow line edges | -| Ember fade | `#b03000` | Glow line outer fade | -| Brand cyan | `console::style().cyan()` | Terminal UI | +| Background (dark) | `#1e1e1e` → `#111111` | App icon dark bg radial gradient | +| Background (light) | `#f5f5f0` → `#e8e8e2` | Light-mode icon bg | +| Steel highlight | `#909090` | Anvil top face, brightest | +| Steel mid-light | `#747474` | Anvil body upper | +| Steel mid-dark | `#555555` | Anvil body lower | +| Steel shadow | `#3a3a3a` | Anvil bottom / feet | +| Ember hot | `#ff9900` | Ember gradient center | +| Ember warm | `#ff7700` | Ember gradient mid | +| Ember edge | `#ff4400` | Ember gradient edge | +| Ember halo | `#ff5500` | Ambient halo fill | +| Hardy hole | `#111111` | Deep shadow socket | +| Mascot dark metal | `#252525` → `#444444` | Mascot body gradient | +| Mascot highlight | `#909090` | Mascot face stripe / eyebrows | +| Mascot pupil | `#0d0d0d` | Mascot eye pupils | +| Blush | `#E07070` opacity 0.35 | Mascot cheek circles | +| Brand orange (CLI) | `\033[38;5;202m` | Terminal ANSI (256-color) | + +### Usage guidelines + +- **Dark context** → use `anvil.svg`, `anvil-logo.svg` +- **Light context** → use `anvil-light.svg`; or `anvil-lockup.svg` (currentColor → set to dark) +- **Monochrome** (print, emboss, watermark) → use `anvil-mono.svg` with `color: #000` or `color: #fff` +- **Favicon** → use `anvil-favicon.svg` (also works as `.ico` by wrapping in an ``) +- **Social preview** → `anvil-social.svg` export to PNG at 1200×630 for OG tags +- **GitHub** → `anvil-github-avatar.svg` export to PNG at 400×400 for org avatar +- **Mascot** → `anvil-mascot.svg` for docs, changelogs, or any place needing a friendly brand character --- @@ -45,7 +80,7 @@ All production assets live in `assets/`. Source of truth is the SVG files — do | Skill | Path | Purpose | |-------|------|---------| -| svg-create | `.claude/skills/svg-create/` | SVG asset creation helper (deprecated by Brand Artist direct authoring) | +| svg-create | `.claude/skills/svg-create/` | SVG asset creation helper | --- @@ -53,4 +88,4 @@ All production assets live in `assets/`. Source of truth is the SVG files — do `/claude-public/` — shared skill directory. Brand Artist checks this directory each heartbeat for new asset-generation or design skills and updates this table when relevant skills are found. -*Last checked: 2026-04-04 — directory not yet present in this environment.* +*Last checked: 2026-04-10 — directory not yet present in this environment.* diff --git a/assets/anvil-favicon.svg b/assets/anvil-favicon.svg new file mode 100644 index 0000000..e8b0b9b --- /dev/null +++ b/assets/anvil-favicon.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/anvil-github-avatar.svg b/assets/anvil-github-avatar.svg new file mode 100644 index 0000000..843937d --- /dev/null +++ b/assets/anvil-github-avatar.svg @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/anvil-light.svg b/assets/anvil-light.svg new file mode 100644 index 0000000..cf61258 --- /dev/null +++ b/assets/anvil-light.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/anvil-mascot.svg b/assets/anvil-mascot.svg index 32cd298..3e2672c 100644 --- a/assets/anvil-mascot.svg +++ b/assets/anvil-mascot.svg @@ -3,20 +3,20 @@ anvil-mascot.svg — "Anvi" the Anvil character Personified anvil: strong, clever, approachable. Works at 200×200 and scales up cleanly. - Palette: #2D3748 body, #4A5568 face/top, #718096 highlights - white eyes, #1A202C pupils, #E07070 blush cheeks + Palette: warm dark-metal — #252525 body, #444444 face/top, #909090 highlights + white eyes, #0d0d0d pupils, #E07070 blush cheeks --> - + - - - + + + - - + + @@ -27,7 +27,7 @@ - + - + - + + stroke="#909090" stroke-width="2.5" stroke-linecap="round" opacity="0.65"/> - + - + - + + stroke="#1a1a1a" stroke-width="14" stroke-linecap="round" fill="none"/> + stroke="#1a1a1a" stroke-width="14" stroke-linecap="round" fill="none"/> - + - + @@ -88,9 +88,9 @@ + stroke="#909090" stroke-width="3.5" stroke-linecap="round" fill="none"/> + stroke="#909090" stroke-width="3.5" stroke-linecap="round" fill="none"/> + + + + + diff --git a/assets/anvil-social.svg b/assets/anvil-social.svg new file mode 100644 index 0000000..6e5da74 --- /dev/null +++ b/assets/anvil-social.svg @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AI AGENT PLATFORM + diff --git a/assets/anvil.svg b/assets/anvil.svg index d0538c5..044202c 100644 --- a/assets/anvil.svg +++ b/assets/anvil.svg @@ -1,40 +1,30 @@ - - - - - - - - + + + - - - - @@ -44,8 +34,6 @@ - - @@ -54,94 +42,68 @@ - - - - - - - - - - - - - + - - - - - - + - - - - - + + + + + - - - - - + - - - diff --git a/benchmarks/README.md b/benchmarks/README.md new file mode 100644 index 0000000..ce4e19d --- /dev/null +++ b/benchmarks/README.md @@ -0,0 +1,32 @@ +# Anvil Benchmark Suite + +Measures build reliability, performance, and artifact correctness for every commit. + +## Metrics + +| Metric | What it measures | Perfect | Zero | Weight | +|---|---|---|---|---| +| `check_time` | `cargo check --workspace` duration | <= 30s | >= 120s | 0.10 | +| `build_time` | `cargo build --workspace` duration | <= 120s | >= 600s | 0.20 | +| `test_pass_rate` | Fraction of tests passing | 1.0 | 0.0 | 0.40 | +| `clippy_clean` | `cargo clippy -- -D warnings` passes | clean | any warning | 0.15 | +| `fmt_clean` | `cargo fmt --check` passes | clean | any diff | 0.10 | +| `binary_size` | Size of compiled binary | <= 50 MB | >= 200 MB | 0.05 | + +**Overall** = weighted average of all scores. The benchmark **passes** if overall >= 0.7. + +## Running locally + +```bash +bash benchmarks/run.sh +``` + +Results are written to `benchmark-results.json` in the repo root. + +The script requires a Rust toolchain (`cargo`, `rustfmt`, `clippy`) and optionally `jq` for +prettier JSON output. Exit code is 0 on pass, 1 on fail. + +## CI integration + +The benchmark runs automatically in the GitHub Actions CI workflow as a `benchmark` job +after tests pass. The `benchmark-results.json` file is uploaded as a workflow artifact. diff --git a/benchmarks/run.sh b/benchmarks/run.sh new file mode 100755 index 0000000..c76165f --- /dev/null +++ b/benchmarks/run.sh @@ -0,0 +1,254 @@ +#!/usr/bin/env bash +# benchmarks/run.sh — Anvil build-quality benchmark suite +# Measures build reliability, performance, and artifact correctness. +# Outputs benchmark-results.json in the repo root. +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +cd "$REPO_ROOT" + +COMMIT="$(git rev-parse HEAD 2>/dev/null || echo "unknown")" +TIMESTAMP="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" + +############################################################################### +# Helpers +############################################################################### + +elapsed() { + # Portable seconds-level timer using bash SECONDS + echo "$SECONDS" +} + +# normalize: value, perfect_threshold, zero_threshold -> score in [0,1] +normalize() { + local val="$1" perfect="$2" zero="$3" + if command -v bc >/dev/null 2>&1; then + bc -l <= z) 0.0 else (z - v) / (z - p) +EOF + else + # Pure-bash fallback (integer approximation) + if [ "$val" -le "$perfect" ] 2>/dev/null; then + echo "1.0" + elif [ "$val" -ge "$zero" ] 2>/dev/null; then + echo "0.0" + else + # linear interpolation with awk + awk -v v="$val" -v p="$perfect" -v z="$zero" 'BEGIN { printf "%.4f", (z - v) / (z - p) }' + fi + fi +} + +# Trim whitespace from a value +trim() { + echo "$1" | tr -d '[:space:]' +} + +############################################################################### +# 1. cargo check +############################################################################### + +echo "==> cargo check --workspace" +SECONDS=0 +if cargo check --workspace 2>&1; then + CHECK_OK=1 +else + CHECK_OK=0 +fi +CHECK_TIME=$SECONDS +echo " check completed in ${CHECK_TIME}s" + +############################################################################### +# 2. cargo build +############################################################################### + +echo "==> cargo build --workspace" +SECONDS=0 +if cargo build --workspace 2>&1; then + BUILD_OK=1 +else + BUILD_OK=0 +fi +BUILD_TIME=$SECONDS +echo " build completed in ${BUILD_TIME}s" + +############################################################################### +# 3. cargo test +############################################################################### + +echo "==> cargo test --workspace" +TEST_OUTPUT="$(cargo test --workspace 2>&1)" || true +echo "$TEST_OUTPUT" + +# Parse test summary line: "test result: ok. X passed; Y failed; Z ignored; ..." +TOTAL_PASSED=0 +TOTAL_FAILED=0 +while IFS= read -r line; do + if echo "$line" | grep -qE '^test result:'; then + p=$(echo "$line" | grep -oE '[0-9]+ passed' | grep -oE '[0-9]+' || echo 0) + f=$(echo "$line" | grep -oE '[0-9]+ failed' | grep -oE '[0-9]+' || echo 0) + TOTAL_PASSED=$((TOTAL_PASSED + p)) + TOTAL_FAILED=$((TOTAL_FAILED + f)) + fi +done <<< "$TEST_OUTPUT" + +TOTAL_TESTS=$((TOTAL_PASSED + TOTAL_FAILED)) +if [ "$TOTAL_TESTS" -gt 0 ]; then + TEST_PASS_RATE=$(awk -v p="$TOTAL_PASSED" -v t="$TOTAL_TESTS" 'BEGIN { printf "%.4f", p / t }') +else + # No tests found; treat as 0 + TEST_PASS_RATE="0.0" +fi +echo " tests: $TOTAL_PASSED passed, $TOTAL_FAILED failed (rate: $TEST_PASS_RATE)" + +############################################################################### +# 4. cargo clippy +############################################################################### + +echo "==> cargo clippy --workspace -- -D warnings" +if cargo clippy --workspace --all-targets -- -D warnings 2>&1; then + CLIPPY_CLEAN="1.0" +else + CLIPPY_CLEAN="0.0" +fi +echo " clippy_clean: $CLIPPY_CLEAN" + +############################################################################### +# 5. cargo fmt --check +############################################################################### + +echo "==> cargo fmt --check" +if cargo fmt --all -- --check 2>&1; then + FMT_CLEAN="1.0" +else + FMT_CLEAN="0.0" +fi +echo " fmt_clean: $FMT_CLEAN" + +############################################################################### +# 6. Binary size +############################################################################### + +echo "==> measuring binary size" +# Look for release binary first, then debug +BIN_PATH="" +if [ -d "target/release" ]; then + BIN_PATH="$(find target/release -maxdepth 1 -type f -executable ! -name '*.d' ! -name '*.so' | head -1 || true)" +fi +if [ -z "$BIN_PATH" ] && [ -d "target/debug" ]; then + BIN_PATH="$(find target/debug -maxdepth 1 -type f -executable ! -name '*.d' ! -name '*.so' ! -name 'build-script-build' | head -1 || true)" +fi + +BINARY_SIZE_BYTES=0 +if [ -n "$BIN_PATH" ] && [ -f "$BIN_PATH" ]; then + BINARY_SIZE_BYTES=$(stat -c%s "$BIN_PATH" 2>/dev/null || stat -f%z "$BIN_PATH" 2>/dev/null || echo 0) + echo " binary: $BIN_PATH ($BINARY_SIZE_BYTES bytes)" +else + echo " no binary found; scoring binary_size as 1.0" +fi + +############################################################################### +# 7. Compute scores +############################################################################### + +# Normalize times +CHECK_SCORE=$(trim "$(normalize "$CHECK_TIME" 30 120)") +BUILD_SCORE=$(trim "$(normalize "$BUILD_TIME" 120 600)") + +# Binary size score: under 50MB = 1.0, linear decay to 0 at 200MB +if [ "$BINARY_SIZE_BYTES" -eq 0 ] 2>/dev/null; then + BINARY_SCORE="1.0" +else + BINARY_MB=$(awk -v b="$BINARY_SIZE_BYTES" 'BEGIN { printf "%.2f", b / 1048576 }') + BINARY_SCORE=$(trim "$(normalize "$BINARY_MB" 50 200)") +fi + +# Weighted overall: test_pass_rate: 0.4, build_time: 0.2, clippy: 0.15, +# check_time: 0.1, fmt: 0.1, binary_size: 0.05 +OVERALL=$(awk -v tr="$TEST_PASS_RATE" -v cl="$CLIPPY_CLEAN" -v fm="$FMT_CLEAN" \ + -v bs="$BUILD_SCORE" -v cs="$CHECK_SCORE" -v bn="$BINARY_SCORE" \ + 'BEGIN { printf "%.4f", tr*0.4 + cl*0.15 + fm*0.1 + bs*0.2 + cs*0.1 + bn*0.05 }') + +# Pass if overall >= 0.7 +PASS=false +if awk -v ov="$OVERALL" 'BEGIN { exit (ov >= 0.7) ? 0 : 1 }'; then + PASS=true +fi + +echo "" +echo "==> Scores" +echo " check_time: $CHECK_SCORE (${CHECK_TIME}s)" +echo " build_time: $BUILD_SCORE (${BUILD_TIME}s)" +echo " test_pass_rate: $TEST_PASS_RATE ($TOTAL_PASSED/$TOTAL_TESTS)" +echo " clippy_clean: $CLIPPY_CLEAN" +echo " fmt_clean: $FMT_CLEAN" +echo " binary_size: $BINARY_SCORE (${BINARY_SIZE_BYTES} bytes)" +echo " overall: $OVERALL" +echo " pass: $PASS" + +############################################################################### +# 8. Write JSON +############################################################################### + +OUTPUT="$REPO_ROOT/benchmark-results.json" + +if command -v jq >/dev/null 2>&1; then + jq -n \ + --arg repo "anvil" \ + --arg commit "$COMMIT" \ + --arg ts "$TIMESTAMP" \ + --argjson check_score "$CHECK_SCORE" \ + --argjson build_score "$BUILD_SCORE" \ + --argjson test_rate "$TEST_PASS_RATE" \ + --argjson clippy "$CLIPPY_CLEAN" \ + --argjson fmt "$FMT_CLEAN" \ + --argjson binsize "$BINARY_SCORE" \ + --argjson overall "$OVERALL" \ + --argjson pass "$PASS" \ + --argjson check_time "$CHECK_TIME" \ + --argjson build_time "$BUILD_TIME" \ + --argjson binary_bytes "$BINARY_SIZE_BYTES" \ + '{ + repo: $repo, + commit: $commit, + timestamp: $ts, + scores: [ + { name: "check_time", value: $check_score, unit: "ratio", raw_seconds: $check_time }, + { name: "build_time", value: $build_score, unit: "ratio", raw_seconds: $build_time }, + { name: "test_pass_rate", value: $test_rate, unit: "ratio" }, + { name: "clippy_clean", value: $clippy, unit: "ratio" }, + { name: "fmt_clean", value: $fmt, unit: "ratio" }, + { name: "binary_size", value: $binsize, unit: "ratio", raw_bytes: $binary_bytes } + ], + overall: $overall, + pass: $pass + }' > "$OUTPUT" +else + printf '{\n' > "$OUTPUT" + printf ' "repo": "anvil",\n' >> "$OUTPUT" + printf ' "commit": "%s",\n' "$COMMIT" >> "$OUTPUT" + printf ' "timestamp": "%s",\n' "$TIMESTAMP" >> "$OUTPUT" + printf ' "scores": [\n' >> "$OUTPUT" + printf ' { "name": "check_time", "value": %s, "unit": "ratio" },\n' "$CHECK_SCORE" >> "$OUTPUT" + printf ' { "name": "build_time", "value": %s, "unit": "ratio" },\n' "$BUILD_SCORE" >> "$OUTPUT" + printf ' { "name": "test_pass_rate", "value": %s, "unit": "ratio" },\n' "$TEST_PASS_RATE" >> "$OUTPUT" + printf ' { "name": "clippy_clean", "value": %s, "unit": "ratio" },\n' "$CLIPPY_CLEAN" >> "$OUTPUT" + printf ' { "name": "fmt_clean", "value": %s, "unit": "ratio" },\n' "$FMT_CLEAN" >> "$OUTPUT" + printf ' { "name": "binary_size", "value": %s, "unit": "ratio" }\n' "$BINARY_SCORE" >> "$OUTPUT" + printf ' ],\n' >> "$OUTPUT" + printf ' "overall": %s,\n' "$OVERALL" >> "$OUTPUT" + printf ' "pass": %s\n' "$PASS" >> "$OUTPUT" + printf '}\n' >> "$OUTPUT" +fi + +echo "" +echo "==> Results written to $OUTPUT" + +if [ "$PASS" = "true" ]; then + echo "BENCHMARK PASSED (overall: $OVERALL)" + exit 0 +else + echo "BENCHMARK FAILED (overall: $OVERALL < 0.7)" + exit 1 +fi diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 71d0f99..17174f6 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -4,6 +4,10 @@ version.workspace = true edition.workspace = true license.workspace = true +[lib] +name = "harness_cli" +path = "src/lib.rs" + [[bin]] name = "anvil" path = "src/main.rs" @@ -11,14 +15,16 @@ path = "src/main.rs" [features] evolution = ["dep:harness-evolution"] -[dependencies] -harness-core = { workspace = true } -harness-tools = { workspace = true } -harness-memory = { workspace = true } -harness-evolution = { path = "../evolution", optional = true } -tokio = { workspace = true } -futures = { workspace = true } -clap = { workspace = true } +[dependencies] +harness-core = { workspace = true } +harness-tools = { workspace = true } +harness-memory = { workspace = true } +harness-paperclip = { workspace = true } +harness-gateway = { workspace = true } +harness-evolution = { path = "../evolution", optional = true } +tokio = { workspace = true } +futures = { workspace = true } +clap = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } anyhow = { workspace = true } diff --git a/crates/cli/src/commands/config.rs b/crates/cli/src/commands/config.rs index 4daee88..22e8e7a 100644 --- a/crates/cli/src/commands/config.rs +++ b/crates/cli/src/commands/config.rs @@ -1,26 +1,317 @@ -use clap::Args; -use harness_core::config::Config; - -#[derive(Args)] -pub struct ConfigArgs { - /// Show resolved API key presence - #[arg(long)] - pub check: bool, -} - -pub async fn execute(args: ConfigArgs) -> anyhow::Result<()> { - let config = Config::load()?; - println!("Provider: {}", config.provider.backend); - println!("Model: {}", config.provider.model); - println!("Max tokens: {}", config.provider.max_tokens); - println!("Memory DB: {}", config.memory.db_path.display()); - println!("Agent name: {}", config.agent.name); - - if args.check { - match config.resolved_api_key() { - Some(_) => println!("API key: [set]"), - None => println!("API key: [NOT SET] ← set ANTHROPIC_API_KEY"), - } - } - Ok(()) -} +use clap::Args; +use harness_core::config::Config; +use std::{ + env, + path::{Path, PathBuf}, + process::Command, +}; + +#[derive(Args)] +pub struct ConfigArgs { + /// Verify provider connectivity (not just static config) + #[arg(long)] + pub check: bool, +} + +pub async fn execute(args: ConfigArgs) -> anyhow::Result<()> { + let config = Config::load()?; + println!("Provider: {}", config.provider.backend); + println!("Model: {}", config.provider.model); + println!("Max tokens: {}", config.provider.max_tokens); + println!("Memory DB: {}", config.memory.db_path.display()); + println!("Agent name: {}", config.agent.name); + + if args.check { + check_api_key(&config); + check_native_build_prerequisites(); + check_connectivity(&config).await; + } + Ok(()) +} + +fn check_api_key(config: &Config) { + match config.resolved_api_key() { + Some(_) => println!("API key: [set]"), + None => println!("API key: [NOT SET] <- set ANTHROPIC_API_KEY"), + } +} + +async fn check_connectivity(config: &Config) { + use harness_core::{ + message::Message, + provider::{EchoProvider, Provider}, + providers::{ClaudeCodeProvider, ClaudeProvider}, + }; + use std::sync::Arc; + use std::time::Instant; + + let backend = &config.provider.backend; + + let provider: Result, String> = match backend.as_str() { + "echo" => Ok(Arc::new(EchoProvider::new())), + "claude-code" | "cc" => Ok(Arc::new(ClaudeCodeProvider::new(&config.provider.model))), + _ => ClaudeProvider::from_env(&config.provider.model, config.provider.max_tokens) + .map(|p| Arc::new(p) as Arc) + .map_err(|e| e.to_string()), + }; + + let provider = match provider { + Ok(p) => p, + Err(e) => { + println!("Connectivity: FAILED (cannot create provider: {e})"); + return; + } + }; + + print!("Connectivity: checking..."); + let _ = std::io::Write::flush(&mut std::io::stdout()); + + let start = Instant::now(); + let ping = vec![Message::user("ping")]; + match provider.complete(&ping).await { + Ok(resp) => { + let elapsed = start.elapsed(); + print!("\r"); + println!("Connectivity: OK ({} -- {:.0?})", resp.model, elapsed,); + } + Err(e) => { + print!("\r"); + println!("Connectivity: FAILED ({e})"); + } + } +} + +#[derive(Clone, Copy, Debug)] +enum NativeDependency { + Cc, + PkgConfig, + OpenSsl, +} + +impl NativeDependency { + fn label(self) -> &'static str { + match self { + Self::Cc => "cc", + Self::PkgConfig => "pkg-config", + Self::OpenSsl => "openssl", + } + } + + fn install_hint(self, os: &str) -> &'static str { + match (os, self) { + ("macos", Self::Cc) => { + "Install Xcode Command Line Tools: xcode-select --install." + } + ("macos", Self::PkgConfig) => "Install pkg-config: brew install pkg-config.", + ("macos", Self::OpenSsl) => { + "Install OpenSSL + pkg-config: brew install openssl@3 pkg-config; then export PKG_CONFIG_PATH=\"$(brew --prefix openssl@3)/lib/pkgconfig:$PKG_CONFIG_PATH\"." + } + ("windows", Self::Cc) => { + "Install Visual Studio Build Tools with \"Desktop development with C++\"." + } + ("windows", Self::PkgConfig) => { + "Install pkg-config via MSYS2: pacman -S mingw-w64-x86_64-pkgconf." + } + ("windows", Self::OpenSsl) => { + "Install OpenSSL and set OPENSSL_DIR/OPENSSL_LIB_DIR (or use vcpkg install openssl:x64-windows)." + } + ("linux", Self::Cc) => { + "Install a C toolchain (Debian/Ubuntu: apt install build-essential; Fedora: dnf groupinstall 'Development Tools'; Alpine: apk add build-base)." + } + ("linux", Self::PkgConfig) => { + "Install pkg-config (Debian/Ubuntu: apt install pkg-config; Fedora: dnf install pkgconf-pkg-config; Alpine: apk add pkgconf)." + } + ("linux", Self::OpenSsl) => { + "Install OpenSSL development headers (Debian/Ubuntu: apt install libssl-dev; Fedora: dnf install openssl-devel; Alpine: apk add openssl-dev)." + } + (_, Self::Cc) => "Install a C compiler toolchain for your platform.", + (_, Self::PkgConfig) => "Install pkg-config for your platform.", + (_, Self::OpenSsl) => { + "Install OpenSSL development headers/libraries and configure OPENSSL_DIR if needed." + } + } + } +} + +#[derive(Debug)] +struct NativeProbe { + dependency: NativeDependency, + ok: bool, + detail: String, +} + +impl NativeProbe { + fn ok(dependency: NativeDependency, detail: impl Into) -> Self { + Self { + dependency, + ok: true, + detail: detail.into(), + } + } + + fn missing(dependency: NativeDependency, detail: impl Into) -> Self { + Self { + dependency, + ok: false, + detail: detail.into(), + } + } +} + +fn check_native_build_prerequisites() { + let target_os = env::consts::OS; + println!("Native deps: preflight (target OS: {target_os})"); + + let cc_probe = probe_command(NativeDependency::Cc); + print_probe(&cc_probe, target_os); + + let pkg_probe = probe_command(NativeDependency::PkgConfig); + print_probe(&pkg_probe, target_os); + + let openssl_probe = probe_openssl(pkg_probe.ok); + print_probe(&openssl_probe, target_os); +} + +fn print_probe(probe: &NativeProbe, os: &str) { + if probe.ok { + println!( + "{}: OK ({})", + probe.dependency.label(), + probe.detail + ); + } else { + println!( + "{}: MISSING ({})", + probe.dependency.label(), + probe.detail + ); + println!(" hint: {}", probe.dependency.install_hint(os)); + } +} + +fn probe_command(dependency: NativeDependency) -> NativeProbe { + let command_name = dependency.label(); + match find_command(command_name) { + Some(path) => NativeProbe::ok(dependency, format!("found at {}", path.display())), + None => NativeProbe::missing(dependency, "not found on PATH"), + } +} + +fn probe_openssl(has_pkg_config: bool) -> NativeProbe { + if env::var_os("OPENSSL_DIR").is_some() || env::var_os("OPENSSL_LIB_DIR").is_some() { + return NativeProbe::ok(NativeDependency::OpenSsl, "OPENSSL_DIR/OPENSSL_LIB_DIR set"); + } + + if has_pkg_config { + match Command::new("pkg-config") + .args(["--exists", "openssl"]) + .status() + { + Ok(status) if status.success() => { + return NativeProbe::ok(NativeDependency::OpenSsl, "detected via pkg-config"); + } + Ok(_) => { + return NativeProbe::missing( + NativeDependency::OpenSsl, + "pkg-config could not resolve openssl", + ); + } + Err(e) => { + return NativeProbe::missing( + NativeDependency::OpenSsl, + format!("pkg-config probe failed: {e}"), + ); + } + } + } + + if let Some(path) = find_command("openssl") { + return NativeProbe::ok( + NativeDependency::OpenSsl, + format!( + "openssl CLI found at {} (install pkg-config for stronger detection)", + path.display() + ), + ); + } + + NativeProbe::missing( + NativeDependency::OpenSsl, + "neither pkg-config detection nor OPENSSL_DIR overrides are available", + ) +} + +fn find_command(command_name: &str) -> Option { + let path = env::var_os("PATH")?; + let candidates = command_candidates(command_name); + + for dir in env::split_paths(&path) { + for candidate in &candidates { + let full = dir.join(candidate); + if is_executable_file(&full) { + return Some(full); + } + } + } + + None +} + +fn command_candidates(command_name: &str) -> Vec { + if env::consts::OS != "windows" { + return vec![command_name.to_string()]; + } + + if Path::new(command_name).extension().is_some() { + return vec![command_name.to_string()]; + } + + let mut candidates = vec![command_name.to_string()]; + let pathext = env::var_os("PATHEXT") + .map(|exts| exts.to_string_lossy().into_owned()) + .unwrap_or_else(|| ".COM;.EXE;.BAT;.CMD".to_string()); + + for ext in pathext.split(';') { + let trimmed = ext.trim(); + if !trimmed.is_empty() { + candidates.push(format!("{command_name}{trimmed}")); + } + } + + candidates +} + +fn is_executable_file(path: &Path) -> bool { + path.is_file() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[tokio::test] + async fn check_displays_static_config() { + let args = ConfigArgs { check: false }; + let result = execute(args).await; + assert!(result.is_ok()); + } + + #[tokio::test] + async fn check_with_echo_provider_reports_ok() { + let mut config = Config::default(); + config.provider.backend = "echo".to_string(); + check_connectivity(&config).await; + } + + #[test] + fn linux_hints_are_actionable() { + let hint = NativeDependency::OpenSsl.install_hint("linux"); + assert!(hint.contains("libssl-dev")); + } + + #[test] + fn windows_hints_are_actionable() { + let hint = NativeDependency::Cc.install_hint("windows"); + assert!(hint.contains("Visual Studio Build Tools")); + } +} diff --git a/crates/cli/src/commands/eval.rs b/crates/cli/src/commands/eval.rs index d3d5af5..f4c172b 100644 --- a/crates/cli/src/commands/eval.rs +++ b/crates/cli/src/commands/eval.rs @@ -63,7 +63,7 @@ pub async fn execute(args: EvalArgs) -> anyhow::Result<()> { let provider: Arc = match backend.as_str() { "echo" => { tracing::info!("using echo provider (no LLM calls)"); - Arc::new(harness_core::provider::EchoProvider) + Arc::new(harness_core::provider::EchoProvider::new()) } _ => { let api_key = config.resolved_api_key().ok_or_else(|| { diff --git a/crates/cli/src/commands/gateway.rs b/crates/cli/src/commands/gateway.rs new file mode 100644 index 0000000..626bd45 --- /dev/null +++ b/crates/cli/src/commands/gateway.rs @@ -0,0 +1,101 @@ +//! `anvil gateway` - local WebSocket control-plane gateway. + +use anyhow::Result; +use clap::{Args, Subcommand}; +use harness_gateway::{AgentEvent, Gateway, GatewayConfig}; +use std::time::Duration; +use tokio::{signal, sync::mpsc}; +use uuid::Uuid; + +const SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5); + +#[derive(Debug, Args)] +pub struct GatewayArgs { + #[command(subcommand)] + command: GatewayCommand, +} + +#[derive(Debug, Subcommand)] +enum GatewayCommand { + /// Start the local WebSocket gateway + Serve(ServeArgs), +} + +#[derive(Debug, Args)] +struct ServeArgs { + /// Port to listen on. Use 0 to bind an OS-selected free port. + #[arg(long, default_value_t = 9000)] + port: u16, + + /// Number of events buffered for each connected client. + #[arg(long, default_value_t = 256, value_parser = parse_event_buffer)] + event_buffer: usize, + + /// Emit a startup token event after the first WebSocket client connects. + #[arg(long)] + emit_hello: bool, +} + +pub async fn execute(args: GatewayArgs) -> Result<()> { + match args.command { + GatewayCommand::Serve(args) => serve(args).await, + } +} + +async fn serve(args: ServeArgs) -> Result<()> { + let config = GatewayConfig { + port: args.port, + event_buffer: args.event_buffer, + }; + let mut handle = Gateway::new(config).start().await?; + + println!("gateway listening"); + println!("health: http://{}/health", handle.addr); + println!("websocket: ws://{}/ws", handle.addr); + + let (_placeholder_tx, placeholder_rx) = mpsc::channel(1); + let mut cmd_rx = std::mem::replace(&mut handle.cmd_rx, placeholder_rx); + let command_drain = tokio::spawn(async move { + while let Some(cmd) = cmd_rx.recv().await { + eprintln!("control command received: {cmd:?}"); + } + }); + + let hello_task = if args.emit_hello { + Some(tokio::spawn({ + let handle = handle.clone_event_handle(); + async move { + while handle.connected_clients() == 0 { + tokio::time::sleep(Duration::from_millis(50)).await; + } + handle.emit(AgentEvent::turn_start(Uuid::new_v4())).await; + handle.emit(AgentEvent::token("anvil gateway online")).await; + } + })) + } else { + None + }; + + signal::ctrl_c().await?; + if !handle.shutdown_with_timeout(SHUTDOWN_TIMEOUT).await { + eprintln!( + "gateway graceful shutdown exceeded {}s; forced shutdown", + SHUTDOWN_TIMEOUT.as_secs() + ); + } + if let Some(task) = hello_task { + task.abort(); + } + command_drain.abort(); + Ok(()) +} + +fn parse_event_buffer(value: &str) -> std::result::Result { + let parsed = value + .parse::() + .map_err(|_| "event buffer must be a positive integer".to_string())?; + if parsed == 0 { + return Err("event buffer must be greater than zero".to_string()); + } + Ok(parsed) +} diff --git a/crates/cli/src/commands/mod.rs b/crates/cli/src/commands/mod.rs index 1052ec6..c5f71d8 100644 --- a/crates/cli/src/commands/mod.rs +++ b/crates/cli/src/commands/mod.rs @@ -1,5 +1,7 @@ -pub mod auth; -pub mod config; -pub mod eval; -pub mod memory; -pub mod run; +pub mod auth; +pub mod config; +pub mod eval; +pub mod gateway; +pub mod memory; +pub mod paperclip; +pub mod run; diff --git a/crates/cli/src/commands/paperclip.rs b/crates/cli/src/commands/paperclip.rs index 8a85e1f..7631a1e 100644 --- a/crates/cli/src/commands/paperclip.rs +++ b/crates/cli/src/commands/paperclip.rs @@ -20,7 +20,7 @@ use std::sync::Arc; use anyhow::{Context, Result}; use async_trait::async_trait; -use clap::{Parser, Subcommand}; +use clap::{Args, Subcommand}; use tracing::info; use harness_core::{ @@ -39,7 +39,7 @@ use crate::agent::Agent; // ── CLI args ─────────────────────────────────────────────────────────────────── /// Paperclip control-plane integration (heartbeat, whoami) -#[derive(Parser)] +#[derive(Args)] pub struct PaperclipArgs { /// Paperclip API base URL #[arg( @@ -77,7 +77,7 @@ enum PaperclipCommand { Heartbeat(HeartbeatCmd), } -#[derive(Parser)] +#[derive(Args)] struct HeartbeatCmd { /// Maximum tasks to process in this heartbeat #[arg(long, default_value = "1")] diff --git a/crates/cli/src/commands/run.rs b/crates/cli/src/commands/run.rs index 4582290..f3c65af 100644 --- a/crates/cli/src/commands/run.rs +++ b/crates/cli/src/commands/run.rs @@ -112,7 +112,7 @@ pub async fn execute(args: RunArgs) -> anyhow::Result<()> { let provider: Arc = match backend.as_str() { "echo" => { tracing::info!("using echo provider (no LLM calls)"); - Arc::new(harness_core::provider::EchoProvider) + Arc::new(harness_core::provider::EchoProvider::new()) } "claude-code" | "cc" => { let model = &config.provider.model; diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs new file mode 100644 index 0000000..f17bc55 --- /dev/null +++ b/crates/cli/src/lib.rs @@ -0,0 +1 @@ +pub mod agent; diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index ca98faf..5845c7a 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -18,7 +18,7 @@ struct Cli { } #[derive(Subcommand)] -enum Commands { +enum Commands { /// Run an agent turn toward a goal Run(commands::run::RunArgs), /// Show current configuration @@ -27,9 +27,13 @@ enum Commands { Memory(commands::memory::MemoryArgs), /// Batch-evaluate agent against a JSONL test suite Eval(commands::eval::EvalArgs), - /// Manage authentication credentials - Auth(commands::auth::AuthArgs), -} + /// Manage authentication credentials + Auth(commands::auth::AuthArgs), + /// Paperclip control-plane integration (heartbeat, whoami) + Paperclip(commands::paperclip::PaperclipArgs), + /// Run the local WebSocket control-plane gateway + Gateway(commands::gateway::GatewayArgs), +} #[tokio::main] async fn main() -> anyhow::Result<()> { @@ -46,7 +50,9 @@ async fn main() -> anyhow::Result<()> { Commands::Run(args) => commands::run::execute(args).await, Commands::Config(args) => commands::config::execute(args).await, Commands::Memory(args) => commands::memory::execute(args).await, - Commands::Eval(args) => commands::eval::execute(args).await, - Commands::Auth(args) => commands::auth::execute(args).await, - } -} + Commands::Eval(args) => commands::eval::execute(args).await, + Commands::Auth(args) => commands::auth::execute(args).await, + Commands::Paperclip(args) => commands::paperclip::execute(args).await, + Commands::Gateway(args) => commands::gateway::execute(args).await, + } +} diff --git a/crates/cli/tests/cli_surface.rs b/crates/cli/tests/cli_surface.rs new file mode 100644 index 0000000..efa7f4d --- /dev/null +++ b/crates/cli/tests/cli_surface.rs @@ -0,0 +1,74 @@ +//! CLI surface regression tests. +//! +//! These tests ensure built artifacts expose expected top-level subcommands, +//! so dogfood workflows do not depend on stale binaries. + +use std::process::Command; + +fn run_anvil(args: &[&str]) -> std::process::Output { + Command::new(env!("CARGO_BIN_EXE_anvil")) + .args(args) + .output() + .expect("failed to run anvil binary") +} + +#[test] +fn top_level_help_lists_paperclip_subcommand() { + let output = run_anvil(&["--help"]); + assert!( + output.status.success(), + "anvil --help failed: {}", + String::from_utf8_lossy(&output.stderr) + ); + + let stdout = String::from_utf8_lossy(&output.stdout); + assert!( + stdout.contains("paperclip"), + "expected `paperclip` in anvil --help output, got:\n{stdout}" + ); +} + +#[test] +fn top_level_help_lists_gateway_subcommand() { + let output = run_anvil(&["--help"]); + assert!( + output.status.success(), + "anvil --help failed: {}", + String::from_utf8_lossy(&output.stderr) + ); + + let stdout = String::from_utf8_lossy(&output.stdout); + assert!( + stdout.contains("gateway"), + "expected `gateway` in anvil --help output, got:\n{stdout}" + ); +} + +#[test] +fn paperclip_subcommand_help_is_available() { + let output = run_anvil(&["paperclip", "--help"]); + assert!( + output.status.success(), + "anvil paperclip --help failed: {}", + String::from_utf8_lossy(&output.stderr) + ); +} + +#[test] +fn gateway_subcommand_help_is_available() { + let output = run_anvil(&["gateway", "--help"]); + assert!( + output.status.success(), + "anvil gateway --help failed: {}", + String::from_utf8_lossy(&output.stderr) + ); +} + +#[test] +fn gateway_serve_rejects_zero_event_buffer() { + let output = run_anvil(&["gateway", "serve", "--event-buffer", "0"]); + assert!( + !output.status.success(), + "anvil gateway serve accepted zero event buffer" + ); +} diff --git a/crates/cli/tests/echo_integration.rs b/crates/cli/tests/echo_integration.rs new file mode 100644 index 0000000..4322eea --- /dev/null +++ b/crates/cli/tests/echo_integration.rs @@ -0,0 +1,262 @@ +//! Integration tests exercising the full agent loop with the echo provider. +//! +//! These tests verify that `anvil run --provider echo` works end-to-end: +//! plain text echo, scripted tool calls, memory persistence, and session +//! continuity — all without any real LLM API calls. + +use std::sync::Arc; + +use harness_cli::agent::{Agent, RunOptions}; +use harness_core::{ + provider::{EchoProvider, ScriptedToolCall}, + session::SessionStatus, +}; +use harness_memory::MemoryDb; + +fn make_config(max_iterations: usize) -> harness_core::config::Config { + let mut cfg = harness_core::config::Config::default(); + cfg.agent.max_iterations = max_iterations; + cfg.agent.system_prompt = None; + cfg +} + +async fn make_memory() -> Arc { + Arc::new(MemoryDb::in_memory().await.unwrap()) +} + +// --------------------------------------------------------------------------- +// 1. Basic echo: goal in -> deterministic echo response out +// --------------------------------------------------------------------------- + +#[tokio::test] +async fn echo_provider_completes_full_agent_loop() { + let provider = Arc::new(EchoProvider::new()); + let memory = make_memory().await; + let config = make_config(10); + + let agent = Agent::new(provider, memory, config); + let session = agent.run("test task").await.unwrap(); + + assert_eq!(session.status, SessionStatus::Done); + assert_eq!(session.iteration, 1); + + let last = session.messages.last().unwrap(); + assert_eq!(last.text(), Some("echo: test task")); +} + +#[tokio::test] +async fn echo_provider_handles_empty_goal() { + let provider = Arc::new(EchoProvider::new()); + let memory = make_memory().await; + let config = make_config(5); + + let agent = Agent::new(provider, memory, config); + let session = agent.run("").await.unwrap(); + + assert_eq!(session.status, SessionStatus::Done); +} + +// --------------------------------------------------------------------------- +// 2. Tool use: scripted tool call -> tool dispatch -> echo final response +// --------------------------------------------------------------------------- + +#[tokio::test] +async fn echo_provider_with_tool_call_exercises_full_loop() { + let provider = Arc::new(EchoProvider::scripted(vec![ScriptedToolCall { + id: "tool-1".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "tool-ping"}), + }])); + let memory = make_memory().await; + let config = make_config(10); + + let agent = Agent::new(provider, memory, config); + let session = agent.run("exercise tools").await.unwrap(); + + assert_eq!(session.status, SessionStatus::Done); + // Iteration 1: tool call. Iteration 2: final echo. + assert_eq!(session.iteration, 2); + + let last = session.messages.last().unwrap(); + // After the tool result, echo provider echoes the last user message + // (the tool result block), which has no plain text — falls back to "(empty)". + assert!(last.text().is_some()); +} + +#[tokio::test] +async fn echo_provider_multiple_tool_calls_in_sequence() { + let provider = Arc::new(EchoProvider::scripted(vec![ + ScriptedToolCall { + id: "c1".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "first"}), + }, + ScriptedToolCall { + id: "c2".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "second"}), + }, + ])); + let memory = make_memory().await; + let config = make_config(10); + + let agent = Agent::new(provider, memory, config); + let session = agent.run("multi-tool test").await.unwrap(); + + assert_eq!(session.status, SessionStatus::Done); + // 2 scripted tool calls + 1 final echo = 3 iterations. + assert_eq!(session.iteration, 3); +} + +#[tokio::test] +async fn tool_call_respects_max_iterations() { + // Script has 5 tool calls but max_iterations is 2. + let provider = Arc::new(EchoProvider::scripted(vec![ + ScriptedToolCall { + id: "c1".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "a"}), + }, + ScriptedToolCall { + id: "c2".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "b"}), + }, + ScriptedToolCall { + id: "c3".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "c"}), + }, + ])); + let memory = make_memory().await; + let config = make_config(2); + + let agent = Agent::new(provider, memory, config); + let session = agent.run("should cap").await.unwrap(); + + assert_eq!(session.status, SessionStatus::Done); + assert_eq!(session.iteration, 2); +} + +// --------------------------------------------------------------------------- +// 3. Memory: episodes are persisted and recallable +// --------------------------------------------------------------------------- + +#[tokio::test] +async fn echo_sessions_persist_to_memory() { + let memory = make_memory().await; + let provider = Arc::new(EchoProvider::new()); + let config = make_config(5); + + let agent = Agent::new(provider, Arc::clone(&memory), config); + let session = agent.run("remember this").await.unwrap(); + + let episodes = memory.recent(session.id, 10).await.unwrap(); + assert!( + episodes.len() >= 2, + "expected at least user + assistant episodes, got {}", + episodes.len() + ); + + let roles: Vec<&str> = episodes.iter().map(|e| e.role.as_str()).collect(); + assert!(roles.contains(&"user")); + assert!(roles.contains(&"assistant")); +} + +#[tokio::test] +async fn echo_tool_session_persists_all_turns() { + let memory = make_memory().await; + let provider = Arc::new(EchoProvider::scripted(vec![ScriptedToolCall { + id: "t1".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "ping"}), + }])); + let config = make_config(10); + + let agent = Agent::new(provider, Arc::clone(&memory), config); + let session = agent.run("tool + memory").await.unwrap(); + + let episodes = memory.recent(session.id, 20).await.unwrap(); + // At minimum: user goal, assistant tool call, tool result, assistant final. + assert!( + episodes.len() >= 2, + "expected multiple episodes for tool session, got {}", + episodes.len() + ); +} + +// --------------------------------------------------------------------------- +// 4. Session continuity via named sessions +// --------------------------------------------------------------------------- + +#[tokio::test] +async fn named_session_allows_multi_turn_continuity() { + let memory = make_memory().await; + let config = make_config(5); + + // Turn 1: initial goal. + let provider1 = Arc::new(EchoProvider::new()); + let agent1 = Agent::new(provider1, Arc::clone(&memory), config.clone()); + let opts1 = RunOptions { + session_name: Some("my-session".to_string()), + ..Default::default() + }; + let s1 = agent1.run_with_options("first turn", opts1).await.unwrap(); + assert_eq!(s1.status, SessionStatus::Done); + + // Turn 2: continue under the same session name. + let provider2 = Arc::new(EchoProvider::new()); + let agent2 = Agent::new(provider2, Arc::clone(&memory), config); + let opts2 = RunOptions { + session_name: Some("my-session".to_string()), + ..Default::default() + }; + let s2 = agent2.run_with_options("second turn", opts2).await.unwrap(); + assert_eq!(s2.status, SessionStatus::Done); + + // Both sessions completed and persisted episodes under the same name. + // The second session injected history from the first (verified by the + // echo response reflecting the prior context). We confirm memory has + // episodes from both sessions. + let all_episodes = memory.recent_by_name("my-session", 20).await.unwrap(); + assert!( + all_episodes.len() >= 4, + "expected episodes from both sessions (>= 4), got {}", + all_episodes.len() + ); +} + +// --------------------------------------------------------------------------- +// 5. RunOptions override +// --------------------------------------------------------------------------- + +#[tokio::test] +async fn run_options_overrides_config_max_iterations() { + let provider = Arc::new(EchoProvider::scripted(vec![ + ScriptedToolCall { + id: "c1".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "x"}), + }, + ScriptedToolCall { + id: "c2".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "y"}), + }, + ScriptedToolCall { + id: "c3".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "z"}), + }, + ])); + let memory = make_memory().await; + let config = make_config(10); // Config says 10, options say 1. + + let agent = Agent::new(provider, memory, config); + let opts = RunOptions { + max_iterations: Some(1), + ..Default::default() + }; + let session = agent.run_with_options("override test", opts).await.unwrap(); + assert_eq!(session.iteration, 1); +} diff --git a/crates/core/src/auth.rs b/crates/core/src/auth.rs index db0a38c..84ae73c 100644 --- a/crates/core/src/auth.rs +++ b/crates/core/src/auth.rs @@ -137,6 +137,10 @@ fn home_dir() -> Option { mod tests { use super::*; use std::io::Write as _; + use std::sync::Mutex; + + /// Guards env-var mutations so auth tests don't race each other. + static ENV_LOCK: Mutex<()> = Mutex::new(()); /// Create a uniquely-named subdirectory under `std::env::temp_dir()`. fn make_temp_dir(suffix: &str) -> PathBuf { @@ -159,6 +163,8 @@ mod tests { #[test] fn auth_resolve_prefers_bearer_when_both_present() { + let _guard = ENV_LOCK.lock().unwrap(); + let dir = make_temp_dir("bearer-wins"); write_creds(&dir, "sk-ant-bearer-token"); @@ -181,6 +187,8 @@ mod tests { #[test] fn auth_resolve_falls_back_to_api_key_when_no_creds_file() { + let _guard = ENV_LOCK.lock().unwrap(); + let dir = make_temp_dir("apikey-fallback"); std::env::set_var("CLAUDE_CONFIG_DIR", dir.to_str().expect("utf8 path")); std::env::set_var("ANTHROPIC_API_KEY", "sk-ant-fallback-key"); diff --git a/crates/core/src/provider.rs b/crates/core/src/provider.rs index ddad4fa..9631ae8 100644 --- a/crates/core/src/provider.rs +++ b/crates/core/src/provider.rs @@ -1,109 +1,236 @@ -use crate::{ - error::Result, - message::{Message, TurnResponse}, -}; -use async_trait::async_trait; -use futures::Stream; -use serde::{Deserialize, Serialize}; -use std::pin::Pin; - -/// Lightweight tool definition passed to providers alongside messages. -/// Mirrors the JSON schema shape expected by Claude / OpenAI tool-calling APIs. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ToolDef { - pub name: String, - pub description: String, - pub input_schema: serde_json::Value, -} - -/// A streaming token chunk from the provider. -#[derive(Debug, Clone)] -pub struct StreamChunk { - pub delta: String, - pub done: bool, -} - -pub type TokenStream = Pin> + Send>>; - -/// Core provider trait — implemented per LLM backend. -/// -/// Implementors: ClaudeProvider, OpenAIProvider, OllamaProvider, etc. -#[async_trait] -pub trait Provider: Send + Sync + 'static { - /// Human-readable provider name (e.g. "claude-3-5-sonnet-20241022"). - fn name(&self) -> &str; - - /// Single non-streaming turn: send messages, get back a complete response. - async fn complete(&self, messages: &[Message]) -> Result; - - /// Turn with tool definitions made available to the LLM. - /// Defaults to `complete` (tools ignored) for providers that don't support them yet. - async fn complete_with_tools( - &self, - messages: &[Message], - _tools: &[ToolDef], - ) -> Result { - self.complete(messages).await - } - - /// Streaming turn: yields token chunks as they arrive. - /// Default falls back to `complete` and emits one chunk. - async fn stream(&self, messages: &[Message]) -> Result { - use futures::stream; - let response = self.complete(messages).await?; - let text = response.message.text().unwrap_or("").to_string(); - let chunk = StreamChunk { - delta: text, - done: true, - }; - Ok(Box::pin(stream::once(async move { Ok(chunk) }))) - } - - /// Maximum context window in tokens (informational). - fn context_limit(&self) -> usize { - 200_000 - } -} - -/// Stub provider for tests — echoes input back. -pub struct EchoProvider; - -#[async_trait] -impl Provider for EchoProvider { - fn name(&self) -> &str { - "echo" - } - - async fn complete(&self, messages: &[Message]) -> Result { - use crate::message::{MessageContent, Role, StopReason, Usage}; - let last = messages - .last() - .and_then(|m| m.text()) - .unwrap_or("(empty)") - .to_string(); - Ok(TurnResponse { - message: Message { - role: Role::Assistant, - content: MessageContent::Text(format!("echo: {last}")), - }, - stop_reason: StopReason::EndTurn, - usage: Usage::default(), - model: "echo".to_string(), - }) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::message::Message; - - #[tokio::test] - async fn echo_provider_round_trips() { - let p = EchoProvider; - let msgs = vec![Message::user("hello")]; - let resp = p.complete(&msgs).await.unwrap(); - assert_eq!(resp.message.text(), Some("echo: hello")); - assert_eq!(resp.model, "echo"); - } -} +use crate::{ + error::Result, + message::{ContentBlock, Message, MessageContent, Role, StopReason, TurnResponse, Usage}, +}; +use async_trait::async_trait; +use futures::Stream; +use serde::{Deserialize, Serialize}; +use std::collections::VecDeque; +use std::pin::Pin; +use std::sync::Mutex; + +/// Lightweight tool definition passed to providers alongside messages. +/// Mirrors the JSON schema shape expected by Claude / OpenAI tool-calling APIs. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ToolDef { + pub name: String, + pub description: String, + pub input_schema: serde_json::Value, +} + +/// A streaming token chunk from the provider. +#[derive(Debug, Clone)] +pub struct StreamChunk { + pub delta: String, + pub done: bool, +} + +pub type TokenStream = Pin> + Send>>; + +/// Core provider trait — implemented per LLM backend. +/// +/// Implementors: ClaudeProvider, OpenAIProvider, OllamaProvider, etc. +#[async_trait] +pub trait Provider: Send + Sync + 'static { + /// Human-readable provider name (e.g. "claude-3-5-sonnet-20241022"). + fn name(&self) -> &str; + + /// Single non-streaming turn: send messages, get back a complete response. + async fn complete(&self, messages: &[Message]) -> Result; + + /// Turn with tool definitions made available to the LLM. + /// Defaults to `complete` (tools ignored) for providers that don't support them yet. + async fn complete_with_tools( + &self, + messages: &[Message], + _tools: &[ToolDef], + ) -> Result { + self.complete(messages).await + } + + /// Streaming turn: yields token chunks as they arrive. + /// Default falls back to `complete` and emits one chunk. + async fn stream(&self, messages: &[Message]) -> Result { + use futures::stream; + let response = self.complete(messages).await?; + let text = response.message.text().unwrap_or("").to_string(); + let chunk = StreamChunk { + delta: text, + done: true, + }; + Ok(Box::pin(stream::once(async move { Ok(chunk) }))) + } + + /// Maximum context window in tokens (informational). + fn context_limit(&self) -> usize { + 200_000 + } +} + +/// A scripted tool call for deterministic testing. +#[derive(Debug, Clone)] +pub struct ScriptedToolCall { + pub id: String, + pub name: String, + pub input: serde_json::Value, +} + +/// Stub provider for tests — echoes input back. +/// +/// In its default mode, `EchoProvider` prefixes the last user message with +/// `"echo: "` and returns `StopReason::EndTurn`. +/// +/// In **scripted mode** (via [`EchoProvider::scripted`]), it dequeues +/// pre-loaded tool calls one per turn, returning `StopReason::ToolUse`. +/// Once the script is exhausted it falls back to the normal echo behaviour. +/// This allows deterministic end-to-end testing of the full agent loop +/// including tool dispatch — no real LLM required. +pub struct EchoProvider { + script: Mutex>, +} + +impl EchoProvider { + /// Plain echo provider — no tool calls, just mirrors input. + pub fn new() -> Self { + Self { + script: Mutex::new(VecDeque::new()), + } + } + + /// Scripted echo provider — emits pre-loaded tool calls in order, + /// then falls back to normal echo behaviour. + pub fn scripted(calls: Vec) -> Self { + Self { + script: Mutex::new(VecDeque::from(calls)), + } + } +} + +impl Default for EchoProvider { + fn default() -> Self { + Self::new() + } +} + +#[async_trait] +impl Provider for EchoProvider { + fn name(&self) -> &str { + "echo" + } + + async fn complete(&self, messages: &[Message]) -> Result { + // Check for a scripted tool call first. + { + let mut script = self.script.lock().unwrap(); + if let Some(call) = script.pop_front() { + return Ok(TurnResponse { + message: Message { + role: Role::Assistant, + content: MessageContent::Blocks(vec![ContentBlock::ToolUse { + id: call.id, + name: call.name, + input: call.input, + }]), + }, + stop_reason: StopReason::ToolUse, + usage: Usage::default(), + model: "echo".to_string(), + }); + } + } + + // Default: echo the last user message. + let last = messages + .last() + .and_then(|m| m.text()) + .unwrap_or("(empty)") + .to_string(); + Ok(TurnResponse { + message: Message { + role: Role::Assistant, + content: MessageContent::Text(format!("echo: {last}")), + }, + stop_reason: StopReason::EndTurn, + usage: Usage::default(), + model: "echo".to_string(), + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::message::Message; + + #[tokio::test] + async fn echo_provider_round_trips() { + let p = EchoProvider::new(); + let msgs = vec![Message::user("hello")]; + let resp = p.complete(&msgs).await.unwrap(); + assert_eq!(resp.message.text(), Some("echo: hello")); + assert_eq!(resp.model, "echo"); + } + + #[tokio::test] + async fn echo_provider_default_is_plain() { + let p = EchoProvider::default(); + let msgs = vec![Message::user("test")]; + let resp = p.complete(&msgs).await.unwrap(); + assert_eq!(resp.stop_reason, StopReason::EndTurn); + assert_eq!(resp.message.text(), Some("echo: test")); + } + + #[tokio::test] + async fn scripted_echo_emits_tool_call_then_echoes() { + let p = EchoProvider::scripted(vec![ScriptedToolCall { + id: "call-1".to_string(), + name: "echo".to_string(), + input: serde_json::json!({"message": "ping"}), + }]); + + // First call returns the scripted tool use. + let msgs = vec![Message::user("goal")]; + let r1 = p.complete(&msgs).await.unwrap(); + assert_eq!(r1.stop_reason, StopReason::ToolUse); + match &r1.message.content { + MessageContent::Blocks(blocks) => match &blocks[0] { + ContentBlock::ToolUse { name, .. } => assert_eq!(name, "echo"), + other => panic!("expected ToolUse, got {other:?}"), + }, + other => panic!("expected Blocks, got {other:?}"), + } + + // Second call falls back to echo. + let r2 = p.complete(&msgs).await.unwrap(); + assert_eq!(r2.stop_reason, StopReason::EndTurn); + assert_eq!(r2.message.text(), Some("echo: goal")); + } + + #[tokio::test] + async fn scripted_echo_drains_multiple_calls() { + let p = EchoProvider::scripted(vec![ + ScriptedToolCall { + id: "c1".to_string(), + name: "read_file".to_string(), + input: serde_json::json!({"path": "a.txt"}), + }, + ScriptedToolCall { + id: "c2".to_string(), + name: "bash_exec".to_string(), + input: serde_json::json!({"command": "ls"}), + }, + ]); + + let msgs = vec![Message::user("do things")]; + + let r1 = p.complete(&msgs).await.unwrap(); + assert_eq!(r1.stop_reason, StopReason::ToolUse); + + let r2 = p.complete(&msgs).await.unwrap(); + assert_eq!(r2.stop_reason, StopReason::ToolUse); + + // Script exhausted — falls back to echo. + let r3 = p.complete(&msgs).await.unwrap(); + assert_eq!(r3.stop_reason, StopReason::EndTurn); + } +} diff --git a/crates/core/src/providers/claude_code.rs b/crates/core/src/providers/claude_code.rs index 79c7689..276e2b9 100644 --- a/crates/core/src/providers/claude_code.rs +++ b/crates/core/src/providers/claude_code.rs @@ -17,6 +17,20 @@ pub struct ClaudeCodeProvider { model: String, } +/// Returns a hint suggesting the `claude` provider as a fallback, but only when +/// `ANTHROPIC_API_KEY` is not already set in the environment. +fn fallback_hint() -> String { + fallback_hint_for_api_key(std::env::var("ANTHROPIC_API_KEY").ok()) +} + +fn fallback_hint_for_api_key(api_key: Option) -> String { + if api_key.is_some() { + String::new() + } else { + "\nTip: try --provider claude with ANTHROPIC_API_KEY set".to_string() + } +} + impl ClaudeCodeProvider { pub fn new(model: impl Into) -> Self { Self { @@ -81,7 +95,8 @@ impl ClaudeCodeProvider { .map_err(|e| { HarnessError::Provider(format!( "failed to spawn claude binary: {e}. \ - Ensure the `claude` CLI is installed and available on PATH." + Ensure the `claude` CLI is installed and available on PATH.{}", + fallback_hint() )) })?; @@ -89,8 +104,9 @@ impl ClaudeCodeProvider { let stderr = String::from_utf8_lossy(&output.stderr).to_string(); let stdout = String::from_utf8_lossy(&output.stdout).to_string(); return Err(HarnessError::Provider(format!( - "claude subprocess exited with {}: stderr={stderr} stdout={stdout}", - output.status + "claude subprocess exited with {}: stderr={stderr} stdout={stdout}{}", + output.status, + fallback_hint() ))); } @@ -172,13 +188,19 @@ impl Provider for ClaudeCodeProvider { ]) .output() .await - .map_err(|e| HarnessError::Provider(format!("failed to spawn claude binary: {e}")))?; + .map_err(|e| { + HarnessError::Provider(format!( + "failed to spawn claude binary: {e}{}", + fallback_hint() + )) + })?; if !output.status.success() { let stderr = String::from_utf8_lossy(&output.stderr).to_string(); return Err(HarnessError::Provider(format!( - "claude subprocess (stream) exited with {}: {stderr}", - output.status + "claude subprocess (stream) exited with {}: {stderr}{}", + output.status, + fallback_hint() ))); } @@ -284,4 +306,17 @@ mod tests { let v = serde_json::json!({"type": "message_start", "message": {}}); assert_eq!(extract_stream_text(&v), None); } + + #[test] + fn fallback_hint_shown_when_api_key_unset() { + let hint = fallback_hint_for_api_key(None); + assert!(hint.contains("--provider claude")); + assert!(hint.contains("ANTHROPIC_API_KEY")); + } + + #[test] + fn fallback_hint_hidden_when_api_key_set() { + let hint = fallback_hint_for_api_key(Some("sk-test-key".to_string())); + assert!(hint.is_empty()); + } } diff --git a/crates/gateway/Cargo.toml b/crates/gateway/Cargo.toml new file mode 100644 index 0000000..0d4a2fa --- /dev/null +++ b/crates/gateway/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "harness-gateway" +version.workspace = true +edition.workspace = true +authors.workspace = true +license.workspace = true +rust-version.workspace = true +description = "WebSocket control-plane gateway for Anvil — streams agent events and accepts control commands" + +[dependencies] +# Async runtime +tokio = { workspace = true } +futures = { workspace = true } + +# HTTP / WebSocket server +axum = { workspace = true, features = ["ws"] } +tower-http = { workspace = true, features = ["cors"] } + +# Serialisation +serde = { workspace = true } +serde_json = { workspace = true } + +# Error handling +anyhow = { workspace = true } +thiserror = { workspace = true } + +# Logging +tracing = { workspace = true } + +# Utilities +uuid = { workspace = true } +chrono = { workspace = true } + +[dev-dependencies] +tokio = { workspace = true, features = ["full", "time"] } +tokio-tungstenite = "0.21" +reqwest = { version = "0.12", features = ["json"] } +futures = { workspace = true } diff --git a/crates/gateway/src/config.rs b/crates/gateway/src/config.rs new file mode 100644 index 0000000..0f37922 --- /dev/null +++ b/crates/gateway/src/config.rs @@ -0,0 +1,18 @@ +/// Configuration for the WebSocket gateway. +#[derive(Debug, Clone)] +pub struct GatewayConfig { + /// Port to listen on. Defaults to `9000`. + pub port: u16, + /// Maximum number of broadcast events buffered in the channel. + /// Lagging clients will miss events rather than block the agent. + pub event_buffer: usize, +} + +impl Default for GatewayConfig { + fn default() -> Self { + Self { + port: 9000, + event_buffer: 256, + } + } +} diff --git a/crates/gateway/src/event.rs b/crates/gateway/src/event.rs new file mode 100644 index 0000000..8600222 --- /dev/null +++ b/crates/gateway/src/event.rs @@ -0,0 +1,95 @@ +#![allow(clippy::module_name_repetitions)] + +use chrono::{DateTime, Utc}; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +/// Events emitted by the agent and broadcast to WebSocket clients. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(tag = "kind", rename_all = "snake_case")] +pub enum AgentEvent { + /// A new agent turn has started. + TurnStart { + id: Uuid, + session_id: Uuid, + ts: DateTime, + }, + /// A streaming text token from the LLM. + Token { + turn_id: Uuid, + delta: String, + ts: DateTime, + }, + /// The agent is calling a tool. + ToolCall { + turn_id: Uuid, + tool_use_id: String, + name: String, + input: serde_json::Value, + ts: DateTime, + }, + /// A tool has returned its result. + ToolResult { + turn_id: Uuid, + tool_use_id: String, + content: String, + ts: DateTime, + }, + /// The agent turn completed. + TurnComplete { + turn_id: Uuid, + stop_reason: String, + input_tokens: u32, + output_tokens: u32, + ts: DateTime, + }, + /// An unrecoverable error occurred. + Error { + turn_id: Option, + message: String, + ts: DateTime, + }, +} + +impl AgentEvent { + /// Convenience constructor: streaming text token. + pub fn token(delta: impl Into) -> Self { + Self::Token { + turn_id: Uuid::nil(), + delta: delta.into(), + ts: Utc::now(), + } + } + + /// Convenience constructor: turn started. + pub fn turn_start(session_id: Uuid) -> Self { + Self::TurnStart { + id: Uuid::new_v4(), + session_id, + ts: Utc::now(), + } + } + + /// Convenience constructor: error event. + pub fn error(message: impl Into) -> Self { + Self::Error { + turn_id: None, + message: message.into(), + ts: Utc::now(), + } + } +} + +/// Commands that remote clients can send to control the agent. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(tag = "cmd", rename_all = "snake_case")] +pub enum ControlCommand { + /// Ask the agent to stop cleanly after the current turn. + Interrupt, + /// Pause execution after the current tool call completes. + Pause, + /// Resume a paused agent. + Resume, + /// No-op ping. + Ping, +} diff --git a/crates/gateway/src/lib.rs b/crates/gateway/src/lib.rs new file mode 100644 index 0000000..4b7f5d1 --- /dev/null +++ b/crates/gateway/src/lib.rs @@ -0,0 +1,35 @@ +//! harness-gateway — WebSocket control-plane for Anvil. +#![allow(clippy::module_name_repetitions)] +//! +//! # Overview +//! +//! [`Gateway`] starts a local Axum-based WebSocket server that: +//! - Broadcasts [`AgentEvent`]s to all connected clients in real time. +//! - Accepts [`ControlCommand`]s (interrupt / pause / resume) from any client. +//! +//! # Usage +//! +//! ```rust,no_run +//! use harness_gateway::{Gateway, GatewayConfig, AgentEvent}; +//! +//! #[tokio::main] +//! async fn main() -> anyhow::Result<()> { +//! let cfg = GatewayConfig { port: 9000, ..Default::default() }; +//! let gateway = Gateway::new(cfg); +//! let handle = gateway.start().await?; +//! +//! // Broadcast an event from agent code: +//! handle.emit(AgentEvent::token("Hello, world!")).await; +//! +//! handle.shutdown().await; +//! Ok(()) +//! } +//! ``` + +pub mod config; +pub mod event; +pub mod server; + +pub use config::GatewayConfig; +pub use event::{AgentEvent, ControlCommand}; +pub use server::{Gateway, GatewayHandle}; diff --git a/crates/gateway/src/server.rs b/crates/gateway/src/server.rs new file mode 100644 index 0000000..53678fc --- /dev/null +++ b/crates/gateway/src/server.rs @@ -0,0 +1,453 @@ +#![allow(clippy::module_name_repetitions)] + +use crate::{ + config::GatewayConfig, + event::{AgentEvent, ControlCommand}, +}; +use axum::{ + extract::{ + ws::{Message as WsMessage, WebSocket}, + State, WebSocketUpgrade, + }, + response::IntoResponse, + routing::get, + Router, +}; +use std::{net::SocketAddr, sync::Arc, time::Duration}; +use tokio::{ + net::TcpListener, + sync::{broadcast, mpsc}, + task::JoinHandle, +}; +use tower_http::cors::CorsLayer; +use tracing::{debug, error, info, warn}; + +/// Shared application state threaded through Axum handlers. +#[derive(Clone)] +struct AppState { + /// Sender for the broadcast channel; cloned into each WebSocket session. + event_tx: broadcast::Sender, + /// Sender to forward inbound control commands from any client. + cmd_tx: mpsc::Sender, +} + +/// The WebSocket gateway. +pub struct Gateway { + config: GatewayConfig, +} + +impl Gateway { + /// Create a new gateway with the given configuration. + pub fn new(config: GatewayConfig) -> Self { + Self { config } + } + + /// Start the gateway and return a [`GatewayHandle`] for interaction. + /// + /// The underlying server runs as a background `tokio` task. + /// + /// # Errors + /// + /// Returns an error if the TCP listener cannot bind to the configured port. + pub async fn start(self) -> anyhow::Result { + let (event_tx, _) = broadcast::channel::(self.config.event_buffer); + let (cmd_tx, cmd_rx) = mpsc::channel::(64); + let (shutdown_tx, shutdown_rx) = tokio::sync::oneshot::channel::<()>(); + + let state = AppState { + event_tx: event_tx.clone(), + cmd_tx: cmd_tx.clone(), + }; + + let app = Router::new() + .route("/ws", get(ws_handler)) + .route("/health", get(health_handler)) + .layer(CorsLayer::permissive()) + .with_state(Arc::new(state)); + + let addr = SocketAddr::from(([127, 0, 0, 1], self.config.port)); + let listener = TcpListener::bind(addr).await?; + let bound_addr = listener.local_addr()?; + info!("harness-gateway listening on ws://{}/ws", bound_addr); + + let server_task: JoinHandle<()> = tokio::spawn(async move { + let server = axum::serve(listener, app).with_graceful_shutdown(async move { + let _ = shutdown_rx.await; + }); + if let Err(e) = server.await { + error!("gateway server error: {e}"); + } + info!("harness-gateway shut down"); + }); + + Ok(GatewayHandle { + event_tx, + cmd_rx, + shutdown_tx: Some(shutdown_tx), + server_task, + addr: bound_addr, + }) + } +} + +/// A handle returned by [`Gateway::start`]. +/// +/// Use this to emit events, receive commands, and shut down the server. +pub struct GatewayHandle { + event_tx: broadcast::Sender, + /// Inbound commands from connected clients. + pub cmd_rx: mpsc::Receiver, + shutdown_tx: Option>, + server_task: JoinHandle<()>, + /// The actual bound address (useful when port 0 was requested in tests). + pub addr: SocketAddr, +} + +/// Cloneable event-only handle for background emitters. +#[derive(Clone)] +pub struct GatewayEventHandle { + event_tx: broadcast::Sender, +} + +impl GatewayHandle { + /// Broadcast an event to all connected WebSocket clients. + /// + /// If no clients are connected the event is silently dropped. + pub async fn emit(&self, event: AgentEvent) { + match self.event_tx.send(event) { + Ok(n) => debug!("event broadcast to {n} clients"), + Err(_) => debug!("no clients connected; event dropped"), + } + } + + /// Return the number of WebSocket clients currently subscribed to events. + #[must_use] + pub fn connected_clients(&self) -> usize { + self.event_tx.receiver_count() + } + + /// Create a cloneable event-only handle. + #[must_use] + pub fn clone_event_handle(&self) -> GatewayEventHandle { + GatewayEventHandle { + event_tx: self.event_tx.clone(), + } + } + + /// Gracefully shut down the gateway server. + pub async fn shutdown(mut self) { + if let Some(tx) = self.shutdown_tx.take() { + let _ = tx.send(()); + } + let _ = self.server_task.await; + } + + /// Gracefully shut down the gateway server, aborting it if it exceeds `timeout`. + /// + /// Returns `true` when graceful shutdown completes before the timeout and `false` + /// when the server task had to be aborted. + pub async fn shutdown_with_timeout(mut self, timeout: Duration) -> bool { + if let Some(tx) = self.shutdown_tx.take() { + let _ = tx.send(()); + } + + match tokio::time::timeout(timeout, &mut self.server_task).await { + Ok(_) => true, + Err(_) => { + self.server_task.abort(); + let _ = self.server_task.await; + false + } + } + } +} + +impl GatewayEventHandle { + /// Broadcast an event to all connected WebSocket clients. + /// + /// If no clients are connected the event is silently dropped. + pub async fn emit(&self, event: AgentEvent) { + match self.event_tx.send(event) { + Ok(n) => debug!("event broadcast to {n} clients"), + Err(_) => debug!("no clients connected; event dropped"), + } + } + + /// Return the number of WebSocket clients currently subscribed to events. + #[must_use] + pub fn connected_clients(&self) -> usize { + self.event_tx.receiver_count() + } +} + +// ─── Axum handlers ─────────────────────────────────────────────────────────── + +async fn health_handler() -> impl IntoResponse { + axum::Json(serde_json::json!({ "status": "ok" })) +} + +async fn ws_handler(ws: WebSocketUpgrade, State(state): State>) -> impl IntoResponse { + ws.on_upgrade(|socket| handle_socket(socket, state)) +} + +async fn handle_socket(mut socket: WebSocket, state: Arc) { + let mut event_rx = state.event_tx.subscribe(); + info!("WebSocket client connected"); + + loop { + tokio::select! { + // Forward agent events to this client. + event = event_rx.recv() => { + match event { + Ok(ev) => { + let json = match serde_json::to_string(&ev) { + Ok(j) => j, + Err(e) => { + error!("failed to serialise event: {e}"); + continue; + } + }; + if socket.send(WsMessage::Text(json)).await.is_err() { + break; // client disconnected + } + } + Err(broadcast::error::RecvError::Lagged(n)) => { + warn!("client lagged by {n} events"); + } + Err(broadcast::error::RecvError::Closed) => break, + } + } + // Receive control commands from the client. + msg = socket.recv() => { + match msg { + Some(Ok(WsMessage::Text(text))) => { + match serde_json::from_str::(&text) { + Ok(cmd) => { + debug!("received command: {cmd:?}"); + if cmd == ControlCommand::Ping { + let pong = serde_json::json!({ "kind": "pong" }).to_string(); + let _ = socket.send(WsMessage::Text(pong)).await; + } else { + let _ = state.cmd_tx.send(cmd).await; + } + } + Err(e) => warn!("invalid command payload: {e}"), + } + } + Some(Ok(WsMessage::Close(_))) | None => break, + Some(Ok(_)) => {} // ignore binary / ping frames + Some(Err(e)) => { + error!("WebSocket error: {e}"); + break; + } + } + } + } + } + + info!("WebSocket client disconnected"); +} + +#[cfg(test)] +#[allow( + clippy::expect_used, + clippy::unwrap_used, + clippy::panic, + clippy::wildcard_imports +)] +mod tests { + use super::*; + use crate::{AgentEvent, GatewayConfig}; + use uuid::Uuid; + + async fn start_test_gateway() -> GatewayHandle { + // Port 0 → OS picks a free port. + let cfg = GatewayConfig { + port: 0, + event_buffer: 16, + }; + Gateway::new(cfg).start().await.expect("gateway start") + } + + #[tokio::test] + async fn test_gateway_starts_and_health_ok() { + let handle = start_test_gateway().await; + let url = format!("http://{}/health", handle.addr); + let resp = reqwest::get(&url).await.expect("http get"); + assert!(resp.status().is_success()); + let body: serde_json::Value = resp.json().await.expect("json"); + assert_eq!(body["status"], "ok"); + handle.shutdown().await; + } + + #[tokio::test] + async fn test_emit_with_no_clients_does_not_panic() { + let handle = start_test_gateway().await; + // No client subscribed — send should not panic. + handle.emit(AgentEvent::token("hello")).await; + handle.emit(AgentEvent::error("oops")).await; + handle.emit(AgentEvent::turn_start(Uuid::new_v4())).await; + handle.shutdown().await; + } + + #[tokio::test] + async fn test_ws_event_delivery() { + use futures::StreamExt; + use tokio_tungstenite::connect_async; + + let handle = start_test_gateway().await; + let ws_url = format!("ws://{}/ws", handle.addr); + + let (mut ws, _) = connect_async(&ws_url).await.expect("ws connect"); + + // Yield so the server-side handle_socket task has time to subscribe + // to the broadcast channel before we emit. + tokio::time::sleep(std::time::Duration::from_millis(10)).await; + + // Emit an event from the server side. + handle + .emit(AgentEvent::Token { + turn_id: Uuid::nil(), + delta: "streaming!".into(), + ts: chrono::Utc::now(), + }) + .await; + + // Receive on the client side. + let msg = ws.next().await.expect("no msg").expect("ws err"); + if let tokio_tungstenite::tungstenite::Message::Text(text) = msg { + let ev: serde_json::Value = serde_json::from_str(&text).expect("json"); + assert_eq!(ev["kind"], "token"); + assert_eq!(ev["delta"], "streaming!"); + } else { + panic!("unexpected message type"); + } + + ws.close(None).await.ok(); + handle.shutdown().await; + } + + #[tokio::test] + async fn test_connected_clients_tracks_websocket_subscribers() { + use tokio_tungstenite::connect_async; + + let handle = start_test_gateway().await; + let ws_url = format!("ws://{}/ws", handle.addr); + + assert_eq!(handle.connected_clients(), 0); + let (mut ws, _) = connect_async(&ws_url).await.expect("ws connect"); + + for _ in 0..20 { + if handle.connected_clients() == 1 { + break; + } + tokio::time::sleep(std::time::Duration::from_millis(10)).await; + } + + assert_eq!(handle.connected_clients(), 1); + + ws.close(None).await.ok(); + handle.shutdown().await; + } + + #[tokio::test] + async fn test_shutdown_with_timeout_returns_with_active_websocket() { + use tokio_tungstenite::connect_async; + + let handle = start_test_gateway().await; + let ws_url = format!("ws://{}/ws", handle.addr); + let (_ws, _) = connect_async(&ws_url).await.expect("ws connect"); + + let result = tokio::time::timeout( + std::time::Duration::from_secs(1), + handle.shutdown_with_timeout(std::time::Duration::from_millis(10)), + ) + .await; + + assert!(result.is_ok(), "shutdown timeout should prevent hangs"); + } + + #[tokio::test] + async fn test_event_handle_can_emit_after_first_subscriber_connects() { + use futures::StreamExt; + use tokio_tungstenite::connect_async; + + let handle = start_test_gateway().await; + let event_handle = handle.clone_event_handle(); + let ws_url = format!("ws://{}/ws", handle.addr); + + let hello_task = tokio::spawn(async move { + while event_handle.connected_clients() == 0 { + tokio::time::sleep(std::time::Duration::from_millis(10)).await; + } + event_handle.emit(AgentEvent::token("online")).await; + }); + + let (mut ws, _) = connect_async(&ws_url).await.expect("ws connect"); + + let msg = ws.next().await.expect("no msg").expect("ws err"); + if let tokio_tungstenite::tungstenite::Message::Text(text) = msg { + let ev: serde_json::Value = serde_json::from_str(&text).expect("json"); + assert_eq!(ev["kind"], "token"); + assert_eq!(ev["delta"], "online"); + } else { + panic!("expected text message"); + } + + hello_task.await.expect("hello task panicked"); + ws.close(None).await.ok(); + handle.shutdown().await; + } + + #[tokio::test] + async fn test_ws_ping_pong() { + use futures::{SinkExt, StreamExt}; + use tokio_tungstenite::connect_async; + + let handle = start_test_gateway().await; + let ws_url = format!("ws://{}/ws", handle.addr); + + let (mut ws, _) = connect_async(&ws_url).await.expect("ws connect"); + + let ping_payload = serde_json::json!({ "cmd": "ping" }).to_string(); + ws.send(tokio_tungstenite::tungstenite::Message::Text(ping_payload)) + .await + .expect("send"); + + let msg = ws.next().await.expect("no msg").expect("ws err"); + if let tokio_tungstenite::tungstenite::Message::Text(text) = msg { + let v: serde_json::Value = serde_json::from_str(&text).expect("json"); + assert_eq!(v["kind"], "pong"); + } else { + panic!("expected text message"); + } + + ws.close(None).await.ok(); + handle.shutdown().await; + } + + #[tokio::test] + async fn test_ws_control_command_forwarded() { + use futures::SinkExt; + use tokio_tungstenite::connect_async; + + let mut handle = start_test_gateway().await; + let ws_url = format!("ws://{}/ws", handle.addr); + + let (mut ws, _) = connect_async(&ws_url).await.expect("ws connect"); + + let cmd_payload = serde_json::json!({ "cmd": "interrupt" }).to_string(); + ws.send(tokio_tungstenite::tungstenite::Message::Text(cmd_payload)) + .await + .expect("send"); + + // Give the server a moment to forward the command. + tokio::time::sleep(std::time::Duration::from_millis(50)).await; + + let cmd = handle.cmd_rx.try_recv().expect("no command received"); + assert_eq!(cmd, ControlCommand::Interrupt); + + ws.close(None).await.ok(); + handle.shutdown().await; + } +} diff --git a/crates/tools/src/builtin.rs b/crates/tools/src/builtin.rs index 086a034..5d75022 100644 --- a/crates/tools/src/builtin.rs +++ b/crates/tools/src/builtin.rs @@ -150,8 +150,13 @@ impl ToolHandler for BashExecTool { let output = tokio::time::timeout( Duration::from_secs(30), tokio::task::spawn_blocking(move || { - std::process::Command::new("sh") - .arg("-c") + let (shell, flag) = if cfg!(windows) { + ("cmd", "/C") + } else { + ("sh", "-c") + }; + std::process::Command::new(shell) + .arg(flag) .arg(&command) .output() }), @@ -284,9 +289,8 @@ mod tests { #[tokio::test] async fn bash_exec_nonzero_exit_is_error() { let tool = BashExecTool; - // ls on a non-existent path exits non-zero; ls is in the allowlist let out = tool - .call(json!({"command": "ls /this_path_does_not_exist_xyz_12345"})) + .call(json!({"command": "cargo --definitely-not-a-real-cargo-flag"})) .await; assert!(out.is_error, "expected error for non-zero exit"); } @@ -646,13 +650,14 @@ mod skill_tests { } async fn unique_skills_dir() -> (std::path::PathBuf, MutexGuard<'static, ()>) { let guard = get_env_lock().lock().await; - let id = COUNTER.fetch_add(1, Ordering::Relaxed); - let dir = - std::env::temp_dir().join(format!("anvil_skill_test_{}_{}", id, std::process::id())); - std::fs::create_dir_all(&dir).unwrap(); - std::env::set_var("ANVIL_SKILLS_DIR", &dir); - (dir, guard) - } + let id = COUNTER.fetch_add(1, Ordering::Relaxed); + let dir = + std::env::temp_dir().join(format!("anvil_skill_test_{}_{}", id, std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + std::env::set_var("ANVIL_SKILLS_DIR", &dir); + (dir, guard) + } #[tokio::test] async fn save_skill_creates_new_file() { let (tmp, _guard) = unique_skills_dir().await; diff --git a/crates/tui/Cargo.toml b/crates/tui/Cargo.toml new file mode 100644 index 0000000..c162354 --- /dev/null +++ b/crates/tui/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "harness-tui" +version.workspace = true +edition.workspace = true +authors.workspace = true +license.workspace = true +rust-version.workspace = true +description = "Interactive ratatui TUI for monitoring a running Anvil agent via harness-gateway" + +[[bin]] +name = "anvil-tui" +path = "src/main.rs" + +[dependencies] +# Workspace +anyhow = { workspace = true } +clap = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +tokio = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } +chrono = { workspace = true } +uuid = { workspace = true } + +# TUI +ratatui = "0.28" +crossterm = { version = "0.27", features = ["event-stream"] } + +# WebSocket client +tokio-tungstenite = { version = "0.24", features = ["native-tls"] } +futures-util = "0.3" diff --git a/crates/tui/src/app.rs b/crates/tui/src/app.rs new file mode 100644 index 0000000..24fa2be --- /dev/null +++ b/crates/tui/src/app.rs @@ -0,0 +1,178 @@ +//! Application state and main event loop. + +use std::collections::VecDeque; +use std::time::Duration; + +use anyhow::Result; +use crossterm::event::{self, Event, KeyCode, KeyModifiers}; +use ratatui::{backend::Backend, Terminal}; +use tokio::sync::mpsc; + +use crate::events::{AgentEvent, AppEvent, GatewayStatus}; +use crate::ui; + +/// Application state. +pub struct App { + /// Capped event history + pub events: VecDeque, + pub max_events: usize, + /// Scroll offset in the event list + pub list_offset: usize, + /// Currently selected event index + pub selected: Option, + /// Current gateway URL + pub gateway_url: String, + /// Current gateway connection status + pub gateway_status: GatewayStatus, + /// Scroll offset in the detail panel + pub detail_offset: usize, + + event_rx: mpsc::UnboundedReceiver, + event_tx: mpsc::UnboundedSender, +} + +impl App { + pub fn new( + max_events: usize, + gateway_url: String, + event_rx: mpsc::UnboundedReceiver, + event_tx: mpsc::UnboundedSender, + ) -> Self { + Self { + events: VecDeque::with_capacity(max_events), + max_events, + list_offset: 0, + selected: None, + gateway_url, + gateway_status: GatewayStatus::Connecting, + detail_offset: 0, + event_rx, + event_tx, + } + } + + /// Main event loop. Drives both terminal input and gateway events. + pub async fn run(&mut self, terminal: &mut Terminal) -> Result<()> { + loop { + // Draw + terminal.draw(|f| ui::draw(f, self))?; + + // Poll for events — give terminal input priority, but don't block long + // so gateway events are still processed promptly. + if event::poll(Duration::from_millis(50))? { + if let Event::Key(key) = event::read()? { + if let Some(ev) = self.handle_key(key.code, key.modifiers) { + let _ = self.event_tx.send(ev); + } + } + } + + // Drain channel (non-blocking) + loop { + match self.event_rx.try_recv() { + Ok(AppEvent::Quit) => return Ok(()), + Ok(AppEvent::Key(k)) => { + if let Some(ev) = self.handle_key(k.code, k.modifiers) { + if matches!(ev, AppEvent::Quit) { + return Ok(()); + } + } + } + Ok(AppEvent::Agent(agent_event)) => { + self.push_event(agent_event); + } + Ok(AppEvent::GatewayStatus(status)) => { + self.gateway_status = status; + } + Err(mpsc::error::TryRecvError::Empty) => break, + Err(mpsc::error::TryRecvError::Disconnected) => return Ok(()), + } + } + } + } + + /// Push a new agent event, capping history at `max_events`. + fn push_event(&mut self, event: AgentEvent) { + if self.events.len() >= self.max_events { + self.events.pop_front(); + // Adjust selection/offset if needed + if let Some(sel) = self.selected { + self.selected = sel.checked_sub(1); + } + if self.list_offset > 0 { + self.list_offset -= 1; + } + } + self.events.push_back(event); + } + + /// Handle a key press. Returns an `AppEvent` to enqueue, or None. + fn handle_key(&mut self, code: KeyCode, modifiers: KeyModifiers) -> Option { + match code { + KeyCode::Char('q') | KeyCode::Char('Q') => return Some(AppEvent::Quit), + KeyCode::Char('c') if modifiers.contains(KeyModifiers::CONTROL) => { + return Some(AppEvent::Quit); + } + KeyCode::Down | KeyCode::Char('j') => self.select_next(), + KeyCode::Up | KeyCode::Char('k') => self.select_prev(), + KeyCode::PageDown => { + for _ in 0..10 { + self.select_next(); + } + } + KeyCode::PageUp => { + for _ in 0..10 { + self.select_prev(); + } + } + KeyCode::Home | KeyCode::Char('g') => { + self.selected = if self.events.is_empty() { + None + } else { + Some(0) + }; + self.list_offset = 0; + self.detail_offset = 0; + } + KeyCode::End | KeyCode::Char('G') => { + if !self.events.is_empty() { + self.selected = Some(self.events.len() - 1); + self.list_offset = self.events.len().saturating_sub(1); + } + self.detail_offset = 0; + } + KeyCode::Char('d') => { + self.detail_offset = self.detail_offset.saturating_add(5); + } + KeyCode::Char('u') => { + self.detail_offset = self.detail_offset.saturating_sub(5); + } + _ => {} + } + None + } + + fn select_next(&mut self) { + if self.events.is_empty() { + self.selected = None; + return; + } + self.selected = Some(match self.selected { + None => 0, + Some(i) => (i + 1).min(self.events.len() - 1), + }); + self.detail_offset = 0; + } + + fn select_prev(&mut self) { + if self.events.is_empty() { + self.selected = None; + return; + } + self.selected = Some(match self.selected { + None => 0, + Some(i) => i.saturating_sub(1), + }); + self.detail_offset = 0; + } +} diff --git a/crates/tui/src/events.rs b/crates/tui/src/events.rs new file mode 100644 index 0000000..910e424 --- /dev/null +++ b/crates/tui/src/events.rs @@ -0,0 +1,144 @@ +//! Internal event types that flow through the TUI's mpsc channel. + +use chrono::{DateTime, Utc}; +use crossterm::event::KeyEvent; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +/// Events from the gateway WebSocket, matching harness-gateway's wire format. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(tag = "kind", rename_all = "snake_case")] +pub enum AgentEvent { + TurnStart { + id: Uuid, + session_id: Uuid, + ts: DateTime, + }, + Token { + turn_id: Uuid, + delta: String, + ts: DateTime, + }, + ToolCall { + turn_id: Uuid, + tool_use_id: String, + name: String, + input: serde_json::Value, + ts: DateTime, + }, + ToolResult { + turn_id: Uuid, + tool_use_id: String, + content: String, + ts: DateTime, + }, + TurnComplete { + turn_id: Uuid, + stop_reason: String, + input_tokens: u32, + output_tokens: u32, + ts: DateTime, + }, + Error { + turn_id: Option, + message: String, + ts: DateTime, + }, +} + +impl AgentEvent { + /// Short label for display in the event list. + #[allow(dead_code)] + pub fn label(&self) -> &'static str { + match self { + Self::TurnStart { .. } => "TURN_START", + Self::Token { .. } => "TOKEN", + Self::ToolCall { .. } => "TOOL_CALL", + Self::ToolResult { .. } => "TOOL_RESULT", + Self::TurnComplete { .. } => "TURN_COMPLETE", + Self::Error { .. } => "ERROR", + } + } + + /// Human-readable one-line summary. + pub fn summary(&self) -> String { + match self { + Self::TurnStart { session_id, .. } => { + format!("session {}", &session_id.to_string()[..8]) + } + Self::Token { delta, .. } => { + let truncated = delta.chars().take(60).collect::(); + if delta.len() > 60 { + format!("{}…", truncated) + } else { + truncated + } + } + Self::ToolCall { name, .. } => name.clone(), + Self::ToolResult { tool_use_id, .. } => { + format!("id={}", &tool_use_id[..tool_use_id.len().min(8)]) + } + Self::TurnComplete { + stop_reason, + input_tokens, + output_tokens, + .. + } => { + format!( + "{} ({} in / {} out tokens)", + stop_reason, input_tokens, output_tokens + ) + } + Self::Error { message, .. } => message.clone(), + } + } + + /// Full detail text for the detail panel. + pub fn detail(&self) -> String { + serde_json::to_string_pretty(self).unwrap_or_else(|_| "".into()) + } + + pub fn timestamp(&self) -> DateTime { + match self { + Self::TurnStart { ts, .. } + | Self::Token { ts, .. } + | Self::ToolCall { ts, .. } + | Self::ToolResult { ts, .. } + | Self::TurnComplete { ts, .. } + | Self::Error { ts, .. } => *ts, + } + } +} + +/// Top-level event type for the app's main loop. +pub enum AppEvent { + /// Key press from the terminal (reserved for future channel-based input) + #[allow(dead_code)] + Key(KeyEvent), + /// New agent event received from gateway + Agent(AgentEvent), + /// Gateway connection status changed + GatewayStatus(GatewayStatus), + /// Request to quit + Quit, +} + +/// Connection status for the status bar. +#[derive(Debug, Clone)] +pub enum GatewayStatus { + Connecting, + Connected, + Disconnected { reason: String }, + Reconnecting { attempt: u32 }, +} + +impl std::fmt::Display for GatewayStatus { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Connecting => write!(f, "connecting…"), + Self::Connected => write!(f, "connected"), + Self::Disconnected { reason } => write!(f, "disconnected: {reason}"), + Self::Reconnecting { attempt } => write!(f, "reconnecting (attempt {attempt})…"), + } + } +} diff --git a/crates/tui/src/gateway.rs b/crates/tui/src/gateway.rs new file mode 100644 index 0000000..6080149 --- /dev/null +++ b/crates/tui/src/gateway.rs @@ -0,0 +1,79 @@ +//! WebSocket client that connects to harness-gateway and forwards events. + +use futures_util::StreamExt; +use tokio::sync::mpsc; +use tokio::time::{sleep, Duration}; +use tokio_tungstenite::connect_async; +use tracing::{error, info, warn}; + +use crate::events::{AgentEvent, AppEvent, GatewayStatus}; + +const INITIAL_BACKOFF_MS: u64 = 500; +const MAX_BACKOFF_MS: u64 = 30_000; + +/// Runs the gateway client with automatic reconnection. +/// Never returns (runs until the TUI exits via channel close). +pub async fn run_gateway_client(url: String, tx: mpsc::UnboundedSender) { + let mut backoff_ms = INITIAL_BACKOFF_MS; + let mut attempt: u32 = 0; + + loop { + // Signal connecting + let _ = tx.send(AppEvent::GatewayStatus(if attempt == 0 { + GatewayStatus::Connecting + } else { + GatewayStatus::Reconnecting { attempt } + })); + + match connect_async(&url).await { + Ok((ws_stream, _)) => { + info!("Connected to gateway at {url}"); + backoff_ms = INITIAL_BACKOFF_MS; + attempt = 0; + let _ = tx.send(AppEvent::GatewayStatus(GatewayStatus::Connected)); + + let (_, mut read) = ws_stream.split(); + + while let Some(msg_result) = read.next().await { + match msg_result { + Ok(msg) => { + if let Ok(text) = msg.into_text() { + match serde_json::from_str::(&text) { + Ok(event) => { + if tx.send(AppEvent::Agent(event)).is_err() { + // TUI shut down + return; + } + } + Err(e) => { + warn!("Failed to parse gateway message: {e} — raw: {text}"); + } + } + } + } + Err(e) => { + error!("WebSocket error: {e}"); + break; + } + } + } + + let reason = "connection closed".to_string(); + let _ = tx.send(AppEvent::GatewayStatus(GatewayStatus::Disconnected { + reason, + })); + } + Err(e) => { + let reason = e.to_string(); + warn!("Gateway connection failed: {reason}"); + let _ = tx.send(AppEvent::GatewayStatus(GatewayStatus::Disconnected { + reason, + })); + } + } + + attempt += 1; + sleep(Duration::from_millis(backoff_ms)).await; + backoff_ms = (backoff_ms * 2).min(MAX_BACKOFF_MS); + } +} diff --git a/crates/tui/src/main.rs b/crates/tui/src/main.rs new file mode 100644 index 0000000..b99ecc0 --- /dev/null +++ b/crates/tui/src/main.rs @@ -0,0 +1,92 @@ +//! harness-tui — interactive ratatui TUI for monitoring an Anvil agent. +//! +//! Connects to a running `harness-gateway` WebSocket endpoint and renders: +//! - Live event feed (turns, tokens, tool calls, tool results, errors) +//! - Selected-event detail panel +//! - Connection status bar +//! +//! # Usage +//! +//! ```bash +//! anvil-tui --gateway ws://127.0.0.1:9000/ws +//! ``` +#![forbid(unsafe_code)] +#![allow(clippy::module_name_repetitions)] + +mod app; +mod events; +mod gateway; +mod ui; + +use anyhow::Result; +use clap::Parser; +use crossterm::{ + event::{DisableMouseCapture, EnableMouseCapture}, + execute, + terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, +}; +use ratatui::{backend::CrosstermBackend, Terminal}; +use std::io; +use tokio::sync::mpsc; + +use app::App; +use events::AppEvent; + +/// Monitor a live Anvil agent session via the harness-gateway WebSocket. +#[derive(Parser, Debug)] +#[command(name = "anvil-tui", version, about)] +struct Args { + /// WebSocket URL of harness-gateway + #[arg(long, default_value = "ws://127.0.0.1:9000/ws")] + gateway: String, + + /// Maximum number of events to keep in memory + #[arg(long, default_value_t = 500)] + max_events: usize, +} + +#[tokio::main] +async fn main() -> Result<()> { + let args = Args::parse(); + + tracing_subscriber::fmt() + .with_env_filter( + std::env::var("RUST_LOG") + .unwrap_or_else(|_| "warn".into()) + .as_str(), + ) + .with_writer(std::io::stderr) + .init(); + + // Channel: gateway task → TUI + let (event_tx, event_rx) = mpsc::unbounded_channel::(); + + // Spawn gateway connection task + let gw_url = args.gateway.clone(); + let tx = event_tx.clone(); + tokio::spawn(async move { + gateway::run_gateway_client(gw_url, tx).await; + }); + + // Set up terminal + enable_raw_mode()?; + let mut stdout = io::stdout(); + execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?; + let backend = CrosstermBackend::new(stdout); + let mut terminal = Terminal::new(backend)?; + + // Run the app + let mut app = App::new(args.max_events, args.gateway, event_rx, event_tx); + let result = app.run(&mut terminal).await; + + // Restore terminal + disable_raw_mode()?; + execute!( + terminal.backend_mut(), + LeaveAlternateScreen, + DisableMouseCapture + )?; + terminal.show_cursor()?; + + result +} diff --git a/crates/tui/src/ui.rs b/crates/tui/src/ui.rs new file mode 100644 index 0000000..c64e296 --- /dev/null +++ b/crates/tui/src/ui.rs @@ -0,0 +1,183 @@ +//! Rendering logic for the TUI. + +use ratatui::{ + layout::{Constraint, Direction, Layout}, + style::{Color, Modifier, Style}, + text::{Line, Span, Text}, + widgets::{Block, Borders, List, ListItem, ListState, Paragraph, Wrap}, + Frame, +}; + +use crate::{app::App, events::AgentEvent}; + +/// Top-level draw function. +pub fn draw(f: &mut Frame, app: &mut App) { + let area = f.area(); + + // Outer layout: title bar + content + status bar + let outer = Layout::default() + .direction(Direction::Vertical) + .constraints([ + Constraint::Length(1), // title + Constraint::Min(0), // content + Constraint::Length(1), // status + ]) + .split(area); + + // Title bar + let title = Paragraph::new(Line::from(vec![ + Span::styled( + " anvil-tui ", + Style::default().fg(Color::Black).bg(Color::Cyan), + ), + Span::raw(" "), + Span::styled(&app.gateway_url, Style::default().fg(Color::DarkGray)), + Span::raw(" "), + Span::styled( + "[j/k] navigate [d/u] detail scroll [G] end [g] top [q] quit", + Style::default().fg(Color::DarkGray), + ), + ])); + f.render_widget(title, outer[0]); + + // Content: event list (left) + detail panel (right) + let content = Layout::default() + .direction(Direction::Horizontal) + .constraints([Constraint::Percentage(45), Constraint::Percentage(55)]) + .split(outer[1]); + + draw_event_list(f, app, content[0]); + draw_detail_panel(f, app, content[1]); + + // Status bar + let status_text = format!(" {} events | {} ", app.events.len(), app.gateway_status); + let status_color = match &app.gateway_status { + crate::events::GatewayStatus::Connected => Color::Green, + crate::events::GatewayStatus::Disconnected { .. } => Color::Red, + _ => Color::Yellow, + }; + let status = Paragraph::new(Line::from(Span::styled( + status_text, + Style::default().fg(status_color), + ))); + f.render_widget(status, outer[2]); +} + +fn draw_event_list(f: &mut Frame, app: &mut App, area: ratatui::layout::Rect) { + let items: Vec = app + .events + .iter() + .enumerate() + .map(|(i, event)| { + let selected = app.selected == Some(i); + let (label_color, label) = event_label_style(event); + + let ts = event.timestamp().format("%H:%M:%S").to_string(); + let summary = event.summary(); + + let style = if selected { + Style::default().bg(Color::DarkGray) + } else { + Style::default() + }; + + ListItem::new(Line::from(vec![ + Span::styled( + format!("{ts} "), + Style::default() + .fg(Color::DarkGray) + .add_modifier(if selected { + Modifier::BOLD + } else { + Modifier::empty() + }), + ), + Span::styled( + format!("{label:<12} "), + Style::default() + .fg(label_color) + .add_modifier(Modifier::BOLD), + ), + Span::styled(summary, style), + ])) + }) + .collect(); + + let mut list_state = ListState::default(); + if let Some(sel) = app.selected { + list_state.select(Some(sel)); + } + + let list = List::new(items) + .block(Block::default().borders(Borders::ALL).title(" Events ")) + .highlight_style(Style::default().bg(Color::DarkGray)); + + f.render_stateful_widget(list, area, &mut list_state); +} + +fn draw_detail_panel(f: &mut Frame, app: &App, area: ratatui::layout::Rect) { + let content = match app.selected.and_then(|i| app.events.get(i)) { + None => Text::from(vec![ + Line::from(""), + Line::from(Span::styled( + " No event selected.", + Style::default().fg(Color::DarkGray), + )), + Line::from(""), + Line::from(Span::styled( + " Use j/k to navigate the event list.", + Style::default().fg(Color::DarkGray), + )), + ]), + Some(event) => { + let (color, label) = event_label_style(event); + let detail = event.detail(); + let mut lines = vec![ + Line::from(vec![ + Span::raw(" "), + Span::styled( + label, + Style::default().fg(color).add_modifier(Modifier::BOLD), + ), + Span::raw(" "), + Span::styled( + event + .timestamp() + .format("%Y-%m-%d %H:%M:%S UTC") + .to_string(), + Style::default().fg(Color::DarkGray), + ), + ]), + Line::from(""), + ]; + for raw_line in detail.lines() { + lines.push(Line::from(format!(" {raw_line}"))); + } + Text::from(lines) + } + }; + + // Scroll: skip `detail_offset` lines + let scrolled_content: Vec = content.lines.into_iter().skip(app.detail_offset).collect(); + + let paragraph = Paragraph::new(Text::from(scrolled_content)) + .block( + Block::default() + .borders(Borders::ALL) + .title(" Detail [d/u scroll] "), + ) + .wrap(Wrap { trim: false }); + + f.render_widget(paragraph, area); +} + +fn event_label_style(event: &AgentEvent) -> (Color, &'static str) { + match event { + AgentEvent::TurnStart { .. } => (Color::Cyan, "TURN_START"), + AgentEvent::Token { .. } => (Color::White, "TOKEN"), + AgentEvent::ToolCall { .. } => (Color::Yellow, "TOOL_CALL"), + AgentEvent::ToolResult { .. } => (Color::Green, "TOOL_RESULT"), + AgentEvent::TurnComplete { .. } => (Color::Blue, "TURN_COMPLETE"), + AgentEvent::Error { .. } => (Color::Red, "ERROR"), + } +}