pub struct MemoryStack { /* private fields */ }Expand description
Full 4-layer memory stack.
Implementations§
Source§impl MemoryStack
impl MemoryStack
pub fn new(db: AimemDb, embedder: Arc<dyn Embedder>, cfg: &Config) -> Self
Sourcepub async fn wake_up(&self, wing: Option<&str>) -> Result<String, LayerError>
pub async fn wake_up(&self, wing: Option<&str>) -> Result<String, LayerError>
Generate wake-up context: L0 (identity) + L1 (essential story). ~600-900 tokens total. Inject into system prompt or first message.
Sourcepub async fn recall(
&self,
wing: Option<&str>,
room: Option<&str>,
) -> Result<String, LayerError>
pub async fn recall( &self, wing: Option<&str>, room: Option<&str>, ) -> Result<String, LayerError>
On-demand L2 retrieval filtered by wing/room.
Sourcepub async fn search(
&self,
query: &str,
wing: Option<&str>,
room: Option<&str>,
) -> Result<String, LayerError>
pub async fn search( &self, query: &str, wing: Option<&str>, room: Option<&str>, ) -> Result<String, LayerError>
Deep L3 semantic search.
Sourcepub async fn file_drawer(
&self,
wing: &str,
room: &str,
content: String,
parts: Vec<ContentPart>,
agent: &str,
) -> Result<String, LayerError>
pub async fn file_drawer( &self, wing: &str, room: &str, content: String, parts: Vec<ContentPart>, agent: &str, ) -> Result<String, LayerError>
File a new memory (drawer) into the L1-L3 store. This handles embedding generation and DB insertion automatically.
Sourcepub async fn file_drawer_with_id(
&self,
id: &str,
wing: &str,
room: &str,
content: String,
parts: Vec<ContentPart>,
source_file: Option<&str>,
chunk_index: i64,
agent: &str,
) -> Result<bool, LayerError>
pub async fn file_drawer_with_id( &self, id: &str, wing: &str, room: &str, content: String, parts: Vec<ContentPart>, source_file: Option<&str>, chunk_index: i64, agent: &str, ) -> Result<bool, LayerError>
File a new memory with a caller-supplied stable drawer ID and optional metadata.
Returns true when a new drawer row was inserted and false when the ID already existed.
Sourcepub async fn file_drawers_with_ids(
&self,
requests: &[DrawerFilingRequest],
) -> Result<Vec<bool>, LayerError>
pub async fn file_drawers_with_ids( &self, requests: &[DrawerFilingRequest], ) -> Result<Vec<bool>, LayerError>
File multiple stable-ID drawers in one embedding batch.
This is useful for attachment-style ingestion where a caller has a set of related chunks (for example one file’s summary + chunk drawers) and wants to avoid one remote embedding request per drawer.
The returned vector is aligned with requests: true means a new drawer
row was inserted, false means the stable ID already existed.
Existing IDs are checked before embedding so retries do not spend another remote embedding call on already-filed drawers.
Sourcepub async fn file_text(
&self,
wing: &str,
room: &str,
content: impl Into<String>,
agent: &str,
) -> Result<String, LayerError>
pub async fn file_text( &self, wing: &str, room: &str, content: impl Into<String>, agent: &str, ) -> Result<String, LayerError>
File a plain-text memory without manually constructing a parts vector.
Sourcepub async fn status(&self) -> Result<Value, LayerError>
pub async fn status(&self) -> Result<Value, LayerError>
Status of the whole stack.
Trait Implementations§
Source§impl Clone for MemoryStack
impl Clone for MemoryStack
Source§fn clone(&self) -> MemoryStack
fn clone(&self) -> MemoryStack
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for MemoryStack
impl !RefUnwindSafe for MemoryStack
impl Send for MemoryStack
impl Sync for MemoryStack
impl Unpin for MemoryStack
impl UnsafeUnpin for MemoryStack
impl !UnwindSafe for MemoryStack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more