diff --git a/Cargo.lock b/Cargo.lock index b43e864..cdbf584 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "agent-bridle-core" version = "0.1.0" @@ -15,6 +21,25 @@ dependencies = [ "serde_json", ] +[[package]] +name = "agent-bridle-tool-web" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3804436b6676c34d67ee9df3a60133bd2e856a04e0476ac3a4e1dcfe4ad79ca" +dependencies = [ + "agent-bridle-core", + "anyhow", + "async-trait", + "dom_smoothie", + "hickory-resolver", + "htmd", + "reqwest", + "serde", + "serde_json", + "tokio", + "url", +] + [[package]] name = "agent-mesh-protocol" version = "0.6.1" @@ -24,16 +49,28 @@ dependencies = [ "blake3", "ed25519-dalek", "hex", - "rand", + "rand 0.8.6", "serde", "serde_bytes", "serde_json", "ssh-key", - "thiserror", + "thiserror 2.0.18", "tracing", "zeroize", ] +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -79,7 +116,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -90,7 +127,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -111,6 +148,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "async-compression" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79b3f8a79cccc2898f31920fc69f304859b3bd567490f75ebf51ae1c792a9ac" +dependencies = [ + "compression-codecs", + "compression-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "async-trait" version = "0.1.89" @@ -122,6 +171,12 @@ dependencies = [ "syn", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.5.1" @@ -134,12 +189,39 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d7ced0ae9557296835c32bf1b1e02b44c746701f898460fb000d7eaa84f00a" + [[package]] name = "blake3" version = "1.8.5" @@ -191,6 +273,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chrono" version = "0.4.45" @@ -258,6 +346,23 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" +[[package]] +name = "compression-codecs" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2548391e9c1929c21bf6aa2680af86fe4c1b33e6cea9ac1cfeec0bd11218cf" +dependencies = [ + "compression-core", + "flate2", + "memchr", +] + +[[package]] +name = "compression-core" +version = "0.4.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc14f565cf027a105f7a44ccf9e5b424348421a1d8952a8fc9d499d313107789" + [[package]] name = "const-oid" version = "0.9.6" @@ -294,6 +399,15 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -301,7 +415,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "rand_core", + "rand_core 0.6.4", "subtle", "zeroize", ] @@ -316,6 +430,29 @@ dependencies = [ "typenum", ] +[[package]] +name = "cssparser" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -343,6 +480,12 @@ dependencies = [ "syn", ] +[[package]] +name = "data-encoding" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8" + [[package]] name = "der" version = "0.7.10" @@ -354,6 +497,27 @@ dependencies = [ "zeroize", ] +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + [[package]] name = "digest" version = "0.10.7" @@ -366,6 +530,66 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dom_query" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521e380c0c8afb8d9a1e83a1822ee03556fc3e3e7dbc1fd30be14e37f9cb3f89" +dependencies = [ + "bit-set", + "cssparser", + "foldhash", + "html5ever", + "nom", + "precomputed-hash", + "selectors", + "tendril", +] + +[[package]] +name = "dom_smoothie" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f21cad308997c8c518aaee15c8b38bb04dc699bbcf30da4176443c9ef40c1bb5" +dependencies = [ + "dom_query", + "flagset", + "foldhash", + "gjson", + "html-escape", + "once_cell", + "phf", + "tendril", + "thiserror 2.0.18", + "unicode-segmentation", +] + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + [[package]] name = "ecdsa" version = "0.16.9" @@ -399,7 +623,7 @@ checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" dependencies = [ "curve25519-dalek", "ed25519", - "rand_core", + "rand_core 0.6.4", "serde", "sha2", "subtle", @@ -419,12 +643,33 @@ dependencies = [ "generic-array", "group", "pkcs8", - "rand_core", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", ] +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" @@ -438,16 +683,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.61.2", ] +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + [[package]] name = "ff" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" dependencies = [ - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -463,12 +726,64 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +[[package]] +name = "flagset" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7ac824320a75a52197e8f2d787f6a38b6718bb6897a35142d749af3c0e8f4fe" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", +] + [[package]] name = "futures-core" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + [[package]] name = "futures-task" version = "0.3.32" @@ -505,10 +820,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", ] +[[package]] +name = "gjson" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43503cc176394dd30a6525f5f36e838339b8b5619be33ed9a7783841580a97b6" + [[package]] name = "group" version = "0.13.0" @@ -516,16 +853,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", - "rand_core", + "rand_core 0.6.4", "subtle", ] +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "heck" version = "0.5.0" @@ -539,57 +894,352 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hmac" -version = "0.12.1" +name = "hickory-proto" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "92652067c9ce6f66ce53cc38d1169daa36e6e7eb7dd3b63b5103bd9d97117248" dependencies = [ - "digest", + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand 0.8.6", + "thiserror 1.0.69", + "tinyvec", + "tokio", + "tracing", + "url", ] [[package]] -name = "iana-time-zone" -version = "0.1.65" +name = "hickory-resolver" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +checksum = "cbb117a1ca520e111743ab2f6688eddee69db4e0ea242545a604dce8a66fd22e" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand 0.8.6", + "resolv-conf", + "smallvec", + "thiserror 1.0.69", + "tokio", + "tracing", ] [[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "cc", + "digest", ] [[package]] -name = "indexmap" -version = "2.14.0" +name = "htmd" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +checksum = "7eee9b00ee2e599b4f86507157e3db786e7a3319fc225f0e9584151dbea2291d" dependencies = [ - "equivalent", - "hashbrown", + "html5ever", + "markup5ever_rcdom", + "phf", ] [[package]] -name = "inout" -version = "0.1.4" +name = "html-escape" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476" dependencies = [ - "generic-array", + "utf8-width", ] +[[package]] +name = "html5ever" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2" +dependencies = [ + "log", + "markup5ever", +] + +[[package]] +name = "http" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be7462df143984c4598a256ef469b251d7d7f9e271135073e78fc535414f3d0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55281c53a1894c864990125767da440a4e630446785086f52523b20033b74498" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipconfig" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d40460c0ce33d6ce4b0630ad68ff63d6661961c48b6dba35e5a4d81cfb48222" +dependencies = [ + "socket2", + "widestring", + "windows-registry", + "windows-result", + "windows-sys 0.61.2", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + [[package]] name = "is_terminal_polyfill" version = "1.70.2" @@ -635,18 +1285,104 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" +[[package]] +name = "libsqlite3-sys" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "markup5ever" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862" +dependencies = [ + "log", + "tendril", + "web_atoms", +] + +[[package]] +name = "markup5ever_rcdom" +version = "0.38.0+unofficial" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "333171ccdf66e915257740d44e38ea5b1b19ce7b45d33cc35cb6f118fbd981ff" +dependencies = [ + "html5ever", + "markup5ever", + "tendril", + "xml5ever", +] + [[package]] name = "memchr" version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8" +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "mio" version = "1.2.1" @@ -655,7 +1391,7 @@ checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -673,13 +1409,16 @@ name = "modulex-core" version = "0.1.0" dependencies = [ "agent-bridle-core", + "agent-bridle-tool-web", "anyhow", "async-trait", + "blake3", "chrono", + "rusqlite", "serde", "serde_json", "shell-words", - "thiserror", + "thiserror 2.0.18", "tokio", "toml", ] @@ -691,6 +1430,7 @@ dependencies = [ "anyhow", "clap", "modulex-core", + "serde", "serde_json", "tokio", ] @@ -707,6 +1447,21 @@ dependencies = [ "tokio", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + [[package]] name = "num-bigint-dig" version = "0.8.6" @@ -718,7 +1473,7 @@ dependencies = [ "num-integer", "num-iter", "num-traits", - "rand", + "rand 0.8.6", "smallvec", "zeroize", ] @@ -799,10 +1554,33 @@ dependencies = [ "ecdsa", "elliptic-curve", "primeorder", - "rand_core", + "rand_core 0.6.4", "sha2", ] +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -812,6 +1590,65 @@ dependencies = [ "base64ct", ] +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.17" @@ -839,12 +1676,27 @@ dependencies = [ "spki", ] +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + [[package]] name = "portable-atomic" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -854,6 +1706,12 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "primeorder" version = "0.13.6" @@ -930,6 +1788,61 @@ dependencies = [ "syn", ] +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.18", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.4", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + [[package]] name = "quote" version = "1.0.45" @@ -939,6 +1852,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "rand" version = "0.8.6" @@ -946,8 +1865,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", ] [[package]] @@ -957,7 +1886,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", ] [[package]] @@ -966,9 +1905,73 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", ] +[[package]] +name = "resolv-conf" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" + [[package]] name = "rfc6979" version = "0.4.0" @@ -979,6 +1982,20 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rsa" version = "0.9.10" @@ -992,7 +2009,7 @@ dependencies = [ "num-traits", "pkcs1", "pkcs8", - "rand_core", + "rand_core 0.6.4", "sha2", "signature", "spki", @@ -1000,6 +2017,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rusqlite" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" +dependencies = [ + "bitflags", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", +] + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + [[package]] name = "rustc_version" version = "0.4.1" @@ -1009,12 +2046,59 @@ dependencies = [ "semver", ] +[[package]] +name = "rustls" +version = "0.23.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "sec1" version = "0.7.3" @@ -1029,6 +2113,25 @@ dependencies = [ "zeroize", ] +[[package]] +name = "selectors" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5d9c0c92a92d33f08817311cf3f2c29a3538a8240e94a6a3c622ce652d7e00c" +dependencies = [ + "bitflags", + "cssparser", + "derive_more", + "log", + "new_debug_unreachable", + "phf", + "phf_codegen", + "precomputed-hash", + "rustc-hash", + "servo_arc", + "smallvec", +] + [[package]] name = "semver" version = "1.0.28" @@ -1097,6 +2200,27 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "servo_arc" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170fb83ab34de17dc69aa7c67482b22218ddb85da56546f9bd6b929e32a05930" +dependencies = [ + "stable_deref_trait", +] + [[package]] name = "sha2" version = "0.10.9" @@ -1137,9 +2261,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", - "rand_core", + "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "siphasher" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + [[package]] name = "slab" version = "0.4.12" @@ -1152,6 +2288,16 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "socket2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "spin" version = "0.9.8" @@ -1199,7 +2345,7 @@ dependencies = [ "p256", "p384", "p521", - "rand_core", + "rand_core 0.6.4", "rsa", "sec1", "sha2", @@ -1210,6 +2356,37 @@ dependencies = [ "zeroize", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "string_cache" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", +] + [[package]] name = "strsim" version = "0.11.1" @@ -1233,19 +2410,69 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "target-lexicon" version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" +[[package]] +name = "tendril" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4790fc369d5a530f4b544b094e31388b9b3a37c0f4652ade4505945f5660d24" +dependencies = [ + "new_debug_unreachable", + "utf-8", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + [[package]] name = "thiserror" version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl", + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1259,6 +2486,31 @@ dependencies = [ "syn", ] +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.52.3" @@ -1270,8 +2522,9 @@ dependencies = [ "mio", "pin-project-lite", "signal-hook-registry", + "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -1285,6 +2538,29 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.8.23" @@ -1326,6 +2602,56 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "async-compression", + "bitflags", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "pin-project-lite", + "tokio", + "tokio-util", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + [[package]] name = "tracing" version = "0.1.44" @@ -1357,6 +2683,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typenum" version = "1.20.1" @@ -1369,24 +2701,90 @@ version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1292c0d970b54115d14f2492fe0170adf21d68a1de108eebc51c1df4f346a091" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasm-bindgen" version = "0.2.122" @@ -1400,6 +2798,16 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9473dbd2991ae90b6291c3c32c30c6187ac49aa32f9905d1cce280ec1e110b0f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.122" @@ -1432,6 +2840,53 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "web-sys" +version = "0.3.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621441cfc37b84979402712047321980c178f299193a3589d05b99e8763436" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7cff6eef815df1834fd250e3a2ff436044d82a9f1bc1980ca1dbdf07effc538" +dependencies = [ + "phf", + "phf_codegen", + "string_cache", + "string_cache_codegen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + [[package]] name = "windows-core" version = "0.62.2" @@ -1473,6 +2928,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + [[package]] name = "windows-result" version = "0.4.1" @@ -1491,6 +2957,24 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -1500,6 +2984,135 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + [[package]] name = "winnow" version = "0.7.15" @@ -1509,6 +3122,51 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "xml5ever" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dc9559429edf0cd3f327cc0afd9d6b36fa8cec6d93107b7fbe64f806b5f2d9" +dependencies = [ + "log", + "markup5ever", +] + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.8.50" @@ -1529,6 +3187,27 @@ dependencies = [ "syn", ] +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "zeroize" version = "1.8.2" @@ -1549,6 +3228,39 @@ dependencies = [ "syn", ] +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zmij" version = "1.0.21" diff --git a/Cargo.toml b/Cargo.toml index 92f5523..9e48213 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,10 +21,13 @@ repository = "https://github.com/hartsock/modulex-mcp" modulex-core = { path = "crates/modulex-core", version = "=0.1.0" } agent-bridle-core = "0.1.0" +agent-bridle-tool-web = "0.1.0" anyhow = "1.0" +blake3 = "1.8" async-trait = "0.1" chrono = { version = "0.4", default-features = false, features = ["clock"] } clap = { version = "4", features = ["derive"] } +rusqlite = { version = "0.32", features = ["bundled"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" shell-words = "1.1" diff --git a/crates/modulex-cli/src/main.rs b/crates/modulex-cli/src/main.rs index 043acb3..269277a 100644 --- a/crates/modulex-cli/src/main.rs +++ b/crates/modulex-cli/src/main.rs @@ -63,6 +63,49 @@ enum Command { Steps, /// Show config location, leash provenance, and tool availability. Doctor, + /// Manage reminders in the agent state store. + Remind { + #[command(subcommand)] + action: RemindAction, + }, + /// Agent state store utilities. + Store { + #[command(subcommand)] + action: StoreAction, + }, +} + +#[derive(Subcommand)] +enum RemindAction { + /// Register a reminder ("remind me of X"). + Add { + /// The reminder text. + text: String, + /// Optional ISO due date (YYYY-MM-DD). + #[arg(long)] + due: Option, + /// Optional recurrence: daily | weekly | monthly. + #[arg(long)] + recur: Option, + }, + /// List open reminders. + List, + /// Mark a reminder done by id. + Done { + /// Reminder id (from `remind list`). + id: i64, + }, +} + +#[derive(Subcommand)] +enum StoreAction { + /// Export the whole store as plain JSON (sovereignty). + Export, + /// Import a previous export (appends). + Import { + /// Path to a JSON export. + file: PathBuf, + }, } fn load(config_path: Option<&PathBuf>) -> anyhow::Result<(Engine, PathBuf, String)> { @@ -176,6 +219,59 @@ async fn run(cli: Cli) -> anyhow::Result { } } println!("routines: {}", engine.list_routines().len()); + match engine.store() { + Some(_) => println!("agent state store: ok"), + None => println!("agent state store: UNAVAILABLE"), + } + Ok(true) + } + Command::Remind { action } => { + let Some(store) = engine.store() else { + anyhow::bail!("agent state store unavailable"); + }; + let generation = engine.current_generation(); + match action { + RemindAction::Add { text, due, recur } => { + let id = + store.reminder_add(&text, due.as_deref(), recur.as_deref(), generation)?; + println!("reminder #{id} registered (after gen {generation})"); + } + RemindAction::List => { + let reminders = store.reminders_open()?; + if reminders.is_empty() { + println!("(no open reminders)"); + } + for r in reminders { + let due = r.due.map(|d| format!(" due {d}")).unwrap_or_default(); + let recur = r + .recurrence + .map(|recurrence| format!(" [{recurrence}]")) + .unwrap_or_default(); + println!("#{} {}{due}{recur}", r.id, r.text); + } + } + RemindAction::Done { id } => { + if store.reminder_done(id, generation)? { + println!("reminder #{id} done"); + } else { + anyhow::bail!("no open reminder #{id}"); + } + } + } + Ok(true) + } + Command::Store { action } => { + let Some(store) = engine.store() else { + anyhow::bail!("agent state store unavailable"); + }; + match action { + StoreAction::Export => println!("{}", store.export_json()?), + StoreAction::Import { file } => { + let json = std::fs::read_to_string(&file)?; + store.import_json(&json)?; + println!("imported {}", file.display()); + } + } Ok(true) } } diff --git a/crates/modulex-core/Cargo.toml b/crates/modulex-core/Cargo.toml index ea404c8..8ec24c1 100644 --- a/crates/modulex-core/Cargo.toml +++ b/crates/modulex-core/Cargo.toml @@ -9,13 +9,20 @@ authors.workspace = true repository.workspace = true [features] +default = ["web"] +# The url-watch step: leashed fetching via agent-bridle-tool-web (net-axis +# Caveats + SSRF screening). Off → no reqwest/rustls in the build. +web = ["dep:agent-bridle-tool-web", "dep:blake3"] # Exposes exec::test_support (MockSpawner, gate_with) to downstream crates' # tests. Dev-dependencies only. test-support = [] [dependencies] agent-bridle-core = { workspace = true } +agent-bridle-tool-web = { workspace = true, optional = true } anyhow = { workspace = true } +blake3 = { workspace = true, optional = true } +rusqlite = { workspace = true } async-trait = { workspace = true } chrono = { workspace = true } serde = { workspace = true } diff --git a/crates/modulex-core/src/config.rs b/crates/modulex-core/src/config.rs index 7d49e99..df1fda7 100644 --- a/crates/modulex-core/src/config.rs +++ b/crates/modulex-core/src/config.rs @@ -159,6 +159,14 @@ pub struct ChoresConfig { pub path: String, } +/// Agent state store location (`[store]`). +#[derive(Clone, Debug, Default, Deserialize)] +pub struct StoreConfig { + /// SQLite path; empty = `$MODULEX_STORE` → `~/.modulex/store.db`. + #[serde(default)] + pub path: String, +} + /// A fixed date to count down to. #[derive(Clone, Debug, Deserialize)] pub struct DeadlineEntry { @@ -218,6 +226,9 @@ pub struct Config { /// Chores config. #[serde(default)] pub chores: ChoresConfig, + /// Agent state store config. + #[serde(default)] + pub store: StoreConfig, /// Deadlines for `deadline-calc`. #[serde(default)] pub deadlines: Vec, diff --git a/crates/modulex-core/src/engine.rs b/crates/modulex-core/src/engine.rs index 0d63667..db744ec 100644 --- a/crates/modulex-core/src/engine.rs +++ b/crates/modulex-core/src/engine.rs @@ -88,17 +88,34 @@ pub struct Engine { spawner: Arc, generation: AtomicU64, reports: Mutex>, + store: Option>, } impl Engine { /// An engine over the given config, registry, and grant, spawning real - /// processes. + /// processes. Opens (creating if needed) the agent state store at the + /// configured path; on failure the engine still runs, store-backed + /// steps soft-skip, and a warning goes to stderr. #[must_use] pub fn new(config: Config, registry: StepRegistry, granted: Caveats) -> Self { - Self::with_spawner(config, registry, granted, Arc::new(TokioSpawner)) + let home = std::env::var_os("HOME").map(std::path::PathBuf::from); + let path = crate::store::Store::resolve_path( + (!config.store.path.is_empty()).then_some(config.store.path.as_str()), + home.as_deref(), + ); + let store = match crate::store::Store::open(&path) { + Ok(store) => Some(Arc::new(store)), + Err(e) => { + eprintln!( + "modulex: agent state store unavailable ({e}) — store-backed steps will skip" + ); + None + } + }; + Self::with_spawner(config, registry, granted, Arc::new(TokioSpawner)).with_store_opt(store) } - /// As [`Engine::new`] with an injected [`Spawner`] (tests). + /// As [`Engine::new`] with an injected [`Spawner`] and NO store (tests). #[must_use] pub fn with_spawner( config: Config, @@ -113,7 +130,38 @@ impl Engine { spawner, generation: AtomicU64::new(0), reports: Mutex::new(VecDeque::new()), + store: None, + } + } + + /// Attach an agent state store (builder). Seeds the generation counter + /// from the store's persisted value, so generations stay monotonic + /// across process restarts. + #[must_use] + pub fn with_store(self, store: Arc) -> Self { + self.with_store_opt(Some(store)) + } + + fn with_store_opt(mut self, store: Option>) -> Self { + if let Some(store) = &store { + self.generation + .store(store.last_generation(), Ordering::Release); } + self.store = store; + self + } + + /// The agent state store, when available. + #[must_use] + pub fn store(&self) -> Option<&Arc> { + self.store.as_ref() + } + + /// The current generation: the identity of the LAST completed (or + /// in-flight) run. Mutation stamps use this — "registered after run N". + #[must_use] + pub fn current_generation(&self) -> u64 { + self.generation.load(Ordering::Acquire) } /// The loaded configuration. @@ -255,6 +303,13 @@ impl Engine { } report.finalize(); + // Persist the generation so it stays monotonic across restarts + // (best effort — a read-only disk shouldn't kill the report). + if let Some(store) = &self.store { + if let Err(e) = store.set_last_generation(generation) { + eprintln!("modulex: could not persist generation {generation}: {e}"); + } + } let mut reports = self.reports.lock().expect("report store poisoned"); while reports.len() >= REPORT_RETENTION { reports.pop_front(); @@ -290,6 +345,7 @@ impl Engine { generation, exec: exec.clone(), prior: prior.to_vec(), + store: self.store.clone(), } } @@ -307,6 +363,7 @@ impl Engine { generation, exec: exec.clone(), prior, + store: self.store.clone(), }; run_with(self.registry.get(&step.step_type).as_deref(), step, &cx).await } diff --git a/crates/modulex-core/src/exec.rs b/crates/modulex-core/src/exec.rs index f9e014e..5ac03c2 100644 --- a/crates/modulex-core/src/exec.rs +++ b/crates/modulex-core/src/exec.rs @@ -210,6 +210,14 @@ impl ExecGate { Self { cx, spawner } } + /// The authorized [`ToolContext`] for this run — read access only. + /// In-proc leashed tools (the url-watch fetcher) consult its `net` axis; + /// the context itself remains unforgeable (minted only by the gate). + #[must_use] + pub fn tool_context(&self) -> &ToolContext { + &self.cx + } + /// Leash-check, spawn, scrub. The ONLY subprocess path in modulex. /// /// # Errors diff --git a/crates/modulex-core/src/lib.rs b/crates/modulex-core/src/lib.rs index 4fbbc6b..c2084fc 100644 --- a/crates/modulex-core/src/lib.rs +++ b/crates/modulex-core/src/lib.rs @@ -32,6 +32,7 @@ pub mod registry; pub mod report; pub mod step; pub mod steps; +pub mod store; pub use caveats::{CaveatsSource, GrantedCaveats}; pub use config::{Config, RoutineSpec, StepSpec}; @@ -41,6 +42,7 @@ pub use exec::{ExecGate, ExecOutput, ExecRequest, Spawner, TokioSpawner}; pub use registry::StepRegistry; pub use report::{RepoResult, Report, StepResult}; pub use step::{RunContext, StepHandler}; +pub use store::Store; // Re-export the leash vocabulary so embedders don't need a direct // agent-bridle-core dependency to construct grants. diff --git a/crates/modulex-core/src/step.rs b/crates/modulex-core/src/step.rs index 49a0ab7..b3f5895 100644 --- a/crates/modulex-core/src/step.rs +++ b/crates/modulex-core/src/step.rs @@ -23,6 +23,9 @@ pub struct RunContext { /// Results of steps that completed earlier in this run, in config order. /// Derived steps (e.g. an SLA check over a review-queue step) read these. pub prior: Vec, + /// The agent state store, when available. Store-backed steps soft-skip + /// without it. + pub store: Option>, } /// A step implementation, registered in a [`crate::registry::StepRegistry`] diff --git a/crates/modulex-core/src/steps/board.rs b/crates/modulex-core/src/steps/board.rs index 368e691..6ec30a2 100644 --- a/crates/modulex-core/src/steps/board.rs +++ b/crates/modulex-core/src/steps/board.rs @@ -214,6 +214,7 @@ mod tests { generation: 1, exec: gate_with(&Caveats::top(), Arc::new(MockSpawner::default())), prior: Vec::new(), + store: None, } } diff --git a/crates/modulex-core/src/steps/dates.rs b/crates/modulex-core/src/steps/dates.rs index 5219d2d..7327b56 100644 --- a/crates/modulex-core/src/steps/dates.rs +++ b/crates/modulex-core/src/steps/dates.rs @@ -126,7 +126,21 @@ impl StepHandler for CountdownCalc { } async fn run(&self, spec: &StepSpec, cx: &RunContext) -> StepResult { - let countdowns = &cx.config.countdowns; + // Config entries + agent-registered store entries, merged. Store + // failures degrade to config-only (soft). + let mut countdowns = cx.config.countdowns.clone(); + if let Some(store) = &cx.store { + if let Ok(stored) = store.countdowns_active() { + countdowns.extend(stored.into_iter().map(|c| crate::config::CountdownEntry { + label: c.label, + start_date: c.start_date, + end_date: c.end_date, + total_work_days: c.total_work_days, + role: String::new(), + display: c.display, + })); + } + } if countdowns.is_empty() { return StepResult::ok(&spec.name, &spec.step_type, "No countdowns configured."); } @@ -142,7 +156,7 @@ impl StepHandler for CountdownCalc { ); } - let output = render_countdowns(countdowns, today()); + let output = render_countdowns(&countdowns, today()); StepResult::ok(&spec.name, &spec.step_type, output) } } diff --git a/crates/modulex-core/src/steps/git.rs b/crates/modulex-core/src/steps/git.rs index b46170a..7dc6824 100644 --- a/crates/modulex-core/src/steps/git.rs +++ b/crates/modulex-core/src/steps/git.rs @@ -279,6 +279,7 @@ mod tests { generation: 1, exec: gate_with(&granted, spawner), prior: Vec::new(), + store: None, } } diff --git a/crates/modulex-core/src/steps/github.rs b/crates/modulex-core/src/steps/github.rs index ba37538..1bf1afc 100644 --- a/crates/modulex-core/src/steps/github.rs +++ b/crates/modulex-core/src/steps/github.rs @@ -189,6 +189,7 @@ mod tests { generation: 1, exec: gate_with(&granted, spawner.clone()), prior: Vec::new(), + store: None, }, spawner, ) diff --git a/crates/modulex-core/src/steps/gitlab.rs b/crates/modulex-core/src/steps/gitlab.rs index be2de88..96463dd 100644 --- a/crates/modulex-core/src/steps/gitlab.rs +++ b/crates/modulex-core/src/steps/gitlab.rs @@ -364,6 +364,7 @@ mod tests { generation: 1, exec: gate_with(&granted, spawner.clone()), prior: Vec::new(), + store: None, }, spawner, ) diff --git a/crates/modulex-core/src/steps/mod.rs b/crates/modulex-core/src/steps/mod.rs index 5d988ef..8c92883 100644 --- a/crates/modulex-core/src/steps/mod.rs +++ b/crates/modulex-core/src/steps/mod.rs @@ -16,8 +16,9 @@ //! | `mr-sla-check` | [`gitlab`] | — (derived from prior results) | //! | `board-scan` | [`board`] | — | //! | `chores-check` | [`board`] | — | -//! //! | `python` | [`python`] | the configured interpreter (plugin protocol) | +//! | `reminders` | [`reminders`] | — (agent state store) | +//! | `url-watch` | [`web`] | — (leashed in-proc fetch; feature `web`) | use std::sync::Arc; @@ -29,7 +30,10 @@ pub mod git; pub mod github; pub mod gitlab; pub mod python; +pub mod reminders; pub mod script; +#[cfg(feature = "web")] +pub mod web; /// A registry holding every builtin handler. #[must_use] @@ -50,6 +54,9 @@ pub fn builtin_registry() -> StepRegistry { registry.register(Arc::new(board::BoardScan)); registry.register(Arc::new(board::ChoresCheck)); registry.register(Arc::new(python::PythonPlugin)); + registry.register(Arc::new(reminders::Reminders)); + #[cfg(feature = "web")] + registry.register(Arc::new(web::UrlWatch::new())); registry } @@ -76,8 +83,11 @@ mod tests { "board-scan", "chores-check", "python", + "reminders", ] { assert!(names.iter().any(|n| n == expected), "missing {expected}"); } + #[cfg(feature = "web")] + assert!(names.iter().any(|n| n == "url-watch")); } } diff --git a/crates/modulex-core/src/steps/python.rs b/crates/modulex-core/src/steps/python.rs index 6589f87..5ae0b86 100644 --- a/crates/modulex-core/src/steps/python.rs +++ b/crates/modulex-core/src/steps/python.rs @@ -244,6 +244,7 @@ mod tests { generation: 7, exec: gate_with(&granted, spawner.clone()), prior: Vec::new(), + store: None, }, spawner, ) diff --git a/crates/modulex-core/src/steps/reminders.rs b/crates/modulex-core/src/steps/reminders.rs new file mode 100644 index 0000000..c3e42fb --- /dev/null +++ b/crates/modulex-core/src/steps/reminders.rs @@ -0,0 +1,189 @@ +//! The `reminders` step — surfaces open reminders from the agent state +//! store: overdue first, then due today, then dated upcoming, then undated. +//! Recurring reminders carry a `[daily]`-style tag. + +use async_trait::async_trait; +use chrono::NaiveDate; + +use crate::config::StepSpec; +use crate::report::StepResult; +use crate::step::{RunContext, StepHandler}; +use crate::store::Reminder; + +/// `reminders`: open reminders from the store. +pub struct Reminders; + +#[async_trait] +impl StepHandler for Reminders { + fn type_name(&self) -> &'static str { + "reminders" + } + + fn required_programs(&self, _spec: &StepSpec) -> Vec { + vec![] + } + + async fn run(&self, spec: &StepSpec, cx: &RunContext) -> StepResult { + let Some(store) = &cx.store else { + return StepResult::skip(&spec.name, &spec.step_type, "agent state store unavailable"); + }; + if cx.dry_run { + return StepResult::ok( + &spec.name, + &spec.step_type, + "[dry-run] would list open reminders from the store", + ); + } + match store.reminders_open() { + Ok(reminders) => { + let today = chrono::Local::now().date_naive(); + StepResult::ok(&spec.name, &spec.step_type, render(&reminders, today)) + } + Err(e) => StepResult::fail(&spec.name, &spec.step_type, e.to_string()), + } + } +} + +fn parse_iso(text: &str) -> Option { + NaiveDate::parse_from_str(text, "%Y-%m-%d").ok() +} + +/// Pure renderer, factored so tests pin `today`. +fn render(reminders: &[Reminder], today: NaiveDate) -> String { + if reminders.is_empty() { + return "(no open reminders)".to_string(); + } + + let mut overdue = Vec::new(); + let mut due_today = Vec::new(); + let mut upcoming = Vec::new(); + let mut undated = Vec::new(); + + for r in reminders { + let tag = r + .recurrence + .as_deref() + .map(|recurrence| format!(" [{recurrence}]")) + .unwrap_or_default(); + match r.due.as_deref().and_then(parse_iso) { + Some(due) if due < today => overdue.push(format!( + " OVERDUE ({} days): #{} {}{tag}", + (today - due).num_days(), + r.id, + r.text + )), + Some(due) if due == today => { + due_today.push(format!(" due today: #{} {}{tag}", r.id, r.text)); + } + Some(due) => upcoming.push(format!(" {due}: #{} {}{tag}", r.id, r.text)), + None => undated.push(format!(" - #{} {}{tag}", r.id, r.text)), + } + } + + let mut lines = Vec::new(); + lines.extend(overdue); + lines.extend(due_today); + lines.extend(upcoming); + lines.extend(undated); + lines.push(format!("({} open)", reminders.len())); + lines.join("\n") +} + +#[cfg(test)] +mod tests { + use std::sync::Arc; + + use agent_bridle_core::Caveats; + + use super::*; + use crate::config::Config; + use crate::exec::test_support::{gate_with, MockSpawner}; + use crate::store::Store; + + fn cx_with(store: Option>) -> RunContext { + RunContext { + config: Arc::new(Config::default()), + dry_run: false, + generation: 5, + exec: gate_with(&Caveats::top(), Arc::new(MockSpawner::default())), + prior: Vec::new(), + store, + } + } + + fn spec() -> StepSpec { + toml::from_str("name=\"reminders\"\ntype=\"reminders\"").unwrap() + } + + #[tokio::test] + async fn missing_store_soft_skips() { + let result = Reminders.run(&spec(), &cx_with(None)).await; + assert!(result.skipped); + } + + #[tokio::test] + async fn lists_open_reminders_through_the_store() { + let store = Arc::new(Store::in_memory().unwrap()); + store.reminder_add("ship it", None, None, 1).unwrap(); + let done = store.reminder_add("old", None, None, 1).unwrap(); + store.reminder_done(done, 2).unwrap(); + + let result = Reminders.run(&spec(), &cx_with(Some(store))).await; + assert!(result.success); + assert!(result.output.contains("ship it")); + assert!(!result.output.contains("old")); + assert!(result.output.contains("(1 open)")); + } + + #[test] + fn render_buckets_and_tags() { + let today = NaiveDate::parse_from_str("2026-06-05", "%Y-%m-%d").unwrap(); + let reminders = vec![ + Reminder { + id: 1, + text: "rotate token".into(), + due: Some("2026-06-01".into()), + recurrence: None, + created_gen: 1, + done_gen: None, + }, + Reminder { + id: 2, + text: "standup".into(), + due: Some("2026-06-05".into()), + recurrence: Some("daily".into()), + created_gen: 1, + done_gen: None, + }, + Reminder { + id: 3, + text: "CFP".into(), + due: Some("2026-07-01".into()), + recurrence: None, + created_gen: 1, + done_gen: None, + }, + Reminder { + id: 4, + text: "someday".into(), + due: None, + recurrence: None, + created_gen: 1, + done_gen: None, + }, + ]; + let body = render(&reminders, today); + let lines: Vec<&str> = body.lines().collect(); + assert!(lines[0].contains("OVERDUE (4 days): #1 rotate token")); + assert!(lines[1].contains("due today: #2 standup [daily]")); + assert!(lines[2].contains("2026-07-01: #3 CFP")); + assert!(lines[3].contains("- #4 someday")); + assert!(lines[4].contains("(4 open)")); + } + + #[test] + fn render_empty() { + let today = chrono::Local::now().date_naive(); + assert_eq!(render(&[], today), "(no open reminders)"); + } +} diff --git a/crates/modulex-core/src/steps/script.rs b/crates/modulex-core/src/steps/script.rs index b701faa..f7ce70e 100644 --- a/crates/modulex-core/src/steps/script.rs +++ b/crates/modulex-core/src/steps/script.rs @@ -196,6 +196,7 @@ mod tests { generation: 1, exec: gate_with(&granted, spawner.clone()), prior: Vec::new(), + store: None, }, spawner, ) diff --git a/crates/modulex-core/src/steps/web.rs b/crates/modulex-core/src/steps/web.rs new file mode 100644 index 0000000..ca5bb02 --- /dev/null +++ b/crates/modulex-core/src/steps/web.rs @@ -0,0 +1,301 @@ +//! The `url-watch` step (feature `web`) — fetch each registered watch +//! through agent-bridle's leashed web tool, hash the extracted content, and +//! report what changed since the watch was last seen. +//! +//! The fetch path is `agent-bridle-tool-web::WebFetchTool`: every request +//! (and every redirect hop) is gated against the run's **net** Caveats axis +//! and SSRF-screened (private/loopback addresses rejected, connections +//! pinned to the screened IP). This is modulex's first use of the net axis — +//! exec and net are now both leashed. +//! +//! Change detection: BLAKE3 hash of the extracted markdown, compared with +//! the hash stored at the last seen **generation** (a counter, never a +//! clock). + +use async_trait::async_trait; + +use crate::config::StepSpec; +use crate::report::{RepoResult, StepResult}; +use crate::step::{RunContext, StepHandler}; + +/// What a leashed fetch produced (the slice url-watch needs). +#[derive(Clone, Debug)] +pub struct FetchResult { + /// HTTP status. + pub status: u16, + /// Extracted page title. + pub title: String, + /// Extracted main content as markdown. + pub markdown: String, +} + +/// The mockable fetch seam (house rule: unit tests touch no network). +#[async_trait] +pub trait Fetcher: Send + Sync { + /// Fetch `url` under the run's leash. + async fn fetch( + &self, + url: &str, + cx: &agent_bridle_core::ToolContext, + ) -> Result; +} + +/// Production fetcher: agent-bridle-tool-web's `WebFetchTool` (net-axis +/// leash + SSRF screen + redirect re-check + DNS-rebinding pin). +pub struct BridleFetcher; + +#[async_trait] +impl Fetcher for BridleFetcher { + async fn fetch( + &self, + url: &str, + cx: &agent_bridle_core::ToolContext, + ) -> Result { + use agent_bridle_core::Tool; + let tool = agent_bridle_tool_web::WebFetchTool::new(); + let result = tool + .invoke(serde_json::json!({ "url": url }), cx) + .await + .map_err(|e| e.to_string())?; + Ok(FetchResult { + status: u16::try_from(result["status"].as_u64().unwrap_or(0)).unwrap_or(0), + title: result["title"].as_str().unwrap_or("").to_string(), + markdown: result["markdown"].as_str().unwrap_or("").to_string(), + }) + } +} + +/// `url-watch`: change tracking over the store's registered URLs. +pub struct UrlWatch { + fetcher: std::sync::Arc, +} + +impl UrlWatch { + /// The production step (BridleFetcher). + #[must_use] + pub fn new() -> Self { + Self { + fetcher: std::sync::Arc::new(BridleFetcher), + } + } + + /// A step over an injected fetcher (tests). + #[must_use] + pub fn with_fetcher(fetcher: std::sync::Arc) -> Self { + Self { fetcher } + } +} + +impl Default for UrlWatch { + fn default() -> Self { + Self::new() + } +} + +#[async_trait] +impl StepHandler for UrlWatch { + fn type_name(&self) -> &'static str { + "url-watch" + } + + fn required_programs(&self, _spec: &StepSpec) -> Vec { + vec![] // in-proc fetch; the leash here is the NET axis, not exec + } + + async fn run(&self, spec: &StepSpec, cx: &RunContext) -> StepResult { + let Some(store) = &cx.store else { + return StepResult::skip(&spec.name, &spec.step_type, "agent state store unavailable"); + }; + let watches = match store.watches() { + Ok(watches) => watches, + Err(e) => return StepResult::fail(&spec.name, &spec.step_type, e.to_string()), + }; + if watches.is_empty() { + return StepResult::ok(&spec.name, &spec.step_type, "No watches registered."); + } + if cx.dry_run { + let listing: Vec = watches + .iter() + .map(|w| format!("[dry-run] would fetch (leashed): {}", w.url)) + .collect(); + return StepResult::ok(&spec.name, &spec.step_type, listing.join("\n")); + } + + let mut repo_results = Vec::with_capacity(watches.len()); + for watch in &watches { + let label = if watch.note.is_empty() { + watch.url.clone() + } else { + format!("{} ({})", watch.url, watch.note) + }; + match self.fetcher.fetch(&watch.url, cx.exec.tool_context()).await { + Ok(fetched) => { + let hash = blake3::hash(fetched.markdown.as_bytes()) + .to_hex() + .to_string(); + let line = match (&watch.last_hash, watch.last_seen_gen) { + (Some(previous), Some(seen)) if *previous == hash => { + format!("unchanged since gen {seen} — {}", fetched.title) + } + (Some(_), Some(seen)) => format!( + "CHANGED since gen {seen} — {} (HTTP {})", + fetched.title, fetched.status + ), + _ => format!("first fetch — {} (HTTP {})", fetched.title, fetched.status), + }; + if let Err(e) = store.watch_seen(watch.id, &hash, cx.generation) { + repo_results.push(RepoResult::err(&label, e.to_string())); + } else { + repo_results.push(RepoResult::ok(&label, line)); + } + } + // A denied or failed fetch is data, not a dead routine — the + // denial reason (net leash, SSRF screen) lands in the report. + Err(e) => repo_results.push(RepoResult::err(&label, e)), + } + } + + let mut lines = Vec::new(); + for rr in &repo_results { + lines.push(format!("### {}", rr.repo)); + match &rr.error { + Some(error) => lines.push(format!("ERROR: {error}")), + None => lines.push(rr.output.clone()), + } + } + StepResult::ok(&spec.name, &spec.step_type, lines.join("\n")).with_repos(repo_results) + } +} + +#[cfg(test)] +mod tests { + use std::sync::Arc; + + use agent_bridle_core::{Caveats, Scope}; + + use super::*; + use crate::config::Config; + use crate::exec::test_support::{gate_with, MockSpawner}; + use crate::store::Store; + + struct CannedFetcher(Vec>); + + #[async_trait] + impl Fetcher for CannedFetcher { + async fn fetch( + &self, + _url: &str, + _cx: &agent_bridle_core::ToolContext, + ) -> Result { + self.0.first().cloned().unwrap_or_else(|| { + Ok(FetchResult { + status: 200, + title: "t".into(), + markdown: "m".into(), + }) + }) + } + } + + fn cx_with(store: Arc) -> RunContext { + RunContext { + config: Arc::new(Config::default()), + dry_run: false, + generation: 7, + exec: gate_with(&Caveats::top(), Arc::new(MockSpawner::default())), + prior: Vec::new(), + store: Some(store), + } + } + + fn spec() -> StepSpec { + toml::from_str("name=\"watches\"\ntype=\"url-watch\"").unwrap() + } + + fn fetched(markdown: &str) -> Result { + Ok(FetchResult { + status: 200, + title: "Release notes".into(), + markdown: markdown.into(), + }) + } + + #[tokio::test] + async fn first_fetch_then_unchanged_then_changed() { + let store = Arc::new(Store::in_memory().unwrap()); + store + .watch_add("https://example.com/r", "releases", 1) + .unwrap(); + + // First fetch. + let step = UrlWatch::with_fetcher(Arc::new(CannedFetcher(vec![fetched("v1")]))); + let result = step.run(&spec(), &cx_with(store.clone())).await; + assert!(result.success); + assert!(result.output.contains("first fetch")); + + // Same content → unchanged since gen 7. + let step = UrlWatch::with_fetcher(Arc::new(CannedFetcher(vec![fetched("v1")]))); + let result = step.run(&spec(), &cx_with(store.clone())).await; + assert!(result.output.contains("unchanged since gen 7")); + + // New content → CHANGED. + let step = UrlWatch::with_fetcher(Arc::new(CannedFetcher(vec![fetched("v2")]))); + let result = step.run(&spec(), &cx_with(store.clone())).await; + assert!(result.output.contains("CHANGED since gen 7")); + } + + #[tokio::test] + async fn fetch_denial_is_step_data_not_routine_death() { + let store = Arc::new(Store::in_memory().unwrap()); + store.watch_add("https://blocked.example", "", 1).unwrap(); + let step = UrlWatch::with_fetcher(Arc::new(CannedFetcher(vec![Err( + "network access to \"blocked.example\" is not within the granted authority".into(), + )]))); + let result = step.run(&spec(), &cx_with(store)).await; + assert!(!result.success, "denied fetch fails the step"); + assert!(result.output.contains("granted authority")); + } + + #[tokio::test] + async fn empty_watches_and_dry_run() { + let store = Arc::new(Store::in_memory().unwrap()); + let step = UrlWatch::with_fetcher(Arc::new(CannedFetcher(vec![]))); + let result = step.run(&spec(), &cx_with(store.clone())).await; + assert_eq!(result.output, "No watches registered."); + + store.watch_add("https://example.com", "", 1).unwrap(); + let mut cx = cx_with(store); + cx.dry_run = true; + let step = UrlWatch::with_fetcher(Arc::new(CannedFetcher(vec![]))); + let result = step.run(&spec(), &cx).await; + assert!(result.output.contains("[dry-run] would fetch (leashed)")); + } + + #[tokio::test] + async fn real_net_leash_denies_unlisted_host_through_bridle_fetcher() { + // The REAL BridleFetcher against a deny-all net grant: the leash + // rejects before any network I/O happens, so this is still a + // no-network unit test. + let store = Arc::new(Store::in_memory().unwrap()); + store.watch_add("https://example.com", "", 1).unwrap(); + let granted = Caveats { + net: Scope::none(), + ..Caveats::top() + }; + let cx = RunContext { + config: Arc::new(Config::default()), + dry_run: false, + generation: 1, + exec: gate_with(&granted, Arc::new(MockSpawner::default())), + prior: Vec::new(), + store: Some(store), + }; + let result = UrlWatch::new().run(&spec(), &cx).await; + assert!(!result.success); + assert!( + result.output.contains("not within the granted authority"), + "got: {}", + result.output + ); + } +} diff --git a/crates/modulex-core/src/store.rs b/crates/modulex-core/src/store.rs new file mode 100644 index 0000000..09f9744 --- /dev/null +++ b/crates/modulex-core/src/store.rs @@ -0,0 +1,661 @@ +//! The agent state store — a small SQLite DB (`~/.modulex/store.db`) that +//! lets ANY agent register dynamic state through modulex instead of editing +//! config: reminders, countdowns, URL watches, iCal feeds, downstream MCP +//! servers (issue #7). +//! +//! Config describes *structure* (routines, steps); the store holds *state*. +//! Store-backed step types read it at routine time, so anything an agent +//! registers surfaces in the next report automatically. +//! +//! Design rules: +//! +//! - **Causal stamps**: rows carry the engine generation current at the time +//! of the mutation (`created_gen` / `done_gen` / …) — counters, never +//! wall-clock. The store also persists the engine's generation counter +//! (`meta.last_generation`) so generations stay monotonic across process +//! restarts. +//! - **Sovereignty**: SQLite is operational state, not the record. +//! [`Store::export_json`] dumps everything as plain JSON; `import_json` +//! reads it back. No lock-in. +//! - Dates (`due`, `start_date`, …) are display data, never coordination. + +use std::path::{Path, PathBuf}; +use std::sync::Mutex; + +use rusqlite::{params, Connection, OptionalExtension}; +use serde::{Deserialize, Serialize}; + +/// Environment variable overriding the store path (first in the search +/// order, before config's `[store] path` and the default). +pub const ENV_STORE: &str = "MODULEX_STORE"; + +/// Schema version stamped via `PRAGMA user_version`. +const SCHEMA_VERSION: i32 = 1; + +/// Errors from store operations. +#[derive(Debug, thiserror::Error)] +pub enum StoreError { + /// Underlying SQLite failure. + #[error("store: {0}")] + Sqlite(#[from] rusqlite::Error), + /// The store directory could not be created. + #[error("store: cannot create {0}: {1}")] + Io(PathBuf, std::io::Error), + /// Import payload malformed. + #[error("store import: {0}")] + Import(String), +} + +/// A registered reminder. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Reminder { + /// Row id. + pub id: i64, + /// The reminder text. + pub text: String, + /// Optional ISO due date. + pub due: Option, + /// Optional recurrence: `daily` | `weekly` | `monthly`. + pub recurrence: Option, + /// Engine generation when registered. + pub created_gen: u64, + /// Engine generation when marked done (`None` = open). + pub done_gen: Option, +} + +/// A registered countdown (same display semantics as config countdowns). +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct StoredCountdown { + /// Row id. + pub id: i64, + /// Display label. + pub label: String, + /// ISO start date. + pub start_date: String, + /// ISO end date. + pub end_date: String, + /// Denominator for the display template. + pub total_work_days: u32, + /// Display template (`{label}`, `{n}`, `{total}`). + pub display: String, + /// Engine generation when registered. + pub created_gen: u64, + /// Engine generation when retired (`None` = active). + pub retired_gen: Option, +} + +/// A URL registered for periodic change tracking. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Watch { + /// Row id. + pub id: i64, + /// The http(s) URL. + pub url: String, + /// Why it's being watched. + pub note: String, + /// Content hash from the last fetch (BLAKE3 hex), if any. + pub last_hash: Option, + /// Generation of the last fetch. + pub last_seen_gen: Option, + /// Engine generation when registered. + pub created_gen: u64, +} + +/// Everything in the store, for plain-text export. +#[derive(Debug, Serialize, Deserialize)] +pub struct StoreDump { + /// Schema version of the dump. + pub schema_version: i32, + /// Persisted engine generation. + pub last_generation: u64, + /// All reminders (open and done). + pub reminders: Vec, + /// All countdowns (active and retired). + pub countdowns: Vec, + /// All watches. + pub watches: Vec, +} + +/// The store handle. Cheap to share behind an `Arc`; all access serialized +/// through one connection (SQLite is the bottleneck anyway, and routine +/// state traffic is tiny). +pub struct Store { + conn: Mutex, +} + +impl Store { + /// Open (creating if needed) the store at `path`. + /// + /// # Errors + /// [`StoreError`] when the directory can't be created or SQLite fails. + pub fn open(path: &Path) -> Result { + if let Some(parent) = path.parent() { + if !parent.as_os_str().is_empty() { + std::fs::create_dir_all(parent) + .map_err(|e| StoreError::Io(parent.to_path_buf(), e))?; + } + } + let conn = Connection::open(path)?; + let store = Self { + conn: Mutex::new(conn), + }; + store.migrate()?; + Ok(store) + } + + /// An in-memory store (tests, ephemeral runs). + /// + /// # Errors + /// [`StoreError`] when SQLite fails. + pub fn in_memory() -> Result { + let store = Self { + conn: Mutex::new(Connection::open_in_memory()?), + }; + store.migrate()?; + Ok(store) + } + + /// Resolve the store path: `$MODULEX_STORE` → `store_path` from config → + /// `~/.modulex/store.db`. + #[must_use] + pub fn resolve_path(config_path: Option<&str>, home: Option<&Path>) -> PathBuf { + if let Some(env) = std::env::var_os(ENV_STORE) { + return PathBuf::from(env); + } + if let Some(path) = config_path { + return crate::config::expand_tilde(path); + } + home.map_or_else( + || PathBuf::from("modulex-store.db"), + |home| home.join(".modulex").join("store.db"), + ) + } + + fn migrate(&self) -> Result<(), StoreError> { + let conn = self.conn.lock().expect("store lock poisoned"); + let version: i32 = conn.query_row("PRAGMA user_version", [], |r| r.get(0))?; + if version >= SCHEMA_VERSION { + return Ok(()); + } + conn.execute_batch( + "BEGIN; + CREATE TABLE IF NOT EXISTS meta ( + key TEXT PRIMARY KEY, value TEXT NOT NULL + ); + CREATE TABLE IF NOT EXISTS reminders ( + id INTEGER PRIMARY KEY, + text TEXT NOT NULL, + due TEXT, + recurrence TEXT, + created_gen INTEGER NOT NULL, + done_gen INTEGER + ); + CREATE TABLE IF NOT EXISTS countdowns ( + id INTEGER PRIMARY KEY, + label TEXT NOT NULL, + start_date TEXT NOT NULL, + end_date TEXT NOT NULL, + total_work_days INTEGER NOT NULL DEFAULT 30, + display TEXT NOT NULL, + created_gen INTEGER NOT NULL, + retired_gen INTEGER + ); + CREATE TABLE IF NOT EXISTS watches ( + id INTEGER PRIMARY KEY, + url TEXT NOT NULL, + note TEXT NOT NULL DEFAULT '', + last_hash TEXT, + last_seen_gen INTEGER, + created_gen INTEGER NOT NULL + ); + -- Registered for later phases (issue #7 C/D); schema reserved + -- now so v1 DBs never need a migration for them. + CREATE TABLE IF NOT EXISTS ical_feeds ( + id INTEGER PRIMARY KEY, + source TEXT NOT NULL, + note TEXT NOT NULL DEFAULT '', + created_gen INTEGER NOT NULL + ); + CREATE TABLE IF NOT EXISTS mcp_servers ( + name TEXT PRIMARY KEY, + command TEXT NOT NULL, + args_json TEXT NOT NULL DEFAULT '[]', + note TEXT NOT NULL DEFAULT '', + created_gen INTEGER NOT NULL + ); + PRAGMA user_version = 1; + COMMIT;", + )?; + Ok(()) + } + + // ── generation persistence ───────────────────────────────────────── + + /// The persisted engine generation (0 when never set) — lets the engine + /// stay monotonic across restarts. + #[must_use] + pub fn last_generation(&self) -> u64 { + let conn = self.conn.lock().expect("store lock poisoned"); + conn.query_row( + "SELECT value FROM meta WHERE key = 'last_generation'", + [], + |r| r.get::<_, String>(0), + ) + .optional() + .ok() + .flatten() + .and_then(|v| v.parse().ok()) + .unwrap_or(0) + } + + /// Persist the engine generation after a run. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn set_last_generation(&self, generation: u64) -> Result<(), StoreError> { + let conn = self.conn.lock().expect("store lock poisoned"); + conn.execute( + "INSERT INTO meta (key, value) VALUES ('last_generation', ?1) + ON CONFLICT(key) DO UPDATE SET value = excluded.value", + params![generation.to_string()], + )?; + Ok(()) + } + + // ── reminders ────────────────────────────────────────────────────── + + /// Register a reminder; returns its id. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn reminder_add( + &self, + text: &str, + due: Option<&str>, + recurrence: Option<&str>, + generation: u64, + ) -> Result { + let conn = self.conn.lock().expect("store lock poisoned"); + conn.execute( + "INSERT INTO reminders (text, due, recurrence, created_gen) VALUES (?1, ?2, ?3, ?4)", + params![text, due, recurrence, generation], + )?; + Ok(conn.last_insert_rowid()) + } + + /// Open reminders (not done), oldest first. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn reminders_open(&self) -> Result, StoreError> { + let conn = self.conn.lock().expect("store lock poisoned"); + let mut stmt = conn.prepare( + "SELECT id, text, due, recurrence, created_gen, done_gen + FROM reminders WHERE done_gen IS NULL ORDER BY id", + )?; + let rows = stmt + .query_map([], row_to_reminder)? + .collect::, _>>()?; + Ok(rows) + } + + /// Mark a reminder done at `generation`. Returns false when no such open + /// reminder exists. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn reminder_done(&self, id: i64, generation: u64) -> Result { + let conn = self.conn.lock().expect("store lock poisoned"); + let changed = conn.execute( + "UPDATE reminders SET done_gen = ?2 WHERE id = ?1 AND done_gen IS NULL", + params![id, generation], + )?; + Ok(changed > 0) + } + + // ── countdowns ───────────────────────────────────────────────────── + + /// Register a countdown; returns its id. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn countdown_add( + &self, + label: &str, + start_date: &str, + end_date: &str, + total_work_days: u32, + display: Option<&str>, + generation: u64, + ) -> Result { + let display = display.unwrap_or("{label}: work day {n} of {total}"); + let conn = self.conn.lock().expect("store lock poisoned"); + conn.execute( + "INSERT INTO countdowns (label, start_date, end_date, total_work_days, display, created_gen) + VALUES (?1, ?2, ?3, ?4, ?5, ?6)", + params![label, start_date, end_date, total_work_days, display, generation], + )?; + Ok(conn.last_insert_rowid()) + } + + /// Active (non-retired) countdowns. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn countdowns_active(&self) -> Result, StoreError> { + let conn = self.conn.lock().expect("store lock poisoned"); + let mut stmt = conn.prepare( + "SELECT id, label, start_date, end_date, total_work_days, display, created_gen, retired_gen + FROM countdowns WHERE retired_gen IS NULL ORDER BY id", + )?; + let rows = stmt + .query_map([], row_to_countdown)? + .collect::, _>>()?; + Ok(rows) + } + + /// Retire a countdown at `generation`. Returns false when not found. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn countdown_retire(&self, id: i64, generation: u64) -> Result { + let conn = self.conn.lock().expect("store lock poisoned"); + let changed = conn.execute( + "UPDATE countdowns SET retired_gen = ?2 WHERE id = ?1 AND retired_gen IS NULL", + params![id, generation], + )?; + Ok(changed > 0) + } + + // ── watches ──────────────────────────────────────────────────────── + + /// Register a URL watch; returns its id. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn watch_add(&self, url: &str, note: &str, generation: u64) -> Result { + let conn = self.conn.lock().expect("store lock poisoned"); + conn.execute( + "INSERT INTO watches (url, note, created_gen) VALUES (?1, ?2, ?3)", + params![url, note, generation], + )?; + Ok(conn.last_insert_rowid()) + } + + /// All watches. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn watches(&self) -> Result, StoreError> { + let conn = self.conn.lock().expect("store lock poisoned"); + let mut stmt = conn.prepare( + "SELECT id, url, note, last_hash, last_seen_gen, created_gen FROM watches ORDER BY id", + )?; + let rows = stmt + .query_map([], row_to_watch)? + .collect::, _>>()?; + Ok(rows) + } + + /// Remove a watch. Returns false when not found. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn watch_remove(&self, id: i64) -> Result { + let conn = self.conn.lock().expect("store lock poisoned"); + Ok(conn.execute("DELETE FROM watches WHERE id = ?1", params![id])? > 0) + } + + /// Record a fetch outcome for a watch. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn watch_seen(&self, id: i64, hash: &str, generation: u64) -> Result<(), StoreError> { + let conn = self.conn.lock().expect("store lock poisoned"); + conn.execute( + "UPDATE watches SET last_hash = ?2, last_seen_gen = ?3 WHERE id = ?1", + params![id, hash, generation], + )?; + Ok(()) + } + + // ── export / import (sovereignty) ────────────────────────────────── + + /// Dump the whole store as a plain-JSON document. + /// + /// # Errors + /// [`StoreError`] on SQLite failure. + pub fn export_json(&self) -> Result { + let dump = StoreDump { + schema_version: SCHEMA_VERSION, + last_generation: self.last_generation(), + reminders: { + let conn = self.conn.lock().expect("store lock poisoned"); + let mut stmt = conn.prepare( + "SELECT id, text, due, recurrence, created_gen, done_gen FROM reminders ORDER BY id", + )?; + let rows = stmt + .query_map([], row_to_reminder)? + .collect::, _>>()?; + rows + }, + countdowns: { + let conn = self.conn.lock().expect("store lock poisoned"); + let mut stmt = conn.prepare( + "SELECT id, label, start_date, end_date, total_work_days, display, created_gen, retired_gen + FROM countdowns ORDER BY id", + )?; + let rows = stmt + .query_map([], row_to_countdown)? + .collect::, _>>()?; + rows + }, + watches: { + let conn = self.conn.lock().expect("store lock poisoned"); + let mut stmt = conn.prepare( + "SELECT id, url, note, last_hash, last_seen_gen, created_gen FROM watches ORDER BY id", + )?; + let rows = stmt + .query_map([], row_to_watch)? + .collect::, _>>()?; + rows + }, + }; + Ok(serde_json::to_string_pretty(&dump).unwrap_or_else(|_| "{}".to_string())) + } + + /// Import a [`Self::export_json`] dump (appends; ids are reassigned). + /// + /// # Errors + /// [`StoreError::Import`] on malformed payloads, otherwise SQLite errors. + pub fn import_json(&self, json: &str) -> Result<(), StoreError> { + let dump: StoreDump = + serde_json::from_str(json).map_err(|e| StoreError::Import(e.to_string()))?; + for r in &dump.reminders { + let id = self.reminder_add( + &r.text, + r.due.as_deref(), + r.recurrence.as_deref(), + r.created_gen, + )?; + if let Some(done) = r.done_gen { + self.reminder_done(id, done)?; + } + } + for c in &dump.countdowns { + let id = self.countdown_add( + &c.label, + &c.start_date, + &c.end_date, + c.total_work_days, + Some(&c.display), + c.created_gen, + )?; + if let Some(retired) = c.retired_gen { + self.countdown_retire(id, retired)?; + } + } + for w in &dump.watches { + let id = self.watch_add(&w.url, &w.note, w.created_gen)?; + if let (Some(hash), Some(gen)) = (&w.last_hash, w.last_seen_gen) { + self.watch_seen(id, hash, gen)?; + } + } + Ok(()) + } +} + +fn row_to_reminder(row: &rusqlite::Row<'_>) -> rusqlite::Result { + Ok(Reminder { + id: row.get(0)?, + text: row.get(1)?, + due: row.get(2)?, + recurrence: row.get(3)?, + created_gen: row.get(4)?, + done_gen: row.get(5)?, + }) +} + +fn row_to_countdown(row: &rusqlite::Row<'_>) -> rusqlite::Result { + Ok(StoredCountdown { + id: row.get(0)?, + label: row.get(1)?, + start_date: row.get(2)?, + end_date: row.get(3)?, + total_work_days: row.get(4)?, + display: row.get(5)?, + created_gen: row.get(6)?, + retired_gen: row.get(7)?, + }) +} + +fn row_to_watch(row: &rusqlite::Row<'_>) -> rusqlite::Result { + Ok(Watch { + id: row.get(0)?, + url: row.get(1)?, + note: row.get(2)?, + last_hash: row.get(3)?, + last_seen_gen: row.get(4)?, + created_gen: row.get(5)?, + }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn reminder_lifecycle() { + let store = Store::in_memory().unwrap(); + let id = store + .reminder_add("rotate the pagerduty token", Some("2026-06-10"), None, 3) + .unwrap(); + let daily = store + .reminder_add("check the board", None, Some("daily"), 3) + .unwrap(); + + let open = store.reminders_open().unwrap(); + assert_eq!(open.len(), 2); + assert_eq!(open[0].text, "rotate the pagerduty token"); + assert_eq!(open[0].due.as_deref(), Some("2026-06-10")); + assert_eq!(open[0].created_gen, 3); + assert_eq!(open[1].recurrence.as_deref(), Some("daily")); + + assert!(store.reminder_done(id, 5).unwrap()); + assert!(!store.reminder_done(id, 6).unwrap(), "already done"); + assert_eq!(store.reminders_open().unwrap().len(), 1); + let _ = daily; + } + + #[test] + fn countdown_lifecycle_and_default_display() { + let store = Store::in_memory().unwrap(); + let id = store + .countdown_add("PJ onboarding", "2026-06-01", "2026-07-15", 30, None, 1) + .unwrap(); + let active = store.countdowns_active().unwrap(); + assert_eq!(active[0].display, "{label}: work day {n} of {total}"); + assert!(store.countdown_retire(id, 2).unwrap()); + assert!(store.countdowns_active().unwrap().is_empty()); + } + + #[test] + fn watch_lifecycle_records_hash_and_generation() { + let store = Store::in_memory().unwrap(); + let id = store + .watch_add("https://example.com/releases", "new versions", 1) + .unwrap(); + store.watch_seen(id, "abc123", 2).unwrap(); + let watches = store.watches().unwrap(); + assert_eq!(watches[0].last_hash.as_deref(), Some("abc123")); + assert_eq!(watches[0].last_seen_gen, Some(2)); + assert!(store.watch_remove(id).unwrap()); + assert!(store.watches().unwrap().is_empty()); + } + + #[test] + fn generation_persists() { + let store = Store::in_memory().unwrap(); + assert_eq!(store.last_generation(), 0); + store.set_last_generation(42).unwrap(); + assert_eq!(store.last_generation(), 42); + } + + #[test] + fn export_import_round_trips() { + let a = Store::in_memory().unwrap(); + a.reminder_add("alpha", Some("2026-06-10"), None, 1) + .unwrap(); + let done = a.reminder_add("beta", None, Some("weekly"), 1).unwrap(); + a.reminder_done(done, 2).unwrap(); + a.countdown_add( + "ramp", + "2026-06-01", + "2026-07-01", + 20, + Some("{label} {n}/{total}"), + 1, + ) + .unwrap(); + let w = a.watch_add("https://example.com", "note", 1).unwrap(); + a.watch_seen(w, "h1", 2).unwrap(); + a.set_last_generation(2).unwrap(); + + let json = a.export_json().unwrap(); + assert!(json.contains("alpha"), "plain-text export carries content"); + + let b = Store::in_memory().unwrap(); + b.import_json(&json).unwrap(); + assert_eq!(b.reminders_open().unwrap().len(), 1); // beta is done + assert_eq!(b.countdowns_active().unwrap().len(), 1); + assert_eq!(b.watches().unwrap()[0].last_hash.as_deref(), Some("h1")); + } + + #[test] + fn open_creates_parent_dirs_and_reopens() { + let dir = std::env::temp_dir().join(format!( + "modulex-store-test-{}-{}", + std::process::id(), + COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed) + )); + let path = dir.join("nested").join("store.db"); + let store = Store::open(&path).unwrap(); + store.reminder_add("persisted", None, None, 1).unwrap(); + drop(store); + + let reopened = Store::open(&path).unwrap(); + assert_eq!(reopened.reminders_open().unwrap()[0].text, "persisted"); + std::fs::remove_dir_all(&dir).ok(); + } + + static COUNTER: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); + + #[test] + fn resolve_path_order() { + // No env in tests (would race other tests): exercise config + default. + let from_config = Store::resolve_path(Some("/x/store.db"), Some(Path::new("/home/u"))); + assert_eq!(from_config, PathBuf::from("/x/store.db")); + let from_home = Store::resolve_path(None, Some(Path::new("/home/u"))); + assert_eq!(from_home, PathBuf::from("/home/u/.modulex/store.db")); + } +} diff --git a/crates/modulex-mcp/Cargo.toml b/crates/modulex-mcp/Cargo.toml index 7eb941a..ccb6efa 100644 --- a/crates/modulex-mcp/Cargo.toml +++ b/crates/modulex-mcp/Cargo.toml @@ -22,6 +22,7 @@ path = "src/main.rs" anyhow = { workspace = true } clap = { workspace = true } modulex-core = { workspace = true } +serde = { workspace = true } serde_json = { workspace = true } tokio = { workspace = true } diff --git a/crates/modulex-mcp/src/server.rs b/crates/modulex-mcp/src/server.rs index e7d0224..a7f53ca 100644 --- a/crates/modulex-mcp/src/server.rs +++ b/crates/modulex-mcp/src/server.rs @@ -154,9 +154,14 @@ args = ["-c", "echo hi"] [[routines.morning.steps]] name = "deadlines" type = "deadline-calc" + +[[routines.morning.steps]] +name = "agenda" +type = "reminders" "#; - /// A server over a mock spawner so no real process ever runs. + /// A server over a mock spawner (no real processes) and an in-memory + /// store (no filesystem). fn server(outputs: Vec) -> Server { let config = Config::from_toml(TEST_CONFIG).unwrap(); let registry = builtin_registry(); @@ -167,7 +172,8 @@ type = "deadline-calc" let spawner = Arc::new(modulex_core::exec::test_support::MockSpawner::with_outputs( outputs, )); - Server::new(Engine::with_spawner(config, registry, granted, spawner)) + let store = Arc::new(modulex_core::Store::in_memory().unwrap()); + Server::new(Engine::with_spawner(config, registry, granted, spawner).with_store(store)) } fn ok_out(stdout: &str) -> modulex_core::ExecOutput { @@ -200,7 +206,7 @@ type = "deadline-calc" } #[tokio::test] - async fn tools_list_names_all_five_tools() { + async fn tools_list_names_the_full_surface() { let s = server(vec![]); let resp = s .handle(&json!({ "jsonrpc": "2.0", "id": 2, "method": "tools/list" })) @@ -219,11 +225,138 @@ type = "deadline-calc" "routine_list", "step_run", "report_get", - "steps_list" + "steps_list", + "reminder_add", + "reminder_list", + "reminder_done", + "countdown_add", + "countdown_retire", + "watch_add", + "watch_list", + "watch_remove", + "store_export", ] ); } + #[tokio::test] + async fn reminder_lifecycle_over_mcp_stamps_generations() { + let s = server(vec![ok_out("hi\n")]); + // Run once so the current generation is 1. + s.handle(&json!({ + "jsonrpc": "2.0", "id": 1, "method": "tools/call", + "params": { "name": "routine_run", "arguments": { "routine": "morning" } } + })) + .await + .unwrap(); + + // Register a reminder — stamped "after run 1". + let resp = s + .handle(&json!({ + "jsonrpc": "2.0", "id": 2, "method": "tools/call", + "params": { "name": "reminder_add", + "arguments": { "text": "rotate the token", "due": "2026-06-10" } } + })) + .await + .unwrap(); + assert!(resp["result"].get("isError").is_none()); + let created: Value = + serde_json::from_str(resp["result"]["content"][0]["text"].as_str().unwrap()).unwrap(); + assert_eq!(created["created_gen"], 1); + let id = created["id"].as_i64().unwrap(); + + // It lists as open… + let resp = s + .handle(&json!({ + "jsonrpc": "2.0", "id": 3, "method": "tools/call", + "params": { "name": "reminder_list" } + })) + .await + .unwrap(); + let open: Value = + serde_json::from_str(resp["result"]["content"][0]["text"].as_str().unwrap()).unwrap(); + assert_eq!(open[0]["text"], "rotate the token"); + + // …surfaces in the reminders step of the NEXT run… + let resp = s + .handle(&json!({ + "jsonrpc": "2.0", "id": 4, "method": "tools/call", + "params": { "name": "step_run", + "arguments": { "routine": "morning", "step": "agenda" } } + })) + .await + .unwrap(); + let text = resp["result"]["content"][0]["text"].as_str().unwrap(); + assert!(text.contains("rotate the token"), "got: {text}"); + + // …and double-done is an error. + let resp = s + .handle(&json!({ + "jsonrpc": "2.0", "id": 5, "method": "tools/call", + "params": { "name": "reminder_done", "arguments": { "id": id } } + })) + .await + .unwrap(); + assert!(resp["result"].get("isError").is_none()); + let resp = s + .handle(&json!({ + "jsonrpc": "2.0", "id": 6, "method": "tools/call", + "params": { "name": "reminder_done", "arguments": { "id": id } } + })) + .await + .unwrap(); + assert_eq!(resp["result"]["isError"], true); + } + + #[tokio::test] + async fn watch_and_countdown_tools_round_trip() { + let s = server(vec![]); + let resp = s + .handle(&json!({ + "jsonrpc": "2.0", "id": 1, "method": "tools/call", + "params": { "name": "watch_add", + "arguments": { "url": "https://example.com/releases", + "note": "new versions" } } + })) + .await + .unwrap(); + assert!(resp["result"].get("isError").is_none()); + + // Non-http URLs are rejected before the store. + let resp = s + .handle(&json!({ + "jsonrpc": "2.0", "id": 2, "method": "tools/call", + "params": { "name": "watch_add", "arguments": { "url": "file:///etc/passwd" } } + })) + .await + .unwrap(); + assert_eq!(resp["result"]["isError"], true); + + let resp = s + .handle(&json!({ + "jsonrpc": "2.0", "id": 3, "method": "tools/call", + "params": { "name": "countdown_add", + "arguments": { "label": "ramp", "start_date": "2026-06-01", + "end_date": "2026-07-15" } } + })) + .await + .unwrap(); + assert!(resp["result"].get("isError").is_none()); + + // Export carries everything as plain JSON (sovereignty). + let resp = s + .handle(&json!({ + "jsonrpc": "2.0", "id": 4, "method": "tools/call", + "params": { "name": "store_export" } + })) + .await + .unwrap(); + let dump: Value = + serde_json::from_str(resp["result"]["content"][0]["text"].as_str().unwrap()).unwrap(); + assert_eq!(dump["watches"][0]["url"], "https://example.com/releases"); + assert_eq!(dump["countdowns"][0]["label"], "ramp"); + } + #[tokio::test] async fn routine_run_returns_report_text_without_is_error() { let s = server(vec![ok_out("hi\n")]); @@ -338,7 +471,7 @@ type = "deadline-calc" let payload: Value = serde_json::from_str(resp["result"]["content"][0]["text"].as_str().unwrap()).unwrap(); assert_eq!(payload["routines"][0]["name"], "morning"); - assert_eq!(payload["routines"][0]["steps"], 2); + assert_eq!(payload["routines"][0]["steps"], 3); let resp = s .handle(&json!({ diff --git a/crates/modulex-mcp/src/tools.rs b/crates/modulex-mcp/src/tools.rs index 0adec8b..2384a2d 100644 --- a/crates/modulex-mcp/src/tools.rs +++ b/crates/modulex-mcp/src/tools.rs @@ -87,6 +87,93 @@ pub fn tool_specs() -> Value { "name": "steps_list", "description": "List registered step types (builtin plus plugins).", "inputSchema": { "type": "object", "properties": {} } + }, + { + "name": "reminder_add", + "description": "Register a reminder ('remind me of X') in the agent state \ + store. It surfaces in every `reminders` step until marked done.", + "inputSchema": { + "type": "object", + "properties": { + "text": { "type": "string" }, + "due": { "type": "string", "description": "Optional ISO date YYYY-MM-DD" }, + "recurrence": { "type": "string", "enum": ["daily", "weekly", "monthly"] } + }, + "required": ["text"] + } + }, + { + "name": "reminder_list", + "description": "List open reminders from the agent state store.", + "inputSchema": { "type": "object", "properties": {} } + }, + { + "name": "reminder_done", + "description": "Mark a reminder done (by id from reminder_list).", + "inputSchema": { + "type": "object", + "properties": { "id": { "type": "integer" } }, + "required": ["id"] + } + }, + { + "name": "countdown_add", + "description": "Register a countdown (work-day progress) in the agent state \ + store; merged with config countdowns by the countdown-calc step.", + "inputSchema": { + "type": "object", + "properties": { + "label": { "type": "string" }, + "start_date": { "type": "string", "description": "ISO date" }, + "end_date": { "type": "string", "description": "ISO date; expires after" }, + "total_work_days": { "type": "integer", "default": 30 }, + "display": { "type": "string", + "description": "Template with {label} {n} {total}" } + }, + "required": ["label", "start_date", "end_date"] + } + }, + { + "name": "countdown_retire", + "description": "Retire a stored countdown (by id).", + "inputSchema": { + "type": "object", + "properties": { "id": { "type": "integer" } }, + "required": ["id"] + } + }, + { + "name": "watch_add", + "description": "Register an http(s) URL for change tracking. The url-watch \ + step fetches it (net-leashed, SSRF-screened) and reports changes.", + "inputSchema": { + "type": "object", + "properties": { + "url": { "type": "string" }, + "note": { "type": "string" } + }, + "required": ["url"] + } + }, + { + "name": "watch_list", + "description": "List registered URL watches.", + "inputSchema": { "type": "object", "properties": {} } + }, + { + "name": "watch_remove", + "description": "Remove a URL watch (by id).", + "inputSchema": { + "type": "object", + "properties": { "id": { "type": "integer" } }, + "required": ["id"] + } + }, + { + "name": "store_export", + "description": "Export the whole agent state store as plain JSON \ + (sovereignty: the content is never locked into SQLite).", + "inputSchema": { "type": "object", "properties": {} } } ]) } @@ -113,9 +200,167 @@ fn engine_fault(e: &EngineError) -> ToolOutcome { ToolOutcome::err(e.to_string()) } +/// The store handle, or the standard fault when it's unavailable. +fn store_of(engine: &Engine) -> Result<&std::sync::Arc, ToolOutcome> { + engine.store().ok_or_else(|| { + ToolOutcome::err("agent state store unavailable (could not be opened at startup)") + }) +} + +/// Unify `Result` into a tool outcome. +fn store_outcome( + result: Result, +) -> ToolOutcome { + match result { + Ok(value) => { + ToolOutcome::ok(serde_json::to_string(&value).unwrap_or_else(|_| "{}".to_string())) + } + Err(e) => ToolOutcome::err(e.to_string()), + } +} + /// Dispatch one tool call against the engine. +#[allow(clippy::too_many_lines)] // a flat tool dispatch reads better unsplit pub async fn call(engine: &Engine, name: &str, args: &Value) -> ToolOutcome { + // Mutation stamps: the generation current at call time — "registered + // after run N". A counter, never a clock. + let generation = engine.current_generation(); match name { + "reminder_add" => { + let store = match store_of(engine) { + Ok(store) => store, + Err(fault) => return fault, + }; + let Some(text) = args.get("text").and_then(Value::as_str) else { + return ToolOutcome::err("reminder_add requires `text`"); + }; + store_outcome( + store + .reminder_add( + text, + args.get("due").and_then(Value::as_str), + args.get("recurrence").and_then(Value::as_str), + generation, + ) + .map(|id| serde_json::json!({ "id": id, "created_gen": generation })), + ) + } + "reminder_list" => { + let store = match store_of(engine) { + Ok(store) => store, + Err(fault) => return fault, + }; + store_outcome(store.reminders_open()) + } + "reminder_done" => { + let store = match store_of(engine) { + Ok(store) => store, + Err(fault) => return fault, + }; + let Some(id) = args.get("id").and_then(Value::as_i64) else { + return ToolOutcome::err("reminder_done requires integer `id`"); + }; + match store.reminder_done(id, generation) { + Ok(true) => ToolOutcome::ok(format!("reminder #{id} done")), + Ok(false) => ToolOutcome::err(format!("no open reminder #{id}")), + Err(e) => ToolOutcome::err(e.to_string()), + } + } + "countdown_add" => { + let store = match store_of(engine) { + Ok(store) => store, + Err(fault) => return fault, + }; + let (Some(label), Some(start), Some(end)) = ( + args.get("label").and_then(Value::as_str), + args.get("start_date").and_then(Value::as_str), + args.get("end_date").and_then(Value::as_str), + ) else { + return ToolOutcome::err( + "countdown_add requires `label`, `start_date`, `end_date`", + ); + }; + let total = args + .get("total_work_days") + .and_then(Value::as_u64) + .and_then(|n| u32::try_from(n).ok()) + .unwrap_or(30); + store_outcome( + store + .countdown_add( + label, + start, + end, + total, + args.get("display").and_then(Value::as_str), + generation, + ) + .map(|id| serde_json::json!({ "id": id, "created_gen": generation })), + ) + } + "countdown_retire" => { + let store = match store_of(engine) { + Ok(store) => store, + Err(fault) => return fault, + }; + let Some(id) = args.get("id").and_then(Value::as_i64) else { + return ToolOutcome::err("countdown_retire requires integer `id`"); + }; + match store.countdown_retire(id, generation) { + Ok(true) => ToolOutcome::ok(format!("countdown #{id} retired")), + Ok(false) => ToolOutcome::err(format!("no active countdown #{id}")), + Err(e) => ToolOutcome::err(e.to_string()), + } + } + "watch_add" => { + let store = match store_of(engine) { + Ok(store) => store, + Err(fault) => return fault, + }; + let Some(url) = args.get("url").and_then(Value::as_str) else { + return ToolOutcome::err("watch_add requires `url`"); + }; + if !url.starts_with("http://") && !url.starts_with("https://") { + return ToolOutcome::err("watch_add: only http(s) URLs can be watched"); + } + let note = args.get("note").and_then(Value::as_str).unwrap_or(""); + store_outcome( + store + .watch_add(url, note, generation) + .map(|id| serde_json::json!({ "id": id, "created_gen": generation })), + ) + } + "watch_list" => { + let store = match store_of(engine) { + Ok(store) => store, + Err(fault) => return fault, + }; + store_outcome(store.watches()) + } + "watch_remove" => { + let store = match store_of(engine) { + Ok(store) => store, + Err(fault) => return fault, + }; + let Some(id) = args.get("id").and_then(Value::as_i64) else { + return ToolOutcome::err("watch_remove requires integer `id`"); + }; + match store.watch_remove(id) { + Ok(true) => ToolOutcome::ok(format!("watch #{id} removed")), + Ok(false) => ToolOutcome::err(format!("no watch #{id}")), + Err(e) => ToolOutcome::err(e.to_string()), + } + } + "store_export" => { + let store = match store_of(engine) { + Ok(store) => store, + Err(fault) => return fault, + }; + match store.export_json() { + Ok(json) => ToolOutcome::ok(json), + Err(e) => ToolOutcome::err(e.to_string()), + } + } "routine_run" => { let Some(routine) = args.get("routine").and_then(Value::as_str) else { return ToolOutcome::err("routine_run requires `routine`"); diff --git a/modulex.toml.example b/modulex.toml.example index f63a110..4677eb4 100644 --- a/modulex.toml.example +++ b/modulex.toml.example @@ -73,7 +73,20 @@ name = "unpushed" type = "git-unpushed" parallel = true -# --- Phase: deadlines & countdowns (pure) --- +# --- Phase: agent state (reminders + watched pages) --- +# Agents register these at any time via MCP tools (reminder_add, watch_add, +# countdown_add, ...) or `modulex remind add` — no config edits. State lives +# in the store ($MODULEX_STORE → [store] path → ~/.modulex/store.db). + +[[routines.morning.steps]] +name = "reminders" +type = "reminders" + +[[routines.morning.steps]] +name = "watched pages" +type = "url-watch" # leashed in-proc fetch: net Caveats axis + SSRF screening + +# --- Phase: deadlines & countdowns (config + store, merged) --- [[routines.morning.steps]] name = "deadlines"