repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

ai(SMH-PLAN-AIAG0001): expose eval and JSON-RPC through one runtime

d3b4efc8ca33087abd428a7a6a10dc0c2ec688d0

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare 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)

+2560 / −12 text lines

Diff layout

Cargo.lock

Modified

+1322 / −10 text lines

1111 "memchr",
14[[package]]
15name = "anstream"
16version = "1.0.0"
17source = "registry+https://github.com/rust-lang/crates.io-index"
18checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
19dependencies = [
20 "anstyle",
21 "anstyle-parse",
22 "anstyle-query",
23 "anstyle-wincon",
24 "colorchoice",
25 "is_terminal_polyfill",
26 "utf8parse",
27]
29[[package]]
30name = "anstyle"
31version = "1.0.14"
32source = "registry+https://github.com/rust-lang/crates.io-index"
33checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
35[[package]]
36name = "anstyle-parse"
37version = "1.0.0"
38source = "registry+https://github.com/rust-lang/crates.io-index"
39checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
40dependencies = [
41 "utf8parse",
42]
44[[package]]
45name = "anstyle-query"
46version = "1.1.5"
47source = "registry+https://github.com/rust-lang/crates.io-index"
48checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
49dependencies = [
50 "windows-sys 0.61.2",
51]
53[[package]]
54name = "anstyle-wincon"
55version = "3.0.11"
56source = "registry+https://github.com/rust-lang/crates.io-index"
57checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
58dependencies = [
59 "anstyle",
60 "once_cell_polyfill",
61 "windows-sys 0.61.2",
62]
64[[package]]
65name = "atomic-waker"
66version = "1.1.2"
67source = "registry+https://github.com/rust-lang/crates.io-index"
68checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
70[[package]]
71name = "base64"
72version = "0.22.1"
73source = "registry+https://github.com/rust-lang/crates.io-index"
74checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
1476[[package]]
1577name = "bitflags"
1678version = "2.13.2"
3395source = "registry+https://github.com/rust-lang/crates.io-index"
3496checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
98[[package]]
99name = "bytes"
100version = "1.12.1"
101source = "registry+https://github.com/rust-lang/crates.io-index"
102checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
104[[package]]
105name = "cc"
106version = "1.4.5"
107source = "registry+https://github.com/rust-lang/crates.io-index"
108checksum = "005ec2760ca554fae18df7a11195552ec576cd665632a881bc011d5bb2fd4d80"
109dependencies = [
110 "find-msvc-tools",
111 "shlex",
112]
36114[[package]]
37115name = "cfg-if"
38116version = "1.0.4"
72150 "half",
153[[package]]
154name = "clap"
155version = "4.6.6"
156source = "registry+https://github.com/rust-lang/crates.io-index"
157checksum = "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca"
158dependencies = [
159 "clap_builder",
160 "clap_derive",
161]
163[[package]]
164name = "clap_builder"
165version = "4.6.6"
166source = "registry+https://github.com/rust-lang/crates.io-index"
167checksum = "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889"
168dependencies = [
169 "anstream",
170 "anstyle",
171 "clap_lex",
172 "strsim",
173]
175[[package]]
176name = "clap_derive"
177version = "4.6.4"
178source = "registry+https://github.com/rust-lang/crates.io-index"
179checksum = "d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061"
180dependencies = [
181 "heck",
182 "proc-macro2",
183 "quote",
184 "syn 3.0.5",
185]
187[[package]]
188name = "clap_lex"
189version = "1.1.0"
190source = "registry+https://github.com/rust-lang/crates.io-index"
191checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
193[[package]]
194name = "colorchoice"
195version = "1.0.5"
196source = "registry+https://github.com/rust-lang/crates.io-index"
197checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
199[[package]]
200name = "core-foundation"
201version = "0.9.4"
202source = "registry+https://github.com/rust-lang/crates.io-index"
203checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
204dependencies = [
205 "core-foundation-sys",
206 "libc",
207]
209[[package]]
210name = "core-foundation"
211version = "0.10.1"
212source = "registry+https://github.com/rust-lang/crates.io-index"
213checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
214dependencies = [
215 "core-foundation-sys",
216 "libc",
217]
219[[package]]
220name = "core-foundation-sys"
221version = "0.8.7"
222source = "registry+https://github.com/rust-lang/crates.io-index"
223checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
225[[package]]
226name = "core_detect"
227version = "1.0.0"
228source = "registry+https://github.com/rust-lang/crates.io-index"
229checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48"
75231[[package]]
76232name = "crossbeam-deque"
77233version = "0.8.8"
121277 "libc",
122278 "option-ext",
123279 "redox_users",
124 "windows-sys",
280 "windows-sys 0.48.0",
281]
283[[package]]
284name = "displaydoc"
285version = "0.2.7"
286source = "registry+https://github.com/rust-lang/crates.io-index"
287checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
288dependencies = [
289 "proc-macro2",
290 "quote",
291 "syn 3.0.5",
292]
294[[package]]
295name = "encoding_rs"
296version = "0.8.41"
297source = "registry+https://github.com/rust-lang/crates.io-index"
298checksum = "7b5ef0006ac9ab233c38522f5ae99cae3625151de8f706cacee1cba4b8e2832a"
299dependencies = [
300 "cfg-if",
301 "core_detect",
302 "multiversion",
303 "multiversion_no_op",
304 "rustversion",
305 "scopeguard",
306 "simdutf8",
127309[[package]]
130312source = "registry+https://github.com/rust-lang/crates.io-index"
131313checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
315[[package]]
316name = "errno"
317version = "0.3.14"
318source = "registry+https://github.com/rust-lang/crates.io-index"
319checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
320dependencies = [
321 "libc",
322 "windows-sys 0.61.2",
323]
325[[package]]
326name = "fastrand"
327version = "2.5.0"
328source = "registry+https://github.com/rust-lang/crates.io-index"
329checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
331[[package]]
332name = "find-msvc-tools"
333version = "0.1.12"
334source = "registry+https://github.com/rust-lang/crates.io-index"
335checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d"
337[[package]]
338name = "fnv"
339version = "1.0.7"
340source = "registry+https://github.com/rust-lang/crates.io-index"
341checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
343[[package]]
344name = "foreign-types"
345version = "0.3.2"
346source = "registry+https://github.com/rust-lang/crates.io-index"
347checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
348dependencies = [
349 "foreign-types-shared",
350]
352[[package]]
353name = "foreign-types-shared"
354version = "0.1.1"
355source = "registry+https://github.com/rust-lang/crates.io-index"
356checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
358[[package]]
359name = "form_urlencoded"
360version = "1.2.2"
361source = "registry+https://github.com/rust-lang/crates.io-index"
362checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
363dependencies = [
364 "percent-encoding",
365]
133367[[package]]
134368name = "fs2"
135369version = "0.4.3"
263497 "regex-syntax",
500[[package]]
501name = "h2"
502version = "0.4.19"
503source = "registry+https://github.com/rust-lang/crates.io-index"
504checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16"
505dependencies = [
506 "atomic-waker",
507 "bytes",
508 "fnv",
509 "futures-core",
510 "futures-sink",
511 "http",
512 "indexmap",
513 "slab",
514 "tokio",
515 "tokio-util",
516 "tracing",
517]
266519[[package]]
267520name = "half"
268521version = "2.7.1"
280533source = "registry+https://github.com/rust-lang/crates.io-index"
281534checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
536[[package]]
537name = "heck"
538version = "0.5.0"
539source = "registry+https://github.com/rust-lang/crates.io-index"
540checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
542[[package]]
543name = "http"
544version = "1.5.0"
545source = "registry+https://github.com/rust-lang/crates.io-index"
546checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
547dependencies = [
548 "bytes",
549 "itoa",
550]
552[[package]]
553name = "http-body"
554version = "1.1.0"
555source = "registry+https://github.com/rust-lang/crates.io-index"
556checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
557dependencies = [
558 "bytes",
559 "http",
560]
562[[package]]
563name = "http-body-util"
564version = "0.1.5"
565source = "registry+https://github.com/rust-lang/crates.io-index"
566checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c"
567dependencies = [
568 "bytes",
569 "futures-core",
570 "http",
571 "http-body",
572 "pin-project-lite",
573]
575[[package]]
576name = "httparse"
577version = "1.10.1"
578source = "registry+https://github.com/rust-lang/crates.io-index"
579checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
581[[package]]
582name = "hyper"
583version = "1.11.1"
584source = "registry+https://github.com/rust-lang/crates.io-index"
585checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43"
586dependencies = [
587 "atomic-waker",
588 "bytes",
589 "futures-channel",
590 "futures-core",
591 "h2",
592 "http",
593 "http-body",
594 "httparse",
595 "itoa",
596 "pin-project-lite",
597 "smallvec",
598 "tokio",
599 "want",
600]
602[[package]]
603name = "hyper-rustls"
604version = "0.27.9"
605source = "registry+https://github.com/rust-lang/crates.io-index"
606checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"
607dependencies = [
608 "http",
609 "hyper",
610 "hyper-util",
611 "rustls",
612 "tokio",
613 "tokio-rustls",
614 "tower-service",
615]
617[[package]]
618name = "hyper-tls"
619version = "0.6.0"
620source = "registry+https://github.com/rust-lang/crates.io-index"
621checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
622dependencies = [
623 "bytes",
624 "http-body-util",
625 "hyper",
626 "hyper-util",
627 "native-tls",
628 "tokio",
629 "tokio-native-tls",
630 "tower-service",
631]
633[[package]]
634name = "hyper-util"
635version = "0.1.20"
636source = "registry+https://github.com/rust-lang/crates.io-index"
637checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
638dependencies = [
639 "base64",
640 "bytes",
641 "futures-channel",
642 "futures-util",
643 "http",
644 "http-body",
645 "hyper",
646 "ipnet",
647 "libc",
648 "percent-encoding",
649 "pin-project-lite",
650 "socket2",
651 "system-configuration",
652 "tokio",
653 "tower-service",
654 "tracing",
655 "windows-registry",
656]
658[[package]]
659name = "icu_collections"
660version = "2.3.0"
661source = "registry+https://github.com/rust-lang/crates.io-index"
662checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513"
663dependencies = [
664 "displaydoc",
665 "potential_utf",
666 "utf8_iter",
667 "yoke",
668 "zerofrom",
669 "zerovec",
670]
672[[package]]
673name = "icu_locale_core"
674version = "2.3.0"
675source = "registry+https://github.com/rust-lang/crates.io-index"
676checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"
677dependencies = [
678 "displaydoc",
679 "litemap",
680 "tinystr",
681 "writeable",
682 "zerovec",
683]
685[[package]]
686name = "icu_normalizer"
687version = "2.3.0"
688source = "registry+https://github.com/rust-lang/crates.io-index"
689checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f"
690dependencies = [
691 "icu_collections",
692 "icu_normalizer_data",
693 "icu_properties",
694 "icu_provider",
695 "smallvec",
696 "zerovec",
697]
699[[package]]
700name = "icu_normalizer_data"
701version = "2.3.0"
702source = "registry+https://github.com/rust-lang/crates.io-index"
703checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0"
705[[package]]
706name = "icu_properties"
707version = "2.3.0"
708source = "registry+https://github.com/rust-lang/crates.io-index"
709checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148"
710dependencies = [
711 "displaydoc",
712 "icu_collections",
713 "icu_locale_core",
714 "icu_properties_data",
715 "icu_provider",
716 "zerotrie",
717 "zerovec",
718]
720[[package]]
721name = "icu_properties_data"
722version = "2.3.0"
723source = "registry+https://github.com/rust-lang/crates.io-index"
724checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa"
726[[package]]
727name = "icu_provider"
728version = "2.3.1"
729source = "registry+https://github.com/rust-lang/crates.io-index"
730checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73"
731dependencies = [
732 "displaydoc",
733 "icu_locale_core",
734 "writeable",
735 "yoke",
736 "zerofrom",
737 "zerotrie",
738 "zerovec",
739]
741[[package]]
742name = "idna"
743version = "1.1.0"
744source = "registry+https://github.com/rust-lang/crates.io-index"
745checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
746dependencies = [
747 "idna_adapter",
748 "smallvec",
749 "utf8_iter",
750]
752[[package]]
753name = "idna_adapter"
754version = "1.2.2"
755source = "registry+https://github.com/rust-lang/crates.io-index"
756checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
757dependencies = [
758 "icu_normalizer",
759 "icu_properties",
760]
283762[[package]]
284763name = "ignore"
285764version = "0.4.33"
306785 "hashbrown",
788[[package]]
789name = "ipnet"
790version = "2.12.2"
791source = "registry+https://github.com/rust-lang/crates.io-index"
792checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0"
794[[package]]
795name = "is_terminal_polyfill"
796version = "1.70.2"
797source = "registry+https://github.com/rust-lang/crates.io-index"
798checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
309800[[package]]
310801name = "itoa"
311802version = "1.0.18"
338829 "libc",
832[[package]]
833name = "linux-raw-sys"
834version = "0.12.1"
835source = "registry+https://github.com/rust-lang/crates.io-index"
836checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
838[[package]]
839name = "litemap"
840version = "0.8.3"
841source = "registry+https://github.com/rust-lang/crates.io-index"
842checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"
341844[[package]]
342845name = "log"
343846version = "0.4.34"
350853source = "registry+https://github.com/rust-lang/crates.io-index"
351854checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
856[[package]]
857name = "mime"
858version = "0.3.17"
859source = "registry+https://github.com/rust-lang/crates.io-index"
860checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
862[[package]]
863name = "mio"
864version = "1.2.3"
865source = "registry+https://github.com/rust-lang/crates.io-index"
866checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8"
867dependencies = [
868 "libc",
869 "wasi",
870 "windows-sys 0.61.2",
871]
873[[package]]
874name = "multiversion"
875version = "0.9.0"
876source = "registry+https://github.com/rust-lang/crates.io-index"
877checksum = "b4ca4bea16ffc3f443cf7d866912118196bfef4c6a1556ca00f9f9b00bb43f7c"
878dependencies = [
879 "multiversion-macros",
880]
882[[package]]
883name = "multiversion-macros"
884version = "0.9.0"
885source = "registry+https://github.com/rust-lang/crates.io-index"
886checksum = "0d416831a7317ef4b08bee00b69cbbb9c8763da7959a7026244d6266869f9c83"
887dependencies = [
888 "proc-macro2",
889 "quote",
890 "rustversion",
891 "syn 3.0.5",
892]
894[[package]]
895name = "multiversion_no_op"
896version = "1.0.0"
897source = "registry+https://github.com/rust-lang/crates.io-index"
898checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d"
900[[package]]
901name = "native-tls"
902version = "0.2.18"
903source = "registry+https://github.com/rust-lang/crates.io-index"
904checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2"
905dependencies = [
906 "libc",
907 "log",
908 "openssl",
909 "openssl-probe",
910 "openssl-sys",
911 "schannel",
912 "security-framework",
913 "security-framework-sys",
914 "tempfile",
915]
353917[[package]]
354918name = "nix"
355919version = "0.29.0"
368932source = "registry+https://github.com/rust-lang/crates.io-index"
369933checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
935[[package]]
936name = "once_cell_polyfill"
937version = "1.70.2"
938source = "registry+https://github.com/rust-lang/crates.io-index"
939checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
941[[package]]
942name = "openssl"
943version = "0.10.81"
944source = "registry+https://github.com/rust-lang/crates.io-index"
945checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45"
946dependencies = [
947 "bitflags",
948 "cfg-if",
949 "foreign-types",
950 "libc",
951 "openssl-macros",
952 "openssl-sys",
953]
955[[package]]
956name = "openssl-macros"
957version = "0.1.1"
958source = "registry+https://github.com/rust-lang/crates.io-index"
959checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
960dependencies = [
961 "proc-macro2",
962 "quote",
963 "syn 2.0.119",
964]
966[[package]]
967name = "openssl-probe"
968version = "0.2.1"
969source = "registry+https://github.com/rust-lang/crates.io-index"
970checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
972[[package]]
973name = "openssl-sys"
974version = "0.9.117"
975source = "registry+https://github.com/rust-lang/crates.io-index"
976checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695"
977dependencies = [
978 "cc",
979 "libc",
980 "pkg-config",
981 "vcpkg",
982]
371984[[package]]
372985name = "option-ext"
373986version = "0.2.0"
374987source = "registry+https://github.com/rust-lang/crates.io-index"
375988checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
990[[package]]
991name = "percent-encoding"
992version = "2.3.2"
993source = "registry+https://github.com/rust-lang/crates.io-index"
994checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
377996[[package]]
378997name = "pin-project-lite"
379998version = "0.2.17"
380999source = "registry+https://github.com/rust-lang/crates.io-index"
3811000checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
1002[[package]]
1003name = "pkg-config"
1004version = "0.3.34"
1005source = "registry+https://github.com/rust-lang/crates.io-index"
1006checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
1008[[package]]
1009name = "potential_utf"
1010version = "0.1.6"
1011source = "registry+https://github.com/rust-lang/crates.io-index"
1012checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661"
1013dependencies = [
1014 "zerovec",
3831017[[package]]
3841018name = "proc-macro2"
3851019version = "1.0.107"
4321066source = "registry+https://github.com/rust-lang/crates.io-index"
4331067checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
1069[[package]]
1070name = "reqwest"
1071version = "0.12.28"
1072source = "registry+https://github.com/rust-lang/crates.io-index"
1073checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
1074dependencies = [
1075 "base64",
1076 "bytes",
1077 "encoding_rs",
1078 "futures-channel",
1079 "futures-core",
1080 "futures-util",
1081 "h2",
1082 "http",
1083 "http-body",
1084 "http-body-util",
1085 "hyper",
1086 "hyper-rustls",
1087 "hyper-tls",
1088 "hyper-util",
1089 "js-sys",
1090 "log",
1091 "mime",
1092 "native-tls",
1093 "percent-encoding",
1094 "pin-project-lite",
1095 "rustls-pki-types",
1096 "serde",
1097 "serde_json",
1098 "serde_urlencoded",
1099 "sync_wrapper",
1100 "tokio",
1101 "tokio-native-tls",
1102 "tokio-util",
1103 "tower",
1104 "tower-http",
1105 "tower-service",
1106 "url",
1107 "wasm-bindgen",
1108 "wasm-bindgen-futures",
1109 "wasm-streams",
1110 "web-sys",
1113[[package]]
1114name = "ring"
1115version = "0.17.14"
1116source = "registry+https://github.com/rust-lang/crates.io-index"
1117checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
1118dependencies = [
1119 "cc",
1120 "cfg-if",
1121 "getrandom 0.2.17",
1122 "libc",
1123 "untrusted",
1124 "windows-sys 0.52.0",
1127[[package]]
1128name = "rustix"
1129version = "1.1.4"
1130source = "registry+https://github.com/rust-lang/crates.io-index"
1131checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
1132dependencies = [
1133 "bitflags",
1134 "errno",
1135 "libc",
1136 "linux-raw-sys",
1137 "windows-sys 0.61.2",
1140[[package]]
1141name = "rustls"
1142version = "0.23.44"
1143source = "registry+https://github.com/rust-lang/crates.io-index"
1144checksum = "6725596c3f2c3a0aef021139e145d4eafe314a6623e4680ca83852b2c67ab2ba"
1145dependencies = [
1146 "once_cell",
1147 "rustls-pki-types",
1148 "rustls-webpki",
1149 "subtle",
1150 "zeroize",
1153[[package]]
1154name = "rustls-pki-types"
1155version = "1.15.1"
1156source = "registry+https://github.com/rust-lang/crates.io-index"
1157checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
1158dependencies = [
1159 "zeroize",
1162[[package]]
1163name = "rustls-webpki"
1164version = "0.103.15"
1165source = "registry+https://github.com/rust-lang/crates.io-index"
1166checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
1167dependencies = [
1168 "ring",
1169 "rustls-pki-types",
1170 "untrusted",
4351173[[package]]
4361174name = "rustversion"
4371175version = "1.0.23"
4381176source = "registry+https://github.com/rust-lang/crates.io-index"
4391177checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
1179[[package]]
1180name = "ryu"
1181version = "1.0.23"
1182source = "registry+https://github.com/rust-lang/crates.io-index"
1183checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
4411185[[package]]
4421186name = "same-file"
4431187version = "1.0.6"
4471191 "winapi-util",
1194[[package]]
1195name = "schannel"
1196version = "0.1.29"
1197source = "registry+https://github.com/rust-lang/crates.io-index"
1198checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
1199dependencies = [
1200 "windows-sys 0.61.2",
1203[[package]]
1204name = "scopeguard"
1205version = "1.2.0"
1206source = "registry+https://github.com/rust-lang/crates.io-index"
1207checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
1209[[package]]
1210name = "security-framework"
1211version = "3.7.0"
1212source = "registry+https://github.com/rust-lang/crates.io-index"
1213checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
1214dependencies = [
1215 "bitflags",
1216 "core-foundation 0.10.1",
1217 "core-foundation-sys",
1218 "libc",
1219 "security-framework-sys",
1222[[package]]
1223name = "security-framework-sys"
1224version = "2.17.0"
1225source = "registry+https://github.com/rust-lang/crates.io-index"
1226checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
1227dependencies = [
1228 "core-foundation-sys",
1229 "libc",
4501232[[package]]
4511233name = "serde"
4521234version = "1.0.229"
4911273 "zmij",
1276[[package]]
1277name = "serde_urlencoded"
1278version = "0.7.1"
1279source = "registry+https://github.com/rust-lang/crates.io-index"
1280checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
1281dependencies = [
1282 "form_urlencoded",
1283 "itoa",
1284 "ryu",
1285 "serde",
1288[[package]]
1289name = "shlex"
1290version = "2.0.1"
1291source = "registry+https://github.com/rust-lang/crates.io-index"
1292checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
1294[[package]]
1295name = "simdutf8"
1296version = "0.1.5"
1297source = "registry+https://github.com/rust-lang/crates.io-index"
1298checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
4941300[[package]]
4951301name = "slab"
4961302version = "0.4.12"
4971303source = "registry+https://github.com/rust-lang/crates.io-index"
4981304checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
1306[[package]]
1307name = "smallvec"
1308version = "1.16.0"
1309source = "registry+https://github.com/rust-lang/crates.io-index"
1310checksum = "b9be42f50aa861c555654aa3a37f52f4b1074bacf4e48fe0ef7fa584e80f1f0f"
5001312[[package]]
5011313name = "smith"
5021314version = "0.1.0"
5141326version = "0.1.0"
5151327dependencies = [
5161328 "futures",
1329 "reqwest",
5171330 "serde",
5181331 "serde_json",
5191332 "smith",
5231336name = "smith-cli"
5241337version = "0.1.0"
5251338dependencies = [
1339 "clap",
1340 "serde_json",
5261341 "smith",
5271342 "smith-harness",
5461361name = "smith-harness"
5471362version = "0.1.0"
5481363dependencies = [
1364 "futures",
1365 "serde",
1366 "serde_json",
5491367 "smith",
5501368 "smith-ai",
5511369 "smith-core",
5591377 "smith",
1380[[package]]
1381name = "socket2"
1382version = "0.6.5"
1383source = "registry+https://github.com/rust-lang/crates.io-index"
1384checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
1385dependencies = [
1386 "libc",
1387 "windows-sys 0.61.2",
1390[[package]]
1391name = "stable_deref_trait"
1392version = "1.2.1"
1393source = "registry+https://github.com/rust-lang/crates.io-index"
1394checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
1396[[package]]
1397name = "strsim"
1398version = "0.11.1"
1399source = "registry+https://github.com/rust-lang/crates.io-index"
1400checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
1402[[package]]
1403name = "subtle"
1404version = "2.6.1"
1405source = "registry+https://github.com/rust-lang/crates.io-index"
1406checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
5621408[[package]]
5631409name = "syn"
5641410version = "2.0.119"
5811427 "unicode-ident",
1430[[package]]
1431name = "sync_wrapper"
1432version = "1.0.2"
1433source = "registry+https://github.com/rust-lang/crates.io-index"
1434checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
1435dependencies = [
1436 "futures-core",
1439[[package]]
1440name = "synstructure"
1441version = "0.13.2"
1442source = "registry+https://github.com/rust-lang/crates.io-index"
1443checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
1444dependencies = [
1445 "proc-macro2",
1446 "quote",
1447 "syn 2.0.119",
1450[[package]]
1451name = "system-configuration"
1452version = "0.7.0"
1453source = "registry+https://github.com/rust-lang/crates.io-index"
1454checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
1455dependencies = [
1456 "bitflags",
1457 "core-foundation 0.9.4",
1458 "system-configuration-sys",
1461[[package]]
1462name = "system-configuration-sys"
1463version = "0.6.0"
1464source = "registry+https://github.com/rust-lang/crates.io-index"
1465checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
1466dependencies = [
1467 "core-foundation-sys",
1468 "libc",
1471[[package]]
1472name = "tempfile"
1473version = "3.27.0"
1474source = "registry+https://github.com/rust-lang/crates.io-index"
1475checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
1476dependencies = [
1477 "fastrand",
1478 "getrandom 0.4.3",
1479 "once_cell",
1480 "rustix",
1481 "windows-sys 0.61.2",
5841484[[package]]
5851485name = "thiserror"
5861486version = "1.0.69"
6011501 "syn 2.0.119",
1504[[package]]
1505name = "tinystr"
1506version = "0.8.4"
1507source = "registry+https://github.com/rust-lang/crates.io-index"
1508checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"
1509dependencies = [
1510 "displaydoc",
1511 "zerovec",
1514[[package]]
1515name = "tokio"
1516version = "1.53.1"
1517source = "registry+https://github.com/rust-lang/crates.io-index"
1518checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
1519dependencies = [
1520 "bytes",
1521 "libc",
1522 "mio",
1523 "pin-project-lite",
1524 "socket2",
1525 "windows-sys 0.61.2",
1528[[package]]
1529name = "tokio-native-tls"
1530version = "0.3.1"
1531source = "registry+https://github.com/rust-lang/crates.io-index"
1532checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
1533dependencies = [
1534 "native-tls",
1535 "tokio",
1538[[package]]
1539name = "tokio-rustls"
1540version = "0.26.5"
1541source = "registry+https://github.com/rust-lang/crates.io-index"
1542checksum = "b0c85f2c3ef0b1cd58b36682f4b17aaa995f0e5db534d85692b4903abce21f67"
1543dependencies = [
1544 "rustls",
1545 "tokio",
1548[[package]]
1549name = "tokio-util"
1550version = "0.7.19"
1551source = "registry+https://github.com/rust-lang/crates.io-index"
1552checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"
1553dependencies = [
1554 "bytes",
1555 "futures-core",
1556 "futures-sink",
1557 "libc",
1558 "pin-project-lite",
1559 "tokio",
1562[[package]]
1563name = "tower"
1564version = "0.5.3"
1565source = "registry+https://github.com/rust-lang/crates.io-index"
1566checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
1567dependencies = [
1568 "futures-core",
1569 "futures-util",
1570 "pin-project-lite",
1571 "sync_wrapper",
1572 "tokio",
1573 "tower-layer",
1574 "tower-service",
1577[[package]]
1578name = "tower-http"
1579version = "0.6.11"
1580source = "registry+https://github.com/rust-lang/crates.io-index"
1581checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
1582dependencies = [
1583 "bitflags",
1584 "bytes",
1585 "futures-util",
1586 "http",
1587 "http-body",
1588 "pin-project-lite",
1589 "tower",
1590 "tower-layer",
1591 "tower-service",
1592 "url",
1595[[package]]
1596name = "tower-layer"
1597version = "0.3.3"
1598source = "registry+https://github.com/rust-lang/crates.io-index"
1599checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
1601[[package]]
1602name = "tower-service"
1603version = "0.3.3"
1604source = "registry+https://github.com/rust-lang/crates.io-index"
1605checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
1607[[package]]
1608name = "tracing"
1609version = "0.1.44"
1610source = "registry+https://github.com/rust-lang/crates.io-index"
1611checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
1612dependencies = [
1613 "pin-project-lite",
1614 "tracing-core",
1617[[package]]
1618name = "tracing-core"
1619version = "0.1.36"
1620source = "registry+https://github.com/rust-lang/crates.io-index"
1621checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
1622dependencies = [
1623 "once_cell",
1626[[package]]
1627name = "try-lock"
1628version = "0.2.5"
1629source = "registry+https://github.com/rust-lang/crates.io-index"
1630checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
6041632[[package]]
6051633name = "unicode-ident"
6061634version = "1.0.24"
6071635source = "registry+https://github.com/rust-lang/crates.io-index"
6081636checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
1638[[package]]
1639name = "untrusted"
1640version = "0.9.0"
1641source = "registry+https://github.com/rust-lang/crates.io-index"
1642checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
1644[[package]]
1645name = "url"
1646version = "2.5.8"
1647source = "registry+https://github.com/rust-lang/crates.io-index"
1648checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
1649dependencies = [
1650 "form_urlencoded",
1651 "idna",
1652 "percent-encoding",
1653 "serde",
1656[[package]]
1657name = "utf8_iter"
1658version = "1.0.4"
1659source = "registry+https://github.com/rust-lang/crates.io-index"
1660checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
1662[[package]]
1663name = "utf8parse"
1664version = "0.2.2"
1665source = "registry+https://github.com/rust-lang/crates.io-index"
1666checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
6101668[[package]]
6111669name = "uuid"
6121670version = "1.26.1"
6191677 "wasm-bindgen",
1680[[package]]
1681name = "vcpkg"
1682version = "0.2.15"
1683source = "registry+https://github.com/rust-lang/crates.io-index"
1684checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
6221686[[package]]
6231687name = "walkdir"
6241688version = "2.5.0"
6291693 "winapi-util",
1696[[package]]
1697name = "want"
1698version = "0.3.1"
1699source = "registry+https://github.com/rust-lang/crates.io-index"
1700checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
1701dependencies = [
1702 "try-lock",
6321705[[package]]
6331706name = "wasi"
6341707version = "0.11.1+wasi-snapshot-preview1"
6481721 "wasm-bindgen-shared",
1724[[package]]
1725name = "wasm-bindgen-futures"
1726version = "0.4.78"
1727source = "registry+https://github.com/rust-lang/crates.io-index"
1728checksum = "6ef4c5d3d2cdf5c54f4231181768f5510842e350db025faf1f7163b1030ed928"
1729dependencies = [
1730 "js-sys",
1731 "wasm-bindgen",
6511734[[package]]
6521735name = "wasm-bindgen-macro"
6531736version = "0.2.128"
6801763 "unicode-ident",
1766[[package]]
1767name = "wasm-streams"
1768version = "0.4.2"
1769source = "registry+https://github.com/rust-lang/crates.io-index"
1770checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65"
1771dependencies = [
1772 "futures-util",
1773 "js-sys",
1774 "wasm-bindgen",
1775 "wasm-bindgen-futures",
1776 "web-sys",
1779[[package]]
1780name = "web-sys"
1781version = "0.3.105"
1782source = "registry+https://github.com/rust-lang/crates.io-index"
1783checksum = "9fbddc4a036f00ec4f18c83445bd3115cb306a91da554919a099d9222fe4a7f8"
1784dependencies = [
1785 "js-sys",
1786 "wasm-bindgen",
6831789[[package]]
6841790name = "winapi"
6851791version = "0.3.9"
7021808source = "registry+https://github.com/rust-lang/crates.io-index"
7031809checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
7041810dependencies = [
705 "windows-sys",
1811 "windows-sys 0.61.2",
7081814[[package]]
7111817source = "registry+https://github.com/rust-lang/crates.io-index"
7121818checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1820[[package]]
1821name = "windows-link"
1822version = "0.2.1"
1823source = "registry+https://github.com/rust-lang/crates.io-index"
1824checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
1826[[package]]
1827name = "windows-registry"
1828version = "0.6.1"
1829source = "registry+https://github.com/rust-lang/crates.io-index"
1830checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
1831dependencies = [
1832 "windows-link",
1833 "windows-result",
1834 "windows-strings",
1837[[package]]
1838name = "windows-result"
1839version = "0.4.1"
1840source = "registry+https://github.com/rust-lang/crates.io-index"
1841checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
1842dependencies = [
1843 "windows-link",
1846[[package]]
1847name = "windows-strings"
1848version = "0.5.1"
1849source = "registry+https://github.com/rust-lang/crates.io-index"
1850checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
1851dependencies = [
1852 "windows-link",
7141855[[package]]
7151856name = "windows-sys"
7161857version = "0.48.0"
7171858source = "registry+https://github.com/rust-lang/crates.io-index"
7181859checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
7191860dependencies = [
720 "windows-targets",
1861 "windows-targets 0.48.5",
1864[[package]]
1865name = "windows-sys"
1866version = "0.52.0"
1867source = "registry+https://github.com/rust-lang/crates.io-index"
1868checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
1869dependencies = [
1870 "windows-targets 0.52.6",
1873[[package]]
1874name = "windows-sys"
1875version = "0.61.2"
1876source = "registry+https://github.com/rust-lang/crates.io-index"
1877checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
1878dependencies = [
1879 "windows-link",
7231882[[package]]
7261885source = "registry+https://github.com/rust-lang/crates.io-index"
7271886checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
7281887dependencies = [
729 "windows_aarch64_gnullvm",
730 "windows_aarch64_msvc",
731 "windows_i686_gnu",
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",
1897[[package]]
1898name = "windows-targets"
1899version = "0.52.6"
1900source = "registry+https://github.com/rust-lang/crates.io-index"
1901checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
1902dependencies = [
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",
7381913[[package]]
7411916source = "registry+https://github.com/rust-lang/crates.io-index"
7421917checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
1919[[package]]
1920name = "windows_aarch64_gnullvm"
1921version = "0.52.6"
1922source = "registry+https://github.com/rust-lang/crates.io-index"
1923checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
7441925[[package]]
7451926name = "windows_aarch64_msvc"
7461927version = "0.48.5"
7471928source = "registry+https://github.com/rust-lang/crates.io-index"
7481929checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
1931[[package]]
1932name = "windows_aarch64_msvc"
1933version = "0.52.6"
1934source = "registry+https://github.com/rust-lang/crates.io-index"
1935checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
7501937[[package]]
7511938name = "windows_i686_gnu"
7521939version = "0.48.5"
7531940source = "registry+https://github.com/rust-lang/crates.io-index"
7541941checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
1943[[package]]
1944name = "windows_i686_gnu"
1945version = "0.52.6"
1946source = "registry+https://github.com/rust-lang/crates.io-index"
1947checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
1949[[package]]
1950name = "windows_i686_gnullvm"
1951version = "0.52.6"
1952source = "registry+https://github.com/rust-lang/crates.io-index"
1953checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
7561955[[package]]
7571956name = "windows_i686_msvc"
7581957version = "0.48.5"
7591958source = "registry+https://github.com/rust-lang/crates.io-index"
7601959checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
1961[[package]]
1962name = "windows_i686_msvc"
1963version = "0.52.6"
1964source = "registry+https://github.com/rust-lang/crates.io-index"
1965checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
7621967[[package]]
7631968name = "windows_x86_64_gnu"
7641969version = "0.48.5"
7651970source = "registry+https://github.com/rust-lang/crates.io-index"
7661971checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
1973[[package]]
1974name = "windows_x86_64_gnu"
1975version = "0.52.6"
1976source = "registry+https://github.com/rust-lang/crates.io-index"
1977checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
7681979[[package]]
7691980name = "windows_x86_64_gnullvm"
7701981version = "0.48.5"
7711982source = "registry+https://github.com/rust-lang/crates.io-index"
7721983checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
1985[[package]]
1986name = "windows_x86_64_gnullvm"
1987version = "0.52.6"
1988source = "registry+https://github.com/rust-lang/crates.io-index"
1989checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
7741991[[package]]
7751992name = "windows_x86_64_msvc"
7761993version = "0.48.5"
7771994source = "registry+https://github.com/rust-lang/crates.io-index"
7781995checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
1997[[package]]
1998name = "windows_x86_64_msvc"
1999version = "0.52.6"
2000source = "registry+https://github.com/rust-lang/crates.io-index"
2001checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
2003[[package]]
2004name = "writeable"
2005version = "0.6.4"
2006source = "registry+https://github.com/rust-lang/crates.io-index"
2007checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
7802009[[package]]
7812010name = "xtask"
7822011version = "0.1.0"
2013[[package]]
2014name = "yoke"
2015version = "0.8.3"
2016source = "registry+https://github.com/rust-lang/crates.io-index"
2017checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
2018dependencies = [
2019 "stable_deref_trait",
2020 "yoke-derive",
2021 "zerofrom",
2024[[package]]
2025name = "yoke-derive"
2026version = "0.8.2"
2027source = "registry+https://github.com/rust-lang/crates.io-index"
2028checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
2029dependencies = [
2030 "proc-macro2",
2031 "quote",
2032 "syn 2.0.119",
2033 "synstructure",
7842036[[package]]
7852037name = "zerocopy"
7862038version = "0.8.57"
8012053 "syn 2.0.119",
2056[[package]]
2057name = "zerofrom"
2058version = "0.1.8"
2059source = "registry+https://github.com/rust-lang/crates.io-index"
2060checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
2061dependencies = [
2062 "zerofrom-derive",
2065[[package]]
2066name = "zerofrom-derive"
2067version = "0.1.7"
2068source = "registry+https://github.com/rust-lang/crates.io-index"
2069checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
2070dependencies = [
2071 "proc-macro2",
2072 "quote",
2073 "syn 2.0.119",
2074 "synstructure",
2077[[package]]
2078name = "zeroize"
2079version = "1.9.0"
2080source = "registry+https://github.com/rust-lang/crates.io-index"
2081checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
2083[[package]]
2084name = "zerotrie"
2085version = "0.2.5"
2086source = "registry+https://github.com/rust-lang/crates.io-index"
2087checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"
2088dependencies = [
2089 "displaydoc",
2090 "yoke",
2091 "zerofrom",
2094[[package]]
2095name = "zerovec"
2096version = "0.11.8"
2097source = "registry+https://github.com/rust-lang/crates.io-index"
2098checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"
2099dependencies = [
2100 "yoke",
2101 "zerofrom",
2102 "zerovec-derive",
2105[[package]]
2106name = "zerovec-derive"
2107version = "0.11.6"
2108source = "registry+https://github.com/rust-lang/crates.io-index"
2109checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"
2110dependencies = [
2111 "proc-macro2",
2112 "quote",
2113 "syn 3.0.5",
8042116[[package]]
8052117name = "zmij"
8062118version = "1.0.23"

smith-ai/Cargo.toml

Modified

+1 / −0 text lines

1010[dependencies]
1111smith = { path = "../smith" }
1212futures = { workspace = true }
13reqwest = { workspace = true, features = ["blocking", "json"] }
1314serde = { workspace = true }
1415serde_json = { workspace = true }

smith-ai/src/lib.rs

Modified

+3 / −0 text lines

2323pub mod openai;
2424/// Cancellable, generation-checked catalog refresh.
2525pub mod refresh;
26/// Vendor HTTP transport.
27pub mod transport;
2729pub use anthropic::AnthropicDecoder;
2830pub use auth::{AuthRegistry, Credential, CredentialSource};
3234pub use mux::{Endpoint, Router};
3335pub use openai::OpenAiDecoder;
3436pub use refresh::{CatalogSnapshot, CatalogState, RefreshOutcome, refresh};
37pub use transport::{VendorEndpoint, build_body, endpoint_headers, endpoint_url, transport};

smith-ai/src/transport.rs

Added
new file mode 100644

+562 / −0 text lines

1//! Vendor HTTP transport: request bodies, posting, and SSE decoding.
2//!
3//! Body builders are pure functions over [`ProviderRequest`] so their vendor
4//! shapes are unit-tested without network. The transport posts and feeds the
5//! matching vendor decoder on a dedicated thread, surfacing normalized
6//! events through a channel-backed stream.
7
8use crate::anthropic::AnthropicDecoder;
9use crate::conformance::StreamDecoder;
10use crate::gemini::GeminiDecoder;
11use crate::models::ProviderKind;
12use crate::openai::OpenAiDecoder;
13use futures::StreamExt;
14use smith::error::{ProviderFault, Result, SmithError};
15use smith::message::{ContentBlock, Role};
16use smith::provider::{ProviderRequest, StreamFn};
17use smith::tool::CancelHandle;
18use std::io::Read;
19use std::sync::Arc;
21/// Vendor endpoint description for one model.
22#[derive(Clone, Debug, PartialEq, Eq)]
23pub struct VendorEndpoint {
24 /// Adapter family.
25 pub kind: ProviderKind,
26 /// Base URL without trailing slash.
27 pub base_url: String,
28 /// Model id for the request body.
29 pub model: String,
30 /// Bearer or key credential value.
31 pub api_key: String,
32}
34/// Build the vendor request body for one provider request.
35///
36/// # Errors
37///
38/// Returns a provider protocol fault when the conversation contains content
39/// the vendor body cannot represent.
40pub fn build_body(
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)),
48 }
49}
51fn openai_body(endpoint: &VendorEndpoint, request: &ProviderRequest) -> serde_json::Value {
52 let mut messages = Vec::new();
53 for message in &request.messages {
54 match message.role {
55 Role::System => messages.push(serde_json::json!({
56 "role": "system",
57 "content": flatten_text(message),
58 })),
59 Role::User => messages.push(serde_json::json!({
60 "role": "user",
61 "content": flatten_text(message),
62 })),
63 Role::Assistant => messages.push(serde_json::json!({
64 "role": "assistant",
65 "content": flatten_text(message),
66 })),
67 Role::Tool => {
68 // Each tool result block becomes its own tool message.
69 for block in &message.blocks {
70 if let ContentBlock::ToolResult {
71 call_id, output, ..
72 } = block
73 {
74 messages.push(serde_json::json!({
75 "role": "tool",
76 "tool_call_id": call_id.to_string(),
77 "content": output,
78 }));
79 }
80 }
81 }
82 }
83 }
84 // OpenAI expects assistant tool calls on the assistant message; the
85 // normalized conversation records them as blocks, mapped here.
86 append_assistant_tool_calls(&request.messages, &mut messages);
87 let mut body = serde_json::json!({
88 "model": endpoint.model,
89 "messages": messages,
90 "stream": true,
91 "stream_options": {"include_usage": true},
92 });
93 if !request.tools.is_empty() {
94 body["tools"] = serde_json::json!(
95 request
96 .tools
97 .iter()
98 .map(|tool| serde_json::json!({
99 "type": "function",
100 "function": {
101 "name": tool.name,
102 "description": tool.description,
103 "parameters": tool.input_schema,
104 }
105 }))
106 .collect::<Vec<_>>()
107 );
108 }
109 if let Some(max) = request.params.max_output_tokens {
110 body["max_tokens"] = serde_json::json!(max);
111 }
112 body
113}
115fn append_assistant_tool_calls(
116 messages: &[smith::message::Message],
117 out: &mut [serde_json::Value],
118) {
119 for message in messages {
120 if message.role != Role::Assistant {
121 continue;
122 }
123 let calls: Vec<serde_json::Value> = message
124 .blocks
125 .iter()
126 .filter_map(|block| {
127 if let ContentBlock::ToolUse {
128 name,
129 input,
130 call_id,
131 ..
132 } = block
133 {
134 Some(serde_json::json!({
135 "id": call_id.to_string(),
136 "type": "function",
137 "function": {"name": name, "arguments": input.to_string()},
138 }))
139 } else {
140 None
141 }
142 })
143 .collect();
144 if calls.is_empty() {
145 continue;
146 }
147 if let Some(last) = out.iter_mut().rev().find(|entry| {
148 entry.get("role").and_then(serde_json::Value::as_str) == Some("assistant")
149 }) {
150 last["tool_calls"] = serde_json::json!(calls);
151 }
152 }
153}
155fn 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 {
160 Role::System => {
161 if !system.is_empty() {
162 system.push('\n');
163 }
164 system.push_str(&flatten_text(message));
165 }
166 Role::User => messages.push(serde_json::json!({
167 "role": "user",
168 "content": [{"type": "text", "text": flatten_text(message)}],
169 })),
170 Role::Assistant => {
171 let mut content = Vec::new();
172 for block in &message.blocks {
173 match block {
174 ContentBlock::Text(text) => content.push(serde_json::json!({
175 "type": "text", "text": text,
176 })),
177 ContentBlock::ToolUse {
178 name,
179 input,
180 call_id,
181 ..
182 } => content.push(serde_json::json!({
183 "type": "tool_use",
184 "id": call_id.to_string(),
185 "name": name,
186 "input": input,
187 })),
188 _ => {}
189 }
190 }
191 messages.push(serde_json::json!({"role": "assistant", "content": content}));
192 }
193 Role::Tool => {
194 let mut content = Vec::new();
195 for block in &message.blocks {
196 if let ContentBlock::ToolResult {
197 call_id, output, ..
198 } = block
199 {
200 content.push(serde_json::json!({
201 "type": "tool_result",
202 "tool_use_id": call_id.to_string(),
203 "content": output,
204 }));
205 }
206 }
207 messages.push(serde_json::json!({"role": "user", "content": content}));
208 }
209 }
210 }
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,
215 "stream": true,
216 });
217 if !system.is_empty() {
218 body["system"] = serde_json::json!(system);
219 }
220 if !request.tools.is_empty() {
221 body["tools"] = serde_json::json!(
222 request
223 .tools
224 .iter()
225 .map(|tool| serde_json::json!({
226 "name": tool.name,
227 "description": tool.description,
228 "input_schema": tool.input_schema,
229 }))
230 .collect::<Vec<_>>()
231 );
232 }
233 body
234}
236fn google_body(_endpoint: &VendorEndpoint, request: &ProviderRequest) -> serde_json::Value {
237 let system: Vec<String> = request
238 .messages
239 .iter()
240 .filter(|message| message.role == Role::System)
241 .map(flatten_text)
242 .collect();
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,
249 };
250 let mut parts = Vec::new();
251 for block in &message.blocks {
252 match block {
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},
256 })),
257 ContentBlock::ToolResult { output, .. } => {
258 parts.push(serde_json::json!({
259 "functionResponse": {"name": "tool", "response": {"output": output}},
260 }));
261 }
262 ContentBlock::Thinking(_) => {}
263 }
264 }
265 contents.push(serde_json::json!({"role": role, "parts": parts}));
266 }
267 let mut body = serde_json::json!({
268 "contents": contents,
269 "generationConfig": {
270 "maxOutputTokens": request.params.max_output_tokens.unwrap_or(4096),
271 },
272 });
273 if !system.is_empty() {
274 body["systemInstruction"] = serde_json::json!({"parts": [{"text": system.join("\n")}]});
275 }
276 if !request.tools.is_empty() {
277 body["tools"] = serde_json::json!([{
278 "functionDeclarations": request
279 .tools
280 .iter()
281 .map(|tool| serde_json::json!({
282 "name": tool.name,
283 "description": tool.description,
284 "parameters": tool.input_schema,
285 }))
286 .collect::<Vec<_>>(),
287 }]);
288 }
289 body
290}
292fn 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() {
297 out.push('\n');
298 }
299 out.push_str(text);
300 }
301 }
302 out
303}
305/// The request URL for one endpoint.
306#[must_use]
307pub fn endpoint_url(endpoint: &VendorEndpoint) -> String {
308 match endpoint.kind {
309 ProviderKind::OpenAiCompatible | ProviderKind::Plugin => {
310 format!("{}/chat/completions", endpoint.base_url)
311 }
312 ProviderKind::Anthropic => format!("{}/v1/messages", endpoint.base_url),
313 ProviderKind::Google => format!(
314 "{}/v1beta/models/{}:streamGenerateContent?alt=sse",
315 endpoint.base_url, endpoint.model
316 ),
317 }
318}
320/// Headers the vendor requires.
321#[must_use]
322pub fn endpoint_headers(endpoint: &VendorEndpoint) -> Vec<(String, String)> {
323 match endpoint.kind {
324 ProviderKind::OpenAiCompatible | ProviderKind::Plugin => {
325 vec![(
326 "Authorization".to_string(),
327 format!("Bearer {}", endpoint.api_key),
328 )]
329 }
330 ProviderKind::Anthropic => vec![
331 ("x-api-key".to_string(), endpoint.api_key.clone()),
332 ("anthropic-version".to_string(), "2023-06-01".to_string()),
333 ],
334 ProviderKind::Google => vec![("x-goog-api-key".to_string(), endpoint.api_key.clone())],
335 }
336}
338fn make_decoder(kind: ProviderKind) -> Box<dyn StreamDecoder + Send> {
339 match kind {
340 ProviderKind::OpenAiCompatible | ProviderKind::Plugin => Box::new(OpenAiDecoder::new()),
341 ProviderKind::Anthropic => Box::new(AnthropicDecoder::new()),
342 ProviderKind::Google => Box::new(GeminiDecoder::new()),
343 }
344}
346/// Build a [`StreamFn`] that posts to one vendor endpoint.
347///
348/// The transport is deliberately synchronous-threaded: the agent loop polls
349/// streams synchronously, so a reader thread feeds decoded events through a
350/// channel.
351///
352/// # Errors
353///
354/// The returned stream's first item is `Err` when the request cannot be
355/// built, credentials are missing, or the HTTP call fails.
356#[must_use]
357pub 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) = result
364 && sender.send(Err(err)).is_err()
365 {
366 // Receiver dropped: the turn was abandoned.
367 }
368 });
369 futures::stream::unfold(receiver, |receiver| async move {
370 receiver.recv().map_or(None, |item| Some((item, receiver)))
371 })
372 .boxed()
373 })
374}
376fn post_and_decode(
377 endpoint: &VendorEndpoint,
378 request: &ProviderRequest,
379 cancel: &CancelHandle,
380 sender: &std::sync::mpsc::Sender<smith::provider::StreamItem>,
381) -> Result<()> {
382 let body = build_body(endpoint, request)?;
383 let client = reqwest::blocking::Client::new();
384 let mut prepared = client
385 .post(endpoint_url(endpoint))
386 .json(&body)
387 .timeout(std::time::Duration::from_secs(600));
388 for (name, value) in endpoint_headers(endpoint) {
389 prepared = prepared.header(name, value);
390 }
391 let response = prepared
392 .send()
393 .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,
401 },
402 401 | 403 => ProviderFault::Authentication { message: body },
403 400 | 404 => ProviderFault::Invalid {
404 field: None,
405 message: body,
406 },
407 503 => ProviderFault::Overloaded { message: body },
408 _ => ProviderFault::Transient { message: body },
409 },
410 });
411 }
412 let mut decoder = make_decoder(endpoint.kind);
413 let mut reader = response;
414 let mut buffer = [0u8; 16 * 1024];
415 loop {
416 if cancel.is_cancelled() {
417 return Err(SmithError::Cancelled);
418 }
419 let read = reader
420 .read(&mut buffer)
421 .map_err(|e| transport_fault(&e.to_string()))?;
422 if read == 0 {
423 break;
424 }
425 for event in decoder.push(&buffer[..read])? {
426 if sender.send(Ok(event)).is_err() {
427 return Ok(());
428 }
429 }
430 }
431 for event in decoder.finish()? {
432 if sender.send(Ok(event)).is_err() {
433 return Ok(());
434 }
435 }
436 Ok(())
437}
439fn transport_fault(message: &str) -> SmithError {
440 SmithError::Provider {
441 fault: ProviderFault::Transient {
442 message: message.to_string(),
443 },
444 }
445}
447#[cfg(test)]
448#[expect(clippy::unwrap_used, reason = "body builders assert on fixed requests")]
449mod tests {
450 use super::*;
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 {
457 VendorEndpoint {
458 kind,
459 base_url: "https://example.test".to_string(),
460 model: model.to_string(),
461 api_key: "k".to_string(),
462 }
463 }
465 #[test]
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(
471 "write",
472 serde_json::json!({"path": "f"}),
473 call_id,
474 ));
475 let mut result = Message::new(Role::Tool);
476 result.add_block(ContentBlock::tool_result(call_id, true, "written"));
477 let request = ProviderRequest::new(
478 "gpt",
479 vec![
480 Message::with_text(Role::System, "be brief"),
481 Message::with_text(Role::User, "hi"),
482 assistant,
483 result,
484 ],
485 )
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");
495 }
497 #[test]
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(
502 "read",
503 serde_json::json!({"path": "f"}),
504 call_id,
505 ));
506 let mut result = Message::new(Role::Tool);
507 result.add_block(ContentBlock::tool_result(call_id, true, "ok"));
508 let request = ProviderRequest::new(
509 "claude",
510 vec![
511 Message::with_text(Role::System, "sys"),
512 Message::with_text(Role::User, "hi"),
513 assistant,
514 result,
515 ],
516 );
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");
522 }
524 #[test]
525 fn google_body_maps_roles_and_declares_functions() {
526 let request = ProviderRequest::new(
527 "gemini",
528 vec![
529 Message::with_text(Role::System, "sys"),
530 Message::with_text(Role::User, "hi"),
531 ],
532 )
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");
538 }
540 #[test]
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"));
550 }
552 #[test]
553 fn stream_events_flow_through_the_shape_they_came_in() {
554 // Body builders stay pure; the unfold transport is covered by the
555 // decoders, so this pins the vendor kind to decoder mapping.
556 let mut decoder = make_decoder(ProviderKind::OpenAiCompatible);
557 let mut events = decoder
558 .push(b"data: {\"choices\":[{\"delta\":{\"content\":\"x\"}}]}\n\n")
559 .unwrap();
560 assert!(matches!(events.pop(), Some(StreamEvent::TextDelta { .. })));
561 }
562}

smith-cli/Cargo.toml

Modified

+2 / −0 text lines

@@ -12,3 +12,5 @@ dependencies
1212[dependencies]
1313smith = { path = "../smith" }
1414smith-harness = { path = "../smith-harness" }
15clap = { workspace = true }
16serde_json = { workspace = true }

smith-cli/src/main.rs

Modified

+150 / −1 text lines

22#![warn(missing_docs)]
44//! Smith command-line entry point.
5//!
6//! Two modes today: `eval` runs one prompt through the agent and prints the
7//! result; `rpc` speaks LF-delimited JSON-RPC on standard input and output.
8//! Both use the same runtime assembly from `smith-harness`.
6const fn main() {}
10use clap::Parser;
11use smith::error::Result;
12use smith_harness::rpc::{RpcState, handle_line};
13use smith_harness::runtime::{RuntimeConfig, RuntimeProvider, build_agent};
14use std::io::{BufRead, Write};
16/// Smith, a fast coding-agent runtime.
17#[derive(Debug, Parser)]
18#[command(name = "smith", version, about)]
19struct Cli {
20 #[command(subcommand)]
21 command: Command,
22}
24/// Interface mode.
25#[derive(Debug, Parser)]
26enum Command {
27 /// Run one prompt without the TUI.
28 Eval {
29 /// The prompt to run.
30 prompt: String,
31 /// Print the structured outcome as JSON.
32 #[arg(long)]
33 json: bool,
34 /// Use the scripted mock provider instead of a real endpoint.
35 #[arg(long)]
36 r#mock: bool,
37 /// OpenAI-compatible base URL.
38 #[arg(long)]
39 base_url: Option<String>,
40 /// Model id; `mock-smith` when mocking.
41 #[arg(long)]
42 model: Option<String>,
43 },
44 /// Serve LF-delimited JSON-RPC on standard input and output.
45 Rpc,
46}
48#[expect(clippy::print_stderr, reason = "the CLI reports failures on stderr")]
49fn main() -> std::process::ExitCode {
50 let cli = Cli::parse();
51 let result = match cli.command {
52 Command::Eval {
53 prompt,
54 json,
55 r#mock,
56 base_url,
57 model,
58 } => eval(&prompt, json, r#mock, base_url, model),
59 Command::Rpc => rpc(),
60 };
61 match result {
62 Ok(()) => std::process::ExitCode::SUCCESS,
63 Err(err) => {
64 eprintln!("smith: {err}");
65 std::process::ExitCode::FAILURE
66 }
67 }
68}
70fn provider(mock: bool, base_url: Option<String>, model: Option<String>) -> RuntimeProvider {
71 if mock {
72 return RuntimeProvider::Mock(vec![smith_harness::mock_text_reply(
73 "mock provider: no model configured",
74 )]);
75 }
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 {
79 base_url: base,
80 model,
81 }
82}
84#[expect(clippy::print_stdout, reason = "eval output is the command's product")]
85fn eval(
86 prompt: &str,
87 json: bool,
88 mock: bool,
89 base_url: Option<String>,
90 model: Option<String>,
91) -> Result<()> {
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"),
97 };
98 let mut agent = build_agent(&config)?;
99 let outcome = agent.run_turn(prompt)?;
100 if json {
101 println!(
102 "{}",
103 serde_json::json!({
104 "text": outcome.text,
105 "reason": format!("{:?}", outcome.reason),
106 "cost": {
107 "input_tokens": outcome.cost.input_tokens,
108 "output_tokens": outcome.cost.output_tokens,
109 },
110 })
111 );
112 } else {
113 println!("{}", outcome.text);
114 }
115 Ok(())
116}
118fn 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",
123 )]),
124 workdir: dir.clone(),
125 session_path: dir.join("rpc.smh"),
126 };
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(),
134 })?;
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(),
140 }
141 })?;
142 }
143 }
144 Ok(())
145}
147fn 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(),
153 })?;
154 Ok(dir)
155}

smith-harness/Cargo.toml

Modified

+3 / −0 text lines

1212smith-core = { path = "../smith-core" }
1313smith-ai = { path = "../smith-ai" }
1414smith-tui = { path = "../smith-tui" }
15futures = { workspace = true }
16serde = { workspace = true }
17serde_json = { workspace = true }

smith-harness/src/lib.rs

Modified

+54 / −1 text lines

11#![forbid(unsafe_code)]
22#![warn(missing_docs)]
4//! Smith orchestration, plugins, SDK, and mode wiring.
4//! Shared runtime assembly for every interface mode.
5//!
6//! One runtime shape serves eval and RPC: resolve an endpoint from the
7//! catalog, validate credentials without dispatch, and drive the
8//! provider-independent agent. `mock` provides a scripted provider for
9//! offline runs and tests.
11pub mod rpc;
12pub mod runtime;
14pub use rpc::{RpcRequest, RpcResponse, RpcState, handle_line};
15pub use runtime::{RuntimeConfig, RuntimeProvider, build_agent};
17use smith::id::MessageId;
18use smith::provider::{ProviderStream, StreamFn};
19use smith::stream::StreamEvent;
20use std::sync::Arc;
21use std::sync::Mutex;
23/// A scripted mock provider: one canned response per request, then a final
24/// apologetic refusal.
25#[must_use]
26pub fn mock_stream(
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() {
34 guard.push(request);
35 }
36 let index = seen_stream
37 .lock()
38 .map_or(0, |guard| guard.len().saturating_sub(1));
39 let response = script
40 .lock()
41 .ok()
42 .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)));
45 stream
46 });
47 (stream, seen)
48}
50/// Convenience: a mock reply of plain text.
51#[must_use]
52pub fn mock_text_reply(text: &str) -> Vec<StreamEvent> {
53 vec![
54 StreamEvent::text_delta(MessageId::new(), text),
55 StreamEvent::stop(smith::stream::StopReason::EndTurn, None),
56 ]
57}

