diff --git a/.github/workflows/rust_tests.yml b/.github/workflows/rust_tests.yml index ed031167..9837531d 100644 --- a/.github/workflows/rust_tests.yml +++ b/.github/workflows/rust_tests.yml @@ -29,6 +29,3 @@ jobs: - name: Run unit tests run: cargo test --lib - - - name: Run integration tests - run: cargo test --test integration diff --git a/crates/Cargo.lock b/crates/Cargo.lock index 1f33b4c2..4898273d 100644 --- a/crates/Cargo.lock +++ b/crates/Cargo.lock @@ -11,22 +11,13 @@ dependencies = [ "num-traits", ] -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli 0.28.1", -] - [[package]] name = "addr2line" version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ - "gimli 0.31.1", + "gimli", ] [[package]] @@ -41,18 +32,6 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if 1.0.0", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.3" @@ -83,27 +62,12 @@ dependencies = [ "libc", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" -[[package]] -name = "arbitrary" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" - [[package]] name = "async-trait" version = "0.1.88" @@ -121,17 +85,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.4.0" @@ -144,8 +97,8 @@ version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" dependencies = [ - "addr2line 0.24.2", - "cfg-if 1.0.0", + "addr2line", + "cfg-if", "libc", "miniz_oxide", "object", @@ -180,12 +133,6 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.9.1" @@ -252,12 +199,6 @@ version = "3.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee" -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bytes" version = "1.10.1" @@ -270,17 +211,9 @@ version = "1.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac" dependencies = [ - "jobserver", - "libc", "shlex", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -300,27 +233,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "textwrap", - "unicode-width 0.1.14", - "vec_map", -] - -[[package]] -name = "cobs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" - [[package]] name = "common" version = "0.1.0" @@ -360,15 +272,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "cpp_demangle" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "cpufeatures" version = "0.2.17" @@ -378,162 +281,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cranelift-bforest" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a41b85213deedf877555a7878ca9fb680ccba8183611c4bb8030ed281b2ad83" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-bitset" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "690d8ae6c73748e5ce3d8fe59034dceadb8823e6c8994ba324141c5eae909b0e" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "cranelift-codegen" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce027a7b16f8b86f60ff6819615273635186d607a0c225ee6ac340d7d18f978" -dependencies = [ - "bumpalo", - "cranelift-bforest", - "cranelift-bitset", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-control", - "cranelift-entity", - "cranelift-isle", - "gimli 0.28.1", - "hashbrown 0.14.5", - "log", - "regalloc2", - "rustc-hash", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a2d2ab65e6cbf91f81781d8da65ec2005510f18300eff21a99526ed6785863" -dependencies = [ - "cranelift-codegen-shared", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efcff860573cf3db9ae98fbd949240d78b319df686cc306872e7fab60e9c84d7" - -[[package]] -name = "cranelift-control" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d70e5b75c2d5541ef80a99966ccd97aaa54d2a6af19ea31759a28538e1685a" -dependencies = [ - "arbitrary", -] - -[[package]] -name = "cranelift-entity" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d21d3089714278920030321829090d9482c91e5ff2339f2f697f8425bffdcba3" -dependencies = [ - "cranelift-bitset", - "serde", - "serde_derive", -] - -[[package]] -name = "cranelift-frontend" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7308482930f2a2fad4fe25a06054f6f9a4ee1ab97264308c661b037cb60001a3" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-isle" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c59e259dab0e6958dabcc536b30845574f027ba6e5000498cdaf7e7ed2d30" - -[[package]] -name = "cranelift-native" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77ac3dfb61ef3159998105116acdfeaec75e4296c43ee2dcc4ea39838c0080e" -dependencies = [ - "cranelift-codegen", - "libc", - "target-lexicon", -] - -[[package]] -name = "cranelift-wasm" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d883f1b8d3d1dab4797407117bc8a1824f4a1fe86654aee2ee3205613f77d3e" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "itertools 0.12.1", - "log", - "smallvec", - "wasmparser 0.212.0", - "wasmtime-types", -] - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - [[package]] name = "crypto-common" version = "0.1.6" @@ -564,7 +311,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.101", ] @@ -579,15 +326,6 @@ dependencies = [ "syn 2.0.101", ] -[[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "uuid", -] - [[package]] name = "deranged" version = "0.4.0" @@ -625,27 +363,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "directories-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" -dependencies = [ - "cfg-if 1.0.0", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "displaydoc" version = "0.2.5" @@ -678,25 +395,13 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - [[package]] name = "encoding_rs" version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -743,12 +448,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - [[package]] name = "fancy-regex" version = "0.12.0" @@ -890,28 +589,6 @@ dependencies = [ "slab", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "fxprof-processed-profile" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" -dependencies = [ - "bitflags 2.9.1", - "debugid", - "fxhash", - "serde", - "serde_json", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -928,7 +605,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] @@ -939,23 +616,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "r-efi", "wasi 0.14.2+wasi-0.2.4", ] -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -dependencies = [ - "fallible-iterator", - "indexmap 2.9.0", - "stable_deref_trait", -] - [[package]] name = "gimli" version = "0.31.1" @@ -974,7 +640,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "no-std-compat", "nonzero_ext", "portable-atomic", @@ -1026,7 +692,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" dependencies = [ - "ahash 0.3.8", + "ahash", "autocfg", ] @@ -1036,25 +702,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.12", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash 0.8.12", - "serde", -] - [[package]] name = "hashbrown" version = "0.15.3" @@ -1066,21 +713,6 @@ dependencies = [ "foldhash", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "hermesllm" version = "0.1.0" @@ -1091,15 +723,6 @@ dependencies = [ "thiserror 2.0.12", ] -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hex" version = "0.4.3" @@ -1428,12 +1051,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "id-arena" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" - [[package]] name = "ident_case" version = "1.0.1" @@ -1499,15 +1116,6 @@ dependencies = [ "serde", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.14.0" @@ -1523,36 +1131,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" -[[package]] -name = "ittapi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" -dependencies = [ - "anyhow", - "ittapi-sys", - "log", -] - -[[package]] -name = "ittapi-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" -dependencies = [ - "cc", -] - -[[package]] -name = "jobserver" -version = "0.1.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" -dependencies = [ - "getrandom 0.3.3", - "libc", -] - [[package]] name = "js-sys" version = "0.3.77" @@ -1569,46 +1147,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - [[package]] name = "libc" version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" -[[package]] -name = "libm" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" - -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.9.1", - "libc", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - [[package]] name = "linux-raw-sys" version = "0.9.4" @@ -1634,7 +1178,6 @@ dependencies = [ "log", "md5", "proxy-wasm", - "proxy-wasm-test-framework", "rand 0.8.5", "serde", "serde_json", @@ -1660,15 +1203,6 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" -[[package]] -name = "mach2" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" -dependencies = [ - "libc", -] - [[package]] name = "matchers" version = "0.1.0" @@ -1690,15 +1224,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memfd" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" -dependencies = [ - "rustix 0.38.44", -] - [[package]] name = "mime" version = "0.3.17" @@ -1731,12 +1256,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "more-asserts" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fafa6961cabd9c63bcd77a45d7e3b7f3b552b70417831fb0f56db717e72407e" - [[package]] name = "native-tls" version = "0.2.14" @@ -1810,9 +1329,6 @@ version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ - "crc32fast", - "hashbrown 0.15.3", - "indexmap 2.9.0", "memchr", ] @@ -1828,8 +1344,8 @@ version = "0.10.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" dependencies = [ - "bitflags 2.9.1", - "cfg-if 1.0.0", + "bitflags", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -1978,19 +1494,13 @@ version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", "windows-targets", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "percent-encoding" version = "2.3.1" @@ -2041,18 +1551,6 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" -[[package]] -name = "postcard" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" -dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "serde", -] - [[package]] name = "potential_utf" version = "0.1.2" @@ -2087,30 +1585,6 @@ dependencies = [ "yansi", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.95" @@ -2133,7 +1607,6 @@ dependencies = [ "md5", "pretty_assertions", "proxy-wasm", - "proxy-wasm-test-framework", "rand 0.8.5", "serde", "serde_json", @@ -2160,7 +1633,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools", "proc-macro2", "quote", "syn 2.0.101", @@ -2176,29 +1649,6 @@ dependencies = [ "log", ] -[[package]] -name = "proxy-wasm-test-framework" -version = "0.1.0" -source = "git+https://github.com/katanemo/test-framework.git?branch=new#c2511cd9030705e14d5f60aca77d6c96c81c6dfa" -dependencies = [ - "anyhow", - "cfg-if 0.1.10", - "lazy_static", - "more-asserts", - "rand 0.8.5", - "structopt", - "wasmtime", -] - -[[package]] -name = "psm" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e944464ec8536cd1beb0bbfd96987eb5e3b72f2ecdafdc5c769a37f1fa2ae1f" -dependencies = [ - "cc", -] - [[package]] name = "quote" version = "1.0.40" @@ -2273,44 +1723,13 @@ dependencies = [ "getrandom 0.3.3", ] -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "redox_syscall" version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" dependencies = [ - "bitflags 2.9.1", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom 0.2.16", - "libredox", - "thiserror 1.0.69", + "bitflags", ] [[package]] @@ -2333,19 +1752,6 @@ dependencies = [ "syn 2.0.101", ] -[[package]] -name = "regalloc2" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" -dependencies = [ - "hashbrown 0.13.2", - "log", - "rustc-hash", - "slice-group-by", - "smallvec", -] - [[package]] name = "regex" version = "1.11.1" @@ -2443,7 +1849,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", - "cfg-if 1.0.0", + "cfg-if", "getrandom 0.2.16", "libc", "untrusted", @@ -2462,29 +1868,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags 2.9.1", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - [[package]] name = "rustix" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ - "bitflags 2.9.1", + "bitflags", "errno", "libc", - "linux-raw-sys 0.9.4", + "linux-raw-sys", "windows-sys 0.59.0", ] @@ -2634,7 +2027,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.9.1", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -2651,15 +2044,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" -dependencies = [ - "serde", -] - [[package]] name = "serde" version = "1.0.219" @@ -2692,15 +2076,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -2788,7 +2163,7 @@ version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -2826,20 +2201,11 @@ dependencies = [ "autocfg", ] -[[package]] -name = "slice-group-by" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" - [[package]] name = "smallvec" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" -dependencies = [ - "serde", -] [[package]] name = "socket2" @@ -2860,54 +2226,18 @@ dependencies = [ "lock_api", ] -[[package]] -name = "sptr" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" - [[package]] name = "stable_deref_trait" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "subtle" version = "2.6.1" @@ -2962,7 +2292,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 2.9.1", + "bitflags", "core-foundation", "system-configuration-sys", ] @@ -2977,12 +2307,6 @@ dependencies = [ "libc", ] -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - [[package]] name = "tempfile" version = "3.20.0" @@ -2992,28 +2316,10 @@ dependencies = [ "fastrand", "getrandom 0.3.3", "once_cell", - "rustix 1.0.7", + "rustix", "windows-sys 0.59.0", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width 0.1.14", -] - [[package]] name = "thiserror" version = "1.0.69" @@ -3060,7 +2366,7 @@ version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -3213,47 +2519,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" -dependencies = [ - "indexmap 2.9.0", - "serde", - "serde_spanned", - "toml_datetime", - "toml_write", - "winnow", -] - -[[package]] -name = "toml_write" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" - [[package]] name = "tonic" version = "0.12.3" @@ -3321,7 +2586,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" dependencies = [ - "bitflags 2.9.1", + "bitflags", "bytes", "futures-util", "http 1.3.1", @@ -3442,30 +2707,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "unicode-width" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - [[package]] name = "unsafe-libyaml" version = "0.2.11" @@ -3501,16 +2742,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" -[[package]] -name = "uuid" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "valuable" version = "0.1.1" @@ -3523,12 +2754,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.5" @@ -3565,7 +2790,7 @@ version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", @@ -3591,7 +2816,7 @@ version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "once_cell", "wasm-bindgen", @@ -3630,25 +2855,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "wasm-encoder" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" -version = "0.233.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9679ae3cf7cfa2ca3a327f7fab97f27f3294d402fd1a76ca8ab514e17973e4d3" -dependencies = [ - "leb128fmt", - "wasmparser 0.233.0", -] - [[package]] name = "wasm-streams" version = "0.4.2" @@ -3662,320 +2868,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wasmparser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" -dependencies = [ - "ahash 0.8.12", - "bitflags 2.9.1", - "hashbrown 0.14.5", - "indexmap 2.9.0", - "semver", - "serde", -] - -[[package]] -name = "wasmparser" -version = "0.233.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b51cb03afce7964bbfce46602d6cb358726f36430b6ba084ac6020d8ce5bc102" -dependencies = [ - "bitflags 2.9.1", - "indexmap 2.9.0", - "semver", -] - -[[package]] -name = "wasmprinter" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" -dependencies = [ - "anyhow", - "termcolor", - "wasmparser 0.212.0", -] - -[[package]] -name = "wasmtime" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe501caefeb9f7b15360bdd7e47ad96e20223846f1c7db485ae5820ba5acc3d2" -dependencies = [ - "addr2line 0.21.0", - "anyhow", - "async-trait", - "bitflags 2.9.1", - "bumpalo", - "cc", - "cfg-if 1.0.0", - "encoding_rs", - "fxprof-processed-profile", - "gimli 0.28.1", - "hashbrown 0.14.5", - "indexmap 2.9.0", - "ittapi", - "libc", - "libm", - "log", - "mach2", - "memfd", - "object", - "once_cell", - "paste", - "postcard", - "psm", - "rayon", - "rustix 0.38.44", - "semver", - "serde", - "serde_derive", - "serde_json", - "smallvec", - "sptr", - "target-lexicon", - "wasm-encoder 0.212.0", - "wasmparser 0.212.0", - "wasmtime-asm-macros", - "wasmtime-cache", - "wasmtime-component-macro", - "wasmtime-component-util", - "wasmtime-cranelift", - "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-jit-debug", - "wasmtime-jit-icache-coherence", - "wasmtime-slab", - "wasmtime-versioned-export-macros", - "wasmtime-winch", - "wat", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-asm-macros" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c904a057d74bfa0ad9369a3fd99231d81ba0345f059d03c9148c3bb2abbf310f" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "wasmtime-cache" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dff4d467d6b5bd0d137f5426f45178222e40b59e49ab3a7361420262b9f00df" -dependencies = [ - "anyhow", - "base64 0.21.7", - "directories-next", - "log", - "postcard", - "rustix 0.38.44", - "serde", - "serde_derive", - "sha2", - "toml", - "windows-sys 0.52.0", - "zstd", -] - -[[package]] -name = "wasmtime-component-macro" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a96185dab1c14ffb986ff2b3a2185d15acf2b801ca7895aa35ee80328e2ce38" -dependencies = [ - "anyhow", - "proc-macro2", - "quote", - "syn 2.0.101", - "wasmtime-component-util", - "wasmtime-wit-bindgen", - "wit-parser", -] - -[[package]] -name = "wasmtime-component-util" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71a40200d42a8985edadb4007a0ed320756cbe28065b83e0027e39524c1b1b22" - -[[package]] -name = "wasmtime-cranelift" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b099ef9b7808fa8d18cad32243e78e9c07a4a8aacfa913d88dc08704b1643c49" -dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "cranelift-codegen", - "cranelift-control", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "cranelift-wasm", - "gimli 0.28.1", - "log", - "object", - "target-lexicon", - "thiserror 1.0.69", - "wasmparser 0.212.0", - "wasmtime-environ", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-environ" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2f1765f6ca1a166927bee13ad4aed7bf18269f34c0cd7d6d523889a0b52e6ee" -dependencies = [ - "anyhow", - "cpp_demangle", - "cranelift-bitset", - "cranelift-entity", - "gimli 0.28.1", - "indexmap 2.9.0", - "log", - "object", - "postcard", - "rustc-demangle", - "semver", - "serde", - "serde_derive", - "target-lexicon", - "wasm-encoder 0.212.0", - "wasmparser 0.212.0", - "wasmprinter", - "wasmtime-component-util", - "wasmtime-types", -] - -[[package]] -name = "wasmtime-fiber" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "047be22a9ebe0343e583edf52b89b60a87e37bec1bc71dc127d3c7fb287c4471" -dependencies = [ - "anyhow", - "cc", - "cfg-if 1.0.0", - "rustix 0.38.44", - "wasmtime-asm-macros", - "wasmtime-versioned-export-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-jit-debug" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2383b29fd973222293b5ff562f81a67c7e558b669685ca13f8cb80d04ea24b2d" -dependencies = [ - "object", - "once_cell", - "rustix 0.38.44", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-jit-icache-coherence" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e1a826e4ccd0803b2f7463289cad104f40d09d06bc8acf1a614230a47b4d96f" -dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-slab" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92a137c17c992eb5eaacfa0f0590353471e49dbb4bdbdf9cf7536d66109e63a" - -[[package]] -name = "wasmtime-types" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6072ac3267866d99ca726b6a4f157df9b733aac8082e902d527368f07c303ba" -dependencies = [ - "anyhow", - "cranelift-entity", - "serde", - "serde_derive", - "smallvec", - "wasmparser 0.212.0", -] - -[[package]] -name = "wasmtime-versioned-export-macros" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bde986038b819bc43a21fef0610aeb47aabfe3ea09ca3533a7b81023b84ec6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.101", -] - -[[package]] -name = "wasmtime-winch" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb1abdc26ddf1d7c819ea0fcbfccb0808410549d28bb3154c9bdb7d11fbcc58" -dependencies = [ - "anyhow", - "cranelift-codegen", - "gimli 0.28.1", - "object", - "target-lexicon", - "wasmparser 0.212.0", - "wasmtime-cranelift", - "wasmtime-environ", - "winch-codegen", -] - -[[package]] -name = "wasmtime-wit-bindgen" -version = "23.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f88e49a9b81746ec0cede5505e40a4012c92cb5054cd7ef4300dc57c36f26b1" -dependencies = [ - "anyhow", - "heck 0.4.1", - "indexmap 2.9.0", - "wit-parser", -] - -[[package]] -name = "wast" -version = "233.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eaf4099d8d0c922b83bf3c90663f5666f0769db9e525184284ebbbdb1dd2180" -dependencies = [ - "bumpalo", - "leb128fmt", - "memchr", - "unicode-width 0.2.0", - "wasm-encoder 0.233.0", -] - -[[package]] -name = "wat" -version = "1.233.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d9bc80f5e4b25ea086ef41b91ccd244adde45d931c384d94a8ff64ab8bd7d87" -dependencies = [ - "wast", -] - [[package]] name = "web-sys" version = "0.3.77" @@ -4012,38 +2904,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "winch-codegen" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a666bf2cdb838e68b9b8370d7ebf8806b87ccc0d89a634bfc9ed8ffca1f19591" -dependencies = [ - "anyhow", - "cranelift-codegen", - "gimli 0.28.1", - "regalloc2", - "smallvec", - "target-lexicon", - "wasmparser 0.212.0", - "wasmtime-cranelift", - "wasmtime-environ", -] - [[package]] name = "windows-core" version = "0.61.2" @@ -4196,40 +3062,13 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" -dependencies = [ - "memchr", -] - [[package]] name = "wit-bindgen-rt" version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.9.1", -] - -[[package]] -name = "wit-parser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceeb0424aa8679f3fcf2d6e3cfa381f3d6fa6179976a2c05a6249dd2bb426716" -dependencies = [ - "anyhow", - "id-arena", - "indexmap 2.9.0", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser 0.212.0", + "bitflags", ] [[package]] @@ -4347,31 +3186,3 @@ dependencies = [ "quote", "syn 2.0.101", ] - -[[package]] -name = "zstd" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.15+zstd.1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/crates/llm_gateway/Cargo.toml b/crates/llm_gateway/Cargo.toml index b65b57b8..b2557477 100644 --- a/crates/llm_gateway/Cargo.toml +++ b/crates/llm_gateway/Cargo.toml @@ -25,5 +25,4 @@ sha2 = "0.10.8" hermesllm = { version = "0.1.0", path = "../hermesllm" } [dev-dependencies] -proxy-wasm-test-framework = { git = "https://github.com/katanemo/test-framework.git", branch = "new" } serial_test = "3.1.1" diff --git a/crates/llm_gateway/tests/integration.rs b/crates/llm_gateway/tests/integration.rs deleted file mode 100644 index 48d4bc86..00000000 --- a/crates/llm_gateway/tests/integration.rs +++ /dev/null @@ -1,562 +0,0 @@ -use http::StatusCode; -use proxy_wasm_test_framework::tester::{self, Tester}; -use proxy_wasm_test_framework::types::{ - Action, BufferType, LogLevel, MapType, MetricType, ReturnType, -}; -use serial_test::serial; -use std::path::Path; - -fn wasm_module() -> String { - let wasm_file = Path::new("../target/wasm32-wasip1/release/llm_gateway.wasm"); - assert!( - wasm_file.exists(), - "Run `cargo build --release --target=wasm32-wasip1` first" - ); - wasm_file.to_string_lossy().to_string() -} - -fn request_headers_expectations(module: &mut Tester, http_context: i32) { - module - .call_proxy_on_request_headers(http_context, 0, false) - .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":path")) - .returning(Some("/v1/chat/completions")) - .expect_get_header_map_value( - Some(MapType::HttpRequestHeaders), - Some("x-arch-llm-provider"), - ) - .returning(None) - .expect_get_header_map_value( - Some(MapType::HttpRequestHeaders), - Some("x-arch-llm-provider-hint"), - ) - .returning(None) - .expect_log( - Some(LogLevel::Info), - None, // Dynamic request ID - could be context_id or x-request-id - ) - .expect_add_header_map_value( - Some(MapType::HttpRequestHeaders), - Some("x-arch-llm-provider"), - Some("openai"), - ) - .expect_remove_header_map_value(Some(MapType::HttpRequestHeaders), Some("x-api-key")) - .expect_replace_header_map_value( - Some(MapType::HttpRequestHeaders), - Some("Authorization"), - Some("Bearer secret_key"), - ) - .expect_remove_header_map_value(Some(MapType::HttpRequestHeaders), Some("content-length")) - .expect_get_header_map_value( - Some(MapType::HttpRequestHeaders), - Some("x-arch-llm-provider-hint"), - ) - .returning(Some("default")) - .expect_get_header_map_value( - Some(MapType::HttpRequestHeaders), - Some("x-arch-ratelimit-selector"), - ) - .returning(Some("selector-key")) - .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("selector-key")) - .returning(Some("selector-value")) - .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("x-request-id")) - .returning(None) - .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("traceparent")) - .returning(None) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} - -fn normal_flow(module: &mut Tester, filter_context: i32, http_context: i32) { - module - .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Trace), None) - .execute_and_expect(ReturnType::None) - .unwrap(); - - request_headers_expectations(module, http_context); -} - -fn setup_filter(module: &mut Tester, config: &str) -> i32 { - let filter_context = 1; - - module - .call_proxy_on_context_create(filter_context, 0) - .expect_metric_creation(MetricType::Gauge, "active_http_calls") - .expect_metric_creation(MetricType::Counter, "ratelimited_rq") - .expect_metric_creation(MetricType::Histogram, "time_to_first_token") - .expect_metric_creation(MetricType::Histogram, "time_per_output_token") - .expect_metric_creation(MetricType::Histogram, "tokens_per_second") - .expect_metric_creation(MetricType::Histogram, "request_latency") - .expect_metric_creation(MetricType::Histogram, "output_sequence_length") - .expect_metric_creation(MetricType::Histogram, "input_sequence_length") - .execute_and_expect(ReturnType::None) - .unwrap(); - - module - .call_proxy_on_configure(filter_context, config.len() as i32) - .expect_get_buffer_bytes(Some(BufferType::PluginConfiguration)) - .returning(Some(config)) - .execute_and_expect(ReturnType::Bool(true)) - .unwrap(); - - filter_context -} - -fn default_config() -> &'static str { - r#" -version: "0.1-beta" - -listener: - address: 0.0.0.0 - port: 10000 - message_format: huggingface - connect_timeout: 0.005s - -endpoints: - api_server: - endpoint: api_server:80 - connect_timeout: 0.005s - -llm_providers: - - name: open-ai-gpt-4 - provider_interface: openai - access_key: secret_key - model: gpt-4 - default: true - - name: open-ai-gpt-4o - provider_interface: openai - access_key: secret_key - model: gpt-4o - -overrides: - # confidence threshold for prompt target intent matching - prompt_target_intent_matching_threshold: 0.6 - -system_prompt: | - You are a helpful assistant. - -prompt_guards: - input_guards: - jailbreak: - on_exception: - message: "Looks like you're curious about my abilities, but I can only provide assistance within my programmed parameters." - -prompt_targets: - - name: weather_forecast - description: This function provides realtime weather forecast information for a given city. - parameters: - - name: city - required: true - description: The city for which the weather forecast is requested. - - name: days - description: The number of days for which the weather forecast is requested. - - name: units - description: The units in which the weather forecast is requested. - endpoint: - name: api_server - path: /weather - system_prompt: | - You are a helpful weather forecaster. Use weater data that is provided to you. Please following following guidelines when responding to user queries: - - Use farenheight for temperature - - Use miles per hour for wind speed - -ratelimits: - - model: gpt-4 - selector: - key: selector-key - value: selector-value - limit: - tokens: 100 - unit: minute -"# -} - -#[test] -#[serial] -fn llm_gateway_successful_request_to_open_ai_chat_completions() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let filter_context = setup_filter(&mut module, default_config()); - - // Setup HTTP Stream - let http_context = 2; - - module - .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Trace), None) - .execute_and_expect(ReturnType::None) - .unwrap(); - - request_headers_expectations(&mut module, http_context); - - // Request Body - let chat_completions_request_body = r#"{"model":"gpt-4","messages":[{"role":"system","content":"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},{"role":"user","content":"Compose a poem."}]}"#; - - module - .call_proxy_on_request_body( - http_context, - chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID - REQUEST_BODY_CHUNK - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(chat_completions_request_body)) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - CLIENT_REQUEST_RECEIVED - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID - CLIENT_REQUEST_PAYLOAD - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - MODEL_RESOLUTION - .expect_log(Some(LogLevel::Debug), Some("TOKENIZER: computing token count for model=gpt-4")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - TOKEN_COUNT - .expect_metric_record("input_sequence_length", 21) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - RATELIMIT_CHECK - .expect_log(Some(LogLevel::Debug), Some("Checking limit for provider=gpt-4, with selector=Header { key: \"selector-key\", value: \"selector-value\" }, consuming tokens=21")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - UPSTREAM_TRANSFORM - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID - UPSTREAM_REQUEST_PAYLOAD - .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} - -#[test] -#[serial] -fn llm_gateway_bad_request_to_open_ai_chat_completions() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let filter_context = setup_filter(&mut module, default_config()); - - // Setup HTTP Stream - let http_context = 2; - - module - .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Trace), None) - .execute_and_expect(ReturnType::None) - .unwrap(); - - request_headers_expectations(&mut module, http_context); - - // Request Body - let incomplete_chat_completions_request_body = r#"{"model":"gpt-1","messages":[{"role":"system","content":"Compose a poem that explains the concept of recursion in programming."}]}"#; - - module - .call_proxy_on_request_body( - http_context, - incomplete_chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID - REQUEST_BODY_CHUNK - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(incomplete_chat_completions_request_body)) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - CLIENT_REQUEST_RECEIVED - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID - CLIENT_REQUEST_PAYLOAD - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - MODEL_RESOLUTION - .expect_log(Some(LogLevel::Debug), Some("TOKENIZER: computing token count for model=gpt-4")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - TOKEN_COUNT - .expect_metric_record("input_sequence_length", 13) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - RATELIMIT_CHECK - .expect_log(Some(LogLevel::Debug), Some("Checking limit for provider=gpt-4, with selector=Header { key: \"selector-key\", value: \"selector-value\" }, consuming tokens=13")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID - RATELIMIT_CHECK - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] UPSTREAM_REQUEST_PAYLOAD: {\"messages\":[{\"role\":\"system\",\"content\":\"Compose a poem that explains the concept of recursion in programming.\"}],\"model\":\"gpt-4\"}")) - .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} - -#[test] -#[serial] -fn llm_gateway_request_ratelimited() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let filter_context = setup_filter(&mut module, default_config()); - - // Setup HTTP Stream - let http_context = 2; - - normal_flow(&mut module, filter_context, http_context); - - // Request Body - let chat_completions_request_body = "\ -{\ - \"messages\": [\ - {\ - \"role\": \"system\",\ - \"content\": \"You are a helpful poetic assistant!, skilled in explaining complex programming concepts with creative flair. Be sure to be concise and to the point.\"\ - },\ - {\ - \"role\": \"user\",\ - \"content\": \"Compose a poem that explains the concept of recursion in programming. Compose a poem that explains the concept of recursion in programming. Compose a poem that explains the concept of recursion in programming. And also summarize it how a 4th graded would understand it. Compose a poem that explains the concept of recursion in programming. And also summarize it how a 4th graded would understand it.\"\ - }\ - ],\ - \"model\": \"gpt-4\"\ -}"; - - module - .call_proxy_on_request_body( - http_context, - chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID) - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(chat_completions_request_body)) - // The actual call is not important in this test, we just need to grab the token_id - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] CLIENT_REQUEST_PAYLOAD: {\"messages\": [{\"role\": \"system\",\"content\": \"You are a helpful poetic assistant!, skilled in explaining complex programming concepts with creative flair. Be sure to be concise and to the point.\"},{\"role\": \"user\",\"content\": \"Compose a poem that explains the concept of recursion in programming. Compose a poem that explains the concept of recursion in programming. Compose a poem that explains the concept of recursion in programming. And also summarize it how a 4th graded would understand it. Compose a poem that explains the concept of recursion in programming. And also summarize it how a 4th graded would understand it.\"}],\"model\": \"gpt-4\"}")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("TOKENIZER: computing token count for model=gpt-4")) - .expect_log(Some(LogLevel::Info), None)// Dynamic request ID) - .expect_metric_record("input_sequence_length", 107) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("Checking limit for provider=gpt-4, with selector=Header { key: \"selector-key\", value: \"selector-value\" }, consuming tokens=107")) - .expect_log(Some(LogLevel::Warn), Some(r#"server error occurred: exceeded limit provider=gpt-4, selector=Header { key: "selector-key", value: "selector-value" }, tokens_used=107"#)) - .expect_send_local_response( - Some(StatusCode::TOO_MANY_REQUESTS.as_u16().into()), - None, - None, - None, - ) - .expect_metric_increment("ratelimited_rq", 1) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} - -#[test] -#[serial] -fn llm_gateway_request_not_ratelimited() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let filter_context = setup_filter(&mut module, default_config()); - - // Setup HTTP Stream - let http_context = 2; - - normal_flow(&mut module, filter_context, http_context); - - // give shorter body to avoid rate limiting - let chat_completions_request_body = r#"{"model":"gpt-1","messages":[{"role":"system","content":"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},{"role":"user","content":"Compose a poem that explains the concept of recursion in programming."}]}"#; - - module - .call_proxy_on_request_body( - http_context, - chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID) - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(chat_completions_request_body)) - // The actual call is not important in this test, we just need to grab the token_id - .expect_log(Some(LogLevel::Info), None) - // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] CLIENT_REQUEST_PAYLOAD: {\"model\":\"gpt-1\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"},{\"role\":\"user\",\"content\":\"Compose a poem that explains the concept of recursion in programming.\"}]}")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("TOKENIZER: computing token count for model=gpt-4")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_metric_record("input_sequence_length", 29) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("Checking limit for provider=gpt-4, with selector=Header { key: \"selector-key\", value: \"selector-value\" }, consuming tokens=29")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] UPSTREAM_REQUEST_PAYLOAD: {\"messages\":[{\"role\":\"system\",\"content\":\"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"},{\"role\":\"user\",\"content\":\"Compose a poem that explains the concept of recursion in programming.\"}],\"model\":\"gpt-4\"}")) - .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} - -#[test] -#[serial] -fn llm_gateway_override_model_name() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let filter_context = setup_filter(&mut module, default_config()); - - // Setup HTTP Stream - let http_context = 2; - - normal_flow(&mut module, filter_context, http_context); - - // give shorter body to avoid rate limiting - let chat_completions_request_body = r#"{"model":"gpt-1","messages":[{"role":"system","content":"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},{"role":"user","content":"Compose a poem that explains the concept of recursion in programming."}]}"#; - - module - .call_proxy_on_request_body( - http_context, - chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID) - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(chat_completions_request_body)) - // The actual call is not important in this test, we just need to grab the token_id - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] CLIENT_REQUEST_PAYLOAD: {\"model\":\"gpt-1\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"},{\"role\":\"user\",\"content\":\"Compose a poem that explains the concept of recursion in programming.\"}]}")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("TOKENIZER: computing token count for model=gpt-4")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_metric_record("input_sequence_length", 29) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("Checking limit for provider=gpt-4, with selector=Header { key: \"selector-key\", value: \"selector-value\" }, consuming tokens=29")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] UPSTREAM_REQUEST_PAYLOAD: {\"messages\":[{\"role\":\"system\",\"content\":\"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"},{\"role\":\"user\",\"content\":\"Compose a poem that explains the concept of recursion in programming.\"}],\"model\":\"gpt-4\"}")) - .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} - -#[test] -#[serial] -fn llm_gateway_override_use_default_model() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let filter_context = setup_filter(&mut module, default_config()); - - // Setup HTTP Stream - let http_context = 2; - - normal_flow(&mut module, filter_context, http_context); - - // give shorter body to avoid rate limiting - let chat_completions_request_body = r#"{"model":"gpt-1","messages":[{"role":"system","content":"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},{"role":"user","content":"Compose a poem that explains the concept of recursion in programming."}]}"#; - - module - .call_proxy_on_request_body( - http_context, - chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID) - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(chat_completions_request_body)) - // The actual call is not important in this test, we just need to grab the token_id - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] CLIENT_REQUEST_PAYLOAD: {\"model\":\"gpt-1\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"},{\"role\":\"user\",\"content\":\"Compose a poem that explains the concept of recursion in programming.\"}]}")) - .expect_log( - Some(LogLevel::Info), - None // Dynamic request ID, - ) - .expect_log(Some(LogLevel::Debug), Some("TOKENIZER: computing token count for model=gpt-4")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_metric_record("input_sequence_length", 29) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("Checking limit for provider=gpt-4, with selector=Header { key: \"selector-key\", value: \"selector-value\" }, consuming tokens=29")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] UPSTREAM_REQUEST_PAYLOAD: {\"messages\":[{\"role\":\"system\",\"content\":\"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"},{\"role\":\"user\",\"content\":\"Compose a poem that explains the concept of recursion in programming.\"}],\"model\":\"gpt-4\"}")) - .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} - -#[test] -#[serial] -fn llm_gateway_override_use_model_name_none() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let filter_context = setup_filter(&mut module, default_config()); - - // Setup HTTP Stream - let http_context = 2; - - normal_flow(&mut module, filter_context, http_context); - - // give shorter body to avoid rate limiting - let chat_completions_request_body = r#"{"model":"none","messages":[{"role":"system","content":"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},{"role":"user","content":"Compose a poem that explains the concept of recursion in programming."}]}"#; - - module - .call_proxy_on_request_body( - http_context, - chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) // Dynamic request ID) - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(chat_completions_request_body)) - // The actual call is not important in this test, we just need to grab the token_id - .expect_log(Some(LogLevel::Info), None) - // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] CLIENT_REQUEST_PAYLOAD: {\"model\":\"none\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"},{\"role\":\"user\",\"content\":\"Compose a poem that explains the concept of recursion in programming.\"}]}")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("TOKENIZER: computing token count for model=gpt-4")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_metric_record("input_sequence_length", 29) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("Checking limit for provider=gpt-4, with selector=Header { key: \"selector-key\", value: \"selector-value\" }, consuming tokens=29")) - .expect_log(Some(LogLevel::Info), None) // Dynamic request ID) - .expect_log(Some(LogLevel::Debug), Some("[ARCHGW_REQ_ID:NO_REQUEST_ID] UPSTREAM_REQUEST_PAYLOAD: {\"messages\":[{\"role\":\"system\",\"content\":\"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"},{\"role\":\"user\",\"content\":\"Compose a poem that explains the concept of recursion in programming.\"}],\"model\":\"gpt-4\"}")) - .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} diff --git a/crates/prompt_gateway/Cargo.toml b/crates/prompt_gateway/Cargo.toml index e8a166f8..93da66ce 100644 --- a/crates/prompt_gateway/Cargo.toml +++ b/crates/prompt_gateway/Cargo.toml @@ -24,6 +24,5 @@ derivative = "2.2.0" sha2 = "0.10.8" [dev-dependencies] -proxy-wasm-test-framework = { git = "https://github.com/katanemo/test-framework.git", branch = "new" } serial_test = "3.1.1" pretty_assertions = "1.4.1" diff --git a/crates/prompt_gateway/tests/integration.rs b/crates/prompt_gateway/tests/integration.rs deleted file mode 100644 index 4708fff1..00000000 --- a/crates/prompt_gateway/tests/integration.rs +++ /dev/null @@ -1,694 +0,0 @@ -use common::api::open_ai::{ - ChatCompletionsResponse, Choice, ContentType, FunctionCallDetail, Message, ToolCall, ToolType, - Usage, -}; -use common::configuration::Configuration; -use http::StatusCode; -use proxy_wasm_test_framework::tester::{self, Tester}; -use proxy_wasm_test_framework::types::{ - Action, BufferType, LogLevel, MapType, MetricType, ReturnType, -}; -use serde_yaml::Value; -use serial_test::serial; -use std::collections::HashMap; -use std::path::Path; - -fn wasm_module() -> String { - let wasm_file = Path::new("../target/wasm32-wasip1/release/prompt_gateway.wasm"); - assert!( - wasm_file.exists(), - "Run `cargo build --release --target=wasm32-wasip1` first" - ); - wasm_file.to_str().unwrap().to_string() -} - -fn request_headers_expectations(module: &mut Tester, http_context: i32) { - module - .call_proxy_on_request_headers(http_context, 0, false) - .expect_log(Some(LogLevel::Debug), None) - .expect_remove_header_map_value(Some(MapType::HttpRequestHeaders), Some("content-length")) - .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":path")) - .returning(Some("/v1/chat/completions")) - .expect_get_header_map_pairs(Some(MapType::HttpRequestHeaders)) - .returning(None) - .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("x-request-id")) - .returning(None) - .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("traceparent")) - .returning(None) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} - -fn normal_flow(module: &mut Tester, filter_context: i32, http_context: i32) { - module - .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Trace), None) - .execute_and_expect(ReturnType::None) - .unwrap(); - - request_headers_expectations(module, http_context); - - // Request Body - let chat_completions_request_body = "\ -{\ - \"messages\": [\ - {\ - \"role\": \"system\",\ - \"content\": \"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"\ - },\ - {\ - \"role\": \"user\",\ - \"content\": \"Compose a poem that explains the concept of recursion in programming.\"\ - }\ - ],\ - \"model\": \"gpt-4\"\ -}"; - - module - .call_proxy_on_request_body( - http_context, - chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(chat_completions_request_body)) - // The actual call is not important in this test, we just need to grab the token_id - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_http_call( - Some("arch_internal"), - Some(vec![ - ("x-arch-upstream", "model_server"), - (":method", "POST"), - (":path", "/function_calling"), - ("content-type", "application/json"), - (":authority", "model_server"), - ("x-envoy-upstream-rq-timeout-ms", "30000"), - ]), - None, - None, - Some(5000), - ) - .returning(Some(1)) - .expect_metric_increment("active_http_calls", 1) - .execute_and_expect(ReturnType::Action(Action::Pause)) - .unwrap(); -} - -fn setup_filter(module: &mut Tester, config: &str) -> i32 { - let filter_context = 1; - - module - .call_proxy_on_context_create(filter_context, 0) - .expect_metric_creation(MetricType::Gauge, "active_http_calls") - .execute_and_expect(ReturnType::None) - .unwrap(); - - module - .call_proxy_on_configure(filter_context, config.len() as i32) - .expect_get_buffer_bytes(Some(BufferType::PluginConfiguration)) - .returning(Some(config)) - .execute_and_expect(ReturnType::Bool(true)) - .unwrap(); - - filter_context -} - -fn default_config() -> &'static str { - r#" -version: "0.1-beta" - -listener: - address: 0.0.0.0 - port: 10000 - message_format: huggingface - connect_timeout: 0.005s - -endpoints: - api_server: - endpoint: api_server:80 - connect_timeout: 0.005s - -llm_providers: - - name: open-ai-gpt-4 - provider_interface: openai - access_key: secret_key - model: gpt-4 - default: true - -overrides: - # confidence threshold for prompt target intent matching - prompt_target_intent_matching_threshold: 0.0 - -system_prompt: | - You are a helpful assistant. - -prompt_guards: - input_guards: - jailbreak: - on_exception: - message: "Looks like you're curious about my abilities, but I can only provide assistance within my programmed parameters." - -prompt_targets: - - name: weather_forecast - description: This function provides realtime weather forecast information for a given city. - parameters: - - name: city - required: true - description: The city for which the weather forecast is requested. - - name: days - description: The number of days for which the weather forecast is requested. - - name: units - description: The units in which the weather forecast is requested. - endpoint: - name: api_server - path: /weather - http_method: POST - system_prompt: | - You are a helpful weather forecaster. Use weater data that is provided to you. Please following following guidelines when responding to user queries: - - Use farenheight for temperature - - Use miles per hour for wind speed - -ratelimits: - - model: gpt-4 - selector: - key: selector-key - value: selector-value - limit: - tokens: 1 - unit: minute -"# -} - -#[test] -#[serial] -fn prompt_gateway_successful_request_to_open_ai_chat_completions() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let filter_context = setup_filter(&mut module, default_config()); - - // Setup HTTP Stream - let http_context = 2; - - module - .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Trace), None) - .execute_and_expect(ReturnType::None) - .unwrap(); - - request_headers_expectations(&mut module, http_context); - - // Request Body - let chat_completions_request_body = "\ - {\ - \"messages\": [\ - {\ - \"role\": \"system\",\ - \"content\": \"You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.\"\ - },\ - {\ - \"role\": \"user\",\ - \"content\": \"Compose a poem that explains the concept of recursion in programming.\"\ - }\ - ],\ - \"model\": \"gpt-4\"\ - }"; - - module - .call_proxy_on_request_body( - http_context, - chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(chat_completions_request_body)) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_http_call(Some("arch_internal"), None, None, None, None) - .returning(Some(4)) - .expect_metric_increment("active_http_calls", 1) - .execute_and_expect(ReturnType::Action(Action::Pause)) - .unwrap(); -} - -#[test] -#[serial] -fn prompt_gateway_bad_request_to_open_ai_chat_completions() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let filter_context = setup_filter(&mut module, default_config()); - - // Setup HTTP Stream - let http_context = 2; - - module - .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Trace), None) - .execute_and_expect(ReturnType::None) - .unwrap(); - - request_headers_expectations(&mut module, http_context); - - // Request Body - let incomplete_chat_completions_request_body = "\ - {\ - \"messages\": [\ - {\ - \"role\": \"system\",\ - },\ - {\ - \"role\": \"user\",\ - \"content\": \"Compose a poem that explains the concept of recursion in programming.\"\ - }\ - ]\ - }"; - - module - .call_proxy_on_request_body( - http_context, - incomplete_chat_completions_request_body.len() as i32, - true, - ) - .expect_log(Some(LogLevel::Debug), None) - .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) - .returning(Some(incomplete_chat_completions_request_body)) - .expect_log(Some(LogLevel::Debug), None) - .expect_send_local_response( - Some(StatusCode::BAD_REQUEST.as_u16().into()), - None, - None, - None, - ) - .execute_and_expect(ReturnType::Action(Action::Pause)) - .unwrap(); -} - -#[test] -#[ignore] -#[serial] -fn prompt_gateway_request_to_llm_gateway() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let mut config: Configuration = serde_yaml::from_str(default_config()).unwrap(); - config.ratelimits.as_mut().unwrap()[0].limit.tokens += 1000; - let config_str = serde_json::to_string(&config).unwrap(); - - let filter_context = setup_filter(&mut module, &config_str); - - // Setup HTTP Stream - let http_context = 2; - - normal_flow(&mut module, filter_context, http_context); - - let arch_fc_resp = ChatCompletionsResponse { - usage: Some(Usage { - completion_tokens: 0, - }), - choices: vec![Choice { - finish_reason: Some("test".to_string()), - index: Some(0), - message: Message { - role: "system".to_string(), - content: None, - tool_calls: Some(vec![ToolCall { - id: String::from("test"), - tool_type: ToolType::Function, - function: FunctionCallDetail { - name: String::from("weather_forecast"), - arguments: Some(HashMap::from([( - String::from("city"), - Value::String(String::from("seattle")), - )])), - }, - }]), - model: None, - tool_call_id: None, - }, - }], - model: String::from("test"), - metadata: { - let mut map: HashMap = HashMap::new(); - map.insert("function_latency".to_string(), "0.0".to_string()); - Some(map) - }, - }; - - let expected_body = "{\"city\":\"seattle\"}"; - let arch_fc_resp_str = serde_json::to_string(&arch_fc_resp).unwrap(); - module - .call_proxy_on_http_call_response(http_context, 1, 0, arch_fc_resp_str.len() as i32, 0) - .expect_metric_increment("active_http_calls", -1) - .expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody)) - .returning(Some(&arch_fc_resp_str)) - .expect_log(Some(LogLevel::Warn), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_http_call( - Some("arch_internal"), - Some(vec![ - ("x-envoy-max-retries", "3"), - ("x-arch-upstream", "api_server"), - ("content-type", "application/json"), - ("x-envoy-upstream-rq-timeout-ms", "30000"), - (":path", "/weather"), - (":method", "POST"), - (":authority", "api_server"), - ]), - Some(expected_body), - None, - Some(5000), - ) - .returning(Some(2)) - .expect_metric_increment("active_http_calls", 1) - .expect_log(Some(LogLevel::Trace), None) - .execute_and_expect(ReturnType::None) - .unwrap(); - - let body_text = String::from("test body"); - module - .call_proxy_on_http_call_response(http_context, 2, 0, body_text.len() as i32, 0) - .expect_metric_increment("active_http_calls", -1) - .expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody)) - .returning(Some(&body_text)) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_get_header_map_value(Some(MapType::HttpCallResponseHeaders), Some(":status")) - .returning(Some("200")) - .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) - .expect_log(Some(LogLevel::Debug), None) - .execute_and_expect(ReturnType::None) - .unwrap(); - - let chat_completion_response = ChatCompletionsResponse { - usage: Some(Usage { - completion_tokens: 0, - }), - choices: vec![Choice { - finish_reason: Some("test".to_string()), - index: Some(0), - message: Message { - role: "assistant".to_string(), - content: Some(ContentType::Text("hello from fake llm gateway".to_string())), - model: None, - tool_calls: None, - tool_call_id: None, - }, - }], - model: String::from("test"), - metadata: None, - }; - - let chat_completion_response_str = serde_json::to_string(&chat_completion_response).unwrap(); - module - .call_proxy_on_response_body( - http_context, - chat_completion_response_str.len() as i32, - true, - ) - .expect_get_buffer_bytes(Some(BufferType::HttpResponseBody)) - .returning(Some(chat_completion_response_str.as_str())) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), None) - .expect_set_buffer_bytes(Some(BufferType::HttpResponseBody), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .execute_and_expect(ReturnType::Action(Action::Continue)) - .unwrap(); -} - -#[test] -#[ignore] -#[serial] -fn prompt_gateway_request_no_intent_match() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let mut config: Configuration = serde_yaml::from_str(default_config()).unwrap(); - config.ratelimits.as_mut().unwrap()[0].limit.tokens += 1000; - let config_str = serde_json::to_string(&config).unwrap(); - - let filter_context = setup_filter(&mut module, &config_str); - - // Setup HTTP Stream - let http_context = 2; - - normal_flow(&mut module, filter_context, http_context); - - let arch_fc_resp = ChatCompletionsResponse { - usage: Some(Usage { - completion_tokens: 0, - }), - choices: vec![Choice { - finish_reason: Some("test".to_string()), - index: Some(0), - message: Message { - role: "assistant".to_string(), - content: None, - tool_calls: None, - model: None, - tool_call_id: None, - }, - }], - model: String::from("test"), - metadata: None, - }; - - let arch_fc_resp_str = serde_json::to_string(&arch_fc_resp).unwrap(); - module - .call_proxy_on_http_call_response(http_context, 1, 0, arch_fc_resp_str.len() as i32, 0) - .expect_metric_increment("active_http_calls", -1) - .expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody)) - .returning(Some(&arch_fc_resp_str)) - .expect_log(Some(LogLevel::Warn), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), Some("intent matched: false")) - .expect_log( - Some(LogLevel::Info), - Some("no default prompt target found, forwarding request to upstream llm"), - ) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Info), None) - .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) - .execute_and_expect(ReturnType::None) - .unwrap(); -} - -fn arch_config_default_target() -> &'static str { - r#" -version: "0.1-beta" - -listener: - address: 0.0.0.0 - port: 10000 - message_format: huggingface - connect_timeout: 0.005s - -endpoints: - api_server: - endpoint: api_server:80 - connect_timeout: 0.005s - -llm_providers: - - name: open-ai-gpt-4 - provider_interface: openai - access_key: secret_key - model: gpt-4 - default: true - -overrides: - # confidence threshold for prompt target intent matching - prompt_target_intent_matching_threshold: 0.0 - -system_prompt: | - You are a helpful assistant. - -prompt_guards: - input_guards: - jailbreak: - on_exception: - message: "Looks like you're curious about my abilities, but I can only provide assistance within my programmed parameters." - -prompt_targets: - - name: weather_forecast - description: This function provides realtime weather forecast information for a given city. - parameters: - - name: city - required: true - description: The city for which the weather forecast is requested. - - name: days - description: The number of days for which the weather forecast is requested. - - name: units - description: The units in which the weather forecast is requested. - endpoint: - name: api_server - path: /weather - http_method: POST - system_prompt: | - You are a helpful weather forecaster. Use weater data that is provided to you. Please following following guidelines when responding to user queries: - - Use farenheight for temperature - - Use miles per hour for wind speed - - - name: default_target - default: true - description: This is the default target for all unmatched prompts. - endpoint: - name: weather_forecast_service - path: /default_target - http_method: POST - system_prompt: | - You are a helpful assistant! Summarize the user's request and provide a helpful response. - # if it is set to false arch will send response that it received from this prompt target to the user - # if true arch will forward the response to the default LLM - auto_llm_dispatch_on_response: false - -ratelimits: - - model: gpt-4 - selector: - key: selector-key - value: selector-value - limit: - tokens: 1 - unit: minute -"# -} - -#[test] -#[ignore] -#[serial] -fn prompt_gateway_request_no_intent_match_default_target() { - let args = tester::MockSettings { - wasm_path: wasm_module(), - quiet: false, - allow_unexpected: false, - }; - let mut module = tester::mock(args).unwrap(); - - module - .call_start() - .execute_and_expect(ReturnType::None) - .unwrap(); - - // Setup Filter - let mut config: Configuration = serde_yaml::from_str(arch_config_default_target()).unwrap(); - config.ratelimits.as_mut().unwrap()[0].limit.tokens += 1000; - let config_str = serde_json::to_string(&config).unwrap(); - - let filter_context = setup_filter(&mut module, &config_str); - - // Setup HTTP Stream - let http_context = 2; - - normal_flow(&mut module, filter_context, http_context); - - let arch_fc_resp = ChatCompletionsResponse { - usage: Some(Usage { - completion_tokens: 0, - }), - choices: vec![Choice { - finish_reason: Some("test".to_string()), - index: Some(0), - message: Message { - role: "system".to_string(), - content: None, - tool_calls: None, - model: None, - tool_call_id: None, - }, - }], - model: String::from("test"), - metadata: None, - }; - - let arch_fc_resp_str = serde_json::to_string(&arch_fc_resp).unwrap(); - module - .call_proxy_on_http_call_response(http_context, 1, 0, arch_fc_resp_str.len() as i32, 0) - .expect_metric_increment("active_http_calls", -1) - .expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody)) - .returning(Some(&arch_fc_resp_str)) - .expect_log(Some(LogLevel::Warn), None) - .expect_log(Some(LogLevel::Info), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), Some("intent matched: false")) - .expect_log( - Some(LogLevel::Info), - Some("default prompt target found, forwarding request to default prompt target"), - ) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), None) - .expect_http_call( - Some("arch_internal"), - Some(vec![ - (":method", "POST"), - ("x-arch-upstream", "weather_forecast_service"), - (":path", "/default_target"), - (":authority", "weather_forecast_service"), - ("content-type", "application/json"), - ("x-envoy-max-retries", "3"), - ("x-envoy-upstream-rq-timeout-ms", "30000"), - ]), - None, - None, - Some(5000), - ) - .returning(Some(2)) - .expect_metric_increment("active_http_calls", 1) - .execute_and_expect(ReturnType::None) - .unwrap(); -}