VaultChatBackend
Defined in: src/lib/chatStore/vaultBackend.ts:128
A ChatBackend over vault: a cache, an optimistic outbox and a change poller.
Extends
Methods
addMemoryLinks()
addMemoryLinks(
conversationId:string,items:ConversationMemoryInput[]):Promise<void>
Defined in: src/lib/storage/ChatBackend.ts:80
Records the memories a turn drew on in recall order, moving already-linked ones to this turn with their new score.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<void>
Inherited from
clearCache()
clearCache():
Promise<void>
Defined in: src/lib/chatStore/vaultBackend.ts:147
Deletes this account’s cached chats and stops caching; call it on logout or a wallet switch.
Returns
Promise<void>
clearMemoryLinks()
clearMemoryLinks(
conversationId:string):Promise<void>
Defined in: src/lib/storage/ChatBackend.ts:81
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<void>
Inherited from
clearMessages()
clearMessages(
conversationId:string):Promise<void>
Defined in: src/lib/storage/ChatStorageAdapter.ts:125
Clears all messages in a conversation (used for the “clear chat” action).
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<void>
Inherited from
close()
close():
void
Defined in: src/lib/chatStore/vaultBackend.ts:148
Returns
void
confirmMessagePersisted()?
optionalconfirmMessagePersisted(message:StoredMessage):Promise<void>
Defined in: src/lib/storage/ChatBackend.ts:55
Confirms the message data in persistent storage; rejects if the write fails or remains in the queue.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<void>
Inherited from
ChatBackend.confirmMessagePersisted
createConversation()
createConversation(
options?:CreateConversationOptions,defaultTitle?:string):Promise<StoredConversation>
Defined in: src/lib/storage/ChatBackend.ts:39
Parameters
| Parameter | Type |
|---|---|
|
| |
|
|
|
Returns
Promise<StoredConversation>
Inherited from
ChatBackend.createConversation
createMessage()
createMessage(
options:CreateMessageOptions):Promise<StoredMessage>
Defined in: src/lib/storage/ChatStorageAdapter.ts:94
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<StoredMessage>
Inherited from
deleteConversation()
deleteConversation(
conversationId:string):Promise<boolean>
Defined in: src/lib/storage/ChatStorageAdapter.ts:63
Soft delete. Implementations are responsible for cascading to messages/media.
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<boolean>
Inherited from
ChatBackend.deleteConversation
deleteMessage()
deleteMessage(
uniqueId:string):Promise<string|null>
Defined in: src/lib/storage/ChatBackend.ts:77
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<string | null>
Inherited from
deleteSummary()
deleteSummary(
conversationId:string):Promise<void>
Defined in: src/lib/storage/ChatBackend.ts:76
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<void>
Inherited from
flush()
flush():
Promise<void>
Defined in: src/lib/chatStore/vaultBackend.ts:131
Sends queued writes now; resolves once the outbox is empty, waiting on a retry, or stopped.
Returns
Promise<void>
getAllFiles()
getAllFiles(
options?:object):Promise<StoredFileWithContext[]>
Defined in: src/lib/storage/ChatBackend.ts:43
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
|
|
|
Filter files by conversation ID |
|
|
|
Maximum number of files to return |
Returns
Promise<StoredFileWithContext[]>
Inherited from
getConversation()
getConversation(
conversationId:string):Promise<StoredConversation|null>
Defined in: src/lib/storage/ChatStorageAdapter.ts:48
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<StoredConversation | null>
Inherited from
getConversations()
getConversations(
options?:ConversationQueryOptions):Promise<StoredConversation[]>
Defined in: src/lib/storage/ChatStorageAdapter.ts:50
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<StoredConversation[]>
Inherited from
getMemoryLinks()
getMemoryLinks(
conversationId:string):Promise<StoredConversationMemory[]>
Defined in: src/lib/storage/ChatBackend.ts:78
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<StoredConversationMemory[]>
Inherited from
getMessageCount()
getMessageCount(
conversationId:string):Promise<number>
Defined in: src/lib/storage/ChatBackend.ts:51
Total message count for a conversation. Optional (additive change).
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<number>
Inherited from
getMessages()
getMessages(
conversationId:string):Promise<StoredMessage[]>
Defined in: src/lib/storage/ChatStorageAdapter.ts:69
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<StoredMessage[]>
Inherited from
getMessagesByIds()
getMessagesByIds(
uniqueIds: readonlystring[]):Promise<StoredMessage[]>
Defined in: src/lib/storage/ChatBackend.ts:50
Reads messages by id in the order asked, leaving out ids that are not stored.
Parameters
| Parameter | Type |
|---|---|
|
|
readonly |
Returns
Promise<StoredMessage[]>
Inherited from
getMessageSkeletons()
getMessageSkeletons(
conversationId:string):Promise<MessageSkeleton[]>
Defined in: src/lib/storage/ChatBackend.ts:48
Whole-thread branch-tree skeleton (no decrypt). See
getMessageSkeletonsOp. Optional for the same additive-change rationale.
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<MessageSkeleton[]>
Inherited from
ChatBackend.getMessageSkeletons
getMessagesPage()
getMessagesPage(
conversationId:string,options:GetMessagesPageOptions):Promise<StoredMessage[]>
Defined in: src/lib/storage/ChatBackend.ts:44
Paginated display read: newest limit messages (optionally below
beforeMessageId), ascending, with embeddings skipped. See
getMessagesPageOp.
Optional so this is an additive, non-breaking interface change (same rationale as updateMessageFileIds). The default WatermelonChatStorageAdapter provides it.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<StoredMessage[]>
Inherited from
getSummary()
getSummary(
conversationId:string):Promise<StoredConversationSummary|null>
Defined in: src/lib/storage/ChatBackend.ts:69
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<StoredConversationSummary | null>
Inherited from
getToolCallEventIds()
getToolCallEventIds(
conversationId:string):Promise<Set<string>>
Defined in: src/lib/storage/ChatBackend.ts:52
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<Set<string>>
Inherited from
ChatBackend.getToolCallEventIds
importChats()
importChats(
chats: readonlyobject[]):Promise<{conversations:number;messages:number; }>
Defined in: src/lib/chatStore/vaultBackend.ts:137
Copies imported conversations and messages into vault with their own ids, times and order, leaving ids vault already holds as they are.
Parameters
| Parameter | Type |
|---|---|
|
|
readonly |
Returns
Promise<{ conversations: number; messages: number; }>
observeConversations()
observeConversations(
options?:ConversationQueryOptions):ChatStorageObservable<StoredConversation[]>
Defined in: src/lib/storage/ChatStorageAdapter.ts:65
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
ChatStorageObservable<StoredConversation[]>
Inherited from
ChatBackend.observeConversations
observeMessages()
observeMessages(
conversationId:string):ChatStorageObservable<StoredMessage[]>
Defined in: src/lib/storage/ChatStorageAdapter.ts:127
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
ChatStorageObservable<StoredMessage[]>
Inherited from
poll()
poll():
Promise<void>
Defined in: src/lib/chatStore/vaultBackend.ts:133
Applies changes other devices made since the last poll.
Returns
Promise<void>
searchChunks()
searchChunks(
queryVector:number[],options?:ChatChunkSearchOptions):Promise<ChunkSearchResult[]>
Defined in: src/lib/storage/ChatBackend.ts:56
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<ChunkSearchResult[]>
Inherited from
searchKeywords()
searchKeywords(
query:string,options?:ChatKeywordSearchOptions):Promise<StoredMessage[]>
Defined in: src/lib/chatStore/vaultBackend.ts:135
Messages holding every word of query across this account’s chats, newest first; empty when vault keeps no word hashes.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<StoredMessage[]>
Overrides
status()
status():
object
Defined in: src/lib/chatStore/vaultBackend.ts:145
Returns
object
pending
pending:
number
stopped?
optionalstopped:string
subscribe()
subscribe(
listener: (event:VaultChatEvent) =>void): () =>void
Defined in: src/lib/chatStore/vaultBackend.ts:129
Parameters
| Parameter | Type |
|---|---|
|
|
( |
Returns
():
void
Returns
void
updateConversationContext()
updateConversationContext(
conversationId:string,context:object):Promise<boolean>
Defined in: src/lib/chatStore/vaultBackend.ts:141
Sets keys of a conversation’s app context, each saved on its own so devices editing different keys keep both; null clears a key.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
{[ |
Returns
Promise<boolean>
updateConversationPinned()
updateConversationPinned(
conversationId:string,pinned:boolean):Promise<boolean>
Defined in: src/lib/storage/ChatStorageAdapter.ts:60
Pin or unpin a conversation. Pinning stamps pinnedAt; list queries are
NOT reordered — consumers sort pinned chats first using pinnedAt.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<boolean>
Inherited from
ChatBackend.updateConversationPinned
updateConversationProject()
updateConversationProject(
conversationId:string,projectId:string|null):Promise<boolean>
Defined in: src/lib/storage/ChatStorageAdapter.ts:56
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<boolean>
Inherited from
ChatBackend.updateConversationProject
updateConversationTitle()
updateConversationTitle(
conversationId:string,title:string):Promise<boolean>
Defined in: src/lib/storage/ChatStorageAdapter.ts:54
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<boolean>
Inherited from
ChatBackend.updateConversationTitle
updateMessageChunks()
updateMessageChunks(
uniqueId:string,chunks:MessageChunk[],embeddingModel:string):Promise<StoredMessage|null>
Defined in: src/lib/storage/ChatStorageAdapter.ts:102
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
| |
|
|
|
Returns
Promise<StoredMessage | null>
Inherited from
ChatBackend.updateMessageChunks
updateMessageEmbedding()
updateMessageEmbedding(
uniqueId:string,vector:number[],embeddingModel:string):Promise<StoredMessage|null>
Defined in: src/lib/storage/ChatStorageAdapter.ts:96
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
|
|
|
Returns
Promise<StoredMessage | null>
Inherited from
ChatBackend.updateMessageEmbedding
updateMessageError()
updateMessageError(
uniqueId:string,error:string|null):Promise<StoredMessage|null>
Defined in: src/lib/storage/ChatStorageAdapter.ts:108
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<StoredMessage | null>
Inherited from
ChatBackend.updateMessageError
updateMessageFeedback()
updateMessageFeedback(
uniqueId:string,feedback:MessageFeedback):Promise<StoredMessage|null>
Defined in: src/lib/storage/ChatStorageAdapter.ts:110
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<StoredMessage | null>
Inherited from
ChatBackend.updateMessageFeedback
updateMessageFileIds()?
optionalupdateMessageFileIds(uniqueId:string,fileIds:string[]):Promise<StoredMessage|null>
Defined in: src/lib/storage/ChatStorageAdapter.ts:122
Replace a message’s attached media ids (fileIds). Used to attach a
generated artifact (e.g. a rendered document PDF) to the assistant message
that produced it, after streaming. Pass the FULL desired list.
Optional so this is an additive, non-breaking interface change: only hosts wiring document/artifact generation need it, and existing custom adapters keep compiling without implementing it. The default WatermelonChatStorageAdapter provides it.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<StoredMessage | null>
Inherited from
ChatBackend.updateMessageFileIds
upsertMessage()
upsertMessage(
options:CreateMessageOptions&object):Promise<StoredMessage>
Defined in: src/lib/storage/ChatBackend.ts:53
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<StoredMessage>
Inherited from
upsertSummary()
upsertSummary(
conversationId:string,summary:string,summarizedUpTo:string,tokenCount:number):Promise<StoredConversationSummary>
Defined in: src/lib/storage/ChatBackend.ts:70
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Returns
Promise<StoredConversationSummary>
Inherited from
warmChunkCache()?
optionalwarmChunkCache(options:object):Promise<number>
Defined in: src/lib/storage/ChatBackend.ts:63
Fills a chunk vector cache ahead of the first search, for backends that score on the device.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
Returns
Promise<number>
Inherited from
write()
write<
T>(fn: (adapter:ChatStorageAdapter) =>Promise<T>):Promise<T>
Defined in: src/lib/storage/ChatStorageAdapter.ts:139
Run a set of mutations inside a single write transaction. Any mutation calls made on the adapter inside the callback are grouped into one atomic write on backends that support it.
On backends without transaction support, this may fall back to sequential writes. Implementations must document the guarantee they provide.
Type Parameters
| Type Parameter |
|---|
|
|
Parameters
| Parameter | Type |
|---|---|
|
|
( |
Returns
Promise<T>
Inherited from