kernl
ReferencekernlInterfaces

Interface: ThreadStore

Defined in: packages/kernl/src/storage/thread.ts:14

Thread persistence store.

Methods

append()

append(events: ThreadEvent[]): Promise<void>;

Defined in: packages/kernl/src/storage/thread.ts:60

Append events to the thread history.

Semantics:

  • Guaranteed per-thread ordering via a monotonically increasing seq.
  • Idempotent on (tid, event.id): duplicate ids MUST NOT create duplicate rows.
  • Events maintain insertion order.

Note:

  • Thread class manages monotonic seq and timestamp assignment.

Parameters

ParameterType
eventsThreadEvent[]

Returns

Promise<void>


delete()

delete(tid: string): Promise<void>;

Defined in: packages/kernl/src/storage/thread.ts:42

Delete a thread and cascade to thread_events.

Parameters

ParameterType
tidstring

Returns

Promise<void>


get()

get(tid: string, include?: ThreadInclude): Promise<Thread<unknown, "text"> | null>;

Defined in: packages/kernl/src/storage/thread.ts:20

Get a thread by id.

Optionally include the thread_events.

Parameters

ParameterType
tidstring
include?ThreadInclude

Returns

Promise<Thread<unknown, "text"> | null>


history()

history(tid: string, options?: ThreadHistoryOptions): Promise<ThreadEvent[]>;

Defined in: packages/kernl/src/storage/thread.ts:47

Get the event history for a thread.

Parameters

ParameterType
tidstring
options?ThreadHistoryOptions

Returns

Promise<ThreadEvent[]>


insert()

insert(thread: NewThread): Promise<Thread<unknown, "text">>;

Defined in: packages/kernl/src/storage/thread.ts:30

Insert a new thread into the store.

Parameters

ParameterType
threadNewThread

Returns

Promise<Thread<unknown, "text">>


list()

list(options?: ThreadListOptions): Promise<Thread<unknown, "text">[]>;

Defined in: packages/kernl/src/storage/thread.ts:25

List threads matching the filter.

Parameters

ParameterType
options?ThreadListOptions

Returns

Promise<Thread<unknown, "text">[]>


update()

update(tid: string, patch: ThreadUpdate): Promise<Thread<unknown, "text">>;

Defined in: packages/kernl/src/storage/thread.ts:37

Update thread runtime state (tick, state, metadata).

Does NOT mutate the event log, which is append-only.

Parameters

ParameterType
tidstring
patchThreadUpdate

Returns

Promise<Thread<unknown, "text">>

On this page