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
refactor(modules): route module client access through modules::client
Steven Enamakel14ca777a006a
diff --git a/crates/openhuman-core/src/channels/bus/delivery.rs b/crates/openhuman-core/src/channels/bus/delivery.rsindex d2b8329c4c..12da60c1ac 100644--- a/crates/openhuman-core/src/channels/bus/delivery.rs+++ b/crates/openhuman-core/src/channels/bus/delivery.rs@@ -148,7 +148,7 @@ impl ModuleProgressiveReply {) -> anyhow::Result<Self> {let callback = ManagedTransport::capture(&config, channel.clone(), session)?;let runtime =- ChannelRuntimeLease::open(crate::modules::ops::client(config), callback).await?;+ ChannelRuntimeLease::open(crate::modules::client(config), callback).await?;let result: ProgressiveResult = runtime.object().call_confidential(diff --git a/crates/openhuman-core/src/channels/bus/subscriber.rs b/crates/openhuman-core/src/channels/bus/subscriber.rsindex 9cb37d277b..53e2ffb3dd 100644--- a/crates/openhuman-core/src/channels/bus/subscriber.rs+++ b/crates/openhuman-core/src/channels/bus/subscriber.rs@@ -73,7 +73,7 @@ impl EventHandler<DomainEvent> for ChannelInboundSubscriber {}};let identity = match crate::modules::channel_controller::prepare_identity(- &crate::modules::ops::client(config.clone()),+ &crate::modules::client(config.clone()),tinychannels_bus::module_inbound::PrepareChannelIdentityRequest {channel: channel.clone(),sender: sender.clone(),diff --git a/crates/openhuman-core/src/channels/commands.rs b/crates/openhuman-core/src/channels/commands.rsindex 2d38e95820..3ad9eb378d 100644--- a/crates/openhuman-core/src/channels/commands.rs+++ b/crates/openhuman-core/src/channels/commands.rs@@ -49,7 +49,7 @@ pub async fn doctor_channels(config: Config) -> Result<()> {service_selectors: selectors,}};- let client = crate::modules::ops::client(config.clone())+ let client = crate::modules::client(config.clone()).with_timeout(Duration::from_secs(configured.len() as u64 * 10 + 5));let channels =crate::modules::channel_health::check(&client, hydrate_channel_credentials(&config), proxy)diff --git a/crates/openhuman-core/src/channels/context.rs b/crates/openhuman-core/src/channels/context.rsindex bdb0ae44e4..db0493b4ea 100644--- a/crates/openhuman-core/src/channels/context.rs+++ b/crates/openhuman-core/src/channels/context.rs@@ -69,7 +69,7 @@ pub(crate) async fn module_client(ctx: &ChannelRuntimeContext) -> tinybus::modulif ctx.config.is_none() {return super::module_fixture::client().await;}- crate::modules::ops::client(ctx.config.as_deref().cloned().unwrap_or_default())+ crate::modules::client(ctx.config.as_deref().cloned().unwrap_or_default())}#[cfg(test)]diff --git a/crates/openhuman-core/src/channels/controllers/backend.rs b/crates/openhuman-core/src/channels/controllers/backend.rsindex 436e93d6db..004644c6e9 100644--- a/crates/openhuman-core/src/channels/controllers/backend.rs+++ b/crates/openhuman-core/src/channels/controllers/backend.rs@@ -35,7 +35,7 @@ impl OpenHumanChannelBackend {&self,prepared: tinychannels_bus::module_runtime::PreparedChannelIntent,) -> anyhow::Result<ChannelSendMessageResult> {- crate::modules::ops::client(self.config.clone())+ crate::modules::client(self.config.clone()).call_confidential("tinychannels",tinychannels_bus::methods::SEND_CHANNEL_INTENT,diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rsindex fbed6d36bf..8f3cbf8f05 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs@@ -31,7 +31,7 @@ pub async fn connect_channel(HttpProxyPolicy::default()};let prepared = crate::modules::channel_controller::prepare_connection(- &crate::modules::ops::client(config.clone()),+ &crate::modules::client(config.clone()),ChannelControllerRequest::PrepareConnect {config: config.channels_config.clone(),channel: channel_id.to_owned(),diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rsindex 17abe872f8..074b39fc8f 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs@@ -30,7 +30,7 @@ pub(crate) async fn channel_config_connected(#[cfg(test)]let client = crate::channels::module_fixture::client().await;#[cfg(not(test))]- let client = crate::modules::ops::client(config.clone());+ let client = crate::modules::client(config.clone());use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult};match client.call_confidential(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 292ff7caea..86b970a0aa 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@@ -18,7 +18,7 @@ pub async fn test_channel(auth_mode: ChannelAuthMode,credentials_value: Value,) -> Result<Outcome<ChannelTestResult>, String> {- let response = crate::modules::ops::client(config.clone())+ let response = crate::modules::client(config.clone()).call_confidential("tinychannels",methods::CHANNEL_CONTROLLER,diff --git a/crates/openhuman-core/src/channels/controllers/ops/discord.rs b/crates/openhuman-core/src/channels/controllers/ops/discord.rsindex 6053a66e5e..7709d54c4f 100644--- a/crates/openhuman-core/src/channels/controllers/ops/discord.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/discord.rs@@ -39,7 +39,7 @@ async fn discord_bot_token(config: &Config) -> Result<String, String> {pub async fn discord_list_guilds(config: &Config) -> Result<Outcome<Vec<DiscordGuild>>, String> {let token = discord_bot_token(config).await?;let guilds = channel_controller::discord(- &crate::modules::ops::client(config.clone()),+ &crate::modules::client(config.clone()),ChannelControllerRequest::DiscordListGuilds {config: config.channels_config.clone(),bot_token: token,@@ -62,7 +62,7 @@ pub async fn discord_list_channels(}let token = discord_bot_token(config).await?;let channels = channel_controller::discord(- &crate::modules::ops::client(config.clone()),+ &crate::modules::client(config.clone()),ChannelControllerRequest::DiscordListChannels {config: config.channels_config.clone(),guild_id: guild_id.to_owned(),@@ -90,7 +90,7 @@ pub async fn discord_check_permissions(}let token = discord_bot_token(config).await?;let check = channel_controller::discord(- &crate::modules::ops::client(config.clone()),+ &crate::modules::client(config.clone()),ChannelControllerRequest::DiscordCheckPermissions {config: config.channels_config.clone(),guild_id: guild_id.to_owned(),diff --git a/crates/openhuman-core/src/channels/controllers/schemas.rs b/crates/openhuman-core/src/channels/controllers/schemas.rsindex 24c380970b..5291323bee 100644--- a/crates/openhuman-core/src/channels/controllers/schemas.rs+++ b/crates/openhuman-core/src/channels/controllers/schemas.rs@@ -373,7 +373,7 @@ fn handle_send_message(params: Map<String, Value>) -> ControllerFuture {async fn send_with_config(config: &Config, p: SendMessageParams) -> Result<Value, String> {let prepared = crate::modules::channel_controller::prepare_message(- &crate::modules::ops::client(config.clone()),+ &crate::modules::client(config.clone()),p.channel.trim(),p.message,)diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rsindex b8b6838f9f..c75d25a030 100644--- a/crates/openhuman-core/src/channels/host/channel_events.rs+++ b/crates/openhuman-core/src/channels/host/channel_events.rs@@ -48,7 +48,7 @@ impl ChannelApprovalSurfaceSubscriber {if self.config.is_none() {return crate::channels::module_fixture::client().await;}- crate::modules::ops::client(self.config.as_deref().cloned().unwrap_or_default())+ crate::modules::client(self.config.as_deref().cloned().unwrap_or_default())}}#[async_trait]@@ -208,11 +208,11 @@ impl ChannelTurnStateSubscriber {let client = if self.config.is_none() {crate::channels::module_fixture::client().await} else {- crate::modules::ops::client(self.config.as_deref().cloned().unwrap_or_default())+ crate::modules::client(self.config.as_deref().cloned().unwrap_or_default())};#[cfg(not(test))]let client =- crate::modules::ops::client(self.config.as_deref().cloned().unwrap_or_default());+ crate::modules::client(self.config.as_deref().cloned().unwrap_or_default());let result: Result<tinychannels_bus::module_remote::RemoteOperationResult, _> = client.call_confidential("tinychannels",diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rsindex f59005013f..7e93f972b7 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs@@ -30,7 +30,7 @@ pub async fn channel_relay_inbound(params: RelayInboundParams) -> Result<Outcomelet tenant = crate::core::runtime::current_tenant().map_err(|error| error.to_string())?;let config = crate::config::rpc::load_config_with_timeout().await?;let identity = crate::modules::channel_controller::prepare_identity(- &crate::modules::ops::client(config.clone()),+ &crate::modules::client(config.clone()),tinychannels_bus::module_inbound::PrepareChannelIdentityRequest {channel: params.channel.clone(),sender: Some(params.sender_id.clone()),@@ -115,7 +115,7 @@ pub(crate) async fn run_relay_turn(params.message_id.clone(),));- let client = crate::modules::ops::client(config.clone());+ let client = crate::modules::client(config.clone());let (message_timeout_secs, _) =match prepare_runtime_limits(&client, config.channels_config.message_timeout_secs, 1).await{@@ -174,7 +174,7 @@ pub(crate) async fn run_relay_turn(// history from it, since this runtime context lives for one message.let message = params.to_channel_message();let prepared = match crate::modules::channel_controller::prepare_inbound(- &crate::modules::ops::client(config.clone()),+ &crate::modules::client(config.clone()),tinychannels_bus::module_inbound::PrepareChannelInboundRequest {source: tinychannels_bus::module_inbound::ChannelInboundSource::Legacy {message: message.clone(),diff --git a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rsindex ed1d25c57f..d8b4977003 100644--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs@@ -45,7 +45,7 @@ impl ModuleChannelRuntime {context: Arc<OnceLock<Weak<crate::channels::context::ChannelRuntimeContext>>>,dispatch: mpsc::Sender<RuntimeChannelMessage>,) -> Result<Self> {- let client = crate::modules::ops::client((*config).clone());+ let client = crate::modules::client((*config).clone());// Queued deliveries from before the storage contract move into the// module's storage before it starts and reads its queue. Best effort:// a failure is retried at the next start, never fatal to channels.diff --git a/crates/openhuman-core/src/hosting/mod.rs b/crates/openhuman-core/src/hosting/mod.rsindex 5c195fc78d..4069585f97 100644--- a/crates/openhuman-core/src/hosting/mod.rs+++ b/crates/openhuman-core/src/hosting/mod.rs@@ -83,7 +83,7 @@ impl Account {return Ok(None);}Ok(Some(Self {- client: crate::modules::ops::client(config.clone()),+ client: crate::modules::client(config.clone()),provider,api_key,team: config.hosting.team().map(str::to_owned),@@ -123,7 +123,7 @@ impl Account {}let workspace_dir = config.workspace_dir.clone();Ok(Self {- client: crate::modules::ops::client(config),+ client: crate::modules::client(config),provider: "vercel".to_owned(),api_key: api_key.trim().to_owned(),team: teamdiff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rsindex 1efb89c027..b8f8783e05 100644--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs@@ -175,7 +175,7 @@ pub async fn install_from_config(config: &crate::config::Config) -> Result<(), S/// Construct explicit access over the shared process-wide loader.pub(super) fn client(config: &crate::config::Config) -> tinybus::module::ModuleClient {- crate::modules::ops::client(config.clone())+ crate::modules::client(config.clone())}/// Everything the module considers about one tool result.diff --git a/crates/openhuman-core/src/integrations/composio/module_client.rs b/crates/openhuman-core/src/integrations/composio/module_client.rsindex ee0677f29d..f789fc2583 100644--- a/crates/openhuman-core/src/integrations/composio/module_client.rs+++ b/crates/openhuman-core/src/integrations/composio/module_client.rs@@ -166,7 +166,7 @@ whereRequest: serde::Serialize + Send,Reply: serde::de::DeserializeOwned,{- crate::modules::ops::client(_config.clone())+ crate::modules::client(_config.clone()).call::<Reply>("tinyconnectors", member, (_request,)).await.map_err(|error| format!("{member}: {error}; {WITHOUT_MODULES}"))@@ -227,7 +227,7 @@ whereRequest: serde::Serialize + Send,Reply: serde::de::DeserializeOwned,{- crate::modules::ops::client(_config.clone())+ crate::modules::client(_config.clone()).call::<Reply>("tinyconnectors", member, (_request,)).await.map_err(|error| format!("{member}: {error}; {WITHOUT_MODULES}"))@@ -286,7 +286,7 @@ pub async fn call_bare<Reply: serde::de::DeserializeOwned>(_config: &crate::config::Config,member: &str,) -> Result<Reply, String> {- crate::modules::ops::client(_config.clone())+ crate::modules::client(_config.clone()).call::<Reply>("tinyconnectors", member, ()).await.map_err(|error| format!("{member}: {error}; {WITHOUT_MODULES}"))diff --git a/crates/openhuman-core/src/integrations/composio/ops/triggers.rs b/crates/openhuman-core/src/integrations/composio/ops/triggers.rsindex 78406810b9..cbb5dd4ccf 100644--- a/crates/openhuman-core/src/integrations/composio/ops/triggers.rs+++ b/crates/openhuman-core/src/integrations/composio/ops/triggers.rs@@ -157,7 +157,7 @@ pub async fn composio_enable_trigger(// settings screen, so its failures are mapped to something a person can// act on ("reconnect GitHub") rather than the provider's own wording.let classified: tinyconnectors_bus::ProviderError =- crate::modules::ops::client(config.clone())+ crate::modules::client(config.clone()).call("tinyconnectors",methods::CLASSIFY_ERROR,diff --git a/crates/openhuman-core/src/integrations/composio/processing.rs b/crates/openhuman-core/src/integrations/composio/processing.rsindex c11a4677b9..628b95b55c 100644--- a/crates/openhuman-core/src/integrations/composio/processing.rs+++ b/crates/openhuman-core/src/integrations/composio/processing.rs@@ -14,7 +14,7 @@ pub(crate) async fn prepare(since: Option<String>,) -> Result<Option<serde_json::Value>, String> {prepare_with(- &crate::modules::ops::client(config.clone()),+ &crate::modules::client(config.clone()),tool,arguments,timezone,@@ -56,7 +56,7 @@ pub(crate) async fn filter(response: super::types::ComposioExecuteResponse,since: String,) -> Result<super::types::ComposioExecuteResponse, String> {- crate::modules::ops::client(config.clone())+ crate::modules::client(config.clone()).call("tinyconnectors",methods::FILTER_RESPONSE,diff --git a/crates/openhuman-core/src/integrations/composio/trigger_history.rs b/crates/openhuman-core/src/integrations/composio/trigger_history.rsindex c8698bf7e7..a3e7c1123e 100644--- a/crates/openhuman-core/src/integrations/composio/trigger_history.rs+++ b/crates/openhuman-core/src/integrations/composio/trigger_history.rs@@ -36,7 +36,7 @@ impl TriggerHistory {if let Some(client) = self.fixture.as_ref() {return client.clone();}- crate::modules::ops::client(config.clone())+ crate::modules::client(config.clone())}async fn ensure_lease(diff --git a/crates/openhuman-core/src/mcp/module_client/lifecycle.rs b/crates/openhuman-core/src/mcp/module_client/lifecycle.rsindex 203e76a218..380b799935 100644--- a/crates/openhuman-core/src/mcp/module_client/lifecycle.rs+++ b/crates/openhuman-core/src/mcp/module_client/lifecycle.rs@@ -115,7 +115,7 @@ impl McpConfiguredClient {Ok(Self::with_port(data_dir,Box::new(TinyMcpPort {- root: crate::modules::ops::client(config.clone()),+ root: crate::modules::client(config.clone()),}),))}diff --git a/crates/openhuman-core/src/mcp/server/module.rs b/crates/openhuman-core/src/mcp/server/module.rsindex eb8be8f7e8..5ae57f2d5b 100644--- a/crates/openhuman-core/src/mcp/server/module.rs+++ b/crates/openhuman-core/src/mcp/server/module.rs@@ -182,7 +182,7 @@ impl ServerSession {pub(super) fn port_for_config(config: &Config) -> Arc<dyn ServerPort> {Self::register_shutdown_hook(config.clone());Arc::new(TinyMcpPort {- client: crate::modules::ops::client(config.clone()),+ client: crate::modules::client(config.clone()),})}@@ -193,7 +193,7 @@ impl ServerSession {crate::core::shutdown::register(move || {let config = config.clone();async move {- let client = crate::modules::ops::client(config);+ let client = crate::modules::client(config);if let Err(error) = client.call::<usize>(MODULE, names::methods::SERVER_SHUTDOWN, ()).awaitdiff --git a/crates/openhuman-core/src/modules/accessibility.rs b/crates/openhuman-core/src/modules/accessibility.rsindex e009bb4424..81d72f3af2 100644--- a/crates/openhuman-core/src/modules/accessibility.rs+++ b/crates/openhuman-core/src/modules/accessibility.rs@@ -43,7 +43,7 @@ pub struct AccessibilityClient {impl AccessibilityClient {pub fn new(config: &Config) -> Self {Self {- client: crate::modules::ops::client(config.clone()),+ client: crate::modules::client(config.clone()),computer_enabled: config.components.computer,}}diff --git a/crates/openhuman-core/src/modules/channel_controller_tests.rs b/crates/openhuman-core/src/modules/channel_controller_tests.rsindex 7aa808e9d2..ad305c5ad2 100644--- a/crates/openhuman-core/src/modules/channel_controller_tests.rs+++ b/crates/openhuman-core/src/modules/channel_controller_tests.rs@@ -179,7 +179,7 @@ async fn hosted_identity_requires_the_module_and_never_uses_a_local_key_fallbacklet mut config = crate::config::Config::default();config.modules.enabled = false;let result = prepare_identity(- &crate::modules::ops::client(config),+ &crate::modules::client(config),tinychannels_bus::module_inbound::PrepareChannelIdentityRequest {channel: "discord:fixture".into(),sender: Some("fixture-private-sender".into()),diff --git a/crates/openhuman-core/src/modules/channel_runtime_tests.rs b/crates/openhuman-core/src/modules/channel_runtime_tests.rsindex 433c3b887d..475165f917 100644--- a/crates/openhuman-core/src/modules/channel_runtime_tests.rs+++ b/crates/openhuman-core/src/modules/channel_runtime_tests.rs@@ -157,7 +157,7 @@ async fn released_runtime_scopes_callbacks_and_replays_one_final_send() {let first_sends = Arc::new(std::sync::atomic::AtomicUsize::new(0));let second_sends = Arc::new(std::sync::atomic::AtomicUsize::new(0));let first = ChannelRuntimeLease::open(- crate::modules::ops::client(config.clone()),+ crate::modules::client(config.clone()),TransportFixture {sends: first_sends.clone(),expected_text: final_text.clone(),@@ -166,7 +166,7 @@ async fn released_runtime_scopes_callbacks_and_replays_one_final_send() {.await.unwrap();let second = ChannelRuntimeLease::open(- crate::modules::ops::client(config),+ crate::modules::client(config),TransportFixture {sends: second_sends.clone(),expected_text: final_text.clone(),diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rsindex f55ef8c5d3..23399d3639 100644--- a/crates/openhuman-core/src/modules/mod.rs+++ b/crates/openhuman-core/src/modules/mod.rs@@ -41,6 +41,7 @@//! - [`ops`] — the adapter over `tinybus::module::Resolver` and `ModuleClient`://! builds them from [`Config`](crate::config::Config) and the registry.//! - [`report`] — the Sentry sink for terminal module outcomes.+//! - [`client`] — a `tinybus::module::ModuleClient`, with or without the loader.//! - [`schemas`] — the `modules` RPC surface.//! - [`boot`] — what happens at startup.@@ -76,7 +77,6 @@ pub mod ops;#[cfg(feature = "modules")]pub(crate) mod profile_claim;pub mod registry;-#[cfg(feature = "modules")]pub(crate) mod report;#[cfg(feature = "modules")]pub mod runtime;@@ -124,6 +124,8 @@ pub mod tinybox;#[cfg(feature = "modules")]mod tokenjuice_host;pub mod types;+#[cfg(not(feature = "modules"))]+mod unloaded;#[cfg(feature = "voice")]#[cfg(feature = "modules")]pub mod voice;@@ -145,6 +147,22 @@ pub use ops::{ensure_loaded, ensure_loaded_within, state_of};pub use schemas::{all_controller_schemas, all_registered_controllers};#[doc(hidden)]pub use source::local_artifact;+/// A `tinybus::module::ModuleClient` that loads modules lazily through the+/// process-wide resolver (see [`ops`]). Constructing one starts nothing. In a+/// build without the `modules` feature there is no loader, and every call is+/// unavailable and reported once with the `loader_disabled` reason.+#[must_use]+pub fn client(config: crate::config::Config) -> tinybus::module::ModuleClient {+ #[cfg(feature = "modules")]+ {+ ops::client(config)+ }+ #[cfg(not(feature = "modules"))]+ {+ unloaded::client(config)+ }+}+pub use types::{LoadPolicy, ModuleRecord, ModuleSource, ModuleState, ModuleStatus, PlatformAsset};/// Imports tinymcp's legacy SQLite files under `data_dir` into the module'sdiff --git a/crates/openhuman-core/src/modules/tinybox.rs b/crates/openhuman-core/src/modules/tinybox.rsindex 640ae6ef47..c4322d528d 100644--- a/crates/openhuman-core/src/modules/tinybox.rs+++ b/crates/openhuman-core/src/modules/tinybox.rs@@ -221,7 +221,7 @@ pub async fn run_docker(request: contract::DockerRunRequest,) -> Result<contract::DockerRunOutput, String> {let timeout = Duration::from_millis(request.timeout_ms).saturating_add(DOCKER_CALL_GRACE);- let client = crate::modules::ops::client(config.clone()).with_timeout(timeout);+ let client = crate::modules::client(config.clone()).with_timeout(timeout);call_run_docker_with_client(&client, request).await}@@ -234,7 +234,7 @@ pub async fn run_docker_without_workspace(request: contract::DockerRunRequest,) -> Result<contract::DockerRunOutput, String> {let timeout = Duration::from_millis(request.timeout_ms).saturating_add(DOCKER_CALL_GRACE);- let client = crate::modules::ops::client(config.clone()).with_timeout(timeout);+ let client = crate::modules::client(config.clone()).with_timeout(timeout);call_run_docker_without_workspace_with_client(&client, request).await}@@ -440,7 +440,7 @@ where}fn module_client(config: &Config) -> ModuleClient {- crate::modules::ops::client(config.clone()).with_timeout(MODULE_CALL_TIMEOUT)+ crate::modules::client(config.clone()).with_timeout(MODULE_CALL_TIMEOUT)}fn message(error: ModuleCallError) -> String {diff --git a/crates/openhuman-core/src/modules/unloaded.rs b/crates/openhuman-core/src/modules/unloaded.rsnew file mode 100644index 0000000000..f008712d48--- /dev/null+++ b/crates/openhuman-core/src/modules/unloaded.rs@@ -0,0 +1,74 @@+//! The module client in a build without the loader.+//!+//! The `modules` feature gates the loader (and the archive and HTTP stack it+//! drags in), but the domains that call modules (accessibility, tokenjuice,+//! composio, channel health, gitbooks) are compiled either way and answer+//! "unavailable" when there is no loader. [`client`] hands them a+//! `tinybus::module::ModuleClient` over the bare registry: every id is known,+//! nothing can be loaded, and each refusal is reported once with the closed+//! `loader_disabled` reason.++use tinybus::module::{+ AccessFuture, FailureReporter, ModuleAccess, ModuleClient, ProxyFailure, Reason,+ ReleaseRecord,+};+use tinybus::Proxy;++use super::{registry, report};+use crate::config::Config;++/// A registry with no loader behind it.+struct Unloaded {+ enabled: bool,+ reporter: std::sync::Arc<FailureReporter>,+}++impl ModuleAccess for Unloaded {+ fn find(&self, id: &str) -> Option<&'static ReleaseRecord> {+ registry::release_records()+ .into_iter()+ .find(|record| record.id == id)+ }++ fn enabled(&self) -> bool {+ self.enabled+ }++ fn reporter(&self) -> &FailureReporter {+ &self.reporter+ }++ fn ensure_loaded<'a>(&'a self, id: &'a str) -> AccessFuture<'a, Result<(), String>> {+ Box::pin(async move {+ log::debug!("[modules] '{id}' unavailable: this build has no module loader");+ if let Some(record) = self.find(id) {+ self.reporter+ .report(record.id, record.version, Reason::LoaderDisabled);+ }+ Err(format!(+ "module '{id}' is unavailable: this build has no module loader"+ ))+ })+ }++ fn proxy<'a>(+ &'a self,+ _bus_name: &'a str,+ _object_path: &'a str,+ ) -> AccessFuture<'a, Result<Proxy, ProxyFailure>> {+ Box::pin(async { Err(ProxyFailure::Transport) })+ }+}++/// A client whose every call is unavailable and reported.+#[must_use]+pub fn client(config: Config) -> ModuleClient {+ ModuleClient::new(Unloaded {+ enabled: config.modules.enabled,+ reporter: report::reporter(),+ })+}++#[cfg(test)]+#[path = "unloaded_tests.rs"]+mod tests;diff --git a/crates/openhuman-core/src/modules/unloaded_tests.rs b/crates/openhuman-core/src/modules/unloaded_tests.rsnew file mode 100644index 0000000000..8b5234f291--- /dev/null+++ b/crates/openhuman-core/src/modules/unloaded_tests.rs@@ -0,0 +1,28 @@+use super::*;+use tinybus::module::ModuleCallError;++#[tokio::test]+async fn a_build_without_the_loader_never_falls_back_to_an_implementation() {+ let result = client(Config::default())+ .call::<serde_json::Value>("tinyhosts", "Providers", ())+ .await;+ assert_eq!(result, Err(ModuleCallError::Unavailable));+}++#[tokio::test]+async fn confidential_calls_are_unavailable_without_the_loader() {+ let result = client(Config::default())+ .call_confidential::<serde_json::Value>("tinywallet", "SignTransaction", ("secret",))+ .await;+ assert_eq!(result, Err(ModuleCallError::Unavailable));+}++#[tokio::test]+async fn unknown_ids_stay_unavailable_without_naming_the_id() {+ let error = client(Config::default())+ .call::<serde_json::Value>("private-user-path", "Anything", ())+ .await+ .unwrap_err();+ assert_eq!(error, ModuleCallError::Unavailable);+ assert!(!error.to_string().contains("private-user-path"));+}diff --git a/crates/openhuman-core/src/threads/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rsindex 2fa961c431..d466103be2 100644--- a/crates/openhuman-core/src/threads/store/bus.rs+++ b/crates/openhuman-core/src/threads/store/bus.rs@@ -359,7 +359,7 @@ async fn persist_channel_turn(if config.workspace_dir != workspace_dir {return Err("channel workspace changed".into());}- crate::modules::ops::client(config)+ crate::modules::client(config)};let prepared: tinychannels_bus::module_inbound::PreparedChannelInbound = client.call_confidential(diff --git a/crates/openhuman-core/src/tools/impl/network/gitbooks.rs b/crates/openhuman-core/src/tools/impl/network/gitbooks.rsindex 90655aab9c..8c499793f5 100644--- a/crates/openhuman-core/src/tools/impl/network/gitbooks.rs+++ b/crates/openhuman-core/src/tools/impl/network/gitbooks.rs@@ -27,7 +27,7 @@ impl GitbooksSearchTool {Ok(Self {endpoint,timeout_secs,- client: crate::modules::ops::client(config)+ client: crate::modules::client(config).with_timeout(Duration::from_secs(timeout_secs)),})}@@ -121,7 +121,7 @@ impl GitbooksGetPageTool {Ok(Self {endpoint,timeout_secs,- client: crate::modules::ops::client(config)+ client: crate::modules::client(config).with_timeout(Duration::from_secs(timeout_secs)),})}diff --git a/crates/openhuman-core/src/voice/audio_capture.rs b/crates/openhuman-core/src/voice/audio_capture.rsindex dc53b7e831..37bb58d44e 100644--- a/crates/openhuman-core/src/voice/audio_capture.rs+++ b/crates/openhuman-core/src/voice/audio_capture.rs@@ -62,7 +62,7 @@ pub async fn start_recording(config: &Config) -> Result<RecordingHandle, String>/// Enumerate native input devices through the loaded module.pub async fn list_input_devices(config: &Config) -> Result<Vec<String>, String> {use tinyvoice_bus::{capture::CaptureResult, names::methods};- let result: CaptureResult<Vec<String>> = crate::modules::ops::client(config.clone())+ let result: CaptureResult<Vec<String>> = crate::modules::client(config.clone()).call_confidential("tinyvoice", methods::LIST_INPUT_DEVICES, ()).await.map_err(|e| e.to_string())?;diff --git a/crates/openhuman-core/src/voice/capture_lease.rs b/crates/openhuman-core/src/voice/capture_lease.rsindex 98fc847c68..8c8d6ab059 100644--- a/crates/openhuman-core/src/voice/capture_lease.rs+++ b/crates/openhuman-core/src/voice/capture_lease.rs@@ -125,7 +125,7 @@ pub(super) struct CaptureLease {}impl CaptureLease {pub(super) async fn reserve(config: &Config, kind: Kind) -> Result<Self, String> {- let port: Arc<dyn Port> = Arc::new(BusPort(crate::modules::ops::client(config.clone())));+ let port: Arc<dyn Port> = Arc::new(BusPort(crate::modules::client(config.clone())));Self::reserve_with_port(port, kind).await}async fn reserve_with_port(port: Arc<dyn Port>, kind: Kind) -> Result<Self, String> {diff --git a/crates/openhuman-embed/src/modules.rs b/crates/openhuman-embed/src/modules.rsindex 7c874948f6..6132f5ae28 100644--- a/crates/openhuman-embed/src/modules.rs+++ b/crates/openhuman-embed/src/modules.rs@@ -24,12 +24,10 @@ pub mod browser {/// Pre-core calls through the process-wide loader, with explicit runtime/// configuration: [`client`] builds a [`ModuleClient`] over the same resolver/// the core uses, so a module loads once per process whoever asks first.-#[cfg(feature = "modules")]-pub use openhuman_core::modules::ops::client;-#[cfg(feature = "modules")]+pub use openhuman_core::modules::client;pub use tinybus::module::{ModuleCallError, ModuleClient};-#[cfg(all(test, feature = "modules"))]+#[cfg(test)]#[path = "modules_tests.rs"]mod tests;diff --git a/vendor/tinybus b/vendor/tinybusindex d5b949be8e..9e76f01bbd 160000--- a/vendor/tinybus+++ b/vendor/tinybus@@ -1 +1 @@-Subproject commit d5b949be8ea56eb5a17289a09aa28e8c09bd88b7+Subproject commit 9e76f01bbd9a7eaf8493fca7e1f5fad2141ce1c9