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(caps_host): update error formatting and module exports
Steven Enamakel81846865d9f8
diff --git a/crates/openhuman-core/src/flows/caps_host/error.rs b/crates/openhuman-core/src/flows/caps_host/error.rsindex 78b127fdbf..ec41a1513d 100644--- a/crates/openhuman-core/src/flows/caps_host/error.rs+++ b/crates/openhuman-core/src/flows/caps_host/error.rs@@ -12,7 +12,7 @@ pub(crate) type EngineError = CapsError;impl fmt::Display for CapsError {fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {match self {- Self::Capability(message) => f.write_str(message),+ Self::Capability(message) => write!(f, "capability error: {message}"),}}}diff --git a/crates/openhuman-core/src/flows/caps_host/mod.rs b/crates/openhuman-core/src/flows/caps_host/mod.rsindex 78f67c411a..153489078d 100644--- a/crates/openhuman-core/src/flows/caps_host/mod.rs+++ b/crates/openhuman-core/src/flows/caps_host/mod.rs@@ -14,6 +14,10 @@ pub(crate) mod tools;pub(crate) use binding::{CapsHostRegistration, serve};pub(crate) use error::{CapsError, EngineError, Result};+pub(crate) use code::OpenHumanCode;+pub(crate) use http::{+ OpenHumanHttp, resolve_http_credential,+};pub(crate) use llm::OpenHumanLlm;pub(crate) use service::CapsHostService;pub(crate) use tools::OpenHumanTools;@@ -21,7 +25,7 @@ pub(crate) use tier::{close_audit, current_tier_policy, enforce_current_node_tier_gate,enforce_node_tier_gate, gate_call_for_tier,};-pub(crate) use tools::NATIVE_TOOL_PREFIX;+pub(crate) use tools::{NATIVE_TOOL_PREFIX, classify_composio_action_for_tier};#[cfg(test)]#[path = "ops_tests.rs"]diff --git a/crates/openhuman-core/src/flows/caps_host/ops_tests.rs b/crates/openhuman-core/src/flows/caps_host/ops_tests.rsindex c768496c01..bfea0d0a3a 100644--- a/crates/openhuman-core/src/flows/caps_host/ops_tests.rs+++ b/crates/openhuman-core/src/flows/caps_host/ops_tests.rs@@ -28,35 +28,6 @@ fn workflow_origin(job_id: &str, require_approval: bool) -> AgentTurnOrigin {}}-// ── Phase 7: sub_workflow-by-id resolver ───────────────────────────────--fn resolver_test_config(tmp: &tempfile::TempDir) -> Config {- let config = Config {- workspace_dir: tmp.path().join("workspace"),- action_dir: tmp.path().join("workspace"),- config_path: tmp.path().join("config.toml"),- ..Config::default()- };- std::fs::create_dir_all(&config.workspace_dir).unwrap();- config-}--fn trigger_only_graph() -> WorkflowGraph {- use tinyflows::model::{Node, NodeKind};- WorkflowGraph {- nodes: vec![Node {- id: "t".to_string(),- kind: NodeKind::Trigger,- type_version: 1,- name: "Trigger".to_string(),- config: Value::Null,- ports: Vec::new(),- position: None,- }],- ..Default::default()- }-}-#[path = "ops_schema_and_structured_output_tests.rs"]mod schema_and_structured_output_tests;#[path = "ops_tier_gate_and_timeouts_tests.rs"]diff --git a/crates/openhuman-core/src/flows/recovery.rs b/crates/openhuman-core/src/flows/recovery.rsnew file mode 100644index 0000000000..9d4a06c16d--- /dev/null+++ b/crates/openhuman-core/src/flows/recovery.rs@@ -0,0 +1,80 @@+//! Host entry points for TinyFlows-owned run recovery.+//!+//! Run rows, lifecycle compare-and-swaps, checkpoints, dedup settlement, and+//! terminal run events belong to the TinyFlows Runs module. OpenHuman supplies+//! only the scope-bound CatalogStorage callback and projects the module's+//! changed runs through the shared runs adapter.++use std::sync::Arc;++use crate::config::Config;+use crate::core::runtime::DispatchCtx;+use crate::flows::{catalog_storage::CatalogStorageRegistration, runs_adapter};++/// Expire parked runs in this dispatch scope, preserving the read-path's+/// best-effort behavior. The module returns only rows whose parked-only expiry+/// compare-and-swap won; the runs adapter projects and releases those rows.+pub(crate) async fn expire_parked_runs(ctx: &DispatchCtx, config: &Config) -> usize {+ let storage = match crate::flows::catalog_storage::register(ctx, config).await {+ Ok(storage) => storage,+ Err(error) => {+ tracing::warn!(target: "flows", %error, "[flows] parked-run TTL sweep could not register CatalogStorage; read continues");+ return 0;+ }+ };++ match runs_adapter::expire_parked(ctx, config, storage).await {+ Ok(response) => response.expired.len(),+ Err(error) => {+ tracing::warn!(target: "flows", %error, "[flows] parked-run TTL sweep failed; read continues");+ 0+ }+ }+}++/// Reconcile orphaned local runs across the selected storage scopes.+///+/// A shared backend is deliberately left alone because a `running` row can be+/// owned by another replica. Each local scope gets its own stable storage+/// callback. The module applies the boot floor and live-actor/lease checks and+/// returns only rows it changed; the runs adapter handles event projection and+/// releases retained callback state for those rows.+pub(crate) async fn sweep_orphaned_runs_on_boot(+ ctx: &DispatchCtx,+ config: &Config,+) -> usize {+ if tinyflows_catalog::run_management::boot_sweep_plan(+ crate::storage::installed_is_shared(),+ ) == tinyflows_catalog::run_management::BootSweepPlan::Nothing+ {+ tracing::info!(target: "flows", "[flows] boot sweep: skipped, the storage backend is shared");+ return 0;+ }++ crate::storage::agents::for_each_scope(ctx, "flows boot sweep", |scope_ctx| async move {+ sweep_one_scope(&scope_ctx, config).await+ })+ .await+ .into_iter()+ .map(|(_, swept)| swept)+ .sum()+}++async fn sweep_one_scope(ctx: &DispatchCtx, config: &Config) -> usize {+ let storage: Arc<CatalogStorageRegistration> =+ match crate::flows::catalog_storage::register(ctx, config).await {+ Ok(storage) => storage,+ Err(error) => {+ tracing::warn!(target: "flows", %error, "[flows] boot sweep: CatalogStorage registration failed");+ return 0;+ }+ };++ match runs_adapter::boot_sweep(ctx, config, storage).await {+ Ok(response) => response.interrupted.len(),+ Err(error) => {+ tracing::warn!(target: "flows", %error, "[flows] boot sweep failed");+ 0+ }+ }+}