chuk-ai-session-manager 0.4__py3-none-any.whl → 0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chuk_ai_session_manager/__init__.py +166 -34
- chuk_ai_session_manager/api/simple_api.py +276 -425
- chuk_ai_session_manager/models/session.py +11 -4
- chuk_ai_session_manager/models/session_event.py +185 -81
- chuk_ai_session_manager/session_manager.py +760 -0
- chuk_ai_session_manager/session_storage.py +19 -6
- chuk_ai_session_manager-0.5.dist-info/METADATA +896 -0
- {chuk_ai_session_manager-0.4.dist-info → chuk_ai_session_manager-0.5.dist-info}/RECORD +10 -9
- chuk_ai_session_manager-0.4.dist-info/METADATA +0 -354
- {chuk_ai_session_manager-0.4.dist-info → chuk_ai_session_manager-0.5.dist-info}/WHEEL +0 -0
- {chuk_ai_session_manager-0.4.dist-info → chuk_ai_session_manager-0.5.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# chuk_ai_session_manager/session_storage.py
|
|
1
|
+
# src/chuk_ai_session_manager/session_storage.py
|
|
2
2
|
"""
|
|
3
3
|
CHUK Sessions storage backend for AI Session Manager.
|
|
4
4
|
|
|
@@ -11,7 +11,18 @@ import json
|
|
|
11
11
|
import logging
|
|
12
12
|
from typing import Any, Dict, List, Optional
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
# Import the correct class from chuk_sessions
|
|
15
|
+
# We need to determine the correct import based on what's actually available
|
|
16
|
+
try:
|
|
17
|
+
from chuk_sessions import SessionManager as ChukSessionManager
|
|
18
|
+
except ImportError as e:
|
|
19
|
+
raise ImportError(
|
|
20
|
+
f"Cannot import SessionManager from chuk_sessions: {e}\n"
|
|
21
|
+
"Please ensure chuk_sessions is properly installed with: uv add chuk-sessions\n"
|
|
22
|
+
"Or check the available classes in chuk_sessions by running:\n"
|
|
23
|
+
"python -c \"import chuk_sessions; print(dir(chuk_sessions))\""
|
|
24
|
+
) from e
|
|
25
|
+
|
|
15
26
|
from chuk_ai_session_manager.models.session import Session
|
|
16
27
|
|
|
17
28
|
logger = logging.getLogger(__name__)
|
|
@@ -45,19 +56,21 @@ class SessionStorage:
|
|
|
45
56
|
return self._cache[session_id]
|
|
46
57
|
|
|
47
58
|
try:
|
|
48
|
-
|
|
49
|
-
return None
|
|
50
|
-
|
|
59
|
+
# Get session info from CHUK Sessions
|
|
51
60
|
info = await self.chuk.get_session_info(session_id)
|
|
52
61
|
if not info:
|
|
53
62
|
return None
|
|
54
63
|
|
|
64
|
+
# Check if it's an AI session manager session
|
|
55
65
|
custom_metadata = info.get('custom_metadata', {})
|
|
56
|
-
|
|
66
|
+
if custom_metadata.get('session_type') != 'ai_session_manager':
|
|
67
|
+
return None
|
|
57
68
|
|
|
69
|
+
ai_session_json = custom_metadata.get('ai_session_data')
|
|
58
70
|
if not ai_session_json:
|
|
59
71
|
return None
|
|
60
72
|
|
|
73
|
+
# Parse the JSON data
|
|
61
74
|
session_data = json.loads(ai_session_json)
|
|
62
75
|
ai_session = Session.model_validate(session_data)
|
|
63
76
|
|