forked from cardosofelipe/fast-next-template
feat(memory): add working memory implementation (Issue #89)
Implements session-scoped ephemeral memory with: Storage Backends: - InMemoryStorage: Thread-safe fallback with TTL support and capacity limits - RedisStorage: Primary storage with connection pooling and JSON serialization - Auto-fallback from Redis to in-memory when unavailable WorkingMemory Class: - Key-value storage with TTL and reserved key protection - Task state tracking with progress updates - Scratchpad for reasoning steps with timestamps - Checkpoint/snapshot support for recovery - Factory methods for auto-configured storage Tests: - 55 unit tests covering all functionality - Tests for basic ops, TTL, capacity, concurrency - Tests for task state, scratchpad, checkpoints 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,6 +94,22 @@ class MemoryStorageError(MemoryError):
|
||||
self.backend = backend
|
||||
|
||||
|
||||
class MemoryConnectionError(MemoryError):
|
||||
"""Raised when memory storage connection fails."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
message: str = "Memory connection failed",
|
||||
*,
|
||||
backend: str | None = None,
|
||||
host: str | None = None,
|
||||
**kwargs: Any,
|
||||
) -> None:
|
||||
super().__init__(message, **kwargs)
|
||||
self.backend = backend
|
||||
self.host = host
|
||||
|
||||
|
||||
class MemorySerializationError(MemoryError):
|
||||
"""Raised when memory serialization/deserialization fails."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user