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(artifacts): vendor tiny-artifacts and wire versioned artifact tools
Sanil5957bfefd138
diff --git a/.gitmodules b/.gitmodulesindex 1a4b6bf600..789211baa6 100644--- a/.gitmodules+++ b/.gitmodules@@ -60,3 +60,6 @@[submodule "vendor/tinymemes"]path = vendor/tinymemesurl = https://github.com/tinyhumansai/tinymemes.git+[submodule "vendor/tiny-artifacts"]+ path = vendor/tiny-artifacts+ url = https://github.com/tinyhumansai/tiny-artifactsdiff --git a/Cargo.lock b/Cargo.lockindex a7245f8836..7a10a1cdbd 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -4579,6 +4579,7 @@ dependencies = ["tar","tempfile","thiserror 2.0.20",+ "tiny-artifacts","tinyagents-definition","tinyagents-graph","tinyagents-harness",@@ -7396,6 +7397,19 @@ dependencies = ["time-core",]+[[package]]+name = "tiny-artifacts"+version = "0.1.0"+dependencies = [+ "anyhow",+ "async-trait",+ "serde",+ "serde_json",+ "thiserror 2.0.20",+ "tinytools",+ "uuid",+]+[[package]]name = "tiny-keccak"version = "2.0.2"diff --git a/Cargo.toml b/Cargo.tomlindex a52d189cee..4822d17482 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -99,6 +99,7 @@ tinyinference-providers = { path = "vendor/tinyagents/vendor/tinyinference/cratetinyinference-voice = { path = "vendor/tinyagents/vendor/tinyinference/crates/tinyinference-voice" }tinyflows = { path = "vendor/tinyflows/crates/tinyflows" }tinychannels = { path = "vendor/tinychannels" }+tiny-artifacts = { path = "vendor/tiny-artifacts/crates/tiny-artifacts" }# Emit enough release DWARF for server-side Sentry symbolication while keeping# shipped binaries small. The CI profile deliberately disables LTO/debug info.diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.tomlindex d2b3b36159..8b89736f6d 100644--- a/crates/openhuman-core/Cargo.toml+++ b/crates/openhuman-core/Cargo.toml@@ -140,6 +140,7 @@ tinyagents-harness = { path = "../../vendor/tinyagents/crates/tinyagents-harness"builtin-tools",] }tinybox-bus = { path = "../../vendor/tinybox/crates/tinybox-bus" }+tiny-artifacts = { path = "../../vendor/tiny-artifacts/crates/tiny-artifacts" }tinyagents-definition = { path = "../../vendor/tinyagents/crates/tinyagents-definition" }# Live (realtime voice) agent sessions: `tinyagents-live` runs a# `tinyliveagents` provider session (Gemini Live direct/relayed, ElevenLabsdiff --git a/crates/openhuman-core/src/agent/artifacts/mod.rs b/crates/openhuman-core/src/agent/artifacts/mod.rsindex 4e1065bb3c..305fa9eb89 100644--- a/crates/openhuman-core/src/agent/artifacts/mod.rs+++ b/crates/openhuman-core/src/agent/artifacts/mod.rs@@ -4,6 +4,7 @@ pub mod ops;pub mod schemas;pub mod store;mod store_documents;+pub mod tiny_store;pub mod tools;pub mod types;diff --git a/crates/openhuman-core/src/agent/artifacts/tiny_store.rs b/crates/openhuman-core/src/agent/artifacts/tiny_store.rsnew file mode 100644index 0000000000..fa8799663c--- /dev/null+++ b/crates/openhuman-core/src/agent/artifacts/tiny_store.rs@@ -0,0 +1,129 @@+//! `ArtifactStore` implementation for OpenHuman: versioned artifacts live+//! under `<workspace>/artifacts/versioned/`.+//!+//! The crate `tiny-artifacts` defines the versioned model (`ArtifactRecord`,+//! `ArtifactVersion`, `ArtifactAuthor`) and the [`ArtifactStore`] trait; this+//! module provides OpenHuman's storage backend for it. Records are persisted+//! one file per artifact as `<root>/versioned/<id>.json`, outside the+//! legacy `meta.json` layout the one-shot producers use, so the two systems+//! coexist.++use std::path::{Path, PathBuf};+use std::sync::Arc;++use async_trait::async_trait;+use tiny_artifacts::{ArtifactRecord, ArtifactStore};++/// Subdirectory under the artifacts root holding versioned records.+const VERSIONED_SUBDIR: &str = "versioned";++/// The artifacts root, mirroring [`super::store::artifacts_root`]:+/// `<workspace_dir>/artifacts/`.+async fn root(workspace_dir: &Path) -> Result<PathBuf, String> {+ let root = workspace_dir.join("artifacts");+ tokio::fs::create_dir_all(&root)+ .await+ .map_err(|e| format!("[tiny-artifacts] failed to create artifacts root {:?}: {e}", root))?;+ Ok(root)+}++/// Reject ids that could escape the root as a path component.+fn validate_id(id: &str) -> Result<(), String> {+ if id.is_empty() {+ return Err("[tiny-artifacts] artifact id must not be empty".into());+ }+ if id == "." || id == ".." {+ return Err(format!("[tiny-artifacts] invalid artifact id: {id:?}"));+ }+ if id.contains('/') || id.contains('\\') {+ return Err(format!("[tiny-artifacts] artifact id must not contain path separators: {id:?}"));+ }+ if id.starts_with('/') || id.starts_with('\\') {+ return Err(format!("[tiny-artifacts] artifact id must not be absolute: {id:?}"));+ }+ Ok(())+}++/// OpenHuman's storage backend for the shared versioned artifact model.+///+/// Each record is stored whole (JSON) at `<workspace>/artifacts/versioned/<id>.json`.+pub struct FsArtifactStore {+ workspace_dir: PathBuf,+}++impl FsArtifactStore {+ /// Creates a store rooted at `workspace_dir`.+ pub fn new(workspace_dir: impl Into<PathBuf>) -> Self {+ Self { workspace_dir: workspace_dir.into() }+ }++ async fn record_path(&self, id: &str) -> Result<PathBuf, String> {+ validate_id(id)?;+ let root = root(&self.workspace_dir).await?;+ let dir = root.join(VERSIONED_SUBDIR);+ tokio::fs::create_dir_all(&dir)+ .await+ .map_err(|e| format!("[tiny-artifacts] failed to create versioned dir {:?}: {e}", dir))?;+ Ok(dir.join(format!("{id}.json")))+ }+}++#[async_trait]+impl ArtifactStore for FsArtifactStore {+ async fn list(&self) -> anyhow::Result<Vec<ArtifactRecord>> {+ let root = root(&self.workspace_dir).await.map_err(anyhow::Error::msg)?;+ let dir = root.join(VERSIONED_SUBDIR);+ let mut records = Vec::new();+ let mut entries = match tokio::fs::read_dir(&dir).await {+ Ok(e) => e,+ Err(_) => return Ok(records), // no versioned dir yet → nothing stored+ };+ while let Some(entry) = entries.next_entry().await? {+ let path = entry.path();+ if path.extension().and_then(|e| e.to_str()) != Some("json") {+ continue;+ }+ let bytes = tokio::fs::read(&path).await?;+ if let Ok(record) = serde_json::from_slice::<ArtifactRecord>(&bytes) {+ records.push(record);+ }+ }+ // Most-recently-updated first, mirroring the crate's documented order.+ records.sort_by(|a, b| b.updated_at_millis.cmp(&a.updated_at_millis));+ Ok(records)+ }++ async fn get(&self, id: &str) -> anyhow::Result<Option<ArtifactRecord>> {+ let path = self.record_path(id).await.map_err(anyhow::Error::msg)?;+ let bytes = match tokio::fs::read(&path).await {+ Ok(b) => b,+ Err(_) => return Ok(None),+ };+ let record = serde_json::from_slice(&bytes)?;+ Ok(Some(record))+ }++ async fn upsert(&self, artifact: &ArtifactRecord) -> anyhow::Result<()> {+ let path = self.record_path(&artifact.id).await.map_err(anyhow::Error::msg)?;+ let bytes = serde_json::to_vec(artifact)?;+ tokio::fs::write(&path, bytes).await?;+ Ok(())+ }++ async fn delete(&self, id: &str) -> anyhow::Result<bool> {+ let path = self.record_path(id).await.map_err(anyhow::Error::msg)?;+ match tokio::fs::remove_file(&path).await {+ Ok(()) => Ok(true),+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(false),+ Err(e) => Err(e.into()),+ }+ }+}++/// Build the versioned artifact tools bound to this store — the four tools in+/// the crate's catalogue order: `create_artifact`, `read_artifact`,+/// `update_artifact`, `list_artifacts`.+pub fn registered_tools(workspace_dir: &Path) -> Vec<Box<dyn tinytools::Tool>> {+ let store: Arc<dyn ArtifactStore> = Arc::new(FsArtifactStore::new(workspace_dir));+ tiny_artifacts::registered_tools(store)+}diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rsindex 0ec732fb89..e20ac3d9e9 100644--- a/crates/openhuman-core/src/tools/ops.rs+++ b/crates/openhuman-core/src/tools/ops.rs@@ -171,6 +171,9 @@ pub fn all_tools_with_runtime(tools.extend(crate::agent::artifacts::tools::registered_tools(config.clone(),));+ tools.extend(crate::agent::artifacts::tiny_store::registered_tools(+ &config.workspace_dir,+ ));tools.extend(crate::integrations::task_sources::tools::registered_tools(config.clone(),));diff --git a/vendor/tiny-artifacts b/vendor/tiny-artifactsnew file mode 160000index 0000000000..2a4495a6a7--- /dev/null+++ b/vendor/tiny-artifacts@@ -0,0 +1 @@+Subproject commit 2a4495a6a72a6130462fe19754daf02e884fbcd0