chuk-ai-session-manager 0.3__tar.gz → 0.4.1__tar.gz

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.
Files changed (51) hide show
  1. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/PKG-INFO +2 -38
  2. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/README.md +0 -37
  3. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/pyproject.toml +34 -9
  4. chuk_ai_session_manager-0.4.1/src/chuk_ai_session_manager/__init__.py +329 -0
  5. chuk_ai_session_manager-0.4.1/src/chuk_ai_session_manager/api/simple_api.py +358 -0
  6. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/models/session.py +11 -4
  7. chuk_ai_session_manager-0.4.1/src/chuk_ai_session_manager/models/session_event.py +270 -0
  8. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/models/token_usage.py +13 -2
  9. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/sample_tools.py +1 -1
  10. chuk_ai_session_manager-0.4.1/src/chuk_ai_session_manager/session_manager.py +760 -0
  11. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/session_prompt_builder.py +70 -62
  12. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/session_storage.py +19 -6
  13. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager.egg-info/PKG-INFO +2 -38
  14. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager.egg-info/SOURCES.txt +11 -7
  15. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager.egg-info/requires.txt +1 -0
  16. chuk_ai_session_manager-0.4.1/tests/test_basic_functionality.py +341 -0
  17. chuk_ai_session_manager-0.4.1/tests/test_exceptions.py +436 -0
  18. chuk_ai_session_manager-0.4.1/tests/test_infinite_conversation.py +446 -0
  19. chuk_ai_session_manager-0.4.1/tests/test_models.py +487 -0
  20. chuk_ai_session_manager-0.4.1/tests/test_prompt_builder.py +668 -0
  21. chuk_ai_session_manager-0.4.1/tests/test_session_manager.py +668 -0
  22. chuk_ai_session_manager-0.4.1/tests/test_session_manager_advanced.py +543 -0
  23. chuk_ai_session_manager-0.4.1/tests/test_simple.py +569 -0
  24. chuk_ai_session_manager-0.4.1/tests/test_simple_api.py +856 -0
  25. chuk_ai_session_manager-0.4.1/tests/test_storage.py +466 -0
  26. chuk_ai_session_manager-0.4.1/tests/test_system_prompt.py +320 -0
  27. chuk_ai_session_manager-0.4.1/tests/test_tools.py +597 -0
  28. chuk_ai_session_manager-0.3/src/chuk_ai_session_manager/__init__.py +0 -71
  29. chuk_ai_session_manager-0.3/src/chuk_ai_session_manager/api/simple_api.py +0 -507
  30. chuk_ai_session_manager-0.3/src/chuk_ai_session_manager/models/session_event.py +0 -166
  31. chuk_ai_session_manager-0.3/src/chuk_ai_session_manager/utils/__init__.py +0 -0
  32. chuk_ai_session_manager-0.3/src/chuk_ai_session_manager/utils/status_display_utils.py +0 -474
  33. chuk_ai_session_manager-0.3/tests/test_basic_functionality.py +0 -126
  34. chuk_ai_session_manager-0.3/tests/test_chuk_session_storage.py +0 -249
  35. chuk_ai_session_manager-0.3/tests/test_infinite_conversation.py +0 -143
  36. chuk_ai_session_manager-0.3/tests/test_infinite_conversation_advanced.py +0 -308
  37. chuk_ai_session_manager-0.3/tests/test_session.py +0 -285
  38. chuk_ai_session_manager-0.3/tests/test_session_aware_tool_processor.py +0 -117
  39. chuk_ai_session_manager-0.3/tests/test_session_prompt_builder.py +0 -57
  40. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/setup.cfg +0 -0
  41. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/api/__init__.py +0 -0
  42. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/exceptions.py +0 -0
  43. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/infinite_conversation.py +0 -0
  44. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/models/__init__.py +0 -0
  45. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/models/event_source.py +0 -0
  46. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/models/event_type.py +0 -0
  47. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/models/session_metadata.py +0 -0
  48. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/models/session_run.py +0 -0
  49. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager/session_aware_tool_processor.py +0 -0
  50. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager.egg-info/dependency_links.txt +0 -0
  51. {chuk_ai_session_manager-0.3 → chuk_ai_session_manager-0.4.1}/src/chuk_ai_session_manager.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chuk-ai-session-manager
