Session

data class Session(val key: SessionKey, val state: State = State(), val events: MutableList<Event> = concurrentMutableListOf(), var lastUpdateTime: Instant = Instant.fromEpochMilliseconds(0))

A Session object that encapsulates the State and Events of a session.

Constructors

Link copied to clipboard
constructor(key: SessionKey, state: State = State(), events: MutableList<Event> = concurrentMutableListOf(), lastUpdateTime: Instant = Instant.fromEpochMilliseconds(0))

Types

Link copied to clipboard
class Builder

Fluent builder for Session, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The events of the session, e.g. user input, model response, function call/response, etc. Defaults to a concurrent list so that appending an event (e.g. from one parallel branch) while another reads the history does not throw ConcurrentModificationException.

Link copied to clipboard

The composite identifier of the session (SessionKey.appName, SessionKey.userId, SessionKey.id).

Link copied to clipboard

The last update time of the session. Defaults to the Unix epoch.

Link copied to clipboard

The state of the session.

Functions

Link copied to clipboard

Returns a Builder initialized with this instance's properties, primarily for Java callers. Prefer it over copy from Java: copy takes every property positionally, so its signature changes whenever a property is added. The event list is copied, but state is shared with this instance.