Skip to content

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

refactor(artifacts): update artifact preview and storage logic

Steven Enamakel2442ac0d245c
diff --git a/crates/openhuman-core/src/artifacts/preview.rs b/crates/openhuman-core/src/artifacts/preview.rs
index 1f75ab9ad0..c13a7c5143 100644
--- a/crates/openhuman-core/src/artifacts/preview.rs
+++ b/crates/openhuman-core/src/artifacts/preview.rs
@@ -5,12 +5,11 @@
//! runs where the artifact lives.
//!
//! * Text kinds (`text`, `markdown`, `html`) return their stored content.
-//! * A file or image version is opened only when its path is inside the
-//! folders file artifacts may point into (the agent's working folder and the
-//! files folders), and only up to [`PREVIEW_MAX_BYTES`]. A UTF-8 file comes
-//! back as text; a DOCX, PPTX, XLSX or PDF is converted to Markdown through
-//! the TinyDocs module. Anything else comes back as its path, for the panel
-//! to show as a file.
+//! * File and image bytes are read from the acting tenant's scoped artifact
+//! store, and only up to [`PREVIEW_MAX_BYTES`]. Legacy path references are
+//! imported through the host's guarded file roots. A UTF-8 file comes back
+//! as text; a DOCX, PPTX, XLSX or PDF is converted to Markdown through the
+//! TinyDocs module. Anything else comes back as its visible file path.
use std::path::Path;
@@ -192,8 +191,7 @@ impl<'a> DocumentConverter<'a> {
}
}
-/// The preview of `record`'s newest version, opening files only inside
-/// `roots`.
+/// The preview of `record`'s newest version, reading file bytes by storage key.
pub(crate) async fn body_of(
record: &ArtifactRecord,
file_store: Option<&std::sync::Arc<dyn FileStore>>,
diff --git a/crates/openhuman-core/src/artifacts/tiny_store.rs b/crates/openhuman-core/src/artifacts/tiny_store.rs
index b9a5d24bba..ee81937671 100644
--- a/crates/openhuman-core/src/artifacts/tiny_store.rs
+++ b/crates/openhuman-core/src/artifacts/tiny_store.rs
@@ -6,6 +6,7 @@
//!
//! * [`versioned_store`] — the records, in the configured storage backend
//! ([`super::version_documents::DocumentArtifactStore`]);
+//! * the acting tenant's scoped blob store as TinyArtifacts' file store;
//! * [`LegacyUiBridge`] — the observer that shows each artifact in the
//! desktop UI;
//! * the folders file artifacts may point into: the agent's working folder
@@ -411,8 +412,8 @@ pub fn artifacts_service(
}
/// Where each file version keeps its own copy:
-/// `<workspace>/artifacts/versioned/files/<id>/v<N>.<ext>`. The visible file
-/// in the files folder shows the newest version.
+/// Legacy workspace folder that earlier builds used for per-version file
+/// copies. New file bytes live in the acting tenant's scoped blob store.
pub fn version_files_dir(workspace_dir: &Path) -> PathBuf {
workspace_dir
.join("artifacts")