Skip to content

Index

diapason.sessions

Cross-channel session management.

Session dataclass

A conversation session with cross-channel message history.

SessionIdentity dataclass

Canonical user identity across channels.

SessionStore

SQLite-backed session persistence with consolidation and decay.

consolidate(session_id)

Consolidate old messages: summarize oldest half, keep recent half.

decay(max_age_hours=None)

Remove sessions older than max_age_hours. Returns count removed.

get_or_create(user_id, *, channel='', channel_user_id='', display_name='')

Get existing session for user or create a new one.

Link a channel identity to an existing session.

list_sessions(*, active_only=True, limit=50)

List sessions, optionally filtering to active only.

save_message(session_id, role, content, *, channel='', metadata=None)

Persist a message to a session.