Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(modules): route module client construction through ops helpers

Steven Enamakel742d5ef8b78d
diff --git a/crates/openhuman-core/src/channels/bus/delivery.rs b/crates/openhuman-core/src/channels/bus/delivery.rs
index b468305014..3612cd0c7d 100644
--- a/crates/openhuman-core/src/channels/bus/delivery.rs
+++ b/crates/openhuman-core/src/channels/bus/delivery.rs
@@ -149,7 +149,7 @@ impl ModuleProgressiveReply {
session: tokio_util::sync::CancellationToken,
) -> anyhow::Result<Self> {
let callback = ManagedTransport::capture(&config, channel.clone(), session)?;
- let runtime = ChannelRuntimeLease::open(ModuleClient::new(config), callback).await?;
+ let runtime = ChannelRuntimeLease::open(crate::modules::ops::client(config), callback).await?;
let result: ProgressiveResult = runtime
.object()
.call_confidential(
@@ -162,7 +162,7 @@ impl ModuleProgressiveReply {
Ok(Self { runtime, handle })
}
_ => {
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
Err(ModuleCallError::ModuleFault.into())
}
}
@@ -181,7 +181,7 @@ impl ModuleProgressiveReply {
)
.await?;
if result != ProgressiveResult::Updated {
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
return Err(ModuleCallError::ModuleFault);
}
Ok(())
@@ -200,7 +200,7 @@ impl ModuleProgressiveReply {
)
.await?;
if result != ProgressiveResult::Closed {
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
return Err(ModuleCallError::ModuleFault);
}
self.runtime.close().await
diff --git a/crates/openhuman-core/src/channels/bus/subscriber.rs b/crates/openhuman-core/src/channels/bus/subscriber.rs
index 55b84c8a7d..9cb37d277b 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::client::ModuleClient::new(config.clone()),
+ &crate::modules::ops::client(config.clone()),
tinychannels_bus::module_inbound::PrepareChannelIdentityRequest {
channel: channel.clone(),
sender: sender.clone(),
@@ -272,7 +272,7 @@ impl EventHandler<DomainEvent> for ChannelInboundSubscriber {
async fn flush_events(
reply: &ModuleProgressiveReply,
pending: &mut Vec<ProgressiveEvent>,
-) -> Result<(), crate::modules::client::ModuleCallError> {
+) -> Result<(), tinybus::module::ModuleCallError> {
if pending.is_empty() {
return Ok(());
}
diff --git a/crates/openhuman-core/src/channels/commands.rs b/crates/openhuman-core/src/channels/commands.rs
index 19881ddec0..4225052c40 100644
--- a/crates/openhuman-core/src/channels/commands.rs
+++ b/crates/openhuman-core/src/channels/commands.rs
@@ -6,7 +6,7 @@
use super::runtime::hydrate_channel_credentials;
use crate::config::Config;
-use crate::modules::client::ModuleClient;
+use tinybus::module::ModuleClient;
use anyhow::Result;
use std::time::Duration;
use tinychannels_bus::{ChannelHealthState, HttpProxyPolicy};
@@ -50,7 +50,7 @@ pub async fn doctor_channels(config: Config) -> Result<()> {
service_selectors: selectors,
}
};
- let client = ModuleClient::new(config.clone())
+ let client = crate::modules::ops::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.rs
index 9dfc424d91..f4f1a23adb 100644
--- a/crates/openhuman-core/src/channels/context.rs
+++ b/crates/openhuman-core/src/channels/context.rs
@@ -66,12 +66,12 @@ pub(crate) struct ChannelRuntimeContext {
/// Resolve the configured module client; unit tests use an attested bus fixture.
pub(crate) async fn module_client(
ctx: &ChannelRuntimeContext,
-) -> crate::modules::client::ModuleClient {
+) -> tinybus::module::ModuleClient {
#[cfg(test)]
if ctx.config.is_none() {
return super::module_fixture::client().await;
}
- crate::modules::client::ModuleClient::new(ctx.config.as_deref().cloned().unwrap_or_default())
+ crate::modules::ops::client(ctx.config.as_deref().cloned().unwrap_or_default())
}
#[cfg(test)]
@@ -82,7 +82,7 @@ pub(crate) fn conversation_history_key(msg: &tinychannels_bus::ChannelMessage) -
pub(crate) async fn is_context_window_overflow_error(
ctx: &ChannelRuntimeContext,
err: &anyhow::Error,
-) -> Result<bool, crate::modules::client::ModuleCallError> {
+) -> Result<bool, tinybus::module::ModuleCallError> {
use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult};
match module_client(ctx)
.await
@@ -97,8 +97,8 @@ pub(crate) async fn is_context_window_overflow_error(
{
ChannelControlResult::Overflow(overflow) => Ok(overflow),
_ => {
- crate::modules::client::ModuleClient::report_malformed_reply("tinychannels");
- Err(crate::modules::client::ModuleCallError::ModuleFault)
+ crate::modules::report::malformed_reply("tinychannels");
+ Err(tinybus::module::ModuleCallError::ModuleFault)
}
}
}
diff --git a/crates/openhuman-core/src/channels/controllers/backend.rs b/crates/openhuman-core/src/channels/controllers/backend.rs
index 485fe819d1..436e93d6db 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::client::ModuleClient::new(self.config.clone())
+ crate::modules::ops::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.rs
index acd88e014c..2f3fdf8ac9 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
@@ -3,7 +3,7 @@
use super::shared::credential_provider;
use crate::config::Config;
use crate::core::Outcome;
-use crate::modules::client::{ModuleCallError, ModuleClient};
+use tinybus::module::{ModuleCallError, ModuleClient};
use crate::security::credentials;
use serde_json::Value;
use tinychannels_bus::controllers::ChannelConnectionResult;
@@ -31,7 +31,7 @@ pub async fn connect_channel(
HttpProxyPolicy::default()
};
let prepared = crate::modules::channel_controller::prepare_connection(
- &ModuleClient::new(config.clone()),
+ &crate::modules::ops::client(config.clone()),
ChannelControllerRequest::PrepareConnect {
config: config.channels_config.clone(),
channel: channel_id.to_owned(),
@@ -149,7 +149,7 @@ fn update_matches_scope(
}
fn malformed() -> String {
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
ModuleCallError::ModuleFault.to_string()
}
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs
index f9e3599494..17abe872f8 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::client::ModuleClient::new(config.clone());
+ let client = crate::modules::ops::client(config.clone());
use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult};
match client
.call_confidential(
@@ -47,8 +47,8 @@ pub(crate) async fn channel_config_connected(
{
ChannelControlResult::Connected(connected) => Ok(connected),
_ => {
- crate::modules::client::ModuleClient::report_malformed_reply("tinychannels");
- Err(crate::modules::client::ModuleCallError::ModuleFault.to_string())
+ crate::modules::report::malformed_reply("tinychannels");
+ Err(tinybus::module::ModuleCallError::ModuleFault.to_string())
}
}
}
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.rs
index f8bf1ba375..aa0a61d4b8 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
@@ -5,7 +5,7 @@ use tinychannels_bus::{methods, ChannelControllerRequest, ChannelControllerResul
use crate::config::Config;
use crate::core::Outcome;
-use crate::modules::client::{ModuleCallError, ModuleClient};
+use tinybus::module::{ModuleCallError, ModuleClient};
use tinychannels_bus::controllers::ChannelAuthMode;
use tinychannels_bus::controllers::ChannelTestResult;
@@ -18,7 +18,7 @@ pub async fn test_channel(
auth_mode: ChannelAuthMode,
credentials_value: Value,
) -> Result<Outcome<ChannelTestResult>, String> {
- let response = ModuleClient::new(config.clone())
+ let response = crate::modules::ops::client(config.clone())
.call_confidential(
"tinychannels",
methods::CHANNEL_CONTROLLER,
@@ -34,7 +34,7 @@ pub async fn test_channel(
match response {
ChannelControllerResult::TestChannel(result) => Ok(Outcome::new(result, vec![])),
_ => {
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
Err(ModuleCallError::ModuleFault.to_string())
}
}
diff --git a/crates/openhuman-core/src/channels/controllers/ops/discord.rs b/crates/openhuman-core/src/channels/controllers/ops/discord.rs
index 51fc027537..73f0390fd0 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/discord.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/discord.rs
@@ -42,7 +42,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(
- &ModuleClient::new(config.clone()),
+ &crate::modules::ops::client(config.clone()),
ChannelControllerRequest::DiscordListGuilds {
config: config.channels_config.clone(),
bot_token: token,
@@ -65,7 +65,7 @@ pub async fn discord_list_channels(
}
let token = discord_bot_token(config).await?;
let channels = channel_controller::discord(
- &ModuleClient::new(config.clone()),
+ &crate::modules::ops::client(config.clone()),
ChannelControllerRequest::DiscordListChannels {
config: config.channels_config.clone(),
guild_id: guild_id.to_owned(),
@@ -93,7 +93,7 @@ pub async fn discord_check_permissions(
}
let token = discord_bot_token(config).await?;
let check = channel_controller::discord(
- &ModuleClient::new(config.clone()),
+ &crate::modules::ops::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.rs
index 9a55c8bb10..24c380970b 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::client::ModuleClient::new(config.clone()),
+ &crate::modules::ops::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.rs
index 67d0ef5c64..72a129ee12 100644
--- a/crates/openhuman-core/src/channels/host/channel_events.rs
+++ b/crates/openhuman-core/src/channels/host/channel_events.rs
@@ -1,7 +1,7 @@
//! Host-owned approval routing and turn events over the channel module.
use crate::channels::{Channel, ChannelSendExt, SendMessage};
use crate::core::events::DomainEvent;
-use crate::modules::client::ModuleClient;
+use tinybus::module::ModuleClient;
use async_trait::async_trait;
use std::collections::HashMap;
use std::path::PathBuf;
@@ -48,7 +48,7 @@ impl ChannelApprovalSurfaceSubscriber {
if self.config.is_none() {
return crate::channels::module_fixture::client().await;
}
- ModuleClient::new(self.config.as_deref().cloned().unwrap_or_default())
+ crate::modules::ops::client(self.config.as_deref().cloned().unwrap_or_default())
}
}
#[async_trait]
@@ -165,7 +165,7 @@ impl EventHandler<DomainEvent> for ChannelApprovalSurfaceSubscriber {
.await;
}
Ok(_) => {
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
}
Err(_) => {}
}
@@ -208,10 +208,10 @@ impl ChannelTurnStateSubscriber {
let client = if self.config.is_none() {
crate::channels::module_fixture::client().await
} else {
- ModuleClient::new(self.config.as_deref().cloned().unwrap_or_default())
+ crate::modules::ops::client(self.config.as_deref().cloned().unwrap_or_default())
};
#[cfg(not(test))]
- let client = ModuleClient::new(self.config.as_deref().cloned().unwrap_or_default());
+ let client = crate::modules::ops::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/module_fixture_tests.rs b/crates/openhuman-core/src/channels/module_fixture_tests.rs
index ac7ec108f6..37f5f547a6 100644
--- a/crates/openhuman-core/src/channels/module_fixture_tests.rs
+++ b/crates/openhuman-core/src/channels/module_fixture_tests.rs
@@ -8,7 +8,7 @@
//! on a process-lifetime runtime, so it outlives the short Tokio runtimes of
//! individual tests.
-use crate::modules::client::ModuleClient;
+use tinybus::module::ModuleClient;
use tinychannels_bus::methods;
/// Return a client for the compiled, linked TinyChannels module fixture.
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rs
index a24e279c32..f59005013f 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<Outcome
let 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::client::ModuleClient::new(config.clone()),
+ &crate::modules::ops::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::client::ModuleClient::new(config.clone());
+ let client = crate::modules::ops::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::client::ModuleClient::new(config.clone()),
+ &crate::modules::ops::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/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 17ea513760..7834fc2214 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -179,7 +179,7 @@ pub(crate) async fn handle_runtime_command_if_needed(
let close = lease.close().await;
let response = response?;
close?;
- Ok::<_, crate::modules::client::ModuleCallError>(response)
+ Ok::<_, tinybus::module::ModuleCallError>(response)
}
.await;
let (reply, next_route, clear_history) = match operation {
@@ -189,7 +189,7 @@ pub(crate) async fn handle_runtime_command_if_needed(
clear_history,
}) => (reply, next_route, clear_history),
Ok(_) => {
- crate::modules::client::ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
return true;
}
Err(_) => {
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
index adb7e33ccc..4684820e10 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -178,7 +178,7 @@ pub(crate) async fn process_channel_runtime_message(
emoji,
)) => Some(emoji),
Ok(_) => {
- crate::modules::client::ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
None
}
Err(_) => None,
diff --git a/crates/openhuman-core/src/channels/runtime/startup.rs b/crates/openhuman-core/src/channels/runtime/startup.rs
index 52e7210ede..9c820483d0 100644
--- a/crates/openhuman-core/src/channels/runtime/startup.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup.rs
@@ -11,7 +11,7 @@ mod relay;
mod start_channels;
mod turn_parts;
-use crate::modules::client::{ModuleCallError, ModuleClient};
+use tinybus::module::{ModuleCallError, ModuleClient};
use anyhow::Result;
/// Ask the owning module to prepare effective execution limits for this host
@@ -43,7 +43,7 @@ pub(crate) async fn prepare_runtime_limits(
Ok((timeout_secs, max_in_flight))
}
_ => {
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
Err(anyhow::Error::new(ModuleCallError::ModuleFault)
.context("channel runtime returned invalid runtime limits"))
}
diff --git a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
index 4b2a6cf564..f69a129942 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
@@ -5,7 +5,7 @@ use super::credentials::hydrate_channel_credentials;
use crate::channels::runtime::dispatch::RuntimeChannelMessage;
use crate::config::Config;
use crate::modules::channel_runtime::ChannelRuntimeLease;
-use crate::modules::client::{ModuleCallError, ModuleClient, ModuleObjectClient};
+use tinybus::module::{ModuleCallError, ModuleClient, ModuleObjectClient};
use anyhow::{Context, Result};
use async_trait::async_trait;
use std::collections::HashMap;
@@ -45,7 +45,7 @@ impl ModuleChannelRuntime {
context: Arc<OnceLock<Weak<crate::channels::context::ChannelRuntimeContext>>>,
dispatch: mpsc::Sender<RuntimeChannelMessage>,
) -> Result<Self> {
- let client = ModuleClient::new((*config).clone());
+ let client = crate::modules::ops::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.rs
index 716b712058..420452816b 100644
--- a/crates/openhuman-core/src/hosting/mod.rs
+++ b/crates/openhuman-core/src/hosting/mod.rs
@@ -27,7 +27,7 @@ type CallFixture =
/// One configured hosting account and its authorized workspace.
#[derive(Clone)]
pub struct Account {
- client: crate::modules::client::ModuleClient,
+ client: tinybus::module::ModuleClient,
provider: String,
api_key: String,
team: Option<String>,
@@ -83,7 +83,7 @@ impl Account {
return Ok(None);
}
Ok(Some(Self {
- client: crate::modules::client::ModuleClient::new(config.clone()),
+ client: crate::modules::ops::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::client::ModuleClient::new(config),
+ client: crate::modules::ops::client(config),
provider: "vercel".to_owned(),
api_key: api_key.trim().to_owned(),
team: team
@@ -158,14 +158,14 @@ impl Account {
let response = self.call_providers().await?;
let providers: Vec<String> =
serde_json::from_str(&response).map_err(|_| {
- crate::modules::client::ModuleClient::report_malformed_reply("tinyhosts");
+ crate::modules::report::malformed_reply("tinyhosts");
anyhow::anyhow!(
- crate::modules::client::ModuleCallError::ModuleFault.to_string()
+ tinybus::module::ModuleCallError::ModuleFault.to_string()
)
})?;
if !providers.iter().any(|provider| provider == &self.provider) {
- crate::modules::client::ModuleClient::report_unavailable("tinyhosts");
- anyhow::bail!(crate::modules::client::ModuleCallError::Unavailable.to_string());
+ crate::modules::report::unavailable("tinyhosts");
+ anyhow::bail!(tinybus::module::ModuleCallError::Unavailable.to_string());
}
Ok::<(), anyhow::Error>(())
})
@@ -190,9 +190,9 @@ impl Account {
.await
.map_err(|error| anyhow::anyhow!(error.to_string()))?;
if !outcome.matches(&operation) {
- crate::modules::client::ModuleClient::report_malformed_reply("tinyhosts");
+ crate::modules::report::malformed_reply("tinyhosts");
return Err(anyhow::anyhow!(
- crate::modules::client::ModuleCallError::ModuleFault.to_string()
+ tinybus::module::ModuleCallError::ModuleFault.to_string()
));
}
Ok(outcome)
@@ -212,7 +212,7 @@ impl Account {
async fn call_execute_json(
&self,
request: &str,
- ) -> Result<tinyhosts_bus::rpc::Outcome, crate::modules::client::ModuleCallError> {
+ ) -> Result<tinyhosts_bus::rpc::Outcome, tinybus::module::ModuleCallError> {
#[cfg(test)]
if let Some(fixture) = &self.call_fixture {
let response = fixture(
@@ -220,10 +220,10 @@ impl Account {
serde_json::json!([request]),
true,
)
- .map_err(|_| crate::modules::client::ModuleCallError::ModuleFault)?;
+ .map_err(|_| tinybus::module::ModuleCallError::ModuleFault)?;
return serde_json::from_str(&response).map_err(|_| {
- crate::modules::client::ModuleClient::report_malformed_reply("tinyhosts");
- crate::modules::client::ModuleCallError::ModuleFault
+ crate::modules::report::malformed_reply("tinyhosts");
+ tinybus::module::ModuleCallError::ModuleFault
});
}
self.client
diff --git a/crates/openhuman-core/src/hosting/tools.rs b/crates/openhuman-core/src/hosting/tools.rs
index 9647a4a85a..e27b4a5fdb 100644
--- a/crates/openhuman-core/src/hosting/tools.rs
+++ b/crates/openhuman-core/src/hosting/tools.rs
@@ -85,7 +85,7 @@ fn pretty(outcome: Outcome) -> anyhow::Result<ToolResult> {
}
fn unexpected() -> anyhow::Error {
- anyhow::anyhow!(crate::modules::client::ModuleCallError::ModuleFault.to_string())
+ anyhow::anyhow!(tinybus::module::ModuleCallError::ModuleFault.to_string())
}
impl HostingTool {
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index 3f5d16a826..1efb89c027 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -174,8 +174,8 @@ 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) -> crate::modules::client::ModuleClient {
- crate::modules::client::ModuleClient::new(config.clone())
+pub(super) fn client(config: &crate::config::Config) -> tinybus::module::ModuleClient {
+ crate::modules::ops::client(config.clone())
}
/// Everything the module considers about one tool result.
@@ -348,7 +348,7 @@ fn compacted_from(response: tinyjuice_bus::wire::CompactResponse) -> CompactedTo
}
async fn record_savings(
- client: &crate::modules::client::ModuleClient,
+ client: &tinybus::module::ModuleClient,
response: &tinyjuice_bus::wire::CompactResponse,
) {
use std::str::FromStr as _;
diff --git a/crates/openhuman-core/src/inference/tokenjuice/savings.rs b/crates/openhuman-core/src/inference/tokenjuice/savings.rs
index 594825ddd7..d004e69b95 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/savings.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/savings.rs
@@ -28,7 +28,7 @@ fn model_slot() -> &'static Mutex<String> {
/// Install the attribution model (host policy) and point the module at the
/// snapshot location; the module loads a prior snapshot once per path.
pub async fn configure(
- client: &crate::modules::client::ModuleClient,
+ client: &tinybus::module::ModuleClient,
attribution_model: String,
workspace_dir: &std::path::Path,
) -> Result<(), String> {
@@ -97,7 +97,7 @@ fn request_for(
/// Record one compaction's savings through the module.
pub async fn record(
- client: &crate::modules::client::ModuleClient,
+ client: &tinybus::module::ModuleClient,
compressor: CompressorKind,
original_tokens: u64,
compacted_tokens: u64,
@@ -115,7 +115,7 @@ pub async fn record(
/// Snapshot the module's savings aggregate.
pub async fn stats(
- client: &crate::modules::client::ModuleClient,
+ client: &tinybus::module::ModuleClient,
) -> Result<SavingsAggregate, String> {
client
.call(MODULE, methods::SAVINGS_STATS, ())
@@ -124,7 +124,7 @@ pub async fn stats(
}
/// Clear all recorded savings (and the persisted snapshot).
-pub async fn reset(client: &crate::modules::client::ModuleClient) -> Result<(), String> {
+pub async fn reset(client: &tinybus::module::ModuleClient) -> Result<(), String> {
client
.call::<()>(MODULE, methods::RESET_SAVINGS, ())
.await
diff --git a/crates/openhuman-core/src/integrations/composio/module_client.rs b/crates/openhuman-core/src/integrations/composio/module_client.rs
index 0f96492f2f..ee0677f29d 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 @@ where
Request: serde::Serialize + Send,
Reply: serde::de::DeserializeOwned,
{
- crate::modules::client::ModuleClient::new(_config.clone())
+ crate::modules::ops::client(_config.clone())
.call::<Reply>("tinyconnectors", member, (_request,))
.await
.map_err(|error| format!("{member}: {error}; {WITHOUT_MODULES}"))
@@ -227,7 +227,7 @@ where
Request: serde::Serialize + Send,
Reply: serde::de::DeserializeOwned,
{
- crate::modules::client::ModuleClient::new(_config.clone())
+ crate::modules::ops::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::client::ModuleClient::new(_config.clone())
+ crate::modules::ops::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.rs
index 6d043f4c14..78406810b9 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::client::ModuleClient::new(config.clone())
+ crate::modules::ops::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.rs
index 0cc3b09158..c11a4677b9 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::client::ModuleClient::new(config.clone()),
+ &crate::modules::ops::client(config.clone()),
tool,
arguments,
timezone,
@@ -24,7 +24,7 @@ pub(crate) async fn prepare(
}
async fn prepare_with(
- client: &crate::modules::client::ModuleClient,
+ client: &tinybus::module::ModuleClient,
tool: &str,
arguments: Option<serde_json::Value>,
timezone: Option<String>,
@@ -56,7 +56,7 @@ pub(crate) async fn filter(
response: super::types::ComposioExecuteResponse,
since: String,
) -> Result<super::types::ComposioExecuteResponse, String> {
- crate::modules::client::ModuleClient::new(config.clone())
+ crate::modules::ops::client(config.clone())
.call(
"tinyconnectors",
methods::FILTER_RESPONSE,
diff --git a/crates/openhuman-core/src/integrations/composio/processing_tests.rs b/crates/openhuman-core/src/integrations/composio/processing_tests.rs
index 93bba62c17..003d04658c 100644
--- a/crates/openhuman-core/src/integrations/composio/processing_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/processing_tests.rs
@@ -65,7 +65,7 @@ async fn preparation_forwards_host_context_and_preserves_module_validation_error
.request_name("test.ConnectorProcessing")
.await
.unwrap();
- let client = crate::modules::client::ModuleClient::fixture(
+ let client = tinybus::module::ModuleClient::fixture(
caller
.proxy(
"test.ConnectorProcessing",
diff --git a/crates/openhuman-core/src/integrations/composio/trigger_history.rs b/crates/openhuman-core/src/integrations/composio/trigger_history.rs
index a3167a629b..c8698bf7e7 100644
--- a/crates/openhuman-core/src/integrations/composio/trigger_history.rs
+++ b/crates/openhuman-core/src/integrations/composio/trigger_history.rs
@@ -11,7 +11,7 @@ use super::types::{
ComposioTriggerEvent, ComposioTriggerHistoryEntry, ComposioTriggerHistoryResult,
};
use crate::config::Config;
-use crate::modules::client::ModuleClient;
+use tinybus::module::ModuleClient;
use tinyconnectors_bus::names::methods;
static GLOBAL_TRIGGER_HISTORY: OnceLock<Arc<TriggerHistory>> = OnceLock::new();
@@ -36,7 +36,7 @@ impl TriggerHistory {
if let Some(client) = self.fixture.as_ref() {
return client.clone();
}
- ModuleClient::new(config.clone())
+ crate::modules::ops::client(config.clone())
}
async fn ensure_lease(
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rs
index cec5b9a75c..71701f77fe 100644
--- a/crates/openhuman-core/src/mcp/module_client.rs
+++ b/crates/openhuman-core/src/mcp/module_client.rs
@@ -28,7 +28,7 @@ use tinymcp_bus::{
use crate::{
config::Config,
- modules::{client::ModuleCallError, client::ModuleClient},
+ ,
};
const MODULE: &str = "tinymcp";
@@ -413,7 +413,7 @@ impl McpConfiguredClient {
.call_object(&object.object_path, member, args, confidential)
.await?;
serde_json::from_value(reply).map_err(|_| {
- ModuleClient::report_malformed_reply(MODULE);
+ crate::modules::report::malformed_reply(MODULE);
ModuleCallError::ModuleFault
})
}
diff --git a/crates/openhuman-core/src/mcp/module_client/lifecycle.rs b/crates/openhuman-core/src/mcp/module_client/lifecycle.rs
index 15bd234f30..203e76a218 100644
--- a/crates/openhuman-core/src/mcp/module_client/lifecycle.rs
+++ b/crates/openhuman-core/src/mcp/module_client/lifecycle.rs
@@ -20,15 +20,15 @@ impl McpConfiguredClient {
/// serialized by the client itself.
pub(crate) fn for_config(config: &Config) -> Result<Arc<Self>, ModuleCallError> {
if SHUTTING_DOWN.load(Ordering::Acquire) {
- ModuleClient::report_unavailable(MODULE);
+ crate::modules::report::unavailable(MODULE);
return Err(ModuleCallError::Unavailable);
}
if !config.modules.enabled {
- ModuleClient::report_unavailable(MODULE);
+ crate::modules::report::unavailable(MODULE);
return Err(ModuleCallError::Unavailable);
}
if current_agent_context_is_removed() {
- ModuleClient::report_unavailable(MODULE);
+ crate::modules::report::unavailable(MODULE);
return Err(ModuleCallError::Unavailable);
}
let data_dir = crate::core::runtime::agent_scope_dir(config);
@@ -41,7 +41,7 @@ impl McpConfiguredClient {
.map_err(|error| match error {
AdmitError::Create(error) => error,
_ => {
- ModuleClient::report_unavailable(MODULE);
+ crate::modules::report::unavailable(MODULE);
ModuleCallError::Unavailable
}
})
@@ -115,7 +115,7 @@ impl McpConfiguredClient {
Ok(Self::with_port(
data_dir,
Box::new(TinyMcpPort {
- root: ModuleClient::new(config.clone()),
+ root: crate::modules::ops::client(config.clone()),
}),
))
}
diff --git a/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs b/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs
index ebdbb5a025..79e6d241c3 100644
--- a/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs
+++ b/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs
@@ -15,10 +15,10 @@ impl crate::mcp::module_client::McpModulePort for RecoveringModulePort {
&self,
_data_dir: &str,
_config: &tinymcp_bus::McpClientConfig,
- ) -> Result<tinymcp_bus::OpenConfiguredResponse, crate::modules::client::ModuleCallError> {
+ ) -> Result<tinymcp_bus::OpenConfiguredResponse, tinybus::module::ModuleCallError> {
self.opens.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
if !self.available.load(std::sync::atomic::Ordering::SeqCst) {
- return Err(crate::modules::client::ModuleCallError::Unavailable);
+ return Err(tinybus::module::ModuleCallError::Unavailable);
}
Ok(tinymcp_bus::OpenConfiguredResponse {
object_path: "/test/mcp".into(),
@@ -29,14 +29,14 @@ impl crate::mcp::module_client::McpModulePort for RecoveringModulePort {
async fn close(
&self,
_data_dir: &str,
- ) -> Result<Option<String>, crate::modules::client::ModuleCallError> {
+ ) -> Result<Option<String>, tinybus::module::ModuleCallError> {
Ok(None)
}
async fn transition_status(
&self,
_transition_id: &str,
- ) -> Result<tinymcp_bus::TransitionStatus, crate::modules::client::ModuleCallError> {
+ ) -> Result<tinymcp_bus::TransitionStatus, tinybus::module::ModuleCallError> {
Ok(tinymcp_bus::TransitionStatus::Complete)
}
@@ -46,36 +46,36 @@ impl crate::mcp::module_client::McpModulePort for RecoveringModulePort {
member: &str,
args: serde_json::Value,
_confidential: bool,
- ) -> Result<serde_json::Value, crate::modules::client::ModuleCallError> {
+ ) -> Result<serde_json::Value, tinybus::module::ModuleCallError> {
if !self.available.load(std::sync::atomic::Ordering::SeqCst) {
- return Err(crate::modules::client::ModuleCallError::Unavailable);
+ return Err(tinybus::module::ModuleCallError::Unavailable);
}
self.calls.lock().unwrap().push(member.to_owned());
match member {
tinymcp_bus::names::methods::NORMALIZE_TOOL_ARGUMENTS => args
.get(0)
.cloned()
- .ok_or(crate::modules::client::ModuleCallError::ModuleFault),
+ .ok_or(tinybus::module::ModuleCallError::ModuleFault),
tinymcp_bus::names::methods::TOOL_CALL => {
serde_json::to_value(tinymcp_bus::ToolCallOutcome {
result: json!({"content":[{"type":"text","text":"loaded"}]}),
is_error: false,
rendered: tinymcp_bus::McpToolResult::success("loaded"),
})
- .map_err(|_| crate::modules::client::ModuleCallError::ModuleFault)
+ .map_err(|_| tinybus::module::ModuleCallError::ModuleFault)
}
tinymcp_bus::names::methods::RENDER_TOOL_OUTPUT => {
serde_json::to_value("lazy-loaded forecast")
- .map_err(|_| crate::modules::client::ModuleCallError::ModuleFault)
+ .map_err(|_| tinybus::module::ModuleCallError::ModuleFault)
}
- _ => Err(crate::modules::client::ModuleCallError::IncompatibleContract),
+ _ => Err(tinybus::module::ModuleCallError::IncompatibleContract),
}
}
async fn prepare_agent_tools(
&self,
_request: tinymcp_bus::PrepareAgentToolsRequest,
- ) -> Result<Vec<tinymcp_bus::McpToolPresentation>, crate::modules::client::ModuleCallError>
+ ) -> Result<Vec<tinymcp_bus::McpToolPresentation>, tinybus::module::ModuleCallError>
{
Ok(Vec::new())
}
@@ -83,7 +83,7 @@ impl crate::mcp::module_client::McpModulePort for RecoveringModulePort {
async fn validate_server_arguments(
&self,
request: tinymcp_bus::ValidateServerArgumentsRequest,
- ) -> Result<tinymcp_bus::ServerArgumentsValidation, crate::modules::client::ModuleCallError>
+ ) -> Result<tinymcp_bus::ServerArgumentsValidation, tinybus::module::ModuleCallError>
{
Ok(tinymcp_bus::ServerArgumentsValidation::Valid(
request.arguments.as_object().cloned().unwrap_or_default(),
diff --git a/crates/openhuman-core/src/mcp/registry/config_ops_tests.rs b/crates/openhuman-core/src/mcp/registry/config_ops_tests.rs
index 5025790e39..3d6acae5fd 100644
--- a/crates/openhuman-core/src/mcp/registry/config_ops_tests.rs
+++ b/crates/openhuman-core/src/mcp/registry/config_ops_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::mcp::module_client::{McpConfiguredClient, McpModulePort};
-use crate::modules::client::ModuleCallError;
+use tinybus::module::ModuleCallError;
use async_trait::async_trait;
use serde_json::Value;
use std::sync::{Arc, Mutex};
diff --git a/crates/openhuman-core/src/mcp/registry/mod.rs b/crates/openhuman-core/src/mcp/registry/mod.rs
index 187855d351..a4fd84b54e 100644
--- a/crates/openhuman-core/src/mcp/registry/mod.rs
+++ b/crates/openhuman-core/src/mcp/registry/mod.rs
@@ -82,7 +82,7 @@ pub mod connections {
config: &Config,
member: &str,
args: impl serde::Serialize,
- ) -> Result<R, crate::modules::client::ModuleCallError> {
+ ) -> Result<R, tinybus::module::ModuleCallError> {
crate::mcp::module_client::McpConfiguredClient::for_config(config)?
.call(&host::client_config(config), member, args)
.await
diff --git a/crates/openhuman-core/src/mcp/registry/ops_tests.rs b/crates/openhuman-core/src/mcp/registry/ops_tests.rs
index 9faa506897..d0e83969ed 100644
--- a/crates/openhuman-core/src/mcp/registry/ops_tests.rs
+++ b/crates/openhuman-core/src/mcp/registry/ops_tests.rs
@@ -7,7 +7,7 @@
use super::*;
use crate::mcp::module_client::{McpConfiguredClient, McpModulePort};
-use crate::modules::client::ModuleCallError;
+use tinybus::module::ModuleCallError;
use async_trait::async_trait;
use serde_json::Value;
use std::sync::{Arc, Mutex};
diff --git a/crates/openhuman-core/src/mcp/registry/tools_tests.rs b/crates/openhuman-core/src/mcp/registry/tools_tests.rs
index 2de22641e6..120202630d 100644
--- a/crates/openhuman-core/src/mcp/registry/tools_tests.rs
+++ b/crates/openhuman-core/src/mcp/registry/tools_tests.rs
@@ -258,7 +258,7 @@ impl crate::mcp::module_client::McpModulePort for ToolCallPort {
&self,
_data_dir: &str,
_config: &tinymcp_bus::McpClientConfig,
- ) -> Result<tinymcp_bus::OpenConfiguredResponse, crate::modules::client::ModuleCallError> {
+ ) -> Result<tinymcp_bus::OpenConfiguredResponse, tinybus::module::ModuleCallError> {
Ok(tinymcp_bus::OpenConfiguredResponse {
object_path: "/test/mcp".to_owned(),
transition_id: "open-test".to_owned(),
@@ -268,14 +268,14 @@ impl crate::mcp::module_client::McpModulePort for ToolCallPort {
async fn close(
&self,
_data_dir: &str,
- ) -> Result<Option<String>, crate::modules::client::ModuleCallError> {
+ ) -> Result<Option<String>, tinybus::module::ModuleCallError> {
Ok(None)
}
async fn transition_status(
&self,
_transition_id: &str,
- ) -> Result<tinymcp_bus::TransitionStatus, crate::modules::client::ModuleCallError> {
+ ) -> Result<tinymcp_bus::TransitionStatus, tinybus::module::ModuleCallError> {
Ok(tinymcp_bus::TransitionStatus::Complete)
}
@@ -285,7 +285,7 @@ impl crate::mcp::module_client::McpModulePort for ToolCallPort {
member: &str,
args: Value,
_confidential: bool,
- ) -> Result<Value, crate::modules::client::ModuleCallError> {
+ ) -> Result<Value, tinybus::module::ModuleCallError> {
match member {
tinymcp_bus::names::methods::STATUS => {
let statuses = self.connected.then(|| tinymcp_bus::ConnStatus {
@@ -298,14 +298,14 @@ impl crate::mcp::module_client::McpModulePort for ToolCallPort {
auth_hint: None,
});
serde_json::to_value(statuses.into_iter().collect::<Vec<_>>())
- .map_err(|_| crate::modules::client::ModuleCallError::ModuleFault)
+ .map_err(|_| tinybus::module::ModuleCallError::ModuleFault)
}
tinymcp_bus::names::methods::LIST_TOOLS => {
if self.connected {
serde_json::to_value(vec![tinymcp_bus::McpTool::new("forecast")])
- .map_err(|_| crate::modules::client::ModuleCallError::ModuleFault)
+ .map_err(|_| tinybus::module::ModuleCallError::ModuleFault)
} else {
- Err(crate::modules::client::ModuleCallError::ModuleFault)
+ Err(tinybus::module::ModuleCallError::ModuleFault)
}
}
tinymcp_bus::names::methods::CONNECTED_OVERVIEW => {
@@ -320,37 +320,37 @@ impl crate::mcp::module_client::McpModulePort for ToolCallPort {
tools: vec![tinymcp_bus::McpTool::new("forecast")],
});
serde_json::to_value(overview.into_iter().collect::<Vec<_>>())
- .map_err(|_| crate::modules::client::ModuleCallError::ModuleFault)
+ .map_err(|_| tinybus::module::ModuleCallError::ModuleFault)
}
tinymcp_bus::names::methods::TOOL_CALL => {
let arguments = args
.get(2)
.cloned()
- .ok_or(crate::modules::client::ModuleCallError::ModuleFault)?;
+ .ok_or(tinybus::module::ModuleCallError::ModuleFault)?;
self.arguments.lock().unwrap().push(arguments);
serde_json::to_value(tinymcp_bus::ToolCallOutcome {
result: json!({"content":[{"type":"text","text":"sunny"}]}),
is_error: false,
rendered: tinymcp_bus::McpToolResult::success("sunny"),
})
- .map_err(|_| crate::modules::client::ModuleCallError::ModuleFault)
+ .map_err(|_| tinybus::module::ModuleCallError::ModuleFault)
}
- _ => Err(crate::modules::client::ModuleCallError::IncompatibleContract),
+ _ => Err(tinybus::module::ModuleCallError::IncompatibleContract),
}
}
async fn validate_server_arguments(
&self,
_request: tinymcp_bus::ValidateServerArgumentsRequest,
- ) -> Result<tinymcp_bus::ServerArgumentsValidation, crate::modules::client::ModuleCallError>
+ ) -> Result<tinymcp_bus::ServerArgumentsValidation, tinybus::module::ModuleCallError>
{
- Err(crate::modules::client::ModuleCallError::IncompatibleContract)
+ Err(tinybus::module::ModuleCallError::IncompatibleContract)
}
async fn normalize_tool_arguments(
&self,
arguments: Option<Value>,
- ) -> Result<serde_json::Map<String, Value>, crate::modules::client::ModuleCallError> {
+ ) -> Result<serde_json::Map<String, Value>, tinybus::module::ModuleCallError> {
self.normalized_arguments
.lock()
.unwrap()
@@ -361,15 +361,15 @@ impl crate::mcp::module_client::McpModulePort for ToolCallPort {
Value::String(encoded) => serde_json::from_str::<Value>(&encoded)
.ok()
.and_then(|value| value.as_object().cloned())
- .ok_or(crate::modules::client::ModuleCallError::ModuleFault),
- _ => Err(crate::modules::client::ModuleCallError::ModuleFault),
+ .ok_or(tinybus::module::ModuleCallError::ModuleFault),
+ _ => Err(tinybus::module::ModuleCallError::ModuleFault),
}
}
async fn prepare_agent_tools(
&self,
_request: tinymcp_bus::PrepareAgentToolsRequest,
- ) -> Result<Vec<tinymcp_bus::McpToolPresentation>, crate::modules::client::ModuleCallError>
+ ) -> Result<Vec<tinymcp_bus::McpToolPresentation>, tinybus::module::ModuleCallError>
{
Ok(Vec::new())
}
diff --git a/crates/openhuman-core/src/mcp/server/module.rs b/crates/openhuman-core/src/mcp/server/module.rs
index 392e6677f7..7b2ad0f142 100644
--- a/crates/openhuman-core/src/mcp/server/module.rs
+++ b/crates/openhuman-core/src/mcp/server/module.rs
@@ -22,7 +22,7 @@ use uuid::Uuid;
use crate::{
config::Config,
- modules::{client::ModuleCallError, client::ModuleClient},
+ ,
};
use super::handler;
@@ -184,7 +184,7 @@ impl ServerSession {
pub(super) fn port_for_config(config: &Config) -> Arc<dyn ServerPort> {
Self::register_shutdown_hook(config.clone());
Arc::new(TinyMcpPort {
- client: ModuleClient::new(config.clone()),
+ client: crate::modules::ops::client(config.clone()),
})
}
@@ -195,7 +195,7 @@ impl ServerSession {
crate::core::shutdown::register(move || {
let config = config.clone();
async move {
- let client = ModuleClient::new(config);
+ let client = crate::modules::ops::client(config);
if let Err(error) = client
.call::<usize>(MODULE, names::methods::SERVER_SHUTDOWN, ())
.await
diff --git a/crates/openhuman-core/src/modules/accessibility.rs b/crates/openhuman-core/src/modules/accessibility.rs
index c184c590a1..01664669e6 100644
--- a/crates/openhuman-core/src/modules/accessibility.rs
+++ b/crates/openhuman-core/src/modules/accessibility.rs
@@ -3,7 +3,7 @@
use serde::{de::DeserializeOwned, Serialize};
use tinycomputer_bus::{names::accessibility as methods, DesktopError, DesktopResponse};
-use super::client::{ModuleCallError, ModuleClient};
+use tinybus::module::{ModuleCallError, ModuleClient};
use crate::config::Config;
pub use tinycomputer_bus::accessibility::{
@@ -43,7 +43,7 @@ pub struct AccessibilityClient {
impl AccessibilityClient {
pub fn new(config: &Config) -> Self {
Self {
- client: ModuleClient::new(config.clone()),
+ client: crate::modules::ops::client(config.clone()),
computer_enabled: config.components.computer,
}
}
@@ -197,7 +197,7 @@ fn decode<T: DeserializeOwned>(raw: serde_json::Value) -> Result<T, Accessibilit
}
fn malformed() -> AccessibilityError {
- ModuleClient::report_malformed_reply(MODULE);
+ crate::modules::report::malformed_reply(MODULE);
AccessibilityError::Bus(ModuleCallError::ModuleFault)
}
diff --git a/crates/openhuman-core/src/modules/channel_controller.rs b/crates/openhuman-core/src/modules/channel_controller.rs
index 2d966ff17f..193bab108a 100644
--- a/crates/openhuman-core/src/modules/channel_controller.rs
+++ b/crates/openhuman-core/src/modules/channel_controller.rs
@@ -1,5 +1,5 @@
//! Thin adapters for module-owned channel controller operations.
-use super::client::{ModuleCallError, ModuleClient};
+use tinybus::module::{ModuleCallError, ModuleClient};
use serde::de::DeserializeOwned;
use tinychannels_bus::{
methods, ChannelControllerRequest, ChannelControllerResult, HttpProxyPolicy,
@@ -37,7 +37,7 @@ fn decode_discord<R: DeserializeOwned>(
};
raw.and_then(|value| serde_json::from_value(value).ok())
.ok_or_else(|| {
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
ModuleCallError::ModuleFault
})
}
@@ -53,7 +53,7 @@ pub(crate) async fn prepare_connection(
match response {
ChannelControllerResult::PreparedConnect(prepared) => Ok(*prepared),
_ => {
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
Err(ModuleCallError::ModuleFault)
}
}
diff --git a/crates/openhuman-core/src/modules/channel_controller_tests.rs b/crates/openhuman-core/src/modules/channel_controller_tests.rs
index b5d9a4ed5f..e782fa8daa 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_fallback
let mut config = crate::config::Config::default();
config.modules.enabled = false;
let result = prepare_identity(
- &ModuleClient::new(config),
+ &crate::modules::ops::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_health.rs b/crates/openhuman-core/src/modules/channel_health.rs
index e3481adff3..9668cb08ca 100644
--- a/crates/openhuman-core/src/modules/channel_health.rs
+++ b/crates/openhuman-core/src/modules/channel_health.rs
@@ -1,5 +1,5 @@
//! Thin confidential adapter for TinyChannels' provider health checks.
-use super::client::{ModuleCallError, ModuleClient};
+use tinybus::module::{ModuleCallError, ModuleClient};
use tinychannels_bus::{ChannelHealthReport, ChannelsConfig, HttpProxyPolicy};
pub(crate) async fn check(
diff --git a/crates/openhuman-core/src/modules/channel_runtime.rs b/crates/openhuman-core/src/modules/channel_runtime.rs
index 7be4cb5d95..9b8b332832 100644
--- a/crates/openhuman-core/src/modules/channel_runtime.rs
+++ b/crates/openhuman-core/src/modules/channel_runtime.rs
@@ -1,6 +1,6 @@
//! Identity-scoped channel objects and cancellation-safe callback ownership.
-use super::client::{ModuleCallError, ModuleClient, ModuleObjectClient};
+use tinybus::module::{ModuleCallError, ModuleClient, ModuleObjectClient};
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
@@ -225,7 +225,7 @@ fn validate_reservation(reservation: &ChannelRuntimeReservation) -> Result<(), M
|| reservation.host_object_path
!= format!("{HOST_OBJECT_PATH}/runtime_{}", reservation.handle)
{
- ModuleClient::report_malformed_reply("tinychannels");
+ crate::modules::report::malformed_reply("tinychannels");
return Err(ModuleCallError::ModuleFault);
}
Ok(())
diff --git a/crates/openhuman-core/src/modules/channel_runtime_tests.rs b/crates/openhuman-core/src/modules/channel_runtime_tests.rs
index c42bbb03de..433c3b887d 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(
- ModuleClient::new(config.clone()),
+ crate::modules::ops::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(
- ModuleClient::new(config),
+ crate::modules::ops::client(config),
TransportFixture {
sends: second_sends.clone(),
expected_text: final_text.clone(),
diff --git a/crates/openhuman-core/src/modules/connectors.rs b/crates/openhuman-core/src/modules/connectors.rs
index 4265b75ae8..724a83db9b 100644
--- a/crates/openhuman-core/src/modules/connectors.rs
+++ b/crates/openhuman-core/src/modules/connectors.rs
@@ -309,7 +309,7 @@ async fn ensure_routed(config: &Config, proxy: &Proxy) -> Result<(), String> {
pub async fn proxy(config: &Config) -> Result<Proxy, String> {
ops::ensure_loaded(config, MODULE_ID)
.await
- .map_err(|_| super::client::ModuleCallError::Unavailable.to_string())?;
+ .map_err(|_| tinybus::module::ModuleCallError::Unavailable.to_string())?;
let proxy = proxy_to_serving().await?;
ensure_routed(config, &proxy).await?;
Ok(proxy)
@@ -322,7 +322,7 @@ async fn proxy_to_serving() -> Result<Proxy, String> {
registry::find(MODULE_ID).ok_or_else(|| format!("unknown module '{MODULE_ID}'"))?;
let runtime = super::host::runtime().await.map_err(|_| {
super::failure::report(record, super::failure::Reason::TransportFailed);
- super::client::ModuleCallError::TransportFailed.to_string()
+ tinybus::module::ModuleCallError::TransportFailed.to_string()
})?;
runtime
.proxy(record.bus_name, record.object_path)
@@ -443,7 +443,7 @@ where
const STATELESS_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(45);
ops::ensure_loaded(config, MODULE_ID)
.await
- .map_err(|_| super::client::ModuleCallError::Unavailable.to_string())?;
+ .map_err(|_| tinybus::module::ModuleCallError::Unavailable.to_string())?;
let proxy = proxy_to_serving().await?.with_timeout(STATELESS_TIMEOUT);
proxy
.call_confidential::<Reply>(member, (request,))
diff --git a/crates/openhuman-core/src/modules/ops.rs b/crates/openhuman-core/src/modules/ops.rs
index 1b1a62e264..7b1d9083c1 100644
--- a/crates/openhuman-core/src/modules/ops.rs
+++ b/crates/openhuman-core/src/modules/ops.rs
@@ -173,7 +173,7 @@ pub fn resolver(config: &Config) -> Resolver {
/// facade before the first call when artifacts ship with the host.
#[must_use]
pub fn client(config: Config) -> ModuleClient {
- ModuleClient::new(resolver(&config))
+ crate::modules::ops::client(resolver(&config))
}
/// Log which source serves each module and warn about a local build whose
diff --git a/crates/openhuman-core/src/modules/tinybox.rs b/crates/openhuman-core/src/modules/tinybox.rs
index 81165e7869..640ae6ef47 100644
--- a/crates/openhuman-core/src/modules/tinybox.rs
+++ b/crates/openhuman-core/src/modules/tinybox.rs
@@ -11,7 +11,7 @@ pub use tinybox_bus as contract;
use crate::config::Config;
-use super::client::{ModuleCallError, ModuleClient};
+use tinybus::module::{ModuleCallError, ModuleClient};
/// Registry id for the TinyBox module.
pub const MODULE_ID: &str = "tinybox";
@@ -76,7 +76,7 @@ fn require_compatible(version: (u32, u32)) -> Result<(), ModuleCallError> {
if contract::is_compatible(version) {
return Ok(());
}
- ModuleClient::report_incompatible_contract(MODULE_ID);
+ crate::modules::report::incompatible_contract(MODULE_ID);
Err(ModuleCallError::IncompatibleContract)
}
@@ -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 = ModuleClient::new(config.clone()).with_timeout(timeout);
+ let client = crate::modules::ops::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 = ModuleClient::new(config.clone()).with_timeout(timeout);
+ let client = crate::modules::ops::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 {
- ModuleClient::new(config.clone()).with_timeout(MODULE_CALL_TIMEOUT)
+ crate::modules::ops::client(config.clone()).with_timeout(MODULE_CALL_TIMEOUT)
}
fn message(error: ModuleCallError) -> String {
diff --git a/crates/openhuman-core/src/threads/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rs
index f02a11583c..2fa961c431 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::client::ModuleClient::new(config)
+ crate::modules::ops::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.rs
index 05e708f393..e21c8f10ab 100644
--- a/crates/openhuman-core/src/tools/impl/network/gitbooks.rs
+++ b/crates/openhuman-core/src/tools/impl/network/gitbooks.rs
@@ -28,7 +28,7 @@ impl GitbooksSearchTool {
Ok(Self {
endpoint,
timeout_secs,
- client: ModuleClient::new(config).with_timeout(Duration::from_secs(timeout_secs)),
+ client: crate::modules::ops::client(config).with_timeout(Duration::from_secs(timeout_secs)),
})
}
@@ -121,7 +121,7 @@ impl GitbooksGetPageTool {
Ok(Self {
endpoint,
timeout_secs,
- client: ModuleClient::new(config).with_timeout(Duration::from_secs(timeout_secs)),
+ client: crate::modules::ops::client(config).with_timeout(Duration::from_secs(timeout_secs)),
})
}
diff --git a/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs b/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
index 3c5ed36058..253578e1a3 100644
--- a/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
@@ -1,7 +1,7 @@
use super::*;
#[cfg(feature = "modules")]
-use crate::modules::client::ModuleClient;
+use tinybus::module::ModuleClient;
#[cfg(feature = "modules")]
#[derive(Clone, Default)]
diff --git a/crates/openhuman-core/src/tools/impl/network/mcp.rs b/crates/openhuman-core/src/tools/impl/network/mcp.rs
index 1ac417e4e4..4cadb3d3dd 100644
--- a/crates/openhuman-core/src/tools/impl/network/mcp.rs
+++ b/crates/openhuman-core/src/tools/impl/network/mcp.rs
@@ -548,9 +548,9 @@ fn unavailable_outcome(server: &str, tool: &str) -> tinymcp_bus::McpCallOutcome
}
pub(super) fn input_module_error_code(
- error: crate::modules::client::ModuleCallError,
+ error: tinybus::module::ModuleCallError,
) -> &'static str {
- use crate::modules::client::ModuleCallError;
+ use tinybus::module::ModuleCallError;
match error {
ModuleCallError::Unavailable | ModuleCallError::IncompatibleContract => {
tinymcp_bus::errors::BUS
@@ -561,9 +561,9 @@ pub(super) fn input_module_error_code(
}
pub(super) fn input_module_error_message(
- error: crate::modules::client::ModuleCallError,
+ error: tinybus::module::ModuleCallError,
) -> &'static str {
- use crate::modules::client::ModuleCallError;
+ use tinybus::module::ModuleCallError;
match error {
ModuleCallError::Unavailable => "TinyMCP module is unavailable",
ModuleCallError::IncompatibleContract => "TinyMCP contract is incompatible",
diff --git a/crates/openhuman-core/src/tools/impl/network/mcp_target_tests.rs b/crates/openhuman-core/src/tools/impl/network/mcp_target_tests.rs
index e446e1ec96..ca2707a043 100644
--- a/crates/openhuman-core/src/tools/impl/network/mcp_target_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/network/mcp_target_tests.rs
@@ -16,7 +16,7 @@ use tinymcp_bus::{
#[derive(Clone, Default)]
struct PreparePort {
requests: Arc<Mutex<Vec<PrepareAgentToolsRequest>>>,
- transform_error: Option<crate::modules::client::ModuleCallError>,
+ transform_error: Option<tinybus::module::ModuleCallError>,
}
#[async_trait]
@@ -25,7 +25,7 @@ impl McpModulePort for PreparePort {
&self,
_: &str,
_: &tinymcp_bus::McpClientConfig,
- ) -> Result<OpenConfiguredResponse, crate::modules::client::ModuleCallError> {
+ ) -> Result<OpenConfiguredResponse, tinybus::module::ModuleCallError> {
Ok(OpenConfiguredResponse {
object_path: "/test/mcp".to_owned(),
transition_id: "open-test".to_owned(),
@@ -35,14 +35,14 @@ impl McpModulePort for PreparePort {
async fn close(
&self,
_: &str,
- ) -> Result<Option<String>, crate::modules::client::ModuleCallError> {
+ ) -> Result<Option<String>, tinybus::module::ModuleCallError> {
Ok(None)
}
async fn transition_status(
&self,
_: &str,
- ) -> Result<TransitionStatus, crate::modules::client::ModuleCallError> {
+ ) -> Result<TransitionStatus, tinybus::module::ModuleCallError> {
Ok(TransitionStatus::Complete)
}
@@ -52,14 +52,14 @@ impl McpModulePort for PreparePort {
_: &str,
_: Value,
_: bool,
- ) -> Result<Value, crate::modules::client::ModuleCallError> {
- Err(crate::modules::client::ModuleCallError::IncompatibleContract)
+ ) -> Result<Value, tinybus::module::ModuleCallError> {
+ Err(tinybus::module::ModuleCallError::IncompatibleContract)
}
async fn prepare_agent_tools(
&self,
request: PrepareAgentToolsRequest,
- ) -> Result<Vec<McpToolPresentation>, crate::modules::client::ModuleCallError> {
+ ) -> Result<Vec<McpToolPresentation>, tinybus::module::ModuleCallError> {
self.requests.lock().unwrap().push(request.clone());
Ok(request
.sources
@@ -90,9 +90,9 @@ impl McpModulePort for PreparePort {
async fn validate_server_arguments(
&self,
_: ValidateServerArgumentsRequest,
- ) -> Result<ServerArgumentsValidation, crate::modules::client::ModuleCallError> {
+ ) -> Result<ServerArgumentsValidation, tinybus::module::ModuleCallError> {
std::future::ready(Err(
- crate::modules::client::ModuleCallError::IncompatibleContract,
+ tinybus::module::ModuleCallError::IncompatibleContract,
))
.await
}
@@ -100,18 +100,18 @@ impl McpModulePort for PreparePort {
async fn normalize_tool_arguments(
&self,
arguments: Option<Value>,
- ) -> Result<serde_json::Map<String, Value>, crate::modules::client::ModuleCallError> {
+ ) -> Result<serde_json::Map<String, Value>, tinybus::module::ModuleCallError> {
match arguments.unwrap_or(Value::Null) {
Value::Null => Ok(serde_json::Map::new()),
Value::Object(arguments) => Ok(arguments),
- _ => Err(crate::modules::client::ModuleCallError::ModuleFault),
+ _ => Err(tinybus::module::ModuleCallError::ModuleFault),
}
}
async fn transform_text(
&self,
request: tinymcp_bus::TransformTextRequest,
- ) -> Result<String, crate::modules::client::ModuleCallError> {
+ ) -> Result<String, tinybus::module::ModuleCallError> {
match self.transform_error {
Some(error) => Err(error),
None => Ok(request.text),
@@ -128,7 +128,7 @@ async fn valid_mcp_identifier_reports_module_unavailable_without_invalid_input_l
McpConfiguredClient::install_test_port(
&config,
Box::new(PreparePort {
- transform_error: Some(crate::modules::client::ModuleCallError::Unavailable),
+ transform_error: Some(tinybus::module::ModuleCallError::Unavailable),
..PreparePort::default()
}),
)
diff --git a/crates/openhuman-core/src/tools/impl/network/mcp_tests.rs b/crates/openhuman-core/src/tools/impl/network/mcp_tests.rs
index 550b1692e8..f0dd1ac567 100644
--- a/crates/openhuman-core/src/tools/impl/network/mcp_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/network/mcp_tests.rs
@@ -19,7 +19,7 @@ fn required_mcp_identifier_rejects_empty_values() {
#[test]
fn module_failures_keep_transport_and_unavailability_categories() {
- use crate::modules::client::ModuleCallError;
+ use tinybus::module::ModuleCallError;
assert_eq!(
input_module_error_code(ModuleCallError::Unavailable),
diff --git a/crates/openhuman-core/src/voice/audio_capture.rs b/crates/openhuman-core/src/voice/audio_capture.rs
index 3f72f817f8..c046d00ed4 100644
--- a/crates/openhuman-core/src/voice/audio_capture.rs
+++ b/crates/openhuman-core/src/voice/audio_capture.rs
@@ -63,7 +63,7 @@ pub async fn start_recording(config: &Config) -> Result<RecordingHandle, String>
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::client::ModuleClient::new(config.clone())
+ crate::modules::ops::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.rs
index bf96579ce6..4ca225605f 100644
--- a/crates/openhuman-core/src/voice/capture_lease.rs
+++ b/crates/openhuman-core/src/voice/capture_lease.rs
@@ -124,7 +124,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(ModuleClient::new(config.clone())));
+ let port: Arc<dyn Port> = Arc::new(BusPort(crate::modules::ops::client(config.clone())));
Self::reserve_with_port(port, kind).await
}
async fn reserve_with_port(port: Arc<dyn Port>, kind: Kind) -> Result<Self, String> {
@@ -319,8 +319,8 @@ impl Drop for CaptureLease {
}
}
fn malformed() -> String {
- ModuleClient::report_malformed_reply(MODULE);
- crate::modules::client::ModuleCallError::ModuleFault.to_string()
+ crate::modules::report::malformed_reply(MODULE);
+ tinybus::module::ModuleCallError::ModuleFault.to_string()
}
fn capture_error(error: CaptureError) -> String {
let reason = match error {
diff --git a/crates/openhuman-core/src/voice/server/hotkey_listener.rs b/crates/openhuman-core/src/voice/server/hotkey_listener.rs
index 633064ed33..2ed8645fe0 100644
--- a/crates/openhuman-core/src/voice/server/hotkey_listener.rs
+++ b/crates/openhuman-core/src/voice/server/hotkey_listener.rs
@@ -352,8 +352,8 @@ async fn start_globe_with_client(
let recover = matches!(
error,
crate::modules::accessibility::AccessibilityError::Bus(
- crate::modules::client::ModuleCallError::TransportFailed
- | crate::modules::client::ModuleCallError::ModuleFault
+ tinybus::module::ModuleCallError::TransportFailed
+ | tinybus::module::ModuleCallError::ModuleFault
)
);
let _ = ready_tx.send(Err(error.to_string()));
diff --git a/crates/openhuman-embed/src/modules.rs b/crates/openhuman-embed/src/modules.rs
index 62eac8c522..d789ba355d 100644
--- a/crates/openhuman-embed/src/modules.rs
+++ b/crates/openhuman-embed/src/modules.rs
@@ -22,7 +22,7 @@ pub mod browser {
}
/// Pre-core calls through the process-wide loader, with explicit runtime configuration.
-pub use openhuman_core::modules::client::{ModuleCallError, ModuleClient};
+pub use tinybus::module::{ModuleCallError, ModuleClient};
#[cfg(all(test, not(feature = "modules"), not(feature = "default")))]
#[path = "modules_tests.rs"]
diff --git a/crates/openhuman-embed/src/modules_tests.rs b/crates/openhuman-embed/src/modules_tests.rs
index 5748762c98..e3b6605614 100644
--- a/crates/openhuman-embed/src/modules_tests.rs
+++ b/crates/openhuman-embed/src/modules_tests.rs
@@ -5,7 +5,7 @@ async fn pre_core_client_without_a_loader_returns_unavailable() {
let mut config = crate::config::RuntimeConfig::default();
config.modules.enabled = true;
config.modules.allow_download = false;
- let result = ModuleClient::new(config)
+ let result = crate::modules::ops::client(config)
.call::<serde_json::Value>("tinyhosts", "Providers", ())
.await;
assert_eq!(result, Err(ModuleCallError::Unavailable));