empathy-framework 5.1.1__py3-none-any.whl → 5.3.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.
Files changed (106) hide show
  1. {empathy_framework-5.1.1.dist-info → empathy_framework-5.3.0.dist-info}/METADATA +79 -6
  2. {empathy_framework-5.1.1.dist-info → empathy_framework-5.3.0.dist-info}/RECORD +83 -64
  3. empathy_os/__init__.py +1 -1
  4. empathy_os/cache/hybrid.py +5 -1
  5. empathy_os/cli/commands/batch.py +8 -0
  6. empathy_os/cli/commands/profiling.py +4 -0
  7. empathy_os/cli/commands/workflow.py +8 -4
  8. empathy_os/cli_router.py +9 -0
  9. empathy_os/config.py +15 -2
  10. empathy_os/core_modules/__init__.py +15 -0
  11. empathy_os/dashboard/simple_server.py +62 -30
  12. empathy_os/mcp/__init__.py +10 -0
  13. empathy_os/mcp/server.py +506 -0
  14. empathy_os/memory/control_panel.py +1 -131
  15. empathy_os/memory/control_panel_support.py +145 -0
  16. empathy_os/memory/encryption.py +159 -0
  17. empathy_os/memory/long_term.py +46 -631
  18. empathy_os/memory/long_term_types.py +99 -0
  19. empathy_os/memory/mixins/__init__.py +25 -0
  20. empathy_os/memory/mixins/backend_init_mixin.py +249 -0
  21. empathy_os/memory/mixins/capabilities_mixin.py +208 -0
  22. empathy_os/memory/mixins/handoff_mixin.py +208 -0
  23. empathy_os/memory/mixins/lifecycle_mixin.py +49 -0
  24. empathy_os/memory/mixins/long_term_mixin.py +352 -0
  25. empathy_os/memory/mixins/promotion_mixin.py +109 -0
  26. empathy_os/memory/mixins/short_term_mixin.py +182 -0
  27. empathy_os/memory/short_term.py +61 -12
  28. empathy_os/memory/simple_storage.py +302 -0
  29. empathy_os/memory/storage_backend.py +167 -0
  30. empathy_os/memory/types.py +8 -3
  31. empathy_os/memory/unified.py +21 -1120
  32. empathy_os/meta_workflows/cli_commands/__init__.py +56 -0
  33. empathy_os/meta_workflows/cli_commands/agent_commands.py +321 -0
  34. empathy_os/meta_workflows/cli_commands/analytics_commands.py +442 -0
  35. empathy_os/meta_workflows/cli_commands/config_commands.py +232 -0
  36. empathy_os/meta_workflows/cli_commands/memory_commands.py +182 -0
  37. empathy_os/meta_workflows/cli_commands/template_commands.py +354 -0
  38. empathy_os/meta_workflows/cli_commands/workflow_commands.py +382 -0
  39. empathy_os/meta_workflows/cli_meta_workflows.py +52 -1802
  40. empathy_os/models/telemetry/__init__.py +71 -0
  41. empathy_os/models/telemetry/analytics.py +594 -0
  42. empathy_os/models/telemetry/backend.py +196 -0
  43. empathy_os/models/telemetry/data_models.py +431 -0
  44. empathy_os/models/telemetry/storage.py +489 -0
  45. empathy_os/orchestration/__init__.py +35 -0
  46. empathy_os/orchestration/execution_strategies.py +481 -0
  47. empathy_os/orchestration/meta_orchestrator.py +488 -1
  48. empathy_os/routing/workflow_registry.py +36 -0
  49. empathy_os/telemetry/agent_coordination.py +2 -3
  50. empathy_os/telemetry/agent_tracking.py +26 -7
  51. empathy_os/telemetry/approval_gates.py +18 -24
  52. empathy_os/telemetry/cli.py +19 -724
  53. empathy_os/telemetry/commands/__init__.py +14 -0
  54. empathy_os/telemetry/commands/dashboard_commands.py +696 -0
  55. empathy_os/telemetry/event_streaming.py +7 -3
  56. empathy_os/telemetry/feedback_loop.py +28 -15
  57. empathy_os/tools.py +183 -0
  58. empathy_os/workflows/__init__.py +5 -0
  59. empathy_os/workflows/autonomous_test_gen.py +860 -161
  60. empathy_os/workflows/base.py +6 -2
  61. empathy_os/workflows/code_review.py +4 -1
  62. empathy_os/workflows/document_gen/__init__.py +25 -0
  63. empathy_os/workflows/document_gen/config.py +30 -0
  64. empathy_os/workflows/document_gen/report_formatter.py +162 -0
  65. empathy_os/workflows/{document_gen.py → document_gen/workflow.py} +5 -184
  66. empathy_os/workflows/output.py +4 -1
  67. empathy_os/workflows/progress.py +8 -2
  68. empathy_os/workflows/security_audit.py +2 -2
  69. empathy_os/workflows/security_audit_phase3.py +7 -4
  70. empathy_os/workflows/seo_optimization.py +633 -0
  71. empathy_os/workflows/test_gen/__init__.py +52 -0
  72. empathy_os/workflows/test_gen/ast_analyzer.py +249 -0
  73. empathy_os/workflows/test_gen/config.py +88 -0
  74. empathy_os/workflows/test_gen/data_models.py +38 -0
  75. empathy_os/workflows/test_gen/report_formatter.py +289 -0
  76. empathy_os/workflows/test_gen/test_templates.py +381 -0
  77. empathy_os/workflows/test_gen/workflow.py +655 -0
  78. empathy_os/workflows/test_gen.py +42 -1905
  79. empathy_os/cli/parsers/cache 2.py +0 -65
  80. empathy_os/cli_router 2.py +0 -416
  81. empathy_os/dashboard/app 2.py +0 -512
  82. empathy_os/dashboard/simple_server 2.py +0 -403
  83. empathy_os/dashboard/standalone_server 2.py +0 -536
  84. empathy_os/memory/types 2.py +0 -441
  85. empathy_os/models/adaptive_routing 2.py +0 -437
  86. empathy_os/models/telemetry.py +0 -1660
  87. empathy_os/project_index/scanner_parallel 2.py +0 -291
  88. empathy_os/telemetry/agent_coordination 2.py +0 -478
  89. empathy_os/telemetry/agent_tracking 2.py +0 -350
  90. empathy_os/telemetry/approval_gates 2.py +0 -563
  91. empathy_os/telemetry/event_streaming 2.py +0 -405
  92. empathy_os/telemetry/feedback_loop 2.py +0 -557
  93. empathy_os/vscode_bridge 2.py +0 -173
  94. empathy_os/workflows/progressive/__init__ 2.py +0 -92
  95. empathy_os/workflows/progressive/cli 2.py +0 -242
  96. empathy_os/workflows/progressive/core 2.py +0 -488
  97. empathy_os/workflows/progressive/orchestrator 2.py +0 -701
  98. empathy_os/workflows/progressive/reports 2.py +0 -528
  99. empathy_os/workflows/progressive/telemetry 2.py +0 -280
  100. empathy_os/workflows/progressive/test_gen 2.py +0 -514
  101. empathy_os/workflows/progressive/workflow 2.py +0 -628
  102. {empathy_framework-5.1.1.dist-info → empathy_framework-5.3.0.dist-info}/WHEEL +0 -0
  103. {empathy_framework-5.1.1.dist-info → empathy_framework-5.3.0.dist-info}/entry_points.txt +0 -0
  104. {empathy_framework-5.1.1.dist-info → empathy_framework-5.3.0.dist-info}/licenses/LICENSE +0 -0
  105. {empathy_framework-5.1.1.dist-info → empathy_framework-5.3.0.dist-info}/licenses/LICENSE_CHANGE_ANNOUNCEMENT.md +0 -0
  106. {empathy_framework-5.1.1.dist-info → empathy_framework-5.3.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,382 @@
1
+ """CLI Workflow Commands.
2
+
3
+ Workflow Commands for meta-workflow system.
4
+
5
+ Copyright 2025 Smart-AI-Memory
6
+ Licensed under Fair Source License 0.9
7
+ """
8
+
9
+
10
+ import typer
11
+ from rich.console import Console
12
+ from rich.panel import Panel
13
+ from rich.table import Table
14
+
15
+ from empathy_os.meta_workflows import (
16
+ MetaWorkflow,
17
+ PatternLearner,
18
+ TemplateRegistry,
19
+ )
20
+ from empathy_os.meta_workflows.intent_detector import IntentDetector
21
+
22
+ from . import meta_workflow_app
23
+
24
+ console = Console()
25
+
26
+
27
+ @meta_workflow_app.command("run")
28
+ def run_workflow(
29
+ template_id: str = typer.Argument(..., help="Template ID to execute"),
30
+ mock: bool = typer.Option(
31
+ True,
32
+ "--mock/--real",
33
+ help="Use mock execution (for testing)",
34
+ ),
35
+ use_memory: bool = typer.Option(
36
+ False,
37
+ "--use-memory",
38
+ "-m",
39
+ help="Enable memory integration for enhanced analytics",
40
+ ),
41
+ use_defaults: bool = typer.Option(
42
+ False,
43
+ "--use-defaults",
44
+ "-d",
45
+ help="Use default values instead of asking questions (non-interactive mode)",
46
+ ),
47
+ user_id: str = typer.Option(
48
+ "cli_user",
49
+ "--user-id",
50
+ "-u",
51
+ help="User ID for memory integration",
52
+ ),
53
+ json_output: bool = typer.Option(
54
+ False,
55
+ "--json",
56
+ "-j",
57
+ help="Output result as JSON (for programmatic use)",
58
+ ),
59
+ ):
60
+ """Execute a meta-workflow from template.
61
+
62
+ This will:
63
+ 1. Load the template
64
+ 2. Ask form questions interactively (or use defaults with --use-defaults)
65
+ 3. Generate dynamic agent team
66
+ 4. Execute agents (mock or real)
67
+ 5. Save results (files + optional memory)
68
+ 6. Display summary
69
+
70
+ Examples:
71
+ empathy meta-workflow run release-prep
72
+ empathy meta-workflow run test-coverage-boost --real
73
+ empathy meta-workflow run manage-docs --use-defaults
74
+ empathy meta-workflow run release-prep --json --use-defaults
75
+ """
76
+ import json
77
+
78
+ try:
79
+ # Load template
80
+ if not json_output:
81
+ console.print(f"\n[bold]Loading template:[/bold] {template_id}")
82
+ registry = TemplateRegistry()
83
+ template = registry.load_template(template_id)
84
+
85
+ if not template:
86
+ if json_output:
87
+ print(json.dumps({"success": False, "error": f"Template not found: {template_id}"}))
88
+ else:
89
+ console.print(f"[red]Template not found:[/red] {template_id}")
90
+ raise typer.Exit(code=1)
91
+
92
+ if not json_output:
93
+ console.print(f"[green]✓[/green] {template.name}")
94
+
95
+ # Setup memory if requested
96
+ pattern_learner = None
97
+ if use_memory:
98
+ if not json_output:
99
+ console.print("\n[bold]Initializing memory integration...[/bold]")
100
+ from empathy_os.memory.unified import UnifiedMemory
101
+
102
+ try:
103
+ memory = UnifiedMemory(user_id=user_id)
104
+ pattern_learner = PatternLearner(memory=memory)
105
+ if not json_output:
106
+ console.print("[green]✓[/green] Memory enabled")
107
+ except Exception as e:
108
+ if not json_output:
109
+ console.print(f"[yellow]Warning:[/yellow] Memory initialization failed: {e}")
110
+ console.print("[yellow]Continuing without memory integration[/yellow]")
111
+
112
+ # Create workflow
113
+ workflow = MetaWorkflow(
114
+ template=template,
115
+ pattern_learner=pattern_learner,
116
+ )
117
+
118
+ # Execute (will ask questions via AskUserQuestion unless --use-defaults)
119
+ if not json_output:
120
+ console.print("\n[bold]Executing workflow...[/bold]")
121
+ console.print(f"Mode: {'Mock' if mock else 'Real'}")
122
+ if use_defaults:
123
+ console.print("[cyan]Using default values (non-interactive)[/cyan]")
124
+
125
+ result = workflow.execute(mock_execution=mock, use_defaults=use_defaults)
126
+
127
+ # JSON output mode - print result as JSON and exit
128
+ if json_output:
129
+ output = {
130
+ "run_id": result.run_id,
131
+ "template_id": template_id,
132
+ "timestamp": result.timestamp,
133
+ "success": result.success,
134
+ "error": result.error,
135
+ "total_cost": result.total_cost,
136
+ "total_duration": result.total_duration,
137
+ "agents_created": len(result.agents_created),
138
+ "form_responses": {
139
+ "template_id": result.form_responses.template_id,
140
+ "responses": result.form_responses.responses,
141
+ "timestamp": result.form_responses.timestamp,
142
+ "response_id": result.form_responses.response_id,
143
+ },
144
+ "agent_results": [
145
+ {
146
+ "agent_id": ar.agent_id,
147
+ "role": ar.role,
148
+ "success": ar.success,
149
+ "cost": ar.cost,
150
+ "duration": ar.duration,
151
+ "tier_used": ar.tier_used,
152
+ "output": ar.output,
153
+ "error": ar.error,
154
+ }
155
+ for ar in result.agent_results
156
+ ],
157
+ }
158
+ print(json.dumps(output))
159
+ return
160
+
161
+ # Display summary (normal mode)
162
+ console.print("\n[bold green]Execution Complete![/bold green]\n")
163
+
164
+ summary_lines = [
165
+ f"[bold]Run ID:[/bold] {result.run_id}",
166
+ f"[bold]Status:[/bold] {'✅ Success' if result.success else '❌ Failed'}",
167
+ "",
168
+ f"[bold]Agents Created:[/bold] {len(result.agents_created)}",
169
+ f"[bold]Agents Executed:[/bold] {len(result.agent_results)}",
170
+ f"[bold]Total Cost:[/bold] ${result.total_cost:.2f}",
171
+ f"[bold]Duration:[/bold] {result.total_duration:.1f}s",
172
+ ]
173
+
174
+ if result.error:
175
+ summary_lines.append(f"\n[bold red]Error:[/bold red] {result.error}")
176
+
177
+ console.print(
178
+ Panel("\n".join(summary_lines), title="Execution Summary", border_style="green")
179
+ )
180
+
181
+ # Show agents
182
+ console.print("\n[bold]Agents Executed:[/bold]\n")
183
+
184
+ for agent_result in result.agent_results:
185
+ status = "✅" if agent_result.success else "❌"
186
+ console.print(
187
+ f" {status} [cyan]{agent_result.role}[/cyan] "
188
+ f"(tier: {agent_result.tier_used}, cost: ${agent_result.cost:.2f})"
189
+ )
190
+
191
+ # Show where results saved
192
+ console.print("\n[bold]Results saved to:[/bold]")
193
+ console.print(f" 📁 Files: .empathy/meta_workflows/executions/{result.run_id}/")
194
+ if use_memory and pattern_learner and pattern_learner.memory:
195
+ console.print(" 🧠 Memory: Long-term storage")
196
+
197
+ console.print(f"\n[dim]View details: empathy meta-workflow show {result.run_id}[/dim]")
198
+ console.print()
199
+
200
+ except Exception as e:
201
+ if json_output:
202
+ print(json.dumps({"success": False, "error": str(e)}))
203
+ else:
204
+ console.print(f"\n[red]Error:[/red] {e}")
205
+ import traceback
206
+
207
+ traceback.print_exc()
208
+ raise typer.Exit(code=1)
209
+
210
+
211
+
212
+ @meta_workflow_app.command("ask")
213
+ def natural_language_run(
214
+ request: str = typer.Argument(..., help="Natural language description of what you need"),
215
+ auto_run: bool = typer.Option(
216
+ False,
217
+ "--auto",
218
+ "-a",
219
+ help="Automatically run if high confidence match (>60%)",
220
+ ),
221
+ mock: bool = typer.Option(
222
+ True,
223
+ "--mock/--real",
224
+ help="Use mock execution (for testing)",
225
+ ),
226
+ use_defaults: bool = typer.Option(
227
+ True,
228
+ "--use-defaults/--interactive",
229
+ "-d/-i",
230
+ help="Use default values (non-interactive)",
231
+ ),
232
+ ):
233
+ """Create agent teams using natural language.
234
+
235
+ Analyzes your request and suggests appropriate agent teams.
236
+ Use --auto to automatically run the best match.
237
+
238
+ Examples:
239
+ empathy meta-workflow ask "I need to prepare for a release"
240
+ empathy meta-workflow ask "improve my test coverage" --auto --real
241
+ empathy meta-workflow ask "check if documentation is up to date"
242
+ """
243
+ try:
244
+ detector = IntentDetector()
245
+ matches = detector.detect(request)
246
+
247
+ if not matches:
248
+ console.print(
249
+ "\n[yellow]I couldn't identify a matching agent team for your request.[/yellow]"
250
+ )
251
+ console.print("\n[bold]Available agent teams:[/bold]")
252
+ console.print(
253
+ " • [cyan]release-prep[/cyan] - Security, testing, code quality, documentation checks"
254
+ )
255
+ console.print(
256
+ " • [cyan]test-coverage-boost[/cyan] - Analyze and improve test coverage"
257
+ )
258
+ console.print(" • [cyan]test-maintenance[/cyan] - Test lifecycle management")
259
+ console.print(" • [cyan]manage-docs[/cyan] - Documentation sync and gap detection")
260
+ console.print("\n[dim]Try: empathy meta-workflow run <template-id>[/dim]\n")
261
+ return
262
+
263
+ # Show detected matches
264
+ console.print(f'\n[bold]Analyzing:[/bold] "{request}"\n')
265
+
266
+ best_match = matches[0]
267
+ confidence_pct = int(best_match.confidence * 100)
268
+
269
+ # If auto-run and high confidence, run immediately
270
+ if auto_run and best_match.confidence >= 0.6:
271
+ console.print(
272
+ f"[bold green]Auto-detected:[/bold green] {best_match.template_name} ({confidence_pct}% confidence)"
273
+ )
274
+ console.print(f"[dim]{best_match.description}[/dim]\n")
275
+ console.print(f"[bold]Running {best_match.template_id}...[/bold]\n")
276
+
277
+ # Run the workflow
278
+ run_workflow(
279
+ template_id=best_match.template_id,
280
+ mock=mock,
281
+ use_memory=False,
282
+ use_defaults=use_defaults,
283
+ user_id="cli_user",
284
+ )
285
+ return
286
+
287
+ # Show suggestions
288
+ console.print("[bold]Suggested Agent Teams:[/bold]\n")
289
+
290
+ for i, match in enumerate(matches[:3], 1):
291
+ confidence = int(match.confidence * 100)
292
+ style = (
293
+ "green"
294
+ if match.confidence >= 0.6
295
+ else "yellow" if match.confidence >= 0.4 else "dim"
296
+ )
297
+
298
+ console.print(f" {i}. [{style}]{match.template_name}[/{style}] ({confidence}% match)")
299
+ console.print(f" [dim]{match.description}[/dim]")
300
+ if match.matched_keywords:
301
+ keywords = ", ".join(match.matched_keywords[:5])
302
+ console.print(f" [dim]Matched: {keywords}[/dim]")
303
+ console.print(f" Run: [cyan]empathy meta-workflow run {match.template_id}[/cyan]")
304
+ console.print()
305
+
306
+ # Prompt to run best match
307
+ if best_match.confidence >= 0.5:
308
+ console.print(
309
+ "[bold]Quick Run:[/bold] Use [cyan]--auto[/cyan] to automatically run the best match"
310
+ )
311
+ console.print(
312
+ f'[dim]Example: empathy meta-workflow ask "{request}" --auto --real[/dim]\n'
313
+ )
314
+
315
+ except Exception as e:
316
+ console.print(f"[red]Error:[/red] {e}")
317
+ raise typer.Exit(code=1)
318
+
319
+
320
+
321
+ @meta_workflow_app.command("detect")
322
+ def detect_intent(
323
+ request: str = typer.Argument(..., help="Natural language request to analyze"),
324
+ threshold: float = typer.Option(
325
+ 0.3,
326
+ "--threshold",
327
+ "-t",
328
+ help="Minimum confidence threshold (0.0-1.0)",
329
+ ),
330
+ ):
331
+ """Detect intent from natural language without running.
332
+
333
+ Useful for testing what agent teams would be suggested for a given request.
334
+
335
+ Examples:
336
+ empathy meta-workflow detect "check security vulnerabilities"
337
+ empathy meta-workflow detect "generate more tests" --threshold 0.5
338
+ """
339
+ try:
340
+ detector = IntentDetector()
341
+ matches = detector.detect(request, threshold=threshold)
342
+
343
+ console.print(f'\n[bold]Intent Analysis:[/bold] "{request}"\n')
344
+ console.print(f"[dim]Threshold: {threshold:.0%}[/dim]\n")
345
+
346
+ if not matches:
347
+ console.print("[yellow]No matches above threshold.[/yellow]\n")
348
+ return
349
+
350
+ # Create table
351
+ table = Table(show_header=True)
352
+ table.add_column("Template", style="cyan")
353
+ table.add_column("Confidence", justify="right")
354
+ table.add_column("Matched Keywords")
355
+ table.add_column("Would Auto-Run?")
356
+
357
+ for match in matches:
358
+ confidence = f"{match.confidence:.0%}"
359
+ keywords = ", ".join(match.matched_keywords[:4])
360
+ auto_run = "✅ Yes" if match.confidence >= 0.6 else "❌ No"
361
+
362
+ table.add_row(
363
+ match.template_id,
364
+ confidence,
365
+ keywords or "-",
366
+ auto_run,
367
+ )
368
+
369
+ console.print(table)
370
+ console.print()
371
+
372
+ except Exception as e:
373
+ console.print(f"[red]Error:[/red] {e}")
374
+ raise typer.Exit(code=1)
375
+
376
+
377
+ # =============================================================================
378
+ # Analytics Commands
379
+ # =============================================================================
380
+
381
+
382
+