Skip to content

agent-sessions / Exports / SessionStore

Class: SessionStore

Persistent session store backed by individual JSON files.

Construct with a custom baseDir to redirect storage (useful in tests).

Table of contents

Constructors

Methods

Constructors

constructor

new SessionStore(baseDir?): SessionStore

Parameters

NameType
baseDir?string

Returns

SessionStore

Defined in

agent-sessions/src/session-store.ts:43

Methods

save

save(session): void

Persist a session record to disk. Creates the storage directory if needed.

Parameters

NameType
sessionISessionRecord

Returns

void

Defined in

agent-sessions/src/session-store.ts:63


load

load(id): undefined | ISessionRecord

Load a session by its ID. Returns undefined when the session file does not exist.

Parameters

NameType
idstring

Returns

undefined | ISessionRecord

Defined in

agent-sessions/src/session-store.ts:72


list

list(): ISessionRecord[]

List all persisted sessions, sorted by updatedAt descending (most recent first).

Returns

ISessionRecord[]

Defined in

agent-sessions/src/session-store.ts:84


delete

delete(id): void

Delete a session by its ID. No-ops silently if the session does not exist.

Parameters

NameType
idstring

Returns

void

Defined in

agent-sessions/src/session-store.ts:111

Released under the MIT License.