Skip to content

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

docs(agents, core): update documentation to reflect jsonrpc/ directory and runtime module structure

Steven Enamakel53a0bdb2ca45
diff --git a/AGENTS.md b/AGENTS.md
index b1233d2305..163483ef7d 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -303,7 +303,7 @@ Preferred module shape:
Additional rules:
- Wire controllers through the registry in `crates/openhuman-core/src/core/all.rs`. Do not add
- namespace branches to `cli.rs` or `jsonrpc.rs`.
+ namespace branches to `cli.rs` or `jsonrpc/`.
- RPC namespace strings are wire contracts and do not follow directory
renames.
- Domain tools live with their domain and are re-exported through
@@ -313,8 +313,12 @@ Additional rules:
are deduplication keys.
- Update `crates/openhuman-core/src/platform/about_app/` when user-visible capabilities
change.
-- `RpcOutcome<T>`, `StructuredRpcError`, `unwrap_rpc`, and the JSON-RPC HTTP
- client live in `crates/openhuman-rpc/`; the core re-exports the crate as
+- The JSON-RPC wire contract lives in `crates/openhuman-rpc/`: `RpcOutcome<T>`,
+ `StructuredRpcError`, `unwrap_rpc`, the request/response envelopes
+ (`RpcRequest`, `RpcSuccess`, `RpcFailure`, `request_body`,
+ `decode_response`), the params contract and its validation messages, the
+ browser-origin allowlist, and the JSON-RPC HTTP client. The core's server
+ side (`core/jsonrpc/`) and every client use it; the core re-exports the crate as
`crate::rpc` (`pub use openhuman_rpc as rpc;` in
`crates/openhuman-core/src/lib.rs`), and `openhuman-app` and `openhuman-tui`
depend on it directly. Keep it free of business logic and core dependencies
diff --git a/crates/openhuman-core/src/channels/runtime/README.md b/crates/openhuman-core/src/channels/runtime/README.md
index d44c9ddef3..a848323fea 100644
--- a/crates/openhuman-core/src/channels/runtime/README.md
+++ b/crates/openhuman-core/src/channels/runtime/README.md
@@ -34,7 +34,7 @@ Two policy points here: `channel_has_approval_surface` is `true` only for `TELEG
## Called by
-`channels::start_channels` is re-exported from `channels/mod.rs` and spawned by `spawn_channels_service` in `crates/openhuman-core/src/core/runtime/services.rs`, unless `OPENHUMAN_DISABLE_CHANNEL_LISTENERS` is set or `channels_config.has_listening_integrations()` is false. Web-chat-only desktop cores therefore never run it; `bus::ChannelInboundSubscriber` and the web-only proactive subscriber are registered on the always-on boot path in `core/jsonrpc.rs` instead.
+`channels::start_channels` is re-exported from `channels/mod.rs` and spawned by `spawn_channels_service` in `crates/openhuman-core/src/core/runtime/services.rs`, unless `OPENHUMAN_DISABLE_CHANNEL_LISTENERS` is set or `channels_config.has_listening_integrations()` is false. Web-chat-only desktop cores therefore never run it; `bus::ChannelInboundSubscriber` and the web-only proactive subscriber are registered on the always-on boot path in `core/runtime/subscribers.rs` instead.
## Tests
diff --git a/crates/openhuman-core/src/core/README.md b/crates/openhuman-core/src/core/README.md
index 3010252f4d..c9bf0b3086 100644
--- a/crates/openhuman-core/src/core/README.md
+++ b/crates/openhuman-core/src/core/README.md
@@ -14,7 +14,7 @@ logic; every controller it exposes is implemented by a domain module under
`DomainGroup` tagging that lets a runtime narrow its live surface.
- Dispatch every RPC call through one tiered function (`dispatch.rs`).
- Own the process-wide typed event bus (`bus.rs`, `events.rs`).
-- Serve JSON-RPC and Socket.IO over HTTP (`jsonrpc.rs`, `socketio.rs`) and
+- Serve JSON-RPC and Socket.IO over HTTP (`jsonrpc/`, `socketio.rs`) and
the equivalent CLI surface (`cli.rs` and friends).
- Seed and check the per-process RPC bearer token (`auth.rs`,
`event_bind_tokens.rs`).
@@ -32,12 +32,12 @@ logic; every controller it exposes is implemented by a domain module under
| `dispatch.rs` | `dispatch()` — the 4-tier RPC router. |
| `bus.rs` | The `BUS: OnceBus<DomainEvent>` singleton, `EVENTS_ROOT`/`EVENTS_INTERFACE`/`EVENTS_VERSION`, `init`/`init_over_socket`. |
| `events.rs` | `DomainEvent` — the full event catalog, `domain()` routing. |
-| `jsonrpc.rs` | Axum router (`/rpc`, `/health`, `/schema`, `/events`, …), `invoke_method`, `run_server*` shims, `bootstrap_core_runtime`. |
+| `jsonrpc/` | JSON-RPC dispatch and transport: `invoke.rs` (`invoke_method`), `classify.rs` (session-expiry and Sentry routing of failures), `server.rs` (`run_server*` shims), and `http/` (the axum router and one module per route family, `http-server` feature only). |
| `socketio.rs` | Socket.IO live-event bridge to the desktop shell. |
| `auth.rs` | Per-process RPC bearer token: init paths, `get_rpc_token`, `rpc_auth_middleware`. |
| `event_bind_tokens.rs` | Single-shot bind tokens for the `/events` SSE stream. |
| `cli.rs`, `agent_cli.rs`, `memory_cli.rs`, `subsystems_cli.rs`, `cli_capability.rs` | CLI argument parsing and dispatch, routed through the same registry as RPC. |
-| `types.rs` | `AppState`, `HostKind`, `RpcRequest`/`RpcSuccess`/`RpcFailure`, `InvocationResult`, `approval_gate_boot_decision`. |
+| `types.rs` | `AppState`, `HostKind`, `InvocationResult`, `approval_gate_boot_decision`. The JSON-RPC envelopes live in `crates/openhuman-rpc`. |
| `legacy_aliases.rs` | `resolve_legacy` — rewrites retired method names before dispatch; mirrors `app/src/services/rpcMethods.ts`'s `LEGACY_METHOD_ALIASES`. |
| `observability.rs` | `report_error` + Sentry `before_send` filters that drop deterministic provider/updater noise. |
| `log_redaction.rs` | `scrub_secrets` — regex secret scrubbing shared by the Sentry path and always-on log path. |
@@ -73,7 +73,7 @@ adds the two Tier-1 internal methods (`core.ping`, `core.version`) to the
registered set for `/schema`.
Wire controllers only through this registry — do not add namespace branches
-to `cli.rs` or `jsonrpc.rs`. RPC namespace strings are wire contracts and do
+to `cli.rs` or `jsonrpc/`. RPC namespace strings are wire contracts and do
not follow directory renames.
## Dispatch
@@ -125,17 +125,18 @@ Each subscribing domain owns a `bus.rs`; subscriber names use
## RPC and HTTP transport
-`jsonrpc.rs` builds the Axum router (`build_core_http_router`) behind the
+`jsonrpc/http/` builds the Axum router (`build_core_http_router`) behind the
`http-server` feature: `POST /rpc`, `GET /health`, `GET /schema`,
`GET /events` (SSE), `GET /events/webhooks`, `GET /events/domain`,
`GET /ws/dictation`, the `/auth`, `/auth/telegram`, and
`/oauth/mcp/callback` callback routes, and a nested `/v1` OpenAI-compatible
inference router (`inference::http`). The
-dispatch surface itself (`invoke_method`, `parse_json_params`,
-`default_state`, the `run_server*` `CoreBuilder` shims,
-`register_domain_subscribers`, `bootstrap_core_runtime`) stays compiled in a
-slim build with no listener bound, so the CLI and `CoreRuntime::invoke` keep
-working without the HTTP feature.
+dispatch surface itself (`invoke_method`, `default_state`, the `run_server*`
+`CoreBuilder` shims) stays compiled in a slim build with no listener bound, so
+the CLI and `CoreRuntime::invoke` keep working without the HTTP feature.
+Runtime boot (`bootstrap_core_runtime`, `register_domain_subscribers`) lives
+in `runtime/`, and the wire vocabulary (envelopes, params shape, origin
+allowlist) in `crates/openhuman-rpc`.
`socketio.rs` bridges live domain events onto Socket.IO for the desktop
shell's webviews. The socketioxide/axum transport
diff --git a/crates/openhuman-core/src/core/runtime/README.md b/crates/openhuman-core/src/core/runtime/README.md
index da6f90a883..18b91bd642 100644
--- a/crates/openhuman-core/src/core/runtime/README.md
+++ b/crates/openhuman-core/src/core/runtime/README.md
@@ -110,7 +110,7 @@ are compiled out, or whose `DomainGroup` is off, stays absent.
`runtime/context.rs`'s `CoreContext` owns the core's initialization
*order*: register controllers, load the master key, seed the RPC bearer,
initialize the workspace-bound stores, and run the pure-registration part of
-`bootstrap_core_runtime`. `init_stores` gates each store on its owning
+`bootstrap_core_runtime` (`runtime/bootstrap.rs`). `init_stores` gates each store on its owning
`DomainGroup` via `StoreInitPlan` — the memory driver binding (`Memory`), the
image-attachment sidecar dir (`Agent`), and the legacy-workflow prune
(`Skills`) — while the keyring-path log and the boot-time Sentry user bind run
@@ -154,3 +154,16 @@ host an agent turn must set:
- [../README.md](../README.md) — the rest of `core/`: dispatch, registry,
event bus, transport, CLI.
+
+## Boot infrastructure
+
+- `bootstrap.rs`: `bootstrap_core_runtime` brings up the event bus, ledgers,
+ the agent-definition registry, the live security policy, the approval gate
+ and the socket manager during `CoreContext::init`.
+ `start_core_runtime_services` starts the selected background jobs from
+ `CoreRuntime::serve`.
+- `subscribers.rs`: `register_domain_subscribers` registers event-bus
+ subscribers. Ungated infrastructure registers once per process, and each
+ `DomainGroup` registers the first time a boot enables it.
+ `DomainSubscriberPlan` is the pure group-to-subscriber mapping the tests
+ assert against.