Skip to main content

kmp_memory_api/
lib.rs

1//! The published consumer contract of the embedded Rehydration Kernel.
2//!
3//! Sibling of `kmp-plugin-api`, pointing the other way: that crate is
4//! what a plugin may know about the kernel, this one is what an embedding
5//! product may know. It holds plain views, a capability report, an error
6//! vocabulary and two traits — recall and record, held separately on purpose —
7//! no domain aggregates, no ports, no storage, no transports. A consumer that
8//! compiles against this crate alone can be tested with a stub and swapped
9//! onto any implementation that honours the contract.
10//!
11//! Versioned deliberately. [`CONTRACT_VERSION`] moves when the meaning of this
12//! surface changes, independently of the kernel's own release number: two
13//! builds of one release can differ in features, and a consumer that guessed
14//! capabilities from a version string would find out mid-run. Consumers check
15//! [`ApiCapabilities`] at startup instead.
16//!
17//! The kernel owns this contract, and its vocabulary is the kernel's — abouts,
18//! memory, wake, ask, record. A consuming product maps these to its own terms
19//! at its own boundary; nothing of any consumer's vocabulary appears here.
20
21mod api_capabilities;
22mod api_error;
23mod memory_recall_api;
24mod memory_record_api;
25mod memory_record_requests;
26mod memory_record_views;
27mod memory_requests;
28mod memory_views;
29
30pub use api_capabilities::ApiCapabilities;
31pub use api_error::ApiError;
32pub use memory_recall_api::MemoryRecallApi;
33pub use memory_record_api::MemoryRecordApi;
34pub use memory_record_requests::{
35    MemoryCoordinateSpec, MemoryDimensionSpec, MemoryEntrySpec, MemoryEvidenceSpec,
36    MemoryProvenanceSpec, MemoryRecordRequest, MemoryRelationSpec,
37};
38pub use memory_record_views::RecordedMemoryView;
39pub use memory_requests::{MemoryAnswerPolicy, MemoryAskRequest, MemoryTier, MemoryWakeRequest};
40pub use memory_views::{
41    MemoryDetailView, MemoryNodeView, MemoryQualityView, MemoryRecallView, MemoryRelationshipView,
42    RenderedMemoryView,
43};
44
45/// The revision of this contract.
46///
47/// Moves on meaning, not on release: adding a capability keeps the version,
48/// changing what an existing field or method means raises it.
49pub const CONTRACT_VERSION: u32 = 1;