Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/memory / / SessionMemoryStoreExt

Interface: SessionMemoryStoreExt

Defined in: packages/memory/src/internal/storage-adapter.ts:210

Extension of the typed SessionMemoryStore with optional token-cache + vector-search + cursor-aware reader helpers that storage adapters may expose.

Stable

Extends

Methods

count()?

ts
optional count(scope): Promise<number>;

Defined in: packages/memory/src/internal/storage-adapter.ts:239

Count the live messages in the scoped session (CE-5) - a COUNT(*), never materialising rows; 0 for a user-only scope. Powers honest metadata() counts instead of list(...)-materialising up to 1000 rows.

Parameters

ParameterType
scopeSessionScope

Returns

Promise&lt;number&gt;


list()

ts
list(scope, opts?): Promise<readonly Message[]>;

Defined in: packages/core/dist/contracts/memory-store.d.ts

Parameters

ParameterType
scopeSessionScope
opts?SessionListOptions

Returns

Promise&lt;readonly Message[]&gt;

Inherited from

SessionMemoryStore.list


listMessagesSince()?

ts
optional listMessagesSince(
   scope, 
   lastMessageId, 
limit): Promise<readonly SessionMessageRecord[]>;

Defined in: packages/memory/src/internal/storage-adapter.ts:229

List messages for the supplied scope past the optional lastMessageId cursor, oldest-first, capped at limit. Used by the consolidator's standard phase to advance the per-scope idempotency cursor without rereading already-processed turns.

Parameters

ParameterType
scopeSessionScope
lastMessageIdstring | null
limitnumber

Returns

Promise&lt;readonly SessionMessageRecord[]&gt;


listWithMetadata()?

ts
optional listWithMetadata(scope, opts?): Promise<readonly SessionMessageWithMetadata[]>;

Defined in: packages/core/dist/contracts/memory-store.d.ts

List messages with their persisted identity (RP-5). Optional: stores that don't implement it fall back to list + fabricated ids on the export path.

Parameters

ParameterType
scopeSessionScope
opts?SessionListOptions

Returns

Promise&lt;readonly SessionMessageWithMetadata[]&gt;

Inherited from

SessionMemoryStore.listWithMetadata


push()

ts
push(scope, message): Promise<MessageRef>;

Defined in: packages/core/dist/contracts/memory-store.d.ts

Parameters

ParameterType
scopeSessionScope
messageMessage

Returns

Promise&lt;MessageRef&gt;

Inherited from

SessionMemoryStore.push


ts
search(
   scope, 
   query, 
opts?): Promise<readonly MemoryHit<MemoryRecord>[]>;

Defined in: packages/core/dist/contracts/memory-store.d.ts

Full-text search over the scoped session messages.

Query precedence (W-127): the POSITIONAL query parameter is authoritative; when the caller also sets opts.query (the field exists because MemorySearchOptions is shared with the option-object search surfaces), implementations MUST ignore it. The duplication is a known wart: narrowing opts to Omit<MemorySearchOptions, 'query'> is a candidate for the next major, not a change this line can make compatibly.

Parameters

ParameterType
scopeSessionScope
querystring
opts?MemorySearchOptions

Returns

Promise<readonly MemoryHit&lt;MemoryRecord&gt;[]>

Inherited from

SessionMemoryStore.search


searchVector()?

ts
optional searchVector(
   scope, 
   embedding, 
   embedderId, 
topK): Promise<readonly MemoryHit<MemoryRecord>[]>;

Defined in: packages/memory/src/internal/storage-adapter.ts:211

Parameters

ParameterType
scopeSessionScope
embeddingFloat32Array
embedderIdstring
topKnumber

Returns

Promise<readonly MemoryHit&lt;MemoryRecord&gt;[]>


totalCachedTokens()?

ts
optional totalCachedTokens(scope): Promise<number | null>;

Defined in: packages/memory/src/internal/storage-adapter.ts:222

Sum of session_messages.token_count for the supplied scope. Returns null when the cache is empty / partially populated so callers can fall back to a heuristic. Surfaced per DEC-131.

Parameters

ParameterType
scopeSessionScope

Returns

Promise&lt;number | null&gt;