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(storage): add import markers to tiny connectors
Steven Enamakel0308786f21c6
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rsindex 119f2e06f4..9aba7f1e39 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs@@ -104,6 +104,10 @@ struct Legacy {}async fn import_into(ctx: &DispatchCtx, scoped: &Storage, state_dir: &Path) -> Result<Outcome> {+ let marker = support::marker_id("connectors", state_dir);+ if support::already_imported(scoped, MARKER_COLLECTION, &marker).await? {+ return Ok(Outcome::AlreadyDone);+ }let docs = scoped.documents();let prefs_dir = state_dir.join(PREFS_DIR);let triggers_dir = state_dir.join(TRIGGERS_DIR);@@ -139,6 +143,7 @@ async fn import_into(ctx: &DispatchCtx, scoped: &Storage, state_dir: &Path) -> Rtriggers += support::append_if_empty(scoped, &day.stream, day.records).await?;}+ support::mark_imported(scoped, MARKER_COLLECTION, &marker).await?;tracing::info!("{LOG_PREFIX} imported prefs={prefs} triggers={triggers} skipped={}",legacy.skippeddiff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rsindex b8d389c019..0f28a3a79c 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs@@ -107,6 +107,10 @@ async fn import_into(ttl: Option<Duration>,now: SystemTime,) -> Result<Outcome> {+ let marker = support::marker_id("ccr", root);+ if support::already_imported(scoped, MARKER_COLLECTION, &marker).await? {+ return Ok(Outcome::AlreadyDone);+ }if !root.is_dir() {return Ok(Outcome::NoSource);}@@ -156,6 +160,7 @@ async fn import_into(imported += 1;}+ support::mark_imported(scoped, MARKER_COLLECTION, &marker).await?;tracing::info!("{LOG_PREFIX} imported={imported} expired={expired} skipped={skipped}");Ok(Outcome::Imported {imported,diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rsindex 7dad421b34..9d83a8ab42 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs@@ -86,6 +86,10 @@ whereF: FnOnce(SavingsAggregate) -> Fut,Fut: Future<Output = Result<bool>>,{+ let marker = support::marker_id("savings", file);+ if support::already_imported(scoped, MARKER_KIND, &marker).await? {+ return Ok(Outcome::AlreadyDone);+ }if std::fs::symlink_metadata(file).is_err() {return Ok(Outcome::NoSource);}@@ -109,6 +113,7 @@ wherefalse}};+ support::mark_imported(scoped, MARKER_KIND, &marker).await?;log::debug!("{LOG_PREFIX} adopted={adopted}");Ok(Outcome::Imported { adopted })}diff --git a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs b/crates/openhuman-core/src/modules/storage_import_tinywallet.rsindex 0787fb8819..f7a0da3c83 100644--- a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinywallet.rs@@ -73,6 +73,10 @@ pub(crate) async fn import_legacy(ctx: &DispatchCtx, workspace_dir: &Path) -> Re}async fn import_into(ctx: &DispatchCtx, scoped: &Storage, workspace_dir: &Path) -> Result<Outcome> {+ let marker = support::marker_id("x402", workspace_dir);+ if support::already_imported(scoped, MARKER_COLLECTION, &marker).await? {+ return Ok(Outcome::AlreadyDone);+ }let ledger = workspace_dir.join(LEDGER_FILE);if !ledger.is_file() {return Ok(Outcome::NoSource);@@ -89,6 +93,7 @@ async fn import_into(ctx: &DispatchCtx, scoped: &Storage, workspace_dir: &Path)let payments = support::append_if_empty(scoped, PAYMENTS_STREAM, records).await.map_err(|error| anyhow!("import the payments: {error:#}"))?;+ support::mark_imported(scoped, MARKER_COLLECTION, &marker).await?;tracing::info!("{LOG_PREFIX} imported payments={payments} skipped={skipped}");Ok(Outcome::Imported { payments, skipped })}