Skip to content

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

merge main into tinyhumans-api-out

Steven Enamakeldd4ccc64b384
diff --cc crates/openhuman-core/README.md
index 4c7ea8cd79,a95b42c09c..cbdd865c0b
--- a/crates/openhuman-core/README.md
+++ b/crates/openhuman-core/README.md
@@@ -24,10 -24,10 +24,10 @@@ contents inside `mod.rs` behind the fea
| Domain | Purpose | README |
| --- | --- | --- |
| `agent` | Multi-agent orchestration, tool execution, session management | [README](src/agent/README.md) |
-| `api` | HTTP and Socket.IO helpers for the TinyHumans / AlphaHuman hosted API | [README](src/api/README.md) |
+| `backend` | The backend port: `BackendTransport`, `BackendClient`, error classification and budget-exhaustion detection. Holds no hosted URL, header policy or product identity of its own | [README](src/backend/README.md) |
| `channels` | Channel implementations and runtime orchestration | [README](src/channels/README.md) |
| `config` | Configuration management for the core | [README](src/config/README.md) |
- | `core` | Transport, dispatch, controller registry (`core::all`), auth, CLI, event bus, runtime composition (`core::runtime`) — not a domain | [README](src/core/README.md) |
+ | `core` | Transport, dispatch, controller registry (`core::all`), auth, CLI, event bus, runtime composition (`core::runtime`); not a domain | [README](src/core/README.md) |
| `cron` | Scheduled-job runtime: cron/human-delay parsing, job + run store, polling scheduler, output delivery | [README](src/cron/README.md) |
| `desktop` | Desktop-shell-facing surfaces | |
| `flows`* | Saved automation workflows (tinyflows graphs) | [README](src/flows/README.md) |
diff --cc crates/openhuman-core/src/backend/client.rs
index 4c39477173,52f2a0cc2d..70d7a6ffa6
--- a/crates/openhuman-core/src/backend/client.rs
+++ b/crates/openhuman-core/src/backend/client.rs
@@@ -136,10 -145,7 +136,10 @@@ pub fn flatten_authed_error(err: anyhow
// (clear the session, prompt re-sign-in) would be the wrong
// recovery. See `BackendApiError::ApiKeyRejected`.
Some(BackendApiError::ApiKeyRejected { method, path }) => {
- format!("API_KEY_REJECTED: backend rejected api key on {method} {path}")
+ format!(
- "{} backend rejected api key on {method} {path}",
++ "{}backend rejected api key on {method} {path}",
+ crate::core::observability::API_KEY_REJECTED_PREFIX
+ )
}
Some(BackendApiError::BackendUnavailable { method, path }) => {
format!(
diff --cc crates/openhuman-core/src/backend/transport/README.md
index 0000000000,429a42c099..429a42c099
mode 000000,100644..100644
--- a/crates/openhuman-core/src/backend/transport/README.md
+++ b/crates/openhuman-core/src/backend/transport/README.md
diff --cc crates/openhuman-core/src/backend/transport/error.rs
index 66e7ab2312,869eea9ca2..a36a913087
--- a/crates/openhuman-core/src/backend/transport/error.rs
+++ b/crates/openhuman-core/src/backend/transport/error.rs
@@@ -1,7 -1,7 +1,7 @@@
//! The error a [`BackendTransport`](super::BackendTransport) returns.
//!
//! This is the core-owned image of the variants the classification code in
- //! [`crate::backend::error`] and `integrations/client/errors.rs` matches on. It
-//! [`crate::api::rest`] and `integrations/client/errors.rs` matches on. It
++//! [`crate::backend::client`] and `integrations/client/errors.rs` matches on. It
//! mirrors the vendored SDK's `Error` one-to-one for those arms so a transport
//! built on the SDK maps mechanically, while the core itself never names the
//! SDK type.
diff --cc crates/openhuman-core/src/backend/transport/mod.rs
index 7d78741232,3030a19a50..53c19220a8
--- a/crates/openhuman-core/src/backend/transport/mod.rs
+++ b/crates/openhuman-core/src/backend/transport/mod.rs
@@@ -3,7 -3,7 +3,7 @@@
//!
//! The core owns the *routes* (`/payments/summary`,
//! `/agent-integrations/...`, `channels/{c}/messages`, ...) and the error
- //! *classification* ([`crate::backend::error`], `integrations/client/errors.rs`).
-//! *classification* ([`crate::api::rest`], `integrations/client/errors.rs`).
++//! *classification* ([`crate::backend::client`], `integrations/client/errors.rs`).
//! What it does not own is the HTTP primitive that carries a request with the
//! right credential header shape and route policy. That is a
//! [`BackendTransport`], and the only production implementation lives in the
diff --cc crates/openhuman-core/src/channels/controllers/README.md
index a15631e850,036ad515cb..69cda9e828
--- a/crates/openhuman-core/src/channels/controllers/README.md
+++ b/crates/openhuman-core/src/channels/controllers/README.md
@@@ -19,9 -19,10 +19,9 @@@ Owns the `channels.*` RPC namespace: pr
| Path | Purpose |
| --- | --- |
- | `connect.rs` (+ `connect/` — `catalog.rs`, `connect_channel.rs`, `disconnect.rs`, `email.rs`, `memory.rs`, `shared.rs`, `status.rs`, `test_channel.rs`) | `list_channels`, `describe_channel`, `connect_channel`, `disconnect_channel`, `channel_status`, `test_channel`, `get_default_channel`/`set_default_channel`, `connected_channel_slugs`, `merge_listener_health` (`pub(crate)`, re-exported from `ops/mod.rs` under `#[cfg(test)]`) |
+ | `connect.rs` (+ `connect/`: `catalog.rs`, `connect_channel.rs`, `disconnect.rs`, `email.rs`, `memory.rs`, `shared.rs`, `status.rs`, `test_channel.rs`) | `list_channels`, `describe_channel`, `connect_channel`, `disconnect_channel`, `channel_status`, `test_channel`, `get_default_channel`/`set_default_channel`, `connected_channel_slugs`, `merge_listener_health` (`pub(crate)`, re-exported from `ops/mod.rs` under `#[cfg(test)]`) |
| `discord.rs` | Discord OAuth link flow and guild/channel/permission listing |
-| `messaging.rs` | `channel_send_message`, `channel_send_reaction`, `channel_create_thread`, `channel_update_thread`, `channel_list_threads`, all calling the TinyHumans backend REST API (`crate::api::rest::BackendOAuthClient`). The only path that reaches `relay_runtime` is `OpenHumanChannelBackend::send_outbound_intent` in `backend.rs` |
-| `telegram.rs` | `telegram_login_start`/`telegram_login_check` |
+| `messaging.rs` | `channel_send_message`, `channel_send_reaction`, `channel_create_thread`, `channel_update_thread`, `channel_list_threads` — all call the TinyHumans backend REST API (`crate::backend::BackendClient`); the only path that reaches `relay_runtime` is `OpenHumanChannelBackend::send_outbound_intent` in `backend.rs` |
| `yuanbao.rs` | `pub(super)` Yuanbao connect helpers: required-field checks, effective config assembly, credential verification |
| `types.rs` | Re-exports of `tinychannels::controllers` result/snapshot types used by the ops layer |
diff --cc crates/openhuman-core/src/core/runtime/README.md
index edb97a338b,61ba5975a2..bb089aa3c8
--- a/crates/openhuman-core/src/core/runtime/README.md
+++ b/crates/openhuman-core/src/core/runtime/README.md
@@@ -80,29 -80,29 +80,29 @@@ registry filters on
`CoreBuilder::new(host_kind)` defaults to `TokenSource::EnvOrFile`,
`ServiceSet::desktop()`, `DomainSet::full()`, and `ToolGroups::default()`
(every group withheld behind `use_skill`, the desktop app's shape). The
- three capability axes only narrow — a group set to `Advertised` whose tools
+ three capability axes only narrow: a group set to `Advertised` whose tools
are compiled out, or whose `DomainGroup` is off, stays absent.
- - `.services(ServiceSet)`, `.domains(DomainSet)`, `.tool_groups(ToolGroups)`
- — the three independent narrowing axes: which services run, which domain
- families exist, and how the tools of the families that do exist are
- disclosed (advertised on the wire, withheld behind the pack proxy, or not
- registered at all).
+ - `.services(ServiceSet)`, `.domains(DomainSet)`, `.tool_groups(ToolGroups)`:
+ the three independent narrowing axes. They control which services run,
+ which domain families exist, and how the tools of the families that do
+ exist are disclosed (advertised on the wire, withheld behind the pack
+ proxy, or not registered at all).
- `.token(TokenSource)`, `.host(impl Into<String>)`, `.port(u16)`.
- - `.config(Config)` — supply the config outright instead of letting
+ - `.config(Config)`: supply the config outright instead of letting
`build()` discover one from `config.toml` + environment; used verbatim, no
env overlay applied automatically.
- - `.workspace(dir)` — sugar over `.config()`: roots `workspace_dir` at `dir`
+ - `.workspace(dir)`: sugar over `.config()`: roots `workspace_dir` at `dir`
and sets `config_path` to `dir/config.toml` so credentials and sessions
resolve beside the workspace rather than a previous config root.
- - `.action_dir(dir)` — sugar over `.config()` for the agent's read/write
+ - `.action_dir(dir)`: sugar over `.config()` for the agent's read/write
root.
- `.backend_url(url)`.
-- `.backend_transport(Arc<dyn BackendTransport>)`: bind the transport this
- core's handlers reach the hosted backend through (`api::transport`). The
+- `.backend_transport(Arc<dyn BackendTransport>)` — bind the transport this
+ core's handlers reach the hosted backend through (`backend::transport`). The
context carries it and every `derive_with` child inherits it. Optional:
without it the core resolves the process-global transport
- (`api::transport::install_backend_transport`), and with neither every
+ (`backend::transport::install_backend_transport`), and with neither every
backend-touching call degrades to a typed "backend unavailable" error.
## `CoreContext` and initialization order
diff --cc crates/openhuman-core/src/skills/webhooks/README.md
index 8c05740724,51585e0419..05b7ea0c61
--- a/crates/openhuman-core/src/skills/webhooks/README.md
+++ b/crates/openhuman-core/src/skills/webhooks/README.md
@@@ -1,8 -1,8 +1,8 @@@
# webhooks
-Client-side webhook tunnel routing for OpenHuman. The backend provisions and hosts the actual tunnels (ngrok / cloudflare / etc.) and forwards incoming HTTP requests to the app over Socket.IO; this module maps each backend tunnel UUID to its owning target (a skill, the built-in echo responder, or the agent triage pipeline), dispatches incoming requests, builds responses, captures debug logs, and exposes both local routing RPCs and thin proxies to the backend's tunnel-management API.
+Client-side webhook **tunnel routing** for OpenHuman. The backend provisions and hosts the actual tunnels (ngrok / cloudflare / etc.) and forwards incoming HTTP requests to the app over Socket.IO; this module maps each backend tunnel UUID to its owning target (a skill, the built-in echo responder, or the agent triage pipeline), dispatches incoming requests, builds responses, captures debug logs, and exposes the local routing RPCs. The backend tunnel-management RPCs (`webhooks.{list,create,get,update,delete}_tunnel`, `webhooks.get_bandwidth`) share this namespace but live in `crates/openhuman-tinyhumans/src/hosted/webhooks/` on the TinyHumans SDK; they are registered only when `openhuman_tinyhumans::install` runs.
- `webhooks` is nested under `skills/` for historical reasons but is **not** gated by the `skills` Cargo feature — it has always-compiled callers in `crates/openhuman-core/src/core/` and stays outside the `skills` feature gate (see `crates/openhuman-core/src/skills/mod.rs`).
+ `webhooks` is nested under `skills/` for historical reasons but is not gated by the `skills` Cargo feature. It has always-compiled callers in `crates/openhuman-core/src/core/` and stays outside the `skills` feature gate (see `crates/openhuman-core/src/skills/mod.rs`).
## Responsibilities
@@@ -19,10 -19,10 +19,10 @@@
| --- | --- |
| `crates/openhuman-core/src/skills/webhooks/mod.rs` | Export-only: module docstring, `pub mod` decls, re-exports of `WebhookRouter`, types, and the `all_webhooks_*` controller pair. |
| `crates/openhuman-core/src/skills/webhooks/types.rs` | Serde domain types: `WebhookRequest`, `WebhookResponseData`, `TunnelRegistration`, `WebhookActivityEntry`, `WebhookDebugLogEntry`, debug result wrappers, `WebhookDebugEvent`. |
-| `crates/openhuman-core/src/skills/webhooks/router.rs` | `WebhookRouter`: route map + ownership rules, disk persistence (generation-counter, spawn_blocking offload), bounded debug log ring (`MAX_DEBUG_LOG_ENTRIES = 250`), debug-event broadcast channel. |
-| `crates/openhuman-core/src/skills/webhooks/ops.rs` | RPC handler logic returning `RpcOutcome<T>`: local routing ops (`list_registrations`, `list_logs`, `clear_logs`, `register_echo`, `unregister_echo`, `register_agent`, `trigger_agent`), `build_echo_response`, and backend-proxied tunnel CRUD (`list/create/get/update/delete_tunnel`, `get_bandwidth`). |
+| `crates/openhuman-core/src/skills/webhooks/router.rs` | `WebhookRouter` — route map + ownership rules, disk persistence (generation-counter, spawn_blocking offload), bounded debug log ring (`MAX_DEBUG_LOG_ENTRIES = 250`), debug-event broadcast channel. |
+| `crates/openhuman-core/src/skills/webhooks/ops.rs` | RPC handler logic returning `RpcOutcome<T>`: local routing ops (`list_registrations`, `list_logs`, `clear_logs`, `register_echo`, `unregister_echo`, `register_agent`, `trigger_agent`), and `build_echo_response`. |
| `crates/openhuman-core/src/skills/webhooks/schemas.rs` | Controller schemas + `handle_*` fns + `all_controller_schemas` / `all_registered_controllers`; deserializes params, delegates to `ops.rs`. |
- | `crates/openhuman-core/src/skills/webhooks/bus.rs` | `WebhookRequestSubscriber` (`EventHandler`) — the incoming-request routing flow; helpers `decode_webhook_body`, `run_agent_trigger`, `build_agent_response`. |
+ | `crates/openhuman-core/src/skills/webhooks/bus.rs` | `WebhookRequestSubscriber` (`EventHandler`): the incoming-request routing flow; helpers `decode_webhook_body`, `run_agent_trigger`, `build_agent_response`. |
| `crates/openhuman-core/src/skills/webhooks/{webhooks_tests,bus_tests,ops_tests,router_tests,schemas_tests,types_tests}.rs` | Test suites, each pulled into its sibling source file via `#[cfg(test)] #[path = "..."] mod tests;` (no inline test modules). |
## Public surface
diff --cc crates/openhuman-core/src/util/tls/README.md
index c40312e32b,3024b87887..c8428ccf76
--- a/crates/openhuman-core/src/util/tls/README.md
+++ b/crates/openhuman-core/src/util/tls/README.md
@@@ -30,11 -29,10 +29,11 @@@ Only the external crate `reqwest` (and
Every HTTP-client construction site that talks to external HTTPS endpoints, including:
- - `crates/openhuman-core/src/config/schema/proxy.rs` — proxy-aware client builders (primary + fallback).
+ - `crates/openhuman-core/src/config/schema/proxy.rs`: proxy-aware client builders (primary and fallback).
- `crates/openhuman-core/src/integrations/client/construct.rs` and `crates/openhuman-core/src/integrations/composio/client/connections.rs`.
-- `crates/openhuman-core/src/search/tools/*.rs` (`tavily`, `exa`, `brave`, `searxng`, `querit`, `seltz`): search-tool HTTP clients.
-- `crates/openhuman-core/src/api/headers.rs`: the shared authenticated-client builder used by the backend REST client.
+- `crates/openhuman-core/src/search/tools/*.rs` (`tavily`, `exa`, `brave`, `searxng`, `querit`, `seltz`) — search-tool HTTP clients.
+- `crates/openhuman-core/src/desktop/app_state/ops/current_user_fetch.rs`.
+- `crates/openhuman-tinyhumans/src/backend/headers.rs` (REST API client profiles for the TinyHumans backend transport).
Declared via `pub mod tls;` in `crates/openhuman-core/src/util/mod.rs`; not re-exported at the `util` root, so callers spell `crate::util::tls::tls_client_builder`.
diff --cc crates/openhuman-tinyhumans/src/hosted/announcements/README.md
index 0b7ede8d30,4c8ac8b9c7..302a97bb38
--- a/crates/openhuman-tinyhumans/src/hosted/announcements/README.md
+++ b/crates/openhuman-tinyhumans/src/hosted/announcements/README.md
@@@ -11,9 -11,9 +11,9 @@@ through verbatim
`GET /announcements/latest`.
- Resolve and require a live backend session token before calling out; fail
closed with a clear error when none is stored.
-- Fold the backend's 404 (`BackendApiError::AnnouncementNotFound`, no
+- Fold the backend's 404 (`tinyhumans_sdk::Error::Status { status: 404 }`, no
qualifying announcement) into the same `null` "no announcement" success
- outcome instead of surfacing it as an error — the feature is cosmetic and
+ outcome instead of surfacing it as an error: the feature is cosmetic and
the 404 is a normal outcome, not a failure worth reporting.
## Key files
@@@ -43,13 -43,16 +43,13 @@@ anything. Dismissal is tracked client-s
## Dependencies
- - `crate::security::credentials::session_support::require_live_session_token`
- — rejects an expired token locally instead of firing a doomed backend 401
+ - `crate::security::credentials::session_support::require_live_session_token`:
+ rejects an expired token locally instead of firing a doomed backend 401
(same guard as `billing/ops.rs`).
-- `crate::api::config::effective_backend_api_url`, `crate::api::BackendOAuthClient`:
- resolve the backend base URL and issue the authed JSON request, carrying
- the sanitized `x-sdk-name` product identity (`crate::api::product`) on every
- call.
-- `crate::api::flatten_authed_error`: flattens any non-404 backend/session
- error for the RPC caller.
-- `crate::rpc::RpcOutcome` (re-export of `openhuman_rpc`): return wrapper
+- `crate::hosted::client::HostedClient` — resolves the core's credential first
+ (no request without one), builds the SDK client with the product identity,
+ and maps SDK errors onto the core's RPC sentinels.
+- `crate::rpc::RpcOutcome` (re-export of `openhuman_rpc`) — return wrapper
carrying value + log line.
## Gating
diff --cc crates/openhuman-tinyhumans/src/hosted/referral/README.md
index 1abf1f19af,6766796383..7f8a6e61e8
--- a/crates/openhuman-tinyhumans/src/hosted/referral/README.md
+++ b/crates/openhuman-tinyhumans/src/hosted/referral/README.md
@@@ -59,8 -61,8 +59,8 @@@ None of its own. The domain is stateles
## Notes / gotchas
- - No `types.rs`, `store.rs`, `tools.rs`, or `bus.rs` — this is a pure RPC adapter, not a stateful domain. No agent tools, no event-bus subscribers.
+ - No `types.rs`, `store.rs`, `tools.rs`, or `bus.rs`: this is a pure RPC adapter, not a stateful domain. No agent tools, no event-bus subscribers.
- Both ops fail closed when no session token is stored, with the error `"no backend session token; run auth_store_session first"`.
- - Eligibility for `claim` ("only users who have not yet subscribed") is enforced **by the backend**, not in this module — it merely forwards the request.
+ - Eligibility for `claim` ("only users who have not yet subscribed") is enforced **by the backend**, not in this module: it merely forwards the request.
- Trimming/whitespace-dropping of `deviceFingerprint` happens in both `ops::claim_referral` and the schema handler `handle_referral_claim` (defensive, redundant filtering).
-- The module deliberately mirrors the billing domain's server-side `reqwest` path to avoid WebView `fetch` "Load failed" failures.
+- The module deliberately runs server-side like the billing domain to avoid WebView `fetch` "Load failed" failures.