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 multiple modules

Steven Enamakel5fcf7ba950ea
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs
index 30425e43df..ab6870dff1 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs
@@ -20,21 +20,6 @@ use crate::security::credentials::session_support::direct_backend_credential;
use super::{environment_for_base, ingestion_url, skip_push, LOG_TARGET, PUSH_TIMEOUT};
-/// Project the run-ledger aggregate onto the upstream run-total shape.
-fn run_totals(telemetry: &RunTelemetry) -> RunTotals {
- RunTotals {
- run_id: telemetry.run_id.clone(),
- input_tokens: telemetry.input_tokens,
- output_tokens: telemetry.output_tokens,
- cached_input_tokens: telemetry.cached_input_tokens,
- cost_usd: telemetry.cost_usd,
- tool_count: telemetry.tool_count,
- model: telemetry.model.clone(),
- provider: telemetry.provider.clone(),
- error: telemetry.error.clone(),
- }
-}
-
/// Push durable journal observations through the tinyagents crate Langfuse
/// exporter. The journal is already redacted before persistence, and this
/// exporter additionally strips model/tool payloads unless `capture_content`
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 ccdf326be7..0c0bfc011d 100644
--- a/crates/openhuman-core/src/agent/session_host/turn/context.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn/context.rs
@@ -9,53 +9,6 @@ use crate::tools::agent_policy::render_tool_policy_boundary;
use anyhow::Result;
-async fn collect_tree_root_summaries(
- per_namespace_cap: usize,
- total_cap: usize,
-) -> Vec<crate::agent::prompts::NamespaceSummary> {
- use crate::memory::api::provider::MemoryProvider;
-
- let Ok(guard) = crate::memory::ops::guard::active_memory_guard().await else {
- return Vec::new();
- };
- let Some(tree) = guard.as_tree() else {
- return Vec::new();
- };
- match tree
- .root_summaries_with_caps(per_namespace_cap, total_cap)
- .await
- {
- Ok(rows) => rows
- .into_iter()
- .map(|row| crate::agent::prompts::NamespaceSummary {
- namespace: row.namespace,
- body: row.body,
- updated_at: row.updated_at,
- })
- .collect(),
- Err(error) => {
- log::warn!("[session-runtime] tree root summaries unavailable: {error}");
- Vec::new()
- }
- }
-}
-
-fn sanitize_learned_entry(content: &str) -> String {
- let trimmed = content.trim();
- if trimmed.is_empty() {
- return String::new();
- }
- let sanitized: String = trimmed.chars().take(200).collect();
- if sanitized.contains("Bearer ")
- || sanitized.contains("sk-")
- || sanitized.contains("ghp_")
- || sanitized.contains("-----BEGIN")
- {
- return "[redacted: potential secret]".to_string();
- }
- sanitized
-}
-
impl OpenHumanSessionHost {
/// Pre-fetches learned context data from memory (observations, patterns, user profile).
///
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs
index febceb563d..2e4b75ff38 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs
@@ -69,14 +69,6 @@ use crate::cron::scheduler_gate;
use crate::inference::tokenjuice::AgentTokenjuiceCompression;
use crate::platform::cost;
-/// Context utilization at which an *already budget-driven* soft hint is
-/// escalated to hard.
-///
-/// Deliberately only an escalator. Utilization on its own never originates a
-/// hint here — that question belongs to the crate's `SummarizationPolicy`, and
-/// answering it a second time from the host is how the two silently disagree.
-const ESCALATE_AT_UTILIZATION: f64 = 0.9;
-
/// OpenHuman's [`BudgetGate`]: scheduler-gate back-pressure, cost-tracker
/// budget enforcement, and TokenJuice-profile-aware compression advice.
///
@@ -152,25 +144,6 @@ impl OpenHumanBudgetGate {
self.last_model.read().clone()
}
- /// Lowers a hint to what the agent's TokenJuice profile tolerates.
- ///
- /// * `Off` — the agent has opted out of TokenJuice, so this gate asks for
- /// nothing. Union semantics mean the crate's own policy still compresses
- /// when the window demands it; this is a declined request, not a veto.
- /// * `Light` — non-lossy reductions only, so `Hard` (which invites lossy
- /// compaction) is softened to `Soft`.
- /// * `Auto` / `Full` — pass through. TokenJuice itself treats `Auto` as
- /// `Full` for callers that have not resolved it.
- fn cap_hint(&self, hint: CompressionHint) -> CompressionHint {
- match self.compression {
- AgentTokenjuiceCompression::Off => CompressionHint::None,
- AgentTokenjuiceCompression::Light => match hint {
- CompressionHint::Hard => CompressionHint::Soft,
- other => other,
- },
- AgentTokenjuiceCompression::Auto | AgentTokenjuiceCompression::Full => hint,
- }
- }
}
#[async_trait]
diff --git a/crates/openhuman-core/src/agent/tinyagents/model.rs b/crates/openhuman-core/src/agent/tinyagents/model.rs
index f36da582c6..8f8e1ed0de 100644
--- a/crates/openhuman-core/src/agent/tinyagents/model.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/model.rs
@@ -16,29 +16,6 @@ pub(super) type TurnChatModel = Arc<dyn ChatModel<()>>;
pub(super) type TierRoutes = Vec<(String, TurnChatModel)>;
pub(super) type BuiltTurnModels = (TurnChatModel, TierRoutes, TurnChatModel);
-/// Build a [`PFormatRegistry`](tinytools_agent::PFormatRegistry)
-/// from the tool schemas advertised on a [`ModelRequest`] (issue #4465).
-///
-/// The text-mode fallback parse needs each tool's positional parameter layout
-/// to reconstruct named JSON arguments from a P-Format `name[a|b]` body. The
-/// harness populates `request.tools` when tools are available (schemas are
-/// rendered into the prompt for prompt-guided providers, or advertised natively
-/// otherwise), so the registry is available in both modes. Tool-less requests
-/// skip fallback parsing entirely; this empty registry is therefore consulted
-/// only alongside a non-empty advertised tool list.
-fn pformat_registry_from_request(request: &ModelRequest) -> tinytools_agent::PFormatRegistry {
- request
- .tools
- .iter()
- .map(|t| {
- (
- t.name.clone(),
- tinytools_agent::PFormatToolParams::from_schema(&t.parameters),
- )
- })
- .collect()
-}
-
/// Translate an openhuman [`ChatResponse`] into a harness [`ModelResponse`]
/// (visible text + tool calls + token usage).
///
@@ -194,21 +171,6 @@ struct OpenhumanUsageMeta {
context_window: u64,
}
-/// Build the `ModelResponse.raw` value carrying charged-USD + context-window
-/// metadata, or `None` when the provider reported neither (so responses from
-/// providers that don't surface billing stay `raw: None`).
-fn openhuman_usage_meta_raw(usage: Option<&UsageInfo>) -> Option<serde_json::Value> {
- let u = usage?;
- if u.charged_amount_usd <= 0.0 && u.context_window == 0 {
- return None;
- }
- let meta = OpenhumanUsageMeta {
- charged_amount_usd: u.charged_amount_usd,
- context_window: u.context_window,
- };
- Some(serde_json::json!({ OPENHUMAN_USAGE_META_KEY: meta }))
-}
-
/// Merge the host billing/context metadata the crate [`Usage`] cannot carry into
/// a crate [`ModelResponse::raw`] under [`OPENHUMAN_USAGE_META_KEY`], so
/// [`usage_info_from_response`] recovers the charged-USD + context window from a
diff --git a/crates/openhuman-core/src/memory/agent/memory_loader.rs b/crates/openhuman-core/src/memory/agent/memory_loader.rs
index 2c14bc3f72..1d6bc09176 100644
--- a/crates/openhuman-core/src/memory/agent/memory_loader.rs
+++ b/crates/openhuman-core/src/memory/agent/memory_loader.rs
@@ -1,16 +1,6 @@
use crate::memory::Memory;
use serde::{Deserialize, Serialize};
-/// Maximum number of `[Prior conversations]` lines surfaced into the prompt
-/// at the start of a fresh chat. Tight cap on purpose: this block is meant
-/// to recover continuity for high-importance facts, not to dump session
-/// history into context. See issue #1399.
-const PRIOR_CONVERSATION_LIMIT: usize = 3;
-/// Only the importance prefix `high.` survives into the prompt block.
-/// Medium/low entries stay queryable via the on-demand memory tool but
-/// do not auto-pollute every fresh chat.
-const PRIOR_CONVERSATION_KEY_PREFIX: &str = "high.";
-
/// Canonical header for the `[Cross-chat context]` block injected on
/// every turn that has FTS-surfaced hits from other threads.
///
diff --git a/crates/openhuman-core/src/modules/wallet.rs b/crates/openhuman-core/src/modules/wallet.rs
index d6a421ca76..562b9c3577 100644
--- a/crates/openhuman-core/src/modules/wallet.rs
+++ b/crates/openhuman-core/src/modules/wallet.rs
@@ -377,27 +377,6 @@ fn hex(bytes: &[u8]) -> String {
})
}
-/// Decode lowercase hex from the module.
-fn unhex(value: &str) -> Result<Vec<u8>, WalletCallError> {
- if !value.len().is_multiple_of(2) {
- return Err(WalletCallError::Failed(
- "the module returned a payload with an odd number of hex characters".to_string(),
- ));
- }
- value
- .as_bytes()
- .chunks_exact(2)
- .map(|pair| {
- std::str::from_utf8(pair)
- .ok()
- .and_then(|pair| u8::from_str_radix(pair, 16).ok())
- .ok_or_else(|| {
- WalletCallError::Failed("the module returned a non-hex payload".to_string())
- })
- })
- .collect()
-}
-
#[cfg(test)]
#[path = "wallet_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/platform/cost/tracker.rs b/crates/openhuman-core/src/platform/cost/tracker.rs
index 61bdf40ff0..ef8df6047b 100644
--- a/crates/openhuman-core/src/platform/cost/tracker.rs
+++ b/crates/openhuman-core/src/platform/cost/tracker.rs
@@ -598,13 +598,6 @@ impl CostStorage {
Ok((self.daily_cost_usd, self.monthly_cost_usd))
}
- /// Get aggregated **managed-route** costs for the current day and month —
- /// the only spend the local `[cost]` budget may gate (#5016).
- fn get_aggregated_managed_costs(&mut self) -> Result<(f64, f64)> {
- self.ensure_period_cache_current()?;
- Ok((self.daily_managed_cost_usd, self.monthly_managed_cost_usd))
- }
-
/// Get cost for a specific date.
fn get_cost_for_date(&self, date: NaiveDate) -> Result<f64> {
let mut cost = 0.0;
diff --git a/crates/openhuman-core/src/security/devices/tunnel_client.rs b/crates/openhuman-core/src/security/devices/tunnel_client.rs
index 3ebc6f8600..24c582da03 100644
--- a/crates/openhuman-core/src/security/devices/tunnel_client.rs
+++ b/crates/openhuman-core/src/security/devices/tunnel_client.rs
@@ -122,14 +122,6 @@ pub struct TunnelFrame {
pub payload: String,
}
-/// Outbound `tunnel:frame` emit payload.
-#[derive(Debug, Serialize)]
-struct TunnelFrameEmit<'a> {
- #[serde(rename = "channelId")]
- channel_id: &'a str,
- payload: &'a str,
-}
-
// ---------------------------------------------------------------------------
// Tunnel operations
// ---------------------------------------------------------------------------
diff --git a/crates/openhuman-core/src/security/encryption/core.rs b/crates/openhuman-core/src/security/encryption/core.rs
index b0ea6d50cc..fbb3a20718 100644
--- a/crates/openhuman-core/src/security/encryption/core.rs
+++ b/crates/openhuman-core/src/security/encryption/core.rs
@@ -111,20 +111,6 @@ pub fn get_data_dir() -> Result<PathBuf, String> {
Ok(data_dir)
}
-/// Get the path to the encryption key file under the env-aware OpenHuman root
-/// (for example `~/.openhuman/encryption.key` or `~/.openhuman-staging/encryption.key`).
-fn get_key_file_path() -> Result<PathBuf, String> {
- Ok(get_data_dir()?.join("encryption.key"))
-}
-
-/// Key file stores the salt; the actual key is derived at runtime from password.
-#[derive(Serialize, Deserialize)]
-struct KeyFile {
- salt: Vec<u8>,
- /// Version for future key rotation
- version: u32,
-}
-
#[cfg(test)]
#[path = "core_tests.rs"]
mod tests;