Skip to content

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

feat(tinyhumans): add budget gating and session expiry handling to integrations

Steven Enamakel5443eb62a9ff
diff --git a/crates/openhuman-core/src/security/credentials/session_support.rs b/crates/openhuman-core/src/security/credentials/session_support.rs
index 2e5a925db8..0a30baab12 100644
--- a/crates/openhuman-core/src/security/credentials/session_support.rs
+++ b/crates/openhuman-core/src/security/credentials/session_support.rs
@@ -312,7 +312,7 @@ fn session_expires_at_from_profile(
/// Liveness verdict for the stored app-session token. Pure + `now`-injected so
/// the expiry decision is unit-testable without a credential store.
#[derive(Debug, PartialEq, Eq)]
-pub(crate) enum SessionTokenCheck {
+pub enum SessionTokenCheck {
/// No token stored (signed out / never authed).
Absent,
/// Token present but its recorded `exp` is in the past (− skew).
@@ -321,7 +321,7 @@ pub(crate) enum SessionTokenCheck {
Live(String),
}
-pub(crate) fn classify_session_token(
+pub fn classify_session_token(
profile: Option<&AuthProfile>,
now: chrono::DateTime<chrono::Utc>,
) -> SessionTokenCheck {
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rs
index b36b040c54..f5f1743ad6 100644
--- a/crates/openhuman-embed/src/host_internals.rs
+++ b/crates/openhuman-embed/src/host_internals.rs
@@ -241,10 +241,15 @@ pub mod security {
}
pub mod session_support {
pub use openhuman_core::security::credentials::session_support::{
- build_session_state, current_session_is_local, resolve_backend_credential,
- BackendCredential, LOCAL_SESSION_BACKEND_UNAVAILABLE,
+ build_session_state, classify_session_token, current_session_is_local,
+ is_local_session_token, load_app_session_profile, publish_local_session_expiry,
+ resolve_backend_credential, BackendCredential, SessionTokenCheck,
+ LOCAL_SESSION_BACKEND_UNAVAILABLE, LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE,
};
}
+ pub mod api_key {
+ pub use openhuman_core::security::credentials::api_key::get_api_key_in;
+ }
}
pub mod approval {
pub use openhuman_core::security::approval::{ApprovalChatContext, ApprovalGate};
diff --git a/crates/openhuman-tinyhumans/src/integrations/client/budget_gate.rs b/crates/openhuman-tinyhumans/src/integrations/client/budget_gate.rs
index f4d00f2b5e..857e1cff73 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client/budget_gate.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client/budget_gate.rs
@@ -20,10 +20,10 @@ use std::time::{Duration, Instant};
use serde_json::Value;
-use crate::backend::BackendClient;
-use crate::config::Config;
-use crate::core::Outcome;
-use crate::security::credentials::session_support::BackendCredential;
+use crate::client::BackendClient;
+use openhuman_embed::__host::config::Config;
+use openhuman_embed::__host::core::Outcome;
+use openhuman_embed::__host::security::credentials::session_support::BackendCredential;
/// Fetch `GET /teams/me/usage` for the pre-call probe with an
/// already-resolved credential. `flatten_authed_error` keeps the typed 401 on
@@ -34,7 +34,7 @@ async fn fetch_usage(config: &Config, credential: BackendCredential) -> Result<V
client
.authed_json(&credential, reqwest::Method::GET, "/teams/me/usage", None)
.await
- .map_err(crate::backend::flatten_authed_error)
+ .map_err(crate::client::flatten_authed_error)
}
/// How long a *failed* usage fetch is short-circuited before the backend is
@@ -127,7 +127,7 @@ where
/// document behind the shared failure backoff.
async fn probe_usage(config: &Config) -> Result<Value, String> {
let credential =
- crate::security::credentials::session_support::resolve_backend_credential(config)?;
+ openhuman_embed::__host::security::credentials::session_support::resolve_backend_credential(config)?;
let backend_key = crate::backend::require_base_url(&config.api_url)?;
usage_with_failure_backoff(&backend_key, || fetch_usage(config, credential))
.await
@@ -139,7 +139,7 @@ async fn probe_usage(config: &Config) -> Result<Value, String> {
///
/// - Within `ttl` of a recorded failure → short-circuit WITHOUT calling
/// `fetch` (network backpressure) and return the
-/// [`crate::core::observability::USAGE_PROBE_BACKOFF_PREFIX`] sentinel, which
+/// [`openhuman_embed::__host::core::observability::USAGE_PROBE_BACKOFF_PREFIX`] sentinel, which
/// the JSON-RPC boundary demotes (no re-report).
/// - Otherwise call `fetch`: `Ok` clears the streak; a non-session-expiry `Err`
/// anchors a fresh streak and propagates verbatim (first-of-streak reports);
@@ -162,7 +162,7 @@ where
);
return Err(format!(
"{} recent /teams/me/usage failure suppressed (backoff)",
- crate::core::observability::USAGE_PROBE_BACKOFF_PREFIX
+ openhuman_embed::__host::core::observability::USAGE_PROBE_BACKOFF_PREFIX
));
}
@@ -172,7 +172,7 @@ where
Ok(Outcome::single_log(data, "team usage fetched from backend"))
}
Err(err) => {
- if crate::core::observability::is_session_expired_message(&err) {
+ if openhuman_embed::__host::core::observability::is_session_expired_message(&err) {
// Session lapse — handled by the session-expired RPC arm and
// drives local session cleanup. Never enter the failure window.
tracing::debug!(
diff --git a/crates/openhuman-tinyhumans/src/integrations/client/budget_gate_tests.rs b/crates/openhuman-tinyhumans/src/integrations/client/budget_gate_tests.rs
index 2d33a5c2bc..6abd6caf94 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client/budget_gate_tests.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client/budget_gate_tests.rs
@@ -10,7 +10,7 @@ fn budget_cache_get_returns_none_when_empty() {
// ── GH #4153: `/teams/me/usage` failure backoff ──────────────────────────
-use crate::core::observability::is_suppressed_usage_probe_backoff;
+use openhuman_embed::__host::core::observability::is_suppressed_usage_probe_backoff;
const TTL: Duration = Duration::from_secs(60);
const FAIL_KEY: &str = "backend-under-test";
@@ -172,7 +172,7 @@ async fn produced_sentinel_is_classified() {
.await
.unwrap_err();
assert!(
- err.starts_with(crate::core::observability::USAGE_PROBE_BACKOFF_PREFIX),
+ err.starts_with(openhuman_embed::__host::core::observability::USAGE_PROBE_BACKOFF_PREFIX),
"sentinel built from the shared prefix constant: {err}"
);
assert!(is_suppressed_usage_probe_backoff(&err));
diff --git a/crates/openhuman-tinyhumans/src/integrations/client/construct.rs b/crates/openhuman-tinyhumans/src/integrations/client/construct.rs
index a5ce4166e6..760d7bcda4 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client/construct.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client/construct.rs
@@ -15,9 +15,9 @@ use crate::integrations::types::IntegrationPricing;
/// baked into a build silently produced 404 URLs like
/// `…/openai/v1/chat/completions/agent-integrations/composio/connections`
/// because every `IntegrationClient` method joins paths onto this field
-/// via [`crate::util::url::join_url`].
+/// via [`openhuman_embed::__host::util::url::join_url`].
pub(super) fn sanitize_backend_url(backend_url: &str) -> String {
- let cleaned = crate::util::url::normalize_backend_api_base_url(backend_url);
+ let cleaned = openhuman_embed::__host::util::url::normalize_backend_api_base_url(backend_url);
let trimmed = backend_url.trim().trim_end_matches('/');
if !cleaned.is_empty() && cleaned != trimmed {
// Redact userinfo (username/password) before logging — a
@@ -25,8 +25,8 @@ pub(super) fn sanitize_backend_url(backend_url: &str) -> String {
// segment. The helper preserves host/path for diagnosability
// while scrubbing secrets.
tracing::warn!(
- input = %crate::util::redact_url_for_log(trimmed),
- cleaned = %crate::util::redact_url_for_log(&cleaned),
+ input = %openhuman_embed::__host::util::redact_url_for_log(trimmed),
+ cleaned = %openhuman_embed::__host::util::redact_url_for_log(&cleaned),
"[integrations] backend_url carried an inference / non-root path; \
stripping before use (issue #2075)"
);
@@ -48,8 +48,8 @@ pub struct IntegrationClient {
/// `Authorization: Bearer`, a TinyHumans API key rides `x-api-key` (see
/// `api::transport::credential_headers`). The 401 handling in `errors.rs`
/// branches on which one it is.
- pub(super) credential: crate::security::credentials::session_support::BackendCredential,
- pub(super) budget_config: Option<Arc<crate::config::Config>>,
+ pub(super) credential: openhuman_embed::__host::security::credentials::session_support::BackendCredential,
+ pub(super) budget_config: Option<Arc<openhuman_embed::__host::config::Config>>,
// The binary download path never rode the SDK: file storage also consumes
// Content-Type and Content-Disposition, and the presigned-redirect hop
// must not carry attribution headers (see `new_inner`).
@@ -64,17 +64,17 @@ impl IntegrationClient {
pub fn new(backend_url: String, auth_token: String) -> Self {
Self::new_inner(
backend_url,
- crate::security::credentials::session_support::BackendCredential::Session(auth_token),
+ openhuman_embed::__host::security::credentials::session_support::BackendCredential::Session(auth_token),
None,
)
}
/// A client authenticating with whichever credential
- /// [`resolve_backend_credential`](crate::security::credentials::session_support::resolve_backend_credential)
+ /// [`resolve_backend_credential`](openhuman_embed::__host::security::credentials::session_support::resolve_backend_credential)
/// chose: the TinyHumans API key or the session JWT.
pub fn new_with_credential(
backend_url: String,
- credential: crate::security::credentials::session_support::BackendCredential,
+ credential: openhuman_embed::__host::security::credentials::session_support::BackendCredential,
) -> Self {
Self::new_inner(backend_url, credential, None)
}
@@ -82,8 +82,8 @@ impl IntegrationClient {
/// Credential-aware variant of [`Self::new_with_budget_config`].
pub fn new_with_credential_and_budget_config(
backend_url: String,
- credential: crate::security::credentials::session_support::BackendCredential,
- config: Arc<crate::config::Config>,
+ credential: openhuman_embed::__host::security::credentials::session_support::BackendCredential,
+ config: Arc<openhuman_embed::__host::config::Config>,
) -> Self {
Self::new_inner(backend_url, credential, Some(config))
}
@@ -99,20 +99,20 @@ impl IntegrationClient {
/// `x-api-key` for an API key.
pub(crate) fn auth_headers(&self) -> anyhow::Result<reqwest::header::HeaderMap> {
self.validate_credential_endpoint()?;
- crate::backend::transport::credential_headers(&self.credential)
+ crate::client::credential_headers(&self.credential)
.map_err(|e| anyhow::anyhow!("invalid backend credential header: {e}"))
}
pub(super) fn validate_credential_endpoint(&self) -> anyhow::Result<()> {
let endpoint = &self.backend_url;
if self.uses_api_key()
- && !crate::inference::provider::openhuman_backend_model::is_managed_endpoint_for_api_key(
+ && !crate::client::is_managed_endpoint_for_api_key(
endpoint,
)
{
anyhow::bail!("TinyHumans API key requires the managed backend or a loopback endpoint");
}
- if !crate::inference::provider::openhuman_backend_model::is_safe_endpoint_for_managed_bearer(
+ if !crate::client::is_safe_endpoint_for_managed_bearer(
endpoint,
) {
anyhow::bail!("backend credential requires HTTPS or a loopback HTTP endpoint");
@@ -122,8 +122,8 @@ impl IntegrationClient {
fn new_inner(
backend_url: String,
- credential: crate::security::credentials::session_support::BackendCredential,
- budget_config: Option<Arc<crate::config::Config>>,
+ credential: openhuman_embed::__host::security::credentials::session_support::BackendCredential,
+ budget_config: Option<Arc<openhuman_embed::__host::config::Config>>,
) -> Self {
// Defense-in-depth (issue #2075 / Sentry OPENHUMAN-TAURI-H6, -HN):
// every prod call site routes `backend_url` through
@@ -149,14 +149,14 @@ impl IntegrationClient {
// follows it without x-api-key or any other backend header.
//
// These raw clients do not add product attribution to storage requests.
- let download_client = crate::util::tls::tls_client_builder()
+ let download_client = openhuman_embed::__host::util::tls::tls_client_builder()
.http1_only()
.redirect(reqwest::redirect::Policy::none())
.timeout(Duration::from_secs(15 * 60))
.connect_timeout(Duration::from_secs(15))
.build()
.expect("failed to build integration download HTTP client");
- let presigned_client = crate::util::tls::tls_client_builder()
+ let presigned_client = openhuman_embed::__host::util::tls::tls_client_builder()
.http1_only()
.redirect(reqwest::redirect::Policy::none())
.timeout(Duration::from_secs(15 * 60))
diff --git a/crates/openhuman-tinyhumans/src/integrations/client/download.rs b/crates/openhuman-tinyhumans/src/integrations/client/download.rs
index b567e7527e..4b0445906a 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client/download.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client/download.rs
@@ -2,7 +2,7 @@
//! download route bypasses the JSON envelope and needs `Content-Type` /
//! `Content-Disposition` metadata the SDK's binary primitive doesn't expose.
-use crate::backend::transport::BackendTransportError;
+use crate::BackendTransportError;
use super::construct::IntegrationClient;
use super::requests::{emit_backend_egress, enforce_backend_egress};
@@ -48,7 +48,7 @@ impl IntegrationClient {
/// client with no backend credential headers.
pub async fn get_bytes(
&self,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
path: &str,
) -> anyhow::Result<(bytes::Bytes, Option<String>, Option<String>)> {
self.validate_credential_endpoint()?;
@@ -64,7 +64,7 @@ impl IntegrationClient {
if !is_file_download {
anyhow::bail!("route is intentionally not exposed by the SDK: GET {route}");
}
- let url = crate::util::url::join_url(&self.backend_url, path);
+ let url = openhuman_embed::__host::util::url::join_url(&self.backend_url, path);
tracing::debug!("[integrations] GET(bytes) {}", url);
let mut resp = self
@@ -87,7 +87,7 @@ impl IntegrationClient {
.to_str()?;
let redirect_url = resp.url().join(location)?;
anyhow::ensure!(
- crate::inference::provider::openhuman_backend_model::is_safe_endpoint_for_managed_bearer(redirect_url.as_str()),
+ crate::client::is_safe_endpoint_for_managed_bearer(redirect_url.as_str()),
"download redirect requires HTTPS or a loopback HTTP endpoint"
);
// Redirect hops never carry backend headers, including x-api-key.
diff --git a/crates/openhuman-tinyhumans/src/integrations/client/errors.rs b/crates/openhuman-tinyhumans/src/integrations/client/errors.rs
index 8bf76477bc..b5fb7c4896 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client/errors.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client/errors.rs
@@ -5,7 +5,7 @@
use std::error::Error as _;
-use crate::backend::transport::BackendTransportError;
+use crate::BackendTransportError;
use crate::integrations::types::BackendResponse;
@@ -36,11 +36,11 @@ pub(crate) fn extract_error_detail(body: &str, max_bytes: usize) -> String {
if let Some(msg) = v.get("error").and_then(|e| e.as_str()) {
let trimmed = msg.trim();
if !trimmed.is_empty() {
- return crate::util::truncate_at_byte_boundary(trimmed, max_bytes);
+ return openhuman_embed::__host::util::truncate_at_byte_boundary(trimmed, max_bytes);
}
}
}
- crate::util::truncate_at_byte_boundary(body, max_bytes)
+ openhuman_embed::__host::util::truncate_at_byte_boundary(body, max_bytes)
}
/// Handle a `401 Unauthorized` from the OpenHuman backend's
@@ -63,8 +63,8 @@ pub(crate) fn extract_error_detail(body: &str, max_bytes: usize) -> String {
/// provider-side failures come back as `2xx` envelope `success:false`
/// (`"Toolkit X is not enabled"`, `"Missing required fields: …"`) or a
/// descriptive non-401 4xx/5xx — handled by
-/// [`crate::core::observability::is_provider_user_state_message`] /
-/// [`crate::core::observability::is_backend_user_error_message`], NOT a bare
+/// [`openhuman_embed::__host::core::observability::is_provider_user_state_message`] /
+/// [`openhuman_embed::__host::core::observability::is_backend_user_error_message`], NOT a bare
/// 401. The backend's auth wall is the only thing that returns 401 here.
/// - **Composio direct mode**: bypasses this client entirely (it talks to
/// `backend.composio.dev` with `x-api-key` via `ComposioTool`), so a
@@ -82,7 +82,7 @@ pub(crate) fn extract_error_detail(body: &str, max_bytes: usize) -> String {
/// (direct publish for paths whose error is consumed inline / swallowed):
///
/// 1. Build a `SESSION_EXPIRED:`-prefixed message so it (a) classifies as
-/// [`crate::core::observability::ExpectedErrorKind::SessionExpired`] and
+/// [`openhuman_embed::__host::core::observability::ExpectedErrorKind::SessionExpired`] and
/// stays demoted from Sentry, and (b) is recognised by
/// `core::session_expiry::is_session_expired_error` *if* it ever propagates up to
/// the RPC boundary.
@@ -112,7 +112,7 @@ fn handle_session_jwt_unauthorized(method: &str, path: &str, url: &str, detail:
// Demote from Sentry (SESSION_EXPIRED classifies as expected) — keeps the
// noise suppression the prior fix established. Applies to both paths.
- crate::core::observability::report_error_or_expected(
+ openhuman_embed::__host::core::observability::report_error_or_expected(
message.as_str(),
"integrations",
"session_expired",
@@ -138,7 +138,7 @@ fn handle_session_jwt_unauthorized(method: &str, path: &str, url: &str, detail:
// is already free of secrets (it names the path + sanitized backend
// `error` detail), but re-scrub for defense-in-depth before it reaches the
// subscriber's logs.
- crate::core::bus::BUS.publish(crate::core::events::DomainEvent::SessionExpired {
+ openhuman_embed::__host::core::bus::BUS.publish(openhuman_embed::__host::core::events::DomainEvent::SessionExpired {
source: format!("integrations.{method}:{path}"),
reason: tinyinference_core::sanitize::sanitize_api_error(&message),
});
@@ -164,7 +164,7 @@ fn handle_api_key_unauthorized(method: &str, path: &str, url: &str, detail: &str
method = %method,
"[integrations] backend rejected api key (401)"
);
- crate::core::observability::report_error_or_expected(
+ openhuman_embed::__host::core::observability::report_error_or_expected(
message.as_str(),
"integrations",
"api_key_rejected",
@@ -222,7 +222,7 @@ impl IntegrationClient {
chain.push_str(&s.to_string());
src = s.source();
}
- crate::core::observability::report_error_or_expected(
+ openhuman_embed::__host::core::observability::report_error_or_expected(
chain.as_str(),
"integrations",
method,
@@ -247,9 +247,9 @@ impl IntegrationClient {
BackendTransportError::Unavailable => {
let msg = format!(
"{}{method_upper} {url}: managed backend is not available in this build",
- crate::core::observability::BACKEND_UNAVAILABLE_PREFIX
+ openhuman_embed::__host::core::observability::BACKEND_UNAVAILABLE_PREFIX
);
- crate::core::observability::report_error_or_expected(
+ openhuman_embed::__host::core::observability::report_error_or_expected(
msg.as_str(),
"integrations",
method,
@@ -288,7 +288,7 @@ impl IntegrationClient {
.map(|status| status.to_string())
.unwrap_or_else(|_| status.to_string());
let status_code = status.to_string();
- crate::core::observability::report_error_or_expected(
+ openhuman_embed::__host::core::observability::report_error_or_expected(
format!("Backend returned {status_text} for {method_upper} {url}: {detail}")
.as_str(),
"integrations",
@@ -317,7 +317,7 @@ impl IntegrationClient {
let msg = envelope
.error
.unwrap_or_else(|| "unknown backend error".into());
- crate::core::observability::report_error_or_expected(
+ openhuman_embed::__host::core::observability::report_error_or_expected(
msg.as_str(),
"integrations",
method,
diff --git a/crates/openhuman-tinyhumans/src/integrations/client/pricing.rs b/crates/openhuman-tinyhumans/src/integrations/client/pricing.rs
index a36cc76b25..c6d991f77e 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client/pricing.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client/pricing.rs
@@ -15,7 +15,7 @@ impl IntegrationClient {
.get_or_init(|| async {
match self
.get::<IntegrationPricing>(
- &crate::security::approval::ApprovalTurnContext::default(),
+ &openhuman_embed::__host::security::approval::ApprovalTurnContext::default(),
"/agent-integrations/pricing",
)
.await
@@ -54,7 +54,7 @@ impl IntegrationClient {
/// downstream consumers don't need a separate code path.
pub async fn pricing_for_config(
client: &IntegrationClient,
- config: &crate::config::Config,
+ config: &openhuman_embed::__host::config::Config,
) -> IntegrationPricing {
use crate::config::schema::COMPOSIO_MODE_DIRECT;
@@ -92,8 +92,8 @@ pub async fn pricing_for_config(
/// callers that need a kill switch (e.g. google_places, parallel,
/// stock_prices) gate tool registration at their own level.
///
-/// [`resolve_backend_credential`]: crate::security::credentials::session_support::resolve_backend_credential
-pub fn build_client(config: &crate::config::Config) -> Option<Arc<IntegrationClient>> {
+/// [`resolve_backend_credential`]: openhuman_embed::__host::security::credentials::session_support::resolve_backend_credential
+pub fn build_client(config: &openhuman_embed::__host::config::Config) -> Option<Arc<IntegrationClient>> {
// Use the integrations-specific resolver: when `config.api_url` is set
// to a local-AI endpoint (Ollama, vLLM, …), it would still be perfect
// for `/v1/chat/completions`, but reusing it as the base for backend
@@ -113,7 +113,7 @@ pub fn build_client(config: &crate::config::Config) -> Option<Arc<IntegrationCli
};
let credential =
- match crate::security::credentials::session_support::resolve_backend_credential(config) {
+ match openhuman_embed::__host::security::credentials::session_support::resolve_backend_credential(config) {
Ok(credential) => Some(credential),
Err(e) => {
tracing::debug!("[integrations] no backend credential: {e}");
@@ -127,15 +127,15 @@ pub fn build_client(config: &crate::config::Config) -> Option<Arc<IntegrationCli
/// The credential decision is separate from profile-store lookup so callers
/// can test the backend boundary without process-wide auth-store state.
fn build_client_with_credential(
- config: &crate::config::Config,
+ config: &openhuman_embed::__host::config::Config,
backend_url: String,
- credential: Option<crate::security::credentials::session_support::BackendCredential>,
+ credential: Option<openhuman_embed::__host::security::credentials::session_support::BackendCredential>,
) -> Option<Arc<IntegrationClient>> {
- use crate::security::credentials::session_support::BackendCredential;
+ use openhuman_embed::__host::security::credentials::session_support::BackendCredential;
let credential = match credential {
Some(BackendCredential::Session(token))
- if crate::security::credentials::session_support::is_local_session_token(
+ if openhuman_embed::__host::security::credentials::session_support::is_local_session_token(
token.trim(),
) =>
{
diff --git a/crates/openhuman-tinyhumans/src/integrations/client/pricing_tests.rs b/crates/openhuman-tinyhumans/src/integrations/client/pricing_tests.rs
index 20f6d160b2..015e7244f7 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client/pricing_tests.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client/pricing_tests.rs
@@ -1,9 +1,9 @@
use super::*;
-use crate::security::credentials::session_support::BackendCredential;
+use openhuman_embed::__host::security::credentials::session_support::BackendCredential;
#[test]
fn local_offline_token_never_constructs_a_hosted_integration_client() {
- let config = crate::config::Config::default();
+ let config = openhuman_embed::__host::config::Config::default();
let backend_url = "https://api.example.test".to_owned();
assert!(build_client_with_credential(
&config,
@@ -21,7 +21,7 @@ fn local_offline_token_never_constructs_a_hosted_integration_client() {
#[test]
fn api_key_constructs_a_client_that_authenticates_with_the_key() {
- let config = crate::config::Config::default();
+ let config = openhuman_embed::__host::config::Config::default();
let client = build_client_with_credential(
&config,
"https://api.tinyhumans.ai".to_owned(),
@@ -49,7 +49,7 @@ fn api_key_rejects_foreign_or_plaintext_integration_endpoints() {
#[test]
fn missing_or_blank_credential_builds_no_client() {
- let config = crate::config::Config::default();
+ let config = openhuman_embed::__host::config::Config::default();
let url = "https://api.example.test".to_owned();
assert!(build_client_with_credential(&config, url.clone(), None).is_none());
assert!(build_client_with_credential(
diff --git a/crates/openhuman-tinyhumans/src/integrations/client/requests.rs b/crates/openhuman-tinyhumans/src/integrations/client/requests.rs
index 23f1640e13..b8428f4075 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client/requests.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client/requests.rs
@@ -3,7 +3,7 @@
//! (`post`/`get`/`patch`/`delete`/`upload_multipart`).
use super::construct::IntegrationClient;
-use crate::security::approval::ApprovalTurnContext;
+use openhuman_embed::__host::security::approval::ApprovalTurnContext;
pub(super) fn managed_budget_applies_to_path(path: &str) -> bool {
path != "/agent-integrations/pricing" && path.starts_with("/agent-integrations/")
@@ -26,16 +26,16 @@ fn reject_privileged_backend_path(method: &str, path: &str) -> anyhow::Result<()
/// Build the egress descriptor for a managed-backend round-trip. The query
/// string is stripped so only the endpoint (the "to where") is described, never
/// any data carried in the query.
-pub(super) fn backend_egress_descriptor(path: &str) -> crate::security::egress::EgressDescriptor {
+pub(super) fn backend_egress_descriptor(path: &str) -> openhuman_embed::__host::egress::EgressDescriptor {
let endpoint = path.split('?').next().unwrap_or(path);
- crate::security::egress::EgressDescriptor::integration(endpoint)
+ openhuman_embed::__host::egress::EgressDescriptor::integration(endpoint)
}
/// Egress spine (privacy epic S2, #4436): disclose an OpenHuman managed-backend
/// round-trip before it leaves the device. Fire-and-forget — never fails the
/// caller.
pub(super) fn emit_backend_egress(approval: &ApprovalTurnContext, path: &str) {
- crate::security::egress::emit_external_transfer(
+ openhuman_embed::__host::egress::emit_external_transfer(
approval.chat.as_ref(),
backend_egress_descriptor(path),
);
@@ -46,10 +46,10 @@ pub(super) fn emit_backend_egress(approval: &ApprovalTurnContext, path: &str) {
/// `Ok(())` for control-plane paths (session / team / billing / integration
/// connection-management + catalog) even under `LocalOnly` — blocking those
/// would break sign-in and the Connections UI for no privacy benefit. See
-/// [`is_control_plane`](crate::security::egress). Call before
+/// [`is_control_plane`](openhuman_embed::__host::egress). Call before
/// [`emit_backend_egress`] so a blocked call is neither disclosed nor sent.
pub(super) fn enforce_backend_egress(path: &str) -> anyhow::Result<()> {
- crate::security::egress::enforce_egress(&backend_egress_descriptor(path))
+ openhuman_embed::__host::egress::enforce_egress(&backend_egress_descriptor(path))
}
impl IntegrationClient {
@@ -134,7 +134,7 @@ impl IntegrationClient {
enforce_backend_egress(path)?;
emit_backend_egress(approval, path);
self.ensure_budget_available(path).await?;
- let url = crate::util::url::join_url(&self.backend_url, path);
+ let url = openhuman_embed::__host::util::url::join_url(&self.backend_url, path);
let method_name = method.as_str().to_ascii_lowercase();
tracing::debug!("[integrations] {} {}", method.as_str(), url);
let value = self
@@ -185,7 +185,7 @@ impl IntegrationClient {
enforce_backend_egress(path)?;
emit_backend_egress(approval, path);
self.ensure_budget_available(path).await?;
- let url = crate::util::url::join_url(&self.backend_url, path);
+ let url = openhuman_embed::__host::util::url::join_url(&self.backend_url, path);
tracing::debug!("[integrations] POST(multipart) {}", url);
let value = self
diff --git a/crates/openhuman-tinyhumans/src/integrations/client_api_key_tests.rs b/crates/openhuman-tinyhumans/src/integrations/client_api_key_tests.rs
index 1106a5392b..d52ab2071c 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client_api_key_tests.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client_api_key_tests.rs
@@ -6,7 +6,7 @@ use super::*;
use axum::http::HeaderMap;
use parking_lot::Mutex;
-use crate::security::credentials::session_support::BackendCredential;
+use openhuman_embed::__host::security::credentials::session_support::BackendCredential;
const KEY: &str = "tiny_test_integrations_key";
@@ -128,7 +128,7 @@ async fn presigned_download_redirect_does_not_forward_api_key() {
#[tokio::test]
async fn api_key_401_is_api_key_rejected_not_session_expired() {
- use crate::core::observability::is_session_expired_message;
+ use openhuman_embed::__host::core::observability::is_session_expired_message;
let app = Router::new().route(
"/agent-integrations/parallel/search",
diff --git a/crates/openhuman-tinyhumans/src/integrations/client_error_propagation_tests.rs b/crates/openhuman-tinyhumans/src/integrations/client_error_propagation_tests.rs
index e394972079..7dfbc65025 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client_error_propagation_tests.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client_error_propagation_tests.rs
@@ -460,7 +460,7 @@ async fn get_403_propagates_backend_error_envelope_message() {
/// regression this guards.
#[tokio::test]
async fn post_400_user_input_failure_classifies_as_backend_user_error() {
- use crate::core::observability::{expected_error_kind, ExpectedErrorKind};
+ use openhuman_embed::__host::core::observability::{expected_error_kind, ExpectedErrorKind};
let app = Router::new().route(
"/agent-integrations/composio/authorize",
@@ -509,7 +509,7 @@ async fn post_400_user_input_failure_classifies_as_backend_user_error() {
/// over-reaches and silences 5xx, this test catches it before users do.
#[tokio::test]
async fn post_500_remains_actionable() {
- use crate::core::observability::expected_error_kind;
+ use openhuman_embed::__host::core::observability::expected_error_kind;
let app = Router::new().route(
"/foo",
@@ -552,7 +552,7 @@ async fn post_500_remains_actionable() {
/// are caught at review rather than in production.
#[tokio::test]
async fn jira_missing_subdomain_error_propagates_and_classifies_as_user_error() {
- use crate::core::observability::{expected_error_kind, ExpectedErrorKind};
+ use openhuman_embed::__host::core::observability::{expected_error_kind, ExpectedErrorKind};
let app = Router::new().route(
"/agent-integrations/composio/authorize",
@@ -609,7 +609,7 @@ async fn jira_missing_subdomain_error_propagates_and_classifies_as_user_error()
/// not as an unexpected error that would create Sentry noise.
#[tokio::test]
async fn jira_generic_400_classifies_as_backend_user_error() {
- use crate::core::observability::{expected_error_kind, ExpectedErrorKind};
+ use openhuman_embed::__host::core::observability::{expected_error_kind, ExpectedErrorKind};
let app = Router::new().route(
"/agent-integrations/composio/authorize",
diff --git a/crates/openhuman-tinyhumans/src/integrations/client_session_expiry_tests.rs b/crates/openhuman-tinyhumans/src/integrations/client_session_expiry_tests.rs
index 4c580411a9..7a770c818e 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client_session_expiry_tests.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client_session_expiry_tests.rs
@@ -18,7 +18,7 @@ use super::*;
/// opaque "parallel search failed: Invalid token" with no sign-in nudge.
#[tokio::test]
async fn post_401_session_jwt_classifies_as_session_expired() {
- use crate::core::observability::{
+ use openhuman_embed::__host::core::observability::{
expected_error_kind, is_session_expired_message, ExpectedErrorKind,
};
@@ -78,7 +78,7 @@ async fn post_401_session_jwt_classifies_as_session_expired() {
/// same session-expiry recovery on a session-JWT 401.
#[tokio::test]
async fn get_401_session_jwt_classifies_as_session_expired() {
- use crate::core::observability::{
+ use openhuman_embed::__host::core::observability::{
expected_error_kind, is_session_expired_message, ExpectedErrorKind,
};
@@ -122,7 +122,7 @@ async fn get_401_session_jwt_classifies_as_session_expired() {
/// widened to swallow other statuses, this catches it.
#[tokio::test]
async fn non_401_4xx_does_not_classify_as_session_expired() {
- use crate::core::observability::{expected_error_kind, is_session_expired_message};
+ use openhuman_embed::__host::core::observability::{expected_error_kind, is_session_expired_message};
// 403 — e.g. an authz/scope rejection on a backend-mediated provider
// resource. This is NOT a dead session; it must stay a generic backend
@@ -165,7 +165,7 @@ async fn non_401_4xx_does_not_classify_as_session_expired() {
);
assert_ne!(
expected_error_kind(&msg),
- Some(crate::core::observability::ExpectedErrorKind::SessionExpired),
+ Some(openhuman_embed::__host::core::observability::ExpectedErrorKind::SessionExpired),
"403 must NOT classify as SessionExpired; got: {msg}"
);
}
@@ -236,7 +236,7 @@ fn composio_soft_auth_path_covers_only_trigger_reads() {
/// the panel with no actionable error (#4281).
#[tokio::test]
async fn get_401_composio_triggers_keeps_sentinel_for_in_place_cta() {
- use crate::core::observability::{
+ use openhuman_embed::__host::core::observability::{
expected_error_kind, is_session_expired_message, ExpectedErrorKind,
};
diff --git a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/delete.rs b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/delete.rs
index a9744c4032..62529bd23e 100644
--- a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/delete.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/delete.rs
@@ -7,7 +7,7 @@ use serde_json::{json, Value};
use super::helpers::{file_path, readonly_autonomy_block, validate_file_id};
use crate::integrations::IntegrationClient;
-use crate::security::SecurityPolicy;
+use openhuman_embed::__host::security::SecurityPolicy;
use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};
use crate::integrations::file_storage::types::DeleteResponse;
@@ -73,7 +73,7 @@ impl Tool for StorageDeleteFileTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -83,7 +83,7 @@ impl StorageDeleteFileTool {
pub(crate) async fn run(
&self,
args: Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
if let Some(blocked) = readonly_autonomy_block(&self.security) {
return Ok(blocked);
diff --git a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/download.rs b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/download.rs
index f065c1ed96..e05f9b815b 100644
--- a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/download.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/download.rs
@@ -11,7 +11,7 @@ use super::helpers::{
sanitize_filename, validate_file_id, DOWNLOADS_DIR,
};
use crate::integrations::IntegrationClient;
-use crate::security::SecurityPolicy;
+use openhuman_embed::__host::security::SecurityPolicy;
use tinytools::ToolRunContext;
use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolCategory, ToolResult};
@@ -42,7 +42,7 @@ impl StorageDownloadFileTool {
&self,
args: Value,
action_dir: &Path,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
if let Some(blocked) = readonly_autonomy_block(&self.security) {
return Ok(blocked);
@@ -162,7 +162,7 @@ impl Tool for StorageDownloadFileTool {
context: Option<&dyn ToolRunContext>,
) -> anyhow::Result<ToolResult> {
let action_dir = action_dir_for_context(&self.action_dir, context, self.name());
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &action_dir, &approval).await
}
}
diff --git a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/helpers.rs b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/helpers.rs
index 82556bf092..955006ceb9 100644
--- a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/helpers.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/helpers.rs
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
use serde_json::Value;
use tinytools::ToolRunContext;
-use crate::security::SecurityPolicy;
+use openhuman_embed::__host::security::SecurityPolicy;
use tinytools::ToolResult;
pub(super) const FILES_PATH: &str = "/agent-integrations/file-storage/files";
diff --git a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/link.rs b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/link.rs
index e1d312d810..bafe5fe654 100644
--- a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/link.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/link.rs
@@ -7,7 +7,7 @@ use serde_json::{json, Value};
use super::helpers::{file_path, readonly_autonomy_block, validate_file_id};
use crate::integrations::IntegrationClient;
-use crate::security::SecurityPolicy;
+use openhuman_embed::__host::security::SecurityPolicy;
use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};
use crate::integrations::file_storage::types::LinkResponse;
@@ -76,7 +76,7 @@ impl Tool for StorageGetLinkTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -86,7 +86,7 @@ impl StorageGetLinkTool {
pub(crate) async fn run(
&self,
args: Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
if let Some(blocked) = readonly_autonomy_block(&self.security) {
return Ok(blocked);
diff --git a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/list.rs b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/list.rs
index 9e0b46161b..6470c88200 100644
--- a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/list.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/list.rs
@@ -50,7 +50,7 @@ impl Tool for StorageListFilesTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(_args, &approval).await
}
}
@@ -60,7 +60,7 @@ impl StorageListFilesTool {
pub(crate) async fn run(
&self,
_args: Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
tracing::debug!("[file_storage] listing files");
match self
diff --git a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/registry.rs b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/registry.rs
index 8dce9c3eb2..ecec8e3a6c 100644
--- a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/registry.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/registry.rs
@@ -3,8 +3,8 @@
use std::path::Path;
use std::sync::Arc;
-use crate::config::Config;
-use crate::security::SecurityPolicy;
+use openhuman_embed::__host::config::Config;
+use openhuman_embed::__host::security::SecurityPolicy;
use tinytools::Tool;
use super::delete::StorageDeleteFileTool;
diff --git a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/upload.rs b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/upload.rs
index d7eeb0e9dd..2cf6c491f8 100644
--- a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/upload.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/upload.rs
@@ -8,7 +8,7 @@ use serde_json::{json, Value};
use super::helpers::{mime_for_path, readonly_autonomy_block, resolve_upload_path};
use crate::integrations::IntegrationClient;
-use crate::security::SecurityPolicy;
+use openhuman_embed::__host::security::SecurityPolicy;
use tinytools::ToolRunContext;
use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolCategory, ToolResult};
@@ -42,7 +42,7 @@ impl StorageUploadFileTool {
&self,
args: Value,
action_dir: &Path,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
if let Some(blocked) = readonly_autonomy_block(&self.security) {
return Ok(blocked);
@@ -196,7 +196,7 @@ impl Tool for StorageUploadFileTool {
context: Option<&dyn ToolRunContext>,
) -> anyhow::Result<ToolResult> {
let action_dir = action_dir_for_context(&self.action_dir, context, self.name());
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &action_dir, &approval).await
}
}
diff --git a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/visibility.rs b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/visibility.rs
index 8e83b47b19..62938d113c 100644
--- a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/visibility.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools/visibility.rs
@@ -7,7 +7,7 @@ use serde_json::{json, Value};
use super::helpers::{file_path, readonly_autonomy_block, validate_file_id, validate_visibility};
use crate::integrations::IntegrationClient;
-use crate::security::SecurityPolicy;
+use openhuman_embed::__host::security::SecurityPolicy;
use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};
use crate::integrations::file_storage::types::FileMeta;
@@ -75,7 +75,7 @@ impl Tool for StorageSetVisibilityTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -85,7 +85,7 @@ impl StorageSetVisibilityTool {
pub(crate) async fn run(
&self,
args: Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
if let Some(blocked) = readonly_autonomy_block(&self.security) {
return Ok(blocked);
diff --git a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools_tests.rs b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools_tests.rs
index bd8202cdec..d018d7f59c 100644
--- a/crates/openhuman-tinyhumans/src/integrations/file_storage/tools_tests.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/file_storage/tools_tests.rs
@@ -8,7 +8,7 @@ use super::{
StorageGetLinkTool, StorageListFilesTool, StorageSetVisibilityTool, StorageUploadFileTool,
};
use crate::integrations::IntegrationClient;
-use crate::security::{AutonomyLevel, SecurityPolicy};
+use openhuman_embed::__host::security::{AutonomyLevel, SecurityPolicy};
use tinytools::{PermissionLevel, Tool, ToolCategory};
fn dummy_client() -> Arc<IntegrationClient> {
diff --git a/crates/openhuman-tinyhumans/src/integrations/media/provider.rs b/crates/openhuman-tinyhumans/src/integrations/media/provider.rs
index 719412a1a6..dacd433bca 100644
--- a/crates/openhuman-tinyhumans/src/integrations/media/provider.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/media/provider.rs
@@ -28,10 +28,10 @@ use tinyagents_harness::tinyinference_video::{
VideoRequest,
};
-use crate::backend::BackendClient;
-use crate::config::Config;
-use crate::security::approval::ApprovalChatContext;
-use crate::security::credentials::session_support::{
+use crate::client::BackendClient;
+use openhuman_embed::__host::config::Config;
+use openhuman_embed::__host::security::approval::ApprovalChatContext;
+use openhuman_embed::__host::security::credentials::session_support::{
resolve_backend_credential, BackendCredential,
};
@@ -165,14 +165,14 @@ impl Guard {
/// Local-only enforcement, then the egress disclosure. A blocked call is
/// neither disclosed nor sent.
fn admit(&self, route: &str) -> ti_image::Result<()> {
- let descriptor = crate::security::egress::EgressDescriptor::integration(format!(
+ let descriptor = openhuman_embed::__host::egress::EgressDescriptor::integration(format!(
"{OPENROUTER_PROXY_PATH}/{route}"
));
- crate::security::egress::enforce_egress(&descriptor).map_err(|error| {
+ openhuman_embed::__host::egress::enforce_egress(&descriptor).map_err(|error| {
tracing::info!(route, %error, "[media_generation] blocked by privacy policy");
ti_image::Error::Validation(format!("blocked by the privacy policy: {error}"))
})?;
- crate::security::egress::emit_external_transfer(self.chat.as_ref(), descriptor);
+ openhuman_embed::__host::egress::emit_external_transfer(self.chat.as_ref(), descriptor);
Ok(())
}
diff --git a/crates/openhuman-tinyhumans/src/integrations/media/provider_tests.rs b/crates/openhuman-tinyhumans/src/integrations/media/provider_tests.rs
index 60343427b4..a3eb94a8be 100644
--- a/crates/openhuman-tinyhumans/src/integrations/media/provider_tests.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/media/provider_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::core::events::DomainEvent;
+use openhuman_embed::__host::core::events::DomainEvent;
fn guard(chat: Option<ApprovalChatContext>) -> Guard {
Guard {
@@ -31,7 +31,7 @@ async fn disclosed_routing(
#[tokio::test]
async fn a_guard_discloses_to_the_chat_it_was_built_for() {
crate::core::bus::init().await.expect("bus init");
- let mut rx = crate::core::bus::BUS.get().unwrap().receiver();
+ let mut rx = openhuman_embed::__host::core::bus::BUS.get().unwrap().receiver();
let chat_a = ApprovalChatContext {
thread_id: "thread-media-a".into(),
diff --git a/crates/openhuman-tinyhumans/src/integrations/tools/google_places.rs b/crates/openhuman-tinyhumans/src/integrations/tools/google_places.rs
index 161d70c807..e69772dbed 100644
--- a/crates/openhuman-tinyhumans/src/integrations/tools/google_places.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/tools/google_places.rs
@@ -138,7 +138,7 @@ impl Tool for GooglePlacesSearchTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -148,7 +148,7 @@ impl GooglePlacesSearchTool {
pub(crate) async fn run(
&self,
args: serde_json::Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
let query = args
.get("query")
@@ -262,7 +262,7 @@ impl Tool for GooglePlacesDetailsTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -272,7 +272,7 @@ impl GooglePlacesDetailsTool {
pub(crate) async fn run(
&self,
args: serde_json::Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
let place_id = args
.get("place_id")
diff --git a/crates/openhuman-tinyhumans/src/integrations/tools/stock_prices.rs b/crates/openhuman-tinyhumans/src/integrations/tools/stock_prices.rs
index 6aea5592e3..55f306d7b9 100644
--- a/crates/openhuman-tinyhumans/src/integrations/tools/stock_prices.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/tools/stock_prices.rs
@@ -187,7 +187,7 @@ impl Tool for StockQuoteTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -197,7 +197,7 @@ impl StockQuoteTool {
pub(crate) async fn run(
&self,
args: serde_json::Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
let symbol = args
.get("symbol")
@@ -300,7 +300,7 @@ impl Tool for StockExchangeRateTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -310,7 +310,7 @@ impl StockExchangeRateTool {
pub(crate) async fn run(
&self,
args: serde_json::Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
let from = args
.get("from_currency")
@@ -414,7 +414,7 @@ impl Tool for StockOptionsTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -424,7 +424,7 @@ impl StockOptionsTool {
pub(crate) async fn run(
&self,
args: serde_json::Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
let symbol = args
.get("symbol")
@@ -543,7 +543,7 @@ impl Tool for StockCryptoSeriesTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -553,7 +553,7 @@ impl StockCryptoSeriesTool {
pub(crate) async fn run(
&self,
args: serde_json::Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
let symbol = args
.get("symbol")
@@ -671,7 +671,7 @@ impl Tool for StockCommodityTool {
_options: tinytools::ToolCallOptions,
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
+ let approval = openhuman_embed::__host::agent::tinyagents::host::run_context::approval_for_tool(context);
self.run(args, &approval).await
}
}
@@ -681,7 +681,7 @@ impl StockCommodityTool {
pub(crate) async fn run(
&self,
args: serde_json::Value,
- approval: &crate::security::approval::ApprovalTurnContext,
+ approval: &openhuman_embed::__host::security::approval::ApprovalTurnContext,
) -> anyhow::Result<ToolResult> {
let commodity = args
.get("commodity")
diff --git a/crates/openhuman-tinyhumans/src/integrations/web3/client.rs b/crates/openhuman-tinyhumans/src/integrations/web3/client.rs
index 4ce4fad77b..3c3c1158fc 100644
--- a/crates/openhuman-tinyhumans/src/integrations/web3/client.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/web3/client.rs
@@ -11,7 +11,7 @@ use std::sync::Arc;
use serde_json::Value;
-use crate::config::Config;
+use openhuman_embed::__host::config::Config;
use crate::integrations::IntegrationClient;
const LOG_PREFIX: &str = "[web3]";
@@ -42,7 +42,7 @@ impl CryptoClient {
tracing::debug!("{LOG_PREFIX} routes");
self.inner
.get::<Value>(
- &crate::security::approval::ApprovalTurnContext::default(),
+ &openhuman_embed::__host::security::approval::ApprovalTurnContext::default(),
"/agent-integrations/crypto/routes",
)
.await
@@ -56,7 +56,7 @@ impl CryptoClient {
tracing::debug!("{LOG_PREFIX} swap_tx chain_id={:?}", body.get("chainId"));
self.inner
.post::<Value>(
- &crate::security::approval::ApprovalTurnContext::default(),
+ &openhuman_embed::__host::security::approval::ApprovalTurnContext::default(),
"/agent-integrations/crypto/swap",
body,
)
@@ -75,7 +75,7 @@ impl CryptoClient {
);
self.inner
.post::<Value>(
- &crate::security::approval::ApprovalTurnContext::default(),
+ &openhuman_embed::__host::security::approval::ApprovalTurnContext::default(),
"/agent-integrations/crypto/bridge",
body,
)
diff --git a/crates/openhuman-tinyhumans/src/voice/cloud_transcribe_tests.rs b/crates/openhuman-tinyhumans/src/voice/cloud_transcribe_tests.rs
index 3dee1af1e3..23e9250281 100644
--- a/crates/openhuman-tinyhumans/src/voice/cloud_transcribe_tests.rs
+++ b/crates/openhuman-tinyhumans/src/voice/cloud_transcribe_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use openhuman_embed::__host::core::observability::{
- is_backend_unavailable_message, is_session_expired_message,
+ is_session_expired_message, BACKEND_UNAVAILABLE_PREFIX,
};
use openhuman_embed::__host::security::credentials::{
api_key::store_api_key, AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,
@@ -60,10 +60,7 @@ async fn offline_local_session_refuses_without_a_request() {
let err = transcribe_cloud(&config, "AAAA", &CloudTranscribeOptions::default())
.await
.unwrap_err();
- assert!(
- is_backend_unavailable_message(&err),
- "{err}"
- );
+ assert!(err.starts_with(BACKEND_UNAVAILABLE_PREFIX), "{err}");
}
#[tokio::test]