alma-memory 0.4.0__py3-none-any.whl → 0.5.1__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.
- alma/__init__.py +121 -45
- alma/confidence/__init__.py +1 -1
- alma/confidence/engine.py +92 -58
- alma/confidence/types.py +34 -14
- alma/config/loader.py +3 -2
- alma/consolidation/__init__.py +23 -0
- alma/consolidation/engine.py +678 -0
- alma/consolidation/prompts.py +84 -0
- alma/core.py +136 -28
- alma/domains/__init__.py +6 -6
- alma/domains/factory.py +12 -9
- alma/domains/schemas.py +17 -3
- alma/domains/types.py +8 -4
- alma/events/__init__.py +75 -0
- alma/events/emitter.py +284 -0
- alma/events/storage_mixin.py +246 -0
- alma/events/types.py +126 -0
- alma/events/webhook.py +425 -0
- alma/exceptions.py +49 -0
- alma/extraction/__init__.py +31 -0
- alma/extraction/auto_learner.py +265 -0
- alma/extraction/extractor.py +420 -0
- alma/graph/__init__.py +106 -0
- alma/graph/backends/__init__.py +32 -0
- alma/graph/backends/kuzu.py +624 -0
- alma/graph/backends/memgraph.py +432 -0
- alma/graph/backends/memory.py +236 -0
- alma/graph/backends/neo4j.py +417 -0
- alma/graph/base.py +159 -0
- alma/graph/extraction.py +198 -0
- alma/graph/store.py +860 -0
- alma/harness/__init__.py +4 -4
- alma/harness/base.py +18 -9
- alma/harness/domains.py +27 -11
- alma/initializer/__init__.py +1 -1
- alma/initializer/initializer.py +51 -43
- alma/initializer/types.py +25 -17
- alma/integration/__init__.py +9 -9
- alma/integration/claude_agents.py +32 -20
- alma/integration/helena.py +32 -22
- alma/integration/victor.py +57 -33
- alma/learning/__init__.py +27 -27
- alma/learning/forgetting.py +198 -148
- alma/learning/heuristic_extractor.py +40 -24
- alma/learning/protocols.py +65 -17
- alma/learning/validation.py +7 -2
- alma/mcp/__init__.py +4 -4
- alma/mcp/__main__.py +2 -1
- alma/mcp/resources.py +17 -16
- alma/mcp/server.py +102 -44
- alma/mcp/tools.py +180 -45
- alma/observability/__init__.py +84 -0
- alma/observability/config.py +302 -0
- alma/observability/logging.py +424 -0
- alma/observability/metrics.py +583 -0
- alma/observability/tracing.py +440 -0
- alma/progress/__init__.py +3 -3
- alma/progress/tracker.py +26 -20
- alma/progress/types.py +8 -12
- alma/py.typed +0 -0
- alma/retrieval/__init__.py +11 -11
- alma/retrieval/cache.py +20 -21
- alma/retrieval/embeddings.py +4 -4
- alma/retrieval/engine.py +179 -39
- alma/retrieval/scoring.py +73 -63
- alma/session/__init__.py +2 -2
- alma/session/manager.py +5 -5
- alma/session/types.py +5 -4
- alma/storage/__init__.py +70 -0
- alma/storage/azure_cosmos.py +414 -133
- alma/storage/base.py +215 -4
- alma/storage/chroma.py +1443 -0
- alma/storage/constants.py +103 -0
- alma/storage/file_based.py +59 -28
- alma/storage/migrations/__init__.py +21 -0
- alma/storage/migrations/base.py +321 -0
- alma/storage/migrations/runner.py +323 -0
- alma/storage/migrations/version_stores.py +337 -0
- alma/storage/migrations/versions/__init__.py +11 -0
- alma/storage/migrations/versions/v1_0_0.py +373 -0
- alma/storage/pinecone.py +1080 -0
- alma/storage/postgresql.py +1559 -0
- alma/storage/qdrant.py +1306 -0
- alma/storage/sqlite_local.py +504 -60
- alma/testing/__init__.py +46 -0
- alma/testing/factories.py +301 -0
- alma/testing/mocks.py +389 -0
- alma/types.py +62 -14
- alma_memory-0.5.1.dist-info/METADATA +939 -0
- alma_memory-0.5.1.dist-info/RECORD +93 -0
- {alma_memory-0.4.0.dist-info → alma_memory-0.5.1.dist-info}/WHEEL +1 -1
- alma_memory-0.4.0.dist-info/METADATA +0 -488
- alma_memory-0.4.0.dist-info/RECORD +0 -52
- {alma_memory-0.4.0.dist-info → alma_memory-0.5.1.dist-info}/top_level.txt +0 -0
alma/session/manager.py
CHANGED
|
@@ -4,14 +4,14 @@ Session Manager.
|
|
|
4
4
|
Manages session continuity, handoffs, and quick context reload.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
from datetime import datetime, timezone
|
|
8
|
-
from typing import Optional, List, Dict, Any, Callable
|
|
9
|
-
import uuid
|
|
10
7
|
import logging
|
|
8
|
+
import uuid
|
|
9
|
+
from datetime import datetime, timezone
|
|
10
|
+
from typing import Any, Callable, Dict, List, Optional
|
|
11
11
|
|
|
12
12
|
from alma.session.types import (
|
|
13
|
-
SessionHandoff,
|
|
14
13
|
SessionContext,
|
|
14
|
+
SessionHandoff,
|
|
15
15
|
SessionOutcome,
|
|
16
16
|
)
|
|
17
17
|
|
|
@@ -281,7 +281,7 @@ class SessionManager:
|
|
|
281
281
|
|
|
282
282
|
# Trim to max
|
|
283
283
|
if len(self._handoffs[agent]) > self.max_handoffs:
|
|
284
|
-
self._handoffs[agent] = self._handoffs[agent][-self.max_handoffs:]
|
|
284
|
+
self._handoffs[agent] = self._handoffs[agent][-self.max_handoffs :]
|
|
285
285
|
|
|
286
286
|
# TODO: Persist to storage backend when integrated
|
|
287
287
|
|
alma/session/types.py
CHANGED
|
@@ -4,11 +4,10 @@ Session Management Types.
|
|
|
4
4
|
Data models for session continuity and handoffs.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
+
import uuid
|
|
7
8
|
from dataclasses import dataclass, field
|
|
8
9
|
from datetime import datetime, timezone
|
|
9
|
-
from typing import
|
|
10
|
-
import uuid
|
|
11
|
-
|
|
10
|
+
from typing import Any, Dict, List, Literal, Optional
|
|
12
11
|
|
|
13
12
|
SessionOutcome = Literal["success", "failure", "interrupted", "unknown"]
|
|
14
13
|
|
|
@@ -276,7 +275,9 @@ class SessionContext:
|
|
|
276
275
|
if "branch" in self.codebase_state:
|
|
277
276
|
lines.append(f"Branch: {self.codebase_state['branch']}")
|
|
278
277
|
if "uncommitted" in self.codebase_state:
|
|
279
|
-
lines.append(
|
|
278
|
+
lines.append(
|
|
279
|
+
f"Uncommitted Changes: {self.codebase_state['uncommitted']}"
|
|
280
|
+
)
|
|
280
281
|
|
|
281
282
|
# Rules
|
|
282
283
|
if self.rules_of_engagement:
|
alma/storage/__init__.py
CHANGED
|
@@ -1,20 +1,90 @@
|
|
|
1
1
|
"""ALMA Storage Backends."""
|
|
2
2
|
|
|
3
3
|
from alma.storage.base import StorageBackend
|
|
4
|
+
from alma.storage.constants import (
|
|
5
|
+
AZURE_COSMOS_CONTAINER_NAMES,
|
|
6
|
+
POSTGRESQL_TABLE_NAMES,
|
|
7
|
+
SQLITE_TABLE_NAMES,
|
|
8
|
+
MemoryType,
|
|
9
|
+
get_table_name,
|
|
10
|
+
get_table_names,
|
|
11
|
+
)
|
|
4
12
|
from alma.storage.file_based import FileBasedStorage
|
|
13
|
+
from alma.storage.migrations import (
|
|
14
|
+
Migration,
|
|
15
|
+
MigrationError,
|
|
16
|
+
MigrationRegistry,
|
|
17
|
+
MigrationRunner,
|
|
18
|
+
SchemaVersion,
|
|
19
|
+
)
|
|
5
20
|
from alma.storage.sqlite_local import SQLiteStorage
|
|
6
21
|
|
|
7
22
|
# Azure Cosmos DB is optional - requires azure-cosmos package
|
|
8
23
|
try:
|
|
9
24
|
from alma.storage.azure_cosmos import AzureCosmosStorage
|
|
25
|
+
|
|
10
26
|
_HAS_AZURE = True
|
|
11
27
|
except ImportError:
|
|
12
28
|
AzureCosmosStorage = None # type: ignore
|
|
13
29
|
_HAS_AZURE = False
|
|
14
30
|
|
|
31
|
+
# PostgreSQL is optional - requires psycopg package
|
|
32
|
+
try:
|
|
33
|
+
from alma.storage.postgresql import PostgreSQLStorage
|
|
34
|
+
|
|
35
|
+
_HAS_POSTGRES = True
|
|
36
|
+
except ImportError:
|
|
37
|
+
PostgreSQLStorage = None # type: ignore
|
|
38
|
+
_HAS_POSTGRES = False
|
|
39
|
+
|
|
40
|
+
# Qdrant is optional - requires qdrant-client package
|
|
41
|
+
try:
|
|
42
|
+
from alma.storage.qdrant import QdrantStorage
|
|
43
|
+
|
|
44
|
+
_HAS_QDRANT = True
|
|
45
|
+
except ImportError:
|
|
46
|
+
QdrantStorage = None # type: ignore
|
|
47
|
+
_HAS_QDRANT = False
|
|
48
|
+
|
|
49
|
+
# ChromaDB is optional - requires chromadb package
|
|
50
|
+
try:
|
|
51
|
+
from alma.storage.chroma import ChromaStorage
|
|
52
|
+
|
|
53
|
+
_HAS_CHROMA = True
|
|
54
|
+
except ImportError:
|
|
55
|
+
ChromaStorage = None # type: ignore
|
|
56
|
+
_HAS_CHROMA = False
|
|
57
|
+
|
|
58
|
+
# Pinecone is optional - requires pinecone-client package
|
|
59
|
+
try:
|
|
60
|
+
from alma.storage.pinecone import PineconeStorage
|
|
61
|
+
|
|
62
|
+
_HAS_PINECONE = True
|
|
63
|
+
except ImportError:
|
|
64
|
+
PineconeStorage = None # type: ignore
|
|
65
|
+
_HAS_PINECONE = False
|
|
66
|
+
|
|
15
67
|
__all__ = [
|
|
68
|
+
# Storage backends
|
|
16
69
|
"StorageBackend",
|
|
17
70
|
"FileBasedStorage",
|
|
18
71
|
"SQLiteStorage",
|
|
19
72
|
"AzureCosmosStorage",
|
|
73
|
+
"PostgreSQLStorage",
|
|
74
|
+
"QdrantStorage",
|
|
75
|
+
"ChromaStorage",
|
|
76
|
+
"PineconeStorage",
|
|
77
|
+
# Migration framework
|
|
78
|
+
"Migration",
|
|
79
|
+
"MigrationError",
|
|
80
|
+
"MigrationRegistry",
|
|
81
|
+
"MigrationRunner",
|
|
82
|
+
"SchemaVersion",
|
|
83
|
+
# Constants for consistent naming
|
|
84
|
+
"MemoryType",
|
|
85
|
+
"get_table_name",
|
|
86
|
+
"get_table_names",
|
|
87
|
+
"POSTGRESQL_TABLE_NAMES",
|
|
88
|
+
"SQLITE_TABLE_NAMES",
|
|
89
|
+
"AZURE_COSMOS_CONTAINER_NAMES",
|
|
20
90
|
]
|