3
- Version: 0.3
3
+ Version: 0.4.1
4
4
  Summary: Session manager for AI applications
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -14,6 +14,7 @@ Requires-Dist: redis>=4.0.0; extra == "redis"
14
14
  Provides-Extra: dev
15
15
  Requires-Dist: pytest>=7.0.0; extra == "dev"
16
16
  Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
17
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
17
18
  Requires-Dist: redis>=4.0.0; extra == "dev"
18
19
  Requires-Dist: black>=23.0.0; extra == "dev"
19
20
  Requires-Dist: isort>=5.12.0; extra == "dev"
@@ -311,36 +312,6 @@ pip install chuk-ai-session-manager
311
312
  | **Production Ready** | Requires additional work | Built for production |
312
313
  | **Learning Curve** | Steep | 5 minutes to productivity |
313
314
 
314
- ## 🚀 Migration Guides
315
-
316
- ### From LangChain Memory
317
- ```python
318
- # Old LangChain way
319
- from langchain.memory import ConversationBufferMemory
320
- memory = ConversationBufferMemory()
321
- memory.save_context({"input": "Hi"}, {"output": "Hello"})
322
-
323
- # New CHUK way (much simpler!)
324
- from chuk_ai_session_manager import track_conversation
325
- await track_conversation("Hi", "Hello")
326
- ```
327
-
328
- ### From Manual Session Management
329
- ```python
330
- # Old manual way
331
- conversations = {}
332
- def save_conversation(user_id, message, response):
333
- if user_id not in conversations:
334
- conversations[user_id] = []
335
- conversations[user_id].append({"user": message, "ai": response})
336
-
337
- # New CHUK way
338
- from chuk_ai_session_manager import SessionManager
339
- sm = SessionManager(session_id=user_id)
340
- await sm.user_says(message)
341
- await sm.ai_responds(response)
342
- ```
343
-
344
315
  ## 📖 More Examples
345
316
 
346
317
  Check out the `/examples` directory for complete working examples:
@@ -362,16 +333,9 @@ Check out the `/examples` directory for complete working examples:
362
333
  - ✅ Complete conversation analytics and observability
363
334
  - ✅ Framework-agnostic solution that works with any LLM library
364
335
 
365
- **Consider alternatives if you:**
366
- - ❌ Only need basic in-memory conversation history
367
- - ❌ Are locked into a specific framework (LangChain, etc.)
368
- - ❌ Don't need cost tracking or analytics
369
- - ❌ Are building simple, stateless AI applications
370
-
371
336
  ## 🤝 Community & Support
372
337
 
373
338
  - 📖 **Documentation**: [Full docs with tutorials](link-to-docs)
374
- - 💬 **Discord**: Join our community for help and discussions
375
339
  - 🐛 **Issues**: Report bugs on GitHub
376
340
  - 💡 **Feature Requests**: Suggest new features
377
341
  - 📧 **Support**: enterprise@chuk.dev for production support
@@ -289,36 +289,6 @@ pip install chuk-ai-session-manager
289
289
  | **Production Ready** | Requires additional work | Built for production |
290
290
  | **Learning Curve** | Steep | 5 minutes to productivity |
291
291
 
292
- ## 🚀 Migration Guides
293
-
294
- ### From LangChain Memory
295
- ```python
296
- # Old LangChain way
297
- from langchain.memory import ConversationBufferMemory
298
- memory = ConversationBufferMemory()
299
- memory.save_context({"input": "Hi"}, {"output": "Hello"})
300
-
301
- # New CHUK way (much simpler!)
302
- from chuk_ai_session_manager import track_conversation
303
- await track_conversation("Hi", "Hello")
304
- ```
305
-
306
- ### From Manual Session Management
307
- ```python
308
- # Old manual way
309
- conversations = {}
310
- def save_conversation(user_id, message, response):
311
- if user_id not in conversations:
312
- conversations[user_id] = []
313
- conversations[user_id].append({"user": message, "ai": response})
314
-
315
- # New CHUK way
316
- from chuk_ai_session_manager import SessionManager
317
- sm = SessionManager(session_id=user_id)
318
- await sm.user_says(message)
319
- await sm.ai_responds(response)
320
- ```
321
-
322
292
  ## 📖 More Examples
