bodhi-realtime-agent / ConversationHistoryStore
Interface: ConversationHistoryStore
Defined in: src/types/history.ts:73
Persistence interface for conversation history. Implementations are responsible for durable storage of session records and conversation items.
Methods
addItems()
addItems(
sessionId,items):Promise<void>
Defined in: src/types/history.ts:94
Append conversation items to a session's history.
Parameters
sessionId
string
items
Returns
Promise<void>
createSession()
createSession(
session):Promise<void>
Defined in: src/types/history.ts:75
Create a new session record.
Parameters
session
Returns
Promise<void>
ensureSession()?
optionalensureSession(session):Promise<SessionRecord>
Defined in: src/types/history.ts:84
Ensure a session record exists without destroying existing items — create it if missing, else leave the stored record/items intact — and return the existing-or-created record. Used by resume (attach mode): unlike createSession (which may reset items) it is safe to call against a prior session. Optional — a store that cannot support non-destructive attach omits it (such a store cannot be used as an attach target). Returns the record so a resumed run can read the original startedAt/metadata.
Parameters
session
Returns
Promise<SessionRecord>
getSession()
getSession(
sessionId):Promise<SessionRecord|null>
Defined in: src/types/history.ts:98
Retrieve a session record by ID (null if not found).
Parameters
sessionId
string
Returns
Promise<SessionRecord | null>
getSessionItems()
getSessionItems(
sessionId,options?):Promise<ConversationItem[]>
Defined in: src/types/history.ts:100
Retrieve conversation items for a session with optional pagination.
Parameters
sessionId
string
options?
Returns
Promise<ConversationItem[]>
listUserSessions()
listUserSessions(
userId,options?):Promise<SessionSummary[]>
Defined in: src/types/history.ts:102
List all sessions for a user with optional pagination.
Parameters
userId
string
options?
Returns
Promise<SessionSummary[]>
reactivateSession()?
optionalreactivateSession(sessionId):Promise<void>
Defined in: src/types/history.ts:90
Re-open a previously-ended record: set status: 'active' and clear the terminal fields (endedAt/durationMs/disconnectReason). A dedicated method because updateSession with undefined values cannot null a column on some backends. Optional (paired with ensureSession).
Parameters
sessionId
string
Returns
Promise<void>
saveSessionReport()
saveSessionReport(
report):Promise<void>
Defined in: src/types/history.ts:96
Save a complete session report (called on session close).
Parameters
report
Returns
Promise<void>
updateSession()
updateSession(
sessionId,update):Promise<void>
Defined in: src/types/history.ts:92
Update fields on an existing session record.
Parameters
sessionId
string
update
Partial<SessionRecord>
Returns
Promise<void>