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/session_host/turn/context.rs,crates/openhuman-c

Steven Enamakel2a7ad574a851
diff --git a/crates/openhuman-core/src/agent/session_host/turn/context.rs b/crates/openhuman-core/src/agent/session_host/turn/context.rs
index 860d913716..37a0cb3526 100644
--- a/crates/openhuman-core/src/agent/session_host/turn/context.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn/context.rs
@@ -4,7 +4,6 @@ use super::super::types::OpenHumanSessionHost;
use crate::agent::prompts::{
tool_call_format_from_dialect, LearnedContextData, PromptContext, PromptTool,
};
-use crate::memory::MemoryCategory;
use crate::tools::agent_policy::render_tool_policy_boundary;
use anyhow::Result;
diff --git a/crates/openhuman-core/src/agent/session_host/turn/mod.rs b/crates/openhuman-core/src/agent/session_host/turn/mod.rs
index 07f011a8bf..390d63584d 100644
--- a/crates/openhuman-core/src/agent/session_host/turn/mod.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn/mod.rs
@@ -6,17 +6,3 @@
mod context;
pub(crate) mod graph;
mod tools;
-
-/// Returns newly connected capability names and records the observation once.
-pub(super) fn newly_connected_slugs(
- connected: &[String],
- announced: &mut std::collections::HashSet<String>,
-) -> Vec<String> {
- let newly: Vec<String> = connected
- .iter()
- .filter(|slug| !announced.contains(*slug))
- .cloned()
- .collect();
- announced.extend(newly.iter().cloned());
- newly
-}
diff --git a/crates/openhuman-core/src/agent/session_host/turn/tools.rs b/crates/openhuman-core/src/agent/session_host/turn/tools.rs
index c7389bb588..39d0c8a318 100644
--- a/crates/openhuman-core/src/agent/session_host/turn/tools.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn/tools.rs
@@ -6,63 +6,11 @@ use crate::agent::progress::AgentProgress;
use std::sync::Arc;
-/// One turn's tool inputs: the durable registry, the synthesised delegation
-/// set, and the callable-name allowlist. See [`OpenHumanSessionHost::turn_tool_sets`].
-type TurnToolSets = (
- Arc<Vec<Box<dyn tinytools::Tool>>>,
- Arc<Vec<Box<dyn tinytools::Tool>>>,
- std::collections::HashSet<String>,
-);
-
impl OpenHumanSessionHost {
// ─────────────────────────────────────────────────────────────────
// Sub-agent context snapshots
// ─────────────────────────────────────────────────────────────────
- /// The tool sets and callable-name allowlist for one turn.
- ///
- /// Returns `(durable tools, synthesised delegation tools, visible names)`.
- /// The two tool sets stay separate all the way to dispatch — see
- /// [`OpenHumanSessionHost::synthesized_tools`] for why they are not one `Arc`.
- ///
- /// `suppress_tools` is the per-turn scope override (#1725): a chat /
- /// small-talk turn runs with an EMPTY tool set, so the provider request
- /// carries no tool schema and the model answers in a single call. The
- /// agent's durable fields are left untouched either way — the next
- /// un-overridden turn gets the full toolbelt back.
- pub(super) fn turn_tool_sets(&self, suppress_tools: bool) -> TurnToolSets {
- if suppress_tools {
- return (
- Arc::new(Vec::new()),
- Arc::new(Vec::new()),
- std::collections::HashSet::new(),
- );
- }
- (
- Arc::clone(&self.tools),
- Arc::clone(&self.synthesized_tools),
- // Advertised plus deferred: the harness advertises only the
- // `Direct` registrations and reaches the rest through its bridge.
- self.reachable_tool_names(),
- )
- }
-
- /// Emit a lifecycle progress event. Uses `send().await` so control
- /// events (turn/iteration boundaries, tool_call_started/completed,
- /// turn_completed) survive downstream backpressure from the
- /// higher-frequency streamed deltas that share the same `on_progress`
- /// channel — dropping one of these would desync the web-channel
- /// progress bridge (e.g. a tool row stuck in `running` forever).
- /// A closed sink is logged and ignored; no progress subscriber is
- /// equivalent to success.
- pub(super) async fn emit_progress(&self, event: AgentProgress) {
- if let Some(ref tx) = self.on_progress {
- if let Err(e) = tx.send(event).await {
- log::warn!("[agent] progress sink closed while emitting lifecycle event: {e}");
- }
- }
- }
-
/// Fetches the user's active Composio connections and populates
/// `self.connected_integrations` so the system prompt can surface them.
///
@@ -96,162 +44,6 @@ impl OpenHumanSessionHost {
self.connected_integrations_initialized = true;
}
- /// Lazily attach this session to the global event bus so it can
- /// observe `ComposioIntegrationsChanged` notifications.
- pub(super) fn ensure_composio_integrations_listener(&mut self) {
- if self.composio_integrations_rx.is_some() {
- return;
- }
- if let Some(bus) = crate::core::bus::BUS.get() {
- self.composio_integrations_rx = Some(bus.receiver());
- log::debug!(
- "[agent_loop] armed composio integrations listener for session='{}'",
- self.event_session_id
- );
- }
- }
-
- /// Reconcile the session's delegation schema against the latest cached
- /// integrations snapshot. Returns `true` only when a refresh applied.
- pub(super) fn refresh_delegation_tools_from_cached_integrations(
- &mut self,
- trigger: &str,
- ) -> bool {
- let Some(cfg) = self.runtime_config.as_ref() else {
- return false;
- };
- let Some(cache_view) = crate::integrations::composio::cached_active_integrations(cfg)
- else {
- return false;
- };
-
- let new_hash = crate::integrations::composio::connected_set_hash(&cache_view);
- if new_hash == self.last_seen_integrations_hash {
- return false;
- }
-
- log::info!(
- "[agent_loop] composio set changed ({trigger}) hash {:x} -> {:x}; refreshing delegation schema (system prompt unchanged for KV cache)",
- self.last_seen_integrations_hash,
- new_hash
- );
-
- // No rollback path: `refresh_delegation_tools` reconciles the specs and
- // the executable instances in one pass and cannot half-apply, so there
- // is no failed state to restore `connected_integrations` from.
- self.connected_integrations = cache_view;
- self.refresh_delegation_tools();
- self.last_seen_integrations_hash = new_hash;
- self.connected_integrations_initialized = true;
- // Surface newly-connected toolkits onto the next user message so
- // the model acts on them on the FIRST post-connect ask instead of
- // refusing from stale chat context. The refresh above already
- // updated the enum; this closes the prose/decision gap.
- let connected_slugs: Vec<String> = self
- .connected_integrations
- .iter()
- .map(|i| i.toolkit.clone())
- .collect();
- // Append (don't overwrite) so a second connect before the next
- // user turn doesn't drop the first one's announcement. Slugs are
- // already de-duped against `announced_integrations`, but guard the
- // pending list too in case the same slug is re-queued.
- for slug in newly_connected_slugs(&connected_slugs, &mut self.announced_integrations) {
- if !self.pending_integration_announcement.contains(&slug) {
- self.pending_integration_announcement.push(slug);
- }
- }
- true
- }
-
- /// Reconcile the tracked installed-skill set ([`Self::workflows`]) against
- /// what is on disk, so a skill installed/uninstalled mid-session can be
- /// surfaced to the model without a session restart.
- ///
- /// Note the system-prompt `## Installed Skills` block is frozen at turn 1
- /// (KV-cache stability — it is only built when history is empty), so this
- /// does NOT rebuild that block for the live session. Instead — exactly like
- /// [`Self::refresh_delegation_tools_from_cached_integrations`] / the MCP
- /// mid-session mechanism — genuinely-new skill ids (present on disk but not
- /// in the prior snapshot) are parked in [`Self::pending_skill_announcement`]
- /// (announced once via [`Self::announced_skills`]) and surfaced on the next
- /// user turn; `run_workflow` then loads/runs them fresh from disk. Updating the
- /// tracked slice keeps the next diff correct and feeds a *fresh* session's
- /// rendered catalogue.
- ///
- /// Returns `true` when the installed set changed. Cheap no-op when it
- /// hasn't: a directory scan plus an id-set comparison, no prompt rebuild.
- pub(in super::super) fn refresh_workflows(&mut self, trigger: &str) -> bool {
- let id_of = |w: &crate::skills::Workflow| -> String {
- if w.dir_name.is_empty() {
- w.name.clone()
- } else {
- w.dir_name.clone()
- }
- };
- log::debug!("[agent_loop] refreshing installed-skills metadata (trigger={trigger})");
- let mut latest = crate::skills::load_workflow_metadata(&self.workspace_dir);
- #[cfg(feature = "flows")]
- if let Some(config) = self.runtime_config.as_deref() {
- latest.extend(crate::flows::catalogue::flow_entries(config));
- }
- log::debug!(
- "[agent_loop] refreshed installed-skills metadata (trigger={trigger}, workflow_count={})",
- latest.len()
- );
- let current_ids: std::collections::HashSet<String> =
- self.workflows.iter().map(&id_of).collect();
- let latest_ids: std::collections::HashSet<String> = latest.iter().map(&id_of).collect();
- if current_ids == latest_ids {
- return false;
- }
- // Newly-present skills (on disk now, absent from the prior snapshot),
- // announced at most once this session.
- let newly: Vec<String> = latest_ids
- .difference(&current_ids)
- .filter(|id| self.announced_skills.insert((*id).clone()))
- .cloned()
- .collect();
- // Skills removed from disk since the last snapshot: retract them so the
- // model stops routing `run_workflow` calls to skills that no longer exist.
- // The frozen `## Installed Skills` system-prompt block cannot be updated
- // mid-session (KV-cache stability), so the retraction note on the user
- // turn is the only signal the model gets — mirrors the install path.
- // Clear from `announced_skills` so a re-install later is announced fresh.
- let removed: Vec<String> = current_ids.difference(&latest_ids).cloned().collect();
- for id in &removed {
- self.announced_skills.remove(id);
- }
- log::info!(
- "[agent_loop] installed-skills set changed ({trigger}): {} -> {} skills (new={} removed={}); updating tracked set + parking notes (system-prompt catalogue frozen for KV cache)",
- self.workflows.len(),
- latest.len(),
- newly.len(),
- removed.len(),
- );
- self.workflows = latest;
- for id in newly {
- // A re-install after a still-pending retraction cancels the
- // retraction: the skill is present again, so drop the stale "gone"
- // note and announce it instead.
- self.pending_skill_retraction.retain(|p| p != &id);
- if !self.pending_skill_announcement.contains(&id) {
- self.pending_skill_announcement.push(id);
- }
- }
- for id in removed {
- // If the skill was installed and uninstalled before its
- // announcement ever surfaced, the model never saw it as available —
- // drop the pending announcement so we don't emit a contradictory
- // "installed" + "retracted" pair on the same user turn.
- self.pending_skill_announcement.retain(|p| p != &id);
- if !self.pending_skill_retraction.contains(&id) {
- self.pending_skill_retraction.push(id);
- }
- }
- true
- }
-
/// Re-synthesise `delegate_*` tools for the orchestrator's `subagents`
/// declaration using the live `connected_integrations` slice, and
/// reconcile the resulting set into `self.synthesized_tools` /
diff --git a/crates/openhuman-core/src/security/devices/tunnel_client.rs b/crates/openhuman-core/src/security/devices/tunnel_client.rs
index 24c582da03..dfc5a127a4 100644
--- a/crates/openhuman-core/src/security/devices/tunnel_client.rs
+++ b/crates/openhuman-core/src/security/devices/tunnel_client.rs
@@ -8,7 +8,7 @@
//!
//! Frame cap: 64 KB. Rate limit: callers are expected to stay ≤ 100 frames/s.
-use serde::{Deserialize, Serialize};
+use serde::Deserialize;
use serde_json::json;
use crate::platform::socket::global_socket_manager;