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): update host gates to accept graph as serde_json::Value
Steven Enamakel05b54b92d931
diff --git a/crates/openhuman-core/src/flows/authoring_host.rs b/crates/openhuman-core/src/flows/authoring_host.rsindex f265840acb..2dca3bb342 100644--- a/crates/openhuman-core/src/flows/authoring_host.rs+++ b/crates/openhuman-core/src/flows/authoring_host.rs@@ -64,8 +64,6 @@ impl Callbacks {let config = Arc::clone(&self.config);let context = self.context.clone();self.in_context(async move {- let graph: tinyflows::model::WorkflowGraph =- serde_json::from_value(graph).map_err(|error| error.to_string())?;match stage.as_str() {tinyflows_bus::host::TOOL_POLICY => {Ok(crate::flows::host_gates::validate_upload_paths(&graph))diff --git a/crates/openhuman-core/src/flows/host_gates/agent_refs.rs b/crates/openhuman-core/src/flows/host_gates/agent_refs.rsindex 3fdbb9f502..8f22652229 100644--- a/crates/openhuman-core/src/flows/host_gates/agent_refs.rs+++ b/crates/openhuman-core/src/flows/host_gates/agent_refs.rs@@ -1,7 +1,7 @@+use super::graph_json::nodes;use crate::config::Config;use crate::core::runtime::DispatchCtx;use serde_json::Value;-use tinyflows::model::{NodeKind, WorkflowGraph};// Agent-ref resolvability gate: an `agent` node's `agent_ref` must name a// real agent, not the runtime's `RegistryFallback` "unknown agent_ref" case@@ -65,7 +65,7 @@ use tinyflows::model::{NodeKind, WorkflowGraph};pub(crate) async fn validate_agent_refs(ctx: &DispatchCtx,config: &Config,- graph: &WorkflowGraph,+ graph: &Value,) -> Vec<String> {use crate::agent_registry::host_definition::AgentDefinitionRegistry;use crate::agent_registry::AgentRegistryEntry;@@ -75,8 +75,8 @@ pub(crate) async fn validate_agent_refs(let mut harness_registry_init_attempted = false;let mut custom_registry: Option<Result<Vec<AgentRegistryEntry>, String>> = None;- for node in &graph.nodes {- if node.kind != NodeKind::Agent {+ for node in nodes(graph) {+ if node.kind != "agent" {continue;}let Some(agent_ref) = node.config.get("agent_ref").and_then(Value::as_str) else {diff --git a/crates/openhuman-core/src/flows/host_gates/agent_refs_tests.rs b/crates/openhuman-core/src/flows/host_gates/agent_refs_tests.rsindex c75204faba..94141de4cb 100644--- a/crates/openhuman-core/src/flows/host_gates/agent_refs_tests.rs+++ b/crates/openhuman-core/src/flows/host_gates/agent_refs_tests.rs@@ -2,7 +2,6 @@ use super::*;use crate::config::Config;use serde_json::{json, Value};use tempfile::TempDir;-use tinyflows::model::WorkflowGraph;fn test_config(tmp: &TempDir) -> Config {let config = Config {@@ -15,11 +14,11 @@ fn test_config(tmp: &TempDir) -> Config {config}-fn graph(value: Value) -> WorkflowGraph {+fn graph(value: Value) -> Value {let graph = tinyflows::migrate::deserialize_graph(value).expect("test graph deserializes");tinyflows::validate::validate(&graph).expect("test graph is structurally valid");tinyflows::compat::ensure_compatible(&graph).expect("test graph is compatible");- graph+ serde_json::to_value(graph).expect("validated graph serializes")}// ── validate_agent_refs (agent-ref resolvability gate, PR #5114) ───────────diff --git a/crates/openhuman-core/src/flows/host_gates/connections.rs b/crates/openhuman-core/src/flows/host_gates/connections.rsindex dd7ae2a361..f368f17421 100644--- a/crates/openhuman-core/src/flows/host_gates/connections.rs+++ b/crates/openhuman-core/src/flows/host_gates/connections.rs@@ -1,6 +1,7 @@+use super::graph_json::nodes;use crate::config::Config;use crate::flows::ops::build_flow_connections;-use tinyflows::model::{NodeKind, WorkflowGraph};+use serde_json::Value;use tinyflows_catalog::FlowConnection;// ─────────────────────────────────────────────────────────────────────────────@@ -33,7 +34,7 @@ use tinyflows_catalog::FlowConnection;pub(crate) async fn validate_connection_refs(ctx: &crate::core::runtime::DispatchCtx,config: &Config,- graph: &WorkflowGraph,+ graph: &Value,) -> Vec<String> {let connections: Option<Vec<FlowConnection>> =match crate::integrations::composio::ops::composio_list_connections(ctx, config).await {@@ -64,20 +65,18 @@ pub(crate) async fn validate_connection_refs(/// connections" state), or `None` when it was unavailable (fail-open: the/// id-existence check is skipped, only the toolkit-mismatch check runs).pub(crate) fn validate_connection_refs_against(- graph: &WorkflowGraph,+ graph: &Value,connections: Option<&[FlowConnection]>,) -> Vec<String> {use crate::integrations::composio::contract::validation::{validate_connection_refs as validate, ConnectedAccountRef, ConnectionRefNode,};- let nodes: Vec<_> = graph- .nodes- .iter()- .filter(|node| node.kind == NodeKind::ToolCall)+ let nodes: Vec<_> = nodes(graph)+ .filter(|node| node.kind == "tool_call").filter_map(|node| {Some(ConnectionRefNode {- id: node.id.clone(),+ id: node.id.to_owned(),slug: node.config.get("slug")?.as_str()?.to_string(),connection_ref: node.config.get("connection_ref")?.as_str()?.to_string(),})diff --git a/crates/openhuman-core/src/flows/host_gates/mod_tests.rs b/crates/openhuman-core/src/flows/host_gates/mod_tests.rsindex 63365995cc..0378816e37 100644--- a/crates/openhuman-core/src/flows/host_gates/mod_tests.rs+++ b/crates/openhuman-core/src/flows/host_gates/mod_tests.rs@@ -3,7 +3,6 @@ use crate::config::Config;use crate::integrations::composio::catalog::{seed_live_catalog_cache, ToolContract};use serde_json::{json, Value};use tempfile::TempDir;-use tinyflows::model::WorkflowGraph;use tinyflows_catalog::FlowConnection;fn test_config(tmp: &TempDir) -> Config {@@ -17,11 +16,11 @@ fn test_config(tmp: &TempDir) -> Config {config}-fn graph(value: Value) -> WorkflowGraph {+fn graph(value: Value) -> Value {let graph = tinyflows::migrate::deserialize_graph(value).expect("test graph deserializes");tinyflows::validate::validate(&graph).expect("test graph is structurally valid");tinyflows::compat::ensure_compatible(&graph).expect("test graph is compatible");- graph+ serde_json::to_value(graph).expect("validated graph serializes")}fn seeded_alias_contract() -> ToolContract {@@ -97,7 +96,7 @@ fn ws3_transcript_connections() -> Vec<FlowConnection> {]}-fn ws3_tool_call_graph(slug: &str, connection_ref: Option<&str>) -> WorkflowGraph {+fn ws3_tool_call_graph(slug: &str, connection_ref: Option<&str>) -> Value {let mut config = json!({ "slug": slug, "args": {} });if let Some(connection_ref) = connection_ref {config["connection_ref"] = json!(connection_ref);@@ -111,7 +110,7 @@ fn ws3_tool_call_graph(slug: &str, connection_ref: Option<&str>) -> WorkflowGrap}))}-fn upload_graph(path: Value) -> WorkflowGraph {+fn upload_graph(path: Value) -> Value {graph(json!({"nodes": [{"id":"t","kind":"trigger","name":"Manual"},diff --git a/crates/openhuman-core/src/flows/host_gates/tool_contracts.rs b/crates/openhuman-core/src/flows/host_gates/tool_contracts.rsindex 81a1b4575e..ac3d82e6a1 100644--- a/crates/openhuman-core/src/flows/host_gates/tool_contracts.rs+++ b/crates/openhuman-core/src/flows/host_gates/tool_contracts.rs@@ -1,6 +1,6 @@+use super::graph_json::nodes;use crate::config::Config;use serde_json::Value;-use tinyflows::model::{NodeKind, WorkflowGraph};// ─────────────────────────────────────────────────────────────────────────────// Tool-contract enforcement gate (systemic tool-contract fix, Part 2)@@ -40,18 +40,16 @@ use tinyflows::model::{NodeKind, WorkflowGraph};/// field can't be proven wrong, whereas a nonexistent slug or a missing/// required arg are both provably broken./// Enforces the host's curated-only, live-action and argument-shape policy.-pub(crate) async fn validate_tool_contracts(config: &Config, graph: &WorkflowGraph) -> Vec<String> {+pub(crate) async fn validate_tool_contracts(config: &Config, graph: &Value) -> Vec<String> {use crate::integrations::composio::contract::validation::{validate_tool_contract_nodes, ToolContractNode,};- let nodes: Vec<_> = graph- .nodes- .iter()- .filter(|node| node.kind == NodeKind::ToolCall)+ let nodes: Vec<_> = nodes(graph)+ .filter(|node| node.kind == "tool_call").filter_map(|node| {Some(ToolContractNode {- id: node.id.clone(),+ id: node.id.to_owned(),slug: node.config.get("slug")?.as_str()?.to_string(),args: node.config.get("args").cloned().unwrap_or(Value::Null),})diff --git a/crates/openhuman-core/src/flows/host_gates/upload_paths.rs b/crates/openhuman-core/src/flows/host_gates/upload_paths.rsindex 19cadf4008..9a7da1568b 100644--- a/crates/openhuman-core/src/flows/host_gates/upload_paths.rs+++ b/crates/openhuman-core/src/flows/host_gates/upload_paths.rs@@ -1,5 +1,5 @@-use serde_json::Value;use super::graph_json::nodes;+use serde_json::Value;/// Author-gate for `oh:storage_upload_file`: its literal `path` arg must be/// workspace-relative. Uploads are confined to the agent workspace by the