323
293
 
324
294
  Check out the `/examples` directory for complete working examples:
@@ -340,16 +310,9 @@ Check out the `/examples` directory for complete working examples:
340
310
  - ✅ Complete conversation analytics and observability
341
311
  - ✅ Framework-agnostic solution that works with any LLM library
342
312
 
343
- **Consider alternatives if you:**
344
- - ❌ Only need basic in-memory conversation history
345
- - ❌ Are locked into a specific framework (LangChain, etc.)
346
- - ❌ Don't need cost tracking or analytics
347
- - ❌ Are building simple, stateless AI applications
348
-
349
313
  ## 🤝 Community & Support
350
314
 
351
315
  - 📖 **Documentation**: [Full docs with tutorials](link-to-docs)
352
- - 💬 **Discord**: Join our community for help and discussions
353
316
  - 🐛 **Issues**: Report bugs on GitHub
354
317
  - 💡 **Feature Requests**: Suggest new features
355
318
  - 📧 **Support**: enterprise@chuk.dev for production support
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0", "wheel"]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "chuk-ai-session-manager"
7
- version = "0.3"
7
+ version = "0.4.1"
8
8
  description = "Session manager for AI applications"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -21,25 +21,50 @@ redis = ["redis>=4.0.0"]
21
21
  dev = [
22
22
  "pytest>=7.0.0",
23
23
  "pytest-cov>=4.0.0",
24
- "redis>=4.0.0", # Redis included in dev dependencies
24
+ "pytest-asyncio>=0.21.0", # Essential for async tests
25
+ "redis>=4.0.0",
25
26
  "black>=23.0.0",
26
27
  "isort>=5.12.0",
27
28
  "mypy>=1.0.0",
28
29
  ]
29
30
  full = []
30
31
 
31
- # Tell setuptools to look in src/ for your chuk session manager package
32
+ # Configure setuptools for src/ layout
32
33
  [tool.setuptools.packages.find]
33
- where = ["src"]
34
+ where = ["src"]
34
35
  include = ["chuk_ai_session_manager*"]
35
36
 
36
- # pytest settings so it finds your src/ layout automatically
37
+ # IMPORTANT: This tells setuptools where packages are located
38
+ [tool.setuptools.package-dir]
39
+ "" = "src"
40
+
41
+ # pytest settings configured for src/ layout
37
42
  [tool.pytest.ini_options]
38
43
  testpaths = ["tests"]
39
44
  pythonpath = ["src"]
40
- addopts = "-v"
45
+ asyncio_mode = "auto"
41
46
  asyncio_default_fixture_loop_scope = "function"
42
- asyncio_mode = "strict"
47
+ python_files = ["test_*.py"]
48
+ python_classes = ["Test*"]
49
+ python_functions = ["test_*"]
50
+ addopts = [
51
+ "--strict-markers",
52
+ "--strict-config",
53
+ "-ra",
54
+ "--tb=short",
55
+ "--import-mode=importlib",
56
+ ]
57
+ markers = [
58
+ "unit: Unit tests",
59
+ "integration: Integration tests",
60
+ "slow: Slow tests",
61
+ "asyncio: Async tests",
62
+ ]
63
+ filterwarnings = [
64
+ "ignore::DeprecationWarning",
65
+ "ignore::PendingDeprecationWarning",
66
+ "ignore::pytest.PytestUnraisableExceptionWarning",
67
+ ]
43
68
 
44
69
  [tool.black]
45
70
  line-length = 88
