The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore(deps): update vendored crates and prune dead subagent code
Steven Enamakelb084f03be653
diff --git a/Cargo.lock b/Cargo.lockindex b9ff277857..e95a7d214b 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -326,7 +326,7 @@ version = "1.1.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"dependencies = [- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -337,7 +337,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"dependencies = ["anstyle","once_cell_polyfill",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -377,7 +377,7 @@ dependencies = ["objc2-foundation 0.3.2","parking_lot","percent-encoding",- "windows-sys 0.59.0",+ "windows-sys 0.61.2","x11rb",]@@ -1258,7 +1258,7 @@ dependencies = ["cap-primitives","cap-std","io-lifetimes 3.0.1",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -1275,7 +1275,7 @@ dependencies = ["maybe-owned","rustix 1.1.5","rustix-linux-procfs",- "windows-sys 0.60.2",+ "windows-sys 0.61.2","winx",]@@ -2480,7 +2480,7 @@ dependencies = ["libc","option-ext","redox_users 0.5.3",- "windows-sys 0.59.0",+ "windows-sys 0.61.2",][[package]]@@ -2755,7 +2755,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"dependencies = ["libc",- "windows-sys 0.59.0",+ "windows-sys 0.61.2",][[package]]@@ -2808,6 +2808,12 @@ dependencies = ["pin-project-lite",]+[[package]]+name = "extended"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365"+[[package]]name = "fallible-iterator"version = "0.3.0"@@ -4997,6 +5003,20 @@ dependencies = ["pxfm",]+[[package]]+name = "mp4"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c9ef834d5ed55e494a2ae350220314dc4aacd1c43a9498b00e320e0ea352a5c3"+dependencies = [+ "byteorder",+ "bytes",+ "num-rational",+ "serde",+ "serde_json",+ "thiserror 1.0.69",+]+[[package]]name = "multiversion_no_op"version = "1.0.0"@@ -5119,7 +5139,7 @@ version = "0.50.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"dependencies = [- "windows-sys 0.59.0",+ "windows-sys 0.61.2",][[package]]@@ -5206,6 +5226,7 @@ dependencies = ["num-bigint","num-integer","num-traits",+ "serde",][[package]]@@ -6098,6 +6119,12 @@ version = "0.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"+[[package]]+name = "opus-pure"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4de7c2ad44427a636b27bf0b03eb29e713775ba1b45ff31a0618c19ee5adb215"+[[package]]name = "ordered-float"version = "4.6.0"@@ -6129,6 +6156,26 @@ version = "0.5.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e"+[[package]]+name = "oxideav-aac"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "35453ffa827080f322dba5d2233879f008627d4ffb07c496c0c6fe3190b35048"+dependencies = [+ "oxideav-core",+]++[[package]]+name = "oxideav-core"+version = "0.1.41"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3be7e0bb531e2acacae221b386a6a2892a5dce4ef1ce6b58e48888c568e9139f"+dependencies = [+ "bytemuck",+ "serde_json",+ "thiserror 2.0.21",+]+[[package]]name = "p12-keystore"version = "0.2.1"@@ -6874,7 +6921,7 @@ dependencies = ["once_cell","socket2","tracing",- "windows-sys 0.59.0",+ "windows-sys 0.61.2",][[package]]@@ -7252,6 +7299,12 @@ version = "0.1.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b6a15a2fa0bfda9361941c45550896ae87b15cc6c8c939ea350079670332e211"+[[package]]+name = "regex-lite"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973"+[[package]]name = "regex-syntax"version = "0.8.11"@@ -7516,7 +7569,7 @@ dependencies = ["errno","libc","linux-raw-sys 0.12.1",- "windows-sys 0.59.0",+ "windows-sys 0.61.2",][[package]]@@ -7600,7 +7653,7 @@ dependencies = ["security-framework 3.7.0","security-framework-sys","webpki-root-certs",- "windows-sys 0.59.0",+ "windows-sys 0.61.2",][[package]]@@ -7639,6 +7692,17 @@ dependencies = ["wait-timeout",]+[[package]]+name = "rvoip-codec-core"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b1c28127efb2f580e03243c5999ff8a8c13b0ed4cf8a03aaafdb37c23fbf8cbb"+dependencies = [+ "thiserror 1.0.69",+ "tracing",+ "tracing-subscriber",+]+[[package]]name = "ryu"version = "1.0.23"@@ -8266,7 +8330,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"dependencies = ["libc",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -8378,7 +8442,7 @@ dependencies = ["cfg-if","libc","psm",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -8468,6 +8532,117 @@ version = "0.1.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a"+[[package]]+name = "symphonia"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7edef6a96b696d4e0cab5ee9ebb7ca155ed95f30a6b45bbb8b97d2727f02424"+dependencies = [+ "lazy_static",+ "symphonia-bundle-mp3",+ "symphonia-codec-aac",+ "symphonia-codec-pcm",+ "symphonia-core",+ "symphonia-format-isomp4",+ "symphonia-format-riff",+ "symphonia-metadata",+]++[[package]]+name = "symphonia-bundle-mp3"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "98ea5ffc8716bff677dfb3b01b420c7b758de901a72b8c330bf2040ab74b4add"+dependencies = [+ "lazy_static",+ "log",+ "symphonia-core",+]++[[package]]+name = "symphonia-codec-aac"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f5bf8e39552d34a3c4c98333370e62f48c92456d2e814f273b5c3ad7c4a5f45c"+dependencies = [+ "lazy_static",+ "log",+ "symphonia-common",+ "symphonia-core",+]++[[package]]+name = "symphonia-codec-pcm"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e04ba75686acbe43542fdd374571195f0530c0b7785ca25cc6840e9c6c4b6eea"+dependencies = [+ "log",+ "symphonia-core",+]++[[package]]+name = "symphonia-common"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2acc3fcc18ec9b8cdd48614e259c4cf0d27b71d41e5d9b120b42c5adab12d7c4"+dependencies = [+ "log",+ "symphonia-core",+ "symphonia-metadata",+]++[[package]]+name = "symphonia-core"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "01c412864d599d4750d0c3d684d7e093ec05e5309681ef5252cc1096a437f6e0"+dependencies = [+ "bitflags 2.13.2",+ "bytemuck",+ "lazy_static",+ "log",+ "num-complex",+ "smallvec",+]++[[package]]+name = "symphonia-format-isomp4"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0e681a70e1870d34e02abf1dbc51e4267c3f1827801474e8870be8c689fc4dc3"+dependencies = [+ "log",+ "symphonia-common",+ "symphonia-core",+ "symphonia-metadata",+]++[[package]]+name = "symphonia-format-riff"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ff70929083a8c1a5f6cd7c904b6071c7914ad04739b510c2f7239dfc9b7dabe"+dependencies = [+ "extended",+ "log",+ "symphonia-core",+ "symphonia-metadata",+]++[[package]]+name = "symphonia-metadata"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "83713a97705d77bdef7cdbc0768fd6e5a54e4cd7e48d60a806ae85639e2c87c6"+dependencies = [+ "lazy_static",+ "log",+ "regex-lite",+ "smallvec",+ "symphonia-core",+]+[[package]]name = "syn"version = "1.0.109"@@ -8618,7 +8793,7 @@ dependencies = ["getrandom 0.4.3","once_cell","rustix 1.1.5",- "windows-sys 0.59.0",+ "windows-sys 0.61.2",][[package]]@@ -8631,7 +8806,7 @@ dependencies = ["parking_lot","rustix 1.1.5","signal-hook",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -8801,7 +8976,8 @@ dependencies = ["serde","serde_json","thiserror 2.0.21",- "tinystoragedrivers-core",+ "tinystoragedrivers-api",+ "tinystoragedrivers-types","tinytools 0.6.0","tokio","tracing",@@ -8819,7 +8995,7 @@ dependencies = [[[package]]name = "tinyagents-definition"-version = "2.11.0"+version = "3.0.0"dependencies = ["anyhow","async-trait",@@ -8830,26 +9006,9 @@ dependencies = ["tracing",]-[[package]]-name = "tinyagents-graph"-version = "2.11.0"-dependencies = [- "async-trait",- "futures",- "serde",- "serde_json",- "tinyagents-harness",- "tinyagents-storage-kit",- "tinyagents-tasks",- "tinyinference-llm 0.5.0",- "tinytools 0.6.0",- "tokio",- "tracing",-]-[[package]]name = "tinyagents-harness"-version = "2.11.0"+version = "3.0.0"dependencies = ["anyhow","async-trait",@@ -8881,7 +9040,6 @@ dependencies = ["tinystoragedrivers-types","tinytools 0.6.0","tinytools-agent 0.6.0",- "tinytools-std","tokio","tracing","uuid",@@ -8891,14 +9049,25 @@ dependencies = [[[package]]name = "tinyagents-harness-tools"-version = "2.11.0"+version = "3.0.0"dependencies = ["anyhow","async-trait",+ "base64 0.23.1","chrono","chrono-tz",+ "fs2",+ "futures-util",+ "glob",+ "libc",+ "log",+ "parking_lot",+ "regex",+ "reqwest 0.12.28",+ "rustix 1.1.5","serde","serde_json",+ "sha2 0.11.1","tinyagents-harness","tinyagents-orchestration","tinyagents-tasks",@@ -8906,11 +9075,13 @@ dependencies = ["tinytools 0.6.0","tokio","tracing",+ "uuid",+ "walkdir",][[package]]name = "tinyagents-hooks"-version = "2.11.0"+version = "3.0.0"dependencies = ["anyhow","async-trait",@@ -8928,7 +9099,7 @@ dependencies = [[[package]]name = "tinyagents-live"-version = "2.11.0"+version = "3.0.0"dependencies = ["serde_json","tinyagents-harness",@@ -8939,7 +9110,7 @@ dependencies = [[[package]]name = "tinyagents-orchestration"-version = "2.11.0"+version = "3.0.0"dependencies = ["anyhow","async-trait",@@ -8950,7 +9121,6 @@ dependencies = ["sha2 0.11.1","thiserror 2.0.21","tinyagents-definition",- "tinyagents-graph","tinyagents-harness","tinyagents-session","tinyagents-storage-kit",@@ -8964,7 +9134,7 @@ dependencies = [[[package]]name = "tinyagents-registry"-version = "2.11.0"+version = "3.0.0"dependencies = ["anyhow","chrono",@@ -8979,12 +9149,13 @@ dependencies = [[[package]]name = "tinyagents-runtime"-version = "2.11.0"+version = "3.0.0"dependencies = ["anyhow","async-trait","chrono","serde_json",+ "sha2 0.11.1","thiserror 2.0.21","tinyagents-harness","tinyagents-hooks",@@ -8998,7 +9169,7 @@ dependencies = [[[package]]name = "tinyagents-session"-version = "2.11.0"+version = "3.0.0"dependencies = ["anyhow","async-trait",@@ -9022,7 +9193,7 @@ dependencies = [[[package]]name = "tinyagents-storage-kit"-version = "2.11.0"+version = "3.0.0"dependencies = ["data-encoding","serde",@@ -9036,7 +9207,7 @@ dependencies = [[[package]]name = "tinyagents-tasks"-version = "2.11.0"+version = "3.0.0"dependencies = ["serde","serde_json",@@ -9045,6 +9216,7 @@ dependencies = ["tinyinference-llm 0.5.0","tokio","tracing",+ "uuid",][[package]]@@ -10005,7 +10177,7 @@ dependencies = [[[package]]name = "tinyjuice-module"-version = "0.11.0"+version = "0.11.2"dependencies = ["log","serde_json",@@ -10298,22 +10470,6 @@ dependencies = ["zstd",]-[[package]]-name = "tinystoragedrivers-core"-version = "1.0.0"-source = "git+https://github.com/tinyhumansai/tinystoragedrivers.git?rev=be94f7568fe7650b0729be55128f48270414b9a7#be94f7568fe7650b0729be55128f48270414b9a7"-dependencies = [- "async-trait",- "data-encoding",- "serde",- "serde_json",- "sha2 0.10.9",- "thiserror 2.0.21",- "tokio",- "ulid",- "zstd",-]-[[package]]name = "tinystoragedrivers-document"version = "2.1.0"@@ -10481,30 +10637,6 @@ dependencies = ["tinytools 0.6.0",]-[[package]]-name = "tinytools-std"-version = "0.6.0"-dependencies = [- "anyhow",- "async-trait",- "base64 0.23.1",- "fs2",- "futures-util",- "glob",- "libc",- "log",- "parking_lot",- "regex",- "reqwest 0.12.28",- "rustix 1.1.5",- "serde_json",- "sha2 0.11.1",- "tinytools 0.6.0",- "tokio",- "tracing",- "walkdir",-]-[[package]]name = "tinyvec"version = "1.13.3"@@ -10515,12 +10647,18 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"name = "tinyvoice"version = "0.3.2"dependencies = [+ "bytes","cpal","log",+ "mp4",+ "opus-pure",+ "oxideav-aac","parking_lot","rdev",+ "rvoip-codec-core","serde","serde_json",+ "symphonia","thiserror 2.0.21","tinyvoice-bus","tokio",@@ -10528,7 +10666,7 @@ dependencies = [[[package]]name = "tinyvoice-bus"-version = "0.1.4"+version = "0.2.0"dependencies = ["serde","serde_json",@@ -10544,7 +10682,7 @@ dependencies = [[[package]]name = "tinyvoice-module"-version = "0.3.4"+version = "0.4.0"dependencies = ["anyhow","async-trait",@@ -11973,7 +12111,7 @@ version = "0.1.11"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"dependencies = [- "windows-sys 0.59.0",+ "windows-sys 0.61.2",][[package]]diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.tomlindex 724f36ebb4..eb8df5b2e2 100644--- a/crates/openhuman-core/Cargo.toml+++ b/crates/openhuman-core/Cargo.toml@@ -105,6 +105,11 @@ tinyagents-harness-tools = { path = "../../vendor/tinyagents/crates/tinyagents-h"state-block","subagents","todos",+ "fs",+ "net",+ "exec",+ "media",+ "plan-review",] }tinybox-bus = { path = "../../vendor/tinybox/crates/tinybox-bus", features = ["storage"] }tiny-artifacts = { path = "../../vendor/tiny-artifacts/crates/tiny-artifacts" }diff --git a/crates/openhuman-core/src/agent/bus.rs b/crates/openhuman-core/src/agent/bus.rsindex 895f02ffe2..84c8df83d8 100644--- a/crates/openhuman-core/src/agent/bus.rs+++ b/crates/openhuman-core/src/agent/bus.rs@@ -24,14 +24,14 @@ use crate::config::MultimodalConfig;use crate::core::bus::BUS;use crate::progress::AgentProgress;use crate::security::prompt_injection::{- enforce_prompt_input, PromptEnforcementAction, PromptEnforcementContext,+ PromptEnforcementAction, PromptEnforcementContext, enforce_prompt_input,};use crate::security::turn_origin::{self, AgentTurnOrigin};use tinyagents_session::transcript::TranscriptMessage;use tinytools::Tool;use crate::agent_registry::host_definition::AgentDefinitionRegistry;-use crate::channels::runtime::turn_driver::run_channel_turn;+use crate::channels::run_channel_turn;use tinyagents_definition::SandboxMode;use tinyagents_harness_tools::fs::file_state::with_file_state_agent_id;diff --git a/crates/openhuman-core/src/agent/goals/mod.rs b/crates/openhuman-core/src/agent/goals/mod.rsindex 21481051ac..3dceba0535 100644--- a/crates/openhuman-core/src/agent/goals/mod.rs+++ b/crates/openhuman-core/src/agent/goals/mod.rs@@ -61,11 +61,28 @@ pub fn goal_store(/// A lost-scope caller gets isolated state, without permission to publish/// goal changes into the host's thread or web-channel event streams.fn isolated_goal_store() -> Arc<GoalStore> {- Arc::new(GoalStore::new(- tinyagents_session::port::InMemorySessionStores::new()- .for_agent("ephemeral")- .kv,- ))+ Arc::new(GoalStore::new(Arc::new(+ tinyagents_harness::store::InMemoryStore::new(),+ )))+}++/// Loads a thread goal from the session store bound to this dispatch context.+///+/// Keeping the context explicit prevents a caller from reading the operator's+/// default store when it is serving a tenant or embedded agent.+pub async fn load_for_thread(+ workspace_dir: &Path,+ context: &crate::core::runtime::DispatchCtx,+ thread_id: Option<&str>,+) -> Option<ThreadGoal> {+ let thread_id = thread_id.map(str::trim).filter(|id| !id.is_empty())?;+ match goal_store(workspace_dir, context).get(thread_id).await {+ Ok(goal) => goal,+ Err(error) => {+ tracing::debug!(thread_id, %error, "[thread_goals] load_for_thread failed");+ None+ }+ }}struct OpenHumanGoalObserver;@@ -103,9 +120,7 @@ struct OpenHumanGoalTool {impl OpenHumanGoalTool {fn new(kind: GoalToolKind, workspace_dir: &Path) -> Self {- let metadata_store = tinyagents_session::port::InMemorySessionStores::new()- .for_agent("metadata")- .kv;+ let metadata_store = Arc::new(tinyagents_harness::store::InMemoryStore::new());Self {kind,workspace_dir: workspace_dir.to_path_buf(),diff --git a/crates/openhuman-core/src/agent/goals/mod_tests.rs b/crates/openhuman-core/src/agent/goals/mod_tests.rsindex 74a001d5f3..9e44f7927c 100644--- a/crates/openhuman-core/src/agent/goals/mod_tests.rs+++ b/crates/openhuman-core/src/agent/goals/mod_tests.rs@@ -24,9 +24,11 @@ async fn goal_store_is_reused_within_a_context_and_isolated_between_agents() {drop(first);drop(repeated);let reacquired = goal_store(first_workspace.path(), &first_dispatch);- assert!(cache_owns_store- .upgrade()- .is_some_and(|cached| Arc::ptr_eq(&cached, &reacquired)));+ assert!(+ cache_owns_store+ .upgrade()+ .is_some_and(|cached| Arc::ptr_eq(&cached, &reacquired))+ );let isolated = goal_store(first_workspace.path(), &second_dispatch);let other_workspace = goal_store(second_workspace.path(), &first_dispatch);@@ -37,11 +39,13 @@ async fn goal_store_is_reused_within_a_context_and_isolated_between_agents() {.set("same-thread", "agent a objective", None).await.expect("write first agent goal");- assert!(isolated- .get("same-thread")- .await- .expect("read second agent goal")- .is_none());+ assert!(+ isolated+ .get("same-thread")+ .await+ .expect("read second agent goal")+ .is_none()+ );}#[tokio::test]@@ -70,11 +74,13 @@ async fn goal_store_isolated_between_profiles_with_the_same_agent_and_thread() {.set("shared-thread-id", "profile A objective", None).await.expect("write profile A goal");- assert!(store_b- .get("shared-thread-id")- .await- .expect("read profile B goal")- .is_none());+ assert!(+ store_b+ .get("shared-thread-id")+ .await+ .expect("read profile B goal")+ .is_none()+ );}#[tokio::test]@@ -145,11 +151,13 @@ async fn goal_tool_with_context_uses_the_business_goal_store() {.await.expect("execute without a thread");assert!(no_thread.is_error);- assert!(goal_store(workspace.path(), &dispatch)- .get("goal-tool-business-store")- .await- .expect("confirm existing goal")- .is_some());+ assert!(+ goal_store(workspace.path(), &dispatch)+ .get("goal-tool-business-store")+ .await+ .expect("confirm existing goal")+ .is_some()+ );}).await;}diff --git a/crates/openhuman-core/src/agent/goals/runtime.rs b/crates/openhuman-core/src/agent/goals/runtime.rsdeleted file mode 100644index 0aba042b6e..0000000000--- a/crates/openhuman-core/src/agent/goals/runtime.rs+++ /dev/null@@ -1,195 +0,0 @@-//! OpenHuman accounting adapters for tinyagents thread goals.-//!-//! These are the pieces that make a stored goal actually steer the agent-//! (Codex parity):-//!-//! - [`account_turn_against_goal`] folds a completed turn's token + time usage-//! into the active goal, flipping it to `budget_limited` when the cap is-//! crossed.-//! - Goal budget policy is supplied by `tinyagents-hooks`; this module keeps-//! persistence and completed-turn accounting.--use std::path::Path;-use std::time::Duration;--use tinyagents_harness_tools::goals::budget as crate_budget;-use tinyagents_harness_tools::goals::{ThreadGoal, ThreadGoalStatus};--use crate::core::bus::BUS;-use crate::core::events::DomainEvent;--/// Load the goal for an explicitly supplied chat thread.-pub async fn load_for_thread(workspace_dir: &Path, thread_id: Option<&str>) -> Option<ThreadGoal> {- let thread_id = normalized_thread(thread_id)?;- let store = crate::storage::sessions::stores_or_ephemeral(workspace_dir).kv;- match tinyagents_harness_tools::goals::store::get(&store, &thread_id)- .await- .map_err(|e| e.to_string())- {- Ok(goal) => goal,- Err(e) => {- tracing::debug!(thread_id = %thread_id, error = %e, "[thread_goals] load_for_thread failed");- None- }- }-}--/// Mark the active goal for an explicit thread `Complete` (the originating-/// task settled successfully). Best-effort; safe to call when there is no goal-/// or no thread id. Emits `ThreadGoalUpdated` so the UI chip refreshes.-///-/// This is the lifecycle counterpart the pause/resume pair was missing: without-/// a settle, a goal a finished task left behind stays `Active` and is-/// re-injected as an `[active_goal]` block on every later turn — including-/// unrelated chat (#1725). A caller that owns a task's lifecycle calls this-/// when the task reaches a terminal, satisfied state so the goal can't linger.-pub async fn complete_for_thread(workspace_dir: &Path, thread_id: Option<&str>) {- let Some(thread_id) = normalized_thread(thread_id) else {- return;- };- let store = crate::storage::sessions::stores_or_ephemeral(workspace_dir).kv;- match tinyagents_harness_tools::goals::store::complete(&store, &thread_id)- .await- .map_err(|e| e.to_string())- {- Ok(goal) => {- if matches!(goal.status, ThreadGoalStatus::Complete) {- BUS.publish(DomainEvent::ThreadGoalUpdated {- thread_id: goal.thread_id.clone(),- goal_id: goal.goal_id.clone(),- status: goal.status.as_str().to_string(),- goal: Some(super::goal_to_value(&goal)),- });- }- }- Err(e) => {- tracing::debug!(thread_id = %thread_id, error = %e, "[thread_goals] complete_for_thread failed");- }- }-}--/// Delete the goal row for an explicit thread entirely (the originating task was-/// abandoned / superseded, and no completion contract should persist).-/// Best-effort; safe to call when there is no goal or thread id.-///-/// Clearing removes the row rather than moving it to a terminal status, so a-/// later turn loads `None` and injects no `[active_goal]` block at all — the-/// strongest guarantee that a stale objective cannot leak forward (#1725).-pub async fn clear_for_thread(workspace_dir: &Path, thread_id: Option<&str>) {- let Some(thread_id) = normalized_thread(thread_id) else {- return;- };- let store = crate::storage::sessions::stores_or_ephemeral(workspace_dir).kv;- match tinyagents_harness_tools::goals::store::clear(&store, &thread_id)- .await- .map_err(|e| e.to_string())- {- Ok(existed) => {- if existed {- BUS.publish(DomainEvent::ThreadGoalCleared {- thread_id: thread_id.clone(),- });- }- }- Err(e) => {- tracing::debug!(thread_id = %thread_id, error = %e, "[thread_goals] clear_for_thread failed");- }- }-}--/// The per-turn token total used for budget accounting (prompt + completion).-fn turn_tokens(input: u64, output: u64) -> u64 {- crate_budget::turn_tokens(input, output)-}--/// Account a finished turn's usage against an explicit thread's goal.-///-/// The accounting rules are the crate's-/// ([`crate_budget::account_turn`](tinyagents_harness_tools::goals::account_turn)):-/// only **active** goals are charged, so a paused/complete/budget-limited goal-/// doesn't accrue usage from incidental chat. OpenHuman runs no autonomous-/// goal continuation, so every accounted turn is user-initiated.-///-/// What is OpenHuman's here: receiving the owned thread from the turn and-/// emitting `ThreadGoalUpdated` when the status changes (e.g. →-/// `budget_limited`) so the UI chip refreshes. Best-effort throughout: a-/// failure is logged and swallowed so accounting never fails a user turn.-pub async fn account_turn_against_goal(- workspace_dir: &Path,- thread_id: Option<&str>,- input: u64,- output: u64,- secs: u64,-) {- let Some(thread_id) = normalized_thread(thread_id) else {- return;- };- let store = crate::storage::sessions::stores_or_ephemeral(workspace_dir).kv;- let prev = match tinyagents_harness_tools::goals::store::get(&store, &thread_id)- .await- .map_err(|e| e.to_string())- {- Ok(Some(goal)) => goal,- Ok(None) => return,- Err(e) => {- tracing::debug!(thread_id = %thread_id, error = %e, "[thread_goals] account get failed");- return;- }- };- let prev_status = prev.status;- let prev_tokens_used = prev.tokens_used;-- match crate_budget::account_turn(&store, &thread_id, input, output, Duration::from_secs(secs))- .await- {- Ok(Some(updated)) => {- tracing::debug!(- thread_id = %thread_id,- goal_id = %updated.goal_id,- tokens_used = updated.tokens_used,- status = updated.status.as_str(),- "[thread_goals] accounted turn usage (+{} tok, +{secs}s)",- turn_tokens(input, output)- );- // Publish on any status transition, or — for a live budget- // display — when accumulated usage has moved by at least 5% of- // the configured budget since the last publish. Without the- // throttle every single turn's accounting would emit a socket- // event; the threshold keeps the UI's budget meter live without- // flooding the bus on chatty threads.- let status_changed = updated.status != prev_status;- let budget_moved = updated- .token_budget- .filter(|b| *b > 0)- .is_some_and(|budget| {- let delta = updated.tokens_used.saturating_sub(prev_tokens_used);- // 5% of budget, at least 1 token so a tiny budget still reports.- let threshold = (budget / 20).max(1);- delta >= threshold- });- if status_changed || budget_moved {- BUS.publish(DomainEvent::ThreadGoalUpdated {- thread_id: updated.thread_id.clone(),- goal_id: updated.goal_id.clone(),- status: updated.status.as_str().to_string(),- goal: Some(super::goal_to_value(&updated)),- });- }- }- Ok(None) => {}- Err(e) => {- tracing::debug!(thread_id = %thread_id, error = %e, "[thread_goals] account_turn failed");- }- }-}--fn normalized_thread(thread_id: Option<&str>) -> Option<String> {- thread_id- .map(str::trim)- .filter(|thread_id| !thread_id.is_empty())- .map(ToOwned::to_owned)-}--#[cfg(test)]-#[path = "runtime_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/goals/tools_tests.rs b/crates/openhuman-core/src/agent/goals/tools_tests.rsdeleted file mode 100644index 1bc3f8fc00..0000000000--- a/crates/openhuman-core/src/agent/goals/tools_tests.rs+++ /dev/null@@ -1,54 +0,0 @@-use super::*;-use serde_json::json;-use tinytools::{ToolCallOptions, ToolRunContext};--struct ThreadContext(&'static str);--impl ToolRunContext for ThreadContext {- fn thread_id(&self) -> Option<&str> {- Some(self.0)- }-}--#[test]-fn exposes_only_the_model_facing_goal_tools() {- let tmp = tempfile::tempdir().unwrap();- let names: Vec<String> = goal_tools(tmp.path())- .iter()- .map(|tool| tool.name().to_string())- .collect();- assert_eq!(- names,- ["goal_get", "goal_set", "goal_complete", "goal_resume"]- );-}--#[tokio::test]-async fn set_persists_to_the_workspace_store_and_answers_goal_and_text() {- let tmp = tempfile::tempdir().unwrap();- let tools = goal_tools(tmp.path());- let set = tools.iter().find(|t| t.name() == "goal_set").unwrap();- let context = ThreadContext("thread-host-tools");- let res = set- .execute_with_context(- json!({ "objective": "land the PR", "token_budget": 5000 }),- ToolCallOptions::default(),- Some(&context),- )- .await- .unwrap();- assert!(!res.is_error, "{}", res.output());- let payload: serde_json::Value = serde_json::from_str(&res.output()).unwrap();- assert_eq!(payload["goal"]["objective"], "land the PR");- assert_eq!(payload["goal"]["tokenBudget"], 5000);- assert!(payload["text"].as_str().unwrap().starts_with("Goal set."));-- let stored = tinyagents_harness_tools::goals::store::get(- &crate::storage::sessions::stores_or_ephemeral(tmp.path()).kv,- "thread-host-tools",- )- .await- .unwrap()- .expect("goal persisted through the workspace store");- assert_eq!(stored.objective, "land the PR");-}diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs b/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rsindex 546d96b73d..47ca8a97d6 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs@@ -6,6 +6,39 @@ use tinyagents_tasks::{CompletionStoreReplaceOutcome, InMemoryCompletionStore, DEFAULT_MAX_ATTEMPTS,};+/// Presents OpenHuman's configured backend through TinyAgents' storage-kit+/// adapter while preserving native conditional writes.+struct CompletionBackend(Arc<dyn crate::storage::StorageBackend>);++impl tinyagents_storage_kit::StorageBackend for CompletionBackend {+ fn for_scope(+ &self,+ scope: &tinyagents_storage_kit::Scope,+ ) -> tinyagents_storage_kit::error::Result<tinyagents_storage_kit::ScopedStorage> {+ let host_scope = crate::storage::Scope::new(scope.as_str())?;+ let storage = self.0.for_scope(&host_scope)?;+ Ok(tinyagents_storage_kit::ScopedStorage::new(+ storage,+ scope.clone(),+ ))+ }++ fn for_scope_conditioned(+ &self,+ scope: &tinyagents_storage_kit::Scope,+ condition: &tinyagents_storage_kit::WriteCondition,+ ) -> tinyagents_storage_kit::error::Result<tinyagents_storage_kit::ScopedStorage> {+ let host_scope = crate::storage::Scope::new(scope.as_str())?;+ let storage = self+ .0+ .for_scope_conditioned(&host_scope, condition)?;+ Ok(tinyagents_storage_kit::ScopedStorage::new(+ storage,+ scope.clone(),+ ))+ }+}+pub(in crate::agent::orchestration) fn router_scope_for(ctx: &DispatchCtx,workspace_dir: &Path,@@ -42,7 +75,12 @@ pub(in crate::agent::orchestration) fn open_driver_store(} else {CompletionStoreFallback::LocalMemory};- open_driver_completion_store_or_memory(opened.backend, opened.scope, fallback)+ let scope = tinyagents_storage_kit::Scope::new(opened.scope.as_str())?;+ open_driver_completion_store_or_memory(+ Arc::new(CompletionBackend(opened.backend)),+ scope,+ fallback,+ ).map_err(|error| anyhow::anyhow!("open the completion store: {error}"))})}diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents.rsindex f07303591f..6708dc6d51 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents.rs@@ -7,8 +7,8 @@ mod roster;mod task_ledger;pub(crate) use cancel::{- cancel_all, cancel_by_session_in_workspace, cancel_by_task_with_workspace_reason,- cancel_for_thread, stop_for_thread, CancelledSubagent,+ CancelledSubagent, cancel_all, cancel_by_session_in_workspace,+ cancel_by_task_with_workspace_reason, cancel_for_thread, stop_for_thread,};pub(crate) use registry::admit_spawn;pub(crate) use roster::active_subagents_context_block;diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rsindex 8d00b01819..0ae00b0afb 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs@@ -67,7 +67,7 @@ pub(crate) async fn cancel_by_task_with_workspace_reason();let scope = ParentJobScope::new(owner_scope.workspace.clone(), parent_thread_id);let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(ctx);let job = jobs.list_for_parent_scope(&owner, &scope)@@ -309,7 +309,7 @@ pub(crate) async fn cancel_for_thread(thread_id,);let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(ctx);let mut cancelled = 0;let mut failures = Vec::new();@@ -439,7 +439,7 @@ pub(crate) fn stop_for_thread(if let Some(core_context) = ctx.resolved() {if let Ok(workspace_dir) = core_context.workspace_dir() {let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(ctx);let scopes = crate::agent::orchestration::completion_owners::driver_tasks_for_thread(ctx,diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rsindex 28238ea35d..a5c7a4d968 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs@@ -128,7 +128,7 @@ pub(crate) async fn active_subagents_context_block(parent_session,)?;let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(ctx);let sessions = match crate::agent::orchestration::subagent_sessions::open_for_context(ctx,diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/steering.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/steering.rsdeleted file mode 100644index e9710516b1..0000000000--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/steering.rs+++ /dev/null@@ -1,107 +0,0 @@-//! OpenHuman's `RunQueue` fallback for TinyAgents detached steering.--use tinyagents_harness::ids::TaskId;-use tinyagents_harness::run_queue::QueueLane;-use tinyagents_orchestration::steering::{- queue_lane_name, steer_detached, SteerAccess, SteerError,-};--use super::cancel::now_ms;-use super::registry::{control_admits, owner_key, registry, RunningSubagentMetadata};--/// Inject an instruction into a detached sub-agent owned by `parent_session`.-pub async fn steer(- ctx: &crate::core::runtime::DispatchCtx,- task_id: &str,- parent_session: &str,- text: String,- lane: QueueLane,-) -> Result<(), SteerError> {- let owner = owner_key(ctx, parent_session).map_err(|_| SteerError::NotOwned)?;- let route = steer_detached(- registry(),- task_id,- SteerAccess::Owner(&owner),- text,- lane,- |metadata: RunningSubagentMetadata, lane, text| async move {- metadata- .run_queue- .push(- lane,- crate::agent::queued_turn::QueuedTurn {- id: uuid::Uuid::new_v4().to_string(),- text,- client_id: "steer_subagent".to_string(),- thread_id: task_id.to_string(),- queued_at_ms: now_ms(),- model_override: None,- temperature: None,- locale: None,- },- )- .await;- },- )- .await?;- tracing::info!(- task_id,- lane = queue_lane_name(lane),- ?route,- "[running_subagents] steered detached task"- );- Ok(())-}--/// User-control variant for JSON-RPC sub-agent controls.-///-/// The caller's profile is checked against the task metadata before using the-/// trusted upstream route. Desktop controls retain authority over process-/// workers, while SaaS controls remain scoped to their captured profile.-pub(crate) async fn steer_control(- ctx: &crate::core::runtime::DispatchCtx,- task_id: &str,- text: String,- lane: QueueLane,-) -> Result<(), SteerError> {- let key = TaskId::new(task_id);- let snapshot = registry()- .snapshot_trusted(&key)- .map_err(SteerError::from)?;- if !control_admits(ctx, &snapshot.metadata) {- return Err(SteerError::NotOwned);- }- let route = steer_detached(- registry(),- task_id,- SteerAccess::Trusted,- text,- lane,- |metadata: RunningSubagentMetadata, lane, text| async move {- metadata- .run_queue- .push(- lane,- crate::agent::queued_turn::QueuedTurn {- id: uuid::Uuid::new_v4().to_string(),- text,- client_id: "subagent_control_rpc".to_string(),- thread_id: task_id.to_string(),- queued_at_ms: now_ms(),- model_override: None,- temperature: None,- locale: None,- },- )- .await;- },- )- .await?;- tracing::info!(- task_id,- lane = queue_lane_name(lane),- ?route,- "[running_subagents] control-steered detached task"- );- Ok(())-}diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rsindex 03cbd66f9a..cbbe54d187 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs@@ -11,11 +11,11 @@ use std::path::{Path, PathBuf};use std::sync::{Arc, OnceLock};use tinyagents_orchestration::subagent::{- orphaned_subagent_reason, record_agent_id, record_parent_session, task_status_label, WaitError,+ WaitError, orphaned_subagent_reason, record_agent_id, record_parent_session, task_status_label,};use tinyagents_tasks::{- open_driver_task_store_or_memory, reconcile_orphaned_tasks, InMemoryTaskStore,- OrchestrationTaskFilter, TaskStore, TaskStoreRegistry,+ InMemoryTaskStore, OrchestrationTaskFilter, TaskStore, TaskStoreRegistry,+ open_driver_task_store_or_memory, reconcile_orphaned_tasks,};/// One cached ledger: a workspace and the storage scope it was opened for.diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rsindex 3df419cb4f..7381e3888a 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs@@ -209,13 +209,7 @@ async fn saas_dispatch_exposes_only_the_callers_detached_worker_controls() {Some(true));assert!(crate::core::all::schema_for_rpc_method("openhuman.config_get_config").is_none());- let unreviewed =- crate::agent_runs::command_center::all_command_center_registered_controllers()- .into_iter()- .find(|controller| controller.schema.function == "list")- .expect("existing Agent controller")- .schema;- let method = crate::core::all::rpc_method_name(&unreviewed);+ let method = "openhuman.agent_work_list";assert!(crate::core::all::schema_for_rpc_method(&method).is_none());assert!(crate::core::invoke::invoke_method(diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_driver.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_driver.rsindex 9a2b0ededf..809c58b533 100644--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_driver.rs+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_driver.rs@@ -8,7 +8,7 @@ use super::*;pub fn cancel_driver_jobs_for_thread(store: &SubagentSessionStore,workspace_dir: &Path,- jobs: &tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ jobs: &tinyagents_orchestration::subagent::SubAgentJobRegistry,thread_id: &str,) -> Vec<String> {let sessions = match store.load() {@@ -66,7 +66,7 @@ pub fn cancel_driver_jobs_for_thread(pub fn cancel_driver_job_for_observed_session(store: &SubagentSessionStore,checkpoint_dir: &Path,- jobs: &tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ jobs: &tinyagents_orchestration::subagent::SubAgentJobRegistry,session: &DurableSubagentSession,parent_session: &str,parent_thread_id: Option<&str>,@@ -127,7 +127,7 @@ pub struct DriverTaskCancellation {pub fn cancel_driver_job_by_task(store: &SubagentSessionStore,checkpoint_dir: &Path,- jobs: &tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ jobs: &tinyagents_orchestration::subagent::SubAgentJobRegistry,task_id: &str,reason: Option<&str>,) -> Result<Option<DriverTaskCancellation>, String> {diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rsindex 8b48a265cc..6751d58547 100644--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs@@ -1,6 +1,6 @@use super::*;use crate::agent::orchestration::subagent_sessions::types::SubagentSessionUpsert;-use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinyagents_orchestration::subagent::{FinishedOutcome, SubagentTaskKey};fn selector(task_key: &str) -> SubagentSessionSelector {diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/storage_schema.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/storage_schema.rsindex 93f683b4b5..744f00729a 100644--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/storage_schema.rs+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/storage_schema.rs@@ -44,7 +44,7 @@ pub(super) fn legacy_collections() -> Vec<CollectionSpec> {}/// The camelCase v1 field and its snake_case v2 name, for the plain copies.-const COPIES: [(&str, &str); 18] = [+const COPIES: [(&str, &str); 19] = [("subagentSessionId", "subagent_session_id"),("parentSession", "parent_session"),("parentThreadId", "parent_thread_id"),diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rsindex 6640c2c860..4303513440 100644--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs@@ -63,7 +63,7 @@ pub(crate) fn open_for_context(workspace_dir: PathBuf,parent_session: impl Into<String>,parent_thread_id: Option<String>,- jobs: Option<tinyagents_harness_tools::subagents::SubAgentJobRegistry>,+ jobs: Option<tinyagents_orchestration::subagent::SubAgentJobRegistry>,) -> Result<Arc<dyn TinySessionStore>, SubagentError> {let documents = documents_for_context(ctx, &workspace_dir)?;let driver = Arc::new(DriverSubagentSessionStore::new(Arc::clone(&documents))?);@@ -393,7 +393,7 @@ pub(crate) struct OpenHumanTinySubagentSessionStore {checkpoint_dir: PathBuf,parent_session: String,parent_thread_id: Option<String>,- jobs: Option<tinyagents_harness_tools::subagents::SubAgentJobRegistry>,+ jobs: Option<tinyagents_orchestration::subagent::SubAgentJobRegistry>,}impl OpenHumanTinySubagentSessionStore {@@ -413,7 +413,7 @@ impl OpenHumanTinySubagentSessionStore {pub(crate) fn with_jobs(mut self,- jobs: tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ jobs: tinyagents_orchestration::subagent::SubAgentJobRegistry,) -> Self {self.jobs = Some(jobs);selfdiff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_epoch.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_epoch.rsindex c2c5a422d8..805914cfdb 100644--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_epoch.rs+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_epoch.rs@@ -21,10 +21,14 @@ pub(super) fn import_parent_epoch(documents.ensure_collection(&tinystoragedrivers::CollectionSpec::new(EPOCHS)).await?;- let repo = tinystoragedrivers::Repo::<ParentEpochRecord>::new(&documents, EPOCHS)?;- repo.update(&session_id, move |_| {- Ok(Some(ParentEpochRecord { parent_epoch }))- })+ let value = serde_json::to_value(ParentEpochRecord { parent_epoch })+ .map_err(|error| crate::storage::StorageError::backend(error.to_string()))?;+ crate::storage::documents::update_or_insert(+ &documents,+ EPOCHS,+ &session_id,+ move |_| Some(value.clone()),+ ).await?;Ok(())})@@ -39,11 +43,12 @@ pub(crate) fn parent_epoch_from_sidecar(documents.ensure_collection(&tinystoragedrivers::CollectionSpec::new(EPOCHS)).await?;- let repo = tinystoragedrivers::Repo::<ParentEpochRecord>::new(&documents, EPOCHS)?;- Ok(repo- .get(&session_id)- .await?- .and_then(|record| record.doc.parent_epoch))+ let Some(record) = documents.get(EPOCHS, &session_id).await? else {+ return Ok(None);+ };+ let record = serde_json::from_value::<ParentEpochRecord>(record.doc)+ .map_err(|error| crate::storage::StorageError::backend(error.to_string()))?;+ Ok(record.parent_epoch)}).map_err(|error| SubagentError::Persistence(format!("read parent epoch: {error}")))}diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rsindex 2b9e55d274..1b5caf485b 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs@@ -337,7 +337,7 @@ async fn headless_spawn_is_async_and_reports_its_result_to_the_run_log() {.expect("headless result is projected to the run log");assert_eq!(output, "done");let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&live.data.dispatch_ctx());let job = jobs.list()diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_driver_lookup.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_driver_lookup.rsindex 1aa7e2b201..3fa7b9d303 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_driver_lookup.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_driver_lookup.rs@@ -140,7 +140,7 @@ async fn close_reusable_driver_session(parent_thread_id: Option<&str>,) -> Result<(), String> {let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(ctx);let cancelled = subagent_sessions::cancel_driver_job_for_observed_session(host_store,diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rsindex 332dcd94f1..0a08d0ccb0 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs@@ -61,7 +61,7 @@ impl SpawnSubagentTool {}};let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&dispatch);let driver_store = match subagent_sessions::open_for_context(&dispatch,@@ -85,10 +85,12 @@ impl SpawnSubagentTool {.unwrap_or_else(|| tinytools::WorkspaceDescriptor::new(parent.workspace_dir.clone()));let resolved_model = definition.model.resolve(parent.model_name.as_str());let target_model = model_override.as_deref().unwrap_or(&resolved_model);+ let model_supports_vision = run_context.hosted_base.as_ref().is_some_and(|base| {+ crate::inference::model_context::model_supports_vision(target_model, &base.config)+ });if crate::attachments::should_forward_parent_images(&prompt)&& !run_context.attachment_placeholders.is_empty()- && (definition.id == "vision_agent"- || crate::inference::provider::factory::oh_tier_supports_vision(target_model))+ && (definition.id == "vision_agent" || model_supports_vision){prompt = format!("{}\n\n{}",@@ -341,7 +343,9 @@ impl SpawnSubagentTool {completion_target.failed(task_id, &definition.id, &message).await;- crate::agent::orchestration::completion_owners::finish_driver_task(&dispatch, task_id);+ crate::agent::orchestration::completion_owners::finish_driver_task(+ &dispatch, task_id,+ );return Ok(ToolResult::error(format!("spawn_subagent: {message}")));}if let Err(error) = crate::agent::subagent_host::resume_async_via_driver_tool(@@ -366,7 +370,9 @@ impl SpawnSubagentTool {completion_target.failed(task_id, &definition.id, &message).await;- crate::agent::orchestration::completion_owners::finish_driver_task(&dispatch, task_id);+ crate::agent::orchestration::completion_owners::finish_driver_task(+ &dispatch, task_id,+ );crate::agent::orchestration::subagent_events::publish_subagent_failed(parent_session,task_id.to_owned(),diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rsindex 74e574fa52..103f813088 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs@@ -113,7 +113,8 @@ async fn steer_reusable_session(message: String,) -> Result<(), String> {use tinyagents_harness::tool::ToolDispatch;- use tinyagents_harness_tools::subagents::{SubAgentJobRegistry, SubAgentMessageTool};+ use tinyagents_harness_tools::subagents::SubAgentMessageTool;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinytools::{ToolCallOptions, ToolTimeout};let context = &parent.data;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rsindex e9ec21851a..06a06f38b5 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs@@ -4,7 +4,7 @@ use super::*;async fn spawn_subagent_with_same_task_key_resumes_paused_job_through_shared_driver() {use crate::agent::orchestration::subagent_sessions::DurableSubagentStatus;use crate::agent::orchestration::tools::SpawnSubagentTool;- use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinyagents_orchestration::subagent::SubAgentJobStatus;let _lock = crate::config::TEST_ENV_LOCK.lock().await;@@ -426,7 +426,7 @@ async fn spawn_subagent_with_same_task_key_resumes_paused_job_through_shared_driasync fn spawn_subagent_reuses_idle_task_key_with_the_saved_history() {use crate::agent::orchestration::subagent_sessions::open_for_context;use crate::agent::orchestration::tools::SpawnSubagentTool;- use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinyagents_orchestration::subagent::{DurableSubagentStatus, SubAgentJobStatus};let _lock = crate::config::TEST_ENV_LOCK.lock().await;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_control_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_control_tests.rsindex 9d4611bb3f..3c163bbacb 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_control_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_control_tests.rs@@ -102,7 +102,7 @@ async fn unscoped_web_stop_cancels_a_running_driver_subagent() {"stop uses the live core context");let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&dispatch);let before_scoped = super::driver_sessions_for_parent(&dispatch,diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_reuse_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_reuse_tests.rsindex 06cee40e9c..e297acbc1a 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_reuse_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_reuse_tests.rs@@ -81,7 +81,7 @@ async fn failed_steer_of_running_reused_session_does_not_create_second_child() {.expect("detached child context").with_cancellation(detached_data.cancellation.clone());let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&live.data.dispatch_ctx());let jobs_before = jobs.list().len();let result = crate::agent::orchestration::tools::SpawnSubagentTool::new()diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rsindex c673a1a915..89d495faea 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rs@@ -8,8 +8,10 @@ async fn force_fresh_cancels_old_driver_before_creating_a_new_session() {use crate::tools::toolpacks::ToolGroups;use tinyagents_harness::context::RunContext;use tinyagents_harness::tool::ToolDispatch;- use tinyagents_harness_tools::subagents::{SubAgentJobRegistry, SubAgentJobsTool};- use tinyagents_orchestration::subagent::{DurableSubagentStatus, SubAgentJobStatus};+ use tinyagents_harness_tools::subagents::SubAgentJobsTool;+ use tinyagents_orchestration::subagent::{+ DurableSubagentStatus, SubAgentJobRegistry, SubAgentJobStatus,+ };struct GatedModel {calls: std::sync::atomic::AtomicUsize,@@ -389,7 +391,7 @@ async fn stopped_async_spawn_is_refused_before_progress_or_session_effects() {"refusal must not publish spawn progress");let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&dispatch);assert!(jobs.list().is_empty(),@@ -531,7 +533,7 @@ async fn deleted_thread_marker_survives_router_restart_and_refuses_async_spawn()"refusal writes no durable child session");let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&restarted.data.dispatch_ctx());assert!(jobs.list().is_empty(), "refusal registers no shared job");@@ -640,7 +642,7 @@ async fn detached_registration_failure_finishes_the_announced_product_card() {"registration error must not dispatch the model");let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&live.data.dispatch_ctx());assert!(jobs.list().is_empty(),diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rsindex 75c2e2ab0a..db5a57bcf0 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs@@ -7,7 +7,7 @@ async fn cancelling_a_paused_driver_settles_once_with_its_reason() {};use crate::agent::orchestration::subagent_sessions::DurableSubagentStatus;use crate::agent::orchestration::tools::SpawnSubagentTool;- use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinyagents_orchestration::subagent::SubAgentJobStatus;use tinyagents_tasks::CompletionStatus;@@ -276,7 +276,7 @@ async fn cancelling_a_paused_driver_settles_once_with_its_reason() {#[tokio::test]async fn stopping_a_paused_driver_releases_its_active_owner() {use crate::agent::orchestration::tools::SpawnSubagentTool;- use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinyagents_orchestration::subagent::SubAgentJobStatus;let _lock = crate::config::TEST_ENV_LOCK.lock().await;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_profile_cancel_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_profile_cancel_tests.rsindex 7d422df512..140e9e9e7c 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_profile_cancel_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_profile_cancel_tests.rs@@ -138,7 +138,7 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {.expect("child start notification");let alice_ctx = live.data.dispatch_ctx();let alice_jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&alice_ctx);let row_before = super::driver_sessions_for_parent(&alice_ctx,@@ -178,7 +178,7 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {let bob_ctx = DispatchCtx::new(Arc::clone(&bob));let bob_job_registry = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&bob_ctx);assert!(bob_job_registry.list().is_empty(),diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_resume_owner_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_resume_owner_tests.rsindex d1325dd27a..ec2230a802 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_resume_owner_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_resume_owner_tests.rs@@ -42,7 +42,7 @@ impl ChatModel<()> for PauseThenHoldResumeModel {async fn resuming_after_owner_cache_loss_registers_live_task_before_launch() {use crate::agent::orchestration::subagent_sessions::DurableSubagentStatus;use crate::agent::orchestration::tools::SpawnSubagentTool;- use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinyagents_orchestration::subagent::SubAgentJobStatus;let _lock = crate::config::TEST_ENV_LOCK.lock().await;@@ -203,7 +203,7 @@ async fn resuming_after_owner_cache_loss_registers_live_task_before_launch() {async fn failed_driver_resume_marks_paused_session_failed_and_releases_owner() {use crate::agent::orchestration::subagent_sessions::DurableSubagentStatus;use crate::agent::orchestration::tools::SpawnSubagentTool;- use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinyagents_orchestration::subagent::SubAgentJobStatus;let _lock = crate::config::TEST_ENV_LOCK.lock().await;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rsindex 50d8f7cbc8..69633c6f2d 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs@@ -140,7 +140,7 @@ async fn spawn_subagent_returns_async_reference_and_runs_child_e2e() {assert!(provider.saw(SPAWN_SUBAGENT_CANARY));assert!(provider.saw("parent supplied context"));let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&live.data.dispatch_ctx());let job = jobs.list()diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_thread_delete_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_thread_delete_tests.rsindex c9e34bb80f..b61453ff14 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_thread_delete_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_thread_delete_tests.rs@@ -8,7 +8,7 @@ async fn deleting_parent_thread_cancels_driver_child_before_discarding_completiouse crate::threads::store::{blocking, CreateConversationThread};use crate::tools::toolpacks::ToolGroups;use tinyagents_harness::context::RunContext;- use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinyagents_orchestration::subagent::SubAgentJobStatus;struct GatedModel {@@ -515,7 +515,7 @@ async fn purging_threads_cancels_driver_children_and_discards_completions() {use crate::threads::store::{blocking, CreateConversationThread};use crate::tools::toolpacks::ToolGroups;use tinyagents_harness::context::RunContext;- use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinyagents_orchestration::subagent::SubAgentJobStatus;struct GatedModel {diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_workspace_owner_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_workspace_owner_tests.rsindex 44ae133c6a..0de7b0ccd6 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_workspace_owner_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_workspace_owner_tests.rs@@ -7,7 +7,7 @@ async fn generic_spawn_jobs_are_owned_by_their_workspace() {use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};use crate::tools::toolpacks::ToolGroups;use tinyagents_harness::context::{RunConfig, RunContext};- use tinyagents_harness_tools::subagents::SubAgentJobRegistry;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;const PROMPT_A: &str = "workspace-owner-child-a-canary";const PROMPT_B: &str = "workspace-owner-child-b-canary";diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rsindex d49a8ba542..61bdc006db 100644--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs@@ -16,11 +16,7 @@ use tinytools_agent::dialect::ToolDialect;use tinyagents_harness::middleware::wrap_harness_instruction;use crate::agent::{- session_host::turn_checkpoint::{- self, build_deterministic_checkpoint, build_deterministic_final_summary_with_cause,- close_verification_prompt, final_answer_instruction, harness_instruction_needles,- render_tool_results, results_from_tool_outcomes,- },+ session_host::{product_copy, stop_policy},tinyagents::{SupplementalTrace, TinyagentsTurnOutcome, TurnModelSource},};use tinyagents_harness::turn_policy::AGENT_TURN_MAX_OUTPUT_TOKENS;@@ -239,6 +235,27 @@ pub(super) struct GroundedClose {/// A classified halt has enough evidence for a deterministic partial result./// Keeping this separate from the model-driven repair path guarantees zero/// additional provider calls once its recovery budget is exhausted.++fn deterministic_final_summary_with_cause(+ results: &[tinyagents_harness::close::CloseToolResult],+ stop_reason: Option<&str>,+ failure_cause: Option<&tinyagents_harness::no_progress::ClassifiedStopCause>,+) -> String {+ if failure_cause.is_some() || stop_reason.is_some() {+ return stop_policy::render_stop_summary_with_cause(+ results,+ stop_reason.unwrap_or_default(),+ failure_cause,+ );+ }+ let rendered = product_copy::render_close_results(results, 4_000);+ tinyagents_harness::close::final_summary_with_copy(+ &product_copy::OPENHUMAN_CLOSE_COPY,+ &rendered,+ !results.is_empty(),+ )+}+fn classified_halt_close(outcome: &TinyagentsTurnOutcome) -> Option<GroundedClose> {let reason = outcome.breaker_halt.as_deref().unwrap_or_default();if outcome.failure_cause.is_none() && !reason.starts_with("Stopping after ") {@@ -246,7 +263,7 @@ fn classified_halt_close(outcome: &TinyagentsTurnOutcome) -> Option<GroundedClos}let records = product_copy::close_results(&outcome.tool_outcomes);Some(GroundedClose {- output: build_deterministic_final_summary_with_cause(+ output: deterministic_final_summary_with_cause(&records,Some(reason),outcome.failure_cause.as_ref(),@@ -425,7 +442,7 @@ pub(super) async fn close_if_needed(!records.is_empty(),)} else {- build_deterministic_final_summary_with_cause(+ deterministic_final_summary_with_cause(&records,stop_reason,outcome.failure_cause.as_ref(),diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_typed_stop_tests.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_typed_stop_tests.rsindex 30601ddde4..3a3681eb13 100644--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_typed_stop_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_typed_stop_tests.rs@@ -151,7 +151,7 @@ fn classified_halt_maps_all_typed_stop_categories_and_aliases() {close.usage.model_calls, 0,"typed `{class}` cause closes without another model call");- let stop = crate::agent::session_host::stop_summary::classify_stop_with_cause(+ let stop = crate::agent::session_host::stop_policy::classify_stop_with_cause(outcome.breaker_halt.as_deref(),outcome.failure_cause.clone(),false,@@ -202,7 +202,7 @@ async fn typed_cause_without_halt_note_still_closes_and_keeps_operation() {"typed cause closes deterministically without calling the provider");- let stop = crate::agent::session_host::stop_summary::classify_stop_with_cause(+ let stop = crate::agent::session_host::stop_policy::classify_stop_with_cause(None,outcome.failure_cause,false,diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rsindex 65c6c3d37d..ec347f68cf 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs@@ -248,8 +248,9 @@ impl OpenHumanTurnPrelude {let active_goal = if turn.overrides.suppress_active_goal {None} else {- crate::agent::goals::runtime::load_for_thread(+ crate::agent::goals::load_for_thread(&self.workspace_dir,+ &self.dispatch_ctx(),self.thread_id.as_deref(),).await@@ -351,6 +352,7 @@ impl OpenHumanTurnPrelude {let finished_plan = crate::agent::tinyagents::state_block::close_finished_plan(&self.workspace_dir,self.thread_id.as_deref(),+ &self.dispatch_ctx(),).await;self.memory_post_turn(receipt, finished_plan);@@ -373,7 +375,7 @@ fn granted_tool_specs(deferred: &std::collections::HashSet<String>,has_thread: bool,) -> Vec<tinytools::ToolSpec> {- let specs = visible+ let specs: Vec<tinytools::ToolSpec> = visible.iter().chain(registered@@ -386,7 +388,10 @@ fn granted_tool_specs(}).map(|spec| spec.as_ref().clone()).collect();- super::super::builder::dedup_visible_tool_specs(specs)+ tinyagents_runtime::dedup_visible_tool_specs(specs.into_iter().map(Arc::new).collect())+ .into_iter()+ .map(|spec| spec.as_ref().clone())+ .collect()}#[cfg(test)]diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rsindex a727a606e2..4a6fb54536 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs@@ -95,7 +95,7 @@ impl OpenHumanSessionHost {let descendant_lease = if headless {let dispatch = context.dispatch_ctx();let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&dispatch);let owner = headless_owner.expect("headless settlement has a root owner scope");Some(diff --git a/crates/openhuman-core/src/agent/session_host/stop_policy.rs b/crates/openhuman-core/src/agent/session_host/stop_policy.rsindex 991fa7b207..2e7cd6db7d 100644--- a/crates/openhuman-core/src/agent/session_host/stop_policy.rs+++ b/crates/openhuman-core/src/agent/session_host/stop_policy.rs@@ -18,7 +18,7 @@use std::fmt::Write as _;-use super::turn_checkpoint::CheckpointToolResult;+use tinyagents_harness::close::CloseToolResult as CheckpointToolResult;use tinyagents_harness::turn_stop::{CopyRequest, TurnStop, TurnStopCopyKey};/// Longest error line shown for one tool, in characters.@@ -300,7 +300,7 @@ pub(crate) fn render_stop_summary_with_cause(short_error_line(content)});tinyagents_harness::turn_stop::render_stop_summary_with_copy(- kind.copy(),+ &kind.copy(),&groups,&super::product_copy::OPENHUMAN_STOP_COPY,)diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rsindex 7a8645360b..bfbc1ff3e9 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs@@ -26,8 +26,8 @@ mod checkpoint;#[path = "lifecycle_outcome.rs"]mod outcome;use checkpoint::absolute_checkpoint_dir;-pub(super) use driver_adapter::outcome_to_host;use driver_adapter::HostInvocation;+pub(super) use driver_adapter::outcome_to_host;#[path = "lifecycle/driver_result.rs"]mod driver_result;@@ -103,13 +103,13 @@ pub(crate) async fn spawn_async_via_driver_tool(input: String,options: SubagentRunOptions,completion: impl Fn(- String,- Result<SubagentRunOutcome, String>,- bool,- ) -> Pin<Box<dyn Future<Output = ()> + Send>>- + Send- + Sync- + 'static,+ String,+ Result<SubagentRunOutcome, String>,+ bool,+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>+ + Send+ + Sync+ + 'static,) -> Result<String, SubagentRunError> {spawn_async_via_driver_tool_using_jobs(parent, definition, input, options, None, None, completion,@@ -127,13 +127,13 @@ pub(crate) async fn resume_async_via_driver_tool(input: String,options: SubagentRunOptions,completion: impl Fn(- String,- Result<SubagentRunOutcome, String>,- bool,- ) -> Pin<Box<dyn Future<Output = ()> + Send>>- + Send- + Sync- + 'static,+ String,+ Result<SubagentRunOutcome, String>,+ bool,+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>+ + Send+ + Sync+ + 'static,) -> Result<String, SubagentRunError> {spawn_async_via_driver_tool_using_jobs(parent,@@ -153,15 +153,15 @@ pub(crate) async fn spawn_async_via_driver_tool_with_jobs(definition: crate::agent_registry::host_definition::AgentDefinition,input: String,options: SubagentRunOptions,- jobs: tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ jobs: tinyagents_orchestration::subagent::SubAgentJobRegistry,completion: impl Fn(- String,- Result<SubagentRunOutcome, String>,- bool,- ) -> Pin<Box<dyn Future<Output = ()> + Send>>- + Send- + Sync- + 'static,+ String,+ Result<SubagentRunOutcome, String>,+ bool,+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>+ + Send+ + Sync+ + 'static,) -> Result<String, SubagentRunError> {spawn_async_via_driver_tool_using_jobs(parent,@@ -180,16 +180,16 @@ async fn spawn_async_via_driver_tool_using_jobs(definition: crate::agent_registry::host_definition::AgentDefinition,input: String,options: SubagentRunOptions,- jobs: Option<tinyagents_harness_tools::subagents::SubAgentJobRegistry>,+ jobs: Option<tinyagents_orchestration::subagent::SubAgentJobRegistry>,continuation: Option<(SubagentTaskKey, SubagentResume)>,completion: impl Fn(- String,- Result<SubagentRunOutcome, String>,- bool,- ) -> Pin<Box<dyn Future<Output = ()> + Send>>- + Send- + Sync- + 'static,+ String,+ Result<SubagentRunOutcome, String>,+ bool,+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>+ + Send+ + Sync+ + 'static,) -> Result<String, SubagentRunError> {let task_id = continuation.as_ref()@@ -233,7 +233,7 @@ async fn invoke_async_spawn_driver_tool(options: SubagentRunOptions,mode: &str,completion: Option<HostCompletion>,- jobs_override: Option<tinyagents_harness_tools::subagents::SubAgentJobRegistry>,+ jobs_override: Option<tinyagents_orchestration::subagent::SubAgentJobRegistry>,continuation: Option<(SubagentTaskKey, SubagentResume)>,) -> Result<(tinytools::ToolResult, OpenHumanDriverBundle), SubagentRunError> {invoke_driver_tool_with_request(@@ -257,11 +257,12 @@ async fn invoke_driver_tool_with_request(input: String,mode: &str,completion: Option<HostCompletion>,- jobs_override: Option<tinyagents_harness_tools::subagents::SubAgentJobRegistry>,+ jobs_override: Option<tinyagents_orchestration::subagent::SubAgentJobRegistry>,continuation: Option<(SubagentTaskKey, SubagentResume)>,) -> Result<(tinytools::ToolResult, OpenHumanDriverBundle), SubagentRunError> {use tinyagents_harness::tool::ToolDispatch;- use tinyagents_harness_tools::subagents::{DriverSubAgentTool, SubAgentJobRegistry};+ use tinyagents_harness_tools::subagents::DriverSubAgentTool;+ use tinyagents_orchestration::subagent::SubAgentJobRegistry;use tinytools::{PermissionLevel, ToolCallOptions, ToolCategory, ToolScope, ToolTimeout};let task_id = host_requestdiff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rsindex baa5346213..ce33a49f74 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs@@ -239,7 +239,7 @@ async fn a_detached_driver_uses_its_carried_actor_for_lifecycle_commits() {"finish".into(),"background",Some(completion),- Some(tinyagents_harness_tools::subagents::SubAgentJobRegistry::default()),+ Some(tinyagents_orchestration::subagent::SubAgentJobRegistry::default()),None,).awaitdiff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_terminal_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_terminal_tests.rsindex 39a4142da1..39861d1ffb 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_terminal_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_terminal_tests.rs@@ -10,7 +10,7 @@ async fn driver_cancel_uses_the_typed_terminal_for_lossy_idle_sessions() {let directory = tempfile::tempdir().unwrap();let workspace = directory.path();let store = SubagentSessionStore::new(workspace.to_path_buf());- let jobs = tinyagents_harness_tools::subagents::SubAgentJobRegistry::default();+ let jobs = tinyagents_orchestration::subagent::SubAgentJobRegistry::default();let persistence = OpenHumanPersistence::new(workspace.join(".openhuman/subagent_checkpoints"));for (task_id, terminal, expected) in [diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex ad224eddfa..a4a413a883 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -11,6 +11,7 @@ use std::time::Instant;use crate::agent::prompts::render_subagent_system_prompt_with_format;use crate::agent::prompts::{PromptContext, SubagentRenderOptions};+use crate::agent::subagent_host::ParentExecutionContext;use crate::agent::subagent_host::definition_iter_cap;use crate::agent::subagent_host::tool_prep::{dedup_owned_tool_specs, filter_definition_tool_indices, subagent_prompt_protocol,@@ -18,17 +19,16 @@ use crate::agent::subagent_host::tool_prep::{use crate::agent::subagent_host::types::{SubagentMode, SubagentRunError, SubagentRunOptions, SubagentRunOutcome,};-use crate::agent::subagent_host::ParentExecutionContext;use crate::agent::tinyagents::budget::MAX_SPAWN_DEPTH;use crate::agent_registry::host_definition::{AgentDefinition, AgentDefinitionRegistry};use tinyagents_definition::{- validate_tier_transition, AgentTier, IterationPolicy, PromptSource,- SandboxMode as AgentSandboxMode,+ AgentTier, IterationPolicy, PromptSource, SandboxMode as AgentSandboxMode,+ validate_tier_transition,};-use tinyagents_harness::context::{current_run_depth, with_run_depth, RunConfig, RunDepth};+use tinyagents_harness::context::{RunConfig, RunDepth, current_run_depth, with_run_depth};use tinyagents_harness::turn_policy::AGENT_TURN_MAX_OUTPUT_TOKENS;-use tinytools::{SandboxMode as TinyagentsSandboxMode, ToolSpec, WorkspaceDescriptor};use tinyagents_harness_tools::fs::file_state::with_file_state_agent_id;+use tinytools::{SandboxMode as TinyagentsSandboxMode, Tool, ToolSpec, WorkspaceDescriptor};use super::prompt::compose_subagent_system_prompt;use super::provider::resolve_subagent_source;diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rsindex cd68d58528..00670edbc7 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rs@@ -1,5 +1,5 @@use super::*;-use crate::agent::subagent_host::{spawn_async_via_driver_tool_with_jobs, SubagentRunStatus};+use crate::agent::subagent_host::{SubagentRunStatus, spawn_async_via_driver_tool_with_jobs};#[tokio::test]async fn prepared_subagent_runs_through_driver_jobs_dispatcher() {@@ -17,7 +17,7 @@ async fn prepared_subagent_runs_through_driver_jobs_dispatcher() {.with_thread("driver-spawn-thread"),);- let jobs = tinyagents_harness_tools::subagents::SubAgentJobRegistry::new();+ let jobs = tinyagents_orchestration::subagent::SubAgentJobRegistry::new();let (completed_tx, completed_rx) = tokio::sync::oneshot::channel();let completed_tx = Arc::new(std::sync::Mutex::new(Some(completed_tx)));let task_id = spawn_async_via_driver_tool_with_jobs(@@ -251,10 +251,12 @@ async fn independent_host_bundles_share_and_project_the_persisted_winner() {!leader.final_history.is_empty(),"winner history is preserved");- assert!(leader- .final_history- .iter()- .any(|row| { row.role == "tool" && row.tool_call_id.as_deref() == Some("call-1") }));+ assert!(+ leader+ .final_history+ .iter()+ .any(|row| { row.role == "tool" && row.tool_call_id.as_deref() == Some("call-1") })+ );assert_eq!(leader.usage.input_tokens, follower.usage.input_tokens);assert!(leader.usage.input_tokens > 0, "winner usage is preserved");assert_eq!(leader.artifact_paths, follower.artifact_paths);@@ -281,11 +283,10 @@ async fn closing_a_durable_driver_session_cancels_only_its_registered_child() {DurableSubagentSession, DurableSubagentStatus, OpenHumanTinySubagentSessionStore,SubagentSessionStore as HostSessionStore,};- use tinyagents_harness_tools::subagents::{- SubAgentJobAction, SubAgentJobRegistry, SubAgentJobsTool,- };+ use tinyagents_harness_tools::subagents::{SubAgentJobAction, SubAgentJobsTool};use tinyagents_orchestration::subagent::{- SubAgentJobStatus, SubagentSessionStore as TinySessionStore, SubagentTaskKey,+ SubAgentJobRegistry, SubAgentJobStatus, SubagentSessionStore as TinySessionStore,+ SubagentTaskKey,};let scratch = tempfile::tempdir().expect("isolated driver close fixture");@@ -401,19 +402,21 @@ async fn closing_a_durable_driver_session_cancels_only_its_registered_child() {);let owner_scope: std::sync::Arc<dyn Fn(u64) -> String + Send + Sync> =std::sync::Arc::new(move |_| owner.clone());- assert!(port- .close("close-driver-session")- .await- .expect("Tiny close adapter cancels then closes the durable row"));+ assert!(+ port.close("close-driver-session")+ .await+ .expect("Tiny close adapter cancels then closes the durable row")+ );assert_eq!(jobs.get(job_id.as_str()).unwrap().status,SubAgentJobStatus::Running,"the job remains visible while cooperative cancellation unwinds");- assert!(port- .close("close-driver-session")- .await- .expect("repeated close is idempotent without re-cancelling"));+ assert!(+ port.close("close-driver-session")+ .await+ .expect("repeated close is idempotent without re-cancelling")+ );assert!(!parent_cancellation.is_cancelled(), "parent stays live");let tiny_store: std::sync::Arc<dyn TinySessionStore> = std::sync::Arc::new(port.clone());@@ -523,7 +526,7 @@ async fn closing_a_durable_driver_session_cancels_only_its_registered_child() {sibling,"complete independently".into(),sibling_options,- tinyagents_harness_tools::subagents::SubAgentJobRegistry::new(),+ tinyagents_orchestration::subagent::SubAgentJobRegistry::new(),move |_target, result, effects| {let sibling_tx = Arc::clone(&sibling_tx);Box::pin(async move {@@ -572,7 +575,7 @@ async fn stopped_parent_thread_rejects_a_new_driver_spawn_before_execution() {make_def_named_tools(&[]),"return the requested result".into(),options,- tinyagents_harness_tools::subagents::SubAgentJobRegistry::new(),+ tinyagents_orchestration::subagent::SubAgentJobRegistry::new(),|_target, _result, _effects| Box::pin(async {}),).await;@@ -609,7 +612,7 @@ async fn detached_driver_spawn_repairs_replayed_host_outcome_without_reexecutionmake_def_named_tools(&[]),"return the persisted result".into(),first_options,- tinyagents_harness_tools::subagents::SubAgentJobRegistry::new(),+ tinyagents_orchestration::subagent::SubAgentJobRegistry::new(),move |_target, result, effects| {let first_tx = first_tx.clone();Box::pin(async move {@@ -642,7 +645,7 @@ async fn detached_driver_spawn_repairs_replayed_host_outcome_without_reexecutionmake_def_named_tools(&[]),"return the persisted result".into(),replay_options,- tinyagents_harness_tools::subagents::SubAgentJobRegistry::new(),+ tinyagents_orchestration::subagent::SubAgentJobRegistry::new(),move |_target, result, effects| {let replay_tx = replay_tx.clone();Box::pin(async move {diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rsindex 78706dcc9b..80a7f47442 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rs@@ -74,7 +74,7 @@ async fn prepared_child_run_is_exported_from_its_native_journal_lineage() {make_def_named_tools(&[]),"answer without exposing the private sentinel".into(),options,- tinyagents_harness_tools::subagents::SubAgentJobRegistry::new(),+ tinyagents_orchestration::subagent::SubAgentJobRegistry::new(),move |_target, result, effects| {let completion_tx = Arc::clone(&completion_tx);Box::pin(async move {diff --git a/crates/openhuman-core/src/agent/tinyagents/budget.rs b/crates/openhuman-core/src/agent/tinyagents/budget.rsindex 991690306e..7368d78a22 100644--- a/crates/openhuman-core/src/agent/tinyagents/budget.rs+++ b/crates/openhuman-core/src/agent/tinyagents/budget.rs@@ -41,22 +41,8 @@ impl crate::inference::turn_models::TurnModels {if budget.is_none() && admission.is_none() {return self;}- if let Some(models) = self.native_model_set.take() {- let models = models- .map_models(|_, model| ModelBudget::control(model, budget, admission.clone()));- let mut registrations = models.registrations("primary").into_iter();- self.primary = registrations- .next()- .expect("native turn set contains its primary")- .1;- self.routes = registrations.collect();- self.summarizer = models.summarizer();- self.error_slot = models.primary_error_slot();- self.native_model_set = Some(models);- return self;- }- self.primary = ModelBudget::control(self.primary, budget, admission.clone());- self.summarizer = ModelBudget::control(self.summarizer, budget, admission.clone());+ self.primary = control_model(self.primary, budget, admission.clone());+ self.summarizer = control_model(self.summarizer, budget, admission.clone());for (_, route) in &mut self.routes {*route = control_model(route.clone(), budget, admission.clone());}diff --git a/crates/openhuman-core/src/agent/tinyagents/config.rs b/crates/openhuman-core/src/agent/tinyagents/config.rsindex 850c5c78e2..31cddbf2b4 100644--- a/crates/openhuman-core/src/agent/tinyagents/config.rs+++ b/crates/openhuman-core/src/agent/tinyagents/config.rs@@ -14,7 +14,7 @@ use tinyagents_harness::config::{RequiredOutput, SessionConfig, ToolConfig, ToolDispatcher, TurnConfig,};-use crate::config::{AgentConfig, Config, DelegateAgentConfig, RequiredOutputContract};+use crate::config::{AgentConfig, Config, RequiredOutputContract};/// Translates OpenHuman's free-form `agent.tool_dispatcher` string into the/// crate enum.@@ -47,10 +47,7 @@ fn dispatcher_from(raw: &str) -> ToolDispatcher {/// Builds the globally-applicable [`SessionConfig`] from `config`.////// Leaves [`SessionConfig::lead_model`] and [`SessionConfig::subagent_model`]-/// unset — those are per-team pins; see [`apply_team_models`]. `max_depth` is-/// left at `0` (delegation disabled) because depth is a per-delegate setting;-/// see [`apply_delegate`]. A caller that wants the plain single-agent case gets-/// exactly that, with no delegation implied by accident.+/// unset — those are per-team pins; see [`apply_team_models`].pub fn session_config_from(config: &Config) -> anyhow::Result<SessionConfig> {let model = config.default_modeldiff --git a/crates/openhuman-core/src/agent/tinyagents/config_tests.rs b/crates/openhuman-core/src/agent/tinyagents/config_tests.rsindex a1a7078e04..0f6132cafe 100644--- a/crates/openhuman-core/src/agent/tinyagents/config_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/config_tests.rs@@ -236,58 +236,3 @@ fn a_blank_team_pin_does_not_displace_the_default() {assert_eq!(s.effective_lead_model(), "sonnet");assert_eq!(s.effective_subagent_model(), "sonnet");}--#[test]-fn a_blank_delegate_model_keeps_the_session_default() {- let mut c = base();- c.default_model = Some("sonnet".into());- let mut s = session_config_from(&c).unwrap();- apply_delegate(- &mut s,- &DelegateAgentConfig {- model: " ".into(),- system_prompt: None,- temperature: None,- max_depth: 1,- },- );- assert_eq!(s.model, "sonnet");-}--#[test]-fn delegate_overrides_replace_the_base_model_and_enable_delegation() {- let c = base();- let mut s = session_config_from(&c).unwrap();- apply_delegate(- &mut s,- &DelegateAgentConfig {- model: "haiku".into(),- system_prompt: None,- temperature: Some(0.1),- max_depth: 2,- },- );-- assert_eq!(s.model, "haiku");- assert_eq!(s.temperature, Some(0.1));- assert_eq!(s.max_depth, 2);- assert!(s.may_delegate_at(1));- assert!(!s.may_delegate_at(2));-}--#[test]-fn a_delegate_without_a_temperature_keeps_the_configured_default() {- let mut c = base();- c.default_temperature = 0.7;- let mut s = session_config_from(&c).unwrap();- apply_delegate(- &mut s,- &DelegateAgentConfig {- model: "haiku".into(),- system_prompt: None,- temperature: None,- max_depth: 1,- },- );- assert_eq!(s.temperature, Some(0.7));-}diff --git a/crates/openhuman-core/src/agent/tinyagents/state_block.rs b/crates/openhuman-core/src/agent/tinyagents/state_block.rsindex a4eb9ade1c..cdd5ce51c3 100644--- a/crates/openhuman-core/src/agent/tinyagents/state_block.rs+++ b/crates/openhuman-core/src/agent/tinyagents/state_block.rs@@ -23,7 +23,7 @@ use std::sync::Arc;use tinyagents_harness::runtime::AgentHarness;use tinyagents_harness::store::Store;-use tinyagents_harness_tools::scratchpad::{store as scratchpad_store, ClosedPlan};+use tinyagents_harness_tools::scratchpad::{ClosedPlan, store as scratchpad_store};use tinyagents_harness_tools::state_block::StateBlockMiddleware;/// Whether a turn gets the run-state block.@@ -83,6 +83,7 @@ pub(crate) struct FinishedPlan {pub(crate) async fn close_finished_plan(workspace_dir: &std::path::Path,thread_id: Option<&str>,+ context: &crate::core::runtime::DispatchCtx,) -> Option<FinishedPlan> {let thread_id = thread_id.map(str::trim).filter(|id| !id.is_empty())?;let store = crate::storage::sessions::stores_or_ephemeral(workspace_dir).kv;@@ -95,7 +96,7 @@ pub(crate) async fn close_finished_plan("[state_block] plan finished: notes moved to the last task");let goal =- crate::agent::goals::runtime::load_for_thread(workspace_dir, Some(thread_id))+ crate::agent::goals::load_for_thread(workspace_dir, context, Some(thread_id)).await.map(|goal| goal.objective);Some(FinishedPlan { plan, goal })diff --git a/crates/openhuman-core/src/agent/tinyagents/state_block_tests.rs b/crates/openhuman-core/src/agent/tinyagents/state_block_tests.rsindex 3254e9ce5f..187bebeb12 100644--- a/crates/openhuman-core/src/agent/tinyagents/state_block_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/state_block_tests.rs@@ -61,7 +61,7 @@ fn a_turn_that_suppresses_the_goal_gets_no_block() {#[tokio::test]async fn a_finished_plan_hands_its_notes_over_at_the_end_of_the_turn() {use tinyagents_harness_tools::scratchpad::ScratchpadUpdate;- use tinyagents_harness_tools::todos::{store as todo_store, TodoItem};+ use tinyagents_harness_tools::todos::{TodoItem, store as todo_store};let workspace = tempfile::tempdir().unwrap();let store = crate::storage::sessions::stores_or_ephemeral(workspace.path()).kv;@@ -79,21 +79,26 @@ async fn a_finished_plan_hands_its_notes_over_at_the_end_of_the_turn() {.await.unwrap();- assert!(close_finished_plan(workspace.path(), None).await.is_none());+ let dispatch = crate::core::runtime::DispatchCtx::ambient();assert!(- close_finished_plan(workspace.path(), Some("t"))+ close_finished_plan(workspace.path(), None, &dispatch)+ .await+ .is_none()+ );+ assert!(+ close_finished_plan(workspace.path(), Some("t"), &dispatch).await.is_none(),"the plan is still open");todo_store::complete(&store, "t", 1).await.unwrap();- let finished = close_finished_plan(workspace.path(), Some("t"))+ let finished = close_finished_plan(workspace.path(), Some("t"), &dispatch).await.expect("the plan finished with notes");assert_eq!(finished.plan.notes.facts, ["the table is auth_users"]);assert_eq!(finished.goal, None, "the thread has no goal");assert!(- close_finished_plan(workspace.path(), Some("t"))+ close_finished_plan(workspace.path(), Some("t"), &dispatch).await.is_none(),"handed over once"diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rsindex f91995ba14..8bc013ba70 100644--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs@@ -178,7 +178,7 @@ async fn memory_live_context_dispatch_cancels_with_parent_without_creating_a_chi.with_cancellation(cancellation.clone()).into_tinyagents(RunConfig::new("memory-live-context-cancel"));let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&parent.data.dispatch_ctx());assert!(jobs.list().is_empty(), "fresh parent has no child jobs");diff --git a/crates/openhuman-core/src/agent/tools.rs b/crates/openhuman-core/src/agent/tools.rsindex 4d3bd5c8f6..1c7ed20b05 100644--- a/crates/openhuman-core/src/agent/tools.rs+++ b/crates/openhuman-core/src/agent/tools.rs@@ -21,6 +21,5 @@ pub(crate) mod plan_exit;mod todo;pub const PLAN_EXIT_MARKER: &str = tinyagents_harness_tools::PLAN_EXIT_MARKER;-pub use tinyagents_harness_tools::{WaitLoopTool, WaitTool};pub use todo::TodoTool;pub(crate) use todo::TodoToolDispatch;diff --git a/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs b/crates/openhuman-core/src/agent/tools/plan_exit_tests.rsindex 78338d0fe3..7a8abb4e20 100644--- a/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs+++ b/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs@@ -1,4 +1,4 @@-use crate::agent::tools::{plan_exit::plan_exit_tool, PLAN_EXIT_MARKER};+use crate::agent::tools::{PLAN_EXIT_MARKER, plan_exit::plan_exit_tool};use serde_json::json;use tinyagents_harness_tools::plan_review::{PlanReviewRequest, PlanReviewResolution};use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolRunContext};@@ -82,14 +82,16 @@ async fn plan_exit_does_not_flip_while_a_review_is_parked() {// Resolve the parked review so the spawned task and the gate's// bookkeeping don't leak past this test.- assert!(crate::plan_review::host::global().decide_by_thread(- &crate::core::runtime::DispatchCtx::ambient()- .tenant()- .unwrap()- .profile_only(),- thread_id,- PlanReviewResolution::Approve,- ));+ assert!(+ crate::plan_review::host::global().decide_by_thread(+ &crate::core::runtime::DispatchCtx::ambient()+ .tenant()+ .unwrap()+ .profile_only(),+ thread_id,+ PlanReviewResolution::Approve,+ )+ );let resolution = parked.await.unwrap();assert_eq!(resolution, PlanReviewResolution::Approve);diff --git a/crates/openhuman-core/src/agent/tools/todo_tests.rs b/crates/openhuman-core/src/agent/tools/todo_tests.rsindex 777468e3de..697d757d59 100644--- a/crates/openhuman-core/src/agent/tools/todo_tests.rs+++ b/crates/openhuman-core/src/agent/tools/todo_tests.rs@@ -1,5 +1,5 @@use super::*;-use serde_json::{json, Value};+use serde_json::{Value, json};use tinyagents_harness_tools::todos::{TodoItem, TodoStatus};/// Serialize tests that share the process-global scratch store. Same lockdiff --git a/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs b/crates/openhuman-core/src/agent_runs/agent_chat/mod.rsindex 5b52f2a856..917847d816 100644--- a/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs+++ b/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs@@ -14,3 +14,4 @@ pub use session_turn::{};pub(crate) use controllers::all_registered_controllers as all_inference_agent_chat_registered_controllers;+pub(crate) use session_turn::agent_chat_for_with_turn_model_source;diff --git a/crates/openhuman-core/src/agent_runs/mod.rs b/crates/openhuman-core/src/agent_runs/mod.rsindex 85eadd3ca6..3ca8c6287e 100644--- a/crates/openhuman-core/src/agent_runs/mod.rs+++ b/crates/openhuman-core/src/agent_runs/mod.rs@@ -1,8 +1,6 @@-//! Product-facing RPC surfaces for agent runs, workflows, replay, and tools.+//! Product-facing RPC surfaces for agent runs, replay, and tools.pub mod agent_chat;-pub(crate) mod agent_teams;-pub(crate) mod command_center;pub(crate) mod context_breakdown;pub(crate) mod replay;mod schemas;@@ -10,9 +8,6 @@ pub(crate) mod subagent_control;mod subagent_finalize;pub(crate) use agent_chat::all_inference_agent_chat_registered_controllers;-pub(crate) use agent_teams::{- all_agent_team_controller_schemas, all_agent_team_registered_controllers,-};/// The canonical RPC method name for `inference.agent_chat`.////// The controller's `namespace` + `function` combine into the wire method@@ -21,9 +16,6 @@ pub(crate) use agent_teams::{/// spelling the string out, so a rename upstream cannot silently drift an/// embedder's dispatch string away from the registered controller.pub const INFERENCE_AGENT_CHAT: &str = "openhuman.inference_agent_chat";-pub(crate) use command_center::{- all_command_center_controller_schemas, all_command_center_registered_controllers,-};pub(crate) use schemas::all_registered_controllers as all_agent_registered_controllers;pub(crate) use subagent_control::{all_controller_schemas as all_subagent_control_controller_schemas,diff --git a/crates/openhuman-core/src/agent_runs/subagent_control.rs b/crates/openhuman-core/src/agent_runs/subagent_control.rsindex 80e9e95c2d..dcb025ff30 100644--- a/crates/openhuman-core/src/agent_runs/subagent_control.rs+++ b/crates/openhuman-core/src/agent_runs/subagent_control.rs@@ -15,13 +15,12 @@//! cancelled.use crate::core::runtime::DispatchCtx;-use serde_json::{json, Map, Value};-use tinyagents_orchestration::steering::SteerError;+use serde_json::{Map, Value, json};use crate::agent::orchestration::running_subagents::CancelledSubagent;use crate::agent::orchestration::{background_completions, running_subagents, subagent_sessions};-use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::Outcome;+use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::{ControllerSchema, FieldSchema, TypeSchema};/// Controller schemas exposed for detached sub-agent control.@@ -253,53 +252,6 @@ async fn settle_paused_driver_cancel(Ok(transitioned)}-fn handle_subagent_steer(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let cid = new_correlation_id();- let task_id = require_str(¶ms, "taskId")?;- let message = require_str(¶ms, "message")?;- let (lane, mode) = match opt_str(¶ms, "mode").as_deref() {- Some("collect") => (QueueLane::Collect, "collect"),- _ => (QueueLane::Steer, "steer"),- };- log::debug!(- target: "subagent_control_rpc",- "[subagent_control_rpc][{cid}] steer.entry task_id={task_id} mode={mode} chars={}",- message.chars().count()- );-- match running_subagents::steer_control(&ctx, &task_id, message, lane).await {- Ok(()) => {- log::debug!(- target: "subagent_control_rpc",- "[subagent_control_rpc][{cid}] steer.done task_id={task_id} mode={mode} steered=true"- );- to_json(json!({ "steered": true, "taskId": task_id, "mode": mode }))- }- Err(err) => {- let reason = match err {- SteerError::Unknown => "unknown",- // SaaS user controls check the captured worker profile,- // independently of the caller-supplied task ID.- SteerError::NotOwned => "not_owned",- SteerError::UnsupportedLane => "unsupported_lane",- _ => "steer_failed",- };- log::debug!(- target: "subagent_control_rpc",- "[subagent_control_rpc][{cid}] steer.done task_id={task_id} mode={mode} steered=false reason={reason}"- );- to_json(json!({- "steered": false,- "taskId": task_id,- "mode": mode,- "reason": reason,- }))- }- }- })-}-fn to_json<T: serde::Serialize>(value: T) -> Result<Value, String> {Outcome::new(value, vec![]).into_cli_compatible_json()}diff --git a/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs b/crates/openhuman-core/src/agent_runs/subagent_control_tests.rsindex ecc55ea66e..0100ad672a 100644--- a/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs+++ b/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs@@ -76,7 +76,7 @@ fn field(out: &Value, name: &str) -> Option<Value> {/// durable session alone, instead of rewriting it as "cancelled by user".#[tokio::test]async fn cancel_of_a_legacy_failed_run_reports_its_outcome_and_rewrites_nothing() {- use crate::agent::orchestration::subagent_sessions::{mark_failed, SubagentSessionStore};+ use crate::agent::orchestration::subagent_sessions::{SubagentSessionStore, mark_failed};use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};use std::sync::Arc;@@ -157,8 +157,8 @@ async fn cancelling_a_paused_driver_queues_a_failed_delivery_with_reason() {forget_workspace_for_test, pending_for,};use crate::agent::orchestration::subagent_sessions::{- mark_finished, upsert_running, DriverTaskCancellation, SubagentSessionSelector,- SubagentSessionStore, SubagentSessionUpsert,+ DriverTaskCancellation, SubagentSessionSelector, SubagentSessionStore,+ SubagentSessionUpsert, mark_finished, upsert_running,};use std::sync::Arc;use tinyagents_orchestration::subagent::SubagentTaskKey;@@ -241,14 +241,16 @@ async fn cancelling_a_paused_driver_queues_a_failed_delivery_with_reason() {parent_thread.clone(),).expect("paused child owner registered");- assert!(settle_paused_driver_cancel(- &ctx,- &observed,- observed.parent_epoch,- Some("user requested stop")- )- .await- .expect("paused cancellation settles"));+ assert!(+ settle_paused_driver_cancel(+ &ctx,+ &observed,+ observed.parent_epoch,+ Some("user requested stop")+ )+ .await+ .expect("paused cancellation settles")+ );let driver = crate::agent::orchestration::subagent_sessions::open_for_context(&ctx,diff --git a/crates/openhuman-core/src/artifacts/production.rs b/crates/openhuman-core/src/artifacts/production.rsindex ae6d8ef8de..53c9dd9d75 100644--- a/crates/openhuman-core/src/artifacts/production.rs+++ b/crates/openhuman-core/src/artifacts/production.rs@@ -240,7 +240,8 @@ impl Production {let ctx = crate::core::runtime::DispatchCtx::ambient();let scoped = crate::storage::sessions::artifact_scoped_for_in(&self.workspace_dir, &ctx);let file_store = scoped.as_ref().map(|scoped| {- Arc::new(tiny_artifacts::BlobFileStore::new(scoped))+ let storage = super::tiny_store::storage_bundle(scoped);+ Arc::new(tiny_artifacts::BlobFileStore::new(&storage))as Arc<dyn tiny_artifacts::FileStore>});let bridge = super::tiny_store::LegacyUiBridge::new(diff --git a/crates/openhuman-core/src/artifacts/production_tests.rs b/crates/openhuman-core/src/artifacts/production_tests.rsindex ae629eb913..e915f9f24a 100644--- a/crates/openhuman-core/src/artifacts/production_tests.rs+++ b/crates/openhuman-core/src/artifacts/production_tests.rs@@ -126,7 +126,8 @@ async fn a_revision_reuses_the_id_and_file_and_keeps_the_history() {let context = crate::core::runtime::DispatchCtx::ambient();let scoped = crate::storage::sessions::artifact_scoped_for_in(&workspace, &context).expect("production's artifact scope is available");- let blobs = tiny_artifacts::BlobFileStore::new(&scoped);+ let storage = crate::artifacts::tiny_store::storage_bundle(&scoped);+ let blobs = tiny_artifacts::BlobFileStore::new(&storage);for (version, expected) in [(1, b"deck-v1".as_slice()), (2, b"deck-v2!".as_slice())] {let file = record.version(version).unwrap().file.as_ref().unwrap();assert_eq!(blobs.read(&file.key).await.unwrap(), expected);diff --git a/crates/openhuman-core/src/artifacts/tiny_store.rs b/crates/openhuman-core/src/artifacts/tiny_store.rsindex 952dd67b0b..6da617160d 100644--- a/crates/openhuman-core/src/artifacts/tiny_store.rs+++ b/crates/openhuman-core/src/artifacts/tiny_store.rs@@ -36,7 +36,7 @@ use tiny_artifacts::{use super::files::FileRoots;use super::types::ArtifactKind as LegacyArtifactKind;use crate::security::approval::ApprovalChatContext;-use crate::tools::per_call::{context as per_call_context, PerCallTool};+use crate::tools::per_call::{PerCallTool, context as per_call_context};/// Subdirectory under the artifacts root holding versioned records.const VERSIONED_SUBDIR: &str = "versioned";@@ -91,6 +91,21 @@ pub fn versioned_store(workspace_dir: &Path) -> super::version_documents::Documesuper::version_documents::DocumentArtifactStore::new(workspace_dir)}+/// Build the storage bundle expected by OpenHuman and TinyArtifacts from the+/// scope-bound handles supplied by TinyAgents.+pub(super) fn storage_bundle(+ scoped: &tinyagents_storage_kit::ScopedStorage,+) -> crate::storage::Storage {+ crate::storage::Storage::new(+ scoped.documents().clone(),+ scoped.streams().clone(),+ scoped.kv().clone(),+ scoped.blobs().clone(),+ scoped.queues().clone(),+ scoped.secrets().clone(),+ )+}+struct UnavailableArtifactStore;#[async_trait]@@ -136,8 +151,7 @@ impl LegacyFileImportStore {.unwrap_or("bin");let key = format!("artifacts/files/{}/v{}.{}", record.id, version.version, ext);let imported =- tiny_artifacts::import_legacy_file(self.files.as_ref(), &self.roots, &legacy, &key)- .await?;+ import_legacy_file(self.files.as_ref(), &self.roots, &legacy, &key).await?;version.body = imported.key.clone();version.file = Some(imported);changed = true;@@ -149,6 +163,28 @@ impl LegacyFileImportStore {}}+/// Copies a legacy path-backed file into the current artifact file store after+/// applying the same host path-root checks used for new artifact references.+async fn import_legacy_file(+ files: &dyn FileStore,+ roots: &tiny_artifacts::FileRoots,+ legacy: &FileRef,+ key: &str,+) -> anyhow::Result<FileRef> {+ let source = roots.resolve(&legacy.key).await?;+ let bytes = tokio::fs::read(&source.path).await?;+ let media_type = legacy+ .media_type+ .as_deref()+ .or(source.media_type.as_deref());+ let metadata = files.put(key, &bytes, media_type).await?;+ Ok(FileRef {+ key: key.to_owned(),+ size_bytes: metadata.size_bytes,+ media_type: metadata.media_type,+ })+}+#[async_trait]impl ArtifactStore for LegacyFileImportStore {async fn list(&self) -> anyhow::Result<Vec<ArtifactRecord>> {@@ -498,24 +534,38 @@ pub(super) fn build_artifacts_service_with_scope(action_dir: Option<&Path>,chat: Option<&ApprovalChatContext>,ctx: &crate::core::runtime::DispatchCtx,- scoped: Option<crate::storage::ScopedStorage>,+ scoped: Option<tinyagents_storage_kit::ScopedStorage>,publisher: Option<&super::ArtifactPublisherBinder>,) -> (Artifacts, Option<Arc<dyn FileStore>>) {- let roots = file_roots(workspace_dir, &files, action_dir);- let service = Artifacts::new(Arc::new(versioned_store(workspace_dir)))- .with_observer(Arc::new(LegacyUiBridge::new(workspace_dir, files, chat)))- .with_file_roots(guarded_roots(roots));- match crate::storage::local::open("artifacts::files", workspace_dir)- .and_then(|opened| opened.scoped())- {- Ok(scoped) => {- service.with_file_store(Arc::new(tiny_artifacts::BlobFileStore::new(&scoped)))- }- Err(error) => {- log::warn!("[artifacts] file storage unavailable: {error:#}");- service+ let source_roots = guarded_roots(file_roots(workspace_dir, &files, action_dir));+ let storage = scoped.as_ref().map(storage_bundle);+ let record_store: Arc<dyn ArtifactStore> = match storage.as_ref() {+ Some(storage) => Arc::new(super::version_documents::DocumentArtifactStore::over(+ workspace_dir,+ storage,+ )),+ None => Arc::new(versioned_store(workspace_dir)),+ };+ let file_store = storage+ .as_ref()+ .map(|storage| Arc::new(tiny_artifacts::BlobFileStore::new(storage)) as Arc<dyn FileStore>);+ let mut service = Artifacts::new(record_store)+ .with_observer(Arc::new(LegacyUiBridge::new(+ workspace_dir,+ files,+ source_roots.clone(),+ file_store.clone(),+ chat,+ ctx,+ )))+ .with_file_roots(source_roots);+ if let Some(file_store) = &file_store {+ service = service.with_file_store(Arc::clone(file_store));+ if let Some(publisher) = publisher {+ service = service.with_publisher(publisher(Arc::clone(file_store)));}}+ (service, file_store)}/// Where each file version keeps its own copy:diff --git a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs b/crates/openhuman-core/src/artifacts/tiny_store_tests.rsindex 1559bcbbbe..59f8960280 100644--- a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs+++ b/crates/openhuman-core/src/artifacts/tiny_store_tests.rs@@ -1,4 +1,6 @@+use std::collections::HashMap;use std::path::PathBuf;+use std::sync::Mutex;use tiny_artifacts::{ArtifactAuthor, ArtifactKind, ArtifactRecord, ArtifactStore, ArtifactVersion, Author, Content,@@ -9,6 +11,32 @@ use super::*;struct UnusedPublisher;+#[derive(Default)]+struct MemoryArtifactStore(Mutex<HashMap<String, ArtifactRecord>>);++#[async_trait::async_trait]+impl ArtifactStore for MemoryArtifactStore {+ async fn list(&self) -> anyhow::Result<Vec<ArtifactRecord>> {+ Ok(self.0.lock().unwrap().values().cloned().collect())+ }++ async fn get(&self, id: &str) -> anyhow::Result<Option<ArtifactRecord>> {+ Ok(self.0.lock().unwrap().get(id).cloned())+ }++ async fn upsert(&self, artifact: &ArtifactRecord) -> anyhow::Result<()> {+ self.0+ .lock()+ .unwrap()+ .insert(artifact.id.clone(), artifact.clone());+ Ok(())+ }++ async fn delete(&self, id: &str) -> anyhow::Result<bool> {+ Ok(self.0.lock().unwrap().remove(id).is_some())+ }+}+#[async_trait::async_trait]impl tiny_artifacts::ArtifactPublisher for UnusedPublisher {async fn publish(@@ -50,13 +78,12 @@ async fn seeded(async fn legacy_path_refs_are_guarded_and_imported_as_opaque_file_keys() {let dir = tempfile::tempdir().unwrap();let source_root = dir.path().join("Files");- let records_root = dir.path().join("records");let blobs_root = dir.path().join("blobs");std::fs::create_dir_all(&source_root).unwrap();let source = source_root.join("report.txt");std::fs::write(&source, "legacy bytes").unwrap();- let records = Arc::new(tiny_artifacts::FsArtifactStore::new(&records_root));+ let records = Arc::new(MemoryArtifactStore::default());let base: Arc<dyn ArtifactStore> = records.clone();let blobs: Arc<dyn FileStore> = Arc::new(tiny_artifacts::FsFileStore::new(&blobs_root));let importing = LegacyFileImportStore {@@ -128,12 +155,16 @@ async fn explicit_artifact_context_binds_records_and_blobs_to_the_same_profile()let context_b = DispatchCtx::new(core_b.clone());CoreContext::scope(context_for("ambient-b"), async {- let (artifacts_a, files_a) = artifacts_service_with_file_store(+ let scoped_a = crate::storage::sessions::artifact_scoped_for_in(&workspace, &context_a)+ .expect("profile A scope");+ let (artifacts_a, files_a) = build_artifacts_service_with_scope(&workspace,FileRoots::new(&files),None,None,&context_a,+ Some(scoped_a),+ None,);let created = artifacts_a.create(@@ -152,21 +183,27 @@ async fn explicit_artifact_context_binds_records_and_blobs_to_the_same_profile()b"profile-a-bytes");- let (artifacts_b, files_b) = artifacts_service_with_file_store(+ let scoped_b = crate::storage::sessions::artifact_scoped_for_in(&workspace, &context_b)+ .expect("profile B scope");+ let (artifacts_b, files_b) = build_artifacts_service_with_scope(&workspace,FileRoots::new(&files),None,None,&context_b,+ Some(scoped_b),+ None,);assert!(artifacts_b.get(&id).await.unwrap().is_none());- assert!(files_b- .as_ref()- .unwrap()- .metadata(&file.key)- .await- .unwrap()- .is_none());+ assert!(+ files_b+ .as_ref()+ .unwrap()+ .metadata(&file.key)+ .await+ .unwrap()+ .is_none()+ );let card_a = CoreContext::scope(core_a.clone(), async {super::super::store::get_artifact(&workspace, &id).await@@ -242,8 +279,7 @@ async fn missing_artifact_storage_binding_does_not_fall_back_to_ambient_records(async fn legacy_bridge_does_not_overwrite_an_existing_card_file_outside_trusted_roots() {let (workspace, files) = temp_dirs();let root = files.parent().unwrap();- let records: Arc<dyn ArtifactStore> =- Arc::new(tiny_artifacts::FsArtifactStore::new(root.join("records")));+ let records: Arc<dyn ArtifactStore> = Arc::new(MemoryArtifactStore::default());let file_store: Arc<dyn FileStore> =Arc::new(tiny_artifacts::FsFileStore::new(root.join("blobs")));let ctx = crate::core::runtime::DispatchCtx::unbound();@@ -440,16 +476,20 @@ async fn deleting_an_artifact_removes_its_card() {.await.unwrap();let id = saved.record.id;- assert!(super::super::store::get_artifact(&workspace, &id)- .await- .is_ok());+ assert!(+ super::super::store::get_artifact(&workspace, &id)+ .await+ .is_ok()+ );let (removed, notice) = artifacts.delete(&id).await.unwrap();assert!(removed);assert!(notice.is_none(), "{notice:?}");- assert!(super::super::store::get_artifact(&workspace, &id)- .await- .is_err());+ assert!(+ super::super::store::get_artifact(&workspace, &id)+ .await+ .is_err()+ );}#[test]diff --git a/crates/openhuman-core/src/artifacts/version_documents.rs b/crates/openhuman-core/src/artifacts/version_documents.rsindex d7f24be28d..3eac9d0d99 100644--- a/crates/openhuman-core/src/artifacts/version_documents.rs+++ b/crates/openhuman-core/src/artifacts/version_documents.rs@@ -29,12 +29,10 @@ use serde_json::Value;use tiny_artifacts::{ArtifactRecord, ArtifactStore};use tinystoragedrivers::{CollectionSpec, Precondition, Query, Sort};-use super::storage_schema::{version_body, version_record, VERSIONS};+use super::storage_schema::{VERSIONS, version_body, version_record};+use crate::storage::DocumentStoreExt;use crate::storage::documents::Repo;use crate::storage::schema_support::key_of;-use crate::storage::DocumentStoreExt;-use crate::storage::ScopedStorage;-const DOMAIN: &str = "artifacts::versions";fn collections() -> Vec<CollectionSpec> {@@ -45,7 +43,7 @@ fn collections() -> Vec<CollectionSpec> {#[derive(Clone, Debug)]pub struct DocumentArtifactStore {workspace_dir: PathBuf,- scoped: Option<ScopedStorage>,+ scoped: Option<crate::storage::Storage>,}impl DocumentArtifactStore {@@ -59,7 +57,7 @@ impl DocumentArtifactStore {/// The version records over the same explicit tenant scope as this/// artifact service's file store.- pub fn over(workspace_dir: impl Into<PathBuf>, scoped: &ScopedStorage) -> Self {+ pub fn over(workspace_dir: impl Into<PathBuf>, scoped: &crate::storage::Storage) -> Self {Self {workspace_dir: workspace_dir.into(),scoped: Some(scoped.clone()),diff --git a/crates/openhuman-core/src/artifacts/version_documents_tests.rs b/crates/openhuman-core/src/artifacts/version_documents_tests.rsindex e2f7c982c3..b436a48336 100644--- a/crates/openhuman-core/src/artifacts/version_documents_tests.rs+++ b/crates/openhuman-core/src/artifacts/version_documents_tests.rs@@ -35,9 +35,11 @@ async fn records_round_trip_through_the_document_store() {assert!(store.get("a-1").await.unwrap().is_none());assert!(!store.delete("a-1").await.unwrap());// Nothing is written as a file.- assert!(!super::super::tiny_store::legacy_versioned_dir(&ws)- .join("a-2.json")- .exists());+ assert!(+ !super::super::tiny_store::legacy_versioned_dir(&ws)+ .join("a-2.json")+ .exists()+ );}#[tokio::test]diff --git a/crates/openhuman-core/src/channels/bus/delivery.rs b/crates/openhuman-core/src/channels/bus/delivery.rsindex 55391d012a..d6c30e7510 100644--- a/crates/openhuman-core/src/channels/bus/delivery.rs+++ b/crates/openhuman-core/src/channels/bus/delivery.rs@@ -8,7 +8,7 @@ use tinychannels_bus::module_progressive::{ProgressiveCommand, ProgressiveEvent, ProgressiveResult, ProgressiveTransportRequest,ProgressiveTransportResult,};-use tinychannels_bus::{methods, ChannelBackendRequest, ChannelBackendResult};+use tinychannels_bus::{ChannelBackendRequest, ChannelBackendResult, methods};fn request_channel(request: &ProgressiveTransportRequest) -> &str {match request {diff --git a/crates/openhuman-core/src/channels/bus_inbound_thread_id_tests_tests.rs b/crates/openhuman-core/src/channels/bus_inbound_thread_id_tests_tests.rsindex f71f9a2de1..bffce5fba7 100644--- a/crates/openhuman-core/src/channels/bus_inbound_thread_id_tests_tests.rs+++ b/crates/openhuman-core/src/channels/bus_inbound_thread_id_tests_tests.rs@@ -15,10 +15,12 @@ fn channel_message_body_adds_deterministic_idempotency_key() {assert_eq!(left["text"], "hello");assert_eq!(left["threadId"], "topic-1");assert_eq!(left["idempotencyKey"], right["idempotencyKey"]);- assert!(left["idempotencyKey"]- .as_str()- .expect("idempotency key")- .starts_with("legacy-send:telegram:"));+ assert!(+ left["idempotencyKey"]+ .as_str()+ .expect("idempotency key")+ .starts_with("legacy-send:telegram:")+ );}#[test]diff --git a/crates/openhuman-core/src/channels/bus_test_support_tests.rs b/crates/openhuman-core/src/channels/bus_test_support_tests.rsindex 6ecc68b630..e33eb8cc02 100644--- a/crates/openhuman-core/src/channels/bus_test_support_tests.rs+++ b/crates/openhuman-core/src/channels/bus_test_support_tests.rs@@ -2,7 +2,7 @@use tinychannels::channel::derive_inbound_thread_id;use tinychannels::delivery::progressive::{- extract_message_id, latest_thinking_snippet, StreamingState,+ StreamingState, extract_message_id, latest_thinking_snippet,};pub fn extract_message_id_for_test(resp: &serde_json::Value) -> Option<String> {diff --git a/crates/openhuman-core/src/channels/context.rs b/crates/openhuman-core/src/channels/context.rsindex 917a544daa..a29f8d50b2 100644--- a/crates/openhuman-core/src/channels/context.rs+++ b/crates/openhuman-core/src/channels/context.rs@@ -11,9 +11,9 @@ use std::sync::{Arc, Mutex};use tinytools::Tool;pub(crate) use tinychannels_bus::context::{- clear_sender_history, compact_sender_history, ChannelRouteSelection, ConversationHistoryMap,- CHANNEL_MESSAGE_TIMEOUT_SECS, CHANNEL_TYPING_REFRESH_INTERVAL_SECS,- DEFAULT_CHANNEL_INITIAL_BACKOFF_SECS, DEFAULT_CHANNEL_MAX_BACKOFF_SECS, MAX_CHANNEL_HISTORY,+ CHANNEL_MESSAGE_TIMEOUT_SECS, CHANNEL_TYPING_REFRESH_INTERVAL_SECS, ChannelRouteSelection,+ ConversationHistoryMap, DEFAULT_CHANNEL_INITIAL_BACKOFF_SECS, DEFAULT_CHANNEL_MAX_BACKOFF_SECS,+ MAX_CHANNEL_HISTORY, clear_sender_history, compact_sender_history,};#[cfg(test)]@@ -23,7 +23,7 @@ pub(crate) use tinychannels_bus::context::{#[cfg(test)]pub(crate) use tinychannels::context::{- effective_channel_message_timeout_secs, MIN_CHANNEL_MESSAGE_TIMEOUT_SECS,+ MIN_CHANNEL_MESSAGE_TIMEOUT_SECS, effective_channel_message_timeout_secs,};pub(crate) type TurnModelSourceCacheMap = Arc<Mutex<HashMap<String, TurnModelSource>>>;@@ -53,7 +53,6 @@ pub(crate) struct ChannelRuntimeContext {pub(crate) api_url: Option<String>,pub(crate) inference_url: Option<String>,pub(crate) reliability: Arc<crate::config::ReliabilityConfig>,- pub(crate) provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions,pub(crate) workspace_dir: Arc<PathBuf>,pub(crate) message_timeout_secs: u64,pub(crate) multimodal: crate::config::MultimodalConfig,diff --git a/crates/openhuman-core/src/channels/context_tests.rs b/crates/openhuman-core/src/channels/context_tests.rsindex e3d8622aca..36a7a11a0a 100644--- a/crates/openhuman-core/src/channels/context_tests.rs+++ b/crates/openhuman-core/src/channels/context_tests.rs@@ -45,7 +45,6 @@ fn runtime_context() -> ChannelRuntimeContext {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(PathBuf::from("/tmp")),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -119,22 +118,22 @@ fn clear_and_compact_sender_history_update_cached_messages() {}clear_sender_history(&ctx.conversation_histories, sender);- assert!(!ctx- .conversation_histories- .lock()- .unwrap()- .contains_key(sender));+ assert!(+ !ctx.conversation_histories+ .lock()+ .unwrap()+ .contains_key(sender)+ );}#[tokio::test]async fn overflow_detection_covers_edge_cases() {let ctx = runtime_context();- assert!(is_context_window_overflow_error(- &ctx,- &anyhow::anyhow!("Maximum context length exceeded")- )- .await- .unwrap());+ assert!(+ is_context_window_overflow_error(&ctx, &anyhow::anyhow!("Maximum context length exceeded"))+ .await+ .unwrap()+ );assert!(!is_context_window_overflow_error(&ctx, &anyhow::anyhow!("network timeout")).awaitdiff --git a/crates/openhuman-core/src/channels/contract_schema.rs b/crates/openhuman-core/src/channels/contract_schema.rsindex 4371baee33..b9491f04b2 100644--- a/crates/openhuman-core/src/channels/contract_schema.rs+++ b/crates/openhuman-core/src/channels/contract_schema.rs@@ -7,8 +7,8 @@//! schemas the contract defines.use tinychannels_bus::controllers::{- channel_controller_schema, ChannelControllerField, ChannelControllerFieldType,- ChannelControllerSchema,+ ChannelControllerField, ChannelControllerFieldType, ChannelControllerSchema,+ channel_controller_schema,};use crate::core::{ControllerSchema, FieldSchema, TypeSchema};diff --git a/crates/openhuman-core/src/channels/controllers/backend.rs b/crates/openhuman-core/src/channels/controllers/backend.rsindex fef919d25b..a404c6d6ca 100644--- a/crates/openhuman-core/src/channels/controllers/backend.rs+++ b/crates/openhuman-core/src/channels/controllers/backend.rs@@ -1,19 +1,19 @@//! TinyChannels backend implementation for OpenHuman controller operations.+use serde_json::Value;#[cfg(test)]use serde_json::json;-use serde_json::Value;use crate::config::{ChannelsConfig, Config};use crate::core::Outcome;use super::ops;+#[cfg(test)]+use tinychannels_bus::SendMessage;use tinychannels_bus::controllers::{ChannelAuthMode, ChannelDisconnectResult, ChannelReactionResult, ChannelSendMessageResult,ChannelStatusEntry, ChannelThreadListResult, ChannelThreadResult,};-#[cfg(test)]-use tinychannels_bus::SendMessage;/// OpenHuman-owned implementation of the TinyChannels backend contract.#[derive(Debug, Clone)]diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/disconnect.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/disconnect.rsindex 47d3b6f859..35b1c97210 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/disconnect.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/disconnect.rs@@ -1,7 +1,7 @@//! Disconnecting a channel: removing stored credentials and clearing its//! runtime config, optionally along with its memory chunks.-use serde_json::{json, Value};+use serde_json::{Value, json};use crate::config::Config;use crate::core::Outcome;@@ -9,7 +9,7 @@ use crate::security::credentials;use super::memory::clear_channel_memory;use super::shared::credential_provider;-use tinychannels_bus::controllers::{find_channel_definition, ChannelAuthMode};+use tinychannels_bus::controllers::{ChannelAuthMode, find_channel_definition};/// Disconnect a channel by removing stored credentials.pub async fn disconnect_channel(diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rsindex 7ce2d79e8f..f85b4b15a3 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs@@ -179,12 +179,16 @@ async fn clears_stamped_and_legacy_channel_conversations_without_mutating_legacy.await.unwrap().items;- assert!(remaining- .iter()- .any(|item| { item.kind == ItemKind::Learning && item.text == "durable preference" }));- assert!(remaining- .iter()- .any(|item| { item.kind == ItemKind::Document && item.text == "durable brain document" }));+ assert!(+ remaining+ .iter()+ .any(|item| { item.kind == ItemKind::Learning && item.text == "durable preference" })+ );+ assert!(+ remaining.iter().any(|item| {+ item.kind == ItemKind::Document && item.text == "durable brain document"+ })+ );assert!(remaining.iter().any(|item| {item.kind == ItemKind::Conversation&& item.meta.thread_id.as_deref() == Some("telegram-current")@@ -478,9 +482,11 @@ async fn offline_snapshot_scans_every_thread_and_message_page() {.await.unwrap();assert_eq!(threads.len(), 66);- assert!(threads[..64]- .iter()- .all(|thread| thread.id != target_thread));+ assert!(+ threads[..64]+ .iter()+ .all(|thread| thread.id != target_thread)+ );assert!(threads.iter()@@ -497,9 +503,11 @@ async fn offline_snapshot_scans_every_thread_and_message_page() {.await.unwrap();assert_eq!(messages.len(), 66);- assert!(messages[..64]- .iter()- .all(|message| message.extra_metadata.get("channel").is_none()));+ assert!(+ messages[..64]+ .iter()+ .all(|message| message.extra_metadata.get("channel").is_none())+ );assert_eq!(messages[64].extra_metadata["channel"], "discord");assert!(messages[65].extra_metadata.get("channel").is_none());assert!(diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/status.rsindex dc64e6e3eb..19cdea98f6 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs@@ -1,7 +1,7 @@//! Channel connection status, the default proactive-delivery channel, and//! the merged set of currently-connected channel slugs.-use serde_json::{json, Value};+use serde_json::{Value, json};use crate::config::Config;use crate::core::Outcome;diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/test_channel.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/test_channel.rsindex 86b970a0aa..281f236073 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/test_channel.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/test_channel.rs@@ -1,7 +1,7 @@//! Testing credentials through the module without persisting host configuration.use serde_json::Value;-use tinychannels_bus::{methods, ChannelControllerRequest, ChannelControllerResult};+use tinychannels_bus::{ChannelControllerRequest, ChannelControllerResult, methods};use crate::config::Config;use crate::core::Outcome;diff --git a/crates/openhuman-core/src/channels/controllers/ops/discord.rs b/crates/openhuman-core/src/channels/controllers/ops/discord.rsindex 7709d54c4f..957012c7ce 100644--- a/crates/openhuman-core/src/channels/controllers/ops/discord.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/discord.rs@@ -8,8 +8,8 @@ use crate::core::Outcome;use crate::modules::channel_controller::{self, DiscordReply};use crate::security::credentials;use tinychannels_bus::{- controllers::{BotPermissionCheck, DiscordGuild, DiscordTextChannel},ChannelControllerRequest,+ controllers::{BotPermissionCheck, DiscordGuild, DiscordTextChannel},};use super::connect::shared::credential_provider;diff --git a/crates/openhuman-core/src/channels/controllers/ops_connect_status_tests.rs b/crates/openhuman-core/src/channels/controllers/ops_connect_status_tests.rsindex 3eb7b58b83..0f6585ae18 100644--- a/crates/openhuman-core/src/channels/controllers/ops_connect_status_tests.rs+++ b/crates/openhuman-core/src/channels/controllers/ops_connect_status_tests.rs@@ -558,10 +558,12 @@ async fn set_default_channel_rejects_unknown_and_empty() {.await.expect("seed discord");- assert!(set_default_channel(&mut config, "myspace")- .await- .unwrap_err()- .contains("unknown channel"),);+ assert!(+ set_default_channel(&mut config, "myspace")+ .await+ .unwrap_err()+ .contains("unknown channel"),+ );assert!(set_default_channel(&mut config, " ").await.is_err());// A rejected set must not clobber the previously persisted value.diff --git a/crates/openhuman-core/src/channels/controllers/schemas.rs b/crates/openhuman-core/src/channels/controllers/schemas.rsindex b5f02e8a21..cb9e1c17fa 100644--- a/crates/openhuman-core/src/channels/controllers/schemas.rs+++ b/crates/openhuman-core/src/channels/controllers/schemas.rs@@ -1,14 +1,14 @@//! RPC controller schemas and handlers for the channels domain.use crate::core::runtime::DispatchCtx;-use serde::de::DeserializeOwned;use serde::Deserialize;+use serde::de::DeserializeOwned;use serde_json::{Map, Value};use crate::config::Config;-use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::ControllerSchema;use crate::core::Outcome;+use crate::core::all::{ControllerFuture, RegisteredController};use super::backend::OpenHumanChannelBackend;use crate::channels::contract_schema::from_channel_controller_schema;diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rsindex ea713f0ba4..d8f426e46b 100644--- a/crates/openhuman-core/src/channels/host/channel_events.rs+++ b/crates/openhuman-core/src/channels/host/channel_events.rs@@ -1,12 +1,12 @@//! Host-owned approval routing and turn events over the channel module.-use crate::channels::{outbound::text_message, Channel};+use crate::channels::{Channel, outbound::text_message};use crate::core::events::DomainEvent;use async_trait::async_trait;use std::collections::HashMap;use std::path::PathBuf;use std::sync::{Arc, Mutex};-use tinybus::module::ModuleClient;use tinybus::EventHandler;+use tinybus::module::ModuleClient;#[derive(Clone)]struct ReplyContext {diff --git a/crates/openhuman-core/src/channels/host/host_tests.rs b/crates/openhuman-core/src/channels/host/host_tests.rsindex a03eb07e33..87b5943afe 100644--- a/crates/openhuman-core/src/channels/host/host_tests.rs+++ b/crates/openhuman-core/src/channels/host/host_tests.rs@@ -63,8 +63,8 @@ async fn event_sink_rejects_non_object_payload() {#[tokio::test]async fn event_sink_routes_channel_reactions_to_domain_bus() {let sink = OpenHumanEventSink;- assert!(sink- .publish(+ assert!(+ sink.publish("channel","reaction_received",serde_json::json!({@@ -73,9 +73,10 @@ async fn event_sink_routes_channel_reactions_to_domain_bus() {}),).await- .is_ok());- assert!(sink- .publish(+ .is_ok()+ );+ assert!(+ sink.publish("channel","reaction_sent",serde_json::json!({@@ -84,16 +85,19 @@ async fn event_sink_routes_channel_reactions_to_domain_bus() {}),).await- .is_ok());+ .is_ok()+ );// Unknown domain/kind is a benign no-op.- assert!(sink- .publish("mystery", "x", serde_json::json!({}))- .await- .is_ok());- assert!(sink- .publish("channel", "unknown", serde_json::json!({}))- .await- .is_ok());+ assert!(+ sink.publish("mystery", "x", serde_json::json!({}))+ .await+ .is_ok()+ );+ assert!(+ sink.publish("channel", "unknown", serde_json::json!({}))+ .await+ .is_ok()+ );}// --- ConversationHistoryStore --------------------------------------------diff --git a/crates/openhuman-core/src/channels/host/mod.rs b/crates/openhuman-core/src/channels/host/mod.rsindex d5746235fe..eb0ba8ae10 100644--- a/crates/openhuman-core/src/channels/host/mod.rs+++ b/crates/openhuman-core/src/channels/host/mod.rs@@ -17,10 +17,10 @@ pub use channel_events::{ChannelApprovalSurfaceSubscriber, ChannelTurnStateSubsc#[cfg(test)]use std::sync::Arc;-#[cfg(test)]-use tinychannels::host::ChannelHostBuilder;#[cfg(test)]use tinychannels::ChannelHost;+#[cfg(test)]+use tinychannels::host::ChannelHostBuilder;#[cfg(test)]use crate::config::Config;diff --git a/crates/openhuman-core/src/channels/host/remote_control.rs b/crates/openhuman-core/src/channels/host/remote_control.rsindex 6b433b3aa5..592028bec4 100644--- a/crates/openhuman-core/src/channels/host/remote_control.rs+++ b/crates/openhuman-core/src/channels/host/remote_control.rs@@ -1,6 +1,6 @@//! Captured host conversation and session state supplied to the channel module.-use crate::channels::context::{clear_sender_history, ChannelRuntimeContext};+use crate::channels::context::{ChannelRuntimeContext, clear_sender_history};use crate::core::runtime::DispatchCtx;use crate::threads::store::{self as conversations, CreateConversationThread};diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rsindex 84c7e80e6c..59cea5b997 100644--- a/crates/openhuman-core/src/channels/mod.rs+++ b/crates/openhuman-core/src/channels/mod.rs@@ -116,6 +116,7 @@ pub use runtime::test_support;pub use prompt::build_system_prompt;#[cfg(feature = "channels")]pub use runtime::start_channels;+pub(crate) use runtime::turn_driver::run_channel_turn;#[cfg(feature = "channels")]pub(crate) use runtime::{session, start_channels_with_session};diff --git a/crates/openhuman-core/src/channels/module_fixture_tests.rs b/crates/openhuman-core/src/channels/module_fixture_tests.rsindex 38ea3cb9ad..0df7989762 100644--- a/crates/openhuman-core/src/channels/module_fixture_tests.rs+++ b/crates/openhuman-core/src/channels/module_fixture_tests.rs@@ -8,8 +8,8 @@//! on a process-lifetime runtime, so it outlives the short Tokio runtimes of//! individual tests.-use crate::config::schema::ModuleSourceMode;use crate::config::Config;+use crate::config::schema::ModuleSourceMode;use crate::modules::linked::register_linked;use crate::modules::{ops, runtime};use std::sync::{Arc, MutexGuard};@@ -95,10 +95,10 @@ async fn linked_module_prepares_runtime_limits_over_confidential_bus_call() {#[cfg(feature = "e2e-test-support")]async fn linked_module_prepares_legacy_inbound_facts_over_confidential_bus_call() {let _storage = install_memory_storage();+ use tinychannels_bus::ChannelMessage;use tinychannels_bus::module_inbound::{ChannelInboundSource, PrepareChannelInboundRequest, PreparedChannelInbound,};- use tinychannels_bus::ChannelMessage;let message = ChannelMessage {id: "message-1".into(),diff --git a/crates/openhuman-core/src/channels/proactive.rs b/crates/openhuman-core/src/channels/proactive.rsindex 442f189263..5f7d1decdc 100644--- a/crates/openhuman-core/src/channels/proactive.rs+++ b/crates/openhuman-core/src/channels/proactive.rs@@ -19,11 +19,11 @@//! (step 1). This avoids double-delivering to a channel that doesn't//! exist.-use crate::channels::outbound::text_message;use crate::channels::Channel;+use crate::channels::outbound::text_message;use crate::core::events::DomainEvent;-use crate::web_chat::publish_web_channel_event;use crate::web_chat::WebChannelEvent;+use crate::web_chat::publish_web_channel_event;use async_trait::async_trait;use std::collections::HashMap;use std::sync::{Arc, RwLock};diff --git a/crates/openhuman-core/src/channels/prompt_tests.rs b/crates/openhuman-core/src/channels/prompt_tests.rsindex b637d394ab..f263e5b15f 100644--- a/crates/openhuman-core/src/channels/prompt_tests.rs+++ b/crates/openhuman-core/src/channels/prompt_tests.rs@@ -103,14 +103,16 @@ fn build_system_prompt_uses_workspace_skill_location_fallback() {);assert!(prompt.contains("<name>research-helper</name>"));- assert!(prompt.contains(- &tmp.path()- .join("skills")- .join("research-helper")- .join("SKILL.md")- .display()- .to_string()- ));+ assert!(+ prompt.contains(+ &tmp.path()+ .join("skills")+ .join("research-helper")+ .join("SKILL.md")+ .display()+ .to_string()+ )+ );assert!(prompt.contains("running as a Telegram bot"));}diff --git a/crates/openhuman-core/src/channels/providers/relay/channel.rs b/crates/openhuman-core/src/channels/providers/relay/channel.rsindex 0f67ca541b..2960e9c9d7 100644--- a/crates/openhuman-core/src/channels/providers/relay/channel.rs+++ b/crates/openhuman-core/src/channels/providers/relay/channel.rs@@ -10,7 +10,7 @@ use std::sync::Mutex;use async_trait::async_trait;use serde_json::json;-use crate::web_chat::{publish_web_channel_event, WebChannelEvent};+use crate::web_chat::{WebChannelEvent, publish_web_channel_event};use tinychannels_bus::channel::{ContentPart, OutboundContentPart};use tinychannels_bus::{Channel, ChannelOutboundMessage};diff --git a/crates/openhuman-core/src/channels/providers/relay/mod.rs b/crates/openhuman-core/src/channels/providers/relay/mod.rsindex 725be88e74..d2c9ebde8c 100644--- a/crates/openhuman-core/src/channels/providers/relay/mod.rs+++ b/crates/openhuman-core/src/channels/providers/relay/mod.rs@@ -26,10 +26,10 @@ mod params;mod schemas;mod store;-pub use channel::{RelayChannel, CHANNEL_OUTBOUND_EVENT};+pub use channel::{CHANNEL_OUTBOUND_EVENT, RelayChannel};pub use ops::channel_relay_inbound;pub use params::{- validate_channel, validate_id, RelayInboundParams, DEFAULT_RELAY_CLIENT_ID, MAX_CHANNEL_LEN,- MAX_ID_LEN, MAX_SENDER_NAME_CHARS, MAX_TEXT_BYTES, RESERVED_CHANNELS,+ DEFAULT_RELAY_CLIENT_ID, MAX_CHANNEL_LEN, MAX_ID_LEN, MAX_SENDER_NAME_CHARS, MAX_TEXT_BYTES,+ RESERVED_CHANNELS, RelayInboundParams, validate_channel, validate_id,};pub use schemas::{all_relay_controller_schemas, all_relay_registered_controllers};diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rsindex 3a9ea146ee..f844f8607f 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs@@ -3,7 +3,7 @@use std::collections::HashMap;use std::sync::Arc;-use serde_json::{json, Value};+use serde_json::{Value, json};use super::channel::RelayChannel;use super::params::RelayInboundParams;@@ -11,8 +11,8 @@ use super::store::{self, Recorded};use crate::channels::context::MAX_CHANNEL_HISTORY;use crate::channels::outbound::text_message;use crate::channels::runtime::{- build_channel_turn_parts, prepare_runtime_limits, process_channel_runtime_message,- runtime_context, PromptToolDescs, RuntimeChannelMessage,+ PromptToolDescs, RuntimeChannelMessage, build_channel_turn_parts, prepare_runtime_limits,+ process_channel_runtime_message, runtime_context,};use crate::config::Config;use crate::core::Outcome;diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rsindex a601cfc039..7ba8d0a672 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs@@ -1,6 +1,6 @@use super::super::channel::CHANNEL_OUTBOUND_EVENT;use super::*;-use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};use crate::security::turn_origin::AgentTurnOrigin;use std::sync::Mutex;diff --git a/crates/openhuman-core/src/channels/providers/relay/params.rs b/crates/openhuman-core/src/channels/providers/relay/params.rsindex 01eb1edb69..7360772ce5 100644--- a/crates/openhuman-core/src/channels/providers/relay/params.rs+++ b/crates/openhuman-core/src/channels/providers/relay/params.rs@@ -7,7 +7,7 @@ use serde_json::Value;#[cfg(test)]use crate::channels::bus::derive_inbound_thread_id;use tinychannels_bus::{- channel::ContentPart, ChannelInboundEnvelope, ChannelRef, ConversationRef, SenderRef,+ ChannelInboundEnvelope, ChannelRef, ConversationRef, SenderRef, channel::ContentPart,};/// Longest channel name: `telegram`, `imessage`, `discord`, ...diff --git a/crates/openhuman-core/src/channels/providers/relay/schemas_tests.rs b/crates/openhuman-core/src/channels/providers/relay/schemas_tests.rsindex 555179bc7b..3b2e3facb1 100644--- a/crates/openhuman-core/src/channels/providers/relay/schemas_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/schemas_tests.rs@@ -25,9 +25,11 @@ fn the_controller_is_channel_relay_inbound() {#[test]fn the_controller_is_registered() {- assert!(crate::core::all::all_registered_controllers()- .iter()- .any(|c| c.rpc_method_name() == "openhuman.channel_relay_inbound"));+ assert!(+ crate::core::all::all_registered_controllers()+ .iter()+ .any(|c| c.rpc_method_name() == "openhuman.channel_relay_inbound")+ );}#[tokio::test]diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rsindex 01101e4bf3..1088f6cc55 100644--- a/crates/openhuman-core/src/channels/routes.rs+++ b/crates/openhuman-core/src/channels/routes.rs@@ -1,7 +1,7 @@//! Per-sender routing and runtime command handling.-use super::context::{clear_sender_history, ChannelRouteSelection, ChannelRuntimeContext};-use super::{outbound::text_message, Channel};+use super::context::{ChannelRouteSelection, ChannelRuntimeContext, clear_sender_history};+use super::{Channel, outbound::text_message};use std::sync::Arc;use tinychannels_bus as traits;use tinychannels_bus::module_control::{diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rsindex 74009d9586..6050c1e066 100644--- a/crates/openhuman-core/src/channels/routes_tests.rs+++ b/crates/openhuman-core/src/channels/routes_tests.rs@@ -1,6 +1,6 @@use super::*;use crate::channels::context::{- conversation_history_key, ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap,+ ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap, conversation_history_key,};use crate::channels::host::ChannelTurnStateSubscriber;use crate::core::events::DomainEvent;@@ -170,7 +170,6 @@ pub(super) fn runtime_context(workspace_dir: PathBuf) -> ChannelRuntimeContext {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(workspace_dir),message_timeout_secs: 60,multimodal: crate::config::MultimodalConfig::default(),@@ -481,12 +480,13 @@ async fn handle_runtime_command_set_model_clears_sender_history_and_persists_rou.await;assert!(handled);- assert!(ctx- .conversation_histories- .lock()- .unwrap()- .get(key)- .is_none());+ assert!(+ ctx.conversation_histories+ .lock()+ .unwrap()+ .get(key)+ .is_none()+ );assert_eq!(get_route_selection(&ctx, key),ChannelRouteSelection {@@ -608,7 +608,9 @@ async fn handle_runtime_command_telegram_sessions_reports_empty_store() {let sent = channel_impl.sent.lock().unwrap();assert_eq!(sent.len(), 1);- assert!(sent_text(&sent[0]).contains("No conversation threads yet. Send `/new` to create one."));+ assert!(+ sent_text(&sent[0]).contains("No conversation threads yet. Send `/new` to create one.")+ );assert_eq!(sent[0].thread_id.as_deref(), Some("42"));}@@ -643,12 +645,13 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {).await);- assert!(ctx- .conversation_histories- .lock()- .unwrap()- .get(sender_key)- .is_none());+ assert!(+ ctx.conversation_histories+ .lock()+ .unwrap()+ .get(sender_key)+ .is_none()+ );ctx.conversation_histories.lock()@@ -727,9 +730,10 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {assert!(sent_text(&sent[2]).contains("**Recent sessions**"));assert!(sent_text(&sent[2]).contains("→ `Telegram"));- assert!(sent- .iter()- .all(|message| message.thread_id.as_deref() == Some("42")));+ assert!(+ sent.iter()+ .all(|message| message.thread_id.as_deref() == Some("42"))+ );}#[tokio::test]diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rsindex 85a8e490e0..e6b9267229 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs@@ -1,7 +1,7 @@use super::*;use crate::core::runtime::DispatchCtx;use std::sync::Arc;-use tokio::sync::{oneshot, Notify};+use tokio::sync::{Notify, oneshot};struct DeferredTyping {started: Notify,diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rsindex 913640ad98..f76919ba9e 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs@@ -3,13 +3,13 @@//! still goes to the orchestrator over the bus.use super::*;-use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};use crate::agent::host_agents::{self, HostAgent, HostAgentResolver};-use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};-use crate::channels::runtime::process_channel_message;use crate::channels::Channel;+use crate::channels::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};+use crate::channels::runtime::process_channel_message;use crate::core::runtime::{CoreContext, DomainSet};-use serde_json::{json, Value};+use serde_json::{Value, json};use std::collections::HashMap;use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};@@ -66,7 +66,6 @@ fn context(channel: Arc<Telegram>, config: Config) -> Arc<ChannelRuntimeContext>api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(config.workspace_dir.clone()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rsindex dfad28932d..65db6b53ee 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs@@ -29,7 +29,7 @@ use tinychannels_bus as traits;pub(crate) mod posture;mod turn;-pub(crate) use turn::{run_host_agent_turn, seed_rows, HostChannelTurn};+pub(crate) use turn::{HostChannelTurn, run_host_agent_turn, seed_rows};/// What a channel's binding resolves to for one message.pub(crate) enum HostRoute {diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture_tests.rsindex a7df3a5833..a73e103e55 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture_tests.rs@@ -1,8 +1,8 @@use super::*;use crate::agent::HostTurnTools;-use serde_json::{json, Value};-use std::sync::atomic::{AtomicUsize, Ordering};+use serde_json::{Value, json};use std::sync::Arc;+use std::sync::atomic::{AtomicUsize, Ordering};use tinytools::{ToolCallOptions, ToolResult};fn external() -> AgentTurnOrigin {diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rsindex ef475d3eda..e59049ad48 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs@@ -19,7 +19,7 @@ mod processor;mod routing;pub(crate) use processor::{- process_channel_runtime_message, run_message_dispatch_loop, RuntimeChannelMessage,+ RuntimeChannelMessage, process_channel_runtime_message, run_message_dispatch_loop,};#[cfg(test)]@@ -38,7 +38,7 @@ use helpers::build_channel_context_block;use helpers::select_acknowledgment_reaction;#[cfg(test)]-use routing::{build_visible_tool_set, AgentScoping};+use routing::{AgentScoping, build_visible_tool_set};#[cfg(any(test, debug_assertions))]#[path = "mod_test_support_tests.rs"]diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rsindex 6c9b6712d5..5976705f83 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs@@ -23,7 +23,7 @@ mod bus_turn;mod in_order;mod turn;-use super::inbound_batch::{merge_channel_batch, QueuedInbound};+use super::inbound_batch::{QueuedInbound, merge_channel_batch};use crate::channels::context::ChannelRuntimeContext;use crate::config::InboundDebounceConfig;use crate::inbound_debounce::{KeyedDebouncer, Push};@@ -64,8 +64,8 @@ impl RuntimeChannelMessage {}}-use admit::admit_runtime_message;pub(crate) use admit::AdmittedInbound;+use admit::admit_runtime_message;#[cfg(test)]pub(crate) use approval::channel_has_approval_surface;#[cfg(test)]diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rsindex 4843f733d9..ecfc057963 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs@@ -10,8 +10,8 @@ use crate::util::truncate_with_ellipsis;use std::sync::Arc;use tinychannels_bus::ChannelInboundEnvelope;-use super::approval::{channel_has_approval_surface, try_route_approval_reply};use super::RuntimeChannelMessage;+use super::approval::{channel_has_approval_surface, try_route_approval_reply};/// A prepared inbound message that still needs an agent turn: not a runtime/// command and not an approval reply.diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rsindex 37f50c1cb2..072649449b 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs@@ -1,7 +1,7 @@//! The orchestrator path: an unbound channel's turn goes over the native bus//! to the `agent.run_turn` handler, with the orchestrator's tool scoping.-use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};+use crate::agent::bus::{AGENT_RUN_TURN_METHOD, AgentTurnRequest, AgentTurnResponse};use crate::channels::context::{ChannelRouteSelection, ChannelRuntimeContext};use crate::core::bus::BUS;use crate::progress::AgentProgress;diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rsindex 6e2b9c73f4..e732589d1f 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs@@ -4,7 +4,7 @@use crate::agent::bus::AgentTurnResponse;use crate::channels::context::{- compact_sender_history, is_context_window_overflow_error, ChannelRuntimeContext,+ ChannelRuntimeContext, compact_sender_history, is_context_window_overflow_error,};use crate::channels::outbound::text_message;use crate::channels::routes::{get_or_create_turn_model_source, get_route_selection};@@ -15,20 +15,20 @@ use crate::util::truncate_with_ellipsis;use std::sync::Arc;use std::time::{Duration, Instant};use tinyagents_session::transcript::TranscriptMessage;-use tinychannels_bus::context::ChatMessage;use tinychannels_bus::ChannelInboundEnvelope;+use tinychannels_bus::context::ChatMessage;use tokio_util::sync::CancellationToken;use tokio_util::task::AbortOnDropHandle;use super::super::helpers::{- build_channel_context_block, log_worker_join_result, spawn_typing_task,- REPLY_LOG_TRUNCATE_CHARS,+ REPLY_LOG_TRUNCATE_CHARS, build_channel_context_block, log_worker_join_result,+ spawn_typing_task,};-use super::super::host_agent::{self, run_host_agent_turn, seed_rows, HostChannelTurn, HostRoute};-use super::admit::{admit_runtime_message, AdmittedInbound};+use super::super::host_agent::{self, HostChannelTurn, HostRoute, run_host_agent_turn, seed_rows};+use super::RuntimeChannelMessage;+use super::admit::{AdmittedInbound, admit_runtime_message};use super::approval::channel_has_approval_surface;use super::bus_turn::dispatch_bus_turn;-use super::RuntimeChannelMessage;pub(crate) async fn process_channel_message(ctx: Arc<ChannelRuntimeContext>,diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs b/crates/openhuman-core/src/channels/runtime/dispatch/routing.rsindex 08dd70b791..79edf395d7 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs@@ -8,12 +8,12 @@use crate::agent_registry::host_definition::{AgentDefinition, AgentDefinitionRegistry};use crate::config::Config;+use crate::integrations::ConnectedIntegration;use crate::integrations::composio::orchestrator_actions;use crate::integrations::composio::{- cached_active_integrations, fetch_connected_integrations_status,- FetchConnectedIntegrationsStatus,+ FetchConnectedIntegrationsStatus, cached_active_integrations,+ fetch_connected_integrations_status,};-use crate::integrations::ConnectedIntegration;use std::collections::HashSet;use std::time::Duration;use tinyagents_definition::ToolScope;diff --git a/crates/openhuman-core/src/channels/runtime/mod.rs b/crates/openhuman-core/src/channels/runtime/mod.rsindex 47ca37fc04..a3ff8afff5 100644--- a/crates/openhuman-core/src/channels/runtime/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/mod.rs@@ -22,9 +22,9 @@ pub(crate) use startup::start_channels_with_session;#[cfg(feature = "channels")]pub(crate) use dispatch::process_channel_message;#[cfg(feature = "channels")]-pub(crate) use dispatch::{process_channel_runtime_message, RuntimeChannelMessage};+pub(crate) use dispatch::{RuntimeChannelMessage, process_channel_runtime_message};#[cfg(feature = "channels")]-pub(crate) use startup::{build_channel_turn_parts, runtime_context, PromptToolDescs};+pub(crate) use startup::{PromptToolDescs, build_channel_turn_parts, runtime_context};#[cfg(feature = "channels")]#[cfg(any(test, debug_assertions))]diff --git a/crates/openhuman-core/src/channels/runtime/session_tests.rs b/crates/openhuman-core/src/channels/runtime/session_tests.rsindex 6aa6d4da36..3502a55425 100644--- a/crates/openhuman-core/src/channels/runtime/session_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/session_tests.rs@@ -1,7 +1,7 @@use super::*;use crate::core::runtime::DispatchCtx;-use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};use std::sync::Arc;+use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};#[tokio::test]async fn independent_local_runtime_does_not_need_an_account_session() {diff --git a/crates/openhuman-core/src/channels/runtime/startup.rs b/crates/openhuman-core/src/channels/runtime/startup.rsindex d9f8324fd3..36ec65dfd9 100644--- a/crates/openhuman-core/src/channels/runtime/startup.rs+++ b/crates/openhuman-core/src/channels/runtime/startup.rs@@ -66,7 +66,7 @@ pub(crate) async fn prepare_runtime_limits(pub use start_channels::start_channels;pub(crate) use start_channels::start_channels_with_session;-pub(crate) use turn_parts::{build_channel_turn_parts, runtime_context, PromptToolDescs};+pub(crate) use turn_parts::{PromptToolDescs, build_channel_turn_parts, runtime_context};// Re-exported at module scope (rather than left as private `pub(super)`// items reached only through their owning submodule) so the `#[path]` test@@ -75,7 +75,7 @@ pub(crate) use turn_parts::{build_channel_turn_parts, runtime_context, PromptToo#[cfg(test)]use crate::config::Config;#[cfg(test)]-use chat_workload::{resolve_chat_workload, ChatWorkloadResolution};+use chat_workload::{ChatWorkloadResolution, resolve_chat_workload};#[cfg(any(test, debug_assertions))]use credentials::resolve_yuanbao_app_secret;#[cfg(test)]diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rsindex 54c6ba363d..dfeb77958b 100644--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs@@ -18,12 +18,12 @@use std::collections::BTreeMap;use std::path::Path;-use crate::storage::{documents::Repo, Scope};-use serde_json::{json, Value};+use crate::storage::{Scope, documents::Repo};+use serde_json::{Value, json};use sha2::Digest;use tinychannels_bus::module_delivery::{- DeliveryQueueEntry, DeliveryTerminalResult, DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES,- DELIVERY_RESULT_CAPACITY, DELIVERY_RESULT_TTL_SECONDS,+ DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES, DELIVERY_RESULT_CAPACITY,+ DELIVERY_RESULT_TTL_SECONDS, DeliveryQueueEntry, DeliveryTerminalResult,};use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition, StorageBackend};diff --git a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rsindex 6a549d9bd0..2639ed3dd9 100644--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs@@ -10,11 +10,11 @@ use async_trait::async_trait;use std::collections::HashMap;use std::sync::{Arc, OnceLock, Weak};use tinybus::module::{ModuleCallError, ModuleClient, ModuleObjectClient};+use tinychannels_bus::Channel;use tinychannels_bus::module_runtime::{ChannelIngressKind, ChannelMessagePreparation, ConfiguredChannelInfo,};use tinychannels_bus::module_supervision::ChannelSupervisionPolicy;-use tinychannels_bus::Channel;use tinychannels_bus::{ChannelInteraction, ChannelInteractionResult};use tokio::sync::mpsc;diff --git a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rsindex 473621dc38..3a21ab2e91 100644--- a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs@@ -3,7 +3,7 @@use super::super::dispatch::run_message_dispatch_loop;use super::module_providers::ModuleChannelRuntime;-use super::turn_parts::{build_channel_turn_parts, runtime_context, PromptToolDescs};+use super::turn_parts::{PromptToolDescs, build_channel_turn_parts, runtime_context};use crate::config::Config;use crate::core::bus::BUS;use crate::core::events::DomainEvent;diff --git a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rsindex d9ef12b186..1aa2cbb033 100644--- a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs@@ -6,7 +6,7 @@//! the caller's own config and policy, so a relayed turn never runs with the//! operator's tools or workspace.-use super::chat_workload::{resolve_chat_workload, ChatWorkloadResolution};+use super::chat_workload::{ChatWorkloadResolution, resolve_chat_workload};use super::prompt::format_access_context;use crate::channels::context::ChannelRuntimeContext;use crate::channels::system_prompt::{ChannelPromptInputs, ChannelSystemPrompt};@@ -26,7 +26,6 @@ use tinytools::Tool;pub(crate) struct ChannelTurnParts {pub(crate) model: String,pub(crate) provider_name: String,- pub(crate) provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions,pub(crate) tools_registry: Arc<Vec<Box<dyn Tool>>>,pub(crate) system_prompt: ChannelSystemPrompt,pub(crate) skills: Vec<Workflow>,@@ -92,12 +91,6 @@ pub(crate) fn build_channel_turn_parts(security: &Arc<SecurityPolicy>,descs: PromptToolDescs,) -> Result<ChannelTurnParts> {- let provider_runtime_options = crate::tools::delegate::ProviderRuntimeOptions {- auth_profile_override: None,- openhuman_dir: config.config_path.parent().map(std::path::PathBuf::from),- secrets_encrypt: config.secrets.encrypt,- reasoning_enabled: config.runtime.reasoning_enabled,- };let (model, provider_name) = match resolve_chat_workload(config) {ChatWorkloadResolution::Cloud => {let (_chat, model) = provider::create_chat_model_with_model_id_in(diff --git a/crates/openhuman-core/src/channels/runtime/startup_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_tests.rsindex b34feaf01f..a74dfe7b3b 100644--- a/crates/openhuman-core/src/channels/runtime/startup_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/startup_tests.rs@@ -7,7 +7,7 @@//! (cloud) path is preserved for users who haven't picked a local ///! BYOK model, and the override path activates for those who have.-use super::{resolve_chat_workload, ChatWorkloadResolution, RelayInboundMessageHandler};+use super::{ChatWorkloadResolution, RelayInboundMessageHandler, resolve_chat_workload};use crate::config::Config;use tinychannels::relay::RelayInboundHandler;diff --git a/crates/openhuman-core/src/channels/runtime/supervision.rs b/crates/openhuman-core/src/channels/runtime/supervision.rsindex b239a61c8b..08791296eb 100644--- a/crates/openhuman-core/src/channels/runtime/supervision.rs+++ b/crates/openhuman-core/src/channels/runtime/supervision.rs@@ -94,7 +94,7 @@ pub(crate) fn spawn_supervised_listener(}#[cfg(test)]-pub(crate) use tinychannels::runtime::{jitter_millis, MAX_JITTER_MS};+pub(crate) use tinychannels::runtime::{MAX_JITTER_MS, jitter_millis};#[cfg(test)]#[path = "supervision_tests.rs"]diff --git a/crates/openhuman-core/src/channels/runtime/supervision_tests.rs b/crates/openhuman-core/src/channels/runtime/supervision_tests.rsindex cfdf387ad5..4ac995ef2a 100644--- a/crates/openhuman-core/src/channels/runtime/supervision_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/supervision_tests.rs@@ -1,5 +1,5 @@use super::super::super::Channel;-use super::{jitter_millis, spawn_supervised_listener, MAX_JITTER_MS};+use super::{MAX_JITTER_MS, jitter_millis, spawn_supervised_listener};use std::sync::{Arc, Mutex};use tinychannels_bus as traits;use tinychannels_bus::SendMessage;diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rsindex 5378596d66..085620f4ad 100644--- a/crates/openhuman-core/src/channels/runtime/test_support.rs+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs@@ -1,17 +1,16 @@//! Debug-build harnesses for raw integration coverage of the channel runtime.pub use super::dispatch::test_support::build_channel_context_block_for_test;-use super::dispatch::{process_channel_runtime_message, RuntimeChannelMessage};+use super::dispatch::{RuntimeChannelMessage, process_channel_runtime_message};pub use super::startup::test_support::resolve_yuanbao_app_secret_for_test;-use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};-use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};+use crate::agent::bus::{AGENT_RUN_TURN_METHOD, AgentTurnRequest, AgentTurnResponse};use crate::channels::Channel;use crate::channels::ChannelSystemPrompt;+use crate::channels::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};use crate::config::{MultimodalConfig, MultimodalFileConfig, ReliabilityConfig};use crate::core::bus::BUS;use crate::core::events::DomainEvent;use crate::progress::AgentProgress;-use crate::tools::delegate::ProviderRuntimeOptions;use anyhow::Result;use async_trait::async_trait;use std::collections::HashMap;diff --git a/crates/openhuman-core/src/channels/system_prompt.rs b/crates/openhuman-core/src/channels/system_prompt.rsindex a171646c40..e36ba20f39 100644--- a/crates/openhuman-core/src/channels/system_prompt.rs+++ b/crates/openhuman-core/src/channels/system_prompt.rs@@ -21,8 +21,8 @@//! bytes, which is the whole point.use crate::channels::prompt::{- build_system_prompt_with_identity, render_project_context, ProjectContextPlacement,- PromptIdentityOverride,+ ProjectContextPlacement, PromptIdentityOverride, build_system_prompt_with_identity,+ render_project_context,};use std::collections::hash_map::DefaultHasher;use std::hash::{Hash, Hasher};diff --git a/crates/openhuman-core/src/channels/tests/discord_integration.rs b/crates/openhuman-core/src/channels/tests/discord_integration.rsindex fef9a24605..20d4ea27af 100644--- a/crates/openhuman-core/src/channels/tests/discord_integration.rs+++ b/crates/openhuman-core/src/channels/tests/discord_integration.rs@@ -23,12 +23,12 @@//! ever reverts to calling `run_tool_call_loop` directly, this test//! starts failing.+use super::super::Channel;use super::super::context::{- conversation_history_key, ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS,+ CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext, conversation_history_key,};use super::super::runtime::process_channel_message;-use super::super::Channel;-use super::common::{channel_envelope, HistoryCaptureModel};+use super::common::{HistoryCaptureModel, channel_envelope};use std::collections::HashMap;use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};@@ -136,7 +136,6 @@ fn make_discord_ctx(api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/channels/tests/health.rs b/crates/openhuman-core/src/channels/tests/health.rsindex 5596b27866..6ff214a8dd 100644--- a/crates/openhuman-core/src/channels/tests/health.rs+++ b/crates/openhuman-core/src/channels/tests/health.rs@@ -1,8 +1,8 @@-use super::super::runtime::spawn_supervised_listener;use super::super::Channel;+use super::super::runtime::spawn_supervised_listener;use super::common::AlwaysFailChannel;-use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::Arc;+use std::sync::atomic::{AtomicUsize, Ordering};use std::time::Duration;use tinychannels_bus as traits;@@ -37,10 +37,12 @@ async fn supervised_listener_marks_error_and_restarts_on_failures() {assert_eq!(component["status"], "error");assert!(component["restart_count"].as_u64().unwrap_or(0) >= 1);- assert!(component["last_error"]- .as_str()- .unwrap_or("")- .contains("listen boom"));+ assert!(+ component["last_error"]+ .as_str()+ .unwrap_or("")+ .contains("listen boom")+ );assert!(calls.load(Ordering::SeqCst) >= 1);}diff --git a/crates/openhuman-core/src/channels/tests/prompt.rs b/crates/openhuman-core/src/channels/tests/prompt.rsindex eefb9d3fe5..ffcf8290d9 100644--- a/crates/openhuman-core/src/channels/tests/prompt.rs+++ b/crates/openhuman-core/src/channels/tests/prompt.rs@@ -1,5 +1,5 @@use super::common::make_workspace;-use crate::channels::prompt::{build_system_prompt, BOOTSTRAP_MAX_CHARS};+use crate::channels::prompt::{BOOTSTRAP_MAX_CHARS, build_system_prompt};use tempfile::TempDir;#[test]diff --git a/crates/openhuman-core/src/channels/tests/runtime_debounce.rs b/crates/openhuman-core/src/channels/tests/runtime_debounce.rsindex 82c2a5a43e..0f373caa44 100644--- a/crates/openhuman-core/src/channels/tests/runtime_debounce.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_debounce.rs@@ -1,15 +1,15 @@-use super::super::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};-use super::super::runtime::{run_message_dispatch_loop, RuntimeChannelMessage};use super::super::Channel;-use super::common::{channel_envelope, RecordingChannel, SlowModel, TelegramRecordingChannel};-use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};+use super::super::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};+use super::super::runtime::{RuntimeChannelMessage, run_message_dispatch_loop};+use super::common::{RecordingChannel, SlowModel, TelegramRecordingChannel, channel_envelope};+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};use crate::config::InboundDebounceConfig;use crate::core::bus_testing::MockBusGuard;use std::collections::HashMap;use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};use std::time::Duration;-use tokio::sync::{mpsc, Notify};+use tokio::sync::{Notify, mpsc};use tokio::task::JoinHandle;#[derive(Default)]@@ -97,7 +97,6 @@ fn runtime_with(channel: Arc<dyn Channel>) -> Arc<ChannelRuntimeContext> {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -252,12 +251,16 @@ async fn messages_during_a_running_turn_become_one_follow_up_that_sees_its_histoassert_eq!(turns.peak.load(Ordering::SeqCst), 1);assert!(turns.last_user(1).ends_with("second\nthird"));let history = turns.history(1);- assert!(history- .iter()- .any(|(role, content)| role == "assistant" && content == "reply 1"));- assert!(history- .iter()- .any(|(role, content)| role == "user" && content.ends_with("first")));+ assert!(+ history+ .iter()+ .any(|(role, content)| role == "assistant" && content == "reply 1")+ );+ assert!(+ history+ .iter()+ .any(|(role, content)| role == "user" && content.ends_with("first"))+ );run.finish().await;assert_eq!(channel.sent_messages.lock().await.len(), 2);}diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rsindex 4c95664d84..d4f7abbfbd 100644--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs@@ -1,11 +1,11 @@-use super::super::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};-use super::super::runtime::test_support::{run_dispatch_harness, DispatchHarnessOptions};+use super::super::Channel;+use super::super::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};+use super::super::runtime::test_support::{DispatchHarnessOptions, run_dispatch_harness};use super::super::runtime::{- process_channel_message, run_message_dispatch_loop, RuntimeChannelMessage,+ RuntimeChannelMessage, process_channel_message, run_message_dispatch_loop,};-use super::super::Channel;-use super::common::{channel_envelope, use_real_agent_handler, RecordingChannel, SlowModel};-use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};+use super::common::{RecordingChannel, SlowModel, channel_envelope, use_real_agent_handler};+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};use crate::core::events::DomainEvent;use std::collections::HashMap;use std::sync::atomic::{AtomicUsize, Ordering};@@ -135,7 +135,6 @@ async fn message_dispatch_processes_messages_in_parallel() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -212,7 +211,6 @@ async fn process_channel_message_cancels_scoped_typing_task() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -302,7 +300,6 @@ async fn dispatch_routes_through_agent_run_turn_bus_handler() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -423,7 +420,6 @@ async fn resolved_route_ctx() -> Arc<ChannelRuntimeContext> {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -557,7 +553,6 @@ async fn process_channel_message_hardens_multimodal_files_against_smuggled_markeapi_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -642,7 +637,6 @@ async fn process_channel_message_hardens_against_relative_path_markers() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -685,8 +679,10 @@ async fn dispatch_replies_with_timeout_notice_when_handler_exceeds_deadline() {..Default::default()}).await;- assert!(timed_out- .sends- .iter()- .any(|send| send.content.contains("Request timed out")));+ assert!(+ timed_out+ .sends+ .iter()+ .any(|send| send.content.contains("Request timed out"))+ );}diff --git a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rsindex db4f8cf6bd..41bb68ac9b 100644--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs@@ -1,12 +1,12 @@+use super::super::Channel;use super::super::context::{- conversation_history_key, ChannelRouteSelection, ChannelRuntimeContext,- CHANNEL_MESSAGE_TIMEOUT_SECS,+ CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRouteSelection, ChannelRuntimeContext,+ conversation_history_key,};use super::super::runtime::process_channel_message;-use super::super::Channel;use super::common::{- channel_envelope, IterativeToolModel, MockPriceTool, ModelCaptureModel, RecordingChannel,- TelegramRecordingChannel, ToolCallingModel,+ IterativeToolModel, MockPriceTool, ModelCaptureModel, RecordingChannel,+ TelegramRecordingChannel, ToolCallingModel, channel_envelope,};use std::collections::HashMap;use std::sync::atomic::Ordering;@@ -41,7 +41,6 @@ async fn process_channel_message_executes_native_tool_calls() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -127,7 +126,6 @@ async fn process_channel_message_handles_models_command_without_llm_call() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -229,7 +227,6 @@ async fn process_channel_message_uses_route_override_provider_and_model() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -281,7 +278,6 @@ async fn process_channel_message_respects_configured_max_tool_iterations_above_dapi_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -341,7 +337,6 @@ async fn process_channel_message_reports_configured_max_tool_iterations_limit()api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/channels/tests/telegram_integration.rs b/crates/openhuman-core/src/channels/tests/telegram_integration.rsindex 3678a472c3..78c836c4b3 100644--- a/crates/openhuman-core/src/channels/tests/telegram_integration.rs+++ b/crates/openhuman-core/src/channels/tests/telegram_integration.rs@@ -5,12 +5,12 @@//! captures every `SendMessage` — including `thread_ts` — so assertions can be made//! about exactly what the channel receives, without needing a real Telegram HTTP server.+use super::super::Channel;use super::super::context::{- conversation_history_key, ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS,+ CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext, conversation_history_key,};use super::super::runtime::process_channel_message;-use super::super::Channel;-use super::common::{channel_envelope, SlowModel};+use super::common::{SlowModel, channel_envelope};use std::collections::HashMap;use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};@@ -112,7 +112,6 @@ fn make_test_context(api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/config/migrations/migrate_legacy_embedding_provider_tests.rs b/crates/openhuman-core/src/config/migrations/migrate_legacy_embedding_provider_tests.rsindex f87b0e9103..e5596af443 100644--- a/crates/openhuman-core/src/config/migrations/migrate_legacy_embedding_provider_tests.rs+++ b/crates/openhuman-core/src/config/migrations/migrate_legacy_embedding_provider_tests.rs@@ -110,7 +110,7 @@ async fn reachable_probe_false_when_no_server() {#[tokio::test]async fn reachable_probe_true_for_2xx_server() {- use axum::{routing::get, Router};+ use axum::{Router, routing::get};use tokio::net::TcpListener;let app = Router::new().route("/api/tags", get(|| async { "{\"models\":[]}" }));diff --git a/crates/openhuman-core/src/config/migrations/reconcile_orphaned_providers_tests.rs b/crates/openhuman-core/src/config/migrations/reconcile_orphaned_providers_tests.rsindex 6c14a60a36..57fb4b5f84 100644--- a/crates/openhuman-core/src/config/migrations/reconcile_orphaned_providers_tests.rs+++ b/crates/openhuman-core/src/config/migrations/reconcile_orphaned_providers_tests.rs@@ -1,8 +1,8 @@//! Tests for migration 5 → 6 (`reconcile_orphaned_providers`).use super::*;-use crate::config::schema::cloud_providers::CloudProviderCreds;use crate::config::Config;+use crate::config::schema::cloud_providers::CloudProviderCreds;/// Minimal cloud-provider entry for tests — only `id` and `slug` matter here.fn provider(id: &str, slug: &str) -> CloudProviderCreds {diff --git a/crates/openhuman-core/src/config/migrations/retire_configured_agents_tests.rs b/crates/openhuman-core/src/config/migrations/retire_configured_agents_tests.rsindex f91a39d58a..107188a869 100644--- a/crates/openhuman-core/src/config/migrations/retire_configured_agents_tests.rs+++ b/crates/openhuman-core/src/config/migrations/retire_configured_agents_tests.rs@@ -14,7 +14,9 @@ fn removes_only_the_top_level_agents_table_idempotently() {assert_eq!(document, first);assert_eq!(document["default_model"].as_str(), Some("kept"));assert!(document.get("agents").is_none());- assert!(document["memory"]["agents"]["local"]["recall"]- .as_bool()- .unwrap());+ assert!(+ document["memory"]["agents"]["local"]["recall"]+ .as_bool()+ .unwrap()+ );}diff --git a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rsindex 0be60154f1..04e2e216ac 100644--- a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs+++ b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs@@ -39,8 +39,8 @@//! - Migrates `inference_url` into a `Custom` cloud provider entry when the//! URL doesn't look like a registered managed backend.-use crate::config::schema::cloud_providers::{generate_provider_id, AuthStyle, CloudProviderCreds};use crate::config::Config;+use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds, generate_provider_id};/// Counters returned by [`run`] for diagnostics. Logged at INFO once per/// successful migration run.diff --git a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings_tests.rs b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings_tests.rsindex 00b9139539..1637b961e7 100644--- a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings_tests.rs+++ b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings_tests.rs@@ -1,8 +1,8 @@//! Tests for the 1 → 2 AI-provider unification migration.use super::*;-use crate::config::schema::{LocalAiConfig, LocalAiUsage};use crate::config::Config;+use crate::config::schema::{LocalAiConfig, LocalAiUsage};fn make_legacy_config_local_on() -> Config {let mut c = Config::default();diff --git a/crates/openhuman-core/src/config/mod.rs b/crates/openhuman-core/src/config/mod.rsindex c1e87741be..a3fb92922a 100644--- a/crates/openhuman-core/src/config/mod.rs+++ b/crates/openhuman-core/src/config/mod.rs@@ -21,7 +21,7 @@ pub mod workspace_handle;#[allow(unused_imports)]pub use daemon::DaemonConfig;pub use enrichers::{- register_enricher, register_enricher_in, run_enrichers, unregister_enricher, ConfigEnricher,+ ConfigEnricher, register_enricher, register_enricher_in, run_enrichers, unregister_enricher,};/// RPC operations for configuration.@@ -29,11 +29,11 @@ pub use ops as rpc;pub use ops::*;pub use schema::{- action_dir_env_override, active_user_marker_path, active_workspace_dir,- active_workspace_dir_cached, active_workspace_snapshot, clear_active_user, default_action_dir,- default_files_dir, default_projects_dir, default_root_openhuman_dir, pre_login_user_dir,- read_active_user_id, resolve_action_dir, resolve_files_dir, user_openhuman_dir,- write_active_user_id, PRE_LOGIN_USER_ID, WORKLOAD_ROLES,+ PRE_LOGIN_USER_ID, WORKLOAD_ROLES, action_dir_env_override, active_user_marker_path,+ active_workspace_dir, active_workspace_dir_cached, active_workspace_snapshot,+ clear_active_user, default_action_dir, default_files_dir, default_projects_dir,+ default_root_openhuman_dir, pre_login_user_dir, read_active_user_id, resolve_action_dir,+ resolve_files_dir, user_openhuman_dir, write_active_user_id,};pub use workspace_handle::workspace_handle;// Crate-internal: workspace→config-dir resolver reused by the cloud embedder.@@ -41,30 +41,30 @@ pub(crate) use schema::resolve_config_dir_for_workspace;pub(crate) use schema::set_cli_inference_overrides;#[allow(unused_imports)]pub use schema::{- apply_runtime_proxy_to_builder, build_runtime_proxy_client,- build_runtime_proxy_client_with_timeouts, device_time_zone, normalize_time_zone,- output_language_directive, runtime_proxy_config, set_runtime_proxy_config, AgentConfig,- AuditConfig, AutonomyConfig, BrowserComputerUseConfig, BrowserConfig, BudgetAction,- BudgetPeriod, BudgetPolicy, BudgetScope, CapabilityProviderConfig,+ AgentConfig, AuditConfig, AutonomyConfig, BrowserComputerUseConfig, BrowserConfig,+ BudgetAction, BudgetPeriod, BudgetPolicy, BudgetScope, CapabilityProviderConfig,CapabilityProviderTrustState, ChannelsConfig, CompactionSettings, CompactionStrategy,ComposioConfig, ComposioDirectBaseUrls, ComposioHostCredential, ComputerConfig, Config,ContextConfig, CostConfig, CronConfig, CurlConfig, DashboardConfig, DecisionModel,- DelegateAgentConfig, DiagramViewerConfig, DiscordConfig, DockerRuntimeConfig, EmailConfig,- EmbeddingRouteConfig, GitbooksConfig, HttpHeader, HttpRequestConfig, IMessageConfig,- IntegrationToggle, IntegrationsConfig, LarkConfig, LegacySearchInputs, LinqConfig,- LocalAiConfig, LocalJailConfig, MatrixConfig, McpAuthConfig, McpClientConfig,+ DiagramViewerConfig, DiscordConfig, DockerRuntimeConfig, EmailConfig, EmbeddingRouteConfig,+ GitbooksConfig, HttpHeader, HttpRequestConfig, IMessageConfig, IntegrationToggle,+ IntegrationsConfig, LarkConfig, LegacySearchInputs, LinqConfig, LocalAiConfig, LocalJailConfig,+ MANAGED_SEARCH_PROVIDERS, MatrixConfig, McpAuthConfig, McpClientConfig,McpClientIdentityConfig, McpServerConfig, McpToolExposure, MemoryConfig, MemoryLayoutMode,ModelRouteConfig, MultimodalConfig, MultimodalFileConfig, ObservabilityConfig,OrchestratorModelConfig, PresentationMode, PrivacyConfig, PrivacyMode, ProviderRoute,ProxyConfig, ProxyScope, ReliabilityConfig, ResourceLimitsConfig, RuntimeConfig,- SandboxBackend, SandboxConfig, SchedulerConfig, SchedulerGateConfig, SchedulerGateMode,- SearchConfig, SearchEngineCredentials, SearchHostCredential, SearchProviderSettings,- SearxngConfig, SecretsConfig, SecurityConfig, ShellConfig, SlackConfig, StreamMode, SttEngine,+ SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED,+ SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS,+ SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, SEARCH_ROLES, SandboxBackend,+ SandboxConfig, SchedulerConfig, SchedulerGateConfig, SchedulerGateMode, SearchConfig,+ SearchEngineCredentials, SearchHostCredential, SearchProviderSettings, SearxngConfig,+ SecretsConfig, SecurityConfig, ShellConfig, SlackConfig, StreamMode, SttEngine,TeamModelConfig, TelegramConfig, TokenjuiceConfig, UnknownKeyedSearchProvider, UpdateConfig,UpdateRestartStrategy, VoiceServerConfig, WebSearchConfig, WebhookConfig, YuanbaoConfig,- MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA,- SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY,- SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,+ apply_runtime_proxy_to_builder, build_runtime_proxy_client,+ build_runtime_proxy_client_with_timeouts, device_time_zone, normalize_time_zone,+ output_language_directive, runtime_proxy_config, set_runtime_proxy_config,};// Kept as a separate re-export (issue #4117) so the large alphabetized group// above stays byte-identical and rustfmt-stable.diff --git a/crates/openhuman-core/src/config/ops/agent.rs b/crates/openhuman-core/src/config/ops/agent.rsindex c918ccbd11..a120f361e3 100644--- a/crates/openhuman-core/src/config/ops/agent.rs+++ b/crates/openhuman-core/src/config/ops/agent.rs@@ -96,7 +96,7 @@ pub async fn apply_autonomy_settings(other => {return Err(format!("invalid autonomy level '{other}' (expected readonly | supervised | full)"- ))+ ));}};}diff --git a/crates/openhuman-core/src/config/ops/agent_paths.rs b/crates/openhuman-core/src/config/ops/agent_paths.rsindex 8fe894f438..f1f2da4705 100644--- a/crates/openhuman-core/src/config/ops/agent_paths.rs+++ b/crates/openhuman-core/src/config/ops/agent_paths.rs@@ -5,8 +5,8 @@ use std::path::{Path, PathBuf};use serde_json::json;use crate::config::Config;-use crate::core::runtime::DispatchCtx;use crate::core::Outcome;+use crate::core::runtime::DispatchCtx;use super::agent::AgentPathsPatch;diff --git a/crates/openhuman-core/src/config/ops/cloud_providers.rs b/crates/openhuman-core/src/config/ops/cloud_providers.rsindex a5882463d3..8df7c6a1f7 100644--- a/crates/openhuman-core/src/config/ops/cloud_providers.rs+++ b/crates/openhuman-core/src/config/ops/cloud_providers.rs@@ -1,7 +1,7 @@//! RPC input conversion for cloud-provider settings.use crate::config::schema::cloud_providers::{- builtin_cloud_provider, generate_provider_id, is_slug_reserved, AuthStyle, CloudProviderCreds,+ AuthStyle, CloudProviderCreds, builtin_cloud_provider, generate_provider_id, is_slug_reserved,};use serde::Deserialize;diff --git a/crates/openhuman-core/src/config/ops/computer.rs b/crates/openhuman-core/src/config/ops/computer.rsindex 44632aa135..d486da3b69 100644--- a/crates/openhuman-core/src/config/ops/computer.rs+++ b/crates/openhuman-core/src/config/ops/computer.rs@@ -2,8 +2,8 @@//! rescue models the module runs a task with.use crate::config::{ComputerConfig, Config, DecisionModel};-use crate::core::runtime::DispatchCtx;use crate::core::Outcome;+use crate::core::runtime::DispatchCtx;use super::loader::snapshot_config_json;diff --git a/crates/openhuman-core/src/config/ops/loader.rs b/crates/openhuman-core/src/config/ops/loader.rsindex a2a907785f..f4f781c171 100644--- a/crates/openhuman-core/src/config/ops/loader.rs+++ b/crates/openhuman-core/src/config/ops/loader.rs@@ -20,13 +20,13 @@ pub(crate) use reset_local_data::reset_local_data_for_paths;#[cfg(all(test, windows))]pub(crate) use reset_local_data::reset_local_data_remove_error;pub use reset_local_data::{get_data_paths, get_data_paths_for_user, reset_local_data};-pub use runtime_flags::{- agent_server_status, core_rpc_url_from_env, get_runtime_flags, set_browser_allow_all,- RuntimeFlagsOut,-};#[cfg(test)]pub(crate) use runtime_flags::{- env_flag_enabled, BROWSER_ALLOW_ALL_ENV, BROWSER_ALLOW_ALL_RPC_ENABLE_ENV,+ BROWSER_ALLOW_ALL_ENV, BROWSER_ALLOW_ALL_RPC_ENABLE_ENV, env_flag_enabled,+};+pub use runtime_flags::{+ RuntimeFlagsOut, agent_server_status, core_rpc_url_from_env, get_runtime_flags,+ set_browser_allow_all,};pub use snapshot::{client_config_json, get_config_snapshot, get_dashboard_settings,diff --git a/crates/openhuman-core/src/config/ops/loader_current_tests.rs b/crates/openhuman-core/src/config/ops/loader_current_tests.rsindex 3f5fc959f1..bddbea4dc5 100644--- a/crates/openhuman-core/src/config/ops/loader_current_tests.rs+++ b/crates/openhuman-core/src/config/ops/loader_current_tests.rs@@ -1,7 +1,7 @@use super::*;-use crate::config::schema::{EphemeralRoute, EPHEMERAL_ROUTE_SLUG};+use crate::config::schema::{EPHEMERAL_ROUTE_SLUG, EphemeralRoute};use crate::core::runtime::DispatchCtx;-use crate::core::runtime::{context::CoreContext, DomainSet};+use crate::core::runtime::{DomainSet, context::CoreContext};fn context_with(config: Config) -> std::sync::Arc<CoreContext> {CoreContext::for_test_with_config(DomainSet::full(), config)@@ -47,10 +47,12 @@ async fn a_context_without_a_route_loads_unchanged_providers() {.expect("context config loads");assert!(loaded.ephemeral_route.is_none());- assert!(loaded- .cloud_providers- .iter()- .all(|entry| entry.slug != EPHEMERAL_ROUTE_SLUG));+ assert!(+ loaded+ .cloud_providers+ .iter()+ .all(|entry| entry.slug != EPHEMERAL_ROUTE_SLUG)+ );assert_ne!(loaded.chat_provider.as_deref(),Some(format!("{EPHEMERAL_ROUTE_SLUG}:ctx-model").as_str())diff --git a/crates/openhuman-core/src/config/ops/loader_explicit_ctx_tests.rs b/crates/openhuman-core/src/config/ops/loader_explicit_ctx_tests.rsindex 45d2109cb8..970a1c3c88 100644--- a/crates/openhuman-core/src/config/ops/loader_explicit_ctx_tests.rs+++ b/crates/openhuman-core/src/config/ops/loader_explicit_ctx_tests.rs@@ -1,7 +1,7 @@//! `load_config_in` reads the context it is handed, not the one the task has.use super::*;-use crate::core::runtime::{context::CoreContext, DispatchCtx, DomainSet};+use crate::core::runtime::{DispatchCtx, DomainSet, context::CoreContext};use std::sync::Arc;fn tenant(model: &str) -> Arc<CoreContext> {diff --git a/crates/openhuman-core/src/config/ops/mod.rs b/crates/openhuman-core/src/config/ops/mod.rsindex b871707d06..42e3b32bd4 100644--- a/crates/openhuman-core/src/config/ops/mod.rs+++ b/crates/openhuman-core/src/config/ops/mod.rs@@ -71,9 +71,9 @@ pub(crate) fn config_save_conflict(// ── Public re-exports (preserving the flat external API) ─────────────────────pub use agent::{- add_auto_approve_tool, apply_agent_settings, apply_autonomy_settings, get_agent_settings,- get_autonomy_settings, load_and_apply_agent_settings, load_and_apply_autonomy_settings,- AgentPathsPatch, AgentSettingsPatch, AutonomySettingsPatch,+ AgentPathsPatch, AgentSettingsPatch, AutonomySettingsPatch, add_auto_approve_tool,+ apply_agent_settings, apply_autonomy_settings, get_agent_settings, get_autonomy_settings,+ load_and_apply_agent_settings, load_and_apply_autonomy_settings,};pub use agent_paths::{apply_agent_paths_settings, ensure_agent_dirs, ensure_usable_cwd, expand_tilde,@@ -81,12 +81,12 @@ pub use agent_paths::{};pub use loader::{- agent_server_status, client_config_json, core_rpc_url_from_env, get_config_snapshot,- get_dashboard_settings, get_data_paths, get_data_paths_for_user, get_runtime_flags,- load_and_get_client_config_snapshot, load_and_get_config_snapshot,+ RuntimeFlagsOut, agent_server_status, client_config_json, core_rpc_url_from_env,+ get_config_snapshot, get_dashboard_settings, get_data_paths, get_data_paths_for_user,+ get_runtime_flags, load_and_get_client_config_snapshot, load_and_get_config_snapshot,load_config_for_workspace_with_timeout, load_config_in, load_config_with_timeout,load_current_or_init, reload_config_from_paths, reload_config_snapshot_with_timeout,- reset_local_data, set_browser_allow_all, snapshot_config_json, RuntimeFlagsOut,+ reset_local_data, set_browser_allow_all, snapshot_config_json,};// expose internal helpers needed by tests (ops_tests.rs uses super::*)#[cfg(test)]@@ -97,9 +97,9 @@ pub(crate) use loader::normalize_loaded_config;pub(crate) use loader::reset_local_data_remove_error;#[cfg(test)]pub(crate) use loader::{- active_workspace_marker_path, config_openhuman_dir, default_openhuman_dir, env_flag_enabled,- fallback_workspace_dir, reset_local_data_for_paths, BROWSER_ALLOW_ALL_ENV,- BROWSER_ALLOW_ALL_RPC_ENABLE_ENV,+ BROWSER_ALLOW_ALL_ENV, BROWSER_ALLOW_ALL_RPC_ENABLE_ENV, active_workspace_marker_path,+ config_openhuman_dir, default_openhuman_dir, env_flag_enabled, fallback_workspace_dir,+ reset_local_data_for_paths,};#[cfg(test)]pub(crate) use model::resolve_backend_api_url;@@ -107,42 +107,41 @@ pub(crate) use model::resolve_backend_api_url;pub(crate) use std::path::PathBuf;pub use model::{- apply_composio_trigger_settings, apply_local_ai_settings, apply_memory_settings,- apply_model_settings, apply_runtime_settings, collect_provider_ca_certs,+ ComposioTriggerSettingsPatch, LocalAiSettingsPatch, MemorySettingsPatch, ModelSettingsPatch,+ RuntimeSettingsPatch, apply_composio_trigger_settings, apply_local_ai_settings,+ apply_memory_settings, apply_model_settings, apply_runtime_settings, collect_provider_ca_certs,get_composio_trigger_settings, load_and_apply_composio_trigger_settings,load_and_apply_local_ai_settings, load_and_apply_memory_settings,load_and_apply_model_settings, load_and_apply_runtime_settings, load_and_resolve_api_url,- ComposioTriggerSettingsPatch, LocalAiSettingsPatch, MemorySettingsPatch, ModelSettingsPatch,- RuntimeSettingsPatch,};-pub use cloud_providers::{build_cloud_provider_creds, CloudProviderUpdate};+pub use cloud_providers::{CloudProviderUpdate, build_cloud_provider_creds};pub(crate) use primary_cloud::{legacy_inference_slug, resolve_primary_cloud_provider_string};pub use privacy::{- apply_privacy_settings, get_privacy_mode, load_and_apply_privacy_settings, PrivacySettingsPatch,+ PrivacySettingsPatch, apply_privacy_settings, get_privacy_mode, load_and_apply_privacy_settings,};mod computer;pub use computer::{- apply_computer_settings, load_and_apply_computer_settings, ComputerSettingsPatch,+ ComputerSettingsPatch, apply_computer_settings, load_and_apply_computer_settings,};pub use sandbox::{- apply_sandbox_settings, get_sandbox_settings, load_and_apply_sandbox_settings,- SandboxSettingsPatch,+ SandboxSettingsPatch, apply_sandbox_settings, get_sandbox_settings,+ load_and_apply_sandbox_settings,};pub use search::{- apply_search_settings, get_search_settings, load_and_apply_search_settings,- search_settings_json, SearchProviderPatch, SearchSettingsPatch,+ SearchProviderPatch, SearchSettingsPatch, apply_search_settings, get_search_settings,+ load_and_apply_search_settings, search_settings_json,};pub use ui::{- apply_analytics_settings, apply_browser_settings, apply_user_timezone,- get_onboarding_completed, load_and_apply_analytics_settings, load_and_apply_browser_settings,- load_and_apply_user_timezone, set_onboarding_completed, user_timezone_json,- workspace_onboarding_flag_exists, workspace_onboarding_flag_resolve,- workspace_onboarding_flag_set, AnalyticsSettingsPatch, BrowserSettingsPatch,+ AnalyticsSettingsPatch, BrowserSettingsPatch, apply_analytics_settings, apply_browser_settings,+ apply_user_timezone, get_onboarding_completed, load_and_apply_analytics_settings,+ load_and_apply_browser_settings, load_and_apply_user_timezone, set_onboarding_completed,+ user_timezone_json, workspace_onboarding_flag_exists, workspace_onboarding_flag_resolve,+ workspace_onboarding_flag_set,};#[cfg(test)]diff --git a/crates/openhuman-core/src/config/ops/model.rs b/crates/openhuman-core/src/config/ops/model.rsindex 92389ed376..52e00aac65 100644--- a/crates/openhuman-core/src/config/ops/model.rs+++ b/crates/openhuman-core/src/config/ops/model.rs@@ -1,8 +1,8 @@//! Model/provider config operations: AI providers, memory, runtime, local AI, Composio.use crate::config::Config;-use crate::core::runtime::DispatchCtx;use crate::core::Outcome;+use crate::core::runtime::DispatchCtx;use super::loader::snapshot_config_json;diff --git a/crates/openhuman-core/src/config/ops/model_byok_tests.rs b/crates/openhuman-core/src/config/ops/model_byok_tests.rsindex 4b20383637..f3d35c7481 100644--- a/crates/openhuman-core/src/config/ops/model_byok_tests.rs+++ b/crates/openhuman-core/src/config/ops/model_byok_tests.rs@@ -17,8 +17,8 @@ fn provider_ca_updates_validate_bundles_and_normalize_slugs() {let certs = collect_provider_ca_certs([(" team ", Some(""))]).unwrap();assert_eq!(certs.get("team").map(String::as_str), Some(""));}-use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};use crate::config::Config;+use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};fn config_with(inference_url: Option<&str>, api_key: Option<&str>, model: Option<&str>) -> Config {let mut config = Config::default();diff --git a/crates/openhuman-core/src/config/ops/primary_cloud.rs b/crates/openhuman-core/src/config/ops/primary_cloud.rsindex 348aef6cef..44a52b854a 100644--- a/crates/openhuman-core/src/config/ops/primary_cloud.rs+++ b/crates/openhuman-core/src/config/ops/primary_cloud.rs@@ -1,7 +1,7 @@//! Primary cloud-provider selection and legacy direct-inference compatibility.-use crate::config::schema::cloud_providers::CloudProviderCreds;use crate::config::Config;+use crate::config::schema::cloud_providers::CloudProviderCreds;use crate::inference::provider::factory::{BYOK_INCOMPLETE_SENTINEL, PROVIDER_OPENHUMAN};/// Keep endpoint paths out of config diagnostics while using TinyInference'sdiff --git a/crates/openhuman-core/src/config/ops/privacy.rs b/crates/openhuman-core/src/config/ops/privacy.rsindex daeab025da..2a50e5d668 100644--- a/crates/openhuman-core/src/config/ops/privacy.rs+++ b/crates/openhuman-core/src/config/ops/privacy.rs@@ -6,8 +6,8 @@//! immediately, without a core restart.use crate::config::{Config, PrivacyMode};-use crate::core::runtime::DispatchCtx;use crate::core::Outcome;+use crate::core::runtime::DispatchCtx;/// Partial update for the `[privacy]` block. `None` leaves the mode unchanged.#[derive(Debug, Clone, Default)]diff --git a/crates/openhuman-core/src/config/ops/sandbox.rs b/crates/openhuman-core/src/config/ops/sandbox.rsindex 2d908ab084..d867058624 100644--- a/crates/openhuman-core/src/config/ops/sandbox.rs+++ b/crates/openhuman-core/src/config/ops/sandbox.rs@@ -1,8 +1,8 @@//! Sandbox / Docker runtime config operations.use crate::config::Config;-use crate::core::runtime::DispatchCtx;use crate::core::Outcome;+use crate::core::runtime::DispatchCtx;use super::loader::snapshot_config_json;diff --git a/crates/openhuman-core/src/config/ops/search.rs b/crates/openhuman-core/src/config/ops/search.rsindex b971a43ada..24acc740e1 100644--- a/crates/openhuman-core/src/config/ops/search.rs+++ b/crates/openhuman-core/src/config/ops/search.rs@@ -9,14 +9,14 @@ use crate::core::runtime::DispatchCtx;use std::collections::BTreeMap;use serde::Deserialize;-use serde_json::{json, Value};+use serde_json::{Value, json};use crate::config::{- Config, PresentationMode, ProviderRoute, MANAGED_SEARCH_PROVIDERS, SEARCH_PROVIDERS,+ Config, MANAGED_SEARCH_PROVIDERS, PresentationMode, ProviderRoute, SEARCH_PROVIDERS,};use crate::core::Outcome;use crate::search::providers;-use tinysearch_bus::{parse_role, role_key, ROLES};+use tinysearch_bus::{ROLES, parse_role, role_key};/// Partial update of one provider.#[derive(Debug, Clone, Default, Deserialize)]diff --git a/crates/openhuman-core/src/config/ops/search_tests.rs b/crates/openhuman-core/src/config/ops/search_tests.rsindex d7561a5079..452c0eea32 100644--- a/crates/openhuman-core/src/config/ops/search_tests.rs+++ b/crates/openhuman-core/src/config/ops/search_tests.rs@@ -64,23 +64,27 @@ fn routes_a_provider_cannot_take_are_rejected() {).unwrap_err();assert!(err.contains("does not support the managed route"), "{err}");- assert!(apply_search_patch(- &mut config,- patch(json!({"providers": {"bing": {"enabled": true}}}))- )- .unwrap_err()- .contains("unknown search provider"));+ assert!(+ apply_search_patch(+ &mut config,+ patch(json!({"providers": {"bing": {"enabled": true}}}))+ )+ .unwrap_err()+ .contains("unknown search provider")+ );let err = apply_search_patch(&mut config,patch(json!({"providers": {"parallel": {"route": "managed"}}})),).unwrap_err();assert!(err.contains("does not support the managed route"), "{err}");- assert!(apply_search_patch(- &mut config,- patch(json!({"providers": {"searxng": {"api_key": "x"}}}))- )- .is_err());+ assert!(+ apply_search_patch(+ &mut config,+ patch(json!({"providers": {"searxng": {"api_key": "x"}}}))+ )+ .is_err()+ );}#[test]@@ -150,11 +154,13 @@ fn seltz_and_searxng_patches_update_their_sections() {assert_eq!(config.seltz.api_key.as_deref(), Some("s"));assert!(config.searxng.enabled);assert_eq!(config.searxng.base_url, "https://sx.example");- assert!(apply_search_patch(- &mut config,- patch(json!({"providers": {"searxng": {"base_url": "ftp://x"}}}))- )- .is_err());+ assert!(+ apply_search_patch(+ &mut config,+ patch(json!({"providers": {"searxng": {"base_url": "ftp://x"}}}))+ )+ .is_err()+ );}#[test]@@ -179,11 +185,13 @@ fn settings_view_reports_status_roles_and_never_keys() {assert_eq!(view["effective_roles"]["answer"], json!(["gemini", "exa"]));assert_eq!(view["effective_roles"]["search"], json!(["exa", "gemini"]));assert!(!view.to_string().contains("secret-gemini"));- assert!(view["providers"]- .as_array()- .unwrap()- .iter()- .all(|p| p["id"] != "gemini_deep_research"));+ assert!(+ view["providers"]+ .as_array()+ .unwrap()+ .iter()+ .all(|p| p["id"] != "gemini_deep_research")+ );let signed_out = search_settings_json_with(&config, false);assert_eq!(provider(&signed_out, "exa")["status"], "sign_in_required");@@ -215,12 +223,16 @@ fn settings_report_the_search_component_as_disabled() {let off = search_settings_json_with(&config, true);assert_eq!(off["enabled"], false);assert_eq!(off["component_disabled"], true);- assert!(off["component_disabled_reason"]- .as_str()- .unwrap()- .starts_with("COMPONENT_DISABLED:search"));- assert!(off["effective_roles"]["search"]- .as_array()- .unwrap()- .is_empty());+ assert!(+ off["component_disabled_reason"]+ .as_str()+ .unwrap()+ .starts_with("COMPONENT_DISABLED:search")+ );+ assert!(+ off["effective_roles"]["search"]+ .as_array()+ .unwrap()+ .is_empty()+ );}diff --git a/crates/openhuman-core/src/config/ops_loader_and_search_tests.rs b/crates/openhuman-core/src/config/ops_loader_and_search_tests.rsindex 8ae686eee1..ba7e2f050d 100644--- a/crates/openhuman-core/src/config/ops_loader_and_search_tests.rs+++ b/crates/openhuman-core/src/config/ops_loader_and_search_tests.rs@@ -30,11 +30,13 @@ async fn reset_local_data_removes_active_user_and_markers_only() {assert!(!user_marker.exists());// … but the shared root itself survives.assert!(default_openhuman_dir.exists());- assert!(outcome- .value- .get("removed_paths")- .and_then(|value| value.as_array())- .is_some_and(|paths| !paths.is_empty()));+ assert!(+ outcome+ .value+ .get("removed_paths")+ .and_then(|value| value.as_array())+ .is_some_and(|paths| !paths.is_empty())+ );}#[tokio::test]@@ -79,11 +81,13 @@ async fn reset_local_data_tolerates_absent_paths() {.unwrap();assert!(default_openhuman_dir.exists());- assert!(outcome- .value- .get("removed_paths")- .and_then(|value| value.as_array())- .is_some_and(|paths| paths.is_empty()));+ assert!(+ outcome+ .value+ .get("removed_paths")+ .and_then(|value| value.as_array())+ .is_some_and(|paths| paths.is_empty())+ );}#[test]@@ -137,10 +141,11 @@ fn core_rpc_url_from_env_uses_override_when_set() {fn fallback_workspace_dir_ends_in_workspace_under_openhuman() {let p = fallback_workspace_dir();assert!(p.ends_with("workspace"));- assert!(p- .parent()- .map(|d| d.ends_with(".openhuman"))- .unwrap_or(false));+ assert!(+ p.parent()+ .map(|d| d.ends_with(".openhuman"))+ .unwrap_or(false)+ );}#[test]@@ -558,11 +563,13 @@ async fn apply_search_settings_stores_and_clears_tavily_key() {.await.expect("clear Tavily key");assert!(cfg.search.tavily.api_key.is_none());- assert!(!result.value["effective_roles"]["search"]- .as_array()- .unwrap()- .iter()- .any(|p| p == "tavily"));+ assert!(+ !result.value["effective_roles"]["search"]+ .as_array()+ .unwrap()+ .iter()+ .any(|p| p == "tavily")+ );}#[tokio::test]diff --git a/crates/openhuman-core/src/config/ops_model_and_local_ai_tests.rs b/crates/openhuman-core/src/config/ops_model_and_local_ai_tests.rsindex edd70e5e24..7cadbd91b4 100644--- a/crates/openhuman-core/src/config/ops_model_and_local_ai_tests.rs+++ b/crates/openhuman-core/src/config/ops_model_and_local_ai_tests.rs@@ -118,10 +118,11 @@ async fn apply_model_settings_replaces_model_registry_when_some_and_keeps_when_n};let _ = apply_model_settings(&mut cfg, set).await.expect("set");assert_eq!(cfg.model_registry.len(), 1);- assert!(cfg- .model_registry- .iter()- .any(|e| e.id == "my-llava" && e.vision));+ assert!(+ cfg.model_registry+ .iter()+ .any(|e| e.id == "my-llava" && e.vision)+ );// None — leave registry alone.let _ = apply_model_settings(@@ -346,10 +347,12 @@ async fn apply_autonomy_settings_updates_action_budget() {outcome.value["config"]["autonomy"]["max_actions_per_hour"],serde_json::json!(64));- assert!(outcome- .logs- .iter()- .any(|l| l.contains("autonomy settings saved to")));+ assert!(+ outcome+ .logs+ .iter()+ .any(|l| l.contains("autonomy settings saved to"))+ );}#[tokio::test]diff --git a/crates/openhuman-core/src/config/ops_voice_and_autonomy_tests.rs b/crates/openhuman-core/src/config/ops_voice_and_autonomy_tests.rsindex 0c04bdc708..6494a4aaa8 100644--- a/crates/openhuman-core/src/config/ops_voice_and_autonomy_tests.rs+++ b/crates/openhuman-core/src/config/ops_voice_and_autonomy_tests.rs@@ -7,10 +7,12 @@ async fn get_config_snapshot_wraps_snapshot_in_rpc_outcome() {let cfg = tmp_config(&tmp);let outcome = get_config_snapshot(&cfg).await.expect("snapshot");assert!(outcome.value.get("config").is_some());- assert!(outcome- .logs- .iter()- .any(|l| l.contains("config loaded from")));+ assert!(+ outcome+ .logs+ .iter()+ .any(|l| l.contains("config loaded from"))+ );}#[tokio::test]@@ -460,10 +462,12 @@ async fn apply_agent_settings_updates_timeout_and_persists_snapshot() {outcome.value["config"]["agent"]["agent_timeout_secs"],serde_json::json!(300));- assert!(outcome- .logs- .iter()- .any(|l| l.contains("agent settings saved to")));+ assert!(+ outcome+ .logs+ .iter()+ .any(|l| l.contains("agent settings saved to"))+ );// With no env override, the live runtime now reflects the saved value.assert_eq!(crate::tools::timeout::tool_execution_timeout_secs(), 300);}diff --git a/crates/openhuman-core/src/config/schema/cloud_providers.rs b/crates/openhuman-core/src/config/schema/cloud_providers.rsindex ecab991081..c769e7fbf8 100644--- a/crates/openhuman-core/src/config/schema/cloud_providers.rs+++ b/crates/openhuman-core/src/config/schema/cloud_providers.rs@@ -15,8 +15,8 @@ use std::sync::Arc;use crate::core::slots::HookSlot;use tinyinference_providers::builtin::{- BuiltinAuthStyle, BuiltinCloudProvider as UpstreamBuiltinCloudProvider, BuiltinPresets,- BUILTIN_CLOUD_PROVIDERS as UPSTREAM_BUILTINS,+ BUILTIN_CLOUD_PROVIDERS as UPSTREAM_BUILTINS, BuiltinAuthStyle,+ BuiltinCloudProvider as UpstreamBuiltinCloudProvider, BuiltinPresets,};static HOSTED_PRESETS: HookSlot<BuiltinCloudProvider> =diff --git a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rsindex 346b4a7603..cb825a94f6 100644--- a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs+++ b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs@@ -1,6 +1,6 @@//! Tests for the surrounding module.-use super::{builtin_cloud_providers, builtin_presets, is_slug_reserved, AuthStyle};+use super::{AuthStyle, builtin_cloud_providers, builtin_presets, is_slug_reserved};use tinyinference_providers::builtin::endpoint_host;#[test]@@ -186,8 +186,10 @@ fn hosted_presets_and_classification_are_context_scoped() {"host additions must not replace a generic provider");assert!(super::builtin_presets().host_is_builtin_cloud_provider("tenant.example"));- assert!(super::builtin_presets()- .endpoint_host_is_chat_completions_only("https://tenant.example/v1"));+ assert!(+ super::builtin_presets()+ .endpoint_host_is_chat_completions_only("https://tenant.example/v1")+ );assert!(super::builtin_cloud_provider("tenant-hosted").is_some());assert!(super::is_hosted_cloud_identity("tenant-hosted"));assert!(!super::is_hosted_auth_style(AuthStyle::Bearer));@@ -283,8 +285,10 @@ fn host_is_builtin_cloud_provider_recognises_inference_hosts() {/// the slug is not builtin.#[test]fn nvidia_host_is_chat_completions_only_regardless_of_slug() {- assert!(builtin_presets()- .endpoint_host_is_chat_completions_only("https://integrate.api.nvidia.com/v1"));+ assert!(+ builtin_presets()+ .endpoint_host_is_chat_completions_only("https://integrate.api.nvidia.com/v1")+ );// Other chat-only built-in hosts too.for endpoint in ["https://api.deepseek.com/v1",@@ -359,9 +363,11 @@ fn generated_provider_ids_sanitize_and_bound_the_slug_prefix() {assert!(id.starts_with("p_provider_with_spaces_"));let suffix = id.rsplit('_').next().expect("suffix");assert_eq!(suffix.len(), 5);- assert!(suffix- .chars()- .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit()));+ assert!(+ suffix+ .chars()+ .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit())+ );}#[test]diff --git a/crates/openhuman-core/src/config/schema/context.rs b/crates/openhuman-core/src/config/schema/context.rsindex 8e720c0ad2..390e7694ef 100644--- a/crates/openhuman-core/src/config/schema/context.rs+++ b/crates/openhuman-core/src/config/schema/context.rs@@ -5,3 +5,31 @@//! serialization contract live with TinyAgents.pub use tinyagents_harness::config::{CompactionSettings, CompactionStrategy, ContextConfig};++/// JSON-schema view of TinyAgents' serialized context settings.+///+/// The harness type deliberately stays independent from `schemars`; this+/// mirror keeps OpenHuman's generated config schema complete without adding a+/// documentation dependency to the owning crate.+#[derive(schemars::JsonSchema)]+pub(crate) struct ContextConfigSchema {+ enabled: bool,+ microcompact_enabled: bool,+ autocompact_enabled: bool,+ microcompact_keep_recent: usize,+ tool_result_budget_bytes: usize,+ summarizer_payload_threshold_tokens: usize,+ summarizer_max_payload_tokens: usize,+ summarizer_model: Option<String>,+ prefer_markdown_tool_output: bool,+ compaction_enabled: bool,+ compaction_trigger_tokens: Option<u64>,+ compaction_strategy: CompactionStrategySchema,+}++#[derive(schemars::JsonSchema)]+#[schemars(rename_all = "snake_case")]+enum CompactionStrategySchema {+ TaskState,+ Summary,+}diff --git a/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs b/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rsindex 2ebeb3b88e..9f405c2fe0 100644--- a/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs+++ b/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs@@ -220,10 +220,12 @@ fn apply_without_a_model_changes_nothing() {apply(&mut config, route());assert!(config.ephemeral_route.is_none());assert!(config.chat_provider.is_none());- assert!(config- .cloud_providers- .iter()- .all(|entry| entry.slug != EPHEMERAL_ROUTE_SLUG));+ assert!(+ config+ .cloud_providers+ .iter()+ .all(|entry| entry.slug != EPHEMERAL_ROUTE_SLUG)+ );}#[test]diff --git a/crates/openhuman-core/src/config/schema/inbound_sources_tests.rs b/crates/openhuman-core/src/config/schema/inbound_sources_tests.rsindex a39fc31da2..5acc6f4f3a 100644--- a/crates/openhuman-core/src/config/schema/inbound_sources_tests.rs+++ b/crates/openhuman-core/src/config/schema/inbound_sources_tests.rs@@ -82,10 +82,12 @@ fn an_unusable_source_is_refused_and_left_out() {);assert!(inbound.source("x:dms").unwrap_err().contains("agent_id"));assert!(inbound.source("x:zero").unwrap_err().contains("max_batch"));- assert!(inbound- .source("composio:gmail")- .unwrap_err()- .contains("reserved"));+ assert!(+ inbound+ .source("composio:gmail")+ .unwrap_err()+ .contains("reserved")+ );let usable: Vec<&str> = inbound.usable_sources().map(|(name, _)| name).collect();assert_eq!(usable, ["x:mentions"]);assert!(inbound.is_pinned("x:mentions"));diff --git a/crates/openhuman-core/src/config/schema/load/branches.rs b/crates/openhuman-core/src/config/schema/load/branches.rsindex 9019c5e7c2..825fb5ea0d 100644--- a/crates/openhuman-core/src/config/schema/load/branches.rs+++ b/crates/openhuman-core/src/config/schema/load/branches.rs@@ -5,7 +5,7 @@//! made its poll frame ~440 KB on top of the agent tower (#6379).use super::super::Config;-use super::dirs::{default_action_dir, resolve_action_dir, ConfigResolutionSource};+use super::dirs::{ConfigResolutionSource, default_action_dir, resolve_action_dir};use super::env::EnvLookup;use super::impl_load::migration_source;use super::migrate::{diff --git a/crates/openhuman-core/src/config/schema/load/context_overlay.rs b/crates/openhuman-core/src/config/schema/load/context_overlay.rsindex 61042f92e5..ed99ff31a0 100644--- a/crates/openhuman-core/src/config/schema/load/context_overlay.rs+++ b/crates/openhuman-core/src/config/schema/load/context_overlay.rs@@ -1,10 +1,10 @@//! Per-context config overrides reapplied after a fresh persisted reload.+use crate::config::Config;use crate::config::schema::{AppliedInferenceOverride, ComposioHostCredential, EphemeralRoute, ResolvedEndpoints,SearchHostCredential,};-use crate::config::Config;use crate::profiles::provider_settings::ProfileProviderSettings;use serde_json::Value;use std::collections::{BTreeMap, BTreeSet};diff --git a/crates/openhuman-core/src/config/schema/load/diagnostics_tests.rs b/crates/openhuman-core/src/config/schema/load/diagnostics_tests.rsindex ca483c7ee6..35a58dfe36 100644--- a/crates/openhuman-core/src/config/schema/load/diagnostics_tests.rs+++ b/crates/openhuman-core/src/config/schema/load/diagnostics_tests.rs@@ -78,11 +78,13 @@ async fn loader_records_legacy_inference_url_migration() {.await.unwrap();- assert!(config- .load_diagnostics()- .migrated_keys- .iter()- .any(|key| key == "api_url"));+ assert!(+ config+ .load_diagnostics()+ .migrated_keys+ .iter()+ .any(|key| key == "api_url")+ );assert_eq!(config.inference_url.as_deref(),Some("https://example.test/v1/chat/completions")@@ -97,8 +99,10 @@ fn default_config_has_empty_load_diagnostics() {assert!(config.load_diagnostics().parse_error.is_none());assert_eq!(config.load_diagnostics().fallback, ConfigLoadFallback::None);assert!(config.load_diagnostics().migrated_keys.is_empty());- assert!(serde_json::to_value(&config)- .unwrap()- .get("load_diagnostics")- .is_none());+ assert!(+ serde_json::to_value(&config)+ .unwrap()+ .get("load_diagnostics")+ .is_none()+ );}diff --git a/crates/openhuman-core/src/config/schema/load/dirs.rs b/crates/openhuman-core/src/config/schema/load/dirs.rsindex c95b98ffd8..74b4322ce2 100644--- a/crates/openhuman-core/src/config/schema/load/dirs.rs+++ b/crates/openhuman-core/src/config/schema/load/dirs.rs@@ -6,8 +6,9 @@ use std::path::{Path, PathBuf};use tokio::fs;pub use load_user_state::{- active_user_marker_path, clear_active_user, pre_login_user_dir, read_active_user_id,- read_active_user_id_checked_async, user_openhuman_dir, write_active_user_id, PRE_LOGIN_USER_ID,+ PRE_LOGIN_USER_ID, active_user_marker_path, clear_active_user, pre_login_user_dir,+ read_active_user_id, read_active_user_id_checked_async, user_openhuman_dir,+ write_active_user_id,};// Sync variant is consumed only by the `read_active_user_id` wrapper (in// load_user_state) and the load_tests module; the async resolver below usesdiff --git a/crates/openhuman-core/src/config/schema/load/env_overlay.rs b/crates/openhuman-core/src/config/schema/load/env_overlay.rsindex edcfca9e54..ee937d060b 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay.rs@@ -14,8 +14,8 @@ mod runtime;mod search;mod update;-use super::super::proxy::{set_runtime_proxy_config, ProxyScope};use super::super::Config;+use super::super::proxy::{ProxyScope, set_runtime_proxy_config};use std::path::PathBuf;/// Classification of an `OPENHUMAN_SHELL_HIDE_WINDOW` env value. Split out fromdiff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/components.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/components.rsindex 357872e65f..09f5adcf2f 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/components.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/components.rs@@ -1,8 +1,8 @@//! Env overrides for `[components]`: `OPENHUMAN_COMPONENT_<NAME>=0|1`.+use crate::config::schema::Config;use crate::config::schema::components::COMPONENT_NAMES;use crate::config::schema::load::env::EnvLookup;-use crate::config::schema::Config;/// Parse a `0|1|true|false|on|off|yes|no` flag; `None` for anything else.pub(crate) fn parse_flag(raw: &str) -> Option<bool> {diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/context.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/context.rsindex 1c9e366a1f..062815d639 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/context.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/context.rs@@ -1,7 +1,7 @@//! Env overrides for the context-management budget.-use crate::config::schema::load::env::EnvLookup;use crate::config::schema::Config;+use crate::config::schema::load::env::EnvLookup;impl Config {pub(super) fn apply_context_env<E: EnvLookup + ?Sized>(&mut self, env: &E) {diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/embeddings.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/embeddings.rsindex 9cd6566bdc..310a1130a4 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/embeddings.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/embeddings.rs@@ -1,7 +1,7 @@//! Env overrides for the embedding settings kept under `[memory]`.-use crate::config::schema::load::env::EnvLookup;use crate::config::schema::Config;+use crate::config::schema::load::env::EnvLookup;impl Config {/// `OPENHUMAN_MEMORY_EMBED_RATE_LIMIT` — embedding requests per minute.diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/inbound_debounce.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/inbound_debounce.rsindex d07b92af3b..babfa0c21b 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/inbound_debounce.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/inbound_debounce.rs@@ -1,8 +1,8 @@//! Env overrides for inbound message batching (`[inbound_debounce]`).-use crate::config::schema::load::env::parse_env_bool;-use crate::config::schema::load::env::EnvLookup;use crate::config::schema::Config;+use crate::config::schema::load::env::EnvLookup;+use crate::config::schema::load::env::parse_env_bool;fn parse_ms(name: &str, raw: &str) -> Option<u64> {let trimmed = raw.trim();diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/modules.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/modules.rsindex 34e9ed0906..a7f116e400 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/modules.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/modules.rs@@ -6,7 +6,7 @@use crate::config::schema::load::env::EnvLookup;use crate::config::schema::{- module_source_env_for, Config, ModuleOverride, ModuleSourceMode, MODULE_SOURCE_ENV,+ Config, MODULE_SOURCE_ENV, ModuleOverride, ModuleSourceMode, module_source_env_for,};impl Config {diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/observability.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/observability.rsindex 5f45f0907c..b32dfffc24 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/observability.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/observability.rs@@ -1,7 +1,7 @@//! Env overrides for Sentry, analytics, and agent-tracing content capture.-use crate::config::schema::load::env::EnvLookup;use crate::config::schema::Config;+use crate::config::schema::load::env::EnvLookup;impl Config {pub(super) fn apply_observability_env<E: EnvLookup + ?Sized>(&mut self, env: &E) {diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/proxy.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/proxy.rsindex 33e01a846e..cb35a5e31d 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/proxy.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/proxy.rs@@ -1,11 +1,11 @@//! Env overrides for the outbound proxy configuration.+use crate::config::schema::Config;use crate::config::schema::load::env::EnvLookup;use crate::config::schema::proxy::{normalize_no_proxy_list, normalize_proxy_url_option, normalize_service_list,parse_proxy_enabled, parse_proxy_scope,};-use crate::config::schema::Config;impl Config {pub(super) fn apply_proxy_env<E: EnvLookup + ?Sized>(&mut self, env: &E) {diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/runtime.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/runtime.rsindex b1b74d1b84..e2a26f890f 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/runtime.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/runtime.rs@@ -1,8 +1,8 @@//! Environment overrides for token compression and related settings.-use crate::config::schema::load::env::parse_env_bool;-use crate::config::schema::load::env::EnvLookup;use crate::config::schema::Config;+use crate::config::schema::load::env::EnvLookup;+use crate::config::schema::load::env::parse_env_bool;impl Config {pub(super) fn apply_runtime_env<E: EnvLookup + ?Sized>(&mut self, env: &E) {diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/search.rsindex a7b7cc9ce0..13b9e2c67b 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs@@ -1,11 +1,11 @@//! Env overrides for web search: provider set, routes, roles, keys, and the//! Seltz/SearXNG options.-use crate::config::schema::load::env::parse_env_bool;use crate::config::schema::load::env::EnvLookup;+use crate::config::schema::load::env::parse_env_bool;use crate::config::schema::{- Config, PresentationMode, ProviderRoute, SearchProviderSettings, MANAGED_SEARCH_PROVIDERS,- SEARCH_PROVIDERS, SEARCH_ROLES,+ Config, MANAGED_SEARCH_PROVIDERS, PresentationMode, ProviderRoute, SEARCH_PROVIDERS,+ SEARCH_ROLES, SearchProviderSettings,};impl Config {diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/update.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/update.rsindex 32dd21d309..72f5b7de9e 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/update.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/update.rs@@ -1,9 +1,9 @@//! Env overrides for the auto-updater (`[update]`).-use crate::config::schema::load::env::parse_env_bool;-use crate::config::schema::load::env::EnvLookup;use crate::config::schema::Config;use crate::config::schema::UpdateRestartStrategy;+use crate::config::schema::load::env::EnvLookup;+use crate::config::schema::load::env::parse_env_bool;impl Config {pub(super) fn apply_update_env<E: EnvLookup + ?Sized>(&mut self, env: &E) {diff --git a/crates/openhuman-core/src/config/schema/load/impl_load.rs b/crates/openhuman-core/src/config/schema/load/impl_load.rsindex 83a1cf0215..9faffa9c69 100644--- a/crates/openhuman-core/src/config/schema/load/impl_load.rs+++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs@@ -2,8 +2,8 @@ use super::super::Config;use super::branches::pre_login_config_boxed;use super::context_refresh::is_document_conflict;use super::dirs::{- default_action_dir, default_config_and_workspace_dirs, resolve_action_dir,- resolve_config_dirs_ignoring_env, resolve_runtime_config_dirs_with, ConfigResolutionSource,+ ConfigResolutionSource, default_action_dir, default_config_and_workspace_dirs,+ resolve_action_dir, resolve_config_dirs_ignoring_env, resolve_runtime_config_dirs_with,};use super::env::{EnvLookup, NoEnv, ProcessEnv, ProcessEnvWithoutWorkspace};use super::migrate::{@@ -17,8 +17,8 @@ use std::path::Path;use std::sync::{Mutex, OnceLock};use tokio::fs;-pub(crate) use super::config_file_read::parse_config_with_recovery;pub(crate) use super::config_file_read::CONFIG_OWNER_MISMATCH_MARKER;+pub(crate) use super::config_file_read::parse_config_with_recovery;pub(super) use super::config_file_read::{describe_config_ownership, migration_source, parse_config_boxed, parse_toml_off_worker,};diff --git a/crates/openhuman-core/src/config/schema/load/mod.rs b/crates/openhuman-core/src/config/schema/load/mod.rsindex 526354d91f..cdd8aabf67 100644--- a/crates/openhuman-core/src/config/schema/load/mod.rs+++ b/crates/openhuman-core/src/config/schema/load/mod.rs@@ -27,11 +27,10 @@ mod diagnostics_tests;pub use active_workspace::active_workspace_dir_cached;pub(crate) use active_workspace::invalidate_active_workspace;pub use dirs::{- action_dir_env_override, active_user_marker_path, active_workspace_dir,+ PRE_LOGIN_USER_ID, action_dir_env_override, active_user_marker_path, active_workspace_dir,active_workspace_snapshot, clear_active_user, default_action_dir, default_files_dir,default_projects_dir, default_root_openhuman_dir, pre_login_user_dir, read_active_user_id,resolve_action_dir, resolve_files_dir, user_openhuman_dir, write_active_user_id,- PRE_LOGIN_USER_ID,};// redact_url_for_log is pub(super) for the schema module; tests inside load@@ -46,8 +45,8 @@ pub(super) use migrate::redact_url_for_log;pub(crate) use impl_load::CONFIG_OWNER_MISMATCH_MARKER;pub(crate) use migrate::apply_loaded_config_migrations;pub(crate) use provenance::{- current_dotenv_load, dotenv_loaded_variable, set_current_dotenv_load, ConfigProvenance,- DotenvLoadProvenance, ProvenanceSource, ValueProvenance,+ ConfigProvenance, DotenvLoadProvenance, ProvenanceSource, ValueProvenance, current_dotenv_load,+ dotenv_loaded_variable, set_current_dotenv_load,};// Items needed by load_tests.rs (loaded as `mod tests` below).@@ -64,7 +63,7 @@ pub(crate) use dirs::read_active_user_id_checked;// holds `auth-profiles.json`.pub(crate) use dirs::resolve_config_dir_for_workspace;pub(crate) use dirs::{- load_persisted_workspace_dirs, read_active_user_id_checked_async, ConfigResolutionSource,+ ConfigResolutionSource, load_persisted_workspace_dirs, read_active_user_id_checked_async,};#[cfg(test)]pub(crate) use dirs::{resolve_runtime_config_dirs, resolve_runtime_config_dirs_with};diff --git a/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs b/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rsindex 33152191e3..236dcf1daa 100644--- a/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs+++ b/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs@@ -1,5 +1,5 @@use super::*;-use crate::core::runtime::{context::CoreContext, ContextOverlay, DispatchCtx, DomainSet};+use crate::core::runtime::{ContextOverlay, DispatchCtx, DomainSet, context::CoreContext};use serde_json::json;#[tokio::test]diff --git a/crates/openhuman-core/src/config/schema/load/source/document.rs b/crates/openhuman-core/src/config/schema/load/source/document.rsindex ccd6bb66c1..97473c7590 100644--- a/crates/openhuman-core/src/config/schema/load/source/document.rs+++ b/crates/openhuman-core/src/config/schema/load/source/document.rs@@ -2,21 +2,21 @@use std::sync::{Arc, Mutex};-use anyhow::{anyhow, Context, Result};+use anyhow::{Context, Result, anyhow};use async_trait::async_trait;use serde_json::json;-use tinystoragedrivers::secrets::{crypto, KeyProvider};+use tinystoragedrivers::secrets::{KeyProvider, crypto};use tinystoragedrivers::{CollectionSpec, Precondition};use tinystoragedrivers_api::DocumentStore;use super::{- apply_bootstrap, strip_bootstrap, ConfigRead, ConfigSource, ConfigSourceAnchor,- DocumentBackendIdentity, FileConfigSource,+ ConfigRead, ConfigSource, ConfigSourceAnchor, DocumentBackendIdentity, FileConfigSource,+ apply_bootstrap, strip_bootstrap,};use crate::storage::Scope;-use super::storage_schema::document_id;pub(crate) use super::storage_schema::CONFIG_COLLECTION;+use super::storage_schema::document_id;/// The document field holding the encrypted TOML body (`enc2:` hex).const BODY_FIELD: &str = "toml_enc";diff --git a/crates/openhuman-core/src/config/schema/load/source/mod_tests.rs b/crates/openhuman-core/src/config/schema/load/source/mod_tests.rsindex 1627d5adba..7ef806f6fb 100644--- a/crates/openhuman-core/src/config/schema/load/source/mod_tests.rs+++ b/crates/openhuman-core/src/config/schema/load/source/mod_tests.rs@@ -1,9 +1,9 @@use super::tests_support::ForcedDocumentSource;use super::*;use crate::config::Config;-use crate::storage::{test_support::memory_backend, Scope, Storage, StorageBackend};+use crate::storage::{Scope, Storage, StorageBackend, test_support::memory_backend};use std::sync::Arc;-use tinystoragedrivers::secrets::{crypto, DerivedKeys, KeyProvider};+use tinystoragedrivers::secrets::{DerivedKeys, KeyProvider, crypto};use zeroize::Zeroizing;fn keys(byte: u8) -> Arc<dyn KeyProvider> {diff --git a/crates/openhuman-core/src/config/schema/load/source/revision_loader_tests.rs b/crates/openhuman-core/src/config/schema/load/source/revision_loader_tests.rsindex 6834ee2610..43f1da9c71 100644--- a/crates/openhuman-core/src/config/schema/load/source/revision_loader_tests.rs+++ b/crates/openhuman-core/src/config/schema/load/source/revision_loader_tests.rs@@ -1,5 +1,5 @@use super::*;-use crate::core::runtime::{context::CoreContext, ContextOverlay, DispatchCtx, DomainSet};+use crate::core::runtime::{ContextOverlay, DispatchCtx, DomainSet, context::CoreContext};use serde_json::json;use std::sync::Arc;use tinytools::Tool;diff --git a/crates/openhuman-core/src/config/schema/load/source/storage_schema.rs b/crates/openhuman-core/src/config/schema/load/source/storage_schema.rsindex 0ab2c19ff6..84b81a0ed6 100644--- a/crates/openhuman-core/src/config/schema/load/source/storage_schema.rs+++ b/crates/openhuman-core/src/config/schema/load/source/storage_schema.rs@@ -7,7 +7,7 @@use tinystoragedrivers::CollectionSpec;-use crate::storage::schema_support::{key_of, map_legacy_collection, LegacyTargetRecord};+use crate::storage::schema_support::{LegacyTargetRecord, key_of, map_legacy_collection};/// The v2 collection holding one config document per scope.pub(crate) const CONFIG_COLLECTION: &str = "config.documents";diff --git a/crates/openhuman-core/src/config/schema/load_active_user_and_dirs_tests.rs b/crates/openhuman-core/src/config/schema/load_active_user_and_dirs_tests.rsindex 6585f55196..7c1a781b6e 100644--- a/crates/openhuman-core/src/config/schema/load_active_user_and_dirs_tests.rs+++ b/crates/openhuman-core/src/config/schema/load_active_user_and_dirs_tests.rs@@ -321,7 +321,7 @@ fn apply_env_overrides_shell_hide_window_parses_truthy_falsy() {#[test]fn classify_shell_hide_window_distinguishes_unset_from_unrecognized() {- use super::super::env_overlay::{classify_shell_hide_window, ShellHideWindowParse as P};+ use super::super::env_overlay::{ShellHideWindowParse as P, classify_shell_hide_window};// The key distinction the change relies on: an empty / whitespace-only value// is `Unset` (silent no-op), NOT `Unrecognized` (which warns on every boot).// Testing the classifier directly proves this — the field-unchanged assertiondiff --git a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rsindex ab91286d2c..4f14827c75 100644--- a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs+++ b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs@@ -146,11 +146,12 @@ fn env_overlay_output_language_accepts_non_empty_value() {cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_OUTPUT_LANGUAGE", "zh-CN"));assert_eq!(cfg.output_language.as_deref(), Some("zh-CN"));- assert!(cfg- .output_language_directive()- .as_deref()- .unwrap_or_default()- .contains("Simplified Chinese"));+ assert!(+ cfg.output_language_directive()+ .as_deref()+ .unwrap_or_default()+ .contains("Simplified Chinese")+ );cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_OUTPUT_LANGUAGE", " "));assert_eq!(diff --git a/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs b/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rsindex 80a1bda5c8..90e423c6bd 100644--- a/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs+++ b/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs@@ -45,10 +45,12 @@ async fn bare_core_advances_schema_without_inventing_hosted_defaults() {let tmp = tempfile::tempdir().unwrap();let mut config = load_or_init_for_workspace(tmp.path()).await;assert!(config.default_model.is_none());- assert!(config- .cloud_providers- .iter()- .all(|provider| provider.slug != "openhuman"));+ assert!(+ config+ .cloud_providers+ .iter()+ .all(|provider| provider.slug != "openhuman")+ );config.schema_version = 7;config.default_model = Some("reasoning-v1".to_string());diff --git a/crates/openhuman-core/src/config/schema/load_migration_tests.rs b/crates/openhuman-core/src/config/schema/load_migration_tests.rsindex 3f8802c691..542033fa24 100644--- a/crates/openhuman-core/src/config/schema/load_migration_tests.rs+++ b/crates/openhuman-core/src/config/schema/load_migration_tests.rs@@ -256,10 +256,12 @@ backend = "sqlite".unwrap();assert!(saved.contains("engine = \"\""));let saved_config: toml::Value = toml::from_str(&saved).unwrap();- assert!(!saved_config["memory"]- .as_table()- .unwrap()- .contains_key("backend"));+ assert!(+ !saved_config["memory"]+ .as_table()+ .unwrap()+ .contains_key("backend")+ );let reloaded = load_or_init_for_workspace(tmp.path()).await;diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rsindex b28415158b..ef966e2141 100644--- a/crates/openhuman-core/src/config/schema/mod.rs+++ b/crates/openhuman-core/src/config/schema/mod.rs@@ -3,7 +3,7 @@//! Split into submodules; this module re-exports the main `Config` and all public types.pub mod cloud_providers;-pub use cloud_providers::{generate_provider_id, is_slug_reserved, AuthStyle, CloudProviderCreds};+pub use cloud_providers::{AuthStyle, CloudProviderCreds, generate_provider_id, is_slug_reserved};fn generate_provider_id_with_prefix(prefix: &str, slug: &str) -> String {use std::time::{SystemTime, UNIX_EPOCH};@@ -35,7 +35,7 @@ fn generate_provider_id_with_prefix(prefix: &str, slug: &str) -> String {format!("{prefix}_{safe_slug}_{suffix}")}pub mod ephemeral_route;-pub use ephemeral_route::{EphemeralRoute, EPHEMERAL_ROUTE_SLUG};+pub use ephemeral_route::{EPHEMERAL_ROUTE_SLUG, EphemeralRoute};pub mod resolved_endpoints;pub use resolved_endpoints::ResolvedEndpoints;mod agent;@@ -62,7 +62,7 @@ pub use hosting::HostingConfig;pub mod storage;pub use storage::StorageConfig;pub mod profile_layout;-pub use profile_layout::{users_dir, ProfileLayout};+pub use profile_layout::{ProfileLayout, users_dir};mod identity_cost;mod inbound_debounce;pub(crate) mod load;@@ -71,11 +71,11 @@ pub(crate) use load::source::storage_schema::collection_specs as config_storage_#[cfg(feature = "legacy-import")]pub(crate) use load::source::storage_schema::upgrade_records as upgrade_config_records;pub use load::{- action_dir_env_override, active_user_marker_path, active_workspace_dir,+ PRE_LOGIN_USER_ID, action_dir_env_override, active_user_marker_path, active_workspace_dir,active_workspace_dir_cached, active_workspace_snapshot, clear_active_user, default_action_dir,default_files_dir, default_projects_dir, default_root_openhuman_dir, pre_login_user_dir,read_active_user_id, resolve_action_dir, resolve_files_dir, user_openhuman_dir,- write_active_user_id, PRE_LOGIN_USER_ID,+ write_active_user_id,};// Crate-internal: the invalidation half of the cached active workspace. The// marker writers in `load_user_state` call it from outside `load`; the@@ -134,19 +134,18 @@ pub use inbound_debounce::{InboundDebounceConfig, InboundDebounceOverride};pub use local_ai::{LocalAiConfig, LocalAiUsage};pub use memes::MemesConfig;pub use memory::{- migrate_legacy_source, MemoryAgentConfig, MemoryConfig, MemoryConversationsConfig,+ MEMORY_CORTEXDB_KEY_NAME, MemoryAgentConfig, MemoryConfig, MemoryConversationsConfig,MemoryEngineSettings, MemoryLayoutMode, MemorySourceConfig, MemorySourceKind, RecallSettings,- MEMORY_CORTEXDB_KEY_NAME,+ migrate_legacy_source,};pub use modules::{- module_source_env_for, ModuleOverride, ModuleSourceMode, ModulesConfig, MODULE_SOURCE_ENV,+ MODULE_SOURCE_ENV, ModuleOverride, ModuleSourceMode, ModulesConfig, module_source_env_for,};pub use observability::{AgentTracingBackend, AgentTracingConfig, ObservabilityConfig};pub use privacy::{PrivacyConfig, PrivacyMode};pub use proxy::{- apply_runtime_proxy_to_builder, build_runtime_proxy_client,+ ProxyConfig, ProxyScope, apply_runtime_proxy_to_builder, build_runtime_proxy_client,build_runtime_proxy_client_with_timeouts, runtime_proxy_config, set_runtime_proxy_config,- ProxyConfig, ProxyScope,};pub use routes::{EmbeddingRouteConfig, ModelRouteConfig};pub use runtime::{@@ -157,17 +156,17 @@ pub use scheduler_gate::{PauseReason, Policy, SchedulerGateConfig, SchedulerGatepub use task_sources::TaskSourcesConfig;pub use tokenjuice::TokenjuiceConfig;pub use tools::{- BrowserComputerUseConfig, BrowserConfig, ComposioConfig, ComposioDirectBaseUrls,- ComposioHostCredential, CurlConfig, GitbooksConfig, HttpHeader, HttpRequestConfig,- IntegrationToggle, IntegrationsConfig, LegacySearchInputs, McpAuthConfig, McpClientConfig,- McpClientIdentityConfig, McpServerConfig, McpToolExposure, MultimodalConfig,- MultimodalFileConfig, PresentationMode, ProviderRoute, SearchConfig, SearchEngineCredentials,+ BrowserComputerUseConfig, BrowserConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT,+ COMPOSIO_MODE_DISABLED, ComposioConfig, ComposioDirectBaseUrls, ComposioHostCredential,+ CurlConfig, GitbooksConfig, HttpHeader, HttpRequestConfig, IntegrationToggle,+ IntegrationsConfig, LegacySearchInputs, MANAGED_SEARCH_PROVIDERS, McpAuthConfig,+ McpClientConfig, McpClientIdentityConfig, McpServerConfig, McpToolExposure, MultimodalConfig,+ MultimodalFileConfig, PresentationMode, ProviderRoute, SEARCH_ENGINE_BRAVE,+ SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL,+ SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLE_ANSWER,+ SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, SEARCH_ROLES, SearchConfig, SearchEngineCredentials,SearchHostCredential, SearchProviderSettings, SearxngConfig, SecretsConfig, SeltzConfig,- UnknownKeyedSearchProvider, WebSearchConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT,- COMPOSIO_MODE_DISABLED, MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED,- SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT,- SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS,- SEARCH_ROLE_SEARCH,+ UnknownKeyedSearchProvider, WebSearchConfig,};pub use update::{UpdateConfig, UpdateRestartStrategy};pub use web_chat_config::WebChatConfig;@@ -177,8 +176,8 @@ pub mod voice_live;pub mod voice_providers;pub use voice_live::LiveVoiceConfig;pub use voice_providers::{- generate_voice_provider_id, is_voice_slug_reserved, BuiltinVoiceProvider, VoiceCapability,- VoiceProviderCreds, BUILTIN_VOICE_PROVIDERS,+ BUILTIN_VOICE_PROVIDERS, BuiltinVoiceProvider, VoiceCapability, VoiceProviderCreds,+ generate_voice_provider_id, is_voice_slug_reserved,};mod types;pub(crate) use types::ConfigDocumentSnapshot;diff --git a/crates/openhuman-core/src/config/schema/tools/browser_tests.rs b/crates/openhuman-core/src/config/schema/tools/browser_tests.rsindex fbc171e7e9..cd562adaaf 100644--- a/crates/openhuman-core/src/config/schema/tools/browser_tests.rs+++ b/crates/openhuman-core/src/config/schema/tools/browser_tests.rs@@ -45,9 +45,11 @@ fn unknown_unattended_names_are_reported_and_never_allow_anything() {assert!(!config.allows_unattended("navigate"));assert!(!config.allows_unattended("hover"));assert!(!config.allows_unattended("*"));- assert!(with_unattended(&["double_click", "select", "check"])- .unknown_unattended_actions()- .is_empty());+ assert!(+ with_unattended(&["double_click", "select", "check"])+ .unknown_unattended_actions()+ .is_empty()+ );}#[test]diff --git a/crates/openhuman-core/src/config/schema/tools/mod.rs b/crates/openhuman-core/src/config/schema/tools/mod.rsindex fcda1d5afe..c747cfb3ac 100644--- a/crates/openhuman-core/src/config/schema/tools/mod.rs+++ b/crates/openhuman-core/src/config/schema/tools/mod.rs@@ -10,9 +10,9 @@ pub mod search;pub use browser::{BrowserComputerUseConfig, BrowserConfig};pub use http::{CurlConfig, HttpRequestConfig};pub use integrations::{- ComposioConfig, ComposioDirectBaseUrls, ComposioHostCredential, IntegrationToggle,- IntegrationsConfig, SecretsConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT,- COMPOSIO_MODE_DISABLED,+ COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT, COMPOSIO_MODE_DISABLED, ComposioConfig,+ ComposioDirectBaseUrls, ComposioHostCredential, IntegrationToggle, IntegrationsConfig,+ SecretsConfig,};pub use mcp::{GitbooksConfig, HttpHeader, McpAuthConfig, McpClientConfig, McpClientIdentityConfig,@@ -20,10 +20,10 @@ pub use mcp::{};pub use multimodal::{MultimodalConfig, MultimodalFileConfig};pub use search::{- LegacySearchInputs, PresentationMode, ProviderRoute, SearchConfig, SearchEngineCredentials,- SearchHostCredential, SearchProviderSettings, SearxngConfig, SeltzConfig,- UnknownKeyedSearchProvider, WebSearchConfig, MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE,- SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL,- SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER,- SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,+ LegacySearchInputs, MANAGED_SEARCH_PROVIDERS, PresentationMode, ProviderRoute,+ SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED,+ SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS,+ SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, SEARCH_ROLES, SearchConfig,+ SearchEngineCredentials, SearchHostCredential, SearchProviderSettings, SearxngConfig,+ SeltzConfig, UnknownKeyedSearchProvider, WebSearchConfig,};diff --git a/crates/openhuman-core/src/config/schema/tools/search.rs b/crates/openhuman-core/src/config/schema/tools/search.rsindex d60dda8655..609bc5078b 100644--- a/crates/openhuman-core/src/config/schema/tools/search.rs+++ b/crates/openhuman-core/src/config/schema/tools/search.rs@@ -202,11 +202,7 @@ impl SearchEngineCredentials {pub fn key(&self) -> Option<&str> {self.api_key.as_deref().and_then(|s| {let t = s.trim();- if t.is_empty() {- None- } else {- Some(t)- }+ if t.is_empty() { None } else { Some(t) }})}}diff --git a/crates/openhuman-core/src/config/schema/tools/search_migrate.rs b/crates/openhuman-core/src/config/schema/tools/search_migrate.rsindex 112f536dab..08c2efd4bc 100644--- a/crates/openhuman-core/src/config/schema/tools/search_migrate.rs+++ b/crates/openhuman-core/src/config/schema/tools/search_migrate.rs@@ -5,10 +5,10 @@use std::collections::BTreeMap;use super::{- LegacySearchInputs, ProviderRoute, SearchConfig, SearchProviderSettings, SEARCH_ENGINE_BRAVE,- SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL,- SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLE_SEARCH,- SEARCH_SCHEMA_PROVIDERS, SEARCH_SCHEMA_VERSION,+ LegacySearchInputs, ProviderRoute, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED,+ SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT,+ SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLE_SEARCH, SEARCH_SCHEMA_PROVIDERS,+ SEARCH_SCHEMA_VERSION, SearchConfig, SearchProviderSettings,};impl SearchConfig {diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rsindex a66fca90ed..e12bb54ada 100644--- a/crates/openhuman-core/src/config/schema/types/config.rs+++ b/crates/openhuman-core/src/config/schema/types/config.rs@@ -282,6 +282,7 @@ pub struct Config {/// session-memory extraction cadence. Consumed by/// the agent context middleware configuration.#[serde(default)]+ #[schemars(with = "super::super::context::ContextConfigSchema")]pub context: ContextConfig,#[serde(default)]diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rsindex 964a33b4be..36e3bc2315 100644--- a/crates/openhuman-core/src/config/schema/types/defaults.rs+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs@@ -4,8 +4,8 @@ use directories::UserDirs;use std::collections::HashMap;use std::path::PathBuf;-use super::config::default_temperature_unsupported_models;use super::config::DEFAULT_TEMPERATURE;+use super::config::default_temperature_unsupported_models;use crate::config::schema::*;impl Default for Config {diff --git a/crates/openhuman-core/src/config/schemas/controllers/agent.rs b/crates/openhuman-core/src/config/schemas/controllers/agent.rsindex 7c294eed5e..fa3110b799 100644--- a/crates/openhuman-core/src/config/schemas/controllers/agent.rs+++ b/crates/openhuman-core/src/config/schemas/controllers/agent.rs@@ -7,9 +7,9 @@ use crate::config::rpc as config_rpc;use crate::core::all::ControllerFuture;use super::super::helpers::{- deserialize_params, to_json, AgentSettingsUpdate, AutonomySettingsUpdate,- BrowserSettingsUpdate, ComputerSettingsUpdate, PrivacyModeUpdate, SandboxSettingsUpdate,- SetBrowserAllowAllParams,+ AgentSettingsUpdate, AutonomySettingsUpdate, BrowserSettingsUpdate, ComputerSettingsUpdate,+ PrivacyModeUpdate, SandboxSettingsUpdate, SetBrowserAllowAllParams, deserialize_params,+ to_json,};pub(crate) fn handle_get_autonomy_settings(diff --git a/crates/openhuman-core/src/config/schemas/controllers/inference.rs b/crates/openhuman-core/src/config/schemas/controllers/inference.rsindex 8e911e9250..93bc61ac27 100644--- a/crates/openhuman-core/src/config/schemas/controllers/inference.rs+++ b/crates/openhuman-core/src/config/schemas/controllers/inference.rs@@ -7,8 +7,8 @@ use crate::config::rpc as config_rpc;use crate::core::all::ControllerFuture;use super::super::helpers::{- deserialize_params, to_json, LocalAiSettingsUpdate, MemorySettingsUpdate, ModelSettingsUpdate,- RuntimeSettingsUpdate,+ LocalAiSettingsUpdate, MemorySettingsUpdate, ModelSettingsUpdate, RuntimeSettingsUpdate,+ deserialize_params, to_json,};pub(super) fn handle_get_config(ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {diff --git a/crates/openhuman-core/src/config/schemas/controllers/integrations.rs b/crates/openhuman-core/src/config/schemas/controllers/integrations.rsindex 544175915c..26c90b2834 100644--- a/crates/openhuman-core/src/config/schemas/controllers/integrations.rs+++ b/crates/openhuman-core/src/config/schemas/controllers/integrations.rs@@ -6,7 +6,7 @@ use serde_json::{Map, Value};use crate::config::rpc as config_rpc;use crate::core::all::ControllerFuture;-use super::super::helpers::{deserialize_params, to_json, ComposioTriggerSettingsUpdate};+use super::super::helpers::{ComposioTriggerSettingsUpdate, deserialize_params, to_json};pub(super) fn handle_update_search_settings(ctx: DispatchCtx,diff --git a/crates/openhuman-core/src/config/schemas/controllers/registry.rs b/crates/openhuman-core/src/config/schemas/controllers/registry.rsindex 66214f8e02..5157bf2d05 100644--- a/crates/openhuman-core/src/config/schemas/controllers/registry.rs+++ b/crates/openhuman-core/src/config/schemas/controllers/registry.rs@@ -1,7 +1,7 @@//! Controller registry for the `config` namespace: schema list and handler wiring.-use crate::core::all::RegisteredController;use crate::core::ControllerSchema;+use crate::core::all::RegisteredController;use super::super::schema_defs::schemas;use super::agent::{diff --git a/crates/openhuman-core/src/config/schemas/controllers/workspace.rs b/crates/openhuman-core/src/config/schemas/controllers/workspace.rsindex 19d229ec9e..16e24f51e3 100644--- a/crates/openhuman-core/src/config/schemas/controllers/workspace.rs+++ b/crates/openhuman-core/src/config/schemas/controllers/workspace.rs@@ -7,9 +7,9 @@ use crate::config::rpc as config_rpc;use crate::core::all::ControllerFuture;use super::super::helpers::{- deserialize_params, to_json, AgentPathsUpdate, AnalyticsSettingsUpdate,+ AgentPathsUpdate, AnalyticsSettingsUpdate, DEFAULT_ONBOARDING_FLAG_NAME,OnboardingCompletedSetParams, UserTimezoneUpdate, WorkspaceOnboardingFlagParams,- WorkspaceOnboardingFlagSetParams, DEFAULT_ONBOARDING_FLAG_NAME,+ WorkspaceOnboardingFlagSetParams, deserialize_params, to_json,};pub(super) fn handle_workspace_onboarding_flag_exists(diff --git a/crates/openhuman-core/src/config/schemas/helpers.rs b/crates/openhuman-core/src/config/schemas/helpers.rsindex c0753faa80..c3da77ee58 100644--- a/crates/openhuman-core/src/config/schemas/helpers.rs+++ b/crates/openhuman-core/src/config/schemas/helpers.rs@@ -1,5 +1,5 @@-use serde::de::{DeserializeOwned, Deserializer};use serde::Deserialize;+use serde::de::{DeserializeOwned, Deserializer};use serde_json::{Map, Value};use crate::core::Outcome;diff --git a/crates/openhuman-core/src/config/schemas/mod.rs b/crates/openhuman-core/src/config/schemas/mod.rsindex 12aaaa34b9..914127e9ae 100644--- a/crates/openhuman-core/src/config/schemas/mod.rs+++ b/crates/openhuman-core/src/config/schemas/mod.rs@@ -51,9 +51,10 @@ use controllers::{};#[cfg(test)]use helpers::{- deserialize_params, AutonomySettingsUpdate, LocalAiSettingsUpdate, MemorySettingsUpdate,- ModelSettingsUpdate, OnboardingCompletedSetParams, SetBrowserAllowAllParams,- WorkspaceOnboardingFlagParams, WorkspaceOnboardingFlagSetParams, DEFAULT_ONBOARDING_FLAG_NAME,+ AutonomySettingsUpdate, DEFAULT_ONBOARDING_FLAG_NAME, LocalAiSettingsUpdate,+ MemorySettingsUpdate, ModelSettingsUpdate, OnboardingCompletedSetParams,+ SetBrowserAllowAllParams, WorkspaceOnboardingFlagParams, WorkspaceOnboardingFlagSetParams,+ deserialize_params,};#[cfg(test)]use serde_json::{Map, Value};diff --git a/crates/openhuman-core/src/config/schemas/schema_defs/agent.rs b/crates/openhuman-core/src/config/schemas/schema_defs/agent.rsindex 06d88e9046..d73965553c 100644--- a/crates/openhuman-core/src/config/schemas/schema_defs/agent.rs+++ b/crates/openhuman-core/src/config/schemas/schema_defs/agent.rs@@ -6,30 +6,43 @@ use super::super::helpers::{json_output, optional_bool, optional_number, optionapub(super) fn lookup(function: &str) -> Option<ControllerSchema> {match function {-"get_autonomy_settings" => Some( ControllerSchema {+ "get_autonomy_settings" => Some(ControllerSchema {namespace: "config",function: "get_autonomy_settings",description: "Get the agent access-mode settings (autonomy level, workspace confinement, trusted roots, command allow-list, forbidden paths).",inputs: vec![],outputs: vec![json_output("autonomy", "Current [autonomy] config block.")],}),-"update_autonomy_settings" => Some( ControllerSchema {+ "update_autonomy_settings" => Some(ControllerSchema {namespace: "config",function: "update_autonomy_settings",description: "Update the agent access mode: whether the policy is enabled at all, autonomy level, workspace confinement, trusted-roots allow-list, command allow-list, forbidden paths, and OS-install permission. Applies live to active sessions.",inputs: vec![- optional_bool("enabled", "Master switch for the autonomy policy. Defaults to false: with it off, command classification, the approval gate, the command allow-list, the action budget and workspace containment are all inert, and every other field here has no effect. Credential stores and system roots stay blocked either way."),- optional_string("level", "Autonomy level: readonly | supervised | full. Only binds when enabled is true."),- optional_bool("workspace_only", "Confine file/path access to the workspace directory."),+ optional_bool(+ "enabled",+ "Master switch for the autonomy policy. Defaults to false: with it off, command classification, the approval gate, the command allow-list, the action budget and workspace containment are all inert, and every other field here has no effect. Credential stores and system roots stay blocked either way.",+ ),+ optional_string(+ "level",+ "Autonomy level: readonly | supervised | full. Only binds when enabled is true.",+ ),+ optional_bool(+ "workspace_only",+ "Confine file/path access to the workspace directory.",+ ),FieldSchema {name: "allowed_commands",- ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(TypeSchema::String)))),+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(+ TypeSchema::String,+ )))),comment: "Replace the shell command allow-list (array of base command names).",required: false,},FieldSchema {name: "forbidden_paths",- ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(TypeSchema::String)))),+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(+ TypeSchema::String,+ )))),comment: "Replace the forbidden-paths denylist (array of path prefixes).",required: false,},@@ -39,7 +52,10 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {comment: "Replace the trusted-roots allow-list: array of {path, access: read|readwrite}. Grants access outside the workspace; credential dirs (~/.ssh, ~/.gnupg, ~/.aws) stay blocked regardless.",required: false,},- optional_bool("allow_tool_install", "Allow the agent to install OS packages via install_tool (intended for Full mode)."),+ optional_bool(+ "allow_tool_install",+ "Allow the agent to install OS packages via install_tool (intended for Full mode).",+ ),FieldSchema {name: "max_actions_per_hour",// A non-zero `u32`: 0 is refused by the apply path, and@@ -53,31 +69,40 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {},FieldSchema {name: "auto_approve",- ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(TypeSchema::String)))),+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(+ TypeSchema::String,+ )))),comment: "Replace the \"Always allow\" allowlist (array of tool names the agent runs without an approval prompt). Empty array clears it.",required: false,},- optional_bool("auto_approve_all", "When true, auto-approve all tool calls without prompting. Unknown origins still denied. Hard security blocks unaffected."),+ optional_bool(+ "auto_approve_all",+ "When true, auto-approve all tool calls without prompting. Unknown origins still denied. Hard security blocks unaffected.",+ ),],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"get_privacy_mode" => Some( ControllerSchema {+ "get_privacy_mode" => Some(ControllerSchema {namespace: "config",function: "get_privacy_mode",description: "Get the active Privacy Mode (data-egress posture): local_only | standard | sensitive. Distinct from the autonomy access mode.",inputs: vec![],- outputs: vec![json_output("mode", "Current privacy mode: local_only | standard | sensitive.")],+ outputs: vec![json_output(+ "mode",+ "Current privacy mode: local_only | standard | sensitive.",+ )],}),-"set_privacy_mode" => Some( ControllerSchema {+ "set_privacy_mode" => Some(ControllerSchema {namespace: "config",function: "set_privacy_mode",description: "Set the Privacy Mode (data-egress posture). local_only blocks external model calls at the inference chokepoint. Applies live to active sessions without a restart.",- inputs: vec![- optional_string("mode", "Privacy mode: local_only | standard | sensitive."),- ],+ inputs: vec![optional_string(+ "mode",+ "Privacy mode: local_only | standard | sensitive.",+ )],outputs: vec![json_output("mode", "Updated privacy mode.")],}),-"get_agent_settings" => Some( ControllerSchema {+ "get_agent_settings" => Some(ControllerSchema {namespace: "config",function: "get_agent_settings",description: "Read agent execution settings: the action/tool wall-clock timeout, the runtime-effective value, and whether the OPENHUMAN_TOOL_TIMEOUT_SECS env var overrides it.",@@ -87,31 +112,33 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {"Agent settings: agent_timeout_secs, effective_timeout_secs, env_override, min_timeout_secs, max_timeout_secs, tool_dispatcher, tool_dispatcher_env_override.",)],}),-"update_agent_settings" => Some( ControllerSchema {+ "update_agent_settings" => Some(ControllerSchema {namespace: "config",function: "update_agent_settings",description: "Update agent execution settings: the action/tool wall-clock timeout (seconds) and the web-chat target agent. Applies to the next tool call without a restart; the OPENHUMAN_TOOL_TIMEOUT_SECS env var still overrides it when set.",- inputs: vec![FieldSchema {- name: "agent_timeout_secs",- ty: TypeSchema::Option(Box::new(TypeSchema::U64)),- comment: "Wall-clock timeout for a single tool/action execution, in seconds (1–3600). Extend this when large local models are interrupted before finishing.",- required: false,- },- FieldSchema {- name: "chat_agent_id",- ty: TypeSchema::Option(Box::new(TypeSchema::String)),- comment: "Agent definition id the web-chat path routes turns to. Empty string reverts to the orchestrator. A named definition's own max_iterations governs the turn, so this is how a longer-running agent is selected.",- required: false,- },- FieldSchema {- name: "tool_dispatcher",- ty: TypeSchema::Option(Box::new(TypeSchema::String)),- comment: "How tool calls are spoken to the model: auto (default; native when supported, else JSON-in-tag) | native | xml | pformat | python | typescript. Applies to new sessions.",- required: false,- }],+ inputs: vec![+ FieldSchema {+ name: "agent_timeout_secs",+ ty: TypeSchema::Option(Box::new(TypeSchema::U64)),+ comment: "Wall-clock timeout for a single tool/action execution, in seconds (1–3600). Extend this when large local models are interrupted before finishing.",+ required: false,+ },+ FieldSchema {+ name: "chat_agent_id",+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),+ comment: "Agent definition id the web-chat path routes turns to. Empty string reverts to the orchestrator. A named definition's own max_iterations governs the turn, so this is how a longer-running agent is selected.",+ required: false,+ },+ FieldSchema {+ name: "tool_dispatcher",+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),+ comment: "How tool calls are spoken to the model: auto (default; native when supported, else JSON-in-tag) | native | xml | pformat | python | typescript. Applies to new sessions.",+ required: false,+ },+ ],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"update_browser_settings" => Some( ControllerSchema {+ "update_browser_settings" => Some(ControllerSchema {namespace: "config",function: "update_browser_settings",description: "Update browser automation settings.",@@ -122,14 +149,32 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {"Browser backend: tinycomputer (legacy values, including tinybrowser, accepted for migration).",),optional_bool("headless", "Run Chrome without a visible window."),- optional_number("viewport_width", "Chrome viewport width in pixels (320-3840)."),- optional_number("viewport_height", "Chrome viewport height in pixels (240-2160)."),- optional_string("chrome_path", "Optional Chrome executable path; empty clears."),+ optional_number(+ "viewport_width",+ "Chrome viewport width in pixels (320-3840).",+ ),+ optional_number(+ "viewport_height",+ "Chrome viewport height in pixels (240-2160).",+ ),+ optional_string(+ "chrome_path",+ "Optional Chrome executable path; empty clears.",+ ),optional_string("profile_mode", "fresh or persistent."),- optional_string("profile_path", "Persistent Chrome profile path; empty clears."),- optional_string("download_dir", "Absolute permitted download folder; empty clears."),+ optional_string(+ "profile_path",+ "Persistent Chrome profile path; empty clears.",+ ),+ optional_string(+ "download_dir",+ "Absolute permitted download folder; empty clears.",+ ),optional_number("max_task_steps", "Maximum Jev task steps (1-100)."),- optional_number("task_timeout_secs", "Browser task timeout in seconds (5-600)."),+ optional_number(+ "task_timeout_secs",+ "Browser task timeout in seconds (5-600).",+ ),optional_bool("learn_from_tasks","Keep the plan and elements a finished browser task used on a site, for the next task there.",@@ -137,20 +182,29 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"update_computer_settings" => Some( ControllerSchema {+ "update_computer_settings" => Some(ControllerSchema {namespace: "config",function: "update_computer_settings",description: "Update TinyComputer's decision, planner and rescue models.",inputs: vec![optional_string("decision_model", "Decision model: jev, open_jev, or sage."),optional_bool("sage_fast", "Use Sage's fast mode."),- optional_string("planner_model", "Planner model id; empty restores the module default."),- optional_string("rescue_model", "Rescue model id for failed steps; empty restores the module default."),- optional_number("max_rescues", "Rescues allowed per task (0-5); 0 turns rescue off."),+ optional_string(+ "planner_model",+ "Planner model id; empty restores the module default.",+ ),+ optional_string(+ "rescue_model",+ "Rescue model id for failed steps; empty restores the module default.",+ ),+ optional_number(+ "max_rescues",+ "Rescues allowed per task (0-5); 0 turns rescue off.",+ ),],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"set_browser_allow_all" => Some( ControllerSchema {+ "set_browser_allow_all" => Some(ControllerSchema {namespace: "config",function: "set_browser_allow_all",description: "Disable browser allow-all mode, or enable it only when operator opt-in is present.",@@ -167,21 +221,27 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {required: true,}],}),-"get_sandbox_settings" => Some( ControllerSchema {+ "get_sandbox_settings" => Some(ControllerSchema {namespace: "config",function: "get_sandbox_settings",description: "Get sandbox execution backend settings: selected backend, Docker image/limits, env passthrough, Docker availability, and detected OS backend.",inputs: vec![],outputs: vec![json_output("settings", "Sandbox settings with status.")],}),-"update_sandbox_settings" => Some( ControllerSchema {+ "update_sandbox_settings" => Some(ControllerSchema {namespace: "config",function: "update_sandbox_settings",description: "Update sandbox execution backend settings: backend selection, Docker image, memory/CPU limits, and env passthrough. Applies to new agent sessions.",inputs: vec![- optional_string("backend", "Sandbox backend: auto | landlock | firejail | bubblewrap | docker | none."),+ optional_string(+ "backend",+ "Sandbox backend: auto | landlock | firejail | bubblewrap | docker | none.",+ ),optional_bool("enabled", "Enable or disable sandbox execution."),- optional_string("docker_image", "Docker image for sandboxed execution (e.g. alpine:3.20)."),+ optional_string(+ "docker_image",+ "Docker image for sandboxed execution (e.g. alpine:3.20).",+ ),FieldSchema {name: "docker_memory_limit_mb",ty: TypeSchema::Option(Box::new(TypeSchema::U64)),@@ -196,7 +256,9 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {},FieldSchema {name: "env_passthrough",- ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(TypeSchema::String)))),+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(+ TypeSchema::String,+ )))),comment: "Environment variables to pass through into the sandbox.",required: false,},diff --git a/crates/openhuman-core/src/config/schemas/schema_defs/inference.rs b/crates/openhuman-core/src/config/schemas/schema_defs/inference.rsindex 4cfad41aea..a341526250 100644--- a/crates/openhuman-core/src/config/schemas/schema_defs/inference.rs+++ b/crates/openhuman-core/src/config/schemas/schema_defs/inference.rs@@ -6,7 +6,7 @@ use super::super::helpers::{json_output, optional_bool, optional_json, optional_pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {match function {-"get_config" => Some( ControllerSchema {+ "get_config" => Some(ControllerSchema {namespace: "config",function: "get",description: "Read persisted config snapshot and resolved paths.",@@ -18,7 +18,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {required: true,}],}),-"get_client_config" => Some( ControllerSchema {+ "get_client_config" => Some(ControllerSchema {namespace: "config",function: "get_client_config",description: "Read safe client-facing config fields (api_url, feature flags). No secrets.",@@ -62,14 +62,23 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {},],}),-"update_model_settings" => Some( ControllerSchema {+ "update_model_settings" => Some(ControllerSchema {namespace: "config",function: "update_model_settings",description: "Update model and backend connection settings, including a custom OpenAI-compatible backend (api_url + api_key).",inputs: vec![- optional_string("api_url", "OpenHuman product backend URL (auth/billing/voice). Almost always left blank; the inference URL is a separate `inference_url` field."),- optional_string("inference_url", "Custom OpenAI-compatible LLM endpoint. When set together with `api_key`, inference goes direct to this URL instead of the OpenHuman backend. Pass an empty string to clear."),- optional_string("api_key", "Optional API key for the configured inference endpoint. Pass an empty string to clear a previously stored key."),+ optional_string(+ "api_url",+ "OpenHuman product backend URL (auth/billing/voice). Almost always left blank; the inference URL is a separate `inference_url` field.",+ ),+ optional_string(+ "inference_url",+ "Custom OpenAI-compatible LLM endpoint. When set together with `api_key`, inference goes direct to this URL instead of the OpenHuman backend. Pass an empty string to clear.",+ ),+ optional_string(+ "api_key",+ "Optional API key for the configured inference endpoint. Pass an empty string to clear a previously stored key.",+ ),optional_string("default_model", "Default model id."),FieldSchema {name: "default_temperature",@@ -89,18 +98,39 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {comment: "Optional list of cloud provider entries {id, slug, label, endpoint, auth_style, ca_cert_pem}. The optional PEM CA bundle is trusted only for this provider; an empty string clears it. API keys are stored separately via cloud_provider_set_key. Replaces config.cloud_providers wholesale.",required: false,},- optional_string("primary_cloud", "id of the cloud_providers entry used when a workload routes to 'cloud'. Empty string clears."),- optional_string("chat_provider", "Provider string for direct conversational chat workloads."),- optional_string("reasoning_provider", "Provider string for the main reasoning workload (e.g. 'cloud', 'ollama:llama3.1:8b', 'openai:gpt-4o')."),- optional_string("agentic_provider", "Provider string for sub-agent / tool-loop workloads."),- optional_string("coding_provider", "Provider string for code-generation workloads."),- optional_string("vision_provider", "Provider string for the vision / multimodal workload (managed default: the default model)."),+ optional_string(+ "primary_cloud",+ "id of the cloud_providers entry used when a workload routes to 'cloud'. Empty string clears.",+ ),+ optional_string(+ "chat_provider",+ "Provider string for direct conversational chat workloads.",+ ),+ optional_string(+ "reasoning_provider",+ "Provider string for the main reasoning workload (e.g. 'cloud', 'ollama:llama3.1:8b', 'openai:gpt-4o').",+ ),+ optional_string(+ "agentic_provider",+ "Provider string for sub-agent / tool-loop workloads.",+ ),+ optional_string(+ "coding_provider",+ "Provider string for code-generation workloads.",+ ),+ optional_string(+ "vision_provider",+ "Provider string for the vision / multimodal workload (managed default: the default model).",+ ),optional_string("memory_provider", "Provider string for summarisation."),- optional_string("embeddings_provider", "Provider string for embedding generation."),+ optional_string(+ "embeddings_provider",+ "Provider string for embedding generation.",+ ),],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"update_memory_settings" => Some( ControllerSchema {+ "update_memory_settings" => Some(ControllerSchema {namespace: "config",function: "update_memory_settings",description: "Update the embedding settings and the agent's memory-context window.",@@ -116,7 +146,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"update_runtime_settings" => Some( ControllerSchema {+ "update_runtime_settings" => Some(ControllerSchema {namespace: "config",function: "update_runtime_settings",description: "Update runtime execution strategy settings.",@@ -134,11 +164,10 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"update_local_ai_settings" => Some( ControllerSchema {+ "update_local_ai_settings" => Some(ControllerSchema {namespace: "config",function: "update_local_ai_settings",- description:- "Update the local AI runtime master switch and per-feature usage flags.",+ description: "Update the local AI runtime master switch and per-feature usage flags.",inputs: vec![optional_bool("runtime_enabled",@@ -171,7 +200,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"resolve_api_url" => Some( ControllerSchema {+ "resolve_api_url" => Some(ControllerSchema {namespace: "config",function: "resolve_api_url",description: "Resolve effective API base URL using config/env/default from core.",@@ -183,7 +212,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {required: true,}],}),-"get_runtime_flags" => Some( ControllerSchema {+ "get_runtime_flags" => Some(ControllerSchema {namespace: "config",function: "get_runtime_flags",description: "Read environment-driven runtime flags.",diff --git a/crates/openhuman-core/src/config/schemas/schema_defs/integrations.rs b/crates/openhuman-core/src/config/schemas/schema_defs/integrations.rsindex bba3ac3bfd..04dc220dab 100644--- a/crates/openhuman-core/src/config/schemas/schema_defs/integrations.rs+++ b/crates/openhuman-core/src/config/schemas/schema_defs/integrations.rs@@ -6,7 +6,7 @@ use super::super::helpers::{json_output, optional_bool, optional_string};pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {match function {-"update_search_settings" => Some( ControllerSchema {+ "update_search_settings" => Some(ControllerSchema {namespace: "config",function: "update_search_settings",description: "Update search providers, their routes (managed or own key), per-role provider order, limits, and the web-access allowlist. Keys are write-only.",@@ -29,7 +29,10 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {required: false,},optional_string("presentation", "roles | all_tools | router | one_provider."),- optional_string("presentation_provider", "Provider for one_provider or the router default; empty clears."),+ optional_string(+ "presentation_provider",+ "Provider for one_provider or the router default; empty clears.",+ ),FieldSchema {name: "max_results",ty: TypeSchema::Option(Box::new(TypeSchema::U64)),@@ -57,13 +60,15 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {required: false,},],- outputs: vec![json_output("settings", "Updated search settings (same shape as get_search_settings).")],+ outputs: vec![json_output(+ "settings",+ "Updated search settings (same shape as get_search_settings).",+ )],}),-"get_search_settings" => Some( ControllerSchema {+ "get_search_settings" => Some(ControllerSchema {namespace: "config",function: "get_search_settings",- description:- "Read search settings: each provider's route, key presence and status, the per-role provider order, and which providers serve each role now. Keys are never returned.",+ description: "Read search settings: each provider's route, key presence and status, the per-role provider order, and which providers serve each role now. Keys are never returned.",inputs: vec![],outputs: vec![json_output("settings",diff --git a/crates/openhuman-core/src/config/schemas/schema_defs/workspace.rs b/crates/openhuman-core/src/config/schemas/schema_defs/workspace.rsindex f5effeee05..7ce3160172 100644--- a/crates/openhuman-core/src/config/schemas/schema_defs/workspace.rs+++ b/crates/openhuman-core/src/config/schemas/schema_defs/workspace.rs@@ -6,7 +6,7 @@ use super::super::helpers::{json_output, optional_bool, optional_string};pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {match function {-"workspace_onboarding_flag_exists" => Some( ControllerSchema {+ "workspace_onboarding_flag_exists" => Some(ControllerSchema {namespace: "config",function: "workspace_onboarding_flag_exists",description: "Check if onboarding flag file exists in workspace.",@@ -23,7 +23,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {required: true,}],}),-"workspace_onboarding_flag_set" => Some( ControllerSchema {+ "workspace_onboarding_flag_set" => Some(ControllerSchema {namespace: "config",function: "workspace_onboarding_flag_set",description: "Create or remove the onboarding flag file in workspace.",@@ -48,7 +48,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {required: true,}],}),-"update_analytics_settings" => Some( ControllerSchema {+ "update_analytics_settings" => Some(ControllerSchema {namespace: "config",function: "update_analytics_settings",description: "Enable or disable anonymized analytics and error reporting.",@@ -58,7 +58,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {)],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"update_user_timezone" => Some( ControllerSchema {+ "update_user_timezone" => Some(ControllerSchema {namespace: "config",function: "update_user_timezone",description: "Set the user's IANA time zone; null or blank follows the device.",@@ -68,7 +68,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {)],outputs: vec![json_output("snapshot", "Updated config snapshot.")],}),-"get_user_timezone" => Some( ControllerSchema {+ "get_user_timezone" => Some(ControllerSchema {namespace: "config",function: "get_user_timezone",description: "Read the user's time zone setting, the device's zone, and the one in effect.",@@ -78,7 +78,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {"{ timezone: string | null, device: string | null, effective: string }.",)],}),-"get_analytics_settings" => Some( ControllerSchema {+ "get_analytics_settings" => Some(ControllerSchema {namespace: "config",function: "get_analytics_settings",description: "Read current analytics settings.",@@ -90,7 +90,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {required: true,}],}),-"get_dashboard_settings" => Some( ControllerSchema {+ "get_dashboard_settings" => Some(ControllerSchema {namespace: "config",function: "get_dashboard_settings",description: "Read dashboard settings, including the local architecture diagram viewer.",@@ -102,26 +102,24 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {required: true,}],}),-"agent_server_status" => Some( ControllerSchema {+ "agent_server_status" => Some(ControllerSchema {namespace: "config",function: "agent_server_status",description: "Return agent server runtime URL and status.",inputs: vec![],outputs: vec![json_output("status", "Agent server status payload.")],}),-"reset_local_data" => Some( ControllerSchema {+ "reset_local_data" => Some(ControllerSchema {namespace: "config",function: "reset_local_data",- description:- "Delete local OpenHuman data for the active config/workspace so the next restart boots clean.",+ description: "Delete local OpenHuman data for the active config/workspace so the next restart boots clean.",inputs: vec![],outputs: vec![json_output("result", "Reset result with removed paths.")],}),-"get_data_paths" => Some( ControllerSchema {+ "get_data_paths" => Some(ControllerSchema {namespace: "config",function: "get_data_paths",- description:- "Resolve the OpenHuman data directories (current workspace, default ~/.openhuman, active workspace marker) that reset_local_data would remove. Read-only — performs no filesystem changes.",+ description: "Resolve the OpenHuman data directories (current workspace, default ~/.openhuman, active workspace marker) that reset_local_data would remove. Read-only — performs no filesystem changes.",inputs: vec![optional_string("user_id","Resolve paths for this specific user id (users/<id>) instead of the active-user marker. Clear App Data passes this because it signs the user out — removing the marker — before deleting the data.",@@ -131,39 +129,40 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {"Resolved data paths: current_openhuman_dir, default_openhuman_dir, active_workspace_marker_path.",)],}),-"get_agent_paths" => Some( ControllerSchema {+ "get_agent_paths" => Some(ControllerSchema {namespace: "config",function: "get_agent_paths",- description:- "Resolve the agent's filesystem roots (action_dir, workspace_dir, projects_dir) so the UI can render live values instead of hard-coded strings. Read-only. Also returns `action_dir_env_override: bool` so the UI knows when OPENHUMAN_ACTION_DIR is forcing the value (Settings → action_dir editing disabled in that case).",+ description: "Resolve the agent's filesystem roots (action_dir, workspace_dir, projects_dir) so the UI can render live values instead of hard-coded strings. Read-only. Also returns `action_dir_env_override: bool` so the UI knows when OPENHUMAN_ACTION_DIR is forcing the value (Settings → action_dir editing disabled in that case).",inputs: vec![],outputs: vec![json_output("paths","Resolved agent paths: action_dir (acting-tool CWD), workspace_dir (internal state, agent-blocked), projects_dir (default projects home), action_dir_source (env | override | default), files_dir (where agent deliverables are written), default_files_dir, files_dir_source (override | default).",)],}),-"update_agent_paths" => Some( ControllerSchema {+ "update_agent_paths" => Some(ControllerSchema {namespace: "config",function: "update_agent_paths",- description:- "Update the agent's editable filesystem roots: action_dir (the acting-tool sandbox) and files_dir (the folder agent deliverables are written to; new artifacts only, and it may not sit inside the OpenHuman data folder). The path must be absolute; a missing directory is auto-created; it cannot equal the internal workspace_dir. An empty string clears the override and reverts to the default. Applies to new sessions immediately (live policy hot-swap), no restart. OPENHUMAN_ACTION_DIR still overrides at runtime when set.",- inputs: vec![FieldSchema {- name: "action_dir",- ty: TypeSchema::Option(Box::new(TypeSchema::String)),- comment: "New absolute action sandbox path. Empty string clears the override (revert to default). Omit to leave unchanged.",- required: false,- }, FieldSchema {- name: "files_dir",- ty: TypeSchema::Option(Box::new(TypeSchema::String)),- comment: "New absolute folder for agent deliverables. Empty string clears the override (revert to ~/OpenHuman/projects/Files). Omit to leave unchanged.",- required: false,- }],+ description: "Update the agent's editable filesystem roots: action_dir (the acting-tool sandbox) and files_dir (the folder agent deliverables are written to; new artifacts only, and it may not sit inside the OpenHuman data folder). The path must be absolute; a missing directory is auto-created; it cannot equal the internal workspace_dir. An empty string clears the override and reverts to the default. Applies to new sessions immediately (live policy hot-swap), no restart. OPENHUMAN_ACTION_DIR still overrides at runtime when set.",+ inputs: vec![+ FieldSchema {+ name: "action_dir",+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),+ comment: "New absolute action sandbox path. Empty string clears the override (revert to default). Omit to leave unchanged.",+ required: false,+ },+ FieldSchema {+ name: "files_dir",+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),+ comment: "New absolute folder for agent deliverables. Empty string clears the override (revert to ~/OpenHuman/projects/Files). Omit to leave unchanged.",+ required: false,+ },+ ],outputs: vec![json_output("paths","Updated agent paths (same shape as get_agent_paths): action_dir, workspace_dir, projects_dir, action_dir_source, files_dir, default_files_dir, files_dir_source.",)],}),-"get_onboarding_completed" => Some( ControllerSchema {+ "get_onboarding_completed" => Some(ControllerSchema {namespace: "config",function: "get_onboarding_completed",description: "Read whether the user has completed the onboarding flow.",diff --git a/crates/openhuman-core/src/config/workspace/ops_tests.rs b/crates/openhuman-core/src/config/workspace/ops_tests.rsindex e017c3c905..a6bcd71a56 100644--- a/crates/openhuman-core/src/config/workspace/ops_tests.rs+++ b/crates/openhuman-core/src/config/workspace/ops_tests.rs@@ -1,6 +1,6 @@use super::*;-use crate::config::test_env::EnvVarGuard;use crate::config::TEST_ENV_LOCK as ENV_LOCK;+use crate::config::test_env::EnvVarGuard;use crate::core::runtime::DispatchCtx;use tempfile::tempdir;@@ -105,10 +105,11 @@ async fn init_workspace_creates_dirs_and_files_in_fresh_workspace() {assert!(created.iter().any(|s| s.ends_with("IDENTITY.md")));let logs = value["logs"].as_array().expect("logs array");- assert!(logs.iter().any(|l| l- .as_str()- .unwrap_or("")- .contains("workspace initialization completed")));+ assert!(logs.iter().any(|l| {+ l.as_str()+ .unwrap_or("")+ .contains("workspace initialization completed")+ }));}#[tokio::test]diff --git a/crates/openhuman-core/src/config/workspace/schemas.rs b/crates/openhuman-core/src/config/workspace/schemas.rsindex ab3bed0cf2..9d58fb1082 100644--- a/crates/openhuman-core/src/config/workspace/schemas.rs+++ b/crates/openhuman-core/src/config/workspace/schemas.rs@@ -3,8 +3,8 @@ use serde::de::DeserializeOwned;use serde_json::{Map, Value};use crate::config::workspace::rpc as workspace_rpc;-use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::Outcome;+use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::{ControllerSchema, FieldSchema, TypeSchema};pub fn all_controller_schemas() -> Vec<ControllerSchema> {diff --git a/crates/openhuman-core/src/config/workspace/state.rs b/crates/openhuman-core/src/config/workspace/state.rsindex 32755bf4ec..850ae2b736 100644--- a/crates/openhuman-core/src/config/workspace/state.rs+++ b/crates/openhuman-core/src/config/workspace/state.rs@@ -8,7 +8,7 @@use std::path::{Path, PathBuf};use std::sync::Arc;-use anyhow::{anyhow, Context, Result};+use anyhow::{Context, Result, anyhow};use serde::{Deserialize, Serialize};use serde_json::Value;use sha2::{Digest, Sha256};diff --git a/crates/openhuman-core/src/config/workspace/tools.rs b/crates/openhuman-core/src/config/workspace/tools.rsindex a94071e838..0176fd663e 100644--- a/crates/openhuman-core/src/config/workspace/tools.rs+++ b/crates/openhuman-core/src/config/workspace/tools.rs@@ -11,10 +11,10 @@use std::sync::Arc;use async_trait::async_trait;-use serde_json::{json, Value};+use serde_json::{Value, json};-use crate::config::workspace::{ops, rpc};use crate::config::Config;+use crate::config::workspace::{ops, rpc};use tinytools::{PermissionLevel, Tool, ToolResult};fn req_str(args: &serde_json::Value, key: &str) -> anyhow::Result<String> {diff --git a/crates/openhuman-core/src/config/workspace_handle_tests.rs b/crates/openhuman-core/src/config/workspace_handle_tests.rsindex 15da13d953..885b381f5c 100644--- a/crates/openhuman-core/src/config/workspace_handle_tests.rs+++ b/crates/openhuman-core/src/config/workspace_handle_tests.rs@@ -1,6 +1,6 @@use std::path::{Path, PathBuf};-use super::{workspace_handle, HANDLE_HEX_LEN, HANDLE_PREFIX};+use super::{HANDLE_HEX_LEN, HANDLE_PREFIX, workspace_handle};#[test]fn handle_is_stable_for_the_same_directory() {diff --git a/crates/openhuman-core/src/core/cli.rs b/crates/openhuman-core/src/core/cli.rsindex 97c9318098..d7b8431134 100644--- a/crates/openhuman-core/src/core/cli.rs+++ b/crates/openhuman-core/src/core/cli.rs@@ -480,7 +480,7 @@ fn run_call_command(args: &[String]) -> Result<()> {let value = rt.block_on(async {let headless_agent_chat = crate::core::legacy_aliases::resolve_legacy(&method)- == crate::inference::INFERENCE_AGENT_CHAT;+ == crate::agent_runs::INFERENCE_AGENT_CHAT;if headless_agent_chat {let config = crate::config::Config::load_or_init().awaitdiff --git a/crates/openhuman-core/src/cron/scheduler_headless_descendants_tests.rs b/crates/openhuman-core/src/cron/scheduler_headless_descendants_tests.rsindex f424a09b93..fc6cc424d3 100644--- a/crates/openhuman-core/src/cron/scheduler_headless_descendants_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_headless_descendants_tests.rs@@ -320,7 +320,7 @@ async fn scheduled_agent_timeout_cancels_its_blocked_child_before_history_settleNone,);let registry = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&inspect_dispatch);let jobs = registry.try_list_owned(owner.as_str())@@ -439,7 +439,7 @@ async fn scheduled_cron_child_cannot_run_its_declared_destructive_tool() {None,);let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&inspect_dispatch).try_list_owned(owner).expect("inspect the exact Cron session owner");diff --git a/crates/openhuman-core/src/flows/caps_host/agent_tests.rs b/crates/openhuman-core/src/flows/caps_host/agent_tests.rsindex 330197fe55..8628ac3b50 100644--- a/crates/openhuman-core/src/flows/caps_host/agent_tests.rs+++ b/crates/openhuman-core/src/flows/caps_host/agent_tests.rs@@ -242,7 +242,7 @@ async fn headless_flow_agent_includes_nested_grandchild_result() {let output = run.await.expect("flow runner task");let output = output.expect("headless flow agent should settle its child");let snapshots = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&crate::core::runtime::DispatchCtx::new(jobs_core)).list();@@ -560,7 +560,7 @@ async fn headless_child_at_depth_cap_gets_readable_spawn_refusal() {tokio::time::timeout(std::time::Duration::from_secs(15), child_started_rx).await;if child_started.is_err() {let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&dispatch).list();eprintln!(@@ -602,7 +602,7 @@ async fn headless_child_at_depth_cap_gets_readable_spawn_refusal() {.expect("headless root task").expect("root completion");let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&dispatch).list();let worker_job = jobsdiff --git a/crates/openhuman-core/src/inference/provider/factory.rs b/crates/openhuman-core/src/inference/provider/factory.rsindex 68022d2b3c..2b06f763a4 100644--- a/crates/openhuman-core/src/inference/provider/factory.rs+++ b/crates/openhuman-core/src/inference/provider/factory.rs@@ -22,13 +22,13 @@ mod managed_backend;mod routing;mod subprocess_providers;+pub(crate) use chat_model::{OpenHumanModelFactory, resolves_to_managed_backend};pub use chat_model::{create_chat_model_from_string, create_chat_model_from_string_with_model_id,create_chat_model_in, create_chat_model_with_model_id_in, probe_inference_readiness,};-pub(crate) use chat_model::{resolves_to_managed_backend, OpenHumanModelFactory};pub(crate) use cloud_slug::resolve_cloud_slug_for;-pub(crate) use cloud_spec::{cloud_provider_spec, CloudCredentialResolver};+pub(crate) use cloud_spec::{CloudCredentialResolver, cloud_provider_spec};pub use credentials::{auth_key_for_slug, lookup_key_for_slug};pub(crate) use credentials::{openai_bearer_is_oauth, redact_endpoint_origin, resolve_codex_routing,@@ -39,16 +39,14 @@ pub(crate) use inspection::{};pub(crate) use local_runtime::create_local_chat_model_from_string;pub(crate) use routing::fallback_diagnostics_for_role;+pub(crate) use routing::{ConfigRouteSource, workload_router};pub use routing::{provider_for_role, role_bypasses_managed_credits};-pub(crate) use routing::{workload_router, ConfigRouteSource};// Factory-internal helpers shared across the implementation modules.use access_gates::{emit_inference_egress, enforce_local_only_inference};#[cfg(test)]use cloud_slug::try_create_cloud_slug_chat_model;-pub(crate) use managed_backend::{- make_openhuman_backend_model_for_options, make_openhuman_backend_model_for_thread_in,-};+pub(crate) use managed_backend::make_openhuman_backend_model_for_thread_in;use tinyinference_providers::route::split_model_and_temperature;/// Test-only seam: inject a mock [`ChatModel`] so e2e tests can drive the@@ -70,8 +68,8 @@ pub mod test_provider_override;#[path = "factory_tests.rs"]mod factory_tests;-use crate::config::schema::cloud_providers::AuthStyle;use crate::config::Config;+use crate::config::schema::cloud_providers::AuthStyle;use crate::security::egress::EgressLedger;use std::sync::Arc;use tinyinference_llm::model::ChatModel;diff --git a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs b/crates/openhuman-core/src/inference/provider/factory/chat_model.rsindex 2e740cb59c..1ec02ce53d 100644--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs@@ -4,6 +4,8 @@#[cfg(any(test, feature = "e2e-test-support", feature = "rss-bench"))]use super::test_provider_override;use super::{+ BYOK_INCOMPLETE_SENTINEL, CLAUDE_AGENT_SDK_PREFIX, CLAUDE_AGENT_SDK_PROVIDER,+ PROVIDER_OPENHUMAN,access_gates::{emit_inference_egress, enforce_local_only_inference},cloud_slug::{resolve_cloud_slug_for, resolve_cloud_slug_with_access,@@ -13,11 +15,9 @@ use super::{local_runtime::try_create_local_runtime_chat_model_from_string,provider_for_role,subprocess_providers::OpenHumanMcpEndpoint,- BYOK_INCOMPLETE_SENTINEL, CLAUDE_AGENT_SDK_PREFIX, CLAUDE_AGENT_SDK_PROVIDER,- PROVIDER_OPENHUMAN,};-use crate::config::ops::resolve_primary_cloud_provider_string;use crate::config::Config;+use crate::config::ops::resolve_primary_cloud_provider_string;use crate::core::runtime::DispatchCtx;use crate::security::egress::EgressLedger;use std::sync::Arc;diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rsindex e29d4a46e0..50818beda2 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs@@ -2,15 +2,15 @@//! abstract-tier remapping, credentials, codex routing) and the crate-native builders.use super::{+ BYOK_INCOMPLETE_SENTINEL, CLAUDE_AGENT_SDK_PREFIX, CLAUDE_AGENT_SDK_PROVIDER,+ InspectionOutputBudgetCapability, PROVIDER_OPENHUMAN,access_gates::enforce_local_only_inference, cloud_spec, credentials::CredentialAccess,local_runtime::OptionalChatModelResult, managed_backend::managed_chat_model_for,openai_bearer_is_oauth, provider_for_role, redact_endpoint_origin, resolve_codex_routing,- InspectionOutputBudgetCapability, BYOK_INCOMPLETE_SENTINEL, CLAUDE_AGENT_SDK_PREFIX,- CLAUDE_AGENT_SDK_PROVIDER, PROVIDER_OPENHUMAN,};+use crate::config::Config;use crate::config::ops::resolve_primary_cloud_provider_string;use crate::config::schema::cloud_providers::AuthStyle;-use crate::config::Config;#[cfg(not(test))]use crate::inference::provider::factory::access_gates::verify_backend_session_active;#[cfg(not(test))]@@ -22,8 +22,8 @@ use std::sync::Arc;use tinyinference_llm::model::ChatModel;use tinyinference_llm::providers::anthropic::endpoint_is_anthropic_messages;use tinyinference_llm::providers::openai::codex::{- openai_codex_client_version, openai_codex_user_agent, OPENAI_CODEX_ACCOUNT_HEADER,- OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,+ OPENAI_CODEX_ACCOUNT_HEADER, OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,+ openai_codex_client_version, openai_codex_user_agent,};use tinyinference_llm::providers::registry::resolve_slug_model;use tinyinference_providers::route::split_model_and_temperature;diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_spec.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_spec.rsindex 15af5e2e6d..7d65d86e5b 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_spec.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_spec.rs@@ -9,8 +9,8 @@//! provider with a custom CA bundle.use super::*;-use tinyinference_llm::providers::openai::codex::OpenAiCodexRouting;use tinyinference_llm::providers::openai::AuthStyle as CompatAuthStyle;+use tinyinference_llm::providers::openai::codex::OpenAiCodexRouting;use tinyinference_llm::providers::registry::{ProviderBuildOptions, ProviderRegistry};use tinyinference_llm::{ProviderKind, ProviderSpec};diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rsindex e77502eb88..4abd9bcca4 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs@@ -78,10 +78,12 @@ fn discovery_request_carries_bearer_auth_and_pins_openrouter_sorting() {let request =cloud_discovery_request(&build(&creds, "m", "sk-or")).expect("openrouter has a listing");assert_eq!(request.endpoint, "https://openrouter.ai/api/v1");- assert!(request- .headers- .iter()- .any(|(name, value)| name == "Authorization" && value == "Bearer sk-or"));+ assert!(+ request+ .headers+ .iter()+ .any(|(name, value)| name == "Authorization" && value == "Bearer sk-or")+ );}#[test]diff --git a/crates/openhuman-core/src/inference/provider/factory/inspection.rs b/crates/openhuman-core/src/inference/provider/factory/inspection.rsindex c6dae846c3..0638032f7d 100644--- a/crates/openhuman-core/src/inference/provider/factory/inspection.rs+++ b/crates/openhuman-core/src/inference/provider/factory/inspection.rs@@ -1,6 +1,7 @@//! Read-only provider preparation for doctor inspections.use super::{+ InspectionOutputBudgetCapability, InspectionRequestIdentity, PreparedInspectionChatModel,chat_model::{resolves_to_managed_backend, unresolved_chat_model_error_for_access,with_default_temperature,@@ -14,10 +15,9 @@ use super::{try_create_claude_agent_sdk_chat_model_for_inspection,try_create_claude_code_chat_model_for_inspection,},- InspectionOutputBudgetCapability, InspectionRequestIdentity, PreparedInspectionChatModel,};-use crate::config::resolve_primary_cloud_provider_string;use crate::config::Config;+use crate::config::resolve_primary_cloud_provider_string;use crate::core::runtime::DispatchCtx;use crate::security::egress::EgressLedger;use std::sync::Arc;diff --git a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rsindex 370e5bb93f..a9772a3d86 100644--- a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs+++ b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs@@ -3,8 +3,8 @@use super::*;use crate::inference::provider::factory::access_gates::verify_provider_session;-use tinyinference_llm::providers::openai::build_local_runtime_chat_model;use tinyinference_llm::providers::openai::AuthStyle as CompatAuthStyle;+use tinyinference_llm::providers::openai::build_local_runtime_chat_model;/// Local OpenAI-compatible runtimes (Ollama / LM Studio / MLX / OMLX //// local-openai) as a crate-native [`ChatModel`] (issue #4727).@@ -79,7 +79,7 @@ fn try_create_local_runtime_chat_model_from_string_with_identity(inspection_identity: Option<&mut Option<(String, String, String)>>,) -> OptionalChatModelResult {use tinyinference_local::local_runtime::{- resolve_local_runtime, LocalRuntimeAuth, LocalRuntimeInputs,+ LocalRuntimeAuth, LocalRuntimeInputs, resolve_local_runtime,};// Use the same classifier as privacy and session policy. Canonicalize onlydiff --git a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rsindex f7a52b066d..16cc9b400e 100644--- a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs+++ b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs@@ -218,33 +218,3 @@ pub(crate) fn make_openhuman_backend_model_in(&EgressLedger::none(),)}--/// The managed model for a caller that holds runtime options rather than a-/// [`Config`] (the configured `delegate` tool): `model` is used verbatim, with-/// no tier translation and no egress emission, exactly as that tool always did.-pub(crate) fn make_openhuman_backend_model_for_options(- options: &crate::tools::delegate::ProviderRuntimeOptions,- model: &str,- thread_id: Option<&str>,-) -> anyhow::Result<ManagedChatModel> {- let overrides = crate::inference::registry::ambient_provider_overrides();- let Some(entry) = overrides.chat_entry(PROVIDER_OPENHUMAN) else {- return Err(managed_unavailable_error());- };- let mut config = Config::default();- if let Some(dir) = options.openhuman_dir.as_ref() {- config.config_path = dir.join("config.toml");- }- config.secrets.encrypt = options.secrets_encrypt;- let egress = EgressLedger::none();- let context = crate::inference::registry::ProviderContext::new(&config, &egress);- let request = tinyinference_llm::providers::overrides::ChatModelRequest {- role: "delegate",- model_override: Some(model),- default_model: Some(model),- native_tool_calling: true,- thread_id,- context: &context,- };- Ok((entry.build)(&request)?)-}diff --git a/crates/openhuman-core/src/inference/provider/factory/routing_tests.rs b/crates/openhuman-core/src/inference/provider/factory/routing_tests.rsindex 109b68a11d..a871a5d70e 100644--- a/crates/openhuman-core/src/inference/provider/factory/routing_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory/routing_tests.rs@@ -1,6 +1,6 @@use super::*;-use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};use crate::config::Config;+use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};use crate::inference::provider::factory::resolves_to_managed_backend;fn byok_openai_compatible_entry() -> CloudProviderCreds {diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rsindex 03a57b3bfa..0be74bcf34 100644--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs@@ -1,8 +1,8 @@+use super::super::super::OpenHumanModelFactory;use super::super::super::cloud_slug::{try_create_cloud_slug_chat_model, try_create_cloud_slug_chat_model_from_string,try_create_cloud_slug_chat_model_from_string_with_native_tools,};-use super::super::super::OpenHumanModelFactory;use super::super::{anthropic_entry, deepseek_entry, install_test_managed_provider, oh_entry, openai_entry,};@@ -148,9 +148,11 @@ fn create_chat_model_routes_anthropic_auth_cloud_slug_to_crate_native() {identity.starts_with("anthropic:https://api.anthropic.com/v1:claude-sonnet-4-6"),"expected the native Messages adapter, got identity {identity}");- assert!(model- .profile()- .is_some_and(|p| p.tool_calling && p.streaming));+ assert!(+ model+ .profile()+ .is_some_and(|p| p.tool_calling && p.streaming)+ );}/// Text mode (prompt-guided tools) is only implemented on the Chat Completionsdiff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rsindex e537d2f839..6f4cc8586f 100644--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs@@ -135,9 +135,11 @@ fn enforce_local_only_inference_errors_on_external_when_local_only() {Err(error) => error,Ok(_) => panic!("direct Claude Code model must preserve the privacy gate"),};- assert!(claude_code_error- .to_string()- .contains("Local-only privacy mode"));+ assert!(+ claude_code_error+ .to_string()+ .contains("Local-only privacy mode")+ );// Both the default factory and a thread-attached managed picker route must// hit the managed resolver's privacy gate before any backend client exists.@@ -373,23 +375,27 @@ fn explicit_local_provider_string_routes_to_crate_native_model() {fn try_create_local_runtime_returns_none_for_managed_and_cloud() {let _guard = crate::inference::inference_test_guard();// Default config resolves to the managed backend, not a local runtime.- assert!(super::local_runtime::try_create_local_runtime_chat_model(- "chat",- &Config::default(),- &EgressLedger::none(),- )- .is_none());+ assert!(+ super::local_runtime::try_create_local_runtime_chat_model(+ "chat",+ &Config::default(),+ &EgressLedger::none(),+ )+ .is_none()+ );// A BYOK cloud slug is not a local runtime either — it falls through to the// `Provider` path.let mut cloud = Config::default();cloud.cloud_providers.push(openai_entry("p_oai", "openai"));cloud.chat_provider = Some("openai:gpt-4o-mini".to_string());- assert!(super::local_runtime::try_create_local_runtime_chat_model(- "chat",- &cloud,- &EgressLedger::none(),- )- .is_none());+ assert!(+ super::local_runtime::try_create_local_runtime_chat_model(+ "chat",+ &cloud,+ &EgressLedger::none(),+ )+ .is_none()+ );}#[test]@@ -473,9 +479,11 @@ fn create_chat_model_routes_anthropic_auth_cloud_slug_to_crate_native() {identity.starts_with("anthropic:https://api.anthropic.com/v1:claude-sonnet-4-6"),"expected the native Messages adapter, got identity {identity}");- assert!(model- .profile()- .is_some_and(|p| p.tool_calling && p.streaming));+ assert!(+ model+ .profile()+ .is_some_and(|p| p.tool_calling && p.streaming)+ );}/// Text mode (prompt-guided tools) is only implemented on the Chat Completionsdiff --git a/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs b/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rsindex dfe26a72b1..63b61e4422 100644--- a/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_explicit_ctx_tests.rs@@ -8,8 +8,8 @@ async fn managed_factory_and_probe_use_the_explicit_provider_entry() {use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};use crate::core::slots::Extensions;use crate::inference::registry::ProviderContext;- use std::sync::atomic::{AtomicBool, Ordering};use std::sync::Arc;+ use std::sync::atomic::{AtomicBool, Ordering};use tinyinference_llm::message::Message;use tinyinference_llm::model::ModelRequest;@@ -132,11 +132,11 @@ async fn managed_factory_and_probe_use_the_explicit_provider_entry() {#[tokio::test]async fn hosted_cloud_slug_uses_explicit_auth_policy_and_model_entry() {use crate::config::schema::cloud_providers::{- register_hosted_cloud_provider_policy_in, AuthStyle, CloudProviderCreds,+ AuthStyle, CloudProviderCreds, register_hosted_cloud_provider_policy_in,};use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};use crate::core::slots::Extensions;- use crate::inference::registry::{register_catalog_in, ProviderContext};+ use crate::inference::registry::{ProviderContext, register_catalog_in};use std::sync::Arc;use tinyinference_llm::message::Message;use tinyinference_llm::model::ModelRequest;diff --git a/crates/openhuman-core/src/inference/provider/factory_tests.rs b/crates/openhuman-core/src/inference/provider/factory_tests.rsindex b0f0358172..25806f7f31 100644--- a/crates/openhuman-core/src/inference/provider/factory_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_tests.rs@@ -1,6 +1,6 @@use super::*;-use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};use crate::config::Config;+use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};use crate::security::credentials::AuthService;use tempfile::TempDir;use wiremock::matchers::{method, path};@@ -403,11 +403,13 @@ async fn inspection_construction_does_not_refresh_unselected_expired_codex_oauth).expect("named OAuth profile is readable without refreshing").expect("expired OAuth profile exists");- assert!(oauth- .token_set- .as_ref()- .and_then(|token_set| token_set.expires_at)- .is_some_and(|expires_at| expires_at < Utc::now()));+ assert!(+ oauth+ .token_set+ .as_ref()+ .and_then(|token_set| token_set.expires_at)+ .is_some_and(|expires_at| expires_at < Utc::now())+ );let selected_codex_credential =super::credentials::lookup_key_for_slug_read_only("openai", &config).expect("read selected OpenAI API-key credential");@@ -479,11 +481,13 @@ async fn inspection_construction_does_not_refresh_unselected_expired_codex_oauthSome("expired-oauth-access-token"),"inspection must not replace an expired token with a refreshed one");- assert!(oauth_after- .token_set- .as_ref()- .and_then(|token_set| token_set.expires_at)- .is_some_and(|expires_at| expires_at < Utc::now()));+ assert!(+ oauth_after+ .token_set+ .as_ref()+ .and_then(|token_set| token_set.expires_at)+ .is_some_and(|expires_at| expires_at < Utc::now())+ );}#[tokio::test(flavor = "multi_thread")]@@ -593,7 +597,7 @@ fn deepseek_entry(id: &str) -> CloudProviderCreds {/// A config carrying a resolved model, as `agent_chat` leaves it after applying/// `model_override` and before building the agent.fn routed_config(endpoint: &str, api_key: &str, model: &str) -> Config {- use crate::config::schema::ephemeral_route::{apply, EphemeralRoute};+ use crate::config::schema::ephemeral_route::{EphemeralRoute, apply};let mut config = Config {default_model: Some(model.to_string()),..Config::default()diff --git a/crates/openhuman-core/src/inference/provider_model_tests.rs b/crates/openhuman-core/src/inference/provider_model_tests.rsindex f4a032b0c9..5d6cddd054 100644--- a/crates/openhuman-core/src/inference/provider_model_tests.rs+++ b/crates/openhuman-core/src/inference/provider_model_tests.rs@@ -224,7 +224,7 @@ fn registered_model_defaults_and_aliases_are_context_scoped() {fn native_provider_metadata_resolves_by_context_and_preserves_request_fields() {use crate::core::slots::Extensions;use crate::inference::registry::{- register_chat_model, register_chat_model_in, unregister_chat_model, ProviderContext,+ ProviderContext, register_chat_model, register_chat_model_in, unregister_chat_model,};use serde_json::json;use std::sync::Arc;@@ -394,60 +394,10 @@ fn native_provider_metadata_resolves_by_context_and_preserves_request_fields() {unregister_chat_model(provider);}-#[test]-fn managed_options_builder_uses_the_ambient_native_provider_entry() {- use crate::core::slots::Extensions;- use crate::inference::registry::{- register_chat_model_in, unregister_chat_model, ProviderContext,- };- use std::sync::Arc;-- let _guard = crate::inference::inference_test_guard();- let _exclusive = crate::inference::provider::factory::test_provider_override::exclusive();- let provider = crate::inference::provider::factory::PROVIDER_OPENHUMAN;- unregister_chat_model(provider);- let extensions = Extensions::new();- register_chat_model_in(- &extensions,- provider,- ChatModelEntry::<ProviderContext> {- build: Arc::new(|request| {- Ok((- Arc::new(tinyagents_harness::testkit::ScriptedModel::replies(vec![- "ambient",- ])),- request- .model_override- .unwrap_or("ambient/model")- .to_string(),- ))- }),- probe: None,- models: None,- },- );- let context = crate::core::runtime::CoreContext::for_test_with_extensions(- crate::core::runtime::DomainSet::full(),- None,- extensions,- );- let built = crate::core::runtime::CoreContext::sync_scope(context, || {- crate::inference::provider::factory::make_openhuman_backend_model_for_options(- &crate::tools::delegate::ProviderRuntimeOptions::default(),- "ambient/pinned",- None,- )- });- assert_eq!(- built.expect("ambient registration must be visible").1,- "ambient/pinned"- );-}-#[test]fn managed_builder_uses_the_entry_selected_before_metadata_resolution() {use crate::core::slots::Extensions;- use crate::inference::registry::{register_chat_model_in, ProviderContext};+ use crate::inference::registry::{ProviderContext, register_chat_model_in};use std::sync::Arc;let _guard = crate::inference::inference_test_guard();diff --git a/crates/openhuman-core/src/inference/turn_models_native_tests.rs b/crates/openhuman-core/src/inference/turn_models_native_tests.rsindex ad79113bf9..ebeccb69ca 100644--- a/crates/openhuman-core/src/inference/turn_models_native_tests.rs+++ b/crates/openhuman-core/src/inference/turn_models_native_tests.rs@@ -49,9 +49,10 @@ async fn native_turn_factory_applies_default_temperature_and_preserves_explicit_}#[tokio::test]async fn native_budget_wrapping_keeps_owner_error_slots_for_primary_tiers_and_summary() {- use crate::agent::tinyagents::budget::{CallBudget, ModelBudget, SpendLimits};+ use crate::agent::tinyagents::budget::{CallBudget, SpendLimits};use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};use crate::core::slots::Extensions;+ use tinyagents_harness::cost::ModelBudget;let _guard = crate::inference::inference_test_guard_async().await;let extensions = Extensions::new();@@ -69,17 +70,17 @@ async fn native_budget_wrapping_keeps_owner_error_slots_for_primary_tiers_and_sulet ctx = DispatchCtx::new(context.clone());let tmp = tempfile::tempdir().expect("isolated workspace");let config = Arc::new(managed_fixture_config(&tmp));- let budget = ModelBudget {- ledger: tinyinference_llm::model::budget::Budget::new(SpendLimits {+ let budget = ModelBudget::new(+ tinyinference_llm::model::budget::Budget::new(SpendLimits {tokens: Some(0),cost_micros: None,}),- call: CallBudget {+ CallBudget {input_tokens: 10_000,output_tokens: 1,cost_micros: 1,},- };+ );let models = TurnModelSource::new_crate_native(&ctx, "chat", config).build("hint:chat", 0.0, None, None).expect("native model set")diff --git a/crates/openhuman-core/src/media/generation/artifact_tool.rs b/crates/openhuman-core/src/media/generation/artifact_tool.rsindex 2b1ba5c3f7..1bf5a418f8 100644--- a/crates/openhuman-core/src/media/generation/artifact_tool.rs+++ b/crates/openhuman-core/src/media/generation/artifact_tool.rs@@ -9,15 +9,19 @@ use std::sync::{Arc, RwLock};use async_trait::async_trait;use futures_util::StreamExt;-use serde_json::{json, Value};+use serde_json::{Value, json};+use tinyagents_harness_tools::media::{+ ArtifactFiling, FiledArtifact, GeneratedArtifact, MediaArtifactKind, MediaInnerFactory,+ MediaJobProgress, MediaProgressFn,+};use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolCategory, ToolPolicy, ToolResult, ToolRunContext,ToolScope, ToolTimeout,};use tokio::io::AsyncWriteExt;-use crate::artifacts::production::Production;use crate::artifacts::ArtifactKind;+use crate::artifacts::production::Production;use crate::security::approval::ApprovalChatContext;use crate::tools::host_extensions::tool_call_id;use tinyagents_harness::tinyinference_video::ProgressFn;@@ -83,8 +87,11 @@ impl<T: Tool + 'static> MediaArtifactTool<T> {/// Reads generated outputs addressed by blob key from the media tool's/// backing store.#[must_use]- pub fn with_blobs(mut self, blobs: Arc<dyn BlobStore>) -> Self {- self.blobs = Some(blobs);+ pub fn with_blobs(self, blobs: Arc<dyn BlobStore>) -> Self {+ self.policy+ .write()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+ .blobs = Some(blobs);self}@@ -111,25 +118,15 @@ impl<T: Tool + 'static> MediaArtifactTool<T> {refresh_allowed_references(&policy).await}- async fn complete_and_discard_blob(- &self,- production: &Production,- source: &Path,- ) -> Result<u64, String> {- OpenHumanArtifactFiling(Arc::clone(&self.policy))- .complete_and_discard_blob(production, source)- .await- }-/// Builds the inner generator for one call around its provider progress/// observer and the call's own host context.#[must_use]pub fn with_per_call_inner(self,build: impl for<'a> Fn(MediaProgressFn, Option<&'a dyn ToolRunContext>) -> T- + Send- + Sync- + 'static,+ + Send+ + Sync+ + 'static,) -> Self {let Self {inner,@@ -151,69 +148,6 @@ impl<T: Tool + 'static> MediaArtifactTool<T> {allowed_references,}}-- async fn file_blob(&self, key: &Path, dest: &Path) -> Result<u64, String> {- let key = key- .to_str()- .ok_or_else(|| "generated media blob key is not valid UTF-8".to_string())?;- let blobs = self.blobs.as_ref().ok_or_else(|| {- format!("generated media returned blob key {key:?} without a blob store")- })?;- let mut blob = blobs- .get_stream(key)- .await- .map_err(|error| format!("failed to read generated media blob {key:?}: {error}"))?- .ok_or_else(|| format!("generated media blob {key:?} was not found"))?;- copy_blob_to_file(&mut blob.reader, dest, key).await- }-}--async fn copy_blob_to_file(- reader: &mut tinyagents_storage_kit::blob::BlobReader,- dest: &Path,- key: &str,-) -> Result<u64, String> {- let mut file = tokio::fs::OpenOptions::new()- .write(true)- .truncate(true)- .open(dest)- .await- .map_err(|error| {- format!(- "failed to open artifact destination {}: {error}",- dest.display()- )- })?;- let mut size = 0_u64;- while let Some(chunk) = reader.next().await {- let chunk = match chunk {- Ok(chunk) => chunk,- Err(error) => {- drop(file);- let _ = tokio::fs::remove_file(dest).await;- return Err(format!(- "failed to copy generated media blob {key:?}: {error}"- ));- }- };- if let Err(error) = file.write_all(&chunk).await {- drop(file);- let _ = tokio::fs::remove_file(dest).await;- return Err(format!(- "failed to write generated media blob {key:?}: {error}"- ));- }- size = size.saturating_add(chunk.len() as u64);- }- if let Err(error) = file.flush().await {- drop(file);- let _ = tokio::fs::remove_file(dest).await;- return Err(format!(- "failed to flush artifact destination {}: {error}",- dest.display()- ));- }- Ok(size)}fn set_artifact_error(entry: &mut Value, message: &str) {@@ -460,8 +394,56 @@ impl OpenHumanArtifactFiling {.await.map_err(|error| format!("failed to read generated media blob {key:?}: {error}"))?.ok_or_else(|| format!("generated media blob {key:?} was not found"))?;- copy_blob_to_file(&mut *blob.reader, destination, key).await+ copy_blob_to_file(&mut blob.reader, destination, key).await+ }+}++async fn copy_blob_to_file(+ reader: &mut tinyagents_storage_kit::blob::BlobReader,+ destination: &Path,+ key: &str,+) -> Result<u64, String> {+ let mut file = tokio::fs::OpenOptions::new()+ .write(true)+ .truncate(true)+ .open(destination)+ .await+ .map_err(|error| {+ format!(+ "failed to open artifact destination {}: {error}",+ destination.display()+ )+ })?;+ let mut size = 0_u64;+ while let Some(chunk) = reader.next().await {+ let chunk = match chunk {+ Ok(chunk) => chunk,+ Err(error) => {+ drop(file);+ let _ = tokio::fs::remove_file(destination).await;+ return Err(format!(+ "failed to copy generated media blob {key:?}: {error}"+ ));+ }+ };+ if let Err(error) = file.write_all(&chunk).await {+ drop(file);+ let _ = tokio::fs::remove_file(destination).await;+ return Err(format!(+ "failed to write generated media blob {key:?}: {error}"+ ));+ }+ size = size.saturating_add(chunk.len() as u64);}+ if let Err(error) = file.flush().await {+ drop(file);+ let _ = tokio::fs::remove_file(destination).await;+ return Err(format!(+ "failed to flush artifact destination {}: {error}",+ destination.display()+ ));+ }+ Ok(size)}/// Host policy wrapper that refreshes the allowlist before a generated-media@@ -650,62 +632,6 @@ fn has_reusable_files_reference(args: &Value, files: &crate::artifacts::FileRoot})}-async fn copy_blob_to_file<R>(reader: &mut R, destination: &Path, key: &str) -> Result<u64, String>-where- R: tokio::io::AsyncRead + Unpin + ?Sized,-{- let mut file = tokio::fs::OpenOptions::new()- .write(true)- .truncate(true)- .open(destination)- .await- .map_err(|error| {- format!(- "failed to open artifact destination {}: {error}",- destination.display()- )- })?;- let size = match tokio::io::copy(reader, &mut file).await {- Ok(size) => size,- Err(error) => {- drop(file);- let _ = tokio::fs::remove_file(destination).await;- return Err(format!(- "failed to copy generated media blob {key:?}: {error}"- ));- }- };- if let Err(error) = file.flush().await {- drop(file);- let _ = tokio::fs::remove_file(destination).await;- return Err(format!(- "failed to flush artifact destination {}: {error}",- destination.display()- ));- }- Ok(size)-}--/// Moves a generated file into the Files folder, copying across mounts.-async fn move_or_copy(source: &Path, destination: &Path) -> Result<u64, String> {- if tokio::fs::rename(source, destination).await.is_err() {- tokio::fs::copy(source, destination)- .await- .map_err(|error| {- format!(- "failed to copy {} -> {}: {error}",- source.display(),- destination.display()- )- })?;- let _ = tokio::fs::remove_file(source).await;- }- let stat = tokio::fs::metadata(destination)- .await- .map_err(|error| format!("failed to stat {}: {error}", destination.display()))?;- Ok(stat.len())-}-#[cfg(test)]#[path = "artifact_tool_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs b/crates/openhuman-core/src/media/generation/artifact_tool_tests.rsindex 17b7494f19..169829956f 100644--- a/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs+++ b/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs@@ -1,12 +1,15 @@use async_trait::async_trait;-use serde_json::{json, Value};+use serde_json::{Value, json};use std::path::Path;use std::sync::Arc;use tinyagents_harness::media::MediaOutput;+use tinyagents_harness_tools::media::MediaJobProgress;use tinystoragedrivers_api::BlobStore;use tinytools::{PermissionLevel, Tool, ToolCategory, ToolContent, ToolResult};-use super::{copy_blob_to_file, has_reusable_files_reference, MediaArtifactTool};+use super::{+ MediaArtifactTool, OpenHumanArtifactFiling, copy_blob_to_file, has_reusable_files_reference,+};use crate::artifacts::{ArtifactKind, ArtifactStatus, FileRoots};#[test]@@ -62,10 +65,11 @@ async fn artifact_history_refresh_failure_fails_closed_for_cached_files() {.with_reference_allowlist(Arc::clone(&allowed));assert!(allowed.lock().unwrap().contains(&replacement));- assert!(tool- .execute(json!({ "references": [replacement.to_string_lossy()] }))- .await- .is_err());+ assert!(+ tool.execute(json!({ "references": [replacement.to_string_lossy()] }))+ .await+ .is_err()+ );}/// A minimal stand-in for `GenerateImageTool` / `GenerateVideoTool`: writes@@ -207,11 +211,13 @@ async fn files_a_blob_backed_generated_artifact() {Some(format!("Saved image at {}\nCost: $0.01", canonical_file.display()).as_str()));assert_eq!(std::fs::read(&file).unwrap(), b"blob-media-bytes");- assert!(blobs- .get("generated-media/stub-0.png")- .await- .unwrap()- .is_none());+ assert!(+ blobs+ .get("generated-media/stub-0.png")+ .await+ .unwrap()+ .is_none()+ );let (_, failed_file) = crate::artifacts::create_artifact_for_call(&workspace,@@ -274,13 +280,15 @@ async fn files_a_blob_backed_generated_artifact() {"failed regeneration retains the previous non-empty file");fresh.refresh_allowed_references().await.unwrap();- assert!(!fresh- .allowed_references- .as_ref()- .unwrap()- .lock()- .unwrap()- .contains(&canonical_file));+ assert!(+ !fresh+ .allowed_references+ .as_ref()+ .unwrap()+ .lock()+ .unwrap()+ .contains(&canonical_file)+ );}#[tokio::test]@@ -341,7 +349,8 @@ async fn keeps_source_blob_when_artifact_finalization_fails() {.await.unwrap();let _ = std::fs::remove_file(production.path());- let error = tool+ let filing = OpenHumanArtifactFiling(Arc::clone(&tool.policy));+ let error = filing.complete_and_discard_blob(&production, Path::new(key)).await.unwrap_err();@@ -423,10 +432,11 @@ async fn files_every_artifact_when_n_greater_than_one() {.await.expect("artifact metadata is persisted");assert_eq!(meta.status, ArtifactStatus::Ready);- assert!(meta- .file- .as_deref()- .is_some_and(|file| std::path::Path::new(file).exists()));+ assert!(+ meta.file+ .as_deref()+ .is_some_and(|file| std::path::Path::new(file).exists())+ );}}diff --git a/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs b/crates/openhuman-core/src/skills/e2e_plumbing_tests.rsindex 206d458f7f..019a22e988 100644--- a/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs+++ b/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs@@ -27,10 +27,10 @@ use std::time::Duration;use async_trait::async_trait;use parking_lot::Mutex;-use crate::channels::runtime::turn_driver::run_channel_turn;+use crate::channels::run_channel_turn;use crate::config::{Config, MultimodalConfig, MultimodalFileConfig};use crate::skills::ops_create::{- create_workflow_inner, CreateWorkflowParams, WorkflowCreateInputDef,+ CreateWorkflowParams, WorkflowCreateInputDef, create_workflow_inner,};use crate::skills::registry::get_workflow;use crate::skills::run_log;diff --git a/crates/openhuman-core/src/storage/schema.rs b/crates/openhuman-core/src/storage/schema.rsindex 976851098d..742c8c025b 100644--- a/crates/openhuman-core/src/storage/schema.rs+++ b/crates/openhuman-core/src/storage/schema.rs@@ -37,8 +37,10 @@ fn declared_collections() -> Vec<CollectionOwner> {"tinyagents-session",tinyagents_session::port::collections(),),- owner("tinyagents-graph", tinyagents_graph::storage::collections()),- owner("tinyagents-tasks", tinyagents_tasks::collections()),+ owner(+ "tinyagents-tasks",+ tinyagents_tasks::storage_schema().collections(),+ ),owner("openhuman-core", host_collections()),];diff --git a/crates/openhuman-core/src/storage/schema_tests.rs b/crates/openhuman-core/src/storage/schema_tests.rsindex 08ab80c814..61cb03bec0 100644--- a/crates/openhuman-core/src/storage/schema_tests.rs+++ b/crates/openhuman-core/src/storage/schema_tests.rs@@ -58,33 +58,18 @@ fn tinyjuice_ccr_blobs_stay_inside_the_juice_owner_namespace() {}#[test]-fn tiny_artifacts_blob_namespace_composes_with_host_artifact_collections() {- let registry = registry().expect("the owners compose");- assert_eq!(- registry- .owners()- .filter(|owner| *owner == "artifacts")- .count(),- 1- );-- let artifacts = owner_schemas()- .into_iter()- .find(|schema| schema.owner.as_str() == "artifacts")- .expect("the artifact owners are composed");- assert!(artifacts.items.iter().any(|item| matches!(- item,- Item::Collection { name, .. } if name == "artifacts.records"- )));- assert!(artifacts.items.iter().any(|item| matches!(- item,- Item::Blobs {- prefix,- scope: ScopeClass::Tenant,- } if prefix == "artifacts/files/"- )));- assert!(!module_items("artifacts")- .blobs+fn tiny_artifacts_collections_compose_with_host_artifact_collections() {+ let owners = collection_owners().expect("the owners compose");+ let host = owners.iter()- .any(|prefix| prefix == "artifacts/files/"));+ .find(|owner| owner.crate_name == "openhuman-core")+ .expect("the host collection owner is present");+ for name in ["artifacts.records", "artifacts.args", "artifacts.versions"] {+ assert!(+ host.collections+ .iter()+ .any(|collection| collection.name == name),+ "missing host artifact collection {name}"+ );+ }}diff --git a/crates/openhuman-core/src/storage/sessions/host_stores.rs b/crates/openhuman-core/src/storage/sessions/host_stores.rsindex 24590cc4ca..2cf1b9f741 100644--- a/crates/openhuman-core/src/storage/sessions/host_stores.rs+++ b/crates/openhuman-core/src/storage/sessions/host_stores.rs@@ -266,7 +266,13 @@ pub fn artifact_scoped_for_in(}};match backend.for_scope(&scope) {- Ok(scoped) => Some(scoped),+ Ok(scoped) => match tinyagents_storage_kit::Scope::new(scope.as_str()) {+ Ok(port_scope) => Some(ScopedStorage::new(scoped, port_scope)),+ Err(error) => {+ log::warn!("[session_store] artifact scope invalid: {error}");+ None+ }+ },Err(error) => {log::warn!("[session_store] artifact scope refused scope={}: {error}",diff --git a/crates/openhuman-core/src/storage/sessions/host_stores_tests.rs b/crates/openhuman-core/src/storage/sessions/host_stores_tests.rsindex 4e63a09781..c5320216e0 100644--- a/crates/openhuman-core/src/storage/sessions/host_stores_tests.rs+++ b/crates/openhuman-core/src/storage/sessions/host_stores_tests.rs@@ -5,6 +5,10 @@ fn scratch() -> tempfile::TempDir {tempfile::tempdir().expect("tempdir")}+fn port_scope(scope: crate::storage::Scope) -> tinyagents_storage_kit::Scope {+ tinyagents_storage_kit::Scope::new(scope.as_str()).expect("valid storage scope")+}+#[test]fn the_calling_tenants_stores_open_on_the_workspace_default() {let ws = scratch();@@ -74,7 +78,7 @@ async fn artifact_scope_uses_the_carried_profile_when_ambient_profile_differs().expect("the explicit artifact owner has a storage scope");assert_eq!(scoped.scope(),- &crate::storage::scope_for_profile("artifact-owner"),+ &port_scope(crate::storage::scope_for_profile("artifact-owner")),"artifacts share the profile scope and follow the carried context");})@@ -102,12 +106,12 @@ fn artifact_scope_uses_agent_scope_only_for_unprofiled_named_agents() {.expect("an unprofiled named agent has a local scope");assert_eq!(named_agent.scope(),- &crate::storage::scope_for_agent("writer")+ &port_scope(crate::storage::scope_for_agent("writer")));let default_agent = artifact_scoped_for_in(ws.path(), &context_for(None)).expect("the default agent has the local scope");- assert!(default_agent.scope().is_local());+ assert_eq!(default_agent.scope().as_str(), "local");let explicitly_named_default = artifact_scoped_for_in(ws.path(),@@ -116,7 +120,9 @@ fn artifact_scope_uses_agent_scope_only_for_unprofiled_named_agents() {.expect("an explicitly named agent uses the agent scope");assert_eq!(explicitly_named_default.scope(),- &crate::storage::scope_for_agent(crate::storage::sessions::DEFAULT_AGENT)+ &port_scope(crate::storage::scope_for_agent(+ crate::storage::sessions::DEFAULT_AGENT,+ )));}diff --git a/crates/openhuman-core/src/storage/sessions/mod.rs b/crates/openhuman-core/src/storage/sessions/mod.rsindex 06878eba71..8bb7c29f5f 100644--- a/crates/openhuman-core/src/storage/sessions/mod.rs+++ b/crates/openhuman-core/src/storage/sessions/mod.rs@@ -19,6 +19,7 @@ use std::sync::{Arc, LazyLock, PoisonError, RwLock};use tinyagents_session::port::{AgentStores, SessionStoreProvider};mod host_stores;+mod rebound;mod tenant_router;pub use host_stores::{@@ -28,7 +29,8 @@ pub use host_stores::{stores_for, stores_or_ephemeral, turn_states_for, with_ledger, with_ledger_async,WorkspaceSessionStores,};-pub use tenant_router::{rebind_all, TenantSessionStores};+pub use rebound::{rebind_all, ReboundSessionStores, StoreRegistry};+pub use tenant_router::TenantSessionStores;static PROVIDER: LazyLock<RwLock<Option<Arc<dyn SessionStoreProvider>>>> =LazyLock::new(|| RwLock::new(None));@@ -185,7 +187,7 @@ pub fn workspace_transcripts(agent_id: &str,workspace_dir: &std::path::Path,) -> Arc<dyn tinyagents_session::transcript::TranscriptLocator> {- workspace::provider_for_workspace(workspace_dir)+ host_stores::provider_for_workspace(workspace_dir).for_agent(agent_id).transcripts}diff --git a/crates/openhuman-core/src/storage/sessions/rebound.rs b/crates/openhuman-core/src/storage/sessions/rebound.rsindex 1b0646cfa8..ec2bd1da9b 100644--- a/crates/openhuman-core/src/storage/sessions/rebound.rs+++ b/crates/openhuman-core/src/storage/sessions/rebound.rs@@ -134,8 +134,8 @@ impl ReboundSessionStores {/// Rebinds every live [`ReboundSessionStores`] of the process to `backend`;/// returns how many.-pub fn rebind_all(backend: &Arc<dyn StorageBackend>) -> usize {- PROCESS.rebind(backend)+pub fn rebind_all(backend: &Arc<dyn StorageBackend>) -> Result<usize, StorageError> {+ Ok(PROCESS.rebind(backend))}impl SessionStoreProvider for ReboundSessionStores {diff --git a/crates/openhuman-core/src/storage/sessions/tenant_router.rs b/crates/openhuman-core/src/storage/sessions/tenant_router.rsindex 1f689fd9c1..75217cdaa6 100644--- a/crates/openhuman-core/src/storage/sessions/tenant_router.rs+++ b/crates/openhuman-core/src/storage/sessions/tenant_router.rs@@ -1,6 +1,6 @@-//! [`TenantSessionStores`]: one upstream rebindable provider per tenant.+//! [`TenantSessionStores`]: one [`DriverSessionStores`] per tenant.//!-//! TinyAgents' rebindable provider serves one tenant and derives+//! TinyAgents' `DriverSessionStores` serves one tenant and derives//! `tenant.agent(id)` itself. The host keeps its flat session keys//! ([`crate::core::runtime::session_key`]: the agent id for the desktop//! operator, `<profile>~<agent>` for a SaaS profile), so this provider decodes@@ -10,10 +10,12 @@//! `u:<profile>/agent:<id>`, inside the tenant fence.use std::collections::HashMap;-use std::sync::{Arc, LazyLock, Mutex, PoisonError, RwLock, Weak};+use std::sync::{Arc, Mutex, PoisonError};use tinyagents_harness::store::SchemaAdmission;-use tinyagents_session::port::{AgentStorageFactory, AgentStores, SessionStoreProvider};+use tinyagents_session::port::{+ AgentStorageFactory, AgentStores, ConditionedAgentStorageFactory, SessionStoreProvider,+};use tinyagents_session::DriverSessionStores;use tinyagents_storage_kit::{Blocking, Scope as PortScope, ScopedStorage};use tinystoragedrivers::{StorageBackend, StorageError};@@ -22,11 +24,11 @@ use crate::storage::Scope;/// Session stores over one backend, routed to a per-tenant provider.pub struct TenantSessionStores {- backend: Arc<RwLock<Arc<dyn StorageBackend>>>,+ backend: Arc<dyn StorageBackend>,+ bridge: Blocking,recover_on_open: bool,admission: SchemaAdmission,- tenants: Arc<TenantProviders>,- registry: Arc<TenantStoreRegistry>,+ tenants: Mutex<HashMap<Scope, Arc<DriverSessionStores>>>,/// Names this router in [`SessionStoreProvider::destination_key`].id: uuid::Uuid,}@@ -34,7 +36,6 @@ pub struct TenantSessionStores {impl std::fmt::Debug for TenantSessionStores {fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {let tenants = self.tenants.lock().unwrap_or_else(PoisonError::into_inner);- let backend = self.backend.read().unwrap_or_else(PoisonError::into_inner);f.debug_struct("TenantSessionStores").field("tenants", &tenants.len()).finish_non_exhaustive()@@ -42,59 +43,58 @@ impl std::fmt::Debug for TenantSessionStores {}impl TenantSessionStores {- fn with_registry(+ /// Stores over `backend` on a shared `bridge`.+ pub fn with_bridge(backend: Arc<dyn StorageBackend>,+ bridge: Blocking,+ recover_on_open: bool,+ ) -> Self {+ Self::with_admission(backend, bridge, recover_on_open, SchemaAdmission::Declare)+ }++ fn with_admission(+ backend: Arc<dyn StorageBackend>,+ bridge: Blocking,recover_on_open: bool,admission: SchemaAdmission,- registry: Arc<TenantStoreRegistry>,) -> Self {Self {- backend: Arc::new(RwLock::new(backend)),+ backend,+ bridge,recover_on_open,admission,- tenants: Arc::new(Mutex::new(HashMap::new())),- registry,+ tenants: Mutex::new(HashMap::new()),id: uuid::Uuid::new_v4(),}}- /// Stores over `backend`, registered for workspace rebinds.+ /// Stores over `backend` with a bridge of their own.////// # Errors///- /// When the TinyAgents session provider cannot start.+ /// When the blocking bridge cannot start.pub fn new(backend: Arc<dyn StorageBackend>,recover_on_open: bool,) -> Result<Self, StorageError> {- let router = Self::with_registry(+ Ok(Self::with_bridge(backend,+ Blocking::new()?,recover_on_open,- SchemaAdmission::Declare,- Arc::clone(&PROCESS_SESSION_STORES),- );- router- .registry- .register_backend(&router.backend, &router.tenants);- Ok(router)+ ))}- /// Workspace fallback stores are tied to a fixed workspace backend and- /// therefore must not join the process-wide workspace-rebind registry.+ /// Stores over a fixed workspace backend without joining any process-wide+ /// rebind registry. The workspace fallback owns this provider directly.pub(super) fn new_workspace_local(backend: Arc<dyn StorageBackend>,recover_on_open: bool,) -> Result<Self, StorageError> {- Ok(Self::with_registry(- backend,- recover_on_open,- SchemaAdmission::Declare,- Arc::new(TenantStoreRegistry::default()),- ))+ Self::new(backend, recover_on_open)}/// The provider of the tenant `key` belongs to, and the agent id within it.- fn route(&self, key: &str) -> (Arc<RebindableSessionStores>, String) {+ fn route(&self, key: &str) -> (Arc<DriverSessionStores>, String) {let (profile, mut agent) = crate::core::runtime::split_session_key(key);if agent.is_empty() {agent = crate::storage::scope::DEFAULT_AGENT.to_owned();@@ -117,12 +117,25 @@ impl TenantSessionStores {})?;Ok(ScopedStorage::new(storage, scope))});+ let backend = Arc::clone(&self.backend);+ let tenant_for_conditioned_factory = tenant.clone();+ let conditioned_factory: ConditionedAgentStorageFactory =+ Arc::new(move |agent_id, condition| {+ let owner_scope = crate::storage::scope::Scope::new(+ tenant_for_conditioned_factory.as_str(),+ )?+ .agent(agent_id)?;+ let scope = PortScope::new(owner_scope.as_str())?;+ let storage = backend.for_scope_conditioned(&owner_scope, condition)?;+ Ok(ScopedStorage::new(storage, scope))+ });let provider = Arc::new(DriverSessionStores::with_bridge_and_schema_admission(factory,self.bridge.clone(),self.admission,)+ .with_conditioned_storage_factory(conditioned_factory).recover_on_open(self.recover_on_open),);tracing::debug!(@@ -134,7 +147,7 @@ impl TenantSessionStores {(provider, agent)}- fn providers(&self) -> Vec<Arc<RebindableSessionStores>> {+ fn providers(&self) -> Vec<Arc<DriverSessionStores>> {self.tenants.lock().unwrap_or_else(PoisonError::into_inner)@@ -155,11 +168,6 @@ impl SessionStoreProvider for TenantSessionStores {provider.try_for_agent(&agent)}- fn lease_for_agent(&self, agent_id: &str) -> Result<SessionStoreLease, SessionStoreLeaseError> {- let (provider, agent) = self.route(agent_id);- provider.lease_for_agent(&agent)- }-fn bind_actor(&self,factory: AgentStorageFactory,diff --git a/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs b/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rsindex a1803337a9..9df7a7b5b1 100644--- a/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs+++ b/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs@@ -99,3 +99,51 @@ async fn the_same_agent_key_is_isolated_between_operator_and_profile_scopes() {Some(serde_json::json!("escaped")));}++#[test]+fn reserved_generation_writes_use_the_tenant_backends_atomic_condition() {+ use tinyagents_session::transcript::{+ SessionRef, TranscriptHistory, TranscriptLocator, TranscriptMessage, TranscriptMeta,+ TranscriptTurn,+ };++ let fixture = crate::storage::test_support::sqlite_backend().unwrap();+ let router = TenantSessionStores::new(Arc::clone(&fixture.backend), false).unwrap();+ let stores = router.for_agent("planner");+ let session = SessionRef::scoped("conditioned-generation", "planner");+ let meta: TranscriptMeta = serde_json::from_value(serde_json::json!({+ "agent_name": "planner",+ "agent_id": "planner",+ "dispatcher": "native",+ "created": "2026-01-01T00:00:00Z",+ "updated": "2026-01-01T00:00:00Z",+ "turn_count": 0,+ "input_tokens": 0,+ "output_tokens": 0,+ "cached_input_tokens": 0,+ "charged_amount_usd": 0.0,+ "thread_id": "conditioned-generation"+ }))+ .unwrap();+ let (successor, history) = stores+ .transcripts+ .begin_generation(&session, meta.clone())+ .unwrap();+ let next = vec![TranscriptMessage::user("carried context")];++ history+ .append_turn(TranscriptTurn {+ prev: &[],+ next: &next,+ meta: &meta,+ turn_usage: None,+ request_id: None,+ tools: None,+ })+ .expect("the SQLite backend supports atomic lease-conditioned writes");++ assert!(stores+ .transcripts+ .read_session_transcript(&successor)+ .is_some());+}diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rsindex b5228090d2..e66bca3e46 100644--- a/crates/openhuman-core/src/threads/ops/crud.rs+++ b/crates/openhuman-core/src/threads/ops/crud.rs@@ -541,7 +541,7 @@ async fn thread_delete_inner(}};let jobs = crate::core::runtime::slot_for::<- tinyagents_harness_tools::subagents::SubAgentJobRegistry,+ tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&ctx);let cancelled_driver =crate::agent::orchestration::subagent_sessions::cancel_driver_jobs_for_thread(diff --git a/crates/openhuman-core/src/threads/turn_state/mirror_observe_thinking_and_subagent_tests.rs b/crates/openhuman-core/src/threads/turn_state/mirror_observe_thinking_and_subagent_tests.rsindex fb87fab9c1..e28c4a8238 100644--- a/crates/openhuman-core/src/threads/turn_state/mirror_observe_thinking_and_subagent_tests.rs+++ b/crates/openhuman-core/src/threads/turn_state/mirror_observe_thinking_and_subagent_tests.rs@@ -182,9 +182,6 @@ fn subagent_completed_persists_capped_output_on_the_activity() {output_chars: 11,usage: None,output: "final answer".into(),- worktree_path: None,- changed_files: Vec::new(),- dirty_status: None,stop: None,});diff --git a/crates/openhuman-core/src/tools/delegate.rs b/crates/openhuman-core/src/tools/delegate.rsdeleted file mode 100644index b18e0234a9..0000000000--- a/crates/openhuman-core/src/tools/delegate.rs+++ /dev/null@@ -1,353 +0,0 @@-use crate::config::DelegateAgentConfig;-use crate::inference::provider::factory::make_openhuman_backend_model_for_options;-use crate::inference::provider::factory::INFERENCE_BACKEND_ID;-use crate::security::policy::ToolOperation;-use crate::security::SecurityPolicy;-use crate::tools::timeout::tool_execution_timeout_secs;-use async_trait::async_trait;-use serde_json::json;-use std::collections::HashMap;-use std::path::PathBuf;-use std::sync::Arc;-use std::time::Duration;-use tinyagents_harness::context::RunContext;-use tinyagents_harness::tool::ToolDispatch;-use tinyinference_llm::message::Message;-use tinyinference_llm::model::ModelRequest;-use tinytools::{Tool, ToolCallOptions, ToolResult, ToolRunContext};--/// Runtime overrides applied when the delegate tool builds a provider.-#[derive(Debug, Clone)]-pub(crate) struct ProviderRuntimeOptions {- pub(crate) auth_profile_override: Option<String>,- pub(crate) openhuman_dir: Option<PathBuf>,- pub(crate) secrets_encrypt: bool,- pub(crate) reasoning_enabled: Option<bool>,-}--impl Default for ProviderRuntimeOptions {- fn default() -> Self {- Self {- auth_profile_override: None,- openhuman_dir: None,- secrets_encrypt: true,- reasoning_enabled: None,- }- }-}--/// Tool that delegates a subtask to a named agent with a different-/// provider/model configuration. Enables multi-agent workflows where-/// a primary agent can hand off specialized work (research, coding,-/// summarization) to purpose-built sub-agents.-pub struct DelegateTool {- agents: Arc<HashMap<String, DelegateAgentConfig>>,- security: Arc<SecurityPolicy>,- /// Provider runtime options inherited from root config.- provider_runtime_options: ProviderRuntimeOptions,- /// Depth at which this tool instance lives in the delegation chain.- depth: u32,-}--/// Host adapter that places the config-defined one-shot executor behind the-/// shared driver lifecycle while retaining the configured Tool instance.-pub(crate) struct DelegateToolDispatch {- tool: Arc<dyn Tool>,-}--impl DelegateToolDispatch {- pub(crate) fn new(tool: Arc<dyn Tool>) -> Self {- Self { tool }- }-}--#[async_trait]-impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext>- for DelegateToolDispatch-{- fn tool(&self) -> Arc<dyn Tool> {- self.tool.clone()- }-- async fn execute(- &self,- _state: &(),- _call_id: tinyagents_harness::CallId,- arguments: serde_json::Value,- _options: ToolCallOptions,- parent: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,- ) -> anyhow::Result<ToolResult> {- let agent_id = arguments- .get("agent")- .and_then(serde_json::Value::as_str)- .map(str::trim)- .filter(|agent| !agent.is_empty())- .unwrap_or("delegate")- .to_owned();- crate::agent::subagent_host::run_configured_delegate_via_driver_tool(- parent,- self.tool.clone(),- arguments,- agent_id,- )- .await- .map_err(|error| anyhow::anyhow!("delegate: {error}"))- }-}--impl DelegateTool {- pub fn new(- agents: HashMap<String, DelegateAgentConfig>,- security: Arc<SecurityPolicy>,- ) -> Self {- Self::new_with_options(agents, security, ProviderRuntimeOptions::default())- }-- pub fn new_with_options(- agents: HashMap<String, DelegateAgentConfig>,- security: Arc<SecurityPolicy>,- provider_runtime_options: ProviderRuntimeOptions,- ) -> Self {- Self {- agents: Arc::new(agents),- security,- provider_runtime_options,- depth: 0,- }- }-- /// Create a DelegateTool for a sub-agent (with incremented depth).- /// When sub-agents eventually get their own tool registry, construct- /// their DelegateTool via this method with `depth: parent.depth + 1`.- pub fn with_depth(- agents: HashMap<String, DelegateAgentConfig>,- security: Arc<SecurityPolicy>,- depth: u32,- ) -> Self {- Self::with_depth_and_options(agents, security, depth, ProviderRuntimeOptions::default())- }-- pub fn with_depth_and_options(- agents: HashMap<String, DelegateAgentConfig>,- security: Arc<SecurityPolicy>,- depth: u32,- provider_runtime_options: ProviderRuntimeOptions,- ) -> Self {- Self {- agents: Arc::new(agents),- security,- provider_runtime_options,- depth,- }- }-}--#[async_trait]-impl Tool for DelegateTool {- fn name(&self) -> &str {- "delegate"- }-- fn description(&self) -> &str {- "Delegate a subtask to a specialized agent. Use when: a task benefits from a different model \- (e.g. fast summarization, deep reasoning, code generation). The sub-agent runs a single \- prompt and returns its response."- }-- fn parameters_schema(&self) -> serde_json::Value {- let agent_names: Vec<&str> = self.agents.keys().map(|s: &String| s.as_str()).collect();- json!({- "type": "object",- "additionalProperties": false,- "properties": {- "agent": {- "type": "string",- "minLength": 1,- "description": format!(- "Name of the agent to delegate to. Available: {}",- if agent_names.is_empty() {- "(none configured)".to_string()- } else {- agent_names.join(", ")- }- )- },- "prompt": {- "type": "string",- "minLength": 1,- "description": "The task/prompt to send to the sub-agent"- },- "context": {- "type": "string",- "description": "Optional context to prepend (e.g. relevant code, prior findings)"- }- },- "required": ["agent", "prompt"]- })- }-- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {- self.execute_inner(args, None).await- }-- async fn execute_with_context(- &self,- args: serde_json::Value,- _options: ToolCallOptions,- tool_context: Option<&dyn ToolRunContext>,- ) -> anyhow::Result<ToolResult> {- self.execute_inner(args, tool_context).await- }-}--impl DelegateTool {- async fn execute_inner(- &self,- args: serde_json::Value,- tool_context: Option<&dyn ToolRunContext>,- ) -> anyhow::Result<ToolResult> {- let agent_name = args- .get("agent")- .and_then(|v| v.as_str())- .map(str::trim)- .ok_or_else(|| anyhow::anyhow!("Missing 'agent' parameter"))?;-- if agent_name.is_empty() {- return Ok(ToolResult::error("'agent' parameter must not be empty"));- }-- let prompt = args- .get("prompt")- .and_then(|v| v.as_str())- .map(str::trim)- .ok_or_else(|| anyhow::anyhow!("Missing 'prompt' parameter"))?;-- if prompt.is_empty() {- return Ok(ToolResult::error("'prompt' parameter must not be empty"));- }-- let context = args- .get("context")- .and_then(|v| v.as_str())- .map(str::trim)- .unwrap_or("");-- // Look up agent config- let agent_config = match self.agents.get(agent_name) {- Some(cfg) => cfg,- None => {- let available: Vec<&str> =- self.agents.keys().map(|s: &String| s.as_str()).collect();- return Ok(ToolResult::error(format!(- "Unknown agent '{agent_name}'. Available agents: {}",- if available.is_empty() {- "(none configured)".to_string()- } else {- available.join(", ")- }- )));- }- };-- // Check recursion depth (immutable — set at construction, incremented for sub-agents)- if self.depth >= agent_config.max_depth {- return Ok(ToolResult::error(format!(- "Delegation depth limit reached ({depth}/{max}). \- Cannot delegate further to prevent infinite loops.",- depth = self.depth,- max = agent_config.max_depth- )));- }-- if let Err(error) = self- .security- .enforce_tool_operation(ToolOperation::Act, "delegate")- {- return Ok(ToolResult::error(error));- }-- // `metadata` below is diagnostic only; the managed model owns the- // actual backend wire extension so configured delegates cannot lose- // their parent's thread between typed dispatch and provider invoke.- let thread_id = tool_context.and_then(ToolRunContext::thread_id);- let model = match make_openhuman_backend_model_for_options(- &self.provider_runtime_options,- &agent_config.model,- thread_id,- ) {- Ok((model, _resolved)) => model,- Err(error) => {- return Ok(ToolResult::error(format!(- "Agent '{agent_name}' failed: {error}"- )));- }- };-- // Build the message- let full_prompt = if context.is_empty() {- prompt.to_string()- } else {- format!("[Context]\n{context}\n\n[Task]\n{prompt}")- };-- let temperature = agent_config.temperature.unwrap_or(0.7);-- let delegate_timeout_secs = tool_execution_timeout_secs();- // Wrap the provider call in a timeout to prevent indefinite blocking- let mut request = ModelRequest::new(- agent_config- .system_prompt- .as_deref()- .map(Message::system)- .into_iter()- .chain(std::iter::once(Message::user(full_prompt)))- .collect(),- )- .with_model(agent_config.model.clone())- .with_temperature(temperature);- request.metadata = json!({- "openhuman": {- "thread_id": tool_context.and_then(ToolRunContext::thread_id),- "workspace_root": tool_context- .and_then(ToolRunContext::workspace)- .map(|workspace| workspace.root.display().to_string()),- }- });-- let result = tokio::time::timeout(- Duration::from_secs(delegate_timeout_secs),- model.invoke(&(), request),- )- .await;-- let result = match result {- Ok(inner) => inner,- Err(_elapsed) => {- return Ok(ToolResult::error(format!(- "Agent '{agent_name}' timed out after {delegate_timeout_secs}s"- )));- }- };-- match result {- Ok(response) => {- let mut rendered = response.text();- if rendered.trim().is_empty() {- rendered = "[Empty response]".to_string();- }-- Ok(ToolResult::success(format!(- "[Agent '{agent_name}' ({}/{})]\n{rendered}",- INFERENCE_BACKEND_ID, agent_config.model- )))- }- Err(e) => Ok(ToolResult::error(format!(- "Agent '{agent_name}' failed: {e}",- ))),- }- }-}--#[cfg(test)]-#[path = "delegate_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/tools/delegate_tests.rs b/crates/openhuman-core/src/tools/delegate_tests.rsdeleted file mode 100644index 4d84fd8ac7..0000000000--- a/crates/openhuman-core/src/tools/delegate_tests.rs+++ /dev/null@@ -1,232 +0,0 @@-use super::*;-use crate::security::{AutonomyLevel, SecurityPolicy};--fn test_security() -> Arc<SecurityPolicy> {- Arc::new(SecurityPolicy::default())-}--fn sample_agents() -> HashMap<String, DelegateAgentConfig> {- let mut agents = HashMap::new();- agents.insert(- "researcher".to_string(),- DelegateAgentConfig {- model: "llama3".to_string(),- system_prompt: Some("You are a research assistant.".to_string()),- temperature: Some(0.3),- max_depth: 3,- },- );- agents.insert(- "coder".to_string(),- DelegateAgentConfig {- model: "test-model".to_string(),- system_prompt: None,- temperature: None,- max_depth: 2,- },- );- agents-}--#[test]-fn name_and_schema() {- let tool = DelegateTool::new(sample_agents(), test_security());- assert_eq!(tool.name(), "delegate");- let schema = tool.parameters_schema();- assert!(schema["properties"]["agent"].is_object());- assert!(schema["properties"]["prompt"].is_object());- assert!(schema["properties"]["context"].is_object());- let required = schema["required"].as_array().unwrap();- assert!(required.contains(&json!("agent")));- assert!(required.contains(&json!("prompt")));- assert_eq!(schema["additionalProperties"], json!(false));- assert_eq!(schema["properties"]["agent"]["minLength"], json!(1));- assert_eq!(schema["properties"]["prompt"]["minLength"], json!(1));-}--#[test]-fn description_not_empty() {- let tool = DelegateTool::new(sample_agents(), test_security());- assert!(!tool.description().is_empty());-}--#[test]-fn schema_lists_agent_names() {- let tool = DelegateTool::new(sample_agents(), test_security());- let schema = tool.parameters_schema();- let desc = schema["properties"]["agent"]["description"]- .as_str()- .unwrap();- assert!(desc.contains("researcher") || desc.contains("coder"));-}--#[tokio::test]-async fn missing_required_params_are_rejected() {- let tool = DelegateTool::new(sample_agents(), test_security());- assert!(tool.execute(json!({"prompt": "test"})).await.is_err());- assert!(tool.execute(json!({"agent": "researcher"})).await.is_err());-}--#[tokio::test]-async fn unknown_agent_returns_error() {- let tool = DelegateTool::new(sample_agents(), test_security());- let result = tool- .execute(json!({"agent": "nonexistent", "prompt": "test"}))- .await- .unwrap();- assert!(result.is_error);- assert!(result.output().contains("Unknown agent"));-}--#[tokio::test]-async fn depth_limit_enforced() {- // Global limit, then coder's own max_depth=2 blocking at depth 2.- for (agent, depth) in [("researcher", 3), ("coder", 2)] {- let tool = DelegateTool::with_depth(sample_agents(), test_security(), depth);- let result = tool- .execute(json!({"agent": agent, "prompt": "test"}))- .await- .unwrap();- assert!(result.is_error, "{agent}@{depth}");- assert!(result.output().contains("depth limit"), "{agent}@{depth}");- }-}--#[test]-fn empty_agents_schema() {- let tool = DelegateTool::new(HashMap::new(), test_security());- let schema = tool.parameters_schema();- let desc = schema["properties"]["agent"]["description"]- .as_str()- .unwrap();- assert!(desc.contains("none configured"));-}--#[tokio::test]-async fn blank_agent_or_prompt_rejected() {- let tool = DelegateTool::new(sample_agents(), test_security());- for args in [- json!({"agent": " ", "prompt": "test"}),- json!({"agent": "researcher", "prompt": " \t "}),- ] {- let result = tool.execute(args.clone()).await.unwrap();- assert!(result.is_error, "{args}");- assert!(result.output().contains("must not be empty"), "{args}");- }-}--#[tokio::test]-async fn whitespace_agent_name_trimmed_and_found() {- let tool = DelegateTool::new(sample_agents(), test_security());- // " researcher " with surrounding whitespace — after trim becomes "researcher"- let result = tool- .execute(json!({"agent": " researcher ", "prompt": "test"}))- .await- .unwrap();- // Should find "researcher" after trim — will fail at provider level- // since ollama isn't running, but must NOT get "Unknown agent".- assert!(!result.output().contains("Unknown agent"));-}--#[tokio::test]-async fn delegation_blocked_in_readonly_mode() {- let readonly = Arc::new(SecurityPolicy {- autonomy: AutonomyLevel::ReadOnly,- ..SecurityPolicy::default()- });- let tool = DelegateTool::new(sample_agents(), readonly);- let result = tool- .execute(json!({"agent": "researcher", "prompt": "test"}))- .await- .unwrap();- assert!(result.is_error);- assert!(result.output().contains("read-only mode"));-}--#[tokio::test]-async fn delegation_blocked_when_rate_limited() {- let limited = Arc::new(SecurityPolicy {- max_actions_per_hour: 0,- ..SecurityPolicy::default()- });- let tool = DelegateTool::new(sample_agents(), limited);- let result = tool- .execute(json!({"agent": "researcher", "prompt": "test"}))- .await- .unwrap();- assert!(result.is_error);- assert!(result.output().contains("Rate limit exceeded"));-}--#[tokio::test]-async fn delegate_context_is_prepended_to_prompt() {- let mut agents = HashMap::new();- agents.insert(- "tester".to_string(),- DelegateAgentConfig {- model: "test-model".to_string(),- system_prompt: None,- temperature: None,- max_depth: 3,- },- );- let tool = DelegateTool::new(agents, test_security());- let result = tool- .execute(json!({- "agent": "tester",- "prompt": "do something",- "context": "some context data"- }))- .await- .unwrap();-- assert!(result.is_error);- assert!(- result.output().contains("Agent 'tester' failed") || result.output().contains("timed out")- );-}--#[tokio::test]-async fn delegate_empty_context_omits_prefix() {- let mut agents = HashMap::new();- agents.insert(- "tester".to_string(),- DelegateAgentConfig {- model: "test-model".to_string(),- system_prompt: None,- temperature: None,- max_depth: 3,- },- );- let tool = DelegateTool::new(agents, test_security());- let result = tool- .execute(json!({- "agent": "tester",- "prompt": "do something",- "context": ""- }))- .await- .unwrap();-- assert!(result.is_error);- assert!(- result.output().contains("Agent 'tester' failed") || result.output().contains("timed out")- );-}--#[test]-fn delegate_depth_construction() {- let tool = DelegateTool::with_depth(sample_agents(), test_security(), 5);- assert_eq!(tool.depth, 5);-}--#[tokio::test]-async fn delegate_no_agents_configured() {- let tool = DelegateTool::new(HashMap::new(), test_security());- let result = tool- .execute(json!({"agent": "any", "prompt": "test"}))- .await- .unwrap();- assert!(result.is_error);- assert!(result.output().contains("none configured"));-}diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rsindex e274960581..2a6abba9b6 100644--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs@@ -2,6 +2,7 @@//! Python encoding defaults used by OpenHuman's runtime adapter.use super::*;+use crate::tools::ShellTool;use crate::modules::tinybox::host_runtime::{host_shell_flavor, ShellFlavor};#[cfg(feature = "modules")]use crate::tools::system::shell_support::{python_env_defaults, PYTHON_ENV_DEFAULTS};diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_runtime_and_sandbox_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_runtime_and_sandbox_tests.rsindex 3eaf73d1ea..fa3fd72e1b 100644--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_runtime_and_sandbox_tests.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_runtime_and_sandbox_tests.rs@@ -1,4 +1,5 @@use super::*;+use crate::tools::ShellTool;#[tokio::test]async fn shell_blocks_rate_limited() {diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rsindex 30f2653d78..6477eff12b 100644--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rs@@ -1,4 +1,5 @@use super::*;+use crate::tools::ShellTool;use tinytools::ToolTimeout;#[tokio::test]diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_timeout_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_timeout_tests.rsindex 787c76a0b2..e9c269c54f 100644--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_timeout_tests.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_timeout_tests.rs@@ -2,6 +2,7 @@//! tool's `timeout_secs` (#6953).use super::*;+use crate::tools::ShellTool;#[cfg(not(windows))]fn process_is_running(pid: i32) -> bool {diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rsindex f47fd804d1..16cb771b97 100644--- a/crates/openhuman-core/src/tools/ops.rs+++ b/crates/openhuman-core/src/tools/ops.rs@@ -506,29 +506,8 @@ pub fn all_tools_with_runtime_and_pack_handle(// Image metadata is always available for user-provided images.tools.push(Box::new(ImageInfoTool::new(security.clone())));- // Add delegation tool when agents are configured- if !agents.is_empty() {- let delegate_agents: HashMap<String, DelegateAgentConfig> = agents- .iter()- .map(|(name, cfg)| (name.clone(), cfg.clone()))- .collect();- tools.push(Box::new(DelegateTool::new_with_options(- delegate_agents,- security.clone(),- crate::tools::delegate::ProviderRuntimeOptions {- auth_profile_override: None,- openhuman_dir: root_config- .config_path- .parent()- .map(std::path::PathBuf::from),- secrets_encrypt: root_config.secrets.encrypt,- reasoning_enabled: root_config.runtime.reasoning_enabled,- },- )));- }-- // Sources placed after the delegation tool (a host's place and market-data- // tools), ahead of the Composio tools.+ // Hosted source tools retain their stable catalogue position ahead of the+ // Composio tools.tools.extend(crate::tools::sources::build_registered_tool_sources(&source_ctx,Some(crate::tools::sources::ANCHOR_AFTER_DELEGATE),diff --git a/crates/openhuman-core/src/tools/ops_tests.rs b/crates/openhuman-core/src/tools/ops_tests.rsindex 26d404ba0d..ece8b45aa3 100644--- a/crates/openhuman-core/src/tools/ops_tests.rs+++ b/crates/openhuman-core/src/tools/ops_tests.rs@@ -1,7 +1,7 @@use super::*;use crate::config::{BrowserConfig, Config};-use crate::security::credentials::{AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME};use crate::security::AuditLogger;+use crate::security::credentials::{APP_SESSION_PROVIDER, AuthService, DEFAULT_AUTH_PROFILE_NAME};use crate::tools::ops::{all_tools, tool_group};use tempfile::TempDir;use tinytools::ToolContent;diff --git a/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs b/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rsindex 15af6b8c9b..8f00bee316 100644--- a/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs+++ b/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs@@ -354,8 +354,8 @@ fn memory_tool_classifies_as_memory_family() {/// A narrowed DomainSet axis still keeps the ordinary platform tools.#[tokio::test]async fn full_domain_set_keeps_platform_tools() {- use crate::core::runtime::context::CoreContext;use crate::core::runtime::DomainSet;+ use crate::core::runtime::context::CoreContext;let tmp = TempDir::new().unwrap();let ctx = CoreContext::for_test(DomainSet::full(), None);diff --git a/crates/openhuman-core/src/tools/ops_tests_default_registry_tests.rs b/crates/openhuman-core/src/tools/ops_tests_default_registry_tests.rsindex 688e6ad5f7..421b6c5fa4 100644--- a/crates/openhuman-core/src/tools/ops_tests_default_registry_tests.rs+++ b/crates/openhuman-core/src/tools/ops_tests_default_registry_tests.rs@@ -27,9 +27,11 @@ fn all_tools_registers_the_memory_tool_while_memory_is_on() {);// The search half of deferral is the harness's intrinsic bridge, never a// registered tool: a host `tool_search` would shadow it.- assert!(!tools- .iter()- .any(|tool| { tool.name() == tinytools::TOOL_SEARCH_NAME }));+ assert!(+ !tools+ .iter()+ .any(|tool| { tool.name() == tinytools::TOOL_SEARCH_NAME })+ );}/// The three `whatsapp_data_*` agent tools are gone, in every build.///@@ -416,9 +418,11 @@ fn all_tools_default_registry_contains_expected_baseline_surface() {"image_info",];assert_contains_all(&names, &expected);- assert!(!names- .iter()- .any(|name| matches!(name.as_str(), "wait" | "wait_loop")));+ assert!(+ !names+ .iter()+ .any(|name| matches!(name.as_str(), "wait" | "wait_loop"))+ );}#[test]fn all_tools_default_registry_has_no_duplicate_tool_names() {diff --git a/crates/openhuman-core/src/triage/escalation.rs b/crates/openhuman-core/src/triage/escalation.rsindex 10f5abdb63..3e885bf213 100644--- a/crates/openhuman-core/src/triage/escalation.rs+++ b/crates/openhuman-core/src/triage/escalation.rs@@ -279,7 +279,7 @@ async fn dispatch_target_agent("[triage::escalation] dispatching direct agent turn");- let outcome = crate::inference::host_runtime::ops::agent_chat_for_with_turn_model_source(+ let outcome = crate::agent_runs::agent_chat::agent_chat_for_with_turn_model_source(&mut config,crate::inference::host_runtime::ops::AgentChatTarget::Definition {definition: &direct_definition,diff --git a/crates/openhuman-core/src/triage/escalation_model_tests.rs b/crates/openhuman-core/src/triage/escalation_model_tests.rsindex f2f02427ea..bf0bfc695d 100644--- a/crates/openhuman-core/src/triage/escalation_model_tests.rs+++ b/crates/openhuman-core/src/triage/escalation_model_tests.rs@@ -5,6 +5,9 @@ use std::sync::{Arc, Mutex};use tinyinference_llm::model::{ChatModel, ModelProfile, ModelRequest, ModelResponse, ModelStream, ModelStreamItem,};+use tinyinference_llm::providers::overrides::ChatModelEntry;++const TEST_MANAGED_MODEL: &str = "hint:chat";struct TriageReplyModel {requests: Arc<Mutex<Vec<(String, String, ModelRequest)>>>,@@ -62,8 +65,8 @@ fn triage_test_model(requests: Arc<Mutex<Vec<(String, String, ModelRequest)>>>,builds: Arc<Mutex<Vec<(String, String)>>>,failing_role: Option<&'static str>,-) -> crate::inference::registry::ChatModelEntry {- crate::inference::registry::ChatModelEntry {+) -> ChatModelEntry<crate::inference::registry::ProviderContext> {+ ChatModelEntry {build: Arc::new(move |build_request| {let role = build_request.role.to_string();let model = build_request@@ -73,7 +76,9 @@ fn triage_test_model(.to_string();builds.lock().unwrap().push((role.clone(), model.clone()));if failing_role == Some(build_request.role) {- anyhow::bail!("test provider has no model for role {role}");+ return Err(tinyinference_llm::Error::Model(format!(+ "test provider has no model for role {role}"+ )));}Ok((Arc::new(TriageReplyModel {@@ -85,6 +90,7 @@ fn triage_test_model())}),probe: None,+ models: None,}}@@ -99,7 +105,7 @@ async fn react_dispatch_keeps_routing_without_creating_child_lifecycle_records()action_dir: temp.path().join("actions"),..Config::default()};- config.default_model = Some(crate::config::MODEL_MANAGED_DEFAULT.to_string());+ config.default_model = Some(TEST_MANAGED_MODEL.to_string());let requests = Arc::new(Mutex::new(Vec::new()));let builds = Arc::new(Mutex::new(Vec::new()));@@ -153,8 +159,7 @@ async fn react_dispatch_keeps_routing_without_creating_child_lifecycle_records()"the trigger reactor should use its configured model role");assert_eq!(- requests[0].1,- crate::config::MODEL_MANAGED_DEFAULT,+ requests[0].1, TEST_MANAGED_MODEL,"the configured managed model pin should reach the actual turn model");assert!(@@ -172,9 +177,11 @@ async fn react_dispatch_keeps_routing_without_creating_child_lifecycle_records().map(|tool| tool.name.as_str()).collect();assert!(tool_names.contains(&"read_workspace_state"));- assert!(!tool_names- .iter()- .any(|name| { *name == "spawn_subagent" || name.starts_with("delegate_") }));+ assert!(+ !tool_names+ .iter()+ .any(|name| { *name == "spawn_subagent" || name.starts_with("delegate_") })+ );assert!(!tool_names.contains(&"shell"));assert!(!tool_names.contains(&"file_write"));}@@ -261,7 +268,7 @@ async fn direct_turn_model_source_metadata_probe_does_not_duplicate_egress_disclArc::clone(runtime.context()),crate::security::turn_origin::with_origin(crate::triage::local_trigger_origin(),- crate::inference::host_runtime::ops::agent_chat_for_with_turn_model_source(+ crate::agent_runs::agent_chat::agent_chat_for_with_turn_model_source(&mut config,crate::inference::host_runtime::ops::AgentChatTarget::Definition {definition: &definition,@@ -295,11 +302,13 @@ async fn direct_turn_model_source_metadata_probe_does_not_duplicate_egress_disclrequests[0].1, model_marker,"the expected model served the turn");- assert!(requests[0]- .2- .messages- .iter()- .any(|message| { message.text().contains("send this trigger reply") }));+ assert!(+ requests[0]+ .2+ .messages+ .iter()+ .any(|message| { message.text().contains("send this trigger reply") })+ );}let sentinel = "triage-direct-source-egress-sentinel";BUS.publish(crate::core::events::DomainEvent::ExternalTransferPending {@@ -355,7 +364,7 @@ async fn react_dispatch_falls_back_to_parent_model_when_hint_route_cannot_build(action_dir: temp.path().join("actions"),..Config::default()};- config.default_model = Some(crate::config::MODEL_MANAGED_DEFAULT.to_string());+ config.default_model = Some(TEST_MANAGED_MODEL.to_string());let requests = Arc::new(Mutex::new(Vec::new()));let builds = Arc::new(Mutex::new(Vec::new()));@@ -410,7 +419,7 @@ async fn react_dispatch_falls_back_to_parent_model_when_hint_route_cannot_build(requests[0].0, "chat","fallback must retain the parent model workload role");- assert_eq!(requests[0].1, crate::config::MODEL_MANAGED_DEFAULT);+ assert_eq!(requests[0].1, TEST_MANAGED_MODEL);assert!(requests[0].2.messages.iter().any(|message| {message.text()@@ -483,7 +492,7 @@ async fn escalate_dispatch_preserves_orchestrator_tools_without_child_delegationrequests[0].0, "coding","an inherited target must keep its parent's workload role");- assert_eq!(requests[0].1, crate::config::MODEL_MANAGED_DEFAULT);+ assert_eq!(requests[0].1, TEST_MANAGED_MODEL);assert!(requests[0].2.messages.iter().any(|message| {message.text()@@ -499,9 +508,11 @@ async fn escalate_dispatch_preserves_orchestrator_tools_without_child_delegationtool_names.contains(&"grep"),"the orchestrator keeps its advertised coding tool");- assert!(!tool_names- .iter()- .any(|name| { *name == "spawn_subagent" || name.starts_with("delegate_") }));+ assert!(+ !tool_names+ .iter()+ .any(|name| { *name == "spawn_subagent" || name.starts_with("delegate_") })+ );}#[tokio::test]@@ -584,7 +595,7 @@ async fn react_dispatch_inherits_the_parent_workload_for_inherit_targets() {requests[0].0, "coding","an Inherit target must retain its parent's workload role");- assert_eq!(requests[0].1, crate::config::MODEL_MANAGED_DEFAULT);+ assert_eq!(requests[0].1, TEST_MANAGED_MODEL);assert!(requests[0].2.messages.iter().any(|message| {message.text()diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_event_match.rs b/crates/openhuman-core/src/web_chat/progress_bridge_event_match.rsindex 56a8fa79a0..a633172a60 100644--- a/crates/openhuman-core/src/web_chat/progress_bridge_event_match.rs+++ b/crates/openhuman-core/src/web_chat/progress_bridge_event_match.rs@@ -253,9 +253,6 @@output_chars,output,usage,- worktree_path,- changed_files,- dirty_status,..} => {subagent_events::on_subagent_completed(@@ -271,9 +268,6 @@output_chars,output,usage,- worktree_path,- changed_files,- dirty_status,);}AgentProgress::SubagentFailed {diff --git a/vendor/tiny-artifacts b/vendor/tiny-artifactsindex e222627fbe..406d2be7c6 160000--- a/vendor/tiny-artifacts+++ b/vendor/tiny-artifacts@@ -1 +1 @@-Subproject commit e222627fbe7d54e2db34226e06fc53f8e90186f2+Subproject commit 406d2be7c6d8b344b5bd3599b6ee0f1106f81af8diff --git a/vendor/tinyjuice b/vendor/tinyjuiceindex 1ff17f09dd..96dff78f4d 160000--- a/vendor/tinyjuice+++ b/vendor/tinyjuice@@ -1 +1 @@-Subproject commit 1ff17f09dd07e5f1ab885e0859c4e850d3590ecf+Subproject commit 96dff78f4d74a3399aadee5da218e61483b35571diff --git a/vendor/tinyvoice b/vendor/tinyvoiceindex 5838caf7a1..9ed9c2eb79 160000--- a/vendor/tinyvoice+++ b/vendor/tinyvoice@@ -1 +1 @@-Subproject commit 5838caf7a1af4cb56ffbee824b68495680f059f7+Subproject commit 9ed9c2eb79198ad4eed9d88c787c03d554f816dd