Class: InMemoryThreadStore¶
Defined in: src/stores/memory.ts:27
In-memory ThreadStore. Data lives for the life of the process — ideal
for local development, tests, and the demo. Use PostgresThreadStore (or a
custom store) for durable persistence.
Example¶
import { createKabooRunner, InMemoryThreadStore } from "@pgege/kaboo-runtime";
const runner = createKabooRunner(new InMemoryThreadStore());
Implements¶
Constructors¶
Constructor¶
new InMemoryThreadStore():
InMemoryThreadStore
Returns¶
InMemoryThreadStore
Methods¶
appendEvents()¶
appendEvents(
threadId,agentId,events,ownerId?):Promise\<void>
Defined in: src/stores/memory.ts:40
Append events (in order) to the thread's log.
ownerId records the owning subject on the thread (the runner passes it
from accessPolicy.ownerOf). A
nullish value must preserve any owner already recorded.
Parameters¶
threadId¶
string
agentId¶
string
events¶
BaseEvent[]
ownerId?¶
string | null
Returns¶
Promise\<void>
Implementation of¶
clear()¶
clear(
threadId?):Promise\<void>
Defined in: src/stores/memory.ts:97
Delete one thread's data, or all threads when threadId is omitted.
Parameters¶
threadId?¶
string
Returns¶
Promise\<void>
Implementation of¶
compactRun()¶
compactRun(
threadId,runId):Promise\<void>
Defined in: src/stores/memory.ts:53
Replace a finished run's events with compactRunEvents of them, in place: events appended after the run keep their position. A run that has not finished, or is not in the log, is left alone.
Parameters¶
threadId¶
string
runId¶
string
Returns¶
Promise\<void>
Implementation of¶
listThreads()¶
listThreads(
filter?):Promise\<StoredThread[]>
Defined in: src/stores/memory.ts:84
List persisted threads, most recently updated first. With
filter.ownerId, only that subject's threads are returned.
Parameters¶
filter?¶
Returns¶
Promise\<StoredThread[]>
Implementation of¶
readEvents()¶
readEvents(
threadId):Promise\<BaseEvent[]>
Defined in: src/stores/memory.ts:63
Read the thread's full event log, in order.
Parameters¶
threadId¶
string
Returns¶
Promise\<BaseEvent[]>
Implementation of¶
readMessages()¶
readMessages(
threadId):Promise\<Message[]>
Defined in: src/stores/memory.ts:80
Read the derived message snapshot for a thread.
Parameters¶
threadId¶
string
Returns¶
Promise\<Message[]>
Implementation of¶
readState()¶
readState(
threadId):Promise\<Record\<string,unknown> |null>
Defined in: src/stores/memory.ts:67
Read the latest agent state (see deriveState), or null.
Parameters¶
threadId¶
string
Returns¶
Promise\<Record\<string, unknown> | null>
Implementation of¶
saveMessages()¶
saveMessages(
threadId,messages):Promise\<void>
Defined in: src/stores/memory.ts:72
Persist the derived message snapshot for a thread.
Parameters¶
threadId¶
string
messages¶
Message[]
Returns¶
Promise\<void>