|
1 | 1 | //! Stable public contracts for the TinyMemory memory system. |
2 | 2 | //! |
3 | | -//! This crate holds the value types, error enum, capability vocabulary, and |
4 | | -//! storage trait that memory engines and their embedding hosts compile |
5 | | -//! against. It is engine-neutral on purpose: `tinycortex` is the default |
6 | | -//! embedded engine, not the owner of the contract, and a second engine |
7 | | -//! (`supermemory`, `mem0`, a self-hosted HTTP backend) implements the same |
8 | | -//! traits without either engine learning about the other. |
9 | | -//! It is deliberately dependency-light (serde / serde_json / |
10 | | -//! chrono / sha2 / anyhow / thiserror / async-trait / uuid only) so depending on |
11 | | -//! the contract never drags in SQLite, git2, reqwest, regex, or an async |
12 | | -//! runtime. |
| 3 | +//! This crate holds the traits a memory engine implements, the host seam it is |
| 4 | +//! bound through, and — re-exported from [`tinymemory_bus`] — the value types, |
| 5 | +//! error enum and capability vocabulary they exchange. It is engine-neutral on |
| 6 | +//! purpose: `tinycortex` is the default embedded engine, not the owner of the |
| 7 | +//! contract, and a second engine (`supermemory`, `mem0`, a self-hosted HTTP |
| 8 | +//! backend) implements the same traits without either engine learning about the |
| 9 | +//! other. It is deliberately dependency-light (serde / serde_json / anyhow / |
| 10 | +//! async-trait / schemars / log, plus `tinymemory-bus`) so depending on the |
| 11 | +//! contract never drags in SQLite, git2, reqwest, regex, or an async runtime. |
| 12 | +//! |
| 13 | +//! ## The vocabulary lives one layer down |
| 14 | +//! |
| 15 | +//! Every payload type is defined in [`tinymemory_bus`] and re-exported here at |
| 16 | +//! its historical path, so `tinymemory_api::types::MemoryEntry` is the *same |
| 17 | +//! item* as `tinymemory_bus::types::MemoryEntry`, not a structural twin. |
| 18 | +//! |
| 19 | +//! The split follows what a consumer actually needs. A **driver author** |
| 20 | +//! implements [`provider::MemoryProvider`] and wants this crate: traits, the |
| 21 | +//! null driver, the mandatory composition, the [`host`] seam. A **host** loads |
| 22 | +//! `tinymemory-module` over `TinyBus` and only makes calls — it names |
| 23 | +//! `MemoryEntry` and `MemoryCategory` and implements nothing — so it depends on |
| 24 | +//! `tinymemory-bus` alone and compiles none of this. |
| 25 | +//! |
| 26 | +//! Defining a second set of payload types for that host was the alternative, |
| 27 | +//! and it is the failure the root manifest's `[patch]` table exists to prevent: |
| 28 | +//! `MemoryCategory` from the module would not be `MemoryCategory` in the host, |
| 29 | +//! with a conversion at every call site that nothing type-checks. |
13 | 30 | //! |
14 | 31 | //! ## Self-contained by design |
15 | 32 | //! |
|
0 commit comments