Skip to content

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

refactor(orchestration): widen visibility of delivery and store helpers

Steven Enamakel1487d2f6cc44
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
index 7150b6fa4c..e3ecb3f7c4 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
@@ -25,12 +25,14 @@ use crate::core::runtime::DispatchCtx;
use std::collections::{HashMap, HashSet, VecDeque};
mod store_adapter;
mod thread_index;
+pub(crate) use store_adapter::router_for_workspace_ctx;
pub(super) use store_adapter::{
degrade_to_memory, entry_for_ctx, new_router, open_driver_store, router_pool, router_scope_for,
};
-pub(crate) use store_adapter::router_for_workspace_ctx;
#[cfg(test)]
-pub(super) use store_adapter::{entry_for, router_for_workspace, router_scope, test_store_overrides};
+pub(super) use store_adapter::{
+ entry_for, router_for_workspace, router_scope, test_store_overrides,
+};
use thread_index::{key, note_thread_workspace};
pub(crate) use thread_index::{
note_session_thread, router_for_thread, thread_for_session, workspace_for_thread,
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index 20117495c1..ea2d0259f0 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
@@ -60,11 +60,12 @@ use super::busy_guard::{busy, clear_busy_for_thread, TurnBusy};
use super::completion_notice::build_undelivered_notice;
use super::completion_owners;
use super::delivery_drain::{DrainFence, RECOVERY_BUSY_POLL};
+#[path = "delivery_events.rs"]
mod delivery_events;
use crate::core::runtime::CoreContext;
#[cfg(test)]
pub(super) use delivery_events::drain_schedule;
-pub(super) use delivery_events::{drain_schedule_in, Drain};
+pub(super) use delivery_events::{drain_schedule_in, owning_profiles, Drain};
/// Coalesce completions landing within this window into one delivery turn.
const DEBOUNCE: Duration = Duration::from_secs(3);
diff --git a/crates/openhuman-core/src/agent/orchestration/delivery_events.rs b/crates/openhuman-core/src/agent/orchestration/delivery_events.rs
index f80d0167d8..379d4400e2 100644
--- a/crates/openhuman-core/src/agent/orchestration/delivery_events.rs
+++ b/crates/openhuman-core/src/agent/orchestration/delivery_events.rs
@@ -14,7 +14,7 @@ pub(super) struct Drain {
/// profile. A session that maps to no thread (cron, voice, skills) has nothing
/// to deliver into.
#[cfg(test)]
-fn drain_schedule(event: &DomainEvent) -> Option<(String, Duration)> {
+pub(super) fn drain_schedule(event: &DomainEvent) -> Option<(String, Duration)> {
let drain = drain_schedule_in(false, event, |_| None)
.into_iter()
.next()?;
@@ -69,7 +69,7 @@ fn owners_of(session: &str, task: Option<&String>) -> Vec<String> {
}
/// The profiles whose contexts [`drain_schedule_in`] will ask for.
-fn owning_profiles(event: &DomainEvent) -> Vec<String> {
+pub(super) fn owning_profiles(event: &DomainEvent) -> Vec<String> {
drain_target(event)
.map(|(session, task, _)| owners_of(session, task))
.unwrap_or_default()