Skip to content

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

chore: remove dead code across the codebase

Steven Enamakel3b303537ed36
diff --git a/crates/openhuman-core/src/agent/multimodal.rs b/crates/openhuman-core/src/agent/multimodal.rs
index f116fde011..9651f29e68 100644
--- a/crates/openhuman-core/src/agent/multimodal.rs
+++ b/crates/openhuman-core/src/agent/multimodal.rs
@@ -617,18 +617,6 @@ fn stash() -> AttachmentStash {
AttachmentStash::new(attachments_dir(), ATTACHMENTS_MAX_BYTES, ATTACHMENTS_TTL)
}
-/// Return the canonical path when `path` resolves inside the managed stash.
-/// Callers should use this returned path for subsequent reads so the checked
-/// path, rather than an attacker-controlled spelling, is what gets opened.
-pub fn managed_attachment_path(path: &str) -> Option<PathBuf> {
- stash().managed_path(path)
-}
-
-#[cfg(test)]
-pub(crate) fn managed_attachments_dir_for_tests() -> PathBuf {
- attachments_dir()
-}
-
/// Per-user fallback attachments dir used only when [`init_attachments_dir`]
/// was never called. Uses the OS user cache dir (e.g. `~/Library/Caches/…`,
/// `~/.cache/…`) so persisted image bytes aren't dropped into a world-readable
diff --git a/crates/openhuman-core/src/agent/prompts/types.rs b/crates/openhuman-core/src/agent/prompts/types.rs
index 87915e42ca..83f9223548 100644
--- a/crates/openhuman-core/src/agent/prompts/types.rs
+++ b/crates/openhuman-core/src/agent/prompts/types.rs
@@ -40,14 +40,6 @@ pub(crate) const USER_FILE_MAX_CHARS: usize = 2_000;
#[allow(dead_code)]
pub(crate) const USER_MEMORY_PER_NAMESPACE_MAX_CHARS: usize = 8_000;
-/// Hard ceiling across all namespaces, so a workspace with 30 namespaces
-/// doesn't burn the entire context window. ~32 000 chars ≈ 8 000 tokens.
-///
-/// **Note**: same Balanced-preset baseline relationship as
-/// `USER_MEMORY_PER_NAMESPACE_MAX_CHARS` — see its rustdoc.
-#[allow(dead_code)]
-pub(crate) const USER_MEMORY_TOTAL_MAX_CHARS: usize = 32_000;
-
// ─────────────────────────────────────────────────────────────────────────────
// Learned context (pre-fetched, not blocking)
// ─────────────────────────────────────────────────────────────────────────────
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
index b8100e3c58..5a154ff911 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
@@ -135,13 +135,6 @@ impl OpenHumanSessionHost {
&self.tool_policy_session
}
- #[cfg(test)]
- pub(crate) fn subagent_tool_ceiling_names_for_test(
- &self,
- ) -> &std::collections::HashSet<String> {
- &self.subagent_tool_ceiling_names
- }
-
/// Borrow the agent's memory backing store as an `Arc`.
pub fn memory_arc(&self) -> Arc<dyn Memory> {
Arc::clone(&self.memory)
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs b/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs
index ae2fa438db..c1d09f0fed 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs
@@ -91,48 +91,4 @@ impl OpenHumanSessionHost {
truncate_with_ellipsis(&scrubbed, Self::EVENT_ERROR_MAX_CHARS)
}
- /// Injects unique IDs into tool calls that are missing them.
- ///
- /// This is necessary for some tool dispatchers to correctly track and
- /// associate results.
- pub(in crate::agent::session_host) fn with_fallback_tool_call_ids(
- mut parsed_calls: Vec<ParsedToolCall>,
- iteration: usize,
- ) -> Vec<ParsedToolCall> {
- for (idx, call) in parsed_calls.iter_mut().enumerate() {
- if call.id.is_none() {
- call.id = Some(format!("parsed-{}-{}", iteration + 1, idx + 1));
- }
- }
- parsed_calls
- }
-
- /// Converts parsed tool calls into the provider-standard `NativeToolCall` format.
- ///
- /// If the provider response already contains native tool calls, they are
- /// returned as-is.
- pub(in crate::agent::session_host) fn persisted_tool_calls_for_history(
- response: &crate::inference::provider::ChatResponse,
- parsed_calls: &[ParsedToolCall],
- iteration: usize,
- ) -> Vec<NativeToolCall> {
- if !response.tool_calls.is_empty() {
- return response.tool_calls.clone();
- }
-
- parsed_calls
- .iter()
- .enumerate()
- .map(|(idx, call)| NativeToolCall {
- id: call
- .id
- .clone()
- .unwrap_or_else(|| format!("parsed-{}-{}", iteration + 1, idx + 1)),
- name: call.name.clone(),
- arguments: call.arguments.to_string(),
- // Prompt-based tool calls carry no provider extra_content.
- extra_content: None,
- })
- .collect()
- }
}
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 ea4d2f95ff..a042d2ae11 100644
--- a/crates/openhuman-core/src/agent/session_host/turn/tools.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn/tools.rs
@@ -353,37 +353,6 @@ impl OpenHumanSessionHost {
true
}
- /// Test-only: installed-skill ids currently in the catalogue snapshot
- /// (`dir_name`, falling back to `name`). Lets `refresh_workflows` tests
- /// assert through a method instead of touching private fields.
- #[cfg(test)]
- pub(in super::super) fn test_workflow_ids(&self) -> Vec<String> {
- self.workflows
- .iter()
- .map(|w| {
- if w.dir_name.is_empty() {
- w.name.clone()
- } else {
- w.dir_name.clone()
- }
- })
- .collect()
- }
-
- /// Test-only: skill ids parked for the next-turn `[skills update]`
- /// announcement by `refresh_workflows`.
- #[cfg(test)]
- pub(in super::super) fn test_pending_skill_announcement(&self) -> &[String] {
- &self.pending_skill_announcement
- }
-
- /// Test-only: skill ids parked for the next-turn `[skills retracted]`
- /// retraction note by `refresh_workflows`.
- #[cfg(test)]
- pub(in super::super) fn test_pending_skill_retraction(&self) -> &[String] {
- &self.pending_skill_retraction
- }
-
/// Test-only: inject a specific skill-events receiver (e.g. one whose
/// sender has been dropped) so `drain_skill_events`' `Closed` arm is
/// reachable without the global bus singleton.
@@ -395,25 +364,6 @@ impl OpenHumanSessionHost {
self.skill_events_rx = Some(rx);
}
- /// Test-only: whether the skill-events listener is currently armed.
- #[cfg(test)]
- pub(in super::super) fn has_skill_events_rx(&self) -> bool {
- self.skill_events_rx.is_some()
- }
-
- /// Test-only: inject a specific composio-integrations receiver so the
- /// drain path can be exercised against an isolated bus instead of the
- /// global singleton (which other parallel tests publish into, racing the
- /// "drained after one pass" assertion). Mirror of
- /// [`Self::set_skill_events_rx_for_test`].
- #[cfg(test)]
- pub(in super::super) fn set_composio_integrations_rx_for_test(
- &mut self,
- rx: tinybus::events::EventReceiver<crate::core::events::DomainEvent>,
- ) {
- self.composio_integrations_rx = Some(rx);
- }
-
/// 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/agent/session_host/turn_checkpoint.rs b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs
index eb0f67207d..df8cdd612a 100644
--- a/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs
@@ -1,41 +1,5 @@
use crate::agent::messages::ChatMessage;
-pub(crate) fn assistant_message_has_tool_calls(msg: &ChatMessage) -> bool {
- if msg.role != "assistant" {
- return false;
- }
- let Ok(value) = serde_json::from_str::<serde_json::Value>(&msg.content) else {
- return false;
- };
- // CodeRabbit follow-up: only treat this as the native tool_calls envelope
- // when the full expected shape is present:
- // - top-level JSON object
- // - `content` key present (the canonical native dialect emits — see
- // `to_provider_messages`)
- // - non-empty `tool_calls` array whose every element carries an `id`
- // string, a `name` string, and an `arguments` field
- // This stops a legitimate assistant text reply that happens to contain
- // the literal string `tool_calls` from being misclassified and dropped at
- // the bound-cached-transcript boundary.
- let Some(obj) = value.as_object() else {
- return false;
- };
- if !obj.contains_key("content") {
- return false;
- }
- let Some(tool_calls) = obj.get("tool_calls").and_then(|tc| tc.as_array()) else {
- return false;
- };
- if tool_calls.is_empty() {
- return false;
- }
- tool_calls.iter().all(|tc| {
- tc.get("id").and_then(|v| v.as_str()).is_some()
- && tc.get("name").and_then(|v| v.as_str()).is_some()
- && tc.get("arguments").is_some()
- })
-}
-
/// Instruction appended (as a synthetic user turn) to the provider
/// messages when a turn hits the tool-call iteration cap. Asks the model
/// to wrap up with a resumable checkpoint instead of letting the turn die.
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
index ead18708c0..c9bf437b27 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
@@ -192,23 +192,6 @@ impl OpenHumanDefinitionRegistry {
}
}
- /// Adapts the process-wide registry, or `None` when
- /// [`AgentDefinitionRegistry::init_global`] has not run yet.
- ///
- /// Returning `Option` rather than lazily initialising keeps boot ordering
- /// the host's decision: silently building a builtins-only registry here
- /// would mask a missing workspace-override load.
- pub fn from_global() -> Option<Self> {
- AgentDefinitionRegistry::global().map(|registry| Self {
- registry: RegistryHandle::Global(registry),
- config: None,
- registered_tools: None,
- deferred_tools: None,
- session_delegation_tools: None,
- session_definition: None,
- })
- }
-
/// Adapts a freshly-built builtins-only registry (no workspace scan).
pub fn builtins_only() -> Self {
Self::new(Arc::new(AgentDefinitionRegistry::builtins_only()))
diff --git a/crates/openhuman-core/src/config/schema/load/dirs.rs b/crates/openhuman-core/src/config/schema/load/dirs.rs
index 9c694d4dd4..9a91f000cc 100644
--- a/crates/openhuman-core/src/config/schema/load/dirs.rs
+++ b/crates/openhuman-core/src/config/schema/load/dirs.rs
@@ -188,76 +188,6 @@ async fn load_persisted_workspace_dirs(
Ok(Some((config_dir.clone(), config_dir.join("workspace"))))
}
-pub(crate) async fn persist_active_workspace_config_dir(config_dir: &Path) -> Result<()> {
- let default_config_dir = default_config_dir()?;
- let state_path = active_workspace_state_path(&default_config_dir);
-
- // Before the write, not after: this marker is one of the inputs the
- // resolver reads, so from here until the next resolve the cached answer
- // is no longer known to be current — including if the write below fails
- // partway. Clearing early costs one resolve; clearing late leaves a
- // window in which a stale workspace reads as active.
- super::active_workspace::invalidate_active_workspace();
-
- if config_dir == default_config_dir {
- if state_path.exists() {
- fs::remove_file(&state_path).await.with_context(|| {
- format!(
- "Failed to clear active workspace marker: {}",
- state_path.display()
- )
- })?;
- // Again, now that the marker is actually gone — same race as the
- // write branch below.
- super::active_workspace::invalidate_active_workspace();
- }
- return Ok(());
- }
-
- fs::create_dir_all(&default_config_dir)
- .await
- .with_context(|| {
- format!(
- "Failed to create default config directory: {}",
- default_config_dir.display()
- )
- })?;
-
- let state = ActiveWorkspaceState {
- config_dir: config_dir.to_string_lossy().into_owned(),
- };
- let serialized =
- toml::to_string_pretty(&state).context("Failed to serialize active workspace marker")?;
-
- let temp_path = default_config_dir.join(format!(
- ".{ACTIVE_WORKSPACE_STATE_FILE}.tmp-{}",
- uuid::Uuid::new_v4()
- ));
- fs::write(&temp_path, serialized).await.with_context(|| {
- format!(
- "Failed to write temporary active workspace marker: {}",
- temp_path.display()
- )
- })?;
-
- if let Err(error) = fs::rename(&temp_path, &state_path).await {
- let _ = fs::remove_file(&temp_path).await;
- anyhow::bail!(
- "Failed to atomically persist active workspace marker {}: {error}",
- state_path.display()
- );
- }
-
- // Again, now that the marker on disk actually says the new workspace. The
- // pre-write clear alone leaves a window in which a racing resolver reads
- // the *old* marker and refills the cache with the workspace being switched
- // away from. Before the directory sync, not after: the rename is what
- // changed the answer, and a sync failure must not skip this.
- super::active_workspace::invalidate_active_workspace();
- super::sync_directory(&default_config_dir).await?;
- Ok(())
-}
-
pub(crate) fn resolve_config_dir_for_workspace(workspace_dir: &Path) -> (PathBuf, PathBuf) {
let workspace_config_dir = workspace_dir.to_path_buf();
if workspace_config_dir.join("config.toml").exists() {
diff --git a/crates/openhuman-core/src/config/schema/tools/multimodal.rs b/crates/openhuman-core/src/config/schema/tools/multimodal.rs
index cda405da55..269620b1bf 100644
--- a/crates/openhuman-core/src/config/schema/tools/multimodal.rs
+++ b/crates/openhuman-core/src/config/schema/tools/multimodal.rs
@@ -105,14 +105,6 @@ impl MultimodalFileConfig {
(max_files, max_file_size_mb, max_extracted_text_chars)
}
- /// True iff `mime` is on the configured allowlist (case-insensitive).
- pub fn is_mime_allowed(&self, mime: &str) -> bool {
- let needle = mime.to_ascii_lowercase();
- self.allowed_mime_types
- .iter()
- .any(|allowed| allowed.eq_ignore_ascii_case(&needle))
- }
-
/// Hardened config for turns whose user text originates from an
/// untrusted third-party channel (Slack / Discord / Telegram /
/// WhatsApp / etc.). Disables `[FILE:…]` marker resolution outright
diff --git a/crates/openhuman-core/src/core/bus.rs b/crates/openhuman-core/src/core/bus.rs
index d76f2bd2c2..2b98a90c82 100644
--- a/crates/openhuman-core/src/core/bus.rs
+++ b/crates/openhuman-core/src/core/bus.rs
@@ -143,25 +143,6 @@ pub async fn init() -> tinybus::Result<()> {
Ok(())
}
-/// Initialise against a broker already listening on a socket.
-///
-/// Used when integrations run out of process: the kernel joins their bus rather
-/// than standing up its own. `address` is the broker's socket path.
-#[cfg(unix)]
-pub async fn init_over_socket(address: impl AsRef<std::path::Path>) -> tinybus::Result<()> {
- let transport = tinybus::transport::unix::UnixTransport::connect(address.as_ref()).await?;
- BUS.init_over(Box::new(transport), config()).await?;
- if let Err(e) = BUS.announce(&manifest()).await {
- tracing::warn!(error = %e, "[bus] could not announce the peer manifest");
- }
- tracing::info!(
- address = %address.as_ref().display(),
- events_version = %EVENTS_VERSION,
- "[bus] initialised against a shared broker"
- );
- Ok(())
-}
-
/// Logs every event at `debug`. Ported from the bus that was replaced.
///
/// Registered once at startup by the channel runtime. It subscribes to every
diff --git a/crates/openhuman-core/src/flows/ops/updates.rs b/crates/openhuman-core/src/flows/ops/updates.rs
index cb0b75cadc..fff3f8d61e 100644
--- a/crates/openhuman-core/src/flows/ops/updates.rs
+++ b/crates/openhuman-core/src/flows/ops/updates.rs
@@ -83,33 +83,6 @@ pub async fn flows_update(
.await
}
-/// Update a flow while atomically disarming any automatic-trigger graph.
-///
-/// Remote authoring surfaces use this variant so revising a schedule,
-/// app-event, or webhook flow never preserves a prior local opt-in to run the
-/// old graph. The same guarded store write persists the graph and
-/// `enabled=false`, so no trigger can observe the revised graph armed between
-/// two writes.
-pub(crate) async fn flows_update_disarming_automatic(
- config: &Config,
- id: &str,
- name: Option<String>,
- graph_json: Option<Value>,
- require_approval: Option<bool>,
- expected_version: Option<String>,
-) -> Result<Outcome<Flow>, String> {
- flows_update_inner(
- config,
- id,
- name,
- graph_json,
- require_approval,
- expected_version,
- true,
- )
- .await
-}
-
async fn flows_update_inner(
config: &Config,
id: &str,
diff --git a/crates/openhuman-core/src/flows/ops/validation.rs b/crates/openhuman-core/src/flows/ops/validation.rs
index 7cb3ee7d9b..152196e3be 100644
--- a/crates/openhuman-core/src/flows/ops/validation.rs
+++ b/crates/openhuman-core/src/flows/ops/validation.rs
@@ -33,24 +33,6 @@ pub(crate) fn engine_compatibility_errors(
.collect()
}
-/// Same walk, with the inline-nesting budget passed in rather than recomputed.
-///
-/// [`referenced_workflow_compatibility_errors`] needs this: a saved child
-/// reached partway through the root's referenced-workflow chain must still be
-/// checked to the *remaining* depth the root allows. The engine's runtime depth
-/// counter is one budget shared across the whole inline-plus-referenced chain,
-/// so a fan-in the child's own cap would not reach can still be reached from
-/// the root.
-pub(crate) fn engine_compatibility_errors_with_max_depth(
- graph: &WorkflowGraph,
- max_depth: u64,
-) -> Vec<crate::flows::FlowValidationError> {
- tinyflows::compat::errors_with_max_depth(graph, max_depth)
- .into_iter()
- .map(to_compat_validation_error)
- .collect()
-}
-
/// The nesting cap `graph` declares on its trigger, or the engine default.
pub(crate) fn max_sub_workflow_depth(graph: &WorkflowGraph) -> u64 {
tinyflows::compat::max_sub_workflow_depth(graph)
diff --git a/crates/openhuman-core/src/hooks/ops.rs b/crates/openhuman-core/src/hooks/ops.rs
index 4accf59872..164bb45226 100644
--- a/crates/openhuman-core/src/hooks/ops.rs
+++ b/crates/openhuman-core/src/hooks/ops.rs
@@ -67,51 +67,6 @@ fn workspace_roots(config: &crate::config::schema::Config) -> Vec<PathBuf> {
roots
}
-/// Fire `sessionStart`, returning context the caller should append to the
-/// session's system prompt.
-pub async fn session_started(identity: TurnIdentity, entrypoint: Option<String>) -> Option<String> {
- let engine = super::host::engine();
- if !engine.has_hooks(HookEvent::SessionStart).await {
- return None;
- }
- let input = build_input(
- HookEvent::SessionStart,
- identity,
- HookPayload::Session(SessionPayload {
- entrypoint,
- reason: None,
- duration_ms: None,
- }),
- );
- engine
- .dispatch(HookEvent::SessionStart, input)
- .await
- .output
- .additional_context
-}
-
-/// Fire `sessionEnd` and release everything scoped to the session.
-pub async fn session_ended(identity: TurnIdentity, reason: &str, duration_ms: Option<u64>) {
- let engine = super::host::engine();
- let session_id = identity.session_id.clone();
- if engine.has_hooks(HookEvent::SessionEnd).await {
- let input = build_input(
- HookEvent::SessionEnd,
- identity,
- HookPayload::Session(SessionPayload {
- entrypoint: None,
- reason: Some(reason.to_string()),
- duration_ms,
- }),
- );
- engine.dispatch(HookEvent::SessionEnd, input).await;
- }
- if let Some(session_id) = session_id {
- engine.forget_session(&session_id).await;
- tinyagents_runtime::command_hooks::followup::forget(&session_id).await;
- }
-}
-
/// The verdict on a submitted prompt.
#[derive(Debug, Clone)]
pub enum PromptVerdict {
@@ -164,33 +119,6 @@ pub async fn prompt_submitted(
}
}
-/// Fire `preCompact`, returning a message for the user if a hook set one.
-pub async fn pre_compact(
- identity: TurnIdentity,
- trigger: &str,
- context_usage_percent: Option<f64>,
- message_count: Option<usize>,
-) -> Option<String> {
- let engine = super::host::engine();
- if !engine.has_hooks(HookEvent::PreCompact).await {
- return None;
- }
- let input = build_input(
- HookEvent::PreCompact,
- identity,
- HookPayload::Compact(CompactPayload {
- trigger: trigger.to_string(),
- context_usage_percent,
- message_count,
- }),
- );
- engine
- .dispatch(HookEvent::PreCompact, input)
- .await
- .output
- .user_message
-}
-
/// Fire `subagentStart`. `Err` carries the reason the child must not run.
pub async fn subagent_starting(
identity: TurnIdentity,
@@ -218,51 +146,3 @@ pub async fn subagent_starting(
None => Ok(()),
}
}
-
-/// Fire `subagentStop`, returning a follow-up the parent may act on.
-pub async fn subagent_stopped(
- identity: TurnIdentity,
- subagent_type: &str,
- task: &str,
- status: &str,
- duration_ms: Option<u64>,
-) -> Option<String> {
- let engine = super::host::engine();
- if !engine.has_hooks(HookEvent::SubagentStop).await {
- return None;
- }
- let input = build_input(
- HookEvent::SubagentStop,
- identity.clone(),
- HookPayload::Subagent(SubagentPayload {
- subagent_type: subagent_type.to_string(),
- task: task.to_string(),
- parent_conversation_id: identity.conversation_id,
- status: Some(status.to_string()),
- duration_ms,
- }),
- );
- engine
- .dispatch(HookEvent::SubagentStop, input)
- .await
- .output
- .followup_message
-}
-
-/// Fire `afterAgentThought`. Observational, so this returns as soon as the
-/// hooks are scheduled.
-pub async fn agent_thought(identity: TurnIdentity, text: &str, duration_ms: Option<u64>) {
- let engine = super::host::engine();
- if !engine.has_hooks(HookEvent::AfterAgentThought).await {
- return;
- }
- let input = build_input(
- HookEvent::AfterAgentThought,
- identity,
- HookPayload::Text(TextPayload {
- text: text.to_string(),
- duration_ms,
- }),
- );
- engine.dispatch(HookEvent::AfterAgentThought, input).await;
-}
diff --git a/crates/openhuman-core/src/inference/provider/types.rs b/crates/openhuman-core/src/inference/provider/types.rs
index 5a5c2933c0..a2a5cce2d6 100644
--- a/crates/openhuman-core/src/inference/provider/types.rs
+++ b/crates/openhuman-core/src/inference/provider/types.rs
@@ -27,15 +27,7 @@ pub struct ChatResponse {
}
impl ChatResponse {
- /// True when the LLM wants to invoke at least one tool.
- pub fn has_tool_calls(&self) -> bool {
- !self.tool_calls.is_empty()
- }
- /// Convenience: return text content or empty string.
- pub fn text_or_empty(&self) -> &str {
- self.text.as_deref().unwrap_or("")
- }
}
/// A fine-grained streaming event emitted by a provider while serving a
@@ -110,22 +102,3 @@ pub struct ChatRequest<'a> {
/// the turn actually needs (TAURI-RUST-C62).
pub max_tokens: Option<u32>,
}
-
-/// Errors that can occur during streaming.
-#[derive(Debug, thiserror::Error)]
-pub enum StreamError {
- #[error("HTTP error: {0}")]
- Http(reqwest::Error),
-
- #[error("JSON parse error: {0}")]
- Json(serde_json::Error),
-
- #[error("Invalid SSE format: {0}")]
- InvalidSse(String),
-
- #[error("Provider error: {0}")]
- Provider(String),
-
- #[error("IO error: {0}")]
- Io(#[from] std::io::Error),
-}
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index fbc8eb8fcf..1010aabfc7 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -499,10 +499,6 @@ pub fn all_tokenjuice_registered_controllers() -> Vec<crate::core::all::Register
schemas::all_registered_controllers()
}
-pub fn all_tokenjuice_controller_schemas() -> Vec<crate::core::ControllerSchema> {
- schemas::all_controller_schemas()
-}
-
#[cfg(test)]
#[path = "mod_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/mcp/registry/mod.rs b/crates/openhuman-core/src/mcp/registry/mod.rs
index 35056368c1..971ac8adfb 100644
--- a/crates/openhuman-core/src/mcp/registry/mod.rs
+++ b/crates/openhuman-core/src/mcp/registry/mod.rs
@@ -250,18 +250,6 @@ pub mod connections {
}
}
- /// Why a server's most recent attempt hit a 401, as a stable code.
- pub async fn auth_hint_for(server_id: &str) -> Option<&'static str> {
- Some(
- host::try_service()?
- .dynamic()
- .connections()
- .auth_hint(server_id)
- .await?
- .as_code(),
- )
- }
-
/// Why a server's most recent attempt in `config`'s workspace hit a 401.
pub async fn auth_hint_for_config(config: &Config, server_id: &str) -> Option<&'static str> {
match host::for_config(config) {
@@ -341,15 +329,6 @@ pub mod connections {
}
}
- /// The most recent failure message for a server.
- pub async fn last_error_for(server_id: &str) -> Option<String> {
- host::try_service()?
- .dynamic()
- .connections()
- .last_error(server_id)
- .await
- }
-
/// The most recent failure message for a server in `config`'s workspace.
pub async fn last_error_for_config(config: &Config, server_id: &str) -> Option<String> {
match host::for_config(config) {
@@ -378,19 +357,6 @@ pub mod store {
use crate::config::Config;
use crate::mcp::host;
- /// Writes one upstream response into the cache for `config`'s workspace.
- ///
- /// # Errors
- ///
- /// Returns an error when the service cannot be opened or the row cannot be
- /// written.
- pub fn set_cached(config: &Config, cache_key: &str, body_json: &str) -> anyhow::Result<()> {
- host::for_config(config)?
- .dynamic()
- .store()
- .cache(cache_key, body_json)
- .map_err(|error| anyhow::anyhow!("failed to seed the registry cache: {error}"))
- }
}
/// Bringing installed servers up at startup.
diff --git a/crates/openhuman-core/src/memory/guard/test_support.rs b/crates/openhuman-core/src/memory/guard/test_support.rs
index 1122176a46..e2210cf77e 100644
--- a/crates/openhuman-core/src/memory/guard/test_support.rs
+++ b/crates/openhuman-core/src/memory/guard/test_support.rs
@@ -47,17 +47,6 @@ pub fn external_policy(trust_state: &str) -> HostGuardPolicy {
)
}
-/// An [`ExportRecord`] fixture.
-pub fn export_record(taint: MemoryTaint) -> ExportRecord {
- ExportRecord {
- kind: "entry".into(),
- id: "r1".into(),
- namespace: Some("ns".into()),
- taint,
- payload: serde_json::Value::Null,
- }
-}
-
/// A guard over a fresh recording provider, plus a handle on that provider.
pub fn guarded(policy: HostGuardPolicy) -> (Arc<RecordingProvider>, MemoryGuard) {
guarded_with(RecordingProvider::new(), policy)
@@ -109,15 +98,6 @@ pub fn document(content: &str, taint: MemoryTaint) -> NamespaceDocumentInput {
}
}
-/// A [`NamespaceSummary`] fixture.
-pub fn namespace_summary(namespace: &str, count: usize) -> NamespaceSummary {
- NamespaceSummary {
- namespace: namespace.into(),
- count,
- last_updated: None,
- }
-}
-
/// A [`NamespaceMemoryHit`] with only the vector component set — the signal the
/// vector-floored recall paths (Lane B, the contradiction check) filter on.
pub fn namespace_hit(
diff --git a/crates/openhuman-core/src/platform/socket/models.rs b/crates/openhuman-core/src/platform/socket/models.rs
index 49e1e7435c..a654c13bcf 100644
--- a/crates/openhuman-core/src/platform/socket/models.rs
+++ b/crates/openhuman-core/src/platform/socket/models.rs
@@ -32,37 +32,6 @@ impl Default for SocketState {
}
}
-/// Generic socket message wrapper
-#[allow(dead_code)]
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct SocketMessage {
- pub event: String,
- pub data: serde_json::Value,
-}
-
-/// MCP request structure (JSON-RPC 2.0)
-#[allow(dead_code)]
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct McpRequest {
- pub jsonrpc: String,
- pub id: serde_json::Value,
- pub method: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub params: Option<serde_json::Value>,
-}
-
-/// MCP response structure (JSON-RPC 2.0)
-#[allow(dead_code)]
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct McpResponse {
- pub jsonrpc: String,
- pub id: serde_json::Value,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub result: Option<serde_json::Value>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub error: Option<McpError>,
-}
-
/// MCP error structure
#[allow(dead_code)]
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/crates/openhuman-core/src/runtime/pool/mod.rs b/crates/openhuman-core/src/runtime/pool/mod.rs
index c0ee6e640a..09c94ac364 100644
--- a/crates/openhuman-core/src/runtime/pool/mod.rs
+++ b/crates/openhuman-core/src/runtime/pool/mod.rs
@@ -98,24 +98,6 @@ fn classify(error: &RuntimeCallError) -> PoolRunError {
PoolRunError::PreDispatch(anyhow::anyhow!("{message}"))
}
-/// Every live pool's counters, as the module reports them.
-///
-/// Returns an empty list when the module is not loaded or has no pool yet, which
-/// is the same thing a status surface wants to render: nothing running.
-pub async fn all_stats(config: &Config) -> Vec<(PoolLang, tinyruntime_bus::PoolStats)> {
- match runtime::pool_stats(config).await {
- Ok(response) => response
- .pools
- .into_iter()
- .filter_map(|stats| PoolLang::from_language(&stats.language).map(|lang| (lang, stats)))
- .collect(),
- Err(error) => {
- tracing::debug!("[runtime::pool] pool stats are unavailable: {error}");
- Vec::new()
- }
- }
-}
-
#[cfg(test)]
#[path = "pool_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/search/bus.rs b/crates/openhuman-core/src/search/bus.rs
index 0a820f85a7..b8eb206a45 100644
--- a/crates/openhuman-core/src/search/bus.rs
+++ b/crates/openhuman-core/src/search/bus.rs
@@ -48,16 +48,6 @@ impl EventHandler<DomainEvent> for CredentialRefreshSubscriber {
}
}
-/// Register the subscriber on the process bus. Called once at startup.
-pub fn register_credential_refresh_subscriber() {
- match crate::core::bus::BUS.subscribe(Arc::new(CredentialRefreshSubscriber)) {
- Some(handle) => std::mem::forget(handle),
- None => tracing::warn!(
- "[search][bus] failed to register credential refresh — bus not initialized"
- ),
- }
-}
-
#[cfg(test)]
#[path = "bus_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/security/approval/types.rs b/crates/openhuman-core/src/security/approval/types.rs
index 4e5facb29d..367617b5be 100644
--- a/crates/openhuman-core/src/security/approval/types.rs
+++ b/crates/openhuman-core/src/security/approval/types.rs
@@ -66,12 +66,6 @@ impl PendingApproval {
}
}
- /// Attach the gated tool call's provider-assigned call id.
- pub fn with_tool_call_id(mut self, tool_call_id: impl Into<String>) -> Self {
- self.tool_call_id = Some(tool_call_id.into());
- self
- }
-
/// Attach an [`ApprovalSourceContext`] — used by
/// [`super::gate::ApprovalGate`] when parking a `Workflow`-origin tool
/// call so the row (and the `approval_list_pending` JSON the frontend
diff --git a/crates/openhuman-core/src/security/audit.rs b/crates/openhuman-core/src/security/audit.rs
index 553cb59b6e..2389fa9ddb 100644
--- a/crates/openhuman-core/src/security/audit.rs
+++ b/crates/openhuman-core/src/security/audit.rs
@@ -165,11 +165,6 @@ impl AuditEvent {
self
}
- /// Set security context
- pub fn with_security(mut self, sandbox_backend: Option<String>) -> Self {
- self.security.sandbox_backend = sandbox_backend;
- self
- }
}
/// Audit logger
@@ -355,29 +350,6 @@ impl AuditLogger {
self.log(&event)
}
- /// Backward-compatible helper to log a command execution event.
- #[allow(clippy::too_many_arguments)]
- pub fn log_command(
- &self,
- channel: &str,
- command: &str,
- risk_level: &str,
- approved: bool,
- allowed: bool,
- success: bool,
- duration_ms: u64,
- ) -> Result<()> {
- self.log_command_event(CommandExecutionLog {
- channel,
- command,
- risk_level,
- approved,
- allowed,
- success,
- duration_ms,
- })
- }
-
/// Rotate log if it exceeds max size
fn rotate_if_needed(&self) -> Result<()> {
if let Ok(metadata) = std::fs::metadata(&self.log_path) {
diff --git a/crates/openhuman-core/src/security/devices/rpc.rs b/crates/openhuman-core/src/security/devices/rpc.rs
index 0a317d9de6..25278274da 100644
--- a/crates/openhuman-core/src/security/devices/rpc.rs
+++ b/crates/openhuman-core/src/security/devices/rpc.rs
@@ -276,52 +276,6 @@ fn build_secret_store(config: &Config) -> SecretStore {
SecretStore::new(&data_dir, true)
}
-/// Reconstruct a `DeviceKeypair` from the encrypted private key store.
-///
-/// Returns `None` when the channel has no persisted key or decryption fails.
-pub(crate) fn load_keypair_from_store(
- config: &Config,
- channel_id: &str,
-) -> Option<Arc<DeviceKeypair>> {
- let enc = PERSISTED_KEYPAIRS
- .lock()
- .unwrap()
- .get(channel_id)
- .cloned()?;
- let store = build_secret_store(config);
- let private_b64 = store
- .decrypt(&enc)
- .map_err(|e| {
- log::warn!(
- "[devices/rpc] decrypt keypair failed channel_id={}: {e}",
- channel_id
- );
- })
- .ok()?;
- let priv_bytes = base64url_decode(&private_b64)
- .map_err(|e| {
- log::warn!(
- "[devices/rpc] base64url decode keypair failed channel_id={}: {e}",
- channel_id
- );
- })
- .ok()?;
- if priv_bytes.len() != 32 {
- log::warn!(
- "[devices/rpc] loaded private key has wrong length {} channel_id={}",
- priv_bytes.len(),
- channel_id
- );
- return None;
- }
- let arr: [u8; 32] = priv_bytes.try_into().ok()?;
- log::debug!(
- "[devices/rpc] keypair restored from encrypted store channel_id={}",
- channel_id
- );
- Some(Arc::new(DeviceKeypair::from_private_bytes(arr)))
-}
-
// ---------------------------------------------------------------------------
// Tests
// ---------------------------------------------------------------------------
diff --git a/crates/openhuman-core/src/security/devices/tunnel_client.rs b/crates/openhuman-core/src/security/devices/tunnel_client.rs
index 88c503eb4c..3ebc6f8600 100644
--- a/crates/openhuman-core/src/security/devices/tunnel_client.rs
+++ b/crates/openhuman-core/src/security/devices/tunnel_client.rs
@@ -17,12 +17,6 @@ use crate::platform::socket::global_socket_manager;
// Wire types
// ---------------------------------------------------------------------------
-/// Payload emitted as `tunnel:register` to the backend.
-#[derive(Debug, Serialize)]
-pub struct TunnelRegisterPayload {
- pub role: String, // always "core"
-}
-
/// Response from the `tunnel:register` ACK callback.
///
/// The backend sends **camelCase**: backend PR #709 introduced
@@ -111,14 +105,6 @@ where
}
}
-/// Payload emitted as `tunnel:connect` to join a channel.
-#[derive(Debug, Serialize)]
-pub struct TunnelConnectPayload {
- #[serde(rename = "channelId")]
- pub channel_id: String,
- pub role: String, // "core" or "client"
-}
-
/// Inbound `tunnel:peer-status` event payload.
#[derive(Debug, Clone, Deserialize)]
pub struct TunnelPeerStatus {
diff --git a/crates/openhuman-core/src/security/encryption/core.rs b/crates/openhuman-core/src/security/encryption/core.rs
index 91fbd49fd0..ed9985385f 100644
--- a/crates/openhuman-core/src/security/encryption/core.rs
+++ b/crates/openhuman-core/src/security/encryption/core.rs
@@ -138,49 +138,6 @@ struct KeyFile {
version: u32,
}
-/// Initialize encryption with a password. Creates key file if needed.
-pub async fn ai_init_encryption(password: String) -> Result<bool, String> {
- let key_path = get_key_file_path()?;
-
- if key_path.exists() {
- // Key file exists, verify password works by loading it
- let content =
- std::fs::read_to_string(&key_path).map_err(|e| format!("Read key file: {e}"))?;
- let key_file: KeyFile =
- serde_json::from_str(&content).map_err(|e| format!("Parse key file: {e}"))?;
- let _key = EncryptionKey::derive(&password, &key_file.salt)?;
- Ok(true)
- } else {
- // Create new key file with random salt
- let salt = EncryptionKey::generate_salt();
- let key_file = KeyFile { salt, version: 1 };
- let content =
- serde_json::to_string_pretty(&key_file).map_err(|e| format!("Serialize: {e}"))?;
- std::fs::write(&key_path, content).map_err(|e| format!("Write key file: {e}"))?;
- Ok(true)
- }
-}
-
-/// Encrypt a string value using the password-derived key.
-pub async fn ai_encrypt(password: String, plaintext: String) -> Result<String, String> {
- let key_path = get_key_file_path()?;
- let content = std::fs::read_to_string(&key_path).map_err(|e| format!("Read key: {e}"))?;
- let key_file: KeyFile =
- serde_json::from_str(&content).map_err(|e| format!("Parse key: {e}"))?;
- let key = EncryptionKey::derive(&password, &key_file.salt)?;
- key.encrypt_string(&plaintext)
-}
-
-/// Decrypt a string value using the password-derived key.
-pub async fn ai_decrypt(password: String, encrypted: String) -> Result<String, String> {
- let key_path = get_key_file_path()?;
- let content = std::fs::read_to_string(&key_path).map_err(|e| format!("Read key: {e}"))?;
- let key_file: KeyFile =
- serde_json::from_str(&content).map_err(|e| format!("Parse key: {e}"))?;
- let key = EncryptionKey::derive(&password, &key_file.salt)?;
- key.decrypt_string(&encrypted)
-}
-
#[cfg(test)]
#[path = "core_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/security/keyring/encrypted_file_backend.rs b/crates/openhuman-core/src/security/keyring/encrypted_file_backend.rs
index 2ab63f3397..c4e4d858e5 100644
--- a/crates/openhuman-core/src/security/keyring/encrypted_file_backend.rs
+++ b/crates/openhuman-core/src/security/keyring/encrypted_file_backend.rs
@@ -75,11 +75,6 @@ pub fn init_master_key() {
});
}
-/// Returns `true` if the master key has been successfully loaded.
-pub fn is_master_key_available() -> bool {
- MASTER_KEY.get().and_then(|k| k.as_ref()).is_some()
-}
-
/// Abstraction over the OS-keychain entry that holds the master key.
///
/// Exists solely so the load-vs-mint decision in [`load_or_mint_master_key`]
diff --git a/crates/openhuman-core/src/test_support/rpc.rs b/crates/openhuman-core/src/test_support/rpc.rs
index b343fae01f..3879f225c5 100644
--- a/crates/openhuman-core/src/test_support/rpc.rs
+++ b/crates/openhuman-core/src/test_support/rpc.rs
@@ -155,20 +155,6 @@ async fn wipe_memory_tree(config: &Config) -> Result<MemoryTreeResetSummary, Str
})
}
-/// Convenience helper for handlers that prefer a raw JSON envelope.
-#[allow(dead_code)]
-pub async fn reset_json() -> Result<serde_json::Value, String> {
- let outcome = reset().await?;
- Ok(json!({
- "removed_cron_jobs": outcome.value.cron_jobs_removed,
- "memory_tree_rows_deleted": outcome.value.memory_tree_rows_deleted,
- "memory_tree_dirs_removed": outcome.value.memory_tree_dirs_removed,
- "memory_tree_sync_state_cleared": outcome.value.memory_tree_sync_state_cleared,
- "previously_onboarded": outcome.value.onboarding_was_completed,
- "previously_authenticated": outcome.value.api_key_was_set,
- }))
-}
-
#[cfg(test)]
#[path = "rpc_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rs
index 40a627f029..0d829fa40a 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs
@@ -74,24 +74,6 @@ impl ShellTool {
}
}
- /// Same as `new` but attaches a managed Node.js bootstrap for transparent
- /// `PATH` injection. The bootstrap is consulted via `try_cached()` on each
- /// invocation, so calling a non-node shell command never forces a download.
- pub fn with_node_bootstrap(
- security: Arc<SecurityPolicy>,
- runtime: Arc<dyn RuntimeAdapter>,
- audit: Arc<AuditLogger>,
- bootstrap: Arc<NodeBootstrap>,
- ) -> Self {
- Self {
- security,
- runtime,
- audit,
- node_bootstrap: Some(bootstrap),
- python_bootstrap: None,
- }
- }
-
/// Attach managed language runtimes used by shell-invoked skills. Node is
/// injected only after a dedicated node/npm tool resolved it; Python is
/// resolved lazily for python/pip commands because shell is currently the
diff --git a/crates/openhuman-core/src/tools/timeout/mod.rs b/crates/openhuman-core/src/tools/timeout/mod.rs
index c756382c8b..5be47eb790 100644
--- a/crates/openhuman-core/src/tools/timeout/mod.rs
+++ b/crates/openhuman-core/src/tools/timeout/mod.rs
@@ -138,11 +138,6 @@ pub fn tool_execution_timeout_secs() -> u64 {
current_secs()
}
-/// Effective timeout as a [`Duration`] for `tokio::time::timeout`-style callers.
-pub fn tool_execution_timeout_duration() -> Duration {
- Duration::from_secs(current_secs())
-}
-
/// Resolve an **explicit** per-call timeout request for a tool that is
/// otherwise unbounded (the scripting tools: `shell`, `node_exec`, `npm_exec`).
///
diff --git a/crates/openhuman-core/src/web3/x402/mod.rs b/crates/openhuman-core/src/web3/x402/mod.rs
index dd0fc67b42..b0c45214b1 100644
--- a/crates/openhuman-core/src/web3/x402/mod.rs
+++ b/crates/openhuman-core/src/web3/x402/mod.rs
@@ -81,17 +81,6 @@ pub async fn handle_402_and_pay(
.await
}
-/// Build a payment for `requirement` and return the encoded header value, for
-/// callers that manage their own HTTP layer.
-#[cfg(feature = "web3")]
-pub async fn try_paid_request(
- challenge: &PaymentRequired,
- requirement: &PaymentRequirements,
-) -> Result<String, X402Error> {
- tinywallet_x402::protocol::pay_challenge_header(&seams::payments(), challenge, requirement)
- .await
-}
-
/// The `x402_request` agent tool, wired to OpenHuman's wallet, chain
/// transport and proxy policy.
#[cfg(feature = "web3")]