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: purge agent import facades
Steven Enamakela540fa07b8a0
diff --git a/crates/openhuman-core/src/agent/README.md b/crates/openhuman-core/src/agent/README.mdindex aba51c0e53..b9106a23a7 100644--- a/crates/openhuman-core/src/agent/README.md+++ b/crates/openhuman-core/src/agent/README.md@@ -8,7 +8,7 @@ Multi-agent orchestration domain. Owns the LLM tool-calling loop, sub-agent disp- `pub fn run_subagent` / `pub struct SubagentRunOptions` / `pub enum SubagentRunError` — `harness/subagent_runner/` — execute a hierarchical sub-agent from a parent tool loop.- `pub struct AgentDefinition` / `pub struct AgentDefinitionRegistry` / `pub enum SandboxMode` / `pub enum ToolScope` — `harness/definition/` (`agent_definition.rs`, `registry.rs`, `source.rs`, `tier.rs`, `execution_spec.rs`, `prompt_source.rs`, `subagents.rs`) — sub-agent archetypes loaded from built-ins + workspace TOML.- `pub mod harness::fork_context` — task-local parent context for KV-cache reuse.-- `pub trait ToolDispatcher` / `pub struct ParsedToolCall` / `pub struct ToolExecutionResult` — `dispatcher.rs` — pluggable tool-call format (XML / JSON / P-Format).+- `pub trait ToolDispatcher` / `pub struct ParsedToolCall` / `pub struct ToolExecutionResult` — `tool_dialect.rs` — host conversion for persisted tool-call formats; parsing and rendering come directly from `tinytools_agent`.- `pub mod triage` (`run_triage`, `apply_decision`, `TriggerEnvelope`, `TriageDecision`, `TriageAction`) — `triage/mod.rs` — classify external triggers, escalate to sub-agents.- `pub mod prompts::SystemPromptBuilder` — `prompts/` — system-prompt section composer.- `pub struct ChatMessage` / `pub enum ConversationMessage` / `pub struct ToolResultMessage` — `messages.rs` — transcript wire types; `inference/provider/types.rs::ChatRequest` borrows `&[ChatMessage]` from here.@@ -43,7 +43,7 @@ Multi-agent orchestration domain. Owns the LLM tool-calling loop, sub-agent disp| `tools/` | Agent-loop control tools (`ask_clarification`, `delegate`, `delegate_to_personality`, `plan_exit`, `remember_preference`, `save_preference`, `run_workflow`, `todo`, `update_task`), re-exported through `crate::tools` || `triage/` | Classifies external `TriggerEnvelope`s and escalates to sub-agents ([README](triage/README.md)) |-Flat files: `bus.rs` (`agent.run_turn` native request handler), `cost.rs` (`pub(crate)`, per-turn token/cost accounting), `dispatcher.rs` (tool-call format dispatch), `error.rs` (typed retryable/permanent loop errors), `hooks.rs` (post-turn self-learning hooks), `host_runtime.rs` (native shell execution backend), `message_convert.rs` (`pub(crate)`, transcript ↔ TinyAgents `Message` conversion), `messages.rs` (transcript types), `multimodal.rs` (attachment handling), `pformat.rs` (adapter over `tinyagents_harness::tool_calling::pformat`), `platform_shell.rs` (cross-platform shell selection shared with `host_runtime` and `sandbox::ops`), `progress.rs` (`AgentProgress` channel), `progress_sink.rs` (task-local progress sink for in-process embedders), `stop_hooks.rs` (mid-turn policy halts), `task_board.rs` (per-thread task board over `tinyagents_graph::todos`), `task_session.rs` (`pub(crate)`, task-board runs as conversation threads), `tool_policy.rs` (pre-execution tool-call policy hook), `turn_origin.rs` (task-local trust/routing label read by the approval gate), `turn_workspace.rs` (task-local per-turn filesystem root).+Flat files: `bus.rs` (`agent.run_turn` native request handler), `cost.rs` (`pub(crate)`, per-turn token/cost accounting), `tool_dialect.rs` (host conversion around canonical tool-call parsing/rendering), `error.rs` (typed retryable/permanent loop errors), `hooks.rs` (post-turn self-learning hooks), `host_runtime.rs` (native shell execution backend), `message_convert.rs` (`pub(crate)`, transcript ↔ TinyAgents `Message` conversion), `messages.rs` (transcript types), `multimodal.rs` (attachment handling), `platform_shell.rs` (cross-platform shell selection shared with `host_runtime` and `sandbox::ops`), `progress.rs` (`AgentProgress` channel), `progress_sink.rs` (task-local progress sink for in-process embedders), `stop_hooks.rs` (mid-turn policy halts), `task_board.rs` (per-thread task board over `tinyagents_graph::todos`), `task_session.rs` (`pub(crate)`, task-board runs as conversation threads), `tool_policy.rs` (pre-execution tool-call policy hook), `turn_origin.rs` (task-local trust/routing label read by the approval gate), `turn_workspace.rs` (task-local per-turn filesystem root).## RPC namespaces owned by this tree@@ -76,7 +76,7 @@ Flat files: `bus.rs` (`agent.run_turn` native request handler), `cost.rs` (`pub(## Tests-- Unit: `agent_tests.rs`, `multimodal_tests.rs`, `dispatcher_tests.rs`, plus `*_tests.rs` files colocated with `bus.rs`, `cost.rs`, `error.rs`, `hooks.rs`, `host_runtime.rs`, `message_convert.rs`, `pformat.rs`, `platform_shell.rs`, `progress_sink.rs`, `schemas.rs`, `stop_hooks.rs`, `task_board.rs`, `task_session.rs`, `tool_policy.rs`, `turn_origin.rs`, `turn_workspace.rs`, and under `harness/`, `harness/session/`, `triage/`.+- Unit: `agent_tests.rs`, `multimodal_tests.rs`, `dispatcher_tests.rs` (loaded by `tool_dialect.rs`), plus `*_tests.rs` files colocated with `bus.rs`, `cost.rs`, `error.rs`, `hooks.rs`, `host_runtime.rs`, `message_convert.rs`, `platform_shell.rs`, `progress_sink.rs`, `schemas.rs`, `stop_hooks.rs`, `task_board.rs`, `task_session.rs`, `tool_policy.rs`, `turn_origin.rs`, `turn_workspace.rs`, and under `harness/`, `harness/session/`, `triage/`.- Integration: `tests/agent_builder_public.rs`, `tests/agent_harness_public.rs`, `tests/agent_harness_e2e.rs`, `tests/agent_multimodal_public.rs`, `tests/agent_turn_overrides_e2e.rs`, `tests/agent_approval_memory_coverage_e2e.rs`.- Schema regression: `schemas_tests.rs` (`controller_schema_inventory_is_stable`).diff --git a/crates/openhuman-core/src/agent/agent_tests.rs b/crates/openhuman-core/src/agent/agent_tests.rsindex 1f7d5f02a6..a232a4ce1e 100644--- a/crates/openhuman-core/src/agent/agent_tests.rs+++ b/crates/openhuman-core/src/agent/agent_tests.rs@@ -24,11 +24,11 @@//! 19. Builder validation (missing required fields)//! 20. Idempotent system prompt insertion-use crate::agent::dispatcher::{- NativeToolDispatcher, ToolDispatcher, ToolExecutionResult, XmlToolDispatcher,-};use crate::agent::harness::session::Agent;use crate::agent::messages::{ChatMessage, ConversationMessage, ToolResultMessage};+use crate::agent::tool_dialect::{+ NativeToolDispatcher, ToolDispatcher, ToolExecutionResult, XmlToolDispatcher,+};use crate::config::AgentConfig;use crate::inference::provider::{ChatResponse, ToolCall};use crate::memory::Memory;diff --git a/crates/openhuman-core/src/agent/context/README.md b/crates/openhuman-core/src/agent/context/README.mdindex d7ce6f4122..4d15738581 100644--- a/crates/openhuman-core/src/agent/context/README.md+++ b/crates/openhuman-core/src/agent/context/README.md@@ -6,7 +6,7 @@ Global context management for agent sessions: system-prompt assembly, per-sessio## Responsibilities-- Assemble opening system prompts (delegates to `agent::prompts` via `prompt.rs`; provides a separate bespoke builder for channel runtimes in `channels_prompt.rs`).+- Maintain prompt-adjacent session state; system-prompt assembly lives in `agent::prompts`, while `channels_prompt.rs` provides the channel-specific builder.- Track context-window utilisation per session (`ContextStatsState`).- Expose the configured per-tool-result byte budget and the compaction/microcompact/autocompact toggles the tinyagents turn reads; enforcement lives in `agent/tinyagents` (`ToolOutputMiddleware`, `MicrocompactMiddleware`, `ContextCompressionMiddleware`) and in `agent/harness/tool_result_artifacts`.- Expose the microcompact placeholder/keep-recent constants consumed by the microcompact middleware.@@ -20,7 +20,6 @@ Global context management for agent sessions: system-prompt assembly, per-sessio| `crates/openhuman-core/src/agent/context/manager.rs` | `ContextManager` — per-session handle agents hold. Owns the default prompt builder, `ContextStatsState`, and the `ContextConfig`-derived knobs. Surfaces `build_system_prompt` / `build_system_prompt_tiered` / `build_system_prompt_with`, `stats()`, the getters the tinyagents turn reads (`tool_result_budget_bytes`, `compaction_enabled`, `microcompact_keep_recent`, `autocompact_enabled`, `prefer_markdown_tool_output`), and the session-memory trigger/mark methods. || `crates/openhuman-core/src/agent/context/stats.rs` | `ContextStatsState` — last provider usage, context-window utilisation, and the shared `SessionMemoryHandle` (`Arc<Mutex<SessionMemoryState>>`). Pure state; issues no LLM calls and does not mutate history. || `crates/openhuman-core/src/agent/context/session_memory.rs` | `SessionMemoryState` / `SessionMemoryConfig` — threshold-gated `should_extract` decision (token growth, tool calls, and turns must all cross) and extraction bookkeeping. Holds `ARCHIVIST_EXTRACTION_PROMPT`. State-tracking only; does not spawn the archivist. |-| `crates/openhuman-core/src/agent/context/prompt.rs` | Compat shim — `pub use crate::agent::prompts::*`. Prompt rendering lives in `agent::prompts`; this keeps `context::prompt::...` as a stable import path. || `crates/openhuman-core/src/agent/context/channels_prompt.rs` | Bespoke free functions `build_system_prompt(...)` / `build_system_prompt_with_identity(...)` (plus `PromptIdentityOverride`, `ProjectContextPlacement`, `render_project_context`) for channel runtimes (Discord/Slack/Telegram/…). Byte-stable for prefix-cache hits; injects workspace bootstrap files (`SOUL.md`, `IDENTITY.md`, optional `PROFILE.md`/`MEMORY.md`, with profile overrides for `SOUL.md`/`MEMORY.md`), tools, safety, skills, runtime, and channel-capabilities sections. || `crates/openhuman-core/src/agent/context/manager_tests.rs`, `channels_prompt_tests.rs`, `session_memory_tests.rs` | Sibling test files wired via `#[cfg(test)] #[path = "..."] mod tests;` from their source file (the layout check rejects inline test modules). |@@ -42,7 +41,7 @@ From `mod.rs` re-exports:- **Manager**: `ContextManager`, `ContextStats`.- **Microcompact config**: `CLEARED_PLACEHOLDER`, `DEFAULT_KEEP_RECENT_TOOL_RESULTS`.-- **Prompt** (re-exported from `agent::prompts`): `SystemPromptBuilder`, `PromptSection`, `PromptContext`, `PromptTool`, `ArchetypePromptSection`, `DateTimeSection`, `IdentitySection`, `LearnedContextData`, `RuntimeSection`, `SafetySection`, `ToolsSection`, `WorkspaceSection`. The full `agent::prompts` surface is reachable through `context::prompt::*`.+- **Prompt**: `SystemPromptBuilder`, `PromptSection`, `PromptContext`, `PromptTool`, `ArchetypePromptSection`, `DateTimeSection`, `IdentitySection`, `LearnedContextData`, `RuntimeSection`, `SafetySection`, `ToolsSection`, and `WorkspaceSection` are imported directly from `agent::prompts`.- **Session memory**: `SessionMemoryConfig`, `SessionMemoryState`, `ARCHIVIST_EXTRACTION_PROMPT`, `DEFAULT_MIN_TOKEN_GROWTH`, `DEFAULT_MIN_TOOL_CALLS`, `DEFAULT_MIN_TURNS_BETWEEN`.- **Tool-result budget**: `DEFAULT_TOOL_RESULT_BUDGET_BYTES` config default only; live truncation is owned by `ToolOutputMiddleware` / `tool_result_artifacts`.@@ -73,16 +72,16 @@ The durable substrate session-memory targets is the workspace `MEMORY.md` file,- `crate::config` — `ContextConfig` (`config/schema/context.rs`): `enabled`, `microcompact_enabled` / `microcompact_keep_recent`, `autocompact_enabled`, `compaction_enabled`, `tool_result_budget_bytes`, `prefer_markdown_tool_output`, `summarizer_model`, and the embedded `session_memory: SessionMemoryConfig`.- `crate::inference::provider::UsageInfo` — fed into `record_usage`.-- `crate::agent::prompts` — `prompt.rs` re-exports its whole surface; `channels_prompt.rs` uses `inject_inline_content`.+- `crate::agent::prompts` — owns prompt rendering; `channels_prompt.rs` uses `inject_inline_content`.- `crate::skills::Workflow` — `channels_prompt.rs` renders the available-skills section from a `&[Workflow]`.## Used by-- **`agent::harness`** — the primary consumer: `session/builder/builder_build.rs` constructs the `ContextManager`; `session/turn/core_turn.rs` drives the session-memory counters and spawns the archivist extraction when `should_extract_session_memory` says so; `session/turn/core/harness_turn.rs` reads the budget/compaction getters into the tinyagents turn config; `session/turn/session_io/{transcript_persist,background_tasks}.rs` read `stats()`; `fork_context.rs`, `subagent_runner/*`, and `tool_filter.rs` consume prompt types.-- **`agent::tinyagents`** — `harness_assembly.rs` reads `CLEARED_PLACEHOLDER` when configuring `MicrocompactMiddleware`; `payload_summarizer.rs` and `host/context_composer.rs` build `PromptContext`s through `context::prompt`.-- **`agent::registry::agents/*/prompt.rs`**, `flows/agents/*/prompt.rs`, `memory/agent/agent/prompt.rs`, `skills/*/agent/*/prompt.rs` — archetype prompt modules pull prompt sections/builder through `context::prompt`.+- **`agent::harness`** — the primary consumer: `session/builder/builder_build.rs` constructs the `ContextManager`; `session/turn/core_turn.rs` drives the session-memory counters and spawns the archivist extraction when `should_extract_session_memory` says so; `session/turn/core/harness_turn.rs` reads the budget/compaction getters into the tinyagents turn config; `session/turn/session_io/{transcript_persist,background_tasks}.rs` read `stats()`; `fork_context.rs` and `subagent_runner/*` consume prompt types.+- **`agent::tinyagents`** — `harness_assembly.rs` reads `CLEARED_PLACEHOLDER` when configuring `MicrocompactMiddleware`; `payload_summarizer.rs` and `host/context_composer.rs` build `PromptContext`s through `agent::prompts`.+- **`agent::registry::agents/*/prompt.rs`**, `flows/agents/*/prompt.rs`, `memory/agent/agent/prompt.rs`, `skills/*/agent/*/prompt.rs` — archetype prompt modules pull prompt sections/builder through `agent::prompts`.- **`channels`** — `channels/system_prompt.rs` (`ChannelSystemPrompt`, used by `channels/runtime/startup/start_channels.rs`) calls `channels_prompt::build_system_prompt_with_identity`; `channels/mod.rs` re-exports `build_system_prompt`; the `channels/tests/*` prompt/identity tests call it directly.-- **`agent::dispatcher`, `agent::triage`, `agent::debug`, `agent::orchestration::tools` (spawn_subagent and friends), `agent::learning::prompt_sections`, `agent::profiles::prompt_section`, `memory::tool_memory::prompt`, `tools::orchestrator_tools`, `integrations::composio`** — consume prompt types (`PromptContext`, `PromptSection`, `ToolCallFormat`, `ConnectedIntegration`, …) via `context::prompt`.+- **`agent::tool_dialect`, `agent::triage`, `agent::debug`, `agent::orchestration::tools` (spawn_subagent and friends), `agent::learning::prompt_sections`, `agent::profiles::prompt_section`, `memory::tool_memory::prompt`, `tools::orchestrator_tools`, `integrations::composio`** — consume prompt types (`PromptContext`, `PromptSection`, `ToolCallFormat`, `ConnectedIntegration`, …) via `agent::prompts`.- **`config::schema`** — `context.rs` embeds `SessionMemoryConfig`.## Notes / gotchas@@ -91,5 +90,5 @@ The durable substrate session-memory targets is the workspace `MEMORY.md` file,- **Tool-result budgeting is not a context pipeline stage.** The tinyagents path applies per-result budgets in `ToolOutputMiddleware` (`agent/tinyagents/middleware/tool_output.rs`), and artifact-preview fallback truncation lives in `agent/harness/tool_result_artifacts`.- **`autocompact_enabled()` is `config.enabled && config.autocompact_enabled`**, and `microcompact_keep_recent()` is `0` when `microcompact_enabled` is off — the manager folds the config gates so the turn reads one value per knob.- **Session memory is separate from compaction**: it does not mutate in-flight history; it gates a *persistent* `MEMORY.md` extraction. All three thresholds (token growth, tool calls, turns) must be crossed and no extraction may be in flight. `mark_extraction_failed` keeps deltas so the next turn retries; `mark_extraction_complete` resets them. The handle is `Arc`-cloned so a detached background task can flip completion state after the synchronous borrow is released.-- **`prompt.rs` is a compat shim** — do not add prompt logic here; it lives in `agent::prompts`.+- Prompt rendering does not belong in this module; add it to `agent::prompts`.- **`channels_prompt::build_system_prompt` deliberately bypasses `SystemPromptBuilder`** to keep production channel prompt bytes stable for prefix-cache hits; it is a standalone free function despite living under `context/`.diff --git a/crates/openhuman-core/src/agent/context/manager.rs b/crates/openhuman-core/src/agent/context/manager.rsindex e322575736..e19bb6dc2b 100644--- a/crates/openhuman-core/src/agent/context/manager.rs+++ b/crates/openhuman-core/src/agent/context/manager.rs@@ -26,9 +26,9 @@//! [`ContextManager::should_extract_session_memory`] so `turn.rs` can//! gate its existing `spawn_subagent` call.-use super::prompt::{PromptContext, SystemPromptBuilder};use super::session_memory::SessionMemoryConfig;use super::stats::{ContextStatsState, SessionMemoryHandle};+use crate::agent::prompts::{PromptContext, SystemPromptBuilder};use crate::config::ContextConfig;use crate::inference::provider::UsageInfo;use anyhow::Result;diff --git a/crates/openhuman-core/src/agent/harness/README.md b/crates/openhuman-core/src/agent/harness/README.mdindex 6f1bddfe43..a7d4053f27 100644--- a/crates/openhuman-core/src/agent/harness/README.md+++ b/crates/openhuman-core/src/agent/harness/README.md@@ -51,7 +51,6 @@ iterations.| `run_queue/` | `RunQueue` and `QueuedMessage` — steer/followup/collect lanes wrapping `tinyagents_harness::run_queue`; `QueueStatus` is re-exported from the crate. || `tool_result_artifacts/` | Persists oversized individual and aggregate tool outputs under `action_dir/artifacts/tool-results/`, replacing them with a bounded `[tool_result_preview]` envelope pointing at the full, redacted file. || `memory_context.rs`, `memory_context_safety.rs`, `memory_protocol.rs` | Working-memory and `[Cross-chat context]` lines surfaced into the prompt (capped by `WORKING_MEMORY_LIMIT`); trust-tier wrapping of recalled entries that came from connectors (`wrap_untrusted_for_agent`); and the read-index → dedupe → write → update-index enforcement state machine for memory-mutating tools (issue #4116). |-| `tool_filter.rs` | `filter_actions_by_prompt` — host adapter turning `ConnectedIntegrationTool` (Composio action shape) into `tinyagents_harness::tool::SelectableTool` for the upstream fuzzy toolkit-action ranker. || `instructions.rs`, `parse.rs`, `required_output.rs` | Text-mode `<tool_call>` protocol section (`build_tool_instructions*`), `parse_tool_calls_with_pformat`, and required structured-output validation/repair. || `credentials.rs` | `scrub_credentials` — regex scrubbing of credential-shaped text (key/value secrets, AWS access-key IDs, `sk-…` keys). Applied to every tool result by the middleware in `agent/tinyagents/`. || `turn_dispatch_guard.rs`, `turn_subagent_usage.rs` | Turn-scoped guard that refuses a new sub-agent dispatch once the run's remaining wall-clock/cap budget cannot fit it (issue #5804), and `LastTurnUsage`/`SubagentUsageEntry` accounting. |diff --git a/crates/openhuman-core/src/agent/harness/graph.rs b/crates/openhuman-core/src/agent/harness/graph.rsindex 0b30160786..3db76815f1 100644--- a/crates/openhuman-core/src/agent/harness/graph.rs+++ b/crates/openhuman-core/src/agent/harness/graph.rs@@ -165,14 +165,14 @@ pub(crate) async fn run_channel_turn_via_graph(// Using `outcome.conversation` (the typed messages-since-last-user) avoids// indexing into a post-trim `outcome.history` with the pre-trim `prior_len`,// which could drop current-turn messages when compaction reshaped the run.- use crate::agent::dispatcher::ToolDispatcher;+ use crate::agent::tool_dialect::ToolDispatcher;let suffix = if native_tools {- crate::agent::dispatcher::NativeToolDispatcher.to_provider_messages(&outcome.conversation)+ crate::agent::tool_dialect::NativeToolDispatcher.to_provider_messages(&outcome.conversation)} else {// History serialization is format-independent for prompt-guided providers// (tool calls already ride the visible assistant text); the XML dispatcher// renders the flat `[Tool results]` shape.- crate::agent::dispatcher::XmlToolDispatcher.to_provider_messages(&outcome.conversation)+ crate::agent::tool_dialect::XmlToolDispatcher.to_provider_messages(&outcome.conversation)};history.extend(suffix);if outcome.early_exit_tool.is_some() {diff --git a/crates/openhuman-core/src/agent/harness/mod.rs b/crates/openhuman-core/src/agent/harness/mod.rsindex 8b520f8a26..50597fc7ce 100644--- a/crates/openhuman-core/src/agent/harness/mod.rs+++ b/crates/openhuman-core/src/agent/harness/mod.rs@@ -40,7 +40,6 @@ pub mod session;mod spawn_depth_context;pub mod subagent_runner;pub mod task_recency_context;-pub(crate) mod tool_filter;pub(crate) mod tool_result_artifacts;pub mod turn_attachments_context;pub mod turn_dispatch_guard;@@ -69,7 +68,7 @@ pub(crate) use graph::run_channel_turn_via_graph;#[cfg(test)]mod harness_gap_tests;#[cfg(test)]-#[path = "parse.rs"]+#[path = "parse_wire_tests.rs"]mod parse_tests;#[cfg(test)]#[path = "harness_tests.rs"]diff --git a/crates/openhuman-core/src/agent/harness/parse.rs b/crates/openhuman-core/src/agent/harness/parse_wire_tests.rssimilarity index 97%rename from crates/openhuman-core/src/agent/harness/parse.rsrename to crates/openhuman-core/src/agent/harness/parse_wire_tests.rsindex fddf8a7ce6..d2f40a87ed 100644--- a/crates/openhuman-core/src/agent/harness/parse.rs+++ b/crates/openhuman-core/src/agent/harness/parse_wire_tests.rs@@ -12,16 +12,15 @@//! fixtures its own tests assert against, and they never compiled into a//! production build even before the move.-pub(crate) use tinytools_agent::{- extract_json_values, parse_tool_calls, parse_tool_calls_with_pformat,-};+#[cfg(test)]+use tinytools_agent::{extract_json_values, parse_tool_calls, parse_tool_calls_with_pformat};// The rest of the crate's re-exports are only reached from this module's own// tests (`tests.rs`) and `harness_gap_tests.rs`, not from any production call// site — gated so a non-test build doesn't warn (and fail `-D warnings`) on// them.#[cfg(test)]-pub(crate) use tinytools_agent::{+use tinytools_agent::{parse_arguments_value, parse_glm_style_tool_calls, parse_tool_call_value,parse_tool_calls_from_json_value,};diff --git a/crates/openhuman-core/src/agent/harness/required_output.rs b/crates/openhuman-core/src/agent/harness/required_output.rsindex 8f2f9ad6da..02d0785e6e 100644--- a/crates/openhuman-core/src/agent/harness/required_output.rs+++ b/crates/openhuman-core/src/agent/harness/required_output.rs@@ -50,7 +50,9 @@ pub(crate) fn find_required_block(if keys.is_empty() {return None;}- let first = super::parse::extract_json_values(text).into_iter().next()?;+ let first = tinytools_agent::extract_json_values(text)+ .into_iter()+ .next()?;let obj = first.as_object()?;let has_all = keys.iter()diff --git a/crates/openhuman-core/src/agent/harness/session/builder/builder_tests_tool_spec_views_tests.rs b/crates/openhuman-core/src/agent/harness/session/builder/builder_tests_tool_spec_views_tests.rsindex 04bc91ab2e..c994bf6908 100644--- a/crates/openhuman-core/src/agent/harness/session/builder/builder_tests_tool_spec_views_tests.rs+++ b/crates/openhuman-core/src/agent/harness/session/builder/builder_tests_tool_spec_views_tests.rs@@ -130,7 +130,7 @@ fn spec_views_stay_consistent_for_a_tool_less_agent() {.chat_model(model).tools(Vec::new()).memory(crate::memory::test_support::noop_memory())- .tool_dispatcher(Box::new(crate::agent::dispatcher::XmlToolDispatcher))+ .tool_dispatcher(Box::new(crate::agent::tool_dialect::XmlToolDispatcher)).build().expect("a tool-less agent is a legal build");diff --git a/crates/openhuman-core/src/agent/harness/session/builder/factory.rs b/crates/openhuman-core/src/agent/harness/session/builder/factory.rsindex 347ee6d764..1daac814d7 100644--- a/crates/openhuman-core/src/agent/harness/session/builder/factory.rs+++ b/crates/openhuman-core/src/agent/harness/session/builder/factory.rs@@ -3,12 +3,12 @@use super::helpers::prefetch_tool_memory_rules_blocking;use super::should_synthesize_delegation_tools;-use crate::agent::dispatcher::{NativeToolDispatcher, PFormatToolDispatcher, XmlToolDispatcher};use crate::agent::harness::definition::NO_TOOLS_SENTINEL;use crate::agent::harness::definition::{AgentDefinitionRegistry, PromptSource, ToolScope};use crate::agent::harness::session::types::Agent;use crate::agent::host_runtime;use crate::agent::prompts::SystemPromptBuilder;+use crate::agent::tool_dialect::{NativeToolDispatcher, PFormatToolDispatcher, XmlToolDispatcher};use crate::config::Config;use crate::inference::provider;use crate::memory::tool_memory::capture::ToolMemoryCaptureHook;@@ -17,7 +17,7 @@ use crate::security::SecurityPolicy;use crate::tools;use anyhow::Result;use std::sync::Arc;-use tinytools::Tool;+use tinytools::{PermissionLevel, Tool, ToolScope};impl Agent {/// Constructs an `Agent` instance from a global system configuration.@@ -356,7 +356,7 @@ impl Agent {let base_config: Arc<Config> = Arc::new(config.clone());let tool_config: Arc<Config> = Arc::clone(&base_config);- let mut tools = tools::all_tools_with_runtime(+ let mut tools = tools::ops::all_tools_with_runtime(Arc::clone(&tool_config),&security,runtime,@@ -383,8 +383,8 @@ impl Agent {if read_only_tools_only {let before = tools.len();tools.retain(|tool| {- tool.permission_level() <= tools::PermissionLevel::ReadOnly- && !matches!(tool.scope(), tools::ToolScope::CliRpcOnly)+ tool.permission_level() <= PermissionLevel::ReadOnly+ && !matches!(tool.scope(), ToolScope::CliRpcOnly)});log::info!("[agent::builder] read-only tool filter applied: before={} after={}",@@ -1062,7 +1062,7 @@ impl Agent {);let dispatcher_kind =resolve_dispatcher_kind(&dispatcher_choice, supports_native, agent_id);- let tool_dispatcher: Box<dyn crate::agent::dispatcher::ToolDispatcher> =+ let tool_dispatcher: Box<dyn crate::agent::tool_dialect::ToolDispatcher> =match dispatcher_kind {DispatcherKind::Native => Box::new(NativeToolDispatcher),DispatcherKind::Xml => Box::new(XmlToolDispatcher),diff --git a/crates/openhuman-core/src/agent/harness/session/builder/setters.rs b/crates/openhuman-core/src/agent/harness/session/builder/setters.rsindex d26dc40c8f..a34ea34127 100644--- a/crates/openhuman-core/src/agent/harness/session/builder/setters.rs+++ b/crates/openhuman-core/src/agent/harness/session/builder/setters.rs@@ -146,7 +146,7 @@ impl AgentBuilder {/// Sets the tool dispatcher for the agent.pub fn tool_dispatcher(mut self,- tool_dispatcher: Box<dyn crate::agent::dispatcher::ToolDispatcher>,+ tool_dispatcher: Box<dyn crate::agent::tool_dialect::ToolDispatcher>,) -> Self {self.tool_dispatcher = Some(tool_dispatcher);self@@ -323,7 +323,7 @@ impl AgentBuilder {/// inspecting transcripts after the fact./// * **[`PromptContext::agent_id`]** at prompt-build time (see/// `turn.rs`). Today only one prompt section reads this field —- /// the `Connected Integrations` branch in `context/prompt.rs`+ /// the `Connected Integrations` branch in `agent/prompts`/// that special-cases `integrations_agent` vs every other agent — so/// the current user-visible impact of a wrong id is limited to/// the two bullets above. The stamped `prompt_builder` injecteddiff --git a/crates/openhuman-core/src/agent/harness/session/runtime/turn_helpers.rs b/crates/openhuman-core/src/agent/harness/session/runtime/turn_helpers.rsindex d1446e35d0..3f1139a8c9 100644--- a/crates/openhuman-core/src/agent/harness/session/runtime/turn_helpers.rs+++ b/crates/openhuman-core/src/agent/harness/session/runtime/turn_helpers.rs@@ -2,9 +2,9 @@//! sanitisation, and tool-call id fallback / persistence shaping.use super::super::types::Agent;-use crate::agent::dispatcher::ParsedToolCall;use crate::agent::error::AgentError;use crate::agent::messages::ConversationMessage;+use crate::agent::tool_dialect::ParsedToolCall;use crate::inference::provider::ToolCall;use crate::util::truncate_with_ellipsis;diff --git a/crates/openhuman-core/src/agent/harness/session/runtime_tests.rs b/crates/openhuman-core/src/agent/harness/session/runtime_tests.rsindex 69b41174de..8b9461c8a7 100644--- a/crates/openhuman-core/src/agent/harness/session/runtime_tests.rs+++ b/crates/openhuman-core/src/agent/harness/session/runtime_tests.rs@@ -1,8 +1,8 @@use super::super::types::Agent;-use crate::agent::dispatcher::XmlToolDispatcher;use crate::agent::error::AgentError;use crate::agent::messages::ChatMessage;use crate::agent::messages::ConversationMessage;+use crate::agent::tool_dialect::XmlToolDispatcher;use crate::core::events::DomainEvent;use crate::inference::provider::{ChatResponse, UsageInfo};use crate::memory::Memory;@@ -168,12 +168,12 @@ fn sanitizers_and_tool_call_helpers_cover_fallback_paths() {assert!(!sanitized.contains('\t'));let calls = vec![- crate::agent::dispatcher::ParsedToolCall {+ crate::agent::tool_dialect::ParsedToolCall {name: "a".into(),arguments: serde_json::json!({}),tool_call_id: None,},- crate::agent::dispatcher::ParsedToolCall {+ crate::agent::tool_dialect::ParsedToolCall {name: "b".into(),arguments: serde_json::json!({"x":1}),tool_call_id: Some("keep".into()),diff --git a/crates/openhuman-core/src/agent/harness/session/session_tests.rs b/crates/openhuman-core/src/agent/harness/session/session_tests.rsindex 7ee4878266..0124afe5b0 100644--- a/crates/openhuman-core/src/agent/harness/session/session_tests.rs+++ b/crates/openhuman-core/src/agent/harness/session/session_tests.rs@@ -6,8 +6,8 @@//! (`MockProvider`, `RecordingProvider`, `MockTool`) are defined here.use super::types::{Agent, AgentBuilder};-use crate::agent::dispatcher::{NativeToolDispatcher, XmlToolDispatcher};use crate::agent::messages::ConversationMessage;+use crate::agent::tool_dialect::{NativeToolDispatcher, XmlToolDispatcher};use crate::core::events::DomainEvent;use crate::inference::provider::ChatResponse;use crate::memory::Memory;diff --git a/crates/openhuman-core/src/agent/harness/session/turn/mod.rs b/crates/openhuman-core/src/agent/harness/session/turn/mod.rsindex 32180cead3..3b629f41c2 100644--- a/crates/openhuman-core/src/agent/harness/session/turn/mod.rs+++ b/crates/openhuman-core/src/agent/harness/session/turn/mod.rs@@ -8,7 +8,7 @@ mod recall_lanes;mod session_io;mod tools;-use crate::agent::dispatcher::ParsedToolCall;+use crate::agent::tool_dialect::ParsedToolCall;use std::borrow::Cow;diff --git a/crates/openhuman-core/src/agent/harness/session/turn_checkpoint.rs b/crates/openhuman-core/src/agent/harness/session/turn_checkpoint.rsindex c844f69fe1..55efea85e8 100644--- a/crates/openhuman-core/src/agent/harness/session/turn_checkpoint.rs+++ b/crates/openhuman-core/src/agent/harness/session/turn_checkpoint.rs@@ -10,7 +10,7 @@ pub(crate) fn assistant_message_has_tool_calls(msg: &ChatMessage) -> bool {// CodeRabbit follow-up: only treat this as the native tool_calls envelope// when the full expected shape is present:// - top-level JSON object- // - `content` key present (the envelope `dispatcher.rs` emits — see+ // - `content` key present (the envelope `tool_dialect.rs` emits — see// `to_provider_messages`)// - non-empty `tool_calls` array whose every element carries an `id`// string, a `name` string, and an `arguments` fielddiff --git a/crates/openhuman-core/src/agent/harness/session/turn_learned_context_and_announcements_tests.rs b/crates/openhuman-core/src/agent/harness/session/turn_learned_context_and_announcements_tests.rsindex 0dacf223dd..bc8e578876 100644--- a/crates/openhuman-core/src/agent/harness/session/turn_learned_context_and_announcements_tests.rs+++ b/crates/openhuman-core/src/agent/harness/session/turn_learned_context_and_announcements_tests.rs@@ -163,7 +163,7 @@ fn assistant_message_has_tool_calls_rejects_plain_text_reply() {#[test]fn assistant_message_has_tool_calls_rejects_envelope_without_content_field() {// A bare `{"tool_calls": [...]}` JSON in the content (no `content` field)- // is not the envelope `dispatcher.rs` emits.+ // is not the envelope `tool_dialect.rs` emits.let body = serde_json::json!({"tool_calls": [{ "id": "tc-1", "name": "shell", "arguments": "{}" }]})diff --git a/crates/openhuman-core/src/agent/harness/session/turn_tests.rs b/crates/openhuman-core/src/agent/harness/session/turn_tests.rsindex af62156378..1c016e55c3 100644--- a/crates/openhuman-core/src/agent/harness/session/turn_tests.rs+++ b/crates/openhuman-core/src/agent/harness/session/turn_tests.rs@@ -1,10 +1,10 @@use super::*;-use crate::agent::dispatcher::{PFormatToolDispatcher, ToolDispatcher, XmlToolDispatcher};use crate::agent::experience::{AgentExperience, AgentExperienceStore, ExperienceOutcome, ExperienceSource,};use crate::agent::hooks::{PostTurnHook, TurnContext};use crate::agent::messages::{ChatMessage, ConversationMessage};+use crate::agent::tool_dialect::{PFormatToolDispatcher, ToolDispatcher, XmlToolDispatcher};use crate::agent::tool_policy::{GeneratedToolRuntimeContext, GeneratedToolRuntimeRisk, ToolPolicy, ToolPolicyDecision,ToolPolicyRequest,diff --git a/crates/openhuman-core/src/agent/harness/session/types.rs b/crates/openhuman-core/src/agent/harness/session/types.rsindex dca2ec9a49..dc0704bf06 100644--- a/crates/openhuman-core/src/agent/harness/session/types.rs+++ b/crates/openhuman-core/src/agent/harness/session/types.rs@@ -7,7 +7,6 @@//! crate gaining field access.use crate::agent::context::ContextManager;-use crate::agent::dispatcher::ToolDispatcher;use crate::agent::harness::archivist::ArchivistHook;use crate::agent::harness::definition::TriggerMemoryAgent;use crate::agent::hooks::PostTurnHook;@@ -15,6 +14,7 @@ use crate::agent::messages::{ChatMessage, ConversationMessage};use crate::agent::progress::AgentProgress;use crate::agent::prompts::SystemPromptBuilder;use crate::agent::tinyagents::TurnModelSource;+use crate::agent::tool_dialect::ToolDispatcher;use crate::agent::tool_policy::ToolPolicy;use crate::memory::Memory;use crate::tools::agent_policy::ToolPolicySession;diff --git a/crates/openhuman-core/src/agent/harness/subagent_runner/mod.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/mod.rsindex b66b693d07..c50a7a09ec 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/mod.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/mod.rs@@ -51,6 +51,10 @@ mod ops;mod tool_prep;mod types;+#[cfg(test)]+#[path = "tool_ranking_tests.rs"]+mod tool_ranking_tests;+// Public API — the entry point and the shapes it returns.pub use autonomous::{autonomous_iter_cap, subagent_iter_cap_with_autonomous_lift, with_autonomous_iter_cap,diff --git a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/checkpoint.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/checkpoint.rsindex 2d6f8c32d5..336cb72051 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/checkpoint.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/checkpoint.rs@@ -56,7 +56,7 @@ impl SubagentCheckpoint {Ok(resp) => {let usage = crate::agent::tinyagents::model::usage_info_from_response(&resp);let raw = resp.text();- let (prose, _) = super::super::super::parse::parse_tool_calls(&raw);+ let (prose, _) = tinytools_agent::parse_tool_calls(&raw);let text = if prose.trim().is_empty() {deterministic} else {diff --git a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rsindex a95520ce72..7309d9b848 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs@@ -396,11 +396,11 @@ pub(in super::super) async fn run_subagent_via_graph(// the typed `outcome.conversation` (messages-since-last-user) also avoids// indexing a post-trim `outcome.history` with the pre-trim length, and the// durable `[IMAGE:…]` markers stay put since the prior user turns are untouched.- use crate::agent::dispatcher::ToolDispatcher;+ use crate::agent::tool_dialect::ToolDispatcher;let suffix = if native_tools {- crate::agent::dispatcher::NativeToolDispatcher.to_provider_messages(&outcome.conversation)+ crate::agent::tool_dialect::NativeToolDispatcher.to_provider_messages(&outcome.conversation)} else {- crate::agent::dispatcher::XmlToolDispatcher.to_provider_messages(&outcome.conversation)+ crate::agent::tool_dialect::XmlToolDispatcher.to_provider_messages(&outcome.conversation)};history.extend(suffix);diff --git a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph_failed_run_tests.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph_failed_run_tests.rsindex 92c4231509..a56fccf119 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph_failed_run_tests.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph_failed_run_tests.rs@@ -1,4 +1,5 @@use super::*;+use tinytools::{Tool, ToolSpec};/// 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/harness/subagent_runner/ops/graph_tests.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph_tests.rsindex 326d701461..654176bbff 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph_tests.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph_tests.rs@@ -7,6 +7,7 @@ use tinyinference_llm::model::{};use tinyinference_llm::tool::ToolCall;use tinytools::ToolResult;+use tinytools::{Tool, ToolSpec};fn native_tool_profile() -> &'static ModelProfile {static PROFILE: std::sync::LazyLock<ModelProfile> = std::sync::LazyLock::new(|| ModelProfile {diff --git a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/mod.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/mod.rsindex 6ad02ad3c4..9a185605e4 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/mod.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/mod.rs@@ -71,8 +71,6 @@ pub(super) use crate::agent::harness::fork_context::ParentExecutionContext;pub(super) use crate::agent::harness::turn_dispatch_guard;#[cfg(test)]pub(super) use crate::agent::harness::{current_spawn_depth, with_spawn_depth, MAX_SPAWN_DEPTH};-#[cfg(test)]-pub(super) use tinytools::{Tool, ToolSpec};// Test companion modules — path references relative to their original location.#[cfg(test)]diff --git a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rsindex bfe2b34be3..97e0143601 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs@@ -46,10 +46,10 @@ use crate::agent::prompts::{use crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS;use crate::memory::api::provider::retrieval::{FastRetrieveQuery, RetrievalResponse};use crate::memory::source_scope::as_bus_scope;-use tinyagents_harness::tool::SandboxMode as TinyagentsSandboxMode;-use tinytools::{Tool, ToolCategory, ToolSpec};--use tinyagents_harness::workspace::WorkspaceDescriptor;+use tinyagents_harness::tool::{rank_tools_by_prompt, SelectableTool, MIN_CONFIDENT_HITS};+use tinytools::{+ SandboxMode as TinyagentsSandboxMode, Tool, ToolCategory, ToolSpec, WorkspaceDescriptor,+};use super::prompt::{append_artifact_offload_contract, append_subagent_role_contract, dedup_tool_specs_by_name,@@ -1085,14 +1085,15 @@ async fn run_typed_mode(};let integration = &integration;let top_k = top_k_for_toolkit(tk);- let filter_hits = super::super::super::tool_filter::filter_actions_by_prompt(- task_prompt,- &integration.tools,- top_k,- );+ let candidates: Vec<_> = integration+ .tools+ .iter()+ .map(|tool| SelectableTool::new(&tool.name, &tool.description))+ .collect();+ let filter_hits = rank_tools_by_prompt(task_prompt, &candidates, top_k);let selected: Vec<&crate::agent::prompts::ConnectedIntegrationTool> = if filter_hits.len()- >= super::super::super::tool_filter::MIN_CONFIDENT_HITS+ >= MIN_CONFIDENT_HITS{// The ranker's verb gate can drop every content-returning// action for a find/search prompt, so the toolkit'sdiff --git a/crates/openhuman-core/src/agent/harness/subagent_runner/ops_tests.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/ops_tests.rsindex 345480c3d2..a03b3e8351 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/ops_tests.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/ops_tests.rs@@ -1,5 +1,6 @@use super::*;use crate::agent::harness::definition::{ModelSpec, ToolScope};+use tinytools::{Tool, ToolSpec};fn make_def_named_tools(names: &[&str]) -> AgentDefinition {AgentDefinition {diff --git a/crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep.rsindex d0563c4054..1781d17f8c 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep.rs@@ -167,7 +167,7 @@ pub(super) fn select_actions_with_essentials(/// Format the tool-use protocol block appended to the system prompt in text/// mode. Teaches **P-Format** first (the same protocol-/// [`crate::agent::dispatcher::PFormatToolDispatcher`] renders and+/// [`crate::agent::tool_dialect::PFormatToolDispatcher`] renders and/// the tinyagents adapter parses via `parse_tool_calls_with_pformat`), with/// the legacy JSON-in-tag form as the documented fallback for nested/// arguments. The `## Tools` catalogue already renders `Call as:` p-format@@ -232,10 +232,10 @@ pub(crate) fn subagent_prompt_protocol(parent_format: crate::agent::prompts::ToolCallFormat,text_mode: bool,) -> (crate::agent::prompts::ToolCallFormat, String) {- use crate::agent::dispatcher::{+ use crate::agent::prompts::ToolCallFormat;+ use crate::agent::tool_dialect::{NativeToolDispatcher, PFormatToolDispatcher, ToolDispatcher, XmlToolDispatcher,};- use crate::agent::prompts::ToolCallFormat;use tinytools_agent::PFormatRegistry;if text_mode {return (ToolCallFormat::PFormat, String::new());diff --git a/crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep_tests.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep_tests.rsindex 129e66e5b5..96b042c98c 100644--- a/crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep_tests.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep_tests.rs@@ -58,6 +58,7 @@ fn unprefixed_delegate_name_overrides_are_treated_as_spawn_tools() {// ── Essential-action reservation (#6033) ────────────────────────────────use crate::agent::prompts::ConnectedIntegrationTool;+use tinyagents_harness::tool::{rank_tools_by_prompt, SelectableTool};fn action(name: &str) -> ConnectedIntegrationTool {ConnectedIntegrationTool {@@ -262,9 +263,11 @@ fn gmail_read_prompt_keeps_a_content_returning_action() {"find job opportunities from the last 5 days","Search the user's Gmail inbox for job opportunity emails from the last 5 days and summarize sender, subject and date",] {- let hits = crate::agent::harness::tool_filter::filter_actions_by_prompt(- prompt, &actions, 12,- );+ let candidates: Vec<_> = actions+ .iter()+ .map(|tool| SelectableTool::new(&tool.name, &tool.description))+ .collect();+ let hits = rank_tools_by_prompt(prompt, &candidates, 12);let selected = select_actions_with_essentials("gmail", &actions, &hits, 12);let names: Vec<&str> = selected.iter().map(|&i| actions[i].name.as_str()).collect();diff --git a/crates/openhuman-core/src/agent/harness/tool_filter_tests.rs b/crates/openhuman-core/src/agent/harness/subagent_runner/tool_ranking_tests.rssimilarity index 90%rename from crates/openhuman-core/src/agent/harness/tool_filter_tests.rsrename to crates/openhuman-core/src/agent/harness/subagent_runner/tool_ranking_tests.rsindex b180393b41..9b2a13f4a9 100644--- a/crates/openhuman-core/src/agent/harness/tool_filter_tests.rs+++ b/crates/openhuman-core/src/agent/harness/subagent_runner/tool_ranking_tests.rs@@ -1,16 +1,28 @@-//! Host-side coverage for the tool-filter adapter.+//! Host-side coverage for direct tinyagents tool ranking.//!//! The ranking algorithm itself is tested upstream in//! `tinyagents_harness::tool::select`, against synthetic catalogues. What is-//! tested here is the half that stayed: the `ConnectedIntegrationTool`-//! adapter, exercised against the real Composio tool-list dumps in+//! tested here is the host fixture conversion from `ConnectedIntegrationTool`,+//! exercised against the real Composio tool-list dumps in//! `tests/fixtures/` (1000 actions across nine toolkits). Those fixtures are//! host data about a specific integration provider and have no business in a//! provider-neutral library crate, so this suite stays here rather than//! moving up with the algorithm.-use super::*;use crate::agent::prompts::ConnectedIntegrationTool;+use tinyagents_harness::tool::{rank_tools_by_prompt, SelectableTool, MIN_CONFIDENT_HITS};++fn rank_actions_by_prompt(+ prompt: &str,+ actions: &[ConnectedIntegrationTool],+ max_results: usize,+) -> Vec<usize> {+ let candidates: Vec<_> = actions+ .iter()+ .map(|tool| SelectableTool::new(&tool.name, &tool.description))+ .collect();+ rank_tools_by_prompt(prompt, &candidates, max_results)+}// ── Real-dataset integration tests ────────────────────────────────//@@ -60,7 +72,7 @@ fn assert_in_top(actions: &[ConnectedIntegrationTool], hits: &[usize], wanted: &fn real_data_github_create_pr() {let actions = load_real_toolkit("github");assert!(actions.len() > 400, "github fixture should have ~500 tools");- let hits = filter_actions_by_prompt(+ let hits = rank_actions_by_prompt("Create a pull request from feature/auth-fix to main in the openhuman repo",&actions,15,@@ -83,7 +95,7 @@ fn real_data_github_create_pr() {#[test]fn real_data_github_list_prs() {let actions = load_real_toolkit("github");- let hits = filter_actions_by_prompt(+ let hits = rank_actions_by_prompt("Find all open pull requests assigned to the current user in the openhuman repo",&actions,15,@@ -100,7 +112,7 @@ fn real_data_github_list_prs() {#[test]fn real_data_gmail_send_email() {let actions = load_real_toolkit("gmail");- let hits = filter_actions_by_prompt(+ let hits = rank_actions_by_prompt("Send an email to [email protected] with subject 'Q2 Report' and body attached",&actions,10,@@ -120,7 +132,7 @@ fn real_data_gmail_send_email() {#[test]fn real_data_gmail_delete_emails() {let actions = load_real_toolkit("gmail");- let hits = filter_actions_by_prompt(+ let hits = rank_actions_by_prompt("Delete all promotional emails received in the last week",&actions,10,@@ -139,7 +151,7 @@ fn real_data_gmail_delete_emails() {#[test]fn real_data_slack_send_message() {let actions = load_real_toolkit("slack");- let hits = filter_actions_by_prompt(+ let hits = rank_actions_by_prompt("Post a message to the #general channel saying the deploy is complete",&actions,15,@@ -151,7 +163,7 @@ fn real_data_slack_send_message() {#[test]fn real_data_notion_create_page() {let actions = load_real_toolkit("notion");- let hits = filter_actions_by_prompt(+ let hits = rank_actions_by_prompt("Create a new page in the Engineering workspace titled 'Sprint Plan'",&actions,15,@@ -191,7 +203,7 @@ fn real_data_full_funnel_report() {let mut total_out = 0usize;for (tk, q) in cases {let actions = load_real_toolkit(tk);- let hits = filter_actions_by_prompt(q, &actions, 15);+ let hits = rank_actions_by_prompt(q, &actions, 15);let kept = if hits.len() >= MIN_CONFIDENT_HITS {hits.len()} else {@@ -225,7 +237,7 @@ fn real_data_full_funnel_report() {#[test]fn repro_3152_create_page_reachable_in_top_k() {let actions = load_real_toolkit("notion");- let hits = filter_actions_by_prompt(+ let hits = rank_actions_by_prompt("create a notion page with the meeting notes and give me the link",&actions,12,@@ -298,7 +310,7 @@ fn adapter_ranking_matches_the_pre_extraction_snapshot() {];for (toolkit, prompt, top_k, expected) in cases {let actions = load_real_toolkit(toolkit);- let got: Vec<&str> = filter_actions_by_prompt(prompt, &actions, *top_k)+ let got: Vec<&str> = rank_actions_by_prompt(prompt, &actions, *top_k).into_iter().take(expected.len()).map(|i| actions[i].name.as_str())diff --git a/crates/openhuman-core/src/agent/harness/tool_filter.rs b/crates/openhuman-core/src/agent/harness/tool_filter.rsdeleted file mode 100644index a870ac7edb..0000000000--- a/crates/openhuman-core/src/agent/harness/tool_filter.rs+++ /dev/null@@ -1,39 +0,0 @@-//! Host adapter for the fuzzy toolkit-action ranker.-//!-//! The algorithm lives upstream in-//! [`tinyagents_harness::tool::select`] — ranking a large tool catalogue-//! against a task prompt is not an OpenHuman concern, and a second host would-//! want the same five-stage pipeline. What stays here is the one thing that is-//! ours: turning a [`ConnectedIntegrationTool`] (Composio's action shape) into-//! the crate's borrowed [`SelectableTool`] view.-//!-//! The historical OpenHuman names are re-exported so the single call site in-//! `subagent_runner/ops/runner.rs` keeps reading the way it did.--use tinyagents_harness::tool::SelectableTool;--use crate::agent::prompts::ConnectedIntegrationTool;--pub use tinyagents_harness::tool::MIN_CONFIDENT_HITS;--/// Rank `actions` against `prompt` and return indices for the top-/// `max_results` matches, ordered best-first.-///-/// Thin adapter over [`tinyagents_harness::tool::rank_tools_by_prompt`];-/// see that function for the ranking rules and for why a result shorter than-/// [`MIN_CONFIDENT_HITS`] should be treated as no result at all.-pub fn filter_actions_by_prompt(- prompt: &str,- actions: &[ConnectedIntegrationTool],- max_results: usize,-) -> Vec<usize> {- let candidates: Vec<SelectableTool<'_>> = actions- .iter()- .map(|a| SelectableTool::new(&a.name, &a.description))- .collect();- tinyagents_harness::tool::rank_tools_by_prompt(prompt, &candidates, max_results)-}--#[cfg(test)]-#[path = "tool_filter_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rsindex 72fe8c00fc..ab0e34b7e1 100644--- a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs+++ b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs@@ -9,7 +9,7 @@use std::path::{Path, PathBuf};use std::sync::{Arc, Mutex};-use crate::agent::dispatcher::ToolExecutionResult;+use crate::agent::tool_dialect::ToolExecutionResult;use crate::memory::safety::{sanitize_text, SanitizationReport, Sanitized};use async_trait::async_trait;use serde_json::Value;diff --git a/crates/openhuman-core/src/agent/learning/README.md b/crates/openhuman-core/src/agent/learning/README.mdindex ac7e8fa0be..6f36a54ad5 100644--- a/crates/openhuman-core/src/agent/learning/README.md+++ b/crates/openhuman-core/src/agent/learning/README.md@@ -103,7 +103,7 @@ These are subscriber registrations rather than a single `bus.rs`; subscriptions- `crate::agent::harness::session::transcript` — `SessionTranscript` parsing for transcript ingestion.- `crate::inference::provider::create_chat_model_from_string_with_model_id` (profile summarisation) and `crate::inference::host_runtime::global` (local reflection route); `ReflectionHook` also accepts an optional `tinyinference_llm::model::ChatModel` for the cloud fallback.- `crate::config` — `Config` / `LearningConfig` / `ReflectionSource` feature flags and `config::rpc` loader.-- `crate::agent::context::prompt` — `PromptContext` / `PromptSection` / `LearnedContextData` for prompt injection.+- `crate::agent::prompts` — `PromptContext` / `PromptSection` / `LearnedContextData` for prompt injection.- `crate::integrations::composio` — `composio::client` (Gmail fetch for enrichment) and `composio::profile_md` (`replace_managed_block` for `PROFILE.md`).- `crate::integrations` — `build_client` / `IntegrationClient` for the Apify scrape call.- `crate::core::bus` / `crate::core::events` / `tinybus` — `BUS.publish` / `BUS.subscribe`, `DomainEvent::CacheRebuilt`, and `tinybus::{EventHandler, SubscriptionHandle}`.diff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rsindex 9933b5483f..45ed9fb06b 100644--- a/crates/openhuman-core/src/agent/mod.rs+++ b/crates/openhuman-core/src/agent/mod.rs@@ -22,7 +22,6 @@ pub mod bus;pub mod context;pub(crate) mod cost;pub mod debug;-pub mod dispatcher;pub mod error;pub mod experience;pub mod file_state;@@ -67,6 +66,7 @@ pub mod task_dispatcher;pub(crate) mod task_session;pub mod tinyagents;pub mod todos;+pub mod tool_dialect;pub mod tool_policy;pub mod tools;pub mod triage;diff --git a/crates/openhuman-core/src/agent/orchestration/README.md b/crates/openhuman-core/src/agent/orchestration/README.mdindex f88d8894a0..740068c1b6 100644--- a/crates/openhuman-core/src/agent/orchestration/README.md+++ b/crates/openhuman-core/src/agent/orchestration/README.md@@ -157,7 +157,7 @@ what the harness exposes to the child.- `agent::harness` — `run_subagent`, `fork_context::ParentExecutionContext`,`definition::{AgentDefinition, AgentDefinitionRegistry}`.-- `agent::tinyagents::orchestration` — `DetachedTaskRegistry`,+- `tinyagents_graph::orchestration` — `DetachedTaskRegistry`,`OrchestrationTaskStatus`, `TaskId`.- `tinyagents_session::run_ledger` — durable storage for teams, workflow runs,and agent run rows.diff --git a/crates/openhuman-core/src/agent/orchestration/delegation.rs b/crates/openhuman-core/src/agent/orchestration/delegation.rsindex f72245d0f9..b9000fe8fe 100644--- a/crates/openhuman-core/src/agent/orchestration/delegation.rs+++ b/crates/openhuman-core/src/agent/orchestration/delegation.rs@@ -1,7 +1,7 @@//! Production wiring for the multi-stage sub-agent delegation graph (issue//! #4249, Phase 3).//!-//! [`tinyagents::delegation::run_delegation`](crate::agent::tinyagents::delegation::run_delegation)+//! [`tinyagents_graph::delegation::run_delegation`](tinyagents_graph::delegation::run_delegation)//! is the durable plan→execute⇄review→finalize state machine, but it takes an//! *injected* per-stage worker so its orchestration mechanics can be unit-tested//! with a mock. This module supplies the **production** worker: every stage runs@@ -21,12 +21,12 @@ use crate::agent::harness::definition::AgentDefinition;use crate::agent::harness::fork_context::{current_parent, with_parent_context};use crate::agent::harness::subagent_runner::{run_subagent, SubagentRunOptions};use crate::agent::orchestration::parent_context::build_root_parent;-use crate::agent::tinyagents::delegation::{- run_or_resume_delegation, DelegationConfig, DelegationStage, DelegationStageOutput,- DelegationState,-};+use crate::agent::tinyagents::host::delegation::run_or_resume_with_tracing;use crate::config::Config;use tinyagents_graph::checkpoint::Checkpointer;+use tinyagents_graph::delegation::{+ DelegationConfig, DelegationStage, DelegationStageOutput, DelegationState,+};use tinyagents_graph::SqliteCheckpointer;use tinyagents_harness::workspace::WorkspaceDescriptor;use tinyagents_harness::CancellationToken;@@ -126,14 +126,14 @@ pub(crate) async fn run_subagent_delegation(cancel: CancellationToken::new(),// Automated (non-human-gated) delegation: the reviewer stage decides// approve/revise on its own. The durable human-approval interrupt- // (see `tinyagents::delegation::run_delegation_durable`) is opt-in and+ // (see `tinyagents_graph::delegation::run_delegation_durable`) is opt-in and// stays off here until a human-review delegation surface wires it...DelegationConfig::default()};// Resume-aware entry (#3884): with today's fresh-per-run `thread_id` this// is always a fresh run; reusing a stable `thread_id` resumes from the// last checkpoint boundary instead of restarting.- run_or_resume_delegation(delegation_config, run_stage)+ run_or_resume_with_tracing(delegation_config, run_stage).await.map(|outcome| outcome.state)};diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents.rsindex 9d505fc4d9..5517c91bb4 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents.rs@@ -6,7 +6,7 @@//! closes both gaps.//!//! Each running async sub-agent registers in TinyAgents'-//! [`DetachedTaskRegistry`](crate::agent::tinyagents::orchestration::DetachedTaskRegistry),+//! [`DetachedTaskRegistry`](tinyagents_graph::orchestration::DetachedTaskRegistry),//! keyed by its `task_id`, with://! - an `Arc<RunQueue>` — the same steering channel the steering forwarder in//! `run_turn_via_tinyagents_shared` drains mid-turn, so `steer_subagent` can@@ -28,7 +28,7 @@//!//! Alongside the executor plumbing (abort handle + steering queue + watch//! status), every detached sub-agent is also recorded in a process-wide-//! [`tinyagents` orchestration `TaskStore`](crate::agent::tinyagents::orchestration)+//! [`tinyagents` orchestration `TaskStore`](tinyagents_graph::orchestration)//! as an `OrchestrationTaskKind::SubAgent` task. `register` inserts it//! (`Pending` → `Running`) and spawns a watcher that mirrors the child's//! terminal status into the store (`Completed`/`Failed`/`Awaiting`); the canceldiff --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.rsindex 9157e4bb6d..2ccd75ad19 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@@ -1,5 +1,4 @@use super::*;-use crate::agent::dispatcher::NativeToolDispatcher;use crate::agent::harness::definition::AgentDefinitionRegistry;use crate::agent::harness::definition::{AgentDefinition, AgentTier, DefinitionSource, ModelSpec, PromptSource, SandboxMode, ToolScope,@@ -11,6 +10,7 @@ use crate::agent::orchestration::spawn_parallel_graph::{WorkerDispatchMode,};use crate::agent::prompts::ToolCallFormat;+use crate::agent::tool_dialect::NativeToolDispatcher;use crate::agent::Agent;use crate::config::AgentConfig;use crate::memory::{Memory, MemoryCategory, MemoryEntry, NamespaceSummary, RecallOpts};diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine.rsindex df3585faf6..6c02fc64c9 100644--- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine.rs+++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine.rs@@ -34,7 +34,7 @@//! checkpointer, resumed with `Command { resume: .. }`) instead of the ad-hoc//! `Interrupted`/cancel-flag bookkeeping used for stop/resume here. The//! mechanism is already implemented end-to-end for the delegation review gate in-//! [`crate::agent::tinyagents::delegation`] (see `run_delegation_durable` /+//! [`tinyagents_graph::delegation`] (see `run_delegation_durable` ///! `resume_delegation`); this engine should adopt the same//! interrupt→checkpoint→resume path once a human-review phase kind exists. The//! current between-phase cancellation bookkeeping is intentionally left in placediff --git a/crates/openhuman-core/src/agent/pformat_tests.rs b/crates/openhuman-core/src/agent/pformat_tests.rsindex b1869120dd..efc80d921d 100644--- a/crates/openhuman-core/src/agent/pformat_tests.rs+++ b/crates/openhuman-core/src/agent/pformat_tests.rs@@ -1,6 +1,6 @@-use super::*;-use tinytools::ToolResult;use async_trait::async_trait;+use tinytools::{Tool, ToolResult};+use tinytools_agent::{build_registry, parse_call, render_signature_from_schema};struct StubTool(&'static str);@@ -32,7 +32,11 @@ impl Tool for StubTool {#[test]fn build_registry_keys_on_the_tools_own_names() {let tools: Vec<Box<dyn Tool>> = vec![Box::new(StubTool("echo")), Box::new(StubTool("shell"))];- let reg = build_registry(&tools);+ let reg = build_registry(+ tools+ .iter()+ .map(|tool| (tool.name(), tool.parameters_schema())),+ );assert!(reg.contains_key("echo"));assert!(reg.contains_key("shell"));assert_eq!(reg.len(), 2);@@ -44,7 +48,11 @@ fn a_tool_absent_from_the_registry_cannot_be_called() {// tool it does not know, or a model could tunnel arbitrary JSON through// by guessing a name. This adapter is what decides what is "known".let tools: Vec<Box<dyn Tool>> = vec![Box::new(StubTool("echo"))];- let reg = build_registry(&tools);+ let reg = build_registry(+ tools+ .iter()+ .map(|tool| (tool.name(), tool.parameters_schema())),+ );assert!(parse_call("shell[rm -rf /]", ®).is_none());}@@ -53,7 +61,11 @@ fn a_registered_tool_parses_positionally_through_the_adapter() {// End-to-end through the adapter: schema comes from the Tool impl, and// arguments come back named and coerced.let tools: Vec<Box<dyn Tool>> = vec![Box::new(StubTool("echo"))];- let reg = build_registry(&tools);+ let reg = build_registry(+ tools+ .iter()+ .map(|tool| (tool.name(), tool.parameters_schema())),+ );let (name, args) = parse_call("echo[0|3|1|hi]", ®).expect("known tool parses");assert_eq!(name, "echo");// Schema properties are ordered alphabetically: count, value.@@ -67,7 +79,7 @@ fn signature_rendering_agrees_between_the_tool_and_schema_forms() {// catalogue would advertise a different argument order than the parser// reconstructs.let tool = StubTool("echo");- let from_tool = render_signature_from_tool(&tool);+ let from_tool = render_signature_from_schema(tool.name(), &tool.parameters_schema());let from_schema = render_signature_from_schema("echo", &tool.parameters_schema());assert_eq!(from_tool, from_schema);assert_eq!(from_tool, "echo[0|<count>|1|<value>]");diff --git a/crates/openhuman-core/src/agent/prompts/README.md b/crates/openhuman-core/src/agent/prompts/README.mdindex bf889be6ee..e072f6990e 100644--- a/crates/openhuman-core/src/agent/prompts/README.md+++ b/crates/openhuman-core/src/agent/prompts/README.md@@ -73,12 +73,11 @@ appears in prompts comes from the curated-memory snapshotEditing these files changes the shipped default agent's persona/style withouta code change.-## Compat shim+## Canonical module-`agent::context::prompt` (`agent/context/prompt.rs`) is `pub use-crate::agent::prompts::*` — prompt plumbing used to live there and was moved-here so it sits next to the agents that consume it. The shim is a stable-import path only; do not add logic to it.+`agent::prompts` is the canonical prompt-plumbing module. Prompt logic lives+here so it sits next to the agents that consume it; do not add a forwarding+module for this API.## Extension points (owned elsewhere)@@ -151,4 +150,3 @@ rather than "N days ago".- `agent/debug/` — `dump_agent_prompt` / `dump_all_agent_prompts` (`mod.rs`)build the same `PromptContext` to render each agent's prompt,`dump_writer.rs` writes it to disk, `prompt_size.rs` measures it.-- `agent/context/prompt.rs` — compat re-export shim (see above).diff --git a/crates/openhuman-core/src/agent/schemas.rs b/crates/openhuman-core/src/agent/schemas.rsindex fb1cc4b7a6..3bd8ea0f76 100644--- a/crates/openhuman-core/src/agent/schemas.rs+++ b/crates/openhuman-core/src/agent/schemas.rs@@ -576,7 +576,7 @@ fn handle_registry_snapshot(_params: Map<String, Value>) -> ControllerFuture {// ── Tools: baseline registry (full per-agent surface deferred) ──────let security = std::sync::Arc::new(crate::security::SecurityPolicy::default());- let baseline_tools = crate::tools::default_tools(security);+ let baseline_tools = crate::tools::ops::default_tools(security);let tool_count = baseline_tools.len();for tool in &baseline_tools {components.push(diff --git a/crates/openhuman-core/src/agent/tinyagents/README.md b/crates/openhuman-core/src/agent/tinyagents/README.mdindex ba332ef48f..88f264272a 100644--- a/crates/openhuman-core/src/agent/tinyagents/README.md+++ b/crates/openhuman-core/src/agent/tinyagents/README.md@@ -37,8 +37,8 @@ The **adapter seam** between OpenHuman and the vendored [`tinyagents`](../../../| `resolved_route.rs` | Task-local slot recording the provider/model that actually served the latest call (`ResolvedProviderRoute`, `with_resolved_provider_route_scope`, `record_resolved_provider_route`). || `topology.rs` | `all_graph_topologies`: behaviour-free `GraphTopology` exports of every custom OpenHuman graph for debug/inspection. || `observability.rs` + `observability/` | `event_bridge.rs`: `OpenhumanEventBridge`, translating crate `AgentEvent`s into `AgentProgress` and feeding per-call usage into `crate::platform::cost`. `event_projection.rs`: its `EventListener` impl. `cap_pauser.rs`: `CapPauser` and `SubagentScope`. `graph_tracing.rs`: `GraphTracingSink`. |-| `orchestration.rs` | Re-exports the `tinyagents_graph::orchestration` task primitives and owns the shared `SteeringRegistry` for detached sub-agents. |-| `delegation.rs` | Thin wrappers (`run_delegation`, `run_delegation_durable`, `resume_delegation`, `run_or_resume_delegation`) over `tinyagents_graph::delegation`'s plan → execute ⇄ review → finalize graph, attaching `GraphTracingSink`. |+| `host/steering.rs` | OpenHuman's steering allowlist and the shared `SteeringRegistry` for detached sub-agents. Task primitives are imported directly from `tinyagents_graph::orchestration`. |+| `host/delegation.rs` | Explicit tracing-bound execution helpers over `tinyagents_graph::delegation`'s plan → execute ⇄ review → finalize graph. || `payload_summarizer.rs` | `PayloadSummarizer` trait, `SummarizeOutcome`/`UnavailableReason`, and the default `SubagentPayloadSummarizer` that compresses oversized tool results through the `summarizer` sub-agent instead of hard-truncating them. || `policy_denial.rs` | `maybe_enrich_policy_block`: rewrites `[policy-blocked]` tool results into structured what/why/workaround messages that tell the model to relay the denial rather than fabricate output. Called from `ToolOutcomeCaptureMiddleware`. || `abort_guard.rs` | `AbortOnDrop`: ties a detached streaming-producer task's lifetime to its consumer stream so a dropped turn aborts the in-flight provider call (issue #4460). |diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rsindex 19a3008e04..2dbb6695c9 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs@@ -351,9 +351,9 @@ pub(super) fn assemble_turn_harness(// `inheriting`) and run it in shadow: it emits the exposure decision// event-native (`AgentEvent::ToolsFiltered`) and logs any divergence between// the crate layer's decision and the set OpenHuman actually registered as- // callable — WITHOUT changing the callable set (byte-identical to today). The- // ownership flip + deletion of `tool_filter.rs`/`tool_prep.rs` is the gated- // follow-up once the `[tool-exposure]` divergence logs show parity. Tags encode+ // callable — WITHOUT changing the callable set (byte-identical to today).+ // Folding the remaining host selection policy in `tool_prep.rs` into the+ // middleware is gated on `[tool-exposure]` divergence logs showing parity. Tags encode// the OpenHuman run context (agent id / channel / scope) for the flip; the// name-based `inheriting` predicate does not consult them yet.let exposure_tags: Vec<String> = {diff --git a/crates/openhuman-core/src/agent/tinyagents/delegation.rs b/crates/openhuman-core/src/agent/tinyagents/host/delegation.rssimilarity index 81%rename from crates/openhuman-core/src/agent/tinyagents/delegation.rsrename to crates/openhuman-core/src/agent/tinyagents/host/delegation.rsindex 31a2528587..73839d5fc6 100644--- a/crates/openhuman-core/src/agent/tinyagents/delegation.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/delegation.rs@@ -47,25 +47,10 @@ use std::sync::Arc;use serde_json::Value;-use super::observability::GraphTracingSink;+use super::super::observability::GraphTracingSink;-// The surface the core imports today, under its historical spellings.-pub(crate) use tinyagents_graph::delegation::{- delegation_graph_topology, DelegationConfig, DelegationOutcome, DelegationStage,- DelegationStageOutput, DelegationState,-};--// The rest of the seam. These have no in-tree caller right now — their only-// consumers were the unit tests, which moved upstream with the graph — but they-// are kept re-exported rather than deleted so the durable-approval path-// (`resume_delegation` + `deny_decision` + `PendingApproval`) and the state-// vocabulary (`StepRecord`, `CURRENT_SCHEMA_VERSION`) are reachable under the-// same names as before, and so a caller wiring that path up finds it here — on-// the wrappers that attach the tracing sink — rather than calling the crate-// directly and silently losing the journal.-#[allow(unused_imports)]-pub(crate) use tinyagents_graph::delegation::{- deny_decision, PendingApproval, StepRecord, CURRENT_SCHEMA_VERSION,+use tinyagents_graph::delegation::{+ DelegationConfig, DelegationOutcome, DelegationStage, DelegationStageOutput, DelegationState,};/// The `tracing` label every delegation graph run is journalled under. Stable —@@ -88,7 +73,7 @@ fn with_tracing_sink(mut config: DelegationConfig) -> DelegationConfig {////// See [`tinyagents_graph::delegation::run_delegation`].#[allow(dead_code)]-pub(crate) async fn run_delegation<F, Fut>(+pub(crate) async fn run_with_tracing<F, Fut>(config: DelegationConfig,run_stage: F,) -> Result<DelegationState, String>@@ -104,7 +89,7 @@ where////// See [`tinyagents_graph::delegation::run_delegation_durable`].#[allow(dead_code)]-pub(crate) async fn run_delegation_durable<F, Fut>(+pub(crate) async fn run_durable_with_tracing<F, Fut>(config: DelegationConfig,run_stage: F,) -> Result<DelegationOutcome, String>@@ -124,7 +109,7 @@ where////// See [`tinyagents_graph::delegation::resume_delegation`].#[allow(dead_code)]-pub(crate) async fn resume_delegation<F, Fut>(+pub(crate) async fn resume_with_tracing<F, Fut>(config: DelegationConfig,decision: Value,run_stage: F,@@ -142,7 +127,7 @@ where/// starting fresh.////// See [`tinyagents_graph::delegation::run_or_resume_delegation`].-pub(crate) async fn run_or_resume_delegation<F, Fut>(+pub(crate) async fn run_or_resume_with_tracing<F, Fut>(config: DelegationConfig,run_stage: F,) -> Result<DelegationOutcome, String>@@ -155,5 +140,5 @@ where}#[cfg(test)]-#[path = "delegation_tests.rs"]+#[path = "../delegation_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs b/crates/openhuman-core/src/agent/tinyagents/host/mod.rsindex 09e9af6865..b9a7fc4b29 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/mod.rs@@ -37,6 +37,7 @@ pub mod agent_memory;pub mod budget_gate;pub mod context_composer;pub mod definition_registry;+pub mod delegation;pub mod experience_store;pub mod learning_sink;pub mod model_resolver;diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_exposure.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_exposure.rsindex 8d1cf8c1c5..65fa764e81 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_exposure.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_exposure.rs@@ -41,8 +41,8 @@ use tinyinference_llm::tool::ToolSchema;/// is only logged/emitted — not enforced — this slice.////// Ownership flip (making this crate selection the sole authority + deleting-/// `agent/harness/tool_filter.rs` and `subagent_runner/tool_prep.rs`) is the-/// GATED follow-up, once the `[tool-exposure]` divergence logs show parity.+/// `subagent_runner/tool_prep.rs`) is the GATED follow-up, once the+/// `[tool-exposure]` divergence logs show parity.pub(crate) struct OpenHumanToolExposureShadowMiddleware {/// Static allow guard (crate). Held for the fail-closed parity cross-check;/// NOT installed as a live `before_tool` execution guard this slice —diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rsindex a53177d90b..d04d9cc8d7 100644--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs@@ -22,7 +22,7 @@pub(crate) mod abort_guard;pub mod config;pub(crate) mod convert;-pub(crate) mod delegation;+mod embeddings;mod harness_assembly;mod harness_context_ladder;diff --git a/crates/openhuman-core/src/agent/tinyagents/steering_forwarder.rs b/crates/openhuman-core/src/agent/tinyagents/steering_forwarder.rsindex 9631899d72..1ad93a0853 100644--- a/crates/openhuman-core/src/agent/tinyagents/steering_forwarder.rs+++ b/crates/openhuman-core/src/agent/tinyagents/steering_forwarder.rs@@ -28,6 +28,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::Arc;use std::time::Duration;+use tinyagents_harness::ids::TaskId;use tinyagents_harness::steering::{SteeringCommand, SteeringHandle};use tinyinference_llm::message::Message as TaMessage;@@ -35,7 +36,7 @@ use crate::agent::harness::run_queue::{QueueMode, QueuedMessage, RunQueue};use crate::core::bus::BUS;use crate::core::events::DomainEvent;-use super::orchestration::{self, TaskId};+use super::host::steering::shared_steering_registry;/// Framing prepended to a queued **steer** message when it is injected as a user/// turn. Kept as a shared const so the residual-requeue path can strip it and@@ -210,7 +211,7 @@ impl Drop for SteeringForwarderGuard {// 2. Deregister the sub-agent steering handle so an aborted run does not// leak a registry entry keyed by a dead handle.if let Some(task_id) = self.registry_task_id.take() {- orchestration::shared_steering_registry().deregister(&task_id);+ shared_steering_registry().deregister(&task_id);tracing::debug!(task_id = task_id.as_str(),"[tinyagents] deregistered subagent steering handle (guard drop)"diff --git a/crates/openhuman-core/src/agent/tinyagents/topology.rs b/crates/openhuman-core/src/agent/tinyagents/topology.rsindex f8de993d6d..b947e828f4 100644--- a/crates/openhuman-core/src/agent/tinyagents/topology.rs+++ b/crates/openhuman-core/src/agent/tinyagents/topology.rs@@ -49,7 +49,7 @@ pub(crate) fn all_graph_topologies() -> Vec<GraphTopologyReport> {out.push(describe("agent_teams:member", &t));}- if let Ok(t) = super::delegation::delegation_graph_topology() {+ if let Ok(t) = tinyagents_graph::delegation::delegation_graph_topology() {out.push(describe("delegation", &t));}diff --git a/crates/openhuman-core/src/agent/tinyagents/topology_tests.rs b/crates/openhuman-core/src/agent/tinyagents/topology_tests.rsindex a74d73567b..0acd363a63 100644--- a/crates/openhuman-core/src/agent/tinyagents/topology_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/topology_tests.rs@@ -62,7 +62,7 @@ fn all_topologies_names_do_not_collide_with_production_tools() {let http = crate::config::HttpRequestConfig::default();let agents = std::collections::HashMap::new();- let tools = crate::tools::all_tools(+ let tools = crate::tools::ops::all_tools(config.clone(),&security,audit,@@ -92,7 +92,7 @@ fn all_topologies_names_do_not_collide_with_production_tools() {#[test]fn delegation_topology_names_the_revision_loop_nodes() {- let t = super::super::delegation::delegation_graph_topology().expect("builds");+ let t = tinyagents_graph::delegation::delegation_graph_topology().expect("builds");let names: Vec<&str> = t.nodes.iter().map(|n| n.id.as_str()).collect();for expected in ["plan", "execute", "review", "finalize"] {assert!(diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rsindex b216ce30ea..fd68a7bcc7 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs@@ -28,6 +28,7 @@ use crate::agent::harness::{run_queue::RunQueue, MAX_SPAWN_DEPTH};use crate::agent::messages::ChatMessage;use crate::agent::progress::AgentProgress;use crate::agent::tinyagents::harness_assembly::{assemble_turn_harness, AssembledTurnHarness};+use crate::agent::tinyagents::host::steering::shared_steering_registry;use crate::agent::tinyagents::middleware::TurnContextMiddleware;use crate::agent::tinyagents::observability::{CapPauser, OpenhumanEventBridge, SubagentScope};use crate::agent::tinyagents::run_cancellation_context::with_run_cancellation;@@ -38,7 +39,8 @@ use crate::agent::tinyagents::turn_outcome::TinyagentsTurnOutcome;use crate::agent::tinyagents::turn_policy::effective_max_iterations;use crate::agent::tinyagents::turn_run_error::map_turn_run_error;use crate::agent::tinyagents::turn_run_finalize::finalize_turn_outcome;-use crate::agent::tinyagents::{journal, orchestration, routes, steering_forwarder};+use crate::agent::tinyagents::{journal, routes, steering_forwarder};+use tinyagents_harness::ids::TaskId;use super::ToolPolicyEnforcement;@@ -550,8 +552,8 @@ pub(crate) async fn run_turn_via_tinyagents_shared(// turn for the shared run queue.let steering_forwarder_guard = if let Some(handle) = handle {let registry_task_id = if let Some(scope) = &subagent_scope {- let task_id = orchestration::TaskId::new(scope.task_id.clone());- orchestration::shared_steering_registry().register(task_id.clone(), handle.clone());+ let task_id = TaskId::new(scope.task_id.clone());+ shared_steering_registry().register(task_id.clone(), handle.clone());tracing::debug!(task_id = scope.task_id.as_str(),"[tinyagents] registered subagent steering handle"diff --git a/crates/openhuman-core/src/agent/dispatcher.rs b/crates/openhuman-core/src/agent/tool_dialect.rssimilarity index 99%rename from crates/openhuman-core/src/agent/dispatcher.rsrename to crates/openhuman-core/src/agent/tool_dialect.rsindex a28c6d2aea..7e1d93cdd7 100644--- a/crates/openhuman-core/src/agent/dispatcher.rs+++ b/crates/openhuman-core/src/agent/tool_dialect.rs@@ -448,6 +448,9 @@ impl ToolDispatcher for NativeToolDispatcher {}}+#[cfg(test)]+#[path = "pformat_tests.rs"]+mod pformat_tests;#[cfg(test)]#[path = "dispatcher_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/bin/rss_bench.rs b/crates/openhuman-core/src/bin/rss_bench.rsindex a01b1ad9d2..dd38e7cc9d 100644--- a/crates/openhuman-core/src/bin/rss_bench.rs+++ b/crates/openhuman-core/src/bin/rss_bench.rs@@ -26,7 +26,7 @@use anyhow::{Context, Result};use async_trait::async_trait;-use openhuman_core::agent::dispatcher::NativeToolDispatcher;+use openhuman_core::agent::tool_dialect::NativeToolDispatcher;use openhuman_core::agent::Agent;use openhuman_core::memory::{Memory, MemoryCategory, MemoryEntry, NamespaceSummary, RecallOpts};use openhuman_core::platform::proc_metrics::{diff --git a/crates/openhuman-core/src/integrations/composio/README.md b/crates/openhuman-core/src/integrations/composio/README.mdindex df635c89db..6743d8c8cc 100644--- a/crates/openhuman-core/src/integrations/composio/README.md+++ b/crates/openhuman-core/src/integrations/composio/README.md@@ -172,10 +172,10 @@ Published from `ops/` via `crate::core::bus::BUS.publish` (`crate::core::events:- `crate::memory::binding` — the workspace's bound memory driver. Connection-scoped cleanup deletes through `MemorySourceSink::forget_matching`; identity facets and user-scope prefs are also read/written through this binding.- `crate::memory::sync::composio` — still owns the trigger/config-change bus subscribers (this module re-exports them via `bus.rs`) and the `slack` RPC layer re-exported from `providers/mod.rs`.- `crate::agent::harness` — sandbox mode (`current_sandbox_mode` / `SandboxMode`) for tool gating; `current_task_recency_window` consumed by `task_window.rs`.-- `crate::tools::traits` — `Tool`, `ToolResult`, `ToolCategory`, `PermissionLevel`, `ToolCallOptions`.+- `tinytools` — `Tool`, `ToolResult`, `ToolCategory`, `PermissionLevel`, `ToolCallOptions`.- `crate::security` — `SecurityPolicy` / `ToolOperation` for direct-tool gating.- `crate::security::credentials` — encrypted store for the direct-mode API key.-- `crate::agent::context::prompt`, `agent::prompts` — prompt/profile injection of connected identities.+- `crate::agent::prompts`, `agent::prompts` — prompt/profile injection of connected identities.- `crate::core::all` — `ControllerFuture` / `RegisteredController` registry types.- `crate::core::bus` (`BUS`) / `crate::core::events::DomainEvent` — event publish/subscribe.- `crate::core::observability` — Sentry error classification/reporting.diff --git a/crates/openhuman-core/src/integrations/file_storage/README.md b/crates/openhuman-core/src/integrations/file_storage/README.mdindex 889bd8b828..b895c2cba9 100644--- a/crates/openhuman-core/src/integrations/file_storage/README.md+++ b/crates/openhuman-core/src/integrations/file_storage/README.md@@ -95,7 +95,7 @@ outside `build_file_storage_tools`.backend-proxied HTTP client; see the [parent README](../README.md).- `crate::security::SecurityPolicy` — gates the mutating tools underread-only autonomy.-- `crate::tools::traits` — `Tool`, `ToolResult`, `PermissionLevel`,+- `tinytools` — `Tool`, `ToolResult`, `PermissionLevel`,`ToolCategory`.- `tinytools::ToolRunContext` — supplies the TinyAgents workspace root whenrunning inside an agent turn.diff --git a/crates/openhuman-core/src/integrations/mod.rs b/crates/openhuman-core/src/integrations/mod.rsindex 9db8ff9668..939ac1b3f9 100644--- a/crates/openhuman-core/src/integrations/mod.rs+++ b/crates/openhuman-core/src/integrations/mod.rs@@ -15,7 +15,7 @@ pub mod types;pub use client::{build_client, pricing_for_config, IntegrationClient};pub use types::{- BackendResponse, IntegrationPricing, IntegrationPricingEntry, PricingIntegrations, ToolScope,+ BackendResponse, IntegrationPricing, IntegrationPricingEntry, PricingIntegrations,};#[cfg(test)]diff --git a/crates/openhuman-core/src/integrations/tools/twilio.rs b/crates/openhuman-core/src/integrations/tools/twilio.rsindex 5d02f3119c..25b131720d 100644--- a/crates/openhuman-core/src/integrations/tools/twilio.rs+++ b/crates/openhuman-core/src/integrations/tools/twilio.rs@@ -11,12 +11,11 @@//! The backend handles Twilio API credentials, billing, and rate limiting.use super::IntegrationClient;-use crate::integrations::ToolScope;use async_trait::async_trait;use serde::Deserialize;use serde_json::json;use std::sync::Arc;-use tinytools::{PermissionLevel, Tool, ToolResult};+use tinytools::{PermissionLevel, Tool, ToolResult, ToolScope};/// Makes outbound phone calls via the backend Twilio integration.pub struct TwilioCallTool {diff --git a/crates/openhuman-core/src/integrations/types.rs b/crates/openhuman-core/src/integrations/types.rsindex 3e7a94d99d..a4972bf661 100644--- a/crates/openhuman-core/src/integrations/types.rs+++ b/crates/openhuman-core/src/integrations/types.rs@@ -2,9 +2,6 @@use serde::Deserialize;-// Re-export ToolScope from the canonical definition in tools::traits.-pub use tinytools::ToolScope;-// ── Pricing types (fetched from backend) ────────────────────────────/// Per-integration pricing returned by `GET /agent-integrations/pricing`.diff --git a/crates/openhuman-core/src/runtime/node/ops.rs b/crates/openhuman-core/src/runtime/node/ops.rsindex edee9f5754..f4da1b7618 100644--- a/crates/openhuman-core/src/runtime/node/ops.rs+++ b/crates/openhuman-core/src/runtime/node/ops.rs@@ -94,7 +94,7 @@ pub fn build_runtime_tools(config: &Config) -> Result<Vec<Box<dyn Tool>>, String.map_err(|e| e.to_string())?;let runtime: Arc<dyn RuntimeAdapter> = Arc::new(NativeRuntime::new());trace!("[runtime_node::ops] build_runtime_tools: tools::all_tools_with_runtime");- let built = tools::all_tools_with_runtime(+ let built = tools::ops::all_tools_with_runtime(Arc::new(config.clone()),&security,runtime,diff --git a/crates/openhuman-core/src/skills/README.md b/crates/openhuman-core/src/skills/README.mdindex ffb6a70d42..e48a0c1a77 100644--- a/crates/openhuman-core/src/skills/README.md+++ b/crates/openhuman-core/src/skills/README.md@@ -6,7 +6,7 @@ Discovery and parsing of agentskills.io-style skills (a directory containing `SK`pub mod skills` is always compiled — it is a facade. Its behavioural submodules (`ops`, `ops_create`, `ops_discover`, `ops_install`, `ops_parse`, `bundled`, `bus`, `preflight`, `registry`, `run_log`, `schemas`, `search`, `tools`) are gated on the default-ON `skills` Cargo feature; when it is off, [`stub.rs`](stub.rs) takes their place, mirroring **functions only** with no-op/empty bodies (`load_workflow_metadata` → `[]`, `init_workflows_dir` → `Ok(())`, empty controller aggregators) so always-on callers need no `#[cfg]`.-[`types.rs`](types.rs) and [`ops_types.rs`](ops_types.rs) are an ungated carve-out compiled in both directions: they are inert serde/std-only definitions with load-bearing consumers outside this domain — `tools::traits` re-exports `ToolResult`/`ToolContent` from `types` as the crate-wide tool-result type, and `Workflow`/`WorkflowFrontmatter`/`WorkflowScope` from `ops_types` appear in always-on agent-harness and prompt signatures. Gating them would take down the tool trait system, MCP, and the Node runtime. The stub therefore re-exports these types verbatim instead of redeclaring them.+[`types.rs`](types.rs) and [`ops_types.rs`](ops_types.rs) are an ungated carve-out compiled in both directions: they are inert serde/std-only definitions with load-bearing consumers outside this domain — `tinytools` re-exports `ToolResult`/`ToolContent` from `types` as the crate-wide tool-result type, and `Workflow`/`WorkflowFrontmatter`/`WorkflowScope` from `ops_types` appear in always-on agent-harness and prompt signatures. Gating them would take down the tool trait system, MCP, and the Node runtime. The stub therefore re-exports these types verbatim instead of redeclaring them.`catalog` and `runtime` are themselves facade+stub pairs for the same feature, so their `pub mod` lines stay ungated. `webhooks` is ungated outright — it is not part of the `skills` feature at all and has always-compiled callers under `crates/openhuman-core/src/core/`.@@ -22,7 +22,7 @@ Stub signatures must match the real ones exactly; `cargo check --no-default-feat| `ops_install.rs` | Facade over submodules `ops_install/fetch.rs`/`ops_install/url_validation.rs`: the hardened HTTPS skill-URL installer (size cap, timeout clamp, non-https/private-IP/non-SKILL.md rejection, GitHub blob→raw normalization). Localhost HTTP installs require `OPENHUMAN_SKILL_INSTALL_ALLOW_LOCAL_HTTP=1` and are for local fixtures only. || `ops_parse.rs` | Splits `SKILL.md`/`WORKFLOW.md` into frontmatter + body, builds the resource inventory, reads a single resource. || `ops_types.rs` | Ungated carve-out: `Workflow`, `WorkflowFrontmatter`, `WorkflowScope` (`Builtin`, `User`, `Project`, `Legacy`, `Profile`, `Flow`), filename/size constants (`MAX_WORKFLOW_RESOURCE_BYTES = 128 KiB`). |-| `types.rs` | Ungated carve-out: `ToolResult`/`ToolContent`, the crate-wide tool-result content-block types re-exported through `tools::traits`. |+| `types.rs` | Ungated carve-out: `ToolResult`/`ToolContent`, the crate-wide tool-result content-block types re-exported through `tinytools`. || `preflight.rs` | Gates that must pass before the orchestrator boots for a `skills_run` (currently the GitHub gate: Composio GitHub connected, `git` on PATH, `user.name`/`user.email` configured, optional strict identity match). Failures surface as a plain `Err` instead of cryptic orchestrator output. || `registry.rs` | A skill is an `AgentDefinition` plus declared `[[inputs]]`, flattened from the same `skill.toml`/`workflow.toml`; `render_inputs_block` renders them into the prompt. Also `prune_legacy_default_workflows`. || `run_log.rs` | Per-run streaming logs at `<workspace>/skills/.runs/<skill>_<UTC-ts>_<run>.log`, written live off the agent's `AgentProgress` channel; read back by `read_run_log_slice`/`scan_runs`. |@@ -53,7 +53,7 @@ Plus the sub-domain namespaces: `skill_registry.*` (`browse`, `search`, `sources## Called by-- `crates/openhuman-core/src/tools/traits.rs` — re-exports `ToolResult`/`ToolContent` from `types.rs` as the shared tool-result shape.+- `tinytools` — supplies the shared `ToolResult`/`ToolContent` shape directly.- `crates/openhuman-core/src/agent/harness/fork_context.rs` — fork context propagates injected skills.- `crates/openhuman-core/src/agent/harness/session/turn/context.rs` and `.../turn/tools.rs` — the per-turn `workflows` list handed to `PromptContext`; `refresh_workflows` reloads it via `load_workflow_metadata_for_profile` when a `WorkflowsChanged` event is drained.- `crates/openhuman-core/src/agent/tools/run_workflow.rs` — the separate `run_workflow`/`AwaitWorkflowTool` launch path.diff --git a/crates/openhuman-core/src/tools/README.md b/crates/openhuman-core/src/tools/README.mdindex bb3a711e99..b708566225 100644--- a/crates/openhuman-core/src/tools/README.md+++ b/crates/openhuman-core/src/tools/README.md@@ -4,7 +4,7 @@ The agent tool layer. Defines the core [`Tool`] trait every agent-callable capab## Responsibilities-- Define the [`Tool`] async trait and its supporting value types (`ToolResult`, `ToolSpec`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`, `ToolExposure`) — sourced from `tinytools` and re-exported through `traits.rs`.+- Use the [`tinytools::Tool`] async trait and its supporting value types (`ToolResult`, `ToolSpec`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`, `ToolExposure`) directly from `tinytools`.- Assemble the registry the agent loop runs against — `default_tools[_with_runtime]` (minimal: shell + file read/write) and `all_tools[_with_runtime]` (full, config-gated set).- Gate registration on config flags / env (`browser.enabled`, `node.enabled`, `runtime_python.enabled`, `learning.*`, `integrations.*`, `search.engine`, `gitbooks.enabled`, MCP registry presence, `OPENHUMAN_LSP_ENABLED`).- Own the cross-cutting built-in tool impls under `impl/` (filesystem, browser, generic system, generic network, meta, and the `documents`-gated document/presentation tools).@@ -22,7 +22,7 @@ The agent tool layer. Defines the core [`Tool`] trait every agent-callable capab| File | Role || --- | --- || `crates/openhuman-core/src/tools/mod.rs` | Export hub. Declares submodules, re-exports the built-in impls and every domain-owned tool set, and the `all_tools_*` controller pair. |-| `crates/openhuman-core/src/tools/traits.rs` | Stable in-crate import path for the `tinytools` vocabulary: `Tool`, `ToolResult`, `ToolContent`, `ToolExposure`, `ToolSpec`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`, `ToolRunContext`, `ToolTimeout`. The per-tool hooks (`permission_level[_with_args]`, `scope`, `category`, `exposure`, `is_concurrency_safe`, `external_effect[_with_args]`, `max_result_size_chars`, `timeout_policy`, `supports_markdown`) are defined on the `tinytools::Tool` trait, not here. Adds three readers over the erased `host_extension` slots: `pack_registry_handle`, `delegation_target`, `generated_runtime_context`. |+| `crates/openhuman-core/src/tools/host_extensions.rs` | OpenHuman-only readers over erased `host_extension` slots: `pack_registry_handle`, `delegation_target`, and `generated_runtime_context`. Import the shared `Tool` vocabulary from `tinytools` directly. || `crates/openhuman-core/src/tools/ops.rs` | Registry assembly: `default_tools`, `default_tools_with_runtime`, `all_tools`, `all_tools_with_runtime`, `browser_allowed_domains`. All config-gating logic lives here. || `crates/openhuman-core/src/tools/schemas.rs` (thin shell over the `schemas/` submodule: `apify.rs`, `composio.rs`, `registry.rs`, `web_search.rs`) | JSON-RPC `tools` namespace controllers + `handle_*` fns. `all_controller_schemas` / `all_registered_controllers` (re-exported as `all_tools_*`). || `crates/openhuman-core/src/tools/policy.rs` | `ToolPolicy` trait + `PolicyDecision` (`Allow`/`Deny`) + allow-all `DefaultToolPolicy`. Evaluated on the agent hot path before each `execute()`. |@@ -49,7 +49,7 @@ The agent tool layer. Defines the core [`Tool`] trait every agent-callable capab## Public surface- Trait + types: `Tool`, `ToolSpec`, `ToolResult`, `ToolContent`, `ToolExposure`, `PermissionLevel`, `ToolScope`, `ToolCategory`, `ToolCallOptions`.-- Registry constructors: `default_tools`, `default_tools_with_runtime`, `all_tools`, `all_tools_with_runtime` (via `pub use ops::*`).+- Registry constructors: `ops::default_tools`, `ops::default_tools_with_runtime`, `ops::all_tools`, `ops::all_tools_with_runtime`.- Policy: `ToolPolicy`, `DefaultToolPolicy`, `PolicyDecision`.- Schema: `SchemaCleanr`, `CleaningStrategy`.- Controllers: `all_tools_controller_schemas`, `all_tools_registered_controllers`.@@ -104,7 +104,7 @@ None. No `store.rs`; the module holds no persisted state. Tools that persist (me- `crate::integrations::composio` — `all_composio_agent_tools`, mode-aware client (`create_composio_client`) for `openhuman.tools_composio_execute`.- `crate::runtime::javascript` / `crate::runtime::python` — `NodeBootstrap` shared by shell/node_exec/npm_exec (behind `runtime-node`), `PythonBootstrap` for `python_exec`.- `crate::mcp::config_servers` (`McpServerRegistry` behind the `mcp_*` bridge tools and the gitbooks MCP source) and `crate::mcp::registry` (tool re-exports; `connections` for the discovery registry) — `mcp` feature.-- `tinytools` (vendored via `vendor/tinyagents/`) — the `Tool` trait itself and its vocabulary, re-exported through `traits.rs`.+- `tinytools` (vendored via `vendor/tinyagents/`) — the `Tool` trait itself and its vocabulary, imported directly by each consumer.- `crate::skills` — skill-run spawning and skill-owned tools (`skills` feature).- `crate::agent::learning` — LinkedIn enrichment scrape/render for the Apify RPC handler.- `crate::web3::wallet`, `crate::cron`, `crate::voice::audio_toolkit` — domain-owned tools re-exported and registered (behind their respective features).@@ -115,7 +115,7 @@ None. No `store.rs`; the module holds no persisted state. Tools that persist (me## Used by- `crates/openhuman-core/src/core/all.rs` — registers the `tools` RPC controllers + schemas.-- `crate::agent` harness (`agent/harness/session/builder/`, `dispatcher`, `subagent_runner`, `agent/tools/*`) and the `crate::agent::tinyagents` seam (`SharedToolAdapter`, `ToolPolicyMiddleware`) — primary consumers; build the registry and execute/police tools on the tinyagents harness path.+- `crate::agent` harness (`agent/harness/session/builder/`, `tool_dialect`, `subagent_runner`, `agent/tools/*`) and the `crate::agent::tinyagents` seam (`SharedToolAdapter`, `ToolPolicyMiddleware`) — primary consumers; build the registry and execute/police tools on the tinyagents harness path.- `crate::channels::runtime::dispatch::routing` — calls `orchestrator_tools::collect_orchestrator_tools` to build per-subagent orchestrator tool sets.- `crate::tools::agent_policy`, `crate::security::approval` — read tool metadata (category, external-effect) for policy/approval decisions.- `crate::tools::registry` (reads `all_tools_controller_schemas`) and `crate::mcp::server` (reuses `SEARXNG_MAX_RESULTS` / `normalize_categories` for its stdio tool specs).@@ -124,7 +124,7 @@ None. No `store.rs`; the module holds no persisted state. Tools that persist (me## Notes / gotchas- **Ownership rule**: only genuinely cross-cutting tool families (filesystem, browser, generic system/network, meta, and the `documents`-gated document/presentation tools) belong in `impl/`. New domain tools go in the owning domain's `tools.rs` and are re-exported via `mod.rs` — do not add them under `impl/`.-- **One unified `ToolResult`**: `traits.rs` re-exports it from `tinytools`, so every tool uses the same type.+- **One unified `ToolResult`**: every tool imports it from `tinytools`, so every tool uses the same type.- **Browser allowlist is fail-safe**: the browser shares `http_request.allowed_domains` but `browser_allowed_domains` strips the `"*"` wildcard — unifying can only narrow browser reach. Allow-all stays behind `OPENHUMAN_BROWSER_ALLOW_ALL`.- **Node tools are co-gated**: `shell`, `node_exec`, and `npm_exec` share one memoised `NodeBootstrap`; with `node.enabled = false` (or the `runtime-node` feature off), node/npm tools are not registered and shell skips PATH injection.- **`external_effect_with_args`** is the hook the harness checks at the gate-decision point (not the arg-less variant) — override it for per-call gating (e.g. composio `execute` vs `list`).diff --git a/crates/openhuman-core/src/tools/mod.rs b/crates/openhuman-core/src/tools/mod.rsindex 010f45294d..5ed1ecf8ee 100644--- a/crates/openhuman-core/src/tools/mod.rs+++ b/crates/openhuman-core/src/tools/mod.rs@@ -61,7 +61,6 @@ pub use crate::voice::audio_toolkit::tools::*;#[cfg(feature = "web3")]pub use crate::web3::wallet::tools::*;pub use implementations::*;-pub use ops::*;pub use policy::{DefaultToolPolicy, PolicyDecision, ToolPolicy};#[allow(unused_imports)]pub use schema::{CleaningStrategy, SchemaCleanr};diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rsindex 2551488b6d..d28c028992 100644--- a/crates/openhuman-core/src/tools/ops.rs+++ b/crates/openhuman-core/src/tools/ops.rs@@ -7,6 +7,7 @@ use crate::runtime::python::PythonBootstrap;use crate::security::{AuditLogger, SecurityPolicy};use std::collections::HashMap;use std::sync::Arc;+use tinytools::Tool;pub(crate) use super::capability::tool_capability;diff --git a/crates/openhuman-core/src/tools/orchestrator_tools.rs b/crates/openhuman-core/src/tools/orchestrator_tools.rsindex 4795667e33..bd8927dd63 100644--- a/crates/openhuman-core/src/tools/orchestrator_tools.rs+++ b/crates/openhuman-core/src/tools/orchestrator_tools.rs@@ -37,8 +37,9 @@ use crate::agent::prompts::ConnectedIntegration;// temporarily disabled (see tinyhumansai/openhuman#1624).#[allow(unused_imports)]use super::SpawnWorkerThreadTool;-use super::{ArchetypeDelegationTool, SkillDelegationTool, Tool};+use super::{ArchetypeDelegationTool, SkillDelegationTool};use crate::agent::orchestration::tools::DelegationTarget;+use tinytools::Tool;/// Synthesise the delegation tool list for an agent based on its/// declarative `subagents` field.diff --git a/crates/openhuman-core/src/tools/toolpacks/README.md b/crates/openhuman-core/src/tools/toolpacks/README.mdindex f682ea0d10..db69c4546f 100644--- a/crates/openhuman-core/src/tools/toolpacks/README.md+++ b/crates/openhuman-core/src/tools/toolpacks/README.md@@ -40,7 +40,7 @@ constructed and executable but unadvertised: the agent sees one small tool,lives — and each must be rebound after its `Arc` is replaced, or packedtools degrade to "skill unavailable" / "no tool in skill". The handle rideson `Tool::host_extension` and is read back by- `tools::traits::pack_registry_handle`.+ `tools::host_extensions::pack_registry_handle`.- `ops::strip_packed_from_visible` does the actual compression: it removes apack's tool names from an agent's advertised `visible` set (only those whosegroup is `Withheld`) and adds `use_skill` back in only if something was@@ -93,7 +93,7 @@ to that delegate, not a second skill runtime.- `tools/ops.rs` — `all_tools_with_runtime` drops every tool whose group is`Off`, then appends `use_skill` via `append_pack_tools`.-- `tools/traits.rs` — `pack_registry_handle` reads the handle back off a+- `tools/host_extensions.rs` — `pack_registry_handle` reads the handle back off atool's `host_extension`.- `core/runtime/builder.rs` and `core/runtime/context.rs` —`CoreBuilder::tool_groups` and the ambient `ToolGroups` on `CoreContext`.diff --git a/crates/openhuman-core/src/voice/audio_toolkit/README.md b/crates/openhuman-core/src/voice/audio_toolkit/README.mdindex 5c5b66100c..fed3c7cbd6 100644--- a/crates/openhuman-core/src/voice/audio_toolkit/README.md+++ b/crates/openhuman-core/src/voice/audio_toolkit/README.md@@ -68,7 +68,7 @@ No durable domain store. Side effects are filesystem writes within the workspace- `crate::channels::email_channel::EmailChannel` — SMTP delivery of the built message.- `crate::config::Config` / `config::rpc` — workspace dir, `local_ai.tts_provider`, `channels_config.email`; `load_config_with_timeout` in RPC handlers.- `crate::security` — `SecurityPolicy` / `ToolOperation` to gate the agent tools.-- `crate::tools::traits` — `Tool`, `ToolResult`, `PermissionLevel`.+- `tinytools` — `Tool`, `ToolResult`, `PermissionLevel`.- `crate::core::all` / `crate::core` — `RegisteredController`, `ControllerFuture`, `ControllerSchema`, `FieldSchema`, `TypeSchema` for RPC registration.- `crate::rpc::RpcOutcome` — controller/op return contract.- External crates: `lettre` (email message + attachment), `base64`, `chrono`, `uuid`.diff --git a/crates/openhuman-core/src/web3/wallet/README.md b/crates/openhuman-core/src/web3/wallet/README.mdindex 489d746cdf..184c1af5bd 100644--- a/crates/openhuman-core/src/web3/wallet/README.md+++ b/crates/openhuman-core/src/web3/wallet/README.md@@ -97,7 +97,7 @@ Owned in `tools/`, re-exported via `tools.rs`:- `WalletTxReceiptTool` — `wallet_tx_receipt`- `WalletLookupTxTool` — `wallet_lookup_tx`-All implement `crate::tools::traits::Tool` and delegate to the matching `wallet::*` functions. (There is no agent tool for `execute_prepared` here; execution is reached via RPC.)+All implement `tinytools::Tool` and delegate to the matching `wallet::*` functions. (There is no agent tool for `execute_prepared` here; execution is reached via RPC.)## Events@@ -116,7 +116,7 @@ None. The module publishes/subscribes no `DomainEvent`s and has no `bus.rs`. Cha- `crate::security::encryption::rpc` (`encrypt_secret`/`decrypt_secret`) — chain executors decrypt the recovery phrase before handing it to the wallet module.- `crate::modules::wallet` (`derive_account`, `sign_transaction_in_module`, `sign_message`) — the loaded `tinywallet` native module does every derivation and signature; the phrase is only sent after the module passes the attestation check (`modules::wallet::attested_proxy`).- `crate::security::approval::APPROVAL_CHAT_CONTEXT` — task-local chat owner (`thread_id`/`client_id`) used to bind quotes to their originating thread.-- `crate::tools::traits` — `Tool`/`ToolResult`/`ToolCallOptions` for the agent tools.+- `tinytools` — `Tool`/`ToolResult`/`ToolCallOptions` for the agent tools.- `crate::core::all` (`ControllerFuture`, `RegisteredController`) and `crate::core` (`ControllerSchema`, `FieldSchema`, `TypeSchema`) — RPC controller registry wiring.- `crate::rpc::RpcOutcome` — standard RPC return shape.- `tinywallet-bus` (`vendor/tinywallet/crates/tinywallet-bus`, optional, gated by the `web3` feature; features `btc`, `evm`, `solana`, `tron`, `keccak`, `net`, `wire`, `eip712`, `abi`, `tx-codec`) — the contract crate. It owns address formats (parsing/validation/conversion) and the wire types crossing the `Transport` seam (`SecretMaterial`, `TransactionSpec`, `NetworkId`), the ERC-20/EIP-712 encoders, and the Tron verifier. Per Cargo.toml's own rationale: taken as the contract crate and NOT the root `tinywallet` crate — key derivation, transaction building, signing and the chain clients (including the `bitcoin` crate and its native secp256k1 build) live inside that loaded module now, so this binary links none of it. The root `tinywallet` crate is still a dev-dependency, used only so test fixtures can derive a known account from a BIP-39 vector phrase.diff --git a/docs/specs/agent-runtime-upstream-boundary.md b/docs/specs/agent-runtime-upstream-boundary.mdindex a9e8e3e476..fcb3b5a519 100644--- a/docs/specs/agent-runtime-upstream-boundary.md+++ b/docs/specs/agent-runtime-upstream-boundary.md@@ -129,7 +129,7 @@ the labels remain useful for review and completion tracking:| Package | Required result || --- | --- |-| **A — direct imports and facade purge** | Import `tinytools-agent` directly; delete `dispatcher.rs`, `pformat.rs`, `harness/parse.rs`, `harness/instructions.rs`, `harness/tool_filter.rs`, `context/prompt.rs`, `registry/tools.rs`, the handoff wrapper, and behavior-free graph re-exports. |+| **A — direct imports and facade purge** | Import `tinytools-agent` directly; replace `dispatcher.rs` with the host-only `tool_dialect.rs` conversion seam, delete `pformat.rs`, production `harness/parse.rs` re-exports, `harness/instructions.rs`, `harness/tool_filter.rs`, `context/prompt.rs`, `registry/tools.rs`, the handoff wrapper, and behavior-free graph re-exports. || **B — TinyInference ownership** | Move max-token/default/profile decorators, route identity, typed usage/provider metadata, call correlation, and abort-on-drop stream behavior to `tinyinference-llm`. || **C — canonical tool vocabulary** | Use `tinytools::Tool`/`ToolResult` end to end; make the harness bridge canonical tool context into its loop; delete OpenHuman tool adapters and conversions. || **D — live host invocation** | Give `AgentHarness` a real `HostCapabilities`-driven entry point, wire all ten OpenHuman adapters, and replace correctness-sensitive task-locals with explicit recursively inherited `RunContext` data. |@@ -158,8 +158,11 @@ canonical call. OpenHuman tools implement `tinytools::Tool` directly; theAll users import parsing APIs from `tinytools_agent::{...}` or`tinytools_agent::dialect::{...}`. Delete-`tinyagents_harness::tool_calling`, OpenHuman `agent::dispatcher`,-`agent::pformat`, `harness::parse`, and any forwarding definitions.+`tinyagents_harness::tool_calling`, the former OpenHuman `agent::dispatcher`+and `agent::pformat` facades, and any forwarding definitions. The retained+`agent::tool_dialect` module is a host-owned conversion layer for OpenHuman's+persisted transcript and provider types; it imports its protocol primitives+directly from `tinytools_agent`.The same direct-import rule applies between TinyAgents crates. A harness,registry, or graph module must not preserve a former path by publicly@@ -268,7 +271,7 @@ all consumers import the owner directly, not that behavior is dropped.| `triage/` | Keep | OpenHuman trigger business domain and RPC. It invokes the host-driven harness. || `bus.rs` | Keep | Process-wide OpenHuman bus registration. || `cost.rs` | Keep/Split | Keep pricing/tier accounting; model-call usage carrier and aggregation primitives move to inference/harness. |-| `dispatcher.rs` | Delete | Use `tinytools-agent::dialect` directly. |+| `tool_dialect.rs` | Keep/Shrink | Retain only OpenHuman persisted-transcript/provider conversion; import `tinytools-agent::dialect` directly. || `error.rs` | Keep/Shrink | Product-facing errors and RPC mapping only; loop/model/tool errors originate upstream. || `hooks.rs`, `stop_hooks.rs` | Keep adapter | Product hook policy; generic callback/control machinery is harness-owned and values are explicit in context. || `host_runtime.rs`, `platform_shell.rs` | Keep | Host execution/shell policy shared with sandbox. |diff --git a/gitbooks/developing/architecture/agent-harness.md b/gitbooks/developing/architecture/agent-harness.mdindex fd920a6316..30788d7cd0 100644--- a/gitbooks/developing/architecture/agent-harness.md+++ b/gitbooks/developing/architecture/agent-harness.md@@ -229,7 +229,7 @@ Every iteration emits a real-time `AgentProgress` event so the UI can render tokLive turns speak **native tool calling**: the tinyagents harness sends structured tool specs through the `ChatModel` adapter and gets structured tool calls back, for every provider (Claude, GPT, Gemini, local Ollama alike).-The older `ToolDispatcher` trait (`crates/openhuman-core/src/agent/dispatcher.rs`) with its three dialects still exists, but as a **transcript-compatibility layer**, not a live routing choice:+The host `ToolDispatcher` trait (`crates/openhuman-core/src/agent/tool_dialect.rs`) remains as a **transcript-compatibility layer**, not a live routing choice; it calls canonical `tinytools_agent` parsers and renderers directly:- **Native** - structured tool-call fields, the shape live turns produce today.- **XML** - `<tool_call>{...}</tool_call>` tags in assistant text, produced by older sessions.@@ -513,10 +513,10 @@ The harness shell lives under `crates/openhuman-core/src/agent/`, with the tinya| `harness/subagent_runner/` | `run_subagent`, history replay, fork-mode, oversized-result handoff; `ops/graph.rs` is its tinyagents route. || `orchestration/subagent_sessions/` | Durable reusable sub-agent identity, compatibility matching, persisted status/history. || `harness/definition.rs` | `AgentDefinition` - what an archetype declares. |-| `harness/tool_filter.rs` | Toolkit-action ranking for integrations sub-agents. |+| `harness/subagent_runner/ops/runner.rs` | Integration-tool ranking uses canonical `tinyagents_harness::tool` APIs. || `../tinyagents/payload_summarizer.rs` | Oversized-tool-result detour. || `harness/session/tool_progress.rs` | Surviving OpenHuman seam: `TurnProgress`. |-| `dispatcher.rs` | Tool-call dialect abstraction (persisted-transcript compatibility). |+| `tool_dialect.rs` | Persisted-transcript conversion around canonical tool-call dialect APIs. || `triage/` | External-trigger classification + escalation. || `registry/agents/` | Built-in archetypes - one subdirectory per agent. || `hooks.rs` / `stop_hooks.rs` | Post-turn and mid-turn hook surfaces. |diff --git a/scripts/ci/agent-runtime-boundary-baseline.json b/scripts/ci/agent-runtime-boundary-baseline.jsonindex 2b41e8b545..b72e02450d 100644--- a/scripts/ci/agent-runtime-boundary-baseline.json+++ b/scripts/ci/agent-runtime-boundary-baseline.json@@ -1,305 +1,4 @@[- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/agent_tests.rs",- "line": 27,- "text": "use crate::agent::dispatcher::{",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/dispatcher_tests.rs",- "line": 2,- "text": "use crate::agent::pformat::PFormatToolParams;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/dispatcher.rs",- "line": 38,- "text": "use crate::agent::pformat::PFormatRegistry;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/graph.rs",- "line": 168,- "text": "use crate::agent::dispatcher::ToolDispatcher;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/graph.rs",- "line": 170,- "text": "crate::agent::dispatcher::NativeToolDispatcher.to_provider_messages(&outcome.conversation)",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/graph.rs",- "line": 175,- "text": "crate::agent::dispatcher::XmlToolDispatcher.to_provider_messages(&outcome.conversation)",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",- "line": 46,- "text": "use crate::agent::harness::parse::parse_tool_calls;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",- "line": 77,- "text": "use crate::agent::harness::parse::parse_tool_calls;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",- "line": 105,- "text": "use crate::agent::harness::parse::parse_tool_calls;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",- "line": 130,- "text": "use crate::agent::harness::parse::parse_tool_calls;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",- "line": 147,- "text": "use crate::agent::harness::parse::parse_tool_calls;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",- "line": 158,- "text": "use crate::agent::harness::parse::parse_tool_calls;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",- "line": 177,- "text": "use crate::agent::harness::parse::parse_tool_calls;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/builder/builder_tests_tool_spec_views_tests.rs",- "line": 133,- "text": ".tool_dispatcher(Box::new(crate::agent::dispatcher::XmlToolDispatcher))",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/builder/factory.rs",- "line": 7,- "text": "use crate::agent::dispatcher::{NativeToolDispatcher, PFormatToolDispatcher, XmlToolDispatcher};",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/builder/factory.rs",- "line": 1058,- "text": "let pformat_registry = crate::agent::pformat::build_registry_from_refs(",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/builder/factory.rs",- "line": 1066,- "text": "let tool_dispatcher: Box<dyn crate::agent::dispatcher::ToolDispatcher> =",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/builder/setters.rs",- "line": 149,- "text": "tool_dispatcher: Box<dyn crate::agent::dispatcher::ToolDispatcher>,",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/runtime_tests.rs",- "line": 2,- "text": "use crate::agent::dispatcher::XmlToolDispatcher;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/runtime_tests.rs",- "line": 171,- "text": "crate::agent::dispatcher::ParsedToolCall {",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/runtime_tests.rs",- "line": 176,- "text": "crate::agent::dispatcher::ParsedToolCall {",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/runtime/turn_helpers.rs",- "line": 5,- "text": "use crate::agent::dispatcher::ParsedToolCall;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/session_tests.rs",- "line": 9,- "text": "use crate::agent::dispatcher::{NativeToolDispatcher, XmlToolDispatcher};",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/turn_checkpoint_and_wrapup_tests.rs",- "line": 42,- "text": "let first_block = crate::agent::harness::parse::extract_json_values(&response)",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/turn_checkpoint_and_wrapup_tests.rs",- "line": 220,- "text": "let registry = crate::agent::pformat::build_registry(&tools);",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/turn_required_output_tests.rs",- "line": 335,- "text": "let first_block = crate::agent::harness::parse::extract_json_values(&response)",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/turn_tests.rs",- "line": 2,- "text": "use crate::agent::dispatcher::{PFormatToolDispatcher, ToolDispatcher, XmlToolDispatcher};",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/turn/mod.rs",- "line": 11,- "text": "use crate::agent::dispatcher::ParsedToolCall;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/session/types.rs",- "line": 11,- "text": "use crate::agent::dispatcher::ToolDispatcher;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs",- "line": 399,- "text": "use crate::agent::dispatcher::ToolDispatcher;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs",- "line": 401,- "text": "crate::agent::dispatcher::NativeToolDispatcher.to_provider_messages(&outcome.conversation)",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs",- "line": 403,- "text": "crate::agent::dispatcher::XmlToolDispatcher.to_provider_messages(&outcome.conversation)",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep_tests.rs",- "line": 265,- "text": "let hits = crate::agent::harness::tool_filter::filter_actions_by_prompt(",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep.rs",- "line": 236,- "text": "use crate::agent::dispatcher::{",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep.rs",- "line": 239,- "text": "use crate::agent::pformat::PFormatRegistry;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs",- "line": 12,- "text": "use crate::agent::dispatcher::ToolExecutionResult;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs",- "line": 3,- "text": "use crate::agent::dispatcher::NativeToolDispatcher;",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/tinyagents/model_g1_usage_tests_tests.rs",- "line": 7,- "text": "fn empty_registry() -> crate::agent::pformat::PFormatRegistry {",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/tinyagents/model_g1_usage_tests_tests.rs",- "line": 8,- "text": "crate::agent::pformat::PFormatRegistry::default()",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/tinyagents/model.rs",- "line": 41,- "text": "fn pformat_registry_from_request(request: &ModelRequest) -> crate::agent::pformat::PFormatRegistry {",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/tinyagents/model.rs",- "line": 48,- "text": "crate::agent::pformat::PFormatToolParams::from_schema(&t.parameters),",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/tinyagents/model.rs",- "line": 74,- "text": "pformat_registry: &crate::agent::pformat::PFormatRegistry,",- "occurrence": 1- },- {- "rule": "openhuman-agent-facade",- "path": "crates/openhuman-core/src/agent/tinyagents/model.rs",- "line": 170,- "text": "&crate::agent::pformat::PFormatRegistry::default(),",- "occurrence": 1- },{"rule": "openhuman-runtime-bridge","path": "crates/openhuman-core/src/agent/harness/graph.rs",@@ -387,7 +86,7 @@{"rule": "openhuman-runtime-bridge","path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",- "line": 92,+ "line": 91,"text": "pub(crate) use turn_runner::run_turn_via_tinyagents_shared;","occurrence": 1},@@ -506,28 +205,28 @@{"rule": "openhuman-runtime-bridge","path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",- "line": 35,+ "line": 36,"text": "use crate::agent::tinyagents::tools::ToolAdapter;","occurrence": 1},{"rule": "openhuman-runtime-bridge","path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",- "line": 79,+ "line": 81,"text": "harness.register_tool(Arc::new(ToolAdapter::new(tool)));","occurrence": 1},{"rule": "openhuman-runtime-bridge","path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",- "line": 201,+ "line": 203,"text": "pub(crate) async fn run_turn_via_tinyagents_shared(","occurrence": 1},{"rule": "openhuman-runtime-bridge","path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",- "line": 256,+ "line": 258,"text": "} = assemble_turn_harness(","occurrence": 1},@@ -758,63 +457,63 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/mod.rs",- "line": 40,+ "line": 38,"text": "pub mod sandbox_context;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/mod.rs",- "line": 42,+ "line": 40,"text": "mod spawn_depth_context;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/mod.rs",- "line": 44,+ "line": 42,"text": "pub mod task_recency_context;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/mod.rs",- "line": 47,+ "line": 44,"text": "pub mod turn_attachments_context;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/mod.rs",- "line": 48,+ "line": 45,"text": "pub mod turn_dispatch_guard;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/mod.rs",- "line": 49,+ "line": 46,"text": "pub mod turn_subagent_usage;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/mod.rs",- "line": 63,+ "line": 60,"text": "pub use sandbox_context::{current_sandbox_mode, with_current_sandbox_mode};","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/mod.rs",- "line": 64,+ "line": 61,"text": "pub(crate) use spawn_depth_context::{current_spawn_depth, with_spawn_depth, MAX_SPAWN_DEPTH};","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/mod.rs",- "line": 66,+ "line": 63,"text": "pub use task_recency_context::{current_task_recency_window, with_task_recency_window};","occurrence": 1},@@ -856,7 +555,7 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/session/builder/factory.rs",- "line": 1518,+ "line": 1517,"text": "let root = crate::agent::turn_workspace::current()?;","occurrence": 1},@@ -1080,7 +779,7 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",- "line": 1731,+ "line": 1729,"text": "crate::agent::harness::turn_subagent_usage::record_subagent_usage(","occurrence": 1},@@ -1213,28 +912,28 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/orchestration/ops.rs",- "line": 167,+ "line": 169,"text": "let parent = current_parent().ok_or(OrchestrationError::NoParentContext)?;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/orchestration/ops.rs",- "line": 399,+ "line": 401,"text": "let handle = tokio::spawn(crate::agent::turn_origin::propagate(","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/orchestration/ops.rs",- "line": 400,+ "line": 402,"text": "crate::agent::turn_workspace::propagate(async move {","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/orchestration/ops.rs",- "line": 402,+ "line": 404,"text": "let result = with_parent_context(parent, async move {","occurrence": 1},@@ -1717,28 +1416,28 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",- "line": 51,+ "line": 50,"text": "pub mod resolved_route;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",- "line": 54,+ "line": 53,"text": "pub(crate) mod run_cancellation_context;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",- "line": 58,+ "line": 57,"text": "pub mod thread_context;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",- "line": 84,+ "line": 83,"text": "pub(crate) use run_cancellation_context::current_run_cancellation;","occurrence": 1},@@ -1913,35 +1612,35 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",- "line": 33,+ "line": 34,"text": "use crate::agent::tinyagents::run_cancellation_context::with_run_cancellation;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",- "line": 476,+ "line": 478,"text": ".then(crate::agent::harness::turn_dispatch_guard::current)","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",- "line": 509,+ "line": 511,"text": "}) = crate::agent::turn_origin::current()","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",- "line": 530,+ "line": 532,"text": ".or_else(|| match crate::agent::turn_origin::current() {","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",- "line": 585,+ "line": 587,"text": "let run_result = with_run_cancellation(cancellation.clone(), async {","occurrence": 1},@@ -2368,7 +2067,7 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/memory/agent/tools.rs",- "line": 121,+ "line": 119,"text": "let parent = current_parent();","occurrence": 1},@@ -2561,76 +2260,6 @@"text": "openhuman_core::agent::progress_sink::with_progress_sink(sink, dispatch).await","occurrence": 1},- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/dispatcher.rs",- "line": 42,- "text": "use tinyagents_harness::tool_calling::dialect::{",- "occurrence": 1- },- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/dispatcher.rs",- "line": 145,- "text": "calls: Vec<tinyagents_harness::tool_calling::ParsedToolCall>,",- "occurrence": 1- },- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/dispatcher.rs",- "line": 260,- "text": "format: tinyagents_harness::tool_calling::dialect::ToolCallFormat,",- "occurrence": 1- },- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/dispatcher.rs",- "line": 262,- "text": "use tinyagents_harness::tool_calling::dialect::ToolCallFormat as Crate;",- "occurrence": 1- },- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/harness/parse.rs",- "line": 15,- "text": "pub(crate) use tinyagents_harness::tool_calling::{",- "occurrence": 1- },- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/harness/parse.rs",- "line": 24,- "text": "pub(crate) use tinyagents_harness::tool_calling::{",- "occurrence": 1- },- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/harness/parse.rs",- "line": 34,- "text": "use tinyagents_harness::tool_calling::ParsedToolCall;",- "occurrence": 1- },- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/pformat.rs",- "line": 23,- "text": "pub use tinyagents_harness::tool_calling::{",- "occurrence": 1- },- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/pformat.rs",- "line": 51,- "text": "tinyagents_harness::tool_calling::build_registry(",- "occurrence": 1- },- {- "rule": "openhuman-tool-calling-facade",- "path": "crates/openhuman-core/src/agent/prompts/sections.rs",- "line": 15,- "text": "use tinyagents_harness::tool_calling::dialect::render_pformat_catalogue;",- "occurrence": 1- },{"rule": "openhuman-upstream-reexport","path": "crates/openhuman-core/src/agent/goals/mod.rs",@@ -2652,20 +2281,6 @@"text": "pub use tinyagents_harness::artifacts::{","occurrence": 1},- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/harness/parse.rs",- "line": 15,- "text": "pub(crate) use tinyagents_harness::tool_calling::{",- "occurrence": 1- },- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/harness/parse.rs",- "line": 24,- "text": "pub(crate) use tinyagents_harness::tool_calling::{",- "occurrence": 1- },{"rule": "openhuman-upstream-reexport","path": "crates/openhuman-core/src/agent/harness/run_queue/mod.rs",@@ -2680,13 +2295,6 @@"text": "pub(crate) use tinyagents_harness::handoff::{","occurrence": 1},- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/harness/tool_filter.rs",- "line": 17,- "text": "pub use tinyagents_harness::tool::MIN_CONFIDENT_HITS;",- "occurrence": 1- },{"rule": "openhuman-upstream-reexport","path": "crates/openhuman-core/src/agent/multimodal.rs",@@ -2708,62 +2316,6 @@"text": "pub use tinyagents_harness::workspace::{","occurrence": 1},- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/pformat.rs",- "line": 23,- "text": "pub use tinyagents_harness::tool_calling::{",- "occurrence": 1- },- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/tinyagents/delegation.rs",- "line": 53,- "text": "pub(crate) use tinyagents_graph::delegation::{",- "occurrence": 1- },- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/tinyagents/delegation.rs",- "line": 67,- "text": "pub(crate) use tinyagents_graph::delegation::{",- "occurrence": 1- },- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",- "line": 25,- "text": "pub(crate) use tinyagents_graph::orchestration::OrchestrationTaskStatus;",- "occurrence": 1- },- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",- "line": 27,- "text": "pub(crate) use tinyagents_graph::orchestration::SteeringRegistry;",- "occurrence": 1- },- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",- "line": 28,- "text": "pub(crate) use tinyagents_graph::orchestration::{",- "occurrence": 1- },- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",- "line": 35,- "text": "pub(crate) use tinyagents_harness::ids::TaskId;",- "occurrence": 1- },- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",- "line": 37,- "text": "pub(crate) use tinyagents_harness::steering::{",- "occurrence": 1- },{"rule": "openhuman-upstream-reexport","path": "crates/openhuman-core/src/agent/todos/ops.rs",@@ -2813,13 +2365,6 @@"text": "pub use tinyagents_harness::tool::{CleaningStrategy, SchemaCleanr, GEMINI_UNSUPPORTED_KEYWORDS};","occurrence": 1},- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/tools/traits.rs",- "line": 22,- "text": "pub use tinytools::{",- "occurrence": 1- },{"rule": "openhuman-upstream-reexport","path": "crates/openhuman-core/src/voice/cloud_transcribe.rs",@@ -3075,7 +2620,7 @@{"rule": "tinyagents-tool-calling-facade","path": "vendor/tinyagents/crates/tinyagents-harness/src/agent_loop/run_loop.rs",- "line": 783,+ "line": 906,"text": "use tinytools_agent::dialect::{DialectResponse, ToolDialect, XmlDialect};","occurrence": 1},diff --git a/tests/agent_builder_public.rs b/tests/agent_builder_public.rsindex 1ac358455e..1b76b057c2 100644--- a/tests/agent_builder_public.rs+++ b/tests/agent_builder_public.rs@@ -1,7 +1,7 @@use anyhow::Result;use async_trait::async_trait;-use openhuman_core::agent::dispatcher::XmlToolDispatcher;use openhuman_core::agent::prompts::SystemPromptBuilder;+use openhuman_core::agent::tool_dialect::XmlToolDispatcher;use openhuman_core::agent::Agent;use openhuman_core::memory::{Memory, MemoryCategory, MemoryEntry};use tinytools::{Tool, ToolResult};diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rsindex 078e017ec5..5ea555f9ed 100644--- a/tests/agent_harness_e2e.rs+++ b/tests/agent_harness_e2e.rs@@ -2359,7 +2359,7 @@ async fn multi_hop_delegation_chain_inner() {mod streaming_support {use async_trait::async_trait;- use openhuman_core::agent::dispatcher::NativeToolDispatcher;+ use openhuman_core::agent::tool_dialect::NativeToolDispatcher;use openhuman_core::agent::Agent;use openhuman_core::config::{AgentConfig, ContextConfig};use openhuman_core::memory::Memory;@@ -4148,8 +4148,8 @@ async fn orchestrator_cannot_call_a_connected_mcp_tool_through_the_raw_registry_mod tool_policy_boundary_placement {use anyhow::Result;use async_trait::async_trait;- use openhuman_core::agent::dispatcher::NativeToolDispatcher;use openhuman_core::agent::prompts::LearnedContextData;+ use openhuman_core::agent::tool_dialect::NativeToolDispatcher;use openhuman_core::agent::Agent;use openhuman_core::config::AgentConfig;use openhuman_core::memory::{diff --git a/tests/agent_turn_overrides_e2e.rs b/tests/agent_turn_overrides_e2e.rsindex 6c40163d7f..0e1b6671a0 100644--- a/tests/agent_turn_overrides_e2e.rs+++ b/tests/agent_turn_overrides_e2e.rs@@ -34,10 +34,10 @@ use std::path::PathBuf;use std::sync::{Arc, Mutex, OnceLock};use tempfile::TempDir;-use openhuman_core::agent::dispatcher::{NativeToolDispatcher, XmlToolDispatcher};use openhuman_core::agent::goals::{runtime as goal_runtime, store as goal_store};use openhuman_core::agent::harness::session::TurnOverrides;use openhuman_core::agent::tinyagents::thread_context::with_thread_id;+use openhuman_core::agent::tool_dialect::{NativeToolDispatcher, XmlToolDispatcher};use openhuman_core::agent::Agent;use openhuman_core::config::{AgentConfig, ContextConfig};use tinyinference_llm::message::Message;@@ -232,7 +232,7 @@ fn agent_with(model: Arc<dyn ChatModel<()>>,tools: Vec<Box<dyn Tool>>,workspace_path: PathBuf,- dispatcher: Box<dyn openhuman_core::agent::dispatcher::ToolDispatcher>,+ dispatcher: Box<dyn openhuman_core::agent::tool_dialect::ToolDispatcher>,) -> Agent {Agent::builder().chat_model(model)diff --git a/tests/calendar_grounding_e2e.rs b/tests/calendar_grounding_e2e.rsindex 66361e53e0..09937ab092 100644--- a/tests/calendar_grounding_e2e.rs+++ b/tests/calendar_grounding_e2e.rs@@ -1,6 +1,6 @@use anyhow::Result;use async_trait::async_trait;-use openhuman_core::agent::dispatcher::NativeToolDispatcher;+use openhuman_core::agent::tool_dialect::NativeToolDispatcher;use openhuman_core::agent::Agent;use tinytools::{PermissionLevel, Tool, ToolResult};diff --git a/tests/raw_coverage/agent_harness_leftovers_raw_coverage_e2e.rs b/tests/raw_coverage/agent_harness_leftovers_raw_coverage_e2e.rsindex e670a3413c..1bd1992ae3 100644--- a/tests/raw_coverage/agent_harness_leftovers_raw_coverage_e2e.rs+++ b/tests/raw_coverage/agent_harness_leftovers_raw_coverage_e2e.rs@@ -6,7 +6,7 @@ use openhuman_core::agent::prompts::{PersonalityRosterEntry, PromptContext, PromptTool, SubagentRenderOptions, SystemPromptBuilder,ToolCallFormat, UserIdentity,};-use openhuman_core::agent::dispatcher::NativeToolDispatcher;+use openhuman_core::agent::tool_dialect::NativeToolDispatcher;use openhuman_core::agent::harness::definition::AgentTier;use openhuman_core::agent::harness::session::Agent;use openhuman_core::agent::harness::{diff --git a/tests/raw_coverage/agent_harness_raw_coverage_e2e.rs b/tests/raw_coverage/agent_harness_raw_coverage_e2e.rsindex 15ff73ee09..bd2635318d 100644--- a/tests/raw_coverage/agent_harness_raw_coverage_e2e.rs+++ b/tests/raw_coverage/agent_harness_raw_coverage_e2e.rs@@ -1,6 +1,6 @@use anyhow::Result;use async_trait::async_trait;-use openhuman_core::agent::dispatcher::NativeToolDispatcher;+use openhuman_core::agent::tool_dialect::NativeToolDispatcher;use openhuman_core::agent::harness::definition::AgentDefinitionRegistry;use openhuman_core::agent::harness::session::Agent;use openhuman_core::agent::harness::{diff --git a/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs b/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rsindex 8f8ea89a17..1ca1aedd8c 100644--- a/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs+++ b/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs@@ -1,6 +1,6 @@use anyhow::Result;use async_trait::async_trait;-use openhuman_core::agent::dispatcher::NativeToolDispatcher;+use openhuman_core::agent::tool_dialect::NativeToolDispatcher;use openhuman_core::agent::harness::session::Agent;use openhuman_core::agent::harness::{run_subagent, with_parent_context, AgentDefinition, DefinitionSource, ModelSpec,diff --git a/tests/raw_coverage/agent_round26_raw_coverage_e2e.rs b/tests/raw_coverage/agent_round26_raw_coverage_e2e.rsindex 3fa8fd3103..93d169b747 100644--- a/tests/raw_coverage/agent_round26_raw_coverage_e2e.rs+++ b/tests/raw_coverage/agent_round26_raw_coverage_e2e.rs@@ -9,7 +9,7 @@ use openhuman_core::agent::prompts::{UserIdentity,};use openhuman_core::agent::debug::{dump_agent_prompt, DumpPromptOptions};-use openhuman_core::agent::dispatcher::NativeToolDispatcher;+use openhuman_core::agent::tool_dialect::NativeToolDispatcher;use openhuman_core::agent::Agent;use openhuman_core::config::AgentConfig;use openhuman_core::memory::{diff --git a/tests/raw_coverage/agent_session_round24_raw_coverage_e2e.rs b/tests/raw_coverage/agent_session_round24_raw_coverage_e2e.rsindex 3750612f90..ce12438906 100644--- a/tests/raw_coverage/agent_session_round24_raw_coverage_e2e.rs+++ b/tests/raw_coverage/agent_session_round24_raw_coverage_e2e.rs@@ -1,6 +1,6 @@use anyhow::Result;use async_trait::async_trait;-use openhuman_core::agent::dispatcher::XmlToolDispatcher;+use openhuman_core::agent::tool_dialect::XmlToolDispatcher;use openhuman_core::agent::hooks::{PostTurnHook, TurnContext};use openhuman_core::agent::Agent;use openhuman_core::config::{AgentConfig, ContextConfig};diff --git a/tests/raw_coverage/agent_session_turn_raw_coverage_e2e.rs b/tests/raw_coverage/agent_session_turn_raw_coverage_e2e.rsindex ccab829f14..413814cd49 100644--- a/tests/raw_coverage/agent_session_turn_raw_coverage_e2e.rs+++ b/tests/raw_coverage/agent_session_turn_raw_coverage_e2e.rs@@ -2,7 +2,7 @@mod noop_memory;use async_trait::async_trait;-use openhuman_core::agent::dispatcher::{NativeToolDispatcher, XmlToolDispatcher};+use openhuman_core::agent::tool_dialect::{NativeToolDispatcher, XmlToolDispatcher};use openhuman_core::agent::harness::definition::AgentTier;use openhuman_core::agent::harness::subagent_runner::run_subagent;use openhuman_core::agent::harness::{@@ -617,7 +617,7 @@ fn agent_with(model: Arc<dyn ChatModel<()>>,tools: Vec<Box<dyn Tool>>,workspace_path: PathBuf,- dispatcher: Box<dyn openhuman_core::agent::dispatcher::ToolDispatcher>,+ dispatcher: Box<dyn openhuman_core::agent::tool_dialect::ToolDispatcher>,config: AgentConfig,context_config: ContextConfig,) -> Agent {diff --git a/tests/raw_coverage/agent_tool_loop_raw_coverage_e2e.rs b/tests/raw_coverage/agent_tool_loop_raw_coverage_e2e.rsindex b798694622..71338c19a1 100644--- a/tests/raw_coverage/agent_tool_loop_raw_coverage_e2e.rs+++ b/tests/raw_coverage/agent_tool_loop_raw_coverage_e2e.rs@@ -4,7 +4,7 @@ use openhuman_core::agent::bus::{register_agent_handlers, AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD,};use openhuman_core::agent::debug::{dump_agent_prompt, DumpPromptOptions};-use openhuman_core::agent::dispatcher::XmlToolDispatcher;+use openhuman_core::agent::tool_dialect::XmlToolDispatcher;use openhuman_core::agent::{Agent, AgentBuilder};use openhuman_core::config::{AgentConfig, MultimodalConfig, MultimodalFileConfig};use openhuman_core::agent::prompts::LearnedContextData;diff --git a/tests/raw_coverage/agent_turn_builder_leftovers_raw_coverage_e2e.rs b/tests/raw_coverage/agent_turn_builder_leftovers_raw_coverage_e2e.rsindex bffcf972d8..cd153ac0ed 100644--- a/tests/raw_coverage/agent_turn_builder_leftovers_raw_coverage_e2e.rs+++ b/tests/raw_coverage/agent_turn_builder_leftovers_raw_coverage_e2e.rs@@ -1,6 +1,6 @@use anyhow::Result;use async_trait::async_trait;-use openhuman_core::agent::dispatcher::{NativeToolDispatcher, XmlToolDispatcher};+use openhuman_core::agent::tool_dialect::{NativeToolDispatcher, XmlToolDispatcher};use openhuman_core::agent::hooks::{PostTurnHook, TurnContext};use openhuman_core::agent::Agent;use openhuman_core::config::{AgentConfig, ContextConfig};diff --git a/tests/raw_coverage/inference_agent_raw_coverage_e2e.rs b/tests/raw_coverage/inference_agent_raw_coverage_e2e.rsindex c8c5b56a11..a319733cfe 100644--- a/tests/raw_coverage/inference_agent_raw_coverage_e2e.rs+++ b/tests/raw_coverage/inference_agent_raw_coverage_e2e.rs@@ -28,7 +28,7 @@ use openhuman_core::agent::bus::{use openhuman_core::agent::debug::{write_prompt_dumps, DumpPromptOptions, DumpedPrompt,};-use openhuman_core::agent::dispatcher::{+use openhuman_core::agent::tool_dialect::{NativeToolDispatcher, PFormatToolDispatcher, ToolDispatcher, ToolExecutionResult,XmlToolDispatcher,};diff --git a/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs b/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rsindex 8d152d7f5a..2d63f65035 100644--- a/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs+++ b/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs@@ -16,7 +16,7 @@ use axum::response::IntoResponse;use axum::routing::post;use axum::{Json, Router};use chrono::{Duration as ChronoDuration, Utc};-use openhuman_core::agent::dispatcher::NativeToolDispatcher;+use openhuman_core::agent::tool_dialect::NativeToolDispatcher;use openhuman_core::agent::harness::session::Agent;use openhuman_core::agent::harness::{run_subagent, with_parent_context, AgentDefinition, ParentExecutionContext, PromptSource,