Skip to content

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

style(channels): apply rustfmt formatting to channel runtime

Steven Enamakeleccfcccb9be6
diff --git a/crates/openhuman-core/src/channels/controllers/backend.rs b/crates/openhuman-core/src/channels/controllers/backend.rs
index 10d65831bf..2b3bf0a4a8 100644
--- a/crates/openhuman-core/src/channels/controllers/backend.rs
+++ b/crates/openhuman-core/src/channels/controllers/backend.rs
@@ -2,7 +2,7 @@
use async_trait::async_trait;
use serde::Serialize;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use crate::config::{ChannelsConfig, Config};
use crate::core::Outcome;
@@ -70,8 +70,8 @@ impl OpenHumanChannelBackend {
&self,
request: tinychannels_bus::ChannelBackendRequest,
) -> anyhow::Result<tinychannels_bus::ChannelBackendResult> {
- use tinychannels_bus::{ChannelBackendRequest as Request, ChannelBackendResult as Result};
use tinychannels::backend::ChannelBackend as _;
+ use tinychannels_bus::{ChannelBackendRequest as Request, ChannelBackendResult as Result};
match request {
Request::RemoteControl(_) | Request::ProgressiveTransport(_) => {
@@ -82,7 +82,12 @@ impl OpenHumanChannelBackend {
auth_mode,
clear_memory,
} => self
- .disconnect_channel(&self.config.channels_config, &channel, auth_mode, clear_memory)
+ .disconnect_channel(
+ &self.config.channels_config,
+ &channel,
+ auth_mode,
+ clear_memory,
+ )
.await
.map(Result::Disconnected),
Request::Status { channel } => self
@@ -162,13 +167,8 @@ impl OpenHumanChannelBackend {
channel: &str,
title: &str,
) -> anyhow::Result<ChannelThreadResult> {
- tinychannels::backend::ChannelBackend::create_thread(
- self,
- channels_config,
- channel,
- title,
- )
- .await
+ tinychannels::backend::ChannelBackend::create_thread(self, channels_config, channel, title)
+ .await
}
/// Update or close one provider thread through the product controller.
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs b/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
index 892bd4c844..6047c8e7b6 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
@@ -17,15 +17,15 @@ pub(super) fn spawn_scoped_typing_task(
) -> tokio::task::JoinHandle<()> {
tokio::spawn(async move {
let handle = match channel
- .begin_typing_refresh(
- &recipient,
- CHANNEL_TYPING_REFRESH_INTERVAL_SECS,
- )
+ .begin_typing_refresh(&recipient, CHANNEL_TYPING_REFRESH_INTERVAL_SECS)
.await
{
Ok(handle) => handle,
Err(error) => {
- tracing::debug!(channel = channel.name(), "typing refresh could not start: {error}");
+ tracing::debug!(
+ channel = channel.name(),
+ "typing refresh could not start: {error}"
+ );
let _ = channel.stop_typing(&recipient).await;
return;
}
@@ -34,7 +34,10 @@ pub(super) fn spawn_scoped_typing_task(
if let Some(handle) = &handle {
cancellation_token.cancelled().await;
if let Err(error) = channel.end_typing_refresh(handle).await {
- tracing::debug!(channel = channel.name(), "typing refresh cleanup failed: {error}");
+ tracing::debug!(
+ channel = channel.name(),
+ "typing refresh cleanup failed: {error}"
+ );
}
} else {
// Compatibility for non-module test doubles. Production module
diff --git a/crates/openhuman-core/src/channels/runtime/startup.rs b/crates/openhuman-core/src/channels/runtime/startup.rs
index 5138217a71..07d34c3ea8 100644
--- a/crates/openhuman-core/src/channels/runtime/startup.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup.rs
@@ -1,7 +1,7 @@
//! Channel startup wiring.
-mod chat_workload;
mod callback;
+mod chat_workload;
mod credentials;
mod delivery_store;
mod module_providers;
@@ -13,7 +13,7 @@ mod turn_parts;
pub(crate) use credentials::hydrate_channel_credentials;
pub use start_channels::start_channels;
pub(crate) use start_channels::start_channels_with_session;
-pub(crate) use turn_parts::{build_channel_turn_parts, runtime_context, PromptToolDescs};
+pub(crate) use turn_parts::{PromptToolDescs, build_channel_turn_parts, runtime_context};
// Re-exported at module scope (rather than left as private `pub(super)`
// items reached only through their owning submodule) so the `#[path]` test
@@ -22,7 +22,7 @@ pub(crate) use turn_parts::{build_channel_turn_parts, runtime_context, PromptToo
#[cfg(test)]
use crate::config::Config;
#[cfg(test)]
-use chat_workload::{resolve_chat_workload, ChatWorkloadResolution};
+use chat_workload::{ChatWorkloadResolution, resolve_chat_workload};
#[cfg(any(test, debug_assertions))]
use credentials::resolve_yuanbao_app_secret;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback.rs b/crates/openhuman-core/src/channels/runtime/startup/callback.rs
index 9752cdbf32..65bc271521 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/callback.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/callback.rs
@@ -65,7 +65,9 @@ impl ChannelHostCallbacks {
>(message.clone())
{
if delivery.envelope.channel.id != channel {
- return Err(Error::failed("relay callback channel does not match envelope"));
+ return Err(Error::failed(
+ "relay callback channel does not match envelope",
+ ));
}
self.dispatch
.send(RuntimeChannelMessage::from_authenticated_relay(delivery))
@@ -74,8 +76,8 @@ impl ChannelHostCallbacks {
return Ok(());
}
- let message: tinychannels_bus::ChannelMessage =
- serde_json::from_value(message).map_err(|_| Error::failed("invalid inbound message"))?;
+ let message: tinychannels_bus::ChannelMessage = serde_json::from_value(message)
+ .map_err(|_| Error::failed("invalid inbound message"))?;
if message.channel != channel {
return Err(Error::failed("callback channel does not match message"));
}
@@ -95,11 +97,14 @@ impl ChannelHostCallbacks {
return Err(Error::failed("channel status is invalid"));
}
match state.as_str() {
- "connected" => crate::core::bus::BUS.publish(crate::core::events::DomainEvent::ChannelConnected { channel }),
- "disconnected" | "stopped" => crate::core::bus::BUS.publish(crate::core::events::DomainEvent::ChannelDisconnected {
- channel,
- reason: state,
- }),
+ "connected" => crate::core::bus::BUS
+ .publish(crate::core::events::DomainEvent::ChannelConnected { channel }),
+ "disconnected" | "stopped" => crate::core::bus::BUS.publish(
+ crate::core::events::DomainEvent::ChannelDisconnected {
+ channel,
+ reason: state,
+ },
+ ),
// `connecting`, `reconnecting`, and `unhealthy` are health facts,
// not user-facing lifecycle events.
_ => {}
@@ -178,7 +183,8 @@ impl ChannelHostCallbacks {
&self,
request: HostTranscriptionRequest,
) -> Result<HostTranscriptionResult> {
- if serde_json::to_vec(&request).map_or(true, |bytes| bytes.len() > MAX_TRANSCRIPTION_BYTES) {
+ if serde_json::to_vec(&request).map_or(true, |bytes| bytes.len() > MAX_TRANSCRIPTION_BYTES)
+ {
return Err(Error::failed("transcription callback exceeds its limit"));
}
use tinychannels::host::Transcriber as _;
@@ -225,15 +231,15 @@ impl ChannelHostCallbacks {
.await
.map(ChannelBackendResult::RemoteControl)
}
- ChannelBackendRequest::ProgressiveTransport(_) => {
- Err(Error::failed("progressive transport callback is unavailable"))
+ ChannelBackendRequest::ProgressiveTransport(_) => Err(Error::failed(
+ "progressive transport callback is unavailable",
+ )),
+ request => {
+ crate::channels::controllers::OpenHumanChannelBackend::new((*self.config).clone())
+ .dispatch_callback(request)
+ .await
+ .map_err(|_| Error::failed("channel controller callback failed"))
}
- request => crate::channels::controllers::OpenHumanChannelBackend::new(
- (*self.config).clone(),
- )
- .dispatch_callback(request)
- .await
- .map_err(|_| Error::failed("channel controller callback failed")),
}
}
}
diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_store.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_store.rs
index 256dad997d..82f3408db0 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_store.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_store.rs
@@ -45,7 +45,9 @@ impl ChannelDeliveryStore {
Self { path, gate }
}
- async fn locked_state(&self) -> anyhow::Result<(tokio::sync::OwnedMutexGuard<()>, DeliveryState)> {
+ async fn locked_state(
+ &self,
+ ) -> anyhow::Result<(tokio::sync::OwnedMutexGuard<()>, DeliveryState)> {
let guard = Arc::clone(&self.gate).lock_owned().await;
let state = self.read_state().await?;
Ok((guard, state))
@@ -59,7 +61,10 @@ impl ChannelDeliveryStore {
}
Err(error) => return Err(error.into()),
};
- anyhow::ensure!(bytes.len() as u64 <= MAX_STORE_BYTES, "channel delivery store is oversized");
+ anyhow::ensure!(
+ bytes.len() as u64 <= MAX_STORE_BYTES,
+ "channel delivery store is oversized"
+ );
let state: DeliveryState = serde_json::from_slice(&bytes)?;
validate_state(&state)?;
Ok(state)
@@ -68,7 +73,10 @@ impl ChannelDeliveryStore {
async fn write_state(&self, state: DeliveryState) -> anyhow::Result<()> {
validate_state(&state)?;
let bytes = serde_json::to_vec(&state)?;
- anyhow::ensure!(bytes.len() as u64 <= MAX_STORE_BYTES, "channel delivery store is oversized");
+ anyhow::ensure!(
+ bytes.len() as u64 <= MAX_STORE_BYTES,
+ "channel delivery store is oversized"
+ );
let path = self.path.clone();
tokio::task::spawn_blocking(move || {
crate::security::secret_storage::file_store::write_atomic(&path, &bytes)
@@ -82,19 +90,28 @@ impl ChannelDeliveryStore {
validate_entry(&entry)?;
let (_guard, mut state) = self.locked_state().await?;
if let Some(existing) = state.pending.get(&entry.id) {
- anyhow::ensure!(existing == &entry, "delivery id conflicts with pending entry");
+ anyhow::ensure!(
+ existing == &entry,
+ "delivery id conflicts with pending entry"
+ );
return Ok(());
}
anyhow::ensure!(
!state.failed.contains_key(&entry.id) && !state.results.contains_key(&entry.id),
"delivery id already has a terminal result"
);
- anyhow::ensure!(state.pending.len() < DELIVERY_PENDING_CAPACITY, "delivery queue is full");
+ anyhow::ensure!(
+ state.pending.len() < DELIVERY_PENDING_CAPACITY,
+ "delivery queue is full"
+ );
state.pending.insert(entry.id.clone(), entry);
self.write_state(state).await
}
- pub(super) async fn load_pending(&self, id: String) -> anyhow::Result<Option<DeliveryQueueEntry>> {
+ pub(super) async fn load_pending(
+ &self,
+ id: String,
+ ) -> anyhow::Result<Option<DeliveryQueueEntry>> {
validate_id(&id)?;
let (_guard, state) = self.locked_state().await?;
Ok(state.pending.get(&id).cloned())
@@ -124,15 +141,24 @@ impl ChannelDeliveryStore {
validate_entry(&entry)?;
let (_guard, mut state) = self.locked_state().await?;
if let Some(existing) = state.failed.get(&entry.id) {
- anyhow::ensure!(existing == &entry, "delivery id conflicts with failed entry");
+ anyhow::ensure!(
+ existing == &entry,
+ "delivery id conflicts with failed entry"
+ );
return Ok(());
}
- anyhow::ensure!(state.failed.len() < DELIVERY_PENDING_CAPACITY, "failed delivery store is full");
+ anyhow::ensure!(
+ state.failed.len() < DELIVERY_PENDING_CAPACITY,
+ "failed delivery store is full"
+ );
state.failed.insert(entry.id.clone(), entry);
self.write_state(state).await
}
- pub(super) async fn load_failed(&self, id: String) -> anyhow::Result<Option<DeliveryQueueEntry>> {
+ pub(super) async fn load_failed(
+ &self,
+ id: String,
+ ) -> anyhow::Result<Option<DeliveryQueueEntry>> {
validate_id(&id)?;
let (_guard, state) = self.locked_state().await?;
Ok(state.failed.get(&id).cloned())
@@ -140,7 +166,10 @@ impl ChannelDeliveryStore {
pub(super) async fn save_result(&self, result: DeliveryTerminalResult) -> anyhow::Result<()> {
validate_id(&result.id)?;
- anyhow::ensure!(!result.intent_fingerprint.is_empty() && result.intent_fingerprint.len() <= 128, "delivery fingerprint is invalid");
+ anyhow::ensure!(
+ !result.intent_fingerprint.is_empty() && result.intent_fingerprint.len() <= 128,
+ "delivery fingerprint is invalid"
+ );
anyhow::ensure!(
serde_json::to_vec(&result).map_or(false, |bytes| bytes.len() <= DELIVERY_RECORD_BYTES),
"delivery result exceeds its record limit"
@@ -148,15 +177,24 @@ impl ChannelDeliveryStore {
let (_guard, mut state) = self.locked_state().await?;
prune_results(&mut state, now_unix_ms());
if let Some(existing) = state.results.get(&result.id) {
- anyhow::ensure!(existing == &result, "delivery id conflicts with terminal result");
+ anyhow::ensure!(
+ existing == &result,
+ "delivery id conflicts with terminal result"
+ );
return Ok(());
}
- anyhow::ensure!(state.results.len() < DELIVERY_RESULT_CAPACITY, "delivery result replay store is full");
+ anyhow::ensure!(
+ state.results.len() < DELIVERY_RESULT_CAPACITY,
+ "delivery result replay store is full"
+ );
state.results.insert(result.id.clone(), result);
self.write_state(state).await
}
- pub(super) async fn load_result(&self, id: String) -> anyhow::Result<Option<DeliveryTerminalResult>> {
+ pub(super) async fn load_result(
+ &self,
+ id: String,
+ ) -> anyhow::Result<Option<DeliveryTerminalResult>> {
validate_id(&id)?;
let (_guard, mut state) = self.locked_state().await?;
prune_results(&mut state, now_unix_ms());
@@ -169,23 +207,38 @@ impl ChannelDeliveryStore {
}
fn validate_state(state: &DeliveryState) -> anyhow::Result<()> {
- anyhow::ensure!(state.pending.len() <= DELIVERY_PENDING_CAPACITY, "pending delivery store exceeds capacity");
- anyhow::ensure!(state.failed.len() <= DELIVERY_PENDING_CAPACITY, "failed delivery store exceeds capacity");
- anyhow::ensure!(state.results.len() <= DELIVERY_RESULT_CAPACITY, "delivery result store exceeds capacity");
+ anyhow::ensure!(
+ state.pending.len() <= DELIVERY_PENDING_CAPACITY,
+ "pending delivery store exceeds capacity"
+ );
+ anyhow::ensure!(
+ state.failed.len() <= DELIVERY_PENDING_CAPACITY,
+ "failed delivery store exceeds capacity"
+ );
+ anyhow::ensure!(
+ state.results.len() <= DELIVERY_RESULT_CAPACITY,
+ "delivery result store exceeds capacity"
+ );
for (id, entry) in state.pending.iter().chain(state.failed.iter()) {
anyhow::ensure!(id == &entry.id, "delivery store key does not match record");
validate_entry(entry)?;
}
for (id, result) in &state.results {
validate_id(id)?;
- anyhow::ensure!(id == &result.id, "delivery result key does not match record");
+ anyhow::ensure!(
+ id == &result.id,
+ "delivery result key does not match record"
+ );
}
Ok(())
}
fn validate_entry(entry: &DeliveryQueueEntry) -> anyhow::Result<()> {
validate_id(&entry.id)?;
- anyhow::ensure!(entry.intent.idempotency_key == entry.id, "delivery id does not match intent key");
+ anyhow::ensure!(
+ entry.intent.idempotency_key == entry.id,
+ "delivery id does not match intent key"
+ );
anyhow::ensure!(
serde_json::to_vec(entry).map_or(false, |bytes| bytes.len() <= DELIVERY_RECORD_BYTES),
"delivery record exceeds its limit"
@@ -200,7 +253,9 @@ fn validate_id(id: &str) -> anyhow::Result<()> {
fn prune_results(state: &mut DeliveryState, now_ms: u64) {
let ttl_ms = DELIVERY_RESULT_TTL_SECONDS.saturating_mul(1000);
- state.results.retain(|_, result| result.completed_at_unix_ms.saturating_add(ttl_ms) > now_ms);
+ state
+ .results
+ .retain(|_, result| result.completed_at_unix_ms.saturating_add(ttl_ms) > now_ms);
}
fn now_unix_ms() -> u64 {
diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_store_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_store_tests.rs
index 2eda026ab0..931d50f8a2 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_store_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_store_tests.rs
@@ -36,9 +36,18 @@ async fn pending_delivery_is_durable_ordered_and_idempotent() {
first.save_pending(entry("earlier", 10)).await.unwrap();
let reopened = store(&path);
- assert_eq!(reopened.load_pending("earlier".into()).await.unwrap(), Some(entry("earlier", 10)));
assert_eq!(
- reopened.load_pending_all().await.unwrap().iter().map(|item| item.id.as_str()).collect::<Vec<_>>(),
+ reopened.load_pending("earlier".into()).await.unwrap(),
+ Some(entry("earlier", 10))
+ );
+ assert_eq!(
+ reopened
+ .load_pending_all()
+ .await
+ .unwrap()
+ .iter()
+ .map(|item| item.id.as_str())
+ .collect::<Vec<_>>(),
vec!["earlier", "later"]
);
}
@@ -51,7 +60,10 @@ async fn changed_intent_cannot_reuse_a_pending_delivery_id() {
let mut changed = entry("same", 1);
changed.intent.conversation_id = "other-chat".into();
assert!(store.save_pending(changed).await.is_err());
- assert_eq!(store.load_pending_all().await.unwrap(), vec![entry("same", 1)]);
+ assert_eq!(
+ store.load_pending_all().await.unwrap(),
+ vec![entry("same", 1)]
+ );
}
#[tokio::test]
@@ -65,7 +77,10 @@ async fn terminal_result_is_replayed_and_conflicts_are_rejected() {
};
store.save_result(result.clone()).await.unwrap();
store.save_result(result.clone()).await.unwrap();
- assert_eq!(store.load_result("done".into()).await.unwrap(), Some(result.clone()));
+ assert_eq!(
+ store.load_result("done".into()).await.unwrap(),
+ Some(result.clone())
+ );
let conflict = DeliveryTerminalResult {
intent_fingerprint: "different".into(),
@@ -87,6 +102,15 @@ async fn removal_and_failed_delivery_are_idempotent_and_durable() {
store.remove_pending("pending".into()).await.unwrap();
let reopened = store(&path);
- assert_eq!(reopened.load_failed("failed".into()).await.unwrap(), Some(failed));
- assert!(reopened.load_pending("pending".into()).await.unwrap().is_none());
+ assert_eq!(
+ reopened.load_failed("failed".into()).await.unwrap(),
+ Some(failed)
+ );
+ assert!(
+ reopened
+ .load_pending("pending".into())
+ .await
+ .unwrap()
+ .is_none()
+ );
}
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 f451439f82..ff4ed4865b 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
@@ -65,7 +65,9 @@ impl ModuleChannelRuntime {
Ok(infos) => infos,
Err(error) => {
let _ = lease.close().await;
- return Err(anyhow::Error::new(error).context("could not describe configured channels"));
+ return Err(
+ anyhow::Error::new(error).context("could not describe configured channels")
+ );
}
};
if infos.is_empty() && !relay_configured(&hydrated) {
@@ -84,7 +86,9 @@ impl ModuleChannelRuntime {
Ok(reservation) => Some(reservation),
Err(error) => {
let _ = lease.close().await;
- return Err(anyhow::Error::new(error).context("could not reserve channel relay"));
+ return Err(
+ anyhow::Error::new(error).context("could not reserve channel relay")
+ );
}
}
} else {
@@ -93,7 +97,10 @@ impl ModuleChannelRuntime {
let relay_fronts = |channel: &str| {
hydrated.relay.as_ref().is_some_and(|relay| {
relay_configured(&hydrated)
- && relay.identities.iter().any(|identity| identity.platform == channel)
+ && relay
+ .identities
+ .iter()
+ .any(|identity| identity.platform == channel)
})
};
let channels = infos
@@ -139,25 +146,33 @@ impl ModuleChannelRuntime {
for info in &self.infos {
let member = match info.ingress {
ChannelIngressKind::Listener => tinychannels_bus::methods::START_CHANNEL_SUPERVISED,
- ChannelIngressKind::ExternalWebhook => tinychannels_bus::methods::START_OUTBOUND_CHANNEL,
- };
- let result: Result<(), ModuleCallError> = if info.ingress == ChannelIngressKind::Listener {
- self.lease
- .object()
- .call_confidential(
- member,
- (info.name.clone(), self.config.clone(), self.proxy.clone(), policy),
- )
- .await
- } else {
- self.lease
- .object()
- .call_confidential(
- member,
- (info.name.clone(), self.config.clone(), self.proxy.clone()),
- )
- .await
+ ChannelIngressKind::ExternalWebhook => {
+ tinychannels_bus::methods::START_OUTBOUND_CHANNEL
+ }
};
+ let result: Result<(), ModuleCallError> =
+ if info.ingress == ChannelIngressKind::Listener {
+ self.lease
+ .object()
+ .call_confidential(
+ member,
+ (
+ info.name.clone(),
+ self.config.clone(),
+ self.proxy.clone(),
+ policy,
+ ),
+ )
+ .await
+ } else {
+ self.lease
+ .object()
+ .call_confidential(
+ member,
+ (info.name.clone(), self.config.clone(), self.proxy.clone()),
+ )
+ .await
+ };
if let Err(error) = result {
let _ = self.close().await;
return Err(anyhow::Error::new(error).context("channel provider startup failed"));
@@ -196,7 +211,12 @@ impl ModuleChannelRuntime {
failure = Some(anyhow::Error::new(error));
}
}
- if let Err(error) = self.lease.object().call::<()>(tinychannels_bus::methods::SHUTDOWN, ()).await {
+ if let Err(error) = self
+ .lease
+ .object()
+ .call::<()>(tinychannels_bus::methods::SHUTDOWN, ())
+ .await
+ {
failure.get_or_insert_with(|| anyhow::Error::new(error));
}
if let Err(error) = self.lease.close().await {
@@ -217,7 +237,10 @@ impl Drop for ModuleChannelRuntime {
let lease = self.lease.clone();
if let Ok(handle) = tokio::runtime::Handle::try_current() {
handle.spawn(async move {
- let _ = lease.object().call::<()>(tinychannels_bus::methods::SHUTDOWN, ()).await;
+ let _ = lease
+ .object()
+ .call::<()>(tinychannels_bus::methods::SHUTDOWN, ())
+ .await;
let _ = lease.close().await;
});
}
@@ -274,7 +297,10 @@ impl Channel for ModuleChannel {
async fn health_check(&self) -> bool {
self.object
- .call::<String>(tinychannels_bus::methods::CHANNEL_STATUS, (self.name.clone(),))
+ .call::<String>(
+ tinychannels_bus::methods::CHANNEL_STATUS,
+ (self.name.clone(),),
+ )
.await
.is_ok_and(|state| state == "connected")
}
@@ -410,7 +436,10 @@ impl ModuleChannel {
.object
.call_confidential(
tinychannels_bus::methods::SEND_RELAY_INTENT,
- (self.relay.clone().expect("checked relay handle"), prepared.intent),
+ (
+ self.relay.clone().expect("checked relay handle"),
+ prepared.intent,
+ ),
)
.await
.map_err(anyhow::Error::new)?;
diff --git a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
index 4e61f3d076..d910093374 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
@@ -3,7 +3,7 @@
use super::super::dispatch::run_message_dispatch_loop;
use super::module_providers::ModuleChannelRuntime;
-use super::turn_parts::{build_channel_turn_parts, runtime_context, PromptToolDescs};
+use super::turn_parts::{PromptToolDescs, build_channel_turn_parts, runtime_context};
use crate::config::Config;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
@@ -144,9 +144,11 @@ async fn start_channels_inner(mut config: Config, session: CancellationToken) ->
}
let configured = crate::channels::commands::configured_providers(&config);
- let relay_configured = config.channels_config.relay.as_ref().is_some_and(|relay| {
- !relay.url.is_empty() && !relay.identities.is_empty()
- });
+ let relay_configured = config
+ .channels_config
+ .relay
+ .as_ref()
+ .is_some_and(|relay| !relay.url.is_empty() && !relay.identities.is_empty());
if configured.is_empty() && !relay_configured {
println!("No channels configured. Set up channels in the web UI.");
return Ok(());
@@ -242,7 +244,11 @@ async fn start_channels_inner(mut config: Config, session: CancellationToken) ->
println!(" 🚦 In-flight message limit: {max_in_flight_messages}");
- let runtime_ctx = Arc::new(runtime_context(&config, parts, Arc::clone(&channels_by_name)));
+ let runtime_ctx = Arc::new(runtime_context(
+ &config,
+ parts,
+ Arc::clone(&channels_by_name),
+ ));
context_slot
.set(Arc::downgrade(&runtime_ctx))
.map_err(|_| anyhow::anyhow!("channel callback context was already initialized"))?;
diff --git a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
index ea3452e1c2..e1abec1d33 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
@@ -6,10 +6,10 @@
//! the caller's own config and policy, so a relayed turn never runs with the
//! operator's tools or workspace.
-use super::chat_workload::{resolve_chat_workload, ChatWorkloadResolution};
+use super::chat_workload::{ChatWorkloadResolution, resolve_chat_workload};
use super::prompt::format_access_context;
use crate::agent::host_runtime;
-use crate::channels::context::{effective_channel_message_timeout_secs, ChannelRuntimeContext};
+use crate::channels::context::{ChannelRuntimeContext, effective_channel_message_timeout_secs};
use crate::channels::system_prompt::{ChannelPromptInputs, ChannelSystemPrompt};
use crate::config::Config;
use crate::inference::provider;
diff --git a/crates/openhuman-core/src/channels/runtime/startup_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_tests.rs
index e1b2658508..ce835f5d31 100644
--- a/crates/openhuman-core/src/channels/runtime/startup_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup_tests.rs
@@ -7,7 +7,7 @@
//! (cloud) path is preserved for users who haven't picked a local /
//! BYOK model, and the override path activates for those who have.
-use super::{resolve_chat_workload, ChatWorkloadResolution, RelayInboundMessageHandler};
+use super::{ChatWorkloadResolution, RelayInboundMessageHandler, resolve_chat_workload};
use crate::config::Config;
use tinychannels::relay::RelayInboundHandler;
diff --git a/crates/openhuman-core/src/channels/traits.rs b/crates/openhuman-core/src/channels/traits.rs
index 23590c9cd2..b863f60d8e 100644
--- a/crates/openhuman-core/src/channels/traits.rs
+++ b/crates/openhuman-core/src/channels/traits.rs
@@ -26,10 +26,7 @@ pub trait Channel: Send + Sync {
async fn send(&self, message: &SendMessage) -> anyhow::Result<()>;
/// Legacy listener seam used by isolated test doubles.
- async fn listen(
- &self,
- tx: tokio::sync::mpsc::Sender<ChannelMessage>,
- ) -> anyhow::Result<()>;
+ async fn listen(&self, tx: tokio::sync::mpsc::Sender<ChannelMessage>) -> anyhow::Result<()>;
/// Whether the configured provider is currently healthy.
async fn health_check(&self) -> bool {