Table of Contents

Class SessionStore

Namespace
JD.AI.Core.Sessions
Assembly
JD.AI.Core.dll

SQLite-backed session store. Handles all CRUD against ~/.jdai/sessions.db.

public sealed class SessionStore : IDisposable
Inheritance
SessionStore
Implements
Inherited Members

Constructors

SessionStore(string?)

public SessionStore(string? dbPath = null)

Parameters

dbPath string

Methods

CloseInactiveSessionsAsync(TimeSpan)

Closes all active sessions that have been inactive for longer than maxInactiveAge. Returns the count of sessions closed.

public Task<int> CloseInactiveSessionsAsync(TimeSpan maxInactiveAge)

Parameters

maxInactiveAge TimeSpan

Returns

Task<int>

CloseSessionAsync(string)

public Task CloseSessionAsync(string id)

Parameters

id string

Returns

Task

CreateSessionAsync(SessionInfo)

public Task CreateSessionAsync(SessionInfo session)

Parameters

session SessionInfo

Returns

Task

DeleteTurnsAfterAsync(string, int)

public Task DeleteTurnsAfterAsync(string sessionId, int turnIndex)

Parameters

sessionId string
turnIndex int

Returns

Task

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetSessionAsync(string)

public Task<SessionInfo?> GetSessionAsync(string id)

Parameters

id string

Returns

Task<SessionInfo>

InitializeAsync()

Create tables if they don't exist.

public Task InitializeAsync()

Returns

Task

ListSessionsAsync(string?, int)

public Task<ReadOnlyCollection<SessionInfo>> ListSessionsAsync(string? projectHash = null, int limit = 20)

Parameters

projectHash string
limit int

Returns

Task<ReadOnlyCollection<SessionInfo>>

SaveTurnAsync(TurnRecord)

public Task SaveTurnAsync(TurnRecord turn)

Parameters

turn TurnRecord

Returns

Task

UpdateSessionAsync(SessionInfo)

public Task UpdateSessionAsync(SessionInfo session)

Parameters

session SessionInfo

Returns

Task