Skip to Content

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

ParameterType

options?

CreateConversationOptions

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

ParameterTypeDescription

searchOptions?

Partial<MemoryEngineSearchOptions>

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

ParameterType

options?

MemoryVaultToolOptions

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

ParameterType

toolOptions?

RecallToolOptions

callbacks?

RecallToolCallbacks

Returns

ToolConfig


deleteConversation()

deleteConversation: (id: string) => Promise<boolean>

Defined in: src/lib/db/chat/types.ts:1122 

Parameters

ParameterType

id

string

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

ParameterType

id

string

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

ParameterType

conversationId?

string

Returns

Promise<ActiveStream[]>


getConversation()

getConversation: (id: string) => Promise<StoredConversation | null>

Defined in: src/lib/db/chat/types.ts:1118 

Parameters

ParameterType

id

string

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

ParameterType

conversationId

string

Returns

Promise<number>

Inherited from

BaseUseChatStorageResult.getMessageCount


getMessages()

getMessages: (conversationId: string) => Promise<StoredMessage[]>

Defined in: src/lib/db/chat/types.ts:1123 

Parameters

ParameterType

conversationId

string

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

ParameterType

conversationId

string

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

ParameterType

conversationId

string

options

GetMessagesPageOptions

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

ParameterTypeDescription

options?

object

‐

options.excludeDisabled?

boolean

Leave out memories the user switched off.

options.factTypes?

string[]

Typed memory (PR1) — restrict to these fact types. Omit for no filter.

options.folderId?

string | null

‐

options.includeArchived?

boolean

Include archived (decayed) memories. Default false (PR1 choke point).

options.includeDeleted?

boolean

Include soft-deleted memories in the result (each carries isDeleted: true). Default false — deleted rows are excluded, as they are from every other read path. Used by the Memory Graph to render “forgotten” nodes; ordinary consumers should leave this off.

options.includeQuarantined?

boolean

Include quarantined memories. Default false (PR1 choke point).

options.includeSuperseded?

boolean

Include A2-superseded memories (each carries supersededBy). Default false — superseded rows are excluded, as they are from recall/dedup. Used by a “memory history” view to render retired facts.

options.kinds?

string[]

Restrict to these profile kinds.

options.levels?

("private" | "matching" | "profile")[]

Filter by level.

options.limit?

number

‐

options.memoryIds?

string[]

‐

options.scopes?

string[]

‐

options.since?

Date

‐

options.visibility?

VaultMemoryVisibility[]

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.

options.withEmbeddings?

boolean

‐

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

ParameterType

sealed

string

sealId

string

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

ParameterType

query

string

options?

RecallOptions

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

ParameterType

handleOverride?

StreamResumeHandle

opts?

object

opts.headless?

boolean

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

ParameterType

input

VaultWriteInput

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

ParameterType

args

SendMessageWithStorageArgs

Returns

Promise<SendMessageWithStorageResult>


setConversationId()

setConversationId: (id: string | null) => void

Defined in: src/lib/db/chat/types.ts:1116 

Parameters

ParameterType

id

string | null

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

ParameterType

id

string

pinned

boolean

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

ParameterType

id

string

title

string

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

ParameterType

stream

ActiveStream

Returns

Promise<ResumeStreamResult>

Last updated on