Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor: move progress and turn origin modules to new paths

Steven Enamakel42bd00979091
diff --git a/crates/openhuman-core/src/agent/agent_turn_progress_release_tests.rs b/crates/openhuman-core/src/agent/agent_turn_progress_release_tests.rs
index 82404f48cb..30cee5f455 100644
--- a/crates/openhuman-core/src/agent/agent_turn_progress_release_tests.rs
+++ b/crates/openhuman-core/src/agent/agent_turn_progress_release_tests.rs
@@ -35,7 +35,7 @@ async fn clearing_progress_after_a_turn_closes_the_receiver() {
while let Some(event) = rx.recv().await {
saw_completed |= matches!(
event,
- crate::agent::progress::AgentProgress::TurnCompleted { .. }
+ crate::progress::AgentProgress::TurnCompleted { .. }
);
}
assert!(saw_completed, "turn must still report TurnCompleted");
diff --git a/crates/openhuman-core/src/agent/bus.rs b/crates/openhuman-core/src/agent/bus.rs
index 4c9b46b9ec..578ef3ff41 100644
--- a/crates/openhuman-core/src/agent/bus.rs
+++ b/crates/openhuman-core/src/agent/bus.rs
@@ -20,8 +20,8 @@ use std::sync::Arc;
use tokio::sync::mpsc;
-use crate::agent::progress::AgentProgress;
-use crate::agent::turn_origin::{self, AgentTurnOrigin};
+use crate::progress::AgentProgress;
+use crate::security::turn_origin::{self, AgentTurnOrigin};
use crate::config::MultimodalConfig;
use crate::core::bus::BUS;
use crate::security::prompt_injection::{
diff --git a/crates/openhuman-core/src/agent/harness/fork_context.rs b/crates/openhuman-core/src/agent/harness/fork_context.rs
index 2a3b8c7504..81f27c447b 100644
--- a/crates/openhuman-core/src/agent/harness/fork_context.rs
+++ b/crates/openhuman-core/src/agent/harness/fork_context.rs
@@ -13,7 +13,7 @@
//! Stashed in `Arc`s so cloning into a child costs a refcount bump
//! rather than a full copy.
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::tinyagents::TurnModelSource;
use crate::config::AgentConfig;
use std::collections::HashSet;
diff --git a/crates/openhuman-core/src/agent/harness/graph.rs b/crates/openhuman-core/src/agent/harness/graph.rs
index d409234a3f..fc323c62cb 100644
--- a/crates/openhuman-core/src/agent/harness/graph.rs
+++ b/crates/openhuman-core/src/agent/harness/graph.rs
@@ -32,7 +32,7 @@ use std::sync::Arc;
use anyhow::Result;
use tokio::sync::mpsc::Sender;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::tinyagents::TurnModelSource;
use crate::agent::tinyagents::TurnSpec;
use crate::config::{MultimodalConfig, MultimodalFileConfig};
@@ -56,7 +56,7 @@ pub(crate) async fn run_channel_turn_via_graph(
multimodal: MultimodalConfig,
multimodal_files: MultimodalFileConfig,
on_progress: Option<Sender<AgentProgress>>,
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
sandbox_mode: tinyagents_definition::SandboxMode,
approval: crate::security::approval::ApprovalTurnContext,
memory_identity: crate::memory::scope::MemoryIdentity,
@@ -119,7 +119,7 @@ pub(crate) async fn run_channel_turn_via_graph(
let scope = crate::attachments::AttachmentAccessScope {
external_channel: matches!(
origin.as_ref(),
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
),
workspace: workspace.clone(),
};
diff --git a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs
index 6bbf8d99a3..b7ed09ddb9 100644
--- a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs
+++ b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs
@@ -188,9 +188,9 @@ pub async fn start_member_run(
// don't cross `tokio::spawn` — capture the caller's turn origin here so the
// worker keeps the label the approval gate needs. Inherit-only: no origin
// in scope means the worker stays unlabelled and fails closed as before.
- let inherited_origin = crate::agent::turn_origin::capture();
+ let inherited_origin = crate::security::turn_origin::capture();
ctx.spawn(async move {
- crate::agent::turn_origin::with_inherited_origin(
+ crate::security::turn_origin::with_inherited_origin(
inherited_origin,
run_member_loop(
&task_ctx,
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index f1dda32d39..a49596a801 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
@@ -644,7 +644,7 @@ async fn run_system_turn_on_thread(
&thread_id,
&run_id,
&prompt,
- crate::agent::turn_origin::AgentTurnOrigin::Cli,
+ crate::security::turn_origin::AgentTurnOrigin::Cli,
)
.await;
diff --git a/crates/openhuman-core/src/agent/orchestration/delegation.rs b/crates/openhuman-core/src/agent/orchestration/delegation.rs
index c1e63dbd30..2b992ff8b1 100644
--- a/crates/openhuman-core/src/agent/orchestration/delegation.rs
+++ b/crates/openhuman-core/src/agent/orchestration/delegation.rs
@@ -17,7 +17,7 @@
use std::sync::Arc;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::subagent_host::{
SubagentRunOptions, SubagentRunStatus, run_subagent_with_parent,
};
diff --git a/crates/openhuman-core/src/agent/orchestration/ops.rs b/crates/openhuman-core/src/agent/orchestration/ops.rs
index 760372034b..339335422f 100644
--- a/crates/openhuman-core/src/agent/orchestration/ops.rs
+++ b/crates/openhuman-core/src/agent/orchestration/ops.rs
@@ -26,7 +26,7 @@ use super::types::{
AgentSnapshot, SpawnAgentRequest, SpawnAgentResponse, WaitAgentOptions, WaitAgentResponse,
};
use crate::agent::harness::fork_context::ParentExecutionContext;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::subagent_host::{
SubagentRunError, SubagentRunOptions, SubagentRunOutcome, SubagentRunStatus, run_subagent,
};
@@ -413,7 +413,7 @@ impl AgentOrchestrationSession {
// carried across the same boundary the parent execution context
// already is. Without the origin the spawned agent's external-effect
// tools reach the approval gate unlabelled and are refused.
- let handle = tokio::spawn(crate::agent::turn_origin::propagate(async move {
+ let handle = tokio::spawn(crate::security::turn_origin::propagate(async move {
mark_running(&task_status_tx);
// The parent rides `options.run_context.parent`, built above.
let result = run_subagent(&definition, &prompt, options).await;
diff --git a/crates/openhuman-core/src/agent/orchestration/spawn_parallel/collect.rs b/crates/openhuman-core/src/agent/orchestration/spawn_parallel/collect.rs
index 29de3b63c5..83f6b1a00a 100644
--- a/crates/openhuman-core/src/agent/orchestration/spawn_parallel/collect.rs
+++ b/crates/openhuman-core/src/agent/orchestration/spawn_parallel/collect.rs
@@ -5,7 +5,7 @@
use serde_json::json;
use tokio::sync::mpsc::Sender;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use tinyagents_orchestration::parallel::{BranchReport, Collected};
use tinytools_std::file_state;
diff --git a/crates/openhuman-core/src/agent/orchestration/spawn_parallel/dispatch.rs b/crates/openhuman-core/src/agent/orchestration/spawn_parallel/dispatch.rs
index 19d7900119..ef89605ad0 100644
--- a/crates/openhuman-core/src/agent/orchestration/spawn_parallel/dispatch.rs
+++ b/crates/openhuman-core/src/agent/orchestration/spawn_parallel/dispatch.rs
@@ -13,7 +13,7 @@ use tokio::sync::mpsc::Sender;
use crate::agent::harness::fork_context::ParentExecutionContext;
use crate::agent::orchestration::worktree;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent_registry::host_definition::AgentDefinition;
use tinyagents_definition::SandboxMode;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/collapsed_delegation.rs b/crates/openhuman-core/src/agent/orchestration/tools/collapsed_delegation.rs
index 2c63c9ed4d..10789e7083 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/collapsed_delegation.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/collapsed_delegation.rs
@@ -51,7 +51,7 @@
//! tool. Naming this one `delegate` would therefore have removed the
//! orchestrator's entire delegation surface for exactly those users, silently.
//!
-//! [`DelegateTool`]: crate::agent::tools::DelegateTool
+//! [`DelegateTool`]: crate::tools::delegate::DelegateTool
//! [`ArchetypeDelegationTool`]: super::ArchetypeDelegationTool
//! [`ToolExposure::Hidden`]: tinytools::ToolExposure::Hidden
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs
index cb2e09dae1..ec849e7e85 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs
@@ -9,7 +9,7 @@
//! appended to the conversation history.
use crate::agent::orchestration::tools::dispatch::{incomplete_stop, stopped_subagent_result};
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::subagent_host::{
SubagentRunOptions, SubagentRunStatus, continue_subagent, continue_subagent_with_parent,
load_subagent_checkpoint,
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
index 461e45fb0b..e6d9d365d3 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
@@ -1,6 +1,6 @@
//! Subagent dispatch logic shared by all agent delegation tools.
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::subagent_host::{
SubagentRunOptions, SubagentRunStatus, run_subagent_with_parent,
};
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs
index fd9e101ec6..25d76ede2b 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs
@@ -7,7 +7,7 @@ use super::super::collapsed_delegation::{
CollapsedDelegationTool, DelegateTarget, dispatch_targets_from_schema,
};
use super::super::delegate_graph::DelegateGraphDispatch;
-use crate::agent::tools::DelegateToolDispatch;
+use crate::tools::delegate::DelegateToolDispatch;
use tinyagents_harness::context::RunConfig;
use tinyagents_harness::tool::ToolDispatch;
use tinyagents_harness::tools::AskClarificationTool;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs
index 09af0ab2f0..02c451ca05 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs
@@ -12,7 +12,7 @@ use crate::agent::orchestration::subagent_sessions::{
SubagentSessionUpsert,
};
use crate::agent::orchestration::tools::dispatch::incomplete_stop;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::subagent_host::{
SubagentRunOptions, SubagentRunStatus, run_subagent_with_parent,
};
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
index bbd41745ce..bb1f00b4be 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
@@ -393,7 +393,7 @@ impl SpawnAsyncSubagentTool {
// the off-task delivery subscriber resolves.
let detached_run_context = detached_parent.data.child();
let mut abort_report = AbortReport::arm(progress_sink.clone(), &definition.id, &task_id);
- let join = dispatch.spawn(crate::agent::turn_origin::propagate(
+ let join = dispatch.spawn(crate::security::turn_origin::propagate(
async move {
let options = SubagentRunOptions {
skill_filter_override: None,
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs
index 505d4df7f8..68c1114078 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs
@@ -13,7 +13,7 @@
//! prompt with a filtered tool list, on a cheaper model where applicable.
//!
use crate::agent::orchestration::tools::dispatch::{incomplete_stop, stopped_subagent_result};
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::subagent_host::{
SubagentRunOptions, SubagentRunOutcome, SubagentRunStatus, run_subagent_with_parent,
};
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/subagent_abort_report.rs b/crates/openhuman-core/src/agent/orchestration/tools/subagent_abort_report.rs
index 6784e639ba..42aaf8bf5a 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/subagent_abort_report.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/subagent_abort_report.rs
@@ -27,7 +27,7 @@
use tokio::sync::mpsc::Sender;
use tokio::sync::mpsc::error::TrySendError;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
/// Error text carried by the synthesised `SubagentFailed`.
pub(crate) const ABORTED_ERROR: &str = "sub-agent was cancelled";
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
index aff62cb386..95817fb41e 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
@@ -99,7 +99,7 @@ async fn spawn_subagent_reports_a_stopped_child_as_a_failed_tool_result() {
let mut stop = None;
while let Ok(event) = progress_rx.try_recv() {
- if let crate::agent::progress::AgentProgress::SubagentCompleted { stop: s, .. } = event {
+ if let crate::progress::AgentProgress::SubagentCompleted { stop: s, .. } = event {
stop = Some(s);
}
}
diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs
index fd2ed4f147..dc8b108d17 100644
--- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs
@@ -68,12 +68,12 @@ pub async fn start_workflow_run(
// origin here and re-scope it around the engine loop — the phases spawn
// sub-agents whose tool calls the approval gate judges by that label.
// Inherit-only: `None` leaves the loop unlabelled and failing closed.
- let inherited_origin = crate::agent::turn_origin::capture();
+ let inherited_origin = crate::security::turn_origin::capture();
let task_ctx = ctx.clone();
ctx.spawn(async move {
match crate::config::ops::load_current_or_init(&task_ctx).await {
Ok(task_config) => {
- crate::agent::turn_origin::with_inherited_origin(
+ crate::security::turn_origin::with_inherited_origin(
inherited_origin,
run_engine_loop(
&task_ctx,
@@ -219,12 +219,12 @@ pub async fn resume_workflow_run(
let task_run_id = id.to_string();
// Same inherit-only origin propagation as `start_workflow_run`: the resumed
// loop runs on a fresh task, which would otherwise drop the caller's label.
- let inherited_origin = crate::agent::turn_origin::capture();
+ let inherited_origin = crate::security::turn_origin::capture();
let task_ctx = ctx.clone();
ctx.spawn(async move {
match crate::config::ops::load_current_or_init(&task_ctx).await {
Ok(task_config) => {
- crate::agent::turn_origin::with_inherited_origin(
+ crate::security::turn_origin::with_inherited_origin(
inherited_origin,
run_engine_loop(
&task_ctx,
diff --git a/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs b/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs
index e8d5ccc1a9..269e858dc0 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs
@@ -3,7 +3,7 @@
use std::collections::BTreeMap;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use tinyagents_harness::observability::trace_export::SpanKind;
use tinyagents_harness::observability::trace_export::serialize::{
MAX_ERROR_MESSAGE_CHARS, MAX_MODEL_CONTENT_CHARS, json_f64, json_str, json_u32, json_u64,
diff --git a/crates/openhuman-core/src/agent/progress_tracing/collector/model_call.rs b/crates/openhuman-core/src/agent/progress_tracing/collector/model_call.rs
index af0f69ab59..803cc4cc05 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/collector/model_call.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/collector/model_call.rs
@@ -40,7 +40,7 @@ impl SpanCollector {
/// ([`generation::normalize_usage`]) and an unpriced model's placeholder
/// cost is dropped ([`generation::effective_cost`]).
#[allow(clippy::too_many_arguments)]
- pub(in crate::agent::progress_tracing) fn record_model_call(
+ pub(in crate::core::observability::progress_tracing) fn record_model_call(
&mut self,
model: &str,
provider_id: &str,
diff --git a/crates/openhuman-core/src/agent/progress_tracing/collector/span_lifecycle.rs b/crates/openhuman-core/src/agent/progress_tracing/collector/span_lifecycle.rs
index e0f77f1a06..a6e33e106a 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/collector/span_lifecycle.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/collector/span_lifecycle.rs
@@ -13,7 +13,7 @@ use super::state::SpanCollector;
impl SpanCollector {
/// Lazily open the root turn span so a stream that begins mid-flight
/// (or never sends `TurnStarted`) still produces a correlated tree.
- pub(in crate::agent::progress_tracing) fn ensure_turn_span(
+ pub(in crate::core::observability::progress_tracing) fn ensure_turn_span(
&mut self,
start_unix_ms: u64,
) -> String {
@@ -83,7 +83,7 @@ impl SpanCollector {
/// The parent any iteration / tool / subagent span should hang off:
/// the current iteration if one is open, else the turn root.
- pub(in crate::agent::progress_tracing) fn active_parent_id(
+ pub(in crate::core::observability::progress_tracing) fn active_parent_id(
&mut self,
now_unix_ms: u64,
) -> String {
@@ -97,7 +97,7 @@ impl SpanCollector {
/// [`MAX_TOOL_CONTENT_CHARS`]. A no-op unless content capture is on
/// (`observability.agent_tracing.capture_content`) — when off, tool I/O
/// never even reaches the in-memory span. `Null` arguments are skipped.
- pub(in crate::agent::progress_tracing) fn capture_tool_arguments(
+ pub(in crate::core::observability::progress_tracing) fn capture_tool_arguments(
&mut self,
index: usize,
arguments: &serde_json::Value,
@@ -122,7 +122,7 @@ impl SpanCollector {
/// Record a tool call's result as the span's `output`, truncated to
/// [`MAX_TOOL_CONTENT_CHARS`]. Same capture gate as
/// [`Self::capture_tool_arguments`]. Empty output is skipped.
- pub(in crate::agent::progress_tracing) fn capture_tool_output(
+ pub(in crate::core::observability::progress_tracing) fn capture_tool_output(
&mut self,
index: usize,
output: &str,
@@ -141,7 +141,7 @@ impl SpanCollector {
}
}
- pub(in crate::agent::progress_tracing) fn close_current_iteration(&mut self, end_unix_ms: u64) {
+ pub(in crate::core::observability::progress_tracing) fn close_current_iteration(&mut self, end_unix_ms: u64) {
if let Some(index) = self.current_iteration_index.take() {
self.close_span(
index,
diff --git a/crates/openhuman-core/src/agent/progress_tracing/collector/state.rs b/crates/openhuman-core/src/agent/progress_tracing/collector/state.rs
index 4421bda805..daf135eb63 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/collector/state.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/collector/state.rs
@@ -113,7 +113,7 @@ pub enum TurnOutcome {
},
}
-/// Pure state machine that folds an [`crate::agent::progress::AgentProgress`]
+/// Pure state machine that folds an [`crate::progress::AgentProgress`]
/// stream into spans.
///
/// Call [`record`](Self::record) for each event (with a millisecond
diff --git a/crates/openhuman-core/src/agent/progress_tracing/journal_projection.rs b/crates/openhuman-core/src/agent/progress_tracing/journal_projection.rs
index 7ea5595d6d..81ce4783ad 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/journal_projection.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/journal_projection.rs
@@ -59,7 +59,7 @@ use tinyagents_harness::events::AgentEvent;
use tinyagents_harness::observability::AgentObservation;
use super::SpanCollector;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use replay::{Replay, json_content_text, turn_outcome_for_failure, user_message_text};
#[path = "journal_replay.rs"]
diff --git a/crates/openhuman-core/src/agent/progress_tracing/journal_replay.rs b/crates/openhuman-core/src/agent/progress_tracing/journal_replay.rs
index 23644afc73..b7d957539c 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/journal_replay.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/journal_replay.rs
@@ -3,8 +3,8 @@
use tinyagents_harness::terminal::{TerminalClass, TerminalOutcome};
-use crate::agent::progress::AgentProgress;
-use crate::agent::progress_tracing::TurnOutcome;
+use crate::progress::AgentProgress;
+use crate::core::observability::progress_tracing::TurnOutcome;
/// One step applied to the [`super::SpanCollector`] while replaying a journal.
///
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_span_tree_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_span_tree_tests.rs
index 8fb012217a..7a67e19d52 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_span_tree_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_span_tree_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use crate::agent::progress_tracing::export::export_spans;
+use crate::core::observability::progress_tracing::export::export_spans;
use tinyagents_harness::observability::trace_export::SpanKind;
use tinyagents_harness::observability::trace_export::serialize::SpanEnvelope;
// ── config ────────────────────────────────────────────────────────────────
@@ -612,7 +612,7 @@ fn turn_span_stamps_user_and_thread_grouping_attributes() {
#[test]
fn envelope_for_maps_configured_backend() {
- use crate::agent::progress_tracing::export::envelope_for;
+ use crate::core::observability::progress_tracing::export::envelope_for;
assert_eq!(envelope_for(AgentTracingBackend::Otel), SpanEnvelope::Otel);
assert_eq!(
envelope_for(AgentTracingBackend::Langfuse),
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs
index 867d87cd8c..b320fa540d 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs
@@ -28,7 +28,7 @@ fn exported_level(spans: &[TraceSpan], name: &str) -> Option<String> {
let payloads = otlp_requests(
spans,
"production",
- &crate::agent::progress_tracing::export_brand(),
+ &crate::core::observability::progress_tracing::export_brand(),
);
payloads
.iter()
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tests.rs
index 3bdd7c8018..b438828881 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tests.rs
@@ -1,7 +1,7 @@
//! Unit tests for the structured tracing export (issue #3886).
use super::*;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::config::schema::{AgentTracingBackend, AgentTracingConfig, ObservabilityConfig};
fn ctx() -> TraceContext {
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_ttft_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_ttft_tests.rs
index ffa8682685..033b3005cd 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_ttft_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_ttft_tests.rs
@@ -138,7 +138,7 @@ fn otlp_exports_completion_start_time_for_langfuse_ttft() {
let payloads = otlp_requests(
&spans,
"production",
- &crate::agent::progress_tracing::export_brand(),
+ &crate::core::observability::progress_tracing::export_brand(),
);
let exported = payloads[0]["resourceSpans"][0]["scopeSpans"][0]["spans"]
.as_array()
diff --git a/crates/openhuman-core/src/agent/prompts/types.rs b/crates/openhuman-core/src/agent/prompts/types.rs
index 6e0a7ca992..740be89688 100644
--- a/crates/openhuman-core/src/agent/prompts/types.rs
+++ b/crates/openhuman-core/src/agent/prompts/types.rs
@@ -201,7 +201,7 @@ pub struct PromptContext<'a> {
/// Empty for non-master agents.
pub personality_roster: Vec<PersonalityRosterEntry>,
/// Pre-loaded global `AGENTS.md` content (`<workspace_dir>/AGENTS.md`),
- /// injected by [`crate::agent::prompts::sections::AgentsInstructionsSection`].
+ /// injected by [`crate::prompts::sections::AgentsInstructionsSection`].
/// `None` when the file is absent/empty or the `agents_md_enabled` config
/// gate is off. Loaded once at system-prompt build time (never re-read per
/// turn) so the frozen system-prompt prefix / KV-cache contract holds.
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index 2fd3269fb2..b8f9d8564b 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -1,7 +1,7 @@
//! `OpenHumanSessionHost::from_config` factory methods and internal `build_session_agent_inner` constructor.
use super::should_synthesize_delegation_tools;
-use crate::agent::host_runtime;
+use crate::modules::tinybox::host_runtime;
use crate::agent::prompts::SystemPromptBuilder;
use crate::agent::session_host::types::OpenHumanSessionHost;
use crate::agent_registry::host_definition::{
diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs
index e53b3cdf23..c850401dab 100644
--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs
+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs
@@ -105,7 +105,7 @@ pub(super) async fn repair_required_output(
history: &[tinyinference_llm::message::Message],
reply: &str,
reply_already_streamed: bool,
- progress: Option<&tokio::sync::mpsc::Sender<crate::agent::progress::AgentProgress>>,
+ progress: Option<&tokio::sync::mpsc::Sender<crate::progress::AgentProgress>>,
iteration: u32,
usage: &mut RepairUsage,
) -> Option<String> {
@@ -152,7 +152,7 @@ pub(super) async fn repair_required_output(
let continuation = format!("\n\n{correction}");
if let Some(progress) = progress {
if let Err(error) = progress
- .send(crate::agent::progress::AgentProgress::TextDelta {
+ .send(crate::progress::AgentProgress::TextDelta {
delta: continuation.clone(),
iteration,
})
diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs
index 02c42de7c5..cd82cee954 100644
--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs
@@ -301,7 +301,7 @@ async fn timed_out_close_keeps_the_usage_of_finished_calls() {
/// accumulator still holds the call.
#[tokio::test(start_paused = true)]
async fn timed_out_repair_keeps_the_usage_of_its_answered_call() {
- use crate::agent::progress::AgentProgress;
+ use crate::progress::AgentProgress;
let source = crate::agent::tinyagents::TurnModelSource::from_model(std::sync::Arc::new(
tinyagents_harness::testkit::ScriptedModel::replies(vec!["no block"]),
));
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
index 056d2c0ef4..4993e7ad2a 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
@@ -391,7 +391,7 @@ impl OpenHumanSessionHost {
/// iteration updates to the UI. Pass `None` to disable.
pub fn set_on_progress(
&mut self,
- tx: Option<tokio::sync::mpsc::Sender<crate::agent::progress::AgentProgress>>,
+ tx: Option<tokio::sync::mpsc::Sender<crate::progress::AgentProgress>>,
) {
// A warm runtime retains the last turn's prelude. Release its sender
// along with the host sender so the finished turn's bridge can drain
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs
index cd1b990c2c..e5f6914207 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs
@@ -29,7 +29,7 @@ impl OpenHumanSessionHost {
pub async fn run_single_with_origin(
&mut self,
message: &str,
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
) -> Result<String> {
self.run_single_with_approval(message, origin, Default::default())
.await
@@ -41,7 +41,7 @@ impl OpenHumanSessionHost {
pub async fn run_single_with_approval(
&mut self,
message: &str,
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
approval: crate::security::approval::ApprovalTurnContext,
) -> Result<String> {
let origin = origin.or_else(|| {
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index 753d16be11..96a3712a8b 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -98,7 +98,7 @@ struct OpenHumanTurnPrelude {
workspace_descriptor: Option<tinytools::WorkspaceDescriptor>,
session_key: String,
session_parent_prefix: Option<String>,
- on_progress: Option<tokio::sync::mpsc::Sender<crate::agent::progress::AgentProgress>>,
+ on_progress: Option<tokio::sync::mpsc::Sender<crate::progress::AgentProgress>>,
run_queue:
Option<Arc<tinyagents_harness::run_queue::RunQueue<crate::agent::queued_turn::QueuedTurn>>>,
host_env: crate::agent::turn_env::HostTurnEnv,
@@ -536,7 +536,7 @@ pub(super) use usage::{account_committed_turn_against_goal, holistic_last_turn_u
impl OpenHumanSessionHost {
pub(super) fn update_runtime_prelude_progress(
&mut self,
- tx: Option<tokio::sync::mpsc::Sender<crate::agent::progress::AgentProgress>>,
+ tx: Option<tokio::sync::mpsc::Sender<crate::progress::AgentProgress>>,
) {
if let Some(prelude) = self
.runtime_state
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit_tests.rs
index d768bb4a33..5be38099f2 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
fn user(text: &str) -> Message {
Message::user(text)
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_progress.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_progress.rs
index 3f76e876a0..10d892c082 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_progress.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_progress.rs
@@ -1,6 +1,6 @@
//! Post-commit progress delivery for a chat turn.
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::tinyagents::host::OpenHumanRunContext;
use tinyagents_harness::turn_stop::TurnStop;
use tinyagents_runtime::CommitReceipt;
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
index 33cc59d6c8..a0eefa8854 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
@@ -18,7 +18,7 @@ fn synthesized_tool_names(
#[tokio::test]
async fn committed_progress_uses_each_turns_receipt_sender() {
- use crate::agent::progress::AgentProgress;
+ use crate::progress::AgentProgress;
use tinyagents_runtime::{
CommitReceipt, ResumeMode, SessionTurnOutcome, TranscriptTurnOptions,
};
@@ -72,7 +72,7 @@ async fn committed_progress_uses_each_turns_receipt_sender() {
/// completion and nobody can find it.
#[tokio::test]
async fn committed_progress_carries_the_sidecar_stop_on_turn_completed() {
- use crate::agent::progress::AgentProgress;
+ use crate::progress::AgentProgress;
use tinyagents_harness::turn_stop::TurnStopKind;
use tinyagents_runtime::{
CommitReceipt, ResumeMode, SessionTurnOutcome, TranscriptTurnOptions,
@@ -147,7 +147,7 @@ fn clearing_progress_releases_warm_prelude_sender() {
/// an event that was dropped.
#[tokio::test]
async fn committed_turn_completion_waits_for_a_full_progress_channel() {
- use crate::agent::progress::AgentProgress;
+ use crate::progress::AgentProgress;
let (tx, mut rx) = tokio::sync::mpsc::channel(1);
tx.send(AgentProgress::TurnStarted).await.unwrap();
@@ -184,7 +184,7 @@ async fn committed_turn_completion_waits_for_a_full_progress_channel() {
/// deadline passes, the committed chat response must still be able to return.
#[tokio::test(start_paused = true)]
async fn committed_turn_completion_is_bounded_when_progress_stalls() {
- use crate::agent::progress::AgentProgress;
+ use crate::progress::AgentProgress;
let (tx, mut rx) = tokio::sync::mpsc::channel(1);
tx.send(AgentProgress::TurnStarted).await.unwrap();
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs
index d1ad11d8ff..de62640755 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs
@@ -11,7 +11,7 @@ impl OpenHumanSessionHost {
pub async fn turn_with_origin(
&mut self,
user_message: &str,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
) -> Result<String> {
self.turn_with_approval(user_message, origin, Default::default())
.await
@@ -24,7 +24,7 @@ impl OpenHumanSessionHost {
pub async fn turn_with_approval(
&mut self,
user_message: &str,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
approval: crate::security::approval::ApprovalTurnContext,
) -> Result<String> {
// The turn's context is bound once, here, before the runtime session
@@ -61,7 +61,7 @@ impl OpenHumanSessionHost {
let root_config = context.root_run_config("openhuman-session");
let mut options = TurnOptions {
request_id: origin.and_then(|origin| match origin {
- crate::agent::turn_origin::AgentTurnOrigin::WebChat { request_id, .. } => {
+ crate::security::turn_origin::AgentTurnOrigin::WebChat { request_id, .. } => {
request_id.clone()
}
_ => None,
diff --git a/crates/openhuman-core/src/agent/session_host/turn/graph.rs b/crates/openhuman-core/src/agent/session_host/turn/graph.rs
index 6da5dc18d5..53585284fe 100644
--- a/crates/openhuman-core/src/agent/session_host/turn/graph.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn/graph.rs
@@ -28,7 +28,7 @@ use std::sync::Arc;
use anyhow::Result;
use tokio::sync::mpsc::Sender;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::tinyagents::middleware::turn_context::TurnContextMiddleware;
use crate::agent::tinyagents::{TinyagentsTurnOutcome, TurnSpec};
use crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS;
diff --git a/crates/openhuman-core/src/agent/session_host/types.rs b/crates/openhuman-core/src/agent/session_host/types.rs
index 445903bfaf..329793627a 100644
--- a/crates/openhuman-core/src/agent/session_host/types.rs
+++ b/crates/openhuman-core/src/agent/session_host/types.rs
@@ -7,7 +7,7 @@
//! crate gaining field access.
use crate::agent::hooks::PostTurnHook;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::prompts::SystemPromptBuilder;
use crate::agent::tinyagents::TurnModelSource;
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs
index dd0a5f3728..4bea14d573 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs
@@ -52,7 +52,7 @@ pub(super) use dispatch::run_subagent_via_graph;
// of the original flat imports now live with the code that uses them, in
// `dispatch.rs` / `transcript.rs` / `threads::worker_mirror`).
#[cfg(test)]
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
#[cfg(test)]
use crate::threads::worker_mirror::{mirror_worker_thread, mirror_worker_thread_from_history};
#[cfg(test)]
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
index 7aeb647ddc..2e8b3c411d 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
@@ -6,7 +6,7 @@ use crate::agent::subagent_host::ops::checkpoint;
use std::collections::HashSet;
use std::sync::Arc;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::subagent_host::types::SubagentRunError;
use crate::agent::tinyagents::{SubagentScope, TurnSpec};
use tinyagents_harness::run_queue::RunQueue;
@@ -267,7 +267,7 @@ pub(in super::super) async fn run_subagent_via_graph(
let task_id = task_id.to_string();
let dispatch = dispatch.clone();
tokio::spawn(async move {
- crate::agent::progress_tracing::export_subagent_journal_trace(
+ crate::core::observability::progress_tracing::export_subagent_journal_trace(
&dispatch,
&config,
&journal_run_id,
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
index 710fbff2d7..9f1a6ab085 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
@@ -84,7 +84,7 @@ async fn typed_mode_model_override_pins_exact_model_for_spawn() {
/// `subagent_tool_result` socket events the parent thread renders.
#[tokio::test]
async fn typed_mode_emits_child_progress_events_when_sink_attached() {
- use crate::agent::progress::AgentProgress;
+ use crate::progress::AgentProgress;
let provider = ScriptedProvider::new(vec![
tool_response("file_read", "{\"path\":\"x\"}"),
@@ -167,7 +167,7 @@ async fn typed_mode_emits_child_progress_events_when_sink_attached() {
/// `subagent_thinking_delta` socket events the parent thread renders live.
#[tokio::test]
async fn typed_mode_forwards_child_text_and_thinking_deltas() {
- use crate::agent::progress::AgentProgress;
+ use crate::progress::AgentProgress;
let provider = ScriptedProvider::new(vec![text_response_with_reasoning(
"the final answer",
diff --git a/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs b/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
index b317b5fcd8..b0f884fb28 100644
--- a/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
@@ -110,10 +110,10 @@ fn hosted_base() -> Arc<crate::agent::tinyagents::host::OpenHumanHostBase> {
fn root_context(
thread_id: &str,
workspace: &str,
- progress: tokio::sync::mpsc::Sender<crate::agent::progress::AgentProgress>,
+ progress: tokio::sync::mpsc::Sender<crate::progress::AgentProgress>,
) -> crate::agent::tinyagents::host::OpenHumanRunContext {
let mut context = crate::agent::tinyagents::host::OpenHumanRunContext::new();
- context.origin = Some(crate::agent::turn_origin::AgentTurnOrigin::WebChat {
+ context.origin = Some(crate::security::turn_origin::AgentTurnOrigin::WebChat {
thread_id: thread_id.to_string(),
client_id: format!("client-{thread_id}"),
request_id: Some(format!("request-{thread_id}")),
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs
index 3fd41a08de..4a10b5f433 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs
@@ -1,7 +1,7 @@
//! The immutable authority view the run exposes to shared tools through the
//! harness's typed state-view seam, and the readers tools use on it.
-use crate::agent::turn_origin::AgentTurnOrigin;
+use crate::security::turn_origin::AgentTurnOrigin;
use tinyagents_definition::SandboxMode;
use std::time::Duration;
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
index 0c72ac6782..9540cb30c3 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -17,12 +17,12 @@ use std::time::Instant;
use tokio::sync::mpsc::Sender;
use crate::agent::harness::fork_context::{AgentContextPreparedSource, ParentExecutionContext};
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::subagent_host::SubagentUsage;
use crate::agent::tinyagents::{
middleware::turn_context::TurnContextMiddleware, turn_policy::ToolPolicyEnforcement,
};
-use crate::agent::turn_origin::AgentTurnOrigin;
+use crate::security::turn_origin::AgentTurnOrigin;
use tinyagents_definition::SandboxMode;
use tinyagents_harness::store::InMemoryStore as ToolResultArtifactIndexStore;
use tinyagents_harness::turn_outcome::{ToolCallOutcome, ToolOutcomeSink};
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
index 0e749a924e..f8207d6147 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
@@ -231,7 +231,7 @@ impl OpenHumanSecurityGate {
/// The origin of the turn this gate authorizes for: the run's own context
/// when it carries one, else the calling task's turn scope.
- fn turn_origin(&self) -> Option<crate::agent::turn_origin::AgentTurnOrigin> {
+ fn turn_origin(&self) -> Option<crate::security::turn_origin::AgentTurnOrigin> {
DispatchCtx::from_weak(self.dispatch.as_ref()).turn_origin_or_scoped()
}
@@ -536,8 +536,8 @@ impl OpenHumanSecurityGate {
if matches!(
self.turn_origin(),
Some(
- crate::agent::turn_origin::AgentTurnOrigin::TrustedAutomation {
- source: crate::agent::turn_origin::TrustedAutomationSource::Cron,
+ crate::security::turn_origin::AgentTurnOrigin::TrustedAutomation {
+ source: crate::security::turn_origin::TrustedAutomationSource::Cron,
..
}
)
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
index 7a6b95c99c..97df0e3fc3 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
@@ -100,7 +100,7 @@ const ALWAYS_RETRYABLE_ON_TIMEOUT: &[&str] = &[
/// The shell agent commands run under on this host, for a nudge that has to
/// say which commands exist.
fn host_shell_description() -> String {
- let shell = match crate::agent::host_runtime::host_shell_flavor() {
+ let shell = match crate::modules::tinybox::host_runtime::host_shell_flavor() {
tinybox_bus::ShellFlavor::Cmd => "cmd.exe",
tinybox_bus::ShellFlavor::Posix => "bash or sh",
};
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs
index da8a2bc1db..c3f67f440b 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs
@@ -6,7 +6,7 @@ async fn attachment_scope_is_request_local_and_contains_only_typed_authority() {
let root = std::path::PathBuf::from("/workspace/project");
let mut data = crate::agent::tinyagents::host::OpenHumanRunContext::new();
data.origin = Some(
- crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+ crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
sender_name: None,
channel: "test".into(),
sender: None,
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability.rs b/crates/openhuman-core/src/agent/tinyagents/observability.rs
index 07705eb3d3..5f3bc6496e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability.rs
@@ -22,7 +22,7 @@ use tinyagents_harness::events::AgentEvent;
use tinyinference_llm::usage::Usage;
#[cfg(test)]
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
pub(crate) use bridge_types::{ProviderUsageCarry, SubagentScope, ToolFailureMap, ToolNameMap};
pub(crate) use event_bridge::OpenhumanEventBridge;
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/bridge_types.rs b/crates/openhuman-core/src/agent/tinyagents/observability/bridge_types.rs
index 59bbcb6e8a..7e29dfe5d0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/bridge_types.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/bridge_types.rs
@@ -7,7 +7,7 @@
use std::sync::{Arc, Mutex};
/// Attribution for child (sub-agent) progress. When present, the bridge routes
-/// events to the `Subagent*` [`AgentProgress`](crate::agent::progress::AgentProgress)
+/// events to the `Subagent*` [`AgentProgress`](crate::progress::AgentProgress)
/// variants (so the parent thread can nest child activity under a live
/// subagent row) instead of the top-level ones. Absent = a parent/top-level
/// turn.
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
index 38b9c6f70f..df757ffb2b 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
@@ -9,7 +9,7 @@ use tokio::sync::mpsc::Sender;
use tinyinference_llm::usage::Usage;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::inference::provider::BilledUsage;
use tinytools::humanize_tool_name;
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs
index 1ee78ddbbb..3848a6acea 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs
@@ -6,7 +6,7 @@
use tinyagents_harness::cache::CacheLayoutEvent;
use tinyagents_harness::events::{AgentEvent, EventListener, EventRecord};
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use tinytools::humanize_tool_name;
use super::event_bridge::OpenhumanEventBridge;
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/tool_progress_projection.rs b/crates/openhuman-core/src/agent/tinyagents/observability/tool_progress_projection.rs
index 5d5f242630..24ed56a7a8 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/tool_progress_projection.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/tool_progress_projection.rs
@@ -1,7 +1,7 @@
//! Projection of `AgentEvent::ToolProgressDetail` onto
//! [`AgentProgress::ToolCallProgress`].
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use super::event_bridge::OpenhumanEventBridge;
diff --git a/crates/openhuman-core/src/agent/tinyagents/steering_forwarder.rs b/crates/openhuman-core/src/agent/tinyagents/steering_forwarder.rs
index 10d4462083..0ab72a2684 100644
--- a/crates/openhuman-core/src/agent/tinyagents/steering_forwarder.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/steering_forwarder.rs
@@ -109,15 +109,15 @@ impl SteeringRegistrar for SharedSteeringRegistrar {
/// interactive/channel parent turn reads the turn origin.
pub(super) fn thread_label(
subagent_scope: Option<&crate::agent::tinyagents::observability::SubagentScope>,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
) -> String {
subagent_scope
.map(|s| s.task_id.clone())
.or_else(|| match origin {
- Some(crate::agent::turn_origin::AgentTurnOrigin::WebChat { thread_id, .. }) => {
+ Some(crate::security::turn_origin::AgentTurnOrigin::WebChat { thread_id, .. }) => {
Some(thread_id.clone())
}
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
reply_target,
..
}) => Some(reply_target.clone()),
diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
index b58bbe8ec2..f82cade496 100644
--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
@@ -99,7 +99,7 @@ pub(crate) fn is_thread_goal_tool(name: &str) -> bool {
/// `CoreContext` is re-scoped with it so a tool that asks "who is acting"
/// answers for this turn and not for whichever turn last set a global.
///
-/// [`AgentTurnOrigin`]: crate::agent::turn_origin::AgentTurnOrigin
+/// [`AgentTurnOrigin`]: crate::security::turn_origin::AgentTurnOrigin
pub(crate) struct TurnOriginScope;
impl ToolExecScope for TurnOriginScope {
diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs
index bf8a2ea9b2..4397f26067 100644
--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs
@@ -98,7 +98,7 @@ impl Tool for OriginObservingTool {
self.0.store(
matches!(
crate::core::runtime::CoreContext::current_turn_origin(),
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
),
Ordering::SeqCst,
);
@@ -119,7 +119,7 @@ async fn shared_adapter_scopes_tool_execution_to_the_run_origin() {
let adapter = shared_tool_adapter(tools, "origin_observer").unwrap();
let mut host = crate::agent::tinyagents::host::OpenHumanRunContext::new();
host.origin = Some(
- crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+ crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
sender_name: None,
channel: "test".into(),
sender: None,
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index bddb413952..2c23fb9b9e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -413,7 +413,7 @@ async fn drive_turn(
)
.await;
if !is_subagent {
- if let Some(crate::agent::turn_origin::AgentTurnOrigin::WebChat {
+ if let Some(crate::security::turn_origin::AgentTurnOrigin::WebChat {
request_id: Some(request_id),
..
}) = run_context.origin.as_ref()
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs
index 06d53c32c7..067c8a4b45 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs
@@ -219,10 +219,10 @@ async fn positive_scoped_tool_limit_caps_hosted_runner_inner() {
fn root_context(
thread_id: &str,
workspace: &str,
- progress: tokio::sync::mpsc::Sender<crate::agent::progress::AgentProgress>,
+ progress: tokio::sync::mpsc::Sender<crate::progress::AgentProgress>,
) -> OpenHumanRunContext {
let mut context = OpenHumanRunContext::new();
- context.origin = Some(crate::agent::turn_origin::AgentTurnOrigin::WebChat {
+ context.origin = Some(crate::security::turn_origin::AgentTurnOrigin::WebChat {
thread_id: thread_id.to_string(),
client_id: format!("client-{thread_id}"),
request_id: Some(format!("request-{thread_id}")),
@@ -396,9 +396,9 @@ async fn a_streamed_delta_reaches_the_progress_channel_exactly_once() {
let mut completed = 0;
while let Ok(event) = events.try_recv() {
match event {
- crate::agent::progress::AgentProgress::TextDelta { delta, .. } => streamed.push(delta),
- crate::agent::progress::AgentProgress::TurnStarted => started += 1,
- crate::agent::progress::AgentProgress::TurnCompleted { .. } => completed += 1,
+ crate::progress::AgentProgress::TextDelta { delta, .. } => streamed.push(delta),
+ crate::progress::AgentProgress::TurnStarted => started += 1,
+ crate::progress::AgentProgress::TurnCompleted { .. } => completed += 1,
_ => {}
}
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
index 32a2427711..742892511e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
@@ -12,7 +12,7 @@ use tinyagents_harness::middleware::AgentRun;
use tinyagents_harness::middleware::{ContextCompressionMiddleware, PromptCacheGuardMiddleware};
use tokio::sync::mpsc::Sender;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::tinyagents::journal::TurnJournal;
use crate::agent::tinyagents::observability::{self, OpenhumanEventBridge, SubagentScope};
use crate::agent::tinyagents::turn_outcome::TinyagentsTurnOutcome;
diff --git a/crates/openhuman-core/src/agent_runs/schemas.rs b/crates/openhuman-core/src/agent_runs/schemas.rs
index 6abc67db60..eae006c2d2 100644
--- a/crates/openhuman-core/src/agent_runs/schemas.rs
+++ b/crates/openhuman-core/src/agent_runs/schemas.rs
@@ -432,7 +432,7 @@ fn handle_triage_evaluate(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
// had. The envelope it builds may name a remote *source*,
// but the request itself is local (#5634).
let origin = crate::triage::local_trigger_origin();
- crate::agent::turn_origin::with_origin(
+ crate::security::turn_origin::with_origin(
origin,
crate::triage::apply_decision(&ctx, run.clone(), &envelope),
)
diff --git a/crates/openhuman-core/src/attachments/mod.rs b/crates/openhuman-core/src/attachments/mod.rs
index b506afb514..35f68bd984 100644
--- a/crates/openhuman-core/src/attachments/mod.rs
+++ b/crates/openhuman-core/src/attachments/mod.rs
@@ -34,7 +34,7 @@ pub(crate) fn attach_request_scope(
) {
let external_channel = matches!(
context.origin,
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
);
let workspace = context
.workspace
@@ -440,7 +440,7 @@ pub(crate) async fn delegation_prompt(
prompt: &str,
args: &serde_json::Value,
workspace: Option<&tinytools::WorkspaceDescriptor>,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
) -> anyhow::Result<String> {
let mut prompt = prompt.to_string();
if let Some(value) = args.get("image_paths") {
@@ -460,7 +460,7 @@ pub(crate) async fn delegation_prompt(
}
if matches!(
origin,
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
) {
anyhow::bail!("local attachment reads are disabled for external channel input");
}
@@ -480,7 +480,7 @@ pub(crate) async fn has_resolvable_image(
ctx: &crate::core::runtime::DispatchCtx,
prompt: &str,
workspace: Option<&tinytools::WorkspaceDescriptor>,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
) -> anyhow::Result<bool> {
let rehydrated = crate::agent::multimodal::rehydrate_image_placeholders(&[
tinyagents_session::transcript::TranscriptMessage::user(prompt),
@@ -499,7 +499,7 @@ pub(crate) async fn has_resolvable_image(
let mut config = ctx.load_config().await.map_err(anyhow::Error::msg)?;
if matches!(
origin,
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
) {
anyhow::bail!("local attachment reads are disabled for external channel input");
}
@@ -582,7 +582,7 @@ pub(crate) async fn stage_turn(
config: Option<&Config>,
workspace: Option<&tinytools::WorkspaceDescriptor>,
thread: Option<&str>,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
) -> anyhow::Result<String> {
if !message.contains("[IMAGE:") && !message.contains("[FILE:") {
return Ok(message.into());
@@ -592,7 +592,7 @@ pub(crate) async fn stage_turn(
.ok_or_else(|| anyhow::anyhow!("attachment intake requires runtime configuration"))?;
if matches!(
origin,
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
) {
config.multimodal_files =
crate::config::MultimodalFileConfig::for_untrusted_channel_input();
@@ -603,7 +603,7 @@ pub(crate) async fn stage_turn(
let scope = AttachmentAccessScope {
external_channel: matches!(
origin,
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
),
workspace: workspace.map(|workspace| workspace.root.clone()),
};
diff --git a/crates/openhuman-core/src/attachments/mod_access_tests.rs b/crates/openhuman-core/src/attachments/mod_access_tests.rs
index e2c1592300..6c098717aa 100644
--- a/crates/openhuman-core/src/attachments/mod_access_tests.rs
+++ b/crates/openhuman-core/src/attachments/mod_access_tests.rs
@@ -2,8 +2,8 @@ use super::*;
const UPLOAD: &str = "caption [FILE:data:text/plain;name=note.txt;base64,YQ==]";
-fn external_origin() -> crate::agent::turn_origin::AgentTurnOrigin {
- crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+fn external_origin() -> crate::security::turn_origin::AgentTurnOrigin {
+ crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
sender_name: None,
channel: "test".into(),
sender: None,
diff --git a/crates/openhuman-core/src/attachments/provider_tests.rs b/crates/openhuman-core/src/attachments/provider_tests.rs
index 7649827706..c4dce5da75 100644
--- a/crates/openhuman-core/src/attachments/provider_tests.rs
+++ b/crates/openhuman-core/src/attachments/provider_tests.rs
@@ -170,7 +170,7 @@ async fn too_many_typed_images_reject_before_read_or_inference() {
#[tokio::test]
async fn external_channel_cannot_rehydrate_a_local_image() {
- use crate::agent::turn_origin::AgentTurnOrigin;
+ use crate::security::turn_origin::AgentTurnOrigin;
let probe = Arc::new(Probe::default());
let wrapper = wrap(
&crate::core::runtime::DispatchCtx::host_default(),
diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rs
index ccb42e1d73..cf52226576 100644
--- a/crates/openhuman-core/src/channels/mod.rs
+++ b/crates/openhuman-core/src/channels/mod.rs
@@ -111,7 +111,7 @@ pub use runtime::test_support;
#[cfg(feature = "channels")]
// Channel system-prompt assembly lives in
-// `crate::agent::context::channels_prompt` alongside the rest of
+// `crate::channels::prompt` alongside the rest of
// the prompt-building code. Re-exported here for callers that used the
// old `channels::build_system_prompt` path.
#[cfg(feature = "channels")]
diff --git a/crates/openhuman-core/src/channels/proactive.rs b/crates/openhuman-core/src/channels/proactive.rs
index 9bf00e5e1e..716c0f5d39 100644
--- a/crates/openhuman-core/src/channels/proactive.rs
+++ b/crates/openhuman-core/src/channels/proactive.rs
@@ -302,9 +302,9 @@ impl EventHandler<DomainEvent> for ProactiveMessageSubscriber {
// agent turn that produced the result, whose tool calls
// must remain subject to the cron effect restriction.
let automation_source =
- crate::agent::turn_origin::TrustedAutomationSource::Background;
- let (outcome, request_id) = crate::agent::turn_origin::with_origin(
- crate::agent::turn_origin::AgentTurnOrigin::TrustedAutomation {
+ crate::security::turn_origin::TrustedAutomationSource::Background;
+ let (outcome, request_id) = crate::security::turn_origin::with_origin(
+ crate::security::turn_origin::AgentTurnOrigin::TrustedAutomation {
job_id: source.clone(),
source: automation_source,
},
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
index 2a3926f070..8a12bc0132 100644
--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
@@ -1,7 +1,7 @@
use super::super::channel::CHANNEL_OUTBOUND_EVENT;
use super::*;
use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};
-use crate::agent::turn_origin::AgentTurnOrigin;
+use crate::security::turn_origin::AgentTurnOrigin;
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};
use std::sync::Mutex;
@@ -27,7 +27,7 @@ async fn relayed_thread_and_external_authority_survive_scoped_spawn() {
.unwrap()
.derive_channel_turn(Some(thread.clone()), None),
async {
- crate::agent::turn_origin::with_origin(origin, async {
+ crate::security::turn_origin::with_origin(origin, async {
let (child_thread, child_agent, child_origin) =
crate::core::runtime::DispatchCtx::ambient()
.spawn(async {
@@ -35,7 +35,7 @@ async fn relayed_thread_and_external_authority_survive_scoped_spawn() {
CoreContext::current_channel_thread(),
CoreContext::scoped()
.and_then(|ctx| ctx.session_agent().map(str::to_owned)),
- crate::agent::turn_origin::current(),
+ crate::security::turn_origin::current(),
)
})
.await
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs
index f984505f23..471645f715 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs
@@ -164,7 +164,7 @@ struct Probe {
name: &'static str,
level: PermissionLevel,
runs: Arc<AtomicUsize>,
- origins: Arc<Mutex<Vec<Option<crate::agent::turn_origin::AgentTurnOrigin>>>>,
+ origins: Arc<Mutex<Vec<Option<crate::security::turn_origin::AgentTurnOrigin>>>>,
}
#[async_trait::async_trait]
@@ -195,7 +195,7 @@ struct OneHostAgent {
config: Config,
reads: Arc<AtomicUsize>,
writes: Arc<AtomicUsize>,
- origins: Arc<Mutex<Vec<Option<crate::agent::turn_origin::AgentTurnOrigin>>>>,
+ origins: Arc<Mutex<Vec<Option<crate::security::turn_origin::AgentTurnOrigin>>>>,
}
impl HostAgentResolver for OneHostAgent {
@@ -394,7 +394,7 @@ async fn bound_channel_runs_its_host_agent() {
assert!(
matches!(
origins.as_slice(),
- [Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { channel, .. })]
+ [Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { channel, .. })]
if channel == "telegram"
),
"the read-only tool ran under the channel's origin: {origins:?}"
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture.rs
index 897b06d53f..b4acc7a5e4 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture.rs
@@ -11,7 +11,7 @@
use tinytools::{PermissionLevel, Tool};
-use crate::agent::turn_origin::AgentTurnOrigin;
+use crate::security::turn_origin::AgentTurnOrigin;
use crate::agent::HostTools;
use crate::config::Config;
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
index 8a942d5227..ef11eb187e 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
@@ -5,8 +5,8 @@ use tokio::sync::mpsc;
use super::posture;
use crate::agent::bus::AgentTurnResponse;
use crate::agent::host_agents::HostAgent;
-use crate::agent::progress::AgentProgress;
-use crate::agent::turn_origin::AgentTurnOrigin;
+use crate::progress::AgentProgress;
+use crate::security::turn_origin::AgentTurnOrigin;
use tinyagents_session::transcript::TranscriptMessage;
/// One channel message, as a host agent's turn needs it.
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs
index b7f32308ef..c1f3a22bb6 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs
@@ -2,8 +2,8 @@
//! to the `agent.run_turn` handler, with the orchestrator's tool scoping.
use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};
-use crate::agent::progress::AgentProgress;
-use crate::agent::turn_origin::AgentTurnOrigin;
+use crate::progress::AgentProgress;
+use crate::security::turn_origin::AgentTurnOrigin;
use crate::channels::context::{ChannelRouteSelection, ChannelRuntimeContext};
use crate::core::bus::BUS;
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
index 7bd943999b..47e2061ba3 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -3,7 +3,7 @@
//! delivering the draft/final reply.
use crate::agent::bus::AgentTurnResponse;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::channels::context::{
compact_sender_history, is_context_window_overflow_error, ChannelRuntimeContext,
};
@@ -406,7 +406,7 @@ pub(crate) async fn process_channel_runtime_message(
// Slack channel cannot use it from their own session — distinct senders
// produce distinct origins, and the wallet preparer / parked-approval
// gates compare these for equality before honouring confirmations.
- let turn_origin = crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+ let turn_origin = crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
sender_name: msg.sender_name.clone(),
channel: msg.channel.clone(),
sender: Some(msg.sender.clone()),
diff --git a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
index 7d9dfe7093..d812f2f287 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
@@ -8,7 +8,7 @@
use super::chat_workload::{resolve_chat_workload, ChatWorkloadResolution};
use super::prompt::format_access_context;
-use crate::agent::host_runtime;
+use crate::modules::tinybox::host_runtime;
use crate::channels::context::ChannelRuntimeContext;
use crate::channels::system_prompt::{ChannelPromptInputs, ChannelSystemPrompt};
use crate::config::Config;
diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rs
index ef3fd4ce8c..1e75ecf833 100644
--- a/crates/openhuman-core/src/channels/runtime/test_support.rs
+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs
@@ -6,7 +6,7 @@ use super::dispatch::{
};
pub use super::startup::test_support::resolve_yuanbao_app_secret_for_test;
use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};
use crate::channels::Channel;
use crate::channels::ChannelSystemPrompt;
diff --git a/crates/openhuman-core/src/channels/tests/identity.rs b/crates/openhuman-core/src/channels/tests/identity.rs
index 88c6d8c589..76b95a0d84 100644
--- a/crates/openhuman-core/src/channels/tests/identity.rs
+++ b/crates/openhuman-core/src/channels/tests/identity.rs
@@ -1,5 +1,5 @@
use super::common::make_workspace;
-use crate::agent::context::channels_prompt::build_system_prompt;
+use crate::channels::prompt::build_system_prompt;
/// `build_system_prompt` loads OpenClaw markdown identity files from the
/// workspace and inlines their contents into the Project Context section.
diff --git a/crates/openhuman-core/src/channels/tests/prompt.rs b/crates/openhuman-core/src/channels/tests/prompt.rs
index b9c1d3bd41..eefb9d3fe5 100644
--- a/crates/openhuman-core/src/channels/tests/prompt.rs
+++ b/crates/openhuman-core/src/channels/tests/prompt.rs
@@ -1,5 +1,5 @@
use super::common::make_workspace;
-use crate::agent::context::channels_prompt::{build_system_prompt, BOOTSTRAP_MAX_CHARS};
+use crate::channels::prompt::{build_system_prompt, BOOTSTRAP_MAX_CHARS};
use tempfile::TempDir;
#[test]
diff --git a/crates/openhuman-core/src/core/all_removed_tests.rs b/crates/openhuman-core/src/core/all_removed_tests.rs
index 45aa1e1114..a3a743640c 100644
--- a/crates/openhuman-core/src/core/all_removed_tests.rs
+++ b/crates/openhuman-core/src/core/all_removed_tests.rs
@@ -32,7 +32,7 @@ fn memory_diff_controllers_are_gone_and_memory_survives() {
/// queried a session index that nothing in `src/` ever writes (permanently
/// empty in production, no frontend consumer). The three `run_ledger`
/// controllers live in the same module and read a table that *is* written
-/// (from `web_chat::progress_bridge` and `agent::progress_tracing`), so they
+/// (from `web_chat::progress_bridge` and `core::observability::progress_tracing`), so they
/// must stay fully registered.
///
/// `run_ledger` is asserted present in the same test on purpose: the removal
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rs
index 621bb51e6e..b60bd6fea4 100644
--- a/crates/openhuman-core/src/core/runtime/context.rs
+++ b/crates/openhuman-core/src/core/runtime/context.rs
@@ -107,7 +107,7 @@ pub struct CoreContext {
/// [`CoreContext::derive_with`].
backend_transport: Option<Arc<dyn crate::backend::transport::BackendTransport>>,
/// Explicit authority on this derived turn context.
- turn_origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ turn_origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
/// Durable relay conversation carried by the immutable turn context.
channel_thread: Option<String>,
/// The agent whose stores a host-installed session store
diff --git a/crates/openhuman-core/src/core/runtime/context_turn_origin.rs b/crates/openhuman-core/src/core/runtime/context_turn_origin.rs
index 761ee07b9a..80003fd083 100644
--- a/crates/openhuman-core/src/core/runtime/context_turn_origin.rs
+++ b/crates/openhuman-core/src/core/runtime/context_turn_origin.rs
@@ -53,13 +53,13 @@ impl CoreContext {
}
/// The turn origin bound to this context, if its entry point supplied one.
- pub(crate) fn turn_origin(&self) -> Option<&crate::agent::turn_origin::AgentTurnOrigin> {
+ pub(crate) fn turn_origin(&self) -> Option<&crate::security::turn_origin::AgentTurnOrigin> {
self.turn_origin.as_ref()
}
/// Typed origin bound to this immutable per-turn context, if supplied by
/// its entrypoint. Missing authority retains library/CLI behavior.
- pub fn current_turn_origin() -> Option<crate::agent::turn_origin::AgentTurnOrigin> {
+ pub fn current_turn_origin() -> Option<crate::security::turn_origin::AgentTurnOrigin> {
Self::scoped_for_turn()
.or_else(|| DEFAULT_CONTEXT.get().cloned())
.and_then(|ctx| ctx.turn_origin.clone())
@@ -70,7 +70,7 @@ impl CoreContext {
/// untouched.
pub async fn scope_with_turn_origin<F: Future>(
ctx: Arc<CoreContext>,
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
fut: F,
) -> F::Output {
CURRENT_CONTEXT
@@ -88,7 +88,7 @@ impl CoreContext {
pub(crate) fn derive_channel_turn(
&self,
thread: Option<String>,
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
) -> Arc<CoreContext> {
let ctx = self;
Arc::new(CoreContext {
diff --git a/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs b/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs
index cec66735b2..4a59562122 100644
--- a/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs
@@ -3,7 +3,7 @@ use super::*;
#[tokio::test]
async fn dispatch_scope_uses_explicit_origin_without_mutating_shared_context() {
let ctx = ctx("/tmp/origin-scope");
- let origin = crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+ let origin = crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
sender_name: None,
channel: "test".into(),
sender: Some("sender".into()),
@@ -14,7 +14,7 @@ async fn dispatch_scope_uses_explicit_origin_without_mutating_shared_context() {
CoreContext::scope_with_turn_origin(ctx.clone(), Some(origin), async {
assert!(matches!(
CoreContext::current_turn_origin(),
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
));
})
.await;
@@ -25,7 +25,7 @@ async fn dispatch_scope_uses_explicit_origin_without_mutating_shared_context() {
#[tokio::test]
async fn missing_child_origin_inherits_bound_external_authority() {
let ctx = ctx("/tmp/origin-inheritance");
- let external = crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+ let external = crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
sender_name: None,
channel: "test".into(),
sender: None,
@@ -38,7 +38,7 @@ async fn missing_child_origin_inherits_bound_external_authority() {
CoreContext::scope_with_turn_origin(parent, None, async {
assert!(matches!(
CoreContext::current_turn_origin(),
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
));
})
.await;
@@ -48,7 +48,7 @@ async fn missing_child_origin_inherits_bound_external_authority() {
#[tokio::test]
async fn explicit_origin_scope_bridges_legacy_and_core_context_without_cross_talk() {
- use crate::agent::turn_origin::{self, AgentTurnOrigin};
+ use crate::security::turn_origin::{self, AgentTurnOrigin};
let run = |workspace: &'static str, channel: &'static str| async move {
let context = ctx(workspace);
@@ -89,7 +89,7 @@ async fn explicit_origin_scope_bridges_legacy_and_core_context_without_cross_tal
#[tokio::test]
async fn bound_external_authority_wins_over_legacy_trusted_automation() {
- use crate::agent::turn_origin::{self, AgentTurnOrigin, TrustedAutomationSource};
+ use crate::security::turn_origin::{self, AgentTurnOrigin, TrustedAutomationSource};
CoreContext::scope(ctx("/tmp/origin-priority"), async {
turn_origin::with_origin(
@@ -138,7 +138,7 @@ async fn bound_external_authority_wins_over_legacy_trusted_automation() {
#[tokio::test]
async fn concurrent_channel_turns_keep_tenant_agent_thread_and_policy_isolated() {
- use crate::agent::turn_origin::{self, AgentTurnOrigin};
+ use crate::security::turn_origin::{self, AgentTurnOrigin};
use crate::core::runtime::{ContextOverlay, DomainSet};
let barrier = Arc::new(tokio::sync::Barrier::new(2));
@@ -210,13 +210,13 @@ async fn concurrent_channel_turns_keep_tenant_agent_thread_and_policy_isolated()
async fn scoped_spawn_does_not_invent_missing_turn_authority() {
CoreContext::scope(ctx("/tmp/origin-missing"), async {
let child = crate::core::runtime::DispatchCtx::ambient()
- .spawn(async { crate::agent::turn_origin::current() })
+ .spawn(async { crate::security::turn_origin::current() })
.await
.unwrap();
assert!(child.is_none());
})
.await;
- assert!(crate::agent::turn_origin::current().is_none());
+ assert!(crate::security::turn_origin::current().is_none());
}
/// Regression: an embedded agent's turn scopes the agent's own derived context
@@ -227,9 +227,9 @@ async fn scoped_spawn_does_not_invent_missing_turn_authority() {
async fn a_turn_origin_survives_a_change_of_context() {
let outer = ctx("/tmp/origin-survives-outer");
let inner = ctx("/tmp/origin-survives-inner");
- let origin = crate::agent::turn_origin::AgentTurnOrigin::TrustedAutomation {
+ let origin = crate::security::turn_origin::AgentTurnOrigin::TrustedAutomation {
job_id: "flow".into(),
- source: crate::agent::turn_origin::TrustedAutomationSource::Workflow {
+ source: crate::security::turn_origin::TrustedAutomationSource::Workflow {
require_approval: true,
},
};
@@ -237,7 +237,7 @@ async fn a_turn_origin_survives_a_change_of_context() {
CoreContext::scope(inner.clone(), async {
assert!(matches!(
CoreContext::current_turn_origin(),
- Some(crate::agent::turn_origin::AgentTurnOrigin::TrustedAutomation { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::TrustedAutomation { .. })
));
// It is the inner context that is scoped (its own state), not the outer.
assert!(CoreContext::current()
@@ -260,14 +260,14 @@ async fn a_turn_origin_survives_a_change_of_context() {
async fn a_contexts_own_origin_wins_over_the_enclosing_turns() {
let outer = ctx("/tmp/origin-own-outer");
let inner = ctx("/tmp/origin-own-inner");
- let own = crate::agent::turn_origin::AgentTurnOrigin::Cli;
- let enclosing = crate::agent::turn_origin::AgentTurnOrigin::DirectChat;
+ let own = crate::security::turn_origin::AgentTurnOrigin::Cli;
+ let enclosing = crate::security::turn_origin::AgentTurnOrigin::DirectChat;
let inner = inner.derive_channel_turn(None, Some(own));
CoreContext::scope_with_turn_origin(outer, Some(enclosing), async {
CoreContext::scope(inner, async {
assert!(matches!(
CoreContext::current_turn_origin(),
- Some(crate::agent::turn_origin::AgentTurnOrigin::Cli)
+ Some(crate::security::turn_origin::AgentTurnOrigin::Cli)
));
})
.await;
diff --git a/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs b/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs
index 7b25b886de..b74e11138b 100644
--- a/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs
+++ b/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs
@@ -170,7 +170,7 @@ impl DispatchCtx {
/// The origin of the turn this call belongs to. Only a bound context
/// supplies one: the process default never carries authority, so an
/// unbound call answers `None` and the gate reads it as `Unknown`.
- pub fn turn_origin(&self) -> Option<crate::agent::turn_origin::AgentTurnOrigin> {
+ pub fn turn_origin(&self) -> Option<crate::security::turn_origin::AgentTurnOrigin> {
self.core
.as_ref()
.and_then(|core| core.turn_origin().cloned())
@@ -180,16 +180,16 @@ impl DispatchCtx {
/// calling task's turn scope carries. For a handler whose context was
/// built by a transport that does not carry the turn's origin, while a
/// turn that called it into being still holds it (transitional, #7801).
- pub fn turn_origin_or_scoped(&self) -> Option<crate::agent::turn_origin::AgentTurnOrigin> {
+ pub fn turn_origin_or_scoped(&self) -> Option<crate::security::turn_origin::AgentTurnOrigin> {
self.turn_origin()
.or_else(|| Self::ambient_turn().turn_origin())
}
/// This context with `origin` bound as its turn origin, for a run that
/// acts under a trusted entry point of its own (a saved flow). The base is
/// this context, else the calling task's turn scope, the process default,
- /// or a bare one, the same resolution `agent::turn_origin::with_origin`
+ /// or a bare one, the same resolution `security::turn_origin::with_origin`
/// scopes under. This context is not mutated.
- pub fn with_turn_origin(&self, origin: crate::agent::turn_origin::AgentTurnOrigin) -> Self {
+ pub fn with_turn_origin(&self, origin: crate::security::turn_origin::AgentTurnOrigin) -> Self {
let base = self
.core
.clone()
diff --git a/crates/openhuman-core/src/core/runtime/dispatch_ctx_tests.rs b/crates/openhuman-core/src/core/runtime/dispatch_ctx_tests.rs
index 4e7c944670..756a328d8f 100644
--- a/crates/openhuman-core/src/core/runtime/dispatch_ctx_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/dispatch_ctx_tests.rs
@@ -38,8 +38,8 @@ async fn ambient_reads_the_scoped_context_and_explicit_ignores_it() {
.await;
}
-fn web_origin(thread: &str) -> crate::agent::turn_origin::AgentTurnOrigin {
- crate::agent::turn_origin::AgentTurnOrigin::WebChat {
+fn web_origin(thread: &str) -> crate::security::turn_origin::AgentTurnOrigin {
+ crate::security::turn_origin::AgentTurnOrigin::WebChat {
thread_id: thread.into(),
client_id: "client".into(),
request_id: format!("req-{thread}").into(),
@@ -52,7 +52,7 @@ async fn explicit_turn_origin_wins_over_the_scoped_one_and_does_not_cross() {
let a = Arc::new(base.derive_channel_turn(None, Some(web_origin("a"))));
let b = Arc::new(base.derive_channel_turn(None, Some(web_origin("b"))));
let thread_of = |ctx: &DispatchCtx| match ctx.turn_origin() {
- Some(crate::agent::turn_origin::AgentTurnOrigin::WebChat { thread_id, .. }) => thread_id,
+ Some(crate::security::turn_origin::AgentTurnOrigin::WebChat { thread_id, .. }) => thread_id,
other => panic!("expected a web origin, got {other:?}"),
};
// Scoped to `a`, a context bound to `b` still answers `b`, across awaits
diff --git a/crates/openhuman-core/src/cron/README.md b/crates/openhuman-core/src/cron/README.md
index 5977bc4eb6..a48c244a14 100644
--- a/crates/openhuman-core/src/cron/README.md
+++ b/crates/openhuman-core/src/cron/README.md
@@ -105,7 +105,7 @@ disabled (the default), most policy checks are inert; see the project
`start_cron_turn_clean` sets `suppress_transcript_autoload`. A cron agent has
no thread, so without this its first turn would resume whatever unthreaded
transcript was newest for that agent name.
-6. The turn runs inside `agent::turn_origin::with_origin` with the origin from
+6. The turn runs inside `security::turn_origin::with_origin` with the origin from
`origin::turn_origin_for_job_run`. The morning briefing job also runs under a
24 hour task-recency window so task-fetch tools only return recent tasks.
diff --git a/crates/openhuman-core/src/cron/origin.rs b/crates/openhuman-core/src/cron/origin.rs
index 25f8210ef6..df03404d4e 100644
--- a/crates/openhuman-core/src/cron/origin.rs
+++ b/crates/openhuman-core/src/cron/origin.rs
@@ -7,7 +7,7 @@
//! from an external channel keeps running as that channel's turn, so its own
//! external-effect tools stay gated exactly like its creator's were.
-use crate::agent::turn_origin::{self, AgentTurnOrigin};
+use crate::security::turn_origin::{self, AgentTurnOrigin};
use serde_json::Value;
use {
tinyflows_schedule::types::delivery_mode, tinyflows_schedule::types::CronJob,
diff --git a/crates/openhuman-core/src/cron/origin_tests.rs b/crates/openhuman-core/src/cron/origin_tests.rs
index 3b3e2a6c8f..66b9efb8e9 100644
--- a/crates/openhuman-core/src/cron/origin_tests.rs
+++ b/crates/openhuman-core/src/cron/origin_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::agent::turn_origin::{with_origin, TrustedAutomationSource};
+use crate::security::turn_origin::{with_origin, TrustedAutomationSource};
use serde_json::json;
use tinyflows_schedule::types::Schedule;
@@ -72,11 +72,11 @@ fn other_origins_have_no_job_origin() {
#[tokio::test]
async fn current_job_origin_reads_the_scoped_turn() {
assert_eq!(
- current_job_origin(crate::agent::turn_origin::current().as_ref()),
+ current_job_origin(crate::security::turn_origin::current().as_ref()),
None
);
let got = with_origin(web_turn("t-9"), async {
- current_job_origin(crate::agent::turn_origin::current().as_ref())
+ current_job_origin(crate::security::turn_origin::current().as_ref())
})
.await;
assert!(matches!(got, Some(JobOrigin::Web { thread_id, .. }) if thread_id == "t-9"));
diff --git a/crates/openhuman-core/src/cron/scheduler/agent_run.rs b/crates/openhuman-core/src/cron/scheduler/agent_run.rs
index 0b66355471..7808c7f0e6 100644
--- a/crates/openhuman-core/src/cron/scheduler/agent_run.rs
+++ b/crates/openhuman-core/src/cron/scheduler/agent_run.rs
@@ -195,7 +195,7 @@ pub(super) async fn run_agent_job_for_run(
// that channel's turn instead, so its external-effect
// tools stay gated like its creator's were.
let origin = crate::cron::origin::turn_origin_for_job_run(job, run_id);
- let turn = crate::agent::turn_origin::with_origin(
+ let turn = crate::security::turn_origin::with_origin(
origin,
agent.run_single(&prefixed_prompt),
);
diff --git a/crates/openhuman-core/src/desktop/notifications/README.md b/crates/openhuman-core/src/desktop/notifications/README.md
index 2a24e69e6b..0ca9075657 100644
--- a/crates/openhuman-core/src/desktop/notifications/README.md
+++ b/crates/openhuman-core/src/desktop/notifications/README.md
@@ -106,7 +106,7 @@ port has no `GROUP BY`. With no backend configured (the desktop default)
- `crate::core::bus::BUS` and `crate::core::events::DomainEvent` (`BUS.subscribe` for the bridge, `BUS.publish` for triage results); the `EventHandler` trait comes from `tinybus`.
- `crate::core::all` (`ControllerFuture`, `RegisteredController`) and `crate::core` (`ControllerSchema`, `FieldSchema`, `TypeSchema`), controller registry contract.
- `crate::config`: `Config` (workspace dir for the DB path), `config::rpc::load_config_with_timeout` in handlers, `active_workspace_snapshot` / `workspace_handle` for the workspace gate.
-- `crate::triage`: `run_triage`, `apply_decision`, `TriageOutcome`, `TriggerEnvelope`, `TriggerSource`, `TriageAction` for the background scoring/routing pipeline; `crate::agent::turn_origin::with_origin` scopes the routing turn.
+- `crate::triage`: `run_triage`, `apply_decision`, `TriageOutcome`, `TriggerEnvelope`, `TriggerSource`, `TriageAction` for the background scoring/routing pipeline; `crate::security::turn_origin::with_origin` scopes the routing turn.
- `crate::core::Outcome`: RPC response shaping.
- External crates: `rusqlite` (store), `chrono`, `uuid`, `serde_json`, `tokio`, `once_cell`, `async_trait`.
diff --git a/crates/openhuman-core/src/desktop/notifications/rpc.rs b/crates/openhuman-core/src/desktop/notifications/rpc.rs
index dc96022825..44e75b0852 100644
--- a/crates/openhuman-core/src/desktop/notifications/rpc.rs
+++ b/crates/openhuman-core/src/desktop/notifications/rpc.rs
@@ -16,7 +16,7 @@ use uuid::Uuid;
use crate::triage::{
apply_decision, local_trigger_origin, run_triage, TriageOutcome, TriggerEnvelope, TriggerSource,
};
-use crate::agent::turn_origin::with_origin;
+use crate::security::turn_origin::with_origin;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
use crate::core::Outcome;
diff --git a/crates/openhuman-core/src/flows/memory_tools.rs b/crates/openhuman-core/src/flows/memory_tools.rs
index 714d9b5e6a..6b0410efa5 100644
--- a/crates/openhuman-core/src/flows/memory_tools.rs
+++ b/crates/openhuman-core/src/flows/memory_tools.rs
@@ -32,7 +32,7 @@ use tinymemory_api::{
};
use tinytools::{PermissionLevel, Tool, ToolResult};
-use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
+use crate::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
use crate::config::Config;
use crate::memory::types::{LearnParams, RecallParams};
use crate::memory::{MemoryError, MemoryResult};
diff --git a/crates/openhuman-core/src/flows/ops.rs b/crates/openhuman-core/src/flows/ops.rs
index a89e4f0c27..fdb98bb26a 100644
--- a/crates/openhuman-core/src/flows/ops.rs
+++ b/crates/openhuman-core/src/flows/ops.rs
@@ -51,7 +51,7 @@ pub(crate) use tinyflows_catalog::graph_policy::{
};
use tokio_util::sync::CancellationToken;
-use crate::agent::turn_origin::{with_origin, AgentTurnOrigin, TrustedAutomationSource};
+use crate::security::turn_origin::{with_origin, AgentTurnOrigin, TrustedAutomationSource};
use crate::config::Config;
use crate::core::Outcome;
use crate::flows::bus;
diff --git a/crates/openhuman-core/src/flows/ops/discovery.rs b/crates/openhuman-core/src/flows/ops/discovery.rs
index 75b93f034a..def709c99d 100644
--- a/crates/openhuman-core/src/flows/ops/discovery.rs
+++ b/crates/openhuman-core/src/flows/ops/discovery.rs
@@ -41,7 +41,7 @@ pub async fn flows_discover(
config: &Config,
stream: Option<FlowStreamTarget>,
) -> Result<Outcome<Vec<FlowSuggestion>>, String> {
- use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};
+ use crate::security::turn_origin::{with_origin, AgentTurnOrigin};
use crate::agent::OpenHumanSessionHost;
tracing::info!(
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs b/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs
index f96cfd8714..2c4224a422 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs
@@ -450,7 +450,7 @@ impl OpenHumanAgentRunner {
//
// Cancellation: the run_registry token aborts the engine future, and the
// inner turn drops with it (task-local scope unwinds cleanly).
- use crate::agent::turn_origin;
+ use crate::security::turn_origin;
let escalated_origin = escalated_origin_for_nested_harness(self.ctx.turn_origin());
if let Some(ref escalated) = escalated_origin {
tracing::debug!(
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tests.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tests.rs
index 90e861f9a7..ec4f9f567b 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tests.rs
@@ -46,7 +46,7 @@ fn policy(level: crate::security::AutonomyLevel) -> SecurityPolicy {
// ── Codex P1: Prompt-tier decisions must escalate past a workflow's own
// require_approval=false default, never silently auto-allow ────────────
-use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
+use crate::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
fn workflow_origin(job_id: &str, require_approval: bool) -> AgentTurnOrigin {
AgentTurnOrigin::TrustedAutomation {
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/tier.rs b/crates/openhuman-core/src/flows/tinyflows/caps/tier.rs
index aa6f561f37..750d11c758 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/tier.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/tier.rs
@@ -75,7 +75,7 @@ pub(crate) fn enforce_node_tier_gate(
/// trip regardless of the running flow's own `require_approval` toggle.
///
/// **Why this is needed (Codex P1 finding):** `ApprovalGate::intercept_audited`
-/// branches on the scoped [`AgentTurnOrigin`](crate::agent::turn_origin::AgentTurnOrigin) —
+/// branches on the scoped [`AgentTurnOrigin`](crate::security::turn_origin::AgentTurnOrigin) —
/// for a `TrustedAutomation { source: Workflow { require_approval: false }, .. }`
/// origin (the default for every saved flow unless the author opts in) it
/// returns `Allow` unconditionally, the same pre-declared-trust-root shortcut a
@@ -99,7 +99,7 @@ pub(crate) async fn gate_call_for_tier(
action_summary: &str,
args_redacted: Value,
) -> (crate::security::approval::GateOutcome, Option<String>) {
- use crate::agent::turn_origin;
+ use crate::security::turn_origin;
let Some(gate) = crate::security::approval::ApprovalGate::try_global() else {
return (crate::security::approval::GateOutcome::Allow, None);
@@ -136,17 +136,17 @@ pub(crate) async fn gate_call_for_tier(
/// `ApprovalGate`.
pub(crate) fn escalated_origin_for_prompt(
tier_decision: GateDecision,
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
-) -> Option<crate::agent::turn_origin::AgentTurnOrigin> {
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
+) -> Option<crate::security::turn_origin::AgentTurnOrigin> {
(tier_decision == GateDecision::Prompt)
.then(|| force_workflow_approval(origin))
.flatten()
}
fn force_workflow_approval(
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
-) -> Option<crate::agent::turn_origin::AgentTurnOrigin> {
- use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
+) -> Option<crate::security::turn_origin::AgentTurnOrigin> {
+ use crate::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
match origin {
Some(AgentTurnOrigin::TrustedAutomation {
@@ -189,7 +189,7 @@ fn force_workflow_approval(
/// Split out as a free function over plain values so the escalation policy is
/// unit-testable without a live `ApprovalGate`.
pub(crate) fn escalated_origin_for_nested_harness(
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
-) -> Option<crate::agent::turn_origin::AgentTurnOrigin> {
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
+) -> Option<crate::security::turn_origin::AgentTurnOrigin> {
force_workflow_approval(origin)
}
diff --git a/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs b/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs
index 761d44e177..63046c3b98 100644
--- a/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs
@@ -16,7 +16,7 @@
//! injector additionally stamps `flow_id` on every span for filtering.
//!
//! Transport mirrors the agent-turn tracing path
-//! (`agent::progress_tracing::otlp::push_spans`): the endpoint is derived
+//! (`core::observability::progress_tracing::otlp::push_spans`): the endpoint is derived
//! from the **current backend hostname** (`effective_backend_api_url`), auth
//! is the live OpenHuman session bearer (the backend injects the real
//! Langfuse keys server-side, stamps the authenticated user on every span and
@@ -125,7 +125,7 @@ fn flow_otlp_requests(
/// The OTLP `service.name` for flow traces.
fn flow_service_name() -> &'static str {
- crate::agent::progress_tracing::export_brand().product
+ crate::core::observability::progress_tracing::export_brand().product
}
/// Exports one settled flow run to Langfuse as a single trace. Best-effort:
diff --git a/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs b/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs
index bcf0b3238a..09df74d630 100644
--- a/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs
@@ -39,8 +39,8 @@ use tinyflows::caps::MemoryProvider;
use tinyflows::error::{EngineError, Result};
#[cfg(test)]
-use crate::agent::turn_origin;
-use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
+use crate::security::turn_origin;
+use crate::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
use crate::config::Config;
use crate::flows::{
cross_flow_filter, flow_filter, flow_key_of, flow_key_tag, forget_matching, remember_keyed,
diff --git a/crates/openhuman-core/src/flows/tinyflows/memory_adapter_tests.rs b/crates/openhuman-core/src/flows/tinyflows/memory_adapter_tests.rs
index 05c525103e..88700c96f9 100644
--- a/crates/openhuman-core/src/flows/tinyflows/memory_adapter_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/memory_adapter_tests.rs
@@ -342,7 +342,7 @@ async fn flow_id_comes_from_the_runs_context_not_the_calling_tasks_scope() {
adapter.ctx = crate::core::runtime::DispatchCtx::unbound().with_turn_origin(own);
// A different flow's origin scoped on the task must not win.
- let id = crate::agent::turn_origin::with_origin(other, async { adapter.trusted_flow_id() })
+ let id = crate::security::turn_origin::with_origin(other, async { adapter.trusted_flow_id() })
.await
.unwrap();
assert_eq!(id, "flow-own");
@@ -353,6 +353,6 @@ async fn a_context_without_a_workflow_origin_refuses_flow_scope_even_inside_a_wo
let (_tmp, adapter) = adapter(AutonomyLevel::Full);
let other = workflow_origin("flow-other");
let result =
- crate::agent::turn_origin::with_origin(other, async { adapter.trusted_flow_id() }).await;
+ crate::security::turn_origin::with_origin(other, async { adapter.trusted_flow_id() }).await;
assert!(result.is_err());
}
diff --git a/crates/openhuman-core/src/flows/tools.rs b/crates/openhuman-core/src/flows/tools.rs
index 287b1a0f3d..c515b71860 100644
--- a/crates/openhuman-core/src/flows/tools.rs
+++ b/crates/openhuman-core/src/flows/tools.rs
@@ -217,7 +217,7 @@ impl Tool for RunFlowTool {
fn name(&self) -> &str {
// NOTE: deliberately `run_flow`, not `run_workflow` — the latter
// name is already taken by the unrelated legacy skills-workflow
- // runner (`crate::agent::tools::run_workflow`,
+ // runner (`crate::skills::run_workflow`,
// `RUN_WORKFLOW_TOOL_NAME`), which is registered in the same
// default tool registry (`tools::ops::all_tools_with_runtime`).
// Both tools were previously named identically, which
diff --git a/crates/openhuman-core/src/inference/host_runtime/mod.rs b/crates/openhuman-core/src/inference/host_runtime/mod.rs
index fabd370a8d..f8e4b40b4c 100644
--- a/crates/openhuman-core/src/inference/host_runtime/mod.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/mod.rs
@@ -25,7 +25,7 @@ pub mod ops;
mod schemas;
// `pub(crate)` so the shared `apply_no_window` helper can be reused from the
-// agent shell runtime (`agent::host_runtime`) — single source of truth for the
+// agent shell runtime (`modules::tinybox::host_runtime`) — single source of truth for the
// Windows `CREATE_NO_WINDOW` flag (#3727/#3728).
pub mod service;
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs
index 2f19a4f7f5..67581ab99b 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs
@@ -37,7 +37,7 @@ use super::turn_guards::{
/// # Progress
///
/// An in-process embedder hands a
-/// [`AgentProgress`](crate::agent::progress::AgentProgress) channel through
+/// [`AgentProgress`](crate::progress::AgentProgress) channel through
/// [`AgentChatEnv`] (see [`agent_chat_for`]); it is attached to the agent built
/// here, so the embedder observes the turn's tool calls and deltas live instead
/// of only its final string.
@@ -81,7 +81,7 @@ pub async fn agent_chat(
pub struct AgentChatEnv {
/// Live progress for the turn; `None` attaches a drain-only sink so the
/// model calls still stream.
- pub progress: Option<tokio::sync::mpsc::Sender<crate::agent::progress::AgentProgress>>,
+ pub progress: Option<tokio::sync::mpsc::Sender<crate::progress::AgentProgress>>,
/// The host environment installed on the session
/// ([`OpenHumanSessionHost::set_host_env`]).
pub host: crate::agent::turn_env::HostTurnEnv,
@@ -573,7 +573,7 @@ pub async fn agent_chat_reply_for(
// turn fell back to unary `invoke`, so time-to-first-token equalled the
// full completion latency. Attach a drain-only sink so the call streams;
// the task ends when the agent drops its sender.
- let (tx, mut rx) = tokio::sync::mpsc::channel::<crate::agent::progress::AgentProgress>(256);
+ let (tx, mut rx) = tokio::sync::mpsc::channel::<crate::progress::AgentProgress>(256);
tokio::spawn(async move { while rx.recv().await.is_some() {} });
agent.set_on_progress(Some(tx));
log::debug!(
@@ -588,7 +588,7 @@ pub async fn agent_chat_reply_for(
// Overwriting that with `Cli` would silently discard the caller's own
// trust statement and hand every such turn the blanket CLI allowance
// instead of the narrower one it asked for.
- let run = crate::agent::turn_origin::with_origin(
+ let run = crate::security::turn_origin::with_origin(
effective_agent_chat_origin(&turn_ctx),
agent.run_single_with_approval(message, None, approval),
);
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_tests.rs b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_tests.rs
index efd820a4fd..19e6ef0eab 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_tests.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_tests.rs
@@ -83,18 +83,18 @@ fn explicit_turn_temperature_overrides_the_definition_without_mutating_it() {
assert_eq!(definition_for_turn(&definition, None).temperature, 0.6);
}
-fn chat_origin(thread: &str) -> crate::agent::turn_origin::AgentTurnOrigin {
- crate::agent::turn_origin::AgentTurnOrigin::WebChat {
+fn chat_origin(thread: &str) -> crate::security::turn_origin::AgentTurnOrigin {
+ crate::security::turn_origin::AgentTurnOrigin::WebChat {
thread_id: thread.into(),
client_id: "client".into(),
request_id: format!("req-{thread}").into(),
}
}
-fn chat_thread(origin: crate::agent::turn_origin::AgentTurnOrigin) -> String {
+fn chat_thread(origin: crate::security::turn_origin::AgentTurnOrigin) -> String {
match origin {
- crate::agent::turn_origin::AgentTurnOrigin::WebChat { thread_id, .. } => thread_id.into(),
- crate::agent::turn_origin::AgentTurnOrigin::DirectChat => "direct".into(),
+ crate::security::turn_origin::AgentTurnOrigin::WebChat { thread_id, .. } => thread_id.into(),
+ crate::security::turn_origin::AgentTurnOrigin::DirectChat => "direct".into(),
other => panic!("unexpected origin {other:?}"),
}
}
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/turn_guards.rs b/crates/openhuman-core/src/inference/host_runtime/ops/turn_guards.rs
index 4b7d42ad6a..812781e2b7 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops/turn_guards.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops/turn_guards.rs
@@ -127,12 +127,12 @@ pub(super) fn grant_turn_cwd(config: &mut Config, root: &std::path::Path) {
/// unchanged — but `message` here is something a *person* typed, and `Cli`
/// answers "who wrote this" with a trust answer. Its own documentation covers
/// sub-agent and internal invocations, so
-/// [`is_user_authored`](crate::agent::turn_origin::AgentTurnOrigin::is_user_authored)
+/// [`is_user_authored`](crate::security::turn_origin::AgentTurnOrigin::is_user_authored)
/// reads `false` for it and the conversation autosave would silently drop a
/// real user message.
pub(super) fn effective_agent_chat_origin(
ctx: &crate::core::runtime::DispatchCtx,
-) -> crate::agent::turn_origin::AgentTurnOrigin {
+) -> crate::security::turn_origin::AgentTurnOrigin {
ctx.turn_origin_or_scoped()
- .unwrap_or(crate::agent::turn_origin::AgentTurnOrigin::DirectChat)
+ .unwrap_or(crate::security::turn_origin::AgentTurnOrigin::DirectChat)
}
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops_tests.rs b/crates/openhuman-core/src/inference/host_runtime/ops_tests.rs
index 06535fb5dd..eebbbce151 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops_tests.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops_tests.rs
@@ -263,7 +263,7 @@ fn grant_turn_cwd_is_the_only_mutation() {
/// silently drop a real user message (#5312).
#[tokio::test]
async fn effective_origin_defaults_to_direct_chat_outside_any_scope() {
- use crate::agent::turn_origin::AgentTurnOrigin;
+ use crate::security::turn_origin::AgentTurnOrigin;
let origin = effective_agent_chat_origin(&crate::core::runtime::DispatchCtx::ambient());
assert!(
matches!(origin, AgentTurnOrigin::DirectChat),
@@ -280,7 +280,7 @@ async fn effective_origin_defaults_to_direct_chat_outside_any_scope() {
/// see, not the blanket `Cli` allowance this RPC would otherwise impose.
#[tokio::test]
async fn effective_origin_keeps_an_embedder_scoped_label() {
- use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource, with_origin};
+ use crate::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource, with_origin};
let observed = with_origin(
AgentTurnOrigin::TrustedAutomation {
job_id: "run-7".to_string(),
diff --git a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
index 2fe7c22f53..ee339707b7 100644
--- a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
+++ b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
@@ -7,7 +7,7 @@ use tinybus::EventHandler;
use crate::triage::{
apply_decision, remote_trigger_origin, run_triage, TriageOutcome, TriggerEnvelope,
};
-use crate::agent::turn_origin::with_origin;
+use crate::security::turn_origin::with_origin;
use crate::core::events::DomainEvent;
use crate::integrations::composio::trigger_history;
diff --git a/crates/openhuman-core/src/integrations/task_sources/route.rs b/crates/openhuman-core/src/integrations/task_sources/route.rs
index 672d5afe84..9ce98bea5b 100644
--- a/crates/openhuman-core/src/integrations/task_sources/route.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/route.rs
@@ -19,7 +19,7 @@ use serde_json::json;
use crate::triage::{
apply_decision, remote_trigger_origin, run_triage, TriageOutcome, TriggerEnvelope,
};
-use crate::agent::turn_origin::with_origin;
+use crate::security::turn_origin::with_origin;
use crate::config::Config;
use crate::cron::scheduler_gate;
diff --git a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs b/crates/openhuman-core/src/mcp/server/tools/dispatch.rs
index a1463a65e8..14fec8a37b 100644
--- a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs
+++ b/crates/openhuman-core/src/mcp/server/tools/dispatch.rs
@@ -361,7 +361,7 @@ async fn run_subagent_tool(
// clients. Treat callers as ExternalChannel — their prompt text is
// remote-controlled and any external_effect tool the agent tries to
// run must route through the gate's audit + TTL-deny path.
- let origin = crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+ let origin = crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
sender_name: None,
channel: "mcp_server".to_string(),
// MCP server callers don't carry a per-user identity at this
@@ -379,7 +379,7 @@ async fn run_subagent_tool(
// `handle_json_value` dispatch above it) keeps a small stack frame.
let response = Box::pin(subagent_depth::scope(
child_depth,
- crate::agent::turn_origin::with_origin(origin, agent.run_single(prompt)),
+ crate::security::turn_origin::with_origin(origin, agent.run_single(prompt)),
))
.await
.map_err(|err| ToolCallError::Internal(format!("subagent `{agent_id}` failed: {err}")))?;
diff --git a/crates/openhuman-core/src/memory/lifecycle/sender.rs b/crates/openhuman-core/src/memory/lifecycle/sender.rs
index f38c37050f..d68dd87875 100644
--- a/crates/openhuman-core/src/memory/lifecycle/sender.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/sender.rs
@@ -22,7 +22,7 @@
use tinymemory_api::ObservedActor;
-use crate::agent::turn_origin::AgentTurnOrigin;
+use crate::security::turn_origin::AgentTurnOrigin;
/// Channels whose senders are phone numbers (or, for iMessage, email
/// addresses).
diff --git a/crates/openhuman-core/src/memory/lifecycle/session_hooks.rs b/crates/openhuman-core/src/memory/lifecycle/session_hooks.rs
index f001014071..873b19bdba 100644
--- a/crates/openhuman-core/src/memory/lifecycle/session_hooks.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/session_hooks.rs
@@ -111,7 +111,7 @@ impl OpenHumanTurnPrelude {
history: &[Message],
committed_turns: usize,
current: Option<&Message>,
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
) -> Option<Arc<MemoryTurn>> {
let user_text = self
.mutable
diff --git a/crates/openhuman-core/src/modules/wallet_host.rs b/crates/openhuman-core/src/modules/wallet_host.rs
index 8f0277ac56..b9e2b2925d 100644
--- a/crates/openhuman-core/src/modules/wallet_host.rs
+++ b/crates/openhuman-core/src/modules/wallet_host.rs
@@ -82,9 +82,9 @@ fn endpoint_references() -> &'static Mutex<HashMap<String, EndpointReference>> {
/// callback arrives over the bus with no run context of its own.
fn x402_request_owner_matches(
request: &AuthorizeX402PaymentRequest,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
) -> bool {
- let Some(crate::agent::turn_origin::AgentTurnOrigin::WebChat {
+ let Some(crate::security::turn_origin::AgentTurnOrigin::WebChat {
thread_id,
client_id,
..
diff --git a/crates/openhuman-core/src/modules/wallet_host_tests.rs b/crates/openhuman-core/src/modules/wallet_host_tests.rs
index 6e55e0cf72..62c3847c42 100644
--- a/crates/openhuman-core/src/modules/wallet_host_tests.rs
+++ b/crates/openhuman-core/src/modules/wallet_host_tests.rs
@@ -23,7 +23,7 @@ fn x402_approval_is_bound_to_the_exact_chat_owner_and_payment_facts() {
client_id: "client-1".into(),
}),
};
- let origin = |thread: &str, client: &str| crate::agent::turn_origin::AgentTurnOrigin::WebChat {
+ let origin = |thread: &str, client: &str| crate::security::turn_origin::AgentTurnOrigin::WebChat {
thread_id: thread.into(),
client_id: client.into(),
request_id: Some("request-1".into()),
@@ -43,7 +43,7 @@ fn x402_approval_is_bound_to_the_exact_chat_owner_and_payment_facts() {
// Only a WebChat turn can own an x402 payment: another origin, or none, never matches.
assert!(!x402_request_owner_matches(
&request,
- Some(&crate::agent::turn_origin::AgentTurnOrigin::Cli)
+ Some(&crate::security::turn_origin::AgentTurnOrigin::Cli)
));
assert!(!x402_request_owner_matches(&request, None));
diff --git a/crates/openhuman-core/src/plan_review/tool.rs b/crates/openhuman-core/src/plan_review/tool.rs
index d9d0794f57..6bc4b86a17 100644
--- a/crates/openhuman-core/src/plan_review/tool.rs
+++ b/crates/openhuman-core/src/plan_review/tool.rs
@@ -11,7 +11,7 @@
use async_trait::async_trait;
use serde_json::json;
-use crate::agent::turn_origin::AgentTurnOrigin;
+use crate::security::turn_origin::AgentTurnOrigin;
use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult, ToolRunContext, ToolTimeout};
use super::gate;
diff --git a/crates/openhuman-core/src/plan_review/tool_tests.rs b/crates/openhuman-core/src/plan_review/tool_tests.rs
index 552ffe883e..df925a9a8d 100644
--- a/crates/openhuman-core/src/plan_review/tool_tests.rs
+++ b/crates/openhuman-core/src/plan_review/tool_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::agent::turn_origin::with_origin;
+use crate::security::turn_origin::with_origin;
use crate::security::approval::ApprovalChatContext;
/// The execution context the harness hands a tool dispatched inside a turn
diff --git a/crates/openhuman-core/src/platform/cost/scope.rs b/crates/openhuman-core/src/platform/cost/scope.rs
index 2011cbd2b0..7bc9da5de6 100644
--- a/crates/openhuman-core/src/platform/cost/scope.rs
+++ b/crates/openhuman-core/src/platform/cost/scope.rs
@@ -10,7 +10,7 @@
//!
//! [`CoreContext`]: crate::core::runtime::CoreContext
-use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
+use crate::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
use crate::core::runtime::DispatchCtx;
use super::types::UsageScope;
diff --git a/crates/openhuman-core/src/platform/cost/scope_tests.rs b/crates/openhuman-core/src/platform/cost/scope_tests.rs
index 3ad1352e07..362350822f 100644
--- a/crates/openhuman-core/src/platform/cost/scope_tests.rs
+++ b/crates/openhuman-core/src/platform/cost/scope_tests.rs
@@ -65,7 +65,7 @@ async fn ambient_scope_reads_the_turn_and_prefers_the_subagent() {
crate::core::runtime::CoreContext::for_test(crate::core::runtime::DomainSet::full(), None);
let (parent, child) = {
let scope_ctx = crate::core::runtime::DispatchCtx::new(ctx);
- crate::agent::turn_origin::with_origin(origin, async {
+ crate::security::turn_origin::with_origin(origin, async {
async {
(
UsageScope::in_ctx(&scope_ctx, Some("openhuman"), None)
diff --git a/crates/openhuman-core/src/prompts/section_renderers.rs b/crates/openhuman-core/src/prompts/section_renderers.rs
index 36095c85c4..061dccaef6 100644
--- a/crates/openhuman-core/src/prompts/section_renderers.rs
+++ b/crates/openhuman-core/src/prompts/section_renderers.rs
@@ -1,5 +1,5 @@
//! Functional `render_*` wrappers over the section structs in
-//! [`crate::agent::prompts::sections`], plus the per-turn datetime stamp and the
+//! [`crate::prompts::sections`], plus the per-turn datetime stamp and the
//! ambient-environment composer that `agents/<id>/prompt.rs` builders call.
use super::sections::*;
diff --git a/crates/openhuman-core/src/prompts/workspace_files.rs b/crates/openhuman-core/src/prompts/workspace_files.rs
index 175b49fcb4..d35d3e6587 100644
--- a/crates/openhuman-core/src/prompts/workspace_files.rs
+++ b/crates/openhuman-core/src/prompts/workspace_files.rs
@@ -144,7 +144,7 @@ pub fn inject_inline_content(prompt: &mut String, label: &str, content: &str, ma
/// Shared `## Project instructions (AGENTS.md)` block writer.
///
-/// Used by both [`crate::agent::prompts::sections::AgentsInstructionsSection`] (the default /
+/// Used by both [`crate::prompts::sections::AgentsInstructionsSection`] (the default /
/// sub-agent builder chains) and the narrow sub-agent renderer
/// ([`super::subagent::render_subagent_system_prompt_with_format`]) so the two paths never
/// drift. The heading is emitted only when at least one layer carries content;
diff --git a/crates/openhuman-core/src/sandbox/README.md b/crates/openhuman-core/src/sandbox/README.md
index 8b6ceb03b1..493af22cc6 100644
--- a/crates/openhuman-core/src/sandbox/README.md
+++ b/crates/openhuman-core/src/sandbox/README.md
@@ -233,7 +233,7 @@ The settings surface (`get_sandbox_settings`, `[security.sandbox]` and
default install the sandbox and the `is_always_forbidden` floor are what
bound an agent.
- Shell selection and the child environment for each platform are TinyBox's
- (`SelectShell` / `StartNativeShellExec`); `agent::host_runtime::host_shell_flavor`
+ (`SelectShell` / `StartNativeShellExec`); `modules::tinybox::host_runtime::host_shell_flavor`
only tells the model which family that is.
- The agent's `SandboxMode` is declared in its definition
(`tinyagents_definition::SandboxMode`) and read per call through
diff --git a/crates/openhuman-core/src/security/approval/gate.rs b/crates/openhuman-core/src/security/approval/gate.rs
index 013b206ba1..3c12d56307 100644
--- a/crates/openhuman-core/src/security/approval/gate.rs
+++ b/crates/openhuman-core/src/security/approval/gate.rs
@@ -38,8 +38,8 @@ use parking_lot::Mutex;
use tokio::sync::oneshot;
#[cfg(test)]
-use crate::agent::turn_origin;
-use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
+use crate::security::turn_origin;
+use crate::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
use crate::config::Config;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
@@ -161,7 +161,7 @@ pub struct ApprovalChatContext {
/// Per-run flow context (flow-approval-surface, PR2 of the tinyflows
/// approval-surfacing design). `flows::ops::flows_run` / `flows_resume`
/// hand it to the engine's capabilities, alongside the existing
-/// `Workflow` [`AgentTurnOrigin`](crate::agent::turn_origin::AgentTurnOrigin),
+/// `Workflow` [`AgentTurnOrigin`](crate::security::turn_origin::AgentTurnOrigin),
/// so a tool call parked from that run can correlate
/// [`PendingApproval::source_context`](super::types::PendingApproval) back to
/// the exact flow + run (the origin alone only carries `flow_id`, not
diff --git a/crates/openhuman-core/src/sessions/mod.rs b/crates/openhuman-core/src/sessions/mod.rs
index 125fd01f0e..01c45856b2 100644
--- a/crates/openhuman-core/src/sessions/mod.rs
+++ b/crates/openhuman-core/src/sessions/mod.rs
@@ -19,7 +19,7 @@
//! in `src/` ever writes (permanently empty in production, no frontend
//! consumer). The run ledger below is written from
//! [`crate::web_chat::progress_bridge`] and
-//! [`crate::agent::progress_tracing`], so it stays fully functional.
+//! [`crate::core::observability::progress_tracing`], so it stays fully functional.
mod schemas;
diff --git a/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs b/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs
index d5136b213a..82ff2b6fb8 100644
--- a/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs
+++ b/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs
@@ -28,7 +28,7 @@ use async_trait::async_trait;
use parking_lot::Mutex;
use crate::agent::harness::run_channel_turn_via_graph;
-use crate::agent::tools::RunWorkflowTool;
+use crate::skills::run_workflow::RunWorkflowTool;
use crate::config::{Config, MultimodalConfig, MultimodalFileConfig};
use crate::skills::ops_create::{
create_workflow_inner, CreateWorkflowParams, WorkflowCreateInputDef,
diff --git a/crates/openhuman-core/src/skills/run_log.rs b/crates/openhuman-core/src/skills/run_log.rs
index deba8a785b..6fcb68c4f0 100644
--- a/crates/openhuman-core/src/skills/run_log.rs
+++ b/crates/openhuman-core/src/skills/run_log.rs
@@ -17,7 +17,7 @@ use serde_json::Value;
use tokio::sync::mpsc::Receiver;
use tokio_util::sync::CancellationToken;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
// Layout, writers-by-timestamp and readers live in `tinyskills::run_log`;
// the host keeps event formatting, the cancel registry and the drain.
diff --git a/crates/openhuman-core/src/skills/runtime/run_machinery.rs b/crates/openhuman-core/src/skills/runtime/run_machinery.rs
index e34e1faa6c..5aba64df29 100644
--- a/crates/openhuman-core/src/skills/runtime/run_machinery.rs
+++ b/crates/openhuman-core/src/skills/runtime/run_machinery.rs
@@ -41,7 +41,7 @@ pub async fn spawn_workflow_run_background(
ctx: &crate::core::runtime::DispatchCtx,
skill_id_param: String,
inputs_param: Option<Value>,
- parent_origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ parent_origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
) -> Result<WorkflowRunStarted, String> {
let workspace = resolve_workspace_dir().await;
let skill = registry::get_workflow(&workspace, &skill_id_param)
@@ -151,7 +151,7 @@ pub async fn spawn_workflow_run_background(
// immediately. Same flow handle_skills_run used to inline — extracted
// so the `run_workflow` agent tool can re-use it for skill chaining.
let inherited_origin =
- parent_origin.unwrap_or(crate::agent::turn_origin::AgentTurnOrigin::Unknown);
+ parent_origin.unwrap_or(crate::security::turn_origin::AgentTurnOrigin::Unknown);
{
let run_id = run_id.clone();
let workflow_id = workflow_id.clone();
@@ -239,7 +239,7 @@ pub async fn spawn_workflow_run_background(
let result = tokio::select! {
biased;
_ = cancel_token.cancelled() => None,
- r = crate::agent::turn_origin::with_origin(
+ r = crate::security::turn_origin::with_origin(
inherited_origin,
agent.run_single(&task_prompt),
) => Some(r),
diff --git a/crates/openhuman-core/src/skills/runtime/schemas.rs b/crates/openhuman-core/src/skills/runtime/schemas.rs
index 481029f336..39f40ccdeb 100644
--- a/crates/openhuman-core/src/skills/runtime/schemas.rs
+++ b/crates/openhuman-core/src/skills/runtime/schemas.rs
@@ -270,8 +270,8 @@ fn handle_run(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture
tracing::info!(skill_id = %payload.skill_id, "[skill_runtime][rpc] run");
let origin = ctx
.turn_origin_or_scoped()
- .unwrap_or(crate::agent::turn_origin::AgentTurnOrigin::Cli);
- let started = crate::agent::turn_origin::with_origin(
+ .unwrap_or(crate::security::turn_origin::AgentTurnOrigin::Cli);
+ let started = crate::security::turn_origin::with_origin(
origin.clone(),
spawn_workflow_run_background(&ctx, payload.skill_id, payload.inputs, Some(origin)),
)
diff --git a/crates/openhuman-core/src/skills/schemas/handlers.rs b/crates/openhuman-core/src/skills/schemas/handlers.rs
index 14231a016c..aa4e305337 100644
--- a/crates/openhuman-core/src/skills/schemas/handlers.rs
+++ b/crates/openhuman-core/src/skills/schemas/handlers.rs
@@ -167,8 +167,8 @@ pub(super) fn handle_skills_run(ctx: DispatchCtx, params: Map<String, Value>) ->
let payload = deserialize_params::<WorkflowsRunParams>(params)?;
let origin = ctx
.turn_origin_or_scoped()
- .unwrap_or(crate::agent::turn_origin::AgentTurnOrigin::Cli);
- let started = match crate::agent::turn_origin::with_origin(
+ .unwrap_or(crate::security::turn_origin::AgentTurnOrigin::Cli);
+ let started = match crate::security::turn_origin::with_origin(
origin.clone(),
spawn_workflow_run_background(&ctx, payload.workflow_id, payload.inputs, Some(origin)),
)
diff --git a/crates/openhuman-core/src/skills/webhooks/bus.rs b/crates/openhuman-core/src/skills/webhooks/bus.rs
index 46a9d4fba2..5e472dbe3e 100644
--- a/crates/openhuman-core/src/skills/webhooks/bus.rs
+++ b/crates/openhuman-core/src/skills/webhooks/bus.rs
@@ -318,7 +318,7 @@ async fn run_agent_trigger(
// attacker-influenceable, so the dispatch parks rather than running
// on a trust root (#5634).
let origin = crate::triage::remote_trigger_origin(envelope);
- crate::agent::turn_origin::with_origin(
+ crate::security::turn_origin::with_origin(
origin,
crate::triage::apply_decision(ctx, run.clone(), envelope),
)
diff --git a/crates/openhuman-core/src/skills/webhooks/ops.rs b/crates/openhuman-core/src/skills/webhooks/ops.rs
index 70697a4843..6d9220acaa 100644
--- a/crates/openhuman-core/src/skills/webhooks/ops.rs
+++ b/crates/openhuman-core/src/skills/webhooks/ops.rs
@@ -169,7 +169,7 @@ pub async fn trigger_agent(
let origin = crate::triage::remote_trigger_origin(&envelope);
tokio::time::timeout(
std::time::Duration::from_secs(60),
- crate::agent::turn_origin::with_origin(
+ crate::security::turn_origin::with_origin(
origin,
crate::triage::apply_decision(ctx, run.clone(), &envelope),
),
diff --git a/crates/openhuman-core/src/threads/README.md b/crates/openhuman-core/src/threads/README.md
index 36a9401b21..94dfc0f54a 100644
--- a/crates/openhuman-core/src/threads/README.md
+++ b/crates/openhuman-core/src/threads/README.md
@@ -133,7 +133,7 @@ its tools act in another. `web_chat::run_task` reads the binding through
`web_chat::progress_bridge` drives a `tinyagents_session::turn_state::TurnStateMirror`
for each web turn. `turn_state::mirror::ObserveProgress` (`mirror/observe.rs`)
-is the host projection: it turns each `agent::progress::AgentProgress` event
+is the host projection: it turns each `progress::AgentProgress` event
into a `TurnState` mutation. Streaming deltas only update memory; the mirror
flushes at iteration and tool boundaries. A finished turn is kept as
`Completed` so the UI can replay it. A turn whose bridge exits without
diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rs
index 7801b3efb0..be999db407 100644
--- a/crates/openhuman-core/src/threads/ops/crud.rs
+++ b/crates/openhuman-core/src/threads/ops/crud.rs
@@ -200,7 +200,7 @@ async fn message_append_with_config(
ctx: &DispatchCtx,
mut request: AppendConversationMessageRequest,
config: &crate::config::Config,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
persistence_dir: &std::path::Path,
) -> Result<Outcome<ApiEnvelope<ConversationMessageRecord>>, ThreadsError> {
if request.message.sender == "user" {
@@ -241,7 +241,7 @@ async fn message_append_with_config(
|| (image_count > 0 && config.multimodal.max_images == 0)
|| matches!(
origin,
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
)
{
return Err(ThreadsError::Message(
@@ -252,7 +252,7 @@ async fn message_append_with_config(
let scope = crate::attachments::AttachmentAccessScope {
external_channel: matches!(
origin,
- Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
+ Some(crate::security::turn_origin::AgentTurnOrigin::ExternalChannel { .. })
),
workspace: Some(workspace.clone()),
};
diff --git a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs
index c0a09c5d82..d1e5108cd7 100644
--- a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs
@@ -27,7 +27,7 @@ async fn setup() -> (tempfile::TempDir, crate::config::Config) {
async fn append_with_test_config(
request: AppendConversationMessageRequest,
config: &crate::config::Config,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
) -> Result<Outcome<ApiEnvelope<ConversationMessageRecord>>, ThreadsError> {
message_append_with_config(
&crate::core::runtime::DispatchCtx::ambient(),
@@ -171,7 +171,7 @@ async fn external_origin_cannot_reuse_an_existing_attachment_marker() {
)
.await
.unwrap();
- let origin = crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+ let origin = crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
sender_name: None,
channel: "test".into(),
sender: None,
diff --git a/crates/openhuman-core/src/threads/turn_state/mirror/observe.rs b/crates/openhuman-core/src/threads/turn_state/mirror/observe.rs
index ee0481400f..fd2f27e8af 100644
--- a/crates/openhuman-core/src/threads/turn_state/mirror/observe.rs
+++ b/crates/openhuman-core/src/threads/turn_state/mirror/observe.rs
@@ -5,7 +5,7 @@
//! `tinyagents_session::turn_state::TurnStateMirror`; this is the host-side
//! progress projection over it.
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::threads::turn_state::rpc_types::persisted_tool_failure;
use tinyagents_session::turn_state::mirror::caps::{cap_persisted_args, cap_persisted_output};
diff --git a/crates/openhuman-core/src/threads/turn_state/mirror_tests.rs b/crates/openhuman-core/src/threads/turn_state/mirror_tests.rs
index 30e9c49c1b..9bc7ff057c 100644
--- a/crates/openhuman-core/src/threads/turn_state/mirror_tests.rs
+++ b/crates/openhuman-core/src/threads/turn_state/mirror_tests.rs
@@ -1,7 +1,7 @@
//! Unit tests for [`super::TurnStateMirror`].
use super::*;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use tempfile::tempdir;
fn fresh(thread_id: &str) -> (tempfile::TempDir, TurnStateMirror) {
diff --git a/crates/openhuman-core/src/threads/turn_state/mod.rs b/crates/openhuman-core/src/threads/turn_state/mod.rs
index a240c7f8cd..721dc4891c 100644
--- a/crates/openhuman-core/src/threads/turn_state/mod.rs
+++ b/crates/openhuman-core/src/threads/turn_state/mod.rs
@@ -7,7 +7,7 @@
//! unclean shutdown at cold boot.
//! `tinyagents_session::turn_state::TurnStateMirror` is the writer — it is driven by
//! [`mirror::ObserveProgress`], which translates
-//! [`crate::agent::progress::AgentProgress`] events into [`types::TurnState`]
+//! [`crate::progress::AgentProgress`] events into [`types::TurnState`]
//! mutations and flushes to the store at iteration / tool boundaries (not on
//! every streaming delta), keeping `Completed` snapshots so the UI can replay
//! a finished turn.
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser.rs b/crates/openhuman-core/src/tools/impl/browser/browser.rs
index fca425027c..0fa5a98ccb 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser.rs
@@ -9,7 +9,7 @@ mod session_pool;
mod task_actions;
#[path = "browser_unattended.rs"]
mod unattended;
-use crate::agent::turn_origin::AgentTurnOrigin;
+use crate::security::turn_origin::AgentTurnOrigin;
use crate::modules::browser::BrowserClient;
use crate::security::approval::{ApprovalGate, GateOutcome};
use crate::security::SecurityPolicy;
@@ -578,7 +578,7 @@ impl BrowserTool {
async fn execute_with_origin(
&self,
args: Value,
- origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<crate::security::turn_origin::AgentTurnOrigin>,
) -> anyhow::Result<ToolResult> {
if !self.security.can_act() {
return Ok(ToolResult::error(
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_task_actions.rs b/crates/openhuman-core/src/tools/impl/browser/browser_task_actions.rs
index 6cd59f8ca0..1e2ff3c66f 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser_task_actions.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser_task_actions.rs
@@ -84,7 +84,7 @@ pub(super) fn task_inputs(args: &Value) -> anyhow::Result<BTreeMap<String, Strin
pub(super) async fn approve_task_action(
pending: &Pending,
browser: &crate::config::BrowserConfig,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
) -> anyhow::Result<bool> {
let clean = |raw: &str| {
let cleaned = raw.chars().filter(|c| !c.is_control()).collect::<String>();
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_unattended.rs b/crates/openhuman-core/src/tools/impl/browser/browser_unattended.rs
index 0df959d6b9..3b13175a3e 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser_unattended.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser_unattended.rs
@@ -7,7 +7,7 @@
//! unattended_actions` names the gated kinds such a turn may take without
//! asking; every other origin keeps the forced gate exactly as it was.
-use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
+use crate::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
use crate::config::BrowserConfig;
/// A turn the user authorized ahead of time and nobody is watching live.
diff --git a/crates/openhuman-core/src/tools/impl/system/schedule.rs b/crates/openhuman-core/src/tools/impl/system/schedule.rs
index 810b99dac7..d9cfce3c72 100644
--- a/crates/openhuman-core/src/tools/impl/system/schedule.rs
+++ b/crates/openhuman-core/src/tools/impl/system/schedule.rs
@@ -248,7 +248,7 @@ impl ScheduleTool {
&self,
action: &str,
args: &serde_json::Value,
- origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
+ origin: Option<&crate::security::turn_origin::AgentTurnOrigin>,
) -> Result<ToolResult> {
let command = args
.get("command")
diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rs
index 90333b73da..d39f3baf92 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs
@@ -2,7 +2,7 @@ use super::shell_description::{command_param_description, shell_description};
#[cfg(feature = "modules")]
use super::shell_support::container_environment;
use super::shell_support::{command_failure, exec_result, python_utf8_env, tool_timeout_message};
-use crate::agent::host_runtime::RuntimeAdapter;
+use crate::modules::tinybox::host_runtime::RuntimeAdapter;
use crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool;
use crate::config::Config;
use crate::core::runtime::DispatchCtx;
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_description.rs b/crates/openhuman-core/src/tools/impl/system/shell_description.rs
index 7a6ac2ebec..b9ca9a54b0 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_description.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_description.rs
@@ -5,7 +5,7 @@
//! a pure function of the contract's [`ShellFlavor`] so both flavors are testable
//! on any host.
-use crate::agent::host_runtime::ShellFlavor;
+use crate::modules::tinybox::host_runtime::ShellFlavor;
/// The `shell` tool description for the shell this host spawns. Models default
/// to POSIX syntax, so on Windows the description says outright that commands
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
index f13ee919ad..a712052e83 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::agent::host_runtime::{NativeRuntime, RuntimeAdapter};
+use crate::modules::tinybox::host_runtime::{NativeRuntime, RuntimeAdapter};
use crate::security::{AutonomyLevel, SecurityPolicy};
use tinybox_bus::CommandClass;
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs
index 503a4a6a14..e12ad99f62 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs
@@ -5,7 +5,7 @@
//! pinned on every CI host, not only on a Windows runner.
use super::*;
-use crate::agent::host_runtime::{host_shell_flavor, ShellFlavor};
+use crate::modules::tinybox::host_runtime::{host_shell_flavor, ShellFlavor};
#[cfg(feature = "modules")]
use crate::tools::system::shell_support::PYTHON_UTF8_DEFAULTS;
use std::collections::HashMap;
@@ -185,7 +185,7 @@ fn the_tool_describes_the_shell_its_runtime_spawns() {
#[test]
fn the_docker_runtime_always_runs_posix_sh() {
- let docker = crate::agent::host_runtime::create_runtime(
+ let docker = crate::modules::tinybox::host_runtime::create_runtime(
&crate::config::RuntimeConfig {
kind: "docker".into(),
..crate::config::RuntimeConfig::default()
diff --git a/crates/openhuman-core/src/tools/impl/threads/spawn_worker_thread.rs b/crates/openhuman-core/src/tools/impl/threads/spawn_worker_thread.rs
index e33a1b22fb..9cedbc8eee 100644
--- a/crates/openhuman-core/src/tools/impl/threads/spawn_worker_thread.rs
+++ b/crates/openhuman-core/src/tools/impl/threads/spawn_worker_thread.rs
@@ -396,7 +396,7 @@ impl SpawnWorkerThreadTool {
);
if let Some(progress) = progress_sink {
let _ = progress
- .send(crate::agent::progress::AgentProgress::SubagentAwaitingUser {
+ .send(crate::progress::AgentProgress::SubagentAwaitingUser {
agent_id: outcome.agent_id.clone(),
task_id: outcome.task_id.clone(),
question: question.clone(),
@@ -449,7 +449,7 @@ impl SpawnWorkerThreadTool {
);
if let Some(progress) = progress_sink {
let _ = progress
- .send(crate::agent::progress::AgentProgress::SubagentFailed {
+ .send(crate::progress::AgentProgress::SubagentFailed {
agent_id: outcome.agent_id.clone(),
task_id: outcome.task_id.clone(),
error: "worker sub-agent was cancelled".into(),
diff --git a/crates/openhuman-core/src/tools/native_ops.rs b/crates/openhuman-core/src/tools/native_ops.rs
index df20950612..8c236720b8 100644
--- a/crates/openhuman-core/src/tools/native_ops.rs
+++ b/crates/openhuman-core/src/tools/native_ops.rs
@@ -1,7 +1,7 @@
use std::sync::Arc;
use std::time::Instant;
-use crate::agent::host_runtime::{NativeRuntime, RuntimeAdapter};
+use crate::modules::tinybox::host_runtime::{NativeRuntime, RuntimeAdapter};
use crate::config::Config;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index d9e10ee254..e848b3e0a2 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -1,8 +1,8 @@
#[cfg(feature = "mcp")]
use super::implementations::network::{McpListServersTool, McpListToolsTool};
use super::*;
-use crate::agent::host_runtime::{NativeRuntime, RuntimeAdapter};
-use crate::agent::tools::DelegateTool;
+use crate::modules::tinybox::host_runtime::{NativeRuntime, RuntimeAdapter};
+use crate::tools::delegate::DelegateTool;
use crate::config::{Config, DelegateAgentConfig};
use crate::security::{AuditLogger, SecurityPolicy};
use std::collections::HashMap;
diff --git a/crates/openhuman-core/src/triage/evaluator/arm.rs b/crates/openhuman-core/src/triage/evaluator/arm.rs
index 0cc6d20252..95850999d1 100644
--- a/crates/openhuman-core/src/triage/evaluator/arm.rs
+++ b/crates/openhuman-core/src/triage/evaluator/arm.rs
@@ -134,7 +134,7 @@ pub(super) async fn try_arm(
// tool call originating from this turn as remote-attacker input
// (the triage agent doesn't usually invoke such tools — it
// classifies and routes — but label correctly for defense in depth).
- origin: crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {
+ origin: crate::security::turn_origin::AgentTurnOrigin::ExternalChannel {
sender_name: None,
channel: envelope.source.slug().to_string(),
// Triage runs over an upstream envelope (composio / webhook /
diff --git a/crates/openhuman-core/src/triage/origin.rs b/crates/openhuman-core/src/triage/origin.rs
index fc3e231357..8367225fd3 100644
--- a/crates/openhuman-core/src/triage/origin.rs
+++ b/crates/openhuman-core/src/triage/origin.rs
@@ -20,7 +20,7 @@
//! desktop notification are not the same trust proposition, and one label for
//! both would have to be the weaker of the two.
-use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
+use crate::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
use super::envelope::TriggerEnvelope;
diff --git a/crates/openhuman-core/src/voice/live/session.rs b/crates/openhuman-core/src/voice/live/session.rs
index 169e377845..0935134df6 100644
--- a/crates/openhuman-core/src/voice/live/session.rs
+++ b/crates/openhuman-core/src/voice/live/session.rs
@@ -18,7 +18,7 @@ use super::providers;
use crate::agent::session_host::OpenHumanSessionHost;
use crate::agent::tinyagents::host::OpenHumanRunContext;
use crate::agent::tinyagents::live_harness::{assemble_live_tool_harness, LIVE_MAX_TOOL_CALLS};
-use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};
+use crate::security::turn_origin::{with_origin, AgentTurnOrigin};
use crate::config::schema::voice_live::is_live_provider;
use crate::config::Config;
use crate::security::approval::{ApprovalChatContext, ApprovalTurnContext};
diff --git a/crates/openhuman-core/src/voice/realtime_harness.rs b/crates/openhuman-core/src/voice/realtime_harness.rs
index 18e26b790a..0839efc0d3 100644
--- a/crates/openhuman-core/src/voice/realtime_harness.rs
+++ b/crates/openhuman-core/src/voice/realtime_harness.rs
@@ -29,7 +29,7 @@ pub use prompt::extract_prompt;
pub use turn_handler::handle_voice_harness_turn;
#[cfg(test)]
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
#[cfg(test)]
use prompt::{
is_answerable_prompt, is_content_free, messages_to_history_pairs, readback_payload,
diff --git a/crates/openhuman-core/src/voice/realtime_harness/agent.rs b/crates/openhuman-core/src/voice/realtime_harness/agent.rs
index 8db5d2a115..09ef61016d 100644
--- a/crates/openhuman-core/src/voice/realtime_harness/agent.rs
+++ b/crates/openhuman-core/src/voice/realtime_harness/agent.rs
@@ -8,9 +8,9 @@ use std::time::Duration;
use log::{info, warn};
use serde_json::Value;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::agent::session_host::OpenHumanSessionHost;
-use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};
+use crate::security::turn_origin::{with_origin, AgentTurnOrigin};
use super::chat_delivery::{VOICE_CHAT_CLIENT_ID, VOICE_CHAT_THREAD_ID};
use super::prompt::messages_to_history_pairs;
diff --git a/crates/openhuman-core/src/voice/realtime_harness/prompt.rs b/crates/openhuman-core/src/voice/realtime_harness/prompt.rs
index ee6fec751f..3465a99914 100644
--- a/crates/openhuman-core/src/voice/realtime_harness/prompt.rs
+++ b/crates/openhuman-core/src/voice/realtime_harness/prompt.rs
@@ -3,7 +3,7 @@
//! (content-free, answerable, read-back), and picking the spoken text out of
//! a streamed progress event.
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use serde_json::Value;
/// Instruction prefix used for "speak-back": when a deferred result is ready, the
diff --git a/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs b/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs
index 204a821acc..bcccddeac9 100644
--- a/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs
+++ b/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs
@@ -11,7 +11,7 @@ use log::{info, warn};
use serde_json::{json, Value};
use tokio::sync::Semaphore;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use super::agent::run_voice_turn;
use super::chat_delivery::{
diff --git a/crates/openhuman-core/src/web_chat/journal_shadow.rs b/crates/openhuman-core/src/web_chat/journal_shadow.rs
index 84ce07e64e..870445e6b4 100644
--- a/crates/openhuman-core/src/web_chat/journal_shadow.rs
+++ b/crates/openhuman-core/src/web_chat/journal_shadow.rs
@@ -8,7 +8,7 @@
//! lists, and drive the comparison for one request.
//!
//! What the comparison means is documented on
-//! [`journal_projection`](crate::agent::progress_tracing::journal_projection):
+//! [`journal_projection`](crate::core::observability::progress_tracing::journal_projection):
//! both sides fold through the same `SpanCollector`, so span-shape parity holds
//! by construction and a divergence is a real gap rather than an artefact of
//! comparing two different abstractions. The largest such gap today is that the
@@ -142,7 +142,7 @@ pub(super) async fn shadow_compare_journal_projection(
return None;
}
- let projected = crate::agent::progress_tracing::journal_projection::spans_from_observations(
+ let projected = crate::core::observability::progress_tracing::journal_projection::spans_from_observations(
trace_ctx,
max_iterations,
&observations,
diff --git a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
index e6a17ea869..16316a33e0 100644
--- a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
+++ b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
@@ -60,7 +60,7 @@ pub(crate) async fn spawn_parallel_turn(
client_id: client_id_task.clone(),
request_id: Some(request_id_task.clone()),
};
- let origin = crate::agent::turn_origin::AgentTurnOrigin::WebChat {
+ let origin = crate::security::turn_origin::AgentTurnOrigin::WebChat {
thread_id: thread_id_task.clone(),
client_id: client_id_task.clone(),
request_id: Some(request_id_task.clone()),
diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
index 7a8740256f..36e30ad665 100644
--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs
+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
@@ -509,7 +509,7 @@ async fn start_chat_inner(
client_id: client_id_task.clone(),
request_id: Some(request_id_task.clone()),
};
- let origin = crate::agent::turn_origin::AgentTurnOrigin::WebChat {
+ let origin = crate::security::turn_origin::AgentTurnOrigin::WebChat {
thread_id: thread_id_task.clone(),
client_id: client_id_task.clone(),
request_id: Some(request_id_task.clone()),
diff --git a/crates/openhuman-core/src/web_chat/ops/system_turn.rs b/crates/openhuman-core/src/web_chat/ops/system_turn.rs
index dbc323862b..dc269c5021 100644
--- a/crates/openhuman-core/src/web_chat/ops/system_turn.rs
+++ b/crates/openhuman-core/src/web_chat/ops/system_turn.rs
@@ -17,7 +17,7 @@
use std::sync::Arc;
use tinyagents_harness::run_queue::RunQueue;
-use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};
+use crate::security::turn_origin::{with_origin, AgentTurnOrigin};
use super::super::run_task::turn_error_discards_session;
use super::super::session::{
diff --git a/crates/openhuman-core/src/web_chat/ops/turn_guards.rs b/crates/openhuman-core/src/web_chat/ops/turn_guards.rs
index 88e03b89bf..d55436a37c 100644
--- a/crates/openhuman-core/src/web_chat/ops/turn_guards.rs
+++ b/crates/openhuman-core/src/web_chat/ops/turn_guards.rs
@@ -35,7 +35,7 @@ use crate::agent::turn_env::HostTurnEnv;
/// like a wedged one. Override via `OPENHUMAN_WEB_TURN_TIMEOUT_SECS`; set it to
/// `0` to disable the backstop and the derived deadlines with it.
fn web_turn_deadline() -> Option<Duration> {
- crate::agent::session_host::turn_backstop::configured_backstop()
+ crate::web_chat::turn_guards::backstop::configured_backstop()
}
/// The backstop for a turn that has to be allowed to run long: one on a local /
@@ -228,7 +228,7 @@ fn turn_host_env(
pub(crate) async fn run_turn_under_cancel_and_deadline<B, F>(
ctx: &crate::core::runtime::DispatchCtx,
cancel_token: CancellationToken,
- origin: crate::agent::turn_origin::AgentTurnOrigin,
+ origin: crate::security::turn_origin::AgentTurnOrigin,
approval_ctx: crate::security::approval::ApprovalChatContext,
build_turn: B,
) -> Option<Result<WebChatTaskResult, String>>
@@ -251,7 +251,7 @@ where
turn_activity::configured_idle_window(),
ids,
|activity| {
- crate::agent::turn_origin::with_origin(
+ crate::security::turn_origin::with_origin(
origin,
build_turn(
env,
diff --git a/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs b/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs
index fa33d95e27..e5e840d94d 100644
--- a/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs
+++ b/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs
@@ -63,8 +63,8 @@ async fn backstop_firing_yields_a_classified_turn_timeout_error() {
assert!(!classified.message.trim().is_empty());
}
-fn text_delta() -> crate::agent::progress::AgentProgress {
- crate::agent::progress::AgentProgress::TextDelta {
+fn text_delta() -> crate::progress::AgentProgress {
+ crate::progress::AgentProgress::TextDelta {
delta: "x".into(),
iteration: 1,
}
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rs
index c305905fdd..ce3671d9d1 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs
@@ -221,7 +221,7 @@ fn session_profile_user_attribution(config: &crate::config::Config) -> Option<St
/// with the correct client/thread/request IDs. The task runs until the
/// sender is dropped (i.e. when the agent turn finishes).
pub(crate) fn spawn_progress_bridge(
- mut rx: tokio::sync::mpsc::Receiver<crate::agent::progress::AgentProgress>,
+ mut rx: tokio::sync::mpsc::Receiver<crate::progress::AgentProgress>,
client_id: String,
thread_id: String,
request_id: String,
@@ -230,7 +230,7 @@ pub(crate) fn spawn_progress_bridge(
config: crate::config::Config,
dispatch_ctx: crate::core::runtime::DispatchCtx,
) -> ProgressBridgeHandle {
- use crate::agent::progress::AgentProgress;
+ use crate::progress::AgentProgress;
use std::collections::HashMap;
use tinyagents_session::run_ledger::{
AgentRunKind, AgentRunStatus, AgentRunUpsert, RunEventAppend, RunTelemetryUpsert,
@@ -1084,7 +1084,7 @@ pub(crate) fn spawn_progress_bridge(
};
if let Some((trace_ctx, observations)) = journal_export {
let run_telemetry = ledger_get_telemetry(&config, &request_id);
- crate::agent::progress_tracing::export_run_trace_from_journal(
+ crate::core::observability::progress_tracing::export_run_trace_from_journal(
&config,
&trace_ctx,
&observations,
@@ -1093,7 +1093,7 @@ pub(crate) fn spawn_progress_bridge(
)
.await;
} else {
- crate::agent::progress_tracing::export_run_trace(&config, &live_spans).await;
+ crate::core::observability::progress_tracing::export_run_trace(&config, &live_spans).await;
}
}
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
index 670a07ceab..43387bced3 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
@@ -118,7 +118,7 @@ async fn tool_call_completed_forwards_real_output_on_tool_result() {
crate::core::runtime::DispatchCtx::ambient(),
);
- tx.send(crate::agent::progress::AgentProgress::ToolCallCompleted {
+ tx.send(crate::progress::AgentProgress::ToolCallCompleted {
call_id: "call-1".into(),
tool_name: "web_search".into(),
success: true,
@@ -188,7 +188,7 @@ fn worktree_detail_forwards_isolated_worker_fields() {
// ── #4270 inference heartbeat ────────────────────────────────────────────
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use crate::config::Config;
use std::time::Duration;
use tokio::sync::broadcast::error::TryRecvError;
@@ -569,7 +569,7 @@ fn cap_wire_args_truncates_oversized_payload_to_a_marker_string() {
/// spawning tool call (#C1).
#[tokio::test]
async fn hold_text_stream_suppresses_text_delta_but_keeps_interim() {
- use crate::agent::progress::AgentProgress;
+ use crate::progress::AgentProgress;
let tmp = tempfile::TempDir::new().unwrap();
let config = crate::config::Config {
workspace_dir: tmp.path().join("workspace"),
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_trace.rs b/crates/openhuman-core/src/web_chat/progress_bridge_trace.rs
index 3836d5b74b..79dacccfb0 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge_trace.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge_trace.rs
@@ -5,7 +5,7 @@
//! thread id for headless/autonomous runs). Disabled (both the remote and the
//! local exporter off), it costs nothing.
-use crate::agent::progress_tracing::SpanCollector;
+use crate::core::observability::progress_tracing::SpanCollector;
use tinyagents_harness::observability::trace_export as te;
use super::super::types::ChatRequestMetadata;
diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rs
index 6bd34c2ad0..afb481da16 100644
--- a/crates/openhuman-core/src/web_chat/run_task.rs
+++ b/crates/openhuman-core/src/web_chat/run_task.rs
@@ -7,7 +7,7 @@
use std::sync::Arc;
use tinyagents_harness::run_queue::RunQueue;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
use super::ops::BudgetCorrelation;
use super::progress_bridge::spawn_progress_bridge;
@@ -35,7 +35,7 @@ pub(crate) async fn run_chat_task(
locale: Option<String>,
run_queue: Arc<RunQueue<crate::agent::queued_turn::QueuedTurn>>,
metadata: ChatRequestMetadata,
- origin: crate::agent::turn_origin::AgentTurnOrigin,
+ origin: crate::security::turn_origin::AgentTurnOrigin,
// When true, run as an isolated fork: build a fresh agent seeded from the
// thread's history-at-start and never touch the shared `THREAD_SESSIONS`
// cache, so a concurrent same-thread (parallel) turn cannot clobber — or be
diff --git a/crates/openhuman-core/src/web_chat/turn_activity.rs b/crates/openhuman-core/src/web_chat/turn_activity.rs
index 4ed7e9e4cd..f1ac17ea96 100644
--- a/crates/openhuman-core/src/web_chat/turn_activity.rs
+++ b/crates/openhuman-core/src/web_chat/turn_activity.rs
@@ -37,7 +37,7 @@ use std::time::Duration;
use tokio::sync::mpsc;
use tokio::time::Instant;
-use crate::agent::progress::AgentProgress;
+use crate::progress::AgentProgress;
/// Default idle window for a web-chat turn, in seconds.
pub(crate) const DEFAULT_TURN_IDLE_SECS: u64 = 900;