Skip to content

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

feat(storage): import host documents into composio file store

Steven Enamakel8950746b3d0a
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
index a2988a33ff..11fcb51e12 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
@@ -29,7 +29,7 @@ use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use tinystoragedrivers::{
- CollectionSpec, DocumentStore, DocumentStoreExt, Key, Kv, Precondition, ScopedStorage,
+ CollectionSpec, DocumentStore, DocumentStoreExt, Key, Kv, ScopedStorage,
StorageError,
};
diff --git a/crates/openhuman-core/src/storage/boot.rs b/crates/openhuman-core/src/storage/boot.rs
index 91e928d529..cc4a3788a0 100644
--- a/crates/openhuman-core/src/storage/boot.rs
+++ b/crates/openhuman-core/src/storage/boot.rs
@@ -194,6 +194,9 @@ async fn post_migrate_importers(
scope: &Scope,
report: &mut BootReport,
) {
+ for (step, error) in super::host_importers::run(scoped).await {
+ record(report, scope, step, &error);
+ }
use tinyagents_harness::storage::{import_legacy_kv, LegacyKv};
for (owner, legacy, kind) in [
("harness", "harness_store", LegacyKv::Flat),
diff --git a/crates/openhuman-core/src/storage/host_importers.rs b/crates/openhuman-core/src/storage/host_importers.rs
new file mode 100644
index 0000000000..c496540ea4
--- /dev/null
+++ b/crates/openhuman-core/src/storage/host_importers.rs
@@ -0,0 +1,22 @@
+//! The host's own boot-time importers: the moves a document step cannot make
+//! because the target is another owner's collection.
+//!
+//! A [`Step`](tinystoragedrivers::schema::Step) may only write its own
+//! owner's items (schema-v2 section 4), so v1 data whose v2 home is a tsd
+//! primitive (`tsd.kv`, `tsd.counters`) is moved here, after
+//! `Registry::migrate`, the same way the TinyAgents owners' post-migrate
+//! importers are. Each is idempotent and drops its v1 collection once moved,
+//! so a finished move costs one collection listing.
+
+use tinystoragedrivers::{ScopedStorage, StorageError};
+
+/// Runs every host importer over `scoped`. Returns `(importer, error)` for each
+/// one that failed; the others still ran, and a failed one is retried at the
+/// next boot.
+pub(super) async fn run(scoped: &ScopedStorage) -> Vec<(&'static str, StorageError)> {
+ let mut failed = Vec::new();
+ if let Err(error) = crate::integrations::composio::migrate_legacy_state(scoped).await {
+ failed.push(("composio_state_to_kv", error));
+ }
+ failed
+}
diff --git a/crates/openhuman-core/src/storage/mod.rs b/crates/openhuman-core/src/storage/mod.rs
index a401d51961..07b0ababa5 100644
--- a/crates/openhuman-core/src/storage/mod.rs
+++ b/crates/openhuman-core/src/storage/mod.rs
@@ -31,6 +31,7 @@ pub mod config;
pub mod documents;
pub mod fence;
pub mod fenced_backend;
+mod host_importers;
pub mod import;
pub mod import_state;
pub mod lease;