forked from vhaudiquet/rhema-claw
build: move the claw to rhema 0.4.0
The framework 0.4.0 split the toolkit: rhema-agent-tools becomes rhema-bash plus rhema-prompt, and the facade crate is deleted from the workspace this time, so the 0.3 facades never publish. The driver changes name with its types: rhema-coding-agent and its CodingAgent, CodingAgentConfig, and CodingAgentError become rhema-host-agent with HostAgent, HostAgentConfig, and HostAgentError. The claw imports the split crates directly, which drops its own vision once-lock: rhema-bash's wire already caches the process-wide answer. The paste expansion moved off the provider seam. Chips travel as the message's spans note now, and ExpandPastes is deleted: the dispatch input migrates its embedded form into plain text plus the note at run_turn, and a restashed session migrates the same way on restore, one rewrite on the way in exactly as the driver's from_session does. The transcript events keep the raw chip form, the record the web UI owns, and a migration test pins the restore path. max_turn_steps is NonZeroU32, the engine's own budget shape: a config naming zero is refused at load instead of cutting every round dead. The engine's Event and the sandbox error enum are non-exhaustive now, so the hub sink and the protocol error map carry wildcard arms that drop and fail in-band the way their neighbors do. The claw's own version travels with the framework, as the 0.3.0 move carried 0.2.3 to 0.3.0: the workspace and the chart base become 0.4.0, so the edge channel's pre-releases order above the 0.3.x line. fmt, clippy with -D warnings over all features and targets, the workspace tests, and the doc build pass.
This commit is contained in:
1 parent
ed645d1faf
commit
df260fd9a8
18 files changed
+318
-173
No files matched your search
Generated
+161
-86
@@ -1904,28 +1904,11 @@ dependencies = [
|
|||||||
"webpki-roots",
|
"webpki-roots",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rhema-agent-tools"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dec3e06eef5c867bb8bc1f2170b5f6f46a6248f52428a25d2bf50f7573adb389"
|
|
||||||
dependencies = [
|
|
||||||
"async-trait",
|
|
||||||
"base64 0.22.1",
|
|
||||||
"minijinja",
|
|
||||||
"rhema-core",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"serde_yaml",
|
|
||||||
"thiserror",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-autonomous-agent"
|
name = "rhema-autonomous-agent"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5234ec887bccf0175975fed5ae18ae53d2801146c8e229756eac09192ae9d7b8"
|
checksum = "08fd6d5fe5f9551226d322491d03b14d5e42ac2ff73544c15a555fb97a04bbfd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"rhema-core",
|
"rhema-core",
|
||||||
@@ -1937,9 +1920,25 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rhema-bash"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cf9ae34e5c556e0abdf279dd7d0aa08632bdcd68cff965bce2b81c226ada8f1e"
|
||||||
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
|
"base64 0.22.1",
|
||||||
|
"rhema-core",
|
||||||
|
"rhema-submissions",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-calendar-integration"
|
name = "rhema-calendar-integration"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
@@ -1958,7 +1957,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-claw"
|
name = "rhema-claw"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -1966,17 +1965,18 @@ dependencies = [
|
|||||||
"bytes",
|
"bytes",
|
||||||
"clap",
|
"clap",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rhema-agent-tools",
|
|
||||||
"rhema-autonomous-agent",
|
"rhema-autonomous-agent",
|
||||||
|
"rhema-bash",
|
||||||
"rhema-calendar-integration",
|
"rhema-calendar-integration",
|
||||||
"rhema-claw-tools-contract",
|
"rhema-claw-tools-contract",
|
||||||
"rhema-coding-agent",
|
|
||||||
"rhema-config",
|
"rhema-config",
|
||||||
"rhema-core",
|
"rhema-core",
|
||||||
"rhema-forge-integration",
|
"rhema-forge-integration",
|
||||||
|
"rhema-host-agent",
|
||||||
"rhema-identity",
|
"rhema-identity",
|
||||||
"rhema-mcp",
|
"rhema-mcp",
|
||||||
"rhema-memory",
|
"rhema-memory",
|
||||||
|
"rhema-prompt",
|
||||||
"rhema-provider",
|
"rhema-provider",
|
||||||
"rhema-provider-registry",
|
"rhema-provider-registry",
|
||||||
"rhema-rsd",
|
"rhema-rsd",
|
||||||
@@ -1997,35 +1997,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-claw-tools-contract"
|
name = "rhema-claw-tools-contract"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rhema-coding-agent"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a5fa7ca082f52429c159addd7cdd036ddc7aa69161ed82004bb480a2e3ae46d1"
|
|
||||||
dependencies = [
|
|
||||||
"minijinja",
|
|
||||||
"rhema-agent-tools",
|
|
||||||
"rhema-config",
|
|
||||||
"rhema-core",
|
|
||||||
"rhema-transcript",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"serde_yaml",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-config"
|
name = "rhema-config"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8c96cd6da28edeb36b8251a7a8129117ec0afa3f5851a0a6d904c10d67fbaa84"
|
checksum = "a0bbfb885f219272d24534c004819db377cf5370de0f82a851f9329466a5349c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"keyring",
|
"keyring",
|
||||||
"rhema-core",
|
"rhema-core",
|
||||||
@@ -2037,9 +2020,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-core"
|
name = "rhema-core"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ac339e3dcd9c379d44c5580ac74075e338e6fce7e79c6e4fefe11fc26a3e10f"
|
checksum = "c3cd4c7a28b121243a2e26371e53750f28368e96c1a1629f021847c717e1cd55"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -2049,7 +2032,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-forge-integration"
|
name = "rhema-forge-integration"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
@@ -2062,10 +2045,30 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-identity"
|
name = "rhema-host-agent"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6b9ced20fc75671b29e49890c6e7f0b5db88f6ad4b43629ee089face88bce633"
|
checksum = "3c10a82a420f1ea5ad1e68cabf0da67e6d05f18ec9e6fa02993969c2dcc53a68"
|
||||||
|
dependencies = [
|
||||||
|
"minijinja",
|
||||||
|
"rhema-bash",
|
||||||
|
"rhema-config",
|
||||||
|
"rhema-core",
|
||||||
|
"rhema-prompt",
|
||||||
|
"rhema-session-store",
|
||||||
|
"rhema-session-store-file",
|
||||||
|
"rhema-transcript",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"serde_yaml",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rhema-identity"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f1bb799ae7395c647577b9cf26208d81c2913d893db050adc82976e88436226c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rusqlite",
|
"rusqlite",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -2074,9 +2077,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-mcp"
|
name = "rhema-mcp"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0c96a292b7da4db6334e0dda5d25d25c2dc0e1058cc0e07df49ca3f28944beff"
|
checksum = "6ed674931827b5b5e3130b376bda837cf49bda6ca6c94392430b74e292b6f516"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -2089,8 +2092,9 @@ dependencies = [
|
|||||||
"hyper-rustls",
|
"hyper-rustls",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"mcp-to-cli",
|
"mcp-to-cli",
|
||||||
"rhema-agent-tools",
|
"rhema-bash",
|
||||||
"rhema-config",
|
"rhema-config",
|
||||||
|
"rhema-prompt",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.9",
|
"sha2 0.10.9",
|
||||||
@@ -2100,9 +2104,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-memory"
|
name = "rhema-memory"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8fcc03d8df84af15c992fd4f317fce11735a824853e40c2d674dff394a952d78"
|
checksum = "34d3b6763b7c567849b6f1787bae7152ce92ec38bdbe2ec27691d4ef2596c259"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"rhema-core",
|
"rhema-core",
|
||||||
@@ -2113,13 +2117,27 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider"
|
name = "rhema-prompt"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c9500c59a8661c16e80ece7525180fe44d553eab2a3e57751194d7a8f138ea6b"
|
checksum = "b70bba0a045879067817db80fcaa7578dc32ef699786cc004b8fdb73bccc47e4"
|
||||||
|
dependencies = [
|
||||||
|
"minijinja",
|
||||||
|
"rhema-core",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"serde_yaml",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rhema-provider"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c400c1ac8430f78184ecc12024605686a988ada7a3ee30dd67a4ce12114ccb9e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
"reqwest",
|
||||||
"rhema-core",
|
"rhema-core",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -2129,9 +2147,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider-anthropic"
|
name = "rhema-provider-anthropic"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "76136cc125a6a03f0db760879c3a417ea56298c1130d20d106f2716cbfe7d031"
|
checksum = "a57458493f5b1fb540fa47f558f7743094dc123d2c06815d2078f9303d9df22f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -2145,9 +2163,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider-chatgpt"
|
name = "rhema-provider-chatgpt"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "38088d5cfa5bb85e6641bd8986757237fab33c8d3ebd86cbc53ef5d88e1af5d4"
|
checksum = "7642b1e0bc194cc81d7f347182eecd6702a04a85de41912bd2d34b2cdf41ca7b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
@@ -2164,9 +2182,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider-copilot"
|
name = "rhema-provider-copilot"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "43ed3942ab1a1ea1a00d082ab85e86ee5607e4718b0ad219a4e9ba9090a302da"
|
checksum = "eb39fa7f059df415bdef2453e58ad5359fd74eeb39f7981179f03c78ffb5af7d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -2182,9 +2200,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider-google"
|
name = "rhema-provider-google"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bad86c3e875e59f166c08e144d9cecd0edd0d445a26472e65dbe0d1bdb6efc44"
|
checksum = "7dda76eea354cfbdfd4a2dfa1fc1ce8da823675699cf2bf4d3ace8560fec2cd7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -2198,9 +2216,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider-llama-cpp"
|
name = "rhema-provider-llama-cpp"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d9dd148f53af3a2dbd811da63cd8519130bbc4191af0b44fb23818ca0d82b6f"
|
checksum = "953181611b909688db511f891e8c59e034b90bd798034f1afef36cac05409566"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -2214,10 +2232,29 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider-openai-compatible"
|
name = "rhema-provider-mistral"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7347b2f056473170a4bf5d7d43fa06892a3b2139eb727a580474ce9bd78f436c"
|
checksum = "1f657297d7d617a14b10bb6248e944d053d73a536d3b6ae4ee4cc8acabcb4a57"
|
||||||
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
|
"base64 0.22.1",
|
||||||
|
"rand 0.8.8",
|
||||||
|
"reqwest",
|
||||||
|
"rhema-core",
|
||||||
|
"rhema-provider",
|
||||||
|
"rhema-provider-openai-compatible",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"sha2 0.10.9",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rhema-provider-openai-compatible"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a90f1620882b2a3dbdb00065b29c329622c5596f582027b29130fbd40003b450"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -2231,9 +2268,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider-opencode"
|
name = "rhema-provider-opencode"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "29823bcfc72d76d5e75bd5c2831a2e7ee07bcbd20598fab2694802652b85a706"
|
checksum = "2068c980362fe3d4f7876e5e842f51c0719626449afac64192592865e11a0108"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
@@ -2246,9 +2283,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider-openrouter"
|
name = "rhema-provider-openrouter"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "488f07952b81a5b20b7acad0d80c2ec28b0fb51f78cc4e878bc183a48f71c32c"
|
checksum = "c2025f84d6a1fd1e513ffad4b374d280f0db600ffac635dfe08a58d04b03e91d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -2262,9 +2299,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-provider-registry"
|
name = "rhema-provider-registry"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3c3d7af90727ea9319a7553726653d0f3908ac9786d25c7ab75b832e4f93bf52"
|
checksum = "be5ed790e3dc4fc3a42bd9b1a633ef72204c519810ce03dafb2792a8ff0b6bf8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rhema-core",
|
"rhema-core",
|
||||||
"rhema-provider",
|
"rhema-provider",
|
||||||
@@ -2273,6 +2310,7 @@ dependencies = [
|
|||||||
"rhema-provider-copilot",
|
"rhema-provider-copilot",
|
||||||
"rhema-provider-google",
|
"rhema-provider-google",
|
||||||
"rhema-provider-llama-cpp",
|
"rhema-provider-llama-cpp",
|
||||||
|
"rhema-provider-mistral",
|
||||||
"rhema-provider-openai-compatible",
|
"rhema-provider-openai-compatible",
|
||||||
"rhema-provider-opencode",
|
"rhema-provider-opencode",
|
||||||
"rhema-provider-openrouter",
|
"rhema-provider-openrouter",
|
||||||
@@ -2281,9 +2319,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-rsd"
|
name = "rhema-rsd"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a163669ba8f439389e0cb4b73c72b26d0b3ccd08b414283f577af9a0b69890ba"
|
checksum = "3a4bd0555ff3720c0501187f5e9c6ee19ebebb95c1ecdb296c509c2e2dd971ce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rhema-core",
|
"rhema-core",
|
||||||
"rusqlite",
|
"rusqlite",
|
||||||
@@ -2294,12 +2332,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-sandbox"
|
name = "rhema-sandbox"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4f35d9fcdee82dae2c455729d54aa19603c870da2d916f0dc115f2e8d8446181"
|
checksum = "7030dbd46aa8a2398452dcf86b6b39d13b82909b9fdc654c49e1374183594779"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"rhema-agent-tools",
|
"rhema-bash",
|
||||||
"rhema-core",
|
"rhema-core",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -2308,9 +2346,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-sandbox-http"
|
name = "rhema-sandbox-http"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e14df93c046a0226941c8b59a86e9af305b8c91bde69b26790ce6534d71709a1"
|
checksum = "b5171470a8a56246e036aa10fc63e641ae7907a3ce70ac8f4816f3c9499eb75b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
@@ -2321,10 +2359,47 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhema-transcript"
|
name = "rhema-session-store"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ee0104c104a9a476d7b246e36c5d7f795568afbae5dbb74f5787580ef2af61d7"
|
checksum = "ef2dd4aca030a56e438c136099d3f07d6fd4649a3db1be6c9838a68a6530cbf6"
|
||||||
|
dependencies = [
|
||||||
|
"rhema-core",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rhema-session-store-file"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e5ff65f110123026ae79679572b084c517693f81e0d464897e580b64985a9507"
|
||||||
|
dependencies = [
|
||||||
|
"rhema-config",
|
||||||
|
"rhema-core",
|
||||||
|
"rhema-session-store",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rhema-submissions"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d054ba904c324ef057c8fb4b9c88a40703496c8b621768844af56a8893d3fb99"
|
||||||
|
dependencies = [
|
||||||
|
"rhema-core",
|
||||||
|
"rhema-session-store",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rhema-transcript"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "800261e8c1f29e6ceee48769bba2aaea19ccd3496ff8c6c76c617aa7d53ec2db"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"rhema-core",
|
"rhema-core",
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "2"
|
|||||||
members = ["crates/*", "integrations/*"]
|
members = ["crates/*", "integrations/*"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.89"
|
rust-version = "1.89"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ surface over HTTP — native routes plus an OpenAI-compatible shim,
|
|||||||
with a web UI and an Android client talking to it.
|
with a web UI and an Android client talking to it.
|
||||||
|
|
||||||
The framework it embeds (the crates under `crates/` it pulls from
|
The framework it embeds (the crates under `crates/` it pulls from
|
||||||
crates.io: `rhema-autonomous-agent`, `rhema-coding-agent`,
|
crates.io: `rhema-autonomous-agent`, `rhema-host-agent`,
|
||||||
`rhema-rsd`, and friends) lives in the
|
`rhema-rsd`, and friends) lives in the
|
||||||
[rhema repository](https://git.vhaudiquet.fr/vhaudiquet/rhema).
|
[rhema repository](https://git.vhaudiquet.fr/vhaudiquet/rhema).
|
||||||
|
|
||||||
|
|||||||
@@ -26,33 +26,36 @@ mock = ["rhema-core/mock"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# The shared toolkit: the resident agent assembles its agent from the
|
# The shared toolkit: the resident agent assembles its agent from the
|
||||||
# shell, the approval seam, paste expansion, and revive-on-resume
|
# shell, the approval seam, and revive-on-resume (rhema-bash), the
|
||||||
rhema-agent-tools = "0.3.0"
|
# system-prompt renderer (rhema-prompt), and the driver that turns a
|
||||||
rhema-autonomous-agent = "0.3.0"
|
# provider into a host-operating agent (rhema-host-agent)
|
||||||
rhema-coding-agent = "0.3.0"
|
rhema-bash = "0.4.0"
|
||||||
rhema-config = "0.3.0"
|
rhema-prompt = "0.4.0"
|
||||||
rhema-core = "0.3.0"
|
rhema-host-agent = "0.4.0"
|
||||||
|
rhema-autonomous-agent = "0.4.0"
|
||||||
|
rhema-config = "0.4.0"
|
||||||
|
rhema-core = "0.4.0"
|
||||||
# The bounded request view over the claw sessions, on by default here
|
# The bounded request view over the claw sessions, on by default here
|
||||||
rhema-transcript = "0.3.0"
|
rhema-transcript = "0.4.0"
|
||||||
rhema-calendar-integration = { path = "../../integrations/rhema-calendar-integration" }
|
rhema-calendar-integration = { path = "../../integrations/rhema-calendar-integration" }
|
||||||
rhema-forge-integration = { path = "../../integrations/rhema-forge-integration" }
|
rhema-forge-integration = { path = "../../integrations/rhema-forge-integration" }
|
||||||
# The accounts layer: identities hold the forge tokens the watches poll
|
# The accounts layer: identities hold the forge tokens the watches poll
|
||||||
# with, and the identity tools manage them over chat
|
# with, and the identity tools manage them over chat
|
||||||
rhema-identity = "0.3.0"
|
rhema-identity = "0.4.0"
|
||||||
rhema-rsd = "0.3.0"
|
rhema-rsd = "0.4.0"
|
||||||
# The sandbox seam: where `bash` runs, local process or a daemon speaking
|
# The sandbox seam: where `bash` runs, local process or a daemon speaking
|
||||||
# the wire protocol over HTTP
|
# the wire protocol over HTTP
|
||||||
rhema-sandbox = "0.3.0"
|
rhema-sandbox = "0.4.0"
|
||||||
rhema-sandbox-http = "0.3.0"
|
rhema-sandbox-http = "0.4.0"
|
||||||
# The tool contract: the agent-token allowlist and version the auth
|
# The tool contract: the agent-token allowlist and version the auth
|
||||||
# middleware enforces (rhema-tools spec). The arrow runs claw ->
|
# middleware enforces (rhema-tools spec). The arrow runs claw ->
|
||||||
# contract only — never the reverse.
|
# contract only — never the reverse.
|
||||||
rhema-claw-tools-contract = { path = "../../tools/contract" }
|
rhema-claw-tools-contract = { path = "../../tools/contract" }
|
||||||
# The resident tier's durable memory: its tools join the resolver chain
|
# The resident tier's durable memory: its tools join the resolver chain
|
||||||
rhema-memory = "0.3.0"
|
rhema-memory = "0.4.0"
|
||||||
# The shared ModelCard the backend registry's listings return
|
# The shared ModelCard the backend registry's listings return
|
||||||
rhema-provider = "0.3.0"
|
rhema-provider = "0.4.0"
|
||||||
rhema-provider-registry = "0.3.0"
|
rhema-provider-registry = "0.4.0"
|
||||||
# Args for the two-flag binary surface
|
# Args for the two-flag binary surface
|
||||||
clap = { version = "4.5", features = ["derive"] }
|
clap = { version = "4.5", features = ["derive"] }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
@@ -77,7 +80,7 @@ time = { version = "0.3", default-features = false, features = ["parsing"] }
|
|||||||
# Inbound chat images ride base64; the dispatch decodes them into the
|
# Inbound chat images ride base64; the dispatch decodes them into the
|
||||||
# attachment store
|
# attachment store
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
rhema-mcp = "0.3.0"
|
rhema-mcp = "0.4.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
@@ -89,7 +92,7 @@ reqwest = { version = "0.12", features = ["json", "stream"] }
|
|||||||
bytes = "1"
|
bytes = "1"
|
||||||
# The scripted provider for turn-level tests; mirrors rhema-code's mock
|
# The scripted provider for turn-level tests; mirrors rhema-code's mock
|
||||||
# feature without a feature of our own — tests are the only consumer
|
# feature without a feature of our own — tests are the only consumer
|
||||||
rhema-core = { version = "0.3.0", features = ["mock"] }
|
rhema-core = { version = "0.4.0", features = ["mock"] }
|
||||||
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "sync", "time"] }
|
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "sync", "time"] }
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ use std::collections::BTreeMap;
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use rhema_agent_tools::render_template;
|
|
||||||
use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait};
|
use rhema_autonomous_agent::{ToolError, ToolOp, ToolRegistry, async_trait};
|
||||||
use rhema_core::ToolSpec;
|
use rhema_core::ToolSpec;
|
||||||
|
use rhema_prompt::render_template;
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
|
|
||||||
/// The built-in system prompt, kept as data next to the code and read
|
/// The built-in system prompt, kept as data next to the code and read
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
//! binary's startup, not here — the daemon library takes the built
|
//! binary's startup, not here — the daemon library takes the built
|
||||||
//! provider, so tests can inject a mock.
|
//! provider, so tests can inject a mock.
|
||||||
|
|
||||||
|
use std::num::NonZeroU32;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -22,10 +23,13 @@ use serde::{Deserialize, Serialize};
|
|||||||
pub const DEFAULT_POLL_INTERVAL_SECS: u64 = 60;
|
pub const DEFAULT_POLL_INTERVAL_SECS: u64 = 60;
|
||||||
|
|
||||||
/// How many tool rounds one chat turn may run, when
|
/// How many tool rounds one chat turn may run, when
|
||||||
/// [`ClawConfig::max_turn_steps`] is unset — the coding driver's own
|
/// [`ClawConfig::max_turn_steps`] is unset — the host agent driver's
|
||||||
/// budget shape and its default: deep enough that a cap is a runaway
|
/// own budget shape and its default: deep enough that a cap is a
|
||||||
/// guard for an agent meant to work unattended, not a work timer.
|
/// runaway guard for an agent meant to work unattended, not a work
|
||||||
pub const DEFAULT_MAX_TURN_STEPS: u32 = 2048;
|
/// timer. `NonZeroU32`, the driver's own spelling: a turn cannot have
|
||||||
|
/// no step budget at all, and a config that names zero is refused at
|
||||||
|
/// load instead of cutting every round dead.
|
||||||
|
pub const DEFAULT_MAX_TURN_STEPS: NonZeroU32 = NonZeroU32::new(2048).unwrap();
|
||||||
|
|
||||||
/// Where the HTTP surface listens when [`ClawConfig::listen`] is unset:
|
/// Where the HTTP surface listens when [`ClawConfig::listen`] is unset:
|
||||||
/// loopback only — the surface is for the machine's resident user.
|
/// loopback only — the surface is for the machine's resident user.
|
||||||
@@ -130,7 +134,7 @@ pub struct ClawConfig {
|
|||||||
/// How many tool rounds one chat turn may run before it is cut off
|
/// How many tool rounds one chat turn may run before it is cut off
|
||||||
/// with a failed outcome, the conversation intact. A follow-up
|
/// with a failed outcome, the conversation intact. A follow-up
|
||||||
/// message keeps going. [`DEFAULT_MAX_TURN_STEPS`] when unset.
|
/// message keeps going. [`DEFAULT_MAX_TURN_STEPS`] when unset.
|
||||||
pub max_turn_steps: u32,
|
pub max_turn_steps: NonZeroU32,
|
||||||
/// The handler's model backend: `google`, `llama-cpp`, `openrouter`,
|
/// The handler's model backend: `google`, `llama-cpp`, `openrouter`,
|
||||||
/// `anthropic`, `openai`, or `zai`; google when unset. Keys resolve
|
/// `anthropic`, `openai`, or `zai`; google when unset. Keys resolve
|
||||||
/// through the stored rhema config's default profile, env vars
|
/// through the stored rhema config's default profile, env vars
|
||||||
@@ -443,7 +447,7 @@ sandbox:
|
|||||||
";
|
";
|
||||||
let config: ClawConfig = serde_yaml::from_str(raw).expect("parses");
|
let config: ClawConfig = serde_yaml::from_str(raw).expect("parses");
|
||||||
assert_eq!(config.poll_interval_secs, 30);
|
assert_eq!(config.poll_interval_secs, 30);
|
||||||
assert_eq!(config.max_turn_steps, 512);
|
assert_eq!(config.max_turn_steps, NonZeroU32::new(512).unwrap());
|
||||||
assert_eq!(config.provider.as_deref(), Some("anthropic"));
|
assert_eq!(config.provider.as_deref(), Some("anthropic"));
|
||||||
assert_eq!(config.model.as_deref(), Some("claude-sonnet-4-5"));
|
assert_eq!(config.model.as_deref(), Some("claude-sonnet-4-5"));
|
||||||
assert_eq!(config.listen.as_deref(), Some("192.168.1.10:7800"));
|
assert_eq!(config.listen.as_deref(), Some("192.168.1.10:7800"));
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Session continuity rides the dispatcher, not the filesystem: the
|
//! Session continuity rides the dispatcher, not the filesystem: the
|
||||||
//! agent's session JSON is stashed into `ctx.session.core.driver_state`
|
//! agent's session JSON is stashed into `ctx.session.core.driver_state`
|
||||||
//! before the run returns and restored with [`CodingAgent::from_session`]
|
//! before the run returns and restored with [`HostAgent::from_session`]
|
||||||
//! on the next dispatch of the same key, so a resumed thread keeps its
|
//! on the next dispatch of the same key, so a resumed thread keeps its
|
||||||
//! conversation. Commit-before-execute rides it too: the run installs the
|
//! conversation. Commit-before-execute rides it too: the run installs the
|
||||||
//! context's commit hook, so the intent is in the store before the first
|
//! context's commit hook, so the intent is in the store before the first
|
||||||
@@ -25,9 +25,8 @@ use std::sync::{Arc, Mutex, PoisonError};
|
|||||||
|
|
||||||
use crate::forge::{WatchCredential, record_client, resolve_watch_credential};
|
use crate::forge::{WatchCredential, record_client, resolve_watch_credential};
|
||||||
use crate::watch_store::ClawStore;
|
use crate::watch_store::ClawStore;
|
||||||
use rhema_agent_tools::{AllowAll, ShellTools};
|
|
||||||
use rhema_autonomous_agent::{Handler, SessionContext, async_trait};
|
use rhema_autonomous_agent::{Handler, SessionContext, async_trait};
|
||||||
use rhema_coding_agent::{CodingAgent, CodingAgentConfig};
|
use rhema_bash::{AllowAll, ShellTools};
|
||||||
use rhema_core::{Content, Event as ModelEvent, EventSink, Message, Session};
|
use rhema_core::{Content, Event as ModelEvent, EventSink, Message, Session};
|
||||||
use rhema_forge_integration::ForgeKind;
|
use rhema_forge_integration::ForgeKind;
|
||||||
use rhema_forge_integration::triage::Role;
|
use rhema_forge_integration::triage::Role;
|
||||||
@@ -35,6 +34,7 @@ use rhema_forge_integration::{
|
|||||||
EventKind, Forge, ForgeError, ForgeEvent, Notification, RepoRef, Snapshot, ThreadState, decode,
|
EventKind, Forge, ForgeError, ForgeEvent, Notification, RepoRef, Snapshot, ThreadState, decode,
|
||||||
parse_key,
|
parse_key,
|
||||||
};
|
};
|
||||||
|
use rhema_host_agent::{HostAgent, HostAgentConfig};
|
||||||
use rhema_identity::IdentityStore;
|
use rhema_identity::IdentityStore;
|
||||||
use rhema_rsd::{InboxItem, Outcome, ResourceKey};
|
use rhema_rsd::{InboxItem, Outcome, ResourceKey};
|
||||||
use tokio::sync::OnceCell;
|
use tokio::sync::OnceCell;
|
||||||
@@ -342,16 +342,16 @@ impl ClawHandler {
|
|||||||
ctx: &SessionContext,
|
ctx: &SessionContext,
|
||||||
workspace: &Path,
|
workspace: &Path,
|
||||||
key: &str,
|
key: &str,
|
||||||
) -> Result<CodingAgent, String> {
|
) -> Result<HostAgent, String> {
|
||||||
let (provider, model) = self.backends.current();
|
let (provider, model) = self.backends.current();
|
||||||
let config = self.agent_config(provider, &model, workspace);
|
let config = self.agent_config(provider, &model, workspace);
|
||||||
let agent = match &ctx.session.core.driver_state {
|
let agent = match &ctx.session.core.driver_state {
|
||||||
// A never-dispatched key carries no stash: start clean.
|
// A never-dispatched key carries no stash: start clean.
|
||||||
serde_json::Value::Null => CodingAgent::new(config),
|
serde_json::Value::Null => HostAgent::new(config),
|
||||||
stashed => {
|
stashed => {
|
||||||
let session: Session = serde_json::from_value(stashed.clone())
|
let session: Session = serde_json::from_value(stashed.clone())
|
||||||
.map_err(|err| format!("stashed session for {key} does not parse: {err}"))?;
|
.map_err(|err| format!("stashed session for {key} does not parse: {err}"))?;
|
||||||
CodingAgent::from_session(config, session)
|
HostAgent::from_session(config, session)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
agent.map_err(|err| format!("cannot start the coding agent for {key}: {err}"))
|
agent.map_err(|err| format!("cannot start the coding agent for {key}: {err}"))
|
||||||
@@ -367,12 +367,12 @@ impl ClawHandler {
|
|||||||
provider: Arc<dyn rhema_core::ModelProvider>,
|
provider: Arc<dyn rhema_core::ModelProvider>,
|
||||||
model: &str,
|
model: &str,
|
||||||
workspace: &Path,
|
workspace: &Path,
|
||||||
) -> CodingAgentConfig {
|
) -> HostAgentConfig {
|
||||||
let display = match &self.sandbox {
|
let display = match &self.sandbox {
|
||||||
Some(sandbox) => sandbox.workspace_for(workspace),
|
Some(sandbox) => sandbox.workspace_for(workspace),
|
||||||
None => workspace.to_path_buf(),
|
None => workspace.to_path_buf(),
|
||||||
};
|
};
|
||||||
let mut config = CodingAgentConfig::new(provider, model, &display, AllowAll);
|
let mut config = HostAgentConfig::new(provider, model, &display, AllowAll);
|
||||||
// Write the resolved value, not an override: the coding agent's
|
// Write the resolved value, not an override: the coding agent's
|
||||||
// own default is on now, and the config's `false` must win.
|
// own default is on now, and the config's `false` must win.
|
||||||
config.transcript = self
|
config.transcript = self
|
||||||
@@ -1100,6 +1100,7 @@ mod tests {
|
|||||||
Content::Text("on it".into()),
|
Content::Text("on it".into()),
|
||||||
Content::Text(" — closing.".into()),
|
Content::Text(" — closing.".into()),
|
||||||
],
|
],
|
||||||
|
annotations: Default::default(),
|
||||||
};
|
};
|
||||||
assert_eq!(final_text(&message).as_deref(), Some("on it — closing."));
|
assert_eq!(final_text(&message).as_deref(), Some("on it — closing."));
|
||||||
let tool_only = Message {
|
let tool_only = Message {
|
||||||
@@ -1110,6 +1111,7 @@ mod tests {
|
|||||||
args: serde_json::json!({}),
|
args: serde_json::json!({}),
|
||||||
provider_data: serde_json::Value::Null,
|
provider_data: serde_json::Value::Null,
|
||||||
})],
|
})],
|
||||||
|
annotations: Default::default(),
|
||||||
};
|
};
|
||||||
assert_eq!(final_text(&tool_only), None, "no text, no reply");
|
assert_eq!(final_text(&tool_only), None, "no text, no reply");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,16 +64,18 @@
|
|||||||
//! rhema-code's UI draws for a steered turn.
|
//! rhema-code's UI draws for a steered turn.
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::num::NonZeroU32;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
use rhema_agent_tools::{AllowAll, ExpandPastes, ShellTools, revive_dangling_calls};
|
|
||||||
use rhema_autonomous_agent::{Allowlist, Handler, ResolverChain, SessionContext, async_trait};
|
use rhema_autonomous_agent::{Allowlist, Handler, ResolverChain, SessionContext, async_trait};
|
||||||
|
use rhema_bash::{AllowAll, ShellTools};
|
||||||
use rhema_core::{
|
use rhema_core::{
|
||||||
Agent, ChatParams, Content, Event as ModelEvent, EventSink, Image, ImageMediaType, Message,
|
Agent, ChatParams, Content, Event as ModelEvent, EventSink, Image, ImageMediaType, Message,
|
||||||
ModelProvider, Role, Session, ToolContext, ToolResolver, close_orphaned_calls, run_turn,
|
ModelProvider, Role, Session, ToolContext, ToolResolver, close_orphaned_calls,
|
||||||
|
revive_dangling_calls, run_turn,
|
||||||
};
|
};
|
||||||
use rhema_memory::{MemoryResolver, MemoryStore, Scope};
|
use rhema_memory::{MemoryResolver, MemoryStore, Scope};
|
||||||
use rhema_rsd::{Dispatcher, Event, KeyFn, Outcome, ResourceKey};
|
use rhema_rsd::{Dispatcher, Event, KeyFn, Outcome, ResourceKey};
|
||||||
@@ -234,7 +236,7 @@ pub struct InteractiveHandler {
|
|||||||
/// How many tool rounds one turn may run before it is cut off — the
|
/// How many tool rounds one turn may run before it is cut off — the
|
||||||
/// config's runaway guard for an agent meant to work unattended; a
|
/// config's runaway guard for an agent meant to work unattended; a
|
||||||
/// follow-up message keeps going.
|
/// follow-up message keeps going.
|
||||||
max_turn_steps: u32,
|
max_turn_steps: NonZeroU32,
|
||||||
/// The extension set the tool half of the chain is cut from, per
|
/// The extension set the tool half of the chain is cut from, per
|
||||||
/// dispatch, in the standard set's order — the same set whose
|
/// dispatch, in the standard set's order — the same set whose
|
||||||
/// sources the daemon's tick drives and whose boot pass runs first.
|
/// sources the daemon's tick drives and whose boot pass runs first.
|
||||||
@@ -243,7 +245,7 @@ pub struct InteractiveHandler {
|
|||||||
/// decorator refreshes it per request, `zoom` reads it, and it
|
/// decorator refreshes it per request, `zoom` reads it, and it
|
||||||
/// lives here — the agent rebuilds per dispatch, the log must not.
|
/// lives here — the agent rebuilds per dispatch, the log must not.
|
||||||
transcript_mirror: Option<Arc<std::sync::Mutex<rhema_transcript::Transcript>>>,
|
transcript_mirror: Option<Arc<std::sync::Mutex<rhema_transcript::Transcript>>>,
|
||||||
/// The wired [`vision`](rhema_agent_tools::vision) section for the
|
/// The wired [`vision`](rhema_bash::vision) section for the
|
||||||
/// prompt, when provisioning succeeded — the same wiring whose env
|
/// prompt, when provisioning succeeded — the same wiring whose env
|
||||||
/// map lights the shell's inbox up.
|
/// map lights the shell's inbox up.
|
||||||
vision: Option<String>,
|
vision: Option<String>,
|
||||||
@@ -271,7 +273,7 @@ impl InteractiveHandler {
|
|||||||
hub: Arc<EventHub>,
|
hub: Arc<EventHub>,
|
||||||
notifications: Arc<NotificationStore>,
|
notifications: Arc<NotificationStore>,
|
||||||
attachments: Arc<crate::attachments::AttachmentStore>,
|
attachments: Arc<crate::attachments::AttachmentStore>,
|
||||||
max_turn_steps: u32,
|
max_turn_steps: NonZeroU32,
|
||||||
extensions: Arc<crate::extension::Extensions>,
|
extensions: Arc<crate::extension::Extensions>,
|
||||||
transcript: bool,
|
transcript: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@@ -280,7 +282,7 @@ impl InteractiveHandler {
|
|||||||
// chat's commands, and its staged images attach to their
|
// chat's commands, and its staged images attach to their
|
||||||
// results. Local shells only — the interactive handler's
|
// results. Local shells only — the interactive handler's
|
||||||
// executor is this host's by construction.
|
// executor is this host's by construction.
|
||||||
let vision = rhema_agent_tools::vision::wire(std::env::var_os("BASH_ENV"));
|
let vision = rhema_bash::vision::wire(std::env::var_os("BASH_ENV"));
|
||||||
let tools = Arc::new(match vision {
|
let tools = Arc::new(match vision {
|
||||||
Some(wiring) => ShellTools::with_env(&workspace, &wiring.shell_env),
|
Some(wiring) => ShellTools::with_env(&workspace, &wiring.shell_env),
|
||||||
None => ShellTools::new(&workspace),
|
None => ShellTools::new(&workspace),
|
||||||
@@ -328,12 +330,7 @@ impl InteractiveHandler {
|
|||||||
/// request advertises.
|
/// request advertises.
|
||||||
fn agent(&self, key: &ResourceKey) -> Result<Agent, String> {
|
fn agent(&self, key: &ResourceKey) -> Result<Agent, String> {
|
||||||
let (provider, model) = self.backends.current();
|
let (provider, model) = self.backends.current();
|
||||||
// Chat input may carry embedded pastes — the compact chip form
|
// The view rides outside the engine: stubs, whole messages,
|
||||||
// the UIs mint and the session keeps — so the provider wraps in
|
|
||||||
// the same expansion the coding driver wraps its own with: the
|
|
||||||
// model sees plain text, the transcript keeps the chips.
|
|
||||||
let provider: Arc<dyn ModelProvider> = Arc::new(ExpandPastes::new(provider));
|
|
||||||
// The view rides outside the expansion: stubs, whole messages,
|
|
||||||
// and zoom output all show the text the model would have seen.
|
// and zoom output all show the text the model would have seen.
|
||||||
let provider: Arc<dyn ModelProvider> = match &self.transcript_mirror {
|
let provider: Arc<dyn ModelProvider> = match &self.transcript_mirror {
|
||||||
Some(mirror) => Arc::new(rhema_transcript::TranscriptView::new(
|
Some(mirror) => Arc::new(rhema_transcript::TranscriptView::new(
|
||||||
@@ -575,10 +572,17 @@ impl InteractiveHandler {
|
|||||||
// future at its current await — a streaming request, or a
|
// future at its current await — a streaming request, or a
|
||||||
// running shell command, whose child dies with the drop. The
|
// running shell command, whose child dies with the drop. The
|
||||||
// next round revives whatever committed before the drop.
|
// next round revives whatever committed before the drop.
|
||||||
|
// Chat input may carry embedded pastes — the compact chip form
|
||||||
|
// the UIs mint — migrated here into the plain record the engine
|
||||||
|
// and its providers read: the payload sits in the text, its span
|
||||||
|
// note survives the checkpoint, and the model never sees a mark.
|
||||||
|
let mut turn_input = [Message::text_with_images(Role::User, input, core_images)];
|
||||||
|
rhema_core::paste::migrate(&mut turn_input);
|
||||||
|
let [turn_input] = turn_input;
|
||||||
let mut turn = Box::pin(run_turn(
|
let mut turn = Box::pin(run_turn(
|
||||||
&mut agent,
|
&mut agent,
|
||||||
&mut session,
|
&mut session,
|
||||||
Message::text_with_images(Role::User, input, core_images),
|
turn_input,
|
||||||
&mut sink,
|
&mut sink,
|
||||||
&tools,
|
&tools,
|
||||||
self.max_turn_steps,
|
self.max_turn_steps,
|
||||||
@@ -722,8 +726,16 @@ enum Round {
|
|||||||
fn restore_session(stashed: &Value, key: &str) -> Result<Session, String> {
|
fn restore_session(stashed: &Value, key: &str) -> Result<Session, String> {
|
||||||
match stashed {
|
match stashed {
|
||||||
Value::Null => Ok(Session::default()),
|
Value::Null => Ok(Session::default()),
|
||||||
stashed => serde_json::from_value(stashed.clone())
|
stashed => {
|
||||||
.map_err(|err| format!("stashed session for {key} does not parse: {err}")),
|
let mut session: Session = serde_json::from_value(stashed.clone())
|
||||||
|
.map_err(|err| format!("stashed session for {key} does not parse: {err}"))?;
|
||||||
|
// A session stashed before paste spans existed carries the
|
||||||
|
// 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);
|
||||||
|
Ok(session)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,6 +849,10 @@ impl EventSink for HubSink {
|
|||||||
| ModelEvent::Usage(_)
|
| ModelEvent::Usage(_)
|
||||||
| ModelEvent::RetryWait { .. }
|
| ModelEvent::RetryWait { .. }
|
||||||
| ModelEvent::StepEnd { .. } => return,
|
| ModelEvent::StepEnd { .. } => return,
|
||||||
|
// The engine's event enum is non-exhaustive: a future
|
||||||
|
// event arrives here, dropped like the rest of the engine's
|
||||||
|
// own bookkeeping until a turn-event shape exists for it.
|
||||||
|
_ => return,
|
||||||
};
|
};
|
||||||
self.hub.emit(&self.key, turn);
|
self.hub.emit(&self.key, turn);
|
||||||
}
|
}
|
||||||
@@ -1186,6 +1202,7 @@ mod tests {
|
|||||||
args,
|
args,
|
||||||
provider_data: serde_json::Value::Null,
|
provider_data: serde_json::Value::Null,
|
||||||
})],
|
})],
|
||||||
|
annotations: Default::default(),
|
||||||
},
|
},
|
||||||
stop_reason: StopReason::ToolUse,
|
stop_reason: StopReason::ToolUse,
|
||||||
usage: Usage::default(),
|
usage: Usage::default(),
|
||||||
@@ -1387,11 +1404,13 @@ mod tests {
|
|||||||
Content::Text("on it".into()),
|
Content::Text("on it".into()),
|
||||||
Content::Text(" — done.".into()),
|
Content::Text(" — done.".into()),
|
||||||
],
|
],
|
||||||
|
annotations: Default::default(),
|
||||||
};
|
};
|
||||||
assert_eq!(final_text(&message).as_deref(), Some("on it — done."));
|
assert_eq!(final_text(&message).as_deref(), Some("on it — done."));
|
||||||
let empty = Message {
|
let empty = Message {
|
||||||
role: Role::Assistant,
|
role: Role::Assistant,
|
||||||
content: vec![Content::Text(" ".into())],
|
content: vec![Content::Text(" ".into())],
|
||||||
|
annotations: Default::default(),
|
||||||
};
|
};
|
||||||
assert_eq!(final_text(&empty), None);
|
assert_eq!(final_text(&empty), None);
|
||||||
}
|
}
|
||||||
@@ -1502,6 +1521,42 @@ mod tests {
|
|||||||
assert!(err.contains("does not parse"), "{err}");
|
assert!(err.contains("does not parse"), "{err}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A session stashed before paste spans existed carries the embedded
|
||||||
|
/// form in its prompts; the restore pass rewrites it so a provider
|
||||||
|
/// never sees a mark, and the chip rides as the span note instead.
|
||||||
|
#[test]
|
||||||
|
fn a_legacy_stash_is_migrated_on_restore() {
|
||||||
|
let payload = "l1\nl2\nl3";
|
||||||
|
let embedded = format!("review this:\u{FFFC}{payload}\u{FFFC} please");
|
||||||
|
let stashed = json!({
|
||||||
|
"history": [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [embedded]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"driver_state": serde_json::Value::Null
|
||||||
|
});
|
||||||
|
let session = restore_session(&stashed, "interactive:web").expect("the legacy stash loads");
|
||||||
|
assert_eq!(
|
||||||
|
final_text(&session.history[0]),
|
||||||
|
Some(format!("review this:{payload} please")),
|
||||||
|
"the mark and its payload land as plain text"
|
||||||
|
);
|
||||||
|
let text = final_text(&session.history[0]).expect("the prompt is text");
|
||||||
|
// 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 {
|
||||||
|
start: "review this:".len(),
|
||||||
|
end: "review this:".len() + payload.len(),
|
||||||
|
lines: 3,
|
||||||
|
}]
|
||||||
|
);
|
||||||
|
assert!(!text.contains('\u{FFFC}'), "no mark survives the restore");
|
||||||
|
}
|
||||||
|
|
||||||
/// The full dispatch, in-process: one message in, one scripted reply
|
/// The full dispatch, in-process: one message in, one scripted reply
|
||||||
/// out, the turn streamed through the hub, the conversation stashed.
|
/// out, the turn streamed through the hub, the conversation stashed.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
//! instance and job resolve through the store, the workspace is the
|
//! instance and job resolve through the store, the workspace is the
|
||||||
//! instance's path, the session blob (or a fresh agent) is loaded, the
|
//! instance's path, the session blob (or a fresh agent) is loaded, the
|
||||||
//! allowlist is permissive exactly as the forge path's — and then one
|
//! allowlist is permissive exactly as the forge path's — and then one
|
||||||
//! `CodingAgent` turn runs. The final text lands in the job row and
|
//! `HostAgent` turn runs. The final text lands in the job row and
|
||||||
//! the user's notifications; the turn itself streams nowhere, its
|
//! the user's notifications; the turn itself streams nowhere, its
|
||||||
//! observability is the stderr tool log.
|
//! observability is the stderr tool log.
|
||||||
//!
|
//!
|
||||||
@@ -22,12 +22,13 @@
|
|||||||
//! fails before any model call. The trust boundary is unchanged from
|
//! fails before any model call. The trust boundary is unchanged from
|
||||||
//! the forge path — the bearer-gated surface and the instance list.
|
//! the forge path — the bearer-gated surface and the instance list.
|
||||||
|
|
||||||
|
use std::num::NonZeroU32;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use rhema_agent_tools::ShellTools;
|
|
||||||
use rhema_autonomous_agent::{Handler, SessionContext, Source, SourceError, async_trait};
|
use rhema_autonomous_agent::{Handler, SessionContext, Source, SourceError, async_trait};
|
||||||
use rhema_coding_agent::{AllowAll, CodingAgent, CodingAgentConfig};
|
use rhema_bash::{AllowAll, ShellTools};
|
||||||
use rhema_core::{Event as ModelEvent, EventSink};
|
use rhema_core::{Event as ModelEvent, EventSink};
|
||||||
|
use rhema_host_agent::{HostAgent, HostAgentConfig};
|
||||||
use rhema_rsd::{Dispatcher, Event, KeyFn, Outcome, ResourceKey};
|
use rhema_rsd::{Dispatcher, Event, KeyFn, Outcome, ResourceKey};
|
||||||
|
|
||||||
use crate::backends::BackendRegistry;
|
use crate::backends::BackendRegistry;
|
||||||
@@ -139,7 +140,7 @@ pub struct CodingJobHandler {
|
|||||||
backends: Arc<BackendRegistry>,
|
backends: Arc<BackendRegistry>,
|
||||||
store: Arc<CodingJobStore>,
|
store: Arc<CodingJobStore>,
|
||||||
notifications: Arc<NotificationStore>,
|
notifications: Arc<NotificationStore>,
|
||||||
max_turn_steps: u32,
|
max_turn_steps: NonZeroU32,
|
||||||
/// Whether the jobs run the bounded request view (the config's
|
/// Whether the jobs run the bounded request view (the config's
|
||||||
/// `transcript`, on unless set false).
|
/// `transcript`, on unless set false).
|
||||||
transcript: bool,
|
transcript: bool,
|
||||||
@@ -156,7 +157,7 @@ impl CodingJobHandler {
|
|||||||
backends: Arc<BackendRegistry>,
|
backends: Arc<BackendRegistry>,
|
||||||
store: Arc<CodingJobStore>,
|
store: Arc<CodingJobStore>,
|
||||||
notifications: Arc<NotificationStore>,
|
notifications: Arc<NotificationStore>,
|
||||||
max_turn_steps: u32,
|
max_turn_steps: NonZeroU32,
|
||||||
transcript: bool,
|
transcript: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -229,7 +230,7 @@ impl CodingJobHandler {
|
|||||||
Some(sandbox) => sandbox.workspace_for(&workspace),
|
Some(sandbox) => sandbox.workspace_for(&workspace),
|
||||||
None => workspace.clone(),
|
None => workspace.clone(),
|
||||||
};
|
};
|
||||||
let mut config = CodingAgentConfig::new(provider, model, &display, AllowAll);
|
let mut config = HostAgentConfig::new(provider, model, &display, AllowAll);
|
||||||
config.max_turn_steps = self.max_turn_steps;
|
config.max_turn_steps = self.max_turn_steps;
|
||||||
// A job's stashed session carries across runs and only ever
|
// A job's stashed session carries across runs and only ever
|
||||||
// grows; the view is what keeps a repeat run's steps cheap.
|
// grows; the view is what keeps a repeat run's steps cheap.
|
||||||
@@ -263,9 +264,9 @@ impl CodingJobHandler {
|
|||||||
self.fail(job_id, &instance_name, &reason);
|
self.fail(job_id, &instance_name, &reason);
|
||||||
reason
|
reason
|
||||||
})?;
|
})?;
|
||||||
CodingAgent::from_session(config, session)
|
HostAgent::from_session(config, session)
|
||||||
}
|
}
|
||||||
None => CodingAgent::new(config),
|
None => HostAgent::new(config),
|
||||||
}
|
}
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
let reason = format!("cannot start the coding agent for {instance_name:?}: {err}");
|
let reason = format!("cannot start the coding agent for {instance_name:?}: {err}");
|
||||||
@@ -275,7 +276,7 @@ impl CodingJobHandler {
|
|||||||
// Commit-before-execute rides the dispatcher exactly as the
|
// Commit-before-execute rides the dispatcher exactly as the
|
||||||
// forge handler's does: the intent is in the store before the
|
// forge handler's does: the intent is in the store before the
|
||||||
// first tool runs, and a crash-left dangling call revives at
|
// first tool runs, and a crash-left dangling call revives at
|
||||||
// turn entry (CodingAgent::turn's own revive, over the resumed
|
// turn entry (HostAgent::turn's own revive, over the resumed
|
||||||
// session).
|
// session).
|
||||||
agent.set_commit_hook(Some(ctx.commit_hook()));
|
agent.set_commit_hook(Some(ctx.commit_hook()));
|
||||||
|
|
||||||
@@ -307,7 +308,7 @@ impl CodingJobHandler {
|
|||||||
Ok(Outcome::Handled)
|
Ok(Outcome::Handled)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn save_session(&self, instance: &str, agent: &CodingAgent) {
|
fn save_session(&self, instance: &str, agent: &HostAgent) {
|
||||||
match serde_json::to_string(agent.session()) {
|
match serde_json::to_string(agent.session()) {
|
||||||
Ok(blob) => {
|
Ok(blob) => {
|
||||||
let _ = self.store.save_session(instance, &blob);
|
let _ = self.store.save_session(instance, &blob);
|
||||||
@@ -387,7 +388,13 @@ mod tests {
|
|||||||
BackendRegistry::new(vec![Backend::headless("mock", provider)], None)
|
BackendRegistry::new(vec![Backend::headless("mock", provider)], None)
|
||||||
.expect("a single mock backend always constructs"),
|
.expect("a single mock backend always constructs"),
|
||||||
);
|
);
|
||||||
CodingJobHandler::new(backends, store, notifications, 16, true)
|
CodingJobHandler::new(
|
||||||
|
backends,
|
||||||
|
store,
|
||||||
|
notifications,
|
||||||
|
NonZeroU32::new(16).unwrap(),
|
||||||
|
true,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reply(text: &str) -> ModelOutput {
|
fn reply(text: &str) -> ModelOutput {
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
if let Some(Command::Vision { args: rest }) = &args.command {
|
if let Some(Command::Vision { args: rest }) = &args.command {
|
||||||
let mut argv = Vec::with_capacity(rest.len() + 1);
|
let mut argv = Vec::with_capacity(rest.len() + 1);
|
||||||
argv.push(std::ffi::OsString::from(rhema_agent_tools::vision::MODE));
|
argv.push(std::ffi::OsString::from(rhema_bash::vision::MODE));
|
||||||
argv.extend(rest.iter().cloned());
|
argv.extend(rest.iter().cloned());
|
||||||
std::process::exit(rhema_agent_tools::vision::cli_run(&argv));
|
std::process::exit(rhema_bash::vision::cli_run(&argv));
|
||||||
}
|
}
|
||||||
if let Err(err) = run(args).await {
|
if let Err(err) = run(args).await {
|
||||||
eprintln!("error: {err}");
|
eprintln!("error: {err}");
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use std::sync::{Arc, OnceLock};
|
use std::sync::{Arc, OnceLock};
|
||||||
|
|
||||||
use rhema_coding_agent::CodingAgentConfig;
|
use rhema_host_agent::HostAgentConfig;
|
||||||
|
|
||||||
/// What one wiring produced, held for the process.
|
/// What one wiring produced, held for the process.
|
||||||
struct Wired {
|
struct Wired {
|
||||||
@@ -61,7 +61,7 @@ fn wired() -> Option<&'static Wired> {
|
|||||||
/// init file, the socket, the token), the prompt's `mcp` lines, and
|
/// init file, the socket, the token), the prompt's `mcp` lines, and
|
||||||
/// the persisted off switch. A frontend without wiring changes
|
/// the persisted off switch. A frontend without wiring changes
|
||||||
/// nothing.
|
/// nothing.
|
||||||
pub(crate) fn apply(config: &mut CodingAgentConfig) {
|
pub(crate) fn apply(config: &mut HostAgentConfig) {
|
||||||
let Some(wired) = wired() else {
|
let Some(wired) = wired() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -82,11 +82,11 @@ mod tests {
|
|||||||
/// same map).
|
/// same map).
|
||||||
#[test]
|
#[test]
|
||||||
fn apply_without_any_wiring_leaves_the_config_alone() {
|
fn apply_without_any_wiring_leaves_the_config_alone() {
|
||||||
let mut config = CodingAgentConfig::new(
|
let mut config = HostAgentConfig::new(
|
||||||
rhema_core::mock::MockProvider::new([]),
|
rhema_core::mock::MockProvider::new([]),
|
||||||
"m",
|
"m",
|
||||||
std::path::Path::new("/tmp"),
|
std::path::Path::new("/tmp"),
|
||||||
rhema_agent_tools::AllowAll,
|
rhema_bash::AllowAll,
|
||||||
);
|
);
|
||||||
let before = config.shell_env.clone();
|
let before = config.shell_env.clone();
|
||||||
apply(&mut config);
|
apply(&mut config);
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ impl ModelProvider for MockLoop {
|
|||||||
message: Message {
|
message: Message {
|
||||||
role: Role::Assistant,
|
role: Role::Assistant,
|
||||||
content: vec![Content::Text(text)],
|
content: vec![Content::Text(text)],
|
||||||
|
annotations: Default::default(),
|
||||||
},
|
},
|
||||||
stop_reason: StopReason::EndTurn,
|
stop_reason: StopReason::EndTurn,
|
||||||
usage: Usage::default(),
|
usage: Usage::default(),
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use base64::Engine as _;
|
use base64::Engine as _;
|
||||||
use rhema_agent_tools::exec::{Executed, ShellError, ShellExecutor, default_executor_with};
|
use rhema_bash::exec::{Executed, ShellError, ShellExecutor, default_executor_with};
|
||||||
use rhema_sandbox::{ExecRequest, Sandbox, ShellSandbox, WorkspaceSeed};
|
use rhema_sandbox::{ExecRequest, Sandbox, ShellSandbox, WorkspaceSeed};
|
||||||
use rhema_sandbox_http::HttpSandbox;
|
use rhema_sandbox_http::HttpSandbox;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -373,6 +373,9 @@ fn protocol_error(err: rhema_sandbox::SandboxError) -> ShellError {
|
|||||||
rhema_sandbox::SandboxError::Timeout(secs) => ShellError::Timeout(secs),
|
rhema_sandbox::SandboxError::Timeout(secs) => ShellError::Timeout(secs),
|
||||||
rhema_sandbox::SandboxError::Unavailable(message)
|
rhema_sandbox::SandboxError::Unavailable(message)
|
||||||
| rhema_sandbox::SandboxError::Failed(message) => ShellError::Failed(message),
|
| rhema_sandbox::SandboxError::Failed(message) => ShellError::Failed(message),
|
||||||
|
// The error enum is non-exhaustive: an unknown failure is still
|
||||||
|
// a failure, reported in-band with its own text.
|
||||||
|
_ => ShellError::Failed(err.to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,21 +9,15 @@
|
|||||||
|
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
|
||||||
use std::sync::{Arc, OnceLock};
|
use std::sync::Arc;
|
||||||
|
|
||||||
use rhema_coding_agent::CodingAgentConfig;
|
use rhema_host_agent::HostAgentConfig;
|
||||||
|
|
||||||
static WIRED: OnceLock<Option<Arc<rhema_agent_tools::vision::Wiring>>> = OnceLock::new();
|
/// The daemon's wiring, provisioned at first use and kept for the
|
||||||
|
/// process's life — the toolkit's own process-wide cache holds it, so
|
||||||
/// The daemon's wiring, established at first use and kept for the
|
/// `None` only when provisioning failed, and a failure does not retry.
|
||||||
/// process's life. `None` only when provisioning failed, cached like
|
pub(crate) fn wired() -> Option<&'static Arc<rhema_bash::vision::Wiring>> {
|
||||||
/// every answer this static gives.
|
rhema_bash::vision::wire(std::env::var_os("BASH_ENV"))
|
||||||
pub(crate) fn wired() -> Option<&'static Arc<rhema_agent_tools::vision::Wiring>> {
|
|
||||||
WIRED
|
|
||||||
.get_or_init(|| {
|
|
||||||
rhema_agent_tools::vision::wire(std::env::var_os("BASH_ENV")).map(Arc::clone)
|
|
||||||
})
|
|
||||||
.as_ref()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The init file a later provisioner chains through — `None` when the
|
/// The init file a later provisioner chains through — `None` when the
|
||||||
@@ -36,7 +30,7 @@ pub(crate) fn init_path() -> Option<std::ffi::OsString> {
|
|||||||
/// Layers the wiring onto one agent config: the shell env map (the
|
/// Layers the wiring onto one agent config: the shell env map (the
|
||||||
/// init file, the binary, the staging directory) and the prompt's
|
/// init file, the binary, the staging directory) and the prompt's
|
||||||
/// vision section. A frontend without wiring changes nothing.
|
/// vision section. A frontend without wiring changes nothing.
|
||||||
pub(crate) fn apply(config: &mut CodingAgentConfig) {
|
pub(crate) fn apply(config: &mut HostAgentConfig) {
|
||||||
let Some(wired) = wired() else {
|
let Some(wired) = wired() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -52,11 +46,11 @@ mod tests {
|
|||||||
/// values are constants, so extending twice is the same map.
|
/// values are constants, so extending twice is the same map.
|
||||||
#[test]
|
#[test]
|
||||||
fn apply_twice_is_apply_once() {
|
fn apply_twice_is_apply_once() {
|
||||||
let mut config = CodingAgentConfig::new(
|
let mut config = HostAgentConfig::new(
|
||||||
rhema_core::mock::MockProvider::new([]),
|
rhema_core::mock::MockProvider::new([]),
|
||||||
"m",
|
"m",
|
||||||
std::path::Path::new("/tmp"),
|
std::path::Path::new("/tmp"),
|
||||||
rhema_agent_tools::AllowAll,
|
rhema_bash::AllowAll,
|
||||||
);
|
);
|
||||||
apply(&mut config);
|
apply(&mut config);
|
||||||
let once = config.shell_env.clone();
|
let once = config.shell_env.clone();
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ fn reply(text: &str) -> ModelOutput {
|
|||||||
fn tool_call(id: &str, name: &str, args: Value) -> ModelOutput {
|
fn tool_call(id: &str, name: &str, args: Value) -> ModelOutput {
|
||||||
ModelOutput {
|
ModelOutput {
|
||||||
message: Message {
|
message: Message {
|
||||||
|
annotations: Default::default(),
|
||||||
role: Role::Assistant,
|
role: Role::Assistant,
|
||||||
content: vec![Content::ToolCall(rhema_core::ToolCall {
|
content: vec![Content::ToolCall(rhema_core::ToolCall {
|
||||||
id: id.to_owned(),
|
id: id.to_owned(),
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ name: rhema-claw
|
|||||||
description: "The resident forge-watching agent daemon: forge watches and a
|
description: "The resident forge-watching agent daemon: forge watches and a
|
||||||
chat HTTP surface over one SQLite store."
|
chat HTTP surface over one SQLite store."
|
||||||
type: application
|
type: application
|
||||||
version: 0.3.0
|
version: 0.4.0
|
||||||
appVersion: "0.3.0"
|
appVersion: "0.4.0"
|
||||||
@@ -15,10 +15,10 @@ publish = false
|
|||||||
rusqlite = { version = "0.40", features = ["bundled"] }
|
rusqlite = { version = "0.40", features = ["bundled"] }
|
||||||
# The reminder source: one `Source` over the feeds, detect-pass shaped
|
# The reminder source: one `Source` over the feeds, detect-pass shaped
|
||||||
# like the task scheduler's
|
# like the task scheduler's
|
||||||
rhema-autonomous-agent = "0.3.0"
|
rhema-autonomous-agent = "0.4.0"
|
||||||
# The reminder source ingests its slots into a `Dispatcher`; the event
|
# The reminder source ingests its slots into a `Dispatcher`; the event
|
||||||
# and key-function shapes are the dispatcher's
|
# and key-function shapes are the dispatcher's
|
||||||
rhema-rsd = "0.3.0"
|
rhema-rsd = "0.4.0"
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ publish = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# The dispatch seam: watches ingest into a Dispatcher
|
# The dispatch seam: watches ingest into a Dispatcher
|
||||||
rhema-rsd = "0.3.0"
|
rhema-rsd = "0.4.0"
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|||||||
Reference in new issue
Block a user