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
chore: reformat function signatures and reorder module declarations
Steven Enamakel43c1bde662a7
diff --git a/src/openhuman/flows/agents/workflow_builder/tool_wording_tests.rs b/src/openhuman/flows/agents/workflow_builder/tool_wording_tests.rsindex a2a6ebb5d9..d51e5af5ba 100644--- a/src/openhuman/flows/agents/workflow_builder/tool_wording_tests.rs+++ b/src/openhuman/flows/agents/workflow_builder/tool_wording_tests.rs@@ -33,5 +33,4 @@ mod tests {the specialist's full tool loop");}-}diff --git a/src/openhuman/flows/builder_tools.rs b/src/openhuman/flows/builder_tools.rsindex 4cecadbb32..b0a5ef387d 100644--- a/src/openhuman/flows/builder_tools.rs+++ b/src/openhuman/flows/builder_tools.rs@@ -2824,11 +2824,9 @@ fn build_null_resolution_entry(diag: &tinyflows::expr::NullResolution,graph: &WorkflowGraph,) -> Value {- if let Some(upstream) = tinyflows::preflight::mock_opaque_tool_call_upstream_ref(- &diag.expression,- graph,- node_id,- ) {+ if let Some(upstream) =+ tinyflows::preflight::mock_opaque_tool_call_upstream_ref(&diag.expression, graph, node_id)+ {let field = diag.location.strip_prefix("args.").unwrap_or("args");// The disambiguation advice differs by upstream kind: a native `oh:`// tool's output binds FLAT (`.item.json.<field>`) afterdiff --git a/src/openhuman/flows/draft_store.rs b/src/openhuman/flows/draft_store.rsindex 6318e28497..be33ff34f9 100644--- a/src/openhuman/flows/draft_store.rs+++ b/src/openhuman/flows/draft_store.rs@@ -12,7 +12,13 @@ use tinyflows_catalog::{DraftOrigin, FlowDraft};/// Binds [`tinyflows_sqlite::drafts::create_draft`] to this host's catalog directory.#[inline]-pub fn create_draft(config: &Config, flow_id: Option<String>, name: String, graph: Value, origin: DraftOrigin) -> Result<FlowDraft> {+pub fn create_draft(+ config: &Config,+ flow_id: Option<String>,+ name: String,+ graph: Value,+ origin: DraftOrigin,+) -> Result<FlowDraft> {tinyflows_sqlite::drafts::create_draft(&dir(config), flow_id, name, graph, origin)}@@ -24,7 +30,13 @@ pub fn get_draft(config: &Config, id: &str) -> Result<Option<FlowDraft>> {/// Binds [`tinyflows_sqlite::drafts::update_draft`] to this host's catalog directory.#[inline]-pub fn update_draft(config: &Config, id: &str, name: Option<String>, graph: Option<Value>, flow_id: Option<Option<String>>) -> Result<FlowDraft> {+pub fn update_draft(+ config: &Config,+ id: &str,+ name: Option<String>,+ graph: Option<Value>,+ flow_id: Option<Option<String>>,+) -> Result<FlowDraft> {tinyflows_sqlite::drafts::update_draft(&dir(config), id, name, graph, flow_id)}diff --git a/src/openhuman/flows/import_tests.rs b/src/openhuman/flows/import_tests.rsindex 0e0471c8f2..1f8cad5aa6 100644--- a/src/openhuman/flows/import_tests.rs+++ b/src/openhuman/flows/import_tests.rs@@ -11,8 +11,6 @@ mod tests {use serde_json::json;use tinyflows_catalog::import::n8n::map_n8n_workflow;--/// Imports a small n8n fixture that uses `$json` bindings end-to-end/// through the exact same path `ops::flows_import` takes (map →/// re-serialize → `validate_and_migrate_graph`), then runs the importeddiff --git a/src/openhuman/flows/mod.rs b/src/openhuman/flows/mod.rsindex f43edc7d97..4a9cc9f41e 100644--- a/src/openhuman/flows/mod.rs+++ b/src/openhuman/flows/mod.rs@@ -30,12 +30,12 @@pub mod agents;pub mod builder_tools;-#[cfg(test)]-#[path = "import_tests.rs"]-mod import_tests;pub mod bus;pub mod discovery_tools;mod draft_store;+#[cfg(test)]+#[path = "import_tests.rs"]+mod import_tests;pub mod medulla_bridge;pub mod memory_tools;pub mod node_contracts;diff --git a/src/openhuman/flows/ops.rs b/src/openhuman/flows/ops.rsindex b99345d74c..84b75eb15f 100644--- a/src/openhuman/flows/ops.rs+++ b/src/openhuman/flows/ops.rs@@ -27,7 +27,6 @@ use tokio_util::sync::CancellationToken;use crate::openhuman::agent::turn_origin::{with_origin, AgentTurnOrigin, TrustedAutomationSource};use crate::openhuman::config::Config;-use tinyflows_catalog::build_registry;use crate::openhuman::flows::bus;use crate::openhuman::flows::draft_store;use crate::openhuman::flows::run_registry;@@ -41,6 +40,7 @@ use crate::openhuman::security::approval::{APPROVAL_FLOW_RUN_CONTEXT,};use crate::rpc::RpcOutcome;+use tinyflows_catalog::build_registry;// `MemoryProvider` brings `driver_id()` / `as_documents()` into scope for the// `MemoryGuard` this file's delete path clears through. Nothing here names the// engine crate any more — `flows_delete_impl`'s test seam took an@@ -203,7 +203,6 @@ fn ensure_config_aware_engine_compatible(}}-/// Runs a raw graph JSON value through migration + deserialization **without**/// the structural `validate` step. Splits the two so a caller that wants/// *every* structural error (via `tinyflows::validate::validate_all`) can rundiff --git a/src/openhuman/flows/store.rs b/src/openhuman/flows/store.rsindex cb9ab299ac..b700c05a27 100644--- a/src/openhuman/flows/store.rs+++ b/src/openhuman/flows/store.rs@@ -42,7 +42,13 @@ pub fn insert_duplicate_flow(config: &Config, source: &Flow, new_name: String) -/// Binds [`tinyflows_sqlite::flows::create_flow`] to this host's catalog directory.#[inline]-pub fn create_flow(config: &Config, name: String, graph: tinyflows::model::WorkflowGraph, require_approval: bool, enabled: bool) -> Result<Flow> {+pub fn create_flow(+ config: &Config,+ name: String,+ graph: tinyflows::model::WorkflowGraph,+ require_approval: bool,+ enabled: bool,+) -> Result<Flow> {tinyflows_sqlite::flows::create_flow(&dir(config), name, graph, require_approval, enabled)}@@ -78,8 +84,26 @@ pub fn set_enabled(config: &Config, id: &str, enabled: bool) -> Result<Flow> {/// Binds [`tinyflows_sqlite::flows::update_flow_graph`] to this host's catalog directory.#[inline]-pub fn update_flow_graph(config: &Config, id: &str, name: String, graph: tinyflows::model::WorkflowGraph, require_approval: bool, enabled_override: Option<bool>, force_disarm_if_automatic: bool, expected_updated_at: Option<&str>) -> std::result::Result<Flow, FlowUpdateError> {- tinyflows_sqlite::flows::update_flow_graph(&dir(config), id, name, graph, require_approval, enabled_override, force_disarm_if_automatic, expected_updated_at)+pub fn update_flow_graph(+ config: &Config,+ id: &str,+ name: String,+ graph: tinyflows::model::WorkflowGraph,+ require_approval: bool,+ enabled_override: Option<bool>,+ force_disarm_if_automatic: bool,+ expected_updated_at: Option<&str>,+) -> std::result::Result<Flow, FlowUpdateError> {+ tinyflows_sqlite::flows::update_flow_graph(+ &dir(config),+ id,+ name,+ graph,+ require_approval,+ enabled_override,+ force_disarm_if_automatic,+ expected_updated_at,+ )}/// Binds [`tinyflows_sqlite::flows::list_revisions`] to this host's catalog directory.@@ -90,7 +114,11 @@ pub fn list_revisions(config: &Config, flow_id: &str, limit: usize) -> Result<Ve/// Binds [`tinyflows_sqlite::flows::revision_by_id`] to this host's catalog directory.#[inline]-pub fn revision_by_id(config: &Config, flow_id: &str, revision_id: &str) -> Result<Option<FlowRevision>> {+pub fn revision_by_id(+ config: &Config,+ flow_id: &str,+ revision_id: &str,+) -> Result<Option<FlowRevision>> {tinyflows_sqlite::flows::revision_by_id(&dir(config), flow_id, revision_id)}@@ -108,7 +136,12 @@ pub fn kv_get(config: &Config, namespace: &str, key: &str) -> Result<Option<serd/// Binds [`tinyflows_sqlite::flows::kv_set`] to this host's catalog directory.#[inline]-pub fn kv_set(config: &Config, namespace: &str, key: &str, value: &serde_json::Value) -> Result<()> {+pub fn kv_set(+ config: &Config,+ namespace: &str,+ key: &str,+ value: &serde_json::Value,+) -> Result<()> {tinyflows_sqlite::flows::kv_set(&dir(config), namespace, key, value)}@@ -120,7 +153,13 @@ pub fn kv_delete(config: &Config, namespace: &str, key: &str) -> Result<()> {/// Binds [`tinyflows_sqlite::flows::insert_flow_run`] to this host's catalog directory.#[inline]-pub fn insert_flow_run(config: &Config, id: &str, flow_id: &str, thread_id: &str, started_at: &str) -> Result<()> {+pub fn insert_flow_run(+ config: &Config,+ id: &str,+ flow_id: &str,+ thread_id: &str,+ started_at: &str,+) -> Result<()> {tinyflows_sqlite::flows::insert_flow_run(&dir(config), id, flow_id, thread_id, started_at)}@@ -132,8 +171,26 @@ pub fn prune_flow_runs(config: &Config, flow_id: &str, keep: usize) -> Result<us/// Binds [`tinyflows_sqlite::flows::finish_flow_run`] to this host's catalog directory.#[inline]-pub fn finish_flow_run(config: &Config, id: &str, status: &str, finished_at: &str, steps: &[FlowRunStep], pending_approvals: &[String], error: Option<&str>, graph_hash: Option<&str>) -> Result<bool> {- tinyflows_sqlite::flows::finish_flow_run(&dir(config), id, status, finished_at, steps, pending_approvals, error, graph_hash)+pub fn finish_flow_run(+ config: &Config,+ id: &str,+ status: &str,+ finished_at: &str,+ steps: &[FlowRunStep],+ pending_approvals: &[String],+ error: Option<&str>,+ graph_hash: Option<&str>,+) -> Result<bool> {+ tinyflows_sqlite::flows::finish_flow_run(+ &dir(config),+ id,+ status,+ finished_at,+ steps,+ pending_approvals,+ error,+ graph_hash,+ )}/// Binds [`tinyflows_sqlite::flows::upsert_flow_run_step`] to this host's catalog directory.@@ -144,13 +201,21 @@ pub fn upsert_flow_run_step(config: &Config, run_id: &str, step: &FlowRunStep) -/// Binds [`tinyflows_sqlite::flows::expire_parked_runs`] to this host's catalog directory.#[inline]-pub fn expire_parked_runs(config: &Config, cutoff: &str, now: &str, error_msg: &str) -> Result<Vec<(String, String)>> {+pub fn expire_parked_runs(+ config: &Config,+ cutoff: &str,+ now: &str,+ error_msg: &str,+) -> Result<Vec<(String, String)>> {tinyflows_sqlite::flows::expire_parked_runs(&dir(config), cutoff, now, error_msg)}/// Binds [`tinyflows_sqlite::flows::list_running_run_ids`] to this host's catalog directory.#[inline]-pub fn list_running_run_ids(config: &Config, started_before: &str) -> Result<Vec<(String, String)>> {+pub fn list_running_run_ids(+ config: &Config,+ started_before: &str,+) -> Result<Vec<(String, String)>> {tinyflows_sqlite::flows::list_running_run_ids(&dir(config), started_before)}@@ -160,7 +225,12 @@ pub fn list_running_run_ids(config: &Config, started_before: &str) -> Result<Vec/// this crate turns on as a dev-dependency and never in a shipped build.#[cfg(test)]#[inline]-pub fn force_run_status_for_test(config: &Config, id: &str, status: &str, error: Option<&str>) -> Result<()> {+pub fn force_run_status_for_test(+ config: &Config,+ id: &str,+ status: &str,+ error: Option<&str>,+) -> Result<()> {tinyflows_sqlite::flows::force_run_status_for_test(&dir(config), id, status, error)}@@ -170,8 +240,16 @@ pub fn force_run_status_for_test(config: &Config, id: &str, status: &str, error:/// this crate turns on as a dev-dependency and never in a shipped build.#[cfg(test)]#[inline]-pub fn force_corrupt_graph_json_for_test(config: &Config, flow_id: &str, raw_graph_json: &str) -> Result<()> {- tinyflows_sqlite::flows::force_corrupt_graph_json_for_test(&dir(config), flow_id, raw_graph_json)+pub fn force_corrupt_graph_json_for_test(+ config: &Config,+ flow_id: &str,+ raw_graph_json: &str,+) -> Result<()> {+ tinyflows_sqlite::flows::force_corrupt_graph_json_for_test(+ &dir(config),+ flow_id,+ raw_graph_json,+ )}/// Binds [`tinyflows_sqlite::flows::mark_run_resuming`] to this host's catalog directory.@@ -212,7 +290,11 @@ pub fn upsert_suggestions(config: &Config, suggestions: &[FlowSuggestion]) -> Re/// Binds [`tinyflows_sqlite::flows::list_suggestions`] to this host's catalog directory.#[inline]-pub fn list_suggestions(config: &Config, status: Option<SuggestionStatus>, limit: usize) -> Result<Vec<FlowSuggestion>> {+pub fn list_suggestions(+ config: &Config,+ status: Option<SuggestionStatus>,+ limit: usize,+) -> Result<Vec<FlowSuggestion>> {tinyflows_sqlite::flows::list_suggestions(&dir(config), status, limit)}diff --git a/src/openhuman/flows/tinyflows/caps/mod.rs b/src/openhuman/flows/tinyflows/caps/mod.rsindex 6119ce5ebd..081899d7df 100644--- a/src/openhuman/flows/tinyflows/caps/mod.rs+++ b/src/openhuman/flows/tinyflows/caps/mod.rs@@ -24,10 +24,10 @@ pub(crate) use llm::*;// "answer the shape this node declared" is a fact about the engine's own// output-parser sub-port, not about OpenHuman. Re-exported under the historical// `caps::` path so existing call sites resolve unchanged.-pub(crate) use tinyflows::caps::mock_schema_aware::*;pub use ops::*;pub(crate) use prompt::*;pub(crate) use resolver::*;pub(crate) use state::*;pub(crate) use tier::*;+pub(crate) use tinyflows::caps::mock_schema_aware::*;pub(crate) use tools::NATIVE_TOOL_PREFIX;diff --git a/src/openhuman/flows/tinyflows/checkpoint_compat_tests.rs b/src/openhuman/flows/tinyflows/checkpoint_compat_tests.rsindex 1974c2ba95..8a5d63f8ad 100644--- a/src/openhuman/flows/tinyflows/checkpoint_compat_tests.rs+++ b/src/openhuman/flows/tinyflows/checkpoint_compat_tests.rs@@ -15,67 +15,66 @@ mod tests {use tinyflows::graph::Checkpointer;use tinyflows_sqlite::checkpoint::SqliteCheckpointer;-/// The reason this file exists. The port is a retarget of the backend-/// `tinyagents` shipped, and the two must agree on the bytes on disk: an-/// existing `<workspace>/flows/checkpoints.db` is read and written by this-/// code after the upgrade, and a divergence would surface as an interrupted-/// flow that cannot resume — at the worst possible moment, on a user's-/// machine, with the run already half-done.-///-/// Comparing the DDL is the cheapest total statement of that: same tables,-/// same columns, same primary keys, same indexes.-#[test]-fn schema_is_identical_to_the_backend_it_replaced() {- assert_eq!(- SqliteCheckpointer::<serde_json::Value>::schema_sql(),- tinyagents::graph::SqliteCheckpointer::<serde_json::Value>::schema_sql(),- "the ported schema drifted from the tinyagents backend that wrote every \+ /// The reason this file exists. The port is a retarget of the backend+ /// `tinyagents` shipped, and the two must agree on the bytes on disk: an+ /// existing `<workspace>/flows/checkpoints.db` is read and written by this+ /// code after the upgrade, and a divergence would surface as an interrupted+ /// flow that cannot resume — at the worst possible moment, on a user's+ /// machine, with the run already half-done.+ ///+ /// Comparing the DDL is the cheapest total statement of that: same tables,+ /// same columns, same primary keys, same indexes.+ #[test]+ fn schema_is_identical_to_the_backend_it_replaced() {+ assert_eq!(+ SqliteCheckpointer::<serde_json::Value>::schema_sql(),+ tinyagents::graph::SqliteCheckpointer::<serde_json::Value>::schema_sql(),+ "the ported schema drifted from the tinyagents backend that wrote every \checkpoints.db in the field — an existing database would stop resuming"- );-}--/// A database written by the backend this replaced must be readable here, and-/// the schema check above is a statement about DDL rather than about-/// behaviour. This writes through the old type and reads back through the new-/// one, against one file.-#[tokio::test]-async fn reads_a_database_written_by_the_previous_backend() {- let tmp = TempDir::new().unwrap();- let db = tmp.path().join("checkpoints.db");+ );+ }- // Fully qualified: the two `Checkpointer` traits share a method set, so- // importing both here would make every call in this file ambiguous.- use tinyagents::Checkpointer as LegacyCheckpointer;+ /// A database written by the backend this replaced must be readable here, and+ /// the schema check above is a statement about DDL rather than about+ /// behaviour. This writes through the old type and reads back through the new+ /// one, against one file.+ #[tokio::test]+ async fn reads_a_database_written_by_the_previous_backend() {+ let tmp = TempDir::new().unwrap();+ let db = tmp.path().join("checkpoints.db");- let old = tinyagents::graph::SqliteCheckpointer::<serde_json::Value>::open(&db).unwrap();- let written = tinyagents::graph::Checkpoint {- thread_id: "flow:f1:run-a".to_string(),- checkpoint_id: "cp-1".to_string(),- run_id: Some("run-1".to_string()),- parent_checkpoint_id: None,- namespace: Vec::new(),- state: json!({ "counter": 7 }),- next_nodes: vec![tinyagents::harness::ids::NodeId::new("next")],- completed_tasks: vec![tinyagents::harness::ids::NodeId::new("done")],- pending_writes: Vec::new(),- interrupts: Vec::new(),- pending_activations: None,- barrier_arrivals: Vec::new(),- metadata: json!({ "source": "loop", "step": 3 }),- };- LegacyCheckpointer::put(&old, written).await.unwrap();- drop(old);+ // Fully qualified: the two `Checkpointer` traits share a method set, so+ // importing both here would make every call in this file ambiguous.+ use tinyagents::Checkpointer as LegacyCheckpointer;- let new = SqliteCheckpointer::<serde_json::Value>::open(&db).unwrap();- let read = new- .get("flow:f1:run-a", None)- .await- .unwrap()- .expect("the pre-upgrade checkpoint must still load");- assert_eq!(read.checkpoint_id, "cp-1");- assert_eq!(read.state, json!({ "counter": 7 }));- assert_eq!(read.next_nodes, vec![NodeId::new("next")]);- assert_eq!(read.metadata["step"], 3);-}+ let old = tinyagents::graph::SqliteCheckpointer::<serde_json::Value>::open(&db).unwrap();+ let written = tinyagents::graph::Checkpoint {+ thread_id: "flow:f1:run-a".to_string(),+ checkpoint_id: "cp-1".to_string(),+ run_id: Some("run-1".to_string()),+ parent_checkpoint_id: None,+ namespace: Vec::new(),+ state: json!({ "counter": 7 }),+ next_nodes: vec![tinyagents::harness::ids::NodeId::new("next")],+ completed_tasks: vec![tinyagents::harness::ids::NodeId::new("done")],+ pending_writes: Vec::new(),+ interrupts: Vec::new(),+ pending_activations: None,+ barrier_arrivals: Vec::new(),+ metadata: json!({ "source": "loop", "step": 3 }),+ };+ LegacyCheckpointer::put(&old, written).await.unwrap();+ drop(old);+ let new = SqliteCheckpointer::<serde_json::Value>::open(&db).unwrap();+ let read = new+ .get("flow:f1:run-a", None)+ .await+ .unwrap()+ .expect("the pre-upgrade checkpoint must still load");+ assert_eq!(read.checkpoint_id, "cp-1");+ assert_eq!(read.state, json!({ "counter": 7 }));+ assert_eq!(read.next_nodes, vec![NodeId::new("next")]);+ assert_eq!(read.metadata["step"], 3);+ }}