commit c14080ff4e95e64926c447ebbb4d76890b41de0d Author: AB-UK Date: Wed Dec 24 01:36:12 2025 +0000 Init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3ff8249 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +.crush diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..d669e5b --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2883 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "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 = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-openai" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb7051804e03daf32cd7e45e7a655bb6cea9283309d2253babfb38c09f4ea03" +dependencies = [ + "async-openai-macros", + "backoff", + "base64", + "bytes", + "derive_builder", + "eventsource-stream", + "futures", + "getrandom 0.3.4", + "rand 0.9.2", + "reqwest", + "reqwest-eventsource", + "secrecy", + "serde", + "serde_json", + "serde_urlencoded", + "thiserror 2.0.17", + "tokio", + "tokio-stream", + "tokio-util", + "tracing", + "url", +] + +[[package]] +name = "async-openai-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81872a8e595e8ceceab71c6ba1f9078e313b452a1e31934e6763ef5d308705e4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "backoff" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" +dependencies = [ + "futures-core", + "getrandom 0.2.16", + "instant", + "pin-project-lite", + "rand 0.8.5", + "tokio", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[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.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "bytes" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" + +[[package]] +name = "cc" +version = "1.2.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f50d563227a1c37cc0a263f64eca3334388c01c5e4c4861a9def205c614383c" +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 = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[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 = "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 = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[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 = "derive_builder" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" +dependencies = [ + "derive_builder_core", + "syn", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[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 = "duty-ai-ops" +version = "0.1.0" +dependencies = [ + "async-openai", + "chrono", + "futures", + "k8s-openapi", + "kube", + "serde", + "serde_json", + "tokio", + "toml", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "enum-ordinalize" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "event-listener" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "eventsource-stream" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74fef4569247a5f429d9156b9d0a2599914385dd189c539334c625d8099d90ab" +dependencies = [ + "futures-core", + "nom", + "pin-project-lite", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" + +[[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 = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "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.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "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 = "headers" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3314d5adb5d94bcdf56771f2e50dbbc80bb4bdf88967526706205ac9eff24eb" +dependencies = [ + "base64", + "bytes", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" +dependencies = [ + "http", +] + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-http-proxy" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ad4b0a1e37510028bc4ba81d0e38d239c39671b0f0ce9e02dfa93a8133f7c08" +dependencies = [ + "bytes", + "futures-util", + "headers", + "http", + "hyper", + "hyper-rustls", + "hyper-util", + "pin-project-lite", + "rustls-native-certs 0.7.3", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[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", + "log", + "rustls", + "rustls-native-certs 0.8.2", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "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.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itoa" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010" + +[[package]] +name = "js-sys" +version = "0.3.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 1.0.69", +] + +[[package]] +name = "jsonpath-rust" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c00ae348f9f8fd2d09f82a98ca381c60df9e0820d8d79fce43e649b4dc3128b" +dependencies = [ + "pest", + "pest_derive", + "regex", + "serde_json", + "thiserror 2.0.17", +] + +[[package]] +name = "jsonptr" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "k8s-openapi" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8847402328d8301354c94d605481f25a6bdc1ed65471fd96af8eca71141b13" +dependencies = [ + "base64", + "chrono", + "serde", + "serde-value", + "serde_json", +] + +[[package]] +name = "kube" +version = "0.97.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fd2596428f922f784ca43907c449f104d69055c811135684474143736c67ae" +dependencies = [ + "k8s-openapi", + "kube-client", + "kube-core", + "kube-derive", + "kube-runtime", +] + +[[package]] +name = "kube-client" +version = "0.97.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d539b6493d162ae5ab691762be972b6a1c20f6d8ddafaae305c0e2111b589d99" +dependencies = [ + "base64", + "bytes", + "chrono", + "either", + "futures", + "home", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-http-proxy", + "hyper-rustls", + "hyper-timeout", + "hyper-util", + "jsonpath-rust", + "k8s-openapi", + "kube-core", + "pem", + "rustls", + "rustls-pemfile", + "secrecy", + "serde", + "serde_json", + "serde_yaml", + "thiserror 2.0.17", + "tokio", + "tokio-util", + "tower", + "tower-http", + "tracing", +] + +[[package]] +name = "kube-core" +version = "0.97.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98a87cc0046cf6b62cbb63ae1fbc366ee8ba29269f575289679473754ff5d7a7" +dependencies = [ + "chrono", + "form_urlencoded", + "http", + "json-patch", + "k8s-openapi", + "schemars", + "serde", + "serde-value", + "serde_json", + "thiserror 2.0.17", +] + +[[package]] +name = "kube-derive" +version = "0.97.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65576922713e6154a89b5a8d2747adca15725b90fa64fc2b828774bf96d6acd8" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "serde_json", + "syn", +] + +[[package]] +name = "kube-runtime" +version = "0.97.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f348cc3e6c9be0ae17f300594bde541b667d10ab8934a119edd61ab5123c43e" +dependencies = [ + "ahash", + "async-broadcast", + "async-stream", + "async-trait", + "backoff", + "educe", + "futures", + "hashbrown 0.15.5", + "json-patch", + "jsonptr", + "k8s-openapi", + "kube-client", + "parking_lot", + "pin-project", + "serde", + "serde_json", + "thiserror 2.0.17", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.178" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[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-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "pem" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" +dependencies = [ + "base64", + "serde_core", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pest" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbcfd20a6d4eeba40179f05735784ad32bdaef05ce8e8af05f180d45bb3e7e22" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f72981ade67b1ca6adc26ec221be9f463f2b5839c7508998daa17c23d94d7f" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee9efd8cdb50d719a80088b76f81aec7c41ed6d522ee750178f83883d271625" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf1d70880e76bdc13ba52eafa6239ce793d85c8e43896507e43dd8984ff05b82" +dependencies = [ + "pest", + "sha2", +] + +[[package]] +name = "pin-project" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +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 = "proc-macro2" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.17", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.17", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-native-certs 0.8.2", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", +] + +[[package]] +name = "reqwest-eventsource" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632c55746dbb44275691640e7b40c907c16a2dc1a5842aa98aaec90da6ec6bde" +dependencies = [ + "eventsource-stream", + "futures-core", + "futures-timer", + "mime", + "nom", + "pin-project-lite", + "reqwest", + "thiserror 1.0.69", +] + +[[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.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustls" +version = "0.23.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework 2.11.1", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9980d917ebb0c0536119ba501e90834767bffc3d60641457fd84a1f3fd337923" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework 3.5.1", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +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.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62049b2877bf12821e8f9ad256ee38fdc31db7387ec2d3b3f403024de2034aea" + +[[package]] +name = "schannel" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "secrecy" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a" +dependencies = [ + "serde", + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "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-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.146" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "217ca874ae0207aac254aa02c957ded05585a90892cc8d87f9e5fa49669dadd8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "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 = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[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-registry" +version = "1.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[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.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +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 = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-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.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "slab", + "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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tokio-util", + "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 = [ + "base64", + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "mime", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[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.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +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 = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "unicase" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[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.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[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.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" +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 = "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-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.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.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d5084b4 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "duty-ai-ops" +version = "0.1.0" +edition = "2021" + +[dependencies] +async-openai = { version = "0.32", features = ["chat-completion"] } +tokio = { version = "1", features = ["full", "signal"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +toml = "0.8" +kube = { version = "0.97", features = ["runtime", "derive"] } +k8s-openapi = { version = "0.23", features = ["v1_31"] } +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] } +futures = "0.3" +chrono = "0.4" diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..2462fb7 --- /dev/null +++ b/config.toml @@ -0,0 +1,10 @@ +# API Configuration +api_base = "http://localhost:11434/v1" +api_key = "ollama" +model = "qwen3-tools:latest" + +# AI concurrency settings +max_concurrent_diagnoses = 1 # Maximum parallel AI diagnosis requests + +# System prompt for the AI assistant +system_prompt = "You are a Kubernetes diagnostic system. Analyze issues using provided tools and output ONLY a brief technical diagnosis in plain text. Rules: 1) Call tools to gather data. 2) After getting data, output diagnosis as plain text - NO XML, NO function calls in output. 3) Format: 'Resource [name] - [problem]. Cause: [technical reason].' 4) Maximum 3 sentences. 5) If tool fails with error, diagnose based on error message. 6) Output must be plain text diagnosis, not tool calls." diff --git a/src/ai/client.rs b/src/ai/client.rs new file mode 100644 index 0000000..6606dc7 --- /dev/null +++ b/src/ai/client.rs @@ -0,0 +1,57 @@ +use crate::config::Config; +use async_openai::{ + config::OpenAIConfig, + types::chat::{ + ChatCompletionRequestMessage, ChatCompletionRequestSystemMessageArgs, + ChatCompletionRequestUserMessageArgs, + }, + Client, +}; + +#[derive(Clone)] +pub struct AIClient { + client: Client, + model: String, + system_prompt: String, +} + +impl AIClient { + pub fn new(cfg: &Config) -> Self { + let config = OpenAIConfig::new() + .with_api_base(&cfg.api_base) + .with_api_key(&cfg.api_key); + + let client = Client::with_config(config); + + Self { + client, + model: cfg.model.clone(), + system_prompt: cfg.system_prompt.clone(), + } + } + + pub fn client(&self) -> &Client { + &self.client + } + + pub fn model(&self) -> &str { + &self.model + } + + pub fn system_message(&self) -> Result> { + Ok(ChatCompletionRequestSystemMessageArgs::default() + .content(self.system_prompt.clone()) + .build()? + .into()) + } + + pub fn user_message( + &self, + content: String, + ) -> Result> { + Ok(ChatCompletionRequestUserMessageArgs::default() + .content(content) + .build()? + .into()) + } +} diff --git a/src/ai/diagnostics.rs b/src/ai/diagnostics.rs new file mode 100644 index 0000000..b22dd3b --- /dev/null +++ b/src/ai/diagnostics.rs @@ -0,0 +1,229 @@ +use crate::k8s::KubeClient; +use crate::tools; +use async_openai::{ + types::chat::{ + ChatCompletionMessageToolCalls, ChatCompletionRequestAssistantMessageArgs, + ChatCompletionRequestMessage, ChatCompletionRequestToolMessageArgs, + ChatCompletionTools, CreateChatCompletionRequestArgs, + }, +}; +use serde::Deserialize; +use std::time::Duration; +use tracing::{debug, warn}; + +pub struct DiagnosticEngine { + kube_client: KubeClient, +} + +#[derive(Debug, Deserialize)] +struct NodeToolArgs { + node_name: String, +} + +#[derive(Debug, Deserialize)] +struct PodDetailsArgs { + namespace: String, + pod_name: String, +} + +#[derive(Debug, Deserialize)] +struct PodLogsArgs { + namespace: String, + pod_name: String, + container_name: Option, + tail_lines: Option, +} + +impl DiagnosticEngine { + pub fn new(kube_client: KubeClient) -> Self { + Self { kube_client } + } + + /// Diagnoses NotReady nodes using AI with tool calling capability + pub async fn diagnose_nodes( + &self, + ai_client: &super::AIClient, + not_ready_nodes: Vec, + ) -> Result> { + let problem_description = format!( + "The following Kubernetes nodes are in NotReady state: {}. \ + Analyze the issue and determine the root cause. \ + Use the get_node_details tool to inspect nodes if needed.", + not_ready_nodes.join(", ") + ); + + let tools: Vec = + vec![ChatCompletionTools::Function(tools::get_node_details_tool())]; + + self.run_diagnosis(ai_client, problem_description, tools) + .await + } + + /// Diagnoses problematic pods using AI with tool calling capability + pub async fn diagnose_pod( + &self, + ai_client: &super::AIClient, + namespace: &str, + pod_name: &str, + problem_description: &str, + ) -> Result> { + let full_description = format!( + "Pod {}/{} has the following issue: {}. \ + Analyze the problem and determine the root cause. \ + Use get_pod_details to inspect the pod state and get_pod_logs to examine recent logs.", + namespace, pod_name, problem_description + ); + + let tools: Vec = vec![ + ChatCompletionTools::Function(tools::get_pod_details_tool()), + ChatCompletionTools::Function(tools::get_pod_logs_tool()), + ]; + + self.run_diagnosis(ai_client, full_description, tools) + .await + } + + async fn run_diagnosis( + &self, + ai_client: &super::AIClient, + problem_description: String, + tools: Vec, + ) -> Result> { + // Add timeout for entire diagnosis + let diagnosis = tokio::time::timeout( + Duration::from_secs(60), + self.run_diagnosis_inner(ai_client, problem_description, tools), + ) + .await; + + match diagnosis { + Ok(result) => result, + Err(_) => { + warn!("AI diagnosis timed out after 60 seconds"); + Err("Diagnosis timeout".into()) + } + } + } + + async fn run_diagnosis_inner( + &self, + ai_client: &super::AIClient, + problem_description: String, + tools: Vec, + ) -> Result> { + let mut messages: Vec = vec![ + ai_client.system_message()?, + ai_client.user_message(problem_description)?, + ]; + + // Conversation loop + for iteration in 0..10 { + debug!(iteration = iteration + 1, "AI diagnosis iteration"); + + let request = CreateChatCompletionRequestArgs::default() + .model(ai_client.model()) + .messages(messages.clone()) + .tools(tools.clone()) + .build()?; + + debug!("Sending request to AI"); + let response = ai_client.client().chat().create(request).await?; + debug!("Received response from AI"); + + let choice = response.choices.first().ok_or("No response from AI")?; + let assistant_message = choice.message.clone(); + + if let Some(tool_calls) = &assistant_message.tool_calls { + debug!(tool_count = tool_calls.len(), "AI calling tools"); + + messages.push( + ChatCompletionRequestAssistantMessageArgs::default() + .tool_calls(tool_calls.clone()) + .build()? + .into(), + ); + + for tool_call_enum in tool_calls { + if let ChatCompletionMessageToolCalls::Function(tool_call) = tool_call_enum { + let tool_name = &tool_call.function.name; + let tool_args = &tool_call.function.arguments; + + debug!(tool = %tool_name, args = %tool_args, "Executing tool"); + + // Execute tool with error handling + let result = match self.execute_tool(tool_name, tool_args).await { + Ok(data) => { + debug!(tool = %tool_name, "Tool executed successfully"); + data + } + Err(e) => { + warn!(tool = %tool_name, error = %e, "Tool execution failed"); + // Return error as tool result instead of failing + format!( + "{{\"error\": \"Tool execution failed: {}\", \"available\": false}}", + e.to_string().replace('"', "'") + ) + } + }; + + messages.push( + ChatCompletionRequestToolMessageArgs::default() + .content(result) + .tool_call_id(tool_call.id.clone()) + .build()? + .into(), + ); + } + } + } else { + if let Some(content) = &assistant_message.content { + debug!("AI provided final diagnosis"); + return Ok(content.clone()); + } else { + warn!("AI returned no content and no tool calls"); + return Err("AI returned no content and no tool calls".into()); + } + } + } + + warn!("Maximum iterations reached without final answer"); + Err("Maximum iterations reached without final answer".into()) + } + + async fn execute_tool( + &self, + tool_name: &str, + arguments_json: &str, + ) -> Result> { + match tool_name { + "get_node_details" => { + let args: NodeToolArgs = serde_json::from_str(arguments_json)?; + let details = self.kube_client.get_node_details(&args.node_name).await?; + Ok(serde_json::to_string_pretty(&details)?) + } + "get_pod_details" => { + let args: PodDetailsArgs = serde_json::from_str(arguments_json)?; + let details = self + .kube_client + .get_pod_details(&args.namespace, &args.pod_name) + .await?; + Ok(serde_json::to_string_pretty(&details)?) + } + "get_pod_logs" => { + let args: PodLogsArgs = serde_json::from_str(arguments_json)?; + let tail_lines = args.tail_lines.or(Some(50)); + let logs = self + .kube_client + .get_pod_logs( + &args.namespace, + &args.pod_name, + args.container_name.as_deref(), + tail_lines, + ) + .await?; + Ok(serde_json::to_string_pretty(&logs)?) + } + _ => Err(format!("Unknown tool: {}", tool_name).into()), + } + } +} diff --git a/src/ai/mod.rs b/src/ai/mod.rs new file mode 100644 index 0000000..3a44889 --- /dev/null +++ b/src/ai/mod.rs @@ -0,0 +1,5 @@ +mod client; +mod diagnostics; + +pub use client::AIClient; +pub use diagnostics::DiagnosticEngine; diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..2b01030 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,24 @@ +use serde::Deserialize; +use std::fs; + +#[derive(Debug, Deserialize)] +pub struct Config { + pub api_base: String, + pub api_key: String, + pub model: String, + pub system_prompt: String, + #[serde(default = "default_max_concurrent_diagnoses")] + pub max_concurrent_diagnoses: usize, +} + +fn default_max_concurrent_diagnoses() -> usize { + 1 +} + +impl Config { + pub fn load(path: &str) -> Result> { + let content = fs::read_to_string(path)?; + let config: Config = toml::from_str(&content)?; + Ok(config) + } +} diff --git a/src/events/handler.rs b/src/events/handler.rs new file mode 100644 index 0000000..3a0a770 --- /dev/null +++ b/src/events/handler.rs @@ -0,0 +1,185 @@ +use crate::ai::{AIClient, DiagnosticEngine}; +use crate::k8s::{KubeClient, NodeEvent, NodeEventType, PodEvent, PodEventType}; +use std::sync::Arc; +use tokio::sync::Semaphore; +use tracing::{error, info, warn}; + +#[derive(Clone)] +pub struct EventHandler { + kube_client: KubeClient, + ai_client: AIClient, + // Semaphore to limit concurrent AI diagnoses + diagnosis_semaphore: Arc, +} + +impl EventHandler { + pub fn new(kube_client: KubeClient, ai_client: AIClient, max_concurrent: usize) -> Self { + Self { + kube_client, + ai_client, + diagnosis_semaphore: Arc::new(Semaphore::new(max_concurrent)), + } + } + + /// Handle node event and trigger AI diagnostics if needed + pub async fn handle_node_event(&self, event: NodeEvent) { + match event.event_type { + NodeEventType::BecameNotReady => { + warn!( + node = %event.node_name, + "Node became NotReady, starting AI diagnostics" + ); + self.diagnose_node(&event.node_name).await; + } + NodeEventType::ConditionChanged { + ref condition_type, + ref status, + ref reason, + } => { + warn!( + node = %event.node_name, + condition = %condition_type, + status = %status, + reason = ?reason, + "Problematic condition detected, starting AI diagnostics" + ); + self.diagnose_node(&event.node_name).await; + } + NodeEventType::BecameReady => { + info!(node = %event.node_name, "Node became Ready"); + } + } + } + + /// Handle pod event and trigger AI diagnostics if needed + pub async fn handle_pod_event(&self, event: PodEvent) { + let problem_description = match &event.event_type { + PodEventType::HighRestartCount { count } => { + warn!( + pod = %event.pod_name, + namespace = %event.namespace, + restart_count = count, + "Pod has high restart count" + ); + format!("High restart count: {} restarts", count) + } + PodEventType::CrashLoopBackOff => { + warn!( + pod = %event.pod_name, + namespace = %event.namespace, + "Pod in CrashLoopBackOff" + ); + "Container is in CrashLoopBackOff state".to_string() + } + PodEventType::ImagePullError => { + warn!( + pod = %event.pod_name, + namespace = %event.namespace, + "Pod has image pull error" + ); + "Failed to pull container image".to_string() + } + PodEventType::Pending { reason } => { + warn!( + pod = %event.pod_name, + namespace = %event.namespace, + reason = ?reason, + "Pod stuck in Pending" + ); + format!( + "Pod stuck in Pending state. Reason: {}", + reason.as_deref().unwrap_or("Unknown") + ) + } + PodEventType::Failed { reason } => { + warn!( + pod = %event.pod_name, + namespace = %event.namespace, + reason = ?reason, + "Pod in Failed state" + ); + format!( + "Pod in Failed state. Reason: {}", + reason.as_deref().unwrap_or("Unknown") + ) + } + PodEventType::ContainerCreating { duration_seconds } => { + warn!( + pod = %event.pod_name, + namespace = %event.namespace, + duration_seconds = duration_seconds, + "Container creating for too long" + ); + format!( + "Container has been creating for {} seconds", + duration_seconds + ) + } + }; + + self.diagnose_pod(&event.namespace, &event.pod_name, &problem_description) + .await; + } + + async fn diagnose_node(&self, node_name: &str) { + // Acquire semaphore permit to limit concurrency + let _permit = self.diagnosis_semaphore.acquire().await.unwrap(); + + info!(node = %node_name, "Starting AI diagnosis (acquired permit)"); + + let diagnostic_engine = DiagnosticEngine::new(self.kube_client.clone()); + + match diagnostic_engine + .diagnose_nodes(&self.ai_client, vec![node_name.to_string()]) + .await + { + Ok(diagnosis) => { + info!( + node = %node_name, + diagnosis = %diagnosis, + "AI diagnosis completed" + ); + } + Err(e) => { + error!( + node = %node_name, + error = %e, + "AI diagnosis failed" + ); + } + } + // Permit is automatically released when _permit is dropped + } + + async fn diagnose_pod(&self, namespace: &str, pod_name: &str, problem: &str) { + // Acquire semaphore permit to limit concurrency + let _permit = self.diagnosis_semaphore.acquire().await.unwrap(); + + info!(pod = %pod_name, namespace = %namespace, "Starting AI diagnosis (acquired permit)"); + + let diagnostic_engine = DiagnosticEngine::new(self.kube_client.clone()); + + match diagnostic_engine + .diagnose_pod(&self.ai_client, namespace, pod_name, problem) + .await + { + Ok(diagnosis) => { + info!( + pod = %pod_name, + namespace = %namespace, + diagnosis = %diagnosis, + "AI diagnosis completed" + ); + } + Err(e) => { + error!( + pod = %pod_name, + namespace = %namespace, + error = %e, + "AI diagnosis failed" + ); + } + } + // Permit is automatically released when _permit is dropped + } +} diff --git a/src/events/mod.rs b/src/events/mod.rs new file mode 100644 index 0000000..62033bf --- /dev/null +++ b/src/events/mod.rs @@ -0,0 +1,3 @@ +mod handler; + +pub use handler::EventHandler; diff --git a/src/k8s/client.rs b/src/k8s/client.rs new file mode 100644 index 0000000..84746ff --- /dev/null +++ b/src/k8s/client.rs @@ -0,0 +1,20 @@ +use kube::{Client, Config}; + +#[derive(Clone)] +pub struct KubeClient { + client: Client, +} + +impl KubeClient { + /// Creates a client using standard credentials + /// (kubeconfig or service account from environment) + pub async fn new() -> Result> { + let config = Config::infer().await?; + let client = Client::try_from(config)?; + Ok(Self { client }) + } + + pub fn inner(&self) -> &Client { + &self.client + } +} diff --git a/src/k8s/mod.rs b/src/k8s/mod.rs new file mode 100644 index 0000000..4481b32 --- /dev/null +++ b/src/k8s/mod.rs @@ -0,0 +1,10 @@ +mod client; +mod nodes; +mod pods; +mod pod_watcher; +mod types; +mod watcher; + +pub use client::KubeClient; +pub use pod_watcher::{PodEvent, PodEventType, PodWatcher}; +pub use watcher::{NodeEvent, NodeEventType, NodeWatcher}; diff --git a/src/k8s/nodes.rs b/src/k8s/nodes.rs new file mode 100644 index 0000000..b720eeb --- /dev/null +++ b/src/k8s/nodes.rs @@ -0,0 +1,181 @@ +use super::client::KubeClient; +use super::types::{NodeCondition, NodeDetails, NodeResources, NodeStatus}; +use k8s_openapi::api::core::v1::{Node, Pod}; +use kube::{api::ListParams, Api}; + +impl KubeClient { + /// Gets list of all nodes and their statuses + pub async fn get_nodes(&self) -> Result, Box> { + let nodes: Api = Api::all(self.inner().clone()); + let node_list = nodes.list(&ListParams::default()).await?; + + let mut result = Vec::new(); + + for node in node_list.items { + let name = node + .metadata + .name + .clone() + .unwrap_or_else(|| "unknown".to_string()); + + let ready = node + .status + .as_ref() + .and_then(|s| s.conditions.as_ref()) + .and_then(|conditions| { + conditions + .iter() + .find(|c| c.type_ == "Ready") + .map(|c| c.status == "True") + }) + .unwrap_or(false); + + let version = node + .status + .as_ref() + .and_then(|s| s.node_info.as_ref()) + .map(|info| info.kubelet_version.clone()) + .unwrap_or_else(|| "unknown".to_string()); + + let internal_ip = node + .status + .as_ref() + .and_then(|s| s.addresses.as_ref()) + .and_then(|addresses| { + addresses + .iter() + .find(|a| a.type_ == "InternalIP") + .map(|a| a.address.clone()) + }); + + result.push(NodeStatus { + name, + ready, + version, + internal_ip, + }); + } + + Ok(result) + } + + /// Gets detailed information about a specific node for diagnostics + pub async fn get_node_details( + &self, + node_name: &str, + ) -> Result> { + let nodes: Api = Api::all(self.inner().clone()); + let node = nodes.get(node_name).await?; + + // Conditions + let conditions = node + .status + .as_ref() + .and_then(|s| s.conditions.as_ref()) + .map(|conds| { + conds + .iter() + .map(|c| NodeCondition { + type_: c.type_.clone(), + status: c.status.clone(), + reason: c.reason.clone(), + message: c.message.clone(), + }) + .collect() + }) + .unwrap_or_default(); + + // Resources - capacity + let capacity = node + .status + .as_ref() + .and_then(|s| s.capacity.as_ref()) + .map(|c| NodeResources { + cpu: c.get("cpu").map(|q| q.0.clone()).unwrap_or_default(), + memory: c.get("memory").map(|q| q.0.clone()).unwrap_or_default(), + pods: c.get("pods").map(|q| q.0.clone()).unwrap_or_default(), + }) + .unwrap_or(NodeResources { + cpu: "unknown".to_string(), + memory: "unknown".to_string(), + pods: "unknown".to_string(), + }); + + // Resources - allocatable + let allocatable = node + .status + .as_ref() + .and_then(|s| s.allocatable.as_ref()) + .map(|a| NodeResources { + cpu: a.get("cpu").map(|q| q.0.clone()).unwrap_or_default(), + memory: a.get("memory").map(|q| q.0.clone()).unwrap_or_default(), + pods: a.get("pods").map(|q| q.0.clone()).unwrap_or_default(), + }) + .unwrap_or(NodeResources { + cpu: "unknown".to_string(), + memory: "unknown".to_string(), + pods: "unknown".to_string(), + }); + + // Taints + let taints = node + .spec + .as_ref() + .and_then(|s| s.taints.as_ref()) + .map(|t| { + t.iter() + .map(|taint| { + format!( + "{}={} (effect: {})", + taint.key, + taint.value.as_deref().unwrap_or(""), + taint.effect + ) + }) + .collect() + }) + .unwrap_or_default(); + + // Labels + let labels = node + .metadata + .labels + .clone() + .unwrap_or_default() + .into_iter() + .collect::>(); + + // Count pods on the node + let pods: Api = Api::all(self.inner().clone()); + let pod_list = pods.list(&ListParams::default()).await?; + let pod_count = pod_list + .items + .iter() + .filter(|pod| { + pod.spec + .as_ref() + .and_then(|s| s.node_name.as_ref()) + .map(|n| n == node_name) + .unwrap_or(false) + }) + .count(); + + let version = node + .status + .as_ref() + .and_then(|s| s.node_info.as_ref()) + .map(|info| info.kubelet_version.clone()) + .unwrap_or_else(|| "unknown".to_string()); + + Ok(NodeDetails { + name: node_name.to_string(), + conditions, + capacity, + allocatable, + taints, + labels, + pod_count, + version, + }) + } +} diff --git a/src/k8s/pod_watcher.rs b/src/k8s/pod_watcher.rs new file mode 100644 index 0000000..8ea0ece --- /dev/null +++ b/src/k8s/pod_watcher.rs @@ -0,0 +1,293 @@ +use futures::TryStreamExt; +use k8s_openapi::api::core::v1::Pod; +use kube::{ + runtime::{watcher, watcher::Config, WatchStreamExt}, + Api, ResourceExt, +}; +use std::collections::HashMap; +use tracing::{debug, info, warn}; + +use super::client::KubeClient; + +#[derive(Debug, Clone)] +pub struct PodEvent { + pub pod_name: String, + pub namespace: String, + pub event_type: PodEventType, +} + +#[derive(Debug, Clone, PartialEq)] +pub enum PodEventType { + HighRestartCount { count: i32 }, + Pending { reason: Option }, + Failed { reason: Option }, + CrashLoopBackOff, + ImagePullError, + ContainerCreating { duration_seconds: i64 }, +} + +pub struct PodWatcher { + api: Api, + // Track restart counts to detect increases + restart_counts: HashMap, + // Track already reported issues to prevent spam + reported_issues: HashMap, +} + +impl PodWatcher { + pub fn new(kube_client: &KubeClient) -> Self { + let api = Api::all(kube_client.inner().clone()); + Self { + api, + restart_counts: HashMap::new(), + reported_issues: HashMap::new(), + } + } + + /// Start watching pod events + pub async fn watch( + mut self, + ) -> Result< + impl futures::Stream>>, + Box, + > { + info!("Starting pod watcher"); + + // Initialize current state + let pods = self.api.list(&Default::default()).await?; + for pod in pods.items { + let key = Self::pod_key(&pod); + let restart_count = Self::get_restart_count(&pod); + self.restart_counts.insert(key, restart_count); + } + + let stream = watcher(self.api.clone(), Config::default()) + .applied_objects() + .try_filter_map(move |pod| { + let event = self.process_pod_event(pod); + futures::future::ready(Ok(event)) + }) + .map_err(|e| Box::new(e) as Box); + + Ok(stream) + } + + fn process_pod_event(&mut self, pod: Pod) -> Option { + let name = pod.name_any(); + let namespace = pod.namespace().unwrap_or_else(|| "default".to_string()); + let key = format!("{}/{}", namespace, name); + + let phase = pod + .status + .as_ref() + .and_then(|s| s.phase.as_deref()) + .unwrap_or("Unknown"); + + // Helper to check if we should report this issue + let should_report = |event_type: &PodEventType| -> bool { + match self.reported_issues.get(&key) { + Some(prev) if prev == event_type => false, // Already reported same issue + _ => true, + } + }; + + // Check for high restart count + let current_restart_count = Self::get_restart_count(&pod); + let previous_restart_count = self.restart_counts.get(&key).copied().unwrap_or(0); + + if current_restart_count > previous_restart_count && current_restart_count >= 3 { + let event_type = PodEventType::HighRestartCount { + count: current_restart_count, + }; + + if should_report(&event_type) { + warn!( + pod = %name, + namespace = %namespace, + restart_count = current_restart_count, + "Pod has high restart count" + ); + self.restart_counts.insert(key.clone(), current_restart_count); + self.reported_issues.insert(key.clone(), event_type.clone()); + return Some(PodEvent { + pod_name: name, + namespace, + event_type, + }); + } + } + + self.restart_counts.insert(key.clone(), current_restart_count); + + // Check container states for specific errors + if let Some(container_statuses) = pod + .status + .as_ref() + .and_then(|s| s.container_statuses.as_ref()) + { + for cs in container_statuses { + if let Some(waiting) = cs.state.as_ref().and_then(|s| s.waiting.as_ref()) { + let reason = waiting.reason.as_deref().unwrap_or(""); + + match reason { + "CrashLoopBackOff" => { + let event_type = PodEventType::CrashLoopBackOff; + if should_report(&event_type) { + warn!( + pod = %name, + namespace = %namespace, + container = %cs.name, + "Container in CrashLoopBackOff" + ); + self.reported_issues.insert(key.clone(), event_type.clone()); + return Some(PodEvent { + pod_name: name, + namespace, + event_type, + }); + } + } + "ImagePullBackOff" | "ErrImagePull" => { + let event_type = PodEventType::ImagePullError; + if should_report(&event_type) { + warn!( + pod = %name, + namespace = %namespace, + container = %cs.name, + "Image pull error" + ); + self.reported_issues.insert(key.clone(), event_type.clone()); + return Some(PodEvent { + pod_name: name, + namespace, + event_type, + }); + } + } + "ContainerCreating" => { + // Check how long it's been creating + if let Some(start_time) = pod + .status + .as_ref() + .and_then(|s| s.start_time.as_ref()) + { + let duration = chrono::Utc::now() + .signed_duration_since(start_time.0) + .num_seconds(); + + if duration > 300 { + // 5 minutes + let event_type = PodEventType::ContainerCreating { + duration_seconds: duration, + }; + if should_report(&event_type) { + warn!( + pod = %name, + namespace = %namespace, + duration_seconds = duration, + "Container creating for too long" + ); + self.reported_issues.insert(key.clone(), event_type.clone()); + return Some(PodEvent { + pod_name: name, + namespace, + event_type, + }); + } + } + } + } + _ => {} + } + } + } + } + + // Check pod phase + match phase { + "Pending" => { + if let Some(reason) = Self::get_pending_reason(&pod) { + let event_type = PodEventType::Pending { + reason: Some(reason.clone()), + }; + if should_report(&event_type) { + warn!( + pod = %name, + namespace = %namespace, + reason = %reason, + "Pod stuck in Pending" + ); + self.reported_issues.insert(key.clone(), event_type.clone()); + return Some(PodEvent { + pod_name: name, + namespace, + event_type, + }); + } + } + } + "Failed" => { + let reason = Self::get_failure_reason(&pod); + let event_type = PodEventType::Failed { + reason: reason.clone(), + }; + if should_report(&event_type) { + warn!( + pod = %name, + namespace = %namespace, + reason = ?reason, + "Pod in Failed state" + ); + self.reported_issues.insert(key, event_type.clone()); + return Some(PodEvent { + pod_name: name, + namespace, + event_type, + }); + } + } + _ => {} + } + + None + } + + fn pod_key(pod: &Pod) -> String { + format!( + "{}/{}", + pod.namespace().unwrap_or_else(|| "default".to_string()), + pod.name_any() + ) + } + + fn get_restart_count(pod: &Pod) -> i32 { + pod.status + .as_ref() + .and_then(|s| s.container_statuses.as_ref()) + .map(|cs| cs.iter().map(|c| c.restart_count).sum()) + .unwrap_or(0) + } + + fn get_pending_reason(pod: &Pod) -> Option { + pod.status + .as_ref() + .and_then(|s| s.conditions.as_ref()) + .and_then(|conditions| { + conditions + .iter() + .find(|c| c.type_ == "PodScheduled" && c.status == "False") + .and_then(|c| c.reason.clone()) + }) + } + + fn get_failure_reason(pod: &Pod) -> Option { + pod.status + .as_ref() + .and_then(|s| s.reason.clone()) + .or_else(|| { + pod.status + .as_ref() + .and_then(|s| s.message.clone()) + }) + } +} diff --git a/src/k8s/pods.rs b/src/k8s/pods.rs new file mode 100644 index 0000000..6133157 --- /dev/null +++ b/src/k8s/pods.rs @@ -0,0 +1,149 @@ +use super::client::KubeClient; +use super::types::{ContainerStatus, PodCondition, PodDetails, PodLogs}; +use k8s_openapi::api::core::v1::Pod; +use kube::{api::LogParams, Api}; + +impl KubeClient { + /// Gets detailed information about a specific pod for diagnostics + pub async fn get_pod_details( + &self, + namespace: &str, + pod_name: &str, + ) -> Result> { + let pods: Api = Api::namespaced(self.inner().clone(), namespace); + let pod = pods.get(pod_name).await?; + + // Extract phase + let phase = pod + .status + .as_ref() + .and_then(|s| s.phase.clone()) + .unwrap_or_else(|| "Unknown".to_string()); + + // Extract node name + let node_name = pod.spec.as_ref().and_then(|s| s.node_name.clone()); + + // Extract conditions + let conditions = pod + .status + .as_ref() + .and_then(|s| s.conditions.as_ref()) + .map(|conds| { + conds + .iter() + .map(|c| PodCondition { + type_: c.type_.clone(), + status: c.status.clone(), + reason: c.reason.clone(), + message: c.message.clone(), + }) + .collect() + }) + .unwrap_or_default(); + + // Extract container statuses + let container_statuses: Vec = pod + .status + .as_ref() + .and_then(|s| s.container_statuses.as_ref()) + .map(|cs| { + cs.iter() + .map(|c| { + let (state, state_reason, state_message) = if let Some(waiting) = + &c.state.as_ref().and_then(|s| s.waiting.as_ref()) + { + ( + "Waiting".to_string(), + waiting.reason.clone(), + waiting.message.clone(), + ) + } else if let Some(_running) = + &c.state.as_ref().and_then(|s| s.running.as_ref()) + { + ("Running".to_string(), None, None) + } else if let Some(terminated) = + &c.state.as_ref().and_then(|s| s.terminated.as_ref()) + { + ( + "Terminated".to_string(), + terminated.reason.clone(), + terminated.message.clone(), + ) + } else { + ("Unknown".to_string(), None, None) + }; + + ContainerStatus { + name: c.name.clone(), + ready: c.ready, + restart_count: c.restart_count, + state, + state_reason, + state_message, + } + }) + .collect() + }) + .unwrap_or_default(); + + // Calculate total restart count + let restart_count: i32 = container_statuses.iter().map(|c| c.restart_count).sum(); + + // Extract start time + let start_time = pod + .status + .as_ref() + .and_then(|s| s.start_time.as_ref()) + .map(|t| t.0.to_rfc3339()); + + Ok(PodDetails { + name: pod_name.to_string(), + namespace: namespace.to_string(), + phase, + node_name, + conditions, + container_statuses, + restart_count, + start_time, + }) + } + + /// Gets recent logs from a pod's container + pub async fn get_pod_logs( + &self, + namespace: &str, + pod_name: &str, + container_name: Option<&str>, + tail_lines: Option, + ) -> Result> { + let pods: Api = Api::namespaced(self.inner().clone(), namespace); + + // Determine which container to get logs from + let container = if let Some(name) = container_name { + name.to_string() + } else { + // Get first container name + let pod = pods.get(pod_name).await?; + pod.spec + .as_ref() + .and_then(|s| s.containers.first()) + .map(|c| c.name.clone()) + .ok_or("No containers found in pod")? + }; + + let log_params = LogParams { + container: Some(container.clone()), + tail_lines, + ..Default::default() + }; + + let logs = pods.logs(pod_name, &log_params).await?; + + Ok(PodLogs { + pod_name: pod_name.to_string(), + namespace: namespace.to_string(), + container_name: container, + logs, + }) + } +} diff --git a/src/k8s/types.rs b/src/k8s/types.rs new file mode 100644 index 0000000..597e195 --- /dev/null +++ b/src/k8s/types.rs @@ -0,0 +1,76 @@ +use serde::Serialize; + +// Node types +#[derive(Debug, Serialize)] +pub struct NodeStatus { + pub name: String, + pub ready: bool, + pub version: String, + pub internal_ip: Option, +} + +#[derive(Debug, Serialize)] +pub struct NodeCondition { + pub type_: String, + pub status: String, + pub reason: Option, + pub message: Option, +} + +#[derive(Debug, Serialize)] +pub struct NodeResources { + pub cpu: String, + pub memory: String, + pub pods: String, +} + +#[derive(Debug, Serialize)] +pub struct NodeDetails { + pub name: String, + pub conditions: Vec, + pub capacity: NodeResources, + pub allocatable: NodeResources, + pub taints: Vec, + pub labels: Vec<(String, String)>, + pub pod_count: usize, + pub version: String, +} + +// Pod types +#[derive(Debug, Serialize)] +pub struct PodCondition { + pub type_: String, + pub status: String, + pub reason: Option, + pub message: Option, +} + +#[derive(Debug, Serialize)] +pub struct ContainerStatus { + pub name: String, + pub ready: bool, + pub restart_count: i32, + pub state: String, + pub state_reason: Option, + pub state_message: Option, +} + +#[derive(Debug, Serialize)] +pub struct PodDetails { + pub name: String, + pub namespace: String, + pub phase: String, + pub node_name: Option, + pub conditions: Vec, + pub container_statuses: Vec, + pub restart_count: i32, + pub start_time: Option, +} + +#[derive(Debug, Serialize)] +pub struct PodLogs { + pub pod_name: String, + pub namespace: String, + pub container_name: String, + pub logs: String, +} diff --git a/src/k8s/watcher.rs b/src/k8s/watcher.rs new file mode 100644 index 0000000..2b7b48c --- /dev/null +++ b/src/k8s/watcher.rs @@ -0,0 +1,170 @@ +use futures::TryStreamExt; +use k8s_openapi::api::core::v1::Node; +use kube::{ + runtime::{watcher, watcher::Config, WatchStreamExt}, + Api, ResourceExt, +}; +use std::collections::HashMap; +use tracing::{debug, info, warn}; + +use super::client::KubeClient; + +#[derive(Debug, Clone)] +pub struct NodeEvent { + pub node_name: String, + pub ready: bool, + pub event_type: NodeEventType, +} + +#[derive(Debug, Clone, PartialEq)] +pub enum NodeEventType { + BecameNotReady, + BecameReady, + ConditionChanged { condition_type: String, status: String, reason: Option }, +} + +pub struct NodeWatcher { + api: Api, + previous_states: HashMap, +} + +impl NodeWatcher { + pub fn new(kube_client: &KubeClient) -> Self { + let api = Api::all(kube_client.inner().clone()); + Self { + api, + previous_states: HashMap::new(), + } + } + + /// Start watching node events + pub async fn watch( + mut self, + ) -> Result< + impl futures::Stream>>, + Box, + > { + info!("Starting node watcher"); + + // Initialize current state + let nodes = self.api.list(&Default::default()).await?; + for node in nodes.items { + let name = node.name_any(); + let ready = Self::is_node_ready(&node); + self.previous_states.insert(name.clone(), ready); + debug!("Initial state: {} = Ready:{}", name, ready); + } + + let stream = watcher(self.api.clone(), Config::default()) + .applied_objects() + .try_filter_map(move |node| { + let event = self.process_node_event(node); + futures::future::ready(Ok(event)) + }) + .map_err(|e| Box::new(e) as Box); + + Ok(stream) + } + + fn process_node_event(&mut self, node: Node) -> Option { + let name = node.name_any(); + let current_ready = Self::is_node_ready(&node); + let previous_ready = self.previous_states.get(&name).copied(); + + let event = match (previous_ready, current_ready) { + // Node became NotReady + (Some(true), false) | (None, false) => { + warn!("Node {} became NotReady", name); + Some(NodeEvent { + node_name: name.clone(), + ready: false, + event_type: NodeEventType::BecameNotReady, + }) + } + // Node became Ready + (Some(false), true) => { + info!("Node {} became Ready", name); + Some(NodeEvent { + node_name: name.clone(), + ready: true, + event_type: NodeEventType::BecameReady, + }) + } + // Check for condition changes even if Ready state is the same + _ => { + if let Some(problematic_condition) = Self::find_problematic_condition(&node) { + warn!( + "Node {} has problematic condition: {}", + name, problematic_condition.condition_type + ); + Some(NodeEvent { + node_name: name.clone(), + ready: current_ready, + event_type: NodeEventType::ConditionChanged { + condition_type: problematic_condition.condition_type, + status: problematic_condition.status, + reason: problematic_condition.reason, + }, + }) + } else { + None + } + } + }; + + // Update state + self.previous_states.insert(name, current_ready); + event + } + + fn is_node_ready(node: &Node) -> bool { + node.status + .as_ref() + .and_then(|s| s.conditions.as_ref()) + .and_then(|conditions| { + conditions + .iter() + .find(|c| c.type_ == "Ready") + .map(|c| c.status == "True") + }) + .unwrap_or(false) + } + + fn find_problematic_condition(node: &Node) -> Option { + node.status + .as_ref() + .and_then(|s| s.conditions.as_ref()) + .and_then(|conditions| { + for condition in conditions { + // Check for problematic conditions + match condition.type_.as_str() { + "Ready" if condition.status != "True" => { + return Some(ProblematicCondition { + condition_type: condition.type_.clone(), + status: condition.status.clone(), + reason: condition.reason.clone(), + }); + } + "MemoryPressure" | "DiskPressure" | "PIDPressure" + if condition.status == "True" => + { + return Some(ProblematicCondition { + condition_type: condition.type_.clone(), + status: condition.status.clone(), + reason: condition.reason.clone(), + }); + } + _ => {} + } + } + None + }) + } +} + +#[derive(Debug)] +struct ProblematicCondition { + condition_type: String, + status: String, + reason: Option, +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..258fc9f --- /dev/null +++ b/src/main.rs @@ -0,0 +1,123 @@ +mod ai; +mod config; +mod events; +mod k8s; +mod tools; + +use ai::AIClient; +use config::Config; +use events::EventHandler; +use futures::StreamExt; +use k8s::{KubeClient, NodeWatcher, PodWatcher}; +use tracing::{error, info}; +use tracing_subscriber::{fmt, prelude::*, EnvFilter}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + // Initialize logging + tracing_subscriber::registry() + .with(fmt::layer()) + .with(EnvFilter::from_default_env().add_directive(tracing::Level::INFO.into())) + .init(); + + info!("Starting duty-ai-ops daemon"); + + // Load configuration + let cfg = Config::load("config.toml")?; + info!("Configuration loaded"); + + // Initialize clients + let kube_client = KubeClient::new().await?; + info!("Connected to Kubernetes cluster"); + + let ai_client = AIClient::new(&cfg); + info!( + model = %cfg.model, + max_concurrent = cfg.max_concurrent_diagnoses, + "AI client initialized" + ); + + // Create event handler with concurrency limit + let event_handler = EventHandler::new( + kube_client.clone(), + ai_client, + cfg.max_concurrent_diagnoses, + ); + + // Start node watcher + let node_watcher = NodeWatcher::new(&kube_client); + let node_stream = node_watcher.watch().await?; + tokio::pin!(node_stream); + + // Start pod watcher + let pod_watcher = PodWatcher::new(&kube_client); + let pod_stream = pod_watcher.watch().await?; + tokio::pin!(pod_stream); + + info!("Node and Pod watchers started, monitoring for events"); + + // Setup graceful shutdown + let ctrl_c = tokio::signal::ctrl_c(); + tokio::pin!(ctrl_c); + + // Event loop + loop { + tokio::select! { + // Handle shutdown signal + _ = &mut ctrl_c => { + info!("Received shutdown signal, exiting gracefully"); + break; + } + + // Handle node events + Some(event_result) = node_stream.next() => { + match event_result { + Ok(event) => { + let handler = event_handler.clone(); + tokio::spawn(async move { + handler.handle_node_event(event).await; + }); + } + Err(e) => { + error!(error = %e, "Error processing node watch event"); + } + } + } + + // Handle pod events + Some(event_result) = pod_stream.next() => { + match event_result { + Ok(event) => { + let handler = event_handler.clone(); + tokio::spawn(async move { + handler.handle_pod_event(event).await; + }); + } + Err(e) => { + error!(error = %e, "Error processing pod watch event"); + } + } + } + + // If streams end unexpectedly + else => { + error!("Watch streams ended unexpectedly, restarting..."); + tokio::time::sleep(tokio::time::Duration::from_secs(5)).await; + + // Recreate watchers and streams + let node_watcher = NodeWatcher::new(&kube_client); + let new_node_stream = node_watcher.watch().await?; + node_stream.set(new_node_stream); + + let pod_watcher = PodWatcher::new(&kube_client); + let new_pod_stream = pod_watcher.watch().await?; + pod_stream.set(new_pod_stream); + + info!("Watchers restarted"); + } + } + } + + info!("Daemon stopped"); + Ok(()) +} diff --git a/src/tools/mod.rs b/src/tools/mod.rs new file mode 100644 index 0000000..78b7a72 --- /dev/null +++ b/src/tools/mod.rs @@ -0,0 +1,5 @@ +mod node_details; +mod pod_tools; + +pub use node_details::get_node_details_tool; +pub use pod_tools::{get_pod_details_tool, get_pod_logs_tool}; diff --git a/src/tools/node_details.rs b/src/tools/node_details.rs new file mode 100644 index 0000000..90a135f --- /dev/null +++ b/src/tools/node_details.rs @@ -0,0 +1,25 @@ +use async_openai::types::chat::{ChatCompletionTool, FunctionObject}; +use serde_json::json; + +/// Creates tool definition for getting detailed node information +pub fn get_node_details_tool() -> ChatCompletionTool { + ChatCompletionTool { + function: FunctionObject { + name: "get_node_details".to_string(), + description: Some( + "Get detailed diagnostic information about a specific Kubernetes node including conditions, resources, taints, labels, and pod count".to_string(), + ), + parameters: Some(json!({ + "type": "object", + "properties": { + "node_name": { + "type": "string", + "description": "The name of the node to get details for" + } + }, + "required": ["node_name"] + })), + strict: None, + }, + } +} diff --git a/src/tools/pod_tools.rs b/src/tools/pod_tools.rs new file mode 100644 index 0000000..33a52dc --- /dev/null +++ b/src/tools/pod_tools.rs @@ -0,0 +1,64 @@ +use async_openai::types::chat::{ChatCompletionTool, FunctionObject}; +use serde_json::json; + +/// Creates tool definition for getting detailed pod information +pub fn get_pod_details_tool() -> ChatCompletionTool { + ChatCompletionTool { + function: FunctionObject { + name: "get_pod_details".to_string(), + description: Some( + "Get detailed diagnostic information about a specific Kubernetes pod including phase, conditions, container statuses, and restart counts".to_string(), + ), + parameters: Some(json!({ + "type": "object", + "properties": { + "namespace": { + "type": "string", + "description": "The namespace of the pod" + }, + "pod_name": { + "type": "string", + "description": "The name of the pod to get details for" + } + }, + "required": ["namespace", "pod_name"] + })), + strict: None, + }, + } +} + +/// Creates tool definition for getting pod logs +pub fn get_pod_logs_tool() -> ChatCompletionTool { + ChatCompletionTool { + function: FunctionObject { + name: "get_pod_logs".to_string(), + description: Some( + "Get recent logs from a pod's container to diagnose runtime issues and errors".to_string(), + ), + parameters: Some(json!({ + "type": "object", + "properties": { + "namespace": { + "type": "string", + "description": "The namespace of the pod" + }, + "pod_name": { + "type": "string", + "description": "The name of the pod to get logs from" + }, + "container_name": { + "type": "string", + "description": "Optional: specific container name. If not provided, gets logs from first container" + }, + "tail_lines": { + "type": "integer", + "description": "Number of recent log lines to retrieve. Default is 50 lines" + } + }, + "required": ["namespace", "pod_name"] + })), + strict: None, + }, + } +}