empathy-framework 5.0.3__py3-none-any.whl → 5.1.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.0.3.dist-info → empathy_framework-5.1.1.dist-info}/METADATA +259 -142
- {empathy_framework-5.0.3.dist-info → empathy_framework-5.1.1.dist-info}/RECORD +58 -28
- empathy_framework-5.1.1.dist-info/licenses/LICENSE +201 -0
- empathy_framework-5.1.1.dist-info/licenses/LICENSE_CHANGE_ANNOUNCEMENT.md +101 -0
- empathy_os/__init__.py +1 -1
- empathy_os/cli/commands/batch.py +5 -5
- empathy_os/cli/commands/routing.py +1 -1
- empathy_os/cli/commands/workflow.py +2 -1
- empathy_os/cli/parsers/cache 2.py +65 -0
- empathy_os/cli_minimal.py +3 -3
- empathy_os/cli_router 2.py +416 -0
- empathy_os/cli_router.py +12 -0
- empathy_os/dashboard/__init__.py +1 -2
- empathy_os/dashboard/app 2.py +512 -0
- empathy_os/dashboard/app.py +1 -1
- empathy_os/dashboard/simple_server 2.py +403 -0
- empathy_os/dashboard/standalone_server 2.py +536 -0
- empathy_os/memory/types 2.py +441 -0
- empathy_os/meta_workflows/intent_detector.py +71 -0
- empathy_os/models/__init__.py +19 -0
- empathy_os/models/adaptive_routing 2.py +437 -0
- empathy_os/models/auth_cli.py +444 -0
- empathy_os/models/auth_strategy.py +450 -0
- empathy_os/project_index/scanner_parallel 2.py +291 -0
- empathy_os/telemetry/agent_coordination 2.py +478 -0
- empathy_os/telemetry/agent_coordination.py +3 -3
- empathy_os/telemetry/agent_tracking 2.py +350 -0
- empathy_os/telemetry/agent_tracking.py +1 -2
- empathy_os/telemetry/approval_gates 2.py +563 -0
- empathy_os/telemetry/event_streaming 2.py +405 -0
- empathy_os/telemetry/event_streaming.py +3 -3
- empathy_os/telemetry/feedback_loop 2.py +557 -0
- empathy_os/telemetry/feedback_loop.py +1 -1
- empathy_os/vscode_bridge 2.py +173 -0
- empathy_os/workflows/__init__.py +8 -0
- empathy_os/workflows/autonomous_test_gen.py +569 -0
- empathy_os/workflows/bug_predict.py +45 -0
- empathy_os/workflows/code_review.py +92 -22
- empathy_os/workflows/document_gen.py +594 -62
- empathy_os/workflows/llm_base.py +363 -0
- empathy_os/workflows/perf_audit.py +69 -0
- empathy_os/workflows/progressive/README 2.md +454 -0
- empathy_os/workflows/progressive/__init__ 2.py +92 -0
- empathy_os/workflows/progressive/cli 2.py +242 -0
- empathy_os/workflows/progressive/core 2.py +488 -0
- empathy_os/workflows/progressive/orchestrator 2.py +701 -0
- empathy_os/workflows/progressive/reports 2.py +528 -0
- empathy_os/workflows/progressive/telemetry 2.py +280 -0
- empathy_os/workflows/progressive/test_gen 2.py +514 -0
- empathy_os/workflows/progressive/workflow 2.py +628 -0
- empathy_os/workflows/release_prep.py +54 -0
- empathy_os/workflows/security_audit.py +154 -79
- empathy_os/workflows/test_gen.py +60 -0
- empathy_os/workflows/test_gen_behavioral.py +477 -0
- empathy_os/workflows/test_gen_parallel.py +341 -0
- empathy_framework-5.0.3.dist-info/licenses/LICENSE +0 -139
- {empathy_framework-5.0.3.dist-info → empathy_framework-5.1.1.dist-info}/WHEEL +0 -0
- {empathy_framework-5.0.3.dist-info → empathy_framework-5.1.1.dist-info}/entry_points.txt +0 -0
- {empathy_framework-5.0.3.dist-info → empathy_framework-5.1.1.dist-info}/top_level.txt +0 -0
|
@@ -57,6 +57,7 @@ class CodeReviewWorkflow(BaseWorkflow):
|
|
|
57
57
|
core_modules: list[str] | None = None,
|
|
58
58
|
use_crew: bool = True,
|
|
59
59
|
crew_config: dict | None = None,
|
|
60
|
+
enable_auth_strategy: bool = True,
|
|
60
61
|
**kwargs: Any,
|
|
61
62
|
):
|
|
62
63
|
"""Initialize workflow.
|
|
@@ -66,6 +67,8 @@ class CodeReviewWorkflow(BaseWorkflow):
|
|
|
66
67
|
core_modules: List of module paths considered "core" (trigger premium).
|
|
67
68
|
use_crew: Enable CodeReviewCrew for comprehensive 5-agent analysis (default: True).
|
|
68
69
|
crew_config: Configuration dict for CodeReviewCrew.
|
|
70
|
+
enable_auth_strategy: If True, use intelligent subscription vs API routing
|
|
71
|
+
based on module size (default True).
|
|
69
72
|
|
|
70
73
|
"""
|
|
71
74
|
super().__init__(**kwargs)
|
|
@@ -79,10 +82,12 @@ class CodeReviewWorkflow(BaseWorkflow):
|
|
|
79
82
|
]
|
|
80
83
|
self.use_crew = use_crew
|
|
81
84
|
self.crew_config = crew_config or {}
|
|
85
|
+
self.enable_auth_strategy = enable_auth_strategy
|
|
82
86
|
self._needs_architect_review: bool = False
|
|
83
87
|
self._change_type: str = "unknown"
|
|
84
88
|
self._crew: Any = None
|
|
85
89
|
self._crew_available = False
|
|
90
|
+
self._auth_mode_used: str | None = None
|
|
86
91
|
|
|
87
92
|
# Dynamically configure stages based on crew setting
|
|
88
93
|
if use_crew:
|
|
@@ -296,6 +301,56 @@ class CodeReviewWorkflow(BaseWorkflow):
|
|
|
296
301
|
# Mark as project-level review
|
|
297
302
|
input_data["is_project_review"] = True
|
|
298
303
|
|
|
304
|
+
# === AUTH STRATEGY INTEGRATION ===
|
|
305
|
+
if self.enable_auth_strategy:
|
|
306
|
+
try:
|
|
307
|
+
import logging
|
|
308
|
+
from pathlib import Path
|
|
309
|
+
|
|
310
|
+
from empathy_os.models import (
|
|
311
|
+
count_lines_of_code,
|
|
312
|
+
get_auth_strategy,
|
|
313
|
+
get_module_size_category,
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
logger = logging.getLogger(__name__)
|
|
317
|
+
|
|
318
|
+
# Calculate module size (for file) or total LOC (for directory)
|
|
319
|
+
target_path = target or diff
|
|
320
|
+
total_lines = 0
|
|
321
|
+
if target_path:
|
|
322
|
+
target_obj = Path(target_path)
|
|
323
|
+
if target_obj.exists():
|
|
324
|
+
if target_obj.is_file():
|
|
325
|
+
total_lines = count_lines_of_code(target_obj)
|
|
326
|
+
elif target_obj.is_dir():
|
|
327
|
+
for py_file in target_obj.rglob("*.py"):
|
|
328
|
+
try:
|
|
329
|
+
total_lines += count_lines_of_code(py_file)
|
|
330
|
+
except Exception:
|
|
331
|
+
pass
|
|
332
|
+
|
|
333
|
+
if total_lines > 0:
|
|
334
|
+
strategy = get_auth_strategy()
|
|
335
|
+
recommended_mode = strategy.get_recommended_mode(total_lines)
|
|
336
|
+
self._auth_mode_used = recommended_mode.value
|
|
337
|
+
|
|
338
|
+
size_category = get_module_size_category(total_lines)
|
|
339
|
+
logger.info(
|
|
340
|
+
f"Code review target: {target_path} ({total_lines:,} LOC, {size_category})"
|
|
341
|
+
)
|
|
342
|
+
logger.info(f"Recommended auth mode: {recommended_mode.value}")
|
|
343
|
+
|
|
344
|
+
cost_estimate = strategy.estimate_cost(total_lines, recommended_mode)
|
|
345
|
+
if recommended_mode.value == "subscription":
|
|
346
|
+
logger.info(f"Cost: {cost_estimate['quota_cost']}")
|
|
347
|
+
else:
|
|
348
|
+
logger.info(f"Cost: ~${cost_estimate['monetary_cost']:.4f}")
|
|
349
|
+
|
|
350
|
+
except Exception as e:
|
|
351
|
+
logger = logging.getLogger(__name__)
|
|
352
|
+
logger.warning(f"Auth strategy detection failed: {e}")
|
|
353
|
+
|
|
299
354
|
system = """You are a code review classifier. Analyze the code and classify:
|
|
300
355
|
1. Change type: bug_fix, feature, refactor, docs, test, config, or security
|
|
301
356
|
2. Complexity: low, medium, high
|
|
@@ -590,28 +645,42 @@ Code to review:
|
|
|
590
645
|
"Code will proceed to architectural review."
|
|
591
646
|
)
|
|
592
647
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
648
|
+
# Determine preliminary verdict based on scan
|
|
649
|
+
if has_critical:
|
|
650
|
+
preliminary_verdict = "request_changes"
|
|
651
|
+
elif security_score >= 90:
|
|
652
|
+
preliminary_verdict = "approve"
|
|
653
|
+
else:
|
|
654
|
+
preliminary_verdict = "approve_with_suggestions"
|
|
655
|
+
|
|
656
|
+
result = {
|
|
657
|
+
"scan_results": response,
|
|
658
|
+
"findings": all_findings, # NEW: structured findings for UI
|
|
659
|
+
"summary": summary, # NEW: summary statistics
|
|
660
|
+
"security_findings": security_findings, # Keep for backward compat
|
|
661
|
+
"bug_patterns": [],
|
|
662
|
+
"quality_issues": [],
|
|
663
|
+
"has_critical_issues": has_critical,
|
|
664
|
+
"security_score": 70 if has_critical else 90,
|
|
665
|
+
"verdict": preliminary_verdict, # Add verdict for when architect_review is skipped
|
|
666
|
+
"needs_architect_review": input_data.get("needs_architect_review", False)
|
|
667
|
+
or has_critical,
|
|
668
|
+
"code_to_review": code_to_review,
|
|
669
|
+
"classification": classification,
|
|
670
|
+
"external_audit_included": external_audit is not None,
|
|
671
|
+
"external_audit_risk_score": (
|
|
672
|
+
external_audit.get("risk_score", 0) if external_audit else 0
|
|
673
|
+
),
|
|
674
|
+
"auth_mode_used": self._auth_mode_used, # Track auth mode
|
|
675
|
+
"model_tier_used": tier.value, # Track model tier
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
# Generate formatted report (for when architect_review is skipped)
|
|
679
|
+
formatted_report = format_code_review_report(result, input_data)
|
|
680
|
+
result["formatted_report"] = formatted_report
|
|
681
|
+
result["display_output"] = formatted_report
|
|
682
|
+
|
|
683
|
+
return (result, input_tokens, output_tokens)
|
|
615
684
|
|
|
616
685
|
def _merge_external_audit(
|
|
617
686
|
self,
|
|
@@ -796,6 +865,7 @@ Provide actionable, specific feedback."""
|
|
|
796
865
|
"verdict": verdict,
|
|
797
866
|
"recommendations": [],
|
|
798
867
|
"model_tier_used": tier.value,
|
|
868
|
+
"auth_mode_used": self._auth_mode_used,
|
|
799
869
|
}
|
|
800
870
|
|
|
801
871
|
# Merge parsed XML data if available
|