Skip to content

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

refactor(core): replace RpcOutcome with Outcome across channels and voice modules

Steven Enamakeld64fb74c33df
diff --git a/crates/openhuman-core/src/channels/controllers/ops/messaging.rs b/crates/openhuman-core/src/channels/controllers/ops/messaging.rs
index 2884717f5e..3332fe0911 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/messaging.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/messaging.rs
@@ -4,7 +4,7 @@ use serde_json::Value;
use crate::backend::BackendClient;
use crate::config::Config;
-use crate::rpc::RpcOutcome;
+use crate::core::Outcome;
use crate::security::credentials::session_support::resolve_backend_credential;
/// Send a rich message to a channel via the backend API.
@@ -12,7 +12,7 @@ pub async fn channel_send_message(
config: &Config,
channel: &str,
message: Value,
-) -> Result<RpcOutcome<Value>, String> {
+) -> Result<Outcome<Value>, String> {
let api_url = crate::backend::require_base_url(&config.api_url)?;
let jwt = resolve_backend_credential(config)?;
@@ -35,7 +35,7 @@ pub async fn channel_send_message(
log::debug!("[channels] send_message response: {:?}", result);
- Ok(RpcOutcome::new(result, vec![]))
+ Ok(Outcome::new(result, vec![]))
}
/// Send a reaction to a message in a channel via the backend API.
@@ -43,7 +43,7 @@ pub async fn channel_send_reaction(
config: &Config,
channel: &str,
reaction: Value,
-) -> Result<RpcOutcome<Value>, String> {
+) -> Result<Outcome<Value>, String> {
let api_url = crate::backend::require_base_url(&config.api_url)?;
let jwt = resolve_backend_credential(config)?;
@@ -66,7 +66,7 @@ pub async fn channel_send_reaction(
log::debug!("[channels] send_reaction response: {:?}", result);
- Ok(RpcOutcome::new(result, vec![]))
+ Ok(Outcome::new(result, vec![]))
}
/// Create a thread in a channel via the backend API.
@@ -74,7 +74,7 @@ pub async fn channel_create_thread(
config: &Config,
channel: &str,
title: &str,
-) -> Result<RpcOutcome<Value>, String> {
+) -> Result<Outcome<Value>, String> {
let api_url = crate::backend::require_base_url(&config.api_url)?;
let jwt = resolve_backend_credential(config)?;
@@ -98,7 +98,7 @@ pub async fn channel_create_thread(
log::debug!("[channels] create_thread response: {:?}", result);
- Ok(RpcOutcome::new(result, vec![]))
+ Ok(Outcome::new(result, vec![]))
}
/// Close or reopen a thread in a channel via the backend API.
@@ -107,7 +107,7 @@ pub async fn channel_update_thread(
channel: &str,
thread_id: &str,
action: &str,
-) -> Result<RpcOutcome<Value>, String> {
+) -> Result<Outcome<Value>, String> {
let api_url = crate::backend::require_base_url(&config.api_url)?;
let jwt = resolve_backend_credential(config)?;
@@ -132,7 +132,7 @@ pub async fn channel_update_thread(
log::debug!("[channels] update_thread response: {:?}", result);
- Ok(RpcOutcome::new(result, vec![]))
+ Ok(Outcome::new(result, vec![]))
}
/// List threads in a channel via the backend API.
@@ -140,7 +140,7 @@ pub async fn channel_list_threads(
config: &Config,
channel: &str,
active: Option<bool>,
-) -> Result<RpcOutcome<Value>, String> {
+) -> Result<Outcome<Value>, String> {
let api_url = crate::backend::require_base_url(&config.api_url)?;
let jwt = resolve_backend_credential(config)?;
@@ -164,5 +164,5 @@ pub async fn channel_list_threads(
log::debug!("[channels] list_threads response: {:?}", result);
- Ok(RpcOutcome::new(result, vec![]))
+ Ok(Outcome::new(result, vec![]))
}
diff --git a/crates/openhuman-core/src/voice/cloud_transcribe.rs b/crates/openhuman-core/src/voice/cloud_transcribe.rs
index 644d04f4dd..8059eb6eaa 100644
--- a/crates/openhuman-core/src/voice/cloud_transcribe.rs
+++ b/crates/openhuman-core/src/voice/cloud_transcribe.rs
@@ -2,7 +2,7 @@
use crate::backend::BackendClient;
use crate::config::Config;
-use crate::rpc::RpcOutcome;
+use crate::core::Outcome;
pub use tinyinference_voice::cloud::{CloudTranscribeOptions, CloudTranscribeResult};
@@ -11,7 +11,7 @@ pub async fn transcribe_cloud(
config: &Config,
audio_base64: &str,
options: &CloudTranscribeOptions,
-) -> Result<RpcOutcome<CloudTranscribeResult>, String> {
+) -> Result<Outcome<CloudTranscribeResult>, String> {
// The session JWT or the TinyHumans API key. The vendored client sends it
// as `Authorization: Bearer`, which the backend accepts for either.
let credential =
@@ -47,7 +47,7 @@ pub async fn transcribe_cloud(
)
.await
.map_err(|error| classify_transcribe_error(error, is_api_key))?;
- Ok(RpcOutcome::single_log(
+ Ok(Outcome::single_log(
result,
"cloud STT via POST /openai/v1/audio/transcriptions",
))
diff --git a/crates/openhuman-core/src/voice/realtime.rs b/crates/openhuman-core/src/voice/realtime.rs
index 203ff08ad3..924908f69a 100644
--- a/crates/openhuman-core/src/voice/realtime.rs
+++ b/crates/openhuman-core/src/voice/realtime.rs
@@ -15,7 +15,7 @@ use serde_json::Value;
use crate::backend::BackendClient;
use crate::config::Config;
-use crate::rpc::RpcOutcome;
+use crate::core::Outcome;
const LOG_PREFIX: &str = "[voice-realtime]";
@@ -80,7 +80,7 @@ fn authority_host(rest: &str) -> &str {
/// than leaking as a raw error string.
pub async fn mint_voice_agent_signed_url(
config: &Config,
-) -> Result<RpcOutcome<VoiceAgentSignedUrl>, String> {
+) -> Result<Outcome<VoiceAgentSignedUrl>, String> {
// API key (sent as `x-api-key`) or live session JWT (sent as Bearer).
let credential =
crate::security::credentials::session_support::resolve_backend_credential(config)?;
@@ -101,7 +101,7 @@ pub async fn mint_voice_agent_signed_url(
let result = parse_signed_url_response(&raw)?;
debug!("{LOG_PREFIX} minted signed url agent={}", result.agent_id);
- Ok(RpcOutcome::single_log(
+ Ok(Outcome::single_log(
result,
"voice agent signed url minted via GET /voice-agent/get-signed-url",
))
diff --git a/crates/openhuman-core/src/voice/reply_speech.rs b/crates/openhuman-core/src/voice/reply_speech.rs
index 13fbacbd6b..9294d8af28 100644
--- a/crates/openhuman-core/src/voice/reply_speech.rs
+++ b/crates/openhuman-core/src/voice/reply_speech.rs
@@ -22,7 +22,7 @@ use serde_json::{json, Value};
use crate::backend::BackendClient;
use crate::config::Config;
-use crate::rpc::RpcOutcome;
+use crate::core::Outcome;
const LOG_PREFIX: &str = "[voice_reply]";
@@ -124,7 +124,7 @@ pub async fn synthesize_reply(
config: &Config,
text: &str,
opts: &ReplySpeechOptions,
-) -> Result<RpcOutcome<ReplySpeechResult>, String> {
+) -> Result<Outcome<ReplySpeechResult>, String> {
let trimmed = text.trim();
if trimmed.is_empty() {
return Err("text is required".to_string());
@@ -144,7 +144,7 @@ pub async fn synthesize_reply(
.lock()
.unwrap()
.push(trimmed.to_string());
- return Ok(RpcOutcome::single_log(
+ return Ok(Outcome::single_log(
ReplySpeechResult {
audio_base64: String::new(),
audio_mime: "audio/mpeg".to_string(),
@@ -228,7 +228,7 @@ pub async fn synthesize_reply(
result.alignment.as_ref().map_or(0, Vec::len)
);
- Ok(RpcOutcome::single_log(
+ Ok(Outcome::single_log(
result,
"voice reply synthesized via POST /openai/v1/audio/speech",
))