Skip to content

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

refactor(core): standardize ops module exports

Steven Enamakel7dd9ce230ddf
diff --git a/crates/openhuman-core/src/channels/routes_provider_tests.rs b/crates/openhuman-core/src/channels/routes_provider_tests.rs
index 04f165e9b5..913e44023f 100644
--- a/crates/openhuman-core/src/channels/routes_provider_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_provider_tests.rs
@@ -1,5 +1,6 @@
-use super::tests::{runtime_context, RecordingChannel};
use super::*;
+
+use super::tests::{runtime_context, RecordingChannel};
use crate::channels::context::conversation_history_key;
use crate::channels::Channel;
use std::path::PathBuf;
diff --git a/crates/openhuman-core/src/config/mod.rs b/crates/openhuman-core/src/config/mod.rs
index 2c8715d2a3..b58926774d 100644
--- a/crates/openhuman-core/src/config/mod.rs
+++ b/crates/openhuman-core/src/config/mod.rs
@@ -12,7 +12,6 @@ pub mod daemon;
pub mod enrichers;
pub mod migrations;
pub mod ops;
-pub use ops as rpc;
pub mod schema;
mod schemas;
pub mod tools;
@@ -26,6 +25,7 @@ pub use enrichers::{
};
/// RPC operations for configuration.
+pub use ops as rpc;
pub use ops::*;
pub use schema::{
diff --git a/crates/openhuman-core/src/cron/mod.rs b/crates/openhuman-core/src/cron/mod.rs
index 2c3ce291c1..aa6656ca6e 100644
--- a/crates/openhuman-core/src/cron/mod.rs
+++ b/crates/openhuman-core/src/cron/mod.rs
@@ -23,7 +23,6 @@ pub mod host_delivery;
pub mod job_builder;
pub mod limits;
pub mod ops;
-pub use ops as rpc;
pub mod origin;
mod schemas;
pub mod seed;
@@ -38,6 +37,7 @@ pub mod scheduler;
#[path = "cutover_tests.rs"]
mod cutover_tests;
+pub use ops as rpc;
#[cfg(test)]
pub use ops::update_cron_job;
pub use ops::{add_once, add_once_at, pause_job, resume_job};
diff --git a/crates/openhuman-core/src/inference/README.md b/crates/openhuman-core/src/inference/README.md
index 99dec54195..493a630426 100644
--- a/crates/openhuman-core/src/inference/README.md
+++ b/crates/openhuman-core/src/inference/README.md
@@ -160,7 +160,7 @@ A failed provider call passes through several layers, each with one job:
provider/http_error.rs api_error(): tinyinference_llm::failure::http
| classifies; HostErrorReporter applies backend guards, demotion, Sentry
|
- +--> auth_failure.rs: 401 from managed backend -> SessionExpired event
+ +--> http_error.rs: 401 from managed backend -> SessionExpired event
| 401/403 on a BYO key -> auth_error_registry::record
| -> ProviderApiKeyRejected (once per episode)
v
@@ -204,7 +204,7 @@ picks the provider the same way a provider string does.
| `provider/openai_codex.rs` | Codex routing metadata for the `openai` slug when Codex OAuth is connected. |
| [`provider/error_code.rs`](./provider/error_code.rs), [`provider/error_classify.rs`](./provider/error_classify.rs) | Managed `errorCode` extraction and Sentry ownership; OpenHuman policy over TinyInference's classifier. |
| `provider/fallback_diagnostics.rs` | Explains background-role fallback when it hits a provider with no credentials. |
-| [`provider/`](./provider/) | `http_error.rs` (host reporter over `tinyinference_llm::failure::http`, `api_error`), `models/` (model catalog listing, local-runtime and OpenRouter entries), `factory/` (chat-model construction and cloud provider resolution). |
+| [`provider/`](./provider/) | [`http_error.rs`](./provider/http_error.rs) (host reporter over `tinyinference_llm::failure::http`, `api_error`), `models/` (model catalog listing, local-runtime and OpenRouter entries), `factory/` (chat-model construction and cloud provider resolution). |
| [`provider/types.rs`](./provider/types.rs) | Host DTOs kept at product and RPC boundaries: `ChatResponse`, `ProviderDelta`, `BilledUsage`, `AGENT_TURN_MAX_OUTPUT_TOKENS`. |
| `host_runtime/` | Product policy, RPC and speech bindings over `tinyinference_local`. See [`host_runtime/README.md`](host_runtime/README.md). |
| `embedding_host/` | Embedding provider selection (managed, Voyage, OpenAI, Cohere, Ollama, custom, noop) and the `embeddings.*` RPC. See [`embedding_host/README.md`](embedding_host/README.md). |
@@ -230,7 +230,7 @@ picks the provider the same way a provider string does.
natively. `INFERENCE_AGENT_CHAT` (`schemas.rs`) is the wire method name hosts reference.
- `context_window_for_model` (`model_context.rs`) and `resolve_context_window`
(`context_window.rs`) answer window sizes.
-- `api_error` ([`provider/http_error/dispatch.rs`](./provider/http_error/dispatch.rs)) is the single entry for turning a failed
+- `api_error` ([`provider/http_error.rs`](./provider/http_error.rs)) is the single entry for turning a failed
provider response into a classified error.
- `auth_error_registry::{record, clear, snapshot}` track rejected BYO keys.
- `test_provider_override` (`provider/factory.rs`) injects a mock `ChatModel` process-wide. It
@@ -270,8 +270,8 @@ Outside JSON-RPC, `http::router()` serves `/v1/chat/completions` and `/v1/models
## Events and persistence
This domain publishes but does not subscribe; there is no `bus.rs`. `SessionExpired` comes from
-[`provider/http_error/auth_failure.rs`](./provider/http_error/auth_failure.rs) and `provider/openhuman_backend_model.rs` (the managed model itself is in `openhuman-tinyhumans`).
-`ProviderApiKeyRejected` comes from `auth_failure.rs`, gated by `auth_error_registry`.
+[`provider/http_error.rs`](./provider/http_error.rs) and `provider/openhuman_backend_model.rs` (the managed model itself is in `openhuman-tinyhumans`).
+`ProviderApiKeyRejected` comes from `provider/http_error.rs`, gated by `auth_error_registry`.
There is no `store.rs`. Routing, provider and local settings persist through `config` (`config/ops/
model.rs` and friends). Provider keys live in the encrypted auth-profile store under
diff --git a/crates/openhuman-core/src/inference/provider/README.md b/crates/openhuman-core/src/inference/provider/README.md
index ff66e880ca..0648e268f9 100644
--- a/crates/openhuman-core/src/inference/provider/README.md
+++ b/crates/openhuman-core/src/inference/provider/README.md
@@ -85,10 +85,10 @@ consumers: the agent harness ([`agent/session_host/builder/factory.rs`](../../ag
## Sub-modules
-- `ops/`: `http_error` (HTTP error
- classification, Sentry routing, `api_error`), `models`
- (`list_configured_models`), `tools/delegate.rs` (`ProviderRuntimeOptions`).
- Preserves the original `pub use ops::*` contract split out of a single `ops.rs`.
+- [`http_error.rs`](./http_error.rs) owns provider HTTP error classification,
+ Sentry routing, and `api_error`; [`models/`](./models/) owns model catalog
+ listing and local-runtime entries. Delegation's `ProviderRuntimeOptions`
+ live with [`tools/delegate.rs`](../tools/delegate.rs).
- Claude Code CLI provider: `tinyagents_harness::providers::claude_code` in [`vendor/tinyagents`](../../../../../vendor/tinyagents/); see the [Claude Code provider guide](../../../../../docs/gitbooks/en/developing/providers/claude-code.md).
## Tests
@@ -97,9 +97,8 @@ consumers: the agent harness ([`agent/session_host/builder/factory.rs`](../../ag
[`factory_egress_fallback_tests.rs`](./factory_egress_fallback_tests.rs), [`factory_route_resolution_tests.rs`](./factory_route_resolution_tests.rs),
[`factory_test_provider_override_tests.rs`](./factory_test_provider_override_tests.rs): provider-string parsing, access
gates, and model construction.
-- [`ops_tests.rs`](./ops_tests.rs), [`ops_tests_error_suppression_tests.rs`](./ops_tests_error_suppression_tests.rs),
- [`ops_tests_models_parsing_tests.rs`](./ops_tests_models_parsing_tests.rs), [`ops/http_error_tests.rs`](./ops/http_error_tests.rs), [`ops/models_tests.rs`](./ops/models_tests.rs): error
- classification and model listing.
+- [`http_error_tests.rs`](./http_error_tests.rs), [`models/mod_tests.rs`](./models/mod_tests.rs),
+ and provider model-listing tests: error classification and model listing.
- Claude Code provider tests live with the provider in
[`vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/`](../../../../../vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/).
- [`openhuman_backend_model_tests.rs`](./openhuman_backend_model_tests.rs): managed host transport; reusable provider
diff --git a/crates/openhuman-core/src/platform/doctor/README.md b/crates/openhuman-core/src/platform/doctor/README.md
index 93b16341d7..629044f65c 100644
--- a/crates/openhuman-core/src/platform/doctor/README.md
+++ b/crates/openhuman-core/src/platform/doctor/README.md
@@ -82,7 +82,7 @@ None of its own (no `store.rs`). It only **reads** existing state owned by other
- `run()` is **strictly blocking** by contract (file system, sqlite, blocking HTTP). `reqwest::blocking::Client` panics inside a tokio runtime, so `ops::doctor_report` runs the whole thing in `tokio::task::spawn_blocking`. Do not add `.await` inside `core::run`.
- An async probe therefore arrives as an **argument**, resolved in `ops` before the blocking hop: `MemoryEngineCheck` is the first of them. Do not reach for `Handle::block_on` inside [`core`](./core): it panics on a current-thread runtime and deadlocks the multi-thread one whose worker it is already occupying.
- An engine that is down is reported as an error and memory being off as a warning, so the doctor names what is wrong instead of showing an empty store.
-- `run_models` / `doctor.models` is lists the configured provider slugs from the supplied config and marks each entry `Skipped` because catalog refresh is not part of doctor.
+- `run_models` / `doctor.models` lists configured provider slugs from the supplied config and marks each entry `Skipped` because catalog refresh is not part of doctor.
- The embedding probe is capped at a 3s timeout to avoid stalling on a slow Ollama daemon; non-ollama providers short-circuit to OK.
- `model_matches` treats `name` vs `name:tag` as a match only when at most one side is tagged; two differently-tagged names are not considered equal.
- Severity rollup: `DoctorSummary` counts `Ok`/`Warn`/`Error` items; checks are intentionally lenient (missing optional dirs/tools → `Warn`, not `Error`).
diff --git a/crates/openhuman-core/src/platform/doctor/mod.rs b/crates/openhuman-core/src/platform/doctor/mod.rs
index a50ca96599..3bc8afafbe 100644
--- a/crates/openhuman-core/src/platform/doctor/mod.rs
+++ b/crates/openhuman-core/src/platform/doctor/mod.rs
@@ -2,12 +2,11 @@
mod core;
pub mod ops;
-pub use ops as rpc;
mod schemas;
pub mod tools;
pub use core::*;
-
+pub use ops as rpc;
pub use ops::*;
pub use schemas::{
all_controller_schemas as all_doctor_controller_schemas,
diff --git a/crates/openhuman-core/src/platform/health/mod.rs b/crates/openhuman-core/src/platform/health/mod.rs
index 317a0a8695..aa7bc9805b 100644
--- a/crates/openhuman-core/src/platform/health/mod.rs
+++ b/crates/openhuman-core/src/platform/health/mod.rs
@@ -1,12 +1,11 @@
pub mod bus;
mod core;
pub mod ops;
-pub use ops as rpc;
mod schemas;
pub mod tools;
pub use core::*;
-
+pub use ops as rpc;
pub use ops::*;
pub use schemas::{
all_controller_schemas as all_health_controller_schemas,
diff --git a/crates/openhuman-core/src/platform/service/mod.rs b/crates/openhuman-core/src/platform/service/mod.rs
index 0e48b3aa2a..19b6cd8308 100644
--- a/crates/openhuman-core/src/platform/service/mod.rs
+++ b/crates/openhuman-core/src/platform/service/mod.rs
@@ -5,7 +5,6 @@ mod core;
pub mod daemon;
pub mod daemon_host;
pub mod ops;
-pub use ops as rpc;
mod restart;
mod schemas;
mod shutdown;
@@ -21,7 +20,7 @@ pub(crate) mod mock;
mod windows;
pub use core::*;
-
+pub use ops as rpc;
pub use ops::*;
pub use restart::apply_startup_restart_delay_from_env;
pub use restart::RestartStatus;
diff --git a/crates/openhuman-core/src/platform/update/mod.rs b/crates/openhuman-core/src/platform/update/mod.rs
index 96dca89b5d..a5986d63fe 100644
--- a/crates/openhuman-core/src/platform/update/mod.rs
+++ b/crates/openhuman-core/src/platform/update/mod.rs
@@ -1,12 +1,11 @@
mod core;
pub mod ops;
-pub use ops as rpc;
pub mod scheduler;
mod schemas;
mod types;
pub use self::core::*;
-
+pub use ops as rpc;
pub use schemas::{
all_controller_schemas as all_update_controller_schemas,
all_registered_controllers as all_update_registered_controllers,
diff --git a/crates/openhuman-core/src/security/credentials/mod.rs b/crates/openhuman-core/src/security/credentials/mod.rs
index 4886252ff6..30fe16ae91 100644
--- a/crates/openhuman-core/src/security/credentials/mod.rs
+++ b/crates/openhuman-core/src/security/credentials/mod.rs
@@ -9,7 +9,6 @@ pub mod identity;
pub mod jwt;
pub mod openai_oauth;
pub mod ops;
-pub use ops as rpc;
pub mod profiles;
pub mod responses;
mod schemas;
@@ -23,7 +22,7 @@ pub use http_creds::{
HttpCredential, HttpCredentialScheme, HttpCredentialSummary, HttpCredentialsStore,
};
pub use jwt::user_id_from_profile_payload;
-
+pub use ops as rpc;
pub use ops::*;
// Direct-mode (BYO Composio API key) credential helpers.
pub use ops::{
diff --git a/crates/openhuman-core/src/security/encryption/mod.rs b/crates/openhuman-core/src/security/encryption/mod.rs
index 9fb41c7ab5..f12c1e0dc0 100644
--- a/crates/openhuman-core/src/security/encryption/mod.rs
+++ b/crates/openhuman-core/src/security/encryption/mod.rs
@@ -6,11 +6,10 @@
mod core;
pub mod ops;
-pub use ops as rpc;
mod schemas;
pub use core::*;
-
+pub use ops as rpc;
pub use ops::*;
pub use schemas::{
all_controller_schemas as all_encryption_controller_schemas,
diff --git a/crates/openhuman-core/src/security/mod.rs b/crates/openhuman-core/src/security/mod.rs
index 2034c23e88..c3c75b878a 100644
--- a/crates/openhuman-core/src/security/mod.rs
+++ b/crates/openhuman-core/src/security/mod.rs
@@ -1,6 +1,5 @@
mod core;
pub mod ops;
-pub use ops as rpc;
mod schemas;
pub mod tools;
@@ -21,9 +20,9 @@ pub mod pairing;
pub mod policy;
pub mod prompt_injection;
pub mod scrub;
+pub(crate) mod transport;
pub mod secret_storage;
pub(crate) mod secure_open;
-pub(crate) mod transport;
pub mod turn_origin;
#[allow(unused_imports)]
@@ -39,7 +38,7 @@ pub use egress::{
emit_external_transfer, enforce_egress, local_only_blocks, local_only_tool_block, DataKind,
EgressDescriptor, EgressReason, IdentificationRisk,
};
-
+pub use ops as rpc;
pub use ops::*;
pub use policy::validate_path_within_root;
#[allow(unused_imports)]