empathy-framework 4.7.1__py3-none-any.whl → 4.8.0__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-4.7.1.dist-info → empathy_framework-4.8.0.dist-info}/METADATA +65 -2
- {empathy_framework-4.7.1.dist-info → empathy_framework-4.8.0.dist-info}/RECORD +73 -52
- {empathy_framework-4.7.1.dist-info → empathy_framework-4.8.0.dist-info}/WHEEL +1 -1
- {empathy_framework-4.7.1.dist-info → empathy_framework-4.8.0.dist-info}/entry_points.txt +2 -1
- {empathy_framework-4.7.1.dist-info → empathy_framework-4.8.0.dist-info}/top_level.txt +0 -1
- empathy_os/__init__.py +2 -0
- empathy_os/cache/hash_only.py +6 -3
- empathy_os/cache/hybrid.py +6 -3
- empathy_os/cli/__init__.py +128 -238
- empathy_os/cli/__main__.py +5 -33
- empathy_os/cli/commands/__init__.py +1 -8
- empathy_os/cli/commands/help.py +331 -0
- empathy_os/cli/commands/info.py +140 -0
- empathy_os/cli/commands/inspect.py +437 -0
- empathy_os/cli/commands/metrics.py +92 -0
- empathy_os/cli/commands/orchestrate.py +184 -0
- empathy_os/cli/commands/patterns.py +207 -0
- empathy_os/cli/commands/provider.py +93 -81
- empathy_os/cli/commands/setup.py +96 -0
- empathy_os/cli/commands/status.py +235 -0
- empathy_os/cli/commands/sync.py +166 -0
- empathy_os/cli/commands/tier.py +121 -0
- empathy_os/cli/commands/workflow.py +574 -0
- empathy_os/cli/parsers/__init__.py +62 -0
- empathy_os/cli/parsers/help.py +41 -0
- empathy_os/cli/parsers/info.py +26 -0
- empathy_os/cli/parsers/inspect.py +66 -0
- empathy_os/cli/parsers/metrics.py +42 -0
- empathy_os/cli/parsers/orchestrate.py +61 -0
- empathy_os/cli/parsers/patterns.py +54 -0
- empathy_os/cli/parsers/provider.py +40 -0
- empathy_os/cli/parsers/setup.py +42 -0
- empathy_os/cli/parsers/status.py +47 -0
- empathy_os/cli/parsers/sync.py +31 -0
- empathy_os/cli/parsers/tier.py +33 -0
- empathy_os/cli/parsers/workflow.py +77 -0
- empathy_os/cli/utils/__init__.py +1 -0
- empathy_os/cli/utils/data.py +242 -0
- empathy_os/cli/utils/helpers.py +68 -0
- empathy_os/{cli.py → cli_legacy.py} +27 -27
- empathy_os/cli_minimal.py +662 -0
- empathy_os/cli_router.py +384 -0
- empathy_os/cli_unified.py +38 -2
- empathy_os/memory/__init__.py +19 -5
- empathy_os/memory/short_term.py +14 -404
- empathy_os/memory/types.py +437 -0
- empathy_os/memory/unified.py +61 -48
- empathy_os/models/fallback.py +1 -1
- empathy_os/models/provider_config.py +59 -344
- empathy_os/models/registry.py +31 -180
- empathy_os/monitoring/alerts.py +14 -20
- empathy_os/monitoring/alerts_cli.py +24 -7
- empathy_os/project_index/__init__.py +2 -0
- empathy_os/project_index/index.py +210 -5
- empathy_os/project_index/scanner.py +45 -14
- empathy_os/project_index/scanner_parallel.py +291 -0
- empathy_os/socratic/ab_testing.py +1 -1
- empathy_os/workflows/__init__.py +31 -2
- empathy_os/workflows/base.py +349 -325
- empathy_os/workflows/bug_predict.py +8 -0
- empathy_os/workflows/builder.py +273 -0
- empathy_os/workflows/caching.py +253 -0
- empathy_os/workflows/code_review_pipeline.py +1 -0
- empathy_os/workflows/history.py +510 -0
- empathy_os/workflows/output.py +410 -0
- empathy_os/workflows/perf_audit.py +125 -19
- empathy_os/workflows/progress.py +324 -22
- empathy_os/workflows/routing.py +168 -0
- empathy_os/workflows/secure_release.py +1 -0
- empathy_os/workflows/security_audit.py +190 -0
- empathy_os/workflows/security_audit_phase3.py +328 -0
- empathy_os/workflows/telemetry_mixin.py +269 -0
- empathy_os/dashboard/__init__.py +0 -15
- empathy_os/dashboard/server.py +0 -941
- patterns/README.md +0 -119
- patterns/__init__.py +0 -95
- patterns/behavior.py +0 -298
- patterns/code_review_memory.json +0 -441
- patterns/core.py +0 -97
- patterns/debugging.json +0 -3763
- patterns/empathy.py +0 -268
- patterns/health_check_memory.json +0 -505
- patterns/input.py +0 -161
- patterns/memory_graph.json +0 -8
- patterns/refactoring_memory.json +0 -1113
- patterns/registry.py +0 -663
- patterns/security_memory.json +0 -8
- patterns/structural.py +0 -415
- patterns/validation.py +0 -194
- {empathy_framework-4.7.1.dist-info → empathy_framework-4.8.0.dist-info}/licenses/LICENSE +0 -0
patterns/empathy.py
DELETED
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
"""Empathy patterns for user experience.
|
|
2
|
-
|
|
3
|
-
Empathy patterns ensure wizards provide excellent user experience:
|
|
4
|
-
- Empathy Levels: 0-4 empathy configuration
|
|
5
|
-
- Educational Banners: Safety notices and educational content
|
|
6
|
-
- User Guidance: Help text, examples, and prompts
|
|
7
|
-
|
|
8
|
-
Copyright 2025 Smart AI Memory, LLC
|
|
9
|
-
Licensed under Fair Source 0.9
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
from typing import Literal
|
|
13
|
-
|
|
14
|
-
from pydantic import Field
|
|
15
|
-
|
|
16
|
-
from .core import BasePattern, CodeGeneratorMixin, PatternCategory
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class EmpathyLevelPattern(BasePattern, CodeGeneratorMixin):
|
|
20
|
-
"""Empathy level configuration pattern.
|
|
21
|
-
|
|
22
|
-
**Description:**
|
|
23
|
-
The Empathy Framework supports 5 levels of empathy (0-4), determining
|
|
24
|
-
how proactive and anticipatory a wizard is.
|
|
25
|
-
|
|
26
|
-
**Usage:** 16 wizards (all domain wizards)
|
|
27
|
-
**Reusability:** 1.0 (universal pattern)
|
|
28
|
-
|
|
29
|
-
**Empathy Levels:**
|
|
30
|
-
- Level 0: Pure Data/Computation - No empathy, just calculations
|
|
31
|
-
- Level 1: Reactive - Responds to explicit requests only
|
|
32
|
-
- Level 2: Responsive - Understands context, provides helpful responses
|
|
33
|
-
- Level 3: Proactive - Suggests improvements and alternatives
|
|
34
|
-
- Level 4: Anticipatory - Predicts future needs and prevents issues
|
|
35
|
-
|
|
36
|
-
**Configuration:**
|
|
37
|
-
@dataclass
|
|
38
|
-
class WizardConfig:
|
|
39
|
-
default_empathy_level: int = 2 # 0-4
|
|
40
|
-
|
|
41
|
-
**Usage:**
|
|
42
|
-
result = await wizard.process(
|
|
43
|
-
user_input="...",
|
|
44
|
-
user_id="user123",
|
|
45
|
-
empathy_level=4, # Override default
|
|
46
|
-
)
|
|
47
|
-
"""
|
|
48
|
-
|
|
49
|
-
category: Literal[PatternCategory.EMPATHY] = PatternCategory.EMPATHY
|
|
50
|
-
default_level: int = Field(
|
|
51
|
-
default=2,
|
|
52
|
-
description="Default empathy level (0-4)",
|
|
53
|
-
ge=0,
|
|
54
|
-
le=4,
|
|
55
|
-
)
|
|
56
|
-
level_descriptions: dict[int, str] = Field(
|
|
57
|
-
default_factory=lambda: {
|
|
58
|
-
0: "Pure data/computation - no empathy",
|
|
59
|
-
1: "Reactive - responds to explicit requests",
|
|
60
|
-
2: "Responsive - understands context",
|
|
61
|
-
3: "Proactive - suggests improvements",
|
|
62
|
-
4: "Anticipatory - predicts future needs",
|
|
63
|
-
},
|
|
64
|
-
description="Description of each empathy level",
|
|
65
|
-
)
|
|
66
|
-
allow_user_override: bool = Field(
|
|
67
|
-
default=True,
|
|
68
|
-
description="Whether users can override empathy level per request",
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
def generate_code(self) -> str:
|
|
72
|
-
"""Generate WizardConfig with empathy levels."""
|
|
73
|
-
return '''
|
|
74
|
-
from dataclasses import dataclass
|
|
75
|
-
|
|
76
|
-
@dataclass
|
|
77
|
-
class WizardConfig:
|
|
78
|
-
"""Configuration for an Empathy wizard"""
|
|
79
|
-
|
|
80
|
-
# Wizard identity
|
|
81
|
-
name: str
|
|
82
|
-
description: str
|
|
83
|
-
domain: str
|
|
84
|
-
|
|
85
|
-
# Empathy level (0-4)
|
|
86
|
-
default_empathy_level: int = 2
|
|
87
|
-
|
|
88
|
-
# Security configuration
|
|
89
|
-
enable_security: bool = False
|
|
90
|
-
pii_patterns: list[str] = None
|
|
91
|
-
|
|
92
|
-
def _validate_config(self):
|
|
93
|
-
"""Validate wizard configuration"""
|
|
94
|
-
if not 0 <= self.default_empathy_level <= 4:
|
|
95
|
-
raise ValueError(
|
|
96
|
-
f"Empathy level must be 0-4, got {self.default_empathy_level}"
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class BaseWizard:
|
|
101
|
-
"""Base wizard with empathy support"""
|
|
102
|
-
|
|
103
|
-
def __init__(self, llm, config: WizardConfig):
|
|
104
|
-
self.llm = llm
|
|
105
|
-
self.config = config
|
|
106
|
-
self._validate_config()
|
|
107
|
-
|
|
108
|
-
async def process(
|
|
109
|
-
self,
|
|
110
|
-
user_input: str,
|
|
111
|
-
user_id: str,
|
|
112
|
-
empathy_level: int | None = None,
|
|
113
|
-
session_context: dict | None = None,
|
|
114
|
-
):
|
|
115
|
-
"""Process with empathy level support"""
|
|
116
|
-
level = empathy_level if empathy_level is not None else self.config.default_empathy_level
|
|
117
|
-
|
|
118
|
-
# Process with specified empathy level
|
|
119
|
-
result = await self.llm.interact(
|
|
120
|
-
user_id=user_id,
|
|
121
|
-
user_input=user_input,
|
|
122
|
-
force_level=level,
|
|
123
|
-
context=session_context or {},
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
result["empathy_level"] = level
|
|
127
|
-
return result
|
|
128
|
-
'''
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
class EducationalBannerPattern(BasePattern, CodeGeneratorMixin):
|
|
132
|
-
"""Educational banner pattern.
|
|
133
|
-
|
|
134
|
-
**Description:**
|
|
135
|
-
Wizards that deal with sensitive domains (healthcare, legal, finance)
|
|
136
|
-
display educational banners to remind users of limitations and proper use.
|
|
137
|
-
|
|
138
|
-
**Usage:** 16 wizards (all healthcare wizards)
|
|
139
|
-
**Reusability:** 1.0 (should be universal for sensitive domains)
|
|
140
|
-
|
|
141
|
-
**Purpose:**
|
|
142
|
-
- Clarify tool is educational/assistive, not replacement for professionals
|
|
143
|
-
- Set appropriate expectations
|
|
144
|
-
- Legal/liability protection
|
|
145
|
-
- Promote responsible use
|
|
146
|
-
|
|
147
|
-
**Display:**
|
|
148
|
-
- Shown at wizard start
|
|
149
|
-
- Included in all generated reports
|
|
150
|
-
- Cannot be dismissed permanently (shown every session)
|
|
151
|
-
|
|
152
|
-
**Example:**
|
|
153
|
-
⚕️ EDUCATIONAL TOOL NOTICE ⚕️
|
|
154
|
-
This wizard is an educational tool for healthcare professionals.
|
|
155
|
-
All clinical documentation should be reviewed by qualified providers.
|
|
156
|
-
Never rely solely on automated tools for clinical decisions.
|
|
157
|
-
"""
|
|
158
|
-
|
|
159
|
-
category: Literal[PatternCategory.EMPATHY] = PatternCategory.EMPATHY
|
|
160
|
-
banner_text: str = Field(..., description="Banner text to display")
|
|
161
|
-
banner_type: Literal["educational", "warning", "disclaimer"] = Field(
|
|
162
|
-
default="educational",
|
|
163
|
-
description="Type of banner",
|
|
164
|
-
)
|
|
165
|
-
display_locations: list[str] = Field(
|
|
166
|
-
default_factory=lambda: ["start", "report", "preview"],
|
|
167
|
-
description="Where to display the banner",
|
|
168
|
-
)
|
|
169
|
-
can_dismiss: bool = Field(
|
|
170
|
-
default=False,
|
|
171
|
-
description="Whether users can dismiss the banner",
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
def generate_code(self) -> str:
|
|
175
|
-
"""Generate banner constant and display logic."""
|
|
176
|
-
icon = {
|
|
177
|
-
"educational": "⚕️",
|
|
178
|
-
"warning": "⚠️",
|
|
179
|
-
"disclaimer": "📋",
|
|
180
|
-
}.get(self.banner_type, "ℹ️")
|
|
181
|
-
|
|
182
|
-
return f'''
|
|
183
|
-
# Educational banner
|
|
184
|
-
BANNER = """
|
|
185
|
-
{icon} {self.banner_type.upper()} {icon}
|
|
186
|
-
{self.banner_text}
|
|
187
|
-
"""
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
@router.post("/start")
|
|
191
|
-
async def start_wizard():
|
|
192
|
-
"""Start wizard with educational banner"""
|
|
193
|
-
wizard_id = str(uuid4())
|
|
194
|
-
|
|
195
|
-
session_data = {{
|
|
196
|
-
"wizard_id": wizard_id,
|
|
197
|
-
"current_step": 1,
|
|
198
|
-
"total_steps": 5,
|
|
199
|
-
"collected_data": {{}},
|
|
200
|
-
}}
|
|
201
|
-
|
|
202
|
-
await _store_session(wizard_id, session_data)
|
|
203
|
-
|
|
204
|
-
return {{
|
|
205
|
-
"wizard_id": wizard_id,
|
|
206
|
-
"current_step": 1,
|
|
207
|
-
"banner": BANNER, # Show banner at start
|
|
208
|
-
}}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
@router.post("/{{wizard_id}}/preview")
|
|
212
|
-
async def preview_report(wizard_id: str):
|
|
213
|
-
"""Preview with banner"""
|
|
214
|
-
session = await _get_session(wizard_id)
|
|
215
|
-
preview = _generate_report(session["collected_data"])
|
|
216
|
-
|
|
217
|
-
return {{
|
|
218
|
-
"preview": preview,
|
|
219
|
-
"banner": BANNER, # Show banner in preview
|
|
220
|
-
}}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
def _generate_report(collected_data: dict) -> dict:
|
|
224
|
-
"""Generate report with banner"""
|
|
225
|
-
return {{
|
|
226
|
-
"data": collected_data,
|
|
227
|
-
"narrative": "...",
|
|
228
|
-
"banner": BANNER, # Include banner in report
|
|
229
|
-
}}
|
|
230
|
-
'''
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
class UserGuidancePattern(BasePattern):
|
|
234
|
-
"""User guidance and help pattern.
|
|
235
|
-
|
|
236
|
-
**Description:**
|
|
237
|
-
Wizards that provide comprehensive help text, examples, and prompts
|
|
238
|
-
to guide users through complex workflows.
|
|
239
|
-
|
|
240
|
-
**Usage:** All wizards should use this pattern
|
|
241
|
-
**Reusability:** 1.0
|
|
242
|
-
|
|
243
|
-
**Guidance Types:**
|
|
244
|
-
- Step-level help text: Explains what to do in each step
|
|
245
|
-
- Field-level examples: Shows example values for fields
|
|
246
|
-
- Contextual prompts: Dynamic prompts based on previous inputs
|
|
247
|
-
- Error messages: Clear, actionable error messages
|
|
248
|
-
|
|
249
|
-
**Best Practices:**
|
|
250
|
-
- Use plain language (avoid jargon)
|
|
251
|
-
- Provide concrete examples
|
|
252
|
-
- Explain "why" not just "what"
|
|
253
|
-
- Anticipate user questions
|
|
254
|
-
"""
|
|
255
|
-
|
|
256
|
-
category: Literal[PatternCategory.EMPATHY] = PatternCategory.EMPATHY
|
|
257
|
-
help_text_per_step: dict[int, str] = Field(
|
|
258
|
-
default_factory=dict,
|
|
259
|
-
description="Help text for each step",
|
|
260
|
-
)
|
|
261
|
-
field_examples: dict[str, list[str]] = Field(
|
|
262
|
-
default_factory=dict,
|
|
263
|
-
description="Example values for each field",
|
|
264
|
-
)
|
|
265
|
-
contextual_prompts: bool = Field(
|
|
266
|
-
default=False,
|
|
267
|
-
description="Whether to generate dynamic prompts based on context",
|
|
268
|
-
)
|