Skip to content

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

chore(core): remove SDK-backed transport shim from core

Steven Enamakel374cf3e62c9f
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index e5c6ade8d1..cc1acfbe08 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -59,16 +59,11 @@ crate-type = ["rlib"]
[dependencies]
openhuman-rpc.workspace = true
-# tinyhumans-sdk — the typed Rust client for the TinyHumans backend API
-# (https://github.com/tinyhumansai/sdk). Vendored as a git submodule under
-# `vendor/` beside the other tiny* crates and consumed by path: the crate is not
-# published to crates.io, so there is no `[patch.crates-io]` entry for it.
-# This is the single source of truth for backend routes — `crates/openhuman-core/src/api/` is the
-# OpenHuman-local adapter layer (session tokens, config, observability) that
-# sits on top of it, not a second HTTP client. Anything missing here belongs
-# upstream in the SDK repo, not re-implemented in `crates/openhuman-core/src/api/`.
-# After cloning: `git submodule update --init vendor/tinyhumans-sdk`.
-tinyhumans-sdk = { path = "../../vendor/tinyhumans-sdk", default-features = false }
+# The TinyHumans SDK is deliberately NOT a dependency of the core. The core
+# reaches the hosted backend only through `api::transport::BackendTransport`;
+# the SDK-backed implementation is `crates/openhuman-tinyhumans`, which hosts
+# install at boot. `scripts/assert-shed.sh` / `cargo tree -i tinyhumans-sdk`
+# must stay empty for this package.
# tinyflows — host-agnostic workflow engine (typed node graph → validate → compile →
# run on tinyagents). Powers the "Workflows" feature via the seam in
# `crates/openhuman-core/src/tinyflows/` + the `flows::` domain. Pulls tinyagents 2.1 transitively
diff --git a/crates/openhuman-core/src/api/transport/install.rs b/crates/openhuman-core/src/api/transport/install.rs
index db9007283c..a70ff2fa0a 100644
--- a/crates/openhuman-core/src/api/transport/install.rs
+++ b/crates/openhuman-core/src/api/transport/install.rs
@@ -82,12 +82,6 @@ pub fn resolve_backend_transport() -> Result<Arc<dyn BackendTransport>, BackendT
}
#[cfg(not(test))]
{
- // P1 shim: the SDK-backed transport compiled into the core until every
- // host installs one from `openhuman-tinyhumans`. Removed with the SDK
- // dependency.
- if let Some(transport) = super::sdk_compat::SdkCompatTransport::shared() {
- return Ok(transport);
- }
log::debug!("[backend-transport] no transport installed; backend unavailable");
Err(BackendTransportError::Unavailable)
}
diff --git a/crates/openhuman-core/src/api/transport/mod.rs b/crates/openhuman-core/src/api/transport/mod.rs
index 8bf347f46e..3030a19a50 100644
--- a/crates/openhuman-core/src/api/transport/mod.rs
+++ b/crates/openhuman-core/src/api/transport/mod.rs
@@ -25,7 +25,6 @@ pub mod error;
pub mod install;
#[cfg(test)]
pub mod plain;
-pub mod sdk_compat;
pub use error::BackendTransportError;
pub use install::{
diff --git a/crates/openhuman-core/src/api/transport/sdk_compat.rs b/crates/openhuman-core/src/api/transport/sdk_compat.rs
deleted file mode 100644
index 71c257cc99..0000000000
--- a/crates/openhuman-core/src/api/transport/sdk_compat.rs
+++ /dev/null
@@ -1,141 +0,0 @@
-//! **Transitional (P1 shim, removed once the SDK leaves the core).**
-//!
-//! Until every host installs a transport from `openhuman-tinyhumans`, the
-//! core keeps its own SDK-backed [`BackendTransport`] as the last-resort
-//! fallback in [`resolve_backend_transport`](super::resolve_backend_transport)
-//! so the desktop shell, TUI, CLI and the mock-backend E2E suites keep working
-//! unchanged while the migration lands phase by phase. It is byte-for-byte the
-//! implementation `openhuman-tinyhumans` ships; when the last host is
-//! switched, delete this module and the `tinyhumans-sdk` dependency together.
-
-use std::sync::{Arc, OnceLock};
-
-use async_trait::async_trait;
-use serde_json::Value;
-use tinyhumans_sdk::{Error as SdkError, TinyHumansClient};
-
-use super::{BackendRequest, BackendTransport, BackendTransportError, TransportProfile};
-use crate::security::credentials::session_support::BackendCredential;
-
-pub struct SdkCompatTransport {
- api: reqwest::Client,
- integrations: reqwest::Client,
-}
-
-impl SdkCompatTransport {
- pub fn new() -> anyhow::Result<Self> {
- Ok(Self {
- api: crate::api::headers::build_backend_client(TransportProfile::Api)?,
- integrations: crate::api::headers::build_backend_client(
- TransportProfile::Integrations,
- )?,
- })
- }
-
- /// The process-wide shim instance, built on first use.
- pub fn shared() -> Option<Arc<dyn BackendTransport>> {
- static SHARED: OnceLock<Option<Arc<SdkCompatTransport>>> = OnceLock::new();
- SHARED
- .get_or_init(|| match Self::new() {
- Ok(t) => Some(Arc::new(t)),
- Err(e) => {
- log::error!("[backend-transport] sdk shim unavailable: {e:#}");
- None
- }
- })
- .clone()
- .map(|t| t as Arc<dyn BackendTransport>)
- }
-
- fn client(&self, profile: TransportProfile) -> &reqwest::Client {
- match profile {
- TransportProfile::Api => &self.api,
- TransportProfile::Integrations => &self.integrations,
- }
- }
-
- fn sdk(&self, req: &BackendRequest<'_>) -> TinyHumansClient {
- // The product identity also rides on the SDK's own default headers,
- // not just the transport's, so it survives if the SDK is ever given a
- // client this crate did not build. The SDK applies its own headers
- // after these, so it cannot be clobbered by `x-sdk-client`.
- let sdk = TinyHumansClient::new(req.base_url)
- .with_http_client(self.client(req.profile).clone())
- .with_default_headers(crate::api::product::product_identity_headers());
- match req.credential {
- Some(BackendCredential::Session(secret)) => {
- sdk.with_token(Some(secret.trim().to_string()))
- }
- Some(BackendCredential::ApiKey(secret)) => {
- log::trace!("[backend-transport] authenticating request with x-api-key");
- sdk.with_api_key(Some(secret.trim().to_string()))
- }
- None => sdk,
- }
- }
-}
-
-/// Map the SDK's error onto the core-owned transport error.
-pub fn map_sdk_error(error: SdkError) -> BackendTransportError {
- match error {
- SdkError::Url(e) => BackendTransportError::Url(e.to_string()),
- SdkError::Http(e) => BackendTransportError::Http(e),
- SdkError::Status { status, body } => BackendTransportError::Status { status, body },
- SdkError::Header(e) => BackendTransportError::Header(e.to_string()),
- SdkError::Decode(e) => BackendTransportError::Decode(e.to_string()),
- SdkError::RouteNotExposed(method, path) => {
- BackendTransportError::RouteNotExposed(method, path)
- }
- SdkError::Envelope {
- error,
- error_code,
- details,
- } => BackendTransportError::Envelope {
- error,
- error_code,
- details,
- },
- // Socket.IO variants only exist with the SDK's `socket` feature, which
- // the core turns off; kept as a catch-all so a future SDK variant maps
- // to something rather than failing the build.
- #[allow(unreachable_patterns)]
- other => BackendTransportError::Other(other.to_string()),
- }
-}
-
-#[async_trait]
-impl BackendTransport for SdkCompatTransport {
- async fn send_json(&self, req: BackendRequest<'_>) -> Result<Value, BackendTransportError> {
- let sdk = self.sdk(&req);
- sdk.raw()
- .send(
- req.method.clone(),
- req.path,
- req.query,
- req.body,
- req.unwrap_envelope,
- )
- .await
- .map_err(map_sdk_error)
- }
-
- async fn send_multipart(
- &self,
- req: BackendRequest<'_>,
- form: reqwest::multipart::Form,
- ) -> Result<Value, BackendTransportError> {
- let sdk = self.sdk(&req);
- sdk.raw()
- .post_multipart(req.path, form)
- .await
- .map_err(map_sdk_error)
- }
-
- fn http_client(&self, profile: TransportProfile) -> reqwest::Client {
- self.client(profile).clone()
- }
-
- fn name(&self) -> &'static str {
- "tinyhumans-sdk (core shim)"
- }
-}