pub struct Session {
pub session_id: Uuid,
pub tenant_id: TenantId,
pub user_id: UserId,
pub client_id: Option<String>,
pub session_type_id: Option<Uuid>,
pub enabled_capabilities: Option<Value>,
pub metadata: Option<Value>,
pub lifecycle_state: LifecycleState,
pub share_token: Option<SecretString>,
pub created_at: OffsetDateTime,
pub updated_at: OffsetDateTime,
}Expand description
A chat session: the top-level container that groups a conversation’s messages, tenant/user ownership, backend plugin binding, and lifecycle.
Debug is implemented manually to redact share_token — it is a
cryptographic bearer secret that grants read-only access to the session
and must never appear in logs, tracing spans, or test output.
Fields§
§session_id: UuidUnique session identifier (primary key).
tenant_id: TenantIdTenant that owns the session; all queries are scoped by this value.
user_id: UserIdEnd-user who created the session (opaque string from the auth token).
client_id: Option<String>Optional client identifier (e.g., app/device) that initiated the session.
session_type_id: Option<Uuid>Session type this session is bound to; determines which backend plugin
handles messages and which capabilities are exposed. May be None for
session types that haven’t been configured yet.
enabled_capabilities: Option<Value>Capability values (from the Capability schema declared by the plugin)
actually enabled for this session — typed as JSON because the shape is
plugin-defined. Use CapabilityValue for structured access.
metadata: Option<Value>Opaque per-session metadata (client-defined). Chat Engine never
interprets this field beyond storing/retrieving it. Also used internally
to persist memory_strategy, retention_policy, and share_expires_at
under reserved keys.
lifecycle_state: LifecycleStateCurrent lifecycle state (active / archived / soft_deleted / hard_deleted).
Cryptographically-random token granting read-only access to a shared view of this session. Present only while sharing is active.
created_at: OffsetDateTimeCreation timestamp (UTC, RFC3339 on the wire).
updated_at: OffsetDateTimeLast-modified timestamp (UTC, RFC3339 on the wire).