smith-harness/src/rpc.rs

Added
new file mode 100644

+268 / −0 text lines

1//! LF-delimited JSON-RPC over standard input and output.
2//!
3//! Standard output carries protocol records only. Request IDs are preserved
4//! on every response, streaming deltas are ordered between a start and an
5//! authoritative end record, and unknown commands return correlated errors.
6
7use smith::error::Result;
8use smith_core::agent::{Agent, AgentEvent};
9use std::sync::Arc;
10use std::sync::Mutex;
12/// The shared RPC session state.
13pub struct RpcState {
14 agent: Arc<Mutex<Agent>>,
15}
17impl RpcState {
18 /// State over one agent.
19 #[must_use]
20 pub fn new(agent: Agent) -> Self {
21 Self {
22 agent: Arc::new(Mutex::new(agent)),
23 }
24 }
25}
27/// One incoming request line.
28#[derive(Clone, Debug, PartialEq, Eq)]
29pub struct RpcRequest {
30 /// Correlation ID; echoed on every response for this request.
31 pub id: serde_json::Value,
32 /// Command name.
33 pub method: String,
34 /// Command parameters, when present.
35 pub params: serde_json::Value,
36}
38/// One outgoing response line.
39#[derive(Clone, Debug, PartialEq, Eq)]
40pub struct RpcResponse {
41 /// Correlation ID of the owning request.
42 pub id: serde_json::Value,
43 /// Record payload: result or error.
44 pub record: serde_json::Value,
45}
47impl RpcResponse {
48 /// Serialize as one LF-terminated JSON line.
49 ///
50 /// # Errors
51 ///
52 /// Returns a serialization fault when the record cannot encode.
53 pub fn to_line(&self) -> Result<String> {
54 let mut value = serde_json::json!({"id": self.id});
55 merge(&mut value, &self.record);
56 let mut line =
57 serde_json::to_string(&value).map_err(|e| smith::error::SmithError::Session {
58 code: "RPC_ENCODE".to_string(),
59 message: e.to_string(),
60 })?;
61 line.push('\n');
62 Ok(line)
63 }
64}
66fn 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());
70 }
71 }
72}
74/// Handle one input line, producing zero or more response lines.
75///
76/// # Errors
77///
78/// Returns an encode fault only when a response cannot serialize.
79#[allow(clippy::print_stdout)]
80pub fn handle_line(state: &RpcState, line: &str) -> Vec<String> {
81 let trimmed = line.trim();
82 if trimmed.is_empty() {
83 return Vec::new();
84 }
85 let parsed: serde_json::Value = match serde_json::from_str(trimmed) {
86 Ok(value) => value,
87 Err(err) => {
88 let response = RpcResponse {
89 id: serde_json::Value::Null,
90 record: serde_json::json!({
91 "error": {"code": "PARSE", "message": err.to_string()},
92 }),
93 };
94 return line_or_empty(&response);
95 }
96 };
97 let request = RpcRequest {
98 id: parsed.get("id").cloned().unwrap_or(serde_json::Value::Null),
99 method: parsed
100 .get("method")
101 .and_then(serde_json::Value::as_str)
102 .unwrap_or_default()
103 .to_string(),
104 params: parsed
105 .get("params")
106 .cloned()
107 .unwrap_or(serde_json::json!({})),
108 };
109 dispatch(state, request)
110 .into_iter()
111 .filter_map(|response| line_or_empty(&response).into_iter().next())
112 .collect()
113}
115fn line_or_empty(response: &RpcResponse) -> Vec<String> {
116 response
117 .to_line()
118 .map(|line| vec![line])
119 .unwrap_or_default()
120}
122fn 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),
126 "abort" => {
127 if let Ok(agent) = state.agent.lock() {
128 agent.cancel_handle().cancel();
129 }
130 vec![result(&request, serde_json::json!({"aborting": true}))]
131 }
132 "status" => vec![result(&request, serde_json::json!({"settled": true}))],
133 other => vec![RpcResponse {
134 id: request.id,
135 record: serde_json::json!({
136 "error": {"code": "METHOD_UNKNOWN", "message": format!("unknown method {other}")},
137 }),
138 }],
139 }
140}
142fn run_prompt(state: &RpcState, request: &RpcRequest) -> Vec<RpcResponse> {
143 let input = request
144 .params
145 .get("input")
146 .and_then(serde_json::Value::as_str)
147 .unwrap_or_default()
148 .to_string();
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")];
152 };
153 // Drive the turn synchronously; deltas replay from the recorded events
154 // between the start and the authoritative end record.
155 match agent.run_turn(&input) {
156 Ok(outcome) => {
157 for event in &outcome.events {
158 if let AgentEvent::Streamed {
159 event: smith::stream::StreamEvent::TextDelta { delta, .. },
160 } = event
161 {
162 responses.push(result(
163 request,
164 serde_json::json!({"event": "delta", "text": delta}),
165 ));
166 }
167 }
168 responses.push(result(
169 request,
170 serde_json::json!({
171 "event": "end",
172 "text": outcome.text,
173 "reason": format!("{:?}", outcome.reason),
174 "cost": {
175 "input_tokens": outcome.cost.input_tokens,
176 "output_tokens": outcome.cost.output_tokens,
177 },
178 }),
179 ));
180 }
181 Err(err) => {
182 responses.push(error(request, "TURN_FAILED", &err.to_string()));
183 }
184 }
185 responses
186}
188fn result(request: &RpcRequest, record: serde_json::Value) -> RpcResponse {
189 RpcResponse {
190 id: request.id.clone(),
191 record,
192 }
193}
195fn error(request: &RpcRequest, code: &str, message: &str) -> RpcResponse {
196 RpcResponse {
197 id: request.id.clone(),
198 record: serde_json::json!({"error": {"code": code, "message": message}}),
199 }
200}
202#[cfg(test)]
203#[expect(clippy::unwrap_used, reason = "rpc tests assert on scripted lines")]
204mod tests {
205 use super::*;
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())
216 }
218 fn lines(state: &RpcState, input: &str) -> Vec<serde_json::Value> {
219 handle_line(state, input)
220 .iter()
221 .map(|line| serde_json::from_str(line.trim()).unwrap())
222 .collect()
223 }
225 #[test]
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");
236 }
238 #[test]
239 fn prompt_streams_deltas_and_assembles_the_final_message() {
240 let state = state();
241 let records = lines(
242 &state,
243 r#"{"id": 1, "method": "prompt", "params": {"input": "hi"}}"#,
244 );
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");
251 // The end record is authoritative and carries the whole message.
252 let assembled: String = records
253 .iter()
254 .filter(|record| record["event"] == "delta")
255 .filter_map(|record| record["text"].as_str().map(str::to_string))
256 .collect();
257 assert_eq!(assembled, end["text"].as_str().unwrap_or_default());
258 // Every record carries the request id.
259 assert!(records.iter().all(|record| record["id"] == 1));
260 }
262 #[test]
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());
267 }
268}

