Skip to main content

Module storage

Module storage 

Source
Expand description

Session and message storage helpers.

Structs§

Memory
A memory entry stored in the database.
MemoryFilter
Filter for memory queries.
MessageData
Message data returned to frontends.
MessageSearchFilter
Filter for message search queries.
MessageSearchResult
A message search result from FTS full-text search.
SessionInfo
Session metadata returned to frontends.
ToolCallInfoData
Tool call info for storage in message.

Enums§

MemoryType
Type of memory entry.

Functions§

activate_session
Activate a specific session and deactivate others for the same chat_id.
deactivate_memory
Deactivate a memory (soft delete).
delete_memory_permanently
Permanently delete a memory (hard delete).
delete_session
Soft-delete a session.
find_memories_by_title
Find memories by title (fuzzy match using LIKE).
find_session_by_chat_id
Find an active session by its platform chat identifier.
get_memory
Get a single memory by ID.
get_messages
Get all messages for a session, ordered by creation time.
get_session
Get a single session by ID.
init_db
Initialize the database: create tables if needed, then run migrations.
insert_memory
Insert a new memory into the database.
insert_message
Insert a message into a session.
insert_session
Insert a new session.
list_all_sessions_by_chat_id
List ALL sessions (including inactive ones) for a chat_id, ordered by most recent first.
list_memories
List memories with optional filtering.
list_sessions
List all active sessions, ordered by most recently updated.
load_chat_messages
Load all messages for a session and convert to chat messages
message_to_chat_message
Convert stored MessageData to ChatCompletionRequestMessage
recall_memories
Recall memories using keyword search (title, content, tags).
resolve_db_path
Resolve the session database path for a working directory and storage scope.
search_messages
Search messages using FTS5 full-text search.
touch_session
Update a session’s updated_at timestamp.
update_memory
Update an existing memory.
update_session_title
Update a session’s title.
update_tool_message
Update a tool message with its result.