empathy-framework 5.1.0__py3-none-any.whl → 5.2.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.
- {empathy_framework-5.1.0.dist-info → empathy_framework-5.2.1.dist-info}/METADATA +52 -3
- {empathy_framework-5.1.0.dist-info → empathy_framework-5.2.1.dist-info}/RECORD +71 -30
- empathy_os/__init__.py +1 -1
- empathy_os/cli_router.py +21 -0
- empathy_os/core_modules/__init__.py +15 -0
- empathy_os/mcp/__init__.py +10 -0
- empathy_os/mcp/server.py +506 -0
- empathy_os/memory/control_panel.py +1 -131
- empathy_os/memory/control_panel_support.py +145 -0
- empathy_os/memory/encryption.py +159 -0
- empathy_os/memory/long_term.py +41 -626
- empathy_os/memory/long_term_types.py +99 -0
- empathy_os/memory/mixins/__init__.py +25 -0
- empathy_os/memory/mixins/backend_init_mixin.py +244 -0
- empathy_os/memory/mixins/capabilities_mixin.py +199 -0
- empathy_os/memory/mixins/handoff_mixin.py +208 -0
- empathy_os/memory/mixins/lifecycle_mixin.py +49 -0
- empathy_os/memory/mixins/long_term_mixin.py +352 -0
- empathy_os/memory/mixins/promotion_mixin.py +109 -0
- empathy_os/memory/mixins/short_term_mixin.py +182 -0
- empathy_os/memory/short_term.py +7 -0
- empathy_os/memory/simple_storage.py +302 -0
- empathy_os/memory/storage_backend.py +167 -0
- empathy_os/memory/unified.py +21 -1120
- empathy_os/meta_workflows/cli_commands/__init__.py +56 -0
- empathy_os/meta_workflows/cli_commands/agent_commands.py +321 -0
- empathy_os/meta_workflows/cli_commands/analytics_commands.py +442 -0
- empathy_os/meta_workflows/cli_commands/config_commands.py +232 -0
- empathy_os/meta_workflows/cli_commands/memory_commands.py +182 -0
- empathy_os/meta_workflows/cli_commands/template_commands.py +354 -0
- empathy_os/meta_workflows/cli_commands/workflow_commands.py +382 -0
- empathy_os/meta_workflows/cli_meta_workflows.py +52 -1802
- empathy_os/meta_workflows/intent_detector.py +71 -0
- empathy_os/models/telemetry/__init__.py +71 -0
- empathy_os/models/telemetry/analytics.py +594 -0
- empathy_os/models/telemetry/backend.py +196 -0
- empathy_os/models/telemetry/data_models.py +431 -0
- empathy_os/models/telemetry/storage.py +489 -0
- empathy_os/orchestration/__init__.py +35 -0
- empathy_os/orchestration/execution_strategies.py +481 -0
- empathy_os/orchestration/meta_orchestrator.py +488 -1
- empathy_os/routing/workflow_registry.py +36 -0
- empathy_os/telemetry/cli.py +19 -724
- empathy_os/telemetry/commands/__init__.py +14 -0
- empathy_os/telemetry/commands/dashboard_commands.py +696 -0
- empathy_os/tools.py +183 -0
- empathy_os/workflows/__init__.py +5 -0
- empathy_os/workflows/autonomous_test_gen.py +860 -161
- empathy_os/workflows/base.py +6 -2
- empathy_os/workflows/code_review.py +4 -1
- empathy_os/workflows/document_gen/__init__.py +25 -0
- empathy_os/workflows/document_gen/config.py +30 -0
- empathy_os/workflows/document_gen/report_formatter.py +162 -0
- empathy_os/workflows/document_gen/workflow.py +1426 -0
- empathy_os/workflows/document_gen.py +22 -1598
- empathy_os/workflows/security_audit.py +2 -2
- empathy_os/workflows/security_audit_phase3.py +7 -4
- empathy_os/workflows/seo_optimization.py +633 -0
- empathy_os/workflows/test_gen/__init__.py +52 -0
- empathy_os/workflows/test_gen/ast_analyzer.py +249 -0
- empathy_os/workflows/test_gen/config.py +88 -0
- empathy_os/workflows/test_gen/data_models.py +38 -0
- empathy_os/workflows/test_gen/report_formatter.py +289 -0
- empathy_os/workflows/test_gen/test_templates.py +381 -0
- empathy_os/workflows/test_gen/workflow.py +655 -0
- empathy_os/workflows/test_gen.py +42 -1905
- empathy_os/memory/types 2.py +0 -441
- empathy_os/models/telemetry.py +0 -1660
- {empathy_framework-5.1.0.dist-info → empathy_framework-5.2.1.dist-info}/WHEEL +0 -0
- {empathy_framework-5.1.0.dist-info → empathy_framework-5.2.1.dist-info}/entry_points.txt +0 -0
- {empathy_framework-5.1.0.dist-info → empathy_framework-5.2.1.dist-info}/licenses/LICENSE +0 -0
- {empathy_framework-5.1.0.dist-info → empathy_framework-5.2.1.dist-info}/licenses/LICENSE_CHANGE_ANNOUNCEMENT.md +0 -0
- {empathy_framework-5.1.0.dist-info → empathy_framework-5.2.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"""File-based storage backend for long-term memory patterns
|
|
2
|
+
|
|
3
|
+
Provides simple file-based storage for MemDocs patterns.
|
|
4
|
+
Extracted from long_term.py for better modularity and testability.
|
|
5
|
+
|
|
6
|
+
In production, this can be replaced with actual MemDocs library integration
|
|
7
|
+
or other storage backends (Redis, PostgreSQL, etc.).
|
|
8
|
+
|
|
9
|
+
Key Features:
|
|
10
|
+
- JSON-based file storage
|
|
11
|
+
- Pattern storage with metadata
|
|
12
|
+
- Query support (by classification, creator)
|
|
13
|
+
- Path validation for security
|
|
14
|
+
|
|
15
|
+
Copyright 2025 Smart AI Memory, LLC
|
|
16
|
+
Licensed under Fair Source 0.9
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import json
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from typing import Any
|
|
22
|
+
|
|
23
|
+
import structlog
|
|
24
|
+
|
|
25
|
+
from empathy_os.config import _validate_file_path
|
|
26
|
+
|
|
27
|
+
logger = structlog.get_logger(__name__)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class MemDocsStorage:
|
|
31
|
+
"""Mock/Simple MemDocs storage backend.
|
|
32
|
+
|
|
33
|
+
In production, this would integrate with the actual MemDocs library.
|
|
34
|
+
For now, provides a simple file-based storage for testing.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def __init__(self, storage_dir: str = "./memdocs_storage"):
|
|
38
|
+
"""Initialize storage backend.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
storage_dir: Directory for pattern storage
|
|
42
|
+
|
|
43
|
+
"""
|
|
44
|
+
self.storage_dir = Path(storage_dir)
|
|
45
|
+
self.storage_dir.mkdir(parents=True, exist_ok=True)
|
|
46
|
+
logger.info("memdocs_storage_initialized", storage_dir=str(self.storage_dir))
|
|
47
|
+
|
|
48
|
+
def store(self, pattern_id: str, content: str, metadata: dict[str, Any]) -> bool:
|
|
49
|
+
"""Store a pattern.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
pattern_id: Unique pattern identifier
|
|
53
|
+
content: Pattern content (may be encrypted)
|
|
54
|
+
metadata: Pattern metadata
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
True if successful
|
|
58
|
+
|
|
59
|
+
Raises:
|
|
60
|
+
IOError: If storage fails
|
|
61
|
+
|
|
62
|
+
"""
|
|
63
|
+
try:
|
|
64
|
+
pattern_file = self.storage_dir / f"{pattern_id}.json"
|
|
65
|
+
|
|
66
|
+
# Ensure parent directory exists
|
|
67
|
+
pattern_file.parent.mkdir(parents=True, exist_ok=True)
|
|
68
|
+
|
|
69
|
+
pattern_data = {"pattern_id": pattern_id, "content": content, "metadata": metadata}
|
|
70
|
+
|
|
71
|
+
validated_pattern_file = _validate_file_path(str(pattern_file))
|
|
72
|
+
with open(validated_pattern_file, "w", encoding="utf-8") as f:
|
|
73
|
+
json.dump(pattern_data, f, indent=2)
|
|
74
|
+
|
|
75
|
+
logger.debug("pattern_stored", pattern_id=pattern_id)
|
|
76
|
+
return True
|
|
77
|
+
|
|
78
|
+
except (OSError, PermissionError, json.JSONDecodeError) as e:
|
|
79
|
+
logger.error("pattern_storage_failed", pattern_id=pattern_id, error=str(e))
|
|
80
|
+
raise
|
|
81
|
+
|
|
82
|
+
def retrieve(self, pattern_id: str) -> dict[str, Any] | None:
|
|
83
|
+
"""Retrieve a pattern.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
pattern_id: Unique pattern identifier
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
Pattern data dictionary or None if not found
|
|
90
|
+
|
|
91
|
+
"""
|
|
92
|
+
try:
|
|
93
|
+
pattern_file = self.storage_dir / f"{pattern_id}.json"
|
|
94
|
+
|
|
95
|
+
if not pattern_file.exists():
|
|
96
|
+
logger.warning("pattern_not_found", pattern_id=pattern_id)
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
with open(pattern_file, encoding="utf-8") as f:
|
|
100
|
+
pattern_data: dict[str, Any] = json.load(f)
|
|
101
|
+
|
|
102
|
+
logger.debug("pattern_retrieved", pattern_id=pattern_id)
|
|
103
|
+
return pattern_data
|
|
104
|
+
|
|
105
|
+
except (OSError, PermissionError, json.JSONDecodeError) as e:
|
|
106
|
+
logger.error("pattern_retrieval_failed", pattern_id=pattern_id, error=str(e))
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
def delete(self, pattern_id: str) -> bool:
|
|
110
|
+
"""Delete a pattern.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
pattern_id: Unique pattern identifier
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
True if deleted, False if not found
|
|
117
|
+
|
|
118
|
+
"""
|
|
119
|
+
try:
|
|
120
|
+
pattern_file = self.storage_dir / f"{pattern_id}.json"
|
|
121
|
+
|
|
122
|
+
if not pattern_file.exists():
|
|
123
|
+
return False
|
|
124
|
+
|
|
125
|
+
pattern_file.unlink()
|
|
126
|
+
logger.info("pattern_deleted", pattern_id=pattern_id)
|
|
127
|
+
return True
|
|
128
|
+
|
|
129
|
+
except (OSError, PermissionError) as e:
|
|
130
|
+
logger.error("pattern_deletion_failed", pattern_id=pattern_id, error=str(e))
|
|
131
|
+
return False
|
|
132
|
+
|
|
133
|
+
def list_patterns(
|
|
134
|
+
self,
|
|
135
|
+
classification: str | None = None,
|
|
136
|
+
created_by: str | None = None,
|
|
137
|
+
) -> list[str]:
|
|
138
|
+
"""List pattern IDs matching criteria.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
classification: Filter by classification
|
|
142
|
+
created_by: Filter by creator
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
List of pattern IDs
|
|
146
|
+
|
|
147
|
+
"""
|
|
148
|
+
pattern_ids = []
|
|
149
|
+
|
|
150
|
+
for pattern_file in self.storage_dir.glob("*.json"):
|
|
151
|
+
try:
|
|
152
|
+
with open(pattern_file, encoding="utf-8") as f:
|
|
153
|
+
data = json.load(f)
|
|
154
|
+
metadata = data.get("metadata", {})
|
|
155
|
+
|
|
156
|
+
# Apply filters
|
|
157
|
+
if classification and metadata.get("classification") != classification:
|
|
158
|
+
continue
|
|
159
|
+
if created_by and metadata.get("created_by") != created_by:
|
|
160
|
+
continue
|
|
161
|
+
|
|
162
|
+
pattern_ids.append(data.get("pattern_id"))
|
|
163
|
+
|
|
164
|
+
except Exception:
|
|
165
|
+
continue
|
|
166
|
+
|
|
167
|
+
return pattern_ids
|