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(flows): widen handler visibility to the schemas module
Steven Enamakel9fab9621bfc4
diff --git a/crates/openhuman-core/src/flows/schemas/handlers/builder.rs b/crates/openhuman-core/src/flows/schemas/handlers/builder.rsindex 9b53abf030..249d60eb13 100644--- a/crates/openhuman-core/src/flows/schemas/handlers/builder.rs+++ b/crates/openhuman-core/src/flows/schemas/handlers/builder.rs@@ -2,7 +2,10 @@ use super::super::*;use super::{read_required, to_json};use crate::core::runtime::DispatchCtx;-pub(super) fn handle_build(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_build(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;// Optional streaming target: when the copilot passes its chat `thread_id`@@ -20,7 +23,7 @@ pub(super) fn handle_build(ctx: DispatchCtx, params: Map<String, Value>) -> Cont})}-pub(super) fn handle_build_cancel(+pub(in crate::flows::schemas) fn handle_build_cancel(_ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -34,7 +37,10 @@ pub(super) fn handle_build_cancel(})}-pub(super) fn handle_discover(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_discover(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;// Optional streaming target for the Flow Scout run (Phase B) — same@@ -48,7 +54,7 @@ pub(super) fn handle_discover(ctx: DispatchCtx, params: Map<String, Value>) -> C/// `flows.build` and `flows.discover` into an [`ops::FlowStreamTarget`]./// Returns `None` (headless run) when no usable `thread_id` is present; a/// missing `request_id` is filled with a fresh uuid inside `from_params`.-pub(super) fn read_flow_stream_target(+pub(in crate::flows::schemas) fn read_flow_stream_target(params: &Map<String, Value>,) -> Option<ops::FlowStreamTarget> {let thread_id = params@@ -62,7 +68,7 @@ pub(super) fn read_flow_stream_target(ops::FlowStreamTarget::from_params(thread_id, request_id)}-pub(super) fn handle_list_suggestions(+pub(in crate::flows::schemas) fn handle_list_suggestions(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -78,7 +84,7 @@ pub(super) fn handle_list_suggestions(})}-pub(super) fn handle_dismiss_suggestion(+pub(in crate::flows::schemas) fn handle_dismiss_suggestion(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -89,7 +95,7 @@ pub(super) fn handle_dismiss_suggestion(})}-pub(super) fn handle_mark_suggestion_built(+pub(in crate::flows::schemas) fn handle_mark_suggestion_built(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -100,7 +106,7 @@ pub(super) fn handle_mark_suggestion_built(})}-pub(super) fn handle_required_connections(+pub(in crate::flows::schemas) fn handle_required_connections(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -111,7 +117,7 @@ pub(super) fn handle_required_connections(})}-pub(super) fn handle_approval_manifest(+pub(in crate::flows::schemas) fn handle_approval_manifest(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -127,7 +133,7 @@ pub(super) fn handle_approval_manifest(})}-pub(super) fn handle_search_tool_catalog(+pub(in crate::flows::schemas) fn handle_search_tool_catalog(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -147,7 +153,7 @@ pub(super) fn handle_search_tool_catalog(})}-pub(super) fn handle_get_tool_contract(+pub(in crate::flows::schemas) fn handle_get_tool_contract(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -158,7 +164,10 @@ pub(super) fn handle_get_tool_contract(})}-pub(super) fn handle_get_history(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_get_history(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;@@ -171,7 +180,10 @@ pub(super) fn handle_get_history(ctx: DispatchCtx, params: Map<String, Value>) -})}-pub(super) fn handle_rollback(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_rollback(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;diff --git a/crates/openhuman-core/src/flows/schemas/handlers/definition.rs b/crates/openhuman-core/src/flows/schemas/handlers/definition.rsindex cbf0498d36..f1cbe9dfbd 100644--- a/crates/openhuman-core/src/flows/schemas/handlers/definition.rs+++ b/crates/openhuman-core/src/flows/schemas/handlers/definition.rs@@ -2,7 +2,10 @@ use super::super::*;use super::{read_required, to_json};use crate::core::runtime::DispatchCtx;-pub(super) fn handle_create(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_create(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let name = read_required::<String>(¶ms, "name")?;@@ -25,7 +28,10 @@ pub(super) fn handle_create(ctx: DispatchCtx, params: Map<String, Value>) -> Con})}-pub(super) fn handle_validate(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_validate(+ _ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {// No config load: validation is pure (no persistence, no workspace).let graph = read_required::<Value>(¶ms, "graph")?;@@ -33,7 +39,10 @@ pub(super) fn handle_validate(_ctx: DispatchCtx, params: Map<String, Value>) ->})}-pub(super) fn handle_import(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_import(+ _ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {// No config load: import is pure (no persistence, no workspace).let graph = read_required::<Value>(¶ms, "graph")?;@@ -47,7 +56,10 @@ pub(super) fn handle_import(_ctx: DispatchCtx, params: Map<String, Value>) -> Co})}-pub(super) fn handle_duplicate(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_duplicate(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;@@ -55,7 +67,10 @@ pub(super) fn handle_duplicate(ctx: DispatchCtx, params: Map<String, Value>) ->})}-pub(super) fn handle_get(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_get(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;@@ -63,14 +78,17 @@ pub(super) fn handle_get(ctx: DispatchCtx, params: Map<String, Value>) -> Contro})}-pub(super) fn handle_list(ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_list(+ ctx: DispatchCtx,+ _params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;to_json(ops::flows_list(&config).await?)})}-pub(super) fn handle_list_connections(+pub(in crate::flows::schemas) fn handle_list_connections(ctx: DispatchCtx,_params: Map<String, Value>,) -> ControllerFuture {@@ -80,7 +98,10 @@ pub(super) fn handle_list_connections(})}-pub(super) fn handle_update(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_update(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;@@ -122,7 +143,10 @@ pub(super) fn handle_update(ctx: DispatchCtx, params: Map<String, Value>) -> Con})}-pub(super) fn handle_delete(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_delete(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;@@ -130,7 +154,10 @@ pub(super) fn handle_delete(ctx: DispatchCtx, params: Map<String, Value>) -> Con})}-pub(super) fn handle_set_enabled(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_set_enabled(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;diff --git a/crates/openhuman-core/src/flows/schemas/handlers/draft.rs b/crates/openhuman-core/src/flows/schemas/handlers/draft.rsindex d0e379a58c..eed0e4a554 100644--- a/crates/openhuman-core/src/flows/schemas/handlers/draft.rs+++ b/crates/openhuman-core/src/flows/schemas/handlers/draft.rs@@ -2,7 +2,7 @@ use super::super::*;use super::{read_required, to_json};use crate::core::runtime::DispatchCtx;-pub(super) fn handle_draft_create(+pub(in crate::flows::schemas) fn handle_draft_create(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -26,7 +26,10 @@ pub(super) fn handle_draft_create(})}-pub(super) fn handle_draft_get(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_draft_get(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;@@ -34,7 +37,7 @@ pub(super) fn handle_draft_get(ctx: DispatchCtx, params: Map<String, Value>) ->})}-pub(super) fn handle_draft_update(+pub(in crate::flows::schemas) fn handle_draft_update(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -60,14 +63,17 @@ pub(super) fn handle_draft_update(})}-pub(super) fn handle_draft_list(ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_draft_list(+ ctx: DispatchCtx,+ _params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;to_json(ops::flows_draft_list(&config)?)})}-pub(super) fn handle_draft_delete(+pub(in crate::flows::schemas) fn handle_draft_delete(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -78,7 +84,7 @@ pub(super) fn handle_draft_delete(})}-pub(super) fn handle_draft_promote(+pub(in crate::flows::schemas) fn handle_draft_promote(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -103,7 +109,7 @@ pub(super) fn handle_draft_promote(/// from its flow. A later `draft_promote` then creates a brand-new flow/// instead of updating the one the caller actually meant.-pub(super) fn parse_draft_update_flow_id(+pub(in crate::flows::schemas) fn parse_draft_update_flow_id(params: &Map<String, Value>,) -> Result<Option<Option<String>>, String> {match params.get("flow_id") {diff --git a/crates/openhuman-core/src/flows/schemas/handlers/mod.rs b/crates/openhuman-core/src/flows/schemas/handlers/mod.rsindex aeb04640f6..213a90c852 100644--- a/crates/openhuman-core/src/flows/schemas/handlers/mod.rs+++ b/crates/openhuman-core/src/flows/schemas/handlers/mod.rs@@ -3,16 +3,16 @@ mod definition;mod draft;mod run;-pub(super) use builder::*;-pub(super) use definition::*;-pub(super) use draft::*;-pub(super) use run::*;+pub(in crate::flows::schemas) use builder::*;+pub(in crate::flows::schemas) use definition::*;+pub(in crate::flows::schemas) use draft::*;+pub(in crate::flows::schemas) use run::*;use crate::core::Outcome;use serde::de::DeserializeOwned;use serde_json::{Map, Value};-pub(super) fn read_required<T: DeserializeOwned>(+pub(in crate::flows::schemas) fn read_required<T: DeserializeOwned>(params: &Map<String, Value>,key: &str,) -> Result<T, String> {@@ -23,6 +23,8 @@ pub(super) fn read_required<T: DeserializeOwned>(serde_json::from_value(value).map_err(|e| format!("invalid '{key}': {e}"))}-pub(super) fn to_json<T: serde::Serialize>(outcome: Outcome<T>) -> Result<Value, String> {+pub(in crate::flows::schemas) fn to_json<T: serde::Serialize>(+ outcome: Outcome<T>,+) -> Result<Value, String> {outcome.into_cli_compatible_json()}diff --git a/crates/openhuman-core/src/flows/schemas/handlers/run.rs b/crates/openhuman-core/src/flows/schemas/handlers/run.rsindex 3d0b138253..bd808ae538 100644--- a/crates/openhuman-core/src/flows/schemas/handlers/run.rs+++ b/crates/openhuman-core/src/flows/schemas/handlers/run.rs@@ -2,7 +2,10 @@ use super::super::*;use super::{read_required, to_json};use crate::core::runtime::DispatchCtx;-pub(super) fn handle_run(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_run(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;@@ -22,7 +25,7 @@ pub(super) fn handle_run(ctx: DispatchCtx, params: Map<String, Value>) -> Contro})}-pub(super) fn handle_run_detached(+pub(in crate::flows::schemas) fn handle_run_detached(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -52,7 +55,7 @@ pub(super) fn handle_run_detached(/// inputs are all optional or defaulted. A present-but-non-object value is a/// caller error rejected here, before it reaches `ops`, so the message names the/// parameter rather than surfacing as a confusing per-input complaint.-pub(super) fn read_declared_inputs(+pub(in crate::flows::schemas) fn read_declared_inputs(params: &Map<String, Value>,) -> Result<Map<String, Value>, String> {match params.get("inputs") {@@ -71,7 +74,10 @@ pub(super) fn read_declared_inputs(}}-pub(super) fn handle_resume(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_resume(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;@@ -106,7 +112,10 @@ pub(super) fn handle_resume(ctx: DispatchCtx, params: Map<String, Value>) -> Con})}-pub(super) fn handle_cancel_run(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_cancel_run(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let run_id = read_required::<String>(¶ms, "run_id")?;@@ -114,7 +123,10 @@ pub(super) fn handle_cancel_run(ctx: DispatchCtx, params: Map<String, Value>) ->})}-pub(super) fn handle_list_runs(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_list_runs(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;@@ -127,7 +139,7 @@ pub(super) fn handle_list_runs(ctx: DispatchCtx, params: Map<String, Value>) ->})}-pub(super) fn handle_list_all_runs(+pub(in crate::flows::schemas) fn handle_list_all_runs(ctx: DispatchCtx,params: Map<String, Value>,) -> ControllerFuture {@@ -142,7 +154,10 @@ pub(super) fn handle_list_all_runs(})}-pub(super) fn handle_get_run(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_get_run(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let run_id = read_required::<String>(¶ms, "run_id")?;@@ -150,7 +165,10 @@ pub(super) fn handle_get_run(ctx: DispatchCtx, params: Map<String, Value>) -> Co})}-pub(super) fn handle_prune_runs(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+pub(in crate::flows::schemas) fn handle_prune_runs(+ ctx: DispatchCtx,+ params: Map<String, Value>,+) -> ControllerFuture {Box::pin(async move {let config = ctx.load_config().await?;let id = read_required::<String>(¶ms, "id")?;