Skip to content

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

feat(transport): expose is_installed and use direct credential for browser tasks

Steven Enamakel74bb489ea827
diff --git a/crates/openhuman-core/src/api/transport/mod.rs b/crates/openhuman-core/src/api/transport/mod.rs
index 3030a19a50..a163e1da24 100644
--- a/crates/openhuman-core/src/api/transport/mod.rs
+++ b/crates/openhuman-core/src/api/transport/mod.rs
@@ -29,7 +29,7 @@ pub mod plain;
pub use error::BackendTransportError;
pub use install::{
clear_backend_transport, install_backend_transport, installed_backend_transport,
- resolve_backend_transport,
+ is_installed, resolve_backend_transport,
};
/// One `(name, value)` query pair; a `None` value omits the pair.
diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rs
index 2d74486c7b..e0f549f95d 100644
--- a/crates/openhuman-core/src/core/runtime/services.rs
+++ b/crates/openhuman-core/src/core/runtime/services.rs
@@ -437,6 +437,12 @@ pub fn spawn_socket_auto_connect(
return;
}
};
+ // No TinyHumans connection (no backend transport installed): there
+ // is no backend to hold a socket to, so skip quietly.
+ if !crate::api::transport::is_installed() {
+ log::debug!("[socket] No backend transport installed — skipping auto-connect");
+ return;
+ }
let api_url = crate::api::config::effective_backend_api_url(&config.api_url);
let initial_token = match crate::api::jwt::get_session_token(&config) {
Ok(Some(t))
diff --git a/crates/openhuman-core/src/modules/browser_task.rs b/crates/openhuman-core/src/modules/browser_task.rs
index 1750621268..d7c67fa9bf 100644
--- a/crates/openhuman-core/src/modules/browser_task.rs
+++ b/crates/openhuman-core/src/modules/browser_task.rs
@@ -13,7 +13,7 @@ use tinyjevclient::{Client, ClientConfig};
use crate::api::config::effective_backend_api_url;
use crate::config::Config;
use crate::inference::provider::factory::{lookup_key_for_slug, provider_for_role};
-use crate::security::credentials::session_support::resolve_backend_credential;
+use crate::security::credentials::session_support::direct_backend_credential;
#[cfg(test)]
#[path = "browser_task_tests.rs"]
@@ -50,8 +50,11 @@ fn jev_client(config: &Config) -> Result<Client, String> {
ClientConfig::openrouter(key)
}
BillingRoute::Hosted => {
- let credential = resolve_backend_credential(config)
- .map_err(|_| "TinyHumans credential is unavailable".to_owned())?;
+ // The hosted route reaches the backend host directly (not through
+ // the transport port): without a TinyHumans connection or a usable
+ // credential there is nothing to call, so refuse before any request.
+ let credential = direct_backend_credential(config, "browser task (hosted jev)")
+ .ok_or_else(|| "TinyHumans credential is unavailable".to_owned())?;
let mut client_config = ClientConfig::tinyhumans_openrouter(credential.into_secret());
client_config.base_url = effective_backend_api_url(&config.api_url);
client_config