Skip to content

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

feat(channels): refresh typing indicator while active

Steven Enamakel8b1b8bb79883
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 b7b1860812..b5bdb3e875 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
@@ -283,14 +283,36 @@ impl Channel for ModuleChannel {
self.interact(ChannelInteraction::StartTyping {
recipient: recipient.to_owned(),
})
- .await
+ .await?;
+ if let Err(error) = self
+ .interact(ChannelInteraction::StartTypingRefresh {
+ recipient: recipient.to_owned(),
+ interval_secs: crate::channels::context::CHANNEL_TYPING_REFRESH_INTERVAL_SECS,
+ })
+ .await
+ {
+ let _ = self
+ .interact(ChannelInteraction::StopTyping {
+ recipient: recipient.to_owned(),
+ })
+ .await;
+ return Err(error);
+ }
+ Ok(())
}
async fn stop_typing(&self, recipient: &str) -> anyhow::Result<()> {
- self.interact(ChannelInteraction::StopTyping {
- recipient: recipient.to_owned(),
- })
- .await
+ let refresh = self
+ .interact(ChannelInteraction::StopTypingRefresh {
+ recipient: recipient.to_owned(),
+ })
+ .await;
+ let stopped = self
+ .interact(ChannelInteraction::StopTyping {
+ recipient: recipient.to_owned(),
+ })
+ .await;
+ refresh.and(stopped)
}
fn capabilities(&self) -> tinychannels_bus::ChannelCapabilities {