@@ -60,4 +85,4 @@ dev = [
60
85
  "pytest-asyncio>=1.0.0",
61
86
  "tiktoken>=0.9.0",
62
87
  "uvicorn>=0.34.2",
63
- ]
88
+ ]
@@ -0,0 +1,329 @@
1
+ # src/chuk_ai_session_manager/__init__.py
2
+ """
3
+ CHUK AI Session Manager - Simple Developer API
4
+
5
+ A powerful session management system for AI applications that provides:
6
+ - Automatic conversation tracking
7
+ - Token usage monitoring
8
+ - Tool call logging
9
+ - Infinite context support with automatic summarization
10
+ - Hierarchical session relationships
11
+ - CHUK Sessions backend integration
12
+
13
+ Quick Start:
14
+ from chuk_ai_session_manager import track_conversation
15
+
16
+ # Track any conversation
17
+ await track_conversation("Hello!", "Hi there! How can I help?")
18
+
19
+ # Or use the session manager directly
20
+ from chuk_ai_session_manager import SessionManager
21
+ sm = SessionManager()
22
+ await sm.user_says("What's the weather?")
23
+ await sm.ai_responds("It's sunny and 72°F", model="gpt-4")
24
+
25
+ Infinite Context Example:
26
+ # Automatically handles long conversations with summarization
27
+ sm = SessionManager(infinite_context=True, token_threshold=4000)
28
+ await sm.user_says("Tell me about machine learning")
29
+ await sm.ai_responds("Machine learning is...", model="gpt-4")
30
+ # Session will auto-segment when limits are reached
31
+
32
+ Advanced Usage:
33
+ # Access the full Session model for detailed control
34
+ from chuk_ai_session_manager import Session, SessionEvent
35
+
36
+ session = await Session.create()
37
+ event = await SessionEvent.create_with_tokens(
38
+ message="Hello", prompt="Hello", model="gpt-4"
39
+ )
40
+ await session.add_event_and_save(event)
41
+ """
42
+
43
+ import logging
44
+ from typing import Optional
45
+
46
+ # Package version
47
+ __version__ = "0.4"
48
+
49
+ # Set up package-level logger
50
+ logger = logging.getLogger(__name__)
51
+
52
+ # Core enums and constants (no dependencies)
53
+ try:
54
+ from chuk_ai_session_manager.models.event_source import EventSource
55
+ from chuk_ai_session_manager.models.event_type import EventType
56
+ except ImportError as e:
57
+ logger.warning(f"Could not import core enums: {e}")
58
+ EventSource = None
59
+ EventType = None
60
+
61
+ # Storage setup function (no circular dependencies)
62
+ try:
63
+ from chuk_ai_session_manager.session_storage import setup_chuk_sessions_storage
64
+ except ImportError as e:
65
+ logger.warning(f"Could not import storage setup: {e}")
66
+ setup_chuk_sessions_storage = None
67
+
68
+ # Exception classes
69
+ try:
70
+ from chuk_ai_session_manager.exceptions import (
71
+ SessionManagerError,
72
+ SessionNotFound,
73
+ SessionAlreadyExists,
74
+ InvalidSessionOperation,
75
+ TokenLimitExceeded,
76
+ StorageError,
77
+ ToolProcessingError
78
+ )
79
+ except ImportError as e:
80
+ logger.warning(f"Could not import exceptions: {e}")
81
+ # Define minimal fallback exceptions
82
+ class SessionManagerError(Exception):
83
+ """Base exception for session manager errors."""
84
+ pass
85
+
86
+ SessionNotFound = SessionManagerError
87
+ SessionAlreadyExists = SessionManagerError
88
+ InvalidSessionOperation = SessionManagerError
89
+ TokenLimitExceeded = SessionManagerError
90
+ StorageError = SessionManagerError
91
+ ToolProcessingError = SessionManagerError
92
+
93
+ # Core models (may have some dependencies)
94
+ Session = None
95
+ SessionEvent = None
96
+ SessionMetadata = None
97
+ SessionRun = None
98
+ RunStatus = None
99
+ TokenUsage = None
100
+
101
+ try:
102
+ from chuk_ai_session_manager.models.session_metadata import SessionMetadata
103
+ except ImportError as e:
104
+ logger.debug(f"Could not import SessionMetadata: {e}")
105
+
106
+ try:
107
+ from chuk_ai_session_manager.models.session_run import SessionRun, RunStatus
108
+ except ImportError as e:
109
+ logger.debug(f"Could not import SessionRun: {e}")
110
+
111
+ try:
112
+ from chuk_ai_session_manager.models.token_usage import TokenUsage, TokenSummary
113
+ except ImportError as e:
114
+ logger.debug(f"Could not import TokenUsage: {e}")
115
+ TokenSummary = None
116
+
117
+ try:
118
+ from chuk_ai_session_manager.models.session_event import SessionEvent
119
+ except ImportError as e:
120
+ logger.debug(f"Could not import SessionEvent: {e}")
121
+
122
+ try:
123
+ from chuk_ai_session_manager.models.session import Session
124
+ except ImportError as e:
125
+ logger.debug(f"Could not import Session: {e}")
126
+
127
+ # Simple API (highest level, most dependencies)
128
+ SessionManager = None
129
+ track_conversation = None
130
+ track_llm_call = None
131
+ quick_conversation = None
132
+ track_infinite_conversation = None
133
+
134
+ try:
135
+ from chuk_ai_session_manager.api.simple_api import (
136
+ SessionManager,
137
+ track_conversation,
138
+ track_llm_call,
139
+ quick_conversation,
140
+ track_infinite_conversation
141
+ )
142
+ except ImportError as e:
143
+ logger.warning(f"Could not import simple API: {e}")
144
+
145
+ # Advanced components (optional)
146
+ InfiniteConversationManager = None
147
+ SessionAwareToolProcessor = None
148
+ build_prompt_from_session = None
149
+ PromptStrategy = None
150
+
151
+ try:
152
+ from chuk_ai_session_manager.infinite_conversation import InfiniteConversationManager
153
+ except ImportError as e:
154
+ logger.debug(f"Could not import InfiniteConversationManager: {e}")
155
+
156
+ try:
157
+ from chuk_ai_session_manager.session_aware_tool_processor import SessionAwareToolProcessor
158
+ except ImportError as e:
159
+ logger.debug(f"Could not import SessionAwareToolProcessor: {e}")
160
+
161
+ try:
162
+ from chuk_ai_session_manager.session_prompt_builder import (
163
+ build_prompt_from_session,
164
+ PromptStrategy
165
+ )
166
+ except ImportError as e:
167
+ logger.debug(f"Could not import prompt builder: {e}")
168
+
169
+
170
+ def _auto_setup_storage(sandbox_id: str = "chuk-ai-session-manager",
171
+ default_ttl_hours: int = 24) -> bool:
172
+ """
173
+ Auto-setup storage with sensible defaults if not already configured.
174
+
175
+ Args:
176
+ sandbox_id: CHUK Sessions sandbox ID to use
177
+ default_ttl_hours: Default TTL for sessions
178
+
179
+ Returns:
180
+ True if setup was successful, False otherwise
181
+ """
182
+ if setup_chuk_sessions_storage is None:
183
+ logger.warning("Storage setup not available - imports failed")
184
+ return False
185
+
186
+ try:
187
+ # Try to get existing backend first
188
+ from chuk_ai_session_manager.session_storage import get_backend
189
+ get_backend() # This will trigger setup if needed
190
+ logger.debug("Storage backend already configured")
191
+ return True
192
+ except Exception:
193
+ # Setup with defaults if not configured
194
+ try:
195
+ setup_chuk_sessions_storage(
196
+ sandbox_id=sandbox_id,
197
+ default_ttl_hours=default_ttl_hours
198
+ )
199
+ logger.info(f"Auto-configured storage with sandbox_id='{sandbox_id}'")
200
+ return True
201
+ except Exception as e:
202
+ logger.error(f"Failed to auto-setup storage: {e}")
203
+ return False
204
+
205
+
206
+ def configure_storage(sandbox_id: str = "chuk-ai-session-manager",
207
+ default_ttl_hours: int = 24) -> bool:
208
+ """
209
+ Explicitly configure the storage backend.
210
+
211
+ Args:
212
+ sandbox_id: CHUK Sessions sandbox ID to use
213
+ default_ttl_hours: Default TTL for sessions
214
+
215
+ Returns:
216
+ True if configuration was successful, False otherwise
217
+ """
218
+ return _auto_setup_storage(sandbox_id, default_ttl_hours)
219
+
220
+
221
+ def get_version() -> str:
222
+ """Get the package version."""
223
+ return __version__
224
+
225
+
226
+ def is_available() -> dict:
227
+ """
228
+ Check which components are available.
229
+
230
+ Returns:
231
+ Dictionary showing availability of each component
232
+ """
233
+ return {
234
+ "core_enums": EventSource is not None and EventType is not None,
235
+ "core_models": Session is not None and SessionEvent is not None,
236
+ "simple_api": SessionManager is not None,
237
+ "storage": setup_chuk_sessions_storage is not None,
238
+ "infinite_context": InfiniteConversationManager is not None,
239
+ "tool_processor": SessionAwareToolProcessor is not None,
240
+ "prompt_builder": build_prompt_from_session is not None,
241
+ "token_tracking": TokenUsage is not None,
242
+ "exceptions": True, # Always available (fallbacks defined)
243
+ }
244
+
245
+
246
+ # Main exports - prioritize what works
247
+ __all__ = []
248
+
249
+ # Always available
250
+ __all__.extend([
251
+ "__version__",
252
+ "get_version",
253
+ "is_available",
254
+ "configure_storage",
255
+ ])
256
+
257
+ # Add exception classes (always available)
258
+ __all__.extend([
259
+ "SessionManagerError",
260
+ "SessionNotFound",
261
+ "SessionAlreadyExists",
262
+ "InvalidSessionOperation",
263
+ "TokenLimitExceeded",
264
+ "StorageError",
265
+ "ToolProcessingError",
266
+ ])
267
+
268
+ # Add available components conditionally
269
+ if EventSource is not None:
270
+ __all__.append("EventSource")
271
+ if EventType is not None:
272
+ __all__.append("EventType")
273
+
274
+ if setup_chuk_sessions_storage is not None:
275
+ __all__.append("setup_chuk_sessions_storage")
276
+
277
+ # Simple API (most important for users)
278
+ if SessionManager is not None:
279
+ __all__.extend([
280
+ "SessionManager",
281
+ "track_conversation",
282
+ "track_llm_call",
283
+ "quick_conversation",
284
+ "track_infinite_conversation",
285
+ ])
286
+
287
+ # Core models
288
+ if Session is not None:
289
+ __all__.append("Session")
290
+ if SessionEvent is not None:
291
+ __all__.append("SessionEvent")
292
+ if SessionMetadata is not None:
293
+ __all__.append("SessionMetadata")
294
+ if SessionRun is not None:
295
+ __all__.extend(["SessionRun", "RunStatus"])
296
+ if TokenUsage is not None:
297
+ __all__.append("TokenUsage")
298
+ if TokenSummary is not None:
299
+ __all__.append("TokenSummary")
300
+
301
+ # Advanced components
302
+ if InfiniteConversationManager is not None:
303
+ __all__.append("InfiniteConversationManager")
304
+ if SessionAwareToolProcessor is not None:
305
+ __all__.append("SessionAwareToolProcessor")
306
+ if build_prompt_from_session is not None:
307
+ __all__.extend(["build_prompt_from_session", "PromptStrategy"])
308
+
309
+ # Auto-setup on import (with error handling)
310
+ try:
311
+ _auto_setup_storage()
312
+ except Exception as e:
313
+ logger.debug(f"Auto-setup failed (this is normal on first import): {e}")
314
+
315
+ # Log successful import
316
+ available = is_available()
317
+ available_count = sum(available.values())
318
+ total_count = len(available)
319
+ logger.debug(f"CHUK AI Session Manager imported successfully "
320
+ f"({available_count}/{total_count} components available)")
321
+
322
+ # Show warning if core components are missing
323
+ if not available.get("simple_api", False):
324
+ logger.warning(
325
+ "Simple API not available - you may need to install missing dependencies. "
326
+ "Check the logs above for specific import errors."
327
+ )
328
+ elif available_count == total_count:
329
+ logger.debug("All components loaded successfully")