The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(session_host): inline tiered prefix snapshot helper
Steven Enamakel839aed4de07c
diff --git a/crates/openhuman-core/src/agent/session_host/mod.rs b/crates/openhuman-core/src/agent/session_host/mod.rsindex 3c8870378b..1b34127ed9 100644--- a/crates/openhuman-core/src/agent/session_host/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/mod.rs@@ -42,7 +42,6 @@ mod hooks;// Tool surface for live voice sessions (`voice::live`).#[cfg(feature = "voice")]mod live_tools;-mod prefix_snapshot;mod recorded_tools;mod runtime;mod runtime_session;diff --git a/crates/openhuman-core/src/agent/session_host/prefix_snapshot.rs b/crates/openhuman-core/src/agent/session_host/prefix_snapshot.rsdeleted file mode 100644index 40301bd22e..0000000000--- a/crates/openhuman-core/src/agent/session_host/prefix_snapshot.rs+++ /dev/null@@ -1,28 +0,0 @@-//! The frozen system-prompt prefix a session hands the runtime.-//!-//! The prompt is rendered once per session as cache tiers (see-//! `agent::prompts::TieredPrompt::system_messages`) and sent as one leading-//! system message per tier. This helper turns a rendered prompt into that-//! prefix, so `runtime_session` never has to know how many messages a prefix-//! is. A resumed thread's prefix is restored by the tinyagents session using-//! the transcript's recorded frozen-prefix count (or the legacy generation-//! fallback); nothing here re-derives it.--use tinyagents_runtime::PrefixSnapshot;-use tinyinference_llm::message::Message;--use crate::agent::prompts::TieredPrompt;--/// One system message per cache tier (stable+context, then volatile). The-/// harness gives each its own cacheable segment, so a rewritten memory file or-/// a newly connected service changes the second segment and leaves the first-/// byte-identical for the provider's prefix cache.-pub(super) fn tiered_prefix_snapshot(tiered: &TieredPrompt) -> PrefixSnapshot {- let messages = tiered.system_messages();- tracing::debug!(- segments = messages.len(),- bytes = ?messages.iter().map(String::len).collect::<Vec<_>>(),- "[session] frozen system prompt as tiered segments"- );- PrefixSnapshot::new(messages.into_iter().map(Message::system).collect())-}diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 5d95312e77..b9f6bfd77e 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -258,7 +258,18 @@ impl OpenHumanTurnPrelude {};let prefix = if cold {let tiered = self.build_system_prompt_tiered()?;- Some(super::prefix_snapshot::tiered_prefix_snapshot(&tiered))+ let messages = tiered.system_messages();+ tracing::debug!(+ segments = messages.len(),+ bytes = ?messages.iter().map(String::len).collect::<Vec<_>>(),+ "[session] frozen system prompt as tiered segments"+ );+ Some(tinyagents_runtime::PrefixSnapshot::new(+ messages+ .into_iter()+ .map(tinyinference_llm::message::Message::system)+ .collect(),+ ))} else {None};