The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(threads): expose controller entry collection
Steven Enamakela69ef3069cf4
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rsindex 751c68841d..9aa0c5cd58 100644--- a/crates/openhuman-core/src/core/all.rs+++ b/crates/openhuman-core/src/core/all.rs@@ -117,11 +117,11 @@ enum EntryHandler {}impl ControllerEntry {- fn legacy(controller: RegisteredController) -> Self {+ pub(crate) fn legacy(controller: RegisteredController) -> Self {Self { schema: controller.schema, handler: EntryHandler::Legacy(controller.handler) }}- fn bound(controller: BoundRegisteredController) -> Self {+ pub(crate) fn bound(controller: BoundRegisteredController) -> Self {Self { schema: controller.schema.clone(), handler: EntryHandler::Bound(controller) }}@@ -731,7 +731,7 @@ fn build_registered_controllers() -> Vec<GroupedController> {push_entries(&mut controllers,DomainGroup::Threads,- crate::threads::schemas::registry::all_controller_entries(),+ crate::threads::schemas::all_controller_entries(),);// TokenJuice content-router debug controllers (detect / compress / cache_stats / retrieve).// Classified Inference: TokenJuice is the token-compression content router,diff --git a/crates/openhuman-core/src/threads/schemas.rs b/crates/openhuman-core/src/threads/schemas.rsindex 4ae5c2abef..b916e52fb7 100644--- a/crates/openhuman-core/src/threads/schemas.rs+++ b/crates/openhuman-core/src/threads/schemas.rs@@ -10,6 +10,10 @@ mod schema_defs;pub use registry::{all_controller_schemas, all_registered_controllers};+pub(crate) fn all_controller_entries() -> Vec<crate::core::all::ControllerEntry> {+ registry::all_controller_entries()+}+#[cfg(test)]use crate::threads::{AppendConversationMessageRequest, ConversationMessagesRequest, DeleteConversationThreadRequest,diff --git a/crates/openhuman-core/src/threads/schemas/handlers.rs b/crates/openhuman-core/src/threads/schemas/handlers.rsindex 5350846aa3..4f67e9d43b 100644--- a/crates/openhuman-core/src/threads/schemas/handlers.rs+++ b/crates/openhuman-core/src/threads/schemas/handlers.rs@@ -23,8 +23,20 @@ pub(super) fn handle_list(ctx: DispatchCtx, _params: Map<String, Value>) -> Cont}pub(super) fn handle_upsert(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+ Box::pin(async move { run_upsert(ctx, parse_upsert(params)?).await })+}++pub(super) fn parse_upsert(+ params: Map<String, Value>,+) -> Result<UpsertConversationThreadRequest, String> {+ parse(params)+}++pub(super) fn run_upsert(+ ctx: DispatchCtx,+ p: UpsertConversationThreadRequest,+) -> ControllerFuture {Box::pin(async move {- let p = parse::<UpsertConversationThreadRequest>(params)?;// A SaaS user picks thread ids for their own threads only; reserved// prefixes and path-like ids are refused (no-op outside SaaS).crate::profiles::surface::check_thread_id(&p.id)?;diff --git a/crates/openhuman-core/src/threads/schemas/registry.rs b/crates/openhuman-core/src/threads/schemas/registry.rsindex ac62edb74c..608cd9b31e 100644--- a/crates/openhuman-core/src/threads/schemas/registry.rs+++ b/crates/openhuman-core/src/threads/schemas/registry.rs@@ -1,7 +1,7 @@//! Controller schema and registered-controller lists for the `threads`//! namespace.-use crate::core::all::RegisteredController;+use crate::core::all::{BoundRegisteredController, ControllerEntry, RegisteredController};use crate::core::ControllerSchema;use super::handlers::{@@ -10,7 +10,7 @@ use super::handlers::{handle_regenerate, handle_search, handle_todos_get, handle_token_usage, handle_transcript_get,handle_turn_state_clear, handle_turn_state_get, handle_turn_state_get_turn,handle_turn_state_history, handle_turn_state_list, handle_update_labels, handle_update_title,- handle_update_working_dir, handle_upsert,+ handle_update_working_dir, handle_upsert, parse_upsert, run_upsert,};use super::schema_defs::schemas;@@ -143,3 +143,20 @@ pub fn all_registered_controllers() -> Vec<RegisteredController> {},]}++pub(crate) fn all_controller_entries() -> Vec<ControllerEntry> {+ all_registered_controllers()+ .into_iter()+ .map(|controller| {+ if controller.schema.function == "upsert" {+ ControllerEntry::bound(BoundRegisteredController::typed(+ controller.schema,+ parse_upsert,+ run_upsert,+ ))+ } else {+ ControllerEntry::legacy(controller)+ }+ })+ .collect::<Vec<_>>()+}