e4dcfc49aa
Tests / Import Check (Python 3.13) (push) Has been cancelled
Tests / Import Check (Python 3.14) (push) Has been cancelled
Tests / Python Tests (Python 3.11) (push) Has been cancelled
Tests / Python Tests (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.14) (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
Tests / Lint and Format (push) Has been cancelled
Tests / Web Node Tests (push) Has been cancelled
Tests / Import Check (Python 3.11) (push) Has been cancelled
Tests / Import Check (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.13) (push) Has been cancelled
60 lines
1.5 KiB
Python
60 lines
1.5 KiB
Python
"""
|
|
Session Management Module
|
|
=========================
|
|
|
|
Provides unified session management for all agent modules.
|
|
|
|
Usage:
|
|
from deeptutor.services.session import BaseSessionManager
|
|
|
|
class MySessionManager(BaseSessionManager):
|
|
def __init__(self):
|
|
super().__init__("my_module")
|
|
|
|
def _get_session_id_prefix(self) -> str:
|
|
return "my_"
|
|
|
|
def _get_default_title(self) -> str:
|
|
return "New My Session"
|
|
|
|
# ... implement other abstract methods
|
|
"""
|
|
|
|
from .base_session_manager import BaseSessionManager
|
|
from .protocol import SessionStoreProtocol
|
|
from .sqlite_store import (
|
|
SQLiteSessionStore,
|
|
get_sqlite_session_store,
|
|
make_imported_session_id,
|
|
)
|
|
from .turn_runtime import TurnRuntimeManager, get_turn_runtime_manager
|
|
|
|
|
|
def get_session_store() -> SessionStoreProtocol:
|
|
"""
|
|
Return the active session store backend.
|
|
|
|
When integrations.pocketbase_url is configured, returns a
|
|
PocketBaseSessionStore. Otherwise falls back to the local
|
|
SQLiteSessionStore (default, zero-config behaviour).
|
|
"""
|
|
from deeptutor.services.pocketbase_client import is_pocketbase_enabled
|
|
|
|
if is_pocketbase_enabled():
|
|
from .pocketbase_store import PocketBaseSessionStore
|
|
|
|
return PocketBaseSessionStore()
|
|
return get_sqlite_session_store()
|
|
|
|
|
|
__all__ = [
|
|
"BaseSessionManager",
|
|
"SessionStoreProtocol",
|
|
"SQLiteSessionStore",
|
|
"TurnRuntimeManager",
|
|
"get_session_store",
|
|
"get_sqlite_session_store",
|
|
"get_turn_runtime_manager",
|
|
"make_imported_session_id",
|
|
]
|