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 platform service, runtime javascript, and config ops

Steven Enamakelf926874a5090
diff --git a/crates/openhuman-core/src/config/ops/README.md b/crates/openhuman-core/src/config/ops/README.md
new file mode 100644
index 0000000000..ec4138cb6d
--- /dev/null
+++ b/crates/openhuman-core/src/config/ops/README.md
@@ -0,0 +1,73 @@
+# ops
+
+JSON-RPC / CLI controller surface for persisted config and runtime flags — the
+mutation half of `config`. `crate::config` re-exports this module both under
+its own name and as `rpc` (`pub use ops as rpc`), so most callers write
+`config::rpc::*`. Controllers in `../schemas/` are thin wrappers around the
+functions here: they deserialize RPC params into the `*SettingsUpdate` structs
+and call the corresponding `apply_*` / `get_*` fn, which returns
+`RpcOutcome<T>`.
+
+## Layout
+
+| File | Responsibility |
+| --- | --- |
+| `agent.rs` | Autonomy, agent, agent-paths, activity-level, and memory-sync settings. |
+| `loader.rs` | Config loading/snapshotting and runtime flags; split into `loader_part_01.rs` / `loader_part_02.rs` via `include!`. |
+| `model.rs` | AI-provider, memory, runtime, local-AI, and Composio-trigger settings. |
+| `privacy.rs` | Privacy Mode (`[privacy]`) get/set. |
+| `sandbox.rs` | Sandbox / Docker runtime (`[security.sandbox]`, `[runtime.docker]`) settings. |
+| `ui.rs` | Browser, analytics, search, dictation, voice-server, and onboarding-flag settings. |
+
+Each submodule follows the same shape: a `*SettingsPatch` struct with
+`Option<T>` fields (`None` = unchanged), an `apply_*` fn that loads the config,
+mutates it from the patch, and saves it, a `load_and_apply_*` convenience
+wrapper that loads the config first, and a `get_*` fn that reads the relevant
+section back out as `RpcOutcome<serde_json::Value>`.
+
+## Key entry points
+
+- `agent.rs`: `apply_autonomy_settings` / `get_autonomy_settings`,
+ `add_auto_approve_tool`, `apply_agent_settings` / `get_agent_settings`,
+ `apply_agent_paths_settings` / `get_agent_paths`, `ensure_usable_cwd`,
+ `expand_tilde`, `redact_home`, `apply_activity_level_settings`,
+ `apply_memory_sync_settings`.
+- `loader.rs`: `load_config_with_timeout`, `get_config_snapshot`,
+ `client_config_json`, `reload_config_from_paths`, `reset_local_data`,
+ `set_browser_allow_all`, `get_runtime_flags`, `core_rpc_url_from_env`,
+ `BROWSER_ALLOW_ALL_ENV`.
+- `model.rs`: `apply_model_settings`, `apply_memory_settings`,
+ `apply_runtime_settings`, `apply_local_ai_settings`,
+ `apply_composio_trigger_settings`, `load_and_resolve_api_url`.
+- `privacy.rs`: `apply_privacy_settings`, `get_privacy_mode`.
+- `sandbox.rs`: `apply_sandbox_settings`, `get_sandbox_settings`.
+- `ui.rs`: `apply_browser_settings`, `apply_analytics_settings`,
+ `apply_search_settings`, `apply_voice_server_settings` /
+ `get_voice_server_settings`, `apply_dictation_settings` /
+ `get_dictation_settings`, `set_onboarding_completed` /
+ `get_onboarding_completed`, `workspace_onboarding_flag_exists` /
+ `workspace_onboarding_flag_set`.
+
+## Security-relevant behavior
+
+- `add_auto_approve_tool` persists the workspace's "always allow" tool list
+ (`config.autonomy.auto_approve`), and `apply_autonomy_settings` and
+ `add_auto_approve_tool` both call
+ `crate::security::live_policy::reload_from(&config.autonomy)` so the live
+ `SecurityPolicy` picks up the change without a core restart. `apply_agent_paths_settings`
+ likewise calls `crate::security::live_policy::set_action_dir` when
+ `action_dir` changes. Do not weaken these settings mutators — they gate the
+ same autonomy invariants AGENTS.md requires of `security/`.
+- `apply_privacy_settings` hot-swaps the live `SecurityPolicy`'s privacy mode
+ the same way, so an inference chokepoint enforces a new mode immediately.
+- `reset_local_data` deletes the workspace's persisted config, memory, and
+ session state; it is invoked only via the explicit `config.reset_local_data`
+ RPC, never automatically.
+
+## `#[cfg(test)]` re-exports
+
+`mod.rs` re-exports several otherwise-private items (`Config`,
+`active_workspace_marker_path`, `resolve_backend_api_url`, etc.) behind
+`#[cfg(test)]` purely so `ops_tests.rs` and its `ops_tests_part_0N_tests.rs`
+siblings can reach them through `use super::*`; they carry no runtime meaning
+outside test builds.
diff --git a/crates/openhuman-core/src/platform/service/README.md b/crates/openhuman-core/src/platform/service/README.md
index 1d58c21080..d4f8c3af61 100644
--- a/crates/openhuman-core/src/platform/service/README.md
+++ b/crates/openhuman-core/src/platform/service/README.md
@@ -95,8 +95,8 @@ Both subscribers are registered idempotently from `crates/openhuman-core/src/cor
- `crates/openhuman-core/src/core/all.rs` — registers the service controllers (`all_service_registered_controllers`).
- `crates/openhuman-core/src/core/jsonrpc.rs` — registers the restart/shutdown event-bus subscribers at startup.
- `crates/openhuman-core/src/platform/doctor/core.rs` — reads `service::daemon::state_file_path`.
-- `crates/openhuman-core/src/platform/update/ops.rs`, `crates/openhuman-core/src/config/ops.rs`, `crates/openhuman-core/src/desktop/app_state/ops.rs` — reference `openhuman::platform::service` (status/lifecycle/restart paths).
-- `src/lib.rs` — module wiring.
+- `crates/openhuman-core/src/platform/update/ops.rs`, `crates/openhuman-core/src/config/ops/loader_part_01.rs` — reference `crate::platform::service` (restart/mock-agent-running paths).
+- `crates/openhuman-core/src/core/all.rs` and `lib.rs` — module wiring.
## Notes / gotchas
diff --git a/crates/openhuman-core/src/runtime/javascript/README.md b/crates/openhuman-core/src/runtime/javascript/README.md
index e57df83a08..0a4f2879b3 100644
--- a/crates/openhuman-core/src/runtime/javascript/README.md
+++ b/crates/openhuman-core/src/runtime/javascript/README.md
@@ -1,81 +1,83 @@
# javascript
-First-class **JavaScript language slot** for the core. This module is a thin re-export facade: it gives the rest of the codebase a stable `crate::runtime::javascript` surface that talks to a *language* (`javascript`) rather than to a concrete backend. Today the implementation backend is the managed Node.js runtime in `crate::runtime::node`; the facade exists so a future sibling slot (`python`, `ruby`, or an alternate JS backend) can swap in without churning callers. It owns no logic of its own — every symbol it exposes is a `pub use` of a `runtime_node` item.
-
-## Responsibilities
-
-- Provide the canonical `openhuman::runtime::javascript::*` import path for Node.js runtime resolution/bootstrap and the agent-tool bridge.
-- Re-export the JS-namespaced RPC controller schemas/registry (`javascript.list_tools`, `javascript.execute_tool`) under stable `all_javascript_*` names so `crates/openhuman-core/src/core/all.rs` can wire them.
-- Re-export `NodeBootstrap` and related resolve/download/extract types used by the system exec tools to locate a `node` binary.
+First-class **JavaScript language slot** for the core. This module is a thin
+re-export facade: it gives the rest of the codebase a stable
+`crate::runtime::javascript` import path that talks to a *language*
+(`javascript`) rather than to a concrete backend. Today the implementation
+backend is the managed Node.js client in [`crate::runtime::node`](../node/README.md),
+which is itself a client for the vendored `tinyruntime` module — the facade
+exists so the backend underneath can be swapped without churning callers. It
+owns no logic of its own: every symbol it exposes is a `pub use`.
## Key files
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/runtime/javascript/mod.rs` | Entire module. Module docstring + `pub use` re-exports from `runtime_node`. No types, no logic, no tests. |
+| `mod.rs` | Entire module (26 lines). Module docstring plus `pub use` re-exports, some gated by the `runtime-node` feature. No types, no logic, no tests. |
-> All behavior lives in `crates/openhuman-core/src/runtime/node/` (`bootstrap.rs`, `downloader.rs`, `extractor.rs`, `resolver.rs`, `ops.rs`, `schemas.rs`, `rpc.rs`, `types.rs`). This facade only renames/forwards their public surface.
+## Gating (`runtime-node`)
-## Public surface
+The facade itself is **always compiled** — `ShellTool` and the other exec
+tools hold an `Option<Arc<NodeBootstrap>>`, so the bootstrap type surface must
+exist in every build:
-Re-exported from `runtime_node`:
+- Always re-exported: `ExecuteToolOutcome`, `NodeBootstrap`, `NodeSource`,
+ `ResolvedNode`. With `runtime-node` off, these come from
+ `runtime::node::stub` (`resolve` errors with a build fact; `try_cached` /
+ `probe_installed` return `None`).
+- Re-exported only behind `runtime-node`: `RuntimeToolSummary`, `execute_tool`,
+ `list_tools`, and the controller registry pair
+ `all_javascript_controller_schemas` / `all_javascript_registered_controllers`
+ (aliases of `all_runtime_node_controller_schemas` /
+ `all_runtime_node_registered_controllers`). These only exist because their
+ only consumers — the RPC bridge and `core/all.rs` — are gated off too.
-- **Types**: `ExecuteToolOutcome`, `RuntimeToolSummary` (from `runtime_node::types`); `NodeBootstrap`, `NodeSource`, `ResolvedNode`, `NodeDistribution`, `SystemNode`.
-- **Functions**: `execute_tool`, `list_tools` (tool bridge); `detect_system_node`, `parse_node_version` (system node detection); `download_distribution`, `fetch_shasums`, `atomic_install`, `extract_distribution` (managed-toolchain install path).
-- **Controller wiring**: `all_javascript_controller_schemas` (← `all_runtime_node_controller_schemas`), `all_javascript_registered_controllers` (← `all_runtime_node_registered_controllers`).
+## Public surface
+
+- **Types** (always): `ExecuteToolOutcome`, `NodeBootstrap`, `NodeSource`,
+ `ResolvedNode`.
+- **Types** (`runtime-node`): `RuntimeToolSummary`.
+- **Functions** (`runtime-node`): `execute_tool`, `list_tools`.
+- **Controller wiring** (`runtime-node`): `all_javascript_controller_schemas`,
+ `all_javascript_registered_controllers`.
## RPC / controllers
-Namespace `javascript` (defined in `runtime_node/schemas.rs`, surfaced through this facade):
+Namespace `javascript`, defined in `runtime::node::schemas` and surfaced
+through this facade's `all_javascript_*` aliases:
| Method | Inputs | Outputs |
| --- | --- | --- |
| `javascript.list_tools` | — | `tools`: array of tool metadata (`name`, `description`, `category`, `permission_level`, `scope`, `supports_markdown`, `parameters`). |
-| `javascript.execute_tool` | `tool_name` (required), `args` (optional Json, defaults to `{}`), `prefer_markdown` (optional bool) | `tool_name`, `elapsed_ms` (u64), `result` (MCP-style ToolResult: `{content, is_error, markdownFormatted?}`). |
-
-Handlers (`runtime_node/rpc.rs`) load config via `config::rpc::load_config_with_timeout`, build the full tool set via `tools::all_tools_with_runtime`, then list or dispatch a tool by exact name. Results are returned as `RpcOutcome` (CLI-compatible JSON).
-
-## Agent tools
+| `javascript.execute_tool` | `tool_name` (required), `args` (optional Json, defaults to `{}`), `prefer_markdown` (optional bool) | `tool_name`, `elapsed_ms` (u64), `result` (MCP-style `ToolResult`: `{content, is_error, markdownFormatted?}`). |
-This module owns no `tools.rs`. Instead it acts as a **bridge** to the cross-cutting tool registry: `runtime_node::ops::build_runtime_tools` constructs the full tool set (`tools::all_tools_with_runtime`) and `list_tools` / `execute_tool` enumerate or invoke them by name.
+Handlers live in `runtime::node::rpc`, load config via
+`config::rpc::load_config_with_timeout`, build the full tool set via
+`tools::all_tools_with_runtime`, then list or dispatch a tool by exact name.
## Events
-`execute_tool` (in `runtime_node/ops.rs`) publishes via `publish_global`:
-
-- `DomainEvent::ToolExecutionStarted { tool_name, session_id: "javascript" }`
-- `DomainEvent::ToolExecutionCompleted { tool_name, session_id: "javascript", success, elapsed_ms }`
-
-No event subscribers (`bus.rs`) are owned here.
-
-## Persistence
-
-No persisted domain state (`store.rs`). The managed-Node install path (`extractor::atomic_install`) writes a Node toolchain to disk, but that is filesystem installation, not domain state.
-
-## Dependencies
-
-(Direct dependency of this facade module: `runtime_node`. Transitive deps below come from the `runtime_node` implementation it forwards to.)
+`execute_tool` (in `runtime::node::ops`) publishes on the bus with
+`session_id = "javascript"`:
-- `crate::runtime::node` — the entire backing implementation; all re-exports come from here.
-- `crate::core::all` (`ControllerFuture`, `RegisteredController`) + `crate::core` (`ControllerSchema`, `FieldSchema`, `TypeSchema`) — RPC controller schema contract.
-- `crate::core::event_bus` — publishes `ToolExecutionStarted` / `ToolExecutionCompleted`.
-- `crate::config` — loads `Config` to build the tool set; RPC handlers use `config::rpc::load_config_with_timeout`.
-- `crate::tools` — `all_tools_with_runtime`, `Tool`, `ToolCallOptions`, `ToolScope`; the actual tool registry being bridged.
-- `crate::agent::host_runtime` — `NativeRuntime` / `RuntimeAdapter` injected when building tools.
-- `crate::memory` / `memory_store` — `create_memory_with_local_ai` for memory-backed tools.
-- `crate::security` — `SecurityPolicy::from_config` + workspace audit logger.
-- `crate::skills::types::ToolResult` — tool result envelope type.
+- `DomainEvent::ToolExecutionStarted`
+- `DomainEvent::ToolExecutionCompleted` (with `success`, `elapsed_ms`)
## Used by
-- `crates/openhuman-core/src/core/all.rs` — wires `all_javascript_registered_controllers` / `all_javascript_controller_schemas` into the controller registry; the about-app catalog describes namespace `javascript`.
-- `crates/openhuman-core/src/tools/ops.rs`, `tools/impl/system/shell.rs`, `node_exec.rs`, `npm_exec.rs` — import `openhuman::runtime::javascript::NodeBootstrap` for Node binary resolution.
-- `crates/openhuman-core/src/runtime/node/rpc.rs` — calls `javascript::list_tools` through the facade.
+- `crates/openhuman-core/src/core/all.rs` — wires
+ `all_javascript_registered_controllers` into the controller registry.
+- `crates/openhuman-core/src/tools/ops.rs`,
+ `tools/impl/system/{shell,node_exec,npm_exec}.rs` — import
+ `crate::runtime::javascript::NodeBootstrap` for Node binary resolution.
+- `crates/openhuman-core/src/runtime/node/rpc.rs` — calls back into
+ `javascript::{list_tools, execute_tool}` through the facade alias.
## Notes / gotchas
-- This is a **rename-only facade** (see the canonical "thin facade" exception in CLAUDE.md): no `types.rs`/`ops.rs`/`store.rs` here by design. Edit behavior in `runtime_node`, not here.
-- `javascript.execute_tool` rebuilds the entire tool set on every call (via `build_runtime_tools`), then finds the named tool — there is no persistent tool cache.
-- The `session_id` on emitted tool events is the literal string `"javascript"`, not a real chat/session id.
-- Tool-list output is sorted by tool name (`list_tools` in `runtime_node/ops.rs`).
-- Both RPC handlers are async and resolve config through `load_config_with_timeout`, so a slow/blocked config load surfaces as an RPC error.
+- This is a rename-only facade: no `types.rs` / `ops.rs` / `store.rs` here by
+ design. Edit behavior in [`runtime/node`](../node/README.md), not here.
+- `javascript.execute_tool` rebuilds the entire tool set on every call — there
+ is no persistent tool cache at this layer.
+- See [`runtime/node/README.md`](../node/README.md) for everything the facade
+ forwards to, including what moved out to the `tinyruntime` module.
diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rs
index b1fa356c64..7e32ef27c5 100644
--- a/crates/openhuman-core/src/web_chat/schemas.rs
+++ b/crates/openhuman-core/src/web_chat/schemas.rs
@@ -1,3 +1,7 @@
+//! `ControllerSchema`/`RegisteredController` definitions for the `channel`
+//! RPC namespace: `web_chat`, `web_cancel`, `web_queue_status`,
+//! `web_queue_clear`.
+
use serde_json::{Map, Value};
use crate::core::all::{ControllerFuture, RegisteredController};