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
refactor(threads): centralize storage collection names
Steven Enamakel821dc195e1b8
diff --git a/crates/openhuman-core/src/threads/attachments/staged.rs b/crates/openhuman-core/src/threads/attachments/staged.rsindex 54e650c021..4d34265447 100644--- a/crates/openhuman-core/src/threads/attachments/staged.rs+++ b/crates/openhuman-core/src/threads/attachments/staged.rs@@ -25,7 +25,7 @@ pub(super) struct StagedAttachmentClaim {}pub(super) const STAGED_DOMAIN: &str = "threads::attachments";-pub(super) const STAGED_COLLECTION: &str = "staged_thread_attachments";+pub(super) const STAGED_COLLECTION: &str = crate::threads::store::storage_schema::STAGED_ATTACHMENTS;pub(super) const STAGED_TTL_SECS: i64 = 7 * 24 * 60 * 60;pub(super) fn staged_doc_id(opaque_id: &str) -> Result<String, String> {diff --git a/crates/openhuman-core/src/threads/channel_projection.rs b/crates/openhuman-core/src/threads/channel_projection.rsindex f6e7c48c36..3543b48dea 100644--- a/crates/openhuman-core/src/threads/channel_projection.rs+++ b/crates/openhuman-core/src/threads/channel_projection.rs@@ -21,7 +21,7 @@ use crate::storage::{};const DOMAIN: &str = "threads::channel_projection";-const COLLECTION: &str = "thread_channel_messages";+const COLLECTION: &str = super::store::storage_schema::CHANNEL_MESSAGES;const LOG_PREFIX: &str = "[threads:channel-projection]";#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]diff --git a/crates/openhuman-core/src/threads/store/storage_schema.rs b/crates/openhuman-core/src/threads/store/storage_schema.rsindex 503a776bcb..2930098a5d 100644--- a/crates/openhuman-core/src/threads/store/storage_schema.rs+++ b/crates/openhuman-core/src/threads/store/storage_schema.rs@@ -16,6 +16,9 @@ use tinystoragedrivers::{CollectionSpec, Result};use crate::storage::schema_support::{key_of, owner};pub(super) const TRANSCRIPT_KEYS: &str = "threads.transcript_keys";+pub(super) const CHANNEL_MESSAGES: &str = "threads.channel_messages";+pub(super) const STAGED_ATTACHMENTS: &str = "threads.staged_attachments";+pub(super) const REPLY_VISEME_TIMELINES: &str = "threads.reply_viseme_timelines";pub(super) const LEGACY_TRANSCRIPT_KEYS: &str = "threads_transcript_keys";const SCHEMA: u32 = 2;@@ -24,6 +27,21 @@ const SCHEMA: u32 = 2;pub fn storage_schema() -> Schema {Schema::new(owner("threads")).collection_with(SCHEMA, spec(), ScopeClass::Tenant)+ .collection_with(+ SCHEMA,+ CollectionSpec::new(CHANNEL_MESSAGES),+ ScopeClass::Tenant,+ )+ .collection_with(+ SCHEMA,+ CollectionSpec::new(STAGED_ATTACHMENTS),+ ScopeClass::Agent,+ )+ .collection_with(+ SCHEMA,+ CollectionSpec::new(REPLY_VISEME_TIMELINES),+ ScopeClass::Agent,+ ).step(Step::new("transcript_keys_v2",diff --git a/crates/openhuman-core/src/threads/store/storage_schema_tests.rs b/crates/openhuman-core/src/threads/store/storage_schema_tests.rsindex 5b882c8c2f..09132d01e8 100644--- a/crates/openhuman-core/src/threads/store/storage_schema_tests.rs+++ b/crates/openhuman-core/src/threads/store/storage_schema_tests.rs@@ -1,5 +1,6 @@use super::*;use serde_json::{json, Value};+use tinystoragedrivers::schema::ScopeClass;use tinystoragedrivers::Meta;#[test]@@ -15,6 +16,24 @@ fn a_recorded_key_moves_under_the_threads_owner_keeping_its_body() {assert_eq!(out[0].body, json!({ "key": "profile~agent" }) as Value);}+#[test]+fn channel_attachment_and_viseme_records_are_declared_in_the_threads_owner() {+ let schema = storage_schema();+ for (name, scope) in [+ (CHANNEL_MESSAGES, ScopeClass::Tenant),+ (STAGED_ATTACHMENTS, ScopeClass::Agent),+ (REPLY_VISEME_TIMELINES, ScopeClass::Agent),+ ] {+ assert!(+ schema+ .items+ .iter()+ .any(|item| item.name() == name && item.scope() == scope),+ "missing {name} collection with {scope:?} scope"+ );+ }+}+#[test]fn the_schema_composes_under_its_owner() {tinystoragedrivers::schema::Registry::compose([storage_schema()]).unwrap();diff --git a/crates/openhuman-core/src/web_chat/voice_notes.rs b/crates/openhuman-core/src/web_chat/voice_notes.rsindex 5c5b785c3f..25a9f9e6ce 100644--- a/crates/openhuman-core/src/web_chat/voice_notes.rs+++ b/crates/openhuman-core/src/web_chat/voice_notes.rs@@ -51,7 +51,7 @@ fn viseme_repo(ctx: &crate::core::runtime::DispatchCtx, workspace: &Path) -> Res}const VISEME_DOMAIN: &str = "web_chat::voice_notes";-const VISEME_COLLECTION: &str = "reply_viseme_timelines";+const VISEME_COLLECTION: &str = crate::threads::store::storage_schema::REPLY_VISEME_TIMELINES;/// Largest note the store accepts (decoded bytes).pub(crate) const MAX_NOTE_BYTES: usize = 25 * 1024 * 1024;