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
feat(agent): add artifact types and subagent host support
Steven Enamakel70190c6bce25
diff --git a/crates/openhuman-core/src/agent/artifacts/types.rs b/crates/openhuman-core/src/agent/artifacts/types.rsindex b3fc107246..02bf1052f8 100644--- a/crates/openhuman-core/src/agent/artifacts/types.rs+++ b/crates/openhuman-core/src/agent/artifacts/types.rs@@ -108,7 +108,7 @@ pub struct ArtifactMeta {#[serde(default, skip_serializing_if = "Option::is_none")]pub error: Option<String>,/// Chat thread that produced the artifact, captured from- /// [`crate::security::approval::APPROVAL_CHAT_CONTEXT`] at create-time+ /// the producing turn's [`crate::security::approval::ApprovalChatContext`] at create-time/// (#3226). `None` for CLI / cron / sub-agent paths and for legacy/// `meta.json` files written before this field existed — same convention/// as the `thread_id` carried on the producer eventsdiff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rsindex ba37e1eb28..77caf50680 100644--- a/crates/openhuman-core/src/agent/mod.rs+++ b/crates/openhuman-core/src/agent/mod.rs@@ -85,7 +85,7 @@ pub mod turn_env;/// entry point that invokes the agent (web chat, channel runtime, cron,/// background jobs, CLI). Read by the approval gate to make/// origin-aware decisions rather than inferring trust from the absence of-/// `APPROVAL_CHAT_CONTEXT`.+/// a chat approval context.pub mod turn_origin;/// How a turn that reached the completion path was stopped early (breaker,/// deadline wind-down, iteration cap), carried to traces and parent tools.diff --git a/crates/openhuman-core/src/agent/subagent_host/autonomous.rs b/crates/openhuman-core/src/agent/subagent_host/autonomous.rsindex 3c2dd39dc0..d61426a23c 100644--- a/crates/openhuman-core/src/agent/subagent_host/autonomous.rs+++ b/crates/openhuman-core/src/agent/subagent_host/autonomous.rs@@ -2,7 +2,7 @@//!//! `skills_run` runs the orchestrator (and any sub-agents it spawns) as an//! unattended background tree: it isn't approval-gated (background turns carry-//! no `APPROVAL_CHAT_CONTEXT`), and the per-agent iteration cap is lifted so the+//! no chat approval context), and the per-agent iteration cap is lifted so the//! run continues until it's done or the repeated-failure circuit breaker trips.//!//! The lifted cap rides `OpenHumanRunContext::autonomous_iter_cap`, set bydiff --git a/crates/openhuman-core/src/core/events.rs b/crates/openhuman-core/src/core/events.rsindex e2ba82ef4d..1bf732dae2 100644--- a/crates/openhuman-core/src/core/events.rs+++ b/crates/openhuman-core/src/core/events.rs@@ -641,7 +641,7 @@ pub enum DomainEvent {/// `EgressSurfaceSubscriber` (defined in/// `crates/openhuman-core/src/web_chat/event_bus.rs`) when the emitting/// turn carries chat routing. `thread_id` / `client_id` come from the- /// ambient `APPROVAL_CHAT_CONTEXT` and are `None` for CLI / cron /+ /// the egress ledger's chat routing and are `None` for CLI / cron //// background transfers (no chat surface to route to).////// Only external transfers fire this event — local-only inference@@ -720,7 +720,7 @@ pub enum DomainEvent {/// is on disk and ready to be downloaded. Published by/// [`crate::agent::artifacts::store::finalize_artifact`]./// Bridged to the web channel as an `artifact_ready` socket event- /// when the publishing turn carries an `APPROVAL_CHAT_CONTEXT`+ /// when the publishing turn carries an `ApprovalChatContext`/// (see [`crate::security::approval::ApprovalChatContext`])./// Sub-task #2779 of #1535.ArtifactReady {@@ -747,7 +747,7 @@ pub enum DomainEvent {/// Final on-disk file size in bytes.size_bytes: u64,/// Chat thread the artifact belongs to, when the producing- /// turn carried an `APPROVAL_CHAT_CONTEXT`. `None` for CLI /+ /// turn carried an `ApprovalChatContext`. `None` for CLI //// cron / sub-agent paths — no client to fan out to.thread_id: Option<String>,/// Socket.IO client id (room) to surface the card to, when@@ -811,7 +811,7 @@ pub enum DomainEvent {/// place without flicker.path: String,/// Chat thread the artifact belongs to, when the producing turn- /// carried an `APPROVAL_CHAT_CONTEXT`. `None` for CLI / cron /+ /// carried an `ApprovalChatContext`. `None` for CLI / cron //// sub-agent paths — no client to fan out to.thread_id: Option<String>,/// Socket.IO client id (room) to surface the card to, when known.diff --git a/crates/openhuman-core/src/flows/agents/workflow_builder/agent.toml b/crates/openhuman-core/src/flows/agents/workflow_builder/agent.tomlindex a5bdf8965d..db69cf3c00 100644--- a/crates/openhuman-core/src/flows/agents/workflow_builder/agent.toml+++ b/crates/openhuman-core/src/flows/agents/workflow_builder/agent.toml@@ -21,7 +21,7 @@ omit_memory_context = true# saved flow), is gated by the `ApprovalGate` itself, not this preamble: on the# streaming copilot path (flows-copilot-live-run-approval, PR3) it parks behind# a real human approval card (`AgentTurnOrigin::WebChat` +-# `APPROVAL_CHAT_CONTEXT`, same as main chat); on the headless `flows_build`+# chat approval context, same as main chat); on the headless `flows_build`# path it stays hidden entirely (`restrict_builder_toolset`, #4593/#4881) since# there is no approval surface to park against there.omit_safety_preamble = truediff --git a/crates/openhuman-core/src/flows/ops/builder_toolset.rs b/crates/openhuman-core/src/flows/ops/builder_toolset.rsindex deb99c5bdd..c24efdc5f0 100644--- a/crates/openhuman-core/src/flows/ops/builder_toolset.rs+++ b/crates/openhuman-core/src/flows/ops/builder_toolset.rs@@ -88,8 +88,8 @@ pub(super) fn restrict_builder_toolset(agent: &mut crate::agent::OpenHumanSessio////// PR3 (flows-copilot-live-run-approval): when a chat thread is attached/// (`stream.is_some()`), `flows_build` now runs the builder under-/// [`AgentTurnOrigin::WebChat`] with [`APPROVAL_CHAT_CONTEXT`] scoped-/// alongside it — the exact same double-scope the main web-chat delegate uses+/// [`AgentTurnOrigin::WebChat`] with the chat approval context handed to+/// the same turn — the exact same pairing the main web-chat delegate uses/// (`web_chat::ops::run_turn_under_cancel_and_deadline`). Under that origin/// the [`crate::security::approval::ApprovalGate`] no longer auto-allows/// `external_effect` tools; it PARKS them for a real human decision, routeddiff --git a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rsindex 642301cc9a..49d066ce54 100644--- a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs@@ -134,7 +134,7 @@ async fn connect_tool_execute_rejects_missing_toolkit() {#[tokio::test]async fn connect_tool_refuses_without_interactive_chat_context() {- // No `APPROVAL_CHAT_CONTEXT` in scope → background/cron turn. There is no+ // No chat approval context → background/cron turn. There is no// surface for the Connect card, so the tool must fail closed (it returns// before touching the network).let t = ComposioConnectTool::new(fake_config_arc());diff --git a/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs b/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rsindex c3cb2df568..450cd066a8 100644--- a/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs+++ b/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs@@ -262,7 +262,7 @@ async fn intercept_audited_id_is_none_for_denied_some_for_approved() {async fn flow_origin_park_populates_source_context_with_flow_and_run_id() {// A `require_approval: true` flow still parks (same shape as before// this change) but the persisted row must now carry the flow/run- // correlation the `APPROVAL_FLOW_RUN_CONTEXT` task-local supplies —+ // correlation the turn's `flow_run` supplies —// the origin alone only carries `flow_id`, not `run_id`.let (gate, _dir) = test_gate();let gate = Arc::new(gate);diff --git a/crates/openhuman-core/src/security/approval/gate_subagent_tests.rs b/crates/openhuman-core/src/security/approval/gate_subagent_tests.rsindex 3b22b394c1..e6f4ef1979 100644--- a/crates/openhuman-core/src/security/approval/gate_subagent_tests.rs+++ b/crates/openhuman-core/src/security/approval/gate_subagent_tests.rs@@ -76,7 +76,7 @@ async fn an_async_subagent_park_reaches_the_parent_thread_detached_with_a_short_let before = chrono::Utc::now();let g = gate.clone();- // Origin propagated, APPROVAL_CHAT_CONTEXT not — the state+ // Origin propagated, the chat approval context not — the state// `spawn_async_subagent` leaves its detached child in.let handle = tokio::spawn(async move {turn_origin::with_origin(diff --git a/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs b/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rsindex ef6b91a758..69954b3c8e 100644--- a/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs+++ b/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs@@ -9,12 +9,12 @@ use crate::platform::socket::manager::global_socket_manager;/// Chat thread + client id the voice turn scopes as its approval / routing/// surface, mirroring `deliver_voice_result_to_chat`. Setting these around the-/// turn (via `APPROVAL_CHAT_CONTEXT` plus the explicit agent thread) is what makes the voice+/// turn (via the chat approval context plus the explicit agent thread) is what makes the voice/// orchestrator behave like the chat path for tools that need a *routable*/// approval surface:////// - `composio_connect` fails closed with a `[policy-denied] … needs an-/// interactive chat turn` message whenever `APPROVAL_CHAT_CONTEXT` is absent+/// interactive chat turn` message whenever the turn has no chat approval context/// (see `integrations/composio/tools.rs`). On voice that message got/// paraphrased back to the user as "your Gmail connection is throwing an auth/// error, reconnect it" — the exact voice-only Gmail-summary failure — evendiff --git a/crates/openhuman-core/src/web_chat/mod.rs b/crates/openhuman-core/src/web_chat/mod.rsindex 1ba366b60a..86a7f3665e 100644--- a/crates/openhuman-core/src/web_chat/mod.rs+++ b/crates/openhuman-core/src/web_chat/mod.rs@@ -5,7 +5,7 @@//! durably-persisted reply: `start_chat` (`ops/start_chat.rs`) validates and//! preprocesses the message, applies the queue mode against the thread's//! in-flight state, and spawns `run_task::run_chat_task` under the cancel-//! token / idle guard / wall-clock backstop / `APPROVAL_CHAT_CONTEXT` scope+//! token / idle guard / wall-clock backstop / approval-context hand-off//! (`run_turn_under_cancel_and_deadline`, `ops/turn_guards.rs`). `run_chat_task`//! resolves or builds the cached session `Agent` (`session.rs`), spawns//! `spawn_progress_bridge` alongside the run, and returns the result; the