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
feat(agent): include connected identities in session context
Steven Enamakel217efa400713
diff --git a/crates/openhuman-core/src/agent/prompts/connected_identities.rs b/crates/openhuman-core/src/agent/prompts/connected_identities.rsindex 783f165c3f..a7e4e9cd9e 100644--- a/crates/openhuman-core/src/agent/prompts/connected_identities.rs+++ b/crates/openhuman-core/src/agent/prompts/connected_identities.rs@@ -17,18 +17,18 @@/// `block_in_place` + current-runtime-handle bridge. Best-effort: no runtime, a/// single-threaded runtime, or a config-load/driver failure all render an/// empty section rather than panicking or blocking a prompt on a memory read.-pub fn render_connected_identities() -> String {+pub fn render_connected_identities(ctx: &crate::core::runtime::DispatchCtx) -> String {let Ok(handle) = tokio::runtime::Handle::try_current() else {return String::new();};if handle.runtime_flavor() != tokio::runtime::RuntimeFlavor::MultiThread {return String::new();}- tokio::task::block_in_place(|| handle.block_on(render_section()))+ tokio::task::block_in_place(|| handle.block_on(render_section(ctx)))}-async fn render_section() -> String {- let config = match crate::config::rpc::load_config_with_timeout().await {+async fn render_section(ctx: &crate::core::runtime::DispatchCtx) -> String {+ let config = match ctx.load_config().await {Ok(config) => config,Err(error) => {tracing::debug!(%error, "[prompts] render_connected_identities: config load failed");diff --git a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rsindex de97dc019a..8f020efd5a 100644--- a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs@@ -278,6 +278,15 @@ impl OpenHumanSessionHost {self.host_env = env;}+ /// The context this session's turns run under: the one its host+ /// environment carries, else the calling task's.+ pub(crate) fn dispatch_ctx(&self) -> crate::core::runtime::DispatchCtx {+ match &self.host_env.core {+ Some(core) => crate::core::runtime::DispatchCtx::new(Arc::clone(core)),+ None => crate::core::runtime::DispatchCtx::ambient(),+ }+ }+/// The host environment installed with [`Self::set_host_env`].pub fn host_env(&self) -> &crate::agent::turn_env::HostTurnEnv {&self.host_envdiff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 9a3b8d68c9..c3a1f12ad6 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -341,7 +341,7 @@ impl OpenHumanTurnPrelude {visible_tool_names: &visible_tool_names,tool_call_format: self.tool_dispatcher.tool_call_format(),connected_integrations: &mutable.connected_integrations,- connected_identities_md: crate::agent::prompts::render_connected_identities(),+ connected_identities_md: crate::agent::prompts::render_connected_identities(&self.dispatch_ctx()),user_identity: crate::security::credentials::identity::peek_credential_user_identity(),personality_roster: vec![],agents_md_global: agents_md.global,diff --git a/crates/openhuman-core/src/agent/session_host/turn/context.rs b/crates/openhuman-core/src/agent/session_host/turn/context.rsindex a3d8743dbb..d835ba3231 100644--- a/crates/openhuman-core/src/agent/session_host/turn/context.rs+++ b/crates/openhuman-core/src/agent/session_host/turn/context.rs@@ -58,7 +58,7 @@ impl OpenHumanSessionHost {visible_tool_names: &prompt_visible_tool_names,tool_call_format: self.tool_dispatcher.tool_call_format(),connected_integrations: &self.connected_integrations,- connected_identities_md: crate::agent::prompts::render_connected_identities(),+ connected_identities_md: crate::agent::prompts::render_connected_identities(&self.dispatch_ctx()),user_identity: crate::security::credentials::identity::peek_credential_user_identity(),personality_roster: vec![], // TODO: build_personality_roster(&workspace_dir)agents_md_global: agents_md.global,diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex efe718de91..566c837624 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -772,7 +772,9 @@ async fn run_typed_mode(visible_tool_names: &visible_tool_names,tool_call_format: prompt_tool_call_format,connected_integrations: &connected_integrations_for_prompt,- connected_identities_md: crate::agent::prompts::render_connected_identities(),+ connected_identities_md: crate::agent::prompts::render_connected_identities(+ &options.run_context.dispatch_ctx(),+ ),user_identity: crate::security::credentials::identity::peek_credential_user_identity(),personality_roster: vec![],agents_md_global: agents_md.global.clone(),diff --git a/crates/openhuman-core/src/agent/tinyagents/host/context_composer.rs b/crates/openhuman-core/src/agent/tinyagents/host/context_composer.rsindex 0e4ecd5667..dc1f29a371 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/context_composer.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/context_composer.rs@@ -105,6 +105,9 @@ pub struct OpenHumanContextComposer {/// (nothing connected, or the caller has not fetched yet) and renders as/// an absent section rather than an error.connected_integrations: Vec<ConnectedIntegration>,+ /// The turn's dispatch context for config reads; `None` falls back to the+ /// calling task's.+ dispatch: Option<DispatchCtx>,/// The section chain. Built once so per-turn composition is just a render.builder: SystemPromptBuilder,}@@ -204,7 +207,9 @@ impl ContextComposer for OpenHumanContextComposer {visible_tool_names: &visible_tool_names,tool_call_format: self.tool_call_format,connected_integrations: &self.connected_integrations,- connected_identities_md: render_connected_identities(),+ connected_identities_md: render_connected_identities(+ &self.dispatch.clone().unwrap_or_else(DispatchCtx::ambient),+ ),user_identity: crate::security::credentials::identity::peek_credential_user_identity(),// TODO(phase4): the master agent's personality roster is built// from the profiles domain (`crate::profiles`); the