Skip to content

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

refactor(core): move provider_role_for to factory module

Steven Enamakel0b02c659afd0
diff --git a/crates/openhuman-core/src/agent/session_host/builder/dispatcher.rs b/crates/openhuman-core/src/agent/session_host/builder/dispatcher.rs
index 04c6a401ac..6ca6566ef9 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/dispatcher.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/dispatcher.rs
@@ -51,31 +51,3 @@ pub(super) fn resolve_dispatcher_kind(
base
}
}
-
-/// Resolve the provider/workload role for a session build.
-///
-/// The `subconscious` workload has two entry points and both must route here:
-/// - the cloud tick builds via `OpenHumanSessionHost::from_config` (agent_id `"orchestrator"`)
-/// with `default_model = "hint:subconscious"`;
-/// - the event-driven long-lived session builds via
-/// `OpenHumanSessionHost::from_config_for_agent(_, "subconscious")` and does NOT set the hint.
-///
-/// Routing on `agent_id == "subconscious"` covers the second case (Codex P2:
-/// otherwise promoted background turns fall through to `chat_provider` and ignore
-/// Connections → API keys → LLM "Subconscious"). Other explicit `hint:<role>` markers route to
-/// their workload; everything else (incl. the legacy `default_model` tier the
-/// bootstrap pinned) falls through to `chat` so `chat_provider` drives the
-/// user-facing turn.
-pub(crate) fn provider_role_for(agent_id: &str, default_model: Option<&str>) -> &'static str {
- if agent_id.trim() == "subconscious" {
- return "subconscious";
- }
- match default_model.map(str::trim) {
- Some("hint:agentic") => "agentic",
- Some("hint:coding") => "coding",
- Some("hint:summarization") => "summarization",
- Some("hint:reasoning") => "reasoning",
- Some("hint:subconscious") => "subconscious",
- _ => "chat",
- }
-}
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 bdc7f40f69..73433878ed 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -1128,6 +1128,34 @@ fn definition_disallows_tool(disallowed: &[String], name: &str) -> bool {
})
}
+/// Resolve the provider/workload role for a session build.
+///
+/// The `subconscious` workload has two entry points and both must route here:
+/// - the cloud tick builds via `OpenHumanSessionHost::from_config` (agent_id `"orchestrator"`)
+/// with `default_model = "hint:subconscious"`;
+/// - the event-driven long-lived session builds via
+/// `OpenHumanSessionHost::from_config_for_agent(_, "subconscious")` and does NOT set the hint.
+///
+/// Routing on `agent_id == "subconscious"` covers the second case (Codex P2:
+/// otherwise promoted background turns fall through to `chat_provider` and ignore
+/// Connections → API keys → LLM "Subconscious"). Other explicit `hint:<role>` markers route to
+/// their workload; everything else (incl. the legacy `default_model` tier the
+/// bootstrap pinned) falls through to `chat` so `chat_provider` drives the
+/// user-facing turn.
+pub(crate) fn provider_role_for(agent_id: &str, default_model: Option<&str>) -> &'static str {
+ if agent_id.trim() == "subconscious" {
+ return "subconscious";
+ }
+ match default_model.map(str::trim) {
+ Some("hint:agentic") => "agentic",
+ Some("hint:coding") => "coding",
+ Some("hint:summarization") => "summarization",
+ Some("hint:reasoning") => "reasoning",
+ Some("hint:subconscious") => "subconscious",
+ _ => "chat",
+ }
+}
+
#[cfg(test)]
#[path = "factory_provider_role_tests_tests.rs"]
mod provider_role_tests;