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): extract announcement note helpers into dedicated module
Steven Enamakelfacb62621a31
diff --git a/crates/openhuman-core/src/agent/session_host/announcement_notes.rs b/crates/openhuman-core/src/agent/session_host/announcement_notes.rsnew file mode 100644index 0000000000..222eafd24b--- /dev/null+++ b/crates/openhuman-core/src/agent/session_host/announcement_notes.rs@@ -0,0 +1,43 @@+//! Mid-conversation availability notes, prepended to the user's next message+//! when an integration, MCP server or skill was connected or installed after+//! the session's system prompt was built (`runtime_session.rs` parks the ids+//! and `apply_pending_announcements` renders them).++// Availability notes prepended to the next user message when something was+// connected or installed mid-conversation. They are *status*, not a task:+// the earlier "act on them immediately" phrasing read as an instruction and+// sent the orchestrator off to the integrations agent in the middle of an+// unrelated exchange ("so lets do 20-30 days then?" → "What are we doing with+// the inbox?"). The user's message that follows is the only thing to act on.+const ANNOUNCEMENT_TRAILER: &str = "This is a capability update, not a request: \+respond to the user's message below and only use these if that message needs them. \+Do not tell the user to reconnect or restart.";++pub(super) fn integration_announcement_note(slugs: &[String]) -> Option<String> {+ (!slugs.is_empty()).then(|| format!(+ "[integration update] These integration(s) connected during this conversation and are available now via delegate_to_integrations_agent with the matching toolkit slug: {}. {ANNOUNCEMENT_TRAILER}",+ slugs.join(", ")+ ))+}++pub(super) fn mcp_announcement_note(servers: &[String]) -> Option<String> {+ (!servers.is_empty()).then(|| format!(+ "[MCP update] These MCP server(s) connected during this conversation and are available now via the use_mcp_server delegate: {}. {ANNOUNCEMENT_TRAILER}",+ servers.join(", ")+ ))+}++pub(super) fn skill_announcement_note(skill_ids: &[String]) -> Option<String> {+ (!skill_ids.is_empty()).then(|| format!(+ "[skills update] These skill(s) were installed during this conversation and are available now in your `## Installed Skills` list via `run_skill`: {}. {ANNOUNCEMENT_TRAILER}",+ skill_ids.join(", ")+ ))+}++pub(super) fn skill_retraction_note(skill_ids: &[String]) -> Option<String> {+ (!skill_ids.is_empty()).then(|| format!(+ "[skills retracted] These skill(s) were uninstalled during this conversation and are no longer available: {}. \+Do not attempt to run them with `run_skill` — they have been removed. Tell the user to reinstall if they want to use them again.",+ skill_ids.join(", ")+ ))+}diff --git a/crates/openhuman-core/src/agent/session_host/mod.rs b/crates/openhuman-core/src/agent/session_host/mod.rsindex 0085907b9b..8193f6f9a6 100644--- a/crates/openhuman-core/src/agent/session_host/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/mod.rs@@ -60,5 +60,7 @@ pub use types::{OpenHumanSessionHost, SessionHostBuilder, TurnOverrides};// share one tested implementation.pub(crate) use builder::dedup_visible_tool_specs;+mod announcement_notes;+#[cfg(test)]mod runtime_adapter_tests;diff --git a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rsindex a1fb9768c0..b0b68fe35c 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs@@ -9,10 +9,12 @@ use tinyagents_runtime::{use tinyagents_session::transcript::{FileTranscriptLocator, TranscriptMeta};use tinyinference_llm::message::Message;+use super::announcement_notes::{+ integration_announcement_note, mcp_announcement_note, skill_announcement_note,+};use super::runtime_session::{account_committed_turn_against_goal, begin_turn_resume, holistic_last_turn_usage,- integration_announcement_note, mcp_announcement_note, reconcile_synthesized_visibility,- skill_announcement_note, OpenHumanSessionState,+ reconcile_synthesized_visibility, OpenHumanSessionState,};use super::{OpenHumanSessionFactory, OpenHumanSessionHooks, OpenHumanTranscriptCodec};use crate::agent::tinyagents::host::OpenHumanRunContext;diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 7dad67506a..d49d8be312 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -1231,45 +1231,6 @@ fn render_agent_context_status_note()}-// Availability notes prepended to the next user message when something was-// connected or installed mid-conversation. They are *status*, not a task:-// the earlier "act on them immediately" phrasing read as an instruction and-// sent the orchestrator off to the integrations agent in the middle of an-// unrelated exchange ("so lets do 20-30 days then?" → "What are we doing with-// the inbox?"). The user's message that follows is the only thing to act on.-const ANNOUNCEMENT_TRAILER: &str = "This is a capability update, not a request: \-respond to the user's message below and only use these if that message needs them. \-Do not tell the user to reconnect or restart.";--pub(super) fn integration_announcement_note(slugs: &[String]) -> Option<String> {- (!slugs.is_empty()).then(|| format!(- "[integration update] These integration(s) connected during this conversation and are available now via delegate_to_integrations_agent with the matching toolkit slug: {}. {ANNOUNCEMENT_TRAILER}",- slugs.join(", ")- ))-}--pub(super) fn mcp_announcement_note(servers: &[String]) -> Option<String> {- (!servers.is_empty()).then(|| format!(- "[MCP update] These MCP server(s) connected during this conversation and are available now via the use_mcp_server delegate: {}. {ANNOUNCEMENT_TRAILER}",- servers.join(", ")- ))-}--pub(super) fn skill_announcement_note(skill_ids: &[String]) -> Option<String> {- (!skill_ids.is_empty()).then(|| format!(- "[skills update] These skill(s) were installed during this conversation and are available now in your `## Installed Skills` list via `run_skill`: {}. {ANNOUNCEMENT_TRAILER}",- skill_ids.join(", ")- ))-}--fn skill_retraction_note(skill_ids: &[String]) -> Option<String> {- (!skill_ids.is_empty()).then(|| format!(- "[skills retracted] These skill(s) were uninstalled during this conversation and are no longer available: {}. \-Do not attempt to run them with `run_skill` — they have been removed. Tell the user to reinstall if they want to use them again.",- skill_ids.join(", ")- ))-}-async fn collect_prelude_tree_roots(per_namespace_cap: usize,total_cap: usize,