session
diapason.sessions.session
¶
Session management — cross-channel persistent sessions.
Supports consolidation and decay.
Session
dataclass
¶
A conversation session with cross-channel message history.
SessionIdentity
dataclass
¶
Canonical user identity across channels.
SessionMessage
dataclass
¶
A single message within a session.
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_channel(session_id, channel, channel_user_id)
¶
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.