The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(cli): add linked-modules feature for local module development
Steven Enamakelde83de1be905
diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.tomlindex 8e6857d6e3..59d02f78a6 100644--- a/crates/openhuman-cli/Cargo.toml+++ b/crates/openhuman-cli/Cargo.toml@@ -74,6 +74,13 @@ required-features = ["http-server", "bin-tools"]# files. #5021 is still the right fix for symbols named in the middle of an# otherwise gate-free target — required-features is the blunt instrument, and# it costs the whole target when the gate is off.+[[test]]+# Loads the tinydocs module from the linked executable and calls GenerateDocx+# end to end. Local only: needs `--features linked-modules,documents`.+name = "tinydocs_linked_e2e"+path = "../../tests/tinydocs_linked_e2e.rs"+required-features = ["linked-modules", "documents"]+[[test]]name = "tinysearch_module_e2e"path = "../../tests/tinysearch_module_e2e.rs"@@ -291,6 +298,10 @@ path = "../../tests/skills_mcp_registry_live.rs"# The only openhuman crate the binary depends on. Every gate below forwards to# it, and it forwards down the chain to the core.openhuman-rpc = { workspace = true, features = ["server"] }+# Local-development bridge that links module implementation crates into this+# executable. Optional and behind the non-product `linked-modules` feature only:+# no product feature set or other host may name it (`pnpm rust:layout`).+openhuman-modules-linked = { path = "../openhuman-modules-linked", features = ["all"], optional = true }anyhow = "1.0"axum = { version = "0.8", default-features = false, features = ["http1", "json", "tokio", "query", "ws", "macros"] }clap = { version = "4.5", features = ["derive"], optional = true }@@ -341,6 +352,7 @@ tar = "0.4"tinyagents-graph = { path = "../../vendor/tinyagents/crates/tinyagents-graph", features = ["sqlite", "storage-drivers"] }tinyagents-harness = { path = "../../vendor/tinyagents/crates/tinyagents-harness", features = ["sqlite", "multimodal"] }tinyagents-session = { path = "../../vendor/tinyagents/crates/tinyagents-session" }+tinydocs-bus = { path = "../../vendor/tinydocs/crates/tinydocs-bus" }tinysearch-bus = { path = "../../vendor/tinysearch/crates/tinysearch-bus" }tinybus = { path = "../../vendor/tinybus/crates/tinybus", default-features = false, features = ["macros", "uds"] }tinychannels = { version = "0.1", features = ["relay-websocket"] }@@ -411,6 +423,12 @@ scheduler-gate = ["openhuman-rpc/scheduler-gate"]crash-reporting = ["openhuman-rpc/crash-reporting"]# CLI argument parsing + logger init for `openhuman-fleet`.bin-tools = ["dep:clap"]+# LOCAL DEVELOPMENT ONLY, never a product gate. Links the module implementation+# crates (`openhuman-modules-linked`) into this binary and its tests and+# registers them at boot, so `OPENHUMAN_MODULE_SOURCE=linked` serves modules from+# the executable. Absent from `scripts/ci/product-features.txt` and from the+# app manifest; CI never enables it.+linked-modules = ["modules", "dep:openhuman-modules-linked"][lints.rust]unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage)'] }diff --git a/crates/openhuman-cli/src/main.rs b/crates/openhuman-cli/src/main.rsindex 2cafe71f5f..810fc276c0 100644--- a/crates/openhuman-cli/src/main.rs+++ b/crates/openhuman-cli/src/main.rs@@ -22,6 +22,12 @@ fn main() {log::debug!("[cli] early dotenv load failed: {err}");}+ // Local development only: link the module implementation crates in and+ // register them with the core's linked-module seam. They are served only+ // when the configuration asks (`OPENHUMAN_MODULE_SOURCE=linked`).+ #[cfg(feature = "linked-modules")]+ openhuman_modules_linked::install();+// The guard must outlive everything, so it is bound in `main`.#[cfg(feature = "crash-reporting")]let _sentry_guard = init_sentry();diff --git a/tests/support/linked_modules.rs b/tests/support/linked_modules.rsnew file mode 100644index 0000000000..1a25b10ca4--- /dev/null+++ b/tests/support/linked_modules.rs@@ -0,0 +1,24 @@+//! Register the linked module factories for a local test run.+//!+//! Only meaningful with `--features linked-modules` (the whole file is empty+//! without it). CI never enables the feature or sets+//! `OPENHUMAN_MODULE_SOURCE=linked`, so it keeps loading released modules.+//!+//! Include with `#[path = "support/linked_modules.rs"] mod linked_modules;`.++#![allow(dead_code)]++/// Register every linked module with the core. Idempotent.+#[cfg(feature = "linked-modules")]+pub fn install() {+ openhuman_modules_linked::install();+}++/// [`install`] when `OPENHUMAN_MODULE_SOURCE=linked` is set, for suites that+/// should follow the environment like the binary does.+#[cfg(feature = "linked-modules")]+pub fn install_if_requested() {+ if std::env::var("OPENHUMAN_MODULE_SOURCE").is_ok_and(|value| value.eq_ignore_ascii_case("linked")) {+ install();+ }+}diff --git a/tests/tinydocs_linked_e2e.rs b/tests/tinydocs_linked_e2e.rsnew file mode 100644index 0000000000..596b322acc--- /dev/null+++ b/tests/tinydocs_linked_e2e.rs@@ -0,0 +1,48 @@+//! The tinydocs module served from the linked executable, end to end.+//!+//! Local only: it needs `--features linked-modules,documents`, which no CI lane+//! or product build enables. The module is admitted through the same+//! `register_linked` seam `openhuman-core --features linked-modules` uses, and+//! `GenerateDocx` runs over the module bus with no downloaded artifact.++#[path = "support/linked_modules.rs"]+mod linked_modules;++use openhuman_core::config::schema::ModuleSourceMode;+use openhuman_core::config::Config;+use openhuman_core::modules::types::{ModuleSource, ModuleState};+use tinydocs_bus::{DocumentSection, DocumentSpec};++#[tokio::test]+async fn linked_tinydocs_generates_a_docx_without_a_release_artifact() {+ linked_modules::install();++ let mut config = Config::default();+ config.modules.enabled = true;+ // A fallback to the release must fail loudly rather than download.+ config.modules.allow_download = false;+ config.modules.source = ModuleSourceMode::Linked;++ let spec = DocumentSpec {+ title: "Linked module report".to_string(),+ author: Some("openhuman".to_string()),+ sections: vec![DocumentSection {+ heading: Some("Overview".to_string()),+ paragraphs: vec!["Served from the executable.".to_string()],+ bullets: vec!["one".to_string(), "two".to_string()],+ }],+ };++ let docx = openhuman_core::modules::documents::generate_docx(&config, &spec)+ .await+ .expect("the linked tinydocs module generates a document");+ // A .docx is a zip archive.+ assert!(docx.starts_with(b"PK"), "not a zip: {} bytes", docx.len());++ let status = openhuman_core::modules::ops::list(&config)+ .into_iter()+ .find(|module| module.id == "tinydocs")+ .expect("tinydocs is registered");+ assert_eq!(status.state, ModuleState::Ready);+ assert_eq!(status.source, Some(ModuleSource::Linked));+}