Skip to content

BridgeSessionStore

Bridge SessionStore that splits concerns between CF and Kuralle.

CF owns messages (via AIChatAgent’s cf_ai_chat_agent_messages table). Kuralle owns orchestration state (via OrchestrationStore).

On get(): reconstructs a Session by combining CF’s messages with Kuralle’s orchestration state.

On save(): extracts orchestration state from the Session and saves it. Does NOT save messages — CF handles that via persistMessages().

  • SessionStore
new BridgeSessionStore(options): BridgeSessionStore;
Parameter Type

options

{ cfMessages: UIMessage<unknown, UIDataTypes, UITools>[]; defaultAgentId: string; sessionId: string; sqlExecutor: SqlExecutor; }

options.cfMessages

UIMessage<unknown, UIDataTypes, UITools>[]

options.defaultAgentId

string

options.sessionId

string

options.sqlExecutor

SqlExecutor

BridgeSessionStore

cleanup(maxAgeMs): Promise<number>;

Garbage-collect orchestration rows older than maxAgeMs.

Parameter Type

maxAgeMs

number

Promise<number>

SessionStore.cleanup

delete(id): Promise<void>;
Parameter Type

id

string

Promise<void>

SessionStore.delete

get(id): Promise<Session | null>;

Reconstruct a Session from CF messages + orchestration state. Keyed by id: multiple sessions (calls) per DO get isolated rows.

Parameter Type

id

string

Promise<Session | null>

SessionStore.get

list(): Promise<Session[]>;

Promise<Session[]>

SessionStore.list

save(session): Promise<void>;

Save only orchestration state. CF handles message persistence.

Parameter Type

session

Session

Promise<void>

SessionStore.save