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(rpc): document new envelope, params, and origin modules
Steven Enamakela5bc61fe0348
diff --git a/crates/openhuman-rpc/README.md b/crates/openhuman-rpc/README.mdindex 970d6f382b..aa5b598d22 100644--- a/crates/openhuman-rpc/README.md+++ b/crates/openhuman-rpc/README.md@@ -14,7 +14,12 @@ HTTP client.- `pub struct RpcOutcome<T>` / `fn new` / `fn single_log` / `fn into_cli_compatible_json` — `lib.rs` — handler result plus its log lines; the type domain `ops.rs` operations return (see `AGENTS.md`'s module-shape table).- `pub fn apply_log_envelope(value, logs) -> Value` — `lib.rs` — single definition of the bare-vs-wrapped response-shape rule; see its doc comment before touching it.- `pub fn unwrap_rpc(value: &Value) -> &Value` — `lib.rs` — client-side unwrapping of nested `result`/`data` envelopes.-- `pub struct StructuredRpcError` / `pub const STRUCTURED_RPC_ERROR_SENTINEL` — `structured_error.rs` — typed error envelope, sentinel-encoded into the controller `Result<_, String>` channel and decoded by `crates/openhuman-core/src/core/jsonrpc.rs`.+- `pub struct StructuredRpcError` / `pub const STRUCTURED_RPC_ERROR_SENTINEL` — `structured_error.rs` — typed error envelope, sentinel-encoded into the controller `Result<_, String>` channel and decoded by `crates/openhuman-core/src/core/jsonrpc/http/rpc_handler.rs`.+- `pub struct RpcRequest` / `RpcSuccess` / `RpcFailure` / `RpcError`, `pub const JSONRPC_VERSION` / `SERVER_ERROR_CODE` — `envelope.rs` — the JSON-RPC 2.0 envelopes the core's `/rpc` handler reads and writes.+- `pub fn request_body(id, method, params) -> Value` / `pub fn decode_response(status, body) -> Result<Value, String>` — `envelope.rs` — the client half: build a request, decode a response into its `result` or error message.+- `pub fn params_to_object` / `json_type_name` / `parse_json_params` — `params.rs` — the named-arguments params contract.+- `pub fn unknown_param_message` / `missing_required_param_message` / `is_param_validation_error` — `params.rs` — the transport-level validation messages and their matcher, kept together so they cannot drift.+- `pub fn is_origin_allowed_with_extra(origin, extra) -> bool` / `pub const ALLOWED_ORIGINS_ENV` — `origin.rs` — the browser-origin allowlist for a core's HTTP API (pure; the caller reads the env var).- `pub struct HttpRpcResponse` — `client.rs` (feature `http-client`) — verbatim status + body from an OpenHuman RPC endpoint.- `pub fn post_json_rpc(url, token, body) -> Result<HttpRpcResponse, String>` — `client.rs` (feature `http-client`) — POST a JSON-RPC body with a 30s timeout; disables redirects when a bearer token is set.- `pub fn bearer_header(token: Option<&str>) -> Option<String>` — `client.rs` (feature `http-client`) — normalize a token into an `Authorization` header value.@@ -72,9 +77,9 @@ HTTP client.## Tests-`#[cfg(test)] mod tests` blocks in `src/lib.rs` and-`src/structured_error.rs` cover the envelope rule and the sentinel-encode/decode round trip. Run with:+Sibling `*_tests.rs` files cover the log-envelope rule, the sentinel+encode/decode round trip, the JSON-RPC envelopes (including the exact+server-failure wire bytes), the params contract and the origin allowlist. Run with:```bashcargo test -p openhuman-rpcdiff --git a/gitbooks/developing/architecture.md b/gitbooks/developing/architecture.mdindex 1094cc40dd..89cdded83a 100644--- a/gitbooks/developing/architecture.md+++ b/gitbooks/developing/architecture.md@@ -17,7 +17,7 @@ OpenHuman is a cross-platform communication and automation platform purpose-buil| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ || **`app/`** | pnpm workspace **`openhuman-app`**: Vite/React UI (`app/src/`), Vitest and WDIO tests. The Tauri shell itself is the Rust crate `crates/openhuman-app/` (below). || **`crates/openhuman-app/`** | Thin Tauri v2 desktop host (Cargo package `openhuman-app`). Built from its own manifest and lockfile, excluded from the root workspace; hosts the core as an in-process tokio task (`src/core_process.rs`). |-| **`crates/openhuman-core/`** | Cargo package **`openhuman`**: library **`openhuman_core`**, with no `tinyhumans-sdk` dependency — the hosted backend is reached only through the `api::transport::BackendTransport` port. Flat domain modules directly under `src/` (`agent`, `api`, `channels`, `config`, `cron`, `desktop`, `flows`, `hooks`, `hosting`, `http_host`, `inference`, `integrations`, `json_schema`, `mcp`, `media`, `memory`, `modules`, `platform`, `runtime`, `sandbox`, `search`, `security`, `skills`, `threads`, `tools`, `util`, `voice`, `web3`, `web_chat`, …). `src/core/` holds the JSON-RPC server (`jsonrpc.rs`), CLI (`cli.rs`), dispatch, controller registry (`all.rs`), event bus (`bus.rs`), `runtime/` (`CoreBuilder`/`CoreRuntime`) and `subsystem/`. There is no `src/rpc/` or `src/embed/` inside this crate any more. |+| **`crates/openhuman-core/`** | Cargo package **`openhuman`**: library **`openhuman_core`**, with no `tinyhumans-sdk` dependency — the hosted backend is reached only through the `api::transport::BackendTransport` port. Flat domain modules directly under `src/` (`agent`, `api`, `channels`, `config`, `cron`, `desktop`, `flows`, `hooks`, `hosting`, `http_host`, `inference`, `integrations`, `json_schema`, `mcp`, `media`, `memory`, `modules`, `platform`, `runtime`, `sandbox`, `search`, `security`, `skills`, `threads`, `tools`, `util`, `voice`, `web3`, `web_chat`, …). `src/core/` holds the JSON-RPC server (`jsonrpc/`), CLI (`cli.rs`), dispatch, controller registry (`all.rs`), event bus (`bus.rs`), `runtime/` (`CoreBuilder`/`CoreRuntime`) and `subsystem/`. There is no `src/rpc/` or `src/embed/` inside this crate any more. || **`crates/openhuman-rpc/`** | Shared JSON-RPC contracts: `RpcOutcome`, `unwrap_rpc`, `apply_log_envelope`, `StructuredRpcError`. The `http-client` feature (default on; off for root-workspace consumers) adds `post_json_rpc`, `bearer_header`, `redact_url_for_log`, `HttpRpcResponse`. Used by the Tauri shell (`core_rpc.rs` → `relay_http_rpc`) and the TUI (envelope decoding); re-exported by the core as `openhuman_core::rpc`. || **`crates/openhuman-embed/`** | Typed library facade (`openhuman_embed::{Harness, Core, CoreBuilder, DomainSet, ServiceSet, HostKind}`) for embedding the core in another product; forwards the core's feature gates. Installs no backend transport itself. || **`crates/openhuman-tinyhumans/`** | The TinyHumans layer above embed: `SdkBackendTransport` (the only crate that depends on the vendored `tinyhumans-sdk`), `install()` for hosts that boot the core themselves, a `RuntimeBuilder` that boots an embed runtime connected, the hosted RPC proxies (`hosted/`: billing, team, referral, announcements — registered into the core's controller registry as an extension), and the host-side login/session owner (`session/`). |