Skip to content

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

chore(modules): remove unused module declarations

Steven Enamakelb591328cb69d
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index b27ef0c8dd..3f5d16a826 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -146,6 +146,15 @@ pub async fn install_from_config(config: &crate::config::Config) -> Result<(), S
.await
.unwrap_or_else(|e| log::debug!("[tokenjuice][savings] configure failed: {e}"));
let request = install_request(config);
+ // The module keeps the durable tier on its blob storage; originals the old
+ // disk tier wrote move across first (once per directory, best effort).
+ if let Some(root) = request.disk_tier_root.as_deref() {
+ crate::modules::import_legacy_tinyjuice(
+ std::path::Path::new(root),
+ request.ccr_ttl_secs.map(std::time::Duration::from_secs),
+ )
+ .await;
+ }
let fingerprint = serde_json::to_vec(&request).map_err(|error| error.to_string())?;
static INSTALLED: std::sync::OnceLock<tokio::sync::Mutex<Option<Vec<u8>>>> =
std::sync::OnceLock::new();
diff --git a/crates/openhuman-core/src/integrations/composio/trigger_history.rs b/crates/openhuman-core/src/integrations/composio/trigger_history.rs
index f166766cbb..a3167a629b 100644
--- a/crates/openhuman-core/src/integrations/composio/trigger_history.rs
+++ b/crates/openhuman-core/src/integrations/composio/trigger_history.rs
@@ -57,6 +57,9 @@ impl TriggerHistory {
let state_dir = state_dir
.to_str()
.ok_or_else(|| "trigger archive requires a UTF-8 state directory".to_owned())?;
+ // The archive opens on the module's storage: bring yesterday's JSONL
+ // files across first (once per state directory, best effort).
+ crate::modules::import_legacy_connectors(&config.workspace_dir.join("state")).await;
let handle = client
.call(
"tinyconnectors",
diff --git a/crates/openhuman-core/src/modules/connectors.rs b/crates/openhuman-core/src/modules/connectors.rs
index 86acbba97b..4265b75ae8 100644
--- a/crates/openhuman-core/src/modules/connectors.rs
+++ b/crates/openhuman-core/src/modules/connectors.rs
@@ -269,6 +269,11 @@ async fn ensure_routed(config: &Config, proxy: &Proxy) -> Result<(), String> {
object.remove("offered_toolkits");
}
+ // Preferences and trigger history from before the storage contract move
+ // into the module's storage before it first serves a call. Once per state
+ // directory, best effort: a failure is retried on the next call.
+ super::import_legacy_connectors(&config.workspace_dir.join("state")).await;
+
let current = fingerprint(&route);
if *last_route()
.lock()
diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rs
index 1552bb6a19..b28399ae02 100644
--- a/crates/openhuman-core/src/modules/mod.rs
+++ b/crates/openhuman-core/src/modules/mod.rs
@@ -87,17 +87,35 @@ mod search_path;
pub(crate) mod site_memory_host;
mod source;
#[cfg(feature = "modules")]
+mod storage_grant_tinybox;
+#[cfg(feature = "modules")]
mod storage_grant_tinychannels;
#[cfg(feature = "modules")]
+mod storage_grant_tinyconnectors;
+#[cfg(feature = "modules")]
+mod storage_grant_tinyjuice;
+#[cfg(feature = "modules")]
mod storage_grant_tinymcp;
#[cfg(feature = "modules")]
+mod storage_grant_tinywallet;
+#[cfg(feature = "modules")]
pub mod storage_grants;
#[cfg(feature = "modules")]
pub(crate) mod storage_host;
#[cfg(feature = "modules")]
mod storage_host_linked;
#[cfg(feature = "modules")]
+mod storage_import_support;
+#[cfg(feature = "modules")]
+mod storage_import_tinybox;
+#[cfg(feature = "modules")]
+mod storage_import_tinyconnectors;
+#[cfg(feature = "modules")]
+mod storage_import_tinyjuice;
+#[cfg(feature = "modules")]
mod storage_import_tinymcp;
+#[cfg(all(feature = "modules", feature = "web3"))]
+mod storage_import_tinywallet;
#[cfg(feature = "modules")]
pub mod tinybox;
#[cfg(feature = "modules")]
@@ -138,3 +156,58 @@ pub async fn import_legacy_mcp(data_dir: &std::path::Path) {
#[cfg(not(feature = "modules"))]
let _ = data_dir;
}
+
+/// Imports the connector module's legacy preference and trigger-archive files
+/// under `state_dir` into its storage, once per directory. Never fails the
+/// caller: an error is logged and the import is retried at the next open.
+pub async fn import_legacy_connectors(state_dir: &std::path::Path) {
+ #[cfg(feature = "modules")]
+ match storage_import_tinyconnectors::import_legacy(state_dir).await {
+ Ok(outcome) => log::debug!("[connectors] legacy storage import: {outcome:?}"),
+ Err(error) => {
+ log::warn!("[connectors] legacy storage import failed, will retry: {error:#}");
+ }
+ }
+ #[cfg(not(feature = "modules"))]
+ let _ = state_dir;
+}
+
+/// Imports the x402 ledger's legacy `payments.jsonl` under `workspace_dir`
+/// into the wallet module's storage, once per workspace. Never fails the
+/// caller: an error is logged and the import is retried at the next open.
+pub async fn import_legacy_x402(workspace_dir: &std::path::Path) {
+ #[cfg(all(feature = "modules", feature = "web3"))]
+ match storage_import_tinywallet::import_legacy(workspace_dir).await {
+ Ok(outcome) => log::debug!("[x402] legacy storage import: {outcome:?}"),
+ Err(error) => log::warn!("[x402] legacy storage import failed, will retry: {error:#}"),
+ }
+ #[cfg(not(all(feature = "modules", feature = "web3")))]
+ let _ = workspace_dir;
+}
+
+/// Imports the legacy jail registry index under `<workspace_dir>/jails` into
+/// the tinybox module's storage, once. Never fails the caller: an error is
+/// logged and the import is retried at the next call.
+pub async fn import_legacy_tinybox(workspace_dir: &std::path::Path) {
+ #[cfg(feature = "modules")]
+ match storage_import_tinybox::import_legacy(workspace_dir).await {
+ Ok(outcome) => log::debug!("[tinybox] legacy storage import: {outcome:?}"),
+ Err(error) => log::warn!("[tinybox] legacy storage import failed, will retry: {error:#}"),
+ }
+ #[cfg(not(feature = "modules"))]
+ let _ = workspace_dir;
+}
+
+/// Imports the legacy on-disk CCR tier under `root` into the tinyjuice
+/// module's blob storage, once per directory. `ttl` is the configured original
+/// lifetime. Never fails the caller: an error is logged and the import is
+/// retried at the next install.
+pub async fn import_legacy_tinyjuice(root: &std::path::Path, ttl: Option<std::time::Duration>) {
+ #[cfg(feature = "modules")]
+ match storage_import_tinyjuice::import_legacy(root, ttl).await {
+ Ok(outcome) => log::debug!("[tinyjuice] legacy storage import: {outcome:?}"),
+ Err(error) => log::warn!("[tinyjuice] legacy storage import failed, will retry: {error:#}"),
+ }
+ #[cfg(not(feature = "modules"))]
+ let _ = (root, ttl);
+}
diff --git a/crates/openhuman-core/src/modules/tinybox.rs b/crates/openhuman-core/src/modules/tinybox.rs
index 8888af9f3d..81165e7869 100644
--- a/crates/openhuman-core/src/modules/tinybox.rs
+++ b/crates/openhuman-core/src/modules/tinybox.rs
@@ -433,6 +433,9 @@ where
Request: Serialize + Send,
Reply: DeserializeOwned,
{
+ // A registry index from before the storage contract moves into the
+ // module's storage before its first call. Once per workspace, best effort.
+ super::import_legacy_tinybox(&config.workspace_dir).await;
call_with_client(&module_client(config), member, request, confidential).await
}
diff --git a/crates/openhuman-core/src/modules/x402_service.rs b/crates/openhuman-core/src/modules/x402_service.rs
index acc14730ba..4f05df4918 100644
--- a/crates/openhuman-core/src/modules/x402_service.rs
+++ b/crates/openhuman-core/src/modules/x402_service.rs
@@ -138,6 +138,9 @@ async fn ensure_service(
}
if active.is_none() {
+ // The module's ledger opens on its storage: bring the payments file of
+ // an earlier install across first (once per workspace, best effort).
+ super::import_legacy_x402(&workspace).await;
let service_config = X402ConfigResponse {
workspace_dir: workspace.display().to_string(),
session_id: format!("x402-{}", uuid::Uuid::new_v4()),