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(tinyagents): qualify middleware re-exports by module path
Steven Enamakel4b3f5383e808
diff --git a/crates/openhuman-core/src/agent/harness/graph.rs b/crates/openhuman-core/src/agent/harness/graph.rsindex c364671759..e2b4252fba 100644--- a/crates/openhuman-core/src/agent/harness/graph.rs+++ b/crates/openhuman-core/src/agent/harness/graph.rs@@ -33,8 +33,8 @@ use anyhow::Result;use tokio::sync::mpsc::Sender;use crate::agent::progress::AgentProgress;-use crate::agent::tinyagents::TurnSpec;use crate::agent::tinyagents::TurnModelSource;+use crate::agent::tinyagents::TurnSpec;use crate::config::{MultimodalConfig, MultimodalFileConfig};use tinyagents_session::transcript::TranscriptMessage;use tinytools::Tool;@@ -174,7 +174,7 @@ pub(crate) async fn run_channel_turn_via_graph(max_output_tokens: Some(crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS),// Context middlewares: cache-align + default tool-result byte cap (the// channel path has no session `ContextManager` to source config from).- context_mw: crate::agent::tinyagents::TurnContextMiddleware::defaults(),+ context_mw: crate::agent::tinyagents::middleware::TurnContextMiddleware::defaults(),// Channel/CLI path carries its own gating; no session `.tool_policy()`.tool_policy: None,// Interactive channel/CLI turn — never serve a cached model response.@@ -183,7 +183,8 @@ pub(crate) async fn run_channel_turn_via_graph(// NOT emit `TurnCompleted` itself, so let the seam emit the single// terminal event (legacy-engine parity).defer_turn_completed_to_caller: false,- }.run();+ }+ .run();let outcome = match (turn_origin, crate::core::runtime::CoreContext::current()) {(Some(origin), Some(context)) => {crate::core::runtime::CoreContext::scope_with_turn_origin(diff --git a/crates/openhuman-core/src/agent/session_host/driver.rs b/crates/openhuman-core/src/agent/session_host/driver.rsindex 26c315498b..0d961ad9b9 100644--- a/crates/openhuman-core/src/agent/session_host/driver.rs+++ b/crates/openhuman-core/src/agent/session_host/driver.rs@@ -108,7 +108,7 @@ impl SessionDriver<OpenHumanRunContext> for OpenHumanSessionDriver {.transcript_snapshot.get_or_insert_with(|| {Arc::new(std::sync::Mutex::new(- crate::agent::tinyagents::TranscriptSnapshot {+ crate::agent::tinyagents::middleware::TranscriptSnapshot {request_base_len: request.history.len(),..Default::default()},@@ -589,7 +589,7 @@ fn ensure_snapshot_tools_are_executable(fn driver_error_with_snapshot(error: anyhow::Error,- snapshot: &crate::agent::tinyagents::TranscriptSnapshotSink,+ snapshot: &crate::agent::tinyagents::middleware::TranscriptSnapshotSink,sidecar: &std::sync::Arc<std::sync::Mutex<crate::agent::tinyagents::host::run_context::SessionTurnSidecar>,>,@@ -623,7 +623,7 @@ fn driver_error_with_snapshot(let accepted_end = guard.accepted_end();let history = guard.messages[..accepted_end].to_vec();let unanswered =- crate::agent::tinyagents::render_unanswered_steps(&guard.messages[accepted_end..]);+ crate::agent::tinyagents::middleware::render_unanswered_steps(&guard.messages[accepted_end..]);let display = if stalled {// The model's streamed narration was stopped before it could repeat// indefinitely. Preserve the completed tools as a useful, bounded@@ -663,7 +663,7 @@ fn driver_error_with_snapshot(/// runtime's single atomic append carries the same usage/failure truth as a/// successful turn. The partial history itself remains accepted-only.fn record_snapshot_usage(- guard: &crate::agent::tinyagents::TranscriptSnapshot,+ guard: &crate::agent::tinyagents::middleware::TranscriptSnapshot,sidecar: &std::sync::Arc<std::sync::Mutex<crate::agent::tinyagents::host::run_context::SessionTurnSidecar>,>,@@ -691,7 +691,7 @@ fn record_snapshot_usage(/// just the request before the first model call. No display partial: the/// turn_state mirror already records the streamed text.fn driver_cancelled_with_snapshot(- snapshot: &crate::agent::tinyagents::TranscriptSnapshotSink,+ snapshot: &crate::agent::tinyagents::middleware::TranscriptSnapshotSink,sidecar: &std::sync::Arc<std::sync::Mutex<crate::agent::tinyagents::host::run_context::SessionTurnSidecar>,>,diff --git a/crates/openhuman-core/src/agent/session_host/driver_tests.rs b/crates/openhuman-core/src/agent/session_host/driver_tests.rsindex a58fbcd641..3334a89a41 100644--- a/crates/openhuman-core/src/agent/session_host/driver_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/driver_tests.rs@@ -11,7 +11,7 @@ fn sidecar(#[test]fn graph_failure_persists_only_accepted_snapshot_history() {let snapshot = Arc::new(std::sync::Mutex::new(- crate::agent::tinyagents::TranscriptSnapshot {+ crate::agent::tinyagents::middleware::TranscriptSnapshot {messages: vec![Message::system("stable prefix"),Message::user("request"),@@ -42,7 +42,7 @@ fn graph_failure_persists_only_accepted_snapshot_history() {#[test]fn stalled_model_stream_reports_completed_evidence_instead_of_its_narration() {let snapshot = Arc::new(std::sync::Mutex::new(- crate::agent::tinyagents::TranscriptSnapshot {+ crate::agent::tinyagents::middleware::TranscriptSnapshot {messages: vec![Message::user("Find information about Jev")],accepted_len: 1,request_base_len: 1,@@ -82,7 +82,7 @@ fn stalled_model_stream_reports_completed_evidence_instead_of_its_narration() {#[test]fn graph_failure_copies_snapshot_usage_and_failed_tool_outcome_to_sidecar() {let snapshot = Arc::new(std::sync::Mutex::new(- crate::agent::tinyagents::TranscriptSnapshot {+ crate::agent::tinyagents::middleware::TranscriptSnapshot {messages: vec![Message::user("request"), Message::tool("call-1", "denied")],accepted_len: 1,request_base_len: 1,@@ -191,7 +191,7 @@ fn tool_snapshot_with_no_executable_source_fails_closed_before_graph() {#[test]fn empty_snapshot_failure_still_carries_the_typed_terminal_outcome() {let snapshot = Arc::new(std::sync::Mutex::new(- crate::agent::tinyagents::TranscriptSnapshot::default(),+ crate::agent::tinyagents::middleware::TranscriptSnapshot::default(),));let typed = driver_error_with_snapshot(anyhow::Error::new(tinyagents_harness::TinyAgentsError::Cancelled),@@ -306,7 +306,7 @@ fn stopped_turn_hands_back_only_its_accepted_rounds() {];for (case, messages, accepted_len, expected) in cases {let snapshot = Arc::new(std::sync::Mutex::new(- crate::agent::tinyagents::TranscriptSnapshot {+ crate::agent::tinyagents::middleware::TranscriptSnapshot {messages,accepted_len,request_base_len: 1,diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 15854cfd7b..a2188513cb 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -36,7 +36,7 @@ use crate::agent::{session_host::{driver::OpenHumanSessionDriver, OpenHumanSessionHooks, OpenHumanTranscriptCodec,},- tinyagents::{host::OpenHumanRunContext, TurnContextMiddleware},+ tinyagents::{host::OpenHumanRunContext, middleware::TurnContextMiddleware},};#[path = "runtime_session_progress.rs"]@@ -812,7 +812,7 @@ impl OpenHumanSessionHost {+ usize::from(view.history.last() != Some(&request.input));Box::pin(async move {let transcript_snapshot =- crate::agent::tinyagents::TranscriptSnapshotSink::default();+ crate::agent::tinyagents::middleware::TranscriptSnapshotSink::default();transcript_snapshot.lock().unwrap_or_else(std::sync::PoisonError::into_inner)diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rsindex 477b41fe01..0baa3476c4 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs@@ -167,7 +167,8 @@ pub(in super::super) async fn run_subagent_via_graph(// worker thread. Attach a snapshot middleware that mirrors each `before_model`// request's transcript here, so the error path below can still persist the// rounds that completed before the failure.- let transcript_snapshot = crate::agent::tinyagents::TranscriptSnapshotSink::default();+ let transcript_snapshot =+ crate::agent::tinyagents::middleware::TranscriptSnapshotSink::default();// The seeded history is always kept; only rounds past it are split into// accepted and unanswered on failure (#6281).transcript_snapshot@@ -530,8 +531,8 @@ pub(crate) fn inherited_thread_id(fn build_subagent_context_mw(tokenjuice_compression: AgentTokenjuiceCompression,config: Option<&crate::config::Config>,-) -> crate::agent::tinyagents::TurnContextMiddleware {- let mut mw = crate::agent::tinyagents::TurnContextMiddleware::defaults();+) -> crate::agent::tinyagents::middleware::TurnContextMiddleware {+ let mut mw = crate::agent::tinyagents::middleware::TurnContextMiddleware::defaults();// Always thread the agent's compression profile — even on the config-default// path — so the definition's TokenJuice choice is honored.mw.tokenjuice_compression = tokenjuice_compression;diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rsindex d520e88c45..95c97b0f8e 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs@@ -18,7 +18,7 @@ use super::worker_mirror::mirror_worker_thread_from_history;/// before.pub(super) fn failed_run_history(original: &[TranscriptMessage],- snapshot: &crate::agent::tinyagents::TranscriptSnapshot,+ snapshot: &crate::agent::tinyagents::middleware::TranscriptSnapshot,) -> (Vec<TranscriptMessage>, Option<String>) {if snapshot.messages.is_empty() {return (Vec::new(), None);@@ -33,7 +33,7 @@ pub(super) fn failed_run_history();(recovered,- crate::agent::tinyagents::render_unanswered_steps(&snapshot.messages[end..]),+ crate::agent::tinyagents::middleware::render_unanswered_steps(&snapshot.messages[end..]),)}diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rsindex c64faf532e..d69a817fa9 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs@@ -124,7 +124,7 @@ async fn failed_subagent_run_keeps_its_unanswered_round_out_of_history() {/// data for a vision run).#[test]fn failed_run_history_keeps_the_original_seed_not_the_provider_bound_one() {- use crate::agent::tinyagents::TranscriptSnapshot;+ use crate::agent::tinyagents::middleware::TranscriptSnapshot;use tinyinference_llm::message::Message;let original = vec![TranscriptMessage::user("describe [IMAGE:attachment-1]")];diff --git a/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs b/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rsindex 6de49ecfc7..1193724aa5 100644--- a/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs@@ -326,10 +326,10 @@ fn a_turn_before_its_wind_down_point_runs_to_its_final_answer() {context_mw: TurnContextMiddleware::default(),tool_policy: None,defer_turn_completed_to_caller: true,- subagent_scope: None,- deterministic_cacheable: false,- }- .run_hosted(hosted_base(), "main".to_string())+ subagent_scope: None,+ deterministic_cacheable: false,+ }+ .run_hosted(hosted_base(), "main".to_string()).await.expect("turn completes");assert_eq!(model_calls.load(std::sync::atomic::Ordering::SeqCst), 2);diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 24e81cd735..e0b51d8fe0 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -19,7 +19,9 @@ use tokio::sync::mpsc::Sender;use crate::agent::harness::fork_context::{AgentContextPreparedSource, ParentExecutionContext};use crate::agent::progress::AgentProgress;use crate::agent::subagent_host::SubagentUsage;-use crate::agent::tinyagents::{turn_policy::ToolPolicyEnforcement, TurnContextMiddleware};+use crate::agent::tinyagents::{+ middleware::TurnContextMiddleware, turn_policy::ToolPolicyEnforcement,+};use crate::agent::turn_origin::AgentTurnOrigin;use tinyagents_definition::SandboxMode;use tinyagents_harness::middleware::StopHook;diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rsindex b08bb357a6..64352e909e 100644--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs@@ -74,9 +74,6 @@ pub(crate) use crate::agent::message_convert::ta_call_to_oh_call;#[allow(unused_imports)] // Wired into the recall/retrieval facade in workstream 09.2.pub(crate) use embeddings::ProviderEmbeddingModel;-pub(crate) use middleware::{- render_unanswered_steps, TranscriptSnapshot, TranscriptSnapshotSink, TurnContextMiddleware,-};pub(crate) use observability::SubagentScope;pub(crate) use reasoning::{apply_requested_effort, parse_reasoning_effort};pub use turn_models::TurnModelSource;diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rsindex bc3c5f91e7..cc7839c40b 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs@@ -140,10 +140,10 @@ async fn scoped_tool_limit_is_honored_by_the_hosted_runner_inner() {context_mw: TurnContextMiddleware::default(),tool_policy: None,defer_turn_completed_to_caller: true,- subagent_scope: None,- deterministic_cacheable: false,- }- .run_hosted(hosted_base(), "main".to_string())+ subagent_scope: None,+ deterministic_cacheable: false,+ }+ .run_hosted(hosted_base(), "main".to_string()).await}.await;@@ -203,10 +203,10 @@ async fn positive_scoped_tool_limit_caps_hosted_runner_inner() {context_mw: TurnContextMiddleware::default(),tool_policy: None,defer_turn_completed_to_caller: true,- subagent_scope: None,- deterministic_cacheable: false,- }- .run_hosted(hosted_base(), "main".to_string())+ subagent_scope: None,+ deterministic_cacheable: false,+ }+ .run_hosted(hosted_base(), "main".to_string()).await}.await;diff --git a/scripts/ci/agent-runtime-boundary-baseline.json b/scripts/ci/agent-runtime-boundary-baseline.jsonindex 8194f366fb..5d636e69b9 100644--- a/scripts/ci/agent-runtime-boundary-baseline.json+++ b/scripts/ci/agent-runtime-boundary-baseline.json@@ -1,46 +1,4 @@[- {- "rule": "openhuman-runtime-bridge",- "path": "crates/openhuman-core/src/agent/harness/graph.rs",- "line": 36,- "text": "use crate::agent::tinyagents::run_turn_via_tinyagents_shared;",- "occurrence": 1- },- {- "rule": "openhuman-runtime-bridge",- "path": "crates/openhuman-core/src/agent/harness/graph.rs",- "line": 149,- "text": "let outcome = run_turn_via_tinyagents_shared(",- "occurrence": 1- },- {- "rule": "openhuman-runtime-bridge",- "path": "crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs",- "line": 11,- "text": "use crate::agent::tinyagents::{run_turn_via_tinyagents_shared, SubagentScope};",- "occurrence": 1- },- {- "rule": "openhuman-runtime-bridge",- "path": "crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs",- "line": 199,- "text": "let run_result = Box::pin(run_turn_via_tinyagents_shared(",- "occurrence": 1- },- {- "rule": "openhuman-runtime-bridge",- "path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",- "line": 91,- "text": "pub(crate) use turn_exec::{run_root_turn_via_hosted_agent, run_turn_via_tinyagents_shared};",- "occurrence": 1- },- {- "rule": "openhuman-runtime-bridge",- "path": "crates/openhuman-core/src/agent/tinyagents/turn_exec.rs",- "line": 98,- "text": "pub(crate) async fn run_turn_via_tinyagents_shared(",- "occurrence": 1- },{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/bus.rs",diff --git a/scripts/ci/check-agent-runtime-boundary.mjs b/scripts/ci/check-agent-runtime-boundary.mjsindex 4ca14bf6fd..dbbb7ff1f3 100644--- a/scripts/ci/check-agent-runtime-boundary.mjs+++ b/scripts/ci/check-agent-runtime-boundary.mjs@@ -144,6 +144,7 @@ const bridgeSymbols = ["execute_openhuman_tool","assemble_turn_harness","run_turn_via_tinyagents_shared",+ "run_root_turn_via_hosted_agent",];const deletedTaskLocalModules = ["fork_context",