Skip to content

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

refactor(triage): move triage module out of agent namespace

Steven Enamakel3837b3171ffe
diff --git a/crates/openhuman-core/src/agent/context/README.md b/crates/openhuman-core/src/agent/context/README.md
index a13201fdc1..a7e49b9174 100644
--- a/crates/openhuman-core/src/agent/context/README.md
+++ b/crates/openhuman-core/src/agent/context/README.md
@@ -76,7 +76,7 @@ No `store.rs`. State is per-session and in-memory:
- `agent::tinyagents`: `turn_middleware.rs` reads `CLEARED_PLACEHOLDER` when configuring `MicrocompactMiddleware`; `payload_summarizer.rs` and `host/context_composer.rs` build `PromptContext`s through `agent::prompts`.
- **`agent_registry::agents/*/prompt.rs`**, `flows/agents/*/prompt.rs`, `skills/*/agent/*/prompt.rs`: archetype prompt modules pull prompt sections/builder through `agent::prompts`.
- `channels`: [`channels/system_prompt.rs`](../../channels/system_prompt.rs) (`ChannelSystemPrompt`, used by [`channels/runtime/startup/start_channels.rs`](../../channels/runtime/startup/start_channels.rs)) calls `channels_prompt::build_system_prompt_with_identity`; [`channels/mod.rs`](../../channels/mod.rs) re-exports `build_system_prompt`; the `channels/tests/*` prompt/identity tests call it directly.
-- `agent::triage`, `agent::debug`, `agent::orchestration::tools` (spawn_subagent and friends), `tools::orchestrator_tools`, `integrations::composio`: consume prompt types (`PromptContext`, `PromptSection`, `ToolCallFormat`, `ConnectedIntegration`, …) via `agent::prompts`.
+- `triage`, `agent::debug`, `agent::orchestration::tools` (spawn_subagent and friends), `tools::orchestrator_tools`, `integrations::composio`: consume prompt types (`PromptContext`, `PromptSection`, `ToolCallFormat`, `ConnectedIntegration`, …) via `agent::prompts`.
## Notes / gotchas
diff --git a/crates/openhuman-core/src/agent_runs/schemas.rs b/crates/openhuman-core/src/agent_runs/schemas.rs
index 92ac8217ca..ab8d788371 100644
--- a/crates/openhuman-core/src/agent_runs/schemas.rs
+++ b/crates/openhuman-core/src/agent_runs/schemas.rs
@@ -375,7 +375,7 @@ fn handle_triage_evaluate(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
let toolkit = p.toolkit.as_deref().unwrap_or("unknown");
let trigger = p.trigger.as_deref().unwrap_or("unknown");
let eid = p.external_id.as_deref().unwrap_or("rpc");
- crate::agent::triage::TriggerEnvelope::from_composio(
+ crate::triage::TriggerEnvelope::from_composio(
toolkit, trigger, "rpc", eid, p.payload,
)
}
@@ -384,7 +384,7 @@ fn handle_triage_evaluate(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
let tunnel_id = p.external_id.as_deref().unwrap_or("unknown");
let method = p.toolkit.as_deref().unwrap_or("POST");
let path = p.trigger.as_deref().unwrap_or("/");
- crate::agent::triage::TriggerEnvelope::from_webhook(
+ crate::triage::TriggerEnvelope::from_webhook(
tunnel_id, method, path, p.payload,
)
}
@@ -399,13 +399,13 @@ fn handle_triage_evaluate(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
.get("output")
.and_then(Value::as_str)
.unwrap_or(job_name);
- crate::agent::triage::TriggerEnvelope::from_cron(job_id, job_name, output)
+ crate::triage::TriggerEnvelope::from_cron(job_id, job_name, output)
}
"external" => {
tracing::trace!("[rpc][agent] building external trigger envelope");
let caller_id = p.external_id.as_deref().unwrap_or("unknown");
let reason = p.display_label.as_str();
- crate::agent::triage::TriggerEnvelope::from_external(caller_id, reason, p.payload)
+ crate::triage::TriggerEnvelope::from_external(caller_id, reason, p.payload)
}
other => {
tracing::warn!(source = %other, "[rpc][agent] unsupported trigger source");
@@ -421,22 +421,22 @@ fn handle_triage_evaluate(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
"[rpc][agent] running triage pipeline"
);
- let outcome = crate::agent::triage::run_triage(&ctx, &envelope)
+ let outcome = crate::triage::run_triage(&ctx, &envelope)
.await
.map_err(|e| format!("triage evaluation failed: {e}"))?;
let dry_run = p.dry_run.unwrap_or(false);
match outcome {
- crate::agent::triage::TriageOutcome::Decision(run) => {
+ crate::triage::TriageOutcome::Decision(run) => {
if !dry_run {
// Locally initiated: this is the desktop's own RPC surface,
// so the dispatch keeps the authority its caller already
// had. The envelope it builds may name a remote *source*,
// but the request itself is local (#5634).
- let origin = crate::agent::triage::local_trigger_origin();
+ let origin = crate::triage::local_trigger_origin();
crate::agent::turn_origin::with_origin(
origin,
- crate::agent::triage::apply_decision(&ctx, run.clone(), &envelope),
+ crate::triage::apply_decision(&ctx, run.clone(), &envelope),
)
.await
.map_err(|e| format!("apply_decision failed: {e}"))?;
@@ -453,7 +453,7 @@ fn handle_triage_evaluate(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
"dry_run": dry_run,
}))
}
- crate::agent::triage::TriageOutcome::Deferred {
+ crate::triage::TriageOutcome::Deferred {
defer_until_ms,
reason,
} => {
@@ -469,7 +469,7 @@ fn handle_triage_evaluate(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
"dry_run": dry_run,
}))
}
- crate::agent::triage::TriageOutcome::Terminal { reason } => Ok(serde_json::json!({
+ crate::triage::TriageOutcome::Terminal { reason } => Ok(serde_json::json!({
"decision": "terminal",
"resolution_path": "terminal",
"reason": reason,
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 c25b616558..b7f32308ef 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
@@ -88,7 +88,7 @@ pub(super) async fn dispatch_bus_turn(
// operator config; the desktop / web-chat path (where the user
// owns the local filesystem) goes through a different turn
// builder and keeps the operator default. Mirrors the triage-arm
- // hardening in `agent::triage::evaluator`.
+ // hardening in `triage::evaluator`.
multimodal_files: crate::config::MultimodalFileConfig::for_untrusted_channel_input(),
max_tool_iterations: ctx.max_tool_iterations,
on_delta: None, // on_progress handles text deltas now
diff --git a/crates/openhuman-core/src/config/schema/tools/multimodal.rs b/crates/openhuman-core/src/config/schema/tools/multimodal.rs
index 269620b1bf..710a54f3f8 100644
--- a/crates/openhuman-core/src/config/schema/tools/multimodal.rs
+++ b/crates/openhuman-core/src/config/schema/tools/multimodal.rs
@@ -120,7 +120,7 @@ impl MultimodalFileConfig {
/// `[tools.multimodal_files]` block in `config.toml`.
///
/// Mirrors the triage-arm hardening in
- /// `openhuman::agent::triage::evaluator`. Apply at the per-turn
+ /// `openhuman::triage::evaluator`. Apply at the per-turn
/// application site (the channel-runtime dispatcher) — the
/// operator-supplied `config.multimodal_files` stays the source of
/// truth for the desktop / web-chat path where the user owns the
diff --git a/crates/openhuman-core/src/core/events.rs b/crates/openhuman-core/src/core/events.rs
index 95dc67713e..c0a591785c 100644
--- a/crates/openhuman-core/src/core/events.rs
+++ b/crates/openhuman-core/src/core/events.rs
@@ -923,12 +923,12 @@ pub enum DomainEvent {
// ── Triage ──────────────────────────────────────────────────────────
//
- // Published by `crate::agent::triage` when an external
+ // Published by `crate::triage` when an external
// trigger (Composio webhook today, cron / webhook / other sources
// later) has been classified by the trigger-triage agent. The
// `source` field is a short slug like `"composio"` / `"cron"` so the
// events stay source-agnostic — any module that calls
- // `agent::triage::run_triage` will publish these.
+ // `triage::run_triage` will publish these.
/// A trigger event was evaluated by the triage agent and assigned
/// one of the four actions (drop / acknowledge / react / escalate).
TriggerEvaluated {
diff --git a/crates/openhuman-core/src/cron/scheduler_gate/README.md b/crates/openhuman-core/src/cron/scheduler_gate/README.md
index 71c02f6798..7c05653c98 100644
--- a/crates/openhuman-core/src/cron/scheduler_gate/README.md
+++ b/crates/openhuman-core/src/cron/scheduler_gate/README.md
@@ -58,7 +58,7 @@ No dependency on any other `openhuman` domain or on `crate::core::*`.
Consumed in-process across the codebase (discoverable via `grep scheduler_gate`):
-- Background workers / pipelines: `autocomplete/core/engine.rs`, `task_sources/route.rs`, [`agent/triage/evaluator.rs`](../../agent/triage/evaluator.rs).
+- Background workers / pipelines: `autocomplete/core/engine.rs`, `task_sources/route.rs`, [`triage/evaluator.rs`](../../triage/evaluator.rs).
- Inference layer: `inference/provider/openhuman_backend.rs`, [`inference/provider/factory.rs`](../../inference/provider/factory.rs), `inference/local/service/{vision_embed.rs,public_infer.rs}`, `inference/voice/postprocess.rs`.
- Credentials lifecycle (signed-out kill switch): `credentials/ops.rs`, `credentials/bus.rs`.
- Bootstrap / transport: [`core/runtime/subscribers.rs`](../../core/runtime/subscribers.rs) (calls `init_global` during server bootstrap), [`core/observability.rs`](../../core/observability.rs), plus the domain wiring in `openhuman/mod.rs` and config schema in [`config/schema/scheduler_gate.rs`](../../config/schema/scheduler_gate.rs).
diff --git a/crates/openhuman-core/src/cron/scheduler_gate/gate.rs b/crates/openhuman-core/src/cron/scheduler_gate/gate.rs
index 8613be7502..d20a5383f2 100644
--- a/crates/openhuman-core/src/cron/scheduler_gate/gate.rs
+++ b/crates/openhuman-core/src/cron/scheduler_gate/gate.rs
@@ -327,7 +327,7 @@ impl Drop for SignedOutTestGuard {
/// background-worker pool to stand down, but the per-runtime `signed_out` flag
/// can still be `true` from an earlier test that exercised the credentials / 401
/// paths, and honouring it would make every later caller poll forever (the
-/// `openhuman::agent::triage::evaluator::tests::*` hangs reported after #1516).
+/// `openhuman::triage::evaluator::tests::*` hangs reported after #1516).
///
/// Returns `None` only if the global LLM semaphore has been closed
/// (never happens in production). Callers can safely treat `None` as "skip the
diff --git a/crates/openhuman-core/src/cron/scheduler_gate/gate_tests.rs b/crates/openhuman-core/src/cron/scheduler_gate/gate_tests.rs
index befd5fdc9b..07786a62ef 100644
--- a/crates/openhuman-core/src/cron/scheduler_gate/gate_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_gate/gate_tests.rs
@@ -126,7 +126,7 @@ async fn signed_out_is_ignored_when_gate_uninit() {
#[tokio::test]
async fn wait_for_capacity_acquires_immediately_when_signed_out_and_uninit() {
// Regression test for the
- // `openhuman::agent::triage::evaluator::tests::*` hangs that surfaced
+ // `openhuman::triage::evaluator::tests::*` hangs that surfaced
// after #1516 added the `signed_out` override. Earlier tests in the
// same `cargo test` binary that exercise `clear_session` /
// `SessionExpiredSubscriber` / the RPC 401 path can leave the
diff --git a/crates/openhuman-core/src/desktop/notifications/README.md b/crates/openhuman-core/src/desktop/notifications/README.md
index a9e4c1e359..2a24e69e6b 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::agent::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::agent::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 77aed83e33..dc96022825 100644
--- a/crates/openhuman-core/src/desktop/notifications/rpc.rs
+++ b/crates/openhuman-core/src/desktop/notifications/rpc.rs
@@ -13,7 +13,7 @@ use chrono::Utc;
use serde_json::{json, Map, Value};
use uuid::Uuid;
-use crate::agent::triage::{
+use crate::triage::{
apply_decision, local_trigger_origin, run_triage, TriageOutcome, TriggerEnvelope, TriggerSource,
};
use crate::agent::turn_origin::with_origin;
@@ -478,8 +478,8 @@ pub async fn handle_stats(ctx: &DispatchCtx, _params: Map<String, Value>) -> Res
/// Map the triage decision to a 0.0–1.0 importance score so the frontend
/// can sort/filter without understanding triage action semantics.
-fn triage_action_to_score(action: crate::agent::triage::TriageAction) -> f32 {
- use crate::agent::triage::TriageAction;
+fn triage_action_to_score(action: crate::triage::TriageAction) -> f32 {
+ use crate::triage::TriageAction;
match action {
TriageAction::Drop => 0.1,
TriageAction::Acknowledge => 0.35,
diff --git a/crates/openhuman-core/src/inference/provider/factory/turn_model.rs b/crates/openhuman-core/src/inference/provider/factory/turn_model.rs
index d7ecf3dee0..763461aa77 100644
--- a/crates/openhuman-core/src/inference/provider/factory/turn_model.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/turn_model.rs
@@ -178,7 +178,7 @@ pub(super) fn create_turn_chat_model_with_native_tools_and_route_inner(
/// explicit-string counterpart of [`create_turn_chat_model`], for producers
/// whose effective provider differs from the role's default resolution.
///
-/// The triage path needs this: [`build_remote_provider`](crate::agent::triage::routing)
+/// The triage path needs this: [`build_remote_provider`](crate::triage::routing)
/// forces the managed backend (`provider_string == `[`PROVIDER_OPENHUMAN`]) when the
/// chat route is local / BYOK-incomplete — the #1257 *"triage never goes
/// local"* invariant — which a plain [`create_turn_chat_model`] (role → `provider_for_role`)
diff --git a/crates/openhuman-core/src/integrations/composio/README.md b/crates/openhuman-core/src/integrations/composio/README.md
index c5baf7247e..930fa5b015 100644
--- a/crates/openhuman-core/src/integrations/composio/README.md
+++ b/crates/openhuman-core/src/integrations/composio/README.md
@@ -137,7 +137,7 @@ From `tools.rs` (`all_composio_agent_tools`, registered only when `agent::subage
The subscribers live in `bus/`. All three are registered by one call, `register_composio_trigger_subscriber()`, from [`crates/openhuman-core/src/core/runtime/subscribers.rs`](../../core/runtime/subscribers.rs) after trigger history initialization:
-- **`ComposioTriggerSubscriber`**, reacts to `DomainEvent::ComposioTriggerReceived` (published by `platform::socket::event_handlers` when the backend emits `composio:trigger`); archives the event to `trigger_history` and routes it through `agent::triage::run_triage` unless `OPENHUMAN_TRIGGER_TRIAGE_DISABLED`, `composio.triage_disabled`, or `composio.triage_disabled_toolkits` opts out.
+- **`ComposioTriggerSubscriber`**, reacts to `DomainEvent::ComposioTriggerReceived` (published by `platform::socket::event_handlers` when the backend emits `composio:trigger`); archives the event to `trigger_history` and routes it through `triage::run_triage` unless `OPENHUMAN_TRIGGER_TRIAGE_DISABLED`, `composio.triage_disabled`, or `composio.triage_disabled_toolkits` opts out.
- **`ComposioConnectionCreatedSubscriber`**, reacts to `DomainEvent::ComposioConnectionCreated` (published by `composio_authorize`); waits for the connection to go active, invalidates and eagerly warms the integrations cache, then (after onboarding, for toolkits with a native identity provider) fetches the profile.
- **`ComposioConfigChangedSubscriber`**, reacts to `DomainEvent::ComposioConfigChanged` (mode/api-key changes).
diff --git a/crates/openhuman-core/src/integrations/composio/bus.rs b/crates/openhuman-core/src/integrations/composio/bus.rs
index 9cfadf6f58..4fb90d17b3 100644
--- a/crates/openhuman-core/src/integrations/composio/bus.rs
+++ b/crates/openhuman-core/src/integrations/composio/bus.rs
@@ -7,7 +7,7 @@
//! [`DomainEvent::ComposioTriggerReceived`] (the backend HMAC-verifies a
//! Composio webhook and emits `composio:trigger` over Socket.IO). Archives
//! the trigger and, unless `OPENHUMAN_TRIGGER_TRIAGE_DISABLED` or the config
-//! opts out, routes it through `agent::triage`.
+//! opts out, routes it through `triage`.
//! - [`ComposioConnectionCreatedSubscriber`] — handles
//! [`DomainEvent::ComposioConnectionCreated`]: waits for the connection to
//! become active, refreshes the integrations cache, fetches the account
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 d5a5794414..2fe7c22f53 100644
--- a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
+++ b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
@@ -4,7 +4,7 @@ use crate::core::runtime::DispatchCtx;
use async_trait::async_trait;
use tinybus::EventHandler;
-use crate::agent::triage::{
+use crate::triage::{
apply_decision, remote_trigger_origin, run_triage, TriageOutcome, TriggerEnvelope,
};
use crate::agent::turn_origin::with_origin;
@@ -18,7 +18,7 @@ use crate::integrations::composio::trigger_history;
pub(super) const TRIAGE_DISABLED_ENV: &str = "OPENHUMAN_TRIGGER_TRIAGE_DISABLED";
/// Logs and (when enabled) routes `ComposioTriggerReceived` events
-/// through the reusable `agent::triage` pipeline.
+/// through the reusable `triage` pipeline.
pub struct ComposioTriggerSubscriber;
impl ComposioTriggerSubscriber {
@@ -181,7 +181,7 @@ impl EventHandler<DomainEvent> for ComposioTriggerSubscriber {
tracing::debug!(
label = %envelope.display_label,
external_id = %envelope.external_id,
- "[composio][triage] dispatching to agent::triage::run_triage"
+ "[composio][triage] dispatching to triage::run_triage"
);
// Spawn so the bus dispatch loop stays non-blocking — the
diff --git a/crates/openhuman-core/src/integrations/task_sources/README.md b/crates/openhuman-core/src/integrations/task_sources/README.md
index 3244e958a3..8dd58210e0 100644
--- a/crates/openhuman-core/src/integrations/task_sources/README.md
+++ b/crates/openhuman-core/src/integrations/task_sources/README.md
@@ -142,7 +142,7 @@ SQL cascade). With no backend configured (the desktop default)
- `crate::core::bus` (`BUS`) + `crate::core::events::DomainEvent`: `BUS.publish`/`BUS.subscribe` for event publish/subscribe.
- `crate::config` (+ `config::rpc`), `Config`, `load_config_with_timeout`; reads the `[task_sources]` block for defaults and the master switch.
- `crate::integrations::composio::contract`: `NormalizedTask`, `TaskContainer`, `TaskFetchFilter`, `TaskKind` (contract types re-exported from `tinymemory_api::composio::tasks`). The old `get_provider` / `ProviderContext` / `ComposioProvider::fetch_tasks` registry no longer exists; `mod.rs`'s intra-doc link to `fetch_tasks` is stale.
-- `crate::agent::triage`: `run_triage`, `apply_decision`, `TriageOutcome`, `TriggerEnvelope`; dispatches the proactive agent turn for `AgentTodoProactive` sources.
+- `crate::triage`: `run_triage`, `apply_decision`, `TriageOutcome`, `TriggerEnvelope`; dispatches the proactive agent turn for `AgentTodoProactive` sources.
- `crate::cron::scheduler_gate`: `wait_for_capacity` capacity semaphore; gates proactive triage turns behind background-AI throttling.
## Used by
diff --git a/crates/openhuman-core/src/integrations/task_sources/route.rs b/crates/openhuman-core/src/integrations/task_sources/route.rs
index 9d874fc08f..672d5afe84 100644
--- a/crates/openhuman-core/src/integrations/task_sources/route.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/route.rs
@@ -16,7 +16,7 @@
use serde_json::json;
-use crate::agent::triage::{
+use crate::triage::{
apply_decision, remote_trigger_origin, run_triage, TriageOutcome, TriggerEnvelope,
};
use crate::agent::turn_origin::with_origin;
diff --git a/crates/openhuman-core/src/security/approval/README.md b/crates/openhuman-core/src/security/approval/README.md
index e1792cb313..378b4899ad 100644
--- a/crates/openhuman-core/src/security/approval/README.md
+++ b/crates/openhuman-core/src/security/approval/README.md
@@ -102,7 +102,7 @@ stored as JSON strings. With no backend configured (the desktop default)
- `crates/openhuman-core/src/core/all.rs`: registers the controller schemas.
- `crates/openhuman-core/src/agent/tinyagents/middleware.rs` (`ApprovalSecurityMiddleware`, a `wrap_tool` middleware on every turn path): routes external-effect tool calls through the gate before `execute()` and records the terminal audit row.
- `crates/openhuman-core/src/web_chat/`: hands each turn its chat `ApprovalTurnContext`, hosts `ApprovalSurfaceSubscriber`, and routes typed yes/no replies to `approval_decide`.
-- `crates/openhuman-core/src/channels/proactive.rs`, `crates/openhuman-core/src/agent/triage/escalation.rs`, `crates/openhuman-core/src/tools/impl/system/install_tool.rs`, `crates/openhuman-core/src/web3/wallet/execution.rs`: interact with the gate / approval types.
+- `crates/openhuman-core/src/channels/proactive.rs`, `crates/openhuman-core/src/triage/escalation.rs`, `crates/openhuman-core/src/tools/impl/system/install_tool.rs`, `crates/openhuman-core/src/web3/wallet/execution.rs`: interact with the gate / approval types.
## Notes / gotchas
diff --git a/crates/openhuman-core/src/security/approval/gate_core_flow_tests.rs b/crates/openhuman-core/src/security/approval/gate_core_flow_tests.rs
index 7847d7cf62..bd0646f58a 100644
--- a/crates/openhuman-core/src/security/approval/gate_core_flow_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_core_flow_tests.rs
@@ -411,7 +411,7 @@ async fn auto_approve_all_overrides_require_approval_workflow() {
/// wrong response.
#[tokio::test]
async fn auto_approve_all_allows_a_remote_triage_dispatch_without_an_audit_row() {
- use crate::agent::triage::{remote_trigger_origin, TriggerEnvelope};
+ use crate::triage::{remote_trigger_origin, TriggerEnvelope};
let _env = crate::config::TEST_ENV_LOCK.lock().await;
let (gate, dir) = test_gate();
diff --git a/crates/openhuman-core/src/security/approval/gate_triage_tests.rs b/crates/openhuman-core/src/security/approval/gate_triage_tests.rs
index 55acf70689..8ed207e7c7 100644
--- a/crates/openhuman-core/src/security/approval/gate_triage_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_triage_tests.rs
@@ -40,7 +40,7 @@ fn parse_approval_reply_maps_yes_no_and_rejects_other() {
/// audit trail, not restored function.
#[tokio::test]
async fn a_remote_triage_escalation_parks_with_an_audit_row_rather_than_an_unknown_denial() {
- use crate::agent::triage::{remote_trigger_origin, TriggerEnvelope};
+ use crate::triage::{remote_trigger_origin, TriggerEnvelope};
let (gate, _dir) = test_gate();
let envelope = TriggerEnvelope::from_composio(
@@ -86,7 +86,7 @@ async fn a_remote_triage_escalation_parks_with_an_audit_row_rather_than_an_unkno
/// simplification to one blanket label would have to break one of them.
#[tokio::test]
async fn a_local_triage_escalation_is_allowed_without_a_prompt() {
- use crate::agent::triage::local_trigger_origin;
+ use crate::triage::local_trigger_origin;
let (gate, _dir) = test_gate();
let outcome = turn_origin::with_origin(
diff --git a/crates/openhuman-core/src/skills/webhooks/README.md b/crates/openhuman-core/src/skills/webhooks/README.md
index 8d3510223a..eea649163e 100644
--- a/crates/openhuman-core/src/skills/webhooks/README.md
+++ b/crates/openhuman-core/src/skills/webhooks/README.md
@@ -79,7 +79,7 @@ Note that nothing in the production startup path currently constructs a `Webhook
- `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`: RPC schema types.
- `crate::core::observability::report_error`: error reporting for body-decode / agent-trigger failures.
- `crate::platform::socket::global_socket_manager`: obtain the `WebhookRouter` (stored on the socket manager) and `emit` responses over the socket.
-- `crate::agent::triage`: `TriggerEnvelope`, `run_triage`, `apply_decision`, `TriageOutcome` for agent-tunnel routing and `trigger_agent`.
+- `crate::triage`: `TriggerEnvelope`, `run_triage`, `apply_decision`, `TriageOutcome` for agent-tunnel routing and `trigger_agent`.
- `crate::config::{Config, rpc::load_config_with_timeout}`: config for local webhook routing operations.
- `crate::rpc::RpcOutcome`: handler return contract.
diff --git a/crates/openhuman-core/src/skills/webhooks/bus.rs b/crates/openhuman-core/src/skills/webhooks/bus.rs
index 6a50ed0069..46a9d4fba2 100644
--- a/crates/openhuman-core/src/skills/webhooks/bus.rs
+++ b/crates/openhuman-core/src/skills/webhooks/bus.rs
@@ -121,7 +121,7 @@ impl EventHandler<DomainEvent> for WebhookRequestSubscriber {
(resp, None, Some(e.to_string()))
} else {
let payload = decoded.unwrap();
- let envelope = crate::agent::triage::TriggerEnvelope::from_webhook(
+ let envelope = crate::triage::TriggerEnvelope::from_webhook(
&tunnel_uuid,
&method,
&path,
@@ -306,21 +306,21 @@ fn decode_webhook_body(base64_body: &str) -> Result<serde_json::Value, String> {
/// human-readable decision summary on success.
async fn run_agent_trigger(
ctx: &crate::core::runtime::DispatchCtx,
- envelope: &crate::agent::triage::TriggerEnvelope,
+ envelope: &crate::triage::TriggerEnvelope,
) -> Result<String, String> {
- let outcome = crate::agent::triage::run_triage(ctx, envelope)
+ let outcome = crate::triage::run_triage(ctx, envelope)
.await
.map_err(|e| format!("triage evaluation failed: {e}"))?;
match outcome {
- crate::agent::triage::TriageOutcome::Decision(run) => {
+ crate::triage::TriageOutcome::Decision(run) => {
// Remote payload: an inbound webhook body is
// attacker-influenceable, so the dispatch parks rather than running
// on a trust root (#5634).
- let origin = crate::agent::triage::remote_trigger_origin(envelope);
+ let origin = crate::triage::remote_trigger_origin(envelope);
crate::agent::turn_origin::with_origin(
origin,
- crate::agent::triage::apply_decision(ctx, run.clone(), envelope),
+ crate::triage::apply_decision(ctx, run.clone(), envelope),
)
.await
.map_err(|e| format!("apply_decision failed: {e}"))?;
@@ -331,11 +331,11 @@ async fn run_agent_trigger(
run.decision.target_agent
))
}
- crate::agent::triage::TriageOutcome::Deferred {
+ crate::triage::TriageOutcome::Deferred {
defer_until_ms,
reason,
} => Ok(format!("Triage deferred until {defer_until_ms}: {reason}")),
- crate::agent::triage::TriageOutcome::Terminal { reason } => {
+ crate::triage::TriageOutcome::Terminal { reason } => {
Ok(format!("Triage reached terminal state: {reason}"))
}
}
diff --git a/crates/openhuman-core/src/skills/webhooks/ops.rs b/crates/openhuman-core/src/skills/webhooks/ops.rs
index 22d8711ca1..70697a4843 100644
--- a/crates/openhuman-core/src/skills/webhooks/ops.rs
+++ b/crates/openhuman-core/src/skills/webhooks/ops.rs
@@ -135,7 +135,7 @@ pub async fn trigger_agent(
reason: &str,
payload: serde_json::Value,
) -> Result<Outcome<serde_json::Value>, String> {
- use crate::agent::triage::TriggerEnvelope;
+ use crate::triage::TriggerEnvelope;
let envelope = match source {
"webhook" => TriggerEnvelope::from_webhook(caller_id, "POST", "/trigger", payload),
@@ -156,22 +156,22 @@ pub async fn trigger_agent(
let outcome = tokio::time::timeout(
std::time::Duration::from_secs(60),
- crate::agent::triage::run_triage(ctx, &envelope),
+ crate::triage::run_triage(ctx, &envelope),
)
.await
.map_err(|_| "triage timed out after 60s".to_string())?
.map_err(|e| format!("triage failed: {e}"))?;
match outcome {
- crate::agent::triage::TriageOutcome::Decision(run) => {
+ crate::triage::TriageOutcome::Decision(run) => {
// Remote payload: a webhook body is attacker-influenceable, so the
// dispatch parks rather than running on a trust root (#5634).
- let origin = crate::agent::triage::remote_trigger_origin(&envelope);
+ let origin = crate::triage::remote_trigger_origin(&envelope);
tokio::time::timeout(
std::time::Duration::from_secs(60),
crate::agent::turn_origin::with_origin(
origin,
- crate::agent::triage::apply_decision(ctx, run.clone(), &envelope),
+ crate::triage::apply_decision(ctx, run.clone(), &envelope),
),
)
.await
@@ -189,7 +189,7 @@ pub async fn trigger_agent(
format!("webhooks.trigger_agent completed for {source}/{caller_id}"),
))
}
- crate::agent::triage::TriageOutcome::Deferred {
+ crate::triage::TriageOutcome::Deferred {
defer_until_ms,
reason,
} => Ok(Outcome::single_log(
@@ -201,7 +201,7 @@ pub async fn trigger_agent(
}),
format!("webhooks.trigger_agent deferred for {source}/{caller_id}"),
)),
- crate::agent::triage::TriageOutcome::Terminal { reason } => Ok(Outcome::single_log(
+ crate::triage::TriageOutcome::Terminal { reason } => Ok(Outcome::single_log(
serde_json::json!({
"decision": "terminal",
"resolution_path": "terminal",
diff --git a/crates/openhuman-core/src/triage/events_tests.rs b/crates/openhuman-core/src/triage/events_tests.rs
index 3a80105b82..b66ef4890f 100644
--- a/crates/openhuman-core/src/triage/events_tests.rs
+++ b/crates/openhuman-core/src/triage/events_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::agent::triage::TriggerEnvelope;
+use crate::triage::TriggerEnvelope;
use crate::core::events::DomainEvent;
use serde_json::json;
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/triage/mod.rs b/crates/openhuman-core/src/triage/mod.rs
index aa23848f9d..aef525a5fa 100644
--- a/crates/openhuman-core/src/triage/mod.rs
+++ b/crates/openhuman-core/src/triage/mod.rs
@@ -19,7 +19,7 @@
//! ## Usage
//!
//! ```ignore
-//! use crate::agent::triage::{run_triage, apply_decision, TriggerEnvelope};
+//! use crate::triage::{run_triage, apply_decision, TriggerEnvelope};
//!
//! // 1. Hydrate the envelope
//! let envelope = TriggerEnvelope::from_composio(toolkit, trigger, id, uuid, payload);
diff --git a/crates/openhuman-core/src/triage/origin_tests.rs b/crates/openhuman-core/src/triage/origin_tests.rs
index 204ea5a340..d6741923b9 100644
--- a/crates/openhuman-core/src/triage/origin_tests.rs
+++ b/crates/openhuman-core/src/triage/origin_tests.rs
@@ -4,7 +4,7 @@
//! handing a trust root to remote content.
use super::*;
-use crate::agent::triage::envelope::TriggerEnvelope;
+use crate::triage::envelope::TriggerEnvelope;
fn composio_envelope() -> TriggerEnvelope {
TriggerEnvelope::from_composio(
@@ -124,7 +124,7 @@ fn every_dispatch_site_scopes_an_origin() {
// The triage module defines and tests `apply_decision`; it is the
// callee, not a call site. Test files model callers rather than
// being them.
- if rel.starts_with("crates/openhuman-core/src/agent/triage/")
+ if rel.starts_with("crates/openhuman-core/src/triage/")
|| rel.ends_with("_tests.rs")
{
continue;
diff --git a/crates/openhuman-core/src/triage/routing.rs b/crates/openhuman-core/src/triage/routing.rs
index 993405bf93..b760a98a4c 100644
--- a/crates/openhuman-core/src/triage/routing.rs
+++ b/crates/openhuman-core/src/triage/routing.rs
@@ -18,7 +18,7 @@ use crate::inference::provider::{self, INFERENCE_BACKEND_ID};
/// short chat-shaped call, so it follows the user's `chat` route.
const TRIAGE_ROLE: &str = "chat";
-/// The concrete provider + metadata that [`crate::agent::triage::evaluator::run_triage`]
+/// The concrete provider + metadata that [`crate::triage::evaluator::run_triage`]
/// should use for this particular triage turn.
pub struct ResolvedProvider {
/// Model source for this arm. Production sources are crate-native.
diff --git a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
index 5582ad38f5..aacaf1d8f3 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
@@ -8,7 +8,7 @@
//! (web_chat regex list, triage whole-word list, loop-guard billing list).
use super::*;
-use crate::agent::triage::evaluator::{classify_error, ArmError};
+use crate::triage::evaluator::{classify_error, ArmError};
use crate::web_chat::WebChannelEvent;
use regex::Regex;
diff --git a/vendor/tinyagents b/vendor/tinyagents
index 6562f27fdf..6661a090a9 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit 6562f27fdfbb7fa2fa6e6160432106cc610f70b4
+Subproject commit 6661a090a96dd915a129979b658414f37c0160fb