The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(hosted): add README files for billing, referral, and team modules
Steven Enamakelf9861231d71e
diff --git a/crates/openhuman-tinyhumans/src/hosted/billing/README.md b/crates/openhuman-tinyhumans/src/hosted/billing/README.mdindex 7cfcd1fd2c..19030eba34 100644--- a/crates/openhuman-tinyhumans/src/hosted/billing/README.md+++ b/crates/openhuman-tinyhumans/src/hosted/billing/README.md@@ -17,7 +17,7 @@ Thin RPC adapter domain over the hosted backend's payment API. It exposes plan l| File | Role || --- | --- || `crates/openhuman-tinyhumans/src/hosted/billing/mod.rs` | Export-focused module root; re-exports `ops::*` and the schemas/controllers pair. |-| `crates/openhuman-tinyhumans/src/hosted/billing/ops.rs` | Business logic: one async fn per backend endpoint; auth helper (`require_token`, `get_authed_value`); input validation + gateway normalization. Returns `RpcOutcome<Value>`. |+| `crates/openhuman-tinyhumans/src/hosted/billing/ops.rs` | Business logic: one async fn per backend endpoint; each through `HostedClient` and the SDK's typed `payments()` / `coupons()` clients (`update_auto_recharge` forwards its payload on the SDK's raw primitive because the SDK's `AutoRechargeRequest` lacks `weeklyLimitUsd`); input validation + gateway/plan normalization into the SDK's request enums. Returns `RpcOutcome<Value>`. || `crates/openhuman-tinyhumans/src/hosted/billing/schemas.rs` | Controller schemas, `all_billing_controller_schemas` / `all_billing_registered_controllers`, param structs, and `handle_billing_*` handlers delegating to `ops`. || `crates/openhuman-tinyhumans/src/hosted/billing/schemas_tests.rs` | Sibling test suite for `schemas.rs` (wired via `#[path]` mod). |@@ -63,17 +63,16 @@ None. No `bus.rs`; the domain neither publishes nor subscribes to `DomainEvent`s## Persistence-None of its own; stateless adapter. The only state it reads is the backend session JWT, which lives in the `api` layer (see `auth_store_session` / `get_session_token`), not in this module.+None of its own; stateless adapter. The only state it reads is the backend credential, resolved through `HostedClient`.## Dependencies- `crate::api::config::effective_backend_api_url` — resolves the backend base URL from `config.api_url`.-- `crate::api::jwt::get_session_token` — reads the stored app-session JWT.-- `crate::api::BackendOAuthClient` — performs the authenticated JSON HTTP request (`authed_json`).+- `crate::hosted::client::HostedClient` — resolves the core's backend credential first (no request without one), builds the SDK's `TinyHumansClient`, and maps SDK errors onto the core's RPC sentinels.- `crate::config::Config` — config struct (`api_url`); `config::rpc::load_config_with_timeout` in handlers.- `crate::rpc::RpcOutcome` — standard RPC return/logging wrapper.- `crate::core::all::{ControllerFuture, RegisteredController}` and `crate::core::{ControllerSchema, FieldSchema, TypeSchema}` — controller registry types.-- External crates: `reqwest` (`Method`), `serde`/`serde_json`, `urlencoding` (path-segment encoding for `paymentMethodId`).+- External crates: `tinyhumans-sdk` (typed payments/coupons clients), `serde_json`.## Used bydiff --git a/crates/openhuman-tinyhumans/src/hosted/referral/README.md b/crates/openhuman-tinyhumans/src/hosted/referral/README.mdindex 2d77541fad..fd9c31d650 100644--- a/crates/openhuman-tinyhumans/src/hosted/referral/README.md+++ b/crates/openhuman-tinyhumans/src/hosted/referral/README.md@@ -1,6 +1,6 @@# referral-Thin RPC adapter domain for the referral program. It does **not** own any business logic, state, or schema of its own — it makes authenticated `reqwest` calls to the hosted backend's `/referral/*` endpoints and surfaces the raw `data` payloads to the CLI / JSON-RPC clients. It exists primarily because the desktop WebView `fetch` to the backend can fail with a generic "Load failed" (CORS / TLS / WebKit), so these ops reuse the same server-side `reqwest` path as the billing domain.+Thin RPC adapter domain for the referral program. It does **not** own any business logic, state, or schema of its own — it calls the hosted backend's `/referral/*` endpoints through the TinyHumans SDK's typed `referral()` client and surfaces the raw `data` payloads to the CLI / JSON-RPC clients. It exists primarily because the desktop WebView `fetch` to the backend can fail with a generic "Load failed" (CORS / TLS / WebKit), so these ops run in-process like the billing domain.## Responsibilities@@ -15,7 +15,7 @@ Thin RPC adapter domain for the referral program. It does **not** own any busine| File | Role || --- | --- || `crates/openhuman-tinyhumans/src/hosted/referral/mod.rs` | Export-only. Re-exports `ops::*` and the schema/controller pair (`all_referral_controller_schemas`, `all_referral_registered_controllers`, `referral_schemas`). |-| `crates/openhuman-tinyhumans/src/hosted/referral/ops.rs` | Business logic: `require_token`, `get_stats`, `claim_referral`. Builds a `BackendOAuthClient` against the effective backend URL and issues authed JSON requests. Includes inline tests against an Axum mock backend. |+| `crates/openhuman-tinyhumans/src/hosted/referral/ops.rs` | Business logic: `get_stats`, `claim_referral`, each through `HostedClient` (see `../client.rs`). Tests in `ops_tests.rs` run against an Axum mock backend. || `crates/openhuman-tinyhumans/src/hosted/referral/schemas.rs` | Controller schemas + `handle_*` fns that load config and delegate to `ops`. Defines `ReferralClaimParams` (camelCase deserialization) and helpers (`to_json`, `deserialize_params`, `json_output`). |## Public surface@@ -28,7 +28,6 @@ From `mod.rs` re-exports:- `all_referral_registered_controllers() -> Vec<RegisteredController>`.- `referral_schemas(function: &str) -> ControllerSchema`.-(`require_token` is a private helper.)## RPC / controllers@@ -43,13 +42,12 @@ An unrecognized `function` name returns an `unknown` placeholder schema with an## Persistence-None of its own. The domain is stateless — it reads the backend session token from the credentials store via `get_session_token` but does not persist anything.+None of its own. The domain is stateless — it reads the backend credential through `HostedClient` but does not persist anything.## Dependencies- `crate::api::config::effective_backend_api_url` — resolves the effective backend API base URL from `config.api_url`.-- `crate::api::jwt::get_session_token` — reads the stored backend session token.-- `crate::api::BackendOAuthClient` — issues authenticated JSON requests (`authed_json`) to the backend.+- `crate::hosted::client::HostedClient` — resolves the core's backend credential first (no request without one), builds the SDK's `TinyHumansClient`, and maps SDK errors onto the core's RPC sentinels.- `crate::config::Config` — config struct passed into ops; `config::rpc::load_config_with_timeout` is used by the schema handlers.- `crate::core::all::{ControllerFuture, RegisteredController}` and `crate::core::{ControllerSchema, FieldSchema, TypeSchema}` — controller registry types.- `crate::rpc::RpcOutcome` — return wrapper carrying value + logs.@@ -65,4 +63,4 @@ None of its own. The domain is stateless — it reads the backend session token- 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.- 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.diff --git a/crates/openhuman-tinyhumans/src/hosted/team/README.md b/crates/openhuman-tinyhumans/src/hosted/team/README.mdindex dae43943f5..f0c4ece02e 100644--- a/crates/openhuman-tinyhumans/src/hosted/team/README.md+++ b/crates/openhuman-tinyhumans/src/hosted/team/README.md@@ -25,10 +25,10 @@ Team management RPC adapters. This domain is a **thin proxy to the hosted backenRe-exported from `mod.rs`:-- **Ops (all `async fn(... ) -> Result<RpcOutcome<Value>, String>`):** `get_usage` (re-exported from `integrations::client::budget_gate`, which owns the `/teams/me/usage` probe, its failure backoff and the managed-tool budget gate — the integrations client is its main consumer), `list_members`, `list_teams`, `get_team`, `create_team`, `update_team`, `delete_team`, `switch_team`, `leave_team`, `join_team`, `create_invite`, `remove_member`, `change_member_role`, `list_invites`, `revoke_invite`.+- **Ops (all `async fn(... ) -> Result<RpcOutcome<Value>, String>`):** `get_usage` (`GET /teams/me/usage` on the SDK, behind the core's shared failure backoff `integrations::client::budget_gate::usage_with_failure_backoff`; the core keeps only the managed-tool pre-call probe), `list_members`, `list_teams`, `get_team`, `create_team`, `update_team`, `delete_team`, `switch_team`, `leave_team`, `join_team`, `create_invite`, `remove_member`, `change_member_role`, `list_invites`, `revoke_invite`.- **Schemas:** `all_team_controller_schemas`, `all_team_registered_controllers`, `team_schemas`.-Internal helpers in `ops.rs` (`require_token`, `normalize_id`, `build_api_path`, `get_authed_value`) are private.+Internal helpers in `ops.rs` (`normalize_id`, `clamp_u32`, `legacy_authed_value`) are private. `create_team` / `delete_team` stay on the core's `BackendOAuthClient::authed_json` (`legacy_authed_value`) because the SDK carries no route for `POST /teams` / `DELETE /teams/{teamId}`.## RPC / controllers@@ -64,17 +64,16 @@ None. No `bus.rs`; publishes/subscribes to no `DomainEvent`s.## Persistence-None local. State lives in the hosted backend. The only stored value it reads is the app-session JWT, fetched via `crate::api::jwt::get_session_token` (written by `auth_store_session`); it is sent as `Authorization: Bearer …` and never logged.+None local. State lives in the hosted backend. The only stored value it reads is the backend credential, resolved through `HostedClient` (session JWT as `Authorization: Bearer`, API key as `x-api-key`); it is never logged.## Dependencies- `crate::api::config::effective_backend_api_url` — resolves the backend base URL from `Config.api_url`.-- `crate::api::jwt::get_session_token` — pulls the session JWT used to authenticate every request.-- `crate::api::BackendOAuthClient` — HTTP client; `authed_json(token, method, path, body)` performs the authed call.+- `crate::hosted::client::HostedClient` — resolves the core's backend credential first (no request without one), builds the SDK's `TinyHumansClient`, and maps SDK errors onto the core's RPC sentinels.- `crate::config::Config` — config passed into every op; `config::rpc::load_config_with_timeout` loads it inside each `handle_*`.- `crate::core::all::{ControllerFuture, RegisteredController}` and `crate::core::{ControllerSchema, FieldSchema, TypeSchema}` — controller registry types.- `crate::rpc::RpcOutcome` — return wrapper (`single_log`).-- `reqwest` (`Method`, `Url`) for HTTP + path building; `serde` / `serde_json` for params and bodies.+- `tinyhumans-sdk` typed `teams()` client; `serde` / `serde_json` for params and bodies.## Used by