Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
# `sync` is the engine-neutral Composio normalisers (issue #18 §B3).
members = [".", "api", "core", "sync", "adapters/tinycortex", "adapters/remote", "conformance"]
default-members = [".", "api", "core", "sync", "adapters/tinycortex", "adapters/remote", "conformance"]
members = [".", "api", "core", "sync", "sources", "adapters/tinycortex", "adapters/remote", "conformance"]
default-members = [".", "api", "core", "sync", "sources", "adapters/tinycortex", "adapters/remote", "conformance"]
# `vendor/` holds engine submodules (tinycortex, tinybus, tinyagents), each of
# which is its own workspace with its own lockfile. Same exclusion
# `vendor/tinycortex` uses for its own nested vendor directory.
Expand Down
4 changes: 4 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ tinymemory-api = { path = "../api" }
# different engine could not have Composio sync despite none of this code
# caring which engine is bound.
tinymemory-sync = { path = "../sync" }
# The memory-source contracts and readers (#18 §B4). `network` because this
# crate's sync path drives the GitHub/RSS/web-page readers; a host that only
# reads local folders can take the crate without them.
tinymemory-sources = { path = "../sources", features = ["network"] }

# The default embedded engine. `store/`, `tree/` and `sync/` drive it directly;
# `tinycortex-api` is a direct dependency because `tinycortex::memory` aliases
Expand Down
14 changes: 7 additions & 7 deletions core/src/sources/readers/conversation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Product `Config` adapter for the tinycortex conversation reader.
//! Product `Config` adapter for the engine-neutral conversation reader.

use async_trait::async_trait;

