Skip to content

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

refactor: migrate chunk type imports from tinymemory_core to tinymemory_api

Steven Enamakelf9c38e979890
diff --git a/src/openhuman/agent/harness/archivist/recap.rs b/src/openhuman/agent/harness/archivist/recap.rs
index 41f3021165..cabdab9d36 100644
--- a/src/openhuman/agent/harness/archivist/recap.rs
+++ b/src/openhuman/agent/harness/archivist/recap.rs
@@ -156,7 +156,7 @@ impl ArchivistHook {
.iter()
.filter(|e| !e.content.trim().is_empty())
.map(|e| {
- use tinymemory_core::store::chunks::types::approx_token_count;
+ use tinymemory_api::chunks::approx_token_count;
let content = e.content.clone();
let token_count = approx_token_count(&content);
let ts = chrono::DateTime::from_timestamp(e.timestamp as i64, 0)
diff --git a/src/openhuman/channels/controllers/ops/connect.rs b/src/openhuman/channels/controllers/ops/connect.rs
index 0d0e960a83..1e483c91f3 100644
--- a/src/openhuman/channels/controllers/ops/connect.rs
+++ b/src/openhuman/channels/controllers/ops/connect.rs
@@ -9,7 +9,7 @@ use crate::openhuman::config::{Config, DiscordConfig, IMessageConfig, TelegramCo
use crate::openhuman::security::credentials;
use crate::rpc::RpcOutcome;
use tinymemory_core::store::chunks::store as memory_tree_store;
-use tinymemory_core::store::chunks::types::SourceKind;
+use tinymemory_api::chunks::SourceKind;
use super::super::definitions::{
all_channel_definitions, find_channel_definition, ChannelAuthMode, ChannelDefinition,
diff --git a/src/openhuman/channels/controllers/ops_tests.rs b/src/openhuman/channels/controllers/ops_tests.rs
index 39bf5e9d08..06e2347146 100644
--- a/src/openhuman/channels/controllers/ops_tests.rs
+++ b/src/openhuman/channels/controllers/ops_tests.rs
@@ -5,7 +5,7 @@ use crate::openhuman::config::schema::{DiscordConfig, IMessageConfig};
use chrono::{TimeZone, Utc};
use tempfile::tempdir;
use tinymemory_core::store::chunks::store as memory_tree_store;
-use tinymemory_core::store::chunks::types::{chunk_id, Chunk, Metadata, SourceKind, SourceRef};
+use tinymemory_api::chunks::{chunk_id, Chunk, Metadata, SourceKind, SourceRef};
fn isolated_test_config() -> (tempfile::TempDir, Config) {
let tmp = tempdir().expect("failed to create temp dir");
diff --git a/src/openhuman/integrations/composio/ops/memory_cleanup.rs b/src/openhuman/integrations/composio/ops/memory_cleanup.rs
index 7a0712716d..58dde07dad 100644
--- a/src/openhuman/integrations/composio/ops/memory_cleanup.rs
+++ b/src/openhuman/integrations/composio/ops/memory_cleanup.rs
@@ -4,7 +4,7 @@ use std::sync::Arc;
use crate::openhuman::config::Config;
use tinymemory_core::store::chunks::store as memory_tree_store;
-use tinymemory_core::store::chunks::types::SourceKind;
+use tinymemory_api::chunks::SourceKind;
use tinymemory_core::store::MemoryClientRef;
#[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/src/openhuman/integrations/composio/ops_tests.rs b/src/openhuman/integrations/composio/ops_tests.rs
index af966d5378..f288b110af 100644
--- a/src/openhuman/integrations/composio/ops_tests.rs
+++ b/src/openhuman/integrations/composio/ops_tests.rs
@@ -241,7 +241,7 @@ use chrono::{TimeZone, Utc};
use serde_json::{json, Value};
use std::collections::HashMap;
use tinymemory_core::store::chunks::store as memory_tree_store;
-use tinymemory_core::store::chunks::types::{chunk_id, Chunk, Metadata, SourceKind, SourceRef};
+use tinymemory_api::chunks::{chunk_id, Chunk, Metadata, SourceKind, SourceRef};
struct WorkspaceEnvGuard {
previous: Option<std::ffi::OsString>,
diff --git a/src/openhuman/memory/query/ingest_document.rs b/src/openhuman/memory/query/ingest_document.rs
index fb510521ee..8abb6058d9 100644
--- a/src/openhuman/memory/query/ingest_document.rs
+++ b/src/openhuman/memory/query/ingest_document.rs
@@ -5,7 +5,7 @@ use async_trait::async_trait;
use chrono::Utc;
use serde_json::json;
use tinycortex::memory::ingest::canonicalize::document::DocumentInput;
-use tinymemory_core::store::chunks::types::SourceKind;
+use tinymemory_api::chunks::SourceKind;
pub struct MemoryTreeIngestDocumentTool;
@@ -151,7 +151,7 @@ mod tests {
use crate::openhuman::config::TEST_ENV_LOCK;
use crate::openhuman::tools::traits::Tool;
use serde_json::json;
- use tinymemory_core::store::chunks::types::SourceRef;
+ use tinymemory_api::chunks::SourceRef;
struct WorkspaceEnvGuard {
_lock: std::sync::MutexGuard<'static, ()>,
diff --git a/src/openhuman/memory/read_rpc/admin.rs b/src/openhuman/memory/read_rpc/admin.rs
index ad77cc38a3..bb58bcabdd 100644
--- a/src/openhuman/memory/read_rpc/admin.rs
+++ b/src/openhuman/memory/read_rpc/admin.rs
@@ -6,7 +6,7 @@ use crate::rpc::RpcOutcome;
use tinymemory_core::store::chunks::store::{
delete_chunks_by_source, delete_orphaned_source_tree, with_connection,
};
-use tinymemory_core::store::chunks::types::SourceKind;
+use tinymemory_api::chunks::SourceKind;
use super::types::{
DeleteSourceResponse, FlushNowResponse, FlushSourceTreeResponse, ResetTreeResponse,
diff --git a/src/openhuman/memory/read_rpc/mod.rs b/src/openhuman/memory/read_rpc/mod.rs
index 623d26d534..dd53cfe4b9 100644
--- a/src/openhuman/memory/read_rpc/mod.rs
+++ b/src/openhuman/memory/read_rpc/mod.rs
@@ -42,8 +42,8 @@ pub use vault::{obsidian_vault_status_rpc, vault_health_check_rpc};
#[allow(dead_code)]
pub(crate) fn parse_source_kind_str(
s: &str,
-) -> Option<tinymemory_core::store::chunks::types::SourceKind> {
- tinymemory_core::store::chunks::types::SourceKind::parse(s).ok()
+) -> Option<tinymemory_api::chunks::SourceKind> {
+ tinymemory_api::chunks::SourceKind::parse(s).ok()
}
#[cfg(test)]
@@ -53,7 +53,7 @@ pub(crate) use admin::clear_composio_sync_state;
#[cfg(test)]
pub(crate) use tinymemory_core::store::chunks::store::with_connection;
#[cfg(test)]
-pub(crate) use tinymemory_core::store::chunks::types::SourceKind;
+pub(crate) use tinymemory_api::chunks::SourceKind;
#[cfg(test)]
#[path = "../read_rpc_tests.rs"]
diff --git a/src/openhuman/memory/read_rpc/types.rs b/src/openhuman/memory/read_rpc/types.rs
index b946181608..5dec650fb9 100644
--- a/src/openhuman/memory/read_rpc/types.rs
+++ b/src/openhuman/memory/read_rpc/types.rs
@@ -6,7 +6,7 @@ pub const MAX_LIST_LIMIT: u32 = 1_000;
/// Wire-shape chunk returned by the read RPCs.
///
-/// Distinct from [`tinymemory_core::store::chunks::types::Chunk`] in two
+/// Distinct from [`tinymemory_api::chunks::Chunk`] in two
/// ways: serialised timestamps are ms-since-epoch (matches the rest of the
/// JSON-RPC surface) and the body is replaced with a `≤500-char preview`
/// + a flag indicating whether the row has an embedding. UIs needing the
diff --git a/src/openhuman/memory/read_rpc_tests.rs b/src/openhuman/memory/read_rpc_tests.rs
index 156e03b700..54b1ce70a3 100644
--- a/src/openhuman/memory/read_rpc_tests.rs
+++ b/src/openhuman/memory/read_rpc_tests.rs
@@ -1011,7 +1011,7 @@ async fn vault_health_check_reports_writable_and_obsidian_registered_when_ready(
#[tokio::test]
async fn wipe_all_clears_ingest_gate() {
use tinymemory_core::store::chunks::store as chunk_store;
- use tinymemory_core::store::chunks::types::SourceKind;
+ use tinymemory_api::chunks::SourceKind;
let (_tmp, cfg) = test_config();
let gate_key = "notion:conn-1:page-abc@1700000000000";
diff --git a/src/openhuman/memory/store_golden.rs b/src/openhuman/memory/store_golden.rs
index f3f1a9c226..94c9d419d4 100644
--- a/src/openhuman/memory/store_golden.rs
+++ b/src/openhuman/memory/store_golden.rs
@@ -50,7 +50,7 @@ use crate::openhuman::memory::ops::{
};
use tinymemory_core::rpc_models::QueryNamespaceRequest;
use tinymemory_core::store::chunks;
-use tinymemory_core::store::chunks::types::{Chunk, Metadata, SourceKind, SourceRef};
+use tinymemory_api::chunks::{Chunk, Metadata, SourceKind, SourceRef};
use tinymemory_core::store::namespace_store::{events, fts5, profile, segments};
use tinymemory_core::store::trees;
use tinymemory_core::store::trees::types::{SummaryNode, Tree, TreeKind, TreeStatus};
diff --git a/src/openhuman/memory/tree/retrieval/rpc.rs b/src/openhuman/memory/tree/retrieval/rpc.rs
index 2c1836057a..55953731ce 100644
--- a/src/openhuman/memory/tree/retrieval/rpc.rs
+++ b/src/openhuman/memory/tree/retrieval/rpc.rs
@@ -19,7 +19,7 @@ use crate::openhuman::memory::tree::retrieval::{
};
use crate::openhuman::memory::tree::score::extract::EntityKind;
use crate::rpc::RpcOutcome;
-use tinymemory_core::store::chunks::types::SourceKind;
+use tinymemory_api::chunks::SourceKind;
// ── query_source ──────────────────────────────────────────────────────
@@ -320,7 +320,7 @@ mod tests {
use chrono::{TimeZone, Utc};
use tempfile::TempDir;
use tinymemory_core::store::chunks::store::upsert_chunks;
- use tinymemory_core::store::chunks::types::{chunk_id, Chunk, Metadata, SourceRef};
+ use tinymemory_api::chunks::{chunk_id, Chunk, Metadata, SourceRef};
use tinymemory_core::store::content as content_store;
fn stage_test_chunks(cfg: &Config, chunks: &[Chunk]) {
diff --git a/src/openhuman/memory/tree/tree/rpc.rs b/src/openhuman/memory/tree/tree/rpc.rs
index c9d6353f0d..31d26dbd30 100644
--- a/src/openhuman/memory/tree/tree/rpc.rs
+++ b/src/openhuman/memory/tree/tree/rpc.rs
@@ -21,7 +21,7 @@ use tinymemory_core::ingest_pipeline::{
ingest_email as do_ingest_email, IngestResult,
};
use tinymemory_core::store::chunks::store::{self as chunk_store, ListChunksQuery};
-use tinymemory_core::store::chunks::types::{Chunk, SourceKind};
+use tinymemory_api::chunks::{Chunk, SourceKind};
/// Unified ingest request. The `payload` shape is adapter-specific and is
/// validated inside the dispatch based on `source_kind`.
@@ -1106,7 +1106,7 @@ mod tests {
use tempfile::TempDir;
use tinycortex::memory::ingest::canonicalize::document::DocumentInput;
use tinymemory_core::queue as jobs;
- use tinymemory_core::store::chunks::types::SourceKind;
+ use tinymemory_api::chunks::SourceKind;
fn test_config() -> (TempDir, Config) {
let tmp = TempDir::new().unwrap();
diff --git a/src/openhuman/memory/tree_e2e_tests.rs b/src/openhuman/memory/tree_e2e_tests.rs
index d69c218737..09886e2aca 100644
--- a/src/openhuman/memory/tree_e2e_tests.rs
+++ b/src/openhuman/memory/tree_e2e_tests.rs
@@ -148,7 +148,7 @@ async fn full_pipeline_ingest_to_retrieval() {
// query_source returns summaries from sealed source trees. With
// enough chunks the seal fires and we expect at least one hit.
// Both sources are Chat kind.
- use tinymemory_core::store::chunks::types::SourceKind;
+ use tinymemory_api::chunks::SourceKind;
let source_resp = query_source(&cfg, None, Some(SourceKind::Chat), None, None, 20)
.await
.expect("query_source on Chat kind must succeed");
@@ -258,7 +258,7 @@ async fn pipeline_works_with_embeddings_disabled() {
.expect("drain_until_idle must succeed with embeddings disabled");
// ── Source-tree retrieval without a query (recency only) ─────────
- use tinymemory_core::store::chunks::types::SourceKind;
+ use tinymemory_api::chunks::SourceKind;
let recency_resp = query_source(&cfg, None, Some(SourceKind::Chat), None, None, 20)
.await
.expect("query_source (recency) must succeed with embeddings disabled");
diff --git a/src/openhuman/security/credentials/ops_tests.rs b/src/openhuman/security/credentials/ops_tests.rs
index a068769e7a..6439cb7066 100644
--- a/src/openhuman/security/credentials/ops_tests.rs
+++ b/src/openhuman/security/credentials/ops_tests.rs
@@ -434,7 +434,7 @@ fn auth_me_store_validation_budget_reads_env_override() {
async fn store_session_requeues_reembed_backfill_after_login() {
use chrono::TimeZone;
use tinymemory_core::store::chunks::store::{upsert_chunks, upsert_staged_chunks_tx};
- use tinymemory_core::store::chunks::types::{chunk_id, Chunk, Metadata, SourceKind, SourceRef};
+ use tinymemory_api::chunks::{chunk_id, Chunk, Metadata, SourceKind, SourceRef};
use tinymemory_core::store::content as content_store;
let _env_guard = crate::openhuman::config::TEST_ENV_LOCK