smith-harness/src/runtime.rs

Added
new file mode 100644

+195 / −0 text lines

1//! Runtime assembly: configuration to agent.
2//!
3//! One shape serves eval and RPC. Mock providers run scripted responses for
4//! offline use; real providers post through the vendor transport with
5//! credentials resolved from the environment.
6
7use smith::config::Config;
8use smith::error::Result;
9use smith::provider::StreamFn;
10use smith_ai::auth::{AuthRegistry, Credential};
11use smith_ai::models::ProviderKind;
12use smith_ai::transport::{VendorEndpoint, transport};
13use smith_core::agent::Agent;
14use smith_core::store::open_session;
15use smith_core::tools::ToolSession;
16use std::path::{Path, PathBuf};
18/// Which provider a runtime uses.
19#[derive(Clone, Debug, PartialEq, Eq)]
20pub enum RuntimeProvider {
21 /// Scripted responses; `smh-mock` in the catalog.
22 Mock(Vec<Vec<smith::stream::StreamEvent>>),
23 /// OpenAI-compatible endpoint.
24 OpenAiCompatible {
25 /// Base URL, for example `https://api.openai.com/v1`.
26 base_url: String,
27 /// Model id.
28 model: String,
29 },
30 /// Anthropic Messages endpoint.
31 Anthropic {
32 /// Base URL.
33 base_url: String,
34 /// Model id.
35 model: String,
36 },
37 /// Google Gemini endpoint.
38 Google {
39 /// Base URL.
40 base_url: String,
41 /// Model id.
42 model: String,
43 },
44}
46impl RuntimeProvider {
47 /// The catalog model id this provider serves.
48 #[must_use]
49 pub fn model(&self) -> &str {
50 match self {
51 Self::Mock(_) => "mock-smith",
52 Self::OpenAiCompatible { model, .. }
53 | Self::Anthropic { model, .. }
54 | Self::Google { model, .. } => model,
55 }
56 }
58 const fn vendor_kind(&self) -> ProviderKind {
59 match self {
60 Self::Mock(_) | Self::OpenAiCompatible { .. } => ProviderKind::OpenAiCompatible,
61 Self::Anthropic { .. } => ProviderKind::Anthropic,
62 Self::Google { .. } => ProviderKind::Google,
63 }
64 }
65}
67/// Everything needed to assemble a runtime.
68#[derive(Clone, Debug)]
69pub struct RuntimeConfig {
70 /// Provider selection.
71 pub provider: RuntimeProvider,
72 /// Working directory for tool effects.
73 pub workdir: PathBuf,
74 /// Session file path; created when missing.
75 pub session_path: PathBuf,
76}
78impl RuntimeConfig {
79 /// A mock runtime under `workdir` with a fresh session file.
80 #[must_use]
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");
84 Self {
85 provider: RuntimeProvider::Mock(script),
86 workdir,
87 session_path,
88 }
89 }
90}
92/// Environment variable per provider family.
93const KEY_VARIABLES: [(ProviderKind, &str); 3] = [
94 (ProviderKind::OpenAiCompatible, "OPENAI_API_KEY"),
95 (ProviderKind::Anthropic, "ANTHROPIC_API_KEY"),
96 (ProviderKind::Google, "GEMINI_API_KEY"),
97];
99/// Assemble an agent from a configuration, opening or creating its session.
100///
101/// # Errors
102///
103/// Returns configuration, session, or credential-resolution failures; a
104/// missing credential for a real provider fails here, before any dispatch.
105pub 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)?;
110 Ok(Agent::new(
111 stream,
112 tools,
113 config.provider.model().to_string(),
114 ))
115}
117fn resolve_stream(provider: &RuntimeProvider) -> Result<StreamFn> {
118 match provider {
119 RuntimeProvider::Mock(script) => {
120 let (stream, _seen) = crate::mock_stream(script.clone());
121 Ok(stream)
122 }
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
129 .iter()
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:?}"),
138 },
139 }
140 })?;
141 let api_key = credential.secret()?;
142 Ok(transport(VendorEndpoint {
143 kind,
144 base_url: base_url.clone(),
145 model: model.clone(),
146 api_key,
147 }))
148 }
149 }
150}
152#[cfg(test)]
153#[expect(
154 clippy::unwrap_used,
155 reason = "runtime tests assert on assembled agents"
156)]
157mod tests {
158 use super::*;
159 use crate::mock_text_reply;
161 #[test]
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");
170 drop(agent);
171 let _ = std::fs::remove_dir_all(&dir);
172 }
174 #[test]
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(());
179 // The credential check reads the environment; a missing variable
180 // is the normal fresh-runner state, so the test does not mutate it.
181 let config = RuntimeConfig {
182 provider: RuntimeProvider::OpenAiCompatible {
183 base_url: "https://example.test/v1".to_string(),
184 model: "gpt-5.1".to_string(),
185 },
186 workdir: dir.clone(),
187 session_path: dir.join("s.smh"),
188 };
189 let Err(err) = build_agent(&config) else {
190 unreachable!("no credential must fail assembly");
191 };
192 assert_eq!(err.code(), "PROVIDER_AUTH");
193 let _ = std::fs::remove_dir_all(&dir);
194 }
195}