Expand All @@ -19,10 +19,10 @@ impl SourceReader for ConversationReader {
source: &MemorySourceEntry,
config: &Config,
) -> Result<Vec<SourceItem>, String> {
crate::engine::backend::sources::SourceReader::list_items(
&crate::engine::backend::sources::readers::conversation::ConversationReader,
tinymemory_sources::readers::SourceReader::list_items(
&tinymemory_sources::readers::conversation::ConversationReader,
source,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand All @@ -34,11 +34,11 @@ impl SourceReader for ConversationReader {
item_id: &str,
config: &Config,
) -> Result<SourceContent, String> {
crate::engine::backend::sources::SourceReader::read_item(
&crate::engine::backend::sources::readers::conversation::ConversationReader,
tinymemory_sources::readers::SourceReader::read_item(
&tinymemory_sources::readers::conversation::ConversationReader,
source,
item_id,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand Down
14 changes: 7 additions & 7 deletions core/src/sources/readers/folder.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Product `Config` adapter for the tinycortex folder reader.
//! Product `Config` adapter for the engine-neutral folder reader.

use async_trait::async_trait;

Expand All @@ -19,10 +19,10 @@ impl SourceReader for FolderReader {
source: &MemorySourceEntry,
config: &Config,
) -> Result<Vec<SourceItem>, String> {
crate::engine::backend::sources::SourceReader::list_items(
&crate::engine::backend::sources::readers::folder::FolderReader,
tinymemory_sources::readers::SourceReader::list_items(
&tinymemory_sources::readers::folder::FolderReader,
source,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand All @@ -34,11 +34,11 @@ impl SourceReader for FolderReader {
item_id: &str,
config: &Config,
) -> Result<SourceContent, String> {
crate::engine::backend::sources::SourceReader::read_item(
&crate::engine::backend::sources::readers::folder::FolderReader,
tinymemory_sources::readers::SourceReader::read_item(
&tinymemory_sources::readers::folder::FolderReader,
source,
item_id,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand Down
18 changes: 8 additions & 10 deletions core/src/sources/readers/github.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Product `Config` adapter for the tinycortex GitHub repo reader.
//! Product `Config` adapter for the engine-neutral GitHub repo reader.
//!
//! The reader itself — commit/issue/PR fetching over `gh`, `git`, and the
//! public REST API — lives in the engine. This module keeps the host-side
Expand All @@ -12,9 +12,7 @@ use crate::sources::readers::SourceReader;
use crate::sources::types::{MemorySourceEntry, SourceContent, SourceItem, SourceKind};
use crate::Config;

pub use crate::engine::backend::sources::readers::github::{
repo_archive_source_id, repo_chunk_scope,
};
pub use tinymemory_sources::readers::github::{repo_archive_source_id, repo_chunk_scope};

pub struct GithubReader;

Expand All @@ -29,10 +27,10 @@ impl SourceReader for GithubReader {
source: &MemorySourceEntry,
config: &Config,
) -> Result<Vec<SourceItem>, String> {
crate::engine::backend::sources::SourceReader::list_items(
&crate::engine::backend::sources::readers::github::GithubReader,
tinymemory_sources::readers::SourceReader::list_items(
&tinymemory_sources::readers::github::GithubReader,
source,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand All @@ -44,11 +42,11 @@ impl SourceReader for GithubReader {
item_id: &str,
config: &Config,
) -> Result<SourceContent, String> {
crate::engine::backend::sources::SourceReader::read_item(
&crate::engine::backend::sources::readers::github::GithubReader,
tinymemory_sources::readers::SourceReader::read_item(
&tinymemory_sources::readers::github::GithubReader,
source,
item_id,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand Down
14 changes: 7 additions & 7 deletions core/src/sources/readers/rss.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Product `Config` adapter for the tinycortex RSS/Atom feed reader.
//! Product `Config` adapter for the engine-neutral RSS/Atom feed reader.

use async_trait::async_trait;

Expand All @@ -12,13 +12,13 @@ use crate::Config;
/// `read_item`, so constructing it per trait call would turn one sync into
/// N+1 downloads.
pub struct RssReader {
inner: crate::engine::backend::sources::readers::rss::RssReader,
inner: tinymemory_sources::readers::rss::RssReader,
}

impl RssReader {
pub fn new() -> Self {
Self {
inner: crate::engine::backend::sources::readers::rss::RssReader::new(),
inner: tinymemory_sources::readers::rss::RssReader::new(),
}
}
}
Expand All @@ -40,10 +40,10 @@ impl SourceReader for RssReader {
source: &MemorySourceEntry,
config: &Config,
) -> Result<Vec<SourceItem>, String> {
crate::engine::backend::sources::SourceReader::list_items(
tinymemory_sources::readers::SourceReader::list_items(
&self.inner,
source,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand All @@ -55,11 +55,11 @@ impl SourceReader for RssReader {
item_id: &str,
config: &Config,
) -> Result<SourceContent, String> {
crate::engine::backend::sources::SourceReader::read_item(
tinymemory_sources::readers::SourceReader::read_item(
&self.inner,
source,
item_id,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand Down
17 changes: 10 additions & 7 deletions core/src/sources/readers/web_page.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//! Product `Config` adapter for the tinycortex single-page web reader.
//! Product `Config` adapter for the engine-neutral single-page web reader.
//!
//! The reader itself lives in `tinymemory-sources` (#18 §B4); this adapts the
//! host's `Config` to the workspace path it takes.

use async_trait::async_trait;

Expand All @@ -19,10 +22,10 @@ impl SourceReader for WebPageReader {
source: &MemorySourceEntry,
config: &Config,
) -> Result<Vec<SourceItem>, String> {
crate::engine::backend::sources::SourceReader::list_items(
&crate::engine::backend::sources::readers::web_page::WebPageReader,
tinymemory_sources::readers::SourceReader::list_items(
&tinymemory_sources::readers::web_page::WebPageReader,
source,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand All @@ -34,11 +37,11 @@ impl SourceReader for WebPageReader {
item_id: &str,
config: &Config,
) -> Result<SourceContent, String> {
crate::engine::backend::sources::SourceReader::read_item(
&crate::engine::backend::sources::readers::web_page::WebPageReader,
tinymemory_sources::readers::SourceReader::read_item(
&tinymemory_sources::readers::web_page::WebPageReader,
source,
item_id,
&crate::engine::memory_config_from(config, config.workspace_dir().clone()),
config.workspace_dir(),
)
.await
.map_err(|error| error.to_string())
Expand Down
13 changes: 8 additions & 5 deletions core/src/sources/registry.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
//! Product config discovery and locking around tinycortex source registry CRUD.
//! Product config discovery and locking around the source registry's CRUD.
//!
//! The registry itself moved to `tinymemory-sources` (#18 §B4); this layer adds
//! the host's config path and the lock that serialises writes to it.

use std::sync::OnceLock;

use crate::config_loader as config_rpc;
use crate::sources::types::{MemorySourceEntry, SourceKind};

pub use crate::engine::backend::sources::{
pub use tinymemory_sources::{
memory_sync_defaults_for_toolkit, ComposioUpsertTarget, MemorySourcePatch,
};

Expand All @@ -18,9 +21,9 @@ pub(crate) async fn memory_sources_write_guard() -> tokio::sync::MutexGuard<'sta
.await
}

async fn registry() -> Result<crate::engine::backend::sources::SourceRegistry, String> {
async fn registry() -> Result<tinymemory_sources::registry::SourceRegistry, String> {
let config = config_rpc::load_config_with_timeout().await?;
Ok(crate::engine::backend::sources::SourceRegistry::new(
Ok(tinymemory_sources::registry::SourceRegistry::new(
config.config_path(),
))
}
Expand Down Expand Up @@ -59,7 +62,7 @@ pub fn get_source_in(
config: &crate::Config,
id: &str,
) -> Result<Option<MemorySourceEntry>, String> {
crate::engine::backend::sources::SourceRegistry::new(config.config_path().clone())
tinymemory_sources::registry::SourceRegistry::new(config.config_path().clone())
.get(id)
.map_err(|error| error.to_string())
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/sources/sync.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Per-source sync dispatcher.
//!
//! Thin routing layer: dispatches supported sources through tinycortex and
//! Thin routing layer: dispatches supported sources through the engine and
//! retains the product-owned background lock, events, and reconcile shell.
//! - Twitter → placeholder
//!
Expand Down Expand Up @@ -382,7 +382,7 @@ pub fn derive_scopes(source: &MemorySourceEntry, config: &Config) -> Vec<SourceS
mod tests {
use super::*;

/// The two GitHub coordinate helpers are re-exported from tinycortex and
/// The two GitHub coordinate helpers are re-exported from `tinymemory-sources` and
/// they deliberately differ: `tree_scope` slugifies to
/// `github-tinyhumansai-openhuman` while `archive_source_id` slugifies to
/// `github-com-tinyhumansai-openhuman`. Swapping the two still compiles and
Expand Down
16 changes: 12 additions & 4 deletions core/src/sources/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
//! Stable host path for tinycortex-owned memory-source contracts.

pub use crate::engine::backend::sources::{
ContentType, MemorySourceEntry, SourceContent, SourceItem, SourceKind,
//! The memory-source contracts, from the engine-neutral crate that owns them.
//!
//! Issue #18 §B4. These were re-exported from `crate::engine::backend::sources`,
//! so the shapes a reader exchanged were the *engine's* — a host binding a
//! different driver could not describe a source at all. They live in
//! `tinymemory-sources` now, which names no engine.
//!
//! Still a re-export, deliberately: `crate::sources::types::SourceKind` is the
//! path ~150 call sites in this crate and 24 in OpenHuman already use, and the
//! move delivers the decoupling without spending that churn.
pub use tinymemory_sources::{
ContentType, MemorySourceEntry, MemorySourcePatch, SourceContent, SourceItem, SourceKind,
};
Loading
Loading