Skip to content

agent-cli / 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/dist/node/index.d.ts:33

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/dist/node/index.d.ts:42


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/dist/node/index.d.ts:47


list

list(): ISessionRecord[]

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

Returns

ISessionRecord[]

Defined in

agent-sessions/dist/node/index.d.ts:51


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/dist/node/index.d.ts:56

Released under the MIT License.