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-cli/Cargo.toml,crates/openhuman-core/Cargo.toml,crates/openhum
Steven Enamakel87fd131acc1c
diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.tomlindex 1fdff0f154..7df858dc33 100644--- a/crates/openhuman-cli/Cargo.toml+++ b/crates/openhuman-cli/Cargo.toml@@ -172,8 +172,7 @@ required-features = ["voice"]name = "raw_coverage_all"path = "../../tests/raw_coverage_all.rs"# The merged raw-coverage target spans ~76 former files, so it reaches the-# widest surface of any single target: `lettre` (pulled in through the voice-# gate's `tinychannels/email`) and the local inference download service.+# widest surface of any single target: voice and the local inference download service.required-features = ["voice", "inference"]# ~20 former `tests/*.rs` targets folded into one binary (one link of the@@ -324,7 +323,6 @@ base64 = "0.22"flate2 = "1"futures-util = "0.3"hex = "0.4"-lettre = { version = "0.11.22", default-features = false, features = ["builder", "smtp-transport", "rustls-tls"] }parking_lot = "0.12"rusqlite = { version = "=0.40.2", features = ["bundled"] }sha2 = "0.10"diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.tomlindex 43af97f0e4..7646bfddc3 100644--- a/crates/openhuman-core/Cargo.toml+++ b/crates/openhuman-core/Cargo.toml@@ -259,8 +259,7 @@ tinychannels-runtime = { version = "0.1", path = "../../vendor/tinychannels/crat# The provider stack that IMPLEMENTS that vocabulary — Telegram, Discord,# Slack, IMAP, WhatsApp, the relay transport loop. Optional: it owns the# `reqwest` / `rusqlite` / `rustls` / `tokio-tungstenite` cohort, which a-# workflow-only build has no use for. Enabled by `channels`; voice-only podcast-# email executes through the separately loaded TinyChannels module.+# workflow-only build has no use for. Enabled by `channels`; the loaded TinyChannels module handles provider execution.tinychannels = { version = "0.1", features = ["relay-websocket"], optional = true }# tinybus — the message bus. Owns what `crates/openhuman-core/src/core/event_bus/` used to: the typed# pub/sub surface (`EventBus`, `EventHandler`, `SubscriptionHandle`), the@@ -394,7 +393,6 @@ walkdir = "2"hostname = "0.4.2"rustls = { version = "0.23", default-features = false, features = ["ring"] }sysinfo = { version = "0.33", default-features = false, features = ["system"] }-lettre = { version = "0.11.22", default-features = false, features = ["builder"], optional = true }# HTTP server framework for the domain-owned routes (`/v1`, dictation, the MCP# HTTP transport). Exclusive to the default-ON `http-server`# feature (#5048); the JSON-RPC server that mounts them lives in@@ -636,7 +634,7 @@ storage-file = []# keeping them on means `cargo check` and rust-analyzer still typecheck nearly# all of the tree. The gates turned OFF are the ones that carry the graph —# web3's ethers/secp256k1 cohort, the-# `voice`+`inference` cpal/lettre/arboard/enigo/rdev stack and+# `voice`+`inference` cpal/arboard/enigo/rdev stack and# `crash-reporting`'s sentry tree. The terminal-specific# ratatui/crossterm cohort lives in the separate `openhuman-tui` package.# Turning the core gates off takes a@@ -733,12 +731,11 @@ tinymemes = ["dep:tinymemes"]# tinybus never unloads one. See `crates/openhuman-core/src/modules/` before adding an entry# to the registry.modules = ["tinybus/modules", "dep:tinybox-bus"]-# Voice + audio_toolkit domains: STT/TTS providers, the standalone dictation-# server, always-on listening, and podcast audio generation/email delivery.+# Voice domain: STT/TTS providers, the standalone dictation+# server, and always-on listening.# Default-ON — the desktop app always ships with voice. Slim / headless builds# opt out via `--no-default-features --features "<explicit list without voice>"`,-# which also drops the exclusive `lettre` (podcast email) dependency. `hound`-# used to be on that list; WAV framing moved to the `tinyvoice` module, so the+# `hound` used to be on that list; WAV framing moved to the `tinyvoice` module, so the# crate left this graph entirely rather than merely being gated. Composes with the runtime `DomainSet::voice` flag (#4796): the# feature narrows the compile-time surface, `DomainSet` gates it at runtime.# Requires `inference` (the microphone-permission probe), so enabling `voice` turns@@ -756,9 +753,6 @@ voice = [# The member names and payload types the module answers with. Contract# only — `serde` and nothing else."dep:tinyvoice-bus",- "dep:lettre",- # Podcast SMTP delivery uses the loadable Channels module. The always-on- # bus dependency provides its upload vocabulary without linking providers.# `voice::live`: live voice agent sessions over tinyagents-live."dep:tinyagents-live",]@@ -823,7 +817,7 @@ flows = ["modules", "dep:tinyflows", "dep:tinyflows-catalog", "dep:tinyflows-cop# narrows the compile-time surface, `DomainSet` gates it at runtime.## The dep list is INTENTIONALLY EMPTY — do not "fix" it. Unlike `voice`-# (`hound`/`lettre`), these domains have no exclusive dependencies: every crate+# (`hound`), these domains have no exclusive dependencies: every crate# they touch (serde, serde_json, tokio, anyhow, async-trait, …) is shared with# always-on domains. This gate's value is tool-surface + prompt-bloat +# startup cost, NOT binary size.diff --git a/crates/openhuman-core/src/agent/session_host/driver.rs b/crates/openhuman-core/src/agent/session_host/driver.rsindex e9742efdd9..bfba85659f 100644--- a/crates/openhuman-core/src/agent/session_host/driver.rs+++ b/crates/openhuman-core/src/agent/session_host/driver.rs@@ -174,7 +174,10 @@ impl SessionDriver<OpenHumanRunContext> for OpenHumanSessionDriver {.iter().map(|spec| spec.name.clone()).collect();- ensure_snapshot_tools_are_executable(&visible_tool_names, &tools, &synthesized_tools)?;+ ensure_snapshot_tools_are_executable(+ &visible_tool_names, &tools, &synthesized_tools,+ &request.run_context.data.recorded_tool_names,+ )?;// The harness must speak the dialect this session's prompt was// composed for: a text dialect strips schemas off the wire and needs// the positional registry to recover P-Format / code-style calls.@@ -502,14 +505,15 @@ fn driver_failure(error: impl std::fmt::Display) -> DriverFailure {}}-/// Refuse a provider declaration that has no executable request-scoped source.-/// Sources may contain additional durable tools because the runtime snapshot is-/// the final provider-visible allowlist, but every declared name must resolve-/// here before the graph begins.+/// Refuse fresh declarations without a request-scoped executable source.+/// Historical declarations may outlive their executors. The harness handles+/// calls to those missing tools as recoverable errors; history never supplies+/// an executor or bypasses the current tool policy.fn ensure_snapshot_tools_are_executable(visible_tool_names: &HashSet<String>,tools: &Arc<Vec<Box<dyn tinytools::Tool>>>,synthesized_tools: &Arc<Vec<Box<dyn tinytools::Tool>>>,+ recorded_tool_names: &HashSet<String>,) -> Result<(), DriverFailure> {let executable_tool_names = tools.iter()@@ -518,6 +522,7 @@ fn ensure_snapshot_tools_are_executable(.collect::<HashSet<_>>();let missing = visible_tool_names.difference(&executable_tool_names)+ .filter(|name| !recorded_tool_names.contains(*name)).cloned().collect::<Vec<_>>();if missing.is_empty() {diff --git a/crates/openhuman-core/src/agent/session_host/driver_tests.rs b/crates/openhuman-core/src/agent/session_host/driver_tests.rsindex 6cfde70275..5d08588eb7 100644--- a/crates/openhuman-core/src/agent/session_host/driver_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/driver_tests.rs@@ -182,6 +182,7 @@ fn tool_snapshot_with_no_executable_source_fails_closed_before_graph() {&visible,&Arc::new(Vec::new()),&Arc::new(Vec::new()),+ &HashSet::new(),).expect_err("a declared tool must have a request-scoped executable source");assert!(error.error.to_string().contains("revoked_tool"));@@ -255,3 +256,15 @@ fn final_call_tokens_prefer_the_newest_call_that_reached_the_provider() {);assert_eq!(final_call_tokens(None, None, None), (0, 0));}++#[test]+fn recorded_declarations_allow_missing_executors_without_authorizing_fresh_names() {+ let historical = HashSet::from(["retired_tool".to_string()]);+ let empty = Arc::new(Vec::new());+ assert!(ensure_snapshot_tools_are_executable(&historical, &empty, &empty, &historical).is_ok());+ let mixed = HashSet::from(["retired_tool".to_string(), "invented_tool".to_string()]);+ let error = ensure_snapshot_tools_are_executable(&mixed, &empty, &empty, &historical)+ .expect_err("historical declarations never permit an unrecorded name");+ assert!(error.error.to_string().contains("invented_tool"));+ assert!(!error.error.to_string().contains("retired_tool"));+}diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rsindex 16a734970f..1fea0954a8 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs@@ -25,7 +25,7 @@ impl OpenHumanSessionHost {context.turn_deadline = crate::agent::turn_deadline::current();let cancellation = context.cancellation.clone();let root_config = context.root_run_config("openhuman-session");- let options = TurnOptions {+ let mut options = TurnOptions {request_id: origin.and_then(|origin| match origin {crate::agent::turn_origin::AgentTurnOrigin::WebChat { request_id, .. } => {request_id.clone()@@ -68,6 +68,14 @@ impl OpenHumanSessionHost {}}}+ // Persisted declarations are historical facts, while the hook still+ // supplies the only executable sources and current policy.+ options.run_context.data.recorded_tool_names = std::sync::Arc::new(+ self.runtime_session.as_ref()+ .and_then(|runtime| runtime.recorded_tools())+ .map(|snapshot| snapshot.specs().iter().map(|spec| spec.name.clone()).collect())+ .unwrap_or_default(),+ );let agent_id = self.agent_definition_id.clone();let turn = self.runtime_sessiondiff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 1557889d0f..372ae2ad49 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -336,6 +336,10 @@ pub struct OpenHumanRunContext {/// Exact executable dynamic/delegation tools selected with/// [`Self::current_tools`] for this turn.pub(crate) current_synthesized_tools: Option<Arc<Vec<Box<dyn tinytools::Tool>>>>,+ /// Native session declarations recorded before this turn. These names+ /// explain historical declarations without granting an executable source.+ pub(crate) recorded_tool_names: Arc<std::collections::HashSet<String>>,+/// Tools the session serves through `tool_search` for this turn although/// their own exposure is `Direct` (the agent definition's/// `deferred_tools`). Turn assembly registers them as `Deferred`, so the@@ -414,6 +418,7 @@ impl OpenHumanRunContext {tool_policy: None,current_tools: None,current_synthesized_tools: None,+ recorded_tool_names: Arc::new(std::collections::HashSet::new()),deferred_tool_names: Arc::new(std::collections::HashSet::new()),tool_rules: None,context_middleware: None,diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rsindex 83266a69e7..fad5d9974d 100644--- a/crates/openhuman-core/src/core/all.rs+++ b/crates/openhuman-core/src/core/all.rs@@ -321,13 +321,6 @@ fn build_registered_controllers() -> Vec<GroupedController> {DomainGroup::Desktop,crate::desktop::app_state::all_app_state_registered_controllers(),);- // Audio generation + podcast-style email delivery (gated with voice).- #[cfg(feature = "voice")]- push(- &mut controllers,- DomainGroup::Voice,- crate::voice::audio_toolkit::all_audio_toolkit_registered_controllers(),- );// Composio integration controllerspush(&mut controllers,diff --git a/crates/openhuman-core/src/core/all_tests.rs b/crates/openhuman-core/src/core/all_tests.rsindex 3b25057bed..94fee5515f 100644--- a/crates/openhuman-core/src/core/all_tests.rs+++ b/crates/openhuman-core/src/core/all_tests.rs@@ -200,36 +200,32 @@ fn all_controller_schemas_matches_registered_count() {assert_eq!(schemas.len(), controllers.len());}-/// With the `voice` feature on (the default), the voice + audio_toolkit+/// With the `voice` feature on (the default), the voice/// controllers are compiled in and registered — the desktop build is/// byte-identical.#[test]#[cfg(feature = "voice")]-fn voice_and_audio_controllers_registered_when_feature_on() {+fn voice_controllers_registered_when_feature_on() {let schemas = all_controller_schemas();assert!(schemas.iter().any(|s| s.namespace == "voice"),"voice controllers must be registered when the `voice` feature is on");- assert!(- schemas.iter().any(|s| s.namespace == "audio_toolkit"),- "audio_toolkit controllers must be registered when the `voice` feature is on"- );}-/// With the `voice` feature off, both domains are compiled out: their-/// controllers never enter the registry, so voice/audio RPC methods are+/// With the `voice` feature off, the voice domain are compiled out: their+/// controllers never enter the registry, so voice RPC methods are/// unknown-method and absent from `/schema`. This is the compile-time/// stub-facade correctness gate (see `crate::voice::stub`).#[test]#[cfg(not(feature = "voice"))]-fn voice_and_audio_controllers_absent_when_feature_off() {+fn voice_controllers_absent_when_feature_off() {let schemas = all_controller_schemas();assert!(!schemas.iter()- .any(|s| s.namespace == "voice" || s.namespace == "audio_toolkit"),- "voice/audio_toolkit controllers must be compiled out when the `voice` feature is off"+ .any(|s| s.namespace == "voice"),+ "voice controllers must be compiled out when the `voice` feature is off");}diff --git a/crates/openhuman-core/src/modules/channel_email.rs b/crates/openhuman-core/src/modules/channel_email.rsdeleted file mode 100644index ec1c579f7d..0000000000--- a/crates/openhuman-core/src/modules/channel_email.rs+++ /dev/null@@ -1,123 +0,0 @@-//! Podcast attachment delivery through the loadable TinyChannels module.-use super::client::{ModuleCallError, ModuleClient};-use async_trait::async_trait;-use std::sync::Arc;-use tinychannels_bus::controllers::ChannelSendMessageResult;-use tinychannels_bus::module_email::{EMAIL_ATTACHMENT_BYTES, EMAIL_UPLOAD_CHUNK_BYTES};-use tinychannels_bus::{methods, EmailUploadBegin, EmailUploadChunk, EmailUploadHandle};--#[async_trait]-trait EmailUploadTransport: Send + Sync {- async fn begin(&self, request: EmailUploadBegin) -> Result<EmailUploadHandle, ModuleCallError>;- async fn append(&self, request: EmailUploadChunk) -> Result<u32, ModuleCallError>;- async fn send(- &self,- handle: EmailUploadHandle,- ) -> Result<ChannelSendMessageResult, ModuleCallError>;- async fn abort(&self, handle: EmailUploadHandle) -> Result<(), ModuleCallError>;-}--#[async_trait]-impl EmailUploadTransport for ModuleClient {- async fn begin(&self, request: EmailUploadBegin) -> Result<EmailUploadHandle, ModuleCallError> {- self.call_confidential("tinychannels", methods::BEGIN_EMAIL_UPLOAD, (request,))- .await- }- async fn append(&self, request: EmailUploadChunk) -> Result<u32, ModuleCallError> {- self.call_confidential(- "tinychannels",- methods::APPEND_EMAIL_UPLOAD_CHUNK,- (request,),- )- .await- }- async fn send(- &self,- handle: EmailUploadHandle,- ) -> Result<ChannelSendMessageResult, ModuleCallError> {- self.call_confidential("tinychannels", methods::SEND_EMAIL_UPLOAD, (handle,))- .await- }- async fn abort(&self, handle: EmailUploadHandle) -> Result<(), ModuleCallError> {- self.call_confidential("tinychannels", methods::ABORT_EMAIL_UPLOAD, (handle,))- .await- }-}--/// Transfer one validated attachment in bounded confidential frames and send it.-/// SMTP and MIME delivery execute inside the module; failures have no local fallback.-pub(crate) async fn send_attachment(- client: ModuleClient,- request: EmailUploadBegin,- bytes: Vec<u8>,-) -> Result<ChannelSendMessageResult, ModuleCallError> {- upload_and_send(Arc::new(client), request, bytes).await-}--async fn upload_and_send<T: EmailUploadTransport + 'static>(- transport: Arc<T>,- request: EmailUploadBegin,- bytes: Vec<u8>,-) -> Result<ChannelSendMessageResult, ModuleCallError> {- if bytes.len() > EMAIL_ATTACHMENT_BYTES- || request.attachments.len() != 1- || request.attachments[0].byte_count != bytes.len()- {- return Err(ModuleCallError::ModuleFault);- }- let handle = transport.begin(request).await?;- let mut lease = UploadLease {- transport: transport.clone(),- handle: Some(handle.clone()),- };- let result = async {- for (sequence, bytes) in bytes.chunks(EMAIL_UPLOAD_CHUNK_BYTES).enumerate() {- let expected = sequence as u32 + 1;- let acknowledged = transport- .append(EmailUploadChunk {- handle: handle.clone(),- attachment_index: 0,- sequence: sequence as u32,- bytes: bytes.to_vec(),- })- .await?;- if acknowledged != expected {- ModuleClient::report_malformed_reply("tinychannels");- return Err(ModuleCallError::ModuleFault);- }- }- transport.send(handle.clone()).await- }- .await;- if result.is_err() {- // A send already admitted to SMTP remains module-owned; Abort refuses- // to cancel it. Failed uploads are explicitly closed before returning.- if transport.abort(handle).await.is_ok() {- lease.handle.take();- }- } else {- lease.handle.take();- }- result-}--struct UploadLease<T: EmailUploadTransport + 'static> {- transport: Arc<T>,- handle: Option<EmailUploadHandle>,-}-impl<T: EmailUploadTransport + 'static> Drop for UploadLease<T> {- fn drop(&mut self) {- if let (Some(handle), Ok(runtime)) =- (self.handle.take(), tokio::runtime::Handle::try_current())- {- let transport = self.transport.clone();- runtime.spawn(async move {- let _ = transport.abort(handle).await;- });- }- }-}--#[cfg(test)]-#[path = "channel_email_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/modules/channel_email_tests.rs b/crates/openhuman-core/src/modules/channel_email_tests.rsdeleted file mode 100644index 105a5c31cd..0000000000--- a/crates/openhuman-core/src/modules/channel_email_tests.rs+++ /dev/null@@ -1,178 +0,0 @@-use super::*;-use std::sync::Mutex;-use tinychannels_bus::{config::EmailConfig, EmailAttachmentUpload};--#[derive(Default)]-struct Fixture {- chunks: Mutex<Vec<EmailUploadChunk>>,- sent: Mutex<bool>,- aborted: Mutex<bool>,- bad_ack: bool,- append_entered: Option<tokio::sync::Notify>,- abort_finished: tokio::sync::Notify,-}-#[async_trait]-impl EmailUploadTransport for Fixture {- async fn begin(&self, request: EmailUploadBegin) -> Result<EmailUploadHandle, ModuleCallError> {- assert_eq!(request.recipient, "[email protected]");- assert_eq!(request.subject, "Podcast");- assert_eq!(request.attachments[0].filename, "podcast.mp3");- Ok(EmailUploadHandle("module-owned-upload".into()))- }- async fn append(&self, chunk: EmailUploadChunk) -> Result<u32, ModuleCallError> {- if let Some(entered) = &self.append_entered {- entered.notify_one();- std::future::pending::<()>().await;- }- let ack = if self.bad_ack { 0 } else { chunk.sequence + 1 };- self.chunks.lock().unwrap().push(chunk);- Ok(ack)- }- async fn send(- &self,- handle: EmailUploadHandle,- ) -> Result<ChannelSendMessageResult, ModuleCallError> {- assert_eq!(handle.0, "module-owned-upload");- *self.sent.lock().unwrap() = true;- Ok(ChannelSendMessageResult::default())- }- async fn abort(&self, _: EmailUploadHandle) -> Result<(), ModuleCallError> {- *self.aborted.lock().unwrap() = true;- self.abort_finished.notify_one();- Ok(())- }-}-fn request(length: usize) -> EmailUploadBegin {- EmailUploadBegin {- config: EmailConfig::default(),- recipient: "[email protected]".into(),- subject: "Podcast".into(),- body: "Attached.".into(),- attachments: vec![EmailAttachmentUpload {- filename: "podcast.mp3".into(),- content_type: "audio/mpeg".into(),- byte_count: length,- }],- }-}-#[tokio::test]-async fn podcast_attachment_uses_bounded_ordered_chunks_before_module_send() {- let fixture = Arc::new(Fixture::default());- let bytes = vec![42; EMAIL_UPLOAD_CHUNK_BYTES + 3];- upload_and_send(fixture.clone(), request(bytes.len()), bytes.clone())- .await- .unwrap();- let chunks = fixture.chunks.lock().unwrap();- assert_eq!(chunks.len(), 2);- assert_eq!(chunks[0].sequence, 0);- assert_eq!(chunks[1].sequence, 1);- assert!(chunks- .iter()- .all(|chunk| chunk.bytes.len() <= EMAIL_UPLOAD_CHUNK_BYTES && chunk.attachment_index == 0));- assert_eq!(- chunks- .iter()- .flat_map(|chunk| chunk.bytes.clone())- .collect::<Vec<_>>(),- bytes- );- assert!(*fixture.sent.lock().unwrap());- assert!(!*fixture.aborted.lock().unwrap());-}-#[tokio::test]-async fn incorrect_upload_receipt_aborts_without_smtp_delivery() {- let fixture = Arc::new(Fixture {- bad_ack: true,- ..Fixture::default()- });- assert_eq!(- upload_and_send(fixture.clone(), request(1), vec![1])- .await- .unwrap_err(),- ModuleCallError::ModuleFault- );- assert!(*fixture.aborted.lock().unwrap());- assert!(!*fixture.sent.lock().unwrap());-}-#[tokio::test]-async fn inconsistent_attachment_metadata_is_refused_before_module_upload() {- let fixture = Arc::new(Fixture::default());- assert_eq!(- upload_and_send(fixture.clone(), request(2), vec![1])- .await- .unwrap_err(),- ModuleCallError::ModuleFault- );- assert!(fixture.chunks.lock().unwrap().is_empty());- assert!(!*fixture.sent.lock().unwrap());-}--#[tokio::test]-async fn canceled_attachment_upload_closes_its_module_handle_without_sending() {- let fixture = Arc::new(Fixture {- append_entered: Some(tokio::sync::Notify::new()),- ..Fixture::default()- });- let task = tokio::spawn(upload_and_send(fixture.clone(), request(1), vec![42]));- fixture.append_entered.as_ref().unwrap().notified().await;- task.abort();- assert!(task.await.unwrap_err().is_cancelled());- tokio::time::timeout(- std::time::Duration::from_secs(2),- fixture.abort_finished.notified(),- )- .await- .unwrap();- assert!(*fixture.aborted.lock().unwrap());- assert!(!*fixture.sent.lock().unwrap());-}--#[cfg(feature = "modules")]-#[tokio::test]-async fn unattested_bus_never_receives_email_credentials_or_retries_plaintext() {- use tinybus::{broker::Broker, transport::memory::MemoryBus, Connection, ObjectPath};- #[derive(Clone)]- struct Unattested(std::sync::Arc<std::sync::atomic::AtomicUsize>);- // An in-process fixture deliberately has no module attestation.- #[tinybus::interface(name = "test.ChannelEmail")]- impl Unattested {- async fn begin_email_upload(- &self,- _: EmailUploadBegin,- ) -> tinybus::Result<EmailUploadHandle> {- self.0.fetch_add(1, std::sync::atomic::Ordering::SeqCst);- Ok(EmailUploadHandle("unattested".into()))- }- }- let bus = MemoryBus::new();- Broker::new().spawn(bus.clone());- let service = Connection::connect(bus.connect().await.unwrap())- .await- .unwrap();- let caller = Connection::connect(bus.connect().await.unwrap())- .await- .unwrap();- let calls = std::sync::Arc::new(std::sync::atomic::AtomicUsize::new(0));- service- .serve_at(- ObjectPath::new("/test/ChannelEmail").unwrap(),- Unattested(calls.clone()),- )- .await- .unwrap();- service.request_name("test.ChannelEmail").await.unwrap();- let proxy = caller- .proxy(- "test.ChannelEmail",- "/test/ChannelEmail",- "test.ChannelEmail",- )- .unwrap();- assert_eq!(- send_attachment(ModuleClient::fixture(proxy), request(1), vec![42])- .await- .unwrap_err(),- ModuleCallError::TransportFailed- );- assert_eq!(calls.load(std::sync::atomic::Ordering::SeqCst), 0);-}diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rsindex 694787740b..cb7d147e19 100644--- a/crates/openhuman-core/src/modules/mod.rs+++ b/crates/openhuman-core/src/modules/mod.rs@@ -51,8 +51,6 @@ pub mod browser_task;mod browser_task_report;#[cfg(feature = "channels")]pub(crate) mod channel_controller;-#[cfg(feature = "voice")]-pub mod channel_email;pub(crate) mod channel_health;pub mod client;#[cfg(feature = "modules")]diff --git a/crates/openhuman-core/src/skills/stub.rs b/crates/openhuman-core/src/skills/stub.rsindex bdfd178767..c4248d44a3 100644--- a/crates/openhuman-core/src/skills/stub.rs+++ b/crates/openhuman-core/src/skills/stub.rs@@ -103,5 +103,5 @@ pub mod bus {// NOTE: no `tools` module here. The `pub use skills::tools::*` glob in// `tools/mod.rs` is `#[cfg(feature = "skills")]` instead — mirroring the-// `voice` gate's handling of the `audio_toolkit::tools::*` glob. An empty stub+// feature-specific domain globs. An empty stub// module would re-export nothing and trip `unused_imports` at the glob site.diff --git a/crates/openhuman-core/src/tools/mod.rs b/crates/openhuman-core/src/tools/mod.rsindex fd93e11c75..2d0aa7c5f4 100644--- a/crates/openhuman-core/src/tools/mod.rs+++ b/crates/openhuman-core/src/tools/mod.rs@@ -55,8 +55,6 @@ pub use crate::skills::runtime::tools::*;pub use crate::skills::search::SkillSearchTool;#[cfg(feature = "skills")]pub use crate::skills::tools::*;-#[cfg(feature = "voice")]-pub use crate::voice::audio_toolkit::tools::*;#[cfg(feature = "web3")]pub use crate::web3::wallet::tools::*;pub use implementations::*;diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rsindex 4492bf7624..6c6a753a66 100644--- a/crates/openhuman-core/src/tools/ops.rs+++ b/crates/openhuman-core/src/tools/ops.rs@@ -345,21 +345,6 @@ pub fn all_tools_with_runtime(security.clone(),action_dir.to_path_buf(),)),- // Audio-toolkit podcast tools — gated with the `voice` feature (they- // live in the `audio_toolkit` domain, which is compiled out when voice- // is disabled).- #[cfg(feature = "voice")]- Box::new(AudioGeneratePodcastTool::new(- config.clone(),- security.clone(),- )),- #[cfg(feature = "voice")]- Box::new(AudioEmailPodcastTool::new(config.clone(), security.clone())),- #[cfg(feature = "voice")]- Box::new(AudioGenerateAndEmailPodcastTool::new(- config.clone(),- security.clone(),- )),Box::new(GmailUnsubscribeTool),// Skills metadata tools. `skill_run` is already exposed by RunSkillTool// above, so it is not duplicated. Reads ship default-ON; thediff --git a/crates/openhuman-core/src/tools/ops_tests.rs b/crates/openhuman-core/src/tools/ops_tests.rsindex c82911cf09..da04cabc3d 100644--- a/crates/openhuman-core/src/tools/ops_tests.rs+++ b/crates/openhuman-core/src/tools/ops_tests.rs@@ -314,7 +314,6 @@ const REPRESENTATIVE: &[(&str, crate::core::all::DomainGroup)] = {("mcp_list_servers", G::Mcp),("wallet_get_address", G::Web3),("media_generate_image", G::Media),- ("audio_generate_podcast", G::Voice),("create_workflow", G::Flows),("run_workflow", G::Skills),("cron_add", G::Automation),diff --git a/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs b/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rsindex 9eafb79089..c0968b6070 100644--- a/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs+++ b/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs@@ -56,15 +56,6 @@ fn tool_group_classifies_gate_and_harness_families() {);}assert_eq!(tool_group("media_generate_image"), DomainGroup::Media);- // Voice audio_* tools have no voice_/tts_/stt_ prefix — must be classified- // explicitly, not fall through to Platform (#4808 review).- assert_eq!(tool_group("audio_generate_podcast"), DomainGroup::Voice);- assert_eq!(tool_group("audio_email_podcast"), DomainGroup::Voice);- assert_eq!(- tool_group("audio_generate_and_email_podcast"),- DomainGroup::Voice- );-// Harness-mapped families → kept under harness().assert_eq!(tool_group("memory"), DomainGroup::Memory);assert_eq!(tool_group("goal_get"), DomainGroup::Threads);@@ -128,7 +119,6 @@ fn tool_group_gate_families_dropped_under_harness_not_full() {assert!(!harness.allows(tool_group("run_workflow")));assert!(!harness.allows(tool_group("shell")));// The previously-misclassified gate-family tools now drop under harness.- assert!(!harness.allows(tool_group("audio_generate_podcast")));}#[test]diff --git a/crates/openhuman-core/src/tools/ops_tool_groups.rs b/crates/openhuman-core/src/tools/ops_tool_groups.rsindex c4ad79f952..47c9ad0c4b 100644--- a/crates/openhuman-core/src/tools/ops_tool_groups.rs+++ b/crates/openhuman-core/src/tools/ops_tool_groups.rs@@ -76,14 +76,6 @@ pub(crate) fn tool_group(name: &str) -> crate::core::all::DomainGroup {"flow_memory_recall","flow_memory_remember",];- // Voice family agent tools (audio_toolkit) — no `voice_`/`tts_`/`stt_`- // prefix, so they must be listed explicitly or they fall through to- // Platform and stay callable when Voice is gated off (#4808 review).- const VOICE: &[&str] = &[- "audio_generate_podcast",- "audio_email_podcast",- "audio_generate_and_email_podcast",- ];// Threads: thread_* / todo_* handled by prefix below; these are the extras.// Monitor + proactive-notify tools (Automation family).const MONITORS: &[&str] = &[@@ -114,10 +106,8 @@ pub(crate) fn tool_group(name: &str) -> crate::core::all::DomainGroup {if name.starts_with("media_") {return DomainGroup::Media;}- // Voice family: explicit audio_* podcast tools plus the defensive- // voice_/tts_/stt_ prefixes for any future tool.- if VOICE.contains(&name)- || name.starts_with("voice_")+ // Voice family prefixes.+ if name.starts_with("voice_")|| name.starts_with("tts_")|| name.starts_with("stt_"){diff --git a/crates/openhuman-core/src/tools/toolpacks/registry.rs b/crates/openhuman-core/src/tools/toolpacks/registry.rsindex 779df93343..bd214aa945 100644--- a/crates/openhuman-core/src/tools/toolpacks/registry.rs+++ b/crates/openhuman-core/src/tools/toolpacks/registry.rs@@ -209,17 +209,6 @@ pub const PACKS: &[ToolPack] = &[owners: &["presentation_agent"],guide: "",},- ToolPack {- id: "audio",- summary: "Generate a spoken podcast from text and optionally email the audio.",- tools: &[- "audio_generate_podcast",- "audio_email_podcast",- "audio_generate_and_email_podcast",- ],- owners: &[],- guide: "",- },ToolPack {id: "system",summary: "OpenHuman settings: config, health, diagnostics, costs, service, proxy, credentials, app updates.",diff --git a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rsindex 2bfd8ab35a..96457af298 100644--- a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs+++ b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs@@ -331,14 +331,6 @@ fn every_pack_declares_the_tools_it_is_named_for() {"make_presentation",],),- (- "audio",- &[- "audio_generate_podcast",- "audio_email_podcast",- "audio_generate_and_email_podcast",- ],- ),("system",&[diff --git a/crates/openhuman-core/src/voice/audio_toolkit/README.md b/crates/openhuman-core/src/voice/audio_toolkit/README.mddeleted file mode 100644index 408da36b7f..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/README.md+++ /dev/null@@ -1,101 +0,0 @@-# audio_toolkit--Text-to-speech "podcast" toolkit. Synthesizes text into a workspace audio file via the `voice` TTS providers, optionally emails that file as an attachment (through the loadable TinyChannels module over SMTP, or as a workspace capture in test/e2e mode), and exposes both as agent tools and JSON-RPC controllers. The combined `generate_and_email` flow chains both steps so the agent can turn arbitrary text into a listen-later audio email in one call.--## Responsibilities--- Synthesize text → audio (`mp3`/`wav`) using a configured or requested TTS provider (`cloud` default, or `piper`).-- Resolve and harden output paths: workspace-relative only, no absolute paths, no `..` traversal; default path is `artifacts/audio/<ts>-<slug>.<ext>`.-- Enforce provider/format compatibility (`piper` → `wav` only; `cloud` → `mp3` only) and verify the provider's returned MIME matches the requested format.-- Build a multipart email (plain body + audio attachment) and deliver it via the `EmailChannel` over SMTP.-- In `e2e-test-support` builds (or when `OPENHUMAN_EMAIL_CAPTURE_DIR` is set), capture the `.eml` to a workspace file instead of sending.-- Surface all three operations as agent tools and JSON-RPC controllers.--## Key files--| File | Role |-| --- | --- |-| `crates/openhuman-core/src/voice/audio_toolkit/mod.rs` | Export-only module surface: re-exports ops fns, schema registries, and types. |-| `crates/openhuman-core/src/voice/audio_toolkit/types.rs` | Serde domain types: `AudioFormat`, request/result structs. |-| `crates/openhuman-core/src/voice/audio_toolkit/ops.rs` | Business logic: `generate_podcast`, `email_podcast`, `generate_and_email_podcast`, `resolve_email_capture_dir`, plus private helpers (path/format/voice resolution, base64 decode, MIME enforcement, slugify, email build/capture). Contains the unit-test suite. |-| `crates/openhuman-core/src/voice/audio_toolkit/schemas.rs` | RPC controller schemas + `handle_*` handlers delegating to [`ops.rs`](./ops.rs); loads `Config` via `config::rpc`. |-| `crates/openhuman-core/src/voice/audio_toolkit/tools.rs` | Re-exports the three agent tool structs from [`tools/podcast.rs`](./tools/podcast.rs). |-| `crates/openhuman-core/src/voice/audio_toolkit/tools/podcast.rs` | `Tool` impls: `AudioGeneratePodcastTool`, `AudioEmailPodcastTool`, `AudioGenerateAndEmailPodcastTool`; security gating + arg parsing. |--## Public surface--From [`mod.rs`](./mod.rs):--- ops: `generate_podcast`, `email_podcast`, `generate_and_email_podcast`, `resolve_email_capture_dir`. All take `&Config` and return `Result<Outcome<T>, String>` (except `resolve_email_capture_dir`, which returns `Option<PathBuf>`).-- schemas: `all_audio_toolkit_registered_controllers`.-- types: `AudioFormat` (`Mp3`/`Wav`, with `extension()` / `mime()`), `AudioGenerateRequest`, `EmailPodcastRequest`, `AudioGeneratedArtifact`, `AudioEmailDeliveryResult`, `AudioToolkitGenerateAndEmailResult`.-- **tools** (`pub mod tools`): `AudioGeneratePodcastTool`, `AudioEmailPodcastTool`, `AudioGenerateAndEmailPodcastTool`.--## RPC / controllers--Namespace `audio_toolkit` (invoked as `openhuman.audio_toolkit_<function>`):--| Method | Inputs | Output |-| --- | --- | --- |-| `audio_toolkit_generate_podcast` | `text` (req); optional `title`, `output_path`, `provider`, `voice`, `format` | `audio` (artifact JSON) |-| `audio_toolkit_email_podcast` | `to`, `subject`, `body`, `audio_path` (req); optional `attachment_name` | `email` (delivery JSON) |-| `audio_toolkit_generate_and_email_podcast` | `text`, `to`, `subject`, `body` (req); optional `title`, `output_path`, `provider`, `voice`, `format`, `attachment_name` | `result` (combined JSON) |--Registered into the global controller registry via `crates/openhuman-core/src/core/all.rs` (`all_audio_toolkit_registered_controllers`).--## Agent tools--From [`tools/podcast.rs`](./tools/podcast.rs). All are `PermissionLevel::Execute`, and each calls `SecurityPolicy::enforce_tool_operation(ToolOperation::Act, ...)` before running:--| Tool name | Backing op |-| --- | --- |-| `audio_generate_podcast` | `generate_podcast` |-| `audio_email_podcast` | `email_podcast` |-| `audio_generate_and_email_podcast` | `generate_and_email_podcast` |--Tools are constructed with `Arc<Config>` + `Arc<SecurityPolicy>` and registered in `crates/openhuman-core/src/tools/ops.rs`; re-exported via `crates/openhuman-core/src/tools/mod.rs`.--## Persistence--No durable domain store. Side effects are filesystem writes within the workspace:--- Audio files → `artifacts/audio/` (or caller-supplied `output_path`).-- Captured emails (test/e2e) → `artifacts/email-capture/` (or `OPENHUMAN_EMAIL_CAPTURE_DIR`) as `.eml` files named `podcast-email-<ts>-<uuid>.eml`.--## Dependencies--- `crate::voice`: `create_tts_provider`, `DEFAULT_PIPER_VOICE`; actual speech synthesis.-- `crate::channels::email_channel::EmailChannel`: SMTP delivery of the built message.-- `crate::config::Config` / `config::rpc`: workspace dir, `local_ai.tts_provider`, `channels_config.email`; `load_config_with_timeout` in RPC handlers.-- `crate::security`: `SecurityPolicy` / `ToolOperation` to gate the agent tools.-- `tinytools`: `Tool`, `ToolResult`, `PermissionLevel`.-- `crate::core::all` / `crate::core`: `RegisteredController`, `ControllerFuture`, `ControllerSchema`, `FieldSchema`, `TypeSchema` for RPC registration.-- `crate::core::Outcome`: controller/op return contract.-- External crates: `lettre` (email message + attachment), `base64`, `chrono`, `uuid`.--## Used by--- `crates/openhuman-core/src/core/all.rs`: registers the controllers/schemas into the JSON-RPC and CLI surface.-- `crates/openhuman-core/src/tools/ops.rs`: instantiates the three tools into the agent tool registry; `crates/openhuman-core/src/tools/mod.rs` re-exports them.--## Notes / gotchas--- `provider`/`format` are coupled: `piper` only emits `wav`, `cloud` only emits `mp3`; mismatches are hard errors (`resolve_format`). After synthesis the returned MIME is re-checked against the requested format (`enforce_audio_format`).-- Default voice is only injected for `piper` (`DEFAULT_PIPER_VOICE`); `cloud` defaults to no explicit voice.-- `email_podcast` re-validates `audio_path` (workspace-relative, no `..`) independently of `generate_podcast`; the combined flow overwrites the email request's `audio_path` with the freshly generated file's path.-- Email capture mode is feature/env-gated: enabled under `feature = "e2e-test-support"` or when `OPENHUMAN_EMAIL_CAPTURE_DIR` is non-empty; otherwise SMTP send requires `channels_config.email` to be configured (`from_address` falls back to `[email protected]`).-- `AudioEmailDeliveryResult.mode` is `"capture"` or `"smtp"` to indicate which path ran.--## Further reading--- [Parent module (`voice`)](../README.md)-- [Voice tools](../../../../../gitbooks/features/native-tools/voice.md)-- [tinyvoice submodule](../../../../../vendor/tinyvoice/README.md)-- [Chat](../../../../../gitbooks/features/chat.md)--SMTP delivery uses `modules/channel_email.rs`: credentials are reconciled by-OpenHuman and metadata/attachment chunks travel through confidential TinyBus-calls. Chunks are bounded by the contract limit; unexpected acknowledgments-abort the upload before SMTP. Cancellation requests cleanup of a known upload handle; module lease expiry-reclaims it if transport cleanup fails. Admitted SMTP work remains module-owned. An unavailable module fails delivery.-The existing capture mode still writes its MIME fixture to the workspace.diff --git a/crates/openhuman-core/src/voice/audio_toolkit/mod.rs b/crates/openhuman-core/src/voice/audio_toolkit/mod.rsdeleted file mode 100644index aa4c98f3f0..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/mod.rs+++ /dev/null@@ -1,18 +0,0 @@-//! Podcast generation + email delivery (`audio_toolkit` RPC namespace).-//!-//! See [README.md](README.md) for responsibilities, the RPC surface, and the-//! agent tools this module exposes.--mod ops;-mod schemas;-pub mod tools;-mod types;--pub use ops::{- email_podcast, generate_and_email_podcast, generate_podcast, resolve_email_capture_dir,-};-pub use schemas::all_audio_toolkit_registered_controllers;-pub use types::{- AudioEmailDeliveryResult, AudioFormat, AudioGenerateRequest, AudioGeneratedArtifact,- AudioToolkitGenerateAndEmailResult, EmailPodcastRequest,-};diff --git a/crates/openhuman-core/src/voice/audio_toolkit/ops.rs b/crates/openhuman-core/src/voice/audio_toolkit/ops.rsdeleted file mode 100644index 4418134345..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/ops.rs+++ /dev/null@@ -1,441 +0,0 @@-use std::path::{Path, PathBuf};--use base64::{engine::general_purpose::STANDARD as BASE64, Engine};-use lettre::message::{header::ContentType, Attachment, Mailbox, MultiPart, SinglePart};-use lettre::Message;--use crate::config::Config;-use crate::core::Outcome;-use crate::voice::{create_tts_provider, DEFAULT_PIPER_VOICE};-use tinychannels_bus::{EmailAttachmentUpload, EmailUploadBegin};--use super::types::{- AudioEmailDeliveryResult, AudioFormat, AudioGenerateRequest, AudioGeneratedArtifact,- AudioToolkitGenerateAndEmailResult, EmailPodcastRequest,-};--const LOG_PREFIX: &str = "[audio_toolkit]";-const DEFAULT_OUTPUT_DIR: &str = "artifacts/audio";-const DEFAULT_CAPTURE_DIR: &str = "artifacts/email-capture";-const EMAIL_CAPTURE_ENV: &str = "OPENHUMAN_EMAIL_CAPTURE_DIR";--pub async fn generate_podcast(- config: &Config,- request: AudioGenerateRequest,-) -> Result<Outcome<AudioGeneratedArtifact>, String> {- let trimmed = request.text.trim();- if trimmed.is_empty() {- return Err("text is required".to_string());- }-- let provider = effective_provider_name(config, request.provider.as_deref());- let format = resolve_format(&provider, request.format)?;- let voice = effective_voice(&provider, request.voice.as_deref());- let output_rel_path = resolve_output_path(- config.workspace_dir.as_path(),- request.output_path.as_deref(),- request.title.as_deref(),- format,- )?;-- log::debug!(- "{LOG_PREFIX} generate provider={} format={:?} output_path={}",- provider,- format,- output_rel_path.display()- );-- let provider_impl = create_tts_provider(&provider, voice.as_deref().unwrap_or(""), config)- .map_err(|e| e.to_string())?;- let outcome = provider_impl- .synthesize(config, trimmed, voice.as_deref())- .await?;-- let bytes = decode_audio_payload(&outcome.value.audio_base64)?;- enforce_audio_format(format, &outcome.value.audio_mime)?;- let resolved = config.workspace_dir.join(&output_rel_path);- if let Some(parent) = resolved.parent() {- tokio::fs::create_dir_all(parent)- .await- .map_err(|e| format!("failed to create {}: {e}", parent.display()))?;- }- tokio::fs::write(&resolved, &bytes)- .await- .map_err(|e| format!("failed to write {}: {e}", resolved.display()))?;-- let result = AudioGeneratedArtifact {- output_path: output_rel_path.to_string_lossy().to_string(),- file_name: resolved- .file_name()- .map(|v| v.to_string_lossy().to_string())- .unwrap_or_else(|| format!("podcast.{}", format.extension())),- provider,- voice,- format,- audio_mime: outcome.value.audio_mime,- bytes_written: bytes.len(),- chars_synthesized: trimmed.chars().count(),- };-- Ok(Outcome::single_log(- result,- "audio podcast synthesized to workspace file",- ))-}--pub async fn email_podcast(- config: &Config,- request: EmailPodcastRequest,-) -> Result<Outcome<AudioEmailDeliveryResult>, String> {- let to = request.to.trim();- let subject = request.subject.trim();- let body = request.body.trim();- let audio_path = request.audio_path.trim();-- if to.is_empty() {- return Err("to is required".to_string());- }- if subject.is_empty() {- return Err("subject is required".to_string());- }- if body.is_empty() {- return Err("body is required".to_string());- }- if audio_path.is_empty() {- return Err("audio_path is required".to_string());- }-- let rel_audio_path = PathBuf::from(audio_path);- if rel_audio_path.is_absolute() {- return Err("audio_path must be workspace-relative".to_string());- }- if rel_audio_path- .components()- .any(|c| matches!(c, std::path::Component::ParentDir))- {- return Err("audio_path must not contain parent-directory traversal".to_string());- }-- let resolved_audio_path = config.workspace_dir.join(&rel_audio_path);- let audio_bytes = tokio::fs::read(&resolved_audio_path)- .await- .map_err(|e| format!("failed to read {}: {e}", resolved_audio_path.display()))?;- let attachment_name = request- .attachment_name- .as_deref()- .map(str::trim)- .filter(|s| !s.is_empty())- .map(str::to_string)- .or_else(|| {- resolved_audio_path- .file_name()- .map(|v| v.to_string_lossy().to_string())- })- .unwrap_or_else(|| "podcast.mp3".to_string());- let content_type = content_type_for_attachment(&attachment_name);-- if let Some(capture_dir) = resolve_email_capture_dir(config) {- let email = build_email_message(- config,- to,- subject,- body,- &attachment_name,- content_type- .parse()- .map_err(|error| format!("invalid content type for attachment: {error}"))?,- audio_bytes,- )?;- let capture_rel =- capture_email_message(config.workspace_dir.as_path(), &capture_dir, &email).await?;- let result = AudioEmailDeliveryResult {- to: to.to_string(),- subject: subject.to_string(),- attachment_name,- mode: "capture".to_string(),- capture_path: Some(capture_rel),- };- return Ok(Outcome::single_log(- result,- "audio email captured to workspace file",- ));- }-- let email_cfg = config- .channels_config- .clone()- .ok_or_else(|| "email channel is not configured".to_string())?;- let mut email_cfg = crate::channels::credentials::resolve_email_password(email_cfg, config);- email_cfg.from_address = email_cfg.from_address.trim().to_owned();- if email_cfg.from_address.is_empty() {- email_cfg.from_address = "[email protected]".into();- }- let byte_count = audio_bytes.len();- if byte_count > tinychannels_bus::module_email::EMAIL_ATTACHMENT_BYTES {- return Err("audio attachment exceeds the 25 MiB email limit".into());- }- crate::modules::channel_email::send_attachment(- crate::modules::client::ModuleClient::new(config.clone()),- EmailUploadBegin {- config: email_cfg,- recipient: to.to_owned(),- subject: subject.to_owned(),- body: body.to_owned(),- attachments: vec![EmailAttachmentUpload {- filename: attachment_name.clone(),- content_type: content_type.to_string(),- byte_count,- }],- },- audio_bytes,- )- .await- .map_err(|error| format!("failed to send email attachment: {error}"))?;-- Ok(Outcome::single_log(- AudioEmailDeliveryResult {- to: to.to_string(),- subject: subject.to_string(),- attachment_name,- mode: "smtp".to_string(),- capture_path: None,- },- "audio email delivered over SMTP",- ))-}--pub async fn generate_and_email_podcast(- config: &Config,- generate_request: AudioGenerateRequest,- email_request: EmailPodcastRequest,-) -> Result<Outcome<AudioToolkitGenerateAndEmailResult>, String> {- let generated = generate_podcast(config, generate_request).await?;- let email_request = EmailPodcastRequest {- audio_path: generated.value.output_path.clone(),- ..email_request- };- let emailed = email_podcast(config, email_request).await?;- Ok(Outcome::single_log(- AudioToolkitGenerateAndEmailResult {- audio: generated.value,- email: emailed.value,- },- "audio podcast generated and emailed",- ))-}--pub fn resolve_email_capture_dir(config: &Config) -> Option<PathBuf> {- if let Ok(raw) = std::env::var(EMAIL_CAPTURE_ENV) {- let trimmed = raw.trim();- if !trimmed.is_empty() {- return Some(PathBuf::from(trimmed));- }- }- #[cfg(feature = "e2e-test-support")]- {- Some(config.workspace_dir.join(DEFAULT_CAPTURE_DIR))- }- #[cfg(not(feature = "e2e-test-support"))]- {- let _ = config;- None- }-}--fn effective_provider_name(config: &Config, requested: Option<&str>) -> String {- requested- .map(str::trim)- .filter(|s| !s.is_empty())- .map(str::to_string)- .unwrap_or_else(|| {- let configured = config.local_ai.tts_provider.trim();- if configured.is_empty() {- "cloud".to_string()- } else {- configured.to_string()- }- })-}--fn effective_voice(provider: &str, requested: Option<&str>) -> Option<String> {- let explicit = requested- .map(str::trim)- .filter(|s| !s.is_empty())- .map(str::to_string);- if explicit.is_some() {- return explicit;- }- if provider == "piper" {- return Some(DEFAULT_PIPER_VOICE.to_string());- }- None-}--fn resolve_format(provider: &str, requested: Option<AudioFormat>) -> Result<AudioFormat, String> {- let resolved = requested.unwrap_or_else(|| {- if provider == "piper" {- AudioFormat::Wav- } else {- AudioFormat::Mp3- }- });- match (provider, resolved) {- ("piper", AudioFormat::Mp3) => {- Err("provider `piper` only supports wav output; use format=`wav` or provider=`cloud`".to_string())- }- ("cloud", AudioFormat::Wav) => {- Err("provider `cloud` currently returns mp3 output only; use format=`mp3` or provider=`piper`".to_string())- }- _ => Ok(resolved),- }-}--fn decode_audio_payload(audio_base64: &str) -> Result<Vec<u8>, String> {- BASE64- .decode(audio_base64.trim())- .map_err(|e| format!("invalid audio_base64 payload: {e}"))-}--fn enforce_audio_format(format: AudioFormat, mime: &str) -> Result<(), String> {- let normalized = mime.trim().to_ascii_lowercase();- match format {- AudioFormat::Mp3 if normalized == "audio/mpeg" => Ok(()),- AudioFormat::Wav if normalized == "audio/wav" => Ok(()),- _ => Err(format!(- "provider returned mime `{mime}` but requested format was `{}`",- format.extension()- )),- }-}--fn resolve_output_path(- workspace_dir: &Path,- requested: Option<&str>,- title: Option<&str>,- format: AudioFormat,-) -> Result<PathBuf, String> {- let rel_path = match requested.map(str::trim).filter(|s| !s.is_empty()) {- Some(path) => PathBuf::from(path),- None => {- let slug = slugify_title(title.unwrap_or("podcast"));- PathBuf::from(DEFAULT_OUTPUT_DIR).join(format!(- "{}-{}.{}",- chrono::Utc::now().format("%Y%m%d-%H%M%S"),- slug,- format.extension()- ))- }- };- if rel_path.is_absolute() {- return Err("output_path must be workspace-relative".to_string());- }- if rel_path- .components()- .any(|c| matches!(c, std::path::Component::ParentDir))- {- return Err("output_path must not contain parent-directory traversal".to_string());- }- let resolved = workspace_dir.join(&rel_path);- if !resolved.starts_with(workspace_dir) {- return Err("output_path escapes the workspace".to_string());- }- Ok(rel_path)-}--fn slugify_title(title: &str) -> String {- let mut out = String::new();- let mut last_was_dash = false;- for ch in title.chars() {- if ch.is_ascii_alphanumeric() {- out.push(ch.to_ascii_lowercase());- last_was_dash = false;- } else if !last_was_dash && !out.is_empty() {- out.push('-');- last_was_dash = true;- }- }- let trimmed = out.trim_matches('-');- if trimmed.is_empty() {- "podcast".to_string()- } else {- trimmed.to_string()- }-}--fn content_type_for_attachment(file_name: &str) -> &'static str {- if file_name.to_ascii_lowercase().ends_with(".wav") {- "audio/wav"- } else {- "audio/mpeg"- }-}--fn build_email_message(- config: &Config,- to: &str,- subject: &str,- body: &str,- attachment_name: &str,- content_type: ContentType,- attachment_bytes: Vec<u8>,-) -> Result<Message, String> {- let from_address = config- .channels_config- .as_ref()- .map(|cfg| cfg.from_address.trim())- .filter(|s| !s.is_empty())- .unwrap_or("[email protected]");- let from: Mailbox = from_address- .parse()- .map_err(|e| format!("invalid from address `{from_address}`: {e}"))?;- let to_mailbox: Mailbox = to- .parse()- .map_err(|e| format!("invalid to address `{to}`: {e}"))?;- let attachment =- Attachment::new(attachment_name.to_string()).body(attachment_bytes, content_type);- Message::builder()- .from(from)- .to(to_mailbox)- .subject(subject)- .multipart(- MultiPart::mixed()- .singlepart(SinglePart::plain(body.to_string()))- .singlepart(attachment),- )- .map_err(|e| format!("failed to build email message: {e}"))-}--async fn capture_email_message(- workspace_dir: &Path,- capture_dir: &Path,- email: &Message,-) -> Result<String, String> {- let resolved_dir = if capture_dir.is_absolute() {- capture_dir.to_path_buf()- } else {- workspace_dir.join(capture_dir)- };- tokio::fs::create_dir_all(&resolved_dir)- .await- .map_err(|e| format!("failed to create {}: {e}", resolved_dir.display()))?;- let file_name = format!(- "podcast-email-{}-{}.eml",- chrono::Utc::now().format("%Y%m%d-%H%M%S"),- uuid::Uuid::new_v4()- );- let resolved_path = resolved_dir.join(&file_name);- tokio::fs::write(&resolved_path, email.formatted())- .await- .map_err(|e| format!("failed to write {}: {e}", resolved_path.display()))?;- let relative = resolved_path- .strip_prefix(workspace_dir)- .map(|v| v.to_string_lossy().to_string())- .unwrap_or_else(|_| resolved_path.to_string_lossy().to_string());- Ok(relative)-}--#[cfg(test)]-#[path = "ops_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/voice/audio_toolkit/ops_tests.rs b/crates/openhuman-core/src/voice/audio_toolkit/ops_tests.rsdeleted file mode 100644index e0030b2a63..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/ops_tests.rs+++ /dev/null@@ -1,95 +0,0 @@-use super::*;--fn test_config() -> Config {- let mut config = Config::default();- config.workspace_dir = std::env::temp_dir().join("openhuman-audio-toolkit-tests");- config.local_ai.tts_provider = "cloud".to_string();- config-}--#[test]-fn resolve_format_defaults_to_mp3_for_cloud() {- assert_eq!(resolve_format("cloud", None).unwrap(), AudioFormat::Mp3);-}--#[test]-fn resolve_format_defaults_to_wav_for_piper() {- assert_eq!(resolve_format("piper", None).unwrap(), AudioFormat::Wav);-}--#[test]-fn resolve_format_rejects_mp3_for_piper() {- let err = resolve_format("piper", Some(AudioFormat::Mp3)).unwrap_err();- assert!(err.contains("only supports wav"));-}--#[test]-fn slugify_title_collapses_noise() {- assert_eq!(- slugify_title(" Weekly update: Q2 / AI! "),- "weekly-update-q2-ai"- );- assert_eq!(slugify_title("###"), "podcast");-}--#[test]-fn resolve_output_path_rejects_parent_dir() {- let err = resolve_output_path(- Path::new("/tmp/workspace"),- Some("../escape.mp3"),- None,- AudioFormat::Mp3,- )- .unwrap_err();- assert!(err.contains("parent-directory traversal"));-}--#[test]-fn build_email_message_includes_attachment_name() {- let config = test_config();- let message = build_email_message(- &config,- "[email protected]",- "Podcast",- "Attached.",- "briefing.mp3",- "audio/mpeg".parse().unwrap(),- vec![1, 2, 3],- )- .unwrap();- let wire = String::from_utf8_lossy(&message.formatted()).to_string();- assert!(wire.contains("Subject: Podcast"));- assert!(wire.contains("filename=\"briefing.mp3\""));- assert!(wire.contains("Content-Type: audio/mpeg"));-}--#[test]-fn resolve_email_capture_dir_uses_workspace_when_e2e_feature_enabled() {- let config = test_config();- let capture = resolve_email_capture_dir(&config);- #[cfg(feature = "e2e-test-support")]- assert!(capture.unwrap().ends_with(DEFAULT_CAPTURE_DIR));- #[cfg(not(feature = "e2e-test-support"))]- assert!(capture.is_none());-}--#[test]-fn effective_voice_defaults_for_piper_only() {- assert_eq!(- effective_voice("piper", None).as_deref(),- Some(DEFAULT_PIPER_VOICE)- );- assert!(effective_voice("cloud", None).is_none());-}--#[test]-fn enforce_audio_format_requires_matching_mime() {- assert!(enforce_audio_format(AudioFormat::Mp3, "audio/mpeg").is_ok());- assert!(enforce_audio_format(AudioFormat::Mp3, "audio/wav").is_err());-}--#[test]-fn decode_audio_payload_rejects_bad_base64() {- let err = decode_audio_payload("not-base64").unwrap_err();- assert!(err.contains("invalid audio_base64"));-}diff --git a/crates/openhuman-core/src/voice/audio_toolkit/schemas.rs b/crates/openhuman-core/src/voice/audio_toolkit/schemas.rsdeleted file mode 100644index 8e3522bc62..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/schemas.rs+++ /dev/null@@ -1,193 +0,0 @@-use serde::Deserialize;-use serde_json::{Map, Value};--use crate::config::rpc as config_rpc;-use crate::core::all::{ControllerFuture, RegisteredController};-use crate::core::Outcome;-use crate::core::{ControllerSchema, FieldSchema, TypeSchema};-use crate::voice::audio_toolkit::types::{AudioFormat, AudioGenerateRequest, EmailPodcastRequest};--#[derive(Debug, Deserialize)]-struct GenerateAndEmailParams {- text: String,- to: String,- subject: String,- body: String,- #[serde(default)]- title: Option<String>,- #[serde(default)]- output_path: Option<String>,- #[serde(default)]- provider: Option<String>,- #[serde(default)]- voice: Option<String>,- #[serde(default)]- format: Option<AudioFormat>,- #[serde(default)]- attachment_name: Option<String>,-}--pub fn all_audio_toolkit_registered_controllers() -> Vec<RegisteredController> {- vec![- RegisteredController {- schema: audio_toolkit_schemas("generate_podcast"),- handler: handle_generate_podcast,- },- RegisteredController {- schema: audio_toolkit_schemas("email_podcast"),- handler: handle_email_podcast,- },- RegisteredController {- schema: audio_toolkit_schemas("generate_and_email_podcast"),- handler: handle_generate_and_email_podcast,- },- ]-}--pub fn audio_toolkit_schemas(function: &str) -> ControllerSchema {- match function {- "generate_podcast" => ControllerSchema {- namespace: "audio_toolkit",- function: "generate_podcast",- description: "Synthesize text into a workspace audio file for listen-later / podcast-style delivery.",- inputs: vec![- required_string("text", "Text to synthesize."),- optional_string("title", "Optional title used to derive the default file name."),- optional_string("output_path", "Optional workspace-relative output path."),- optional_string("provider", "Optional TTS provider override (`cloud` or `piper`)."),- optional_string("voice", "Optional provider-specific voice id."),- FieldSchema {- name: "format",- ty: TypeSchema::Option(Box::new(TypeSchema::String)),- comment: "Optional output format (`mp3` or `wav`).",- required: false,- },- ],- outputs: vec![json_output("audio", "Generated audio artifact metadata.")],- },- "email_podcast" => ControllerSchema {- namespace: "audio_toolkit",- function: "email_podcast",- description: "Email a previously generated workspace audio file as an attachment.",- inputs: vec![- required_string("to", "Destination email address."),- required_string("subject", "Email subject line."),- required_string("body", "Email body text."),- required_string("audio_path", "Workspace-relative path to the audio attachment."),- optional_string("attachment_name", "Optional attachment file name override."),- ],- outputs: vec![json_output("email", "Email delivery metadata.")],- },- "generate_and_email_podcast" => ControllerSchema {- namespace: "audio_toolkit",- function: "generate_and_email_podcast",- description: "Generate an audio file from text and immediately email it as a podcast-style attachment.",- inputs: vec![- required_string("text", "Text to synthesize."),- required_string("to", "Destination email address."),- required_string("subject", "Email subject line."),- required_string("body", "Email body text."),- optional_string("title", "Optional title used for the generated file name."),- optional_string("output_path", "Optional workspace-relative output path."),- optional_string("provider", "Optional TTS provider override (`cloud` or `piper`)."),- optional_string("voice", "Optional provider-specific voice id."),- FieldSchema {- name: "format",- ty: TypeSchema::Option(Box::new(TypeSchema::String)),- comment: "Optional output format (`mp3` or `wav`).",- required: false,- },- optional_string("attachment_name", "Optional attachment file name override."),- ],- outputs: vec![json_output("result", "Combined audio generation and email-delivery result.")],- },- _ => ControllerSchema {- namespace: "audio_toolkit",- function: "unknown",- description: "Unknown audio toolkit controller.",- inputs: vec![],- outputs: vec![FieldSchema {- name: "error",- ty: TypeSchema::String,- comment: "Lookup error details.",- required: true,- }],- },- }-}--fn handle_generate_podcast(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let config = config_rpc::load_config_with_timeout().await?;- let request: AudioGenerateRequest =- serde_json::from_value(Value::Object(params)).map_err(|e| e.to_string())?;- to_json(crate::voice::audio_toolkit::generate_podcast(&config, request).await?)- })-}--fn handle_email_podcast(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let config = config_rpc::load_config_with_timeout().await?;- let request: EmailPodcastRequest =- serde_json::from_value(Value::Object(params)).map_err(|e| e.to_string())?;- to_json(crate::voice::audio_toolkit::email_podcast(&config, request).await?)- })-}--fn handle_generate_and_email_podcast(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let config = config_rpc::load_config_with_timeout().await?;- let request: GenerateAndEmailParams =- serde_json::from_value(Value::Object(params)).map_err(|e| e.to_string())?;- let generated = AudioGenerateRequest {- text: request.text,- title: request.title,- output_path: request.output_path,- provider: request.provider,- voice: request.voice,- format: request.format,- };- let email = EmailPodcastRequest {- to: request.to,- subject: request.subject,- body: request.body,- audio_path: String::new(),- attachment_name: request.attachment_name,- };- to_json(- crate::voice::audio_toolkit::generate_and_email_podcast(&config, generated, email)- .await?,- )- })-}--fn to_json<T: serde::Serialize>(outcome: Outcome<T>) -> Result<Value, String> {- serde_json::to_value(outcome.value).map_err(|e| format!("serialize error: {e}"))-}--fn required_string(name: &'static str, comment: &'static str) -> FieldSchema {- FieldSchema {- name,- ty: TypeSchema::String,- comment,- required: true,- }-}--fn optional_string(name: &'static str, comment: &'static str) -> FieldSchema {- FieldSchema {- name,- ty: TypeSchema::Option(Box::new(TypeSchema::String)),- comment,- required: false,- }-}--fn json_output(name: &'static str, comment: &'static str) -> FieldSchema {- FieldSchema {- name,- ty: TypeSchema::Json,- comment,- required: true,- }-}diff --git a/crates/openhuman-core/src/voice/audio_toolkit/tools.rs b/crates/openhuman-core/src/voice/audio_toolkit/tools.rsdeleted file mode 100644index 3d196dde24..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/tools.rs+++ /dev/null@@ -1,5 +0,0 @@-mod podcast;--pub use podcast::{- AudioEmailPodcastTool, AudioGenerateAndEmailPodcastTool, AudioGeneratePodcastTool,-};diff --git a/crates/openhuman-core/src/voice/audio_toolkit/tools/parameters/audio_generate_and_email_podcast.json b/crates/openhuman-core/src/voice/audio_toolkit/tools/parameters/audio_generate_and_email_podcast.jsondeleted file mode 100644index 19a385e964..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/tools/parameters/audio_generate_and_email_podcast.json+++ /dev/null@@ -1,55 +0,0 @@-{- "type": "object",- "required": [- "text",- "to",- "subject",- "body"- ],- "properties": {- "text": {- "type": "string",- "description": "Text to synthesize into audio."- },- "to": {- "type": "string",- "description": "Recipient email address."- },- "subject": {- "type": "string",- "description": "Email subject line."- },- "body": {- "type": "string",- "description": "Email body text."- },- "title": {- "type": "string",- "description": "Optional title used in the default file name."- },- "output_path": {- "type": "string",- "description": "Optional workspace-relative output path."- },- "provider": {- "type": "string",- "description": "Optional TTS provider override (`cloud` or `piper`)."- },- "voice": {- "type": "string",- "description": "Optional voice id for the chosen provider."- },- "format": {- "type": "string",- "enum": [- "mp3",- "wav"- ],- "description": "Desired audio format."- },- "attachment_name": {- "type": "string",- "description": "Optional attachment file name override."- }- }-}diff --git a/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast.rs b/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast.rsdeleted file mode 100644index 5db1c32622..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast.rs+++ /dev/null@@ -1,220 +0,0 @@-use crate::tools::schema_cache::static_schema;-use std::sync::Arc;--use async_trait::async_trait;-use serde_json::json;--use crate::config::Config;-use crate::security::{SecurityPolicy, ToolOperation};-use crate::voice::audio_toolkit::{- email_podcast, generate_and_email_podcast, generate_podcast, AudioGenerateRequest,- EmailPodcastRequest,-};-use tinytools::{PermissionLevel, Tool, ToolResult};--pub struct AudioGeneratePodcastTool {- config: Arc<Config>,- security: Arc<SecurityPolicy>,-}--pub struct AudioEmailPodcastTool {- config: Arc<Config>,- security: Arc<SecurityPolicy>,-}--pub struct AudioGenerateAndEmailPodcastTool {- config: Arc<Config>,- security: Arc<SecurityPolicy>,-}--impl AudioGeneratePodcastTool {- pub fn new(config: Arc<Config>, security: Arc<SecurityPolicy>) -> Self {- Self { config, security }- }-}--impl AudioEmailPodcastTool {- pub fn new(config: Arc<Config>, security: Arc<SecurityPolicy>) -> Self {- Self { config, security }- }-}--impl AudioGenerateAndEmailPodcastTool {- pub fn new(config: Arc<Config>, security: Arc<SecurityPolicy>) -> Self {- Self { config, security }- }-}--#[async_trait]-impl Tool for AudioGeneratePodcastTool {- fn name(&self) -> &str {- "audio_generate_podcast"- }-- fn description(&self) -> &str {- "Generate an audio file from text and save it into the workspace for listen-later or podcast-style delivery."- }-- fn parameters_schema(&self) -> serde_json::Value {- json!({- "type": "object",- "required": ["text"],- "properties": {- "text": { "type": "string", "description": "Text to synthesize into audio." },- "title": { "type": "string", "description": "Optional title used in the default file name." },- "output_path": { "type": "string", "description": "Optional workspace-relative path to write the audio file to." },- "provider": { "type": "string", "description": "Optional TTS provider override (`cloud` or `piper`)." },- "voice": { "type": "string", "description": "Optional voice id for the chosen provider." },- "format": { "type": "string", "enum": ["mp3", "wav"], "description": "Desired audio format." }- }- })- }-- fn permission_level(&self) -> PermissionLevel {- PermissionLevel::Execute- }-- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {- self.security- .enforce_tool_operation(ToolOperation::Act, self.name())- .map_err(anyhow::Error::msg)?;- let request: AudioGenerateRequest = serde_json::from_value(args)?;- let outcome = generate_podcast(&self.config, request)- .await- .map_err(anyhow::Error::msg)?;- Ok(ToolResult::success(serde_json::to_string_pretty(- &outcome.value,- )?))- }-}--#[async_trait]-impl Tool for AudioEmailPodcastTool {- fn name(&self) -> &str {- "audio_email_podcast"- }-- fn description(&self) -> &str {- "Email a workspace audio file as an attachment so the recipient can listen to it like a podcast episode."- }-- fn parameters_schema(&self) -> serde_json::Value {- json!({- "type": "object",- "required": ["to", "subject", "body", "audio_path"],- "properties": {- "to": { "type": "string", "description": "Recipient email address." },- "subject": { "type": "string", "description": "Email subject line." },- "body": { "type": "string", "description": "Email body text." },- "audio_path": { "type": "string", "description": "Workspace-relative path to the generated audio file." },- "attachment_name": { "type": "string", "description": "Optional attachment file name override." }- }- })- }-- fn permission_level(&self) -> PermissionLevel {- PermissionLevel::Execute- }-- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {- self.security- .enforce_tool_operation(ToolOperation::Act, self.name())- .map_err(anyhow::Error::msg)?;- let request: EmailPodcastRequest = serde_json::from_value(args)?;- let outcome = email_podcast(&self.config, request)- .await- .map_err(anyhow::Error::msg)?;- Ok(ToolResult::success(serde_json::to_string_pretty(- &outcome.value,- )?))- }-}--#[async_trait]-impl Tool for AudioGenerateAndEmailPodcastTool {- fn name(&self) -> &str {- "audio_generate_and_email_podcast"- }-- fn description(&self) -> &str {- "Generate an audio file from text and immediately email it as a podcast-style attachment."- }-- fn parameters_schema(&self) -> serde_json::Value {- static_schema!(include_str!(- "parameters/audio_generate_and_email_podcast.json"- ))- }-- fn permission_level(&self) -> PermissionLevel {- PermissionLevel::Execute- }-- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {- self.security- .enforce_tool_operation(ToolOperation::Act, self.name())- .map_err(anyhow::Error::msg)?;-- let text = required_string(&args, "text")?;- let to = required_string(&args, "to")?;- let subject = required_string(&args, "subject")?;- let body = required_string(&args, "body")?;-- let generated = AudioGenerateRequest {- text,- title: optional_string(&args, "title"),- output_path: optional_string(&args, "output_path"),- provider: optional_string(&args, "provider"),- voice: optional_string(&args, "voice"),- format: optional_format(&args, "format")?,- };- let email = EmailPodcastRequest {- to,- subject,- body,- audio_path: String::new(),- attachment_name: optional_string(&args, "attachment_name"),- };- let outcome = generate_and_email_podcast(&self.config, generated, email)- .await- .map_err(anyhow::Error::msg)?;- Ok(ToolResult::success(serde_json::to_string_pretty(- &outcome.value,- )?))- }-}--fn required_string(args: &serde_json::Value, key: &str) -> anyhow::Result<String> {- args.get(key)- .and_then(|v| v.as_str())- .map(str::trim)- .filter(|s| !s.is_empty())- .map(str::to_string)- .ok_or_else(|| anyhow::anyhow!("missing required `{key}`"))-}--fn optional_string(args: &serde_json::Value, key: &str) -> Option<String> {- args.get(key)- .and_then(|v| v.as_str())- .map(str::trim)- .filter(|s| !s.is_empty())- .map(str::to_string)-}--fn optional_format(- args: &serde_json::Value,- key: &str,-) -> anyhow::Result<Option<crate::voice::audio_toolkit::AudioFormat>> {- let Some(raw) = args.get(key).and_then(|v| v.as_str()) else {- return Ok(None);- };- match raw.trim() {- "mp3" => Ok(Some(crate::voice::audio_toolkit::AudioFormat::Mp3)),- "wav" => Ok(Some(crate::voice::audio_toolkit::AudioFormat::Wav)),- other => Err(anyhow::anyhow!("invalid format `{other}`")),- }-}--#[cfg(test)]-#[path = "podcast_schema_tests.rs"]-mod schema_tests;diff --git a/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast_schema_tests.rs b/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast_schema_tests.rsdeleted file mode 100644index 0671220861..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast_schema_tests.rs+++ /dev/null@@ -1,33 +0,0 @@-use super::*;-use serde_json::json;--fn expected_audio_generate_and_email_podcast() -> serde_json::Value {- json!({- "type": "object",- "required": ["text", "to", "subject", "body"],- "properties": {- "text": { "type": "string", "description": "Text to synthesize into audio." },- "to": { "type": "string", "description": "Recipient email address." },- "subject": { "type": "string", "description": "Email subject line." },- "body": { "type": "string", "description": "Email body text." },- "title": { "type": "string", "description": "Optional title used in the default file name." },- "output_path": { "type": "string", "description": "Optional workspace-relative output path." },- "provider": { "type": "string", "description": "Optional TTS provider override (`cloud` or `piper`)." },- "voice": { "type": "string", "description": "Optional voice id for the chosen provider." },- "format": { "type": "string", "enum": ["mp3", "wav"], "description": "Desired audio format." },- "attachment_name": { "type": "string", "description": "Optional attachment file name override." }- }- })-}--#[test]-fn audio_generate_and_email_podcast_static_schema_matches_json_literal() {- let tool = AudioGenerateAndEmailPodcastTool::new(- std::sync::Arc::new(crate::config::Config::default()),- std::sync::Arc::new(crate::security::SecurityPolicy::default()),- );- assert_eq!(- tinytools::Tool::parameters_schema(&tool),- expected_audio_generate_and_email_podcast()- );-}diff --git a/crates/openhuman-core/src/voice/audio_toolkit/types.rs b/crates/openhuman-core/src/voice/audio_toolkit/types.rsdeleted file mode 100644index 3648c97cc9..0000000000--- a/crates/openhuman-core/src/voice/audio_toolkit/types.rs+++ /dev/null@@ -1,77 +0,0 @@-use serde::{Deserialize, Serialize};--#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]-#[serde(rename_all = "snake_case")]-pub enum AudioFormat {- Mp3,- Wav,-}--impl AudioFormat {- pub fn extension(self) -> &'static str {- match self {- Self::Mp3 => "mp3",- Self::Wav => "wav",- }- }-- pub fn mime(self) -> &'static str {- match self {- Self::Mp3 => "audio/mpeg",- Self::Wav => "audio/wav",- }- }-}--#[derive(Debug, Clone, Serialize, Deserialize)]-pub struct AudioGenerateRequest {- pub text: String,- #[serde(default)]- pub title: Option<String>,- #[serde(default)]- pub output_path: Option<String>,- #[serde(default)]- pub provider: Option<String>,- #[serde(default)]- pub voice: Option<String>,- #[serde(default)]- pub format: Option<AudioFormat>,-}--#[derive(Debug, Clone, Serialize, Deserialize)]-pub struct EmailPodcastRequest {- pub to: String,- pub subject: String,- pub body: String,- pub audio_path: String,- #[serde(default)]- pub attachment_name: Option<String>,-}--#[derive(Debug, Clone, Serialize, Deserialize)]-pub struct AudioGeneratedArtifact {- pub output_path: String,- pub file_name: String,- pub provider: String,- pub voice: Option<String>,- pub format: AudioFormat,- pub audio_mime: String,- pub bytes_written: usize,- pub chars_synthesized: usize,-}--#[derive(Debug, Clone, Serialize, Deserialize)]-pub struct AudioEmailDeliveryResult {- pub to: String,- pub subject: String,- pub attachment_name: String,- pub mode: String,- #[serde(default)]- pub capture_path: Option<String>,-}--#[derive(Debug, Clone, Serialize, Deserialize)]-pub struct AudioToolkitGenerateAndEmailResult {- pub audio: AudioGeneratedArtifact,- pub email: AudioEmailDeliveryResult,-}diff --git a/crates/openhuman-core/src/voice/factory/entry.rs b/crates/openhuman-core/src/voice/factory/entry.rsindex a041ca2ce3..bd678557ec 100644--- a/crates/openhuman-core/src/voice/factory/entry.rs+++ b/crates/openhuman-core/src/voice/factory/entry.rs@@ -86,7 +86,7 @@ pub fn create_stt_provider(////// Callers deliberately pass an empty `voice` to mean "this provider picks its/// own default" (`handle_voice_test_provider`, `handle_voice_reply_synthesize`,-/// `handle_voice_tts_dispatch`, `audio_toolkit::ops`) — each of those already+/// `handle_voice_tts_dispatch`) — each of those already/// guards the Piper default at its own level, and that guard is only effective/// if this function honours the empty string.pub fn create_tts_provider(diff --git a/crates/openhuman-core/src/voice/mod.rs b/crates/openhuman-core/src/voice/mod.rsindex 1cdd2a823e..6404922948 100644--- a/crates/openhuman-core/src/voice/mod.rs+++ b/crates/openhuman-core/src/voice/mod.rs@@ -32,10 +32,6 @@ pub use compile_status::VOICE_COMPILED_IN;pub mod always_on;#[cfg(feature = "voice")]pub mod audio_capture;-/// Podcast generation + email delivery (`audio_toolkit` RPC namespace). Part of-/// the voice family: it is compiled out with the same `voice` gate.-#[cfg(feature = "voice")]-pub mod audio_toolkit;#[cfg(feature = "voice")]pub mod bus;#[cfg(feature = "voice")]diff --git a/crates/openhuman-core/src/voice/stub.rs b/crates/openhuman-core/src/voice/stub.rsindex 786e470d0b..11d1e47a77 100644--- a/crates/openhuman-core/src/voice/stub.rs+++ b/crates/openhuman-core/src/voice/stub.rs@@ -4,7 +4,7 @@//! [`super`]). It mirrors the subset of the real `voice` public surface that//! always-on / other-gated callers depend on, with no-op / disabled-error//! bodies so the crate still compiles, boots, and serves `/rpc` without the-//! voice + audio_toolkit domains.+//! voice domain.//!//! The signatures here MUST match the real ones exactly (return types included).//! The disabled builddiff --git a/scripts/generate-test-inventory.mjs b/scripts/generate-test-inventory.mjsindex 3a67d391c5..28b1413817 100644--- a/scripts/generate-test-inventory.mjs+++ b/scripts/generate-test-inventory.mjs@@ -77,7 +77,6 @@ const DOMAIN_ALLOWLIST = new Set(['agent_experience','agent_meetings','announcements',- 'audio_toolkit','devices','harness_init','http_host',