session¶
Full name: tenets.core.session.session
session¶
Session manager with optional SQLite persistence.
Uses an in-memory dict by default. When provided a TenetsConfig, it will persist sessions and context entries via storage.SessionDB while keeping an in-memory mirror for fast access.
This layer is intentionally thin: persistent semantics live in tenets.storage.session_db.SessionDB.
Classes¶
SessionManagerdataclass¶
High-level session manager used by the CLI and core flows.
Source code in tenets/core/session/session.py
Methods:¶
delete¶
Delete a session by name from persistence (if configured) and memory.
Source code in tenets/core/session/session.py
Python
def delete(self, name: str) -> bool:
"""Delete a session by name from persistence (if configured) and memory."""
db_deleted = False
if self._db:
try:
# Rely on default purge_context=True in SessionDB.delete_session
db_deleted = bool(self._db.delete_session(name))
except Exception as e:
self._logger.debug(f"SessionDB delete failed for {name}: {e}")
mem_deleted = self.sessions.pop(name, None) is not None
return bool(db_deleted or mem_deleted)