Skip to content

InMemoryPersistentMemoryStore

Nested by (scope, owner, key) rather than a joined string — a Map can key on any value, so there is nothing to flatten and therefore nothing that can rearrange across a delimiter. The previous `${scope}:${owner}:${key}` composition made (owner: 'a:b', key: 'K') and (owner: 'a', key: 'b:K') the same map entry, and listBlocks’s prefix scan compounded it by also matching owner a’s scan against owner a:b’s rows.

new InMemoryPersistentMemoryStore(): InMemoryPersistentMemoryStore;

InMemoryPersistentMemoryStore

deleteBlock(
scope,
owner,
key): Promise<void>;

Delete a block. No-op when missing.

Parameter Type

scope

MemoryBlockScope

owner

string

key

string

Promise<void>

PersistentMemoryStore.deleteBlock


listBlocks(scope, owner): Promise<string[]>;

List block keys for an owner within a scope.

Parameter Type

scope

MemoryBlockScope

owner

string

Promise<string[]>

PersistentMemoryStore.listBlocks


loadBlock(
scope,
owner,
key): Promise<
| PersistentMemoryBlock
| null>;

Load a single block by (scope, owner, key). Returns null when the block does not exist yet (first time the agent ever ran for this owner). Implementations MUST NOT throw on missing — return null.

owner is typically the userId for scope=‘user’ / scope=‘shared’, and the agentId for scope=‘agent’. Implementations should accept any string and treat it as opaque.

Parameter Type

scope

MemoryBlockScope

owner

string

key

string

Promise< | PersistentMemoryBlock | null>

PersistentMemoryStore.loadBlock


saveBlock(block, owner): Promise<void>;

Persist a block atomically. Replaces the entire content.

Parameter Type

block

PersistentMemoryBlock

owner

string

Promise<void>

PersistentMemoryStore.saveBlock