empathy-framework 4.7.0__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.
Files changed (86) hide show
  1. empathy_framework-4.8.0.dist-info/METADATA +753 -0
  2. {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/RECORD +83 -37
  3. {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/WHEEL +1 -1
  4. {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/entry_points.txt +2 -1
  5. empathy_os/__init__.py +2 -0
  6. empathy_os/cache/hash_only.py +6 -3
  7. empathy_os/cache/hybrid.py +6 -3
  8. empathy_os/cli/__init__.py +128 -238
  9. empathy_os/cli/__main__.py +5 -33
  10. empathy_os/cli/commands/__init__.py +1 -8
  11. empathy_os/cli/commands/help.py +331 -0
  12. empathy_os/cli/commands/info.py +140 -0
  13. empathy_os/cli/commands/inspect.py +437 -0
  14. empathy_os/cli/commands/metrics.py +92 -0
  15. empathy_os/cli/commands/orchestrate.py +184 -0
  16. empathy_os/cli/commands/patterns.py +207 -0
  17. empathy_os/cli/commands/provider.py +93 -81
  18. empathy_os/cli/commands/setup.py +96 -0
  19. empathy_os/cli/commands/status.py +235 -0
  20. empathy_os/cli/commands/sync.py +166 -0
  21. empathy_os/cli/commands/tier.py +121 -0
  22. empathy_os/cli/commands/workflow.py +574 -0
  23. empathy_os/cli/parsers/__init__.py +62 -0
  24. empathy_os/cli/parsers/help.py +41 -0
  25. empathy_os/cli/parsers/info.py +26 -0
  26. empathy_os/cli/parsers/inspect.py +66 -0
  27. empathy_os/cli/parsers/metrics.py +42 -0
  28. empathy_os/cli/parsers/orchestrate.py +61 -0
  29. empathy_os/cli/parsers/patterns.py +54 -0
  30. empathy_os/cli/parsers/provider.py +40 -0
  31. empathy_os/cli/parsers/setup.py +42 -0
  32. empathy_os/cli/parsers/status.py +47 -0
  33. empathy_os/cli/parsers/sync.py +31 -0
  34. empathy_os/cli/parsers/tier.py +33 -0
  35. empathy_os/cli/parsers/workflow.py +77 -0
  36. empathy_os/cli/utils/__init__.py +1 -0
  37. empathy_os/cli/utils/data.py +242 -0
  38. empathy_os/cli/utils/helpers.py +68 -0
  39. empathy_os/{cli.py → cli_legacy.py} +27 -27
  40. empathy_os/cli_minimal.py +662 -0
  41. empathy_os/cli_router.py +384 -0
  42. empathy_os/cli_unified.py +38 -2
  43. empathy_os/memory/__init__.py +19 -5
  44. empathy_os/memory/short_term.py +14 -404
  45. empathy_os/memory/types.py +437 -0
  46. empathy_os/memory/unified.py +61 -48
  47. empathy_os/models/fallback.py +1 -1
  48. empathy_os/models/provider_config.py +59 -344
  49. empathy_os/models/registry.py +31 -180
  50. empathy_os/monitoring/alerts.py +14 -20
  51. empathy_os/monitoring/alerts_cli.py +24 -7
  52. empathy_os/project_index/__init__.py +2 -0
  53. empathy_os/project_index/index.py +210 -5
  54. empathy_os/project_index/scanner.py +45 -14
  55. empathy_os/project_index/scanner_parallel.py +291 -0
  56. empathy_os/socratic/ab_testing.py +1 -1
  57. empathy_os/vscode_bridge 2.py +173 -0
  58. empathy_os/workflows/__init__.py +31 -2
  59. empathy_os/workflows/base.py +349 -325
  60. empathy_os/workflows/bug_predict.py +8 -0
  61. empathy_os/workflows/builder.py +273 -0
  62. empathy_os/workflows/caching.py +253 -0
  63. empathy_os/workflows/code_review_pipeline.py +1 -0
  64. empathy_os/workflows/history.py +510 -0
  65. empathy_os/workflows/output.py +410 -0
  66. empathy_os/workflows/perf_audit.py +125 -19
  67. empathy_os/workflows/progress.py +324 -22
  68. empathy_os/workflows/progressive/README 2.md +454 -0
  69. empathy_os/workflows/progressive/__init__ 2.py +92 -0
  70. empathy_os/workflows/progressive/cli 2.py +242 -0
  71. empathy_os/workflows/progressive/core 2.py +488 -0
  72. empathy_os/workflows/progressive/orchestrator 2.py +701 -0
  73. empathy_os/workflows/progressive/reports 2.py +528 -0
  74. empathy_os/workflows/progressive/telemetry 2.py +280 -0
  75. empathy_os/workflows/progressive/test_gen 2.py +514 -0
  76. empathy_os/workflows/progressive/workflow 2.py +628 -0
  77. empathy_os/workflows/routing.py +168 -0
  78. empathy_os/workflows/secure_release.py +1 -0
  79. empathy_os/workflows/security_audit.py +190 -0
  80. empathy_os/workflows/security_audit_phase3.py +328 -0
  81. empathy_os/workflows/telemetry_mixin.py +269 -0
  82. empathy_framework-4.7.0.dist-info/METADATA +0 -1598
  83. empathy_os/dashboard/__init__.py +0 -15
  84. empathy_os/dashboard/server.py +0 -941
  85. {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/licenses/LICENSE +0 -0
  86. {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,173 @@
1
+ """VS Code Extension Bridge
2
+
3
+ Provides functions to write data that the VS Code extension can pick up.
4
+ Enables Claude Code CLI output to appear in VS Code webview panels.
5
+
6
+ Copyright 2026 Smart-AI-Memory
7
+ Licensed under Fair Source License 0.9
8
+ """
9
+
10
+ import json
11
+ from dataclasses import asdict, dataclass
12
+ from datetime import datetime
13
+ from pathlib import Path
14
+ from typing import Any
15
+
16
+
17
+ @dataclass
18
+ class ReviewFinding:
19
+ """A code review finding."""
20
+
21
+ id: str
22
+ file: str
23
+ line: int
24
+ severity: str # 'critical' | 'high' | 'medium' | 'low' | 'info'
25
+ category: str # 'security' | 'performance' | 'maintainability' | 'style' | 'correctness'
26
+ message: str
27
+ column: int = 1
28
+ details: str | None = None
29
+ recommendation: str | None = None
30
+
31
+
32
+ @dataclass
33
+ class CodeReviewResult:
34
+ """Code review results for VS Code bridge."""
35
+
36
+ findings: list[dict[str, Any]]
37
+ summary: dict[str, Any]
38
+ verdict: str # 'approve' | 'approve_with_suggestions' | 'request_changes' | 'reject'
39
+ security_score: int
40
+ formatted_report: str
41
+ model_tier_used: str
42
+ timestamp: str
43
+
44
+
45
+ def get_empathy_dir() -> Path:
46
+ """Get the .empathy directory, creating if needed."""
47
+ empathy_dir = Path(".empathy")
48
+ empathy_dir.mkdir(exist_ok=True)
49
+ return empathy_dir
50
+
51
+
52
+ def write_code_review_results(
53
+ findings: list[dict[str, Any]] | None = None,
54
+ summary: dict[str, Any] | None = None,
55
+ verdict: str = "approve_with_suggestions",
56
+ security_score: int = 85,
57
+ formatted_report: str = "",
58
+ model_tier_used: str = "capable",
59
+ ) -> Path:
60
+ """Write code review results for VS Code extension to pick up.
61
+
62
+ Args:
63
+ findings: List of finding dicts with keys: id, file, line, severity, category, message
64
+ summary: Summary dict with keys: total_findings, by_severity, by_category, files_affected
65
+ verdict: One of 'approve', 'approve_with_suggestions', 'request_changes', 'reject'
66
+ security_score: 0-100 score
67
+ formatted_report: Markdown formatted report
68
+ model_tier_used: 'cheap', 'capable', or 'premium'
69
+
70
+ Returns:
71
+ Path to the written file
72
+ """
73
+ findings = findings or []
74
+
75
+ # Build summary if not provided
76
+ if summary is None:
77
+ by_severity: dict[str, int] = {}
78
+ by_category: dict[str, int] = {}
79
+ files_affected: set[str] = set()
80
+
81
+ for f in findings:
82
+ sev = f.get("severity", "info")
83
+ cat = f.get("category", "correctness")
84
+ by_severity[sev] = by_severity.get(sev, 0) + 1
85
+ by_category[cat] = by_category.get(cat, 0) + 1
86
+ if f.get("file"):
87
+ files_affected.add(f["file"])
88
+
89
+ summary = {
90
+ "total_findings": len(findings),
91
+ "by_severity": by_severity,
92
+ "by_category": by_category,
93
+ "files_affected": list(files_affected),
94
+ }
95
+
96
+ result = CodeReviewResult(
97
+ findings=findings,
98
+ summary=summary,
99
+ verdict=verdict,
100
+ security_score=security_score,
101
+ formatted_report=formatted_report,
102
+ model_tier_used=model_tier_used,
103
+ timestamp=datetime.now().isoformat(),
104
+ )
105
+
106
+ output_path = get_empathy_dir() / "code-review-results.json"
107
+
108
+ with open(output_path, "w") as f:
109
+ json.dump(asdict(result), f, indent=2)
110
+
111
+ return output_path
112
+
113
+
114
+ def write_pr_review_results(
115
+ pr_number: int | str,
116
+ title: str,
117
+ findings: list[dict[str, Any]],
118
+ verdict: str = "approve_with_suggestions",
119
+ summary_text: str = "",
120
+ ) -> Path:
121
+ """Write PR review results for VS Code extension.
122
+
123
+ Convenience wrapper for PR reviews from GitHub.
124
+
125
+ Args:
126
+ pr_number: The PR number
127
+ title: PR title
128
+ findings: List of review findings
129
+ verdict: Review verdict
130
+ summary_text: Summary of the review
131
+
132
+ Returns:
133
+ Path to the written file
134
+ """
135
+ formatted_report = f"""## PR #{pr_number}: {title}
136
+
137
+ {summary_text}
138
+
139
+ ### Findings ({len(findings)})
140
+
141
+ """
142
+ for f in findings:
143
+ formatted_report += f"- **{f.get('severity', 'info').upper()}** [{f.get('file', 'unknown')}:{f.get('line', 0)}]: {f.get('message', '')}\n"
144
+
145
+ return write_code_review_results(
146
+ findings=findings,
147
+ verdict=verdict,
148
+ formatted_report=formatted_report,
149
+ model_tier_used="capable",
150
+ )
151
+
152
+
153
+ # Quick helper for Claude Code to call
154
+ def send_to_vscode(
155
+ message: str,
156
+ findings: list[dict[str, Any]] | None = None,
157
+ verdict: str = "approve_with_suggestions",
158
+ ) -> str:
159
+ """Quick helper to send review results to VS Code.
160
+
161
+ Usage in Claude Code:
162
+ from empathy_os.vscode_bridge import send_to_vscode
163
+ send_to_vscode("Review complete", findings=[...])
164
+
165
+ Returns:
166
+ Confirmation message
167
+ """
168
+ path = write_code_review_results(
169
+ findings=findings or [],
170
+ formatted_report=message,
171
+ verdict=verdict,
172
+ )
173
+ return f"Results written to {path} - VS Code will update automatically"
@@ -80,8 +80,20 @@ from .base import (
80
80
  get_workflow_stats,
81
81
  )
82
82
 
83
+ # Builder pattern for workflow construction
84
+ from .builder import WorkflowBuilder, workflow_builder
85
+
83
86
  # Config is small and frequently needed
84
87
  from .config import DEFAULT_MODELS, ModelConfig, WorkflowConfig, create_example_config, get_model
88
+
89
+ # Routing strategies (small, frequently needed for builder pattern)
90
+ from .routing import (
91
+ BalancedRouting,
92
+ CostOptimizedRouting,
93
+ PerformanceOptimizedRouting,
94
+ RoutingContext,
95
+ TierRoutingStrategy,
96
+ )
85
97
  from .step_config import WorkflowStepConfig, steps_from_tier_map, validate_step_config
86
98
 
87
99
  # Lazy import mapping for workflow classes
@@ -99,9 +111,15 @@ _LAZY_WORKFLOW_IMPORTS: dict[str, tuple[str, str]] = {
99
111
  "KeyboardShortcutWorkflow": (".keyboard_shortcuts", "KeyboardShortcutWorkflow"),
100
112
  "ManageDocumentationCrew": (".manage_documentation", "ManageDocumentationCrew"),
101
113
  "ManageDocumentationCrewResult": (".manage_documentation", "ManageDocumentationCrewResult"),
102
- "OrchestratedHealthCheckWorkflow": (".orchestrated_health_check", "OrchestratedHealthCheckWorkflow"),
114
+ "OrchestratedHealthCheckWorkflow": (
115
+ ".orchestrated_health_check",
116
+ "OrchestratedHealthCheckWorkflow",
117
+ ),
103
118
  "HealthCheckReport": (".orchestrated_health_check", "HealthCheckReport"),
104
- "OrchestratedReleasePrepWorkflow": (".orchestrated_release_prep", "OrchestratedReleasePrepWorkflow"),
119
+ "OrchestratedReleasePrepWorkflow": (
120
+ ".orchestrated_release_prep",
121
+ "OrchestratedReleasePrepWorkflow",
122
+ ),
105
123
  "ReleaseReadinessReport": (".orchestrated_release_prep", "ReleaseReadinessReport"),
106
124
  "PerformanceAuditWorkflow": (".perf_audit", "PerformanceAuditWorkflow"),
107
125
  "PRReviewWorkflow": (".pr_review", "PRReviewWorkflow"),
@@ -141,6 +159,7 @@ def _lazy_import_workflow(name: str) -> object:
141
159
 
142
160
  # Import the module and get the attribute
143
161
  import importlib
162
+
144
163
  module = importlib.import_module(module_path, package="empathy_os.workflows")
145
164
  attr = getattr(module, attr_name)
146
165
 
@@ -148,6 +167,7 @@ def _lazy_import_workflow(name: str) -> object:
148
167
  _loaded_workflow_modules[cache_key] = attr
149
168
  return attr
150
169
 
170
+
151
171
  # Re-export CLI commands from workflow_commands.py (lazy loaded)
152
172
  _parent_dir = os.path.dirname(os.path.dirname(__file__))
153
173
  _workflows_module_path = os.path.join(_parent_dir, "workflow_commands.py")
@@ -420,6 +440,15 @@ __all__ = [
420
440
  "WORKFLOW_REGISTRY",
421
441
  # Base classes
422
442
  "BaseWorkflow",
443
+ # Routing strategies
444
+ "TierRoutingStrategy",
445
+ "RoutingContext",
446
+ "CostOptimizedRouting",
447
+ "PerformanceOptimizedRouting",
448
+ "BalancedRouting",
449
+ # Builder pattern
450
+ "WorkflowBuilder",
451
+ "workflow_builder",
423
452
  # New high-value workflows
424
453
  "BugPredictionWorkflow",
425
454
  # Code review crew integration (v3.1)