Skip to content

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

docs(config): add README for config ops module

Steven Enamakelb8a0bf1d580b
diff --git a/crates/openhuman-core/src/config/ops/README.md b/crates/openhuman-core/src/config/ops/README.md
index ec4138cb6d..57609c34eb 100644
--- a/crates/openhuman-core/src/config/ops/README.md
+++ b/crates/openhuman-core/src/config/ops/README.md
@@ -4,9 +4,10 @@ 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>`.
+functions here: they deserialize RPC params into `../schemas/helpers.rs`
+`*SettingsUpdate` structs, map those field-by-field onto the `*SettingsPatch`
+structs defined here, and call the corresponding `load_and_apply_*` / `get_*`
+fn, which returns `RpcOutcome<T>`.
## Layout
@@ -16,14 +17,16 @@ and call the corresponding `apply_*` / `get_*` fn, which returns
| `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. |
+| `sandbox.rs` | Sandbox / Docker runtime (`[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>`.
+`Option<T>` fields (`None` = unchanged); an `apply_*(&mut Config, patch)` fn
+that mutates the given config, calls `Config::save()`, and returns the
+snapshot; a `load_and_apply_*(patch)` wrapper that calls
+`load_config_with_timeout` first; and a `get_*` fn that reads the relevant
+section back out, usually as `RpcOutcome<serde_json::Value>`. `ui.rs`'s
+dictation and voice-server mutators exist only in `load_and_apply_*` form.
## Key entry points
@@ -32,37 +35,52 @@ section back out as `RpcOutcome<serde_json::Value>`.
`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`,
+- `loader.rs`: `load_config_with_timeout`,
+ `load_config_for_workspace_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`.
+ `get_data_paths`, `set_browser_allow_all`, `get_runtime_flags`,
+ `core_rpc_url_from_env`, `agent_server_status`, `get_dashboard_settings`.
+ `BROWSER_ALLOW_ALL_ENV` (`OPENHUMAN_BROWSER_ALLOW_ALL`) and
+ `BROWSER_ALLOW_ALL_RPC_ENABLE_ENV` are `pub(crate)` constants re-exported
+ from `mod.rs` only under `#[cfg(test)]`.
- `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`.
+ `apply_search_settings` / `get_search_settings`,
+ `load_and_apply_voice_server_settings` / `get_voice_server_settings`,
+ `load_and_apply_dictation_settings` / `get_dictation_settings`,
+ `set_onboarding_completed` / `get_onboarding_completed`,
+ `workspace_onboarding_flag_exists` / `workspace_onboarding_flag_set` /
+ `workspace_onboarding_flag_resolve`.
## 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.
+- `apply_autonomy_settings` is the single write path for `[autonomy]`: after
+ `Config::save()` it calls
+ `crate::security::live_policy::reload_from(&config.autonomy)` and publishes
+ `DomainEvent::AutonomyConfigChanged`, so the live `SecurityPolicy` and any
+ running agent sessions pick up the change without a core restart.
+ `add_auto_approve_tool` (backing the `ApproveAlwaysForTool` approval
+ decision) appends to `config.autonomy.auto_approve` under a process-wide
+ lock and delegates to `apply_autonomy_settings`, so the same reload
+ happens. `apply_agent_paths_settings` 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` calls `crate::security::live_policy::reload_privacy`
+ after saving, so the inference chokepoint enforces the new Privacy Mode
+ immediately (an `Err` only means no session runtime is installed yet, e.g.
+ the CLI, and the persisted value applies on the next install).
+- `reset_local_data` (RPC `config.reset_local_data`) removes only the active
+ user's `~/.openhuman/users/<id>` directory plus the two root markers
+ (`active_workspace.toml`, `active_user.toml`); the shared root is preserved
+ so sibling users' data survives. Because it runs inside the core's own tokio
+ task, GUI callers use the Tauri-side `reset_local_data` command instead
+ (which stops the core first); `get_data_paths` reports what would be removed
+ without touching anything.
## `#[cfg(test)]` re-exports