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(config): read current document version before writing
Steven Enamakelb99890eb4d81
diff --git a/crates/openhuman-core/src/config/schema/load/source/document.rs b/crates/openhuman-core/src/config/schema/load/source/document.rsindex fcba50cfc9..cde4213e5e 100644--- a/crates/openhuman-core/src/config/schema/load/source/document.rs+++ b/crates/openhuman-core/src/config/schema/load/source/document.rs@@ -59,6 +59,22 @@ impl DocumentConfigSource {.map_err(|error| anyhow!("no data key for the config document: {error}"))}+ /// Read the current document revision for callers that intentionally+ /// replace the latest value rather than saving a previously loaded config+ /// snapshot. `Config::save` uses the revision captured at load time.+ async fn current_version(&self) -> Result<Option<tinystoragedrivers::Version>> {+ self.docs+ .ensure_collection(&CollectionSpec::new(CONFIG_COLLECTION))+ .await+ .context("declare the config collection")?;+ let stored = self+ .docs+ .get(CONFIG_COLLECTION, &document_id(self.scope.as_str())?)+ .await+ .context("read the config document")?;+ Ok(stored.map(|versioned| versioned.version))+ }+/// The local file's text for its bootstrap tables.////// When the file read had to recover (non-UTF-8 content renamed aside, the@@ -184,7 +200,8 @@ impl ConfigSource for DocumentConfigSource {}async fn write(&self, toml: &str) -> Result<()> {- self.write_versioned(toml, None).await?;+ let current_version = self.current_version().await?;+ self.write_versioned(toml, current_version).await?;Ok(())}