README Source History Refs Reviews Compare Notes Search Review guide ai(SMH-PLAN-AIAG0001): expose eval and JSON-RPC through one runtime d3b4efc8ca33087abd428a7a6a10dc0c2ec688d0
Oliver Jan Krylow <oliver@bugabinga.net > · 11 Sep 2026
unsigned
Browse files Compare with HEAD
smith-harness assembles the agent from configuration: mock providers
run scripted responses offline, real providers post through the vendor
transport with credentials resolved from the environment and fail
fast when they are missing. The smith binary gains eval (plain or
JSON output) and rpc (LF-delimited, request IDs preserved on every
record including unknown-method errors, deltas ordered before the
authoritative end record). Verified end to end through the real
binary under an isolated XDG home.
Changed files (10) Diff layout Auto Unified Split
+1322 / −10 text lines
17 + source = "registry+https://github.com/rust-lang/crates.io-index" 18 + checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" 25 + "is_terminal_polyfill" ,32 + source = "registry+https://github.com/rust-lang/crates.io-index" 33 + checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" 36 + name = "anstyle-parse" 38 + source = "registry+https://github.com/rust-lang/crates.io-index" 39 + checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" 45 + name = "anstyle-query" 47 + source = "registry+https://github.com/rust-lang/crates.io-index" 48 + checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" 50 + "windows-sys 0.61.2" ,54 + name = "anstyle-wincon" 56 + source = "registry+https://github.com/rust-lang/crates.io-index" 57 + checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" 60 + "once_cell_polyfill" ,61 + "windows-sys 0.61.2" ,67 + source = "registry+https://github.com/rust-lang/crates.io-index" 68 + checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" 73 + source = "registry+https://github.com/rust-lang/crates.io-index" 74 + checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" 14 76 [[package ]][[package ]]15 77 name = "bitflags" name = "bitflags" 16 78 version = "2.13.2" version = "2.13.2" 33 95 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 34 96 checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
101 + source = "registry+https://github.com/rust-lang/crates.io-index" 102 + checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" 107 + source = "registry+https://github.com/rust-lang/crates.io-index" 108 + checksum = "005ec2760ca554fae18df7a11195552ec576cd665632a881bc011d5bb2fd4d80" 36 114 [[package ]][[package ]]37 115 name = "cfg-if" name = "cfg-if" 38 116 version = "1.0.4" version = "1.0.4"
156 + source = "registry+https://github.com/rust-lang/crates.io-index" 157 + checksum = "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca" 164 + name = "clap_builder" 166 + source = "registry+https://github.com/rust-lang/crates.io-index" 167 + checksum = "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889" 178 + source = "registry+https://github.com/rust-lang/crates.io-index" 179 + checksum = "d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061" 190 + source = "registry+https://github.com/rust-lang/crates.io-index" 191 + checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" 196 + source = "registry+https://github.com/rust-lang/crates.io-index" 197 + checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" 200 + name = "core-foundation" 202 + source = "registry+https://github.com/rust-lang/crates.io-index" 203 + checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" 205 + "core-foundation-sys" ,210 + name = "core-foundation" 212 + source = "registry+https://github.com/rust-lang/crates.io-index" 213 + checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" 215 + "core-foundation-sys" ,220 + name = "core-foundation-sys" 222 + source = "registry+https://github.com/rust-lang/crates.io-index" 223 + checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" 228 + source = "registry+https://github.com/rust-lang/crates.io-index" 229 + checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" 75 231 [[package ]][[package ]]76 232 name = "crossbeam-deque" name = "crossbeam-deque" 77 233 version = "0.8.8" version = "0.8.8" 122 278 "option-ext" , "option-ext" ,123 279 "redox_users" , "redox_users" ,280 + "windows-sys 0.48.0" ,286 + source = "registry+https://github.com/rust-lang/crates.io-index" 287 + checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" 297 + source = "registry+https://github.com/rust-lang/crates.io-index" 298 + checksum = "7b5ef0006ac9ab233c38522f5ae99cae3625151de8f706cacee1cba4b8e2832a" 303 + "multiversion_no_op" ,127 309 [[package ]][[package ]]130 312 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 131 313 checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
318 + source = "registry+https://github.com/rust-lang/crates.io-index" 319 + checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" 322 + "windows-sys 0.61.2" ,328 + source = "registry+https://github.com/rust-lang/crates.io-index" 329 + checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" 332 + name = "find-msvc-tools" 334 + source = "registry+https://github.com/rust-lang/crates.io-index" 335 + checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d" 340 + source = "registry+https://github.com/rust-lang/crates.io-index" 341 + checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 344 + name = "foreign-types" 346 + source = "registry+https://github.com/rust-lang/crates.io-index" 347 + checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 349 + "foreign-types-shared" ,353 + name = "foreign-types-shared" 355 + source = "registry+https://github.com/rust-lang/crates.io-index" 356 + checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 359 + name = "form_urlencoded" 361 + source = "registry+https://github.com/rust-lang/crates.io-index" 362 + checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" 133 367 [[package ]][[package ]]134 368 name = "fs2" name = "fs2" 135 369 version = "0.4.3" version = "0.4.3" 263 497 "regex-syntax" , "regex-syntax" ,
503 + source = "registry+https://github.com/rust-lang/crates.io-index" 504 + checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16" 266 519 [[package ]][[package ]]267 520 name = "half" name = "half" 268 521 version = "2.7.1" version = "2.7.1" 280 533 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 281 534 checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
539 + source = "registry+https://github.com/rust-lang/crates.io-index" 540 + checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 545 + source = "registry+https://github.com/rust-lang/crates.io-index" 546 + checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" 555 + source = "registry+https://github.com/rust-lang/crates.io-index" 556 + checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" 563 + name = "http-body-util" 565 + source = "registry+https://github.com/rust-lang/crates.io-index" 566 + checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" 578 + source = "registry+https://github.com/rust-lang/crates.io-index" 579 + checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" 584 + source = "registry+https://github.com/rust-lang/crates.io-index" 585 + checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43" 603 + name = "hyper-rustls" 605 + source = "registry+https://github.com/rust-lang/crates.io-index" 606 + checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" 620 + source = "registry+https://github.com/rust-lang/crates.io-index" 621 + checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" 636 + source = "registry+https://github.com/rust-lang/crates.io-index" 637 + checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" 651 + "system-configuration" ,659 + name = "icu_collections" 661 + source = "registry+https://github.com/rust-lang/crates.io-index" 662 + checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" 673 + name = "icu_locale_core" 675 + source = "registry+https://github.com/rust-lang/crates.io-index" 676 + checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" 686 + name = "icu_normalizer" 688 + source = "registry+https://github.com/rust-lang/crates.io-index" 689 + checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" 692 + "icu_normalizer_data" ,700 + name = "icu_normalizer_data" 702 + source = "registry+https://github.com/rust-lang/crates.io-index" 703 + checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" 706 + name = "icu_properties" 708 + source = "registry+https://github.com/rust-lang/crates.io-index" 709 + checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" 714 + "icu_properties_data" ,721 + name = "icu_properties_data" 723 + source = "registry+https://github.com/rust-lang/crates.io-index" 724 + checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" 727 + name = "icu_provider" 729 + source = "registry+https://github.com/rust-lang/crates.io-index" 730 + checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" 744 + source = "registry+https://github.com/rust-lang/crates.io-index" 745 + checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" 753 + name = "idna_adapter" 755 + source = "registry+https://github.com/rust-lang/crates.io-index" 756 + checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" 283 762 [[package ]][[package ]]284 763 name = "ignore" name = "ignore" 285 764 version = "0.4.33" version = "0.4.33" 306 785 "hashbrown" , "hashbrown" ,
791 + source = "registry+https://github.com/rust-lang/crates.io-index" 792 + checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" 795 + name = "is_terminal_polyfill" 797 + source = "registry+https://github.com/rust-lang/crates.io-index" 798 + checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" 309 800 [[package ]][[package ]]310 801 name = "itoa" name = "itoa" 311 802 version = "1.0.18" version = "1.0.18"
833 + name = "linux-raw-sys" 835 + source = "registry+https://github.com/rust-lang/crates.io-index" 836 + checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" 841 + source = "registry+https://github.com/rust-lang/crates.io-index" 842 + checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" 341 844 [[package ]][[package ]]342 845 name = "log" name = "log" 343 846 version = "0.4.34" version = "0.4.34" 350 853 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 351 854 checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
859 + source = "registry+https://github.com/rust-lang/crates.io-index" 860 + checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 865 + source = "registry+https://github.com/rust-lang/crates.io-index" 866 + checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8" 870 + "windows-sys 0.61.2" ,874 + name = "multiversion" 876 + source = "registry+https://github.com/rust-lang/crates.io-index" 877 + checksum = "b4ca4bea16ffc3f443cf7d866912118196bfef4c6a1556ca00f9f9b00bb43f7c" 879 + "multiversion-macros" ,883 + name = "multiversion-macros" 885 + source = "registry+https://github.com/rust-lang/crates.io-index" 886 + checksum = "0d416831a7317ef4b08bee00b69cbbb9c8763da7959a7026244d6266869f9c83" 895 + name = "multiversion_no_op" 897 + source = "registry+https://github.com/rust-lang/crates.io-index" 898 + checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" 903 + source = "registry+https://github.com/rust-lang/crates.io-index" 904 + checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" 912 + "security-framework" ,913 + "security-framework-sys" ,353 917 [[package ]][[package ]]354 918 name = "nix" name = "nix" 355 919 version = "0.29.0" version = "0.29.0" 368 932 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 369 933 checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
936 + name = "once_cell_polyfill" 938 + source = "registry+https://github.com/rust-lang/crates.io-index" 939 + checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" 944 + source = "registry+https://github.com/rust-lang/crates.io-index" 945 + checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" 956 + name = "openssl-macros" 958 + source = "registry+https://github.com/rust-lang/crates.io-index" 959 + checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 967 + name = "openssl-probe" 969 + source = "registry+https://github.com/rust-lang/crates.io-index" 970 + checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" 975 + source = "registry+https://github.com/rust-lang/crates.io-index" 976 + checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" 371 984 [[package ]][[package ]]372 985 name = "option-ext" name = "option-ext" 373 986 version = "0.2.0" version = "0.2.0" 374 987 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 375 988 checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
991 + name = "percent-encoding" 993 + source = "registry+https://github.com/rust-lang/crates.io-index" 994 + checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" 377 996 [[package ]][[package ]]378 997 name = "pin-project-lite" name = "pin-project-lite" 379 998 version = "0.2.17" version = "0.2.17" 380 999 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 381 1000 checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
1005 + source = "registry+https://github.com/rust-lang/crates.io-index" 1006 + checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" 1009 + name = "potential_utf" 1011 + source = "registry+https://github.com/rust-lang/crates.io-index" 1012 + checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" 383 1017 [[package ]][[package ]]384 1018 name = "proc-macro2" name = "proc-macro2" 385 1019 version = "1.0.107" version = "1.0.107" 432 1066 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 433 1067 checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
1072 + source = "registry+https://github.com/rust-lang/crates.io-index" 1073 + checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" 1093 + "percent-encoding" ,1094 + "pin-project-lite" ,1095 + "rustls-pki-types" ,1098 + "serde_urlencoded" ,1101 + "tokio-native-tls" ,1108 + "wasm-bindgen-futures" ,1116 + source = "registry+https://github.com/rust-lang/crates.io-index" 1117 + checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" 1121 + "getrandom 0.2.17" ,1124 + "windows-sys 0.52.0" ,1130 + source = "registry+https://github.com/rust-lang/crates.io-index" 1131 + checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" 1137 + "windows-sys 0.61.2" ,1143 + source = "registry+https://github.com/rust-lang/crates.io-index" 1144 + checksum = "6725596c3f2c3a0aef021139e145d4eafe314a6623e4680ca83852b2c67ab2ba" 1147 + "rustls-pki-types" ,1154 + name = "rustls-pki-types" 1156 + source = "registry+https://github.com/rust-lang/crates.io-index" 1157 + checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" 1163 + name = "rustls-webpki" 1164 + version = "0.103.15" 1165 + source = "registry+https://github.com/rust-lang/crates.io-index" 1166 + checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" 1169 + "rustls-pki-types" ,435 1173 [[package ]][[package ]]436 1174 name = "rustversion" name = "rustversion" 437 1175 version = "1.0.23" version = "1.0.23" 438 1176 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 439 1177 checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
1182 + source = "registry+https://github.com/rust-lang/crates.io-index" 1183 + checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" 441 1185 [[package ]][[package ]]442 1186 name = "same-file" name = "same-file" 443 1187 version = "1.0.6" version = "1.0.6" 447 1191 "winapi-util" , "winapi-util" ,
1197 + source = "registry+https://github.com/rust-lang/crates.io-index" 1198 + checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" 1200 + "windows-sys 0.61.2" ,1206 + source = "registry+https://github.com/rust-lang/crates.io-index" 1207 + checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1210 + name = "security-framework" 1212 + source = "registry+https://github.com/rust-lang/crates.io-index" 1213 + checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" 1216 + "core-foundation 0.10.1" ,1217 + "core-foundation-sys" ,1219 + "security-framework-sys" ,1223 + name = "security-framework-sys" 1225 + source = "registry+https://github.com/rust-lang/crates.io-index" 1226 + checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" 1228 + "core-foundation-sys" ,450 1232 [[package ]][[package ]]451 1233 name = "serde" name = "serde" 452 1234 version = "1.0.229" version = "1.0.229"
1277 + name = "serde_urlencoded" 1279 + source = "registry+https://github.com/rust-lang/crates.io-index" 1280 + checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1291 + source = "registry+https://github.com/rust-lang/crates.io-index" 1292 + checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" 1297 + source = "registry+https://github.com/rust-lang/crates.io-index" 1298 + checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" 494 1300 [[package ]][[package ]]495 1301 name = "slab" name = "slab" 496 1302 version = "0.4.12" version = "0.4.12" 497 1303 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 498 1304 checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
1309 + source = "registry+https://github.com/rust-lang/crates.io-index" 1310 + checksum = "b9be42f50aa861c555654aa3a37f52f4b1074bacf4e48fe0ef7fa584e80f1f0f" 500 1312 [[package ]][[package ]]501 1313 name = "smith" name = "smith" 502 1314 version = "0.1.0" version = "0.1.0" 514 1326 version = "0.1.0" version = "0.1.0" 515 1327 dependencies = [dependencies = [516 1328 "futures" , "futures" ,517 1330 "serde" , "serde" ,518 1331 "serde_json" , "serde_json" ,519 1332 "smith" , "smith" ,523 1336 name = "smith-cli" name = "smith-cli" 524 1337 version = "0.1.0" version = "0.1.0" 525 1338 dependencies = [dependencies = [526 1341 "smith" , "smith" ,527 1342 "smith-harness" , "smith-harness" ,546 1361 name = "smith-harness" name = "smith-harness" 547 1362 version = "0.1.0" version = "0.1.0" 548 1363 dependencies = [dependencies = [549 1367 "smith" , "smith" ,550 1368 "smith-ai" , "smith-ai" ,551 1369 "smith-core" , "smith-core" ,559 1377 "smith" , "smith" ,
1383 + source = "registry+https://github.com/rust-lang/crates.io-index" 1384 + checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" 1387 + "windows-sys 0.61.2" ,1391 + name = "stable_deref_trait" 1393 + source = "registry+https://github.com/rust-lang/crates.io-index" 1394 + checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" 1399 + source = "registry+https://github.com/rust-lang/crates.io-index" 1400 + checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 1405 + source = "registry+https://github.com/rust-lang/crates.io-index" 1406 + checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" 562 1408 [[package ]][[package ]]563 1409 name = "syn" name = "syn" 564 1410 version = "2.0.119" version = "2.0.119" 581 1427 "unicode-ident" , "unicode-ident" ,
1431 + name = "sync_wrapper" 1433 + source = "registry+https://github.com/rust-lang/crates.io-index" 1434 + checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" 1440 + name = "synstructure" 1442 + source = "registry+https://github.com/rust-lang/crates.io-index" 1443 + checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" 1451 + name = "system-configuration" 1453 + source = "registry+https://github.com/rust-lang/crates.io-index" 1454 + checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" 1457 + "core-foundation 0.9.4" ,1458 + "system-configuration-sys" ,1462 + name = "system-configuration-sys" 1464 + source = "registry+https://github.com/rust-lang/crates.io-index" 1465 + checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" 1467 + "core-foundation-sys" ,1474 + source = "registry+https://github.com/rust-lang/crates.io-index" 1475 + checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" 1481 + "windows-sys 0.61.2" ,584 1484 [[package ]][[package ]]585 1485 name = "thiserror" name = "thiserror" 586 1486 version = "1.0.69" version = "1.0.69" 601 1501 "syn 2.0.119" , "syn 2.0.119" ,
1507 + source = "registry+https://github.com/rust-lang/crates.io-index" 1508 + checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" 1517 + source = "registry+https://github.com/rust-lang/crates.io-index" 1518 + checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" 1523 + "pin-project-lite" ,1525 + "windows-sys 0.61.2" ,1529 + name = "tokio-native-tls" 1531 + source = "registry+https://github.com/rust-lang/crates.io-index" 1532 + checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 1539 + name = "tokio-rustls" 1541 + source = "registry+https://github.com/rust-lang/crates.io-index" 1542 + checksum = "b0c85f2c3ef0b1cd58b36682f4b17aaa995f0e5db534d85692b4903abce21f67" 1551 + source = "registry+https://github.com/rust-lang/crates.io-index" 1552 + checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" 1558 + "pin-project-lite" ,1565 + source = "registry+https://github.com/rust-lang/crates.io-index" 1566 + checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" 1570 + "pin-project-lite" ,1580 + source = "registry+https://github.com/rust-lang/crates.io-index" 1581 + checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" 1588 + "pin-project-lite" ,1596 + name = "tower-layer" 1598 + source = "registry+https://github.com/rust-lang/crates.io-index" 1599 + checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" 1602 + name = "tower-service" 1604 + source = "registry+https://github.com/rust-lang/crates.io-index" 1605 + checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" 1610 + source = "registry+https://github.com/rust-lang/crates.io-index" 1611 + checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" 1613 + "pin-project-lite" ,1618 + name = "tracing-core" 1620 + source = "registry+https://github.com/rust-lang/crates.io-index" 1621 + checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" 1629 + source = "registry+https://github.com/rust-lang/crates.io-index" 1630 + checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" 604 1632 [[package ]][[package ]]605 1633 name = "unicode-ident" name = "unicode-ident" 606 1634 version = "1.0.24" version = "1.0.24" 607 1635 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 608 1636 checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
1641 + source = "registry+https://github.com/rust-lang/crates.io-index" 1642 + checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" 1647 + source = "registry+https://github.com/rust-lang/crates.io-index" 1648 + checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" 1652 + "percent-encoding" ,1659 + source = "registry+https://github.com/rust-lang/crates.io-index" 1660 + checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" 1665 + source = "registry+https://github.com/rust-lang/crates.io-index" 1666 + checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 610 1668 [[package ]][[package ]]611 1669 name = "uuid" name = "uuid" 612 1670 version = "1.26.1" version = "1.26.1" 619 1677 "wasm-bindgen" , "wasm-bindgen" ,
1683 + source = "registry+https://github.com/rust-lang/crates.io-index" 1684 + checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 622 1686 [[package ]][[package ]]623 1687 name = "walkdir" name = "walkdir" 624 1688 version = "2.5.0" version = "2.5.0" 629 1693 "winapi-util" , "winapi-util" ,
1699 + source = "registry+https://github.com/rust-lang/crates.io-index" 1700 + checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 632 1705 [[package ]][[package ]]633 1706 name = "wasi" name = "wasi" 634 1707 version = "0.11.1+wasi-snapshot-preview1" version = "0.11.1+wasi-snapshot-preview1" 648 1721 "wasm-bindgen-shared" , "wasm-bindgen-shared" ,
1725 + name = "wasm-bindgen-futures" 1727 + source = "registry+https://github.com/rust-lang/crates.io-index" 1728 + checksum = "6ef4c5d3d2cdf5c54f4231181768f5510842e350db025faf1f7163b1030ed928" 651 1734 [[package ]][[package ]]652 1735 name = "wasm-bindgen-macro" name = "wasm-bindgen-macro" 653 1736 version = "0.2.128" version = "0.2.128" 680 1763 "unicode-ident" , "unicode-ident" ,
1767 + name = "wasm-streams" 1769 + source = "registry+https://github.com/rust-lang/crates.io-index" 1770 + checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" 1775 + "wasm-bindgen-futures" ,1782 + source = "registry+https://github.com/rust-lang/crates.io-index" 1783 + checksum = "9fbddc4a036f00ec4f18c83445bd3115cb306a91da554919a099d9222fe4a7f8" 683 1789 [[package ]][[package ]]684 1790 name = "winapi" name = "winapi" 685 1791 version = "0.3.9" version = "0.3.9" 702 1808 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 703 1809 checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" 704 1810 dependencies = [dependencies = [1811 + "windows-sys 0.61.2" ,708 1814 [[package ]][[package ]]711 1817 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 712 1818 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1821 + name = "windows-link" 1823 + source = "registry+https://github.com/rust-lang/crates.io-index" 1824 + checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" 1827 + name = "windows-registry" 1829 + source = "registry+https://github.com/rust-lang/crates.io-index" 1830 + checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" 1838 + name = "windows-result" 1840 + source = "registry+https://github.com/rust-lang/crates.io-index" 1841 + checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" 1847 + name = "windows-strings" 1849 + source = "registry+https://github.com/rust-lang/crates.io-index" 1850 + checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" 714 1855 [[package ]][[package ]]715 1856 name = "windows-sys" name = "windows-sys" 716 1857 version = "0.48.0" version = "0.48.0" 717 1858 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 718 1859 checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 719 1860 dependencies = [dependencies = [1861 + "windows-targets 0.48.5" ,1865 + name = "windows-sys" 1867 + source = "registry+https://github.com/rust-lang/crates.io-index" 1868 + checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1870 + "windows-targets 0.52.6" ,1874 + name = "windows-sys" 1876 + source = "registry+https://github.com/rust-lang/crates.io-index" 1877 + checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" 723 1882 [[package ]][[package ]]726 1885 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 727 1886 checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 728 1887 dependencies = [dependencies = [729 - "windows_aarch64_gnullvm" ,730 - "windows_aarch64_msvc" ,732 - "windows_i686_msvc" ,733 - "windows_x86_64_gnu" ,734 - "windows_x86_64_gnullvm" ,735 - "windows_x86_64_msvc" ,1888 + "windows_aarch64_gnullvm 0.48.5" ,1889 + "windows_aarch64_msvc 0.48.5" ,1890 + "windows_i686_gnu 0.48.5" ,1891 + "windows_i686_msvc 0.48.5" ,1892 + "windows_x86_64_gnu 0.48.5" ,1893 + "windows_x86_64_gnullvm 0.48.5" ,1894 + "windows_x86_64_msvc 0.48.5" ,1898 + name = "windows-targets" 1900 + source = "registry+https://github.com/rust-lang/crates.io-index" 1901 + checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 1903 + "windows_aarch64_gnullvm 0.52.6" ,1904 + "windows_aarch64_msvc 0.52.6" ,1905 + "windows_i686_gnu 0.52.6" ,1906 + "windows_i686_gnullvm" ,1907 + "windows_i686_msvc 0.52.6" ,1908 + "windows_x86_64_gnu 0.52.6" ,1909 + "windows_x86_64_gnullvm 0.52.6" ,1910 + "windows_x86_64_msvc 0.52.6" ,738 1913 [[package ]][[package ]]741 1916 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 742 1917 checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
1920 + name = "windows_aarch64_gnullvm" 1922 + source = "registry+https://github.com/rust-lang/crates.io-index" 1923 + checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 744 1925 [[package ]][[package ]]745 1926 name = "windows_aarch64_msvc" name = "windows_aarch64_msvc" 746 1927 version = "0.48.5" version = "0.48.5" 747 1928 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 748 1929 checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
1932 + name = "windows_aarch64_msvc" 1934 + source = "registry+https://github.com/rust-lang/crates.io-index" 1935 + checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 750 1937 [[package ]][[package ]]751 1938 name = "windows_i686_gnu" name = "windows_i686_gnu" 752 1939 version = "0.48.5" version = "0.48.5" 753 1940 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 754 1941 checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
1944 + name = "windows_i686_gnu" 1946 + source = "registry+https://github.com/rust-lang/crates.io-index" 1947 + checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 1950 + name = "windows_i686_gnullvm" 1952 + source = "registry+https://github.com/rust-lang/crates.io-index" 1953 + checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 756 1955 [[package ]][[package ]]757 1956 name = "windows_i686_msvc" name = "windows_i686_msvc" 758 1957 version = "0.48.5" version = "0.48.5" 759 1958 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 760 1959 checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
1962 + name = "windows_i686_msvc" 1964 + source = "registry+https://github.com/rust-lang/crates.io-index" 1965 + checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 762 1967 [[package ]][[package ]]763 1968 name = "windows_x86_64_gnu" name = "windows_x86_64_gnu" 764 1969 version = "0.48.5" version = "0.48.5" 765 1970 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 766 1971 checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
1974 + name = "windows_x86_64_gnu" 1976 + source = "registry+https://github.com/rust-lang/crates.io-index" 1977 + checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 768 1979 [[package ]][[package ]]769 1980 name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm" 770 1981 version = "0.48.5" version = "0.48.5" 771 1982 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 772 1983 checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
1986 + name = "windows_x86_64_gnullvm" 1988 + source = "registry+https://github.com/rust-lang/crates.io-index" 1989 + checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 774 1991 [[package ]][[package ]]775 1992 name = "windows_x86_64_msvc" name = "windows_x86_64_msvc" 776 1993 version = "0.48.5" version = "0.48.5" 777 1994 source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index" 778 1995 checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
1998 + name = "windows_x86_64_msvc" 2000 + source = "registry+https://github.com/rust-lang/crates.io-index" 2001 + checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 2006 + source = "registry+https://github.com/rust-lang/crates.io-index" 2007 + checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" 780 2009 [[package ]][[package ]]781 2010 name = "xtask" name = "xtask" 782 2011 version = "0.1.0" version = "0.1.0"
2016 + source = "registry+https://github.com/rust-lang/crates.io-index" 2017 + checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" 2019 + "stable_deref_trait" ,2025 + name = "yoke-derive" 2027 + source = "registry+https://github.com/rust-lang/crates.io-index" 2028 + checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" 784 2036 [[package ]][[package ]]785 2037 name = "zerocopy" name = "zerocopy" 786 2038 version = "0.8.57" version = "0.8.57" 801 2053 "syn 2.0.119" , "syn 2.0.119" ,
2059 + source = "registry+https://github.com/rust-lang/crates.io-index" 2060 + checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" 2066 + name = "zerofrom-derive" 2068 + source = "registry+https://github.com/rust-lang/crates.io-index" 2069 + checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" 2080 + source = "registry+https://github.com/rust-lang/crates.io-index" 2081 + checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" 2086 + source = "registry+https://github.com/rust-lang/crates.io-index" 2087 + checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" 2097 + source = "registry+https://github.com/rust-lang/crates.io-index" 2098 + checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" 2106 + name = "zerovec-derive" 2108 + source = "registry+https://github.com/rust-lang/crates.io-index" 2109 + checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" 804 2116 [[package ]][[package ]]805 2117 name = "zmij" name = "zmij" 806 2118 version = "1.0.23" version = "1.0.23" smith-ai/Cargo.toml Modified +1 / −0 text lines
10 10 [dependencies ][dependencies ]11 11 smith = { path = "../smith" }smith = { path = "../smith" }12 12 futures = { workspace = true }futures = { workspace = true }
13 + reqwest = { workspace = true , features = ["blocking" , "json" ] }13 14 serde = { workspace = true }serde = { workspace = true }14 15 serde_json = { workspace = true }serde_json = { workspace = true }smith-ai/src/lib.rs Modified +3 / −0 text lines
23 23 pub mod openai ;pub mod openai ;25 25 pub mod refresh ;pub mod refresh ;27 29 pub use anthropic::AnthropicDecoder;pub use anthropic::AnthropicDecoder;28 30 pub use auth::{AuthRegistry, Credential, CredentialSource};pub use auth::{AuthRegistry, Credential, CredentialSource};32 34 pub use mux::{Endpoint, Router};pub use mux::{Endpoint, Router};33 35 pub use openai::OpenAiDecoder;pub use openai::OpenAiDecoder;34 36 pub use refresh::{CatalogSnapshot, CatalogState, RefreshOutcome, refresh};pub use refresh::{CatalogSnapshot, CatalogState, RefreshOutcome, refresh};
37 + pub use transport::{VendorEndpoint, build_body, endpoint_headers, endpoint_url, transport};smith-ai/src/transport.rs Added new file mode 100644+562 / −0 text lines
8 + use crate ::anthropic::AnthropicDecoder;9 + use crate ::conformance::StreamDecoder;10 + use crate ::gemini::GeminiDecoder;11 + use crate ::models::ProviderKind;12 + use crate ::openai::OpenAiDecoder;13 + use futures::StreamExt;14 + use smith::error::{ProviderFault, Result , SmithError};15 + use smith::message::{ContentBlock, Role};16 + use smith::provider::{ProviderRequest, StreamFn};17 + use smith::tool::CancelHandle;22 + #[derive(Clone, Debug, PartialEq, Eq)]23 + pub struct VendorEndpoint {25 + pub kind: ProviderKind,27 + pub base_url: String,41 + endpoint: & VendorEndpoint,42 + request: & ProviderRequest,43 + ) -> Result <serde_json::Value> {44 + match endpoint.kind {45 + ProviderKind::OpenAiCompatible | ProviderKind::Plugin => Ok (openai_body (endpoint, request)),46 + ProviderKind::Anthropic => Ok (anthropic_body (endpoint, request)),47 + ProviderKind::Google => Ok (google_body (endpoint, request)),51 + fn openai_body (endpoint: & VendorEndpoint, request: & ProviderRequest) -> serde_json::Value {52 + let mut messages = Vec ::new();53 + for message in & request.messages {55 + Role::System => messages.push (serde_json::json! ({57 + "content" : flatten_text (message),59 + Role::User => messages.push (serde_json::json! ({61 + "content" : flatten_text (message),63 + Role::Assistant => messages.push (serde_json::json! ({65 + "content" : flatten_text (message),69 + for block in & message.blocks {70 + if let ContentBlock::ToolResult {74 + messages.push (serde_json::json! ({76 + "tool_call_id" : call_id.to_string (),86 + append_assistant_tool_calls (& request.messages, &mut messages);87 + let mut body = serde_json::json! ({88 + "model" : endpoint.model,89 + "messages" : messages,91 + "stream_options" : {"include_usage" : true },93 + if ! request.tools.is_empty () {94 + body["tools" ] = serde_json::json! (98 + .map (|tool| serde_json::json! ({102 + "description" : tool.description,103 + "parameters" : tool.input_schema,106 + .collect::<Vec <_ >>()109 + if let Some (max) = request.params.max_output_tokens {110 + body["max_tokens" ] = serde_json::json! (max);115 + fn append_assistant_tool_calls (116 + messages: & [smith::message::Message],117 + out: &mut [serde_json::Value],119 + for message in messages {120 + if message.role != Role::Assistant {123 + let calls: Vec <serde_json::Value> = message126 + .filter_map (|block| {127 + if let ContentBlock::ToolUse {134 + Some (serde_json::json! ({135 + "id" : call_id.to_string (),137 + "function" : {"name" : name, "arguments" : input.to_string ()},144 + if calls.is_empty () {147 + if let Some (last) = out.iter_mut ().rev ().find (|entry| {148 + entry.get ("role" ).and_then (serde_json::Value::as_str) == Some ("assistant" )150 + last["tool_calls" ] = serde_json::json! (calls);155 + fn anthropic_body (endpoint: & VendorEndpoint, request: & ProviderRequest) -> serde_json::Value {156 + let mut system = String ::new();157 + let mut messages = Vec ::new();158 + for message in & request.messages {159 + match message.role {161 + if ! system.is_empty () {164 + system.push_str (& flatten_text (message));166 + Role::User => messages.push (serde_json::json! ({168 + "content" : [{"type" : "text" , "text" : flatten_text (message)}],170 + Role::Assistant => {171 + let mut content = Vec ::new();172 + for block in & message.blocks {174 + ContentBlock::Text(text) => content.push (serde_json::json! ({175 + "type" : "text" , "text" : text,177 + ContentBlock::ToolUse {182 + } => content.push (serde_json::json! ({184 + "id" : call_id.to_string (),191 + messages.push (serde_json::json! ({"role" : "assistant" , "content" : content}));194 + let mut content = Vec ::new();195 + for block in & message.blocks {196 + if let ContentBlock::ToolResult {200 + content.push (serde_json::json! ({201 + "type" : "tool_result" ,202 + "tool_use_id" : call_id.to_string (),207 + messages.push (serde_json::json! ({"role" : "user" , "content" : content}));211 + let mut body = serde_json::json! ({212 + "model" : endpoint.model,213 + "max_tokens" : request.params.max_output_tokens.unwrap_or (4096 ),214 + "messages" : messages,217 + if ! system.is_empty () {218 + body["system" ] = serde_json::json! (system);220 + if ! request.tools.is_empty () {221 + body["tools" ] = serde_json::json! (225 + .map (|tool| serde_json::json! ({227 + "description" : tool.description,228 + "input_schema" : tool.input_schema,230 + .collect::<Vec <_ >>()236 + fn google_body (_endpoint: & VendorEndpoint, request: & ProviderRequest) -> serde_json::Value {237 + let system: Vec <String > = request240 + .filter (|message| message.role == Role::System)243 + let mut contents = Vec ::new();244 + for message in & request.messages {245 + let role = match message.role {246 + Role::User | Role::Tool => "user" ,247 + Role::Assistant => "model" ,248 + Role::System => continue ,250 + let mut parts = Vec ::new();251 + for block in & message.blocks {253 + ContentBlock::Text(text) => parts.push (serde_json::json! ({"text" : text})),254 + ContentBlock::ToolUse { name, input, .. } => parts.push (serde_json::json! ({255 + "functionCall" : {"name" : name, "args" : input},257 + ContentBlock::ToolResult { output, .. } => {258 + parts.push (serde_json::json! ({259 + "functionResponse" : {"name" : "tool" , "response" : {"output" : output}},262 + ContentBlock::Thinking(_ ) => {}265 + contents.push (serde_json::json! ({"role" : role, "parts" : parts}));267 + let mut body = serde_json::json! ({268 + "contents" : contents,269 + "generationConfig" : {270 + "maxOutputTokens" : request.params.max_output_tokens.unwrap_or (4096 ),273 + if ! system.is_empty () {274 + body["systemInstruction" ] = serde_json::json! ({"parts" : [{"text" : system.join ("\n" )}]});276 + if ! request.tools.is_empty () {277 + body["tools" ] = serde_json::json! ([{278 + "functionDeclarations" : request281 + .map (|tool| serde_json::json! ({283 + "description" : tool.description,284 + "parameters" : tool.input_schema,286 + .collect::<Vec <_ >>(),292 + fn flatten_text (message: & smith::message::Message) -> String {293 + let mut out = String ::new();294 + for block in & message.blocks {295 + if let ContentBlock::Text(text) = block {296 + if ! out.is_empty () {307 + pub fn endpoint_url (endpoint: & VendorEndpoint) -> String {308 + match endpoint.kind {309 + ProviderKind::OpenAiCompatible | ProviderKind::Plugin => {310 + format! ("{}/chat/completions" , endpoint.base_url)312 + ProviderKind::Anthropic => format! ("{}/v1/messages" , endpoint.base_url),313 + ProviderKind::Google => format! (314 + "{}/v1beta/models/{}:streamGenerateContent?alt=sse" ,315 + endpoint.base_url, endpoint.model322 + pub fn endpoint_headers (endpoint: & VendorEndpoint) -> Vec <(String, String)> {323 + match endpoint.kind {324 + ProviderKind::OpenAiCompatible | ProviderKind::Plugin => {326 + "Authorization" .to_string (),327 + format! ("Bearer {}" , endpoint.api_key),330 + ProviderKind::Anthropic => vec! [331 + ("x-api-key" .to_string (), endpoint.api_key.clone ()),332 + ("anthropic-version" .to_string (), "2023-06-01" .to_string ()),334 + ProviderKind::Google => vec! [("x-goog-api-key" .to_string (), endpoint.api_key.clone ())],338 + fn make_decoder (kind: ProviderKind) -> Box <dyn StreamDecoder + Send > {340 + ProviderKind::OpenAiCompatible | ProviderKind::Plugin => Box ::new(OpenAiDecoder::new()),341 + ProviderKind::Anthropic => Box ::new(AnthropicDecoder::new()),342 + ProviderKind::Google => Box ::new(GeminiDecoder::new()),357 + pub fn transport (endpoint: VendorEndpoint) -> StreamFn {358 + Arc::new(move | request: ProviderRequest, cancel: CancelHandle| {359 + let endpoint = endpoint.clone ();360 + let (sender, receiver) = std::sync::mpsc::channel::<smith::provider::StreamItem>();361 + std::thread::spawn(move || {362 + let result = post_and_decode (& endpoint, & request, & cancel, & sender);363 + if let Err (err) = result364 + && sender.send (Err (err)).is_err ()369 + futures::stream::unfold(receiver, |receiver| async move {370 + receiver.recv ().map_or (None , |item| Some ((item, receiver)))377 + endpoint: & VendorEndpoint,378 + request: & ProviderRequest,379 + cancel: & CancelHandle,380 + sender: & std::sync::mpsc::Sender<smith::provider::StreamItem>,382 + let body = build_body (endpoint, request)? ;383 + let client = reqwest::blocking::Client::new();384 + let mut prepared = client385 + .post (endpoint_url (endpoint))387 + .timeout (std::time::Duration::from_secs(600 ));388 + for (name, value) in endpoint_headers (endpoint) {389 + prepared = prepared.header (name, value);391 + let response = prepared393 + .map_err (|e| transport_fault (& e.to_string ()))? ;394 + let status = response.status ();395 + if ! status.is_success () {396 + let body = response.text ().unwrap_or_default ();397 + return Err (SmithError::Provider {398 + fault: match status.as_u16 () {399 + 429 => ProviderFault::RateLimit {400 + retry_after_ms: None ,402 + 401 | 403 => ProviderFault::Authentication { message: body },403 + 400 | 404 => ProviderFault::Invalid {407 + 503 => ProviderFault::Overloaded { message: body },408 + _ => ProviderFault::Transient { message: body },412 + let mut decoder = make_decoder (endpoint.kind);413 + let mut reader = response;414 + let mut buffer = [0 u8 ; 16 * 1024 ];416 + if cancel.is_cancelled () {417 + return Err (SmithError::Cancelled);421 + .map_err (|e| transport_fault (& e.to_string ()))? ;425 + for event in decoder.push (& buffer[.. read])? {426 + if sender.send (Ok (event)).is_err () {431 + for event in decoder.finish ()? {432 + if sender.send (Ok (event)).is_err () {439 + fn transport_fault (message: &str ) -> SmithError {440 + SmithError::Provider {441 + fault: ProviderFault::Transient {442 + message: message.to_string (),448 + #[expect(clippy::unwrap_used, reason = "body builders assert on fixed requests" )]451 + use smith::id::ToolCallId;452 + use smith::message::{Message, Role};453 + use smith::stream::StreamEvent;454 + use smith::tool::ToolMetadata;456 + fn endpoint (kind: ProviderKind, model: &str ) -> VendorEndpoint {459 + base_url: "https://example.test" .to_string (),460 + model: model.to_string (),461 + api_key: "k" .to_string (),466 + fn openai_body_carries_messages_tools_and_usage_flag () {467 + let call_id = ToolCallId::new();468 + let mut assistant = Message::new(Role::Assistant);469 + assistant.add_block (ContentBlock::text("Writing." ));470 + assistant.add_block (ContentBlock::tool_use(472 + serde_json::json! ({"path" : "f" }),475 + let mut result = Message::new(Role::Tool);476 + result.add_block (ContentBlock::tool_result(call_id, true , "written" ));477 + let request = ProviderRequest::new(480 + Message::with_text(Role::System, "be brief" ),481 + Message::with_text(Role::User, "hi" ),486 + .with_tools (vec! [ToolMetadata::new("read" , "Read" )]);487 + let body = build_body (& endpoint (ProviderKind::OpenAiCompatible, "gpt" ), & request).unwrap ();488 + assert_eq! (body["model" ], "gpt" );489 + assert_eq! (body["stream" ], true );490 + assert_eq! (body["stream_options" ]["include_usage" ], true );491 + assert_eq! (body["messages" ][0 ]["role" ], "system" );492 + assert_eq! (body["messages" ][3 ]["role" ], "tool" );493 + assert! (body["messages" ][2 ]["tool_calls" ].is_array ());494 + assert_eq! (body["tools" ][0 ]["function" ]["name" ], "read" );498 + fn anthropic_body_hoists_system_and_pairs_tool_blocks () {499 + let call_id = ToolCallId::new();500 + let mut assistant = Message::new(Role::Assistant);501 + assistant.add_block (ContentBlock::tool_use(503 + serde_json::json! ({"path" : "f" }),506 + let mut result = Message::new(Role::Tool);507 + result.add_block (ContentBlock::tool_result(call_id, true , "ok" ));508 + let request = ProviderRequest::new(511 + Message::with_text(Role::System, "sys" ),512 + Message::with_text(Role::User, "hi" ),517 + let body = build_body (& endpoint (ProviderKind::Anthropic, "claude" ), & request).unwrap ();518 + assert_eq! (body["system" ], "sys" );519 + assert_eq! (body["messages" ].as_array ().map (Vec ::len), Some (3 ));520 + assert_eq! (body["messages" ][1 ]["content" ][0 ]["type" ], "tool_use" );521 + assert_eq! (body["messages" ][2 ]["content" ][0 ]["type" ], "tool_result" );525 + fn google_body_maps_roles_and_declares_functions () {526 + let request = ProviderRequest::new(529 + Message::with_text(Role::System, "sys" ),530 + Message::with_text(Role::User, "hi" ),533 + .with_tools (vec! [ToolMetadata::new("read" , "Read" )]);534 + let body = build_body (& endpoint (ProviderKind::Google, "gemini" ), & request).unwrap ();535 + assert_eq! (body["systemInstruction" ]["parts" ][0 ]["text" ], "sys" );536 + assert_eq! (body["contents" ][0 ]["role" ], "user" );537 + assert_eq! (body["tools" ][0 ]["functionDeclarations" ][0 ]["name" ], "read" );541 + fn urls_and_headers_match_vendor_conventions () {542 + let openai = endpoint (ProviderKind::OpenAiCompatible, "gpt" );543 + assert! (endpoint_url (& openai).ends_with ("/chat/completions" ));544 + let anthropic = endpoint (ProviderKind::Anthropic, "claude" );545 + assert! (endpoint_url (& anthropic).ends_with ("/v1/messages" ));546 + let google = endpoint (ProviderKind::Google, "gemini" );547 + assert! (endpoint_url (& google).contains ("alt=sse" ));548 + let headers = endpoint_headers (& anthropic);549 + assert! (headers.iter ().any (|(name, _)| name == "x-api-key" ));553 + fn stream_events_flow_through_the_shape_they_came_in () {556 + let mut decoder = make_decoder (ProviderKind::OpenAiCompatible);557 + let mut events = decoder558 + .push (b "data: {\"choices\":[{\"delta\":{\"content\":\"x\"}}]}\n\n" )560 + assert! (matches! (events.pop (), Some (StreamEvent::TextDelta { .. })));smith-cli/Cargo.toml Modified +2 / −0 text lines
12 12 [dependencies ][dependencies ]13 13 smith = { path = "../smith" }smith = { path = "../smith" }14 14 smith-harness = { path = "../smith-harness" }smith-harness = { path = "../smith-harness" }
15 + clap = { workspace = true }16 + serde_json = { workspace = true }smith-cli/src/main.rs Modified +150 / −1 text lines
2 2 #![warn(missing_docs)]#![warn(missing_docs)]11 + use smith::error::Result;12 + use smith_harness::rpc::{RpcState, handle_line};13 + use smith_harness::runtime::{RuntimeConfig, RuntimeProvider, build_agent};14 + use std::io::{BufRead, Write};17 + #[derive(Debug, Parser)]18 + #[command(name = "smith" , version, about)]20 + #[command(subcommand)]25 + #[derive(Debug, Parser)]39 + base_url: Option <String >,42 + model: Option <String >,48 + #[expect(clippy::print_stderr, reason = "the CLI reports failures on stderr" )]49 + fn main () -> std::process::ExitCode {50 + let cli = Cli::parse();51 + let result = match cli.command {58 + } => eval (& prompt, json, r# mock, base_url, model),59 + Command::Rpc => rpc (),62 + Ok (()) => std::process::ExitCode::SUCCESS ,64 + eprintln! ("smith: {err}" );65 + std::process::ExitCode::FAILURE 70 + fn provider (mock: bool , base_url: Option <String >, model: Option <String >) -> RuntimeProvider {72 + return RuntimeProvider::Mock(vec! [smith_harness::mock_text_reply(73 + "mock provider: no model configured" ,76 + let base = base_url.unwrap_or_else (|| "https://api.openai.com/v1" .to_string ());77 + let model = model.unwrap_or_else (|| "gpt-5.1" .to_string ());78 + RuntimeProvider::OpenAiCompatible {84 + #[expect(clippy::print_stdout, reason = "eval output is the command's product" )]89 + base_url: Option <String >,90 + model: Option <String >,92 + let dir = session_dir ()? ;93 + let config = RuntimeConfig {94 + provider: provider (mock, base_url, model),95 + workdir: dir.clone (),96 + session_path: dir.join ("eval.smh" ),98 + let mut agent = build_agent (& config)? ;99 + let outcome = agent.run_turn (prompt)? ;104 + "text" : outcome.text,105 + "reason" : format! ("{:?}" , outcome.reason),107 + "input_tokens" : outcome.cost.input_tokens,108 + "output_tokens" : outcome.cost.output_tokens,113 + println! ("{}" , outcome.text);118 + fn rpc () -> Result <()> {119 + let dir = session_dir ()? ;120 + let config = RuntimeConfig {121 + provider: RuntimeProvider::Mock(vec! [smith_harness::mock_text_reply(122 + "rpc mock provider ready" ,124 + workdir: dir.clone (),125 + session_path: dir.join ("rpc.smh" ),127 + let state = RpcState::new(build_agent (& config)? );128 + let stdin = std::io::stdin();129 + let mut stdout = std::io::stdout();130 + for line in stdin.lock ().lines () {131 + let line = line.map_err (|e| smith::error::SmithError::Session {132 + code: "RPC_STDIN" .to_string (),133 + message: e.to_string (),135 + for response in handle_line (& state, & line) {136 + stdout.write_all (response.as_bytes ()).map_err (|e| {137 + smith::error::SmithError::Session {138 + code: "RPC_STDOUT" .to_string (),139 + message: e.to_string (),147 + fn session_dir () -> Result <std::path::PathBuf> {148 + let config = smith::config::Config::default_valid();149 + let dir = std::path::PathBuf::from(config.session_dir).join ("run" );150 + std::fs::create_dir_all(& dir).map_err (|e| smith::error::SmithError::Session {151 + code: "RUNTIME_DIR" .to_string (),152 + message: e.to_string (),smith-harness/Cargo.toml Modified +3 / −0 text lines
12 12 smith-core = { path = "../smith-core" }smith-core = { path = "../smith-core" }13 13 smith-ai = { path = "../smith-ai" }smith-ai = { path = "../smith-ai" }14 14 smith-tui = { path = "../smith-tui" }smith-tui = { path = "../smith-tui" }
15 + futures = { workspace = true }16 + serde = { workspace = true }17 + serde_json = { workspace = true }smith-harness/src/lib.rs Modified +54 / −1 text lines
1 1 #![forbid(unsafe_code)]#![forbid(unsafe_code)]2 2 #![warn(missing_docs)]#![warn(missing_docs)]14 + pub use rpc::{RpcRequest, RpcResponse, RpcState, handle_line};15 + pub use runtime::{RuntimeConfig, RuntimeProvider, build_agent};17 + use smith::id::MessageId;18 + use smith::provider::{ProviderStream, StreamFn};19 + use smith::stream::StreamEvent;27 + script: Vec <Vec <StreamEvent>>,28 + ) -> (StreamFn, Arc<Mutex<Vec <smith::provider::ProviderRequest>>>) {29 + let seen: Arc<Mutex<Vec <smith::provider::ProviderRequest>>> = Arc::new(Mutex::new(Vec ::new()));30 + let script = Arc::new(Mutex::new(script));31 + let seen_stream = Arc::clone(& seen);32 + let stream: StreamFn = Arc::new(move | request, _cancel| {33 + if let Ok (mut guard) = seen_stream.lock () {36 + let index = seen_stream38 + .map_or (0 , |guard| guard.len ().saturating_sub (1 ));39 + let response = script42 + .and_then (|guard| guard.get (index).cloned ())43 + .unwrap_or_default ();44 + let stream: ProviderStream = Box ::pin(futures::stream::iter(response.into_iter ().map (Ok )));52 + pub fn mock_text_reply (text: &str ) -> Vec <StreamEvent> {54 + StreamEvent::text_delta(MessageId::new(), text),55 + StreamEvent::stop(smith::stream::StopReason::EndTurn, None ),smith-harness/src/rpc.rs Added new file mode 100644+268 / −0 text lines
7 + use smith::error::Result;8 + use smith_core::agent::{Agent, AgentEvent};14 + agent: Arc<Mutex<Agent>>,20 + pub fn new (agent: Agent) -> Self {22 + agent: Arc::new(Mutex::new(agent)),28 + #[derive(Clone, Debug, PartialEq, Eq)]29 + pub struct RpcRequest {31 + pub id: serde_json::Value,35 + pub params: serde_json::Value,39 + #[derive(Clone, Debug, PartialEq, Eq)]40 + pub struct RpcResponse {42 + pub id: serde_json::Value,44 + pub record: serde_json::Value,53 + pub fn to_line (& self) -> Result <String > {54 + let mut value = serde_json::json! ({"id" : self.id});55 + merge (&mut value, & self.record);57 + serde_json::to_string(& value).map_err (|e| smith::error::SmithError::Session {58 + code: "RPC_ENCODE" .to_string (),59 + message: e.to_string (),66 + fn merge (target: &mut serde_json::Value, patch: & serde_json::Value) {67 + if let (Some (target), Some (patch)) = (target.as_object_mut (), patch.as_object ()) {68 + for (key, value) in patch {69 + target.insert (key.clone (), value.clone ());79 + #[allow(clippy::print_stdout)]80 + pub fn handle_line (state: & RpcState, line: &str ) -> Vec <String > {81 + let trimmed = line.trim ();82 + if trimmed.is_empty () {85 + let parsed: serde_json::Value = match serde_json::from_str(trimmed) {88 + let response = RpcResponse {89 + id: serde_json::Value::Null,90 + record: serde_json::json! ({91 + "error" : {"code" : "PARSE" , "message" : err.to_string ()},94 + return line_or_empty (& response);97 + let request = RpcRequest {98 + id: parsed.get ("id" ).cloned ().unwrap_or (serde_json::Value::Null),101 + .and_then (serde_json::Value::as_str)102 + .unwrap_or_default ()107 + .unwrap_or (serde_json::json! ({})),109 + dispatch (state, request)111 + .filter_map (|response| line_or_empty (& response).into_iter ().next ())115 + fn line_or_empty (response: & RpcResponse) -> Vec <String > {118 + .map (|line| vec! [line])119 + .unwrap_or_default ()122 + fn dispatch (state: & RpcState, request: RpcRequest) -> Vec <RpcResponse> {123 + match request.method.as_str () {124 + "ping" => vec! [result (& request, serde_json::json! ({"pong" : true }))],125 + "prompt" => run_prompt (state, & request),127 + if let Ok (agent) = state.agent.lock () {128 + agent.cancel_handle ().cancel ();130 + vec! [result (& request, serde_json::json! ({"aborting" : true }))]132 + "status" => vec! [result (& request, serde_json::json! ({"settled" : true }))],133 + other => vec! [RpcResponse {135 + record: serde_json::json! ({136 + "error" : {"code" : "METHOD_UNKNOWN" , "message" : format! ("unknown method {other}" )},142 + fn run_prompt (state: & RpcState, request: & RpcRequest) -> Vec <RpcResponse> {146 + .and_then (serde_json::Value::as_str)147 + .unwrap_or_default ()149 + let mut responses = vec! [result (request, serde_json::json! ({"event" : "start" }))];150 + let Ok (mut agent) = state.agent.lock () else {151 + return vec! [error (request, "STATE" , "agent state unavailable" )];155 + match agent.run_turn (& input) {157 + for event in & outcome.events {158 + if let AgentEvent::Streamed {159 + event: smith::stream::StreamEvent::TextDelta { delta, .. },162 + responses.push (result (164 + serde_json::json! ({"event" : "delta" , "text" : delta}),168 + responses.push (result (172 + "text" : outcome.text,173 + "reason" : format! ("{:?}" , outcome.reason),175 + "input_tokens" : outcome.cost.input_tokens,176 + "output_tokens" : outcome.cost.output_tokens,182 + responses.push (error (request, "TURN_FAILED" , & err.to_string ()));188 + fn result (request: & RpcRequest, record: serde_json::Value) -> RpcResponse {190 + id: request.id.clone (),195 + fn error (request: & RpcRequest, code: &str , message: &str ) -> RpcResponse {197 + id: request.id.clone (),198 + record: serde_json::json! ({"error" : {"code" : code, "message" : message}}),203 + #[expect(clippy::unwrap_used, reason = "rpc tests assert on scripted lines" )]206 + use crate ::mock_text_reply;207 + use crate ::runtime::{RuntimeConfig, build_agent};208 + use smith_core::tools::ToolSession;210 + fn state () -> RpcState {211 + let dir = std::env::temp_dir().join (format! ("smith_rpc_{}" , std::process::id()));212 + let _ = std::fs::remove_dir_all(& dir);213 + std::fs::create_dir_all(& dir).unwrap ();214 + let config = RuntimeConfig::mock(dir, vec! [mock_text_reply ("hello world" )]);215 + RpcState::new(build_agent (& config).unwrap ())218 + fn lines (state: & RpcState, input: &str ) -> Vec <serde_json::Value> {219 + handle_line (state, input)221 + .map (|line| serde_json::from_str(line.trim ()).unwrap ())226 + fn ping_correlates_and_unknown_methods_error_with_the_same_id () {227 + let state = state ();228 + let pong = & lines (& state, r #"{"id": 7, "method": "ping"}"# )[0 ];229 + assert_eq! (pong["id" ], 7 );230 + assert_eq! (pong["pong" ], true );231 + let unknown = & lines (& state, r #"{"id": "abc", "method": "explode"}"# )[0 ];232 + assert_eq! (unknown["id" ], "abc" );233 + assert_eq! (unknown["error" ]["code" ], "METHOD_UNKNOWN" );234 + let malformed = & lines (& state, "not json" )[0 ];235 + assert_eq! (malformed["error" ]["code" ], "PARSE" );239 + fn prompt_streams_deltas_and_assembles_the_final_message () {240 + let state = state ();241 + let records = lines (243 + r #"{"id": 1, "method": "prompt", "params": {"input": "hi"}}"# ,245 + assert_eq! (records[0 ]["event" ], "start" );246 + assert_eq! (records[1 ]["event" ], "delta" );247 + assert_eq! (records[1 ]["text" ], "hello world" );248 + let end = records.last ().unwrap ();249 + assert_eq! (end["event" ], "end" );250 + assert_eq! (end["text" ], "hello world" );252 + let assembled: String = records254 + .filter (|record| record["event" ] == "delta" )255 + .filter_map (|record| record["text" ].as_str ().map (str ::to_string))257 + assert_eq! (assembled, end["text" ].as_str ().unwrap_or_default ());259 + assert! (records.iter ().all (|record| record["id" ] == 1 ));263 + fn blank_lines_are_ignored () {264 + let state = state ();265 + assert! (handle_line (& state, " " ).is_empty ());266 + let _ = ToolSession::new(std::env::temp_dir());smith-harness/src/runtime.rs Added new file mode 100644+195 / −0 text lines
7 + use smith::config::Config;8 + use smith::error::Result;9 + use smith::provider::StreamFn;10 + use smith_ai::auth::{AuthRegistry, Credential};11 + use smith_ai::models::ProviderKind;12 + use smith_ai::transport::{VendorEndpoint, transport};13 + use smith_core::agent::Agent;14 + use smith_core::store::open_session;15 + use smith_core::tools::ToolSession;16 + use std::path::{Path, PathBuf};19 + #[derive(Clone, Debug, PartialEq, Eq)]20 + pub enum RuntimeProvider {22 + Mock(Vec <Vec <smith::stream::StreamEvent>>),46 + impl RuntimeProvider {49 + pub fn model (& self) -> &str {51 + Self ::Mock(_ ) => "mock-smith" ,52 + Self ::OpenAiCompatible { model, .. }53 + | Self ::Anthropic { model, .. }54 + | Self ::Google { model, .. } => model,58 + const fn vendor_kind (& self) -> ProviderKind {60 + Self ::Mock(_ ) | Self ::OpenAiCompatible { .. } => ProviderKind::OpenAiCompatible,61 + Self ::Anthropic { .. } => ProviderKind::Anthropic,62 + Self ::Google { .. } => ProviderKind::Google,68 + #[derive(Clone, Debug)]69 + pub struct RuntimeConfig {71 + pub provider: RuntimeProvider,73 + pub workdir: PathBuf,75 + pub session_path: PathBuf,81 + pub fn mock (workdir: impl Into <PathBuf>, script: Vec <Vec <smith::stream::StreamEvent>>) -> Self {82 + let workdir = workdir.into ();83 + let session_path = workdir.join ("session.smh" );85 + provider: RuntimeProvider::Mock(script),93 + const KEY_VARIABLES : [(ProviderKind, &str ); 3 ] = [94 + (ProviderKind::OpenAiCompatible, "OPENAI_API_KEY" ),95 + (ProviderKind::Anthropic, "ANTHROPIC_API_KEY" ),96 + (ProviderKind::Google, "GEMINI_API_KEY" ),105 + pub fn build_agent (config: & RuntimeConfig) -> Result <Agent> {106 + let smith_config = Config::default_valid();107 + let opened = open_session (Path::new(& config.session_path), smith_config)? ;108 + let tools = ToolSession::with_session(config.workdir.clone (), opened.session, opened.writer);109 + let stream = resolve_stream (& config.provider)? ;113 + config.provider.model ().to_string (),117 + fn resolve_stream (provider: & RuntimeProvider) -> Result <StreamFn> {119 + RuntimeProvider::Mock(script) => {120 + let (stream, _seen) = crate ::mock_stream(script.clone ());123 + RuntimeProvider::OpenAiCompatible { base_url, model }124 + | RuntimeProvider::Anthropic { base_url, model }125 + | RuntimeProvider::Google { base_url, model } => {126 + let kind = provider.vendor_kind ();127 + let registry = AuthRegistry::new();128 + let variable = KEY_VARIABLES 130 + .find (|(candidate, _)| * candidate == kind)131 + .map (|(_, variable)| (* variable).to_string ())132 + .unwrap_or_default ();133 + registry.set (format! ("{kind:?}" ), Credential::from_env(variable));134 + let credential = registry.get (& format! ("{kind:?}" )).ok_or_else (|| {135 + smith::error::SmithError::Provider {136 + fault: smith::error::ProviderFault::Authentication {137 + message: format! ("no credential for {kind:?}" ),141 + let api_key = credential.secret ()? ;142 + Ok (transport (VendorEndpoint {144 + base_url: base_url.clone (),145 + model: model.clone (),154 + clippy::unwrap_used,155 + reason = "runtime tests assert on assembled agents" 159 + use crate ::mock_text_reply;162 + fn mock_runtime_completes_and_persists_a_turn () {163 + let dir = std::env::temp_dir().join (format! ("smith_harness_{}" , std::process::id()));164 + let _ = std::fs::remove_dir_all(& dir);165 + std::fs::create_dir_all(& dir).unwrap_or (());166 + let config = RuntimeConfig::mock(dir.join ("work" ), vec! [mock_text_reply ("assembled" )]);167 + let mut agent = build_agent (& config).unwrap ();168 + let outcome = agent.run_turn ("hello" ).unwrap ();169 + assert_eq! (outcome.text, "assembled" );171 + let _ = std::fs::remove_dir_all(& dir);175 + fn real_providers_fail_fast_without_credentials () {176 + let dir = std::env::temp_dir().join (format! ("smith_harness_auth_{}" , std::process::id()));177 + let _ = std::fs::remove_dir_all(& dir);178 + std::fs::create_dir_all(& dir).unwrap_or (());181 + let config = RuntimeConfig {182 + provider: RuntimeProvider::OpenAiCompatible {183 + base_url: "https://example.test/v1" .to_string (),184 + model: "gpt-5.1" .to_string (),186 + workdir: dir.clone (),187 + session_path: dir.join ("s.smh" ),189 + let Err (err) = build_agent (& config) else {190 + unreachable! ("no credential must fail assembly" );192 + assert_eq! (err.code (), "PROVIDER_AUTH" );193 + let _ = std::fs::remove_dir_all(& dir);