diff --git a/Cargo.lock b/Cargo.lock index 77ef0d877f6..c7e385dad4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6434,11 +6434,10 @@ dependencies = [ "serde", "serde_json", "tinyagents-harness", - "tinyagents-language", - "tinyagents-tracing", "tinyinference-llm", "tinytools 0.3.0", "tokio", + "tracing", ] [[package]] @@ -6452,7 +6451,6 @@ dependencies = [ "dirs", "flate2", "futures", - "log", "regex", "reqwest", "rusqlite", @@ -6462,25 +6460,16 @@ dependencies = [ "tempfile", "thiserror 2.0.20", "tinyagents-definition", - "tinyagents-tracing", "tinyinference-embeddings", "tinyinference-llm", "tinytools 0.3.0", "tinytools-agent 0.3.0", "tokio", + "tracing", "uuid", "wait-timeout", ] -[[package]] -name = "tinyagents-language" -version = "2.1.2" -dependencies = [ - "serde", - "serde_json", - "tinyagents-harness", -] - [[package]] name = "tinyagents-orchestration" version = "2.1.2" @@ -6491,11 +6480,13 @@ dependencies = [ "parking_lot", "serde", "serde_json", + "thiserror 2.0.20", "tinyagents-graph", "tinyagents-harness", "tinyagents-runtime", "tinyagents-session", "tinyinference-llm", + "tinytools 0.3.0", "tokio", "uuid", ] @@ -6505,11 +6496,11 @@ name = "tinyagents-registry" version = "2.1.2" dependencies = [ "anyhow", + "chrono", "serde", "serde_json", "tinyagents-definition", "tinyagents-harness", - "tinyagents-language", "tinyinference-llm", "tinytools 0.3.0", ] @@ -6533,19 +6524,15 @@ name = "tinyagents-session" version = "2.1.2" dependencies = [ "anyhow", + "async-trait", "chrono", - "log", "rusqlite", "serde", "serde_json", "tinyagents-harness", - "tinyagents-tracing", + "tracing", ] -[[package]] -name = "tinyagents-tracing" -version = "2.1.2" - [[package]] name = "tinybus" version = "0.1.1" @@ -6839,8 +6826,6 @@ dependencies = [ "serde", "serde_json", "sha2 0.11.0", - "thiserror 2.0.20", - "tracing", "url", ] diff --git a/crates/openhuman-core/src/agent/agent_tests.rs b/crates/openhuman-core/src/agent/agent_tests.rs index eb7ac73fb8c..840b35e5f76 100644 --- a/crates/openhuman-core/src/agent/agent_tests.rs +++ b/crates/openhuman-core/src/agent/agent_tests.rs @@ -34,7 +34,7 @@ use async_trait::async_trait; use std::sync::{Arc, Mutex}; use tinyinference_llm::model::{ChatModel, ModelProfile, ModelRequest, ModelResponse}; use tinytools::{Tool, ToolResult}; -use tinytools_agent::dialect::{NativeDialect, ToolDialect, ToolOutcome, XmlDialect}; +use tinytools_agent::dialect::{NativeDialect, ToolDialect, XmlDialect}; // ═══════════════════════════════════════════════════════════════════════════ // Test Helpers — Mock Provider, Mock Tool, Mock Memory diff --git a/crates/openhuman-core/src/agent/harness/graph_tests.rs b/crates/openhuman-core/src/agent/harness/graph_tests.rs index d6b09aa56b0..4a11e942f2d 100644 --- a/crates/openhuman-core/src/agent/harness/graph_tests.rs +++ b/crates/openhuman-core/src/agent/harness/graph_tests.rs @@ -34,6 +34,7 @@ async fn channel_turn_runs_through_the_graph() { content: Vec::new(), tool_calls: vec![ToolCall::new("p", "ping", serde_json::json!({}))], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), @@ -93,6 +94,7 @@ async fn channel_turn_pauses_on_ask_user_clarification() { serde_json::json!({ "question": "Which three sources?" }), )], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/crates/openhuman-core/src/agent/message_convert.rs b/crates/openhuman-core/src/agent/message_convert.rs index 42e53cfeb84..35e43f4a535 100644 --- a/crates/openhuman-core/src/agent/message_convert.rs +++ b/crates/openhuman-core/src/agent/message_convert.rs @@ -171,6 +171,9 @@ pub(crate) fn chat_message_to_message(msg: &ChatMessage) -> Message { match msg.role.as_str() { "system" => Message::System(SystemMessage { content: vec![ContentBlock::Text(text)], + sections: Default::default(), + tools_added: Vec::new(), + tools_removed: Vec::new(), }), "assistant" => { // Restore any `reasoning_content` stashed on the persisted message so a @@ -189,6 +192,7 @@ pub(crate) fn chat_message_to_message(msg: &ChatMessage) -> Message { content, tool_calls, usage: None, + origin: None, }) } else { let mut content = vec![ContentBlock::Text(text)]; @@ -198,6 +202,7 @@ pub(crate) fn chat_message_to_message(msg: &ChatMessage) -> Message { content, tool_calls: Vec::new(), usage: None, + origin: None, }) } } diff --git a/crates/openhuman-core/src/agent/message_convert_tests.rs b/crates/openhuman-core/src/agent/message_convert_tests.rs index 4355b812046..0cdc50b90b6 100644 --- a/crates/openhuman-core/src/agent/message_convert_tests.rs +++ b/crates/openhuman-core/src/agent/message_convert_tests.rs @@ -241,6 +241,7 @@ fn legacy_provider_extension_reasoning_still_round_trips() { ], tool_calls: vec![], usage: None, + origin: None, }); let back = message_to_chat_message(&msg); @@ -303,6 +304,7 @@ fn conversation_preserves_tool_call_structure() { invalid: None, }], usage: None, + origin: None, }), Message::Tool(ToolMessage { tool_call_id: "c1".into(), @@ -315,6 +317,7 @@ fn conversation_preserves_tool_call_structure() { content: vec![ContentBlock::Text("all done".into())], tool_calls: vec![], usage: None, + origin: None, }), ]; diff --git a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime_tests.rs b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime_tests.rs index 82f3c344432..138d1b10521 100644 --- a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime_tests.rs +++ b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime_tests.rs @@ -12,7 +12,6 @@ use std::collections::HashSet; use std::sync::Arc; use async_trait::async_trait; -use serde_json::json; use super::*; use crate::agent::harness::definition::AgentDefinitionRegistry; diff --git a/crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/tool.rs b/crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/tool.rs index b9575d794c9..780cfcad4a5 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/tool.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/tool.rs @@ -38,11 +38,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); AgentPrepareContextTool::new() .execute_with_live_parent_context( arguments, diff --git a/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs index 97df6686ef5..53b9b5012d1 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs @@ -30,11 +30,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); CloseSubagentTool::new() .execute_with_parent_context(arguments, parent.data.parent.clone(), Some(&context)) .await diff --git a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs index 6d86a739016..3a3feb74927 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs @@ -45,11 +45,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); ContinueSubagentTool::new() .execute_with_live_parent_context( arguments, diff --git a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs index dff66ed0a20..2c5e44f02fe 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs @@ -53,11 +53,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); let graph_parent = parent .child( tinyagents_harness::context::RunConfig::new(format!( diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs index c9e135794f2..a99729ba838 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs @@ -88,11 +88,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for D async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let tool_context = ToolExecutionContext::from_run_context(parent); + let tool_context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); let child = parent.data.child(); match &self.kind { DelegationDispatchKind::Collapsed { targets } => { diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs index ec3c48e8e30..8884c6c29b8 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs @@ -114,6 +114,7 @@ async fn delegate_graph_dispatch_uses_its_durable_graph_argument_path() { let result = dispatch .execute( &(), + tinyagents_harness::CallId::new("test-call"), serde_json::json!({"task": "review this change"}), tinytools::ToolCallOptions::default(), &parent, @@ -141,6 +142,7 @@ async fn config_delegate_dispatch_honours_the_parent_cancellation_token() { .into_tinyagents(RunConfig::new("config-delegate-parent").with_thread("thread-parent")); let execution = dispatch.execute( &(), + tinyagents_harness::CallId::new("test-call"), serde_json::json!({"agent": "configured", "prompt": "work"}), tinytools::ToolCallOptions::default(), &parent, diff --git a/crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs b/crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs index db7b423fb99..795d8181aa3 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs @@ -35,11 +35,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); ListSubagentsTool::new() .execute_with_parent_context(arguments, parent.data.parent.clone(), Some(&context)) .await diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs index 9dddd360cf5..a54240eabd4 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs @@ -50,11 +50,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); let detached_data = parent.data.detached_child(); let detached_cancellation = detached_data.cancellation.clone(); let detached_parent = parent diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs index 84dddc6e841..902d41fbeeb 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs @@ -62,6 +62,7 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs index 6e69050af3b..c03787231dd 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs @@ -207,6 +207,7 @@ async fn typed_dispatch_uses_the_parent_token_for_fanout_cancellation() { dispatch .execute( &(), + tinyagents_harness::CallId::new("test-call"), json!({ "tasks": [ { "agent_id": "researcher", "prompt": "one" }, @@ -564,6 +565,7 @@ fn tool_response(name: &str, arguments: serde_json::Value) -> ModelResponse { content: Vec::new(), tool_calls: vec![ToolCall::new(format!("call-{name}"), name, arguments)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs index 23338bd9f9e..8ab881cf296 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs @@ -59,11 +59,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); SpawnSubagentTool::new() .execute_with_live_parent_context( arguments, diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs index a8e16855621..ca5e6d4d4f0 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs @@ -44,11 +44,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); SpawnWorkerThreadTool::new() .execute_with_live_parent_context( arguments, diff --git a/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs index 287d699df98..f3d4851bf59 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs @@ -37,11 +37,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); SteerSubagentTool::new() .execute_with_parent_context(arguments, parent.data.parent.clone(), Some(&context)) .await diff --git a/crates/openhuman-core/src/agent/orchestration/tools/use_skill_dispatch.rs b/crates/openhuman-core/src/agent/orchestration/tools/use_skill_dispatch.rs index 2d2a1a19cad..ed20d8a8650 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/use_skill_dispatch.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/use_skill_dispatch.rs @@ -63,7 +63,7 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for U } } - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); self.tool .execute_with_context(arguments, options, Some(&context)) .await diff --git a/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs index 7bea7d7fab0..da0557f9bd1 100644 --- a/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs +++ b/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs @@ -65,11 +65,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); WaitSubagentTool::new() .execute_with_parent_context(arguments, parent.data.parent.clone(), Some(&context)) .await diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/ops_tests.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/ops_tests.rs index 302c44e9298..26e0dee9adf 100644 --- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/ops_tests.rs +++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/ops_tests.rs @@ -1,5 +1,4 @@ use super::*; -use std::collections::BTreeMap; use tinyagents_orchestration::workflow::{ validate_agents, validate_structure, DefinitionError, WorkflowDefinition, WorkflowPhase, }; diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs index 934fd22f2b4..e84e285c486 100644 --- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs +++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs @@ -1,9 +1,6 @@ //! Tests for the builder module — dedup_visible_tool_specs and related logic. -use super::{ - dedup_visible_tool_specs, ensure_recovery_tool_visible, should_synthesize_delegation_tools, - visible_tool_specs_for_policy, -}; +use super::{dedup_visible_tool_specs, visible_tool_specs_for_policy}; use serde_json::json; use tinytools::ToolSpec; diff --git a/crates/openhuman-core/src/agent/subagent_host/handoff.rs b/crates/openhuman-core/src/agent/subagent_host/handoff.rs index 5c29321e44f..5ce96fca04e 100644 --- a/crates/openhuman-core/src/agent/subagent_host/handoff.rs +++ b/crates/openhuman-core/src/agent/subagent_host/handoff.rs @@ -57,6 +57,7 @@ pub(crate) fn apply_handoff( .unwrap_or(HANDOFF_OVERSIZE_THRESHOLD_TOKENS); tinyagents_harness::handoff::apply_handoff( cache, + &tinyagents_harness::handoff::HandoffConfig::default(), tool_name, task_id, agent_id, diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs index 7fe34dd1f5b..32b265170bd 100644 --- a/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs +++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs @@ -62,7 +62,6 @@ use std::collections::HashSet; #[cfg(test)] use std::sync::Arc; #[cfg(test)] -use tinytools::Tool; #[cfg(test)] use worker_mirror::{mirror_worker_thread, mirror_worker_thread_from_history}; 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.rs index f1077398c0b..7be34c7dd90 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 @@ -1,5 +1,5 @@ use super::*; -use tinytools::{Tool, ToolSpec}; +use tinytools::Tool; /// Answers two tool rounds, then rejects the third request with a 400 (which the /// harness does not retry). diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs index f6294eec6c1..bfb5216f746 100644 --- a/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs +++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs @@ -6,8 +6,8 @@ use tinyinference_llm::model::{ ChatModel, ModelProfile, ModelRequest, ModelResponse, ModelStream, ModelStreamItem, }; use tinyinference_llm::tool::ToolCall; +use tinytools::Tool; use tinytools::ToolResult; -use tinytools::{Tool, ToolSpec}; fn native_tool_profile() -> &'static ModelProfile { static PROFILE: std::sync::LazyLock = std::sync::LazyLock::new(|| ModelProfile { @@ -27,6 +27,7 @@ fn tool_response(id: &str, name: &str, arguments: serde_json::Value) -> ModelRes content: Vec::new(), tool_calls: vec![ToolCall::new(id, name, arguments)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs index c07de9da542..2bedd1ffc9b 100644 --- a/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs +++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs @@ -1,6 +1,6 @@ use super::*; use crate::agent::harness::definition::{ModelSpec, ToolScope}; -use tinytools::{Tool, ToolSpec}; +use tinytools::Tool; fn make_def_named_tools(names: &[&str]) -> AgentDefinition { AgentDefinition { @@ -205,6 +205,7 @@ fn text_response_with_reasoning(text: &str, reasoning: &str) -> ModelResponse { ], tool_calls: Vec::new(), usage: None, + origin: None, }, usage: None, finish_reason: None, @@ -228,6 +229,7 @@ fn tool_response(name: &str, args: &str) -> ModelResponse { serde_json::from_str(args).expect("valid scripted tool arguments"), )], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tests.rs index a328fa1c57a..1dd70713304 100644 --- a/crates/openhuman-core/src/agent/tinyagents/middleware_tests.rs +++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tests.rs @@ -312,6 +312,7 @@ fn repeated_success_response(tool: &str, args: serde_json::Value) -> ModelRespon content: vec![ContentBlock::Text("working".to_string())], tool_calls: vec![TaToolCall::new("repeat-1", tool, args)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs index d431ebdc687..d613af28964 100644 --- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs +++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs @@ -275,6 +275,7 @@ async fn the_summarized_size_survives_a_tool_cap_shorter_than_the_summary() { sandbox: tinytools::SandboxMode::Inherit, max_result_bytes: Some(12), streaming: false, + replay: Default::default(), }), ); let summary = "summary ".repeat(50); diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs index 69e1d9c00cf..8a674ec27b6 100644 --- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs +++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs @@ -402,6 +402,7 @@ fn tool_char_cap_reads_the_tools_own_declared_cap() { sandbox: tinytools::SandboxMode::Inherit, max_result_bytes: Some(10), streaming: false, + replay: Default::default(), }), ); let mw = ToolOutputMiddleware { @@ -442,6 +443,7 @@ async fn an_unavailable_notice_survives_a_tool_cap_shorter_than_itself() { // Far shorter than the ~165-char notice. max_result_bytes: Some(12), streaming: false, + replay: Default::default(), }), ); let mw = ToolOutputMiddleware { @@ -507,6 +509,7 @@ async fn tool_output_honors_a_tools_own_cap() { sandbox: tinytools::SandboxMode::Inherit, max_result_bytes: Some(20), streaming: false, + replay: Default::default(), }), ); let mw = ToolOutputMiddleware { diff --git a/crates/openhuman-core/src/agent/tinyagents/model.rs b/crates/openhuman-core/src/agent/tinyagents/model.rs index e5fe8c4fc3c..93852632e2d 100644 --- a/crates/openhuman-core/src/agent/tinyagents/model.rs +++ b/crates/openhuman-core/src/agent/tinyagents/model.rs @@ -146,6 +146,7 @@ fn response_to_model_response( content, tool_calls, usage, + origin: None, }, usage, finish_reason: Some(finish_reason.to_string()), @@ -368,6 +369,7 @@ pub(crate) fn forward_provider_delta(tx: &UnboundedSender, delt call_id, content: String::new(), tool_name: Some(tool_name), + content_index: None, })); } ProviderDelta::ToolCallArgsDelta { call_id, delta } => { @@ -381,6 +383,7 @@ pub(crate) fn forward_provider_delta(tx: &UnboundedSender, delt call_id, content: delta, tool_name: None, + content_index: None, })); } } diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/cap_pauser_tests.rs b/crates/openhuman-core/src/agent/tinyagents/observability/cap_pauser_tests.rs index 03807f99129..2572d5e6bff 100644 --- a/crates/openhuman-core/src/agent/tinyagents/observability/cap_pauser_tests.rs +++ b/crates/openhuman-core/src/agent/tinyagents/observability/cap_pauser_tests.rs @@ -9,8 +9,8 @@ use tinyagents_harness::events::EventSink; use tinyagents_harness::middleware::{AgentRun, Middleware, ToolInvocationIdentity}; use tinyagents_harness::runtime::{AgentHarness, RunPolicy}; use tinyagents_harness::steering::SteeringPolicy; -use tinyagents_harness::subagent::SubAgent; use tinyagents_harness::testkit::{FakeTool, ScriptedModel, SlowModel}; +use tinyagents_orchestration::subagent::SubAgent; use tinyinference_llm::message::{AssistantMessage, Message}; use tinyinference_llm::model::{ChatModel, ModelResponse}; use tinyinference_llm::tool::ToolCall; @@ -25,6 +25,7 @@ fn tool_call_response(id: &str) -> ModelResponse { content: Vec::new(), tool_calls: vec![ToolCall::new(id, "lookup", serde_json::json!({}))], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs index fd30c786953..d6adf130ced 100644 --- a/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs +++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs @@ -266,6 +266,7 @@ impl EventListener for OpenhumanEventBridge { by, excluded, remaining, + .. } => { tracing::debug!( policy = by.as_str(), diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/graph_tracing.rs b/crates/openhuman-core/src/agent/tinyagents/observability/graph_tracing.rs index a3fcccecc1f..36c36233a2b 100644 --- a/crates/openhuman-core/src/agent/tinyagents/observability/graph_tracing.rs +++ b/crates/openhuman-core/src/agent/tinyagents/observability/graph_tracing.rs @@ -4,7 +4,7 @@ use std::sync::atomic::Ordering; use std::sync::Arc; -use tinyagents_graph::stream::{GraphEvent, GraphEventSink}; +use tinyagents_graph::stream::{GraphEvent, GraphEventEnvelope, GraphEventSink}; /// A [`GraphEventSink`] that mirrors the `tinyagents` graph executor's lifecycle /// stream onto openhuman's `tracing` diagnostics — an observability journal for @@ -34,7 +34,8 @@ impl GraphTracingSink { } impl GraphEventSink for GraphTracingSink { - fn emit(&self, event: GraphEvent) { + fn emit(&self, envelope: GraphEventEnvelope) { + let event = envelope.event; self.count.fetch_add(1, Ordering::Relaxed); let label = self.label.as_str(); match &event { diff --git a/crates/openhuman-core/src/agent/tinyagents/routes.rs b/crates/openhuman-core/src/agent/tinyagents/routes.rs index b2506043498..53baec74d4f 100644 --- a/crates/openhuman-core/src/agent/tinyagents/routes.rs +++ b/crates/openhuman-core/src/agent/tinyagents/routes.rs @@ -7,7 +7,7 @@ use tinyagents_harness::context::RunContext; use tinyagents_harness::events::AgentEvent; use tinyagents_harness::middleware::{MiddlewareModelOutcome, ModelHandler, ModelMiddleware}; use tinyagents_harness::retry::FallbackPolicy; -use tinyagents_registry::{ModelRouter, WorkloadRoute}; +use tinyagents_registry::{WorkloadRoute, WorkloadRouter}; use tinyinference_llm::model::{CapabilitySet, ModelRequest}; use crate::config::{ @@ -34,7 +34,7 @@ pub(super) const WORKLOAD_ROUTE_TIERS: &[&str] = &[ ]; /// The OpenHuman workload-tier routing table as a crate -/// [`ModelRouter`](tinyagents_registry::ModelRouter) — the single declarative +/// [`WorkloadRouter`](tinyagents_registry::WorkloadRouter) — the single declarative /// source for cross-route **fallback chains** and per-tier **required-capability /// gates** (issue #4249, Phase 3 routing consolidation). /// @@ -50,12 +50,12 @@ pub(super) const WORKLOAD_ROUTE_TIERS: &[&str] = &[ /// - `summarization-v1 → chat-v1` (summarization rides a general chat model); /// - `vision-v1` is `image_in`-gated and primary-only — a text fallback cannot /// satisfy the gate — and its `hint:vision` form carries the same gate. -static OH_WORKLOAD_ROUTER: LazyLock = LazyLock::new(|| { +static OH_WORKLOAD_ROUTER: LazyLock = LazyLock::new(|| { let vision_gate = CapabilitySet { image_in: true, ..CapabilitySet::default() }; - ModelRouter::new() + WorkloadRouter::new() .with_route( WorkloadRoute::new(MODEL_CHAT_V1, MODEL_CHAT_V1).with_fallbacks([MODEL_BURST_V1]), ) diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs index 2da27bd641c..ae2c8d107cb 100644 --- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs +++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs @@ -655,7 +655,10 @@ async fn run_turn_via_tinyagents_inner( Err(error) => Err(error), } } else { - root_hosted_harness().invoke_agent(invocation, &state).await + root_hosted_harness() + .invoke_agent(invocation, &state) + .await + .map_err(|error| tinyagents_harness::TinyAgentsError::Model(error.to_string())) } } else if streaming { let mut stream = Box::pin(harness.invoke_stream_in_context(&(), ctx, input)); diff --git a/crates/openhuman-core/src/agent/tools/delegate.rs b/crates/openhuman-core/src/agent/tools/delegate.rs index 6dbf9b5a840..54a2a70a559 100644 --- a/crates/openhuman-core/src/agent/tools/delegate.rs +++ b/crates/openhuman-core/src/agent/tools/delegate.rs @@ -56,11 +56,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); let child = parent.data.child(); tokio::select! { _ = child.cancellation.cancelled() => Ok(ToolResult::error( diff --git a/crates/openhuman-core/src/agent/tools/todo.rs b/crates/openhuman-core/src/agent/tools/todo.rs index 1999fae696b..b6f6ed95dad 100644 --- a/crates/openhuman-core/src/agent/tools/todo.rs +++ b/crates/openhuman-core/src/agent/tools/todo.rs @@ -35,11 +35,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for T async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); TodoTool::new() .execute_with_parent_context(arguments, parent.data.parent.clone(), Some(&context)) .await diff --git a/crates/openhuman-core/src/agent/tools/update_task.rs b/crates/openhuman-core/src/agent/tools/update_task.rs index b2cd760a668..2070930ec62 100644 --- a/crates/openhuman-core/src/agent/tools/update_task.rs +++ b/crates/openhuman-core/src/agent/tools/update_task.rs @@ -39,6 +39,7 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for U async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, diff --git a/crates/openhuman-core/src/channels/tests/common.rs b/crates/openhuman-core/src/channels/tests/common.rs index 5c090a1b6fb..7228dfee052 100644 --- a/crates/openhuman-core/src/channels/tests/common.rs +++ b/crates/openhuman-core/src/channels/tests/common.rs @@ -39,6 +39,7 @@ fn tool_call_response(step: Option) -> ModelResponse { content: Vec::new(), tool_calls: vec![ToolCall::new("mock-price-call", "mock_price", arguments)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rs index a48e158b52c..c3d617b931c 100644 --- a/crates/openhuman-core/src/cron/store_tests.rs +++ b/crates/openhuman-core/src/cron/store_tests.rs @@ -8,7 +8,6 @@ use tempfile::TempDir; use crate::cron::CronJobPatch; use crate::cron::JobType; use crate::cron::Schedule; -use crate::cron::SessionTarget; fn test_config(tmp: &TempDir) -> Config { let config = Config { workspace_dir: tmp.path().join("workspace"), diff --git a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs index 25887348541..22917da088b 100644 --- a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs +++ b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs @@ -70,6 +70,7 @@ fn project_managed_usage_recovers_charged_and_cached() { content: vec![], tool_calls: vec![], usage: None, + origin: None, }, usage: Some(Usage { input_tokens: 1000, @@ -112,6 +113,7 @@ fn project_managed_usage_is_noop_without_envelope() { content: vec![], tool_calls: vec![], usage: None, + origin: None, }, usage: Some(Usage { input_tokens: 10, diff --git a/crates/openhuman-core/src/memory/agent/tools.rs b/crates/openhuman-core/src/memory/agent/tools.rs index e84e4700788..b2a621b4f2d 100644 --- a/crates/openhuman-core/src/memory/agent/tools.rs +++ b/crates/openhuman-core/src/memory/agent/tools.rs @@ -48,11 +48,12 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> async fn execute( &self, _state: &(), + _call_id: tinyagents_harness::CallId, arguments: serde_json::Value, _options: ToolCallOptions, parent: &RunContext, ) -> anyhow::Result { - let context = ToolExecutionContext::from_run_context(parent); + let context = ToolExecutionContext::from_run_context(parent, _call_id.clone()); CallMemoryAgentTool::new() .execute_with_live_parent_context(arguments, Some(&context), Some(parent)) .await diff --git a/crates/openhuman-core/src/memory/guard/test_support.rs b/crates/openhuman-core/src/memory/guard/test_support.rs index 0c993f2ae3f..1cb5acbc84d 100644 --- a/crates/openhuman-core/src/memory/guard/test_support.rs +++ b/crates/openhuman-core/src/memory/guard/test_support.rs @@ -17,5 +17,5 @@ mod retrieval_and_ingest_impls; pub use fixtures::{ document, embedded_policy, entry, export_record, external_policy, guarded, guarded_with, - namespace_hit, namespace_summary, RecordingProvider, + namespace_hit, RecordingProvider, }; diff --git a/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs b/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs index 22f995ecfba..4fe50fabe32 100644 --- a/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs +++ b/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs @@ -70,6 +70,7 @@ fn tool_call(id: &str, name: &str, args: serde_json::Value) -> ModelResponse { content: Vec::new(), tool_calls: vec![ToolCall::new(id, name, args)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/crates/openhuman-core/src/skills/e2e_run_tests.rs b/crates/openhuman-core/src/skills/e2e_run_tests.rs index c43d7d132bb..58375f733c1 100644 --- a/crates/openhuman-core/src/skills/e2e_run_tests.rs +++ b/crates/openhuman-core/src/skills/e2e_run_tests.rs @@ -72,6 +72,7 @@ fn tool_call_response(id: &str, name: &str, arguments: serde_json::Value) -> Mod content: Vec::new(), tool_calls: vec![ToolCall::new(id, name, arguments)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/crates/openhuman-core/src/skills/ops_discover.rs b/crates/openhuman-core/src/skills/ops_discover.rs index d785bc91610..d1329c44760 100644 --- a/crates/openhuman-core/src/skills/ops_discover.rs +++ b/crates/openhuman-core/src/skills/ops_discover.rs @@ -16,9 +16,7 @@ mod scan; // `Path`, `Workflow`, `WorkflowScope`, and `precedence` exactly as it did // before this module was split into submodules. #[cfg(test)] -use super::ops_types::{Workflow, WorkflowScope}; #[cfg(test)] -use collision::precedence; #[cfg(test)] use std::path::Path; diff --git a/tests/calendar_grounding_e2e.rs b/tests/calendar_grounding_e2e.rs index 509e04ad6aa..cf43473b9e0 100644 --- a/tests/calendar_grounding_e2e.rs +++ b/tests/calendar_grounding_e2e.rs @@ -51,6 +51,7 @@ impl ChatModel<()> for MockCalendarModel { }), )], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".into()), diff --git a/tests/composio_list_tools_stack_overflow_regression.rs b/tests/composio_list_tools_stack_overflow_regression.rs index 523ba717d1d..8d77cdaa619 100644 --- a/tests/composio_list_tools_stack_overflow_regression.rs +++ b/tests/composio_list_tools_stack_overflow_regression.rs @@ -218,6 +218,7 @@ impl ChatModel<()> for StubModel { json!({ "toolkits": ["gmail"] }), )], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".into()), diff --git a/tests/raw_coverage/agent_archivist_debug_round21_raw_coverage_e2e.rs b/tests/raw_coverage/agent_archivist_debug_round21_raw_coverage_e2e.rs index 9ebec22fcc1..2a85e34da08 100644 --- a/tests/raw_coverage/agent_archivist_debug_round21_raw_coverage_e2e.rs +++ b/tests/raw_coverage/agent_archivist_debug_round21_raw_coverage_e2e.rs @@ -202,6 +202,7 @@ fn tool_response(name: &str, arguments: serde_json::Value) -> ModelResponse { ], tool_calls: vec![ToolCall::new("round21-call", name, arguments)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/tests/raw_coverage/agent_large_round25_raw_coverage_e2e.rs b/tests/raw_coverage/agent_large_round25_raw_coverage_e2e.rs index 586023e3999..00e8f875bc2 100644 --- a/tests/raw_coverage/agent_large_round25_raw_coverage_e2e.rs +++ b/tests/raw_coverage/agent_large_round25_raw_coverage_e2e.rs @@ -266,6 +266,7 @@ fn tool_response(name: &str, args: serde_json::Value) -> ModelResponse { content: vec![ContentBlock::Text("round25 call".to_string())], tool_calls: vec![ToolCall::new(format!("round25-{name}"), name, args)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs b/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs index d84d02e4be7..4beed5b8de8 100644 --- a/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs +++ b/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs @@ -224,6 +224,7 @@ fn tool_response(name: &str, arguments: serde_json::Value) -> ModelResponse { ], tool_calls: vec![ToolCall::new("round18-call", name, arguments)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/tests/raw_coverage/agent_turn_toolloop_round22_raw_coverage_e2e.rs b/tests/raw_coverage/agent_turn_toolloop_round22_raw_coverage_e2e.rs index 9ec860d4a90..3c616f60803 100644 --- a/tests/raw_coverage/agent_turn_toolloop_round22_raw_coverage_e2e.rs +++ b/tests/raw_coverage/agent_turn_toolloop_round22_raw_coverage_e2e.rs @@ -180,6 +180,7 @@ fn tool_response(name: &str, args: serde_json::Value) -> ModelResponse { content: vec![ContentBlock::Text("before".to_string())], tool_calls: vec![ToolCall::new(format!("call-{name}"), name, args)], usage: None, + origin: None, }, usage: None, finish_reason: Some("tool_calls".to_string()), diff --git a/vendor/tinyagents b/vendor/tinyagents index 9483a5694f5..3922a7afcb6 160000 --- a/vendor/tinyagents +++ b/vendor/tinyagents @@ -1 +1 @@ -Subproject commit 9483a5694f51baf609700958177863c963d83a06 +Subproject commit 3922a7afcb6e05a7e541e0ff2af532c9b9fdd1e2