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
chore: files changed crates/openhuman-core/src/inference/host_runtime/ops.rs,crates/openhuman-core/s
Steven Enamakel1ebf5529023e
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops.rs b/crates/openhuman-core/src/inference/host_runtime/ops.rsindex fd3ddd9593..8b28bb3d87 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops.rs@@ -1,22 +1,19 @@//! JSON-RPC / CLI controller surface for the bundled local AI stack.//!//! This module provides high-level functions for interacting with local AI-//! services such as agent chat, model downloads, summarization, and-//! transcription. These functions are typically invoked via RPC or CLI.+//! services such as agent chat, summarization, and transcription. The local+//! runtime itself is run by the user; nothing here downloads models. These functions are typically invoked via RPC or CLI.#[cfg(test)]#[path = "ops_tests.rs"]mod tests;mod agent_chat;-mod chat;mod runtime_ops;mod turn_guards;pub use agent_chat::{agent_chat, agent_chat_for, agent_chat_simple, AgentChatTarget};-pub use chat::{local_ai_chat, LocalAiChatMessage};pub use runtime_ops::{- local_ai_assets_status, local_ai_download_asset, local_ai_downloads_progress, local_ai_embed,local_ai_prompt, local_ai_status, local_ai_summarize, local_ai_transcribe,local_ai_transcribe_bytes, local_ai_tts, local_ai_vision_prompt,};diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/chat.rs b/crates/openhuman-core/src/inference/host_runtime/ops/chat.rsdeleted file mode 100644index 70b294e84e..0000000000--- a/crates/openhuman-core/src/inference/host_runtime/ops/chat.rs+++ /dev/null@@ -1,68 +0,0 @@-//! Multi-turn chat through the local model.--use crate::config::Config;-use crate::core::Outcome;-use crate::inference::host_runtime as local_ai;--use super::turn_guards::enforce_user_prompt_or_reject;--/// A single message in a local AI chat conversation.-#[derive(Debug, serde::Deserialize)]-pub struct LocalAiChatMessage {- /// The role of the message sender (e.g., "user", "assistant").- pub role: String,- /// The text content of the message.- pub content: String,-}--/// Executes a multi-turn chat conversation using the local model.-pub async fn local_ai_chat(- config: &Config,- messages: Vec<LocalAiChatMessage>,- max_tokens: Option<u32>,-) -> Result<Outcome<String>, String> {- tracing::debug!(- message_count = messages.len(),- "[local_ai:chat] local_ai_chat op: validating"- );-- if messages.is_empty() {- return Err("messages must not be empty".to_string());- }-- let mut ollama_messages: Vec<tinyinference_local::ollama::OllamaChatMessage> =- Vec::with_capacity(messages.len());-- for msg in messages.into_iter() {- let normalized_role = msg.role.trim().to_ascii_lowercase();- match normalized_role.as_str() {- "user" => {- enforce_user_prompt_or_reject(msg.content.as_str(), "local_ai.ops.local_ai_chat")?;- }- "system" | "assistant" => {}- _ => {- return Err(format!(- "unsupported message role: '{}'; expected one of: user, system, assistant",- msg.role.trim()- ));- }- }-- ollama_messages.push(tinyinference_local::ollama::OllamaChatMessage {- role: normalized_role,- content: msg.content,- });- }-- let service = local_ai::global(config);- let runtime = crate::inference::local_runtime_config(config);- let reply = service- .chat_with_history_interactive(&runtime, ollama_messages, max_tokens)- .await?;-- tracing::debug!(- reply_len = reply.len(),- "[local_ai:chat] local_ai_chat op: done"- );- Ok(Outcome::single_log(reply, "local ai chat completed"))-}diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/runtime_ops.rs b/crates/openhuman-core/src/inference/host_runtime/ops/runtime_ops.rsindex 22e847b491..fe3f402f89 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops/runtime_ops.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops/runtime_ops.rs@@ -1,15 +1,13 @@-//! Operations over the local runtime: status, summarize, prompt, vision,-//! embeddings, transcription, speech, and model asset management.+//! Operations over the user-run local runtime: status, summarize, prompt,+//! vision, transcription, and speech. OpenHuman never downloads models or+//! starts the runtime; it only probes and talks to the configured endpoint.use chrono::Utc;use crate::config::Config;use crate::core::Outcome;use crate::inference::host_runtime as local_ai;-use crate::inference::{- LocalAiAssetsStatus, LocalAiDownloadsProgress, LocalAiEmbeddingResult, LocalAiSpeechResult,- LocalAiStatus, LocalAiTtsResult,-};+use crate::inference::{LocalAiSpeechResult, LocalAiStatus, LocalAiTtsResult};use super::turn_guards::enforce_user_prompt_or_reject;@@ -18,7 +16,14 @@ pub async fn local_ai_status(config: &Config) -> Result<Outcome<LocalAiStatus>,let service = local_ai::global(config);let runtime = crate::inference::local_runtime_config(config);let status = service.status();- if matches!(status.state.as_str(), "idle" | "degraded") {+ // `unreachable` is re-probed on every status poll so a runtime the user+ // starts later is picked up. The probe is read-only (`GET /api/tags` or+ // `GET /v1/models`); it never spawns a runtime or pulls a model.+ if matches!(status.state.as_str(), "idle" | "degraded" | "unreachable") {+ tracing::debug!(+ state = %status.state,+ "[local_ai] status: scheduling endpoint probe"+ );let service_clone = service.clone();let config_clone = runtime.clone();tokio::spawn(async move {@@ -110,23 +115,6 @@ pub async fn local_ai_vision_prompt())}-/// Generates semantic embeddings for the provided input strings.-pub async fn local_ai_embed(- config: &Config,- inputs: &[String],-) -> Result<Outcome<LocalAiEmbeddingResult>, String> {- let service = local_ai::global(config);- let runtime = crate::inference::local_runtime_config(config);- let Some(_permit) = crate::cron::scheduler_gate::wait_for_capacity().await else {- return Err("local AI embedding inference is paused while signed out".to_string());- };- let output = service- .embed(&runtime, inputs)- .await- .map_err(|e| e.to_string())?;- Ok(Outcome::single_log(output, "local ai embedding completed"))-}-/// Transcribes the audio file at the specified path.pub async fn local_ai_transcribe(config: &Config,@@ -198,52 +186,3 @@ pub async fn local_ai_tts(.map_err(|e| e.to_string())?;Ok(Outcome::single_log(output, "local ai tts completed"))}--/// Returns the status of all local AI assets (models and support files).-pub async fn local_ai_assets_status(- config: &Config,-) -> Result<Outcome<LocalAiAssetsStatus>, String> {- let service = local_ai::global(config);- let runtime = crate::inference::local_runtime_config(config);- let output = service- .assets_status(&runtime)- .await- .map_err(|e| e.to_string())?;- Ok(Outcome::single_log(- output,- "local ai assets status fetched",- ))-}--/// Returns progress for any ongoing asset downloads.-pub async fn local_ai_downloads_progress(- config: &Config,-) -> Result<Outcome<LocalAiDownloadsProgress>, String> {- let service = local_ai::global(config);- let runtime = crate::inference::local_runtime_config(config);- let output = service- .downloads_progress(&runtime)- .await- .map_err(|e| e.to_string())?;- Ok(Outcome::single_log(- output,- "local ai downloads progress fetched",- ))-}--/// Triggers the download of a specific AI asset based on capability name.-pub async fn local_ai_download_asset(- config: &Config,- capability: &str,-) -> Result<Outcome<LocalAiAssetsStatus>, String> {- let service = local_ai::global(config);- let runtime = crate::inference::local_runtime_config(config);- let output = service- .download_asset(&runtime, capability.trim())- .await- .map_err(|e| e.to_string())?;- Ok(Outcome::single_log(- output,- "local ai asset download triggered",- ))-}diff --git a/crates/openhuman-core/src/inference/host_runtime/schemas_tests.rs b/crates/openhuman-core/src/inference/host_runtime/schemas_tests.rsindex ddf47a8f2b..d05ce0f0a8 100644--- a/crates/openhuman-core/src/inference/host_runtime/schemas_tests.rs+++ b/crates/openhuman-core/src/inference/host_runtime/schemas_tests.rs@@ -6,8 +6,8 @@ fn catalog_counts_match_and_nonempty() {let h = all_registered_controllers();assert_eq!(s.len(), h.len());assert!(- s.len() >= 10,- "local inference should expose >=10 controller fns"+ s.len() >= 6,+ "local inference should expose >=6 controller fns");}@@ -35,11 +35,6 @@ fn every_registered_key_resolves_to_non_unknown_schema() {"transcribe","transcribe_bytes","tts",- "assets_status",- "downloads_progress",- "download_asset",- "install_piper",- "piper_install_status","test_connection",];for k in keys {@@ -49,6 +44,26 @@ fn every_registered_key_resolves_to_non_unknown_schema() {}}+/// Model download, asset, and Piper-install controllers were removed: the+/// user runs their own local runtime and pulls models there.+#[test]+fn download_and_installer_controllers_are_not_registered() {+ let functions: Vec<&str> = all_controller_schemas()+ .into_iter()+ .map(|schema| schema.function)+ .collect();+ for removed in [+ "assets_status",+ "downloads_progress",+ "download_asset",+ "install_piper",+ "piper_install_status",+ ] {+ assert!(!functions.contains(&removed), "`{removed}` still registered");+ assert_eq!(schemas(removed).function, "unknown");+ }+}+#[test]fn registered_controllers_all_in_inference_namespace() {for h in all_registered_controllers() {