From 23aea1195d78a9faa1b80a59976bf7b51bc106c0 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Tue, 24 Nov 2026 20:02:46 +0100 Subject: [PATCH] refactor(claw): carry the tool seam the 0.4.2 line removed The 0.4.2 line deletes the resident tool machinery from rhema-autonomous-agent. The claw was its only consumer, so the registry, the TOOL.yaml loader, the allowlist, and the resolver chain now live in `toolkit`, beside the manifests and builtins that feed them. The shapes do not change; only the owner does. The compiler marked the rest of the release's edges: - The resolver seam grew `resolve_streaming`, so the chain returns the shell's output as deltas and a filtered registry still answers the plain call. - `ShellExecutor::run` now takes a `RunRequest` and a `ToolProgress` sink. The sandbox adapter re-roots the request for the wrapped sandbox and relays its `RunOutcome`; `Sandbox::exec` became `Sandbox::run`, so the seed probe follows. - `SandboxError::OutOfMemory` joins the error mapping. - `rhema_core::paste` left the engine with the display encodings, so `paste` here carries the span record, the annotation, and the legacy migration. A stash from either line loads unchanged. - `rhema_bash::exec` no longer re-exports `async_trait`; the tool modules import it from the crate. The dependency pins and both integrations move to 0.4.2 together; the lock refreshes with them. --- Cargo.lock | 1239 ++++++++++++++++- crates/rhema-claw/Cargo.toml | 37 +- crates/rhema-claw/src/accounts_tools.rs | 18 +- crates/rhema-claw/src/attachments.rs | 11 +- crates/rhema-claw/src/bootstrap.rs | 10 +- crates/rhema-claw/src/consents.rs | 11 +- crates/rhema-claw/src/extension.rs | 9 +- crates/rhema-claw/src/handler.rs | 4 +- crates/rhema-claw/src/hub.rs | 2 +- crates/rhema-claw/src/identity.rs | 11 +- crates/rhema-claw/src/interactive.rs | 24 +- crates/rhema-claw/src/job_tools.rs | 8 +- crates/rhema-claw/src/lib.rs | 2 + crates/rhema-claw/src/notify_tools.rs | 14 +- crates/rhema-claw/src/paste.rs | 215 +++ crates/rhema-claw/src/phone.rs | 11 +- crates/rhema-claw/src/sandbox.rs | 47 +- crates/rhema-claw/src/task_tools.rs | 23 +- crates/rhema-claw/src/toolkit.rs | 680 +++++++++ crates/rhema-claw/src/watch_tools.rs | 22 +- crates/rhema-claw/tests/http.rs | 10 +- .../rhema-calendar-integration/Cargo.toml | 4 +- .../rhema-forge-integration/Cargo.toml | 2 +- 23 files changed, 2208 insertions(+), 206 deletions(-) create mode 100644 crates/rhema-claw/src/paste.rs create mode 100644 crates/rhema-claw/src/toolkit.rs diff --git a/Cargo.lock b/Cargo.lock index 8eb329c..d9de4b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1973cfbc1a2daf9cf550e74e1f088c28e7f7d8c1e1418fb6c9dc5184b7e84c99" +dependencies = [ + "crypto-common 0.2.2", + "inout", +] + [[package]] name = "aes" version = "0.9.4" @@ -11,6 +21,22 @@ dependencies = [ "cipher", "cpubits", "cpufeatures 0.3.1", + "zeroize", +] + +[[package]] +name = "aes-gcm" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2b8006a0c83f52b62ba44a97b58bf76fe2f70a329e588f67f89691d93d498f" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ctutils", + "ghash", + "zeroize", ] [[package]] @@ -22,6 +48,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "1.0.0" @@ -83,6 +118,18 @@ dependencies = [ "security-framework", ] +[[package]] +name = "argon2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c52ddac6d63c576bef8168db10c83c49c26444ecbc68060fef078925a901c" +dependencies = [ + "base64ct", + "blake2", + "cpufeatures 0.3.1", + "password-hash", +] + [[package]] name = "assert-json-diff" version = "2.0.2" @@ -333,6 +380,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "base16ct" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd307490d624467aa6f74b0eabb77633d1f758a7b25f12bceb0b22e08d9726f6" + [[package]] name = "base64" version = "0.22.1" @@ -345,12 +398,38 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bcrypt-pbkdf" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "144e573728da132683b9488acd528274c790e07fc06ff81ee29f9d8f8b1041e0" +dependencies = [ + "blowfish", + "pbkdf2", + "sha2 0.11.1", +] + [[package]] name = "bitflags" version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +[[package]] +name = "blake2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5d4d889834ee8ecfc0f8426ad30faf7cdcb10f741a8e6d7224d95325479f6f" +dependencies = [ + "digest 0.11.3", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -367,6 +446,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" dependencies = [ "hybrid-array", + "zeroize", ] [[package]] @@ -391,6 +471,26 @@ dependencies = [ "piper", ] +[[package]] +name = "blowfish" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62ce3946557b35e71d1bbe07ec385073ce9eda05043f95de134eb578fcf1a298" +dependencies = [ + "byteorder", + "cipher", +] + +[[package]] +name = "bstr" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a680398c10c7bc0488067c4612226ea905a85f607134b69f3068d505d58c4214" +dependencies = [ + "memchr", + "serde_core", +] + [[package]] name = "bumpalo" version = "3.20.4" @@ -449,8 +549,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ "cfg-if", + "cipher", "cpufeatures 0.3.1", "rand_core 0.10.1", + "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", ] [[package]] @@ -459,8 +574,10 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c" dependencies = [ + "block-buffer 0.12.1", "crypto-common 0.2.2", "inout", + "zeroize", ] [[package]] @@ -611,6 +728,23 @@ version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" +[[package]] +name = "crypto-bigint" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914c195c4d7fbc5ed7f88d14cbf85914d5c664967658d43404b263913a477e82" +dependencies = [ + "cpubits", + "ctutils", + "getrandom 0.4.3", + "hybrid-array", + "num-traits", + "rand_core 0.10.1", + "serdect", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.7" @@ -627,7 +761,28 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" dependencies = [ + "getrandom 0.4.3", "hybrid-array", + "rand_core 0.10.1", +] + +[[package]] +name = "crypto-primes" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3633a51a39c69ebbaa4feaa694bd83d241e4093901c84a0963b19d9bb3f0cf8f" +dependencies = [ + "crypto-bigint", + "rand_core 0.10.1", +] + +[[package]] +name = "ctr" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baaca1c4b237092596f64d571e9db6ce4109c4ef9742e27590f1709594461f21" +dependencies = [ + "cipher", ] [[package]] @@ -637,8 +792,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f" dependencies = [ "cmov", + "subtle", ] +[[package]] +name = "curve25519-dalek" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eed333089e2e1c1ac8c6c0398e5e2497b4c9926ca6d0365ed1e099afa5bc23" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "curve25519-dalek-derive", + "digest 0.11.3", + "fiat-crypto", + "rand_core 0.10.1", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + [[package]] name = "deadpool" version = "0.12.3" @@ -657,6 +847,28 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" +[[package]] +name = "delegate" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "780eb241654bf097afb00fc5f054a09b687dad862e485fdcf8399bb056565370" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "der" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a996a108feb8b427a6e12fcf6af4aa83409b79d72c15337d7741368131ee004" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + [[package]] name = "deranged" version = "0.5.9" @@ -666,6 +878,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "des" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "916a94e407b54f9034d71dd748234cd1e516ced6284009906ae246f177eafe5a" +dependencies = [ + "cipher", +] + [[package]] name = "digest" version = "0.10.7" @@ -686,6 +907,7 @@ dependencies = [ "const-oid", "crypto-common 0.2.2", "ctutils", + "zeroize", ] [[package]] @@ -705,6 +927,69 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "ecdsa" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0681a4fc24c767085329728d8dfba959af91228aa4610cca4f8ce317ba46ae0" +dependencies = [ + "der", + "digest 0.11.3", + "elliptic-curve", + "rfc6979", + "signature", + "spki", + "zeroize", +] + +[[package]] +name = "ed25519" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29fcf32e6c73d1079f83ab4d782de2d81620346a5f38c6237a86a22f8368980a" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ebaa1a2bf1290ab3bfe5a7b771d050ebffab2711c19a81691c683a5144a25de" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core 0.10.1", + "serde", + "sha2 0.11.1", + "signature", + "subtle", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900f37e7e18d74a2347389af6cd69e3a30d5cc9e697f40004865679aa75e9c7c" +dependencies = [ + "base16ct", + "crypto-bigint", + "crypto-common 0.2.2", + "digest 0.11.3", + "ff", + "group", + "hkdf", + "hybrid-array", + "pem-rfc7468", + "pkcs8", + "rand_core 0.10.1", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "encoding_rs" version = "0.8.44" @@ -725,6 +1010,18 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "enumflags2" version = "0.7.12" @@ -800,6 +1097,22 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" +[[package]] +name = "ff" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f686ab92a9fb0eaf188f6c6c87b89490baa6fdb0db4544ba4dc47f7942489f" +dependencies = [ + "rand_core 0.10.1", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64cd1e32ddd350061ae6edb1b082d7c54915b5c672c389143b9a63403a109f24" + [[package]] name = "find-msvc-tools" version = "0.1.15" @@ -986,6 +1299,40 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ghash" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eecf2d5dc9b66b732b97707a0210906b1d30523eb773193ab777c0c84b3e8d5" +dependencies = [ + "polyval", + "zeroize", +] + +[[package]] +name = "globset" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71217a07f20b48b4938c14203b77b610f8a7fa6762c3f75394a10c5f31e5aee0" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "group" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd1a1c7a5206c5b7a3f5a0d7ccd3ff85d0c8f5133d62a02680255b0004af5f4" +dependencies = [ + "ff", + "rand_core 0.10.1", + "subtle", +] + [[package]] name = "h2" version = "0.4.20" @@ -1050,6 +1397,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-literal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e712f64ec3850b98572bffac52e2c6f282b29fe6c5fa6d42334b30be438d95c1" + [[package]] name = "hkdf" version = "0.13.0" @@ -1119,7 +1472,10 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" dependencies = [ + "ctutils", + "subtle", "typenum", + "zeroize", ] [[package]] @@ -1202,6 +1558,30 @@ dependencies = [ "windows-registry", ] +[[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.4.0" @@ -1414,6 +1794,26 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "keccak" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8f198d1db720e4940b5a493201d199d9f24f568f8f746bd13706243a2f71598" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", +] + +[[package]] +name = "kem" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01737161ba802849cfd486b5bd209d38ba4943494c249a8126005170c7621edd" +dependencies = [ + "crypto-common 0.2.2", + "rand_core 0.10.1", +] + [[package]] name = "keyring" version = "4.2.0" @@ -1447,6 +1847,18 @@ version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags", + "libc", + "plain", + "redox_syscall", +] + [[package]] name = "libsqlite3-sys" version = "0.38.2" @@ -1499,6 +1911,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "md5" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebb8d8732c6a6df3d8f032a82911cfc747e00efb95cc46e8d0acd5b5b88570c" + [[package]] name = "memchr" version = "2.8.3" @@ -1540,6 +1958,32 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "ml-kem" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84ca78b66f46050d49fa21693ae8adab2081d8101b65d8067316b6b70b64a0d1" +dependencies = [ + "hybrid-array", + "kem", + "module-lattice", + "pkcs8", + "rand_core 0.10.1", + "sha3", + "shake", +] + +[[package]] +name = "module-lattice" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e412c8ee83a1c678f427806219c49c96b2511b9f07497514f0e43fb26155" +dependencies = [ + "ctutils", + "hybrid-array", + "num-traits", +] + [[package]] name = "multiversion_no_op" version = "1.0.0" @@ -1563,13 +2007,25 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nix" +version = "0.31.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc81ce8148d3b4f3274da811f11cdd824ae661ee4ef732cdb229825cf5be7f7" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "num" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ - "num-bigint", + "num-bigint 0.4.8", "num-complex", "num-integer", "num-iter", @@ -1587,6 +2043,18 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e7820bc0a80a0238e650327316f929ba18d5be054b647490a3a6a339f3e7c0" +dependencies = [ + "num-integer", + "num-traits", + "rand 0.10.4", + "rand_core 0.10.1", +] + [[package]] name = "num-complex" version = "0.4.6" @@ -1627,7 +2095,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "num-bigint", + "num-bigint 0.4.8", "num-integer", "num-traits", ] @@ -1716,18 +2184,117 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "p256" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c9239b2dbc807adbbe147e8cf72ea7450c3a0aabe62cb8e75ff4ec22e1f72a" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primefield", + "primeorder", + "sha2 0.11.1", +] + +[[package]] +name = "p384" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d17b851e6b3e378ab4ecb07fa2ed23f4d15f075735f8fec9fa1e7bdce5f8301f" +dependencies = [ + "ecdsa", + "elliptic-curve", + "fiat-crypto", + "primefield", + "primeorder", + "sha2 0.11.1", +] + +[[package]] +name = "p521" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad64cc32c2dc466317c12ee5853e61f159f9eab1fe7efade0395dc2e7b43449" +dependencies = [ + "base16ct", + "ecdsa", + "elliptic-curve", + "primefield", + "primeorder", + "sha2 0.11.1", +] + +[[package]] +name = "pageant" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0bc922d9aa8cfcf598de27b3c6122cb2eeda9d6fe71527a22ebcb7f633540ff" +dependencies = [ + "base16ct", + "byteorder", + "bytes", + "delegate", + "futures", + "log", + "rand 0.10.4", + "sha2 0.11.1", + "thiserror", + "tokio", + "windows", + "windows-strings", +] + [[package]] name = "parking" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" +[[package]] +name = "password-hash" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aab41826031698d6ffcd9cff78ef56ef998e39dc7e5067cdfebe373842d4723b" +dependencies = [ + "phc", +] + +[[package]] +name = "pbkdf2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112d82ceb8c5bf524d9af484d4e4970c9fd5a0cc15ba14ad93dccd28873b0629" +dependencies = [ + "digest 0.11.3", + "hmac", +] + +[[package]] +name = "pem-rfc7468" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "phc" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44dc769b75f93afdddd8c7fa12d685292ddeff1e66f7f0f3a234cf1818afe892" +dependencies = [ + "base64ct", + "ctutils", +] + [[package]] name = "pin-project-lite" version = "0.2.18" @@ -1745,12 +2312,57 @@ dependencies = [ "futures-io", ] +[[package]] +name = "pkcs1" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6250dd7321adbe93d12b750aee0ced159fd13e77f625edcdf1cb6f83cd99f650" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkcs5" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63d440a804ec8d6fafbb6b84471e013286658d373248927692ab3366686220ca" +dependencies = [ + "aes", + "aes-gcm", + "cbc", + "der", + "pbkdf2", + "rand_core 0.10.1", + "scrypt", + "sha2 0.11.1", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7" +dependencies = [ + "der", + "pkcs5", + "rand_core 0.10.1", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + [[package]] name = "polling" version = "3.11.0" @@ -1765,6 +2377,29 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "poly1305" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2d0073b297041425c7c3df6eb4792d598a15323fe63346852b092eca02904c" +dependencies = [ + "cpufeatures 0.3.1", + "universal-hash", + "zeroize", +] + +[[package]] +name = "polyval" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0fa31d631f2b2cb2a544d0aa321ce847a94764d701ca2becc411138b93d49cd" +dependencies = [ + "cpubits", + "cpufeatures 0.3.1", + "universal-hash", + "zeroize", +] + [[package]] name = "potential_utf" version = "0.1.6" @@ -1789,6 +2424,33 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "primefield" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c555a6e4eb7d4e158fcb028c835c3b8642206ddc279b5c6b202ef9a8bdb592f4" +dependencies = [ + "crypto-bigint", + "crypto-common 0.2.2", + "ff", + "rand_core 0.10.1", + "subtle", + "zeroize", +] + +[[package]] +name = "primeorder" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c9f42978c78a00e3d68f69fc03e57a234debae69da4020a4fb588fcdcd07b06" +dependencies = [ + "elliptic-curve", + "once_cell", + "primefield", + "serdect", + "wnaf", +] + [[package]] name = "proc-macro-crate" version = "3.5.0" @@ -1944,6 +2606,15 @@ dependencies = [ "rand_core 0.10.1", ] +[[package]] +name = "redox_syscall" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" version = "1.13.2" @@ -2065,26 +2736,33 @@ dependencies = [ ] [[package]] -name = "rhema-autonomous-agent" -version = "0.4.1" +name = "rfc6979" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46677fb855ebb628da602111fa2595ad363401c7101c07f07a602dbc86a1dd8a" +checksum = "b4a459cddafb3fe76b31fd8f1108007566c40301feb64dc7b54656eb7388172b" +dependencies = [ + "crypto-bigint", + "hmac", +] + +[[package]] +name = "rhema-autonomous-agent" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b195f903228731ff75183609970aa7177963f5cc3691b250378474dcbebef0" dependencies = [ "async-trait", "rhema-core", "rhema-rsd", - "serde", - "serde_json", - "serde_yaml", "thiserror", "tokio", ] [[package]] name = "rhema-bash" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0aacc9aac461f674ec7f72dc321b11edc4c7868d3c635c2b1c58dbd9256c80" +checksum = "14bc9f013dd5b0329965d76ad929021822e4662991a26ce1d4d07c45486ac291" dependencies = [ "async-trait", "base64 0.22.1", @@ -2167,9 +2845,9 @@ dependencies = [ [[package]] name = "rhema-config" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a05d1d30472d7ea03685806b69e0e9984744b0349cc7c7ad53497916b6c2be1" +checksum = "657d715fca5fe5c427e2758cbf03fd0ee226dd91132e307cd1afce325deede71" dependencies = [ "keyring", "rhema-core", @@ -2181,9 +2859,9 @@ dependencies = [ [[package]] name = "rhema-core" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de9d3c12019209170cbf82fa75dcad4ec10c3c712f7235d9f9a60f165cab5d8c" +checksum = "f51de499b6402a10596c7a5b9646009603b3de1e5678bf236e8d808f89d7446f" dependencies = [ "async-trait", "serde", @@ -2207,9 +2885,9 @@ dependencies = [ [[package]] name = "rhema-host-agent" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "973dc8ee54a24065c7996b23e0cfd2eba715687394a248583582faca3d7a5c4c" +checksum = "86d64b9f54589857b49eeed7e6cf19dffea688e20003f47601bf0fd54e930377" dependencies = [ "minijinja", "rhema-bash", @@ -2218,6 +2896,7 @@ dependencies = [ "rhema-prompt", "rhema-session-store", "rhema-session-store-file", + "rhema-skills", "rhema-transcript", "serde", "serde_json", @@ -2227,9 +2906,9 @@ dependencies = [ [[package]] name = "rhema-identity" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3188f0fec1338df315c76034909e8ff7c1314a84ff6dd0ac11793d605d655b5b" +checksum = "7724fb9b693cc0721eda5ba1612e8e8420b503f6cd72365413e78ab529a8437b" dependencies = [ "rusqlite", "serde", @@ -2238,9 +2917,9 @@ dependencies = [ [[package]] name = "rhema-mcp" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd8f9ee0b0699c09efb303dfc17ed3049aabc8a7b3e01d211de283c43c8c19b" +checksum = "f3762bf1c07ac649d5aad168eb7470871bfb0a53799b0eac06742e6fe826b3ed" dependencies = [ "async-stream", "axum", @@ -2265,9 +2944,9 @@ dependencies = [ [[package]] name = "rhema-memory" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abdfee3e709305e86cedc3e60ca59776af512b2bf520ab87d7da1d184f01d560" +checksum = "6caacb93f3c7188ac8d269422320a4ac6d917f9f390386644bf78f96e29191b3" dependencies = [ "async-trait", "rhema-core", @@ -2279,22 +2958,21 @@ dependencies = [ [[package]] name = "rhema-prompt" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ecbf1ae5d134d110c8f3b4c47ad2331f703bd7bb1ad6d53b4108787d894c8bd" +checksum = "4f92b7fb63f5cc47469284bf34c45d457e48c6307c7e169c8e80a3600b4a4694" dependencies = [ "minijinja", "rhema-core", - "serde", + "rhema-skills", "serde_json", - "serde_yaml", ] [[package]] name = "rhema-provider" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15855c3fa2d858622cd55bd6323d4a7533066e52a74e3dc440ffe69c12ed1263" +checksum = "a0747c23b7a2974e21405e972771aefdf96bbdd3cfeaaec8ab589cf52506c78b" dependencies = [ "async-trait", "futures-core", @@ -2308,9 +2986,9 @@ dependencies = [ [[package]] name = "rhema-provider-anthropic" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "223a60c52ce2e548f72a9f2cce6f7a48be954bd3e5b959ff70d308b3d42d6425" +checksum = "47f8b4621b5f252d2b1b0dc833adc93e57850109ef82969fe526d7b5c28e0671" dependencies = [ "async-trait", "futures-util", @@ -2324,9 +3002,9 @@ dependencies = [ [[package]] name = "rhema-provider-chatgpt" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec84f3f5601e8ca6e69f92a291480842058352bb580b985ec23db713505b8f5d" +checksum = "be081c311c3944e80ecedeb35f7bd1b759a6e67a18131d7d6f111f6ddfa7eb47" dependencies = [ "async-trait", "base64 0.22.1", @@ -2343,9 +3021,9 @@ dependencies = [ [[package]] name = "rhema-provider-copilot" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6685a56017c7de21d17384d25f941f2733526d581dfafc5cd7371d4f6e82096" +checksum = "2777401558ef1501786a184ff61e5ace54f5833d796069671de24bc12ebcce89" dependencies = [ "async-trait", "futures-util", @@ -2362,9 +3040,9 @@ dependencies = [ [[package]] name = "rhema-provider-google" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "749f27fcf2ad1c7745cabc85e56d05e116bce30b6be317910f0c455ba4147ff9" +checksum = "3100f54086765196c23fcbd7b2b5dccb493e025a33c9c9b8ffa4b02170a3b3d5" dependencies = [ "async-trait", "futures-util", @@ -2378,9 +3056,9 @@ dependencies = [ [[package]] name = "rhema-provider-llama-cpp" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf5d26ec681baac6b8c6fc752470a78205acb11f763987bf571fa54be1195e2a" +checksum = "4c5a71591fbf6aa3bb9f373bec064f647f81272c8c3d367ac4b783446861873f" dependencies = [ "async-trait", "futures-util", @@ -2395,9 +3073,9 @@ dependencies = [ [[package]] name = "rhema-provider-mistral" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d8ae3c2c924202d3614987b6b7c4930d84a19ebb2264747bb5100f1f67db7ff" +checksum = "44b86aa34a98038aaf49de500fab2884110c9b0022ff6b20d23ab13d9567618f" dependencies = [ "async-trait", "base64 0.22.1", @@ -2414,9 +3092,9 @@ dependencies = [ [[package]] name = "rhema-provider-openai-compatible" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aab0c24d2d558d66de1f002c250d05c25d9c52038e4fa1890f6c40644c4f9702" +checksum = "5e35f4d305a6ff00f9547f2671a1d4954ef8e6886dcbf4c51e494ee40e25fb69" dependencies = [ "async-trait", "futures-util", @@ -2430,9 +3108,9 @@ dependencies = [ [[package]] name = "rhema-provider-opencode" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb4c641b7997ba5cab41bede6c4b7331baa9a9b2298d5bb0ffbc8844df6dbf3" +checksum = "1761a1eae28b52a2f29e3c08002824e5b93cd2a062443038218d3fff476d7ad4" dependencies = [ "async-trait", "reqwest 0.12.28", @@ -2445,9 +3123,9 @@ dependencies = [ [[package]] name = "rhema-provider-openrouter" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170cef8b456c8f1df1b565d16ad3c61c4b252e521fff16718eacca5d7d98605" +checksum = "65671e35cc068ea8c4cafeaf8e27326ffe19b416ae4956c62e26af43f486c91b" dependencies = [ "async-trait", "futures-util", @@ -2461,9 +3139,9 @@ dependencies = [ [[package]] name = "rhema-provider-registry" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c93ceacbe2332f122b23a11de11ddf4a502a96baaa8c95f33882c5c589581dce" +checksum = "7a45bb694be2a867b2a3031b3d0c835d801a9642250caa995936dadf34b338bd" dependencies = [ "rhema-core", "rhema-provider", @@ -2481,9 +3159,9 @@ dependencies = [ [[package]] name = "rhema-rsd" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e97a9d363b432147220a0646a158ea7a08d6012efa1bedf169fd973721dd745" +checksum = "6d1651f343f455884c7252512d970ae63dfecaa3d305f6e45c507468393b7579" dependencies = [ "rhema-core", "rusqlite", @@ -2494,13 +3172,14 @@ dependencies = [ [[package]] name = "rhema-sandbox" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d5aaa76f2400989439f325754a29593669c1275485796150e19b04277ea54fb" +checksum = "d753773e61931c2de04db246de89b6218bb1d9582d4e289fabb74e922fe4b1de" dependencies = [ "async-trait", "rhema-bash", "rhema-core", + "rhema-skills", "serde", "serde_json", "thiserror", @@ -2509,9 +3188,9 @@ dependencies = [ [[package]] name = "rhema-sandbox-http" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f4cbb9f2238961082a8b406da460c84ced75f4d6bb9e52a79b41dc17065b601" +checksum = "d3c5e5e3e529925becf541a64145e3ecd863277693b845539ad850742f3a383a" dependencies = [ "async-trait", "base64 0.22.1", @@ -2523,21 +3202,23 @@ dependencies = [ [[package]] name = "rhema-sandbox-ssh" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578252c65b6e8047b8f013d2d0a0bd867991b50ed31a530cdfa1304d158a6e65" +checksum = "c35db979910204bd2a828c18befa9c7b0013ff22c0ee093f69f4f47a8c2c9c61" dependencies = [ "async-trait", "base64 0.22.1", "rhema-sandbox", + "russh", + "russh-config", "tokio", ] [[package]] name = "rhema-session-store" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00548f40bf2ec40381d4f9d60a1e136c66d7c4c334097a5eebafe21169915f5c" +checksum = "e5dd8185f1d74fc31a816f0b796ef9edbfd403274c467ee06ed05986f7d7800a" dependencies = [ "rhema-core", "serde", @@ -2547,9 +3228,9 @@ dependencies = [ [[package]] name = "rhema-session-store-file" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df75d21d1ad25b16cb72fc3747d435415e7423872b51fa3751094a5a6e380543" +checksum = "b656d9982c6c2d31af79133d38d64521ee5c27574b51b826336e8d48b3f1264c" dependencies = [ "rhema-config", "rhema-core", @@ -2558,10 +3239,21 @@ dependencies = [ ] [[package]] -name = "rhema-submissions" -version = "0.4.1" +name = "rhema-skills" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba11599010c7537800bee275dd9d414162dd57806b1d75c54ef98f126eb9f65" +checksum = "f291ba6783a523254cdea0d9469f23e7bf4cfd5c030f1e9f421774a757247096" +dependencies = [ + "rhema-core", + "serde", + "serde_yaml", +] + +[[package]] +name = "rhema-submissions" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f7c20c8d0292e5b0c98d0cbfcc1b5aec0977c6ab54cf77c4ff474b2d45ed8d" dependencies = [ "rhema-core", "rhema-session-store", @@ -2572,9 +3264,9 @@ dependencies = [ [[package]] name = "rhema-transcript" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "592b80da0bf1c84e4da814639383dc33c5d2eeee522db5bd93bb779bf0e34e10" +checksum = "2a9d1314414f55b78c8ed69a9c6d05f3bb7bcfa00eab2a38dd9582b860e0a691" dependencies = [ "async-trait", "rhema-core", @@ -2597,6 +3289,27 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rsa" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e77fd77e0dea28b3011fd62d15445b7de7959333b0276d930e03be0f755699" +dependencies = [ + "const-oid", + "crypto-bigint", + "crypto-common 0.2.2", + "crypto-primes", + "digest 0.11.3", + "hmac", + "pkcs1", + "pkcs8", + "rand_core 0.10.1", + "sha2 0.11.1", + "signature", + "spki", + "zeroize", +] + [[package]] name = "rsqlite-vfs" version = "0.1.1" @@ -2622,6 +3335,113 @@ dependencies = [ "sqlite-wasm-rs", ] +[[package]] +name = "russh" +version = "0.65.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "569d8c45e20c123af2fc5ecb4803fde0a98572449ba4c24ed97741d7b02fedf7" +dependencies = [ + "aes", + "bitflags", + "block-padding", + "byteorder", + "bytes", + "cbc", + "cipher", + "crypto-bigint", + "ctr", + "curve25519-dalek", + "data-encoding", + "delegate", + "der", + "digest 0.11.3", + "ecdsa", + "ed25519-dalek", + "elliptic-curve", + "enum_dispatch", + "futures", + "getrandom 0.4.3", + "ghash", + "hex-literal", + "hmac", + "inout", + "keccak", + "log", + "md5", + "ml-kem", + "module-lattice", + "num-bigint 0.5.1", + "p256", + "p384", + "p521", + "pageant", + "pbkdf2", + "pkcs1", + "pkcs5", + "pkcs8", + "polyval", + "rand 0.10.4", + "rand_core 0.10.1", + "ring", + "rsa", + "russh-cryptovec", + "russh-util", + "salsa20", + "scrypt", + "sec1", + "sha1", + "sha2 0.11.1", + "sha3", + "signature", + "spki", + "ssh-encoding", + "ssh-key", + "subtle", + "thiserror", + "tokio", + "typenum", + "universal-hash", + "zeroize", +] + +[[package]] +name = "russh-config" +version = "0.65.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2482e18c04c939c36e1b550d469c3465164af0acad96b7b4d4735d0197d3a529" +dependencies = [ + "futures", + "globset", + "log", + "thiserror", + "tokio", + "whoami", +] + +[[package]] +name = "russh-cryptovec" +version = "0.62.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3aec6cb630dbe85d72ffd7bcd95f07e1bd69f9f270ee8adfa1afe443a6331438" +dependencies = [ + "log", + "nix", + "ssh-encoding", + "windows-sys 0.61.2", +] + +[[package]] +name = "russh-util" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668424a5dde0bcb45b55ba7de8476b93831b4aa2fa6947e145f3b053e22c60b6" +dependencies = [ + "chrono", + "tokio", + "wasm-bindgen", + "wasm-bindgen-futures", +] + [[package]] name = "rustc-hash" version = "2.1.3" @@ -2738,6 +3558,16 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +[[package]] +name = "salsa20" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f874456e72520ff1375a06c588eaf074b0f01f9e9e1aada45bd9b7954a6e42c" +dependencies = [ + "cfg-if", + "cipher", +] + [[package]] name = "same-file" version = "1.0.6" @@ -2762,6 +3592,32 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scrypt" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87af57419b594aa23fa95f09f0e06d80d84ba01c26148c43844cad6ff4485f0" +dependencies = [ + "cfg-if", + "pbkdf2", + "salsa20", + "sha2 0.11.1", +] + +[[package]] +name = "sec1" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56d437c2f19203ce5f7122e507831de96f3d2d4d3be5af44a0b0a09d8a80e4d" +dependencies = [ + "base16ct", + "ctutils", + "der", + "hybrid-array", + "subtle", + "zeroize", +] + [[package]] name = "secret-service" version = "5.2.0" @@ -2900,6 +3756,27 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "serdect" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66cf8fedced2fcf12406bcb34223dffb92eaf34908ede12fed414c82b7f00b3e" +dependencies = [ + "base16ct", + "serde", +] + +[[package]] +name = "sha1" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest 0.11.3", +] + [[package]] name = "sha2" version = "0.10.9" @@ -2922,6 +3799,28 @@ dependencies = [ "digest 0.11.3", ] +[[package]] +name = "sha3" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc9bad02c26382724b2d2692c6f179285e4b54eeecd7968f52a50059c3c11759" +dependencies = [ + "digest 0.11.3", + "keccak", + "sponge-cursor", +] + +[[package]] +name = "shake" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09057cb2149ad4cbd2da1e26b351f9a4c354219421229c69c3063e6f61947c4a" +dependencies = [ + "digest 0.11.3", + "keccak", + "sponge-cursor", +] + [[package]] name = "shlex" version = "2.0.1" @@ -2938,6 +3837,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5" +dependencies = [ + "digest 0.11.3", + "rand_core 0.10.1", +] + [[package]] name = "simd_cesu8" version = "1.2.0" @@ -2976,6 +3885,22 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "spki" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef958a98b9d5da290cfc78946e9f3e61e1e62a18db0d92cac0b83cc161491a9" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sponge-cursor" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0219bd7d979d58245a4f41f695e1ac9f8befdffadd7f61f1bae9e39abc6620" + [[package]] name = "sqlite-wasm-rs" version = "0.5.5" @@ -2988,6 +3913,65 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ssh-cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d801accda99469cde6d73da741422610fdf6508a72d9a69d1b55cb241c720597" +dependencies = [ + "aead", + "aes", + "aes-gcm", + "chacha20", + "cipher", + "ctutils", + "des", + "poly1305", + "ssh-encoding", + "zeroize", +] + +[[package]] +name = "ssh-encoding" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b54d0ed0498daf3f78d82e00e28c8eec9d75a067c4cfbcc7a0f7d0f4077749e" +dependencies = [ + "base64ct", + "bytes", + "crypto-bigint", + "ctutils", + "digest 0.11.3", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "ssh-key" +version = "0.7.0-rc.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0701b552e6bd8f13a6e07bde25307c32d7daad80a79b65832d110c0416e7b638" +dependencies = [ + "argon2", + "bcrypt-pbkdf", + "ctutils", + "ed25519-dalek", + "hex", + "hmac", + "p256", + "p384", + "p521", + "rand_core 0.10.1", + "rsa", + "sec1", + "sha1", + "sha2 0.11.1", + "signature", + "ssh-cipher", + "ssh-encoding", + "zeroize", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -3358,6 +4342,16 @@ version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" +[[package]] +name = "universal-hash" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4987bdc12753382e0bec4a65c50738ffaabc998b9cdd1f952fb5f39b0048a96" +dependencies = [ + "crypto-common 0.2.2", + "ctutils", +] + [[package]] name = "unsafe-libyaml" version = "0.2.11" @@ -3451,6 +4445,12 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" version = "0.2.130" @@ -3570,6 +4570,17 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "whoami" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" +dependencies = [ + "libredox", + "wasite", + "web-sys", +] + [[package]] name = "winapi-util" version = "0.1.11" @@ -3579,6 +4590,73 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-link" version = "0.2.1" @@ -3598,6 +4676,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + [[package]] name = "windows-registry" version = "0.6.1" @@ -3661,6 +4749,15 @@ dependencies = [ "windows_x86_64_msvc", ] +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -3741,6 +4838,18 @@ dependencies = [ "url", ] +[[package]] +name = "wnaf" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "795ca18b3fdb5e62bf982199278341ddcf7ebf7d32e25e212ad05d496e95f6fa" +dependencies = [ + "ff", + "group", + "hybrid-array", + "primefield", +] + [[package]] name = "writeable" version = "0.6.4" diff --git a/crates/rhema-claw/Cargo.toml b/crates/rhema-claw/Cargo.toml index 234b3b0..54be320 100644 --- a/crates/rhema-claw/Cargo.toml +++ b/crates/rhema-claw/Cargo.toml @@ -29,26 +29,25 @@ mock = ["rhema-core/mock"] # shell, the approval seam, and revive-on-resume (rhema-bash), the # system-prompt renderer (rhema-prompt), and the driver that turns a # provider into a host-operating agent (rhema-host-agent) -rhema-bash = "0.4.1" -rhema-prompt = "0.4.1" -rhema-host-agent = "0.4.1" -rhema-autonomous-agent = "0.4.1" -rhema-config = "0.4.1" -rhema-core = "0.4.1" +rhema-bash = "0.4.2" +rhema-prompt = "0.4.2" +rhema-host-agent = "0.4.2" +rhema-autonomous-agent = "0.4.2" +rhema-config = "0.4.2" +rhema-core = "0.4.2" # The bounded request view over the claw sessions, on by default here -rhema-transcript = "0.4.1" +rhema-transcript = "0.4.2" rhema-calendar-integration = { path = "../../integrations/rhema-calendar-integration" } rhema-forge-integration = { path = "../../integrations/rhema-forge-integration" } # The accounts layer: identities hold the forge tokens the watches poll # with, and the identity tools manage them over chat -rhema-identity = "0.4.1" -rhema-rsd = "0.4.1" +rhema-identity = "0.4.2" +rhema-rsd = "0.4.2" # The sandbox seam: where `bash` runs, this host's processes, a daemon -# speaking the wire protocol over HTTP, or an ssh login on a far box -# The private-key seam: the ssh sandbox carries the key text, not a -# path, so a store-held credential has no file to stage. This rides -# the rhema 0.4.2 release; everything else stays on the 0.4.1 line -# until the lockstep bump. +# speaking the wire protocol over HTTP, or an ssh login on a far box. +# The choice carries an ssh private key as text, so a store-held +# credential has no file to stage; that is the seam the 0.4.2 line adds, +# and the family moves to it together. rhema-sandbox = "0.4.2" rhema-sandbox-http = "0.4.2" rhema-sandbox-ssh = "0.4.2" @@ -57,10 +56,10 @@ rhema-sandbox-ssh = "0.4.2" # contract only — never the reverse. rhema-claw-tools-contract = { path = "../../tools/contract" } # The resident tier's durable memory: its tools join the resolver chain -rhema-memory = "0.4.1" +rhema-memory = "0.4.2" # The shared ModelCard the backend registry's listings return -rhema-provider = "0.4.1" -rhema-provider-registry = "0.4.1" +rhema-provider = "0.4.2" +rhema-provider-registry = "0.4.2" # Args for the two-flag binary surface clap = { version = "4.5", features = ["derive"] } serde = { workspace = true } @@ -85,7 +84,7 @@ time = { version = "0.3", default-features = false, features = ["parsing"] } # Inbound chat images ride base64; the dispatch decodes them into the # attachment store base64 = "0.23" -rhema-mcp = "0.4.1" +rhema-mcp = "0.4.2" [dev-dependencies] tempfile = "3" @@ -97,7 +96,7 @@ reqwest = { version = "0.13", features = ["json", "stream"] } bytes = "1" # The scripted provider for turn-level tests; mirrors rhema-code's mock # feature without a feature of our own — tests are the only consumer -rhema-core = { version = "0.4.1", features = ["mock"] } +rhema-core = { version = "0.4.2", features = ["mock"] } tokio = { workspace = true, features = ["rt-multi-thread", "macros", "sync", "time"] } [lints] diff --git a/crates/rhema-claw/src/accounts_tools.rs b/crates/rhema-claw/src/accounts_tools.rs index 4664dfe..8c57d6d 100644 --- a/crates/rhema-claw/src/accounts_tools.rs +++ b/crates/rhema-claw/src/accounts_tools.rs @@ -29,7 +29,8 @@ use std::process::Stdio; use std::sync::Arc; use std::time::Duration; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use rhema_core::{ToolCall, ToolContext, ToolResolver, ToolResult, ToolSpec}; use rhema_identity::{Account, AccountDraft, IdentityStore, Secret, SecretKind}; use serde::Deserialize; @@ -283,8 +284,7 @@ pub const MANIFESTS: &[(&str, &str)] = &[ /// The identity tool set over the account store and the watch table — /// specs from the embedded manifests, operations compiled here. pub fn registry(accounts: Arc, watches: Arc) -> ToolRegistry { - let (tools, skipped) = - rhema_autonomous_agent::manifest::builtin_tools(MANIFESTS, &builtins(accounts, watches)); + let (tools, skipped) = crate::toolkit::builtin_tools(MANIFESTS, &builtins(accounts, watches)); assert!( skipped.is_empty(), "the identity tool manifests must all load: {skipped:?}" @@ -582,7 +582,7 @@ impl ToolResolver for IdentityExec { #[cfg(test)] mod tests { use super::*; - use rhema_autonomous_agent::ToolOp; + use crate::toolkit::ToolOp; fn parts() -> (Arc, Arc) { ( @@ -598,15 +598,13 @@ mod tests { #[test] fn every_manifest_loads_against_its_builtin_and_serves_the_registry() { let (accounts, watches) = parts(); - let (tools, skipped) = rhema_autonomous_agent::manifest::builtin_tools( - MANIFESTS, - &builtins(accounts, watches), - ); + let (tools, skipped) = + crate::toolkit::builtin_tools(MANIFESTS, &builtins(accounts, watches)); assert!(skipped.is_empty(), "{skipped:?}"); assert_eq!(tools.len(), 3); let (accounts, watches) = parts(); - let resolver = registry(accounts, watches) - .resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + let resolver = + registry(accounts, watches).resolver_for(&crate::toolkit::Allowlist::permissive()); assert_eq!( resolver.replay_safety("identity_list"), rhema_core::ReplaySafety::Safe diff --git a/crates/rhema-claw/src/attachments.rs b/crates/rhema-claw/src/attachments.rs index 3fd8560..cf3ebc2 100644 --- a/crates/rhema-claw/src/attachments.rs +++ b/crates/rhema-claw/src/attachments.rs @@ -17,7 +17,8 @@ use std::sync::Arc; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::{SystemTime, UNIX_EPOCH}; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use serde::Deserialize; use serde_json::{Value, json}; @@ -309,10 +310,8 @@ pub fn registry( hub: Arc, key: ResourceKey, ) -> ToolRegistry { - let (tools, skipped) = rhema_autonomous_agent::manifest::builtin_tools( - MANIFESTS, - &builtins(store, workspace.into(), hub, key), - ); + let (tools, skipped) = + crate::toolkit::builtin_tools(MANIFESTS, &builtins(store, workspace.into(), hub, key)); assert!( skipped.is_empty(), "the attach_file tool manifest must load: {skipped:?}" @@ -327,7 +326,7 @@ pub fn registry( #[cfg(test)] mod tests { use super::*; - use rhema_autonomous_agent::Allowlist; + use crate::toolkit::Allowlist; #[test] fn the_manifest_loads_against_its_builtin_and_serves_the_registry() { diff --git a/crates/rhema-claw/src/bootstrap.rs b/crates/rhema-claw/src/bootstrap.rs index 2fe90f4..f180246 100644 --- a/crates/rhema-claw/src/bootstrap.rs +++ b/crates/rhema-claw/src/bootstrap.rs @@ -26,7 +26,8 @@ use std::collections::BTreeMap; use std::path::{Path, PathBuf}; use std::sync::Arc; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use rhema_core::ToolSpec; use rhema_prompt::render_template; use serde_json::{Value, json}; @@ -312,8 +313,7 @@ pub const MANIFESTS: &[(&str, &str)] = &[( /// interactive resolver chain composes — its spec from the embedded /// manifest, the operation compiled here. pub fn registry(bootstrap: Arc) -> ToolRegistry { - let (tools, skipped) = - rhema_autonomous_agent::manifest::builtin_tools(MANIFESTS, &builtins(bootstrap)); + let (tools, skipped) = crate::toolkit::builtin_tools(MANIFESTS, &builtins(bootstrap)); assert!( skipped.is_empty(), "the bootstrap tool manifest must load: {skipped:?}" @@ -444,7 +444,7 @@ mod tests { let tools = registry(Arc::new(Bootstrap { root: bootstrap.root().to_path_buf(), })) - .resolver_for(&rhema_autonomous_agent::Allowlist::permissive()) + .resolver_for(&crate::toolkit::Allowlist::permissive()) .specs(); let prompt = render_system( DEFAULT_SYSTEM_MD, @@ -666,7 +666,7 @@ mod tests { #[tokio::test] async fn the_tool_writes_through_the_store_and_answers_one_line() { - use rhema_autonomous_agent::Allowlist; + use crate::toolkit::Allowlist; use rhema_core::{ToolCall, ToolContext}; let (_dir, bootstrap) = store(); diff --git a/crates/rhema-claw/src/consents.rs b/crates/rhema-claw/src/consents.rs index b71e4cf..38b0156 100644 --- a/crates/rhema-claw/src/consents.rs +++ b/crates/rhema-claw/src/consents.rs @@ -21,7 +21,8 @@ use std::collections::{BTreeMap, HashMap}; use std::sync::{Arc, Mutex, PoisonError}; use std::time::Duration; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use rusqlite::params; use serde::Deserialize; use serde_json::{Value, json}; @@ -509,10 +510,8 @@ pub fn registry( hub: Arc, key: ResourceKey, ) -> ToolRegistry { - let (tools, skipped) = rhema_autonomous_agent::manifest::builtin_tools( - MANIFESTS, - &builtins(consents, bridge, hub, key), - ); + let (tools, skipped) = + crate::toolkit::builtin_tools(MANIFESTS, &builtins(consents, bridge, hub, key)); assert!( skipped.is_empty(), "the ask_secret tool manifest must load: {skipped:?}" @@ -527,7 +526,7 @@ pub fn registry( #[cfg(test)] mod tests { use super::*; - use rhema_autonomous_agent::Allowlist; + use crate::toolkit::Allowlist; #[test] fn the_manifest_loads_against_its_builtin_and_serves_the_registry() { diff --git a/crates/rhema-claw/src/extension.rs b/crates/rhema-claw/src/extension.rs index 262931f..111d91c 100644 --- a/crates/rhema-claw/src/extension.rs +++ b/crates/rhema-claw/src/extension.rs @@ -32,17 +32,18 @@ use std::path::PathBuf; use std::sync::Arc; -use rhema_autonomous_agent::{Allowlist, Source, ToolRegistry}; +use rhema_autonomous_agent::Source; +use rhema_calendar_integration::CalendarSource; +use rhema_calendar_integration::CalendarStore; use rhema_core::ToolResolver; +use rhema_forge_integration::ForgeKind; use rhema_rsd::{Dispatcher, ResourceKey, SystemClock}; use crate::consents::WaitBridge; use crate::daemon::ClawError; use crate::forge::ForgeSource; use crate::hub::EventHub; -use rhema_calendar_integration::CalendarSource; -use rhema_calendar_integration::CalendarStore; -use rhema_forge_integration::ForgeKind; +use crate::toolkit::{Allowlist, ToolRegistry}; /// The store handles the standard set is assembled over. One struct, /// so a new extension is a field plus a constructor line, not another diff --git a/crates/rhema-claw/src/handler.rs b/crates/rhema-claw/src/handler.rs index 30ac863..b228525 100644 --- a/crates/rhema-claw/src/handler.rs +++ b/crates/rhema-claw/src/handler.rs @@ -50,8 +50,8 @@ use crate::sandbox::SandboxState; /// [`Role`] is the seam it hangs on, a reviewer dispatch deserving a /// narrower policy than an implementer's — and a policy that refuses the /// shell refuses the run (see [`ClawHandler::dispatch`]). -fn allowlist() -> rhema_autonomous_agent::Allowlist { - rhema_autonomous_agent::Allowlist::permissive() +fn allowlist() -> crate::toolkit::Allowlist { + crate::toolkit::Allowlist::permissive() } /// The coding agent over one watch: a provider, a model, a workspace diff --git a/crates/rhema-claw/src/hub.rs b/crates/rhema-claw/src/hub.rs index 90ab28e..a23091b 100644 --- a/crates/rhema-claw/src/hub.rs +++ b/crates/rhema-claw/src/hub.rs @@ -28,11 +28,11 @@ use std::collections::{HashMap, VecDeque}; use std::sync::{Arc, Mutex, PoisonError}; -use rhema_core::paste::PasteSpan; use rhema_rsd::ResourceKey; use serde::{Deserialize, Serialize}; use tokio::sync::broadcast; +use crate::paste::PasteSpan; use crate::turn_store::{TurnStore, TurnStoreError}; /// How many events a subscriber may trail by before the oldest drop. diff --git a/crates/rhema-claw/src/identity.rs b/crates/rhema-claw/src/identity.rs index 3f50dbe..11d6b02 100644 --- a/crates/rhema-claw/src/identity.rs +++ b/crates/rhema-claw/src/identity.rs @@ -14,7 +14,8 @@ use std::collections::BTreeMap; use std::path::{Path, PathBuf}; use std::sync::Arc; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use serde::{Deserialize, Serialize}; use serde_json::{Value, json}; @@ -353,10 +354,8 @@ pub const MANIFESTS: &[(&str, &str)] = &[( /// The identity tool set over `store`: `identity_set` — its spec from /// the embedded manifest, the operation compiled here. pub fn registry(store: Arc, workspace: impl Into) -> ToolRegistry { - let (tools, skipped) = rhema_autonomous_agent::manifest::builtin_tools( - MANIFESTS, - &builtins(store, workspace.into()), - ); + let (tools, skipped) = + crate::toolkit::builtin_tools(MANIFESTS, &builtins(store, workspace.into())); assert!( skipped.is_empty(), "the identity_set tool manifest must load: {skipped:?}" @@ -371,7 +370,7 @@ pub fn registry(store: Arc, workspace: impl Into) -> Too #[cfg(test)] mod tests { use super::*; - use rhema_autonomous_agent::Allowlist; + use crate::toolkit::Allowlist; #[test] fn the_manifest_loads_against_its_builtin_and_serves_the_registry() { diff --git a/crates/rhema-claw/src/interactive.rs b/crates/rhema-claw/src/interactive.rs index a73b8da..a375c45 100644 --- a/crates/rhema-claw/src/interactive.rs +++ b/crates/rhema-claw/src/interactive.rs @@ -78,7 +78,8 @@ use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; use std::time::{SystemTime, UNIX_EPOCH}; -use rhema_autonomous_agent::{Allowlist, Handler, ResolverChain, SessionContext, async_trait}; +use async_trait::async_trait; +use rhema_autonomous_agent::{Handler, SessionContext}; use rhema_bash::{AllowAll, ShellTools}; use rhema_core::{ Agent, ChatParams, Content, Event as ModelEvent, EventSink, Image, ImageMediaType, Message, @@ -96,6 +97,7 @@ use crate::hub::{EventHub, TurnEvent, UserImage}; use crate::notifications::NotificationStore; use crate::sandbox::SandboxState; use crate::steer::{SteerGuard, SteerRegistry}; +use crate::toolkit::{Allowlist, ResolverChain}; /// The key prefixes of the resident context (see the module docs): /// `interactive:`, `task:`, `phone:`, and `calendar:`. Forge keys — @@ -497,8 +499,8 @@ impl InteractiveHandler { // plain either way before the join, its span // measured where it lands. let mut message = [Message::text(Role::User, text.to_owned())]; - rhema_core::paste::migrate(&mut message); - let mut spans = rhema_core::paste::spans(&message[0]); + crate::paste::migrate(&mut message); + let mut spans = crate::paste::spans(&message[0]); let mut composed = match &message[0].content[0] { Content::Text(text) => text.clone(), _ => unreachable!("the message was built with one text block"), @@ -509,9 +511,9 @@ impl InteractiveHandler { .into_iter() .flatten() .filter_map(Value::as_str) - .map(rhema_core::paste::normalize) + .map(crate::paste::normalize) { - let span = rhema_core::paste::PasteSpan { + let span = crate::paste::PasteSpan { start: composed.len(), end: composed.len() + paste.len(), lines: paste.lines().count(), @@ -538,7 +540,7 @@ impl InteractiveHandler { } let base = input.len(); input.push_str(&text); - pastes.extend(spans.into_iter().map(|span| rhema_core::paste::PasteSpan { + pastes.extend(spans.into_iter().map(|span| crate::paste::PasteSpan { start: span.start + base, end: span.end + base, lines: span.lines, @@ -669,14 +671,14 @@ impl InteractiveHandler { let framed_len = input.len(); let pastes = pastes .iter() - .map(|span| rhema_core::paste::PasteSpan { + .map(|span| crate::paste::PasteSpan { start: span.start + framed_len - recorded_len, end: span.end + framed_len - recorded_len, lines: span.lines, }) .collect::>(); let mut question = [Message::text_with_images(Role::User, input, core_images)]; - rhema_core::paste::annotate(&mut question[0], &pastes); + crate::paste::annotate(&mut question[0], &pastes); let [turn_input] = question; let mut turn = Box::pin(run_turn( &mut agent, @@ -871,7 +873,7 @@ fn restore_session(stashed: &Value, key: &str) -> Result { // embedded form in its prompts; the provider must never see // a mark. One rewrite on the way in, chips survive as the // span note — the same pass the driver's from_session runs. - rhema_core::paste::migrate(&mut session.history); + crate::paste::migrate(&mut session.history); Ok(session) } } @@ -1754,8 +1756,8 @@ mod tests { // The chip rides as the span note: one span, over exactly the // payload's range, and no mark survives the restore. assert_eq!( - rhema_core::paste::spans(&session.history[0]).as_slice(), - &[rhema_core::paste::PasteSpan { + crate::paste::spans(&session.history[0]).as_slice(), + &[crate::paste::PasteSpan { start: "review this:".len(), end: "review this:".len() + payload.len(), lines: 3, diff --git a/crates/rhema-claw/src/job_tools.rs b/crates/rhema-claw/src/job_tools.rs index 9594de3..9baf084 100644 --- a/crates/rhema-claw/src/job_tools.rs +++ b/crates/rhema-claw/src/job_tools.rs @@ -17,7 +17,8 @@ use std::collections::BTreeMap; use std::sync::Arc; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use serde::Deserialize; use serde_json::{Value, json}; @@ -41,8 +42,7 @@ pub const MANIFESTS: &[(&str, &str)] = &[( /// The coding-agent tool set over `store`: one tool, `coding_agent` — /// its spec from the embedded manifest, the operation compiled here. pub fn registry(store: Arc) -> ToolRegistry { - let (tools, skipped) = - rhema_autonomous_agent::manifest::builtin_tools(MANIFESTS, &builtins(store)); + let (tools, skipped) = crate::toolkit::builtin_tools(MANIFESTS, &builtins(store)); assert!( skipped.is_empty(), "the coding_agent tool manifest must load: {skipped:?}" @@ -227,7 +227,7 @@ fn required<'a>(value: &'a Option, complaint: &str) -> Result<&'a str, S #[cfg(test)] mod tests { use super::*; - use rhema_autonomous_agent::Allowlist; + use crate::toolkit::Allowlist; #[test] fn the_manifest_loads_against_its_builtin_and_serves_the_registry() { diff --git a/crates/rhema-claw/src/lib.rs b/crates/rhema-claw/src/lib.rs index 062a2a0..bd51eb9 100644 --- a/crates/rhema-claw/src/lib.rs +++ b/crates/rhema-claw/src/lib.rs @@ -96,6 +96,7 @@ pub mod mock; pub mod notifications; pub mod notify_tools; pub mod openai; +pub mod paste; pub mod pause; pub mod phone; pub mod sandbox; @@ -104,6 +105,7 @@ pub mod steer; pub mod task_source; pub mod task_store; pub mod task_tools; +pub mod toolkit; pub mod turn_store; pub(crate) mod vision; pub mod watch_store; diff --git a/crates/rhema-claw/src/notify_tools.rs b/crates/rhema-claw/src/notify_tools.rs index f1fe5d2..a1809ce 100644 --- a/crates/rhema-claw/src/notify_tools.rs +++ b/crates/rhema-claw/src/notify_tools.rs @@ -12,7 +12,8 @@ use std::collections::BTreeMap; use std::sync::Arc; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use serde::Deserialize; use serde_json::{Value, json}; @@ -33,8 +34,7 @@ pub const MANIFESTS: &[(&str, &str)] = &[("notify", include_str!("../tools/notif /// The notification tool set over `store`: `notify` — its spec from /// the embedded manifest, the operation compiled here. pub fn registry(store: Arc) -> ToolRegistry { - let (tools, skipped) = - rhema_autonomous_agent::manifest::builtin_tools(MANIFESTS, &builtins(store)); + let (tools, skipped) = crate::toolkit::builtin_tools(MANIFESTS, &builtins(store)); assert!( skipped.is_empty(), "the notify tool manifest must load: {skipped:?}" @@ -102,7 +102,7 @@ mod tests { async fn call(store: &Arc, args: Value) -> rhema_core::ToolResult { let resolver = - registry(store.clone()).resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + registry(store.clone()).resolver_for(&crate::toolkit::Allowlist::permissive()); resolver .resolve( rhema_core::ToolCall { @@ -118,13 +118,11 @@ mod tests { #[test] fn the_manifest_loads_against_its_builtin_and_serves_the_spec() { - let (tools, skipped) = - rhema_autonomous_agent::manifest::builtin_tools(MANIFESTS, &builtins(store())); + let (tools, skipped) = crate::toolkit::builtin_tools(MANIFESTS, &builtins(store())); assert!(skipped.is_empty(), "{skipped:?}"); assert_eq!(tools.len(), 1); assert_eq!(tools[0].spec().name, "notify"); - let resolver = - registry(store()).resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + let resolver = registry(store()).resolver_for(&crate::toolkit::Allowlist::permissive()); assert_eq!( resolver.replay_safety("notify"), rhema_core::ReplaySafety::Unsafe, diff --git a/crates/rhema-claw/src/paste.rs b/crates/rhema-claw/src/paste.rs new file mode 100644 index 0000000..85a642e --- /dev/null +++ b/crates/rhema-claw/src/paste.rs @@ -0,0 +1,215 @@ +//! How a prompt carries a pasted payload: plain text plus a span note. +//! +//! A submitted prompt is plain text with each multi-line paste's payload +//! in place, exactly what the model reads, and the message carries a +//! [`PasteSpan`] list under [`CONSUMER`] saying which byte ranges the +//! chat surface draws as chips. No provider, no summarizer, and no other +//! consumer reads that note. +//! +//! `rhema-core` carried this until 0.4.2 moved display encodings out of +//! the engine. One frontend writes the note and the same frontend reads +//! it, so it belongs beside that frontend. The format is unchanged, so a +//! session stashed by either side loads in the other. +//! +//! [`PasteSpan`] replaced an embedded encoding, [`MARK`], payload, +//! [`MARK`], written into the text. Sessions written that way still +//! load. [`migrate`] rewrites one into plain text plus spans before the +//! first provider call. + +use rhema_core::{Content, Message, Role}; +use serde::{Deserialize, Serialize}; + +/// The object-replacement character: opens and closes one embedded +/// paste. Two marks always bracket a payload; a lone mark is literal +/// text. +pub const MARK: char = '\u{FFFC}'; + +/// The annotation key the chat surface records paste spans under on a +/// user message. No engine reads it. +pub const CONSUMER: &str = "rhema-code"; + +/// One paste's span in a message's plain text: the byte range its chip +/// stands for, and the payload's line count for the chip's label. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +pub struct PasteSpan { + /// Start byte of the payload in the message text. + pub start: usize, + /// End byte of the payload in the message text, exclusive. + pub end: usize, + /// Lines in the payload, the chip's size label. + pub lines: usize, +} + +/// The annotation's own shape, `{"pastes": [...]}`. +#[derive(Serialize, Deserialize)] +struct Pastes { + pastes: Vec, +} + +/// Normalizes text that travels inside an embed or beside marks: +/// carriage returns to newlines, stray marks dropped, the scan must stay +/// unambiguous. +pub fn normalize(text: &str) -> String { + text.replace("\r\n", "\n") + .replace('\r', "\n") + .replace(MARK, "") +} + +/// Records `spans` on `message` under [`CONSUMER`], replacing whatever +/// the same consumer left before; an empty list clears the note. +pub fn annotate(message: &mut Message, spans: &[PasteSpan]) { + if spans.is_empty() { + message.annotations.remove(CONSUMER); + return; + } + let value = serde_json::to_value(Pastes { + pastes: spans.to_vec(), + }) + .expect("paste spans serialize"); + message.annotate(CONSUMER, value); +} + +/// The paste spans `message` carries, empty when it has none or when the +/// note is not this consumer's shape. +pub fn spans(message: &Message) -> Vec { + message + .annotation(CONSUMER) + .and_then(|value| serde_json::from_value::(value.clone()).ok()) + .map(|pastes| pastes.pastes) + .unwrap_or_default() +} + +/// Splits legacy embedded text into the plain form and its spans. +fn split_legacy(text: &str) -> (String, Vec) { + let mut plain = String::with_capacity(text.len()); + let mut spans = Vec::new(); + let mut rest = text; + while let Some(start) = rest.find(MARK) { + plain.push_str(&rest[..start]); + let after = &rest[start + MARK.len_utf8()..]; + match after.find(MARK) { + Some(end) => { + let payload = &after[..end]; + let begin = plain.len(); + plain.push_str(payload); + spans.push(PasteSpan { + start: begin, + end: plain.len(), + lines: payload.lines().count(), + }); + rest = &after[end + MARK.len_utf8()..]; + } + // An unpaired mark is literal text. + None => { + plain.push(MARK); + rest = after; + } + } + } + plain.push_str(rest); + (plain, spans) +} + +/// Rewrites the legacy embedded form in `history` into plain text plus +/// [`PasteSpan`] annotations, returning how many messages changed. +/// Sessions written before the annotation existed carry `MARK payload +/// MARK` inside the prompt; a resumed session must not send those marks +/// to a provider. Chips only ever lived in one user text block, so only +/// user messages are considered. +pub fn migrate(history: &mut [Message]) -> usize { + let mut changed = 0; + for message in history.iter_mut() { + if message.role != Role::User { + continue; + } + let mut spans = Vec::new(); + let mut touched = false; + for content in message.content.iter_mut() { + if let Content::Text(text) = content + && text.contains(MARK) + { + let (plain, found) = split_legacy(text); + *text = plain; + spans.extend(found); + touched = true; + } + } + if touched { + annotate(message, &spans); + changed += 1; + } + } + changed +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn spans_round_trip_through_the_annotation() { + let mut message = Message::text(Role::User, "look at l1\nl2 this"); + assert!(spans(&message).is_empty()); + let span = PasteSpan { + start: 8, + end: 13, + lines: 2, + }; + annotate(&mut message, &[span]); + assert_eq!(spans(&message), vec![span]); + let json = serde_json::to_value(&message).unwrap(); + assert_eq!(json["annotations"]["rhema-code"]["pastes"][0]["lines"], 2); + // Clearing the last span drops the whole note, so an + // annotation-free message keeps the pre-annotation wire shape. + annotate(&mut message, &[]); + assert!(spans(&message).is_empty()); + assert!( + serde_json::to_value(&message) + .unwrap() + .get("annotations") + .is_none() + ); + } + + #[test] + fn migrate_rewrites_the_legacy_form_into_plain_text_and_spans() { + let payload = "l1\nl2\nl3\nl4"; + let mut history = vec![ + Message::text(Role::User, format!("look at {MARK}{payload}{MARK} this")), + Message::text(Role::Assistant, "on it"), + ]; + assert_eq!(migrate(&mut history), 1); + assert_eq!( + history[0].content, + Message::text(Role::User, format!("look at {payload} this")).content + ); + assert_eq!( + spans(&history[0]), + vec![PasteSpan { + start: 8, + end: 8 + payload.len(), + lines: 4, + }] + ); + // Idempotent: the plain form has no marks left to rewrite. + assert_eq!(migrate(&mut history), 0); + assert_eq!(history[1], Message::text(Role::Assistant, "on it")); + } + + #[test] + fn an_unpaired_mark_migrates_as_literal_text() { + let mut history = vec![Message::text(Role::User, format!("a{MARK}b"))]; + assert_eq!(migrate(&mut history), 1); + assert_eq!( + history[0].content, + Message::text(Role::User, "a\u{FFFC}b").content + ); + assert!(spans(&history[0]).is_empty()); + } + + #[test] + fn normalize_flattens_carriage_returns_and_drops_marks() { + assert_eq!(normalize("p\r\nq\rs"), "p\nq\ns"); + assert_eq!(normalize(&format!("a{MARK}b")), "ab"); + } +} diff --git a/crates/rhema-claw/src/phone.rs b/crates/rhema-claw/src/phone.rs index 94ca309..a47ad6f 100644 --- a/crates/rhema-claw/src/phone.rs +++ b/crates/rhema-claw/src/phone.rs @@ -49,7 +49,8 @@ use std::collections::BTreeMap; use std::sync::{Arc, Mutex, PoisonError}; use std::time::Duration; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use rusqlite::params; use serde::Deserialize; use serde_json::{Value, json}; @@ -721,10 +722,8 @@ pub fn registry( hub: Arc, key: ResourceKey, ) -> ToolRegistry { - let (tools, skipped) = rhema_autonomous_agent::manifest::builtin_tools( - MANIFESTS, - &builtins(store, consents, bridge, hub, key), - ); + let (tools, skipped) = + crate::toolkit::builtin_tools(MANIFESTS, &builtins(store, consents, bridge, hub, key)); assert!( skipped.is_empty(), "the phone tool manifest must load: {skipped:?}" @@ -739,7 +738,7 @@ pub fn registry( #[cfg(test)] mod tests { use super::*; - use rhema_autonomous_agent::Allowlist; + use crate::toolkit::Allowlist; #[test] fn the_manifest_loads_against_its_builtin_and_serves_the_registry() { diff --git a/crates/rhema-claw/src/sandbox.rs b/crates/rhema-claw/src/sandbox.rs index 37f3072..4d206ab 100644 --- a/crates/rhema-claw/src/sandbox.rs +++ b/crates/rhema-claw/src/sandbox.rs @@ -26,8 +26,9 @@ use std::time::Duration; use async_trait::async_trait; use base64::Engine as _; -use rhema_bash::exec::{Executed, ShellError, ShellExecutor, default_executor_with}; -use rhema_sandbox::{ExecRequest, Sandbox, ShellSandbox, WorkspaceSeed}; +use rhema_bash::exec::{RunOutcome, ShellError, ShellExecutor, default_executor_with}; +use rhema_core::{OutputOnly, ToolProgress}; +use rhema_sandbox::{RunRequest, Sandbox, ShellSandbox, WorkspaceSeed}; use rhema_sandbox_http::HttpSandbox; use rhema_sandbox_ssh::SshSandbox; use serde::{Deserialize, Serialize}; @@ -388,16 +389,16 @@ impl ClawShell { .workspace_for(&self.host_workspace) .to_string_lossy() .to_string(); - let mut sink = |_line: &str| {}; + let mut sink = OutputOnly(|_line: &str| {}); let probe = sandbox - .exec( - ExecRequest { + .run( + RunRequest { command: format!( "mkdir -p {}; ls -A {} 2>/dev/null | head -n 1", shquote(&root), shquote(&root) ), - cwd: root.clone(), + cwd: root.clone().into(), timeout: PROBE_TIMEOUT, }, cancelled, @@ -432,18 +433,13 @@ impl ClawShell { impl ShellExecutor for ClawShell { async fn run( &self, - command: &str, - cwd: &Path, - timeout: Duration, + request: RunRequest, cancelled: &AtomicBool, - progress: &mut (dyn for<'a> FnMut(&'a str) + Send), - ) -> Result { + progress: &mut dyn ToolProgress, + ) -> Result { let choice = self.state.choice(); if !choice.is_remote() { - return self - .local - .run(command, cwd, timeout, cancelled, progress) - .await; + return self.local.run(request, cancelled, progress).await; } { let mut last = self.last.lock().unwrap_or_else(PoisonError::into_inner); @@ -459,7 +455,15 @@ impl ShellExecutor for ClawShell { } let root = choice.remote_root(&self.host_workspace); ShellSandbox::new(sandbox) - .run(command, &root, timeout, cancelled, progress) + .run( + RunRequest { + command: request.command, + cwd: root, + timeout: request.timeout, + }, + cancelled, + progress, + ) .await } } @@ -469,6 +473,7 @@ impl ShellExecutor for ClawShell { fn protocol_error(err: rhema_sandbox::SandboxError) -> ShellError { match err { rhema_sandbox::SandboxError::Timeout(secs) => ShellError::Timeout(secs), + rhema_sandbox::SandboxError::OutOfMemory => ShellError::OutOfMemory, rhema_sandbox::SandboxError::Unavailable(message) | rhema_sandbox::SandboxError::Failed(message) => ShellError::Failed(message), // The error enum is non-exhaustive: an unknown failure is still @@ -800,12 +805,14 @@ mod tests { }); let executor = state.executor(dir.path()); let cancelled = AtomicBool::new(false); - let mut sink = |_line: &str| {}; + let mut sink = OutputOnly(|_line: &str| {}); let executed = executor .run( - "echo hi", - Path::new(REMOTE_WORKSPACE), - Duration::from_secs(5), + RunRequest { + command: "echo hi".to_owned(), + cwd: Path::new(REMOTE_WORKSPACE).to_path_buf(), + timeout: Duration::from_secs(5), + }, &cancelled, &mut sink, ) diff --git a/crates/rhema-claw/src/task_tools.rs b/crates/rhema-claw/src/task_tools.rs index 11a0957..0d8d0e5 100644 --- a/crates/rhema-claw/src/task_tools.rs +++ b/crates/rhema-claw/src/task_tools.rs @@ -15,7 +15,8 @@ use std::collections::BTreeMap; use std::sync::Arc; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use serde::Deserialize; use serde_json::{Value, json}; use time::OffsetDateTime; @@ -65,8 +66,7 @@ pub const MANIFESTS: &[(&str, &str)] = &[ /// `cancel_task` — specs from the embedded manifests, operations /// compiled here. pub fn registry(store: Arc) -> ToolRegistry { - let (tools, skipped) = - rhema_autonomous_agent::manifest::builtin_tools(MANIFESTS, &builtins(store)); + let (tools, skipped) = crate::toolkit::builtin_tools(MANIFESTS, &builtins(store)); assert!( skipped.is_empty(), "the task tool manifests must all load: {skipped:?}" @@ -236,7 +236,7 @@ mod tests { async fn call(store: &Arc, name: &str, args: Value) -> rhema_core::ToolResult { let resolver = - registry(store.clone()).resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + registry(store.clone()).resolver_for(&crate::toolkit::Allowlist::permissive()); resolver .resolve( rhema_core::ToolCall { @@ -252,8 +252,7 @@ mod tests { #[test] fn every_manifest_loads_against_its_builtin() { - let (tools, skipped) = - rhema_autonomous_agent::manifest::builtin_tools(MANIFESTS, &builtins(store())); + let (tools, skipped) = crate::toolkit::builtin_tools(MANIFESTS, &builtins(store())); assert!(skipped.is_empty(), "{skipped:?}"); let names: Vec = tools.iter().map(|tool| tool.spec().name).collect(); assert_eq!( @@ -271,7 +270,7 @@ mod tests { let mut covered = Vec::new(); for (source, raw) in MANIFESTS { covered.push( - rhema_autonomous_agent::manifest::parse(raw) + crate::toolkit::parse_manifest(raw) .unwrap_or_else(|err| panic!("{source}: {err}")) .builtin, ); @@ -286,12 +285,11 @@ mod tests { #[test] fn the_registry_serves_the_manifest_specs() { - let resolver = - registry(store()).resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + let resolver = registry(store()).resolver_for(&crate::toolkit::Allowlist::permissive()); let specs = resolver.specs(); for (name, raw) in MANIFESTS { - let manifest = rhema_autonomous_agent::manifest::parse(raw) - .unwrap_or_else(|err| panic!("{name}: {err}")); + let manifest = + crate::toolkit::parse_manifest(raw).unwrap_or_else(|err| panic!("{name}: {err}")); let spec = specs .iter() .find(|spec| spec.name == *name) @@ -310,8 +308,7 @@ mod tests { #[test] fn replay_safety_comes_from_the_manifest() { - let resolver = - registry(store()).resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + let resolver = registry(store()).resolver_for(&crate::toolkit::Allowlist::permissive()); assert_eq!( resolver.replay_safety("list_tasks"), rhema_core::ReplaySafety::Safe diff --git a/crates/rhema-claw/src/toolkit.rs b/crates/rhema-claw/src/toolkit.rs new file mode 100644 index 0000000..9181f54 --- /dev/null +++ b/crates/rhema-claw/src/toolkit.rs @@ -0,0 +1,680 @@ +//! The resident's toolset: named tools, a `TOOL.yaml` per tool, and the +//! per-run [`ToolResolver`] cut from them. +//! +//! `rhema-core` ships the resolver seam and no registry, on purpose. It +//! ships one primitive, not a framework. Until 0.4.2 the registry, the +//! manifest loader, the allowlist, and the resolver chain rode +//! `rhema-autonomous-agent`, which was never the right home for them. The +//! crate is the lease-driven loop, and it compiles no tool of its own. +//! The claw was the only consumer, so the machinery moved here with the +//! tools it serves. +//! +//! The shape is unchanged. A tool is a folder under `tools/` holding a +//! `TOOL.yaml`: the name the model calls, the description it +//! picks the tool by, the argument schema, the replay classification, and +//! a `run` binding. The code half is a [`ToolOp`] registered under that +//! binding's id, so a tool's static data stops living next to it in Rust +//! string literals and one folder names one tool. [`builtin_tools`] +//! joins the two, [`ToolRegistry`] holds the survivors, and +//! [`ToolRegistry::resolver_for`] cuts the allowlisted view the step +//! engine consumes. +//! +//! A manifest that does not parse, or whose `run.builtin` id has no +//! operation, is skipped rather than fatal, the way an unreadable skill +//! folder is; each family pins its shipped set with a test. + +use std::collections::{BTreeMap, BTreeSet}; +use std::sync::Arc; + +use async_trait::async_trait; +use rhema_core::{ + ReplaySafety, ToolCall, ToolContext, ToolProgress, ToolResolver, ToolResult, ToolSpec, +}; +use serde::Deserialize; +use serde_json::Value; +use thiserror::Error; + +/// Why a tool invocation failed: the message the model reads. The +/// registry turns `Err` into an in-band failure result, a failing tool is +/// a result the model reacts to, never a crashed run, so the message is +/// the error's whole content. +#[derive(Debug, Clone, PartialEq, Eq, Error)] +#[error("{0}")] +pub struct ToolError(String); + +impl ToolError { + /// An error whose message the model reads verbatim. + pub fn new(message: impl Into) -> Self { + Self(message.into()) + } + + /// The message the model reads. + pub fn message(&self) -> &str { + &self.0 + } +} + +impl From for ToolError { + fn from(message: String) -> Self { + Self(message) + } +} + +impl From<&str> for ToolError { + fn from(message: &str) -> Self { + Self(message.to_owned()) + } +} + +/// One named tool: the spec the model sees, and the invocation the +/// registry dispatches to. +#[async_trait] +pub trait Tool: Send + Sync { + /// The tool's schema, passed through to the provider's native + /// tool-calling format. The description lives here and nowhere else. + fn spec(&self) -> ToolSpec; + + /// Whether a resume may re-execute one of this tool's committed calls + /// that lost its result. [`ReplaySafety::Unsafe`] unless declared + /// otherwise: an unclassified tool is treated as side-effecting. + fn replay_safety(&self) -> ReplaySafety { + ReplaySafety::Unsafe + } + + /// Runs the tool. The registry turns `Err` into an in-band failure + /// result carrying the error's message; `Ok` text is the tool's + /// answer. + async fn invoke(&self, args: Value) -> Result; +} + +/// The static half of a tool, parsed from a `TOOL.yaml`. +#[derive(Debug, Clone, PartialEq)] +pub struct Manifest { + /// Name the model uses to call the tool. + pub name: String, + /// What the tool does; the model picks tools from this. + pub description: String, + /// JSON schema for the call arguments; the empty-object schema when + /// the manifest omits it. + pub parameters: Value, + /// Whether a resume may re-execute a committed call that lost its + /// result; [`ReplaySafety::Unsafe`] when the manifest omits it. + pub replay_safety: ReplaySafety, + /// The `run.builtin` id naming the compiled operation. + pub builtin: String, +} + +/// Why a `TOOL.yaml` did not parse into a [`Manifest`]. +#[derive(Debug, Error)] +#[error("{0}")] +pub struct ManifestError(String); + +/// Parses one `TOOL.yaml`. `parameters` defaults to the empty-object +/// schema and `replay_safety` to [`ReplaySafety::Unsafe`], so a minimal +/// manifest is a name, a description, and a `run` binding. +pub fn parse_manifest(raw: &str) -> Result { + let yaml: ManifestYaml = + serde_yaml::from_str(raw).map_err(|err| ManifestError(err.to_string()))?; + let name = yaml.name.trim().to_owned(); + if name.is_empty() { + return Err(ManifestError("no tool name".to_owned())); + } + let description = yaml.description.trim().to_owned(); + if description.is_empty() { + return Err(ManifestError(format!("{name}: no description"))); + } + let builtin = match yaml.run.kind { + RunKind::Builtin { builtin } => builtin.trim().to_owned(), + }; + if builtin.is_empty() { + return Err(ManifestError(format!( + "{name}: run.builtin names no operation" + ))); + } + let parameters = match yaml.parameters { + Some(value) => serde_json::to_value(&value) + .map_err(|err| ManifestError(format!("{name}: parameters are not JSON: {err}")))?, + None => serde_json::json!({ "type": "object" }), + }; + let replay_safety = yaml + .replay_safety + .map(|replay| match replay { + ReplayYaml::Unsafe => ReplaySafety::Unsafe, + ReplayYaml::Safe => ReplaySafety::Safe, + }) + .unwrap_or_default(); + Ok(Manifest { + name, + description, + parameters, + replay_safety, + builtin, + }) +} + +/// The operation half of a manifest-defined tool: run the call. The spec +/// half lives in the tool's `TOOL.yaml`, so an operation carries no +/// schema strings of its own. +#[async_trait] +pub trait ToolOp: Send + Sync { + /// Runs the tool. The registry turns `Err` into an in-band failure + /// result; `Ok` text is the tool's answer. + async fn invoke(&self, args: Value) -> Result; +} + +/// A [`Tool`] cut from a [`Manifest`] plus its registered operation: the +/// model sees the manifest's spec, and the registry dispatches to the +/// operation. +pub struct ManifestTool { + manifest: Manifest, + op: Arc, +} + +impl ManifestTool { + /// Binds `manifest` to the operation `op`. + pub fn new(manifest: Manifest, op: Arc) -> Self { + Self { manifest, op } + } +} + +#[async_trait] +impl Tool for ManifestTool { + fn spec(&self) -> ToolSpec { + ToolSpec::new( + self.manifest.name.clone(), + self.manifest.description.clone(), + self.manifest.parameters.clone(), + ) + } + + fn replay_safety(&self) -> ReplaySafety { + self.manifest.replay_safety + } + + async fn invoke(&self, args: Value) -> Result { + self.op.invoke(args).await + } +} + +/// Loads `manifests`: `(source, text)` pairs, `source` naming the +/// manifest in skip reports, against the registered `builtins`. A +/// manifest that does not parse, or whose `run.builtin` id has no +/// operation, is skipped and reported; the survivors are ready to +/// register. +pub fn builtin_tools( + manifests: &[(&str, &str)], + builtins: &BTreeMap>, +) -> (Vec>, Vec) { + let mut tools: Vec> = Vec::new(); + let mut skipped = Vec::new(); + for (source, raw) in manifests { + let manifest = match parse_manifest(raw) { + Ok(manifest) => manifest, + Err(err) => { + skipped.push(format!("{source}: {err}")); + continue; + } + }; + match builtins.get(&manifest.builtin) { + Some(op) => tools.push(Arc::new(ManifestTool::new(manifest, op.clone()))), + None => skipped.push(format!( + "{source}: no builtin operation for {:?}", + manifest.builtin + )), + } + } + (tools, skipped) +} + +/// The tool-permission set one handler run is granted. `None` means +/// permissive, every registered tool, which is the resident tier's +/// standing policy: the HTTP surface is the trust boundary. +#[derive(Debug, Clone, Default, PartialEq, Eq)] +pub struct Allowlist { + allowed: Option>, +} + +impl Allowlist { + /// Every registered tool is permitted. + pub fn permissive() -> Self { + Self { allowed: None } + } + + /// Only the named tools are permitted. + pub fn from_tools(names: impl IntoIterator>) -> Self { + Self { + allowed: Some(names.into_iter().map(Into::into).collect()), + } + } + + /// Whether `tool` may be invoked under this allowlist. + pub fn allows(&self, tool: &str) -> bool { + match &self.allowed { + None => true, + Some(allowed) => allowed.contains(tool), + } + } +} + +/// The named tool set, from which per-run [`ToolResolver`]s are cut. +#[derive(Default)] +pub struct ToolRegistry { + tools: BTreeMap>, +} + +impl ToolRegistry { + /// An empty registry. + pub fn new() -> Self { + Self::default() + } + + /// Registers a tool under its spec's name; a re-register replaces. + pub fn register(&mut self, tool: Arc) { + self.tools.insert(tool.spec().name, tool); + } + + /// How many tools are registered. + pub fn len(&self) -> usize { + self.tools.len() + } + + /// Whether nothing is registered. + pub fn is_empty(&self) -> bool { + self.tools.is_empty() + } + + /// A resolver over the tools `allowlist` permits: the model sees only + /// those specs, and a call for a forbidden or unknown tool comes back + /// as an in-band failure result. + pub fn resolver_for(&self, allowlist: &Allowlist) -> Arc { + Arc::new(FilteredResolver { + tools: self + .tools + .iter() + .filter(|(name, _)| allowlist.allows(name)) + .map(|(name, tool)| (name.clone(), tool.clone())) + .collect(), + }) + } +} + +/// One run's view of the registry: the allowlisted slice, as the seam the +/// step engine consumes. +struct FilteredResolver { + tools: BTreeMap>, +} + +#[async_trait] +impl ToolResolver for FilteredResolver { + fn specs(&self) -> Vec { + self.tools.values().map(|tool| tool.spec()).collect() + } + + fn replay_safety(&self, name: &str) -> ReplaySafety { + self.tools + .get(name) + .map(|tool| tool.replay_safety()) + .unwrap_or(ReplaySafety::Unsafe) + } + + async fn resolve(&self, call: ToolCall, _ctx: &ToolContext) -> ToolResult { + let Some(tool) = self.tools.get(&call.name) else { + return ToolResult::failure(&call.id, format!("unknown tool: {}", call.name)); + }; + match tool.invoke(call.args.clone()).await { + Ok(text) => ToolResult::success(&call.id, text), + Err(err) => ToolResult::failure(&call.id, err.message()), + } + } +} + +/// Several resolvers behind one seam: specs concatenate in order, and a +/// call is served by the first resolver offering that tool's name. Tool +/// names should be unique across the chain; on a duplicate, the earlier +/// resolver wins and the later one is unreachable for it. +pub struct ResolverChain { + resolvers: Vec>, +} + +impl ResolverChain { + /// A chain serving tools from `resolvers`, in order. + pub fn new(resolvers: Vec>) -> Self { + Self { resolvers } + } + + /// The resolver offering `name`, if any. + fn owner(&self, name: &str) -> Option<&Arc> { + self.resolvers + .iter() + .find(|resolver| resolver.specs().iter().any(|spec| spec.name == name)) + } +} + +#[async_trait] +impl ToolResolver for ResolverChain { + fn specs(&self) -> Vec { + self.resolvers + .iter() + .flat_map(|resolver| resolver.specs()) + .collect() + } + + fn replay_safety(&self, name: &str) -> ReplaySafety { + self.owner(name) + .map(|resolver| resolver.replay_safety(name)) + .unwrap_or(ReplaySafety::Unsafe) + } + + async fn resolve(&self, call: ToolCall, ctx: &ToolContext) -> ToolResult { + match self.owner(&call.name) { + Some(resolver) => resolver.resolve(call, ctx).await, + None => ToolResult::failure(&call.id, format!("unknown tool: {}", call.name)), + } + } + + /// Streams through the owning resolver: the shell is long, and its + /// live lines are the reason this chain exists as a seam rather than + /// a filter. + async fn resolve_streaming( + &self, + call: ToolCall, + ctx: &ToolContext, + progress: &mut dyn ToolProgress, + ) -> ToolResult { + match self.owner(&call.name) { + Some(resolver) => resolver.resolve_streaming(call, ctx, progress).await, + None => ToolResult::failure(&call.id, format!("unknown tool: {}", call.name)), + } + } +} + +/// The `TOOL.yaml` body this module reads. +#[derive(Debug, Deserialize)] +struct ManifestYaml { + name: String, + description: String, + #[serde(default)] + parameters: Option, + #[serde(default)] + replay_safety: Option, + run: Run, +} + +/// The `run` binding: the kind's field name is the variant, so `builtin` +/// names a compiled operation the consumer registered under that id, and +/// a future kind is another variant. +#[derive(Debug, Deserialize)] +struct Run { + #[serde(flatten)] + kind: RunKind, +} + +#[derive(Debug, Deserialize)] +#[serde(untagged)] +enum RunKind { + Builtin { builtin: String }, +} + +/// The manifest's `replay_safety`, lowercase to read like the yaml it +/// sits in; maps onto [`ReplaySafety`]. +#[derive(Debug, Deserialize)] +#[serde(rename_all = "lowercase")] +enum ReplayYaml { + Unsafe, + Safe, +} + +#[cfg(test)] +mod tests { + use super::*; + + struct Echo; + + #[async_trait] + impl ToolOp for Echo { + async fn invoke(&self, args: Value) -> Result { + Ok(args.to_string()) + } + } + + struct Boom; + + #[async_trait] + impl ToolOp for Boom { + async fn invoke(&self, _args: Value) -> Result { + Err(ToolError::new("exploded")) + } + } + + fn builtins() -> BTreeMap> { + BTreeMap::from([ + ("test.echo".to_owned(), Arc::new(Echo) as Arc), + ("test.boom".to_owned(), Arc::new(Boom) as Arc), + ]) + } + + #[test] + fn a_full_manifest_parses() { + let manifest = parse_manifest( + "name: probe\n\ + description: |\n\ + \x20 Probe the parser.\n\ + parameters:\n\ + \x20 type: object\n\ + \x20 properties:\n\ + \x20 path:\n\ + \x20 type: string\n\ + \x20 required: [path]\n\ + replay_safety: safe\n\ + run:\n\ + \x20 builtin: test.echo\n", + ) + .expect("parses"); + assert_eq!(manifest.name, "probe"); + assert_eq!(manifest.description, "Probe the parser."); + assert_eq!( + manifest.parameters, + serde_json::json!({ + "type": "object", + "properties": { "path": { "type": "string" } }, + "required": ["path"] + }) + ); + assert_eq!(manifest.replay_safety, ReplaySafety::Safe); + assert_eq!(manifest.builtin, "test.echo"); + } + + #[test] + fn omissions_take_defaults() { + let manifest = + parse_manifest("name: probe\ndescription: Probe.\nrun:\n builtin: test.echo\n") + .expect("parses"); + assert_eq!(manifest.parameters, serde_json::json!({ "type": "object" })); + assert_eq!(manifest.replay_safety, ReplaySafety::Unsafe); + } + + #[test] + fn blank_fields_and_a_missing_run_are_rejected() { + assert!(parse_manifest("description: Probe.\nrun:\n builtin: test.echo\n").is_err()); + assert!( + parse_manifest("name: probe\ndescription: \" \"\nrun:\n builtin: test.echo\n") + .is_err() + ); + assert!( + parse_manifest("name: probe\ndescription: Probe.\nrun:\n builtin: \" \"\n").is_err() + ); + assert!(parse_manifest("name: probe\ndescription: Probe.\n").is_err()); + } + + #[test] + fn an_unknown_run_kind_is_rejected_not_silently_dropped() { + let err = parse_manifest("name: probe\ndescription: Probe.\nrun:\n exec: ./run.sh\n") + .expect_err("exec is not a binding"); + assert!( + err.to_string().contains("did not match any variant"), + "{err}" + ); + } + + #[test] + fn loading_resolves_builtins_and_reports_skips() { + let manifests = [ + ( + "probe", + "name: probe\ndescription: Probe.\nrun:\n builtin: test.echo\n", + ), + ("bad", "name: bad\ndescription: Probe.\n"), + ( + "orphan", + "name: orphan\ndescription: Probe.\nrun:\n builtin: test.nope\n", + ), + ]; + let (tools, skipped) = builtin_tools(&manifests, &builtins()); + assert_eq!(tools.len(), 1); + assert_eq!(tools[0].spec().name, "probe"); + assert_eq!(skipped.len(), 2, "{skipped:?}"); + assert!(skipped[0].starts_with("bad:"), "{skipped:?}"); + assert!(skipped[1].contains("test.nope"), "{skipped:?}"); + } + + #[test] + fn a_loaded_tool_registers_under_its_manifest_name_and_classifies() { + let manifests = [( + "probe", + "name: probe\ndescription: Probe.\nreplay_safety: safe\nrun:\n builtin: test.echo\n", + )]; + let (tools, skipped) = builtin_tools(&manifests, &builtins()); + assert!(skipped.is_empty(), "{skipped:?}"); + let mut registry = ToolRegistry::new(); + for tool in tools { + registry.register(tool); + } + assert_eq!(registry.len(), 1); + let resolver = registry.resolver_for(&Allowlist::permissive()); + assert_eq!(resolver.specs()[0].name, "probe"); + assert_eq!( + resolver.replay_safety("probe"), + ReplaySafety::Safe, + "the manifest's classification reaches the resolver" + ); + assert_eq!(resolver.replay_safety("unknown"), ReplaySafety::Unsafe); + } + + fn call(name: &str) -> ToolCall { + ToolCall { + id: "c1".into(), + name: name.into(), + args: serde_json::json!({ "a": 1 }), + provider_data: Value::Null, + } + } + + #[tokio::test] + async fn a_filtered_resolver_hides_what_it_forbids_and_fails_a_call_for_it() { + let (tools, _) = builtin_tools( + &[ + ( + "echo", + "name: echo\ndescription: Echo.\nrun:\n builtin: test.echo\n", + ), + ( + "boom", + "name: boom\ndescription: Boom.\nrun:\n builtin: test.boom\n", + ), + ], + &builtins(), + ); + let mut registry = ToolRegistry::new(); + for tool in tools { + registry.register(tool); + } + let resolver = registry.resolver_for(&Allowlist::from_tools(["echo"])); + let names: Vec = resolver.specs().iter().map(|s| s.name.clone()).collect(); + assert_eq!(names, vec!["echo".to_owned()]); + + let forbidden = resolver + .resolve(call("boom"), &ToolContext::default()) + .await; + assert!(forbidden.is_error); + assert_eq!(forbidden.content, "unknown tool: boom"); + } + + #[tokio::test] + async fn an_operation_error_is_an_in_band_failure_with_its_message() { + let (tools, _) = builtin_tools( + &[( + "boom", + "name: boom\ndescription: Boom.\nrun:\n builtin: test.boom\n", + )], + &builtins(), + ); + let mut registry = ToolRegistry::new(); + for tool in tools { + registry.register(tool); + } + let resolver = registry.resolver_for(&Allowlist::permissive()); + let result = resolver + .resolve(call("boom"), &ToolContext::default()) + .await; + assert!(result.is_error); + assert_eq!(result.content, "exploded"); + assert_eq!(result.id, "c1"); + } + + #[tokio::test] + async fn a_chain_serves_each_name_from_its_own_resolver() { + let (tools, _) = builtin_tools( + &[ + ( + "echo", + "name: echo\ndescription: Echo.\nreplay_safety: safe\nrun:\n builtin: test.echo\n", + ), + ( + "boom", + "name: boom\ndescription: Boom.\nrun:\n builtin: test.boom\n", + ), + ], + &builtins(), + ); + let mut left = ToolRegistry::new(); + left.register(tools[0].clone()); + let mut right = ToolRegistry::new(); + right.register(tools[1].clone()); + let chain = ResolverChain::new(vec![ + left.resolver_for(&Allowlist::permissive()), + right.resolver_for(&Allowlist::permissive()), + ]); + + let names: Vec = chain.specs().iter().map(|s| s.name.clone()).collect(); + assert_eq!(names, vec!["echo".to_owned(), "boom".to_owned()]); + assert_eq!(chain.replay_safety("echo"), ReplaySafety::Safe); + assert_eq!(chain.replay_safety("boom"), ReplaySafety::Unsafe); + assert_eq!( + chain + .resolve(call("echo"), &ToolContext::default()) + .await + .content, + r#"{"a":1}"# + ); + assert!( + chain + .resolve(call("boom"), &ToolContext::default()) + .await + .is_error + ); + assert_eq!( + chain + .resolve(call("nope"), &ToolContext::default()) + .await + .content, + "unknown tool: nope" + ); + } + + #[test] + fn an_empty_allowlist_permits_nothing() { + let allowlist = Allowlist::from_tools(Vec::::new()); + assert!(!allowlist.allows("bash")); + assert_eq!(Allowlist::default(), Allowlist::permissive()); + } +} diff --git a/crates/rhema-claw/src/watch_tools.rs b/crates/rhema-claw/src/watch_tools.rs index d9584ec..ef9ef22 100644 --- a/crates/rhema-claw/src/watch_tools.rs +++ b/crates/rhema-claw/src/watch_tools.rs @@ -14,7 +14,8 @@ use std::collections::BTreeMap; use std::sync::Arc; -use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait}; +use crate::toolkit::{ToolError, ToolOp, ToolRegistry}; +use async_trait::async_trait; use serde::Deserialize; use serde_json::{Value, json}; @@ -62,8 +63,7 @@ pub const MANIFESTS: &[(&str, &str)] = &[ /// `unwatch_repo`, `list_watches` — specs from the embedded manifests, /// operations compiled here. pub fn registry(store: Arc) -> ToolRegistry { - let (tools, skipped) = - rhema_autonomous_agent::manifest::builtin_tools(MANIFESTS, &builtins(store)); + let (tools, skipped) = crate::toolkit::builtin_tools(MANIFESTS, &builtins(store)); assert!( skipped.is_empty(), "the watch tool manifests must all load: {skipped:?}" @@ -197,7 +197,7 @@ mod tests { fn names(registry: &ToolRegistry) -> Vec { registry - .resolver_for(&rhema_autonomous_agent::Allowlist::permissive()) + .resolver_for(&crate::toolkit::Allowlist::permissive()) .specs() .into_iter() .map(|spec| spec.name) @@ -206,8 +206,7 @@ mod tests { #[test] fn every_manifest_loads_against_its_builtin() { - let (tools, skipped) = - rhema_autonomous_agent::manifest::builtin_tools(MANIFESTS, &builtins(store())); + let (tools, skipped) = crate::toolkit::builtin_tools(MANIFESTS, &builtins(store())); assert!(skipped.is_empty(), "{skipped:?}"); let names: Vec = tools.iter().map(|tool| tool.spec().name).collect(); assert_eq!( @@ -221,7 +220,7 @@ mod tests { let mut covered = Vec::new(); for (source, raw) in MANIFESTS { covered.push( - rhema_autonomous_agent::manifest::parse(raw) + crate::toolkit::parse_manifest(raw) .unwrap_or_else(|err| panic!("{source}: {err}")) .builtin, ); @@ -236,8 +235,7 @@ mod tests { #[test] fn replay_safety_comes_from_the_manifest() { - let resolver = - registry(store()).resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + let resolver = registry(store()).resolver_for(&crate::toolkit::Allowlist::permissive()); assert_eq!( resolver.replay_safety("list_watches"), rhema_core::ReplaySafety::Safe @@ -263,7 +261,7 @@ mod tests { async fn watch_repo_lands_a_row_and_answers_json() { let store = store(); let tools = registry(store.clone()); - let resolver = tools.resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + let resolver = tools.resolver_for(&crate::toolkit::Allowlist::permissive()); let ctx = rhema_core::ToolContext::default(); let result = resolver .resolve( @@ -303,7 +301,7 @@ mod tests { async fn a_bad_watch_fails_in_band_with_the_reason() { let store = store(); let tools = registry(store.clone()); - let resolver = tools.resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + let resolver = tools.resolver_for(&crate::toolkit::Allowlist::permissive()); let ctx = rhema_core::ToolContext::default(); let call = |name: &str, args: Value| { resolver.resolve( @@ -356,7 +354,7 @@ mod tests { store.add("github", "acme/widgets", None, "").expect("seed"); store.add("gitlab", "group/prop", None, "").expect("seed"); let tools = registry(store.clone()); - let resolver = tools.resolver_for(&rhema_autonomous_agent::Allowlist::permissive()); + let resolver = tools.resolver_for(&crate::toolkit::Allowlist::permissive()); let ctx = rhema_core::ToolContext::default(); let call = |name: &str, args: Value| { resolver.resolve( diff --git a/crates/rhema-claw/tests/http.rs b/crates/rhema-claw/tests/http.rs index 0a5b59b..df691d2 100644 --- a/crates/rhema-claw/tests/http.rs +++ b/crates/rhema-claw/tests/http.rs @@ -11,7 +11,7 @@ use std::pin::Pin; use std::sync::Arc; use std::time::Duration; -use rhema_autonomous_agent::Allowlist; +use rhema_claw::toolkit::Allowlist; use rhema_claw::watch_tools; use rhema_claw::{ClawConfig, Daemon}; use rhema_core::{Content, Message, MockProvider, ModelOutput, Role, Session, StopReason, Usage}; @@ -955,10 +955,10 @@ async fn a_staged_chip_records_as_spans_on_the_stream_and_in_the_stash() { .iter() .find(|message| message.role == Role::User) .expect("the question is stashed"); - assert_eq!(rhema_core::paste::spans(ask).len(), 1); - assert_eq!(rhema_core::paste::spans(ask)[0].start, 12); - assert_eq!(rhema_core::paste::spans(ask)[0].end, 38); - assert_eq!(rhema_core::paste::spans(ask)[0].lines, 2); + assert_eq!(rhema_claw::paste::spans(ask).len(), 1); + assert_eq!(rhema_claw::paste::spans(ask)[0].start, 12); + assert_eq!(rhema_claw::paste::spans(ask)[0].end, 38); + assert_eq!(rhema_claw::paste::spans(ask)[0].lines, 2); } /// A turn nobody watched is still replayable: a client arriving after diff --git a/integrations/rhema-calendar-integration/Cargo.toml b/integrations/rhema-calendar-integration/Cargo.toml index 97dfb0c..647288d 100644 --- a/integrations/rhema-calendar-integration/Cargo.toml +++ b/integrations/rhema-calendar-integration/Cargo.toml @@ -15,10 +15,10 @@ publish = false rusqlite = { version = "0.40", features = ["bundled"] } # The reminder source: one `Source` over the feeds, detect-pass shaped # like the task scheduler's -rhema-autonomous-agent = "0.4.1" +rhema-autonomous-agent = "0.4.2" # The reminder source ingests its slots into a `Dispatcher`; the event # and key-function shapes are the dispatcher's -rhema-rsd = "0.4.1" +rhema-rsd = "0.4.2" serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } diff --git a/integrations/rhema-forge-integration/Cargo.toml b/integrations/rhema-forge-integration/Cargo.toml index 7ea7691..95fdb40 100644 --- a/integrations/rhema-forge-integration/Cargo.toml +++ b/integrations/rhema-forge-integration/Cargo.toml @@ -13,7 +13,7 @@ publish = false [dependencies] # The dispatch seam: watches ingest into a Dispatcher -rhema-rsd = "0.4.1" +rhema-rsd = "0.4.2" serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true }