Skip to content

session_store

session_store

SQLite-backed session store for channel conversations.

Classes

SessionStore

SessionStore(db_path: str = '')

Manages per-sender, per-channel conversation sessions.

Each session tracks conversation history, notification preferences, and pending long responses for the /more command.

Source code in src/openjarvis/server/session_store.py
def __init__(self, db_path: str = "") -> None:
    if not db_path:
        db_path = str(Path.home() / ".openjarvis" / "sessions.db")
    from openjarvis.security.file_utils import secure_create

    secure_create(Path(db_path))
    self._db = sqlite3.connect(db_path, check_same_thread=False)
    self._db.row_factory = sqlite3.Row
    self._create_tables()
Functions
get_notification_targets
get_notification_targets() -> List[Dict[str, str]]

Return all senders with a notification channel.

Source code in src/openjarvis/server/session_store.py
def get_notification_targets(self) -> List[Dict[str, str]]:
    """Return all senders with a notification channel."""
    rows = self._db.execute(
        "SELECT sender_id, channel_type, "
        "preferred_notification_channel "
        "FROM channel_sessions "
        "WHERE preferred_notification_channel IS NOT NULL"
    ).fetchall()
    return [dict(r) for r in rows]