Skip to content

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

feat(modules): add module type definitions

Steven Enamakel05e215a7adc0
diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rs
index c54f21683d..316d90a628 100644
--- a/crates/openhuman-core/src/modules/mod.rs
+++ b/crates/openhuman-core/src/modules/mod.rs
@@ -104,4 +104,4 @@ pub(crate) mod x402_service;
pub use ops::{ensure_loaded, ensure_loaded_within, state_of, LoadError};
#[cfg(feature = "modules")]
pub use schemas::{all_controller_schemas, all_registered_controllers};
-pub use types::{LoadPolicy, ModuleRecord, ModuleState, ModuleStatus, PlatformAsset};
+pub use types::{LoadPolicy, ModuleRecord, ModuleSource, ModuleState, ModuleStatus, PlatformAsset};
diff --git a/crates/openhuman-core/src/modules/types.rs b/crates/openhuman-core/src/modules/types.rs
index e8637762e7..fcad3998b6 100644
--- a/crates/openhuman-core/src/modules/types.rs
+++ b/crates/openhuman-core/src/modules/types.rs
@@ -64,17 +64,22 @@ pub enum LoadPolicy {
Eager,
}
-/// Where a module's artifact should come from.
-#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
-#[serde(tag = "kind", rename_all = "snake_case")]
+/// Which source actually serves (or would serve) a module.
+///
+/// Reported in `modules.list`. It can differ from the mode requested: a
+/// `linked` request in a binary with no linked factory is served by `release`.
+/// Never carries a path.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "snake_case")]
pub enum ModuleSource {
- /// The registry-pinned GitHub release for this build.
- Pinned,
- /// A local artifact, for developing a module against a live core.
- LocalFile {
- /// Absolute path to the platform library.
- path: String,
- },
+ /// The registry-pinned, digest-checked GitHub release.
+ Release,
+ /// The in-process factory from `openhuman-modules-linked`.
+ Linked,
+ /// A locally built artifact selected through the `source` mode.
+ Source,
+ /// A local artifact named by a `[[modules.overrides]]` `path`.
+ LocalFile,
}
/// Lifecycle of a module as this host sees it.
@@ -113,6 +118,9 @@ pub struct ModuleStatus {
pub bus_name: String,
/// Current lifecycle state.
pub state: ModuleState,
+ /// Source that serves this module under the current configuration.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub source: Option<ModuleSource>,
/// Why the module is in [`ModuleState::Failed`] or
/// [`ModuleState::Unsupported`], if it is.
///