UseChatStorageResult
Defined in: src/expo/useChatStorage.ts:503
Result returned by useChatStorage hook (Expo version)
Extends base result with Expo-specific sendMessage signature.
Extends
BaseUseChatStorageResult
Properties
clearQueue()
clearQueue: () =>
void
Defined in: src/expo/useChatStorage.ts:614
Clear all queued operations without writing them.
Returns
void
conversationId
conversationId:
string|null
Defined in: src/lib/db/chat/types.ts:1115
Inherited from
BaseUseChatStorageResult.conversationId
createConversation()
createConversation: (
options?:CreateConversationOptions) =>Promise<StoredConversation>
Defined in: src/lib/db/chat/types.ts:1117
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<StoredConversation>
Inherited from
BaseUseChatStorageResult.createConversation
createMemoryEngineTool()
createMemoryEngineTool: (
searchOptions?:Partial<MemoryEngineSearchOptions>) =>ToolConfig
Defined in: src/expo/useChatStorage.ts:566
Create a memory engine tool for LLM to search past conversations. The tool is pre-configured with the hook’s storage context and auth.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
|
Optional search configuration (limit, minSimilarity, etc.) |
Returns
ToolConfig
A ToolConfig that can be passed to sendMessage’s clientTools
Example
const memoryTool = createMemoryEngineTool({ limit: 5 });
await sendMessage({
messages: [...],
clientTools: [memoryTool],
});createMemoryVaultTool()
createMemoryVaultTool: (
options?:MemoryVaultToolOptions) =>ToolConfig
Defined in: src/expo/useChatStorage.ts:569
Create a memory vault tool pre-configured with hook’s vault context and encryption.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
ToolConfig
createRecallTool()
createRecallTool: (
toolOptions?:RecallToolOptions,callbacks?:RecallToolCallbacks) =>ToolConfig
Defined in: src/expo/useChatStorage.ts:585
Create the unified recall tool — single chat-completion tool that searches both vault facts and conversation chunks via recall(). Replaces the legacy createMemoryEngineTool / vault search pair.
Parameters
| Parameter | Type |
|---|---|
|
| |
|
|
Returns
ToolConfig
deleteConversation()
deleteConversation: (
id:string) =>Promise<boolean>
Defined in: src/lib/db/chat/types.ts:1122
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<boolean>
Inherited from
BaseUseChatStorageResult.deleteConversation
deleteVaultMemory()
deleteVaultMemory: (
id:string) =>Promise<boolean>
Defined in: src/expo/useChatStorage.ts:608
Delete a vault memory by its ID (soft delete).
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<boolean>
deliverInbox()
deliverInbox: () =>
Promise<InboxDeliveryResult[]>
Defined in: src/expo/useChatStorage.ts:547
Register the inbox public key, then store and remove every answer portal sealed into the inbox; without signMessage, it uses the key pair the encryption-key unlock derived and does nothing before that.
Returns
Promise<InboxDeliveryResult[]>
detach()
detach: () =>
StreamResumeHandle|null
Defined in: src/expo/useChatStorage.ts:512
Detach the in-flight stream (keep generating server-side). Resolves to the
resume handle, or null when nothing is resumable. The partial assistant row
is persisted by sendMessage’s detached branch — pair the handle with that
row’s assistantUniqueId to complete it via resumeStream.
Returns
StreamResumeHandle | null
flushQueue()
flushQueue: () =>
Promise<FlushResult>
Defined in: src/expo/useChatStorage.ts:611
Manually flush all queued operations for the current wallet.
Returns
Promise<FlushResult>
getActiveStreams()
getActiveStreams: (
conversationId?:string) =>Promise<ActiveStream[]>
Defined in: src/expo/useChatStorage.ts:543
The caller’s generations still running on the portal, optionally for one conversation.
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<ActiveStream[]>
getConversation()
getConversation: (
id:string) =>Promise<StoredConversation|null>
Defined in: src/lib/db/chat/types.ts:1118
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<StoredConversation | null>
Inherited from
BaseUseChatStorageResult.getConversation
getConversations()
getConversations: () =>
Promise<StoredConversation[]>
Defined in: src/lib/db/chat/types.ts:1119
Returns
Promise<StoredConversation[]>
Inherited from
BaseUseChatStorageResult.getConversations
getMessageCount()
getMessageCount: (
conversationId:string) =>Promise<number>
Defined in: src/lib/db/chat/types.ts:1135
Total message count for a conversation.
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<number>
Inherited from
BaseUseChatStorageResult.getMessageCount
getMessages()
getMessages: (
conversationId:string) =>Promise<StoredMessage[]>
Defined in: src/lib/db/chat/types.ts:1123
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<StoredMessage[]>
Inherited from
BaseUseChatStorageResult.getMessages
getMessageSkeletons()
getMessageSkeletons: (
conversationId:string) =>Promise<MessageSkeleton[]>
Defined in: src/lib/db/chat/types.ts:1133
Whole-thread branch-tree skeleton — no field decryption.
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<MessageSkeleton[]>
Inherited from
BaseUseChatStorageResult.getMessageSkeletons
getMessagesPage()
getMessagesPage: (
conversationId:string,options:GetMessagesPageOptions) =>Promise<StoredMessage[]>
Defined in: src/lib/db/chat/types.ts:1128
Paginated display read: the newest limit messages (optionally below
beforeMessageId), ascending, with embedding columns skipped.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<StoredMessage[]>
Inherited from
BaseUseChatStorageResult.getMessagesPage
getVaultMemories()
getVaultMemories: (
options?:object) =>Promise<StoredVaultMemory[]>
Defined in: src/expo/useChatStorage.ts:603
Get all vault memories for context injection. Soft-deleted memories are
excluded unless includeDeleted is set.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
|
|
|
Leave out memories the user switched off. |
|
|
|
Typed memory (PR1) — restrict to these fact types. Omit for no filter. |
|
|
|
‐ |
|
|
|
Include archived (decayed) memories. Default |
|
|
|
Include soft-deleted memories in the result (each carries
|
|
|
|
Include quarantined memories. Default |
|
|
|
Include A2-superseded memories (each carries |
|
|
|
Restrict to these profile kinds. |
|
|
( |
Filter by level. |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
‐ |
|
|
Filter by People Nearby visibility. Legacy rows with a NULL column count as “private”. Used by the publish reconciler to fetch the published set to diff against the server index. | |
|
|
|
‐ |
Returns
Promise<StoredVaultMemory[]>
isLoading
isLoading:
boolean
Defined in: src/lib/db/chat/types.ts:1113
Inherited from
BaseUseChatStorageResult.isLoading
openSealedWithInboxKey()
openSealedWithInboxKey: (
sealed:string,sealId:string) =>Promise<string>
Defined in: src/expo/useChatStorage.ts:549
Open text that portal sealed to the inbox public key under sealId, such as a reward code.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<string>
queueStatus
queueStatus:
QueueStatus
Defined in: src/expo/useChatStorage.ts:617
Current status of the write queue.
recall()
recall: (
query:string,options?:RecallOptions) =>Promise<RecallResult>
Defined in: src/expo/useChatStorage.ts:599
Recall memories programmatically via the unified ranked pipeline — the
programmatic twin of createRecallTool. Returns ranked memories
for callers that inject memory into the prompt themselves (e.g.
pre-retrieval injection) instead of exposing a tool to the LLM. Shares
the hook’s warm embedding cache. Defaults to budget: 'low',
types: ['fact']. Gracefully returns an empty result when auth is
unavailable — pre-retrieval must never crash the submit path.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<RecallResult>
resumeStream()
resumeStream: (
handleOverride?:StreamResumeHandle,opts?:object) =>Promise<ResumeStreamWithStorageResult>
Defined in: src/expo/useChatStorage.ts:538
Replay a detached stream and reconcile the result onto the SAME assistant
row (find→update via upsertMessageOp). Never creates a second row for the
same assistantUniqueId.
Uses the pending-resume context stowed by the detached sendMessage by
default; pass handleOverride for a cold-launch resume (mobile PR5) where
a deserialized handle has no in-memory context (the row is then created
fresh). Replay is always from seq 0 — consumers reset accumulated streaming
text before calling.
Pass { headless: true } for a cold-launch replay of a conversation that is
NOT the one on screen: the row is still reconciled + PERSISTED exactly as
normal, but NOTHING is emitted to ANY consumer callback — onData /
onThinking / onFinish / onError are all withheld (forwarded into the
inner useChat, which spreads {} in place of all four). isLoading is
also left untouched, so reusing the on-screen chat’s hook for an off-screen
recovery can’t flicker the visible loading state. A headless resume also
does NOT touch the inner hook’s shared abort controller, so the visible UI’s
stop() can’t abort it and it can’t clobber a concurrently-visible stream’s
controller. Recovered text can’t bleed into the visible chat’s streaming
buffer, nor can the recovered response (onFinish) or a transient error
(onError) reach the on-screen consumer; the caller uses the returned result
instead (mobile PR5 worker).
Parameters
| Parameter | Type |
|---|---|
|
| |
|
|
|
|
|
|
Returns
Promise<ResumeStreamWithStorageResult>
retainVaultMemory()
retainVaultMemory: (
input:VaultWriteInput) =>Promise<RetainResult>
Defined in: src/expo/useChatStorage.ts:578
Write one memory through retain() — cosine auto-merge against the vault,
so an explicit “save this” from a host surface (selection → memory, a
manual add) lands as a re-observation of an existing memory instead of a
duplicate row when the vault already holds the fact. The
memory_vault_save tool writes through this too. Throws without getToken.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<RetainResult>
sendMessage()
sendMessage: (
args:SendMessageWithStorageArgs) =>Promise<SendMessageWithStorageResult>
Defined in: src/expo/useChatStorage.ts:505
Send a message and automatically store it (Expo version)
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<SendMessageWithStorageResult>
setConversationId()
setConversationId: (
id:string|null) =>void
Defined in: src/lib/db/chat/types.ts:1116
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
void
Inherited from
BaseUseChatStorageResult.setConversationId
stop()
stop: () =>
void
Defined in: src/lib/db/chat/types.ts:1114
Returns
void
Inherited from
BaseUseChatStorageResult.stop
updateConversationPinned()
updateConversationPinned: (
id:string,pinned:boolean) =>Promise<boolean>
Defined in: src/lib/db/chat/types.ts:1121
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<boolean>
Inherited from
BaseUseChatStorageResult.updateConversationPinned
updateConversationTitle()
updateConversationTitle: (
id:string,title:string) =>Promise<boolean>
Defined in: src/lib/db/chat/types.ts:1120
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<boolean>
Inherited from
BaseUseChatStorageResult.updateConversationTitle
watchStream()
watchStream: (
stream:ActiveStream) =>Promise<ResumeStreamResult>
Defined in: src/expo/useChatStorage.ts:545
Show a running generation from its first frame; nothing is stored.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<ResumeStreamResult>