Skip to content

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

chore(dispatch): register progressive processor module

Steven Enamakel5a510a449c1d
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
index 72185269eb..4ab4b9ac7d 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
@@ -16,6 +16,7 @@
mod approval;
mod bus_turn;
+mod progressive;
mod turn;
use crate::channels::context::ChannelRuntimeContext;
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/progressive.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/progressive.rs
new file mode 100644
index 0000000000..d594af2fe0
--- /dev/null
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/progressive.rs
@@ -0,0 +1,88 @@
+//! Progress projection onto the compiled TinyChannels progressive engine.
+
+use crate::channels::bus::NativeProgressiveReply;
+use tinyagents_harness::progress::AgentProgress;
+use tinychannels_bus::module_progressive::ChannelOutputEvent;
+use tokio::sync::mpsc;
+
+pub(super) fn spawn_native_progress(
+ mut events: mpsc::Receiver<AgentProgress>,
+ reply: std::sync::Arc<NativeProgressiveReply>,
+) -> tokio::task::JoinHandle<()> {
+ tokio::spawn(async move {
+ while let Some(progress) = events.recv().await {
+ let Some(event) = output_event(progress) else {
+ continue;
+ };
+ if let Err(error) = reply.feed(vec![event]).await {
+ tracing::warn!("[dispatch] progressive channel update failed: {error}");
+ break;
+ }
+ }
+ })
+}
+
+fn output_event(progress: AgentProgress) -> Option<ChannelOutputEvent> {
+ match progress {
+ AgentProgress::TextDelta { delta, iteration } => Some(ChannelOutputEvent::TextDelta {
+ text: delta,
+ iteration: Some(iteration),
+ }),
+ AgentProgress::ThinkingDelta { delta, iteration } => {
+ Some(ChannelOutputEvent::ThinkingDelta {
+ text: delta,
+ iteration: Some(iteration),
+ })
+ }
+ AgentProgress::ToolCallStarted {
+ call_id,
+ tool_name,
+ arguments,
+ iteration,
+ display_label,
+ display_detail,
+ } => Some(ChannelOutputEvent::ToolCallStarted {
+ call_id,
+ tool_name,
+ arguments,
+ iteration,
+ display_label,
+ display_detail,
+ }),
+ AgentProgress::ToolCallProgress { call_id, message } => {
+ Some(ChannelOutputEvent::ToolCallProgress { call_id, message })
+ }
+ AgentProgress::ToolCallCompleted {
+ call_id,
+ tool_name,
+ success,
+ output_chars,
+ output,
+ arguments,
+ elapsed_ms,
+ iteration,
+ display_label,
+ display_detail,
+ structured,
+ ..
+ } => Some(ChannelOutputEvent::ToolCallCompleted {
+ call_id,
+ tool_name,
+ success,
+ output_chars,
+ output,
+ arguments,
+ elapsed_ms,
+ iteration,
+ failure: None,
+ display_label,
+ display_detail,
+ structured,
+ }),
+ _ => None,
+ }
+}
+
+#[cfg(test)]
+#[path = "progressive_tests.rs"]
+mod tests;