Skip to content

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

refactor(runtime): split turn origin tracking out of context

Steven Enamakel035a13694632
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rs
index a099b35988..d2ef0f9fd6 100644
--- a/crates/openhuman-core/src/core/runtime/context.rs
+++ b/crates/openhuman-core/src/core/runtime/context.rs
@@ -85,6 +85,11 @@ pub struct CoreContext {
/// the model. Defaults to every group withheld, which is what the
/// compiled-in pack table meant before the type existed.
tool_groups: crate::tools::toolpacks::ToolGroups,
+ /// Which tiny dependencies the config switched off (`[components]`). Only
+ /// narrows: `domains` and `tool_groups` are already clamped by it, and this
+ /// is kept so dispatch can answer `COMPONENT_DISABLED:<name>` for a method
+ /// that a disabled component removed.
+ components: crate::core::runtime::ComponentSet,
/// Whether skill discovery under this context scans the operator's
/// user-scope roots (`~/.openhuman/skills`, `~/.agents/skills`).
///
@@ -268,6 +273,7 @@ impl CoreContext {
}))),
domains,
tool_groups,
+ components,
embedder_config,
user_skill_roots: true,
backend_transport,
@@ -387,6 +393,7 @@ impl CoreContext {
workspace_binding: RwLock::new(shared_binding),
domains,
tool_groups: overlay.tool_groups,
+ components: self.components,
embedder_config: Some(overlay.config),
user_skill_roots: overlay.user_skill_roots,
backend_transport: self.backend_transport.clone(),
@@ -542,6 +549,7 @@ impl CoreContext {
}))),
domains,
tool_groups: Default::default(),
+ components: Default::default(),
embedder_config: None,
user_skill_roots: true,
backend_transport: None,
@@ -575,6 +583,7 @@ impl CoreContext {
}))),
domains,
tool_groups: Default::default(),
+ components: Default::default(),
embedder_config: Some(config),
user_skill_roots: true,
backend_transport: None,
diff --git a/crates/openhuman-core/src/core/runtime/context_for_agent.rs b/crates/openhuman-core/src/core/runtime/context_for_agent.rs
index 9594319060..1bc7cf0d76 100644
--- a/crates/openhuman-core/src/core/runtime/context_for_agent.rs
+++ b/crates/openhuman-core/src/core/runtime/context_for_agent.rs
@@ -30,6 +30,7 @@ impl CoreContext {
workspace_binding: RwLock::new(binding),
domains: self.domains,
tool_groups: self.tool_groups.clone(),
+ components: self.components,
embedder_config: self.embedder_config.clone(),
user_skill_roots: self.user_skill_roots,
backend_transport: self.backend_transport.clone(),
diff --git a/crates/openhuman-core/src/core/runtime/context_tests.rs b/crates/openhuman-core/src/core/runtime/context_tests.rs
index 4f9c57adb8..4a02e99275 100644
--- a/crates/openhuman-core/src/core/runtime/context_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/context_tests.rs
@@ -9,6 +9,7 @@ fn ctx(dir: &str) -> Arc<CoreContext> {
}))),
domains: crate::core::runtime::DomainSet::full(),
tool_groups: Default::default(),
+ components: Default::default(),
embedder_config: None,
user_skill_roots: true,
backend_transport: None,
@@ -43,6 +44,7 @@ fn ctx_with_config(config: crate::config::Config) -> Arc<CoreContext> {
}))),
domains: crate::core::runtime::DomainSet::full(),
tool_groups: Default::default(),
+ components: Default::default(),
embedder_config: Some(config),
user_skill_roots: true,
backend_transport: None,
@@ -382,6 +384,7 @@ fn degraded_context_rejects_workspace_bound_stores() {
}))),
domains: crate::core::runtime::DomainSet::full(),
tool_groups: Default::default(),
+ components: Default::default(),
embedder_config: None,
user_skill_roots: true,
backend_transport: None,
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 156e0191d3..58aab6c546 100644
--- a/crates/openhuman-core/src/core/runtime/context_turn_origin.rs
+++ b/crates/openhuman-core/src/core/runtime/context_turn_origin.rs
@@ -63,6 +63,7 @@ impl CoreContext {
),
domains: ctx.domains,
tool_groups: ctx.tool_groups.clone(),
+ components: ctx.components,
embedder_config: ctx.embedder_config.clone(),
user_skill_roots: ctx.user_skill_roots,
backend_transport: ctx.backend_transport.clone(),