Skip to content

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

docs: add README files for app, runtime, and webhooks

Steven Enamakelede23c1ad189
diff --git a/crates/openhuman-app/README.md b/crates/openhuman-app/README.md
index 27eb713150..6bc8d938b6 100644
--- a/crates/openhuman-app/README.md
+++ b/crates/openhuman-app/README.md
@@ -82,8 +82,8 @@ the `openhuman_core` product-feature forwarding above and do not belong in
| --- | --- |
| Core lifecycle | `core_process.rs`, `core_rpc.rs`, `process_kill.rs`, `process_recovery.rs`, `workspace_paths.rs` |
| Gateways (feature-gated) | `gateway/` (`types`, `store`, `ops`, `provision`, `registry`, `commands`) |
-| Platform integration | `deep_link_ipc.rs` (Linux), `deep_link_ipc_windows.rs`, `deep_link_registration_check.rs`, `native_notifications/`, `imessage_scanner/` (macOS `chat.db` reader), `mascot_native_window.rs`, `notch_window.rs`, `ptt_hotkeys.rs`/`ptt_overlay.rs`, `dictation_hotkeys.rs`, `window_state.rs` |
-| Updates / reset | `app_update.rs`, `local_data_reset.rs`, `reset_reboot_schedule.rs` |
+| Platform integration | `deep_link_ipc.rs` (Linux), `deep_link_ipc_windows.rs`, `deep_link_registration_check.rs`, `native_notifications/`, `imessage_scanner/` (macOS `chat.db` reader), `mascot_native_window.rs` and `notch_window.rs` (macOS), `ptt_hotkeys.rs`/`ptt_overlay.rs`, `dictation_hotkeys.rs`, `window_state.rs` |
+| Updates / reset | `app_update.rs`, `local_data_reset.rs`, `reset_reboot_schedule.rs` (Windows) |
| Misc | `artifact_commands.rs`, `claude_code.rs`, `mcp_commands.rs`, `loopback_oauth.rs`, `directory_picker.rs`, `file_logging.rs`, `stderr_panic_hook.rs` |
## Tests
diff --git a/crates/openhuman-core/src/skills/runtime/README.md b/crates/openhuman-core/src/skills/runtime/README.md
index f858ca4116..8941ad34c2 100644
--- a/crates/openhuman-core/src/skills/runtime/README.md
+++ b/crates/openhuman-core/src/skills/runtime/README.md
@@ -1,49 +1,68 @@
# skills/runtime
`crate::skills::runtime` owns execution of installed `SKILL.md` skills.
-`skill_runtime` is the stable RPC/CLI namespace for this module (registered
-in `core/all.rs`).
+`skill_runtime` is the stable RPC/CLI namespace (registered through
+`all_skill_runtime_registered_controllers()` in `core/all.rs`); the
+directory rename did not change it.
Responsibilities:
-- Start and cancel skill runs.
-- Read recent run metadata and run logs.
-- Resolve reusable language runtimes before script-backed skills run.
-- Host the built-in `skill_executor` sub-agent that carries out a run.
+- Start a skill run in the background and cancel an in-flight one.
+- List recent runs and read run-log slices.
+- Resolve the reusable Node/Python runtimes before script-backed skills run.
+- Define the built-in `skill_executor` delegate agent.
-It deliberately reuses:
+A run is an `orchestrator` `Agent` built per run
+(`Agent::from_config_for_agent_with_profile(&config, "orchestrator", ..)`),
+given the skill body as its task prompt, capped at
+`WORKFLOW_RUN_MAX_ITERATIONS`, and raced against the cancellation token
+registered in `run_log`. Progress events drain to the run log; the footer
+records `DONE`, `FAILED`, `CANCELLED`, or `DEGENERATE`.
-- `crate::runtime::node` for Node.js, npm, npx, and PATH injection.
-- `crate::runtime::python` for Python interpreter resolution and process
- launching.
-- `crate::skills` (`ops_discover`, `run_log`) for installed skill discovery,
- metadata, resources, and run-log storage.
+The same `spawn_workflow_run_background` / `await_run_outcome` pair backs the
+`skills_run` / `skills_cancel` / `skills_recent_runs` / `skills_read_run_log`
+controllers in `skills/schemas/` and the `run_workflow` / `await_workflow`
+agent tools in `agent/tools/run_workflow.rs`, so RPC and tool callers share
+one spawn path.
+
+It reuses, rather than duplicates:
+
+- `crate::runtime::node` (`NodeBootstrap`) and `crate::runtime::python`
+ (`PythonBootstrap`) for interpreter resolution.
+- `crate::skills::registry` for skill lookup and required-input checks,
+ `crate::skills::preflight` for the `[github]` gate, `crate::skills::run_log`
+ for log paths, cancellation tokens, and run scanning, and
+ `crate::skills::schemas::resolve_workspace_dir`.
## Key files
| File | Purpose |
| --- | --- |
-| `mod.rs` | Feature gate for the `skills` Cargo feature; re-exports the real module or [`stub`] |
-| `ops.rs` | `RuntimeRequirement` and `resolve_runtimes` — checks Node/Python availability |
-| `run_machinery.rs` | Spawns and awaits background skill runs (`spawn_workflow_run_background[_with_profile]`, `await_run_outcome`) |
-| `schemas.rs` | Controller schemas and handlers for `skill_runtime_*` (`run`, `cancel`, `recent_runs`, `read_run_log`, `resolve_runtimes`, `schemas`) |
-| `tools.rs` | LLM-callable tool wrapping `resolve_runtimes` |
-| `stub.rs` | Disabled-feature facade matching the public surface with empty bodies |
-| `agent/skill_executor/` | Built-in `skill_executor` agent archetype that carries out a run |
+| `mod.rs` | Facade: gates the real modules behind the `skills` feature, re-exports the run machinery and controller aggregators, or pulls in `stub` |
+| `ops.rs` | `RuntimeRequirement` (`all` / `node` / `python`) and `resolve_runtimes` returning `ResolveRuntimesOutcome` |
+| `run_machinery.rs` | `spawn_workflow_run_background[_with_profile]`, `WorkflowRunStarted`, `await_run_outcome` |
+| `schemas.rs` | `skill_runtime` controllers: `run`, `cancel`, `recent_runs`, `read_run_log`, `resolve_runtimes`, `schemas` |
+| `tools.rs` | `SkillRuntimeResolveRuntimesTool` (`skill_runtime_resolve_runtimes`), re-exported through `tools/mod.rs` under the `skills` gate |
+| `stub.rs` | Disabled-feature facade: only the two controller aggregators, both returning empty vectors |
+| `agent/skill_executor/` | `agent.toml`, `prompt.md`, and `prompt.rs` for the `skill_executor` agent (delegate name `run_skill`); registered in `agent/registry/agents/loader.rs` and listed as an orchestrator delegate |
## Compile-time gate (`skills` feature)
-`pub mod runtime;` in `skills/mod.rs` is always compiled — it is a facade.
-The real implementation is gated behind the default-ON `skills` Cargo
-feature (the same gate as `skills` and `skills::catalog`). When the feature
-is off, [`stub`](stub.rs) takes its place with disabled-error / empty
-bodies. See `crates/openhuman-core/src/skills/mod.rs` for the pattern.
+`pub mod runtime;` in `skills/mod.rs` stays ungated because it is a facade.
+`agent`, `ops`, `run_machinery`, `schemas`, and `tools` are compiled only
+with the default-on `skills` Cargo feature (the same gate as `skills` and
+`skills::catalog`). With the feature off, `stub.rs` supplies
+`all_skill_runtime_registered_controllers` and
+`all_skill_runtime_controller_schemas` as empty lists, so the namespace is
+absent from `/schema` and unknown over `/rpc`. Every other caller of the run
+machinery is behind the same feature, so the stub owes nothing else;
+`cargo check --no-default-features` is what catches signature drift.
-Production smoke examples:
+Smoke examples:
```bash
-openhuman skill_runtime schemas
-openhuman skill_runtime resolve_runtimes --runtime all
-openhuman skill_runtime run --skill_id git-helper --inputs '{}'
-openhuman skill_runtime recent_runs --limit 10
+openhuman-core skill_runtime schemas
+openhuman-core skill_runtime resolve_runtimes --runtime all
+openhuman-core skill_runtime run --skill_id git-helper --inputs '{}'
+openhuman-core skill_runtime recent_runs --limit 10
```
diff --git a/crates/openhuman-core/src/skills/webhooks/README.md b/crates/openhuman-core/src/skills/webhooks/README.md
index cb65da01df..ba23acb3b3 100644
--- a/crates/openhuman-core/src/skills/webhooks/README.md
+++ b/crates/openhuman-core/src/skills/webhooks/README.md
@@ -18,12 +18,12 @@ Client-side webhook **tunnel routing** for OpenHuman. The backend provisions and
| File | Role |
| --- | --- |
| `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`. Inline tests. |
+| `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/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`. Inline tests. |
-| `crates/openhuman-core/src/skills/webhooks/{webhooks_tests,bus_tests,ops_tests,router_tests,schemas_tests,types_tests}.rs` | Test suites (module-level + per-file via `#[path]`). |
+| `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
@@ -55,7 +55,7 @@ Registered via `all_webhooks_registered_controllers()` (wired in `crates/openhum
| `webhooks.delete_tunnel` | backend proxy | `DELETE /webhooks/core/{id}`. |
| `webhooks.get_bandwidth` | backend proxy | `GET /webhooks/core/bandwidth`. |
-Backend-proxy methods require a stored session token (`get_session_token`) and call the backend via `BackendOAuthClient`. Local router methods degrade gracefully to empty results when the router/socket manager isn't initialized rather than erroring.
+Backend-proxy methods require a stored session token (`get_session_token`) and call the backend via `BackendOAuthClient`. `list_registrations`, `list_logs` and `clear_logs` return empty results when the router/socket manager isn't initialized; the `register_*`/`unregister_*` ops return an error in that case.
## Agent tools
@@ -63,7 +63,7 @@ None. This domain owns no `tools.rs` agent tools.
## Events
-Subscriber (in `bus.rs`): **`WebhookRequestSubscriber`** — `name() = "webhook::request_handler"`, `domains() = ["webhook"]`. Registered in `register_domain_subscribers()` (`crates/openhuman-core/src/core/jsonrpc.rs`), gated on the `Skills` domain group being enabled (`plan.skills`); `channels/runtime/startup_part_01.rs` explicitly skips registering it to avoid double-registration when both startup paths run in the same process.
+Subscriber (in `bus.rs`): **`WebhookRequestSubscriber`** — `name() = "webhook::request_handler"`, `domains() = ["webhook"]`. Registered in `register_domain_subscribers()` (`crates/openhuman-core/src/core/jsonrpc.rs`, called from `bootstrap_core_runtime()`), gated on the `Skills` domain group being enabled (`plan.skills`) and installed at most once per process; `channels/runtime/startup_part_01.rs` deliberately does not register it, to avoid double-registration when both startup paths run in the same process.
- **Subscribes**: `DomainEvent::WebhookIncomingRequest` (published by the socket transport in `socket/event_handlers.rs`).
- **Publishes**: `DomainEvent::WebhookRegistered` / `WebhookUnregistered` (from the router on registration changes — `WebhookUnregistered`, the `registration_changed` debug event and the route re-persist all fire **only when a registration was actually removed**; unregistering an absent tunnel is a silent no-op that returns `Ok(false)`, see #6091), `DomainEvent::WebhookReceived` (when routed to a target), `DomainEvent::WebhookProcessed` (always, with status/elapsed/error).
@@ -74,11 +74,13 @@ The router also runs a separate `tokio::sync::broadcast` channel of `WebhookDebu
## Persistence
-`WebhookRouter` serializes its registrations to a JSON file (`PersistedRoutes`) at the `persist_path` passed to `new()` (e.g. `~/.openhuman/webhook_routes.json`). Writes are best-effort and fire-and-forget: offloaded to `spawn_blocking` inside a tokio runtime (inline otherwise), guarded by a monotonic generation counter so stale writes under rapid churn are dropped. Routes are reloaded from this file on startup. Debug logs are **not** persisted — they live only in an in-memory `VecDeque` capped at 250 entries.
+`WebhookRouter` serializes its registrations to a JSON file (`PersistedRoutes`) at the optional `persist_path` passed to `new()`, and reloads them from that file when constructed. Writes are best-effort and fire-and-forget: offloaded to `spawn_blocking` inside a tokio runtime (inline otherwise), guarded by a monotonic generation counter so stale writes under rapid churn are dropped. Debug logs are **not** persisted — they live only in an in-memory `VecDeque` capped at 250 entries.
+
+Note that nothing in the production startup path currently constructs a `WebhookRouter` or calls `SocketManager::set_webhook_router`; the only caller is `tests/raw_coverage/webhooks_ingress_e2e.rs`. Until a router is attached, the local RPCs return empty results (see above) and the subscriber answers every incoming request with `404`.
## Dependencies
-- `crate::core::bus` — `BUS`, `DomainEvent`, `EventHandler` for the subscriber and registration events.
+- `crate::core::bus::BUS` and `crate::core::events::DomainEvent` — publishing and subscribing; the `EventHandler` trait comes from `tinybus`.
- `crate::core::all` — `ControllerFuture`, `RegisteredController` for controller registration.
- `crate::core::{ControllerSchema, FieldSchema, TypeSchema}` — RPC schema types.
- `crate::core::observability::report_error` — error reporting for body-decode / agent-trigger failures.
@@ -98,7 +100,7 @@ The router also runs a separate `tokio::sync::broadcast` channel of `WebhookDebu
## Notes / gotchas
-- **Direct skill dispatch is not implemented**: a `skill`-kind tunnel returns `501`. Real handling exists only for `echo` and `agent` kinds (the skills QuickJS runtime was removed; see CLAUDE.md).
+- **Direct skill dispatch is not implemented**: a `skill`-kind tunnel returns `501`. Real handling exists only for `echo` and `agent` kinds (the QuickJS skill runtime was removed; see `gitbooks/developing/architecture.md`).
- `route()` deliberately resolves only `target_kind == "skill"` registrations; echo/agent registrations are matched via `registration()` in the bus, not `route()`.
- Agent tunnels respond `202` immediately and complete asynchronously — the spawned task emits the final `webhook:response` itself to avoid blocking the broadcast dispatch task during LLM calls.
- `register_agent` stores `agent_id` for observability and rebind validation only; per the docstring the triage evaluator selects the target agent dynamically regardless of the pinned value.