Skip to content

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

chore: files changed crates/openhuman-core/src/agent/harness/host_definition.rs,crates/openhuman-cor

Steven Enamakel9405fedd6736
diff --git a/crates/openhuman-core/src/agent/harness/host_definition.rs b/crates/openhuman-core/src/agent/harness/host_definition.rs
index 23284361c4..d6c7e3d3be 100644
--- a/crates/openhuman-core/src/agent/harness/host_definition.rs
+++ b/crates/openhuman-core/src/agent/harness/host_definition.rs
@@ -108,6 +108,19 @@ fn same_definition(a: &AgentDefinition, b: &AgentDefinition) -> bool {
}
}
+/// The concrete TokenJuice policy for `def` (see
+/// [`AgentExt::effective_tokenjuice_compression`]).
+pub fn effective_tokenjuice_compression(def: &AgentDefinition) -> AgentTokenjuiceCompression {
+ def.extensions.effective_tokenjuice_compression(&def.model)
+}
+
+/// The prompt builder behind a `PromptSource::Dynamic(())` marker.
+pub fn dynamic_prompt_builder(def: &AgentDefinition) -> Result<PromptBuilder> {
+ def.extensions
+ .prompt_builder
+ .ok_or_else(|| anyhow::anyhow!("agent `{}` declares a dynamic prompt but has no builder", def.id))
+}
+
/// Re-check the spawn-hierarchy contract over a slice of definitions.
pub fn validate_tier_hierarchy(defs: &[AgentDefinition]) -> Result<()> {
let mut set = DefinitionSet::<AgentExt>::new();
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 2742e522cd..9848e3962b 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -344,13 +344,7 @@ impl OpenHumanSessionHost {
// body and get wrapped by [`SystemPromptBuilder::for_subagent`].
let prompt_builder = match target_def {
Some(def) => match &def.system_prompt {
- PromptSource::Dynamic(()) => match def.extensions.prompt_builder {
- Some(build) => SystemPromptBuilder::from_dynamic(build),
- None => anyhow::bail!(
- "agent `{}` declares a dynamic prompt but has no builder",
- def.id
- ),
- },
+ PromptSource::Dynamic(()) => SystemPromptBuilder::from_dynamic(dynamic_prompt_builder(def)?),
PromptSource::Verbatim(text) => SystemPromptBuilder::verbatim(text.clone()),
PromptSource::Inline(text) => SystemPromptBuilder::for_subagent(
text.clone(),
@@ -674,7 +668,7 @@ impl OpenHumanSessionHost {
.map(|def| def.extensions.omit_memory_context)
.unwrap_or(false);
let effective_tokenjuice_compression = target_def
- .map(|def| def.extensions.effective_tokenjuice_compression(&def.model))
+ .map(|def| effective_tokenjuice_compression(def))
.unwrap_or(tinyjuice_bus::types::AgentTokenjuiceCompression::Full);
// Stamp the resolved agent definition id onto the OpenHumanSessionHost via the
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index 66165d98cc..e8f4215376 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -946,9 +946,7 @@ async fn run_typed_mode(
"subagent",
// Agent-level TokenJuice profile → sub-agent context middleware
// (#4466), so sub-agent tool outputs compact like the chat path.
- definition
- .extensions
- .effective_tokenjuice_compression(&definition.model),
+ effective_tokenjuice_compression(definition),
// The spawn-wide config snapshot supplies the `[context]`
// knobs the graph used to load for itself.
config.as_ref().ok().map(|c| c.as_ref()),